From 7a7e0748e3ad6d178f5a351bbb5c8ed896f7f833 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Mon, 3 Jul 2023 18:36:35 -0400 Subject: [PATCH] feat: upgrade to TypeScript 5.1.6 (#19695) Integrates https://github.com/denoland/TypeScript/pull/7 --- cli/build.rs | 2 +- cli/tests/integration/lsp_tests.rs | 2 +- .../run/check_js_points_to_ts/test.js.out | 2 +- cli/tests/unit/version_test.ts | 2 +- cli/tsc/00_typescript.js | 41480 ++++++++-------- cli/tsc/dts/lib.dom.d.ts | 11667 ++++- cli/tsc/dts/lib.dom.iterable.d.ts | 113 +- cli/tsc/dts/lib.es2015.collection.d.ts | 2 +- cli/tsc/dts/lib.es2015.core.d.ts | 4 +- cli/tsc/dts/lib.es2020.bigint.d.ts | 8 +- cli/tsc/dts/lib.es2022.intl.d.ts | 9 + cli/tsc/dts/lib.es5.d.ts | 97 +- cli/tsc/dts/lib.webworker.d.ts | 3551 +- cli/tsc/dts/lib.webworker.iterable.d.ts | 101 +- cli/tsc/dts/typescript.d.ts | 953 +- 15 files changed, 36209 insertions(+), 21784 deletions(-) diff --git a/cli/build.rs b/cli/build.rs index 3e74a3ff30..9238096fe9 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -468,7 +468,7 @@ fn main() { ); let ts_version = ts::version(); - debug_assert_eq!(ts_version, "5.0.4"); // bump this assertion when it changes + debug_assert_eq!(ts_version, "5.1.6"); // bump this assertion when it changes println!("cargo:rustc-env=TS_VERSION={}", ts_version); println!("cargo:rerun-if-env-changed=TS_VERSION"); diff --git a/cli/tests/integration/lsp_tests.rs b/cli/tests/integration/lsp_tests.rs index b4339679f5..9135698b2f 100644 --- a/cli/tests/integration/lsp_tests.rs +++ b/cli/tests/integration/lsp_tests.rs @@ -4788,7 +4788,7 @@ fn lsp_completions_auto_import() { "source": "./b.ts", "data": { "exportName": "foo", - "exportMapKey": "foo|6893|file:///a/b", + "exportMapKey": "foo|6768|file:///a/b", "moduleSpecifier": "./b.ts", "fileName": "file:///a/b.ts" }, diff --git a/cli/tests/testdata/run/check_js_points_to_ts/test.js.out b/cli/tests/testdata/run/check_js_points_to_ts/test.js.out index c052a7c3d9..67cda9a65b 100644 --- a/cli/tests/testdata/run/check_js_points_to_ts/test.js.out +++ b/cli/tests/testdata/run/check_js_points_to_ts/test.js.out @@ -1,4 +1,4 @@ error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. return 42; - ~~~~~~~~~~ + ~~~~~~ at [WILDCARD] diff --git a/cli/tests/unit/version_test.ts b/cli/tests/unit/version_test.ts index 222aeeb851..d5fa9ad667 100644 --- a/cli/tests/unit/version_test.ts +++ b/cli/tests/unit/version_test.ts @@ -6,5 +6,5 @@ Deno.test(function version() { const pattern = /^\d+\.\d+\.\d+/; assert(pattern.test(Deno.version.deno)); assert(pattern.test(Deno.version.v8)); - assertEquals(Deno.version.typescript, "5.0.4"); + assertEquals(Deno.version.typescript, "5.1.6"); }); diff --git a/cli/tsc/00_typescript.js b/cli/tsc/00_typescript.js index a477f09d9e..7ecdddc5d8 100644 --- a/cli/tsc/00_typescript.js +++ b/cli/tsc/00_typescript.js @@ -34,8 +34,8 @@ var ts = (() => { var init_corePublic = __esm({ "src/compiler/corePublic.ts"() { "use strict"; - versionMajorMinor = "5.0"; - version = "5.0.4"; + versionMajorMinor = "5.1"; + version = "5.1.6"; Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -136,7 +136,7 @@ var ts = (() => { function find(array, predicate, startIndex) { if (array === void 0) return void 0; - for (let i = startIndex != null ? startIndex : 0; i < array.length; i++) { + for (let i = startIndex ?? 0; i < array.length; i++) { const value = array[i]; if (predicate(value, i)) { return value; @@ -147,7 +147,7 @@ var ts = (() => { function findLast(array, predicate, startIndex) { if (array === void 0) return void 0; - for (let i = startIndex != null ? startIndex : array.length - 1; i >= 0; i--) { + for (let i = startIndex ?? array.length - 1; i >= 0; i--) { const value = array[i]; if (predicate(value, i)) { return value; @@ -158,7 +158,7 @@ var ts = (() => { function findIndex(array, predicate, startIndex) { if (array === void 0) return -1; - for (let i = startIndex != null ? startIndex : 0; i < array.length; i++) { + for (let i = startIndex ?? 0; i < array.length; i++) { if (predicate(array[i], i)) { return i; } @@ -168,7 +168,7 @@ var ts = (() => { function findLastIndex(array, predicate, startIndex) { if (array === void 0) return -1; - for (let i = startIndex != null ? startIndex : array.length - 1; i >= 0; i--) { + for (let i = startIndex ?? array.length - 1; i >= 0; i--) { if (predicate(array[i], i)) { return i; } @@ -932,12 +932,11 @@ var ts = (() => { return arrayFrom(arrayToMultiMap(values, getGroupId).values(), resultSelector); } function groupBy(values, keySelector) { - var _a2; const result = {}; if (values) { for (const value of values) { const key = `${keySelector(value)}`; - const array = (_a2 = result[key]) != null ? _a2 : result[key] = []; + const array = result[key] ?? (result[key] = []); array.push(value); } } @@ -1000,9 +999,6 @@ var ts = (() => { } } } - function createUnderscoreEscapedMultiMap() { - return createMultiMap(); - } function createQueue(items) { const elements = (items == null ? void 0 : items.slice()) || []; let headIndex = 0; @@ -1623,9 +1619,9 @@ var ts = (() => { return s.slice(0, end + 1); } function isNodeLikeSystem() { - return typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object"; + return typeof process !== "undefined" && !!process.nextTick && !process.browser && typeof module === "object"; } - var emptyArray, emptyMap, emptySet, SortKind, elementAt, hasOwnProperty, noopPush, fileNameLowerCaseRegExp, AssertionLevel, createUIStringComparer, uiComparerCaseSensitive, uiLocale, trimString, trimStringEnd, trimStringStart; + var emptyArray, emptyMap, emptySet, SortKind, elementAt, hasOwnProperty, fileNameLowerCaseRegExp, AssertionLevel, createUIStringComparer, uiComparerCaseSensitive, uiLocale, trimString, trimStringEnd, trimStringStart; var init_core = __esm({ "src/compiler/core.ts"() { "use strict"; @@ -1650,10 +1646,6 @@ var ts = (() => { return void 0; }; hasOwnProperty = Object.prototype.hasOwnProperty; - noopPush = { - push: noop, - length: 0 - }; fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g; AssertionLevel = /* @__PURE__ */ ((AssertionLevel2) => { AssertionLevel2[AssertionLevel2["None"] = 0] = "None"; @@ -2267,8 +2259,8 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`, return formatSignatureFlags(this.flags); } }, __debugSignatureToString: { value() { - var _a2; - return (_a2 = this.checker) == null ? void 0 : _a2.signatureToString(this); + var _a; + return (_a = this.checker) == null ? void 0 : _a.signatureToString(this); } } }); const nodeConstructors = [ @@ -2338,11 +2330,11 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`, Debug2.formatVariance = formatVariance; class DebugTypeMapper { __debugToString() { - var _a2; + var _a; type(this); switch (this.kind) { case 3 /* Function */: - return ((_a2 = this.debugInfo) == null ? void 0 : _a2.call(this)) || "(function mapper)"; + return ((_a = this.debugInfo) == null ? void 0 : _a.call(this)) || "(function mapper)"; case 0 /* Simple */: return `${this.source.__debugTypeToString()} -> ${this.target.__debugTypeToString()}`; case 1 /* Array */: @@ -3060,41 +3052,8 @@ ${lanes.join("\n")} function tryGetNodePerformanceHooks() { if (isNodeLikeSystem()) { try { - let performance2; - const { performance: nodePerformance, PerformanceObserver: PerformanceObserver2 } = require("perf_hooks"); - if (hasRequiredAPI(nodePerformance, PerformanceObserver2)) { - performance2 = nodePerformance; - const version2 = new Version(process.versions.node); - const range = new VersionRange("<12.16.3 || 13 <13.13"); - if (range.test(version2)) { - performance2 = { - get timeOrigin() { - return nodePerformance.timeOrigin; - }, - now() { - return nodePerformance.now(); - }, - mark(name) { - return nodePerformance.mark(name); - }, - measure(name, start = "nodeStart", end) { - if (end === void 0) { - end = "__performance.measure-fix__"; - nodePerformance.mark(end); - } - nodePerformance.measure(name, start, end); - if (end === "__performance.measure-fix__") { - nodePerformance.clearMarks("__performance.measure-fix__"); - } - }, - clearMarks(name) { - return nodePerformance.clearMarks(name); - }, - clearMeasures(name) { - return nodePerformance.clearMeasures(name); - } - }; - } + const { performance: performance2, PerformanceObserver: PerformanceObserver2 } = require("perf_hooks"); + if (hasRequiredAPI(performance2, PerformanceObserver2)) { return { // By default, only write native events when generating a cpu profile or using the v8 profiler. shouldWriteNativeEvents: false, @@ -3102,7 +3061,7 @@ ${lanes.join("\n")} PerformanceObserver: PerformanceObserver2 }; } - } catch (e) { + } catch { } } } @@ -3121,40 +3080,17 @@ ${lanes.join("\n")} }); // src/compiler/perfLogger.ts - var nullLogger, etwModule, _a, perfLogger; + var etwModule, perfLogger; var init_perfLogger = __esm({ "src/compiler/perfLogger.ts"() { "use strict"; - init_ts2(); - nullLogger = { - logEvent: noop, - logErrEvent: noop, - logPerfEvent: noop, - logInfoEvent: noop, - logStartCommand: noop, - logStopCommand: noop, - logStartUpdateProgram: noop, - logStopUpdateProgram: noop, - logStartUpdateGraph: noop, - logStopUpdateGraph: noop, - logStartResolveModule: noop, - logStopResolveModule: noop, - logStartParseSourceFile: noop, - logStopParseSourceFile: noop, - logStartReadFile: noop, - logStopReadFile: noop, - logStartBindFile: noop, - logStopBindFile: noop, - logStartScheduledOperation: noop, - logStopScheduledOperation: noop - }; try { - const etwModulePath = (_a = process.env.TS_ETW_MODULE_PATH) != null ? _a : "./node_modules/@microsoft/typescript-etw"; + const etwModulePath = process.env.TS_ETW_MODULE_PATH ?? "./node_modules/@microsoft/typescript-etw"; etwModule = require(etwModulePath); } catch (e) { etwModule = void 0; } - perfLogger = (etwModule == null ? void 0 : etwModule.logEvent) ? etwModule : nullLogger; + perfLogger = (etwModule == null ? void 0 : etwModule.logEvent) ? etwModule : void 0; } }); @@ -3183,9 +3119,8 @@ ${lanes.join("\n")} } } function mark(markName) { - var _a2; if (enabled) { - const count = (_a2 = counts.get(markName)) != null ? _a2 : 0; + const count = counts.get(markName) ?? 0; counts.set(markName, count + 1); marks.set(markName, timestamp()); performanceImpl == null ? void 0 : performanceImpl.mark(markName); @@ -3195,10 +3130,9 @@ ${lanes.join("\n")} } } function measure(measureName, startMarkName, endMarkName) { - var _a2, _b; if (enabled) { - const end = (_a2 = endMarkName !== void 0 ? marks.get(endMarkName) : void 0) != null ? _a2 : timestamp(); - const start = (_b = startMarkName !== void 0 ? marks.get(startMarkName) : void 0) != null ? _b : timeorigin; + const end = (endMarkName !== void 0 ? marks.get(endMarkName) : void 0) ?? timestamp(); + const start = (startMarkName !== void 0 ? marks.get(startMarkName) : void 0) ?? timeorigin; const previousDuration = durations.get(measureName) || 0; durations.set(measureName, previousDuration + (end - start)); performanceImpl == null ? void 0 : performanceImpl.measure(measureName, startMarkName, endMarkName); @@ -3237,13 +3171,13 @@ ${lanes.join("\n")} return enabled; } function enable(system = sys) { - var _a2; + var _a; if (!enabled) { enabled = true; perfHooks || (perfHooks = tryGetNativePerformanceHooks()); if (perfHooks) { timeorigin = perfHooks.performance.timeOrigin; - if (perfHooks.shouldWriteNativeEvents || ((_a2 = system == null ? void 0 : system.cpuProfilingEnabled) == null ? void 0 : _a2.call(system)) || (system == null ? void 0 : system.debugMode)) { + if (perfHooks.shouldWriteNativeEvents || ((_a = system == null ? void 0 : system.cpuProfilingEnabled) == null ? void 0 : _a.call(system)) || (system == null ? void 0 : system.debugMode)) { performanceImpl = perfHooks.performance; } } @@ -3456,7 +3390,7 @@ ${lanes.join("\n")} } } function dumpTypes(types) { - var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v; + var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s; mark("beginDumpTypes"); const typesPath = legend[legend.length - 1].typesPath; const typesFd = fs.openSync(typesPath, "w"); @@ -3466,12 +3400,12 @@ ${lanes.join("\n")} for (let i = 0; i < numTypes; i++) { const type = types[i]; const objectFlags = type.objectFlags; - const symbol = (_a2 = type.aliasSymbol) != null ? _a2 : type.symbol; + const symbol = type.aliasSymbol ?? type.symbol; let display; if (objectFlags & 16 /* Anonymous */ | type.flags & 2944 /* Literal */) { try { - display = (_b = type.checker) == null ? void 0 : _b.typeToString(type); - } catch (e) { + display = (_a = type.checker) == null ? void 0 : _a.typeToString(type); + } catch { display = void 0; } } @@ -3479,16 +3413,16 @@ ${lanes.join("\n")} if (type.flags & 8388608 /* IndexedAccess */) { const indexedAccessType = type; indexedAccessProperties = { - indexedAccessObjectType: (_c = indexedAccessType.objectType) == null ? void 0 : _c.id, - indexedAccessIndexType: (_d = indexedAccessType.indexType) == null ? void 0 : _d.id + indexedAccessObjectType: (_b = indexedAccessType.objectType) == null ? void 0 : _b.id, + indexedAccessIndexType: (_c = indexedAccessType.indexType) == null ? void 0 : _c.id }; } let referenceProperties = {}; if (objectFlags & 4 /* Reference */) { const referenceType = type; referenceProperties = { - instantiatedType: (_e = referenceType.target) == null ? void 0 : _e.id, - typeArguments: (_f = referenceType.resolvedTypeArguments) == null ? void 0 : _f.map((t) => t.id), + instantiatedType: (_d = referenceType.target) == null ? void 0 : _d.id, + typeArguments: (_e = referenceType.resolvedTypeArguments) == null ? void 0 : _e.map((t) => t.id), referenceLocation: getLocation(referenceType.node) }; } @@ -3496,27 +3430,27 @@ ${lanes.join("\n")} if (type.flags & 16777216 /* Conditional */) { const conditionalType = type; conditionalProperties = { - conditionalCheckType: (_g = conditionalType.checkType) == null ? void 0 : _g.id, - conditionalExtendsType: (_h = conditionalType.extendsType) == null ? void 0 : _h.id, - conditionalTrueType: (_j = (_i = conditionalType.resolvedTrueType) == null ? void 0 : _i.id) != null ? _j : -1, - conditionalFalseType: (_l = (_k = conditionalType.resolvedFalseType) == null ? void 0 : _k.id) != null ? _l : -1 + conditionalCheckType: (_f = conditionalType.checkType) == null ? void 0 : _f.id, + conditionalExtendsType: (_g = conditionalType.extendsType) == null ? void 0 : _g.id, + conditionalTrueType: ((_h = conditionalType.resolvedTrueType) == null ? void 0 : _h.id) ?? -1, + conditionalFalseType: ((_i = conditionalType.resolvedFalseType) == null ? void 0 : _i.id) ?? -1 }; } let substitutionProperties = {}; if (type.flags & 33554432 /* Substitution */) { const substitutionType = type; substitutionProperties = { - substitutionBaseType: (_m = substitutionType.baseType) == null ? void 0 : _m.id, - constraintType: (_n = substitutionType.constraint) == null ? void 0 : _n.id + substitutionBaseType: (_j = substitutionType.baseType) == null ? void 0 : _j.id, + constraintType: (_k = substitutionType.constraint) == null ? void 0 : _k.id }; } let reverseMappedProperties = {}; if (objectFlags & 1024 /* ReverseMapped */) { const reverseMappedType = type; reverseMappedProperties = { - reverseMappedSourceType: (_o = reverseMappedType.source) == null ? void 0 : _o.id, - reverseMappedMappedType: (_p = reverseMappedType.mappedType) == null ? void 0 : _p.id, - reverseMappedConstraintType: (_q = reverseMappedType.constraintType) == null ? void 0 : _q.id + reverseMappedSourceType: (_l = reverseMappedType.source) == null ? void 0 : _l.id, + reverseMappedMappedType: (_m = reverseMappedType.mappedType) == null ? void 0 : _m.id, + reverseMappedConstraintType: (_n = reverseMappedType.constraintType) == null ? void 0 : _n.id }; } let evolvingArrayProperties = {}; @@ -3524,7 +3458,7 @@ ${lanes.join("\n")} const evolvingArrayType = type; evolvingArrayProperties = { evolvingArrayElementType: evolvingArrayType.elementType.id, - evolvingArrayFinalType: (_r = evolvingArrayType.finalArrayType) == null ? void 0 : _r.id + evolvingArrayFinalType: (_o = evolvingArrayType.finalArrayType) == null ? void 0 : _o.id }; } let recursionToken; @@ -3542,10 +3476,10 @@ ${lanes.join("\n")} symbolName: (symbol == null ? void 0 : symbol.escapedName) && unescapeLeadingUnderscores(symbol.escapedName), recursionId: recursionToken, isTuple: objectFlags & 8 /* Tuple */ ? true : void 0, - unionTypes: type.flags & 1048576 /* Union */ ? (_s = type.types) == null ? void 0 : _s.map((t) => t.id) : void 0, + unionTypes: type.flags & 1048576 /* Union */ ? (_p = type.types) == null ? void 0 : _p.map((t) => t.id) : void 0, intersectionTypes: type.flags & 2097152 /* Intersection */ ? type.types.map((t) => t.id) : void 0, - aliasTypeArguments: (_t = type.aliasTypeArguments) == null ? void 0 : _t.map((t) => t.id), - keyofType: type.flags & 4194304 /* Index */ ? (_u = type.type) == null ? void 0 : _u.id : void 0, + aliasTypeArguments: (_q = type.aliasTypeArguments) == null ? void 0 : _q.map((t) => t.id), + keyofType: type.flags & 4194304 /* Index */ ? (_r = type.type) == null ? void 0 : _r.id : void 0, ...indexedAccessProperties, ...referenceProperties, ...conditionalProperties, @@ -3553,7 +3487,7 @@ ${lanes.join("\n")} ...reverseMappedProperties, ...evolvingArrayProperties, destructuringPattern: getLocation(type.pattern), - firstDeclaration: getLocation((_v = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _v[0]), + firstDeclaration: getLocation((_s = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _s[0]), flags: Debug.formatTypeFlags(type.flags).split("|"), display }; @@ -3585,7 +3519,7 @@ ${lanes.join("\n")} const name = DiagnosticCategory[d.category]; return lowerCase ? name.toLowerCase() : name; } - var SyntaxKind, NodeFlags, ModifierFlags, JsxFlags, RelationComparisonResult, GeneratedIdentifierFlags, TokenFlags, FlowFlags, CommentDirectiveType, OperationCanceledException, FileIncludeKind, FilePreprocessingDiagnosticsKind, EmitOnly, StructureIsReused, ExitStatus, MemberOverrideStatus, UnionReduction, ContextFlags, NodeBuilderFlags, TypeFormatFlags, SymbolFormatFlags, SymbolAccessibility, SyntheticSymbolKind, TypePredicateKind, TypeReferenceSerializationKind, SymbolFlags, EnumKind, CheckFlags, InternalSymbolName, NodeCheckFlags, TypeFlags, ObjectFlags, VarianceFlags, ElementFlags, AccessFlags, JsxReferenceKind, SignatureKind, SignatureFlags, IndexKind, TypeMapKind, InferencePriority, InferenceFlags, Ternary, AssignmentDeclarationKind, DiagnosticCategory, ModuleResolutionKind, ModuleDetectionKind, WatchFileKind, WatchDirectoryKind, PollingWatchKind, ModuleKind, JsxEmit, ImportsNotUsedAsValues, NewLineKind, ScriptKind, ScriptTarget, LanguageVariant, WatchDirectoryFlags, CharacterCodes, Extension, TransformFlags, SnippetKind, EmitFlags, InternalEmitFlags, ExternalEmitHelpers, EmitHint, OuterExpressionKinds, LexicalEnvironmentFlags, BundleFileSectionKind, ListFormat, PragmaKindFlags, commentPragmas; + var SyntaxKind, NodeFlags, ModifierFlags, JsxFlags, RelationComparisonResult, GeneratedIdentifierFlags, TokenFlags, FlowFlags, CommentDirectiveType, OperationCanceledException, FileIncludeKind, FilePreprocessingDiagnosticsKind, EmitOnly, StructureIsReused, ExitStatus, MemberOverrideStatus, UnionReduction, ContextFlags, NodeBuilderFlags, TypeFormatFlags, SymbolFormatFlags, SymbolAccessibility, SyntheticSymbolKind, TypePredicateKind, TypeReferenceSerializationKind, SymbolFlags, EnumKind, CheckFlags, InternalSymbolName, NodeCheckFlags, TypeFlags, ObjectFlags, VarianceFlags, ElementFlags, AccessFlags, IndexFlags, JsxReferenceKind, SignatureKind, SignatureFlags, IndexKind, TypeMapKind, InferencePriority, InferenceFlags, Ternary, AssignmentDeclarationKind, DiagnosticCategory, ModuleResolutionKind, ModuleDetectionKind, WatchFileKind, WatchDirectoryKind, PollingWatchKind, ModuleKind, JsxEmit, ImportsNotUsedAsValues, NewLineKind, ScriptKind, ScriptTarget, LanguageVariant, WatchDirectoryFlags, CharacterCodes, Extension, TransformFlags, SnippetKind, EmitFlags, InternalEmitFlags, ExternalEmitHelpers, EmitHint, OuterExpressionKinds, LexicalEnvironmentFlags, BundleFileSectionKind, ListFormat, PragmaKindFlags, commentPragmas; var init_types = __esm({ "src/compiler/types.ts"() { "use strict"; @@ -3598,394 +3532,395 @@ ${lanes.join("\n")} SyntaxKind5[SyntaxKind5["WhitespaceTrivia"] = 5] = "WhitespaceTrivia"; SyntaxKind5[SyntaxKind5["ShebangTrivia"] = 6] = "ShebangTrivia"; SyntaxKind5[SyntaxKind5["ConflictMarkerTrivia"] = 7] = "ConflictMarkerTrivia"; - SyntaxKind5[SyntaxKind5["NumericLiteral"] = 8] = "NumericLiteral"; - SyntaxKind5[SyntaxKind5["BigIntLiteral"] = 9] = "BigIntLiteral"; - SyntaxKind5[SyntaxKind5["StringLiteral"] = 10] = "StringLiteral"; - SyntaxKind5[SyntaxKind5["JsxText"] = 11] = "JsxText"; - SyntaxKind5[SyntaxKind5["JsxTextAllWhiteSpaces"] = 12] = "JsxTextAllWhiteSpaces"; - SyntaxKind5[SyntaxKind5["RegularExpressionLiteral"] = 13] = "RegularExpressionLiteral"; - SyntaxKind5[SyntaxKind5["NoSubstitutionTemplateLiteral"] = 14] = "NoSubstitutionTemplateLiteral"; - SyntaxKind5[SyntaxKind5["TemplateHead"] = 15] = "TemplateHead"; - SyntaxKind5[SyntaxKind5["TemplateMiddle"] = 16] = "TemplateMiddle"; - SyntaxKind5[SyntaxKind5["TemplateTail"] = 17] = "TemplateTail"; - SyntaxKind5[SyntaxKind5["OpenBraceToken"] = 18] = "OpenBraceToken"; - SyntaxKind5[SyntaxKind5["CloseBraceToken"] = 19] = "CloseBraceToken"; - SyntaxKind5[SyntaxKind5["OpenParenToken"] = 20] = "OpenParenToken"; - SyntaxKind5[SyntaxKind5["CloseParenToken"] = 21] = "CloseParenToken"; - SyntaxKind5[SyntaxKind5["OpenBracketToken"] = 22] = "OpenBracketToken"; - SyntaxKind5[SyntaxKind5["CloseBracketToken"] = 23] = "CloseBracketToken"; - SyntaxKind5[SyntaxKind5["DotToken"] = 24] = "DotToken"; - SyntaxKind5[SyntaxKind5["DotDotDotToken"] = 25] = "DotDotDotToken"; - SyntaxKind5[SyntaxKind5["SemicolonToken"] = 26] = "SemicolonToken"; - SyntaxKind5[SyntaxKind5["CommaToken"] = 27] = "CommaToken"; - SyntaxKind5[SyntaxKind5["QuestionDotToken"] = 28] = "QuestionDotToken"; - SyntaxKind5[SyntaxKind5["LessThanToken"] = 29] = "LessThanToken"; - SyntaxKind5[SyntaxKind5["LessThanSlashToken"] = 30] = "LessThanSlashToken"; - SyntaxKind5[SyntaxKind5["GreaterThanToken"] = 31] = "GreaterThanToken"; - SyntaxKind5[SyntaxKind5["LessThanEqualsToken"] = 32] = "LessThanEqualsToken"; - SyntaxKind5[SyntaxKind5["GreaterThanEqualsToken"] = 33] = "GreaterThanEqualsToken"; - SyntaxKind5[SyntaxKind5["EqualsEqualsToken"] = 34] = "EqualsEqualsToken"; - SyntaxKind5[SyntaxKind5["ExclamationEqualsToken"] = 35] = "ExclamationEqualsToken"; - SyntaxKind5[SyntaxKind5["EqualsEqualsEqualsToken"] = 36] = "EqualsEqualsEqualsToken"; - SyntaxKind5[SyntaxKind5["ExclamationEqualsEqualsToken"] = 37] = "ExclamationEqualsEqualsToken"; - SyntaxKind5[SyntaxKind5["EqualsGreaterThanToken"] = 38] = "EqualsGreaterThanToken"; - SyntaxKind5[SyntaxKind5["PlusToken"] = 39] = "PlusToken"; - SyntaxKind5[SyntaxKind5["MinusToken"] = 40] = "MinusToken"; - SyntaxKind5[SyntaxKind5["AsteriskToken"] = 41] = "AsteriskToken"; - SyntaxKind5[SyntaxKind5["AsteriskAsteriskToken"] = 42] = "AsteriskAsteriskToken"; - SyntaxKind5[SyntaxKind5["SlashToken"] = 43] = "SlashToken"; - SyntaxKind5[SyntaxKind5["PercentToken"] = 44] = "PercentToken"; - SyntaxKind5[SyntaxKind5["PlusPlusToken"] = 45] = "PlusPlusToken"; - SyntaxKind5[SyntaxKind5["MinusMinusToken"] = 46] = "MinusMinusToken"; - SyntaxKind5[SyntaxKind5["LessThanLessThanToken"] = 47] = "LessThanLessThanToken"; - SyntaxKind5[SyntaxKind5["GreaterThanGreaterThanToken"] = 48] = "GreaterThanGreaterThanToken"; - SyntaxKind5[SyntaxKind5["GreaterThanGreaterThanGreaterThanToken"] = 49] = "GreaterThanGreaterThanGreaterThanToken"; - SyntaxKind5[SyntaxKind5["AmpersandToken"] = 50] = "AmpersandToken"; - SyntaxKind5[SyntaxKind5["BarToken"] = 51] = "BarToken"; - SyntaxKind5[SyntaxKind5["CaretToken"] = 52] = "CaretToken"; - SyntaxKind5[SyntaxKind5["ExclamationToken"] = 53] = "ExclamationToken"; - SyntaxKind5[SyntaxKind5["TildeToken"] = 54] = "TildeToken"; - SyntaxKind5[SyntaxKind5["AmpersandAmpersandToken"] = 55] = "AmpersandAmpersandToken"; - SyntaxKind5[SyntaxKind5["BarBarToken"] = 56] = "BarBarToken"; - SyntaxKind5[SyntaxKind5["QuestionToken"] = 57] = "QuestionToken"; - SyntaxKind5[SyntaxKind5["ColonToken"] = 58] = "ColonToken"; - SyntaxKind5[SyntaxKind5["AtToken"] = 59] = "AtToken"; - SyntaxKind5[SyntaxKind5["QuestionQuestionToken"] = 60] = "QuestionQuestionToken"; - SyntaxKind5[SyntaxKind5["BacktickToken"] = 61] = "BacktickToken"; - SyntaxKind5[SyntaxKind5["HashToken"] = 62] = "HashToken"; - SyntaxKind5[SyntaxKind5["EqualsToken"] = 63] = "EqualsToken"; - SyntaxKind5[SyntaxKind5["PlusEqualsToken"] = 64] = "PlusEqualsToken"; - SyntaxKind5[SyntaxKind5["MinusEqualsToken"] = 65] = "MinusEqualsToken"; - SyntaxKind5[SyntaxKind5["AsteriskEqualsToken"] = 66] = "AsteriskEqualsToken"; - SyntaxKind5[SyntaxKind5["AsteriskAsteriskEqualsToken"] = 67] = "AsteriskAsteriskEqualsToken"; - SyntaxKind5[SyntaxKind5["SlashEqualsToken"] = 68] = "SlashEqualsToken"; - SyntaxKind5[SyntaxKind5["PercentEqualsToken"] = 69] = "PercentEqualsToken"; - SyntaxKind5[SyntaxKind5["LessThanLessThanEqualsToken"] = 70] = "LessThanLessThanEqualsToken"; - SyntaxKind5[SyntaxKind5["GreaterThanGreaterThanEqualsToken"] = 71] = "GreaterThanGreaterThanEqualsToken"; - SyntaxKind5[SyntaxKind5["GreaterThanGreaterThanGreaterThanEqualsToken"] = 72] = "GreaterThanGreaterThanGreaterThanEqualsToken"; - SyntaxKind5[SyntaxKind5["AmpersandEqualsToken"] = 73] = "AmpersandEqualsToken"; - SyntaxKind5[SyntaxKind5["BarEqualsToken"] = 74] = "BarEqualsToken"; - SyntaxKind5[SyntaxKind5["BarBarEqualsToken"] = 75] = "BarBarEqualsToken"; - SyntaxKind5[SyntaxKind5["AmpersandAmpersandEqualsToken"] = 76] = "AmpersandAmpersandEqualsToken"; - SyntaxKind5[SyntaxKind5["QuestionQuestionEqualsToken"] = 77] = "QuestionQuestionEqualsToken"; - SyntaxKind5[SyntaxKind5["CaretEqualsToken"] = 78] = "CaretEqualsToken"; - SyntaxKind5[SyntaxKind5["Identifier"] = 79] = "Identifier"; - SyntaxKind5[SyntaxKind5["PrivateIdentifier"] = 80] = "PrivateIdentifier"; - SyntaxKind5[SyntaxKind5["BreakKeyword"] = 81] = "BreakKeyword"; - SyntaxKind5[SyntaxKind5["CaseKeyword"] = 82] = "CaseKeyword"; - SyntaxKind5[SyntaxKind5["CatchKeyword"] = 83] = "CatchKeyword"; - SyntaxKind5[SyntaxKind5["ClassKeyword"] = 84] = "ClassKeyword"; - SyntaxKind5[SyntaxKind5["ConstKeyword"] = 85] = "ConstKeyword"; - SyntaxKind5[SyntaxKind5["ContinueKeyword"] = 86] = "ContinueKeyword"; - SyntaxKind5[SyntaxKind5["DebuggerKeyword"] = 87] = "DebuggerKeyword"; - SyntaxKind5[SyntaxKind5["DefaultKeyword"] = 88] = "DefaultKeyword"; - SyntaxKind5[SyntaxKind5["DeleteKeyword"] = 89] = "DeleteKeyword"; - SyntaxKind5[SyntaxKind5["DoKeyword"] = 90] = "DoKeyword"; - SyntaxKind5[SyntaxKind5["ElseKeyword"] = 91] = "ElseKeyword"; - SyntaxKind5[SyntaxKind5["EnumKeyword"] = 92] = "EnumKeyword"; - SyntaxKind5[SyntaxKind5["ExportKeyword"] = 93] = "ExportKeyword"; - SyntaxKind5[SyntaxKind5["ExtendsKeyword"] = 94] = "ExtendsKeyword"; - SyntaxKind5[SyntaxKind5["FalseKeyword"] = 95] = "FalseKeyword"; - SyntaxKind5[SyntaxKind5["FinallyKeyword"] = 96] = "FinallyKeyword"; - SyntaxKind5[SyntaxKind5["ForKeyword"] = 97] = "ForKeyword"; - SyntaxKind5[SyntaxKind5["FunctionKeyword"] = 98] = "FunctionKeyword"; - SyntaxKind5[SyntaxKind5["IfKeyword"] = 99] = "IfKeyword"; - SyntaxKind5[SyntaxKind5["ImportKeyword"] = 100] = "ImportKeyword"; - SyntaxKind5[SyntaxKind5["InKeyword"] = 101] = "InKeyword"; - SyntaxKind5[SyntaxKind5["InstanceOfKeyword"] = 102] = "InstanceOfKeyword"; - SyntaxKind5[SyntaxKind5["NewKeyword"] = 103] = "NewKeyword"; - SyntaxKind5[SyntaxKind5["NullKeyword"] = 104] = "NullKeyword"; - SyntaxKind5[SyntaxKind5["ReturnKeyword"] = 105] = "ReturnKeyword"; - SyntaxKind5[SyntaxKind5["SuperKeyword"] = 106] = "SuperKeyword"; - SyntaxKind5[SyntaxKind5["SwitchKeyword"] = 107] = "SwitchKeyword"; - SyntaxKind5[SyntaxKind5["ThisKeyword"] = 108] = "ThisKeyword"; - SyntaxKind5[SyntaxKind5["ThrowKeyword"] = 109] = "ThrowKeyword"; - SyntaxKind5[SyntaxKind5["TrueKeyword"] = 110] = "TrueKeyword"; - SyntaxKind5[SyntaxKind5["TryKeyword"] = 111] = "TryKeyword"; - SyntaxKind5[SyntaxKind5["TypeOfKeyword"] = 112] = "TypeOfKeyword"; - SyntaxKind5[SyntaxKind5["VarKeyword"] = 113] = "VarKeyword"; - SyntaxKind5[SyntaxKind5["VoidKeyword"] = 114] = "VoidKeyword"; - SyntaxKind5[SyntaxKind5["WhileKeyword"] = 115] = "WhileKeyword"; - SyntaxKind5[SyntaxKind5["WithKeyword"] = 116] = "WithKeyword"; - SyntaxKind5[SyntaxKind5["ImplementsKeyword"] = 117] = "ImplementsKeyword"; - SyntaxKind5[SyntaxKind5["InterfaceKeyword"] = 118] = "InterfaceKeyword"; - SyntaxKind5[SyntaxKind5["LetKeyword"] = 119] = "LetKeyword"; - SyntaxKind5[SyntaxKind5["PackageKeyword"] = 120] = "PackageKeyword"; - SyntaxKind5[SyntaxKind5["PrivateKeyword"] = 121] = "PrivateKeyword"; - SyntaxKind5[SyntaxKind5["ProtectedKeyword"] = 122] = "ProtectedKeyword"; - SyntaxKind5[SyntaxKind5["PublicKeyword"] = 123] = "PublicKeyword"; - SyntaxKind5[SyntaxKind5["StaticKeyword"] = 124] = "StaticKeyword"; - SyntaxKind5[SyntaxKind5["YieldKeyword"] = 125] = "YieldKeyword"; - SyntaxKind5[SyntaxKind5["AbstractKeyword"] = 126] = "AbstractKeyword"; - SyntaxKind5[SyntaxKind5["AccessorKeyword"] = 127] = "AccessorKeyword"; - SyntaxKind5[SyntaxKind5["AsKeyword"] = 128] = "AsKeyword"; - SyntaxKind5[SyntaxKind5["AssertsKeyword"] = 129] = "AssertsKeyword"; - SyntaxKind5[SyntaxKind5["AssertKeyword"] = 130] = "AssertKeyword"; - SyntaxKind5[SyntaxKind5["AnyKeyword"] = 131] = "AnyKeyword"; - SyntaxKind5[SyntaxKind5["AsyncKeyword"] = 132] = "AsyncKeyword"; - SyntaxKind5[SyntaxKind5["AwaitKeyword"] = 133] = "AwaitKeyword"; - SyntaxKind5[SyntaxKind5["BooleanKeyword"] = 134] = "BooleanKeyword"; - SyntaxKind5[SyntaxKind5["ConstructorKeyword"] = 135] = "ConstructorKeyword"; - SyntaxKind5[SyntaxKind5["DeclareKeyword"] = 136] = "DeclareKeyword"; - SyntaxKind5[SyntaxKind5["GetKeyword"] = 137] = "GetKeyword"; - SyntaxKind5[SyntaxKind5["InferKeyword"] = 138] = "InferKeyword"; - SyntaxKind5[SyntaxKind5["IntrinsicKeyword"] = 139] = "IntrinsicKeyword"; - SyntaxKind5[SyntaxKind5["IsKeyword"] = 140] = "IsKeyword"; - SyntaxKind5[SyntaxKind5["KeyOfKeyword"] = 141] = "KeyOfKeyword"; - SyntaxKind5[SyntaxKind5["ModuleKeyword"] = 142] = "ModuleKeyword"; - SyntaxKind5[SyntaxKind5["NamespaceKeyword"] = 143] = "NamespaceKeyword"; - SyntaxKind5[SyntaxKind5["NeverKeyword"] = 144] = "NeverKeyword"; - SyntaxKind5[SyntaxKind5["OutKeyword"] = 145] = "OutKeyword"; - SyntaxKind5[SyntaxKind5["ReadonlyKeyword"] = 146] = "ReadonlyKeyword"; - SyntaxKind5[SyntaxKind5["RequireKeyword"] = 147] = "RequireKeyword"; - SyntaxKind5[SyntaxKind5["NumberKeyword"] = 148] = "NumberKeyword"; - SyntaxKind5[SyntaxKind5["ObjectKeyword"] = 149] = "ObjectKeyword"; - SyntaxKind5[SyntaxKind5["SatisfiesKeyword"] = 150] = "SatisfiesKeyword"; - SyntaxKind5[SyntaxKind5["SetKeyword"] = 151] = "SetKeyword"; - SyntaxKind5[SyntaxKind5["StringKeyword"] = 152] = "StringKeyword"; - SyntaxKind5[SyntaxKind5["SymbolKeyword"] = 153] = "SymbolKeyword"; - SyntaxKind5[SyntaxKind5["TypeKeyword"] = 154] = "TypeKeyword"; - SyntaxKind5[SyntaxKind5["UndefinedKeyword"] = 155] = "UndefinedKeyword"; - SyntaxKind5[SyntaxKind5["UniqueKeyword"] = 156] = "UniqueKeyword"; - SyntaxKind5[SyntaxKind5["UnknownKeyword"] = 157] = "UnknownKeyword"; - SyntaxKind5[SyntaxKind5["FromKeyword"] = 158] = "FromKeyword"; - SyntaxKind5[SyntaxKind5["GlobalKeyword"] = 159] = "GlobalKeyword"; - SyntaxKind5[SyntaxKind5["BigIntKeyword"] = 160] = "BigIntKeyword"; - SyntaxKind5[SyntaxKind5["OverrideKeyword"] = 161] = "OverrideKeyword"; - SyntaxKind5[SyntaxKind5["OfKeyword"] = 162] = "OfKeyword"; - SyntaxKind5[SyntaxKind5["QualifiedName"] = 163] = "QualifiedName"; - SyntaxKind5[SyntaxKind5["ComputedPropertyName"] = 164] = "ComputedPropertyName"; - SyntaxKind5[SyntaxKind5["TypeParameter"] = 165] = "TypeParameter"; - SyntaxKind5[SyntaxKind5["Parameter"] = 166] = "Parameter"; - SyntaxKind5[SyntaxKind5["Decorator"] = 167] = "Decorator"; - SyntaxKind5[SyntaxKind5["PropertySignature"] = 168] = "PropertySignature"; - SyntaxKind5[SyntaxKind5["PropertyDeclaration"] = 169] = "PropertyDeclaration"; - SyntaxKind5[SyntaxKind5["MethodSignature"] = 170] = "MethodSignature"; - SyntaxKind5[SyntaxKind5["MethodDeclaration"] = 171] = "MethodDeclaration"; - SyntaxKind5[SyntaxKind5["ClassStaticBlockDeclaration"] = 172] = "ClassStaticBlockDeclaration"; - SyntaxKind5[SyntaxKind5["Constructor"] = 173] = "Constructor"; - SyntaxKind5[SyntaxKind5["GetAccessor"] = 174] = "GetAccessor"; - SyntaxKind5[SyntaxKind5["SetAccessor"] = 175] = "SetAccessor"; - SyntaxKind5[SyntaxKind5["CallSignature"] = 176] = "CallSignature"; - SyntaxKind5[SyntaxKind5["ConstructSignature"] = 177] = "ConstructSignature"; - SyntaxKind5[SyntaxKind5["IndexSignature"] = 178] = "IndexSignature"; - SyntaxKind5[SyntaxKind5["TypePredicate"] = 179] = "TypePredicate"; - SyntaxKind5[SyntaxKind5["TypeReference"] = 180] = "TypeReference"; - SyntaxKind5[SyntaxKind5["FunctionType"] = 181] = "FunctionType"; - SyntaxKind5[SyntaxKind5["ConstructorType"] = 182] = "ConstructorType"; - SyntaxKind5[SyntaxKind5["TypeQuery"] = 183] = "TypeQuery"; - SyntaxKind5[SyntaxKind5["TypeLiteral"] = 184] = "TypeLiteral"; - SyntaxKind5[SyntaxKind5["ArrayType"] = 185] = "ArrayType"; - SyntaxKind5[SyntaxKind5["TupleType"] = 186] = "TupleType"; - SyntaxKind5[SyntaxKind5["OptionalType"] = 187] = "OptionalType"; - SyntaxKind5[SyntaxKind5["RestType"] = 188] = "RestType"; - SyntaxKind5[SyntaxKind5["UnionType"] = 189] = "UnionType"; - SyntaxKind5[SyntaxKind5["IntersectionType"] = 190] = "IntersectionType"; - SyntaxKind5[SyntaxKind5["ConditionalType"] = 191] = "ConditionalType"; - SyntaxKind5[SyntaxKind5["InferType"] = 192] = "InferType"; - SyntaxKind5[SyntaxKind5["ParenthesizedType"] = 193] = "ParenthesizedType"; - SyntaxKind5[SyntaxKind5["ThisType"] = 194] = "ThisType"; - SyntaxKind5[SyntaxKind5["TypeOperator"] = 195] = "TypeOperator"; - SyntaxKind5[SyntaxKind5["IndexedAccessType"] = 196] = "IndexedAccessType"; - SyntaxKind5[SyntaxKind5["MappedType"] = 197] = "MappedType"; - SyntaxKind5[SyntaxKind5["LiteralType"] = 198] = "LiteralType"; - SyntaxKind5[SyntaxKind5["NamedTupleMember"] = 199] = "NamedTupleMember"; - SyntaxKind5[SyntaxKind5["TemplateLiteralType"] = 200] = "TemplateLiteralType"; - SyntaxKind5[SyntaxKind5["TemplateLiteralTypeSpan"] = 201] = "TemplateLiteralTypeSpan"; - SyntaxKind5[SyntaxKind5["ImportType"] = 202] = "ImportType"; - SyntaxKind5[SyntaxKind5["ObjectBindingPattern"] = 203] = "ObjectBindingPattern"; - SyntaxKind5[SyntaxKind5["ArrayBindingPattern"] = 204] = "ArrayBindingPattern"; - SyntaxKind5[SyntaxKind5["BindingElement"] = 205] = "BindingElement"; - SyntaxKind5[SyntaxKind5["ArrayLiteralExpression"] = 206] = "ArrayLiteralExpression"; - SyntaxKind5[SyntaxKind5["ObjectLiteralExpression"] = 207] = "ObjectLiteralExpression"; - SyntaxKind5[SyntaxKind5["PropertyAccessExpression"] = 208] = "PropertyAccessExpression"; - SyntaxKind5[SyntaxKind5["ElementAccessExpression"] = 209] = "ElementAccessExpression"; - SyntaxKind5[SyntaxKind5["CallExpression"] = 210] = "CallExpression"; - SyntaxKind5[SyntaxKind5["NewExpression"] = 211] = "NewExpression"; - SyntaxKind5[SyntaxKind5["TaggedTemplateExpression"] = 212] = "TaggedTemplateExpression"; - SyntaxKind5[SyntaxKind5["TypeAssertionExpression"] = 213] = "TypeAssertionExpression"; - SyntaxKind5[SyntaxKind5["ParenthesizedExpression"] = 214] = "ParenthesizedExpression"; - SyntaxKind5[SyntaxKind5["FunctionExpression"] = 215] = "FunctionExpression"; - SyntaxKind5[SyntaxKind5["ArrowFunction"] = 216] = "ArrowFunction"; - SyntaxKind5[SyntaxKind5["DeleteExpression"] = 217] = "DeleteExpression"; - SyntaxKind5[SyntaxKind5["TypeOfExpression"] = 218] = "TypeOfExpression"; - SyntaxKind5[SyntaxKind5["VoidExpression"] = 219] = "VoidExpression"; - SyntaxKind5[SyntaxKind5["AwaitExpression"] = 220] = "AwaitExpression"; - SyntaxKind5[SyntaxKind5["PrefixUnaryExpression"] = 221] = "PrefixUnaryExpression"; - SyntaxKind5[SyntaxKind5["PostfixUnaryExpression"] = 222] = "PostfixUnaryExpression"; - SyntaxKind5[SyntaxKind5["BinaryExpression"] = 223] = "BinaryExpression"; - SyntaxKind5[SyntaxKind5["ConditionalExpression"] = 224] = "ConditionalExpression"; - SyntaxKind5[SyntaxKind5["TemplateExpression"] = 225] = "TemplateExpression"; - SyntaxKind5[SyntaxKind5["YieldExpression"] = 226] = "YieldExpression"; - SyntaxKind5[SyntaxKind5["SpreadElement"] = 227] = "SpreadElement"; - SyntaxKind5[SyntaxKind5["ClassExpression"] = 228] = "ClassExpression"; - SyntaxKind5[SyntaxKind5["OmittedExpression"] = 229] = "OmittedExpression"; - SyntaxKind5[SyntaxKind5["ExpressionWithTypeArguments"] = 230] = "ExpressionWithTypeArguments"; - SyntaxKind5[SyntaxKind5["AsExpression"] = 231] = "AsExpression"; - SyntaxKind5[SyntaxKind5["NonNullExpression"] = 232] = "NonNullExpression"; - SyntaxKind5[SyntaxKind5["MetaProperty"] = 233] = "MetaProperty"; - SyntaxKind5[SyntaxKind5["SyntheticExpression"] = 234] = "SyntheticExpression"; - SyntaxKind5[SyntaxKind5["SatisfiesExpression"] = 235] = "SatisfiesExpression"; - SyntaxKind5[SyntaxKind5["TemplateSpan"] = 236] = "TemplateSpan"; - SyntaxKind5[SyntaxKind5["SemicolonClassElement"] = 237] = "SemicolonClassElement"; - SyntaxKind5[SyntaxKind5["Block"] = 238] = "Block"; - SyntaxKind5[SyntaxKind5["EmptyStatement"] = 239] = "EmptyStatement"; - SyntaxKind5[SyntaxKind5["VariableStatement"] = 240] = "VariableStatement"; - SyntaxKind5[SyntaxKind5["ExpressionStatement"] = 241] = "ExpressionStatement"; - SyntaxKind5[SyntaxKind5["IfStatement"] = 242] = "IfStatement"; - SyntaxKind5[SyntaxKind5["DoStatement"] = 243] = "DoStatement"; - SyntaxKind5[SyntaxKind5["WhileStatement"] = 244] = "WhileStatement"; - SyntaxKind5[SyntaxKind5["ForStatement"] = 245] = "ForStatement"; - SyntaxKind5[SyntaxKind5["ForInStatement"] = 246] = "ForInStatement"; - SyntaxKind5[SyntaxKind5["ForOfStatement"] = 247] = "ForOfStatement"; - SyntaxKind5[SyntaxKind5["ContinueStatement"] = 248] = "ContinueStatement"; - SyntaxKind5[SyntaxKind5["BreakStatement"] = 249] = "BreakStatement"; - SyntaxKind5[SyntaxKind5["ReturnStatement"] = 250] = "ReturnStatement"; - SyntaxKind5[SyntaxKind5["WithStatement"] = 251] = "WithStatement"; - SyntaxKind5[SyntaxKind5["SwitchStatement"] = 252] = "SwitchStatement"; - SyntaxKind5[SyntaxKind5["LabeledStatement"] = 253] = "LabeledStatement"; - SyntaxKind5[SyntaxKind5["ThrowStatement"] = 254] = "ThrowStatement"; - SyntaxKind5[SyntaxKind5["TryStatement"] = 255] = "TryStatement"; - SyntaxKind5[SyntaxKind5["DebuggerStatement"] = 256] = "DebuggerStatement"; - SyntaxKind5[SyntaxKind5["VariableDeclaration"] = 257] = "VariableDeclaration"; - SyntaxKind5[SyntaxKind5["VariableDeclarationList"] = 258] = "VariableDeclarationList"; - SyntaxKind5[SyntaxKind5["FunctionDeclaration"] = 259] = "FunctionDeclaration"; - SyntaxKind5[SyntaxKind5["ClassDeclaration"] = 260] = "ClassDeclaration"; - SyntaxKind5[SyntaxKind5["InterfaceDeclaration"] = 261] = "InterfaceDeclaration"; - SyntaxKind5[SyntaxKind5["TypeAliasDeclaration"] = 262] = "TypeAliasDeclaration"; - SyntaxKind5[SyntaxKind5["EnumDeclaration"] = 263] = "EnumDeclaration"; - SyntaxKind5[SyntaxKind5["ModuleDeclaration"] = 264] = "ModuleDeclaration"; - SyntaxKind5[SyntaxKind5["ModuleBlock"] = 265] = "ModuleBlock"; - SyntaxKind5[SyntaxKind5["CaseBlock"] = 266] = "CaseBlock"; - SyntaxKind5[SyntaxKind5["NamespaceExportDeclaration"] = 267] = "NamespaceExportDeclaration"; - SyntaxKind5[SyntaxKind5["ImportEqualsDeclaration"] = 268] = "ImportEqualsDeclaration"; - SyntaxKind5[SyntaxKind5["ImportDeclaration"] = 269] = "ImportDeclaration"; - SyntaxKind5[SyntaxKind5["ImportClause"] = 270] = "ImportClause"; - SyntaxKind5[SyntaxKind5["NamespaceImport"] = 271] = "NamespaceImport"; - SyntaxKind5[SyntaxKind5["NamedImports"] = 272] = "NamedImports"; - SyntaxKind5[SyntaxKind5["ImportSpecifier"] = 273] = "ImportSpecifier"; - SyntaxKind5[SyntaxKind5["ExportAssignment"] = 274] = "ExportAssignment"; - SyntaxKind5[SyntaxKind5["ExportDeclaration"] = 275] = "ExportDeclaration"; - SyntaxKind5[SyntaxKind5["NamedExports"] = 276] = "NamedExports"; - SyntaxKind5[SyntaxKind5["NamespaceExport"] = 277] = "NamespaceExport"; - SyntaxKind5[SyntaxKind5["ExportSpecifier"] = 278] = "ExportSpecifier"; - SyntaxKind5[SyntaxKind5["MissingDeclaration"] = 279] = "MissingDeclaration"; - SyntaxKind5[SyntaxKind5["ExternalModuleReference"] = 280] = "ExternalModuleReference"; - SyntaxKind5[SyntaxKind5["JsxElement"] = 281] = "JsxElement"; - SyntaxKind5[SyntaxKind5["JsxSelfClosingElement"] = 282] = "JsxSelfClosingElement"; - SyntaxKind5[SyntaxKind5["JsxOpeningElement"] = 283] = "JsxOpeningElement"; - SyntaxKind5[SyntaxKind5["JsxClosingElement"] = 284] = "JsxClosingElement"; - SyntaxKind5[SyntaxKind5["JsxFragment"] = 285] = "JsxFragment"; - SyntaxKind5[SyntaxKind5["JsxOpeningFragment"] = 286] = "JsxOpeningFragment"; - SyntaxKind5[SyntaxKind5["JsxClosingFragment"] = 287] = "JsxClosingFragment"; - SyntaxKind5[SyntaxKind5["JsxAttribute"] = 288] = "JsxAttribute"; - SyntaxKind5[SyntaxKind5["JsxAttributes"] = 289] = "JsxAttributes"; - SyntaxKind5[SyntaxKind5["JsxSpreadAttribute"] = 290] = "JsxSpreadAttribute"; - SyntaxKind5[SyntaxKind5["JsxExpression"] = 291] = "JsxExpression"; - SyntaxKind5[SyntaxKind5["CaseClause"] = 292] = "CaseClause"; - SyntaxKind5[SyntaxKind5["DefaultClause"] = 293] = "DefaultClause"; - SyntaxKind5[SyntaxKind5["HeritageClause"] = 294] = "HeritageClause"; - SyntaxKind5[SyntaxKind5["CatchClause"] = 295] = "CatchClause"; - SyntaxKind5[SyntaxKind5["AssertClause"] = 296] = "AssertClause"; - SyntaxKind5[SyntaxKind5["AssertEntry"] = 297] = "AssertEntry"; - SyntaxKind5[SyntaxKind5["ImportTypeAssertionContainer"] = 298] = "ImportTypeAssertionContainer"; - SyntaxKind5[SyntaxKind5["PropertyAssignment"] = 299] = "PropertyAssignment"; - SyntaxKind5[SyntaxKind5["ShorthandPropertyAssignment"] = 300] = "ShorthandPropertyAssignment"; - SyntaxKind5[SyntaxKind5["SpreadAssignment"] = 301] = "SpreadAssignment"; - SyntaxKind5[SyntaxKind5["EnumMember"] = 302] = "EnumMember"; - SyntaxKind5[SyntaxKind5["UnparsedPrologue"] = 303] = "UnparsedPrologue"; - SyntaxKind5[SyntaxKind5["UnparsedPrepend"] = 304] = "UnparsedPrepend"; - SyntaxKind5[SyntaxKind5["UnparsedText"] = 305] = "UnparsedText"; - SyntaxKind5[SyntaxKind5["UnparsedInternalText"] = 306] = "UnparsedInternalText"; - SyntaxKind5[SyntaxKind5["UnparsedSyntheticReference"] = 307] = "UnparsedSyntheticReference"; - SyntaxKind5[SyntaxKind5["SourceFile"] = 308] = "SourceFile"; - SyntaxKind5[SyntaxKind5["Bundle"] = 309] = "Bundle"; - SyntaxKind5[SyntaxKind5["UnparsedSource"] = 310] = "UnparsedSource"; - SyntaxKind5[SyntaxKind5["InputFiles"] = 311] = "InputFiles"; - SyntaxKind5[SyntaxKind5["JSDocTypeExpression"] = 312] = "JSDocTypeExpression"; - SyntaxKind5[SyntaxKind5["JSDocNameReference"] = 313] = "JSDocNameReference"; - SyntaxKind5[SyntaxKind5["JSDocMemberName"] = 314] = "JSDocMemberName"; - SyntaxKind5[SyntaxKind5["JSDocAllType"] = 315] = "JSDocAllType"; - SyntaxKind5[SyntaxKind5["JSDocUnknownType"] = 316] = "JSDocUnknownType"; - SyntaxKind5[SyntaxKind5["JSDocNullableType"] = 317] = "JSDocNullableType"; - SyntaxKind5[SyntaxKind5["JSDocNonNullableType"] = 318] = "JSDocNonNullableType"; - SyntaxKind5[SyntaxKind5["JSDocOptionalType"] = 319] = "JSDocOptionalType"; - SyntaxKind5[SyntaxKind5["JSDocFunctionType"] = 320] = "JSDocFunctionType"; - SyntaxKind5[SyntaxKind5["JSDocVariadicType"] = 321] = "JSDocVariadicType"; - SyntaxKind5[SyntaxKind5["JSDocNamepathType"] = 322] = "JSDocNamepathType"; - SyntaxKind5[SyntaxKind5["JSDoc"] = 323] = "JSDoc"; - SyntaxKind5[SyntaxKind5["JSDocComment"] = 323 /* JSDoc */] = "JSDocComment"; - SyntaxKind5[SyntaxKind5["JSDocText"] = 324] = "JSDocText"; - SyntaxKind5[SyntaxKind5["JSDocTypeLiteral"] = 325] = "JSDocTypeLiteral"; - SyntaxKind5[SyntaxKind5["JSDocSignature"] = 326] = "JSDocSignature"; - SyntaxKind5[SyntaxKind5["JSDocLink"] = 327] = "JSDocLink"; - SyntaxKind5[SyntaxKind5["JSDocLinkCode"] = 328] = "JSDocLinkCode"; - SyntaxKind5[SyntaxKind5["JSDocLinkPlain"] = 329] = "JSDocLinkPlain"; - SyntaxKind5[SyntaxKind5["JSDocTag"] = 330] = "JSDocTag"; - SyntaxKind5[SyntaxKind5["JSDocAugmentsTag"] = 331] = "JSDocAugmentsTag"; - SyntaxKind5[SyntaxKind5["JSDocImplementsTag"] = 332] = "JSDocImplementsTag"; - SyntaxKind5[SyntaxKind5["JSDocAuthorTag"] = 333] = "JSDocAuthorTag"; - SyntaxKind5[SyntaxKind5["JSDocDeprecatedTag"] = 334] = "JSDocDeprecatedTag"; - SyntaxKind5[SyntaxKind5["JSDocClassTag"] = 335] = "JSDocClassTag"; - SyntaxKind5[SyntaxKind5["JSDocPublicTag"] = 336] = "JSDocPublicTag"; - SyntaxKind5[SyntaxKind5["JSDocPrivateTag"] = 337] = "JSDocPrivateTag"; - SyntaxKind5[SyntaxKind5["JSDocProtectedTag"] = 338] = "JSDocProtectedTag"; - SyntaxKind5[SyntaxKind5["JSDocReadonlyTag"] = 339] = "JSDocReadonlyTag"; - SyntaxKind5[SyntaxKind5["JSDocOverrideTag"] = 340] = "JSDocOverrideTag"; - SyntaxKind5[SyntaxKind5["JSDocCallbackTag"] = 341] = "JSDocCallbackTag"; - SyntaxKind5[SyntaxKind5["JSDocOverloadTag"] = 342] = "JSDocOverloadTag"; - SyntaxKind5[SyntaxKind5["JSDocEnumTag"] = 343] = "JSDocEnumTag"; - SyntaxKind5[SyntaxKind5["JSDocParameterTag"] = 344] = "JSDocParameterTag"; - SyntaxKind5[SyntaxKind5["JSDocReturnTag"] = 345] = "JSDocReturnTag"; - SyntaxKind5[SyntaxKind5["JSDocThisTag"] = 346] = "JSDocThisTag"; - SyntaxKind5[SyntaxKind5["JSDocTypeTag"] = 347] = "JSDocTypeTag"; - SyntaxKind5[SyntaxKind5["JSDocTemplateTag"] = 348] = "JSDocTemplateTag"; - SyntaxKind5[SyntaxKind5["JSDocTypedefTag"] = 349] = "JSDocTypedefTag"; - SyntaxKind5[SyntaxKind5["JSDocSeeTag"] = 350] = "JSDocSeeTag"; - SyntaxKind5[SyntaxKind5["JSDocPropertyTag"] = 351] = "JSDocPropertyTag"; - SyntaxKind5[SyntaxKind5["JSDocThrowsTag"] = 352] = "JSDocThrowsTag"; - SyntaxKind5[SyntaxKind5["JSDocSatisfiesTag"] = 353] = "JSDocSatisfiesTag"; - SyntaxKind5[SyntaxKind5["SyntaxList"] = 354] = "SyntaxList"; - SyntaxKind5[SyntaxKind5["NotEmittedStatement"] = 355] = "NotEmittedStatement"; - SyntaxKind5[SyntaxKind5["PartiallyEmittedExpression"] = 356] = "PartiallyEmittedExpression"; - SyntaxKind5[SyntaxKind5["CommaListExpression"] = 357] = "CommaListExpression"; - SyntaxKind5[SyntaxKind5["MergeDeclarationMarker"] = 358] = "MergeDeclarationMarker"; - SyntaxKind5[SyntaxKind5["EndOfDeclarationMarker"] = 359] = "EndOfDeclarationMarker"; - SyntaxKind5[SyntaxKind5["SyntheticReferenceExpression"] = 360] = "SyntheticReferenceExpression"; - SyntaxKind5[SyntaxKind5["Count"] = 361] = "Count"; - SyntaxKind5[SyntaxKind5["FirstAssignment"] = 63 /* EqualsToken */] = "FirstAssignment"; - SyntaxKind5[SyntaxKind5["LastAssignment"] = 78 /* CaretEqualsToken */] = "LastAssignment"; - SyntaxKind5[SyntaxKind5["FirstCompoundAssignment"] = 64 /* PlusEqualsToken */] = "FirstCompoundAssignment"; - SyntaxKind5[SyntaxKind5["LastCompoundAssignment"] = 78 /* CaretEqualsToken */] = "LastCompoundAssignment"; - SyntaxKind5[SyntaxKind5["FirstReservedWord"] = 81 /* BreakKeyword */] = "FirstReservedWord"; - SyntaxKind5[SyntaxKind5["LastReservedWord"] = 116 /* WithKeyword */] = "LastReservedWord"; - SyntaxKind5[SyntaxKind5["FirstKeyword"] = 81 /* BreakKeyword */] = "FirstKeyword"; - SyntaxKind5[SyntaxKind5["LastKeyword"] = 162 /* OfKeyword */] = "LastKeyword"; - SyntaxKind5[SyntaxKind5["FirstFutureReservedWord"] = 117 /* ImplementsKeyword */] = "FirstFutureReservedWord"; - SyntaxKind5[SyntaxKind5["LastFutureReservedWord"] = 125 /* YieldKeyword */] = "LastFutureReservedWord"; - SyntaxKind5[SyntaxKind5["FirstTypeNode"] = 179 /* TypePredicate */] = "FirstTypeNode"; - SyntaxKind5[SyntaxKind5["LastTypeNode"] = 202 /* ImportType */] = "LastTypeNode"; - SyntaxKind5[SyntaxKind5["FirstPunctuation"] = 18 /* OpenBraceToken */] = "FirstPunctuation"; - SyntaxKind5[SyntaxKind5["LastPunctuation"] = 78 /* CaretEqualsToken */] = "LastPunctuation"; + SyntaxKind5[SyntaxKind5["NonTextFileMarkerTrivia"] = 8] = "NonTextFileMarkerTrivia"; + SyntaxKind5[SyntaxKind5["NumericLiteral"] = 9] = "NumericLiteral"; + SyntaxKind5[SyntaxKind5["BigIntLiteral"] = 10] = "BigIntLiteral"; + SyntaxKind5[SyntaxKind5["StringLiteral"] = 11] = "StringLiteral"; + SyntaxKind5[SyntaxKind5["JsxText"] = 12] = "JsxText"; + SyntaxKind5[SyntaxKind5["JsxTextAllWhiteSpaces"] = 13] = "JsxTextAllWhiteSpaces"; + SyntaxKind5[SyntaxKind5["RegularExpressionLiteral"] = 14] = "RegularExpressionLiteral"; + SyntaxKind5[SyntaxKind5["NoSubstitutionTemplateLiteral"] = 15] = "NoSubstitutionTemplateLiteral"; + SyntaxKind5[SyntaxKind5["TemplateHead"] = 16] = "TemplateHead"; + SyntaxKind5[SyntaxKind5["TemplateMiddle"] = 17] = "TemplateMiddle"; + SyntaxKind5[SyntaxKind5["TemplateTail"] = 18] = "TemplateTail"; + SyntaxKind5[SyntaxKind5["OpenBraceToken"] = 19] = "OpenBraceToken"; + SyntaxKind5[SyntaxKind5["CloseBraceToken"] = 20] = "CloseBraceToken"; + SyntaxKind5[SyntaxKind5["OpenParenToken"] = 21] = "OpenParenToken"; + SyntaxKind5[SyntaxKind5["CloseParenToken"] = 22] = "CloseParenToken"; + SyntaxKind5[SyntaxKind5["OpenBracketToken"] = 23] = "OpenBracketToken"; + SyntaxKind5[SyntaxKind5["CloseBracketToken"] = 24] = "CloseBracketToken"; + SyntaxKind5[SyntaxKind5["DotToken"] = 25] = "DotToken"; + SyntaxKind5[SyntaxKind5["DotDotDotToken"] = 26] = "DotDotDotToken"; + SyntaxKind5[SyntaxKind5["SemicolonToken"] = 27] = "SemicolonToken"; + SyntaxKind5[SyntaxKind5["CommaToken"] = 28] = "CommaToken"; + SyntaxKind5[SyntaxKind5["QuestionDotToken"] = 29] = "QuestionDotToken"; + SyntaxKind5[SyntaxKind5["LessThanToken"] = 30] = "LessThanToken"; + SyntaxKind5[SyntaxKind5["LessThanSlashToken"] = 31] = "LessThanSlashToken"; + SyntaxKind5[SyntaxKind5["GreaterThanToken"] = 32] = "GreaterThanToken"; + SyntaxKind5[SyntaxKind5["LessThanEqualsToken"] = 33] = "LessThanEqualsToken"; + SyntaxKind5[SyntaxKind5["GreaterThanEqualsToken"] = 34] = "GreaterThanEqualsToken"; + SyntaxKind5[SyntaxKind5["EqualsEqualsToken"] = 35] = "EqualsEqualsToken"; + SyntaxKind5[SyntaxKind5["ExclamationEqualsToken"] = 36] = "ExclamationEqualsToken"; + SyntaxKind5[SyntaxKind5["EqualsEqualsEqualsToken"] = 37] = "EqualsEqualsEqualsToken"; + SyntaxKind5[SyntaxKind5["ExclamationEqualsEqualsToken"] = 38] = "ExclamationEqualsEqualsToken"; + SyntaxKind5[SyntaxKind5["EqualsGreaterThanToken"] = 39] = "EqualsGreaterThanToken"; + SyntaxKind5[SyntaxKind5["PlusToken"] = 40] = "PlusToken"; + SyntaxKind5[SyntaxKind5["MinusToken"] = 41] = "MinusToken"; + SyntaxKind5[SyntaxKind5["AsteriskToken"] = 42] = "AsteriskToken"; + SyntaxKind5[SyntaxKind5["AsteriskAsteriskToken"] = 43] = "AsteriskAsteriskToken"; + SyntaxKind5[SyntaxKind5["SlashToken"] = 44] = "SlashToken"; + SyntaxKind5[SyntaxKind5["PercentToken"] = 45] = "PercentToken"; + SyntaxKind5[SyntaxKind5["PlusPlusToken"] = 46] = "PlusPlusToken"; + SyntaxKind5[SyntaxKind5["MinusMinusToken"] = 47] = "MinusMinusToken"; + SyntaxKind5[SyntaxKind5["LessThanLessThanToken"] = 48] = "LessThanLessThanToken"; + SyntaxKind5[SyntaxKind5["GreaterThanGreaterThanToken"] = 49] = "GreaterThanGreaterThanToken"; + SyntaxKind5[SyntaxKind5["GreaterThanGreaterThanGreaterThanToken"] = 50] = "GreaterThanGreaterThanGreaterThanToken"; + SyntaxKind5[SyntaxKind5["AmpersandToken"] = 51] = "AmpersandToken"; + SyntaxKind5[SyntaxKind5["BarToken"] = 52] = "BarToken"; + SyntaxKind5[SyntaxKind5["CaretToken"] = 53] = "CaretToken"; + SyntaxKind5[SyntaxKind5["ExclamationToken"] = 54] = "ExclamationToken"; + SyntaxKind5[SyntaxKind5["TildeToken"] = 55] = "TildeToken"; + SyntaxKind5[SyntaxKind5["AmpersandAmpersandToken"] = 56] = "AmpersandAmpersandToken"; + SyntaxKind5[SyntaxKind5["BarBarToken"] = 57] = "BarBarToken"; + SyntaxKind5[SyntaxKind5["QuestionToken"] = 58] = "QuestionToken"; + SyntaxKind5[SyntaxKind5["ColonToken"] = 59] = "ColonToken"; + SyntaxKind5[SyntaxKind5["AtToken"] = 60] = "AtToken"; + SyntaxKind5[SyntaxKind5["QuestionQuestionToken"] = 61] = "QuestionQuestionToken"; + SyntaxKind5[SyntaxKind5["BacktickToken"] = 62] = "BacktickToken"; + SyntaxKind5[SyntaxKind5["HashToken"] = 63] = "HashToken"; + SyntaxKind5[SyntaxKind5["EqualsToken"] = 64] = "EqualsToken"; + SyntaxKind5[SyntaxKind5["PlusEqualsToken"] = 65] = "PlusEqualsToken"; + SyntaxKind5[SyntaxKind5["MinusEqualsToken"] = 66] = "MinusEqualsToken"; + SyntaxKind5[SyntaxKind5["AsteriskEqualsToken"] = 67] = "AsteriskEqualsToken"; + SyntaxKind5[SyntaxKind5["AsteriskAsteriskEqualsToken"] = 68] = "AsteriskAsteriskEqualsToken"; + SyntaxKind5[SyntaxKind5["SlashEqualsToken"] = 69] = "SlashEqualsToken"; + SyntaxKind5[SyntaxKind5["PercentEqualsToken"] = 70] = "PercentEqualsToken"; + SyntaxKind5[SyntaxKind5["LessThanLessThanEqualsToken"] = 71] = "LessThanLessThanEqualsToken"; + SyntaxKind5[SyntaxKind5["GreaterThanGreaterThanEqualsToken"] = 72] = "GreaterThanGreaterThanEqualsToken"; + SyntaxKind5[SyntaxKind5["GreaterThanGreaterThanGreaterThanEqualsToken"] = 73] = "GreaterThanGreaterThanGreaterThanEqualsToken"; + SyntaxKind5[SyntaxKind5["AmpersandEqualsToken"] = 74] = "AmpersandEqualsToken"; + SyntaxKind5[SyntaxKind5["BarEqualsToken"] = 75] = "BarEqualsToken"; + SyntaxKind5[SyntaxKind5["BarBarEqualsToken"] = 76] = "BarBarEqualsToken"; + SyntaxKind5[SyntaxKind5["AmpersandAmpersandEqualsToken"] = 77] = "AmpersandAmpersandEqualsToken"; + SyntaxKind5[SyntaxKind5["QuestionQuestionEqualsToken"] = 78] = "QuestionQuestionEqualsToken"; + SyntaxKind5[SyntaxKind5["CaretEqualsToken"] = 79] = "CaretEqualsToken"; + SyntaxKind5[SyntaxKind5["Identifier"] = 80] = "Identifier"; + SyntaxKind5[SyntaxKind5["PrivateIdentifier"] = 81] = "PrivateIdentifier"; + SyntaxKind5[SyntaxKind5["JSDocCommentTextToken"] = 82] = "JSDocCommentTextToken"; + SyntaxKind5[SyntaxKind5["BreakKeyword"] = 83] = "BreakKeyword"; + SyntaxKind5[SyntaxKind5["CaseKeyword"] = 84] = "CaseKeyword"; + SyntaxKind5[SyntaxKind5["CatchKeyword"] = 85] = "CatchKeyword"; + SyntaxKind5[SyntaxKind5["ClassKeyword"] = 86] = "ClassKeyword"; + SyntaxKind5[SyntaxKind5["ConstKeyword"] = 87] = "ConstKeyword"; + SyntaxKind5[SyntaxKind5["ContinueKeyword"] = 88] = "ContinueKeyword"; + SyntaxKind5[SyntaxKind5["DebuggerKeyword"] = 89] = "DebuggerKeyword"; + SyntaxKind5[SyntaxKind5["DefaultKeyword"] = 90] = "DefaultKeyword"; + SyntaxKind5[SyntaxKind5["DeleteKeyword"] = 91] = "DeleteKeyword"; + SyntaxKind5[SyntaxKind5["DoKeyword"] = 92] = "DoKeyword"; + SyntaxKind5[SyntaxKind5["ElseKeyword"] = 93] = "ElseKeyword"; + SyntaxKind5[SyntaxKind5["EnumKeyword"] = 94] = "EnumKeyword"; + SyntaxKind5[SyntaxKind5["ExportKeyword"] = 95] = "ExportKeyword"; + SyntaxKind5[SyntaxKind5["ExtendsKeyword"] = 96] = "ExtendsKeyword"; + SyntaxKind5[SyntaxKind5["FalseKeyword"] = 97] = "FalseKeyword"; + SyntaxKind5[SyntaxKind5["FinallyKeyword"] = 98] = "FinallyKeyword"; + SyntaxKind5[SyntaxKind5["ForKeyword"] = 99] = "ForKeyword"; + SyntaxKind5[SyntaxKind5["FunctionKeyword"] = 100] = "FunctionKeyword"; + SyntaxKind5[SyntaxKind5["IfKeyword"] = 101] = "IfKeyword"; + SyntaxKind5[SyntaxKind5["ImportKeyword"] = 102] = "ImportKeyword"; + SyntaxKind5[SyntaxKind5["InKeyword"] = 103] = "InKeyword"; + SyntaxKind5[SyntaxKind5["InstanceOfKeyword"] = 104] = "InstanceOfKeyword"; + SyntaxKind5[SyntaxKind5["NewKeyword"] = 105] = "NewKeyword"; + SyntaxKind5[SyntaxKind5["NullKeyword"] = 106] = "NullKeyword"; + SyntaxKind5[SyntaxKind5["ReturnKeyword"] = 107] = "ReturnKeyword"; + SyntaxKind5[SyntaxKind5["SuperKeyword"] = 108] = "SuperKeyword"; + SyntaxKind5[SyntaxKind5["SwitchKeyword"] = 109] = "SwitchKeyword"; + SyntaxKind5[SyntaxKind5["ThisKeyword"] = 110] = "ThisKeyword"; + SyntaxKind5[SyntaxKind5["ThrowKeyword"] = 111] = "ThrowKeyword"; + SyntaxKind5[SyntaxKind5["TrueKeyword"] = 112] = "TrueKeyword"; + SyntaxKind5[SyntaxKind5["TryKeyword"] = 113] = "TryKeyword"; + SyntaxKind5[SyntaxKind5["TypeOfKeyword"] = 114] = "TypeOfKeyword"; + SyntaxKind5[SyntaxKind5["VarKeyword"] = 115] = "VarKeyword"; + SyntaxKind5[SyntaxKind5["VoidKeyword"] = 116] = "VoidKeyword"; + SyntaxKind5[SyntaxKind5["WhileKeyword"] = 117] = "WhileKeyword"; + SyntaxKind5[SyntaxKind5["WithKeyword"] = 118] = "WithKeyword"; + SyntaxKind5[SyntaxKind5["ImplementsKeyword"] = 119] = "ImplementsKeyword"; + SyntaxKind5[SyntaxKind5["InterfaceKeyword"] = 120] = "InterfaceKeyword"; + SyntaxKind5[SyntaxKind5["LetKeyword"] = 121] = "LetKeyword"; + SyntaxKind5[SyntaxKind5["PackageKeyword"] = 122] = "PackageKeyword"; + SyntaxKind5[SyntaxKind5["PrivateKeyword"] = 123] = "PrivateKeyword"; + SyntaxKind5[SyntaxKind5["ProtectedKeyword"] = 124] = "ProtectedKeyword"; + SyntaxKind5[SyntaxKind5["PublicKeyword"] = 125] = "PublicKeyword"; + SyntaxKind5[SyntaxKind5["StaticKeyword"] = 126] = "StaticKeyword"; + SyntaxKind5[SyntaxKind5["YieldKeyword"] = 127] = "YieldKeyword"; + SyntaxKind5[SyntaxKind5["AbstractKeyword"] = 128] = "AbstractKeyword"; + SyntaxKind5[SyntaxKind5["AccessorKeyword"] = 129] = "AccessorKeyword"; + SyntaxKind5[SyntaxKind5["AsKeyword"] = 130] = "AsKeyword"; + SyntaxKind5[SyntaxKind5["AssertsKeyword"] = 131] = "AssertsKeyword"; + SyntaxKind5[SyntaxKind5["AssertKeyword"] = 132] = "AssertKeyword"; + SyntaxKind5[SyntaxKind5["AnyKeyword"] = 133] = "AnyKeyword"; + SyntaxKind5[SyntaxKind5["AsyncKeyword"] = 134] = "AsyncKeyword"; + SyntaxKind5[SyntaxKind5["AwaitKeyword"] = 135] = "AwaitKeyword"; + SyntaxKind5[SyntaxKind5["BooleanKeyword"] = 136] = "BooleanKeyword"; + SyntaxKind5[SyntaxKind5["ConstructorKeyword"] = 137] = "ConstructorKeyword"; + SyntaxKind5[SyntaxKind5["DeclareKeyword"] = 138] = "DeclareKeyword"; + SyntaxKind5[SyntaxKind5["GetKeyword"] = 139] = "GetKeyword"; + SyntaxKind5[SyntaxKind5["InferKeyword"] = 140] = "InferKeyword"; + SyntaxKind5[SyntaxKind5["IntrinsicKeyword"] = 141] = "IntrinsicKeyword"; + SyntaxKind5[SyntaxKind5["IsKeyword"] = 142] = "IsKeyword"; + SyntaxKind5[SyntaxKind5["KeyOfKeyword"] = 143] = "KeyOfKeyword"; + SyntaxKind5[SyntaxKind5["ModuleKeyword"] = 144] = "ModuleKeyword"; + SyntaxKind5[SyntaxKind5["NamespaceKeyword"] = 145] = "NamespaceKeyword"; + SyntaxKind5[SyntaxKind5["NeverKeyword"] = 146] = "NeverKeyword"; + SyntaxKind5[SyntaxKind5["OutKeyword"] = 147] = "OutKeyword"; + SyntaxKind5[SyntaxKind5["ReadonlyKeyword"] = 148] = "ReadonlyKeyword"; + SyntaxKind5[SyntaxKind5["RequireKeyword"] = 149] = "RequireKeyword"; + SyntaxKind5[SyntaxKind5["NumberKeyword"] = 150] = "NumberKeyword"; + SyntaxKind5[SyntaxKind5["ObjectKeyword"] = 151] = "ObjectKeyword"; + SyntaxKind5[SyntaxKind5["SatisfiesKeyword"] = 152] = "SatisfiesKeyword"; + SyntaxKind5[SyntaxKind5["SetKeyword"] = 153] = "SetKeyword"; + SyntaxKind5[SyntaxKind5["StringKeyword"] = 154] = "StringKeyword"; + SyntaxKind5[SyntaxKind5["SymbolKeyword"] = 155] = "SymbolKeyword"; + SyntaxKind5[SyntaxKind5["TypeKeyword"] = 156] = "TypeKeyword"; + SyntaxKind5[SyntaxKind5["UndefinedKeyword"] = 157] = "UndefinedKeyword"; + SyntaxKind5[SyntaxKind5["UniqueKeyword"] = 158] = "UniqueKeyword"; + SyntaxKind5[SyntaxKind5["UnknownKeyword"] = 159] = "UnknownKeyword"; + SyntaxKind5[SyntaxKind5["FromKeyword"] = 160] = "FromKeyword"; + SyntaxKind5[SyntaxKind5["GlobalKeyword"] = 161] = "GlobalKeyword"; + SyntaxKind5[SyntaxKind5["BigIntKeyword"] = 162] = "BigIntKeyword"; + SyntaxKind5[SyntaxKind5["OverrideKeyword"] = 163] = "OverrideKeyword"; + SyntaxKind5[SyntaxKind5["OfKeyword"] = 164] = "OfKeyword"; + SyntaxKind5[SyntaxKind5["QualifiedName"] = 165] = "QualifiedName"; + SyntaxKind5[SyntaxKind5["ComputedPropertyName"] = 166] = "ComputedPropertyName"; + SyntaxKind5[SyntaxKind5["TypeParameter"] = 167] = "TypeParameter"; + SyntaxKind5[SyntaxKind5["Parameter"] = 168] = "Parameter"; + SyntaxKind5[SyntaxKind5["Decorator"] = 169] = "Decorator"; + SyntaxKind5[SyntaxKind5["PropertySignature"] = 170] = "PropertySignature"; + SyntaxKind5[SyntaxKind5["PropertyDeclaration"] = 171] = "PropertyDeclaration"; + SyntaxKind5[SyntaxKind5["MethodSignature"] = 172] = "MethodSignature"; + SyntaxKind5[SyntaxKind5["MethodDeclaration"] = 173] = "MethodDeclaration"; + SyntaxKind5[SyntaxKind5["ClassStaticBlockDeclaration"] = 174] = "ClassStaticBlockDeclaration"; + SyntaxKind5[SyntaxKind5["Constructor"] = 175] = "Constructor"; + SyntaxKind5[SyntaxKind5["GetAccessor"] = 176] = "GetAccessor"; + SyntaxKind5[SyntaxKind5["SetAccessor"] = 177] = "SetAccessor"; + SyntaxKind5[SyntaxKind5["CallSignature"] = 178] = "CallSignature"; + SyntaxKind5[SyntaxKind5["ConstructSignature"] = 179] = "ConstructSignature"; + SyntaxKind5[SyntaxKind5["IndexSignature"] = 180] = "IndexSignature"; + SyntaxKind5[SyntaxKind5["TypePredicate"] = 181] = "TypePredicate"; + SyntaxKind5[SyntaxKind5["TypeReference"] = 182] = "TypeReference"; + SyntaxKind5[SyntaxKind5["FunctionType"] = 183] = "FunctionType"; + SyntaxKind5[SyntaxKind5["ConstructorType"] = 184] = "ConstructorType"; + SyntaxKind5[SyntaxKind5["TypeQuery"] = 185] = "TypeQuery"; + SyntaxKind5[SyntaxKind5["TypeLiteral"] = 186] = "TypeLiteral"; + SyntaxKind5[SyntaxKind5["ArrayType"] = 187] = "ArrayType"; + SyntaxKind5[SyntaxKind5["TupleType"] = 188] = "TupleType"; + SyntaxKind5[SyntaxKind5["OptionalType"] = 189] = "OptionalType"; + SyntaxKind5[SyntaxKind5["RestType"] = 190] = "RestType"; + SyntaxKind5[SyntaxKind5["UnionType"] = 191] = "UnionType"; + SyntaxKind5[SyntaxKind5["IntersectionType"] = 192] = "IntersectionType"; + SyntaxKind5[SyntaxKind5["ConditionalType"] = 193] = "ConditionalType"; + SyntaxKind5[SyntaxKind5["InferType"] = 194] = "InferType"; + SyntaxKind5[SyntaxKind5["ParenthesizedType"] = 195] = "ParenthesizedType"; + SyntaxKind5[SyntaxKind5["ThisType"] = 196] = "ThisType"; + SyntaxKind5[SyntaxKind5["TypeOperator"] = 197] = "TypeOperator"; + SyntaxKind5[SyntaxKind5["IndexedAccessType"] = 198] = "IndexedAccessType"; + SyntaxKind5[SyntaxKind5["MappedType"] = 199] = "MappedType"; + SyntaxKind5[SyntaxKind5["LiteralType"] = 200] = "LiteralType"; + SyntaxKind5[SyntaxKind5["NamedTupleMember"] = 201] = "NamedTupleMember"; + SyntaxKind5[SyntaxKind5["TemplateLiteralType"] = 202] = "TemplateLiteralType"; + SyntaxKind5[SyntaxKind5["TemplateLiteralTypeSpan"] = 203] = "TemplateLiteralTypeSpan"; + SyntaxKind5[SyntaxKind5["ImportType"] = 204] = "ImportType"; + SyntaxKind5[SyntaxKind5["ObjectBindingPattern"] = 205] = "ObjectBindingPattern"; + SyntaxKind5[SyntaxKind5["ArrayBindingPattern"] = 206] = "ArrayBindingPattern"; + SyntaxKind5[SyntaxKind5["BindingElement"] = 207] = "BindingElement"; + SyntaxKind5[SyntaxKind5["ArrayLiteralExpression"] = 208] = "ArrayLiteralExpression"; + SyntaxKind5[SyntaxKind5["ObjectLiteralExpression"] = 209] = "ObjectLiteralExpression"; + SyntaxKind5[SyntaxKind5["PropertyAccessExpression"] = 210] = "PropertyAccessExpression"; + SyntaxKind5[SyntaxKind5["ElementAccessExpression"] = 211] = "ElementAccessExpression"; + SyntaxKind5[SyntaxKind5["CallExpression"] = 212] = "CallExpression"; + SyntaxKind5[SyntaxKind5["NewExpression"] = 213] = "NewExpression"; + SyntaxKind5[SyntaxKind5["TaggedTemplateExpression"] = 214] = "TaggedTemplateExpression"; + SyntaxKind5[SyntaxKind5["TypeAssertionExpression"] = 215] = "TypeAssertionExpression"; + SyntaxKind5[SyntaxKind5["ParenthesizedExpression"] = 216] = "ParenthesizedExpression"; + SyntaxKind5[SyntaxKind5["FunctionExpression"] = 217] = "FunctionExpression"; + SyntaxKind5[SyntaxKind5["ArrowFunction"] = 218] = "ArrowFunction"; + SyntaxKind5[SyntaxKind5["DeleteExpression"] = 219] = "DeleteExpression"; + SyntaxKind5[SyntaxKind5["TypeOfExpression"] = 220] = "TypeOfExpression"; + SyntaxKind5[SyntaxKind5["VoidExpression"] = 221] = "VoidExpression"; + SyntaxKind5[SyntaxKind5["AwaitExpression"] = 222] = "AwaitExpression"; + SyntaxKind5[SyntaxKind5["PrefixUnaryExpression"] = 223] = "PrefixUnaryExpression"; + SyntaxKind5[SyntaxKind5["PostfixUnaryExpression"] = 224] = "PostfixUnaryExpression"; + SyntaxKind5[SyntaxKind5["BinaryExpression"] = 225] = "BinaryExpression"; + SyntaxKind5[SyntaxKind5["ConditionalExpression"] = 226] = "ConditionalExpression"; + SyntaxKind5[SyntaxKind5["TemplateExpression"] = 227] = "TemplateExpression"; + SyntaxKind5[SyntaxKind5["YieldExpression"] = 228] = "YieldExpression"; + SyntaxKind5[SyntaxKind5["SpreadElement"] = 229] = "SpreadElement"; + SyntaxKind5[SyntaxKind5["ClassExpression"] = 230] = "ClassExpression"; + SyntaxKind5[SyntaxKind5["OmittedExpression"] = 231] = "OmittedExpression"; + SyntaxKind5[SyntaxKind5["ExpressionWithTypeArguments"] = 232] = "ExpressionWithTypeArguments"; + SyntaxKind5[SyntaxKind5["AsExpression"] = 233] = "AsExpression"; + SyntaxKind5[SyntaxKind5["NonNullExpression"] = 234] = "NonNullExpression"; + SyntaxKind5[SyntaxKind5["MetaProperty"] = 235] = "MetaProperty"; + SyntaxKind5[SyntaxKind5["SyntheticExpression"] = 236] = "SyntheticExpression"; + SyntaxKind5[SyntaxKind5["SatisfiesExpression"] = 237] = "SatisfiesExpression"; + SyntaxKind5[SyntaxKind5["TemplateSpan"] = 238] = "TemplateSpan"; + SyntaxKind5[SyntaxKind5["SemicolonClassElement"] = 239] = "SemicolonClassElement"; + SyntaxKind5[SyntaxKind5["Block"] = 240] = "Block"; + SyntaxKind5[SyntaxKind5["EmptyStatement"] = 241] = "EmptyStatement"; + SyntaxKind5[SyntaxKind5["VariableStatement"] = 242] = "VariableStatement"; + SyntaxKind5[SyntaxKind5["ExpressionStatement"] = 243] = "ExpressionStatement"; + SyntaxKind5[SyntaxKind5["IfStatement"] = 244] = "IfStatement"; + SyntaxKind5[SyntaxKind5["DoStatement"] = 245] = "DoStatement"; + SyntaxKind5[SyntaxKind5["WhileStatement"] = 246] = "WhileStatement"; + SyntaxKind5[SyntaxKind5["ForStatement"] = 247] = "ForStatement"; + SyntaxKind5[SyntaxKind5["ForInStatement"] = 248] = "ForInStatement"; + SyntaxKind5[SyntaxKind5["ForOfStatement"] = 249] = "ForOfStatement"; + SyntaxKind5[SyntaxKind5["ContinueStatement"] = 250] = "ContinueStatement"; + SyntaxKind5[SyntaxKind5["BreakStatement"] = 251] = "BreakStatement"; + SyntaxKind5[SyntaxKind5["ReturnStatement"] = 252] = "ReturnStatement"; + SyntaxKind5[SyntaxKind5["WithStatement"] = 253] = "WithStatement"; + SyntaxKind5[SyntaxKind5["SwitchStatement"] = 254] = "SwitchStatement"; + SyntaxKind5[SyntaxKind5["LabeledStatement"] = 255] = "LabeledStatement"; + SyntaxKind5[SyntaxKind5["ThrowStatement"] = 256] = "ThrowStatement"; + SyntaxKind5[SyntaxKind5["TryStatement"] = 257] = "TryStatement"; + SyntaxKind5[SyntaxKind5["DebuggerStatement"] = 258] = "DebuggerStatement"; + SyntaxKind5[SyntaxKind5["VariableDeclaration"] = 259] = "VariableDeclaration"; + SyntaxKind5[SyntaxKind5["VariableDeclarationList"] = 260] = "VariableDeclarationList"; + SyntaxKind5[SyntaxKind5["FunctionDeclaration"] = 261] = "FunctionDeclaration"; + SyntaxKind5[SyntaxKind5["ClassDeclaration"] = 262] = "ClassDeclaration"; + SyntaxKind5[SyntaxKind5["InterfaceDeclaration"] = 263] = "InterfaceDeclaration"; + SyntaxKind5[SyntaxKind5["TypeAliasDeclaration"] = 264] = "TypeAliasDeclaration"; + SyntaxKind5[SyntaxKind5["EnumDeclaration"] = 265] = "EnumDeclaration"; + SyntaxKind5[SyntaxKind5["ModuleDeclaration"] = 266] = "ModuleDeclaration"; + SyntaxKind5[SyntaxKind5["ModuleBlock"] = 267] = "ModuleBlock"; + SyntaxKind5[SyntaxKind5["CaseBlock"] = 268] = "CaseBlock"; + SyntaxKind5[SyntaxKind5["NamespaceExportDeclaration"] = 269] = "NamespaceExportDeclaration"; + SyntaxKind5[SyntaxKind5["ImportEqualsDeclaration"] = 270] = "ImportEqualsDeclaration"; + SyntaxKind5[SyntaxKind5["ImportDeclaration"] = 271] = "ImportDeclaration"; + SyntaxKind5[SyntaxKind5["ImportClause"] = 272] = "ImportClause"; + SyntaxKind5[SyntaxKind5["NamespaceImport"] = 273] = "NamespaceImport"; + SyntaxKind5[SyntaxKind5["NamedImports"] = 274] = "NamedImports"; + SyntaxKind5[SyntaxKind5["ImportSpecifier"] = 275] = "ImportSpecifier"; + SyntaxKind5[SyntaxKind5["ExportAssignment"] = 276] = "ExportAssignment"; + SyntaxKind5[SyntaxKind5["ExportDeclaration"] = 277] = "ExportDeclaration"; + SyntaxKind5[SyntaxKind5["NamedExports"] = 278] = "NamedExports"; + SyntaxKind5[SyntaxKind5["NamespaceExport"] = 279] = "NamespaceExport"; + SyntaxKind5[SyntaxKind5["ExportSpecifier"] = 280] = "ExportSpecifier"; + SyntaxKind5[SyntaxKind5["MissingDeclaration"] = 281] = "MissingDeclaration"; + SyntaxKind5[SyntaxKind5["ExternalModuleReference"] = 282] = "ExternalModuleReference"; + SyntaxKind5[SyntaxKind5["JsxElement"] = 283] = "JsxElement"; + SyntaxKind5[SyntaxKind5["JsxSelfClosingElement"] = 284] = "JsxSelfClosingElement"; + SyntaxKind5[SyntaxKind5["JsxOpeningElement"] = 285] = "JsxOpeningElement"; + SyntaxKind5[SyntaxKind5["JsxClosingElement"] = 286] = "JsxClosingElement"; + SyntaxKind5[SyntaxKind5["JsxFragment"] = 287] = "JsxFragment"; + SyntaxKind5[SyntaxKind5["JsxOpeningFragment"] = 288] = "JsxOpeningFragment"; + SyntaxKind5[SyntaxKind5["JsxClosingFragment"] = 289] = "JsxClosingFragment"; + SyntaxKind5[SyntaxKind5["JsxAttribute"] = 290] = "JsxAttribute"; + SyntaxKind5[SyntaxKind5["JsxAttributes"] = 291] = "JsxAttributes"; + SyntaxKind5[SyntaxKind5["JsxSpreadAttribute"] = 292] = "JsxSpreadAttribute"; + SyntaxKind5[SyntaxKind5["JsxExpression"] = 293] = "JsxExpression"; + SyntaxKind5[SyntaxKind5["JsxNamespacedName"] = 294] = "JsxNamespacedName"; + SyntaxKind5[SyntaxKind5["CaseClause"] = 295] = "CaseClause"; + SyntaxKind5[SyntaxKind5["DefaultClause"] = 296] = "DefaultClause"; + SyntaxKind5[SyntaxKind5["HeritageClause"] = 297] = "HeritageClause"; + SyntaxKind5[SyntaxKind5["CatchClause"] = 298] = "CatchClause"; + SyntaxKind5[SyntaxKind5["AssertClause"] = 299] = "AssertClause"; + SyntaxKind5[SyntaxKind5["AssertEntry"] = 300] = "AssertEntry"; + SyntaxKind5[SyntaxKind5["ImportTypeAssertionContainer"] = 301] = "ImportTypeAssertionContainer"; + SyntaxKind5[SyntaxKind5["PropertyAssignment"] = 302] = "PropertyAssignment"; + SyntaxKind5[SyntaxKind5["ShorthandPropertyAssignment"] = 303] = "ShorthandPropertyAssignment"; + SyntaxKind5[SyntaxKind5["SpreadAssignment"] = 304] = "SpreadAssignment"; + SyntaxKind5[SyntaxKind5["EnumMember"] = 305] = "EnumMember"; + SyntaxKind5[SyntaxKind5["UnparsedPrologue"] = 306] = "UnparsedPrologue"; + SyntaxKind5[SyntaxKind5["UnparsedPrepend"] = 307] = "UnparsedPrepend"; + SyntaxKind5[SyntaxKind5["UnparsedText"] = 308] = "UnparsedText"; + SyntaxKind5[SyntaxKind5["UnparsedInternalText"] = 309] = "UnparsedInternalText"; + SyntaxKind5[SyntaxKind5["UnparsedSyntheticReference"] = 310] = "UnparsedSyntheticReference"; + SyntaxKind5[SyntaxKind5["SourceFile"] = 311] = "SourceFile"; + SyntaxKind5[SyntaxKind5["Bundle"] = 312] = "Bundle"; + SyntaxKind5[SyntaxKind5["UnparsedSource"] = 313] = "UnparsedSource"; + SyntaxKind5[SyntaxKind5["InputFiles"] = 314] = "InputFiles"; + SyntaxKind5[SyntaxKind5["JSDocTypeExpression"] = 315] = "JSDocTypeExpression"; + SyntaxKind5[SyntaxKind5["JSDocNameReference"] = 316] = "JSDocNameReference"; + SyntaxKind5[SyntaxKind5["JSDocMemberName"] = 317] = "JSDocMemberName"; + SyntaxKind5[SyntaxKind5["JSDocAllType"] = 318] = "JSDocAllType"; + SyntaxKind5[SyntaxKind5["JSDocUnknownType"] = 319] = "JSDocUnknownType"; + SyntaxKind5[SyntaxKind5["JSDocNullableType"] = 320] = "JSDocNullableType"; + SyntaxKind5[SyntaxKind5["JSDocNonNullableType"] = 321] = "JSDocNonNullableType"; + SyntaxKind5[SyntaxKind5["JSDocOptionalType"] = 322] = "JSDocOptionalType"; + SyntaxKind5[SyntaxKind5["JSDocFunctionType"] = 323] = "JSDocFunctionType"; + SyntaxKind5[SyntaxKind5["JSDocVariadicType"] = 324] = "JSDocVariadicType"; + SyntaxKind5[SyntaxKind5["JSDocNamepathType"] = 325] = "JSDocNamepathType"; + SyntaxKind5[SyntaxKind5["JSDoc"] = 326] = "JSDoc"; + SyntaxKind5[SyntaxKind5["JSDocComment"] = 326 /* JSDoc */] = "JSDocComment"; + SyntaxKind5[SyntaxKind5["JSDocText"] = 327] = "JSDocText"; + SyntaxKind5[SyntaxKind5["JSDocTypeLiteral"] = 328] = "JSDocTypeLiteral"; + SyntaxKind5[SyntaxKind5["JSDocSignature"] = 329] = "JSDocSignature"; + SyntaxKind5[SyntaxKind5["JSDocLink"] = 330] = "JSDocLink"; + SyntaxKind5[SyntaxKind5["JSDocLinkCode"] = 331] = "JSDocLinkCode"; + SyntaxKind5[SyntaxKind5["JSDocLinkPlain"] = 332] = "JSDocLinkPlain"; + SyntaxKind5[SyntaxKind5["JSDocTag"] = 333] = "JSDocTag"; + SyntaxKind5[SyntaxKind5["JSDocAugmentsTag"] = 334] = "JSDocAugmentsTag"; + SyntaxKind5[SyntaxKind5["JSDocImplementsTag"] = 335] = "JSDocImplementsTag"; + SyntaxKind5[SyntaxKind5["JSDocAuthorTag"] = 336] = "JSDocAuthorTag"; + SyntaxKind5[SyntaxKind5["JSDocDeprecatedTag"] = 337] = "JSDocDeprecatedTag"; + SyntaxKind5[SyntaxKind5["JSDocClassTag"] = 338] = "JSDocClassTag"; + SyntaxKind5[SyntaxKind5["JSDocPublicTag"] = 339] = "JSDocPublicTag"; + SyntaxKind5[SyntaxKind5["JSDocPrivateTag"] = 340] = "JSDocPrivateTag"; + SyntaxKind5[SyntaxKind5["JSDocProtectedTag"] = 341] = "JSDocProtectedTag"; + SyntaxKind5[SyntaxKind5["JSDocReadonlyTag"] = 342] = "JSDocReadonlyTag"; + SyntaxKind5[SyntaxKind5["JSDocOverrideTag"] = 343] = "JSDocOverrideTag"; + SyntaxKind5[SyntaxKind5["JSDocCallbackTag"] = 344] = "JSDocCallbackTag"; + SyntaxKind5[SyntaxKind5["JSDocOverloadTag"] = 345] = "JSDocOverloadTag"; + SyntaxKind5[SyntaxKind5["JSDocEnumTag"] = 346] = "JSDocEnumTag"; + SyntaxKind5[SyntaxKind5["JSDocParameterTag"] = 347] = "JSDocParameterTag"; + SyntaxKind5[SyntaxKind5["JSDocReturnTag"] = 348] = "JSDocReturnTag"; + SyntaxKind5[SyntaxKind5["JSDocThisTag"] = 349] = "JSDocThisTag"; + SyntaxKind5[SyntaxKind5["JSDocTypeTag"] = 350] = "JSDocTypeTag"; + SyntaxKind5[SyntaxKind5["JSDocTemplateTag"] = 351] = "JSDocTemplateTag"; + SyntaxKind5[SyntaxKind5["JSDocTypedefTag"] = 352] = "JSDocTypedefTag"; + SyntaxKind5[SyntaxKind5["JSDocSeeTag"] = 353] = "JSDocSeeTag"; + SyntaxKind5[SyntaxKind5["JSDocPropertyTag"] = 354] = "JSDocPropertyTag"; + SyntaxKind5[SyntaxKind5["JSDocThrowsTag"] = 355] = "JSDocThrowsTag"; + SyntaxKind5[SyntaxKind5["JSDocSatisfiesTag"] = 356] = "JSDocSatisfiesTag"; + SyntaxKind5[SyntaxKind5["SyntaxList"] = 357] = "SyntaxList"; + SyntaxKind5[SyntaxKind5["NotEmittedStatement"] = 358] = "NotEmittedStatement"; + SyntaxKind5[SyntaxKind5["PartiallyEmittedExpression"] = 359] = "PartiallyEmittedExpression"; + SyntaxKind5[SyntaxKind5["CommaListExpression"] = 360] = "CommaListExpression"; + SyntaxKind5[SyntaxKind5["SyntheticReferenceExpression"] = 361] = "SyntheticReferenceExpression"; + SyntaxKind5[SyntaxKind5["Count"] = 362] = "Count"; + SyntaxKind5[SyntaxKind5["FirstAssignment"] = 64 /* EqualsToken */] = "FirstAssignment"; + SyntaxKind5[SyntaxKind5["LastAssignment"] = 79 /* CaretEqualsToken */] = "LastAssignment"; + SyntaxKind5[SyntaxKind5["FirstCompoundAssignment"] = 65 /* PlusEqualsToken */] = "FirstCompoundAssignment"; + SyntaxKind5[SyntaxKind5["LastCompoundAssignment"] = 79 /* CaretEqualsToken */] = "LastCompoundAssignment"; + SyntaxKind5[SyntaxKind5["FirstReservedWord"] = 83 /* BreakKeyword */] = "FirstReservedWord"; + SyntaxKind5[SyntaxKind5["LastReservedWord"] = 118 /* WithKeyword */] = "LastReservedWord"; + SyntaxKind5[SyntaxKind5["FirstKeyword"] = 83 /* BreakKeyword */] = "FirstKeyword"; + SyntaxKind5[SyntaxKind5["LastKeyword"] = 164 /* OfKeyword */] = "LastKeyword"; + SyntaxKind5[SyntaxKind5["FirstFutureReservedWord"] = 119 /* ImplementsKeyword */] = "FirstFutureReservedWord"; + SyntaxKind5[SyntaxKind5["LastFutureReservedWord"] = 127 /* YieldKeyword */] = "LastFutureReservedWord"; + SyntaxKind5[SyntaxKind5["FirstTypeNode"] = 181 /* TypePredicate */] = "FirstTypeNode"; + SyntaxKind5[SyntaxKind5["LastTypeNode"] = 204 /* ImportType */] = "LastTypeNode"; + SyntaxKind5[SyntaxKind5["FirstPunctuation"] = 19 /* OpenBraceToken */] = "FirstPunctuation"; + SyntaxKind5[SyntaxKind5["LastPunctuation"] = 79 /* CaretEqualsToken */] = "LastPunctuation"; SyntaxKind5[SyntaxKind5["FirstToken"] = 0 /* Unknown */] = "FirstToken"; - SyntaxKind5[SyntaxKind5["LastToken"] = 162 /* LastKeyword */] = "LastToken"; + SyntaxKind5[SyntaxKind5["LastToken"] = 164 /* LastKeyword */] = "LastToken"; SyntaxKind5[SyntaxKind5["FirstTriviaToken"] = 2 /* SingleLineCommentTrivia */] = "FirstTriviaToken"; SyntaxKind5[SyntaxKind5["LastTriviaToken"] = 7 /* ConflictMarkerTrivia */] = "LastTriviaToken"; - SyntaxKind5[SyntaxKind5["FirstLiteralToken"] = 8 /* NumericLiteral */] = "FirstLiteralToken"; - SyntaxKind5[SyntaxKind5["LastLiteralToken"] = 14 /* NoSubstitutionTemplateLiteral */] = "LastLiteralToken"; - SyntaxKind5[SyntaxKind5["FirstTemplateToken"] = 14 /* NoSubstitutionTemplateLiteral */] = "FirstTemplateToken"; - SyntaxKind5[SyntaxKind5["LastTemplateToken"] = 17 /* TemplateTail */] = "LastTemplateToken"; - SyntaxKind5[SyntaxKind5["FirstBinaryOperator"] = 29 /* LessThanToken */] = "FirstBinaryOperator"; - SyntaxKind5[SyntaxKind5["LastBinaryOperator"] = 78 /* CaretEqualsToken */] = "LastBinaryOperator"; - SyntaxKind5[SyntaxKind5["FirstStatement"] = 240 /* VariableStatement */] = "FirstStatement"; - SyntaxKind5[SyntaxKind5["LastStatement"] = 256 /* DebuggerStatement */] = "LastStatement"; - SyntaxKind5[SyntaxKind5["FirstNode"] = 163 /* QualifiedName */] = "FirstNode"; - SyntaxKind5[SyntaxKind5["FirstJSDocNode"] = 312 /* JSDocTypeExpression */] = "FirstJSDocNode"; - SyntaxKind5[SyntaxKind5["LastJSDocNode"] = 353 /* JSDocSatisfiesTag */] = "LastJSDocNode"; - SyntaxKind5[SyntaxKind5["FirstJSDocTagNode"] = 330 /* JSDocTag */] = "FirstJSDocTagNode"; - SyntaxKind5[SyntaxKind5["LastJSDocTagNode"] = 353 /* JSDocSatisfiesTag */] = "LastJSDocTagNode"; - SyntaxKind5[SyntaxKind5["FirstContextualKeyword"] = 126 /* AbstractKeyword */] = "FirstContextualKeyword"; - SyntaxKind5[SyntaxKind5["LastContextualKeyword"] = 162 /* OfKeyword */] = "LastContextualKeyword"; + SyntaxKind5[SyntaxKind5["FirstLiteralToken"] = 9 /* NumericLiteral */] = "FirstLiteralToken"; + SyntaxKind5[SyntaxKind5["LastLiteralToken"] = 15 /* NoSubstitutionTemplateLiteral */] = "LastLiteralToken"; + SyntaxKind5[SyntaxKind5["FirstTemplateToken"] = 15 /* NoSubstitutionTemplateLiteral */] = "FirstTemplateToken"; + SyntaxKind5[SyntaxKind5["LastTemplateToken"] = 18 /* TemplateTail */] = "LastTemplateToken"; + SyntaxKind5[SyntaxKind5["FirstBinaryOperator"] = 30 /* LessThanToken */] = "FirstBinaryOperator"; + SyntaxKind5[SyntaxKind5["LastBinaryOperator"] = 79 /* CaretEqualsToken */] = "LastBinaryOperator"; + SyntaxKind5[SyntaxKind5["FirstStatement"] = 242 /* VariableStatement */] = "FirstStatement"; + SyntaxKind5[SyntaxKind5["LastStatement"] = 258 /* DebuggerStatement */] = "LastStatement"; + SyntaxKind5[SyntaxKind5["FirstNode"] = 165 /* QualifiedName */] = "FirstNode"; + SyntaxKind5[SyntaxKind5["FirstJSDocNode"] = 315 /* JSDocTypeExpression */] = "FirstJSDocNode"; + SyntaxKind5[SyntaxKind5["LastJSDocNode"] = 356 /* JSDocSatisfiesTag */] = "LastJSDocNode"; + SyntaxKind5[SyntaxKind5["FirstJSDocTagNode"] = 333 /* JSDocTag */] = "FirstJSDocTagNode"; + SyntaxKind5[SyntaxKind5["LastJSDocTagNode"] = 356 /* JSDocSatisfiesTag */] = "LastJSDocTagNode"; + SyntaxKind5[SyntaxKind5["FirstContextualKeyword"] = 128 /* AbstractKeyword */] = "FirstContextualKeyword"; + SyntaxKind5[SyntaxKind5["LastContextualKeyword"] = 164 /* OfKeyword */] = "LastContextualKeyword"; return SyntaxKind5; })(SyntaxKind || {}); NodeFlags = /* @__PURE__ */ ((NodeFlags3) => { @@ -4102,9 +4037,15 @@ ${lanes.join("\n")} TokenFlags2[TokenFlags2["ContainsSeparator"] = 512] = "ContainsSeparator"; TokenFlags2[TokenFlags2["UnicodeEscape"] = 1024] = "UnicodeEscape"; TokenFlags2[TokenFlags2["ContainsInvalidEscape"] = 2048] = "ContainsInvalidEscape"; + TokenFlags2[TokenFlags2["HexEscape"] = 4096] = "HexEscape"; + TokenFlags2[TokenFlags2["ContainsLeadingZero"] = 8192] = "ContainsLeadingZero"; + TokenFlags2[TokenFlags2["ContainsInvalidSeparator"] = 16384] = "ContainsInvalidSeparator"; TokenFlags2[TokenFlags2["BinaryOrOctalSpecifier"] = 384] = "BinaryOrOctalSpecifier"; - TokenFlags2[TokenFlags2["NumericLiteralFlags"] = 1008] = "NumericLiteralFlags"; - TokenFlags2[TokenFlags2["TemplateLiteralLikeFlags"] = 2048 /* ContainsInvalidEscape */] = "TemplateLiteralLikeFlags"; + TokenFlags2[TokenFlags2["WithSpecifier"] = 448] = "WithSpecifier"; + TokenFlags2[TokenFlags2["StringLiteralFlags"] = 7176] = "StringLiteralFlags"; + TokenFlags2[TokenFlags2["NumericLiteralFlags"] = 25584] = "NumericLiteralFlags"; + TokenFlags2[TokenFlags2["TemplateLiteralLikeFlags"] = 7176] = "TemplateLiteralLikeFlags"; + TokenFlags2[TokenFlags2["IsInvalid"] = 26656] = "IsInvalid"; return TokenFlags2; })(TokenFlags || {}); FlowFlags = /* @__PURE__ */ ((FlowFlags2) => { @@ -4484,7 +4425,6 @@ ${lanes.join("\n")} TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy"; TypeFlags2[TypeFlags2["PossiblyFalsy"] = 117724] = "PossiblyFalsy"; TypeFlags2[TypeFlags2["Intrinsic"] = 67359327] = "Intrinsic"; - TypeFlags2[TypeFlags2["Primitive"] = 134348796] = "Primitive"; TypeFlags2[TypeFlags2["StringLike"] = 402653316] = "StringLike"; TypeFlags2[TypeFlags2["NumberLike"] = 296] = "NumberLike"; TypeFlags2[TypeFlags2["BigIntLike"] = 2112] = "BigIntLike"; @@ -4492,6 +4432,7 @@ ${lanes.join("\n")} TypeFlags2[TypeFlags2["EnumLike"] = 1056] = "EnumLike"; TypeFlags2[TypeFlags2["ESSymbolLike"] = 12288] = "ESSymbolLike"; TypeFlags2[TypeFlags2["VoidLike"] = 49152] = "VoidLike"; + TypeFlags2[TypeFlags2["Primitive"] = 402784252] = "Primitive"; TypeFlags2[TypeFlags2["DefinitelyNonNullable"] = 470302716] = "DefinitelyNonNullable"; TypeFlags2[TypeFlags2["DisjointDomains"] = 469892092] = "DisjointDomains"; TypeFlags2[TypeFlags2["UnionOrIntersection"] = 3145728] = "UnionOrIntersection"; @@ -4501,17 +4442,17 @@ ${lanes.join("\n")} TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive"; TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable"; TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable"; - TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType"; + TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType"; TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable"; TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton"; TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable"; - TypeFlags2[TypeFlags2["IncludesMask"] = 205258751] = "IncludesMask"; + TypeFlags2[TypeFlags2["IncludesMask"] = 473694207] = "IncludesMask"; TypeFlags2[TypeFlags2["IncludesMissingType"] = 262144 /* TypeParameter */] = "IncludesMissingType"; TypeFlags2[TypeFlags2["IncludesNonWideningType"] = 4194304 /* Index */] = "IncludesNonWideningType"; TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard"; TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject"; TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable"; - TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323363] = "NotPrimitiveUnion"; + TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion"; return TypeFlags2; })(TypeFlags || {}); ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => { @@ -4595,6 +4536,13 @@ ${lanes.join("\n")} AccessFlags2[AccessFlags2["Persistent"] = 1 /* IncludeUndefined */] = "Persistent"; return AccessFlags2; })(AccessFlags || {}); + IndexFlags = /* @__PURE__ */ ((IndexFlags2) => { + IndexFlags2[IndexFlags2["None"] = 0] = "None"; + IndexFlags2[IndexFlags2["StringsOnly"] = 1] = "StringsOnly"; + IndexFlags2[IndexFlags2["NoIndexSignatures"] = 2] = "NoIndexSignatures"; + IndexFlags2[IndexFlags2["NoReducibleCheck"] = 4] = "NoReducibleCheck"; + return IndexFlags2; + })(IndexFlags || {}); JsxReferenceKind = /* @__PURE__ */ ((JsxReferenceKind2) => { JsxReferenceKind2[JsxReferenceKind2["Component"] = 0] = "Component"; JsxReferenceKind2[JsxReferenceKind2["Function"] = 1] = "Function"; @@ -4614,6 +4562,7 @@ ${lanes.join("\n")} SignatureFlags5[SignatureFlags5["IsInnerCallChain"] = 8] = "IsInnerCallChain"; SignatureFlags5[SignatureFlags5["IsOuterCallChain"] = 16] = "IsOuterCallChain"; SignatureFlags5[SignatureFlags5["IsUntypedSignatureInJSFile"] = 32] = "IsUntypedSignatureInJSFile"; + SignatureFlags5[SignatureFlags5["IsNonInferrable"] = 64] = "IsNonInferrable"; SignatureFlags5[SignatureFlags5["PropagatingFlags"] = 39] = "PropagatingFlags"; SignatureFlags5[SignatureFlags5["CallChainFlags"] = 24] = "CallChainFlags"; return SignatureFlags5; @@ -4819,6 +4768,7 @@ ${lanes.join("\n")} CharacterCodes2[CharacterCodes2["ideographicSpace"] = 12288] = "ideographicSpace"; CharacterCodes2[CharacterCodes2["mathematicalSpace"] = 8287] = "mathematicalSpace"; CharacterCodes2[CharacterCodes2["ogham"] = 5760] = "ogham"; + CharacterCodes2[CharacterCodes2["replacementCharacter"] = 65533] = "replacementCharacter"; CharacterCodes2[CharacterCodes2["_"] = 95] = "_"; CharacterCodes2[CharacterCodes2["$"] = 36] = "$"; CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0"; @@ -5038,9 +4988,8 @@ ${lanes.join("\n")} EmitFlags3[EmitFlags3["ReuseTempVariableScope"] = 1048576] = "ReuseTempVariableScope"; EmitFlags3[EmitFlags3["CustomPrologue"] = 2097152] = "CustomPrologue"; EmitFlags3[EmitFlags3["NoHoisting"] = 4194304] = "NoHoisting"; - EmitFlags3[EmitFlags3["HasEndOfDeclarationMarker"] = 8388608] = "HasEndOfDeclarationMarker"; - EmitFlags3[EmitFlags3["Iterator"] = 16777216] = "Iterator"; - EmitFlags3[EmitFlags3["NoAsciiEscaping"] = 33554432] = "NoAsciiEscaping"; + EmitFlags3[EmitFlags3["Iterator"] = 8388608] = "Iterator"; + EmitFlags3[EmitFlags3["NoAsciiEscaping"] = 16777216] = "NoAsciiEscaping"; return EmitFlags3; })(EmitFlags || {}); InternalEmitFlags = /* @__PURE__ */ ((InternalEmitFlags3) => { @@ -5385,7 +5334,7 @@ ${lanes.join("\n")} queue.pollScheduled = false; return queue; } - function pollPollingIntervalQueue(queue) { + function pollPollingIntervalQueue(_timeoutType, queue) { queue.pollIndex = pollQueue(queue, queue.pollingInterval, queue.pollIndex, pollingChunkSize[queue.pollingInterval]); if (queue.length) { scheduleNextPoll(queue.pollingInterval); @@ -5394,7 +5343,7 @@ ${lanes.join("\n")} queue.pollScheduled = false; } } - function pollLowPollingIntervalQueue(queue) { + function pollLowPollingIntervalQueue(_timeoutType, queue) { pollQueue( changedFilesInLastPoll, 250 /* Low */, @@ -5402,7 +5351,7 @@ ${lanes.join("\n")} 0, changedFilesInLastPoll.length ); - pollPollingIntervalQueue(queue); + pollPollingIntervalQueue(_timeoutType, queue); if (!queue.pollScheduled && changedFilesInLastPoll.length) { scheduleNextPoll(250 /* Low */); } @@ -5459,7 +5408,7 @@ ${lanes.join("\n")} } } function scheduleNextPoll(pollingInterval) { - pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)); + pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === 250 /* Low */ ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingInterval === 250 /* Low */ ? "pollLowPollingIntervalQueue" : "pollPollingIntervalQueue", pollingIntervalQueue(pollingInterval)); } } function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { @@ -5538,7 +5487,7 @@ ${lanes.join("\n")} function scheduleNextPoll() { if (!watchedFiles.length || pollScheduled) return; - pollScheduled = host.setTimeout(pollQueue, 2e3 /* High */); + pollScheduled = host.setTimeout(pollQueue, 2e3 /* High */, "pollQueue"); } } function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { @@ -5552,8 +5501,8 @@ ${lanes.join("\n")} watcher: createWatcher( // Cant infer types correctly so lets satisfy checker (param1, param2, param3) => { - var _a2; - return (_a2 = cache.get(path)) == null ? void 0 : _a2.callbacks.slice().forEach((cb) => cb(param1, param2, param3)); + var _a; + return (_a = cache.get(path)) == null ? void 0 : _a.callbacks.slice().forEach((cb) => cb(param1, param2, param3)); } ), callbacks: [callback] @@ -5704,7 +5653,7 @@ ${lanes.join("\n")} clearTimeout2(timerToUpdateChildWatches); timerToUpdateChildWatches = void 0; } - timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3); + timerToUpdateChildWatches = setTimeout2(onTimerToUpdateChildWatches, 1e3, "timerToUpdateChildWatches"); } function onTimerToUpdateChildWatches() { timerToUpdateChildWatches = void 0; @@ -6178,7 +6127,7 @@ ${lanes.join("\n")} let _crypto; try { _crypto = require("crypto"); - } catch (e) { + } catch { _crypto = void 0; } let activeSession; @@ -6206,7 +6155,7 @@ ${lanes.join("\n")} getAccessibleSortedChildDirectories: (path) => getAccessibleFileSystemEntries(path).directories, realpath, tscWatchFile: process.env.TSC_WATCHFILE, - useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER, + useNonPollingWatchers: !!process.env.TSC_NONPOLLING_WATCHER, tscWatchDirectory: process.env.TSC_WATCHDIRECTORY, inodeWatching: isLinuxOrMacOs, sysLog @@ -6268,7 +6217,7 @@ ${lanes.join("\n")} if (stat == null ? void 0 : stat.isFile()) { return stat.size; } - } catch (e) { + } catch { } return 0; }, @@ -6283,7 +6232,7 @@ ${lanes.join("\n")} tryEnableSourceMapsForHost() { try { require("source-map-support").install(); - } catch (e) { + } catch { } }, setTimeout, @@ -6292,8 +6241,10 @@ ${lanes.join("\n")} process.stdout.write("\x1Bc"); }, setBlocking: () => { - if (process.stdout && process.stdout._handle && process.stdout._handle.setBlocking) { - process.stdout._handle.setBlocking(true); + var _a; + const handle = (_a = process.stdout) == null ? void 0 : _a._handle; + if (handle && handle.setBlocking) { + handle.setBlocking(true); } }, bufferFrom, @@ -6362,17 +6313,17 @@ ${lanes.join("\n")} if (activeSession && activeSession !== "stopping") { const s = activeSession; activeSession.post("Profiler.stop", (err, { profile }) => { - var _a2; + var _a; if (!err) { try { - if ((_a2 = statSync(profilePath)) == null ? void 0 : _a2.isDirectory()) { + if ((_a = statSync(profilePath)) == null ? void 0 : _a.isDirectory()) { profilePath = _path.join(profilePath, `${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`); } - } catch (e) { + } catch { } try { _fs.mkdirSync(_path.dirname(profilePath), { recursive: true }); - } catch (e) { + } catch { } _fs.writeFileSync(profilePath, JSON.stringify(cleanupPaths(profile))); } @@ -6458,13 +6409,15 @@ ${lanes.join("\n")} return buffer.toString("utf8"); } function readFile(fileName, _encoding) { - perfLogger.logStartReadFile(fileName); + var _a, _b; + (_a = perfLogger) == null ? void 0 : _a.logStartReadFile(fileName); const file = readFileWorker(fileName, _encoding); - perfLogger.logStopReadFile(); + (_b = perfLogger) == null ? void 0 : _b.logStopReadFile(); return file; } function writeFile2(fileName, data, writeByteOrderMark) { - perfLogger.logEvent("WriteFile: " + fileName); + var _a; + (_a = perfLogger) == null ? void 0 : _a.logEvent("WriteFile: " + fileName); if (writeByteOrderMark) { data = byteOrderMarkIndicator + data; } @@ -6485,7 +6438,8 @@ ${lanes.join("\n")} } } function getAccessibleFileSystemEntries(path) { - perfLogger.logEvent("ReadDir: " + (path || ".")); + var _a; + (_a = perfLogger) == null ? void 0 : _a.logEvent("ReadDir: " + (path || ".")); try { const entries = _fs.readdirSync(path || ".", { withFileTypes: true }); const files = []; @@ -6562,16 +6516,16 @@ ${lanes.join("\n")} function realpath(path) { try { return fsRealpath(path); - } catch (e) { + } catch { return path; } } function getModifiedTime3(path) { - var _a2; + var _a; const originalStackTraceLimit = Error.stackTraceLimit; Error.stackTraceLimit = 0; try { - return (_a2 = statSync(path)) == null ? void 0 : _a2.mtime; + return (_a = statSync(path)) == null ? void 0 : _a.mtime; } catch (e) { return void 0; } finally { @@ -6782,11 +6736,11 @@ ${lanes.join("\n")} path = combinePaths(currentDirectory, path); return pathComponents(path, getRootLength(path)); } - function getPathFromPathComponents(pathComponents2) { + function getPathFromPathComponents(pathComponents2, length2) { if (pathComponents2.length === 0) return ""; const root = pathComponents2[0] && ensureTrailingDirectorySeparator(pathComponents2[0]); - return root + pathComponents2.slice(1).join(directorySeparator); + return root + pathComponents2.slice(1, length2).join(directorySeparator); } function normalizeSlashes(path) { return path.indexOf("\\") !== -1 ? path.replace(backslashRegExp, directorySeparator) : path; @@ -7112,7 +7066,6 @@ ${lanes.join("\n")} _0_modifier_cannot_appear_on_an_index_signature: diag(1071, 1 /* Error */, "_0_modifier_cannot_appear_on_an_index_signature_1071", "'{0}' modifier cannot appear on an index signature."), A_0_modifier_cannot_be_used_with_an_import_declaration: diag(1079, 1 /* Error */, "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", "A '{0}' modifier cannot be used with an import declaration."), Invalid_reference_directive_syntax: diag(1084, 1 /* Error */, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."), - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: diag(1085, 1 /* Error */, "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."), _0_modifier_cannot_appear_on_a_constructor_declaration: diag(1089, 1 /* Error */, "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", "'{0}' modifier cannot appear on a constructor declaration."), _0_modifier_cannot_appear_on_a_parameter: diag(1090, 1 /* Error */, "_0_modifier_cannot_appear_on_a_parameter_1090", "'{0}' modifier cannot appear on a parameter."), Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: diag(1091, 1 /* Error */, "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", "Only a single variable declaration is allowed in a 'for...in' statement."), @@ -7143,7 +7096,7 @@ ${lanes.join("\n")} An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: diag(1118, 1 /* Error */, "An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118", "An object literal cannot have multiple get/set accessors with the same name."), An_object_literal_cannot_have_property_and_accessor_with_the_same_name: diag(1119, 1 /* Error */, "An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119", "An object literal cannot have property and accessor with the same name."), An_export_assignment_cannot_have_modifiers: diag(1120, 1 /* Error */, "An_export_assignment_cannot_have_modifiers_1120", "An export assignment cannot have modifiers."), - Octal_literals_are_not_allowed_in_strict_mode: diag(1121, 1 /* Error */, "Octal_literals_are_not_allowed_in_strict_mode_1121", "Octal literals are not allowed in strict mode."), + Octal_literals_are_not_allowed_Use_the_syntax_0: diag(1121, 1 /* Error */, "Octal_literals_are_not_allowed_Use_the_syntax_0_1121", "Octal literals are not allowed. Use the syntax '{0}'."), Variable_declaration_list_cannot_be_empty: diag(1123, 1 /* Error */, "Variable_declaration_list_cannot_be_empty_1123", "Variable declaration list cannot be empty."), Digit_expected: diag(1124, 1 /* Error */, "Digit_expected_1124", "Digit expected."), Hexadecimal_digit_expected: diag(1125, 1 /* Error */, "Hexadecimal_digit_expected_1125", "Hexadecimal digit expected."), @@ -7258,6 +7211,7 @@ ${lanes.join("\n")} Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: diag(1250, 1 /* Error */, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'."), Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: diag(1251, 1 /* Error */, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode."), Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: diag(1252, 1 /* Error */, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode."), + Abstract_properties_can_only_appear_within_an_abstract_class: diag(1253, 1 /* Error */, "Abstract_properties_can_only_appear_within_an_abstract_class_1253", "Abstract properties can only appear within an abstract class."), A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_reference: diag(1254, 1 /* Error */, "A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_refere_1254", "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference."), A_definite_assignment_assertion_is_not_permitted_in_this_context: diag(1255, 1 /* Error */, "A_definite_assignment_assertion_is_not_permitted_in_this_context_1255", "A definite assignment assertion '!' is not permitted in this context."), A_required_element_cannot_follow_an_optional_element: diag(1257, 1 /* Error */, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."), @@ -7453,6 +7407,10 @@ ${lanes.join("\n")} _0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1484, 1 /* Error */, "_0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled_1484", "'{0}' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."), _0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled: diag(1485, 1 /* Error */, "_0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimMo_1485", "'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled."), Decorator_used_before_export_here: diag(1486, 1 /* Error */, "Decorator_used_before_export_here_1486", "Decorator used before 'export' here."), + Octal_escape_sequences_are_not_allowed_Use_the_syntax_0: diag(1487, 1 /* Error */, "Octal_escape_sequences_are_not_allowed_Use_the_syntax_0_1487", "Octal escape sequences are not allowed. Use the syntax '{0}'."), + Escape_sequence_0_is_not_allowed: diag(1488, 1 /* Error */, "Escape_sequence_0_is_not_allowed_1488", "Escape sequence '{0}' is not allowed."), + Decimals_with_leading_zeros_are_not_allowed: diag(1489, 1 /* Error */, "Decimals_with_leading_zeros_are_not_allowed_1489", "Decimals with leading zeros are not allowed."), + File_appears_to_be_binary: diag(1490, 1 /* Error */, "File_appears_to_be_binary_1490", "File appears to be binary."), The_types_of_0_are_incompatible_between_these_types: diag(2200, 1 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."), The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."), Call_signature_return_types_0_and_1_are_incompatible: diag( @@ -7556,7 +7514,7 @@ ${lanes.join("\n")} Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first: diag(2352, 1 /* Error */, "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352", "Conversion of type '{0}' to type '{1}' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first."), Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: diag(2353, 1 /* Error */, "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'."), This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: diag(2354, 1 /* Error */, "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", "This syntax requires an imported helper but module '{0}' cannot be found."), - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: diag(2355, 1 /* Error */, "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", "A function whose declared type is neither 'void' nor 'any' must return a value."), + A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value: diag(2355, 1 /* Error */, "A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value_2355", "A function whose declared type is neither 'undefined', 'void', nor 'any' must return a value."), An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2356, 1 /* Error */, "An_arithmetic_operand_must_be_of_type_any_number_bigint_or_an_enum_type_2356", "An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type."), The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, 1 /* 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, 1 /* 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."), @@ -7579,7 +7537,6 @@ ${lanes.join("\n")} Constructors_for_derived_classes_must_contain_a_super_call: diag(2377, 1 /* Error */, "Constructors_for_derived_classes_must_contain_a_super_call_2377", "Constructors for derived classes must contain a 'super' call."), A_get_accessor_must_return_a_value: diag(2378, 1 /* Error */, "A_get_accessor_must_return_a_value_2378", "A 'get' accessor must return a value."), Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties: diag(2379, 1 /* Error */, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_with_exactOptionalPropertyTypes_Colon_tr_2379", "Argument of type '{0}' is not assignable to parameter of type '{1}' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties."), - The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type: diag(2380, 1 /* Error */, "The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type_2380", "The return type of a 'get' accessor must be assignable to its 'set' accessor type"), Overload_signatures_must_all_be_exported_or_non_exported: diag(2383, 1 /* Error */, "Overload_signatures_must_all_be_exported_or_non_exported_2383", "Overload signatures must all be exported or non-exported."), Overload_signatures_must_all_be_ambient_or_non_ambient: diag(2384, 1 /* Error */, "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", "Overload signatures must all be ambient or non-ambient."), Overload_signatures_must_all_be_public_private_or_protected: diag(2385, 1 /* Error */, "Overload_signatures_must_all_be_public_private_or_protected_2385", "Overload signatures must all be public, private or protected."), @@ -7809,6 +7766,7 @@ ${lanes.join("\n")} Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, 1 /* 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, 1 /* 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, 1 /* 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."), + React_components_cannot_include_JSX_namespace_names: diag(2639, 1 /* Error */, "React_components_cannot_include_JSX_namespace_names_2639", "React components cannot include JSX namespace names"), Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, 1 /* 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, 1 /* 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, 1 /* 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."), @@ -7997,6 +7955,8 @@ ${lanes.join("\n")} Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, 1 /* 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, 1 /* Error */, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."), A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_file_0_instead: diag(2846, 1 /* Error */, "A_declaration_file_cannot_be_imported_without_import_type_Did_you_mean_to_import_an_implementation_f_2846", "A declaration file cannot be imported without 'import type'. Did you mean to import an implementation file '{0}' instead?"), + The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression: diag(2848, 1 /* Error */, "The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression_2848", "The right-hand side of an 'instanceof' expression must not be an instantiation expression."), + Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1: diag(2849, 1 /* Error */, "Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1_2849", "Target signature provides too few arguments. Expected {0} or more, but got {1}."), Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* 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, 1 /* 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, 1 /* 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}'."), @@ -8331,6 +8291,7 @@ ${lanes.join("\n")} List_of_folders_to_include_type_definitions_from: diag(6161, 3 /* Message */, "List_of_folders_to_include_type_definitions_from_6161", "List of folders to include type definitions from."), Disable_size_limitations_on_JavaScript_projects: diag(6162, 3 /* Message */, "Disable_size_limitations_on_JavaScript_projects_6162", "Disable size limitations on JavaScript projects."), The_character_set_of_the_input_files: diag(6163, 3 /* Message */, "The_character_set_of_the_input_files_6163", "The character set of the input files."), + Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1: diag(6164, 3 /* Message */, "Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1_6164", "Skipping module '{0}' that looks like an absolute URI, target file types: {1}."), Do_not_truncate_error_messages: diag(6165, 3 /* Message */, "Do_not_truncate_error_messages_6165", "Do not truncate error messages."), Output_directory_for_generated_declaration_files: diag(6166, 3 /* Message */, "Output_directory_for_generated_declaration_files_6166", "Output directory for generated declaration files."), A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl: diag(6167, 3 /* Message */, "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167", "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'."), @@ -8442,12 +8403,14 @@ ${lanes.join("\n")} Output_Formatting: diag(6256, 3 /* Message */, "Output_Formatting_6256", "Output Formatting"), Completeness: diag(6257, 3 /* Message */, "Completeness_6257", "Completeness"), _0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file: diag(6258, 1 /* Error */, "_0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file_6258", "'{0}' should be set inside the 'compilerOptions' object of the config json file"), - Found_1_error_in_1: diag(6259, 3 /* Message */, "Found_1_error_in_1_6259", "Found 1 error in {1}"), + Found_1_error_in_0: diag(6259, 3 /* Message */, "Found_1_error_in_0_6259", "Found 1 error in {0}"), Found_0_errors_in_the_same_file_starting_at_Colon_1: diag(6260, 3 /* Message */, "Found_0_errors_in_the_same_file_starting_at_Colon_1_6260", "Found {0} errors in the same file, starting at: {1}"), Found_0_errors_in_1_files: diag(6261, 3 /* Message */, "Found_0_errors_in_1_files_6261", "Found {0} errors in {1} files."), File_name_0_has_a_1_extension_looking_up_2_instead: diag(6262, 3 /* Message */, "File_name_0_has_a_1_extension_looking_up_2_instead_6262", "File name '{0}' has a '{1}' extension - looking up '{2}' instead."), Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set: diag(6263, 1 /* Error */, "Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set_6263", "Module '{0}' was resolved to '{1}', but '--allowArbitraryExtensions' is not set."), Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present: diag(6264, 3 /* Message */, "Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present_6264", "Enable importing files with any extension, provided a declaration file is present."), + Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder: diag(6265, 3 /* Message */, "Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_no_6265", "Resolving type reference directive for program that specifies custom typeRoots, skipping lookup in 'node_modules' folder."), + Option_0_can_only_be_specified_on_command_line: diag(6266, 1 /* Error */, "Option_0_can_only_be_specified_on_command_line_6266", "Option '{0}' can only be specified on command line."), Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, 3 /* Message */, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."), Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, 3 /* Message */, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."), Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, 3 /* Message */, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."), @@ -8788,8 +8751,6 @@ ${lanes.join("\n")} Parameter_modifiers_can_only_be_used_in_TypeScript_files: diag(8012, 1 /* Error */, "Parameter_modifiers_can_only_be_used_in_TypeScript_files_8012", "Parameter modifiers can only be used in TypeScript files."), Non_null_assertions_can_only_be_used_in_TypeScript_files: diag(8013, 1 /* Error */, "Non_null_assertions_can_only_be_used_in_TypeScript_files_8013", "Non-null assertions can only be used in TypeScript files."), Type_assertion_expressions_can_only_be_used_in_TypeScript_files: diag(8016, 1 /* Error */, "Type_assertion_expressions_can_only_be_used_in_TypeScript_files_8016", "Type assertion expressions can only be used in TypeScript files."), - Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: diag(8017, 1 /* Error */, "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", "Octal literal types must use ES2015 syntax. Use the syntax '{0}'."), - Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: diag(8018, 1 /* Error */, "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'."), Report_errors_in_js_files: diag(8019, 3 /* Message */, "Report_errors_in_js_files_8019", "Report errors in .js files."), JSDoc_types_can_only_be_used_inside_documentation_comments: diag(8020, 1 /* Error */, "JSDoc_types_can_only_be_used_inside_documentation_comments_8020", "JSDoc types can only be used inside documentation comments."), JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags: diag(8021, 1 /* Error */, "JSDoc_typedef_tag_should_either_have_a_type_annotation_or_be_followed_by_property_or_member_tags_8021", "JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags."), @@ -8810,6 +8771,7 @@ ${lanes.join("\n")} You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, 1 /* 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, 1 /* Error */, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."), Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export: diag(8038, 1 /* Error */, "Decorators_may_not_appear_after_export_or_export_default_if_they_also_appear_before_export_8038", "Decorators may not appear after 'export' or 'export default' if they also appear before 'export'."), + A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag: diag(8039, 1 /* Error */, "A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag_8039", "A JSDoc '@template' tag may not follow a '@typedef', '@callback', or '@overload' tag"), Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, 1 /* 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, 1 /* 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(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), @@ -8843,6 +8805,8 @@ ${lanes.join("\n")} This_may_be_converted_to_an_async_function: diag(80006, 2 /* Suggestion */, "This_may_be_converted_to_an_async_function_80006", "This may be converted to an async function."), await_has_no_effect_on_the_type_of_this_expression: diag(80007, 2 /* Suggestion */, "await_has_no_effect_on_the_type_of_this_expression_80007", "'await' has no effect on the type of this expression."), Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers: diag(80008, 2 /* Suggestion */, "Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accur_80008", "Numeric literals with absolute values equal to 2^53 or greater are too large to be represented accurately as integers."), + JSDoc_typedef_may_be_converted_to_TypeScript_type: diag(80009, 2 /* Suggestion */, "JSDoc_typedef_may_be_converted_to_TypeScript_type_80009", "JSDoc typedef may be converted to TypeScript type."), + JSDoc_typedefs_may_be_converted_to_TypeScript_types: diag(80010, 2 /* Suggestion */, "JSDoc_typedefs_may_be_converted_to_TypeScript_types_80010", "JSDoc typedefs may be converted to TypeScript types."), Add_missing_super_call: diag(90001, 3 /* Message */, "Add_missing_super_call_90001", "Add missing 'super()' call"), Make_super_call_the_first_statement_in_the_constructor: diag(90002, 3 /* Message */, "Make_super_call_the_first_statement_in_the_constructor_90002", "Make 'super()' call the first statement in the constructor"), Change_extends_to_implements: diag(90003, 3 /* Message */, "Change_extends_to_implements_90003", "Change 'extends' to 'implements'"), @@ -9057,6 +9021,10 @@ ${lanes.join("\n")} Rename_param_tag_name_0_to_1: diag(95173, 3 /* Message */, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"), Use_0: diag(95174, 3 /* Message */, "Use_0_95174", "Use `{0}`."), Use_Number_isNaN_in_all_conditions: diag(95175, 3 /* Message */, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."), + Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."), + Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."), + Move_to_file: diag(95178, 3 /* Message */, "Move_to_file_95178", "Move to file"), + Cannot_move_to_file_selected_file_is_invalid: diag(95179, 3 /* Message */, "Cannot_move_to_file_selected_file_is_invalid_95179", "Cannot move to file, selected file is invalid"), No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* 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, 1 /* 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, 1 /* 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?"), @@ -9096,17 +9064,19 @@ ${lanes.join("\n")} _0_is_possibly_undefined: diag(18048, 1 /* Error */, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."), _0_is_possibly_null_or_undefined: diag(18049, 1 /* Error */, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."), The_value_0_cannot_be_used_here: diag(18050, 1 /* Error */, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."), - Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string.") + Compiler_option_0_cannot_be_given_an_empty_string: diag(18051, 1 /* Error */, "Compiler_option_0_cannot_be_given_an_empty_string_18051", "Compiler option '{0}' cannot be given an empty string."), + Non_abstract_class_0_does_not_implement_all_abstract_members_of_1: diag(18052, 1 /* Error */, "Non_abstract_class_0_does_not_implement_all_abstract_members_of_1_18052", "Non-abstract class '{0}' does not implement all abstract members of '{1}'"), + Its_type_0_is_not_a_valid_JSX_element_type: diag(18053, 1 /* Error */, "Its_type_0_is_not_a_valid_JSX_element_type_18053", "Its type '{0}' is not a valid JSX element type.") }; } }); // src/compiler/scanner.ts function tokenIsIdentifierOrKeyword(token) { - return token >= 79 /* Identifier */; + return token >= 80 /* Identifier */; } function tokenIsIdentifierOrKeywordOrGreaterThan(token) { - return token === 31 /* GreaterThanToken */ || tokenIsIdentifierOrKeyword(token); + return token === 32 /* GreaterThanToken */ || tokenIsIdentifierOrKeyword(token); } function lookupInUnicodeMap(code, map2) { if (code < map2[0]) { @@ -9604,8 +9574,8 @@ ${lanes.join("\n")} var text = textInitial; var pos; var end; - var startPos; - var tokenPos; + var fullStartPos; + var tokenStart; var token; var tokenValue; var tokenFlags; @@ -9613,21 +9583,24 @@ ${lanes.join("\n")} var inJSDocType = 0; setText(text, start, length2); var scanner2 = { - getStartPos: () => startPos, + getTokenFullStart: () => fullStartPos, + getStartPos: () => fullStartPos, + getTokenEnd: () => pos, getTextPos: () => pos, getToken: () => token, - getTokenPos: () => tokenPos, - getTokenText: () => text.substring(tokenPos, pos), + getTokenStart: () => tokenStart, + getTokenPos: () => tokenStart, + getTokenText: () => text.substring(tokenStart, pos), getTokenValue: () => tokenValue, hasUnicodeEscape: () => (tokenFlags & 1024 /* UnicodeEscape */) !== 0, hasExtendedUnicodeEscape: () => (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0, hasPrecedingLineBreak: () => (tokenFlags & 1 /* PrecedingLineBreak */) !== 0, hasPrecedingJSDocComment: () => (tokenFlags & 2 /* PrecedingJSDocComment */) !== 0, - isIdentifier: () => token === 79 /* Identifier */ || token > 116 /* LastReservedWord */, - isReservedWord: () => token >= 81 /* FirstReservedWord */ && token <= 116 /* LastReservedWord */, + isIdentifier: () => token === 80 /* Identifier */ || token > 118 /* LastReservedWord */, + isReservedWord: () => token >= 83 /* FirstReservedWord */ && token <= 118 /* LastReservedWord */, isUnterminated: () => (tokenFlags & 4 /* Unterminated */) !== 0, getCommentDirectives: () => commentDirectives, - getNumericLiteralFlags: () => tokenFlags & 1008 /* NumericLiteralFlags */, + getNumericLiteralFlags: () => tokenFlags & 25584 /* NumericLiteralFlags */, getTokenFlags: () => tokenFlags, reScanGreaterToken, reScanAsteriskEqualsToken, @@ -9644,6 +9617,7 @@ ${lanes.join("\n")} reScanInvalidIdentifier, scanJsxToken, scanJsDocToken, + scanJSDocCommentTextToken, scan, getText, clearCommentDirectives, @@ -9651,7 +9625,8 @@ ${lanes.join("\n")} setScriptTarget, setLanguageVariant, setOnError, - setTextPos, + resetTokenState, + setTextPos: resetTokenState, setInJSDocType, tryScan, lookAhead, @@ -9661,16 +9636,16 @@ ${lanes.join("\n")} Object.defineProperty(scanner2, "__debugShowCurrentPositionInText", { get: () => { const text2 = scanner2.getText(); - return text2.slice(0, scanner2.getStartPos()) + "\u2551" + text2.slice(scanner2.getStartPos()); + return text2.slice(0, scanner2.getTokenFullStart()) + "\u2551" + text2.slice(scanner2.getTokenFullStart()); } }); } return scanner2; - function error(message, errPos = pos, length3) { + function error(message, errPos = pos, length3, arg0) { if (onError) { const oldPos = pos; pos = errPos; - onError(message, length3 || 0); + onError(message, length3 || 0, arg0); pos = oldPos; } } @@ -9687,10 +9662,13 @@ ${lanes.join("\n")} allowSeparator = false; isPreviousTokenSeparator = true; result += text.substring(start2, pos); - } else if (isPreviousTokenSeparator) { - error(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); } else { - error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); + tokenFlags |= 16384 /* ContainsInvalidSeparator */; + if (isPreviousTokenSeparator) { + error(Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted, pos, 1); + } else { + error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); + } } pos++; start2 = pos; @@ -9705,13 +9683,39 @@ ${lanes.join("\n")} break; } if (text.charCodeAt(pos - 1) === 95 /* _ */) { + tokenFlags |= 16384 /* ContainsInvalidSeparator */; error(Diagnostics.Numeric_separators_are_not_allowed_here, pos - 1, 1); } return result + text.substring(start2, pos); } function scanNumber() { - const start2 = pos; - const mainFragment = scanNumberFragment(); + let start2 = pos; + let mainFragment; + if (text.charCodeAt(pos) === 48 /* _0 */) { + pos++; + if (text.charCodeAt(pos) === 95 /* _ */) { + tokenFlags |= 512 /* ContainsSeparator */ | 16384 /* ContainsInvalidSeparator */; + error(Diagnostics.Numeric_separators_are_not_allowed_here, pos, 1); + pos--; + mainFragment = scanNumberFragment(); + } else if (!scanDigits()) { + tokenFlags |= 8192 /* ContainsLeadingZero */; + mainFragment = "" + +tokenValue; + } else if (!tokenValue) { + mainFragment = "0"; + } else { + tokenValue = "" + parseInt(tokenValue, 8); + tokenFlags |= 32 /* Octal */; + const withMinus = token === 41 /* MinusToken */; + const literal = (withMinus ? "-" : "") + "0o" + (+tokenValue).toString(8); + if (withMinus) + start2--; + error(Diagnostics.Octal_literals_are_not_allowed_Use_the_syntax_0, start2, pos - start2, literal); + return { type: 9 /* NumericLiteral */, value: tokenValue }; + } + } else { + mainFragment = scanNumberFragment(); + } let decimalFragment; let scientificFragment; if (text.charCodeAt(pos) === 46 /* dot */) { @@ -9745,10 +9749,14 @@ ${lanes.join("\n")} } else { result = text.substring(start2, end2); } + if (tokenFlags & 8192 /* ContainsLeadingZero */) { + error(Diagnostics.Decimals_with_leading_zeros_are_not_allowed, start2, end2 - start2); + return { type: 9 /* NumericLiteral */, value: "" + +result }; + } if (decimalFragment !== void 0 || tokenFlags & 16 /* Scientific */) { checkForIdentifierStartAfterNumericLiteral(start2, decimalFragment === void 0 && !!(tokenFlags & 16 /* Scientific */)); return { - type: 8 /* NumericLiteral */, + type: 9 /* NumericLiteral */, value: "" + +result // if value is not an integer, it can be safely coerced to a number }; @@ -9776,12 +9784,17 @@ ${lanes.join("\n")} pos = identifierStart; } } - function scanOctalDigits() { + function scanDigits() { const start2 = pos; - while (isOctalDigit(text.charCodeAt(pos))) { + let isOctal = true; + while (isDigit(text.charCodeAt(pos))) { + if (!isOctalDigit(text.charCodeAt(pos))) { + isOctal = false; + } pos++; } - return +text.substring(start2, pos); + tokenValue = text.substring(start2, pos); + return isOctal; } function scanExactNumberOfHexDigits(count, canHaveSeparators) { const valueString = scanHexDigits( @@ -9859,7 +9872,10 @@ ${lanes.join("\n")} } if (ch === 92 /* backslash */ && !jsxAttributeString) { result += text.substring(start2, pos); - result += scanEscapeSequence(); + result += scanEscapeSequence( + /*shouldEmitInvalidEscapeError*/ + true + ); start2 = pos; continue; } @@ -9873,7 +9889,7 @@ ${lanes.join("\n")} } return result; } - function scanTemplateAndSetTokenValue(isTaggedTemplate) { + function scanTemplateAndSetTokenValue(shouldEmitInvalidEscapeError) { const startedWithBacktick = text.charCodeAt(pos) === 96 /* backtick */; pos++; let start2 = pos; @@ -9884,25 +9900,25 @@ ${lanes.join("\n")} contents += text.substring(start2, pos); tokenFlags |= 4 /* Unterminated */; error(Diagnostics.Unterminated_template_literal); - resultingToken = startedWithBacktick ? 14 /* NoSubstitutionTemplateLiteral */ : 17 /* TemplateTail */; + resultingToken = startedWithBacktick ? 15 /* NoSubstitutionTemplateLiteral */ : 18 /* TemplateTail */; break; } const currChar = text.charCodeAt(pos); if (currChar === 96 /* backtick */) { contents += text.substring(start2, pos); pos++; - resultingToken = startedWithBacktick ? 14 /* NoSubstitutionTemplateLiteral */ : 17 /* TemplateTail */; + resultingToken = startedWithBacktick ? 15 /* NoSubstitutionTemplateLiteral */ : 18 /* TemplateTail */; break; } if (currChar === 36 /* $ */ && pos + 1 < end && text.charCodeAt(pos + 1) === 123 /* openBrace */) { contents += text.substring(start2, pos); pos += 2; - resultingToken = startedWithBacktick ? 15 /* TemplateHead */ : 16 /* TemplateMiddle */; + resultingToken = startedWithBacktick ? 16 /* TemplateHead */ : 17 /* TemplateMiddle */; break; } if (currChar === 92 /* backslash */) { contents += text.substring(start2, pos); - contents += scanEscapeSequence(isTaggedTemplate); + contents += scanEscapeSequence(shouldEmitInvalidEscapeError); start2 = pos; continue; } @@ -9922,7 +9938,7 @@ ${lanes.join("\n")} tokenValue = contents; return resultingToken; } - function scanEscapeSequence(isTaggedTemplate) { + function scanEscapeSequence(shouldEmitInvalidEscapeError) { const start2 = pos; pos++; if (pos >= end) { @@ -9933,12 +9949,37 @@ ${lanes.join("\n")} pos++; switch (ch) { case 48 /* _0 */: - if (isTaggedTemplate && pos < end && isDigit(text.charCodeAt(pos))) { - pos++; - tokenFlags |= 2048 /* ContainsInvalidEscape */; - return text.substring(start2, pos); + if (pos >= end || !isDigit(text.charCodeAt(pos))) { + return "\0"; } - return "\0"; + case 49 /* _1 */: + case 50 /* _2 */: + case 51 /* _3 */: + if (pos < end && isOctalDigit(text.charCodeAt(pos))) { + pos++; + } + case 52 /* _4 */: + case 53 /* _5 */: + case 54 /* _6 */: + case 55 /* _7 */: + if (pos < end && isOctalDigit(text.charCodeAt(pos))) { + pos++; + } + tokenFlags |= 2048 /* ContainsInvalidEscape */; + if (shouldEmitInvalidEscapeError) { + const code = parseInt(text.substring(start2 + 1, pos), 8); + error(Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0, start2, pos - start2, "\\x" + padLeft(code.toString(16), 2, "0")); + return String.fromCharCode(code); + } + return text.substring(start2, pos); + case 56 /* _8 */: + case 57 /* _9 */: + tokenFlags |= 2048 /* ContainsInvalidEscape */; + if (shouldEmitInvalidEscapeError) { + error(Diagnostics.Escape_sequence_0_is_not_allowed, start2, pos - start2, text.substring(start2, pos)); + return String.fromCharCode(ch); + } + return text.substring(start2, pos); case 98 /* b */: return "\b"; case 116 /* t */: @@ -9956,59 +9997,69 @@ ${lanes.join("\n")} case 34 /* doubleQuote */: return '"'; case 117 /* u */: - if (isTaggedTemplate) { - for (let escapePos = pos; escapePos < pos + 4; escapePos++) { - if (escapePos < end && !isHexDigit(text.charCodeAt(escapePos)) && text.charCodeAt(escapePos) !== 123 /* openBrace */) { - pos = escapePos; - tokenFlags |= 2048 /* ContainsInvalidEscape */; - return text.substring(start2, pos); - } - } - } if (pos < end && text.charCodeAt(pos) === 123 /* openBrace */) { pos++; - if (isTaggedTemplate && !isHexDigit(text.charCodeAt(pos))) { + const escapedValueString = scanMinimumNumberOfHexDigits( + 1, + /*canHaveSeparators*/ + false + ); + const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1; + if (escapedValue < 0) { tokenFlags |= 2048 /* ContainsInvalidEscape */; + if (shouldEmitInvalidEscapeError) { + error(Diagnostics.Hexadecimal_digit_expected); + } return text.substring(start2, pos); } - if (isTaggedTemplate) { - const savePos = pos; - const escapedValueString = scanMinimumNumberOfHexDigits( - 1, - /*canHaveSeparators*/ - false - ); - const escapedValue = escapedValueString ? parseInt(escapedValueString, 16) : -1; - if (!isCodePoint(escapedValue) || text.charCodeAt(pos) !== 125 /* closeBrace */) { - tokenFlags |= 2048 /* ContainsInvalidEscape */; - return text.substring(start2, pos); - } else { - pos = savePos; + if (!isCodePoint(escapedValue)) { + tokenFlags |= 2048 /* ContainsInvalidEscape */; + if (shouldEmitInvalidEscapeError) { + error(Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive); } + return text.substring(start2, pos); } + if (pos >= end) { + tokenFlags |= 2048 /* ContainsInvalidEscape */; + if (shouldEmitInvalidEscapeError) { + error(Diagnostics.Unexpected_end_of_text); + } + return text.substring(start2, pos); + } + if (text.charCodeAt(pos) !== 125 /* closeBrace */) { + tokenFlags |= 2048 /* ContainsInvalidEscape */; + if (shouldEmitInvalidEscapeError) { + error(Diagnostics.Unterminated_Unicode_escape_sequence); + } + return text.substring(start2, pos); + } + pos++; tokenFlags |= 8 /* ExtendedUnicodeEscape */; - return scanExtendedUnicodeEscape(); + return utf16EncodeAsString(escapedValue); + } + for (; pos < start2 + 6; pos++) { + if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) { + tokenFlags |= 2048 /* ContainsInvalidEscape */; + if (shouldEmitInvalidEscapeError) { + error(Diagnostics.Hexadecimal_digit_expected); + } + return text.substring(start2, pos); + } } tokenFlags |= 1024 /* UnicodeEscape */; - return scanHexadecimalEscape( - /*numDigits*/ - 4 - ); + return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16)); case 120 /* x */: - if (isTaggedTemplate) { - if (!isHexDigit(text.charCodeAt(pos))) { - tokenFlags |= 2048 /* ContainsInvalidEscape */; - return text.substring(start2, pos); - } else if (!isHexDigit(text.charCodeAt(pos + 1))) { - pos++; + for (; pos < start2 + 4; pos++) { + if (!(pos < end && isHexDigit(text.charCodeAt(pos)))) { tokenFlags |= 2048 /* ContainsInvalidEscape */; + if (shouldEmitInvalidEscapeError) { + error(Diagnostics.Hexadecimal_digit_expected); + } return text.substring(start2, pos); } } - return scanHexadecimalEscape( - /*numDigits*/ - 2 - ); + tokenFlags |= 4096 /* HexEscape */; + return String.fromCharCode(parseInt(text.substring(start2 + 2, pos), 16)); case 13 /* carriageReturn */: if (pos < end && text.charCodeAt(pos) === 10 /* lineFeed */) { pos++; @@ -10021,19 +10072,6 @@ ${lanes.join("\n")} return String.fromCharCode(ch); } } - function scanHexadecimalEscape(numDigits) { - const escapedValue = scanExactNumberOfHexDigits( - numDigits, - /*canHaveSeparators*/ - false - ); - if (escapedValue >= 0) { - return String.fromCharCode(escapedValue); - } else { - error(Diagnostics.Hexadecimal_digit_expected); - return ""; - } - } function scanExtendedUnicodeEscape() { const escapedValueString = scanMinimumNumberOfHexDigits( 1, @@ -10135,7 +10173,7 @@ ${lanes.join("\n")} } } } - return token = 79 /* Identifier */; + return token = 80 /* Identifier */; } function scanBinaryOrOctalDigits(base) { let value = ""; @@ -10176,29 +10214,36 @@ ${lanes.join("\n")} tokenValue = parsePseudoBigInt(tokenValue) + "n"; } pos++; - return 9 /* BigIntLiteral */; + return 10 /* BigIntLiteral */; } else { const numericValue = tokenFlags & 128 /* BinarySpecifier */ ? parseInt(tokenValue.slice(2), 2) : tokenFlags & 256 /* OctalSpecifier */ ? parseInt(tokenValue.slice(2), 8) : +tokenValue; tokenValue = "" + numericValue; - return 8 /* NumericLiteral */; + return 9 /* NumericLiteral */; } } function scan() { - startPos = pos; + fullStartPos = pos; tokenFlags = 0 /* None */; let asteriskSeen = false; while (true) { - tokenPos = pos; + tokenStart = pos; if (pos >= end) { return token = 1 /* EndOfFileToken */; } const ch = codePointAt(text, pos); - if (ch === 35 /* hash */ && pos === 0 && isShebangTrivia(text, pos)) { - pos = scanShebangTrivia(text, pos); - if (skipTrivia2) { - continue; - } else { - return token = 6 /* ShebangTrivia */; + if (pos === 0) { + if (ch === 65533 /* replacementCharacter */) { + error(Diagnostics.File_appears_to_be_binary); + pos = end; + return token = 8 /* NonTextFileMarkerTrivia */; + } + if (ch === 35 /* hash */ && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + if (skipTrivia2) { + continue; + } else { + return token = 6 /* ShebangTrivia */; + } } } switch (ch) { @@ -10250,92 +10295,92 @@ ${lanes.join("\n")} case 33 /* exclamation */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 37 /* ExclamationEqualsEqualsToken */; + return pos += 3, token = 38 /* ExclamationEqualsEqualsToken */; } - return pos += 2, token = 35 /* ExclamationEqualsToken */; + return pos += 2, token = 36 /* ExclamationEqualsToken */; } pos++; - return token = 53 /* ExclamationToken */; + return token = 54 /* ExclamationToken */; case 34 /* doubleQuote */: case 39 /* singleQuote */: tokenValue = scanString(); - return token = 10 /* StringLiteral */; + return token = 11 /* StringLiteral */; case 96 /* backtick */: return token = scanTemplateAndSetTokenValue( - /* isTaggedTemplate */ + /*shouldEmitInvalidEscapeError*/ false ); case 37 /* percent */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 69 /* PercentEqualsToken */; + return pos += 2, token = 70 /* PercentEqualsToken */; } pos++; - return token = 44 /* PercentToken */; + return token = 45 /* PercentToken */; case 38 /* ampersand */: if (text.charCodeAt(pos + 1) === 38 /* ampersand */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 76 /* AmpersandAmpersandEqualsToken */; + return pos += 3, token = 77 /* AmpersandAmpersandEqualsToken */; } - return pos += 2, token = 55 /* AmpersandAmpersandToken */; + return pos += 2, token = 56 /* AmpersandAmpersandToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 73 /* AmpersandEqualsToken */; + return pos += 2, token = 74 /* AmpersandEqualsToken */; } pos++; - return token = 50 /* AmpersandToken */; + return token = 51 /* AmpersandToken */; case 40 /* openParen */: pos++; - return token = 20 /* OpenParenToken */; + return token = 21 /* OpenParenToken */; case 41 /* closeParen */: pos++; - return token = 21 /* CloseParenToken */; + return token = 22 /* CloseParenToken */; case 42 /* asterisk */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 66 /* AsteriskEqualsToken */; + return pos += 2, token = 67 /* AsteriskEqualsToken */; } if (text.charCodeAt(pos + 1) === 42 /* asterisk */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 67 /* AsteriskAsteriskEqualsToken */; + return pos += 3, token = 68 /* AsteriskAsteriskEqualsToken */; } - return pos += 2, token = 42 /* AsteriskAsteriskToken */; + return pos += 2, token = 43 /* AsteriskAsteriskToken */; } pos++; if (inJSDocType && !asteriskSeen && tokenFlags & 1 /* PrecedingLineBreak */) { asteriskSeen = true; continue; } - return token = 41 /* AsteriskToken */; + return token = 42 /* AsteriskToken */; case 43 /* plus */: if (text.charCodeAt(pos + 1) === 43 /* plus */) { - return pos += 2, token = 45 /* PlusPlusToken */; + return pos += 2, token = 46 /* PlusPlusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 64 /* PlusEqualsToken */; + return pos += 2, token = 65 /* PlusEqualsToken */; } pos++; - return token = 39 /* PlusToken */; + return token = 40 /* PlusToken */; case 44 /* comma */: pos++; - return token = 27 /* CommaToken */; + return token = 28 /* CommaToken */; case 45 /* minus */: if (text.charCodeAt(pos + 1) === 45 /* minus */) { - return pos += 2, token = 46 /* MinusMinusToken */; + return pos += 2, token = 47 /* MinusMinusToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 65 /* MinusEqualsToken */; + return pos += 2, token = 66 /* MinusEqualsToken */; } pos++; - return token = 40 /* MinusToken */; + return token = 41 /* MinusToken */; case 46 /* dot */: if (isDigit(text.charCodeAt(pos + 1))) { tokenValue = scanNumber().value; - return token = 8 /* NumericLiteral */; + return token = 9 /* NumericLiteral */; } if (text.charCodeAt(pos + 1) === 46 /* dot */ && text.charCodeAt(pos + 2) === 46 /* dot */) { - return pos += 3, token = 25 /* DotDotDotToken */; + return pos += 3, token = 26 /* DotDotDotToken */; } pos++; - return token = 24 /* DotToken */; + return token = 25 /* DotToken */; case 47 /* slash */: if (text.charCodeAt(pos + 1) === 47 /* slash */) { pos += 2; @@ -10347,9 +10392,9 @@ ${lanes.join("\n")} } commentDirectives = appendIfCommentDirective( commentDirectives, - text.slice(tokenPos, pos), + text.slice(tokenStart, pos), commentDirectiveRegExSingleLine, - tokenPos + tokenStart ); if (skipTrivia2) { continue; @@ -10363,7 +10408,7 @@ ${lanes.join("\n")} tokenFlags |= 2 /* PrecedingJSDocComment */; } let commentClosed = false; - let lastLineStart = tokenPos; + let lastLineStart = tokenStart; while (pos < end) { const ch2 = text.charCodeAt(pos); if (ch2 === 42 /* asterisk */ && text.charCodeAt(pos + 1) === 47 /* slash */) { @@ -10391,10 +10436,10 @@ ${lanes.join("\n")} } } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 68 /* SlashEqualsToken */; + return pos += 2, token = 69 /* SlashEqualsToken */; } pos++; - return token = 43 /* SlashToken */; + return token = 44 /* SlashToken */; case 48 /* _0 */: if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 /* X */ || text.charCodeAt(pos + 1) === 120 /* x */)) { pos += 2; @@ -10437,11 +10482,6 @@ ${lanes.join("\n")} tokenFlags |= 256 /* OctalSpecifier */; return token = checkBigIntSuffix(); } - if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { - tokenValue = "" + scanOctalDigits(); - tokenFlags |= 32 /* Octal */; - return token = 8 /* NumericLiteral */; - } case 49 /* _1 */: case 50 /* _2 */: case 51 /* _3 */: @@ -10455,10 +10495,10 @@ ${lanes.join("\n")} return token; case 58 /* colon */: pos++; - return token = 58 /* ColonToken */; + return token = 59 /* ColonToken */; case 59 /* semicolon */: pos++; - return token = 26 /* SemicolonToken */; + return token = 27 /* SemicolonToken */; case 60 /* lessThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -10470,18 +10510,18 @@ ${lanes.join("\n")} } if (text.charCodeAt(pos + 1) === 60 /* lessThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 70 /* LessThanLessThanEqualsToken */; + return pos += 3, token = 71 /* LessThanLessThanEqualsToken */; } - return pos += 2, token = 47 /* LessThanLessThanToken */; + return pos += 2, token = 48 /* LessThanLessThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 32 /* LessThanEqualsToken */; + return pos += 2, token = 33 /* LessThanEqualsToken */; } if (languageVariant === 1 /* JSX */ && text.charCodeAt(pos + 1) === 47 /* slash */ && text.charCodeAt(pos + 2) !== 42 /* asterisk */) { - return pos += 2, token = 30 /* LessThanSlashToken */; + return pos += 2, token = 31 /* LessThanSlashToken */; } pos++; - return token = 29 /* LessThanToken */; + return token = 30 /* LessThanToken */; case 61 /* equals */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -10493,15 +10533,15 @@ ${lanes.join("\n")} } if (text.charCodeAt(pos + 1) === 61 /* equals */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 36 /* EqualsEqualsEqualsToken */; + return pos += 3, token = 37 /* EqualsEqualsEqualsToken */; } - return pos += 2, token = 34 /* EqualsEqualsToken */; + return pos += 2, token = 35 /* EqualsEqualsToken */; } if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { - return pos += 2, token = 38 /* EqualsGreaterThanToken */; + return pos += 2, token = 39 /* EqualsGreaterThanToken */; } pos++; - return token = 63 /* EqualsToken */; + return token = 64 /* EqualsToken */; case 62 /* greaterThan */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -10512,34 +10552,34 @@ ${lanes.join("\n")} } } pos++; - return token = 31 /* GreaterThanToken */; + return token = 32 /* GreaterThanToken */; case 63 /* question */: if (text.charCodeAt(pos + 1) === 46 /* dot */ && !isDigit(text.charCodeAt(pos + 2))) { - return pos += 2, token = 28 /* QuestionDotToken */; + return pos += 2, token = 29 /* QuestionDotToken */; } if (text.charCodeAt(pos + 1) === 63 /* question */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 77 /* QuestionQuestionEqualsToken */; + return pos += 3, token = 78 /* QuestionQuestionEqualsToken */; } - return pos += 2, token = 60 /* QuestionQuestionToken */; + return pos += 2, token = 61 /* QuestionQuestionToken */; } pos++; - return token = 57 /* QuestionToken */; + return token = 58 /* QuestionToken */; case 91 /* openBracket */: pos++; - return token = 22 /* OpenBracketToken */; + return token = 23 /* OpenBracketToken */; case 93 /* closeBracket */: pos++; - return token = 23 /* CloseBracketToken */; + return token = 24 /* CloseBracketToken */; case 94 /* caret */: if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 78 /* CaretEqualsToken */; + return pos += 2, token = 79 /* CaretEqualsToken */; } pos++; - return token = 52 /* CaretToken */; + return token = 53 /* CaretToken */; case 123 /* openBrace */: pos++; - return token = 18 /* OpenBraceToken */; + return token = 19 /* OpenBraceToken */; case 124 /* bar */: if (isConflictMarkerTrivia(text, pos)) { pos = scanConflictMarkerTrivia(text, pos, error); @@ -10551,24 +10591,24 @@ ${lanes.join("\n")} } if (text.charCodeAt(pos + 1) === 124 /* bar */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 75 /* BarBarEqualsToken */; + return pos += 3, token = 76 /* BarBarEqualsToken */; } - return pos += 2, token = 56 /* BarBarToken */; + return pos += 2, token = 57 /* BarBarToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 74 /* BarEqualsToken */; + return pos += 2, token = 75 /* BarEqualsToken */; } pos++; - return token = 51 /* BarToken */; + return token = 52 /* BarToken */; case 125 /* closeBrace */: pos++; - return token = 19 /* CloseBraceToken */; + return token = 20 /* CloseBraceToken */; case 126 /* tilde */: pos++; - return token = 54 /* TildeToken */; + return token = 55 /* TildeToken */; case 64 /* at */: pos++; - return token = 59 /* AtToken */; + return token = 60 /* AtToken */; case 92 /* backslash */: const extendedCookedChar = peekExtendedUnicodeEscape(); if (extendedCookedChar >= 0 && isIdentifierStart(extendedCookedChar, languageVersion)) { @@ -10601,14 +10641,14 @@ ${lanes.join("\n")} pos += 3; tokenFlags |= 8 /* ExtendedUnicodeEscape */; tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts(); - return token = 80 /* PrivateIdentifier */; + return token = 81 /* PrivateIdentifier */; } const cookedChar2 = peekUnicodeEscape(); if (cookedChar2 >= 0 && isIdentifierStart(cookedChar2, languageVersion)) { pos += 6; tokenFlags |= 1024 /* UnicodeEscape */; tokenValue = "#" + String.fromCharCode(cookedChar2) + scanIdentifierParts(); - return token = 80 /* PrivateIdentifier */; + return token = 81 /* PrivateIdentifier */; } pos--; } @@ -10619,7 +10659,7 @@ ${lanes.join("\n")} tokenValue = "#"; error(Diagnostics.Invalid_character, pos++, charSize(ch)); } - return token = 80 /* PrivateIdentifier */; + return token = 81 /* PrivateIdentifier */; default: const identifierKind = scanIdentifier(ch, languageVersion); if (identifierKind) { @@ -10641,7 +10681,7 @@ ${lanes.join("\n")} } function reScanInvalidIdentifier() { Debug.assert(token === 0 /* Unknown */, "'reScanInvalidIdentifier' should only be called when the current token is 'SyntaxKind.Unknown'."); - pos = tokenPos = startPos; + pos = tokenStart = fullStartPos; tokenFlags = 0; const ch = codePointAt(text, pos); const identifierKind = scanIdentifier(ch, 99 /* ESNext */); @@ -10657,7 +10697,7 @@ ${lanes.join("\n")} pos += charSize(ch); while (pos < end && isIdentifierPart(ch = codePointAt(text, pos), languageVersion2)) pos += charSize(ch); - tokenValue = text.substring(tokenPos, pos); + tokenValue = text.substring(tokenStart, pos); if (ch === 92 /* backslash */) { tokenValue += scanIdentifierParts(); } @@ -10665,35 +10705,35 @@ ${lanes.join("\n")} } } function reScanGreaterToken() { - if (token === 31 /* GreaterThanToken */) { + if (token === 32 /* GreaterThanToken */) { if (text.charCodeAt(pos) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) { if (text.charCodeAt(pos + 2) === 61 /* equals */) { - return pos += 3, token = 72 /* GreaterThanGreaterThanGreaterThanEqualsToken */; + return pos += 3, token = 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */; } - return pos += 2, token = 49 /* GreaterThanGreaterThanGreaterThanToken */; + return pos += 2, token = 50 /* GreaterThanGreaterThanGreaterThanToken */; } if (text.charCodeAt(pos + 1) === 61 /* equals */) { - return pos += 2, token = 71 /* GreaterThanGreaterThanEqualsToken */; + return pos += 2, token = 72 /* GreaterThanGreaterThanEqualsToken */; } pos++; - return token = 48 /* GreaterThanGreaterThanToken */; + return token = 49 /* GreaterThanGreaterThanToken */; } if (text.charCodeAt(pos) === 61 /* equals */) { pos++; - return token = 33 /* GreaterThanEqualsToken */; + return token = 34 /* GreaterThanEqualsToken */; } } return token; } function reScanAsteriskEqualsToken() { - Debug.assert(token === 66 /* AsteriskEqualsToken */, "'reScanAsteriskEqualsToken' should only be called on a '*='"); - pos = tokenPos + 1; - return token = 63 /* EqualsToken */; + Debug.assert(token === 67 /* AsteriskEqualsToken */, "'reScanAsteriskEqualsToken' should only be called on a '*='"); + pos = tokenStart + 1; + return token = 64 /* EqualsToken */; } function reScanSlashToken() { - if (token === 43 /* SlashToken */ || token === 68 /* SlashEqualsToken */) { - let p = tokenPos + 1; + if (token === 44 /* SlashToken */ || token === 69 /* SlashEqualsToken */) { + let p = tokenStart + 1; let inEscape = false; let inCharacterClass = false; while (true) { @@ -10726,8 +10766,8 @@ ${lanes.join("\n")} p++; } pos = p; - tokenValue = text.substring(tokenPos, pos); - token = 13 /* RegularExpressionLiteral */; + tokenValue = text.substring(tokenStart, pos); + token = 14 /* RegularExpressionLiteral */; } return token; } @@ -10758,42 +10798,41 @@ ${lanes.join("\n")} return void 0; } function reScanTemplateToken(isTaggedTemplate) { - Debug.assert(token === 19 /* CloseBraceToken */, "'reScanTemplateToken' should only be called on a '}'"); - pos = tokenPos; - return token = scanTemplateAndSetTokenValue(isTaggedTemplate); + pos = tokenStart; + return token = scanTemplateAndSetTokenValue(!isTaggedTemplate); } function reScanTemplateHeadOrNoSubstitutionTemplate() { - pos = tokenPos; + pos = tokenStart; return token = scanTemplateAndSetTokenValue( - /* isTaggedTemplate */ + /*shouldEmitInvalidEscapeError*/ true ); } function reScanJsxToken(allowMultilineJsxText = true) { - pos = tokenPos = startPos; + pos = tokenStart = fullStartPos; return token = scanJsxToken(allowMultilineJsxText); } function reScanLessThanToken() { - if (token === 47 /* LessThanLessThanToken */) { - pos = tokenPos + 1; - return token = 29 /* LessThanToken */; + if (token === 48 /* LessThanLessThanToken */) { + pos = tokenStart + 1; + return token = 30 /* LessThanToken */; } return token; } function reScanHashToken() { - if (token === 80 /* PrivateIdentifier */) { - pos = tokenPos + 1; - return token = 62 /* HashToken */; + if (token === 81 /* PrivateIdentifier */) { + pos = tokenStart + 1; + return token = 63 /* HashToken */; } return token; } function reScanQuestionToken() { - Debug.assert(token === 60 /* QuestionQuestionToken */, "'reScanQuestionToken' should only be called on a '??'"); - pos = tokenPos + 1; - return token = 57 /* QuestionToken */; + Debug.assert(token === 61 /* QuestionQuestionToken */, "'reScanQuestionToken' should only be called on a '??'"); + pos = tokenStart + 1; + return token = 58 /* QuestionToken */; } function scanJsxToken(allowMultilineJsxText = true) { - startPos = tokenPos = pos; + fullStartPos = tokenStart = pos; if (pos >= end) { return token = 1 /* EndOfFileToken */; } @@ -10801,14 +10840,14 @@ ${lanes.join("\n")} if (char === 60 /* lessThan */) { if (text.charCodeAt(pos + 1) === 47 /* slash */) { pos += 2; - return token = 30 /* LessThanSlashToken */; + return token = 31 /* LessThanSlashToken */; } pos++; - return token = 29 /* LessThanToken */; + return token = 30 /* LessThanToken */; } if (char === 123 /* openBrace */) { pos++; - return token = 18 /* OpenBraceToken */; + return token = 19 /* OpenBraceToken */; } let firstNonWhitespace = 0; while (pos < end) { @@ -10838,24 +10877,17 @@ ${lanes.join("\n")} } pos++; } - tokenValue = text.substring(startPos, pos); - return firstNonWhitespace === -1 ? 12 /* JsxTextAllWhiteSpaces */ : 11 /* JsxText */; + tokenValue = text.substring(fullStartPos, pos); + return firstNonWhitespace === -1 ? 13 /* JsxTextAllWhiteSpaces */ : 12 /* JsxText */; } function scanJsxIdentifier() { if (tokenIsIdentifierOrKeyword(token)) { - let namespaceSeparator = false; while (pos < end) { const ch = text.charCodeAt(pos); if (ch === 45 /* minus */) { tokenValue += "-"; pos++; continue; - } else if (ch === 58 /* colon */ && !namespaceSeparator) { - tokenValue += ":"; - pos++; - namespaceSeparator = true; - token = 79 /* Identifier */; - continue; } const oldPos = pos; tokenValue += scanIdentifierParts(); @@ -10863,16 +10895,12 @@ ${lanes.join("\n")} break; } } - if (tokenValue.slice(-1) === ":") { - tokenValue = tokenValue.slice(0, -1); - pos--; - } return getIdentifierToken(); } return token; } function scanJsxAttributeValue() { - startPos = pos; + fullStartPos = pos; switch (text.charCodeAt(pos)) { case 34 /* doubleQuote */: case 39 /* singleQuote */: @@ -10880,17 +10908,38 @@ ${lanes.join("\n")} /*jsxAttributeString*/ true ); - return token = 10 /* StringLiteral */; + return token = 11 /* StringLiteral */; default: return scan(); } } function reScanJsxAttributeValue() { - pos = tokenPos = startPos; + pos = tokenStart = fullStartPos; return scanJsxAttributeValue(); } + function scanJSDocCommentTextToken(inBackticks) { + fullStartPos = tokenStart = pos; + tokenFlags = 0 /* None */; + if (pos >= end) { + return token = 1 /* EndOfFileToken */; + } + for (let ch = text.charCodeAt(pos); pos < end && (!isLineBreak(ch) && ch !== 96 /* backtick */); ch = codePointAt(text, ++pos)) { + if (!inBackticks) { + if (ch === 123 /* openBrace */) { + break; + } else if (ch === 64 /* at */ && pos - 1 >= 0 && isWhiteSpaceSingleLine(text.charCodeAt(pos - 1)) && !(pos + 1 < end && isWhiteSpaceLike(text.charCodeAt(pos + 1)))) { + break; + } + } + } + if (pos === tokenStart) { + return scanJsDocToken(); + } + tokenValue = text.substring(tokenStart, pos); + return token = 82 /* JSDocCommentTextToken */; + } function scanJsDocToken() { - startPos = tokenPos = pos; + fullStartPos = tokenStart = pos; tokenFlags = 0 /* None */; if (pos >= end) { return token = 1 /* EndOfFileToken */; @@ -10907,7 +10956,7 @@ ${lanes.join("\n")} } return token = 5 /* WhitespaceTrivia */; case 64 /* at */: - return token = 59 /* AtToken */; + return token = 60 /* AtToken */; case 13 /* carriageReturn */: if (text.charCodeAt(pos) === 10 /* lineFeed */) { pos++; @@ -10916,29 +10965,29 @@ ${lanes.join("\n")} tokenFlags |= 1 /* PrecedingLineBreak */; return token = 4 /* NewLineTrivia */; case 42 /* asterisk */: - return token = 41 /* AsteriskToken */; + return token = 42 /* AsteriskToken */; case 123 /* openBrace */: - return token = 18 /* OpenBraceToken */; + return token = 19 /* OpenBraceToken */; case 125 /* closeBrace */: - return token = 19 /* CloseBraceToken */; + return token = 20 /* CloseBraceToken */; case 91 /* openBracket */: - return token = 22 /* OpenBracketToken */; + return token = 23 /* OpenBracketToken */; case 93 /* closeBracket */: - return token = 23 /* CloseBracketToken */; + return token = 24 /* CloseBracketToken */; case 60 /* lessThan */: - return token = 29 /* LessThanToken */; + return token = 30 /* LessThanToken */; case 62 /* greaterThan */: - return token = 31 /* GreaterThanToken */; + return token = 32 /* GreaterThanToken */; case 61 /* equals */: - return token = 63 /* EqualsToken */; + return token = 64 /* EqualsToken */; case 44 /* comma */: - return token = 27 /* CommaToken */; + return token = 28 /* CommaToken */; case 46 /* dot */: - return token = 24 /* DotToken */; + return token = 25 /* DotToken */; case 96 /* backtick */: - return token = 61 /* BacktickToken */; + return token = 62 /* BacktickToken */; case 35 /* hash */: - return token = 62 /* HashToken */; + return token = 63 /* HashToken */; case 92 /* backslash */: pos--; const extendedCookedChar = peekExtendedUnicodeEscape(); @@ -10962,7 +11011,7 @@ ${lanes.join("\n")} let char = ch; while (pos < end && isIdentifierPart(char = codePointAt(text, pos), languageVersion) || text.charCodeAt(pos) === 45 /* minus */) pos += charSize(char); - tokenValue = text.substring(tokenPos, pos); + tokenValue = text.substring(tokenStart, pos); if (char === 92 /* backslash */) { tokenValue += scanIdentifierParts(); } @@ -10973,16 +11022,16 @@ ${lanes.join("\n")} } function speculationHelper(callback, isLookahead) { const savePos = pos; - const saveStartPos = startPos; - const saveTokenPos = tokenPos; + const saveStartPos = fullStartPos; + const saveTokenPos = tokenStart; const saveToken = token; const saveTokenValue = tokenValue; const saveTokenFlags = tokenFlags; const result = callback(); if (!result || isLookahead) { pos = savePos; - startPos = saveStartPos; - tokenPos = saveTokenPos; + fullStartPos = saveStartPos; + tokenStart = saveTokenPos; token = saveToken; tokenValue = saveTokenValue; tokenFlags = saveTokenFlags; @@ -10992,8 +11041,8 @@ ${lanes.join("\n")} function scanRange(start2, length3, callback) { const saveEnd = end; const savePos = pos; - const saveStartPos = startPos; - const saveTokenPos = tokenPos; + const saveStartPos = fullStartPos; + const saveTokenPos = tokenStart; const saveToken = token; const saveTokenValue = tokenValue; const saveTokenFlags = tokenFlags; @@ -11002,8 +11051,8 @@ ${lanes.join("\n")} const result = callback(); end = saveEnd; pos = savePos; - startPos = saveStartPos; - tokenPos = saveTokenPos; + fullStartPos = saveStartPos; + tokenStart = saveTokenPos; token = saveToken; tokenValue = saveTokenValue; tokenFlags = saveTokenFlags; @@ -11033,7 +11082,7 @@ ${lanes.join("\n")} function setText(newText, start2, length3) { text = newText || ""; end = length3 === void 0 ? text.length : start2 + length3; - setTextPos(start2 || 0); + resetTokenState(start2 || 0); } function setOnError(errorCallback) { onError = errorCallback; @@ -11044,11 +11093,11 @@ ${lanes.join("\n")} function setLanguageVariant(variant) { languageVariant = variant; } - function setTextPos(textPos) { - Debug.assert(textPos >= 0); - pos = textPos; - startPos = textPos; - tokenPos = textPos; + function resetTokenState(position) { + Debug.assert(position >= 0); + pos = position; + fullStartPos = position; + tokenStart = position; token = 0 /* Unknown */; tokenValue = void 0; tokenFlags = 0 /* None */; @@ -11081,153 +11130,153 @@ ${lanes.join("\n")} "use strict"; init_ts2(); textToKeywordObj = { - abstract: 126 /* AbstractKeyword */, - accessor: 127 /* AccessorKeyword */, - any: 131 /* AnyKeyword */, - as: 128 /* AsKeyword */, - asserts: 129 /* AssertsKeyword */, - assert: 130 /* AssertKeyword */, - bigint: 160 /* BigIntKeyword */, - boolean: 134 /* BooleanKeyword */, - break: 81 /* BreakKeyword */, - case: 82 /* CaseKeyword */, - catch: 83 /* CatchKeyword */, - class: 84 /* ClassKeyword */, - continue: 86 /* ContinueKeyword */, - const: 85 /* ConstKeyword */, - ["constructor"]: 135 /* ConstructorKeyword */, - debugger: 87 /* DebuggerKeyword */, - declare: 136 /* DeclareKeyword */, - default: 88 /* DefaultKeyword */, - delete: 89 /* DeleteKeyword */, - do: 90 /* DoKeyword */, - else: 91 /* ElseKeyword */, - enum: 92 /* EnumKeyword */, - export: 93 /* ExportKeyword */, - extends: 94 /* ExtendsKeyword */, - false: 95 /* FalseKeyword */, - finally: 96 /* FinallyKeyword */, - for: 97 /* ForKeyword */, - from: 158 /* FromKeyword */, - function: 98 /* FunctionKeyword */, - get: 137 /* GetKeyword */, - if: 99 /* IfKeyword */, - implements: 117 /* ImplementsKeyword */, - import: 100 /* ImportKeyword */, - in: 101 /* InKeyword */, - infer: 138 /* InferKeyword */, - instanceof: 102 /* InstanceOfKeyword */, - interface: 118 /* InterfaceKeyword */, - intrinsic: 139 /* IntrinsicKeyword */, - is: 140 /* IsKeyword */, - keyof: 141 /* KeyOfKeyword */, - let: 119 /* LetKeyword */, - module: 142 /* ModuleKeyword */, - namespace: 143 /* NamespaceKeyword */, - never: 144 /* NeverKeyword */, - new: 103 /* NewKeyword */, - null: 104 /* NullKeyword */, - number: 148 /* NumberKeyword */, - object: 149 /* ObjectKeyword */, - package: 120 /* PackageKeyword */, - private: 121 /* PrivateKeyword */, - protected: 122 /* ProtectedKeyword */, - public: 123 /* PublicKeyword */, - override: 161 /* OverrideKeyword */, - out: 145 /* OutKeyword */, - readonly: 146 /* ReadonlyKeyword */, - require: 147 /* RequireKeyword */, - global: 159 /* GlobalKeyword */, - return: 105 /* ReturnKeyword */, - satisfies: 150 /* SatisfiesKeyword */, - set: 151 /* SetKeyword */, - static: 124 /* StaticKeyword */, - string: 152 /* StringKeyword */, - super: 106 /* SuperKeyword */, - switch: 107 /* SwitchKeyword */, - symbol: 153 /* SymbolKeyword */, - this: 108 /* ThisKeyword */, - throw: 109 /* ThrowKeyword */, - true: 110 /* TrueKeyword */, - try: 111 /* TryKeyword */, - type: 154 /* TypeKeyword */, - typeof: 112 /* TypeOfKeyword */, - undefined: 155 /* UndefinedKeyword */, - unique: 156 /* UniqueKeyword */, - unknown: 157 /* UnknownKeyword */, - var: 113 /* VarKeyword */, - void: 114 /* VoidKeyword */, - while: 115 /* WhileKeyword */, - with: 116 /* WithKeyword */, - yield: 125 /* YieldKeyword */, - async: 132 /* AsyncKeyword */, - await: 133 /* AwaitKeyword */, - of: 162 /* OfKeyword */ + abstract: 128 /* AbstractKeyword */, + accessor: 129 /* AccessorKeyword */, + any: 133 /* AnyKeyword */, + as: 130 /* AsKeyword */, + asserts: 131 /* AssertsKeyword */, + assert: 132 /* AssertKeyword */, + bigint: 162 /* BigIntKeyword */, + boolean: 136 /* BooleanKeyword */, + break: 83 /* BreakKeyword */, + case: 84 /* CaseKeyword */, + catch: 85 /* CatchKeyword */, + class: 86 /* ClassKeyword */, + continue: 88 /* ContinueKeyword */, + const: 87 /* ConstKeyword */, + ["constructor"]: 137 /* ConstructorKeyword */, + debugger: 89 /* DebuggerKeyword */, + declare: 138 /* DeclareKeyword */, + default: 90 /* DefaultKeyword */, + delete: 91 /* DeleteKeyword */, + do: 92 /* DoKeyword */, + else: 93 /* ElseKeyword */, + enum: 94 /* EnumKeyword */, + export: 95 /* ExportKeyword */, + extends: 96 /* ExtendsKeyword */, + false: 97 /* FalseKeyword */, + finally: 98 /* FinallyKeyword */, + for: 99 /* ForKeyword */, + from: 160 /* FromKeyword */, + function: 100 /* FunctionKeyword */, + get: 139 /* GetKeyword */, + if: 101 /* IfKeyword */, + implements: 119 /* ImplementsKeyword */, + import: 102 /* ImportKeyword */, + in: 103 /* InKeyword */, + infer: 140 /* InferKeyword */, + instanceof: 104 /* InstanceOfKeyword */, + interface: 120 /* InterfaceKeyword */, + intrinsic: 141 /* IntrinsicKeyword */, + is: 142 /* IsKeyword */, + keyof: 143 /* KeyOfKeyword */, + let: 121 /* LetKeyword */, + module: 144 /* ModuleKeyword */, + namespace: 145 /* NamespaceKeyword */, + never: 146 /* NeverKeyword */, + new: 105 /* NewKeyword */, + null: 106 /* NullKeyword */, + number: 150 /* NumberKeyword */, + object: 151 /* ObjectKeyword */, + package: 122 /* PackageKeyword */, + private: 123 /* PrivateKeyword */, + protected: 124 /* ProtectedKeyword */, + public: 125 /* PublicKeyword */, + override: 163 /* OverrideKeyword */, + out: 147 /* OutKeyword */, + readonly: 148 /* ReadonlyKeyword */, + require: 149 /* RequireKeyword */, + global: 161 /* GlobalKeyword */, + return: 107 /* ReturnKeyword */, + satisfies: 152 /* SatisfiesKeyword */, + set: 153 /* SetKeyword */, + static: 126 /* StaticKeyword */, + string: 154 /* StringKeyword */, + super: 108 /* SuperKeyword */, + switch: 109 /* SwitchKeyword */, + symbol: 155 /* SymbolKeyword */, + this: 110 /* ThisKeyword */, + throw: 111 /* ThrowKeyword */, + true: 112 /* TrueKeyword */, + try: 113 /* TryKeyword */, + type: 156 /* TypeKeyword */, + typeof: 114 /* TypeOfKeyword */, + undefined: 157 /* UndefinedKeyword */, + unique: 158 /* UniqueKeyword */, + unknown: 159 /* UnknownKeyword */, + var: 115 /* VarKeyword */, + void: 116 /* VoidKeyword */, + while: 117 /* WhileKeyword */, + with: 118 /* WithKeyword */, + yield: 127 /* YieldKeyword */, + async: 134 /* AsyncKeyword */, + await: 135 /* AwaitKeyword */, + of: 164 /* OfKeyword */ }; textToKeyword = new Map(Object.entries(textToKeywordObj)); textToToken = new Map(Object.entries({ ...textToKeywordObj, - "{": 18 /* OpenBraceToken */, - "}": 19 /* CloseBraceToken */, - "(": 20 /* OpenParenToken */, - ")": 21 /* CloseParenToken */, - "[": 22 /* OpenBracketToken */, - "]": 23 /* CloseBracketToken */, - ".": 24 /* DotToken */, - "...": 25 /* DotDotDotToken */, - ";": 26 /* SemicolonToken */, - ",": 27 /* CommaToken */, - "<": 29 /* LessThanToken */, - ">": 31 /* GreaterThanToken */, - "<=": 32 /* LessThanEqualsToken */, - ">=": 33 /* GreaterThanEqualsToken */, - "==": 34 /* EqualsEqualsToken */, - "!=": 35 /* ExclamationEqualsToken */, - "===": 36 /* EqualsEqualsEqualsToken */, - "!==": 37 /* ExclamationEqualsEqualsToken */, - "=>": 38 /* EqualsGreaterThanToken */, - "+": 39 /* PlusToken */, - "-": 40 /* MinusToken */, - "**": 42 /* AsteriskAsteriskToken */, - "*": 41 /* AsteriskToken */, - "/": 43 /* SlashToken */, - "%": 44 /* PercentToken */, - "++": 45 /* PlusPlusToken */, - "--": 46 /* MinusMinusToken */, - "<<": 47 /* LessThanLessThanToken */, - ">": 48 /* GreaterThanGreaterThanToken */, - ">>>": 49 /* GreaterThanGreaterThanGreaterThanToken */, - "&": 50 /* AmpersandToken */, - "|": 51 /* BarToken */, - "^": 52 /* CaretToken */, - "!": 53 /* ExclamationToken */, - "~": 54 /* TildeToken */, - "&&": 55 /* AmpersandAmpersandToken */, - "||": 56 /* BarBarToken */, - "?": 57 /* QuestionToken */, - "??": 60 /* QuestionQuestionToken */, - "?.": 28 /* QuestionDotToken */, - ":": 58 /* ColonToken */, - "=": 63 /* EqualsToken */, - "+=": 64 /* PlusEqualsToken */, - "-=": 65 /* MinusEqualsToken */, - "*=": 66 /* AsteriskEqualsToken */, - "**=": 67 /* AsteriskAsteriskEqualsToken */, - "/=": 68 /* SlashEqualsToken */, - "%=": 69 /* PercentEqualsToken */, - "<<=": 70 /* LessThanLessThanEqualsToken */, - ">>=": 71 /* GreaterThanGreaterThanEqualsToken */, - ">>>=": 72 /* GreaterThanGreaterThanGreaterThanEqualsToken */, - "&=": 73 /* AmpersandEqualsToken */, - "|=": 74 /* BarEqualsToken */, - "^=": 78 /* CaretEqualsToken */, - "||=": 75 /* BarBarEqualsToken */, - "&&=": 76 /* AmpersandAmpersandEqualsToken */, - "??=": 77 /* QuestionQuestionEqualsToken */, - "@": 59 /* AtToken */, - "#": 62 /* HashToken */, - "`": 61 /* BacktickToken */ + "{": 19 /* OpenBraceToken */, + "}": 20 /* CloseBraceToken */, + "(": 21 /* OpenParenToken */, + ")": 22 /* CloseParenToken */, + "[": 23 /* OpenBracketToken */, + "]": 24 /* CloseBracketToken */, + ".": 25 /* DotToken */, + "...": 26 /* DotDotDotToken */, + ";": 27 /* SemicolonToken */, + ",": 28 /* CommaToken */, + "<": 30 /* LessThanToken */, + ">": 32 /* GreaterThanToken */, + "<=": 33 /* LessThanEqualsToken */, + ">=": 34 /* GreaterThanEqualsToken */, + "==": 35 /* EqualsEqualsToken */, + "!=": 36 /* ExclamationEqualsToken */, + "===": 37 /* EqualsEqualsEqualsToken */, + "!==": 38 /* ExclamationEqualsEqualsToken */, + "=>": 39 /* EqualsGreaterThanToken */, + "+": 40 /* PlusToken */, + "-": 41 /* MinusToken */, + "**": 43 /* AsteriskAsteriskToken */, + "*": 42 /* AsteriskToken */, + "/": 44 /* SlashToken */, + "%": 45 /* PercentToken */, + "++": 46 /* PlusPlusToken */, + "--": 47 /* MinusMinusToken */, + "<<": 48 /* LessThanLessThanToken */, + ">": 49 /* GreaterThanGreaterThanToken */, + ">>>": 50 /* GreaterThanGreaterThanGreaterThanToken */, + "&": 51 /* AmpersandToken */, + "|": 52 /* BarToken */, + "^": 53 /* CaretToken */, + "!": 54 /* ExclamationToken */, + "~": 55 /* TildeToken */, + "&&": 56 /* AmpersandAmpersandToken */, + "||": 57 /* BarBarToken */, + "?": 58 /* QuestionToken */, + "??": 61 /* QuestionQuestionToken */, + "?.": 29 /* QuestionDotToken */, + ":": 59 /* ColonToken */, + "=": 64 /* EqualsToken */, + "+=": 65 /* PlusEqualsToken */, + "-=": 66 /* MinusEqualsToken */, + "*=": 67 /* AsteriskEqualsToken */, + "**=": 68 /* AsteriskAsteriskEqualsToken */, + "/=": 69 /* SlashEqualsToken */, + "%=": 70 /* PercentEqualsToken */, + "<<=": 71 /* LessThanLessThanEqualsToken */, + ">>=": 72 /* GreaterThanGreaterThanEqualsToken */, + ">>>=": 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */, + "&=": 74 /* AmpersandEqualsToken */, + "|=": 75 /* BarEqualsToken */, + "^=": 79 /* CaretEqualsToken */, + "||=": 76 /* BarBarEqualsToken */, + "&&=": 77 /* AmpersandAmpersandEqualsToken */, + "??=": 78 /* QuestionQuestionEqualsToken */, + "@": 60 /* AtToken */, + "#": 63 /* HashToken */, + "`": 62 /* BacktickToken */ })); unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500]; unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500]; @@ -11384,16 +11433,16 @@ ${lanes.join("\n")} ); } function getTypeParameterOwner(d) { - if (d && d.kind === 165 /* TypeParameter */) { + if (d && d.kind === 167 /* TypeParameter */) { for (let current = d; current; current = current.parent) { - if (isFunctionLike(current) || isClassLike(current) || current.kind === 261 /* InterfaceDeclaration */) { + if (isFunctionLike(current) || isClassLike(current) || current.kind === 263 /* InterfaceDeclaration */) { return current; } } } } function isParameterPropertyDeclaration(node, parent2) { - return isParameter(node) && hasSyntacticModifier(node, 16476 /* ParameterPropertyModifier */) && parent2.kind === 173 /* Constructor */; + return isParameter(node) && hasSyntacticModifier(node, 16476 /* ParameterPropertyModifier */) && parent2.kind === 175 /* Constructor */; } function isEmptyBindingPattern(node) { if (isBindingPattern(node)) { @@ -11419,14 +11468,14 @@ ${lanes.join("\n")} node = walkUpBindingElementsAndPatterns(node); } let flags = getFlags(node); - if (node.kind === 257 /* VariableDeclaration */) { + if (node.kind === 259 /* VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 258 /* VariableDeclarationList */) { + if (node && node.kind === 260 /* VariableDeclarationList */) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 240 /* VariableStatement */) { + if (node && node.kind === 242 /* VariableStatement */) { flags |= getFlags(node); } return flags; @@ -11482,7 +11531,7 @@ ${lanes.join("\n")} } try { setLocalizedDiagnosticMessages(JSON.parse(fileContents)); - } catch (e) { + } catch { if (errors2) { errors2.push(createCompilerDiagnostic(Diagnostics.Corrupted_locale_file_0, filePath)); } @@ -11558,30 +11607,30 @@ ${lanes.join("\n")} return getDeclarationIdentifier(hostNode); } switch (hostNode.kind) { - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 241 /* ExpressionStatement */: + case 243 /* ExpressionStatement */: let expr = hostNode.expression; - if (expr.kind === 223 /* BinaryExpression */ && expr.operatorToken.kind === 63 /* EqualsToken */) { + if (expr.kind === 225 /* BinaryExpression */ && expr.operatorToken.kind === 64 /* EqualsToken */) { expr = expr.left; } switch (expr.kind) { - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: return expr.name; - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: const arg = expr.argumentExpression; if (isIdentifier(arg)) { return arg; } } break; - case 214 /* ParenthesizedExpression */: { + case 216 /* ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 253 /* LabeledStatement */: { + case 255 /* LabeledStatement */: { if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -11610,18 +11659,18 @@ ${lanes.join("\n")} } function getNonAssignedNameOfDeclaration(declaration) { switch (declaration.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return declaration; - case 351 /* JSDocPropertyTag */: - case 344 /* JSDocParameterTag */: { + case 354 /* JSDocPropertyTag */: + case 347 /* JSDocParameterTag */: { const { name } = declaration; - if (name.kind === 163 /* QualifiedName */) { + if (name.kind === 165 /* QualifiedName */) { return name.right; } break; } - case 210 /* CallExpression */: - case 223 /* BinaryExpression */: { + case 212 /* CallExpression */: + case 225 /* BinaryExpression */: { const expr2 = declaration; switch (getAssignmentDeclarationKind(expr2)) { case 1 /* ExportsProperty */: @@ -11637,15 +11686,15 @@ ${lanes.join("\n")} return void 0; } } - case 349 /* JSDocTypedefTag */: + case 352 /* JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 343 /* JSDocEnumTag */: + case 346 /* JSDocEnumTag */: return nameForNamelessJSDocTypedef(declaration); - case 274 /* ExportAssignment */: { + case 276 /* ExportAssignment */: { const { expression } = declaration; return isIdentifier(expression) ? expression : void 0; } - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: const expr = declaration; if (isBindableStaticElementAccessExpression(expr)) { return expr.argumentExpression; @@ -11853,16 +11902,16 @@ ${lanes.join("\n")} } } function getJSDocTagsWorker(node, noCache) { - var _a2, _b; + var _a; if (!canHaveJSDoc(node)) return emptyArray; - let tags = (_a2 = node.jsDoc) == null ? void 0 : _a2.jsDocCache; + let tags = (_a = node.jsDoc) == null ? void 0 : _a.jsDocCache; if (tags === void 0 || noCache) { const comments = getJSDocCommentsAndTags(node, noCache); Debug.assert(comments.length < 2 || comments[0] !== comments[1]); tags = flatMap(comments, (j) => isJSDoc(j) ? j.tags : j); if (!noCache) { - (_b = node.jsDoc) != null ? _b : node.jsDoc = []; + node.jsDoc ?? (node.jsDoc = []); node.jsDoc.jsDocCache = tags; } } @@ -11892,10 +11941,10 @@ ${lanes.join("\n")} return getJSDocTags(node).filter((doc) => doc.kind === kind); } function getTextOfJSDocComment(comment) { - return typeof comment === "string" ? comment : comment == null ? void 0 : comment.map((c) => c.kind === 324 /* JSDocText */ ? c.text : formatJSDocLink(c)).join(""); + return typeof comment === "string" ? comment : comment == null ? void 0 : comment.map((c) => c.kind === 327 /* JSDocText */ ? c.text : formatJSDocLink(c)).join(""); } function formatJSDocLink(link) { - const kind = link.kind === 327 /* JSDocLink */ ? "link" : link.kind === 328 /* JSDocLinkCode */ ? "linkcode" : "linkplain"; + const kind = link.kind === 330 /* JSDocLink */ ? "link" : link.kind === 331 /* JSDocLinkCode */ ? "linkcode" : "linkplain"; const name = link.name ? entityNameToString(link.name) : ""; const space = link.name && link.text.startsWith("://") ? "" : " "; return `{@${kind} ${name}${space}${link.text}}`; @@ -11911,7 +11960,7 @@ ${lanes.join("\n")} return emptyArray; } if (isJSDocTypeAlias(node)) { - Debug.assert(node.parent.kind === 323 /* JSDoc */); + Debug.assert(node.parent.kind === 326 /* JSDoc */); return flatMap(node.parent.tags, (tag) => isJSDocTemplateTag(tag) ? tag.typeParameters : void 0); } if (node.typeParameters) { @@ -11936,10 +11985,10 @@ ${lanes.join("\n")} return node.constraint ? node.constraint : isJSDocTemplateTag(node.parent) && node === node.parent.typeParameters[0] ? node.parent.constraint : void 0; } function isMemberName(node) { - return node.kind === 79 /* Identifier */ || node.kind === 80 /* PrivateIdentifier */; + return node.kind === 80 /* Identifier */ || node.kind === 81 /* PrivateIdentifier */; } function isGetOrSetAccessorDeclaration(node) { - return node.kind === 175 /* SetAccessor */ || node.kind === 174 /* GetAccessor */; + return node.kind === 177 /* SetAccessor */ || node.kind === 176 /* GetAccessor */; } function isPropertyAccessChain(node) { return isPropertyAccessExpression(node) && !!(node.flags & 32 /* OptionalChain */); @@ -11952,7 +12001,7 @@ ${lanes.join("\n")} } function isOptionalChain(node) { const kind = node.kind; - return !!(node.flags & 32 /* OptionalChain */) && (kind === 208 /* PropertyAccessExpression */ || kind === 209 /* ElementAccessExpression */ || kind === 210 /* CallExpression */ || kind === 232 /* NonNullExpression */); + return !!(node.flags & 32 /* OptionalChain */) && (kind === 210 /* PropertyAccessExpression */ || kind === 211 /* ElementAccessExpression */ || kind === 212 /* CallExpression */ || kind === 234 /* NonNullExpression */); } function isOptionalChainRoot(node) { return isOptionalChain(node) && !isNonNullExpression(node) && !!node.questionDotToken; @@ -11964,7 +12013,7 @@ ${lanes.join("\n")} return !isOptionalChain(node.parent) || isOptionalChainRoot(node.parent) || node !== node.parent.expression; } function isNullishCoalesce(node) { - return node.kind === 223 /* BinaryExpression */ && node.operatorToken.kind === 60 /* QuestionQuestionToken */; + return node.kind === 225 /* BinaryExpression */ && node.operatorToken.kind === 61 /* QuestionQuestionToken */; } function isConstTypeReference(node) { return isTypeReferenceNode(node) && isIdentifier(node.typeName) && node.typeName.escapedText === "const" && !node.typeArguments; @@ -11976,34 +12025,34 @@ ${lanes.join("\n")} return isNonNullExpression(node) && !!(node.flags & 32 /* OptionalChain */); } function isBreakOrContinueStatement(node) { - return node.kind === 249 /* BreakStatement */ || node.kind === 248 /* ContinueStatement */; + return node.kind === 251 /* BreakStatement */ || node.kind === 250 /* ContinueStatement */; } function isNamedExportBindings(node) { - return node.kind === 277 /* NamespaceExport */ || node.kind === 276 /* NamedExports */; + return node.kind === 279 /* NamespaceExport */ || node.kind === 278 /* NamedExports */; } function isUnparsedTextLike(node) { switch (node.kind) { - case 305 /* UnparsedText */: - case 306 /* UnparsedInternalText */: + case 308 /* UnparsedText */: + case 309 /* UnparsedInternalText */: return true; default: return false; } } function isUnparsedNode(node) { - return isUnparsedTextLike(node) || node.kind === 303 /* UnparsedPrologue */ || node.kind === 307 /* UnparsedSyntheticReference */; + return isUnparsedTextLike(node) || node.kind === 306 /* UnparsedPrologue */ || node.kind === 310 /* UnparsedSyntheticReference */; } function isJSDocPropertyLikeTag(node) { - return node.kind === 351 /* JSDocPropertyTag */ || node.kind === 344 /* JSDocParameterTag */; + return node.kind === 354 /* JSDocPropertyTag */ || node.kind === 347 /* JSDocParameterTag */; } function isNode(node) { return isNodeKind(node.kind); } function isNodeKind(kind) { - return kind >= 163 /* FirstNode */; + return kind >= 165 /* FirstNode */; } function isTokenKind(kind) { - return kind >= 0 /* FirstToken */ && kind <= 162 /* LastToken */; + return kind >= 0 /* FirstToken */ && kind <= 164 /* LastToken */; } function isToken(n) { return isTokenKind(n.kind); @@ -12012,54 +12061,54 @@ ${lanes.join("\n")} return hasProperty(array, "pos") && hasProperty(array, "end"); } function isLiteralKind(kind) { - return 8 /* FirstLiteralToken */ <= kind && kind <= 14 /* LastLiteralToken */; + return 9 /* FirstLiteralToken */ <= kind && kind <= 15 /* LastLiteralToken */; } function isLiteralExpression(node) { return isLiteralKind(node.kind); } function isLiteralExpressionOfObject(node) { switch (node.kind) { - case 207 /* ObjectLiteralExpression */: - case 206 /* ArrayLiteralExpression */: - case 13 /* RegularExpressionLiteral */: - case 215 /* FunctionExpression */: - case 228 /* ClassExpression */: + case 209 /* ObjectLiteralExpression */: + case 208 /* ArrayLiteralExpression */: + case 14 /* RegularExpressionLiteral */: + case 217 /* FunctionExpression */: + case 230 /* ClassExpression */: return true; } return false; } function isTemplateLiteralKind(kind) { - return 14 /* FirstTemplateToken */ <= kind && kind <= 17 /* LastTemplateToken */; + return 15 /* FirstTemplateToken */ <= kind && kind <= 18 /* LastTemplateToken */; } function isTemplateLiteralToken(node) { return isTemplateLiteralKind(node.kind); } function isTemplateMiddleOrTemplateTail(node) { const kind = node.kind; - return kind === 16 /* TemplateMiddle */ || kind === 17 /* TemplateTail */; + return kind === 17 /* TemplateMiddle */ || kind === 18 /* TemplateTail */; } function isImportOrExportSpecifier(node) { return isImportSpecifier(node) || isExportSpecifier(node); } function isTypeOnlyImportDeclaration(node) { switch (node.kind) { - case 273 /* ImportSpecifier */: + case 275 /* ImportSpecifier */: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 271 /* NamespaceImport */: + case 273 /* NamespaceImport */: return node.parent.isTypeOnly; - case 270 /* ImportClause */: - case 268 /* ImportEqualsDeclaration */: + case 272 /* ImportClause */: + case 270 /* ImportEqualsDeclaration */: return node.isTypeOnly; } return false; } function isTypeOnlyExportDeclaration(node) { switch (node.kind) { - case 278 /* ExportSpecifier */: + case 280 /* ExportSpecifier */: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: return node.isTypeOnly && !!node.moduleSpecifier && !node.exportClause; - case 277 /* NamespaceExport */: + case 279 /* NamespaceExport */: return node.parent.isTypeOnly; } return false; @@ -12071,15 +12120,15 @@ ${lanes.join("\n")} return isStringLiteral(node) || isIdentifier(node); } function isStringTextContainingNode(node) { - return node.kind === 10 /* StringLiteral */ || isTemplateLiteralKind(node.kind); + return node.kind === 11 /* StringLiteral */ || isTemplateLiteralKind(node.kind); } function isGeneratedIdentifier(node) { - var _a2; - return isIdentifier(node) && ((_a2 = node.emitNode) == null ? void 0 : _a2.autoGenerate) !== void 0; + var _a; + return isIdentifier(node) && ((_a = node.emitNode) == null ? void 0 : _a.autoGenerate) !== void 0; } function isGeneratedPrivateIdentifier(node) { - var _a2; - return isPrivateIdentifier(node) && ((_a2 = node.emitNode) == null ? void 0 : _a2.autoGenerate) !== void 0; + var _a; + return isPrivateIdentifier(node) && ((_a = node.emitNode) == null ? void 0 : _a.autoGenerate) !== void 0; } function isPrivateIdentifierClassElementDeclaration(node) { return (isPropertyDeclaration(node) || isMethodOrAccessor(node)) && isPrivateIdentifier(node.name); @@ -12089,21 +12138,21 @@ ${lanes.join("\n")} } function isModifierKind(token) { switch (token) { - case 126 /* AbstractKeyword */: - case 127 /* AccessorKeyword */: - case 132 /* AsyncKeyword */: - case 85 /* ConstKeyword */: - case 136 /* DeclareKeyword */: - case 88 /* DefaultKeyword */: - case 93 /* ExportKeyword */: - case 101 /* InKeyword */: - case 123 /* PublicKeyword */: - case 121 /* PrivateKeyword */: - case 122 /* ProtectedKeyword */: - case 146 /* ReadonlyKeyword */: - case 124 /* StaticKeyword */: - case 145 /* OutKeyword */: - case 161 /* OverrideKeyword */: + case 128 /* AbstractKeyword */: + case 129 /* AccessorKeyword */: + case 134 /* AsyncKeyword */: + case 87 /* ConstKeyword */: + case 138 /* DeclareKeyword */: + case 90 /* DefaultKeyword */: + case 95 /* ExportKeyword */: + case 103 /* InKeyword */: + case 125 /* PublicKeyword */: + case 123 /* PrivateKeyword */: + case 124 /* ProtectedKeyword */: + case 148 /* ReadonlyKeyword */: + case 126 /* StaticKeyword */: + case 147 /* OutKeyword */: + case 163 /* OverrideKeyword */: return true; } return false; @@ -12112,22 +12161,22 @@ ${lanes.join("\n")} return !!(modifierToFlag(kind) & 16476 /* ParameterPropertyModifier */); } function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 124 /* StaticKeyword */ || idToken === 161 /* OverrideKeyword */ || idToken === 127 /* AccessorKeyword */; + return isParameterPropertyModifier(idToken) || idToken === 126 /* StaticKeyword */ || idToken === 163 /* OverrideKeyword */ || idToken === 129 /* AccessorKeyword */; } function isModifier(node) { return isModifierKind(node.kind); } function isEntityName(node) { const kind = node.kind; - return kind === 163 /* QualifiedName */ || kind === 79 /* Identifier */; + return kind === 165 /* QualifiedName */ || kind === 80 /* Identifier */; } function isPropertyName(node) { const kind = node.kind; - return kind === 79 /* Identifier */ || kind === 80 /* PrivateIdentifier */ || kind === 10 /* StringLiteral */ || kind === 8 /* NumericLiteral */ || kind === 164 /* ComputedPropertyName */; + return kind === 80 /* Identifier */ || kind === 81 /* PrivateIdentifier */ || kind === 11 /* StringLiteral */ || kind === 9 /* NumericLiteral */ || kind === 166 /* ComputedPropertyName */; } function isBindingName(node) { const kind = node.kind; - return kind === 79 /* Identifier */ || kind === 203 /* ObjectBindingPattern */ || kind === 204 /* ArrayBindingPattern */; + return kind === 80 /* Identifier */ || kind === 205 /* ObjectBindingPattern */ || kind === 206 /* ArrayBindingPattern */; } function isFunctionLike(node) { return !!node && isFunctionLikeKind(node.kind); @@ -12139,17 +12188,17 @@ ${lanes.join("\n")} return node && isFunctionLikeDeclarationKind(node.kind); } function isBooleanLiteral(node) { - return node.kind === 110 /* TrueKeyword */ || node.kind === 95 /* FalseKeyword */; + return node.kind === 112 /* TrueKeyword */ || node.kind === 97 /* FalseKeyword */; } function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 259 /* FunctionDeclaration */: - case 171 /* MethodDeclaration */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 261 /* FunctionDeclaration */: + case 173 /* MethodDeclaration */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: return true; default: return false; @@ -12157,14 +12206,14 @@ ${lanes.join("\n")} } function isFunctionLikeKind(kind) { switch (kind) { - case 170 /* MethodSignature */: - case 176 /* CallSignature */: - case 326 /* JSDocSignature */: - case 177 /* ConstructSignature */: - case 178 /* IndexSignature */: - case 181 /* FunctionType */: - case 320 /* JSDocFunctionType */: - case 182 /* ConstructorType */: + case 172 /* MethodSignature */: + case 178 /* CallSignature */: + case 329 /* JSDocSignature */: + case 179 /* ConstructSignature */: + case 180 /* IndexSignature */: + case 183 /* FunctionType */: + case 323 /* JSDocFunctionType */: + case 184 /* ConstructorType */: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -12175,22 +12224,22 @@ ${lanes.join("\n")} } function isClassElement(node) { const kind = node.kind; - return kind === 173 /* Constructor */ || kind === 169 /* PropertyDeclaration */ || kind === 171 /* MethodDeclaration */ || kind === 174 /* GetAccessor */ || kind === 175 /* SetAccessor */ || kind === 178 /* IndexSignature */ || kind === 172 /* ClassStaticBlockDeclaration */ || kind === 237 /* SemicolonClassElement */; + return kind === 175 /* Constructor */ || kind === 171 /* PropertyDeclaration */ || kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */ || kind === 180 /* IndexSignature */ || kind === 174 /* ClassStaticBlockDeclaration */ || kind === 239 /* SemicolonClassElement */; } function isClassLike(node) { - return node && (node.kind === 260 /* ClassDeclaration */ || node.kind === 228 /* ClassExpression */); + return node && (node.kind === 262 /* ClassDeclaration */ || node.kind === 230 /* ClassExpression */); } function isAccessor(node) { - return node && (node.kind === 174 /* GetAccessor */ || node.kind === 175 /* SetAccessor */); + return node && (node.kind === 176 /* GetAccessor */ || node.kind === 177 /* SetAccessor */); } function isAutoAccessorPropertyDeclaration(node) { return isPropertyDeclaration(node) && hasAccessorModifier(node); } function isMethodOrAccessor(node) { switch (node.kind) { - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return true; default: return false; @@ -12198,10 +12247,10 @@ ${lanes.join("\n")} } function isNamedClassElement(node) { switch (node.kind) { - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 169 /* PropertyDeclaration */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 171 /* PropertyDeclaration */: return true; default: return false; @@ -12212,22 +12261,22 @@ ${lanes.join("\n")} } function isTypeElement(node) { const kind = node.kind; - return kind === 177 /* ConstructSignature */ || kind === 176 /* CallSignature */ || kind === 168 /* PropertySignature */ || kind === 170 /* MethodSignature */ || kind === 178 /* IndexSignature */ || kind === 174 /* GetAccessor */ || kind === 175 /* SetAccessor */; + return kind === 179 /* ConstructSignature */ || kind === 178 /* CallSignature */ || kind === 170 /* PropertySignature */ || kind === 172 /* MethodSignature */ || kind === 180 /* IndexSignature */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */; } function isClassOrTypeElement(node) { return isTypeElement(node) || isClassElement(node); } function isObjectLiteralElementLike(node) { const kind = node.kind; - return kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 301 /* SpreadAssignment */ || kind === 171 /* MethodDeclaration */ || kind === 174 /* GetAccessor */ || kind === 175 /* SetAccessor */; + return kind === 302 /* PropertyAssignment */ || kind === 303 /* ShorthandPropertyAssignment */ || kind === 304 /* SpreadAssignment */ || kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */; } function isTypeNode(node) { return isTypeNodeKind(node.kind); } function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 181 /* FunctionType */: - case 182 /* ConstructorType */: + case 183 /* FunctionType */: + case 184 /* ConstructorType */: return true; } return false; @@ -12235,23 +12284,23 @@ ${lanes.join("\n")} function isBindingPattern(node) { if (node) { const kind = node.kind; - return kind === 204 /* ArrayBindingPattern */ || kind === 203 /* ObjectBindingPattern */; + return kind === 206 /* ArrayBindingPattern */ || kind === 205 /* ObjectBindingPattern */; } return false; } function isAssignmentPattern(node) { const kind = node.kind; - return kind === 206 /* ArrayLiteralExpression */ || kind === 207 /* ObjectLiteralExpression */; + return kind === 208 /* ArrayLiteralExpression */ || kind === 209 /* ObjectLiteralExpression */; } function isArrayBindingElement(node) { const kind = node.kind; - return kind === 205 /* BindingElement */ || kind === 229 /* OmittedExpression */; + return kind === 207 /* BindingElement */ || kind === 231 /* OmittedExpression */; } function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 257 /* VariableDeclaration */: - case 166 /* Parameter */: - case 205 /* BindingElement */: + case 259 /* VariableDeclaration */: + case 168 /* Parameter */: + case 207 /* BindingElement */: return true; } return false; @@ -12264,40 +12313,40 @@ ${lanes.join("\n")} } function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 203 /* ObjectBindingPattern */: - case 207 /* ObjectLiteralExpression */: + case 205 /* ObjectBindingPattern */: + case 209 /* ObjectLiteralExpression */: return true; } return false; } function isObjectBindingOrAssignmentElement(node) { switch (node.kind) { - case 205 /* BindingElement */: - case 299 /* PropertyAssignment */: - case 300 /* ShorthandPropertyAssignment */: - case 301 /* SpreadAssignment */: + case 207 /* BindingElement */: + case 302 /* PropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: + case 304 /* SpreadAssignment */: return true; } return false; } function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 204 /* ArrayBindingPattern */: - case 206 /* ArrayLiteralExpression */: + case 206 /* ArrayBindingPattern */: + case 208 /* ArrayLiteralExpression */: return true; } return false; } function isArrayBindingOrAssignmentElement(node) { switch (node.kind) { - case 205 /* BindingElement */: - case 229 /* OmittedExpression */: - case 227 /* SpreadElement */: - case 206 /* ArrayLiteralExpression */: - case 207 /* ObjectLiteralExpression */: - case 79 /* Identifier */: - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 207 /* BindingElement */: + case 231 /* OmittedExpression */: + case 229 /* SpreadElement */: + case 208 /* ArrayLiteralExpression */: + case 209 /* ObjectLiteralExpression */: + case 80 /* Identifier */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: return true; } return isAssignmentExpression( @@ -12308,68 +12357,68 @@ ${lanes.join("\n")} } function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { const kind = node.kind; - return kind === 208 /* PropertyAccessExpression */ || kind === 163 /* QualifiedName */ || kind === 202 /* ImportType */; + return kind === 210 /* PropertyAccessExpression */ || kind === 165 /* QualifiedName */ || kind === 204 /* ImportType */; } function isPropertyAccessOrQualifiedName(node) { const kind = node.kind; - return kind === 208 /* PropertyAccessExpression */ || kind === 163 /* QualifiedName */; + return kind === 210 /* PropertyAccessExpression */ || kind === 165 /* QualifiedName */; } function isCallLikeExpression(node) { switch (node.kind) { - case 283 /* JsxOpeningElement */: - case 282 /* JsxSelfClosingElement */: - case 210 /* CallExpression */: - case 211 /* NewExpression */: - case 212 /* TaggedTemplateExpression */: - case 167 /* Decorator */: + case 285 /* JsxOpeningElement */: + case 284 /* JsxSelfClosingElement */: + case 212 /* CallExpression */: + case 213 /* NewExpression */: + case 214 /* TaggedTemplateExpression */: + case 169 /* Decorator */: return true; default: return false; } } function isCallOrNewExpression(node) { - return node.kind === 210 /* CallExpression */ || node.kind === 211 /* NewExpression */; + return node.kind === 212 /* CallExpression */ || node.kind === 213 /* NewExpression */; } function isTemplateLiteral(node) { const kind = node.kind; - return kind === 225 /* TemplateExpression */ || kind === 14 /* NoSubstitutionTemplateLiteral */; + return kind === 227 /* TemplateExpression */ || kind === 15 /* NoSubstitutionTemplateLiteral */; } function isLeftHandSideExpression(node) { return isLeftHandSideExpressionKind(skipPartiallyEmittedExpressions(node).kind); } function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: - case 211 /* NewExpression */: - case 210 /* CallExpression */: - case 281 /* JsxElement */: - case 282 /* JsxSelfClosingElement */: - case 285 /* JsxFragment */: - case 212 /* TaggedTemplateExpression */: - case 206 /* ArrayLiteralExpression */: - case 214 /* ParenthesizedExpression */: - case 207 /* ObjectLiteralExpression */: - case 228 /* ClassExpression */: - case 215 /* FunctionExpression */: - case 79 /* Identifier */: - case 80 /* PrivateIdentifier */: - case 13 /* RegularExpressionLiteral */: - case 8 /* NumericLiteral */: - case 9 /* BigIntLiteral */: - case 10 /* StringLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 225 /* TemplateExpression */: - case 95 /* FalseKeyword */: - case 104 /* NullKeyword */: - case 108 /* ThisKeyword */: - case 110 /* TrueKeyword */: - case 106 /* SuperKeyword */: - case 232 /* NonNullExpression */: - case 230 /* ExpressionWithTypeArguments */: - case 233 /* MetaProperty */: - case 100 /* ImportKeyword */: - case 279 /* MissingDeclaration */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: + case 213 /* NewExpression */: + case 212 /* CallExpression */: + case 283 /* JsxElement */: + case 284 /* JsxSelfClosingElement */: + case 287 /* JsxFragment */: + case 214 /* TaggedTemplateExpression */: + case 208 /* ArrayLiteralExpression */: + case 216 /* ParenthesizedExpression */: + case 209 /* ObjectLiteralExpression */: + case 230 /* ClassExpression */: + case 217 /* FunctionExpression */: + case 80 /* Identifier */: + case 81 /* PrivateIdentifier */: + case 14 /* RegularExpressionLiteral */: + case 9 /* NumericLiteral */: + case 10 /* BigIntLiteral */: + case 11 /* StringLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 227 /* TemplateExpression */: + case 97 /* FalseKeyword */: + case 106 /* NullKeyword */: + case 110 /* ThisKeyword */: + case 112 /* TrueKeyword */: + case 108 /* SuperKeyword */: + case 234 /* NonNullExpression */: + case 232 /* ExpressionWithTypeArguments */: + case 235 /* MetaProperty */: + case 102 /* ImportKeyword */: + case 281 /* MissingDeclaration */: return true; default: return false; @@ -12380,13 +12429,13 @@ ${lanes.join("\n")} } function isUnaryExpressionKind(kind) { switch (kind) { - case 221 /* PrefixUnaryExpression */: - case 222 /* PostfixUnaryExpression */: - case 217 /* DeleteExpression */: - case 218 /* TypeOfExpression */: - case 219 /* VoidExpression */: - case 220 /* AwaitExpression */: - case 213 /* TypeAssertionExpression */: + case 223 /* PrefixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: + case 219 /* DeleteExpression */: + case 220 /* TypeOfExpression */: + case 221 /* VoidExpression */: + case 222 /* AwaitExpression */: + case 215 /* TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -12394,20 +12443,20 @@ ${lanes.join("\n")} } function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 222 /* PostfixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: return true; - case 221 /* PrefixUnaryExpression */: - return expr.operator === 45 /* PlusPlusToken */ || expr.operator === 46 /* MinusMinusToken */; + case 223 /* PrefixUnaryExpression */: + return expr.operator === 46 /* PlusPlusToken */ || expr.operator === 47 /* MinusMinusToken */; default: return false; } } function isLiteralTypeLiteral(node) { switch (node.kind) { - case 104 /* NullKeyword */: - case 110 /* TrueKeyword */: - case 95 /* FalseKeyword */: - case 221 /* PrefixUnaryExpression */: + case 106 /* NullKeyword */: + case 112 /* TrueKeyword */: + case 97 /* FalseKeyword */: + case 223 /* PrefixUnaryExpression */: return true; default: return isLiteralExpression(node); @@ -12418,16 +12467,16 @@ ${lanes.join("\n")} } function isExpressionKind(kind) { switch (kind) { - case 224 /* ConditionalExpression */: - case 226 /* YieldExpression */: - case 216 /* ArrowFunction */: - case 223 /* BinaryExpression */: - case 227 /* SpreadElement */: - case 231 /* AsExpression */: - case 229 /* OmittedExpression */: - case 357 /* CommaListExpression */: - case 356 /* PartiallyEmittedExpression */: - case 235 /* SatisfiesExpression */: + case 226 /* ConditionalExpression */: + case 228 /* YieldExpression */: + case 218 /* ArrowFunction */: + case 225 /* BinaryExpression */: + case 229 /* SpreadElement */: + case 233 /* AsExpression */: + case 231 /* OmittedExpression */: + case 360 /* CommaListExpression */: + case 359 /* PartiallyEmittedExpression */: + case 237 /* SatisfiesExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -12435,20 +12484,20 @@ ${lanes.join("\n")} } function isAssertionExpression(node) { const kind = node.kind; - return kind === 213 /* TypeAssertionExpression */ || kind === 231 /* AsExpression */; + return kind === 215 /* TypeAssertionExpression */ || kind === 233 /* AsExpression */; } function isNotEmittedOrPartiallyEmittedNode(node) { return isNotEmittedStatement(node) || isPartiallyEmittedExpression(node); } function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 245 /* ForStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: - case 243 /* DoStatement */: - case 244 /* WhileStatement */: + case 247 /* ForStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 245 /* DoStatement */: + case 246 /* WhileStatement */: return true; - case 253 /* LabeledStatement */: + case 255 /* LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -12466,7 +12515,7 @@ ${lanes.join("\n")} return isAnyImportOrReExport(result) || isExportAssignment(result) || hasSyntacticModifier(result, 1 /* Export */); } function isForInOrOfStatement(node) { - return node.kind === 246 /* ForInStatement */ || node.kind === 247 /* ForOfStatement */; + return node.kind === 248 /* ForInStatement */ || node.kind === 249 /* ForOfStatement */; } function isConciseBody(node) { return isBlock(node) || isExpression(node); @@ -12479,89 +12528,89 @@ ${lanes.join("\n")} } function isModuleBody(node) { const kind = node.kind; - return kind === 265 /* ModuleBlock */ || kind === 264 /* ModuleDeclaration */ || kind === 79 /* Identifier */; + return kind === 267 /* ModuleBlock */ || kind === 266 /* ModuleDeclaration */ || kind === 80 /* Identifier */; } function isNamespaceBody(node) { const kind = node.kind; - return kind === 265 /* ModuleBlock */ || kind === 264 /* ModuleDeclaration */; + return kind === 267 /* ModuleBlock */ || kind === 266 /* ModuleDeclaration */; } function isJSDocNamespaceBody(node) { const kind = node.kind; - return kind === 79 /* Identifier */ || kind === 264 /* ModuleDeclaration */; + return kind === 80 /* Identifier */ || kind === 266 /* ModuleDeclaration */; } function isNamedImportBindings(node) { const kind = node.kind; - return kind === 272 /* NamedImports */ || kind === 271 /* NamespaceImport */; + return kind === 274 /* NamedImports */ || kind === 273 /* NamespaceImport */; } function isModuleOrEnumDeclaration(node) { - return node.kind === 264 /* ModuleDeclaration */ || node.kind === 263 /* EnumDeclaration */; + return node.kind === 266 /* ModuleDeclaration */ || node.kind === 265 /* EnumDeclaration */; } function canHaveSymbol(node) { switch (node.kind) { - case 216 /* ArrowFunction */: - case 223 /* BinaryExpression */: - case 205 /* BindingElement */: - case 210 /* CallExpression */: - case 176 /* CallSignature */: - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 172 /* ClassStaticBlockDeclaration */: - case 173 /* Constructor */: - case 182 /* ConstructorType */: - case 177 /* ConstructSignature */: - case 209 /* ElementAccessExpression */: - case 263 /* EnumDeclaration */: - case 302 /* EnumMember */: - case 274 /* ExportAssignment */: - case 275 /* ExportDeclaration */: - case 278 /* ExportSpecifier */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 181 /* FunctionType */: - case 174 /* GetAccessor */: - case 79 /* Identifier */: - case 270 /* ImportClause */: - case 268 /* ImportEqualsDeclaration */: - case 273 /* ImportSpecifier */: - case 178 /* IndexSignature */: - case 261 /* InterfaceDeclaration */: - case 341 /* JSDocCallbackTag */: - case 343 /* JSDocEnumTag */: - case 320 /* JSDocFunctionType */: - case 344 /* JSDocParameterTag */: - case 351 /* JSDocPropertyTag */: - case 326 /* JSDocSignature */: - case 349 /* JSDocTypedefTag */: - case 325 /* JSDocTypeLiteral */: - case 288 /* JsxAttribute */: - case 289 /* JsxAttributes */: - case 290 /* JsxSpreadAttribute */: - case 197 /* MappedType */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 264 /* ModuleDeclaration */: - case 199 /* NamedTupleMember */: - case 277 /* NamespaceExport */: - case 267 /* NamespaceExportDeclaration */: - case 271 /* NamespaceImport */: - case 211 /* NewExpression */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 8 /* NumericLiteral */: - case 207 /* ObjectLiteralExpression */: - case 166 /* Parameter */: - case 208 /* PropertyAccessExpression */: - case 299 /* PropertyAssignment */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 175 /* SetAccessor */: - case 300 /* ShorthandPropertyAssignment */: - case 308 /* SourceFile */: - case 301 /* SpreadAssignment */: - case 10 /* StringLiteral */: - case 262 /* TypeAliasDeclaration */: - case 184 /* TypeLiteral */: - case 165 /* TypeParameter */: - case 257 /* VariableDeclaration */: + case 218 /* ArrowFunction */: + case 225 /* BinaryExpression */: + case 207 /* BindingElement */: + case 212 /* CallExpression */: + case 178 /* CallSignature */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 174 /* ClassStaticBlockDeclaration */: + case 175 /* Constructor */: + case 184 /* ConstructorType */: + case 179 /* ConstructSignature */: + case 211 /* ElementAccessExpression */: + case 265 /* EnumDeclaration */: + case 305 /* EnumMember */: + case 276 /* ExportAssignment */: + case 277 /* ExportDeclaration */: + case 280 /* ExportSpecifier */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 183 /* FunctionType */: + case 176 /* GetAccessor */: + case 80 /* Identifier */: + case 272 /* ImportClause */: + case 270 /* ImportEqualsDeclaration */: + case 275 /* ImportSpecifier */: + case 180 /* IndexSignature */: + case 263 /* InterfaceDeclaration */: + case 344 /* JSDocCallbackTag */: + case 346 /* JSDocEnumTag */: + case 323 /* JSDocFunctionType */: + case 347 /* JSDocParameterTag */: + case 354 /* JSDocPropertyTag */: + case 329 /* JSDocSignature */: + case 352 /* JSDocTypedefTag */: + case 328 /* JSDocTypeLiteral */: + case 290 /* JsxAttribute */: + case 291 /* JsxAttributes */: + case 292 /* JsxSpreadAttribute */: + case 199 /* MappedType */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 266 /* ModuleDeclaration */: + case 201 /* NamedTupleMember */: + case 279 /* NamespaceExport */: + case 269 /* NamespaceExportDeclaration */: + case 273 /* NamespaceImport */: + case 213 /* NewExpression */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 9 /* NumericLiteral */: + case 209 /* ObjectLiteralExpression */: + case 168 /* Parameter */: + case 210 /* PropertyAccessExpression */: + case 302 /* PropertyAssignment */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 177 /* SetAccessor */: + case 303 /* ShorthandPropertyAssignment */: + case 311 /* SourceFile */: + case 304 /* SpreadAssignment */: + case 11 /* StringLiteral */: + case 264 /* TypeAliasDeclaration */: + case 186 /* TypeLiteral */: + case 167 /* TypeParameter */: + case 259 /* VariableDeclaration */: return true; default: return false; @@ -12569,53 +12618,53 @@ ${lanes.join("\n")} } function canHaveLocals(node) { switch (node.kind) { - case 216 /* ArrowFunction */: - case 238 /* Block */: - case 176 /* CallSignature */: - case 266 /* CaseBlock */: - case 295 /* CatchClause */: - case 172 /* ClassStaticBlockDeclaration */: - case 191 /* ConditionalType */: - case 173 /* Constructor */: - case 182 /* ConstructorType */: - case 177 /* ConstructSignature */: - case 245 /* ForStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 181 /* FunctionType */: - case 174 /* GetAccessor */: - case 178 /* IndexSignature */: - case 341 /* JSDocCallbackTag */: - case 343 /* JSDocEnumTag */: - case 320 /* JSDocFunctionType */: - case 326 /* JSDocSignature */: - case 349 /* JSDocTypedefTag */: - case 197 /* MappedType */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 264 /* ModuleDeclaration */: - case 175 /* SetAccessor */: - case 308 /* SourceFile */: - case 262 /* TypeAliasDeclaration */: + case 218 /* ArrowFunction */: + case 240 /* Block */: + case 178 /* CallSignature */: + case 268 /* CaseBlock */: + case 298 /* CatchClause */: + case 174 /* ClassStaticBlockDeclaration */: + case 193 /* ConditionalType */: + case 175 /* Constructor */: + case 184 /* ConstructorType */: + case 179 /* ConstructSignature */: + case 247 /* ForStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 183 /* FunctionType */: + case 176 /* GetAccessor */: + case 180 /* IndexSignature */: + case 344 /* JSDocCallbackTag */: + case 346 /* JSDocEnumTag */: + case 323 /* JSDocFunctionType */: + case 329 /* JSDocSignature */: + case 352 /* JSDocTypedefTag */: + case 199 /* MappedType */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 266 /* ModuleDeclaration */: + case 177 /* SetAccessor */: + case 311 /* SourceFile */: + case 264 /* TypeAliasDeclaration */: return true; default: return false; } } function isDeclarationKind(kind) { - return kind === 216 /* ArrowFunction */ || kind === 205 /* BindingElement */ || kind === 260 /* ClassDeclaration */ || kind === 228 /* ClassExpression */ || kind === 172 /* ClassStaticBlockDeclaration */ || kind === 173 /* Constructor */ || kind === 263 /* EnumDeclaration */ || kind === 302 /* EnumMember */ || kind === 278 /* ExportSpecifier */ || kind === 259 /* FunctionDeclaration */ || kind === 215 /* FunctionExpression */ || kind === 174 /* GetAccessor */ || kind === 270 /* ImportClause */ || kind === 268 /* ImportEqualsDeclaration */ || kind === 273 /* ImportSpecifier */ || kind === 261 /* InterfaceDeclaration */ || kind === 288 /* JsxAttribute */ || kind === 171 /* MethodDeclaration */ || kind === 170 /* MethodSignature */ || kind === 264 /* ModuleDeclaration */ || kind === 267 /* NamespaceExportDeclaration */ || kind === 271 /* NamespaceImport */ || kind === 277 /* NamespaceExport */ || kind === 166 /* Parameter */ || kind === 299 /* PropertyAssignment */ || kind === 169 /* PropertyDeclaration */ || kind === 168 /* PropertySignature */ || kind === 175 /* SetAccessor */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 262 /* TypeAliasDeclaration */ || kind === 165 /* TypeParameter */ || kind === 257 /* VariableDeclaration */ || kind === 349 /* JSDocTypedefTag */ || kind === 341 /* JSDocCallbackTag */ || kind === 351 /* JSDocPropertyTag */; + return kind === 218 /* ArrowFunction */ || kind === 207 /* BindingElement */ || kind === 262 /* ClassDeclaration */ || kind === 230 /* ClassExpression */ || kind === 174 /* ClassStaticBlockDeclaration */ || kind === 175 /* Constructor */ || kind === 265 /* EnumDeclaration */ || kind === 305 /* EnumMember */ || kind === 280 /* ExportSpecifier */ || kind === 261 /* FunctionDeclaration */ || kind === 217 /* FunctionExpression */ || kind === 176 /* GetAccessor */ || kind === 272 /* ImportClause */ || kind === 270 /* ImportEqualsDeclaration */ || kind === 275 /* ImportSpecifier */ || kind === 263 /* InterfaceDeclaration */ || kind === 290 /* JsxAttribute */ || kind === 173 /* MethodDeclaration */ || kind === 172 /* MethodSignature */ || kind === 266 /* ModuleDeclaration */ || kind === 269 /* NamespaceExportDeclaration */ || kind === 273 /* NamespaceImport */ || kind === 279 /* NamespaceExport */ || kind === 168 /* Parameter */ || kind === 302 /* PropertyAssignment */ || kind === 171 /* PropertyDeclaration */ || kind === 170 /* PropertySignature */ || kind === 177 /* SetAccessor */ || kind === 303 /* ShorthandPropertyAssignment */ || kind === 264 /* TypeAliasDeclaration */ || kind === 167 /* TypeParameter */ || kind === 259 /* VariableDeclaration */ || kind === 352 /* JSDocTypedefTag */ || kind === 344 /* JSDocCallbackTag */ || kind === 354 /* JSDocPropertyTag */; } function isDeclarationStatementKind(kind) { - return kind === 259 /* FunctionDeclaration */ || kind === 279 /* MissingDeclaration */ || kind === 260 /* ClassDeclaration */ || kind === 261 /* InterfaceDeclaration */ || kind === 262 /* TypeAliasDeclaration */ || kind === 263 /* EnumDeclaration */ || kind === 264 /* ModuleDeclaration */ || kind === 269 /* ImportDeclaration */ || kind === 268 /* ImportEqualsDeclaration */ || kind === 275 /* ExportDeclaration */ || kind === 274 /* ExportAssignment */ || kind === 267 /* NamespaceExportDeclaration */; + return kind === 261 /* FunctionDeclaration */ || kind === 281 /* MissingDeclaration */ || kind === 262 /* ClassDeclaration */ || kind === 263 /* InterfaceDeclaration */ || kind === 264 /* TypeAliasDeclaration */ || kind === 265 /* EnumDeclaration */ || kind === 266 /* ModuleDeclaration */ || kind === 271 /* ImportDeclaration */ || kind === 270 /* ImportEqualsDeclaration */ || kind === 277 /* ExportDeclaration */ || kind === 276 /* ExportAssignment */ || kind === 269 /* NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 249 /* BreakStatement */ || kind === 248 /* ContinueStatement */ || kind === 256 /* DebuggerStatement */ || kind === 243 /* DoStatement */ || kind === 241 /* ExpressionStatement */ || kind === 239 /* EmptyStatement */ || kind === 246 /* ForInStatement */ || kind === 247 /* ForOfStatement */ || kind === 245 /* ForStatement */ || kind === 242 /* IfStatement */ || kind === 253 /* LabeledStatement */ || kind === 250 /* ReturnStatement */ || kind === 252 /* SwitchStatement */ || kind === 254 /* ThrowStatement */ || kind === 255 /* TryStatement */ || kind === 240 /* VariableStatement */ || kind === 244 /* WhileStatement */ || kind === 251 /* WithStatement */ || kind === 355 /* NotEmittedStatement */ || kind === 359 /* EndOfDeclarationMarker */ || kind === 358 /* MergeDeclarationMarker */; + return kind === 251 /* BreakStatement */ || kind === 250 /* ContinueStatement */ || kind === 258 /* DebuggerStatement */ || kind === 245 /* DoStatement */ || kind === 243 /* ExpressionStatement */ || kind === 241 /* EmptyStatement */ || kind === 248 /* ForInStatement */ || kind === 249 /* ForOfStatement */ || kind === 247 /* ForStatement */ || kind === 244 /* IfStatement */ || kind === 255 /* LabeledStatement */ || kind === 252 /* ReturnStatement */ || kind === 254 /* SwitchStatement */ || kind === 256 /* ThrowStatement */ || kind === 257 /* TryStatement */ || kind === 242 /* VariableStatement */ || kind === 246 /* WhileStatement */ || kind === 253 /* WithStatement */ || kind === 358 /* NotEmittedStatement */; } function isDeclaration(node) { - if (node.kind === 165 /* TypeParameter */) { - return node.parent && node.parent.kind !== 348 /* JSDocTemplateTag */ || isInJSFile(node); + if (node.kind === 167 /* TypeParameter */) { + return node.parent && node.parent.kind !== 351 /* JSDocTemplateTag */ || isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -12630,10 +12679,10 @@ ${lanes.join("\n")} return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) || isBlockStatement(node); } function isBlockStatement(node) { - if (node.kind !== 238 /* Block */) + if (node.kind !== 240 /* Block */) return false; if (node.parent !== void 0) { - if (node.parent.kind === 255 /* TryStatement */ || node.parent.kind === 295 /* CatchClause */) { + if (node.parent.kind === 257 /* TryStatement */ || node.parent.kind === 298 /* CatchClause */) { return false; } } @@ -12641,50 +12690,50 @@ ${lanes.join("\n")} } function isStatementOrBlock(node) { const kind = node.kind; - return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) || kind === 238 /* Block */; + return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) || kind === 240 /* Block */; } function isModuleReference(node) { const kind = node.kind; - return kind === 280 /* ExternalModuleReference */ || kind === 163 /* QualifiedName */ || kind === 79 /* Identifier */; + return kind === 282 /* ExternalModuleReference */ || kind === 165 /* QualifiedName */ || kind === 80 /* Identifier */; } function isJsxTagNameExpression(node) { const kind = node.kind; - return kind === 108 /* ThisKeyword */ || kind === 79 /* Identifier */ || kind === 208 /* PropertyAccessExpression */; + return kind === 110 /* ThisKeyword */ || kind === 80 /* Identifier */ || kind === 210 /* PropertyAccessExpression */ || kind === 294 /* JsxNamespacedName */; } function isJsxChild(node) { const kind = node.kind; - return kind === 281 /* JsxElement */ || kind === 291 /* JsxExpression */ || kind === 282 /* JsxSelfClosingElement */ || kind === 11 /* JsxText */ || kind === 285 /* JsxFragment */; + return kind === 283 /* JsxElement */ || kind === 293 /* JsxExpression */ || kind === 284 /* JsxSelfClosingElement */ || kind === 12 /* JsxText */ || kind === 287 /* JsxFragment */; } function isJsxAttributeLike(node) { const kind = node.kind; - return kind === 288 /* JsxAttribute */ || kind === 290 /* JsxSpreadAttribute */; + return kind === 290 /* JsxAttribute */ || kind === 292 /* JsxSpreadAttribute */; } function isStringLiteralOrJsxExpression(node) { const kind = node.kind; - return kind === 10 /* StringLiteral */ || kind === 291 /* JsxExpression */; + return kind === 11 /* StringLiteral */ || kind === 293 /* JsxExpression */; } function isJsxOpeningLikeElement(node) { const kind = node.kind; - return kind === 283 /* JsxOpeningElement */ || kind === 282 /* JsxSelfClosingElement */; + return kind === 285 /* JsxOpeningElement */ || kind === 284 /* JsxSelfClosingElement */; } function isCaseOrDefaultClause(node) { const kind = node.kind; - return kind === 292 /* CaseClause */ || kind === 293 /* DefaultClause */; + return kind === 295 /* CaseClause */ || kind === 296 /* DefaultClause */; } function isJSDocNode(node) { - return node.kind >= 312 /* FirstJSDocNode */ && node.kind <= 353 /* LastJSDocNode */; + return node.kind >= 315 /* FirstJSDocNode */ && node.kind <= 356 /* LastJSDocNode */; } function isJSDocCommentContainingNode(node) { - return node.kind === 323 /* JSDoc */ || node.kind === 322 /* JSDocNamepathType */ || node.kind === 324 /* JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || isJSDocTypeLiteral(node) || isJSDocSignature(node); + return node.kind === 326 /* JSDoc */ || node.kind === 325 /* JSDocNamepathType */ || node.kind === 327 /* JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || isJSDocTypeLiteral(node) || isJSDocSignature(node); } function isJSDocTag(node) { - return node.kind >= 330 /* FirstJSDocTagNode */ && node.kind <= 353 /* LastJSDocTagNode */; + return node.kind >= 333 /* FirstJSDocTagNode */ && node.kind <= 356 /* LastJSDocTagNode */; } function isSetAccessor(node) { - return node.kind === 175 /* SetAccessor */; + return node.kind === 177 /* SetAccessor */; } function isGetAccessor(node) { - return node.kind === 174 /* GetAccessor */; + return node.kind === 176 /* GetAccessor */; } function hasJSDocNodes(node) { if (!canHaveJSDoc(node)) @@ -12700,22 +12749,22 @@ ${lanes.join("\n")} } function hasOnlyExpressionInitializer(node) { switch (node.kind) { - case 257 /* VariableDeclaration */: - case 166 /* Parameter */: - case 205 /* BindingElement */: - case 169 /* PropertyDeclaration */: - case 299 /* PropertyAssignment */: - case 302 /* EnumMember */: + case 259 /* VariableDeclaration */: + case 168 /* Parameter */: + case 207 /* BindingElement */: + case 171 /* PropertyDeclaration */: + case 302 /* PropertyAssignment */: + case 305 /* EnumMember */: return true; default: return false; } } function isObjectLiteralElement(node) { - return node.kind === 288 /* JsxAttribute */ || node.kind === 290 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node); + return node.kind === 290 /* JsxAttribute */ || node.kind === 292 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node); } function isTypeReferenceType(node) { - return node.kind === 180 /* TypeReference */ || node.kind === 230 /* ExpressionWithTypeArguments */; + return node.kind === 182 /* TypeReference */ || node.kind === 232 /* ExpressionWithTypeArguments */; } function guessIndentation(lines) { let indentation = MAX_SMI_X86; @@ -12739,10 +12788,10 @@ ${lanes.join("\n")} return indentation === MAX_SMI_X86 ? void 0 : indentation; } function isStringLiteralLike(node) { - return node.kind === 10 /* StringLiteral */ || node.kind === 14 /* NoSubstitutionTemplateLiteral */; + return node.kind === 11 /* StringLiteral */ || node.kind === 15 /* NoSubstitutionTemplateLiteral */; } function isJSDocLinkLike(node) { - return node.kind === 327 /* JSDocLink */ || node.kind === 328 /* JSDocLinkCode */ || node.kind === 329 /* JSDocLinkPlain */; + return node.kind === 330 /* JSDocLink */ || node.kind === 331 /* JSDocLinkCode */ || node.kind === 332 /* JSDocLinkPlain */; } function hasRestParameter(s) { const last2 = lastOrUndefined(s.parameters); @@ -12750,7 +12799,7 @@ ${lanes.join("\n")} } function isRestParameter(node) { const type = isJSDocParameterTag(node) ? node.typeExpression && node.typeExpression.type : node.type; - return node.dotDotDotToken !== void 0 || !!type && type.kind === 321 /* JSDocVariadicType */; + return node.dotDotDotToken !== void 0 || !!type && type.kind === 324 /* JSDocVariadicType */; } var unchangedTextChangeRange, supportedLocaleDirectories, MAX_SMI_X86; var init_utilitiesPublic = __esm({ @@ -12886,8 +12935,8 @@ ${lanes.join("\n")} return node.end - node.pos; } function getResolvedModule(sourceFile, moduleNameText, mode) { - var _a2, _b; - return (_b = (_a2 = sourceFile == null ? void 0 : sourceFile.resolvedModules) == null ? void 0 : _a2.get(moduleNameText, mode)) == null ? void 0 : _b.resolvedModule; + var _a, _b; + return (_b = (_a = sourceFile == null ? void 0 : sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleNameText, mode)) == null ? void 0 : _b.resolvedModule; } function setResolvedModule(sourceFile, moduleNameText, resolvedModule, mode) { if (!sourceFile.resolvedModules) { @@ -12902,14 +12951,46 @@ ${lanes.join("\n")} sourceFile.resolvedTypeReferenceDirectiveNames.set(typeReferenceDirectiveName, mode, resolvedTypeReferenceDirective); } function getResolvedTypeReferenceDirective(sourceFile, typeReferenceDirectiveName, mode) { - var _a2, _b; - return (_b = (_a2 = sourceFile == null ? void 0 : sourceFile.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a2.get(typeReferenceDirectiveName, mode)) == null ? void 0 : _b.resolvedTypeReferenceDirective; + var _a, _b; + return (_b = (_a = sourceFile == null ? void 0 : sourceFile.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _a.get(typeReferenceDirectiveName, mode)) == null ? void 0 : _b.resolvedTypeReferenceDirective; } function projectReferenceIsEqualTo(oldRef, newRef) { return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular; } function moduleResolutionIsEqualTo(oldResolution, newResolution) { - return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId); + return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId) && oldResolution.node10Result === newResolution.node10Result; + } + function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) { + var _a, _b; + const node10Result = (_b = (_a = sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleReference, mode)) == null ? void 0 : _b.node10Result; + const result = node10Result ? chainDiagnosticMessages( + /*details*/ + void 0, + Diagnostics.There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The_1_library_may_need_to_update_its_package_json_or_typings, + node10Result, + node10Result.indexOf(nodeModulesPathPart + "@types/") > -1 ? `@types/${mangleScopedPackageName(packageName)}` : packageName + ) : host.typesPackageExists(packageName) ? chainDiagnosticMessages( + /*details*/ + void 0, + Diagnostics.If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1, + packageName, + mangleScopedPackageName(packageName) + ) : host.packageBundlesTypes(packageName) ? chainDiagnosticMessages( + /*details*/ + void 0, + Diagnostics.If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1, + packageName, + moduleReference + ) : chainDiagnosticMessages( + /*details*/ + void 0, + Diagnostics.Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0, + moduleReference, + mangleScopedPackageName(packageName) + ); + if (result) + result.repopulateInfo = () => ({ moduleReference, mode, packageName: packageName === moduleReference ? void 0 : packageName }); + return result; } function packageIdIsEqual(a, b) { return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version; @@ -12952,7 +13033,7 @@ ${lanes.join("\n")} } } function getSourceFileOfNode(node) { - while (node && node.kind !== 308 /* SourceFile */) { + while (node && node.kind !== 311 /* SourceFile */) { node = node.parent; } return node; @@ -12965,11 +13046,11 @@ ${lanes.join("\n")} } function isStatementWithLocals(node) { switch (node.kind) { - case 238 /* Block */: - case 266 /* CaseBlock */: - case 245 /* ForStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: + case 240 /* Block */: + case 268 /* CaseBlock */: + case 247 /* ForStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: return true; } return false; @@ -13084,7 +13165,7 @@ ${lanes.join("\n")} function isRecognizedTripleSlashComment(text, commentPos, commentEnd) { if (text.charCodeAt(commentPos + 1) === 47 /* slash */ && commentPos + 2 < commentEnd && text.charCodeAt(commentPos + 2) === 47 /* slash */) { const textSubStr = text.substring(commentPos, commentEnd); - return fullTripleSlashReferencePathRegEx.test(textSubStr) || fullTripleSlashAMDReferencePathRegEx.test(textSubStr) || fullTripleSlashReferenceTypeReferenceDirectiveRegEx.test(textSubStr) || defaultLibReferenceRegEx.test(textSubStr) ? true : false; + return fullTripleSlashReferencePathRegEx.test(textSubStr) || fullTripleSlashAMDReferencePathRegEx.test(textSubStr) || fullTripleSlashAMDModuleRegEx.test(textSubStr) || fullTripleSlashReferenceTypeReferenceDirectiveRegEx.test(textSubStr) || fullTripleSlashLibReferenceRegEx.test(textSubStr) || defaultLibReferenceRegEx.test(textSubStr) ? true : false; } return false; } @@ -13115,7 +13196,7 @@ ${lanes.join("\n")} if (nodeIsMissing(node)) { return node.pos; } - if (isJSDocNode(node) || node.kind === 11 /* JsxText */) { + if (isJSDocNode(node) || node.kind === 12 /* JsxText */) { return skipTrivia( (sourceFile || getSourceFileOfNode(node)).text, node.pos, @@ -13128,7 +13209,7 @@ ${lanes.join("\n")} if (includeJsDoc && hasJSDocNodes(node)) { return getTokenPosOfNode(node.jsDoc[0], sourceFile); } - if (node.kind === 354 /* SyntaxList */ && node._children.length > 0) { + if (node.kind === 357 /* SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return skipTrivia( @@ -13581,41 +13662,40 @@ ${lanes.join("\n")} })); } function getLiteralText(node, sourceFile, flags) { - var _a2; if (sourceFile && canUseOriginalText(node, flags)) { return getSourceTextOfNodeFromSourceFile(sourceFile, node); } switch (node.kind) { - case 10 /* StringLiteral */: { - const escapeText = flags & 2 /* JsxAttributeEscape */ ? escapeJsxAttributeString : flags & 1 /* NeverAsciiEscape */ || getEmitFlags(node) & 33554432 /* NoAsciiEscaping */ ? escapeString : escapeNonAsciiString; + case 11 /* StringLiteral */: { + const escapeText = flags & 2 /* JsxAttributeEscape */ ? escapeJsxAttributeString : flags & 1 /* NeverAsciiEscape */ || getEmitFlags(node) & 16777216 /* NoAsciiEscaping */ ? escapeString : escapeNonAsciiString; if (node.singleQuote) { return "'" + escapeText(node.text, 39 /* singleQuote */) + "'"; } else { return '"' + escapeText(node.text, 34 /* doubleQuote */) + '"'; } } - case 14 /* NoSubstitutionTemplateLiteral */: - case 15 /* TemplateHead */: - case 16 /* TemplateMiddle */: - case 17 /* TemplateTail */: { - const escapeText = flags & 1 /* NeverAsciiEscape */ || getEmitFlags(node) & 33554432 /* NoAsciiEscaping */ ? escapeString : escapeNonAsciiString; - const rawText = (_a2 = node.rawText) != null ? _a2 : escapeTemplateSubstitution(escapeText(node.text, 96 /* backtick */)); + case 15 /* NoSubstitutionTemplateLiteral */: + case 16 /* TemplateHead */: + case 17 /* TemplateMiddle */: + case 18 /* TemplateTail */: { + const escapeText = flags & 1 /* NeverAsciiEscape */ || getEmitFlags(node) & 16777216 /* NoAsciiEscaping */ ? escapeString : escapeNonAsciiString; + const rawText = node.rawText ?? escapeTemplateSubstitution(escapeText(node.text, 96 /* backtick */)); switch (node.kind) { - case 14 /* NoSubstitutionTemplateLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: return "`" + rawText + "`"; - case 15 /* TemplateHead */: + case 16 /* TemplateHead */: return "`" + rawText + "${"; - case 16 /* TemplateMiddle */: + case 17 /* TemplateMiddle */: return "}" + rawText + "${"; - case 17 /* TemplateTail */: + case 18 /* TemplateTail */: return "}" + rawText + "`"; } break; } - case 8 /* NumericLiteral */: - case 9 /* BigIntLiteral */: + case 9 /* NumericLiteral */: + case 10 /* BigIntLiteral */: return node.text; - case 13 /* RegularExpressionLiteral */: + case 14 /* RegularExpressionLiteral */: if (flags & 4 /* TerminateUnterminatedLiterals */ && node.isUnterminated) { return node.text + (node.text.charCodeAt(node.text.length - 1) === 92 /* backslash */ ? " /" : "/"); } @@ -13627,8 +13707,13 @@ ${lanes.join("\n")} if (nodeIsSynthesized(node) || !node.parent || flags & 4 /* TerminateUnterminatedLiterals */ && node.isUnterminated) { return false; } - if (isNumericLiteral(node) && node.numericLiteralFlags & 512 /* ContainsSeparator */) { - return !!(flags & 8 /* AllowNumericSeparator */); + if (isNumericLiteral(node)) { + if (node.numericLiteralFlags & 26656 /* IsInvalid */) { + return false; + } + if (node.numericLiteralFlags & 512 /* ContainsSeparator */) { + return !!(flags & 8 /* AllowNumericSeparator */); + } } return !isBigIntLiteral(node); } @@ -13643,13 +13728,13 @@ ${lanes.join("\n")} } function isCatchClauseVariableDeclarationOrBindingElement(declaration) { const node = getRootDeclaration(declaration); - return node.kind === 257 /* VariableDeclaration */ && node.parent.kind === 295 /* CatchClause */; + return node.kind === 259 /* VariableDeclaration */ && node.parent.kind === 298 /* CatchClause */; } function isAmbientModule(node) { - return isModuleDeclaration(node) && (node.name.kind === 10 /* StringLiteral */ || isGlobalScopeAugmentation(node)); + return isModuleDeclaration(node) && (node.name.kind === 11 /* StringLiteral */ || isGlobalScopeAugmentation(node)); } function isModuleWithStringLiteralName(node) { - return isModuleDeclaration(node) && node.name.kind === 10 /* StringLiteral */; + return isModuleDeclaration(node) && node.name.kind === 11 /* StringLiteral */; } function isNonGlobalAmbientModule(node) { return isModuleDeclaration(node) && isStringLiteral(node.name); @@ -13661,10 +13746,10 @@ ${lanes.join("\n")} return isShorthandAmbientModule(moduleSymbol.valueDeclaration); } function isShorthandAmbientModule(node) { - return !!node && node.kind === 264 /* ModuleDeclaration */ && !node.body; + return !!node && node.kind === 266 /* ModuleDeclaration */ && !node.body; } function isBlockScopedContainerTopLevel(node) { - return node.kind === 308 /* SourceFile */ || node.kind === 264 /* ModuleDeclaration */ || isFunctionLikeOrClassStaticBlockDeclaration(node); + return node.kind === 311 /* SourceFile */ || node.kind === 266 /* ModuleDeclaration */ || isFunctionLikeOrClassStaticBlockDeclaration(node); } function isGlobalScopeAugmentation(module2) { return !!(module2.flags & 1024 /* GlobalAugmentation */); @@ -13674,22 +13759,22 @@ ${lanes.join("\n")} } function isModuleAugmentationExternal(node) { switch (node.parent.kind) { - case 308 /* SourceFile */: + case 311 /* SourceFile */: return isExternalModule(node.parent); - case 265 /* ModuleBlock */: + case 267 /* ModuleBlock */: return isAmbientModule(node.parent.parent) && isSourceFile(node.parent.parent.parent) && !isExternalModule(node.parent.parent.parent); } return false; } function getNonAugmentationDeclaration(symbol) { - var _a2; - return (_a2 = symbol.declarations) == null ? void 0 : _a2.find((d) => !isExternalModuleAugmentation(d) && !(isModuleDeclaration(d) && isGlobalScopeAugmentation(d))); + var _a; + return (_a = symbol.declarations) == null ? void 0 : _a.find((d) => !isExternalModuleAugmentation(d) && !(isModuleDeclaration(d) && isGlobalScopeAugmentation(d))); } function isCommonJSContainingModuleKind(kind) { return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */; } function isEffectiveExternalModule(node, compilerOptions) { - return isExternalModule(node) || getIsolatedModules(compilerOptions) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator; + return isExternalModule(node) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator; } function isEffectiveStrictModeSourceFile(node, compilerOptions) { switch (node.scriptKind) { @@ -13723,24 +13808,24 @@ ${lanes.join("\n")} } function isBlockScope(node, parentNode) { switch (node.kind) { - case 308 /* SourceFile */: - case 266 /* CaseBlock */: - case 295 /* CatchClause */: - case 264 /* ModuleDeclaration */: - case 245 /* ForStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: - case 173 /* Constructor */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 169 /* PropertyDeclaration */: - case 172 /* ClassStaticBlockDeclaration */: + case 311 /* SourceFile */: + case 268 /* CaseBlock */: + case 298 /* CatchClause */: + case 266 /* ModuleDeclaration */: + case 247 /* ForStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 175 /* Constructor */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 171 /* PropertyDeclaration */: + case 174 /* ClassStaticBlockDeclaration */: return true; - case 238 /* Block */: + case 240 /* Block */: return !isFunctionLikeOrClassStaticBlockDeclaration(parentNode); } return false; @@ -13748,9 +13833,9 @@ ${lanes.join("\n")} function isDeclarationWithTypeParameters(node) { Debug.type(node); switch (node.kind) { - case 341 /* JSDocCallbackTag */: - case 349 /* JSDocTypedefTag */: - case 326 /* JSDocSignature */: + case 344 /* JSDocCallbackTag */: + case 352 /* JSDocTypedefTag */: + case 329 /* JSDocSignature */: return true; default: assertType(node); @@ -13760,25 +13845,25 @@ ${lanes.join("\n")} function isDeclarationWithTypeParameterChildren(node) { Debug.type(node); switch (node.kind) { - case 176 /* CallSignature */: - case 177 /* ConstructSignature */: - case 170 /* MethodSignature */: - case 178 /* IndexSignature */: - case 181 /* FunctionType */: - case 182 /* ConstructorType */: - case 320 /* JSDocFunctionType */: - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 261 /* InterfaceDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 348 /* JSDocTemplateTag */: - case 259 /* FunctionDeclaration */: - case 171 /* MethodDeclaration */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 178 /* CallSignature */: + case 179 /* ConstructSignature */: + case 172 /* MethodSignature */: + case 180 /* IndexSignature */: + case 183 /* FunctionType */: + case 184 /* ConstructorType */: + case 323 /* JSDocFunctionType */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 263 /* InterfaceDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 351 /* JSDocTemplateTag */: + case 261 /* FunctionDeclaration */: + case 173 /* MethodDeclaration */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: return true; default: assertType(node); @@ -13787,8 +13872,8 @@ ${lanes.join("\n")} } function isAnyImportSyntax(node) { switch (node.kind) { - case 269 /* ImportDeclaration */: - case 268 /* ImportEqualsDeclaration */: + case 271 /* ImportDeclaration */: + case 270 /* ImportEqualsDeclaration */: return true; default: return false; @@ -13799,15 +13884,15 @@ ${lanes.join("\n")} } function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 269 /* ImportDeclaration */: - case 268 /* ImportEqualsDeclaration */: - case 240 /* VariableStatement */: - case 260 /* ClassDeclaration */: - case 259 /* FunctionDeclaration */: - case 264 /* ModuleDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 261 /* InterfaceDeclaration */: - case 263 /* EnumDeclaration */: + case 271 /* ImportDeclaration */: + case 270 /* ImportEqualsDeclaration */: + case 242 /* VariableStatement */: + case 262 /* ClassDeclaration */: + case 261 /* FunctionDeclaration */: + case 266 /* ModuleDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 263 /* InterfaceDeclaration */: + case 265 /* EnumDeclaration */: return true; default: return false; @@ -13836,22 +13921,24 @@ ${lanes.join("\n")} return info.declaration ? declarationNameToString(info.declaration.parameters[0].name) : void 0; } function isComputedNonLiteralName(name) { - return name.kind === 164 /* ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); + return name.kind === 166 /* ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); } function tryGetTextOfPropertyName(name) { - var _a2; + var _a; switch (name.kind) { - case 79 /* Identifier */: - case 80 /* PrivateIdentifier */: - return ((_a2 = name.emitNode) == null ? void 0 : _a2.autoGenerate) ? void 0 : name.escapedText; - case 10 /* StringLiteral */: - case 8 /* NumericLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: + case 80 /* Identifier */: + case 81 /* PrivateIdentifier */: + return ((_a = name.emitNode) == null ? void 0 : _a.autoGenerate) ? void 0 : name.escapedText; + case 11 /* StringLiteral */: + case 9 /* NumericLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: return escapeLeadingUnderscores(name.text); - case 164 /* ComputedPropertyName */: + case 166 /* ComputedPropertyName */: if (isStringOrNumericLiteralLike(name.expression)) return escapeLeadingUnderscores(name.expression.text); return void 0; + case 294 /* JsxNamespacedName */: + return getEscapedTextOfJsxNamespacedName(name); default: return Debug.assertNever(name); } @@ -13861,36 +13948,38 @@ ${lanes.join("\n")} } function entityNameToString(name) { switch (name.kind) { - case 108 /* ThisKeyword */: + case 110 /* ThisKeyword */: return "this"; - case 80 /* PrivateIdentifier */: - case 79 /* Identifier */: + case 81 /* PrivateIdentifier */: + case 80 /* Identifier */: return getFullWidth(name) === 0 ? idText(name) : getTextOfNode(name); - case 163 /* QualifiedName */: + case 165 /* QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: if (isIdentifier(name.name) || isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return Debug.assertNever(name.name); } - case 314 /* JSDocMemberName */: + case 317 /* JSDocMemberName */: return entityNameToString(name.left) + entityNameToString(name.right); + case 294 /* JsxNamespacedName */: + return entityNameToString(name.namespace) + ":" + entityNameToString(name.name); default: return Debug.assertNever(name); } } - function createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3) { + function createDiagnosticForNode(node, message, ...args) { const sourceFile = getSourceFileOfNode(node); - return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3); + return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args); } - function createDiagnosticForNodeArray(sourceFile, nodes, message, arg0, arg1, arg2, arg3) { + function createDiagnosticForNodeArray(sourceFile, nodes, message, ...args) { const start = skipTrivia(sourceFile.text, nodes.pos); - return createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2, arg3); + return createFileDiagnostic(sourceFile, start, nodes.end - start, message, ...args); } - function createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3) { + function createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args) { const span = getErrorSpanForNode(sourceFile, node); - return createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2, arg3); + return createFileDiagnostic(sourceFile, span.start, span.length, message, ...args); } function createDiagnosticForNodeFromMessageChain(sourceFile, node, messageChain, relatedInformation) { const span = getErrorSpanForNode(sourceFile, node); @@ -13956,13 +14045,13 @@ ${lanes.join("\n")} true, sourceFile.languageVariant, sourceFile.text, - /*onError:*/ + /*onError*/ void 0, pos ); scanner2.scan(); - const start = scanner2.getTokenPos(); - return createTextSpanFromBounds(start, scanner2.getTextPos()); + const start = scanner2.getTokenStart(); + return createTextSpanFromBounds(start, scanner2.getTokenEnd()); } function scanTokenAtPosition(sourceFile, pos) { const scanner2 = createScanner( @@ -13971,7 +14060,7 @@ ${lanes.join("\n")} true, sourceFile.languageVariant, sourceFile.text, - /*onError:*/ + /*onError*/ void 0, pos ); @@ -13980,7 +14069,7 @@ ${lanes.join("\n")} } function getErrorSpanForArrowFunction(sourceFile, node) { const pos = skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 238 /* Block */) { + if (node.body && node.body.kind === 240 /* Block */) { const { line: startLine } = getLineAndCharacterOfPosition(sourceFile, node.body.pos); const { line: endLine } = getLineAndCharacterOfPosition(sourceFile, node.body.end); if (startLine < endLine) { @@ -13992,7 +14081,7 @@ ${lanes.join("\n")} function getErrorSpanForNode(sourceFile, node) { let errorNode = node; switch (node.kind) { - case 308 /* SourceFile */: + case 311 /* SourceFile */: { const pos2 = skipTrivia( sourceFile.text, 0, @@ -14003,32 +14092,47 @@ ${lanes.join("\n")} return createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos2); - case 257 /* VariableDeclaration */: - case 205 /* BindingElement */: - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 261 /* InterfaceDeclaration */: - case 264 /* ModuleDeclaration */: - case 263 /* EnumDeclaration */: - case 302 /* EnumMember */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 262 /* TypeAliasDeclaration */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 271 /* NamespaceImport */: + } + case 259 /* VariableDeclaration */: + case 207 /* BindingElement */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 263 /* InterfaceDeclaration */: + case 266 /* ModuleDeclaration */: + case 265 /* EnumDeclaration */: + case 305 /* EnumMember */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 264 /* TypeAliasDeclaration */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 273 /* NamespaceImport */: errorNode = node.name; break; - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); - case 292 /* CaseClause */: - case 293 /* DefaultClause */: + case 295 /* CaseClause */: + case 296 /* DefaultClause */: { const start = skipTrivia(sourceFile.text, node.pos); const end = node.statements.length > 0 ? node.statements[0].pos : node.end; return createTextSpanFromBounds(start, end); + } + case 252 /* ReturnStatement */: + case 228 /* YieldExpression */: { + const pos2 = skipTrivia(sourceFile.text, node.pos); + return getSpanOfTokenAtPosition(sourceFile, pos2); + } + case 237 /* SatisfiesExpression */: { + const pos2 = skipTrivia(sourceFile.text, node.expression.end); + return getSpanOfTokenAtPosition(sourceFile, pos2); + } + case 356 /* JSDocSatisfiesTag */: { + const pos2 = skipTrivia(sourceFile.text, node.tagName.pos); + return getSpanOfTokenAtPosition(sourceFile, pos2); + } } if (errorNode === void 0) { return getSpanOfTokenAtPosition(sourceFile, node.pos); @@ -14064,19 +14168,19 @@ ${lanes.join("\n")} return !!(getCombinedNodeFlags(node) & 1 /* Let */); } function isSuperCall(n) { - return n.kind === 210 /* CallExpression */ && n.expression.kind === 106 /* SuperKeyword */; + return n.kind === 212 /* CallExpression */ && n.expression.kind === 108 /* SuperKeyword */; } function isImportCall(n) { - return n.kind === 210 /* CallExpression */ && n.expression.kind === 100 /* ImportKeyword */; + return n.kind === 212 /* CallExpression */ && n.expression.kind === 102 /* ImportKeyword */; } function isImportMeta(n) { - return isMetaProperty(n) && n.keywordToken === 100 /* ImportKeyword */ && n.name.escapedText === "meta"; + return isMetaProperty(n) && n.keywordToken === 102 /* ImportKeyword */ && n.name.escapedText === "meta"; } function isLiteralImportTypeNode(n) { return isImportTypeNode(n) && isLiteralTypeNode(n.argument) && isStringLiteral(n.argument.literal); } function isPrologueDirective(node) { - return node.kind === 241 /* ExpressionStatement */ && node.expression.kind === 10 /* StringLiteral */; + return node.kind === 243 /* ExpressionStatement */ && node.expression.kind === 11 /* StringLiteral */; } function isCustomPrologue(node) { return !!(getEmitFlags(node) & 2097152 /* CustomPrologue */); @@ -14091,89 +14195,89 @@ ${lanes.join("\n")} return isCustomPrologue(node) && isVariableStatement(node) && every(node.declarationList.declarations, isHoistedVariable); } function getLeadingCommentRangesOfNode(node, sourceFileOfNode) { - return node.kind !== 11 /* JsxText */ ? getLeadingCommentRanges(sourceFileOfNode.text, node.pos) : void 0; + return node.kind !== 12 /* JsxText */ ? getLeadingCommentRanges(sourceFileOfNode.text, node.pos) : void 0; } function getJSDocCommentRanges(node, text) { - const commentRanges = node.kind === 166 /* Parameter */ || node.kind === 165 /* TypeParameter */ || node.kind === 215 /* FunctionExpression */ || node.kind === 216 /* ArrowFunction */ || node.kind === 214 /* ParenthesizedExpression */ || node.kind === 257 /* VariableDeclaration */ || node.kind === 278 /* ExportSpecifier */ ? concatenate(getTrailingCommentRanges(text, node.pos), getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRanges(text, node.pos); + const commentRanges = node.kind === 168 /* Parameter */ || node.kind === 167 /* TypeParameter */ || node.kind === 217 /* FunctionExpression */ || node.kind === 218 /* ArrowFunction */ || node.kind === 216 /* ParenthesizedExpression */ || node.kind === 259 /* VariableDeclaration */ || node.kind === 280 /* ExportSpecifier */ ? concatenate(getTrailingCommentRanges(text, node.pos), getLeadingCommentRanges(text, node.pos)) : getLeadingCommentRanges(text, node.pos); return filter(commentRanges, (comment) => text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */); } function isPartOfTypeNode(node) { - if (179 /* FirstTypeNode */ <= node.kind && node.kind <= 202 /* LastTypeNode */) { + if (181 /* FirstTypeNode */ <= node.kind && node.kind <= 204 /* LastTypeNode */) { return true; } switch (node.kind) { - case 131 /* AnyKeyword */: - case 157 /* UnknownKeyword */: - case 148 /* NumberKeyword */: - case 160 /* BigIntKeyword */: - case 152 /* StringKeyword */: - case 134 /* BooleanKeyword */: - case 153 /* SymbolKeyword */: - case 149 /* ObjectKeyword */: - case 155 /* UndefinedKeyword */: - case 144 /* NeverKeyword */: + case 133 /* AnyKeyword */: + case 159 /* UnknownKeyword */: + case 150 /* NumberKeyword */: + case 162 /* BigIntKeyword */: + case 154 /* StringKeyword */: + case 136 /* BooleanKeyword */: + case 155 /* SymbolKeyword */: + case 151 /* ObjectKeyword */: + case 157 /* UndefinedKeyword */: + case 106 /* NullKeyword */: + case 146 /* NeverKeyword */: return true; - case 114 /* VoidKeyword */: - return node.parent.kind !== 219 /* VoidExpression */; - case 230 /* ExpressionWithTypeArguments */: + case 116 /* VoidKeyword */: + return node.parent.kind !== 221 /* VoidExpression */; + case 232 /* ExpressionWithTypeArguments */: return isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 165 /* TypeParameter */: - return node.parent.kind === 197 /* MappedType */ || node.parent.kind === 192 /* InferType */; - case 79 /* Identifier */: - if (node.parent.kind === 163 /* QualifiedName */ && node.parent.right === node) { + case 167 /* TypeParameter */: + return node.parent.kind === 199 /* MappedType */ || node.parent.kind === 194 /* InferType */; + case 80 /* Identifier */: + if (node.parent.kind === 165 /* QualifiedName */ && node.parent.right === node) { node = node.parent; - } else if (node.parent.kind === 208 /* PropertyAccessExpression */ && node.parent.name === node) { + } else if (node.parent.kind === 210 /* PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } Debug.assert( - node.kind === 79 /* Identifier */ || node.kind === 163 /* QualifiedName */ || node.kind === 208 /* PropertyAccessExpression */, + node.kind === 80 /* Identifier */ || node.kind === 165 /* QualifiedName */ || node.kind === 210 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'." ); - case 163 /* QualifiedName */: - case 208 /* PropertyAccessExpression */: - case 108 /* ThisKeyword */: { + case 165 /* QualifiedName */: + case 210 /* PropertyAccessExpression */: + case 110 /* ThisKeyword */: { const { parent: parent2 } = node; - if (parent2.kind === 183 /* TypeQuery */) { + if (parent2.kind === 185 /* TypeQuery */) { return false; } - if (parent2.kind === 202 /* ImportType */) { + if (parent2.kind === 204 /* ImportType */) { return !parent2.isTypeOf; } - if (179 /* FirstTypeNode */ <= parent2.kind && parent2.kind <= 202 /* LastTypeNode */) { + if (181 /* FirstTypeNode */ <= parent2.kind && parent2.kind <= 204 /* LastTypeNode */) { return true; } switch (parent2.kind) { - case 230 /* ExpressionWithTypeArguments */: + case 232 /* ExpressionWithTypeArguments */: return isHeritageClause(parent2.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent2); - case 165 /* TypeParameter */: + case 167 /* TypeParameter */: return node === parent2.constraint; - case 348 /* JSDocTemplateTag */: + case 351 /* JSDocTemplateTag */: return node === parent2.constraint; - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 166 /* Parameter */: - case 257 /* VariableDeclaration */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 168 /* Parameter */: + case 259 /* VariableDeclaration */: return node === parent2.type; - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 173 /* Constructor */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 175 /* Constructor */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return node === parent2.type; - case 176 /* CallSignature */: - case 177 /* ConstructSignature */: - case 178 /* IndexSignature */: + case 178 /* CallSignature */: + case 179 /* ConstructSignature */: + case 180 /* IndexSignature */: return node === parent2.type; - case 213 /* TypeAssertionExpression */: + case 215 /* TypeAssertionExpression */: return node === parent2.type; - case 210 /* CallExpression */: - case 211 /* NewExpression */: + case 212 /* CallExpression */: + case 213 /* NewExpression */: + case 214 /* TaggedTemplateExpression */: return contains(parent2.typeArguments, node); - case 212 /* TaggedTemplateExpression */: - return false; } } } @@ -14192,23 +14296,23 @@ ${lanes.join("\n")} return traverse(body); function traverse(node) { switch (node.kind) { - case 250 /* ReturnStatement */: + case 252 /* ReturnStatement */: return visitor(node); - case 266 /* CaseBlock */: - case 238 /* Block */: - case 242 /* IfStatement */: - case 243 /* DoStatement */: - case 244 /* WhileStatement */: - case 245 /* ForStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: - case 251 /* WithStatement */: - case 252 /* SwitchStatement */: - case 292 /* CaseClause */: - case 293 /* DefaultClause */: - case 253 /* LabeledStatement */: - case 255 /* TryStatement */: - case 295 /* CatchClause */: + case 268 /* CaseBlock */: + case 240 /* Block */: + case 244 /* IfStatement */: + case 245 /* DoStatement */: + case 246 /* WhileStatement */: + case 247 /* ForStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 253 /* WithStatement */: + case 254 /* SwitchStatement */: + case 295 /* CaseClause */: + case 296 /* DefaultClause */: + case 255 /* LabeledStatement */: + case 257 /* TryStatement */: + case 298 /* CatchClause */: return forEachChild(node, traverse); } } @@ -14217,21 +14321,21 @@ ${lanes.join("\n")} return traverse(body); function traverse(node) { switch (node.kind) { - case 226 /* YieldExpression */: + case 228 /* YieldExpression */: visitor(node); const operand = node.expression; if (operand) { traverse(operand); } return; - case 263 /* EnumDeclaration */: - case 261 /* InterfaceDeclaration */: - case 264 /* ModuleDeclaration */: - case 262 /* TypeAliasDeclaration */: + case 265 /* EnumDeclaration */: + case 263 /* InterfaceDeclaration */: + case 266 /* ModuleDeclaration */: + case 264 /* TypeAliasDeclaration */: return; default: if (isFunctionLike(node)) { - if (node.name && node.name.kind === 164 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 166 /* ComputedPropertyName */) { traverse(node.name.expression); return; } @@ -14242,9 +14346,9 @@ ${lanes.join("\n")} } } function getRestParameterElementType(node) { - if (node && node.kind === 185 /* ArrayType */) { + if (node && node.kind === 187 /* ArrayType */) { return node.elementType; - } else if (node && node.kind === 180 /* TypeReference */) { + } else if (node && node.kind === 182 /* TypeReference */) { return singleOrUndefined(node.typeArguments); } else { return void 0; @@ -14252,26 +14356,26 @@ ${lanes.join("\n")} } function getMembersOfDeclaration(node) { switch (node.kind) { - case 261 /* InterfaceDeclaration */: - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 184 /* TypeLiteral */: + case 263 /* InterfaceDeclaration */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 186 /* TypeLiteral */: return node.members; - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return node.properties; } } function isVariableLike(node) { if (node) { switch (node.kind) { - case 205 /* BindingElement */: - case 302 /* EnumMember */: - case 166 /* Parameter */: - case 299 /* PropertyAssignment */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 300 /* ShorthandPropertyAssignment */: - case 257 /* VariableDeclaration */: + case 207 /* BindingElement */: + case 305 /* EnumMember */: + case 168 /* Parameter */: + case 302 /* PropertyAssignment */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 303 /* ShorthandPropertyAssignment */: + case 259 /* VariableDeclaration */: return true; } } @@ -14281,7 +14385,7 @@ ${lanes.join("\n")} return isVariableLike(node) || isAccessor(node); } function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 258 /* VariableDeclarationList */ && node.parent.parent.kind === 240 /* VariableStatement */; + return node.parent.kind === 260 /* VariableDeclarationList */ && node.parent.parent.kind === 242 /* VariableStatement */; } function isCommonJsExportedExpression(node) { if (!isInJSFile(node)) @@ -14298,13 +14402,13 @@ ${lanes.join("\n")} } function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: return true; } return false; @@ -14314,20 +14418,20 @@ ${lanes.join("\n")} if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 253 /* LabeledStatement */) { + if (node.statement.kind !== 255 /* LabeledStatement */) { return node.statement; } node = node.statement; } } function isFunctionBlock(node) { - return node && node.kind === 238 /* Block */ && isFunctionLike(node.parent); + return node && node.kind === 240 /* Block */ && isFunctionLike(node.parent); } function isObjectLiteralMethod(node) { - return node && node.kind === 171 /* MethodDeclaration */ && node.parent.kind === 207 /* ObjectLiteralExpression */; + return node && node.kind === 173 /* MethodDeclaration */ && node.parent.kind === 209 /* ObjectLiteralExpression */; } function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { - return (node.kind === 171 /* MethodDeclaration */ || node.kind === 174 /* GetAccessor */ || node.kind === 175 /* SetAccessor */) && (node.parent.kind === 207 /* ObjectLiteralExpression */ || node.parent.kind === 228 /* ClassExpression */); + return (node.kind === 173 /* MethodDeclaration */ || node.kind === 176 /* GetAccessor */ || node.kind === 177 /* SetAccessor */) && (node.parent.kind === 209 /* ObjectLiteralExpression */ || node.parent.kind === 230 /* ClassExpression */); } function isIdentifierTypePredicate(predicate) { return predicate && predicate.kind === 1 /* Identifier */; @@ -14335,17 +14439,20 @@ ${lanes.join("\n")} function isThisTypePredicate(predicate) { return predicate && predicate.kind === 0 /* This */; } - function getPropertyAssignment(objectLiteral, key, key2) { - return objectLiteral.properties.filter((property) => { - if (property.kind === 299 /* PropertyAssignment */) { - const propName = tryGetTextOfPropertyName(property.name); - return key === propName || !!key2 && key2 === propName; - } - return false; + function forEachPropertyAssignment(objectLiteral, key, callback, key2) { + return forEach(objectLiteral == null ? void 0 : objectLiteral.properties, (property) => { + if (!isPropertyAssignment(property)) + return void 0; + const propName = tryGetTextOfPropertyName(property.name); + return key === propName || key2 && key2 === propName ? callback(property) : void 0; }); } function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) { - return firstDefined(getPropertyAssignment(objectLiteral, propKey), (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0); + return forEachPropertyAssignment( + objectLiteral, + propKey, + (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0 + ); } function getTsConfigObjectLiteralExpression(tsConfigSourceFile) { if (tsConfigSourceFile && tsConfigSourceFile.statements.length) { @@ -14354,11 +14461,10 @@ ${lanes.join("\n")} } } function getTsConfigPropArrayElementValue(tsConfigSourceFile, propKey, elementValue) { - return firstDefined(getTsConfigPropArray(tsConfigSourceFile, propKey), (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0); + return forEachTsConfigPropArray(tsConfigSourceFile, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0); } - function getTsConfigPropArray(tsConfigSourceFile, propKey) { - const jsonObjectLiteral = getTsConfigObjectLiteralExpression(tsConfigSourceFile); - return jsonObjectLiteral ? getPropertyAssignment(jsonObjectLiteral, propKey) : emptyArray; + function forEachTsConfigPropArray(tsConfigSourceFile, propKey, callback) { + return forEachPropertyAssignment(getTsConfigObjectLiteralExpression(tsConfigSourceFile), propKey, callback); } function getContainingFunction(node) { return findAncestor(node.parent, isFunctionLike); @@ -14381,63 +14487,63 @@ ${lanes.join("\n")} return findAncestor(node.parent, isFunctionLikeOrClassStaticBlockDeclaration); } function getThisContainer(node, includeArrowFunctions, includeClassComputedPropertyName) { - Debug.assert(node.kind !== 308 /* SourceFile */); + Debug.assert(node.kind !== 311 /* SourceFile */); while (true) { node = node.parent; if (!node) { return Debug.fail(); } switch (node.kind) { - case 164 /* ComputedPropertyName */: + case 166 /* ComputedPropertyName */: if (includeClassComputedPropertyName && isClassLike(node.parent.parent)) { return node; } node = node.parent.parent; break; - case 167 /* Decorator */: - if (node.parent.kind === 166 /* Parameter */ && isClassElement(node.parent.parent)) { + case 169 /* Decorator */: + if (node.parent.kind === 168 /* Parameter */ && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; } break; - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: if (!includeArrowFunctions) { continue; } - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 264 /* ModuleDeclaration */: - case 172 /* ClassStaticBlockDeclaration */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 176 /* CallSignature */: - case 177 /* ConstructSignature */: - case 178 /* IndexSignature */: - case 263 /* EnumDeclaration */: - case 308 /* SourceFile */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 266 /* ModuleDeclaration */: + case 174 /* ClassStaticBlockDeclaration */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 178 /* CallSignature */: + case 179 /* ConstructSignature */: + case 180 /* IndexSignature */: + case 265 /* EnumDeclaration */: + case 311 /* SourceFile */: return node; } } } function isThisContainerOrFunctionBlock(node) { switch (node.kind) { - case 216 /* ArrowFunction */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 169 /* PropertyDeclaration */: + case 218 /* ArrowFunction */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 171 /* PropertyDeclaration */: return true; - case 238 /* Block */: + case 240 /* Block */: switch (node.parent.kind) { - case 173 /* Constructor */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 175 /* Constructor */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return true; default: return false; @@ -14469,9 +14575,9 @@ ${lanes.join("\n")} ); if (container) { switch (container.kind) { - case 173 /* Constructor */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: + case 175 /* Constructor */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: return container; } } @@ -14484,26 +14590,26 @@ ${lanes.join("\n")} return void 0; } switch (node.kind) { - case 164 /* ComputedPropertyName */: + case 166 /* ComputedPropertyName */: node = node.parent; break; - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: if (!stopOnFunctions) { continue; } - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 172 /* ClassStaticBlockDeclaration */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 174 /* ClassStaticBlockDeclaration */: return node; - case 167 /* Decorator */: - if (node.parent.kind === 166 /* Parameter */ && isClassElement(node.parent.parent)) { + case 169 /* Decorator */: + if (node.parent.kind === 168 /* Parameter */ && isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (isClassElement(node.parent)) { node = node.parent; @@ -14513,54 +14619,54 @@ ${lanes.join("\n")} } } function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 215 /* FunctionExpression */ || func.kind === 216 /* ArrowFunction */) { + if (func.kind === 217 /* FunctionExpression */ || func.kind === 218 /* ArrowFunction */) { let prev = func; let parent2 = func.parent; - while (parent2.kind === 214 /* ParenthesizedExpression */) { + while (parent2.kind === 216 /* ParenthesizedExpression */) { prev = parent2; parent2 = parent2.parent; } - if (parent2.kind === 210 /* CallExpression */ && parent2.expression === prev) { + if (parent2.kind === 212 /* CallExpression */ && parent2.expression === prev) { return parent2; } } } function isSuperOrSuperProperty(node) { - return node.kind === 106 /* SuperKeyword */ || isSuperProperty(node); + return node.kind === 108 /* SuperKeyword */ || isSuperProperty(node); } function isSuperProperty(node) { const kind = node.kind; - return (kind === 208 /* PropertyAccessExpression */ || kind === 209 /* ElementAccessExpression */) && node.expression.kind === 106 /* SuperKeyword */; + return (kind === 210 /* PropertyAccessExpression */ || kind === 211 /* ElementAccessExpression */) && node.expression.kind === 108 /* SuperKeyword */; } function isThisProperty(node) { const kind = node.kind; - return (kind === 208 /* PropertyAccessExpression */ || kind === 209 /* ElementAccessExpression */) && node.expression.kind === 108 /* ThisKeyword */; + return (kind === 210 /* PropertyAccessExpression */ || kind === 211 /* ElementAccessExpression */) && node.expression.kind === 110 /* ThisKeyword */; } function isThisInitializedDeclaration(node) { - var _a2; - return !!node && isVariableDeclaration(node) && ((_a2 = node.initializer) == null ? void 0 : _a2.kind) === 108 /* ThisKeyword */; + var _a; + return !!node && isVariableDeclaration(node) && ((_a = node.initializer) == null ? void 0 : _a.kind) === 110 /* ThisKeyword */; } function isThisInitializedObjectBindingExpression(node) { - return !!node && (isShorthandPropertyAssignment(node) || isPropertyAssignment(node)) && isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 63 /* EqualsToken */ && node.parent.parent.right.kind === 108 /* ThisKeyword */; + return !!node && (isShorthandPropertyAssignment(node) || isPropertyAssignment(node)) && isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 64 /* EqualsToken */ && node.parent.parent.right.kind === 110 /* ThisKeyword */; } function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 180 /* TypeReference */: + case 182 /* TypeReference */: return node.typeName; - case 230 /* ExpressionWithTypeArguments */: + case 232 /* ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : void 0; - case 79 /* Identifier */: - case 163 /* QualifiedName */: + case 80 /* Identifier */: + case 165 /* QualifiedName */: return node; } return void 0; } function getInvokedExpression(node) { switch (node.kind) { - case 212 /* TaggedTemplateExpression */: + case 214 /* TaggedTemplateExpression */: return node.tag; - case 283 /* JsxOpeningElement */: - case 282 /* JsxSelfClosingElement */: + case 285 /* JsxOpeningElement */: + case 284 /* JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -14571,20 +14677,20 @@ ${lanes.join("\n")} return false; } switch (node.kind) { - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: return true; - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: return !useLegacyDecorators; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return parent2 !== void 0 && (useLegacyDecorators ? isClassDeclaration(parent2) : isClassLike(parent2) && !hasAbstractModifier(node) && !hasAmbientModifier(node)); - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 171 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 173 /* MethodDeclaration */: return node.body !== void 0 && parent2 !== void 0 && (useLegacyDecorators ? isClassDeclaration(parent2) : isClassLike(parent2)); - case 166 /* Parameter */: + case 168 /* Parameter */: if (!useLegacyDecorators) return false; - return parent2 !== void 0 && parent2.body !== void 0 && (parent2.kind === 173 /* Constructor */ || parent2.kind === 171 /* MethodDeclaration */ || parent2.kind === 175 /* SetAccessor */) && getThisParameter(parent2) !== node && grandparent !== void 0 && grandparent.kind === 260 /* ClassDeclaration */; + return parent2 !== void 0 && parent2.body !== void 0 && (parent2.kind === 175 /* Constructor */ || parent2.kind === 173 /* MethodDeclaration */ || parent2.kind === 177 /* SetAccessor */) && getThisParameter(parent2) !== node && grandparent !== void 0 && grandparent.kind === 262 /* ClassDeclaration */; } return false; } @@ -14596,13 +14702,13 @@ ${lanes.join("\n")} } function childIsDecorated(useLegacyDecorators, node, parent2) { switch (node.kind) { - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: return some(node.members, (m) => nodeOrChildIsDecorated(useLegacyDecorators, m, node, parent2)); - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: return !useLegacyDecorators && some(node.members, (m) => nodeOrChildIsDecorated(useLegacyDecorators, m, node, parent2)); - case 171 /* MethodDeclaration */: - case 175 /* SetAccessor */: - case 173 /* Constructor */: + case 173 /* MethodDeclaration */: + case 177 /* SetAccessor */: + case 175 /* Constructor */: return some(node.parameters, (p) => nodeIsDecorated(useLegacyDecorators, p, node, parent2)); default: return false; @@ -14642,9 +14748,9 @@ ${lanes.join("\n")} function isEmptyStringLiteral(node) { if (node.textSourceNode) { switch (node.textSourceNode.kind) { - case 10 /* StringLiteral */: + case 11 /* StringLiteral */: return isEmptyStringLiteral(node.textSourceNode); - case 14 /* NoSubstitutionTemplateLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: return node.text === ""; } return false; @@ -14653,73 +14759,73 @@ ${lanes.join("\n")} } function isJSXTagName(node) { const { parent: parent2 } = node; - if (parent2.kind === 283 /* JsxOpeningElement */ || parent2.kind === 282 /* JsxSelfClosingElement */ || parent2.kind === 284 /* JsxClosingElement */) { + if (parent2.kind === 285 /* JsxOpeningElement */ || parent2.kind === 284 /* JsxSelfClosingElement */ || parent2.kind === 286 /* JsxClosingElement */) { return parent2.tagName === node; } return false; } function isExpressionNode(node) { switch (node.kind) { - case 106 /* SuperKeyword */: - case 104 /* NullKeyword */: - case 110 /* TrueKeyword */: - case 95 /* FalseKeyword */: - case 13 /* RegularExpressionLiteral */: - case 206 /* ArrayLiteralExpression */: - case 207 /* ObjectLiteralExpression */: - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: - case 210 /* CallExpression */: - case 211 /* NewExpression */: - case 212 /* TaggedTemplateExpression */: - case 231 /* AsExpression */: - case 213 /* TypeAssertionExpression */: - case 235 /* SatisfiesExpression */: - case 232 /* NonNullExpression */: - case 214 /* ParenthesizedExpression */: - case 215 /* FunctionExpression */: - case 228 /* ClassExpression */: - case 216 /* ArrowFunction */: - case 219 /* VoidExpression */: - case 217 /* DeleteExpression */: - case 218 /* TypeOfExpression */: - case 221 /* PrefixUnaryExpression */: - case 222 /* PostfixUnaryExpression */: - case 223 /* BinaryExpression */: - case 224 /* ConditionalExpression */: - case 227 /* SpreadElement */: - case 225 /* TemplateExpression */: - case 229 /* OmittedExpression */: - case 281 /* JsxElement */: - case 282 /* JsxSelfClosingElement */: - case 285 /* JsxFragment */: - case 226 /* YieldExpression */: - case 220 /* AwaitExpression */: - case 233 /* MetaProperty */: + case 108 /* SuperKeyword */: + case 106 /* NullKeyword */: + case 112 /* TrueKeyword */: + case 97 /* FalseKeyword */: + case 14 /* RegularExpressionLiteral */: + case 208 /* ArrayLiteralExpression */: + case 209 /* ObjectLiteralExpression */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: + case 212 /* CallExpression */: + case 213 /* NewExpression */: + case 214 /* TaggedTemplateExpression */: + case 233 /* AsExpression */: + case 215 /* TypeAssertionExpression */: + case 237 /* SatisfiesExpression */: + case 234 /* NonNullExpression */: + case 216 /* ParenthesizedExpression */: + case 217 /* FunctionExpression */: + case 230 /* ClassExpression */: + case 218 /* ArrowFunction */: + case 221 /* VoidExpression */: + case 219 /* DeleteExpression */: + case 220 /* TypeOfExpression */: + case 223 /* PrefixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: + case 225 /* BinaryExpression */: + case 226 /* ConditionalExpression */: + case 229 /* SpreadElement */: + case 227 /* TemplateExpression */: + case 231 /* OmittedExpression */: + case 283 /* JsxElement */: + case 284 /* JsxSelfClosingElement */: + case 287 /* JsxFragment */: + case 228 /* YieldExpression */: + case 222 /* AwaitExpression */: + case 235 /* MetaProperty */: return true; - case 230 /* ExpressionWithTypeArguments */: + case 232 /* ExpressionWithTypeArguments */: return !isHeritageClause(node.parent) && !isJSDocAugmentsTag(node.parent); - case 163 /* QualifiedName */: - while (node.parent.kind === 163 /* QualifiedName */) { + case 165 /* QualifiedName */: + while (node.parent.kind === 165 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 183 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node); - case 314 /* JSDocMemberName */: + return node.parent.kind === 185 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node); + case 317 /* JSDocMemberName */: while (isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === 183 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node); - case 80 /* PrivateIdentifier */: - return isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101 /* InKeyword */; - case 79 /* Identifier */: - if (node.parent.kind === 183 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node)) { + return node.parent.kind === 185 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node); + case 81 /* PrivateIdentifier */: + return isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 103 /* InKeyword */; + case 80 /* Identifier */: + if (node.parent.kind === 185 /* TypeQuery */ || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } - case 8 /* NumericLiteral */: - case 9 /* BigIntLiteral */: - case 10 /* StringLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 108 /* ThisKeyword */: + case 9 /* NumericLiteral */: + case 10 /* BigIntLiteral */: + case 11 /* StringLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 110 /* ThisKeyword */: return isInExpressionContext(node); default: return false; @@ -14728,64 +14834,64 @@ ${lanes.join("\n")} function isInExpressionContext(node) { const { parent: parent2 } = node; switch (parent2.kind) { - case 257 /* VariableDeclaration */: - case 166 /* Parameter */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 302 /* EnumMember */: - case 299 /* PropertyAssignment */: - case 205 /* BindingElement */: + case 259 /* VariableDeclaration */: + case 168 /* Parameter */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 305 /* EnumMember */: + case 302 /* PropertyAssignment */: + case 207 /* BindingElement */: return parent2.initializer === node; - case 241 /* ExpressionStatement */: - case 242 /* IfStatement */: - case 243 /* DoStatement */: - case 244 /* WhileStatement */: - case 250 /* ReturnStatement */: - case 251 /* WithStatement */: - case 252 /* SwitchStatement */: - case 292 /* CaseClause */: - case 254 /* ThrowStatement */: + case 243 /* ExpressionStatement */: + case 244 /* IfStatement */: + case 245 /* DoStatement */: + case 246 /* WhileStatement */: + case 252 /* ReturnStatement */: + case 253 /* WithStatement */: + case 254 /* SwitchStatement */: + case 295 /* CaseClause */: + case 256 /* ThrowStatement */: return parent2.expression === node; - case 245 /* ForStatement */: + case 247 /* ForStatement */: const forStatement = parent2; - return forStatement.initializer === node && forStatement.initializer.kind !== 258 /* VariableDeclarationList */ || forStatement.condition === node || forStatement.incrementor === node; - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: + return forStatement.initializer === node && forStatement.initializer.kind !== 260 /* VariableDeclarationList */ || forStatement.condition === node || forStatement.incrementor === node; + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: const forInStatement = parent2; - return forInStatement.initializer === node && forInStatement.initializer.kind !== 258 /* VariableDeclarationList */ || forInStatement.expression === node; - case 213 /* TypeAssertionExpression */: - case 231 /* AsExpression */: + return forInStatement.initializer === node && forInStatement.initializer.kind !== 260 /* VariableDeclarationList */ || forInStatement.expression === node; + case 215 /* TypeAssertionExpression */: + case 233 /* AsExpression */: return node === parent2.expression; - case 236 /* TemplateSpan */: + case 238 /* TemplateSpan */: return node === parent2.expression; - case 164 /* ComputedPropertyName */: + case 166 /* ComputedPropertyName */: return node === parent2.expression; - case 167 /* Decorator */: - case 291 /* JsxExpression */: - case 290 /* JsxSpreadAttribute */: - case 301 /* SpreadAssignment */: + case 169 /* Decorator */: + case 293 /* JsxExpression */: + case 292 /* JsxSpreadAttribute */: + case 304 /* SpreadAssignment */: return true; - case 230 /* ExpressionWithTypeArguments */: + case 232 /* ExpressionWithTypeArguments */: return parent2.expression === node && !isPartOfTypeNode(parent2); - case 300 /* ShorthandPropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: return parent2.objectAssignmentInitializer === node; - case 235 /* SatisfiesExpression */: + case 237 /* SatisfiesExpression */: return node === parent2.expression; default: return isExpressionNode(parent2); } } function isPartOfTypeQuery(node) { - while (node.kind === 163 /* QualifiedName */ || node.kind === 79 /* Identifier */) { + while (node.kind === 165 /* QualifiedName */ || node.kind === 80 /* Identifier */) { node = node.parent; } - return node.kind === 183 /* TypeQuery */; + return node.kind === 185 /* TypeQuery */; } function isNamespaceReexportDeclaration(node) { return isNamespaceExport(node) && !!node.parent.moduleSpecifier; } function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 268 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 280 /* ExternalModuleReference */; + return node.kind === 270 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 282 /* ExternalModuleReference */; } function getExternalModuleImportEqualsDeclarationExpression(node) { Debug.assert(isExternalModuleImportEqualsDeclaration(node)); @@ -14795,7 +14901,7 @@ ${lanes.join("\n")} return isVariableDeclarationInitializedToBareOrAccessedRequire(node) && getLeftmostAccessExpression(node.initializer).arguments[0]; } function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 268 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 280 /* ExternalModuleReference */; + return node.kind === 270 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 282 /* ExternalModuleReference */; } function isSourceFileJS(file) { return isInJSFile(file); @@ -14816,14 +14922,14 @@ ${lanes.join("\n")} return !!node && !!(node.flags & 8388608 /* JSDoc */); } function isJSDocIndexSignature(node) { - return isTypeReferenceNode(node) && isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && (node.typeArguments[0].kind === 152 /* StringKeyword */ || node.typeArguments[0].kind === 148 /* NumberKeyword */); + return isTypeReferenceNode(node) && isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && (node.typeArguments[0].kind === 154 /* StringKeyword */ || node.typeArguments[0].kind === 150 /* NumberKeyword */); } function isRequireCall(callExpression, requireStringLiteralLikeArgument) { - if (callExpression.kind !== 210 /* CallExpression */) { + if (callExpression.kind !== 212 /* CallExpression */) { return false; } const { expression, arguments: args } = callExpression; - if (expression.kind !== 79 /* Identifier */ || expression.escapedText !== "require") { + if (expression.kind !== 80 /* Identifier */ || expression.escapedText !== "require") { return false; } if (args.length !== 1) { @@ -14869,7 +14975,7 @@ ${lanes.join("\n")} return isBinaryExpression(decl) || isAccessExpression(decl) || isIdentifier(decl) || isCallExpression(decl); } function getEffectiveInitializer(node) { - if (isInJSFile(node) && node.initializer && isBinaryExpression(node.initializer) && (node.initializer.operatorToken.kind === 56 /* BarBarToken */ || node.initializer.operatorToken.kind === 60 /* QuestionQuestionToken */) && node.name && isEntityNameExpression(node.name) && isSameEntityName(node.name, node.initializer.left)) { + if (isInJSFile(node) && node.initializer && isBinaryExpression(node.initializer) && (node.initializer.operatorToken.kind === 57 /* BarBarToken */ || node.initializer.operatorToken.kind === 61 /* QuestionQuestionToken */) && node.name && isEntityNameExpression(node.name) && isSameEntityName(node.name, node.initializer.left)) { return node.initializer.right; } return node.initializer; @@ -14882,7 +14988,7 @@ ${lanes.join("\n")} return forEach(node.properties, (p) => isPropertyAssignment(p) && isIdentifier(p.name) && p.name.escapedText === "value" && p.initializer && getExpandoInitializer(p.initializer, isPrototypeAssignment)); } function getAssignedExpandoInitializer(node) { - if (node && node.parent && isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 63 /* EqualsToken */) { + if (node && node.parent && isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 64 /* EqualsToken */) { const isPrototypeAssignment = isPrototypeAccess(node.parent.left); return getExpandoInitializer(node.parent.right, isPrototypeAssignment) || getDefaultedExpandoInitializer(node.parent.left, node.parent.right, isPrototypeAssignment); } @@ -14896,9 +15002,9 @@ ${lanes.join("\n")} function getExpandoInitializer(initializer, isPrototypeAssignment) { if (isCallExpression(initializer)) { const e = skipParentheses(initializer.expression); - return e.kind === 215 /* FunctionExpression */ || e.kind === 216 /* ArrowFunction */ ? initializer : void 0; + return e.kind === 217 /* FunctionExpression */ || e.kind === 218 /* ArrowFunction */ ? initializer : void 0; } - if (initializer.kind === 215 /* FunctionExpression */ || initializer.kind === 228 /* ClassExpression */ || initializer.kind === 216 /* ArrowFunction */) { + if (initializer.kind === 217 /* FunctionExpression */ || initializer.kind === 230 /* ClassExpression */ || initializer.kind === 218 /* ArrowFunction */) { return initializer; } if (isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -14906,19 +15012,19 @@ ${lanes.join("\n")} } } function getDefaultedExpandoInitializer(name, initializer, isPrototypeAssignment) { - const e = isBinaryExpression(initializer) && (initializer.operatorToken.kind === 56 /* BarBarToken */ || initializer.operatorToken.kind === 60 /* QuestionQuestionToken */) && getExpandoInitializer(initializer.right, isPrototypeAssignment); + const e = isBinaryExpression(initializer) && (initializer.operatorToken.kind === 57 /* BarBarToken */ || initializer.operatorToken.kind === 61 /* QuestionQuestionToken */) && getExpandoInitializer(initializer.right, isPrototypeAssignment); if (e && isSameEntityName(name, initializer.left)) { return e; } } function isDefaultedExpandoInitializer(node) { - const name = isVariableDeclaration(node.parent) ? node.parent.name : isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 63 /* EqualsToken */ ? node.parent.left : void 0; + const name = isVariableDeclaration(node.parent) ? node.parent.name : isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 64 /* EqualsToken */ ? node.parent.left : void 0; return name && getExpandoInitializer(node.right, isPrototypeAccess(name)) && isEntityNameExpression(name) && isSameEntityName(name, node.left); } function getNameOfExpando(node) { if (isBinaryExpression(node.parent)) { - const parent2 = (node.parent.operatorToken.kind === 56 /* BarBarToken */ || node.parent.operatorToken.kind === 60 /* QuestionQuestionToken */) && isBinaryExpression(node.parent.parent) ? node.parent.parent : node.parent; - if (parent2.operatorToken.kind === 63 /* EqualsToken */ && isIdentifier(parent2.left)) { + const parent2 = (node.parent.operatorToken.kind === 57 /* BarBarToken */ || node.parent.operatorToken.kind === 61 /* QuestionQuestionToken */) && isBinaryExpression(node.parent.parent) ? node.parent.parent : node.parent; + if (parent2.operatorToken.kind === 64 /* EqualsToken */ && isIdentifier(parent2.left)) { return parent2.left; } } else if (isVariableDeclaration(node.parent)) { @@ -14929,7 +15035,7 @@ ${lanes.join("\n")} if (isPropertyNameLiteral(name) && isPropertyNameLiteral(initializer)) { return getTextOfIdentifierOrLiteral(name) === getTextOfIdentifierOrLiteral(initializer); } - if (isMemberName(name) && isLiteralLikeAccess(initializer) && (initializer.expression.kind === 108 /* ThisKeyword */ || isIdentifier(initializer.expression) && (initializer.expression.escapedText === "window" || initializer.expression.escapedText === "self" || initializer.expression.escapedText === "global"))) { + if (isMemberName(name) && isLiteralLikeAccess(initializer) && (initializer.expression.kind === 110 /* ThisKeyword */ || isIdentifier(initializer.expression) && (initializer.expression.escapedText === "window" || initializer.expression.escapedText === "self" || initializer.expression.escapedText === "global"))) { return isSameEntityName(name, getNameOrArgument(initializer)); } if (isLiteralLikeAccess(name) && isLiteralLikeAccess(initializer)) { @@ -14940,7 +15046,7 @@ ${lanes.join("\n")} function getRightMostAssignedExpression(node) { while (isAssignmentExpression( node, - /*excludeCompoundAssignments*/ + /*excludeCompoundAssignment*/ true )) { node = node.right; @@ -14974,14 +15080,14 @@ ${lanes.join("\n")} return isElementAccessExpression(node) && isStringOrNumericLiteralLike(node.argumentExpression); } function isBindableStaticAccessExpression(node, excludeThisKeyword) { - return isPropertyAccessExpression(node) && (!excludeThisKeyword && node.expression.kind === 108 /* ThisKeyword */ || isIdentifier(node.name) && isBindableStaticNameExpression( + return isPropertyAccessExpression(node) && (!excludeThisKeyword && node.expression.kind === 110 /* ThisKeyword */ || isIdentifier(node.name) && isBindableStaticNameExpression( node.expression, /*excludeThisKeyword*/ true )) || isBindableStaticElementAccessExpression(node, excludeThisKeyword); } function isBindableStaticElementAccessExpression(node, excludeThisKeyword) { - return isLiteralLikeElementAccess(node) && (!excludeThisKeyword && node.expression.kind === 108 /* ThisKeyword */ || isEntityNameExpression(node.expression) || isBindableStaticAccessExpression( + return isLiteralLikeElementAccess(node) && (!excludeThisKeyword && node.expression.kind === 110 /* ThisKeyword */ || isEntityNameExpression(node.expression) || isBindableStaticAccessExpression( node.expression, /*excludeThisKeyword*/ true @@ -15010,7 +15116,7 @@ ${lanes.join("\n")} } return 7 /* ObjectDefinePropertyValue */; } - if (expr.operatorToken.kind !== 63 /* EqualsToken */ || !isAccessExpression(expr.left) || isVoidZero(getRightMostAssignedExpression(expr))) { + if (expr.operatorToken.kind !== 64 /* EqualsToken */ || !isAccessExpression(expr.left) || isVoidZero(getRightMostAssignedExpression(expr))) { return 0 /* None */; } if (isBindableStaticNameExpression( @@ -15048,7 +15154,7 @@ ${lanes.join("\n")} return void 0; } function getAssignmentDeclarationPropertyAccessKind(lhs) { - if (lhs.expression.kind === 108 /* ThisKeyword */) { + if (lhs.expression.kind === 110 /* ThisKeyword */) { return 4 /* ThisProperty */; } else if (isModuleExportsAccessExpression(lhs)) { return 2 /* ModuleExports */; @@ -15089,7 +15195,7 @@ ${lanes.join("\n")} return isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 3 /* PrototypeProperty */; } function isSpecialPropertyDeclaration(expr) { - return isInJSFile(expr) && expr.parent && expr.parent.kind === 241 /* ExpressionStatement */ && (!isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!getJSDocTypeTag(expr.parent); + return isInJSFile(expr) && expr.parent && expr.parent.kind === 243 /* ExpressionStatement */ && (!isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!getJSDocTypeTag(expr.parent); } function setValueDeclaration(symbol, node) { const { valueDeclaration } = symbol; @@ -15102,29 +15208,29 @@ ${lanes.join("\n")} return false; } const decl = symbol.valueDeclaration; - return decl.kind === 259 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer); + return decl.kind === 261 /* FunctionDeclaration */ || isVariableDeclaration(decl) && decl.initializer && isFunctionLike(decl.initializer); } function tryGetModuleSpecifierFromDeclaration(node) { - var _a2, _b; + var _a, _b; switch (node.kind) { - case 257 /* VariableDeclaration */: - case 205 /* BindingElement */: - return (_a2 = findAncestor(node.initializer, (node2) => isRequireCall( + case 259 /* VariableDeclaration */: + case 207 /* BindingElement */: + return (_a = findAncestor(node.initializer, (node2) => isRequireCall( node2, /*requireStringLiteralLikeArgument*/ true - ))) == null ? void 0 : _a2.arguments[0]; - case 269 /* ImportDeclaration */: + ))) == null ? void 0 : _a.arguments[0]; + case 271 /* ImportDeclaration */: return tryCast(node.moduleSpecifier, isStringLiteralLike); - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: return tryCast((_b = tryCast(node.moduleReference, isExternalModuleReference)) == null ? void 0 : _b.expression, isStringLiteralLike); - case 270 /* ImportClause */: - case 277 /* NamespaceExport */: + case 272 /* ImportClause */: + case 279 /* NamespaceExport */: return tryCast(node.parent.moduleSpecifier, isStringLiteralLike); - case 271 /* NamespaceImport */: - case 278 /* ExportSpecifier */: + case 273 /* NamespaceImport */: + case 280 /* ExportSpecifier */: return tryCast(node.parent.parent.moduleSpecifier, isStringLiteralLike); - case 273 /* ImportSpecifier */: + case 275 /* ImportSpecifier */: return tryCast(node.parent.parent.parent.moduleSpecifier, isStringLiteralLike); default: Debug.assertNever(node); @@ -15135,18 +15241,18 @@ ${lanes.join("\n")} } function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 269 /* ImportDeclaration */: - case 275 /* ExportDeclaration */: + case 271 /* ImportDeclaration */: + case 277 /* ExportDeclaration */: return node.parent; - case 280 /* ExternalModuleReference */: + case 282 /* ExternalModuleReference */: return node.parent.parent; - case 210 /* CallExpression */: + case 212 /* CallExpression */: return isImportCall(node.parent) || isRequireCall( node.parent, - /*checkArg*/ + /*requireStringLiteralLikeArgument*/ false ) ? node.parent : void 0; - case 198 /* LiteralType */: + case 200 /* LiteralType */: Debug.assert(isStringLiteral(node)); return tryCast(node.parent.parent, isImportTypeNode); default: @@ -15155,35 +15261,35 @@ ${lanes.join("\n")} } function getExternalModuleName(node) { switch (node.kind) { - case 269 /* ImportDeclaration */: - case 275 /* ExportDeclaration */: + case 271 /* ImportDeclaration */: + case 277 /* ExportDeclaration */: return node.moduleSpecifier; - case 268 /* ImportEqualsDeclaration */: - return node.moduleReference.kind === 280 /* ExternalModuleReference */ ? node.moduleReference.expression : void 0; - case 202 /* ImportType */: + case 270 /* ImportEqualsDeclaration */: + return node.moduleReference.kind === 282 /* ExternalModuleReference */ ? node.moduleReference.expression : void 0; + case 204 /* ImportType */: return isLiteralImportTypeNode(node) ? node.argument.literal : void 0; - case 210 /* CallExpression */: + case 212 /* CallExpression */: return node.arguments[0]; - case 264 /* ModuleDeclaration */: - return node.name.kind === 10 /* StringLiteral */ ? node.name : void 0; + case 266 /* ModuleDeclaration */: + return node.name.kind === 11 /* StringLiteral */ ? node.name : void 0; default: return Debug.assertNever(node); } } function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 269 /* ImportDeclaration */: + case 271 /* ImportDeclaration */: return node.importClause && tryCast(node.importClause.namedBindings, isNamespaceImport); - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: return node; - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: return node.exportClause && tryCast(node.exportClause, isNamespaceExport); default: return Debug.assertNever(node); } } function isDefaultImport(node) { - return node.kind === 269 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name; + return node.kind === 271 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name; } function forEachImportClauseDeclaration(node, action) { if (node.name) { @@ -15200,13 +15306,13 @@ ${lanes.join("\n")} function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 166 /* Parameter */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 300 /* ShorthandPropertyAssignment */: - case 299 /* PropertyAssignment */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: + case 168 /* Parameter */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 303 /* ShorthandPropertyAssignment */: + case 302 /* PropertyAssignment */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: return node.questionToken !== void 0; } } @@ -15218,25 +15324,25 @@ ${lanes.join("\n")} return !!name && name.escapedText === "new"; } function isJSDocTypeAlias(node) { - return node.kind === 349 /* JSDocTypedefTag */ || node.kind === 341 /* JSDocCallbackTag */ || node.kind === 343 /* JSDocEnumTag */; + return node.kind === 352 /* JSDocTypedefTag */ || node.kind === 344 /* JSDocCallbackTag */ || node.kind === 346 /* JSDocEnumTag */; } function isTypeAlias(node) { return isJSDocTypeAlias(node) || isTypeAliasDeclaration(node); } function getSourceOfAssignment(node) { - return isExpressionStatement(node) && isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 63 /* EqualsToken */ ? getRightMostAssignedExpression(node.expression) : void 0; + return isExpressionStatement(node) && isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 64 /* EqualsToken */ ? getRightMostAssignedExpression(node.expression) : void 0; } function getSourceOfDefaultedAssignment(node) { - return isExpressionStatement(node) && isBinaryExpression(node.expression) && getAssignmentDeclarationKind(node.expression) !== 0 /* None */ && isBinaryExpression(node.expression.right) && (node.expression.right.operatorToken.kind === 56 /* BarBarToken */ || node.expression.right.operatorToken.kind === 60 /* QuestionQuestionToken */) ? node.expression.right.right : void 0; + return isExpressionStatement(node) && isBinaryExpression(node.expression) && getAssignmentDeclarationKind(node.expression) !== 0 /* None */ && isBinaryExpression(node.expression.right) && (node.expression.right.operatorToken.kind === 57 /* BarBarToken */ || node.expression.right.operatorToken.kind === 61 /* QuestionQuestionToken */) ? node.expression.right.right : void 0; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: const v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return node.initializer; - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: return node.initializer; } } @@ -15244,26 +15350,26 @@ ${lanes.join("\n")} return isVariableStatement(node) ? firstOrUndefined(node.declarationList.declarations) : void 0; } function getNestedModuleDeclaration(node) { - return isModuleDeclaration(node) && node.body && node.body.kind === 264 /* ModuleDeclaration */ ? node.body : void 0; + return isModuleDeclaration(node) && node.body && node.body.kind === 266 /* ModuleDeclaration */ ? node.body : void 0; } function canHaveFlowNode(node) { - if (node.kind >= 240 /* FirstStatement */ && node.kind <= 256 /* LastStatement */) { + if (node.kind >= 242 /* FirstStatement */ && node.kind <= 258 /* LastStatement */) { return true; } switch (node.kind) { - case 79 /* Identifier */: - case 108 /* ThisKeyword */: - case 106 /* SuperKeyword */: - case 163 /* QualifiedName */: - case 233 /* MetaProperty */: - case 209 /* ElementAccessExpression */: - case 208 /* PropertyAccessExpression */: - case 205 /* BindingElement */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 80 /* Identifier */: + case 110 /* ThisKeyword */: + case 108 /* SuperKeyword */: + case 165 /* QualifiedName */: + case 235 /* MetaProperty */: + case 211 /* ElementAccessExpression */: + case 210 /* PropertyAccessExpression */: + case 207 /* BindingElement */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return true; default: return false; @@ -15271,71 +15377,72 @@ ${lanes.join("\n")} } function canHaveJSDoc(node) { switch (node.kind) { - case 216 /* ArrowFunction */: - case 223 /* BinaryExpression */: - case 238 /* Block */: - case 249 /* BreakStatement */: - case 176 /* CallSignature */: - case 292 /* CaseClause */: - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 172 /* ClassStaticBlockDeclaration */: - case 173 /* Constructor */: - case 182 /* ConstructorType */: - case 177 /* ConstructSignature */: - case 248 /* ContinueStatement */: - case 256 /* DebuggerStatement */: - case 243 /* DoStatement */: - case 209 /* ElementAccessExpression */: - case 239 /* EmptyStatement */: + case 218 /* ArrowFunction */: + case 225 /* BinaryExpression */: + case 240 /* Block */: + case 251 /* BreakStatement */: + case 178 /* CallSignature */: + case 295 /* CaseClause */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 174 /* ClassStaticBlockDeclaration */: + case 175 /* Constructor */: + case 184 /* ConstructorType */: + case 179 /* ConstructSignature */: + case 250 /* ContinueStatement */: + case 258 /* DebuggerStatement */: + case 245 /* DoStatement */: + case 211 /* ElementAccessExpression */: + case 241 /* EmptyStatement */: case 1 /* EndOfFileToken */: - case 263 /* EnumDeclaration */: - case 302 /* EnumMember */: - case 274 /* ExportAssignment */: - case 275 /* ExportDeclaration */: - case 278 /* ExportSpecifier */: - case 241 /* ExpressionStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: - case 245 /* ForStatement */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 181 /* FunctionType */: - case 174 /* GetAccessor */: - case 79 /* Identifier */: - case 242 /* IfStatement */: - case 269 /* ImportDeclaration */: - case 268 /* ImportEqualsDeclaration */: - case 178 /* IndexSignature */: - case 261 /* InterfaceDeclaration */: - case 320 /* JSDocFunctionType */: - case 326 /* JSDocSignature */: - case 253 /* LabeledStatement */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 264 /* ModuleDeclaration */: - case 199 /* NamedTupleMember */: - case 267 /* NamespaceExportDeclaration */: - case 207 /* ObjectLiteralExpression */: - case 166 /* Parameter */: - case 214 /* ParenthesizedExpression */: - case 208 /* PropertyAccessExpression */: - case 299 /* PropertyAssignment */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 250 /* ReturnStatement */: - case 175 /* SetAccessor */: - case 300 /* ShorthandPropertyAssignment */: - case 301 /* SpreadAssignment */: - case 252 /* SwitchStatement */: - case 254 /* ThrowStatement */: - case 255 /* TryStatement */: - case 262 /* TypeAliasDeclaration */: - case 165 /* TypeParameter */: - case 257 /* VariableDeclaration */: - case 240 /* VariableStatement */: - case 244 /* WhileStatement */: - case 251 /* WithStatement */: + case 265 /* EnumDeclaration */: + case 305 /* EnumMember */: + case 276 /* ExportAssignment */: + case 277 /* ExportDeclaration */: + case 280 /* ExportSpecifier */: + case 243 /* ExpressionStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 247 /* ForStatement */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 183 /* FunctionType */: + case 176 /* GetAccessor */: + case 80 /* Identifier */: + case 244 /* IfStatement */: + case 271 /* ImportDeclaration */: + case 270 /* ImportEqualsDeclaration */: + case 180 /* IndexSignature */: + case 263 /* InterfaceDeclaration */: + case 323 /* JSDocFunctionType */: + case 329 /* JSDocSignature */: + case 255 /* LabeledStatement */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 266 /* ModuleDeclaration */: + case 201 /* NamedTupleMember */: + case 269 /* NamespaceExportDeclaration */: + case 209 /* ObjectLiteralExpression */: + case 168 /* Parameter */: + case 216 /* ParenthesizedExpression */: + case 210 /* PropertyAccessExpression */: + case 302 /* PropertyAssignment */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 252 /* ReturnStatement */: + case 239 /* SemicolonClassElement */: + case 177 /* SetAccessor */: + case 303 /* ShorthandPropertyAssignment */: + case 304 /* SpreadAssignment */: + case 254 /* SwitchStatement */: + case 256 /* ThrowStatement */: + case 257 /* TryStatement */: + case 264 /* TypeAliasDeclaration */: + case 167 /* TypeParameter */: + case 259 /* VariableDeclaration */: + case 242 /* VariableStatement */: + case 246 /* WhileStatement */: + case 253 /* WithStatement */: return true; default: return false; @@ -15351,11 +15458,11 @@ ${lanes.join("\n")} if (hasJSDocNodes(node)) { result = addRange(result, filterOwnedJSDocTags(hostNode, last(node.jsDoc))); } - if (node.kind === 166 /* Parameter */) { + if (node.kind === 168 /* Parameter */) { result = addRange(result, (noCache ? getJSDocParameterTagsNoCache : getJSDocParameterTags)(node)); break; } - if (node.kind === 165 /* TypeParameter */) { + if (node.kind === 167 /* TypeParameter */) { result = addRange(result, (noCache ? getJSDocTypeParameterTagsNoCache : getJSDocTypeParameterTags)(node)); break; } @@ -15375,9 +15482,9 @@ ${lanes.join("\n")} } function getNextJSDocCommentLocation(node) { const parent2 = node.parent; - if (parent2.kind === 299 /* PropertyAssignment */ || parent2.kind === 274 /* ExportAssignment */ || parent2.kind === 169 /* PropertyDeclaration */ || parent2.kind === 241 /* ExpressionStatement */ && node.kind === 208 /* PropertyAccessExpression */ || parent2.kind === 250 /* ReturnStatement */ || getNestedModuleDeclaration(parent2) || isBinaryExpression(node) && node.operatorToken.kind === 63 /* EqualsToken */) { + if (parent2.kind === 302 /* PropertyAssignment */ || parent2.kind === 276 /* ExportAssignment */ || parent2.kind === 171 /* PropertyDeclaration */ || parent2.kind === 243 /* ExpressionStatement */ && node.kind === 210 /* PropertyAccessExpression */ || parent2.kind === 252 /* ReturnStatement */ || getNestedModuleDeclaration(parent2) || isBinaryExpression(node) && node.operatorToken.kind === 64 /* EqualsToken */) { return parent2; - } else if (parent2.parent && (getSingleVariableOfVariableStatement(parent2.parent) === node || isBinaryExpression(parent2) && parent2.operatorToken.kind === 63 /* EqualsToken */)) { + } else if (parent2.parent && (getSingleVariableOfVariableStatement(parent2.parent) === node || isBinaryExpression(parent2) && parent2.operatorToken.kind === 64 /* EqualsToken */)) { return parent2.parent; } else if (parent2.parent && parent2.parent.parent && (getSingleVariableOfVariableStatement(parent2.parent.parent) || getSingleInitializerOfVariableStatementOrPropertyDeclaration(parent2.parent.parent) === node || getSourceOfDefaultedAssignment(parent2.parent.parent))) { return parent2.parent.parent; @@ -15395,7 +15502,7 @@ ${lanes.join("\n")} if (!decl) { return void 0; } - const parameter = find(decl.parameters, (p) => p.name.kind === 79 /* Identifier */ && p.name.escapedText === name); + const parameter = find(decl.parameters, (p) => p.name.kind === 80 /* Identifier */ && p.name.escapedText === name); return parameter && parameter.symbol; } function getEffectiveContainerForJSDocTemplateTag(node) { @@ -15445,32 +15552,32 @@ ${lanes.join("\n")} let parent2 = node.parent; while (true) { switch (parent2.kind) { - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: const binaryOperator = parent2.operatorToken.kind; - return isAssignmentOperator(binaryOperator) && parent2.left === node ? binaryOperator === 63 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; - case 221 /* PrefixUnaryExpression */: - case 222 /* PostfixUnaryExpression */: + return isAssignmentOperator(binaryOperator) && parent2.left === node ? binaryOperator === 64 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */; + case 223 /* PrefixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: const unaryOperator = parent2.operator; - return unaryOperator === 45 /* PlusPlusToken */ || unaryOperator === 46 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */; - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: + return unaryOperator === 46 /* PlusPlusToken */ || unaryOperator === 47 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */; + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: return parent2.initializer === node ? 1 /* Definite */ : 0 /* None */; - case 214 /* ParenthesizedExpression */: - case 206 /* ArrayLiteralExpression */: - case 227 /* SpreadElement */: - case 232 /* NonNullExpression */: + case 216 /* ParenthesizedExpression */: + case 208 /* ArrayLiteralExpression */: + case 229 /* SpreadElement */: + case 234 /* NonNullExpression */: node = parent2; break; - case 301 /* SpreadAssignment */: + case 304 /* SpreadAssignment */: node = parent2.parent; break; - case 300 /* ShorthandPropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: if (parent2.name !== node) { return 0 /* None */; } node = parent2.parent; break; - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: if (parent2.name === node) { return 0 /* None */; } @@ -15487,22 +15594,22 @@ ${lanes.join("\n")} } function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 238 /* Block */: - case 240 /* VariableStatement */: - case 251 /* WithStatement */: - case 242 /* IfStatement */: - case 252 /* SwitchStatement */: - case 266 /* CaseBlock */: - case 292 /* CaseClause */: - case 293 /* DefaultClause */: - case 253 /* LabeledStatement */: - case 245 /* ForStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: - case 243 /* DoStatement */: - case 244 /* WhileStatement */: - case 255 /* TryStatement */: - case 295 /* CatchClause */: + case 240 /* Block */: + case 242 /* VariableStatement */: + case 253 /* WithStatement */: + case 244 /* IfStatement */: + case 254 /* SwitchStatement */: + case 268 /* CaseBlock */: + case 295 /* CaseClause */: + case 296 /* DefaultClause */: + case 255 /* LabeledStatement */: + case 247 /* ForStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 245 /* DoStatement */: + case 246 /* WhileStatement */: + case 257 /* TryStatement */: + case 298 /* CatchClause */: return true; } return false; @@ -15517,14 +15624,14 @@ ${lanes.join("\n")} return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 193 /* ParenthesizedType */); + return walkUp(node, 195 /* ParenthesizedType */); } function walkUpParenthesizedExpressions(node) { - return walkUp(node, 214 /* ParenthesizedExpression */); + return walkUp(node, 216 /* ParenthesizedExpression */); } function walkUpParenthesizedTypesAndGetParentAndChild(node) { let child; - while (node && node.kind === 193 /* ParenthesizedType */) { + while (node && node.kind === 195 /* ParenthesizedType */) { child = node; node = node.parent; } @@ -15540,11 +15647,11 @@ ${lanes.join("\n")} return skipOuterExpressions(node, flags); } function isDeleteTarget(node) { - if (node.kind !== 208 /* PropertyAccessExpression */ && node.kind !== 209 /* ElementAccessExpression */) { + if (node.kind !== 210 /* PropertyAccessExpression */ && node.kind !== 211 /* ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 217 /* DeleteExpression */; + return node && node.kind === 219 /* DeleteExpression */; } function isNodeDescendantOf(node, ancestor) { while (node) { @@ -15560,12 +15667,12 @@ ${lanes.join("\n")} function getDeclarationFromName(name) { const parent2 = name.parent; switch (name.kind) { - case 10 /* StringLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 8 /* NumericLiteral */: + case 11 /* StringLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 9 /* NumericLiteral */: if (isComputedPropertyName(parent2)) return parent2.parent; - case 79 /* Identifier */: + case 80 /* Identifier */: if (isDeclaration(parent2)) { return parent2.name === name ? parent2 : void 0; } else if (isQualifiedName(parent2)) { @@ -15575,62 +15682,62 @@ ${lanes.join("\n")} const binExp = parent2.parent; return isBinaryExpression(binExp) && getAssignmentDeclarationKind(binExp) !== 0 /* None */ && (binExp.left.symbol || binExp.symbol) && getNameOfDeclaration(binExp) === name ? binExp : void 0; } - case 80 /* PrivateIdentifier */: + case 81 /* PrivateIdentifier */: return isDeclaration(parent2) && parent2.name === name ? parent2 : void 0; default: return void 0; } } function isLiteralComputedPropertyDeclarationName(node) { - return isStringOrNumericLiteralLike(node) && node.parent.kind === 164 /* ComputedPropertyName */ && isDeclaration(node.parent.parent); + return isStringOrNumericLiteralLike(node) && node.parent.kind === 166 /* ComputedPropertyName */ && isDeclaration(node.parent.parent); } function isIdentifierName(node) { const parent2 = node.parent; switch (parent2.kind) { - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 302 /* EnumMember */: - case 299 /* PropertyAssignment */: - case 208 /* PropertyAccessExpression */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 305 /* EnumMember */: + case 302 /* PropertyAssignment */: + case 210 /* PropertyAccessExpression */: return parent2.name === node; - case 163 /* QualifiedName */: + case 165 /* QualifiedName */: return parent2.right === node; - case 205 /* BindingElement */: - case 273 /* ImportSpecifier */: + case 207 /* BindingElement */: + case 275 /* ImportSpecifier */: return parent2.propertyName === node; - case 278 /* ExportSpecifier */: - case 288 /* JsxAttribute */: - case 282 /* JsxSelfClosingElement */: - case 283 /* JsxOpeningElement */: - case 284 /* JsxClosingElement */: + case 280 /* ExportSpecifier */: + case 290 /* JsxAttribute */: + case 284 /* JsxSelfClosingElement */: + case 285 /* JsxOpeningElement */: + case 286 /* JsxClosingElement */: return true; } return false; } function isAliasSymbolDeclaration(node) { - if (node.kind === 268 /* ImportEqualsDeclaration */ || node.kind === 267 /* NamespaceExportDeclaration */ || node.kind === 270 /* ImportClause */ && !!node.name || node.kind === 271 /* NamespaceImport */ || node.kind === 277 /* NamespaceExport */ || node.kind === 273 /* ImportSpecifier */ || node.kind === 278 /* ExportSpecifier */ || node.kind === 274 /* ExportAssignment */ && exportAssignmentIsAlias(node)) { + if (node.kind === 270 /* ImportEqualsDeclaration */ || node.kind === 269 /* NamespaceExportDeclaration */ || node.kind === 272 /* ImportClause */ && !!node.name || node.kind === 273 /* NamespaceImport */ || node.kind === 279 /* NamespaceExport */ || node.kind === 275 /* ImportSpecifier */ || node.kind === 280 /* ExportSpecifier */ || node.kind === 276 /* ExportAssignment */ && exportAssignmentIsAlias(node)) { return true; } - return isInJSFile(node) && (isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) || isPropertyAccessExpression(node) && isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* EqualsToken */ && isAliasableExpression(node.parent.right)); + return isInJSFile(node) && (isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) || isPropertyAccessExpression(node) && isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 64 /* EqualsToken */ && isAliasableExpression(node.parent.right)); } function getAliasDeclarationFromName(node) { switch (node.parent.kind) { - case 270 /* ImportClause */: - case 273 /* ImportSpecifier */: - case 271 /* NamespaceImport */: - case 278 /* ExportSpecifier */: - case 274 /* ExportAssignment */: - case 268 /* ImportEqualsDeclaration */: - case 277 /* NamespaceExport */: + case 272 /* ImportClause */: + case 275 /* ImportSpecifier */: + case 273 /* NamespaceImport */: + case 280 /* ExportSpecifier */: + case 276 /* ExportAssignment */: + case 270 /* ImportEqualsDeclaration */: + case 279 /* NamespaceExport */: return node.parent; - case 163 /* QualifiedName */: + case 165 /* QualifiedName */: do { node = node.parent; - } while (node.parent.kind === 163 /* QualifiedName */); + } while (node.parent.kind === 165 /* QualifiedName */); return getAliasDeclarationFromName(node); } } @@ -15645,7 +15752,7 @@ ${lanes.join("\n")} return isExportAssignment(node) ? node.expression : node.right; } function getPropertyAssignmentAliasLikeExpression(node) { - return node.kind === 300 /* ShorthandPropertyAssignment */ ? node.name : node.kind === 299 /* PropertyAssignment */ ? node.initializer : node.parent.right; + return node.kind === 303 /* ShorthandPropertyAssignment */ ? node.name : node.kind === 302 /* PropertyAssignment */ ? node.initializer : node.parent.right; } function getEffectiveBaseTypeNode(node) { const baseType = getClassExtendsHeritageElement(node); @@ -15658,14 +15765,14 @@ ${lanes.join("\n")} return baseType; } function getClassExtendsHeritageElement(node) { - const heritageClause = getHeritageClause(node.heritageClauses, 94 /* ExtendsKeyword */); + const heritageClause = getHeritageClause(node.heritageClauses, 96 /* ExtendsKeyword */); return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : void 0; } function getEffectiveImplementsTypeNodes(node) { if (isInJSFile(node)) { return getJSDocImplementsTags(node).map((n) => n.class); } else { - const heritageClause = getHeritageClause(node.heritageClauses, 117 /* ImplementsKeyword */); + const heritageClause = getHeritageClause(node.heritageClauses, 119 /* ImplementsKeyword */); return heritageClause == null ? void 0 : heritageClause.types; } } @@ -15673,7 +15780,7 @@ ${lanes.join("\n")} return isInterfaceDeclaration(node) ? getInterfaceBaseTypeNodes(node) || emptyArray : isClassLike(node) ? concatenate(singleElementArray(getEffectiveBaseTypeNode(node)), getEffectiveImplementsTypeNodes(node)) || emptyArray : emptyArray; } function getInterfaceBaseTypeNodes(node) { - const heritageClause = getHeritageClause(node.heritageClauses, 94 /* ExtendsKeyword */); + const heritageClause = getHeritageClause(node.heritageClauses, 96 /* ExtendsKeyword */); return heritageClause ? heritageClause.types : void 0; } function getHeritageClause(clauses, kind) { @@ -15696,16 +15803,22 @@ ${lanes.join("\n")} return void 0; } function isKeyword(token) { - return 81 /* FirstKeyword */ <= token && token <= 162 /* LastKeyword */; + return 83 /* FirstKeyword */ <= token && token <= 164 /* LastKeyword */; + } + function isPunctuation(token) { + return 19 /* FirstPunctuation */ <= token && token <= 79 /* LastPunctuation */; + } + function isKeywordOrPunctuation(token) { + return isKeyword(token) || isPunctuation(token); } function isContextualKeyword(token) { - return 126 /* FirstContextualKeyword */ <= token && token <= 162 /* LastContextualKeyword */; + return 128 /* FirstContextualKeyword */ <= token && token <= 164 /* LastContextualKeyword */; } function isNonContextualKeyword(token) { return isKeyword(token) && !isContextualKeyword(token); } function isFutureReservedKeyword(token) { - return 117 /* FirstFutureReservedWord */ <= token && token <= 125 /* LastFutureReservedWord */; + return 119 /* FirstFutureReservedWord */ <= token && token <= 127 /* LastFutureReservedWord */; } function isStringANonContextualKeyword(name) { const token = stringToToken(name); @@ -15728,13 +15841,13 @@ ${lanes.join("\n")} } let flags = 0 /* Normal */; switch (node.kind) { - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 171 /* MethodDeclaration */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 173 /* MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* Generator */; } - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: if (hasSyntacticModifier(node, 512 /* Async */)) { flags |= 2 /* Async */; } @@ -15747,10 +15860,10 @@ ${lanes.join("\n")} } function isAsyncFunction(node) { switch (node.kind) { - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 171 /* MethodDeclaration */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 173 /* MethodDeclaration */: return node.body !== void 0 && node.asteriskToken === void 0 && hasSyntacticModifier(node, 512 /* Async */); } return false; @@ -15759,14 +15872,14 @@ ${lanes.join("\n")} return isStringLiteralLike(node) || isNumericLiteral(node); } function isSignedNumericLiteral(node) { - return isPrefixUnaryExpression(node) && (node.operator === 39 /* PlusToken */ || node.operator === 40 /* MinusToken */) && isNumericLiteral(node.operand); + return isPrefixUnaryExpression(node) && (node.operator === 40 /* PlusToken */ || node.operator === 41 /* MinusToken */) && isNumericLiteral(node.operand); } function hasDynamicName(declaration) { const name = getNameOfDeclaration(declaration); return !!name && isDynamicName(name); } function isDynamicName(name) { - if (!(name.kind === 164 /* ComputedPropertyName */ || name.kind === 209 /* ElementAccessExpression */)) { + if (!(name.kind === 166 /* ComputedPropertyName */ || name.kind === 211 /* ElementAccessExpression */)) { return false; } const expr = isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; @@ -15774,49 +15887,51 @@ ${lanes.join("\n")} } function getPropertyNameForPropertyNameNode(name) { switch (name.kind) { - case 79 /* Identifier */: - case 80 /* PrivateIdentifier */: + case 80 /* Identifier */: + case 81 /* PrivateIdentifier */: return name.escapedText; - case 10 /* StringLiteral */: - case 8 /* NumericLiteral */: + case 11 /* StringLiteral */: + case 9 /* NumericLiteral */: return escapeLeadingUnderscores(name.text); - case 164 /* ComputedPropertyName */: + case 166 /* ComputedPropertyName */: const nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return escapeLeadingUnderscores(nameExpression.text); } else if (isSignedNumericLiteral(nameExpression)) { - if (nameExpression.operator === 40 /* MinusToken */) { + if (nameExpression.operator === 41 /* MinusToken */) { return tokenToString(nameExpression.operator) + nameExpression.operand.text; } return nameExpression.operand.text; } return void 0; + case 294 /* JsxNamespacedName */: + return getEscapedTextOfJsxNamespacedName(name); default: return Debug.assertNever(name); } } function isPropertyNameLiteral(node) { switch (node.kind) { - case 79 /* Identifier */: - case 10 /* StringLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 8 /* NumericLiteral */: + case 80 /* Identifier */: + case 11 /* StringLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 9 /* NumericLiteral */: return true; default: return false; } } function getTextOfIdentifierOrLiteral(node) { - return isMemberName(node) ? idText(node) : node.text; + return isMemberName(node) ? idText(node) : isJsxNamespacedName(node) ? getTextOfJsxNamespacedName(node) : node.text; } function getEscapedTextOfIdentifierOrLiteral(node) { - return isMemberName(node) ? node.escapedText : escapeLeadingUnderscores(node.text); + return isMemberName(node) ? node.escapedText : isJsxNamespacedName(node) ? getEscapedTextOfJsxNamespacedName(node) : escapeLeadingUnderscores(node.text); } function getPropertyNameForUniqueESSymbol(symbol) { return `__@${getSymbolId(symbol)}@${symbol.escapedName}`; } - function getSymbolNameForPrivateIdentifier(containingClassSymbol, description2) { - return `__#${getSymbolId(containingClassSymbol)}@${description2}`; + function getSymbolNameForPrivateIdentifier(containingClassSymbol, description3) { + return `__#${getSymbolId(containingClassSymbol)}@${description3}`; } function isKnownSymbol(symbol) { return startsWith(symbol.escapedName, "__@"); @@ -15825,7 +15940,7 @@ ${lanes.join("\n")} return startsWith(symbol.escapedName, "__#"); } function isESSymbolIdentifier(node) { - return node.kind === 79 /* Identifier */ && node.escapedText === "Symbol"; + return node.kind === 80 /* Identifier */ && node.escapedText === "Symbol"; } function isProtoSetter(node) { return isIdentifier(node) ? idText(node) === "__proto__" : isStringLiteral(node) && node.text === "__proto__"; @@ -15833,13 +15948,13 @@ ${lanes.join("\n")} function isAnonymousFunctionDefinition(node, cb) { node = skipOuterExpressions(node); switch (node.kind) { - case 228 /* ClassExpression */: - case 215 /* FunctionExpression */: + case 230 /* ClassExpression */: + case 217 /* FunctionExpression */: if (node.name) { return false; } break; - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: break; default: return false; @@ -15848,28 +15963,28 @@ ${lanes.join("\n")} } function isNamedEvaluationSource(node) { switch (node.kind) { - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: return !isProtoSetter(node.name); - case 300 /* ShorthandPropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: return !!node.objectAssignmentInitializer; - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: return isIdentifier(node.name) && !!node.initializer; - case 166 /* Parameter */: + case 168 /* Parameter */: return isIdentifier(node.name) && !!node.initializer && !node.dotDotDotToken; - case 205 /* BindingElement */: + case 207 /* BindingElement */: return isIdentifier(node.name) && !!node.initializer && !node.dotDotDotToken; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return !!node.initializer; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: switch (node.operatorToken.kind) { - case 63 /* EqualsToken */: - case 76 /* AmpersandAmpersandEqualsToken */: - case 75 /* BarBarEqualsToken */: - case 77 /* QuestionQuestionEqualsToken */: + case 64 /* EqualsToken */: + case 77 /* AmpersandAmpersandEqualsToken */: + case 76 /* BarBarEqualsToken */: + case 78 /* QuestionQuestionEqualsToken */: return isIdentifier(node.left); } break; - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: return true; } return false; @@ -15878,18 +15993,18 @@ ${lanes.join("\n")} if (!isNamedEvaluationSource(node)) return false; switch (node.kind) { - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: return isAnonymousFunctionDefinition(node.initializer, cb); - case 300 /* ShorthandPropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: return isAnonymousFunctionDefinition(node.objectAssignmentInitializer, cb); - case 257 /* VariableDeclaration */: - case 166 /* Parameter */: - case 205 /* BindingElement */: - case 169 /* PropertyDeclaration */: + case 259 /* VariableDeclaration */: + case 168 /* Parameter */: + case 207 /* BindingElement */: + case 171 /* PropertyDeclaration */: return isAnonymousFunctionDefinition(node.initializer, cb); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return isAnonymousFunctionDefinition(node.right, cb); - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: return isAnonymousFunctionDefinition(node.expression, cb); } } @@ -15898,17 +16013,17 @@ ${lanes.join("\n")} } function isParameterDeclaration(node) { const root = getRootDeclaration(node); - return root.kind === 166 /* Parameter */; + return root.kind === 168 /* Parameter */; } function getRootDeclaration(node) { - while (node.kind === 205 /* BindingElement */) { + while (node.kind === 207 /* BindingElement */) { node = node.parent.parent; } return node; } function nodeStartsNewLexicalEnvironment(node) { const kind = node.kind; - return kind === 173 /* Constructor */ || kind === 215 /* FunctionExpression */ || kind === 259 /* FunctionDeclaration */ || kind === 216 /* ArrowFunction */ || kind === 171 /* MethodDeclaration */ || kind === 174 /* GetAccessor */ || kind === 175 /* SetAccessor */ || kind === 264 /* ModuleDeclaration */ || kind === 308 /* SourceFile */; + return kind === 175 /* Constructor */ || kind === 217 /* FunctionExpression */ || kind === 261 /* FunctionDeclaration */ || kind === 218 /* ArrowFunction */ || kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */ || kind === 266 /* ModuleDeclaration */ || kind === 311 /* SourceFile */; } function nodeIsSynthesized(range) { return positionIsSynthesized(range.pos) || positionIsSynthesized(range.end); @@ -15918,40 +16033,40 @@ ${lanes.join("\n")} } function getExpressionAssociativity(expression) { const operator = getOperator(expression); - const hasArguments = expression.kind === 211 /* NewExpression */ && expression.arguments !== void 0; + const hasArguments = expression.kind === 213 /* NewExpression */ && expression.arguments !== void 0; return getOperatorAssociativity(expression.kind, operator, hasArguments); } function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 211 /* NewExpression */: + case 213 /* NewExpression */: return hasArguments ? 0 /* Left */ : 1 /* Right */; - case 221 /* PrefixUnaryExpression */: - case 218 /* TypeOfExpression */: - case 219 /* VoidExpression */: - case 217 /* DeleteExpression */: - case 220 /* AwaitExpression */: - case 224 /* ConditionalExpression */: - case 226 /* YieldExpression */: + case 223 /* PrefixUnaryExpression */: + case 220 /* TypeOfExpression */: + case 221 /* VoidExpression */: + case 219 /* DeleteExpression */: + case 222 /* AwaitExpression */: + case 226 /* ConditionalExpression */: + case 228 /* YieldExpression */: return 1 /* Right */; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: switch (operator) { - case 42 /* AsteriskAsteriskToken */: - case 63 /* EqualsToken */: - case 64 /* PlusEqualsToken */: - case 65 /* MinusEqualsToken */: - case 67 /* AsteriskAsteriskEqualsToken */: - case 66 /* AsteriskEqualsToken */: - case 68 /* SlashEqualsToken */: - case 69 /* PercentEqualsToken */: - case 70 /* LessThanLessThanEqualsToken */: - case 71 /* GreaterThanGreaterThanEqualsToken */: - case 72 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 73 /* AmpersandEqualsToken */: - case 78 /* CaretEqualsToken */: - case 74 /* BarEqualsToken */: - case 75 /* BarBarEqualsToken */: - case 76 /* AmpersandAmpersandEqualsToken */: - case 77 /* QuestionQuestionEqualsToken */: + case 43 /* AsteriskAsteriskToken */: + case 64 /* EqualsToken */: + case 65 /* PlusEqualsToken */: + case 66 /* MinusEqualsToken */: + case 68 /* AsteriskAsteriskEqualsToken */: + case 67 /* AsteriskEqualsToken */: + case 69 /* SlashEqualsToken */: + case 70 /* PercentEqualsToken */: + case 71 /* LessThanLessThanEqualsToken */: + case 72 /* GreaterThanGreaterThanEqualsToken */: + case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 74 /* AmpersandEqualsToken */: + case 79 /* CaretEqualsToken */: + case 75 /* BarEqualsToken */: + case 76 /* BarBarEqualsToken */: + case 77 /* AmpersandAmpersandEqualsToken */: + case 78 /* QuestionQuestionEqualsToken */: return 1 /* Right */; } } @@ -15959,13 +16074,13 @@ ${lanes.join("\n")} } function getExpressionPrecedence(expression) { const operator = getOperator(expression); - const hasArguments = expression.kind === 211 /* NewExpression */ && expression.arguments !== void 0; + const hasArguments = expression.kind === 213 /* NewExpression */ && expression.arguments !== void 0; return getOperatorPrecedence(expression.kind, operator, hasArguments); } function getOperator(expression) { - if (expression.kind === 223 /* BinaryExpression */) { + if (expression.kind === 225 /* BinaryExpression */) { return expression.operatorToken.kind; - } else if (expression.kind === 221 /* PrefixUnaryExpression */ || expression.kind === 222 /* PostfixUnaryExpression */) { + } else if (expression.kind === 223 /* PrefixUnaryExpression */ || expression.kind === 224 /* PostfixUnaryExpression */) { return expression.operator; } else { return expression.kind; @@ -15973,83 +16088,83 @@ ${lanes.join("\n")} } function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 357 /* CommaListExpression */: + case 360 /* CommaListExpression */: return 0 /* Comma */; - case 227 /* SpreadElement */: + case 229 /* SpreadElement */: return 1 /* Spread */; - case 226 /* YieldExpression */: + case 228 /* YieldExpression */: return 2 /* Yield */; - case 224 /* ConditionalExpression */: + case 226 /* ConditionalExpression */: return 4 /* Conditional */; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: switch (operatorKind) { - case 27 /* CommaToken */: + case 28 /* CommaToken */: return 0 /* Comma */; - case 63 /* EqualsToken */: - case 64 /* PlusEqualsToken */: - case 65 /* MinusEqualsToken */: - case 67 /* AsteriskAsteriskEqualsToken */: - case 66 /* AsteriskEqualsToken */: - case 68 /* SlashEqualsToken */: - case 69 /* PercentEqualsToken */: - case 70 /* LessThanLessThanEqualsToken */: - case 71 /* GreaterThanGreaterThanEqualsToken */: - case 72 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 73 /* AmpersandEqualsToken */: - case 78 /* CaretEqualsToken */: - case 74 /* BarEqualsToken */: - case 75 /* BarBarEqualsToken */: - case 76 /* AmpersandAmpersandEqualsToken */: - case 77 /* QuestionQuestionEqualsToken */: + case 64 /* EqualsToken */: + case 65 /* PlusEqualsToken */: + case 66 /* MinusEqualsToken */: + case 68 /* AsteriskAsteriskEqualsToken */: + case 67 /* AsteriskEqualsToken */: + case 69 /* SlashEqualsToken */: + case 70 /* PercentEqualsToken */: + case 71 /* LessThanLessThanEqualsToken */: + case 72 /* GreaterThanGreaterThanEqualsToken */: + case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 74 /* AmpersandEqualsToken */: + case 79 /* CaretEqualsToken */: + case 75 /* BarEqualsToken */: + case 76 /* BarBarEqualsToken */: + case 77 /* AmpersandAmpersandEqualsToken */: + case 78 /* QuestionQuestionEqualsToken */: return 3 /* Assignment */; default: return getBinaryOperatorPrecedence(operatorKind); } - case 213 /* TypeAssertionExpression */: - case 232 /* NonNullExpression */: - case 221 /* PrefixUnaryExpression */: - case 218 /* TypeOfExpression */: - case 219 /* VoidExpression */: - case 217 /* DeleteExpression */: - case 220 /* AwaitExpression */: + case 215 /* TypeAssertionExpression */: + case 234 /* NonNullExpression */: + case 223 /* PrefixUnaryExpression */: + case 220 /* TypeOfExpression */: + case 221 /* VoidExpression */: + case 219 /* DeleteExpression */: + case 222 /* AwaitExpression */: return 16 /* Unary */; - case 222 /* PostfixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: return 17 /* Update */; - case 210 /* CallExpression */: + case 212 /* CallExpression */: return 18 /* LeftHandSide */; - case 211 /* NewExpression */: + case 213 /* NewExpression */: return hasArguments ? 19 /* Member */ : 18 /* LeftHandSide */; - case 212 /* TaggedTemplateExpression */: - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: - case 233 /* MetaProperty */: + case 214 /* TaggedTemplateExpression */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: + case 235 /* MetaProperty */: return 19 /* Member */; - case 231 /* AsExpression */: - case 235 /* SatisfiesExpression */: + case 233 /* AsExpression */: + case 237 /* SatisfiesExpression */: return 11 /* Relational */; - case 108 /* ThisKeyword */: - case 106 /* SuperKeyword */: - case 79 /* Identifier */: - case 80 /* PrivateIdentifier */: - case 104 /* NullKeyword */: - case 110 /* TrueKeyword */: - case 95 /* FalseKeyword */: - case 8 /* NumericLiteral */: - case 9 /* BigIntLiteral */: - case 10 /* StringLiteral */: - case 206 /* ArrayLiteralExpression */: - case 207 /* ObjectLiteralExpression */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 228 /* ClassExpression */: - case 13 /* RegularExpressionLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 225 /* TemplateExpression */: - case 214 /* ParenthesizedExpression */: - case 229 /* OmittedExpression */: - case 281 /* JsxElement */: - case 282 /* JsxSelfClosingElement */: - case 285 /* JsxFragment */: + case 110 /* ThisKeyword */: + case 108 /* SuperKeyword */: + case 80 /* Identifier */: + case 81 /* PrivateIdentifier */: + case 106 /* NullKeyword */: + case 112 /* TrueKeyword */: + case 97 /* FalseKeyword */: + case 9 /* NumericLiteral */: + case 10 /* BigIntLiteral */: + case 11 /* StringLiteral */: + case 208 /* ArrayLiteralExpression */: + case 209 /* ObjectLiteralExpression */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 230 /* ClassExpression */: + case 14 /* RegularExpressionLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 227 /* TemplateExpression */: + case 216 /* ParenthesizedExpression */: + case 231 /* OmittedExpression */: + case 283 /* JsxElement */: + case 284 /* JsxSelfClosingElement */: + case 287 /* JsxFragment */: return 20 /* Primary */; default: return -1 /* Invalid */; @@ -16057,44 +16172,44 @@ ${lanes.join("\n")} } function getBinaryOperatorPrecedence(kind) { switch (kind) { - case 60 /* QuestionQuestionToken */: + case 61 /* QuestionQuestionToken */: return 4 /* Coalesce */; - case 56 /* BarBarToken */: + case 57 /* BarBarToken */: return 5 /* LogicalOR */; - case 55 /* AmpersandAmpersandToken */: + case 56 /* AmpersandAmpersandToken */: return 6 /* LogicalAND */; - case 51 /* BarToken */: + case 52 /* BarToken */: return 7 /* BitwiseOR */; - case 52 /* CaretToken */: + case 53 /* CaretToken */: return 8 /* BitwiseXOR */; - case 50 /* AmpersandToken */: + case 51 /* AmpersandToken */: return 9 /* BitwiseAND */; - case 34 /* EqualsEqualsToken */: - case 35 /* ExclamationEqualsToken */: - case 36 /* EqualsEqualsEqualsToken */: - case 37 /* ExclamationEqualsEqualsToken */: + case 35 /* EqualsEqualsToken */: + case 36 /* ExclamationEqualsToken */: + case 37 /* EqualsEqualsEqualsToken */: + case 38 /* ExclamationEqualsEqualsToken */: return 10 /* Equality */; - case 29 /* LessThanToken */: - case 31 /* GreaterThanToken */: - case 32 /* LessThanEqualsToken */: - case 33 /* GreaterThanEqualsToken */: - case 102 /* InstanceOfKeyword */: - case 101 /* InKeyword */: - case 128 /* AsKeyword */: - case 150 /* SatisfiesKeyword */: + case 30 /* LessThanToken */: + case 32 /* GreaterThanToken */: + case 33 /* LessThanEqualsToken */: + case 34 /* GreaterThanEqualsToken */: + case 104 /* InstanceOfKeyword */: + case 103 /* InKeyword */: + case 130 /* AsKeyword */: + case 152 /* SatisfiesKeyword */: return 11 /* Relational */; - case 47 /* LessThanLessThanToken */: - case 48 /* GreaterThanGreaterThanToken */: - case 49 /* GreaterThanGreaterThanGreaterThanToken */: + case 48 /* LessThanLessThanToken */: + case 49 /* GreaterThanGreaterThanToken */: + case 50 /* GreaterThanGreaterThanGreaterThanToken */: return 12 /* Shift */; - case 39 /* PlusToken */: - case 40 /* MinusToken */: + case 40 /* PlusToken */: + case 41 /* MinusToken */: return 13 /* Additive */; - case 41 /* AsteriskToken */: - case 43 /* SlashToken */: - case 44 /* PercentToken */: + case 42 /* AsteriskToken */: + case 44 /* SlashToken */: + case 45 /* PercentToken */: return 14 /* Multiplicative */; - case 42 /* AsteriskAsteriskToken */: + case 43 /* AsteriskAsteriskToken */: return 15 /* Exponentiation */; } return -1; @@ -16102,9 +16217,9 @@ ${lanes.join("\n")} function getSemanticJsxChildren(children) { return filter(children, (i) => { switch (i.kind) { - case 291 /* JsxExpression */: + case 293 /* JsxExpression */: return !!i.expression; - case 11 /* JsxText */: + case 12 /* JsxText */: return !i.containsOnlyTriviaWhiteSpaces; default: return true; @@ -16227,7 +16342,7 @@ ${lanes.join("\n")} } function isIntrinsicJsxName(name) { const ch = name.charCodeAt(0); - return ch >= 97 /* a */ && ch <= 122 /* z */ || stringContains(name, "-") || stringContains(name, ":"); + return ch >= 97 /* a */ && ch <= 122 /* z */ || stringContains(name, "-"); } function getIndentString(level) { const singleLevel = indentStrings[1]; @@ -16482,10 +16597,10 @@ ${lanes.join("\n")} return options.outFile || options.out; } function getPathsBasePath(options, host) { - var _a2, _b; + var _a; if (!options.paths) return void 0; - return (_b = options.baseUrl) != null ? _b : Debug.checkDefined(options.pathsBasePath || ((_a2 = host.getCurrentDirectory) == null ? void 0 : _a2.call(host)), "Encountered 'paths' without a 'baseUrl', config file, or host 'getCurrentDirectory'."); + return options.baseUrl ?? Debug.checkDefined(options.pathsBasePath || ((_a = host.getCurrentDirectory) == null ? void 0 : _a.call(host)), "Encountered 'paths' without a 'baseUrl', config file, or host 'getCurrentDirectory'."); } function getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit) { const options = host.getCompilerOptions(); @@ -16532,7 +16647,7 @@ ${lanes.join("\n")} function writeFileEnsuringDirectories(path, data, writeByteOrderMark, writeFile2, createDirectory, directoryExists) { try { writeFile2(path, data, writeByteOrderMark); - } catch (e) { + } catch { ensureDirectoriesExist(getDirectoryPath(normalizePath(path)), createDirectory, directoryExists); writeFile2(path, data, writeByteOrderMark); } @@ -16569,7 +16684,7 @@ ${lanes.join("\n")} return isThisIdentifier(parameter.name); } function isThisIdentifier(node) { - return !!node && node.kind === 79 /* Identifier */ && identifierIsThisKeyword(node); + return !!node && node.kind === 80 /* Identifier */ && identifierIsThisKeyword(node); } function isThisInTypeQuery(node) { if (!isThisIdentifier(node)) { @@ -16578,7 +16693,7 @@ ${lanes.join("\n")} while (isQualifiedName(node.parent) && node.parent.left === node) { node = node.parent; } - return node.parent.kind === 183 /* TypeQuery */; + return node.parent.kind === 185 /* TypeQuery */; } function identifierIsThisKeyword(id) { return id.escapedText === "this"; @@ -16590,9 +16705,9 @@ ${lanes.join("\n")} let setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 174 /* GetAccessor */) { + if (accessor.kind === 176 /* GetAccessor */) { getAccessor = accessor; - } else if (accessor.kind === 175 /* SetAccessor */) { + } else if (accessor.kind === 177 /* SetAccessor */) { setAccessor = accessor; } else { Debug.fail("Accessor has wrong kind"); @@ -16608,10 +16723,10 @@ ${lanes.join("\n")} } else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 174 /* GetAccessor */ && !getAccessor) { + if (member.kind === 176 /* GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 175 /* SetAccessor */ && !setAccessor) { + if (member.kind === 177 /* SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -16643,7 +16758,7 @@ ${lanes.join("\n")} return flatMap(getJSDocTags(node), (tag) => isNonTypeAliasTemplate(tag) ? tag.typeParameters : void 0); } function isNonTypeAliasTemplate(tag) { - return isJSDocTemplateTag(tag) && !(tag.parent.kind === 323 /* JSDoc */ && (tag.parent.tags.some(isJSDocTypeAlias) || tag.parent.tags.some(isJSDocOverloadTag))); + return isJSDocTemplateTag(tag) && !(tag.parent.kind === 326 /* JSDoc */ && (tag.parent.tags.some(isJSDocTypeAlias) || tag.parent.tags.some(isJSDocOverloadTag))); } function getEffectiveSetAccessorTypeAnnotationNode(node) { const parameter = getSetAccessorValueParameter(node); @@ -16833,7 +16948,7 @@ ${lanes.join("\n")} return getSyntacticModifierFlags(node) & flags; } function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { - if (node.kind >= 0 /* FirstToken */ && node.kind <= 162 /* LastToken */) { + if (node.kind >= 0 /* FirstToken */ && node.kind <= 164 /* LastToken */) { return 0 /* None */; } if (!(node.modifierFlagsCache & 536870912 /* HasComputedFlags */)) { @@ -16854,9 +16969,9 @@ ${lanes.join("\n")} function getEffectiveModifierFlagsAlwaysIncludeJSDoc(node) { return getModifierFlagsWorker( node, - /*includeJSDOc*/ + /*includeJSDoc*/ true, - /*alwaysIncludeJSDOc*/ + /*alwaysIncludeJSDoc*/ true ); } @@ -16892,7 +17007,7 @@ ${lanes.join("\n")} } function getSyntacticModifierFlagsNoCache(node) { let flags = canHaveModifiers(node) ? modifiersToFlags(node.modifiers) : 0 /* None */; - if (node.flags & 4 /* NestedNamespace */ || node.kind === 79 /* Identifier */ && node.flags & 2048 /* IdentifierIsInJSDocNamespace */) { + if (node.flags & 4 /* NestedNamespace */ || node.kind === 80 /* Identifier */ && node.flags & 2048 /* IdentifierIsInJSDocNamespace */) { flags |= 1 /* Export */; } return flags; @@ -16908,61 +17023,61 @@ ${lanes.join("\n")} } function modifierToFlag(token) { switch (token) { - case 124 /* StaticKeyword */: + case 126 /* StaticKeyword */: return 32 /* Static */; - case 123 /* PublicKeyword */: + case 125 /* PublicKeyword */: return 4 /* Public */; - case 122 /* ProtectedKeyword */: + case 124 /* ProtectedKeyword */: return 16 /* Protected */; - case 121 /* PrivateKeyword */: + case 123 /* PrivateKeyword */: return 8 /* Private */; - case 126 /* AbstractKeyword */: + case 128 /* AbstractKeyword */: return 256 /* Abstract */; - case 127 /* AccessorKeyword */: + case 129 /* AccessorKeyword */: return 128 /* Accessor */; - case 93 /* ExportKeyword */: + case 95 /* ExportKeyword */: return 1 /* Export */; - case 136 /* DeclareKeyword */: + case 138 /* DeclareKeyword */: return 2 /* Ambient */; - case 85 /* ConstKeyword */: + case 87 /* ConstKeyword */: return 2048 /* Const */; - case 88 /* DefaultKeyword */: + case 90 /* DefaultKeyword */: return 1024 /* Default */; - case 132 /* AsyncKeyword */: + case 134 /* AsyncKeyword */: return 512 /* Async */; - case 146 /* ReadonlyKeyword */: + case 148 /* ReadonlyKeyword */: return 64 /* Readonly */; - case 161 /* OverrideKeyword */: + case 163 /* OverrideKeyword */: return 16384 /* Override */; - case 101 /* InKeyword */: + case 103 /* InKeyword */: return 32768 /* In */; - case 145 /* OutKeyword */: + case 147 /* OutKeyword */: return 65536 /* Out */; - case 167 /* Decorator */: + case 169 /* Decorator */: return 131072 /* Decorator */; } return 0 /* None */; } function isBinaryLogicalOperator(token) { - return token === 56 /* BarBarToken */ || token === 55 /* AmpersandAmpersandToken */; + return token === 57 /* BarBarToken */ || token === 56 /* AmpersandAmpersandToken */; } function isLogicalOperator(token) { - return isBinaryLogicalOperator(token) || token === 53 /* ExclamationToken */; + return isBinaryLogicalOperator(token) || token === 54 /* ExclamationToken */; } function isLogicalOrCoalescingAssignmentOperator(token) { - return token === 75 /* BarBarEqualsToken */ || token === 76 /* AmpersandAmpersandEqualsToken */ || token === 77 /* QuestionQuestionEqualsToken */; + return token === 76 /* BarBarEqualsToken */ || token === 77 /* AmpersandAmpersandEqualsToken */ || token === 78 /* QuestionQuestionEqualsToken */; } function isLogicalOrCoalescingAssignmentExpression(expr) { return isBinaryExpression(expr) && isLogicalOrCoalescingAssignmentOperator(expr.operatorToken.kind); } function isLogicalOrCoalescingBinaryOperator(token) { - return isBinaryLogicalOperator(token) || token === 60 /* QuestionQuestionToken */; + return isBinaryLogicalOperator(token) || token === 61 /* QuestionQuestionToken */; } function isLogicalOrCoalescingBinaryExpression(expr) { return isBinaryExpression(expr) && isLogicalOrCoalescingBinaryOperator(expr.operatorToken.kind); } function isAssignmentOperator(token) { - return token >= 63 /* FirstAssignment */ && token <= 78 /* LastAssignment */; + return token >= 64 /* FirstAssignment */ && token <= 79 /* LastAssignment */; } function tryGetClassExtendingExpressionWithTypeArguments(node) { const cls = tryGetClassImplementingOrExtendingExpressionWithTypeArguments(node); @@ -16971,7 +17086,7 @@ ${lanes.join("\n")} function tryGetClassImplementingOrExtendingExpressionWithTypeArguments(node) { if (isExpressionWithTypeArguments(node)) { if (isHeritageClause(node.parent) && isClassLike(node.parent.parent)) { - return { class: node.parent.parent, isImplements: node.parent.token === 117 /* ImplementsKeyword */ }; + return { class: node.parent.parent, isImplements: node.parent.token === 119 /* ImplementsKeyword */ }; } if (isJSDocAugmentsTag(node.parent)) { const host = getEffectiveJSDocHost(node.parent); @@ -16983,7 +17098,7 @@ ${lanes.join("\n")} return void 0; } function isAssignmentExpression(node, excludeCompoundAssignment) { - return isBinaryExpression(node) && (excludeCompoundAssignment ? node.operatorToken.kind === 63 /* EqualsToken */ : isAssignmentOperator(node.operatorToken.kind)) && isLeftHandSideExpression(node.left); + return isBinaryExpression(node) && (excludeCompoundAssignment ? node.operatorToken.kind === 64 /* EqualsToken */ : isAssignmentOperator(node.operatorToken.kind)) && isLeftHandSideExpression(node.left); } function isLeftHandSideOfAssignment(node) { return isAssignmentExpression(node.parent) && node.parent.left === node; @@ -16995,7 +17110,7 @@ ${lanes.join("\n")} true )) { const kind = node.left.kind; - return kind === 207 /* ObjectLiteralExpression */ || kind === 206 /* ArrayLiteralExpression */; + return kind === 209 /* ObjectLiteralExpression */ || kind === 208 /* ArrayLiteralExpression */; } return false; } @@ -17003,26 +17118,26 @@ ${lanes.join("\n")} return tryGetClassExtendingExpressionWithTypeArguments(node) !== void 0; } function isEntityNameExpression(node) { - return node.kind === 79 /* Identifier */ || isPropertyAccessEntityNameExpression(node); + return node.kind === 80 /* Identifier */ || isPropertyAccessEntityNameExpression(node); } function getFirstIdentifier(node) { switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return node; - case 163 /* QualifiedName */: + case 165 /* QualifiedName */: do { node = node.left; - } while (node.kind !== 79 /* Identifier */); + } while (node.kind !== 80 /* Identifier */); return node; - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: do { node = node.expression; - } while (node.kind !== 79 /* Identifier */); + } while (node.kind !== 80 /* Identifier */); return node; } } function isDottedName(node) { - return node.kind === 79 /* Identifier */ || node.kind === 108 /* ThisKeyword */ || node.kind === 106 /* SuperKeyword */ || node.kind === 233 /* MetaProperty */ || node.kind === 208 /* PropertyAccessExpression */ && isDottedName(node.expression) || node.kind === 214 /* ParenthesizedExpression */ && isDottedName(node.expression); + return node.kind === 80 /* Identifier */ || node.kind === 110 /* ThisKeyword */ || node.kind === 108 /* SuperKeyword */ || node.kind === 235 /* MetaProperty */ || node.kind === 210 /* PropertyAccessExpression */ && isDottedName(node.expression) || node.kind === 216 /* ParenthesizedExpression */ && isDottedName(node.expression); } function isPropertyAccessEntityNameExpression(node) { return isPropertyAccessExpression(node) && isIdentifier(node.name) && isEntityNameExpression(node.expression); @@ -17040,6 +17155,8 @@ ${lanes.join("\n")} } } else if (isIdentifier(expr)) { return unescapeLeadingUnderscores(expr.escapedText); + } else if (isJsxNamespacedName(expr)) { + return getTextOfJsxNamespacedName(expr); } return void 0; } @@ -17047,7 +17164,7 @@ ${lanes.join("\n")} return isBindableStaticAccessExpression(node) && getElementOrPropertyAccessName(node) === "prototype"; } function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return node.parent.kind === 163 /* QualifiedName */ && node.parent.right === node || node.parent.kind === 208 /* PropertyAccessExpression */ && node.parent.name === node; + return node.parent.kind === 165 /* QualifiedName */ && node.parent.right === node || node.parent.kind === 210 /* PropertyAccessExpression */ && node.parent.name === node; } function isRightSideOfAccessExpression(node) { return isPropertyAccessExpression(node.parent) && node.parent.name === node || isElementAccessExpression(node.parent) && node.parent.argumentExpression === node; @@ -17056,10 +17173,10 @@ ${lanes.join("\n")} return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node || isJSDocMemberName(node.parent) && node.parent.right === node; } function isEmptyObjectLiteral(expression) { - return expression.kind === 207 /* ObjectLiteralExpression */ && expression.properties.length === 0; + return expression.kind === 209 /* ObjectLiteralExpression */ && expression.properties.length === 0; } function isEmptyArrayLiteral(expression) { - return expression.kind === 206 /* ArrayLiteralExpression */ && expression.elements.length === 0; + return expression.kind === 208 /* ArrayLiteralExpression */ && expression.elements.length === 0; } function getLocalSymbolForExportDefault(symbol) { if (!isExportDefaultSymbol(symbol) || !symbol.declarations) @@ -17302,7 +17419,7 @@ ${lanes.join("\n")} includeComments ); const prevPos = getPreviousNonWhitespacePosition(startPos, stopPos, sourceFile); - return getLinesBetweenPositions(sourceFile, prevPos != null ? prevPos : stopPos, startPos); + return getLinesBetweenPositions(sourceFile, prevPos ?? stopPos, startPos); } function getLinesBetweenPositionAndNextNonWhitespaceCharacter(pos, stopPos, sourceFile, includeComments) { const nextPos = skipTrivia( @@ -17325,8 +17442,8 @@ ${lanes.join("\n")} const parseNode = getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 263 /* EnumDeclaration */: - case 264 /* ModuleDeclaration */: + case 265 /* EnumDeclaration */: + case 266 /* ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -17378,34 +17495,29 @@ ${lanes.join("\n")} } function accessKind(node) { const { parent: parent2 } = node; - if (!parent2) - return 0 /* Read */; - switch (parent2.kind) { - case 214 /* ParenthesizedExpression */: + switch (parent2 == null ? void 0 : parent2.kind) { + case 216 /* ParenthesizedExpression */: return accessKind(parent2); - case 222 /* PostfixUnaryExpression */: - case 221 /* PrefixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: const { operator } = parent2; - return operator === 45 /* PlusPlusToken */ || operator === 46 /* MinusMinusToken */ ? writeOrReadWrite() : 0 /* Read */; - case 223 /* BinaryExpression */: + return operator === 46 /* PlusPlusToken */ || operator === 47 /* MinusMinusToken */ ? 2 /* ReadWrite */ : 0 /* Read */; + case 225 /* BinaryExpression */: const { left, operatorToken } = parent2; - return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* EqualsToken */ ? 1 /* Write */ : writeOrReadWrite() : 0 /* Read */; - case 208 /* PropertyAccessExpression */: + return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 64 /* EqualsToken */ ? 1 /* Write */ : 2 /* ReadWrite */ : 0 /* Read */; + case 210 /* PropertyAccessExpression */: return parent2.name !== node ? 0 /* Read */ : accessKind(parent2); - case 299 /* PropertyAssignment */: { + case 302 /* PropertyAssignment */: { const parentAccess = accessKind(parent2.parent); return node === parent2.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 300 /* ShorthandPropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: return node === parent2.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent2.parent); - case 206 /* ArrayLiteralExpression */: + case 208 /* ArrayLiteralExpression */: return accessKind(parent2); default: return 0 /* Read */; } - function writeOrReadWrite() { - return parent2.parent && walkUpParenthesizedExpressions(parent2.parent).kind === 241 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */; - } } function reverseAccessKind(a) { switch (a) { @@ -17469,11 +17581,11 @@ ${lanes.join("\n")} return false; } function getClassLikeDeclarationOfSymbol(symbol) { - var _a2; - return (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isClassLike); + var _a; + return (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike); } function getObjectFlags(type) { - return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0; + return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0; } function forSomeAncestorDirectory(directory, callback) { return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0); @@ -17514,16 +17626,16 @@ ${lanes.join("\n")} return isClassLike(node) || isInterfaceDeclaration(node) || isTypeLiteralNode(node); } function isTypeNodeKind(kind) { - return kind >= 179 /* FirstTypeNode */ && kind <= 202 /* LastTypeNode */ || kind === 131 /* AnyKeyword */ || kind === 157 /* UnknownKeyword */ || kind === 148 /* NumberKeyword */ || kind === 160 /* BigIntKeyword */ || kind === 149 /* ObjectKeyword */ || kind === 134 /* BooleanKeyword */ || kind === 152 /* StringKeyword */ || kind === 153 /* SymbolKeyword */ || kind === 114 /* VoidKeyword */ || kind === 155 /* UndefinedKeyword */ || kind === 144 /* NeverKeyword */ || kind === 139 /* IntrinsicKeyword */ || kind === 230 /* ExpressionWithTypeArguments */ || kind === 315 /* JSDocAllType */ || kind === 316 /* JSDocUnknownType */ || kind === 317 /* JSDocNullableType */ || kind === 318 /* JSDocNonNullableType */ || kind === 319 /* JSDocOptionalType */ || kind === 320 /* JSDocFunctionType */ || kind === 321 /* JSDocVariadicType */; + return kind >= 181 /* FirstTypeNode */ && kind <= 204 /* LastTypeNode */ || kind === 133 /* AnyKeyword */ || kind === 159 /* UnknownKeyword */ || kind === 150 /* NumberKeyword */ || kind === 162 /* BigIntKeyword */ || kind === 151 /* ObjectKeyword */ || kind === 136 /* BooleanKeyword */ || kind === 154 /* StringKeyword */ || kind === 155 /* SymbolKeyword */ || kind === 116 /* VoidKeyword */ || kind === 157 /* UndefinedKeyword */ || kind === 146 /* NeverKeyword */ || kind === 141 /* IntrinsicKeyword */ || kind === 232 /* ExpressionWithTypeArguments */ || kind === 318 /* JSDocAllType */ || kind === 319 /* JSDocUnknownType */ || kind === 320 /* JSDocNullableType */ || kind === 321 /* JSDocNonNullableType */ || kind === 322 /* JSDocOptionalType */ || kind === 323 /* JSDocFunctionType */ || kind === 324 /* JSDocVariadicType */; } function isAccessExpression(node) { - return node.kind === 208 /* PropertyAccessExpression */ || node.kind === 209 /* ElementAccessExpression */; + return node.kind === 210 /* PropertyAccessExpression */ || node.kind === 211 /* ElementAccessExpression */; } function getNameOfAccessExpression(node) { - if (node.kind === 208 /* PropertyAccessExpression */) { + if (node.kind === 210 /* PropertyAccessExpression */) { return node.name; } - Debug.assert(node.kind === 209 /* ElementAccessExpression */); + Debug.assert(node.kind === 211 /* ElementAccessExpression */); return node.argumentExpression; } function isBundleFileTextLike(section) { @@ -17536,7 +17648,7 @@ ${lanes.join("\n")} } } function isNamedImportsOrExports(node) { - return node.kind === 272 /* NamedImports */ || node.kind === 276 /* NamedExports */; + return node.kind === 274 /* NamedImports */ || node.kind === 278 /* NamedExports */; } function getLeftmostAccessExpression(expr) { while (isAccessExpression(expr)) { @@ -17549,12 +17661,12 @@ ${lanes.join("\n")} return walkAccessExpression(name.parent); } function walkAccessExpression(access) { - if (access.kind === 208 /* PropertyAccessExpression */) { + if (access.kind === 210 /* PropertyAccessExpression */) { const res = action(access.name); if (res !== void 0) { return res; } - } else if (access.kind === 209 /* ElementAccessExpression */) { + } else if (access.kind === 211 /* ElementAccessExpression */) { if (isIdentifier(access.argumentExpression) || isStringLiteralLike(access.argumentExpression)) { const res = action(access.argumentExpression); if (res !== void 0) { @@ -17576,28 +17688,28 @@ ${lanes.join("\n")} function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 222 /* PostfixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: node = node.operand; continue; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: node = node.left; continue; - case 224 /* ConditionalExpression */: + case 226 /* ConditionalExpression */: node = node.condition; continue; - case 212 /* TaggedTemplateExpression */: + case 214 /* TaggedTemplateExpression */: node = node.tag; continue; - case 210 /* CallExpression */: + case 212 /* CallExpression */: if (stopAtCallExpressions) { return node; } - case 231 /* AsExpression */: - case 209 /* ElementAccessExpression */: - case 208 /* PropertyAccessExpression */: - case 232 /* NonNullExpression */: - case 356 /* PartiallyEmittedExpression */: - case 235 /* SatisfiesExpression */: + case 233 /* AsExpression */: + case 211 /* ElementAccessExpression */: + case 210 /* PropertyAccessExpression */: + case 234 /* NonNullExpression */: + case 359 /* PartiallyEmittedExpression */: + case 237 /* SatisfiesExpression */: node = node.expression; continue; } @@ -17915,8 +18027,7 @@ ${lanes.join("\n")} } } function getEmitScriptTarget(compilerOptions) { - var _a2; - return (_a2 = compilerOptions.target) != null ? _a2 : compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */; + return compilerOptions.target ?? (compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */); } function getEmitModuleKind(compilerOptions) { return typeof compilerOptions.module === "number" ? compilerOptions.module : getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */ ? 5 /* ES2015 */ : 1 /* CommonJS */; @@ -18114,11 +18225,11 @@ ${lanes.join("\n")} } }, setSymlinksFromResolutions(files, typeReferenceDirectives) { - var _a2, _b; + var _a, _b; Debug.assert(!hasProcessedResolutions); hasProcessedResolutions = true; for (const file of files) { - (_a2 = file.resolvedModules) == null ? void 0 : _a2.forEach((resolution) => processResolution(this, resolution.resolvedModule)); + (_a = file.resolvedModules) == null ? void 0 : _a.forEach((resolution) => processResolution(this, resolution.resolvedModule)); (_b = file.resolvedTypeReferenceDirectiveNames) == null ? void 0 : _b.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective)); } typeReferenceDirectives.forEach((resolution) => processResolution(this, resolution.resolvedTypeReferenceDirective)); @@ -18387,7 +18498,7 @@ ${lanes.join("\n")} return some(supportedTSExtensionsFlat, (extension) => fileExtensionIs(fileName, extension)); } function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtension, hasTSFileExtension)) { - return firstDefined(imports, ({ text }) => pathIsRelative(text) ? hasExtension2(text) : void 0) || false; + return firstDefined(imports, ({ text }) => pathIsRelative(text) && !fileExtensionIsOneOf(text, extensionsNotSupportingExtensionlessResolution) ? hasExtension2(text) : void 0) || false; } function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) { if (preference === "js" || resolutionMode === 99 /* ESNext */) { @@ -18411,6 +18522,9 @@ ${lanes.join("\n")} const specifiers = sourceFile.imports.length ? sourceFile.imports.map((i) => i.text) : isSourceFileJS(sourceFile) ? getRequiresAtTopOfFile(sourceFile).map((r) => r.arguments[0].text) : emptyArray; for (const specifier of specifiers) { if (pathIsRelative(specifier)) { + if (fileExtensionIsOneOf(specifier, extensionsNotSupportingExtensionlessResolution)) { + continue; + } if (hasTSFileExtension(specifier)) { return 3 /* TsExtension */; } @@ -18665,12 +18779,12 @@ ${lanes.join("\n")} scanner2.setOnError(() => success = false); scanner2.setText(s + "n"); let result = scanner2.scan(); - const negative = result === 40 /* MinusToken */; + const negative = result === 41 /* MinusToken */; if (negative) { result = scanner2.scan(); } const flags = scanner2.getTokenFlags(); - return success && result === 9 /* BigIntLiteral */ && scanner2.getTextPos() === s.length + 1 && !(flags & 512 /* ContainsSeparator */) && (!roundTripOnly || s === pseudoBigIntToString({ negative, base10Value: parsePseudoBigInt(scanner2.getTokenValue()) })); + return success && result === 10 /* BigIntLiteral */ && scanner2.getTokenEnd() === s.length + 1 && !(flags & 512 /* ContainsSeparator */) && (!roundTripOnly || s === pseudoBigIntToString({ negative, base10Value: parsePseudoBigInt(scanner2.getTokenValue()) })); } function isValidTypeOnlyAliasUseSite(useSite) { return !!(useSite.flags & 16777216 /* Ambient */) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite)); @@ -18679,33 +18793,33 @@ ${lanes.join("\n")} return isIdentifier(useSite) && isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { - while (node.kind === 79 /* Identifier */ || node.kind === 208 /* PropertyAccessExpression */) { + while (node.kind === 80 /* Identifier */ || node.kind === 210 /* PropertyAccessExpression */) { node = node.parent; } - if (node.kind !== 164 /* ComputedPropertyName */) { + if (node.kind !== 166 /* ComputedPropertyName */) { return false; } if (hasSyntacticModifier(node.parent, 256 /* Abstract */)) { return true; } const containerKind = node.parent.parent.kind; - return containerKind === 261 /* InterfaceDeclaration */ || containerKind === 184 /* TypeLiteral */; + return containerKind === 263 /* InterfaceDeclaration */ || containerKind === 186 /* TypeLiteral */; } function isIdentifierInNonEmittingHeritageClause(node) { - if (node.kind !== 79 /* Identifier */) + if (node.kind !== 80 /* Identifier */) return false; const heritageClause = findAncestor(node.parent, (parent2) => { switch (parent2.kind) { - case 294 /* HeritageClause */: + case 297 /* HeritageClause */: return true; - case 208 /* PropertyAccessExpression */: - case 230 /* ExpressionWithTypeArguments */: + case 210 /* PropertyAccessExpression */: + case 232 /* ExpressionWithTypeArguments */: return false; default: return "quit"; } }); - return (heritageClause == null ? void 0 : heritageClause.token) === 117 /* ImplementsKeyword */ || (heritageClause == null ? void 0 : heritageClause.parent.kind) === 261 /* InterfaceDeclaration */; + return (heritageClause == null ? void 0 : heritageClause.token) === 119 /* ImplementsKeyword */ || (heritageClause == null ? void 0 : heritageClause.parent.kind) === 263 /* InterfaceDeclaration */; } function isIdentifierTypeReference(node) { return isTypeReferenceNode(node) && isIdentifier(node.typeName); @@ -18801,7 +18915,7 @@ ${lanes.join("\n")} node = parent2; continue; } - if (isBinaryExpression(parent2) && parent2.operatorToken.kind === 27 /* CommaToken */) { + if (isBinaryExpression(parent2) && parent2.operatorToken.kind === 28 /* CommaToken */) { if (node === parent2.left) return true; node = parent2; @@ -18817,20 +18931,20 @@ ${lanes.join("\n")} if (!node.parent) return void 0; switch (node.kind) { - case 165 /* TypeParameter */: + case 167 /* TypeParameter */: const { parent: parent3 } = node; - return parent3.kind === 192 /* InferType */ ? void 0 : parent3.typeParameters; - case 166 /* Parameter */: + return parent3.kind === 194 /* InferType */ ? void 0 : parent3.typeParameters; + case 168 /* Parameter */: return node.parent.parameters; - case 201 /* TemplateLiteralTypeSpan */: + case 203 /* TemplateLiteralTypeSpan */: return node.parent.templateSpans; - case 236 /* TemplateSpan */: + case 238 /* TemplateSpan */: return node.parent.templateSpans; - case 167 /* Decorator */: { + case 169 /* Decorator */: { const { parent: parent4 } = node; return canHaveDecorators(parent4) ? parent4.modifiers : void 0; } - case 294 /* HeritageClause */: + case 297 /* HeritageClause */: return node.parent.heritageClauses; } const { parent: parent2 } = node; @@ -18838,43 +18952,43 @@ ${lanes.join("\n")} return isJSDocTypeLiteral(node.parent) ? void 0 : node.parent.tags; } switch (parent2.kind) { - case 184 /* TypeLiteral */: - case 261 /* InterfaceDeclaration */: + case 186 /* TypeLiteral */: + case 263 /* InterfaceDeclaration */: return isTypeElement(node) ? parent2.members : void 0; - case 189 /* UnionType */: - case 190 /* IntersectionType */: + case 191 /* UnionType */: + case 192 /* IntersectionType */: return parent2.types; - case 186 /* TupleType */: - case 206 /* ArrayLiteralExpression */: - case 357 /* CommaListExpression */: - case 272 /* NamedImports */: - case 276 /* NamedExports */: + case 188 /* TupleType */: + case 208 /* ArrayLiteralExpression */: + case 360 /* CommaListExpression */: + case 274 /* NamedImports */: + case 278 /* NamedExports */: return parent2.elements; - case 207 /* ObjectLiteralExpression */: - case 289 /* JsxAttributes */: + case 209 /* ObjectLiteralExpression */: + case 291 /* JsxAttributes */: return parent2.properties; - case 210 /* CallExpression */: - case 211 /* NewExpression */: + case 212 /* CallExpression */: + case 213 /* NewExpression */: return isTypeNode(node) ? parent2.typeArguments : parent2.expression === node ? void 0 : parent2.arguments; - case 281 /* JsxElement */: - case 285 /* JsxFragment */: + case 283 /* JsxElement */: + case 287 /* JsxFragment */: return isJsxChild(node) ? parent2.children : void 0; - case 283 /* JsxOpeningElement */: - case 282 /* JsxSelfClosingElement */: + case 285 /* JsxOpeningElement */: + case 284 /* JsxSelfClosingElement */: return isTypeNode(node) ? parent2.typeArguments : void 0; - case 238 /* Block */: - case 292 /* CaseClause */: - case 293 /* DefaultClause */: - case 265 /* ModuleBlock */: + case 240 /* Block */: + case 295 /* CaseClause */: + case 296 /* DefaultClause */: + case 267 /* ModuleBlock */: return parent2.statements; - case 266 /* CaseBlock */: + case 268 /* CaseBlock */: return parent2.clauses; - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: return isClassElement(node) ? parent2.members : void 0; - case 263 /* EnumDeclaration */: + case 265 /* EnumDeclaration */: return isEnumMember(node) ? parent2.members : void 0; - case 308 /* SourceFile */: + case 311 /* SourceFile */: return parent2.statements; } } @@ -18883,7 +18997,7 @@ ${lanes.join("\n")} if (some(node.parameters, (p) => !getEffectiveTypeAnnotationNode(p))) { return true; } - if (node.kind !== 216 /* ArrowFunction */) { + if (node.kind !== 218 /* ArrowFunction */) { const parameter = firstOrUndefined(node.parameters); if (!(parameter && parameterIsThisKeyword(parameter))) { return true; @@ -18896,14 +19010,14 @@ ${lanes.join("\n")} return name === "Infinity" || name === "-Infinity" || name === "NaN"; } function isCatchClauseVariableDeclaration(node) { - return node.kind === 257 /* VariableDeclaration */ && node.parent.kind === 295 /* CatchClause */; + return node.kind === 259 /* VariableDeclaration */ && node.parent.kind === 298 /* CatchClause */; } function isParameterOrCatchClauseVariable(symbol) { const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration); return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration)); } function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 215 /* FunctionExpression */ || node.kind === 216 /* ArrowFunction */; + return node.kind === 217 /* FunctionExpression */ || node.kind === 218 /* ArrowFunction */; } function escapeSnippetText(text) { return text.replace(/\$/gm, () => "\\$"); @@ -18965,24 +19079,24 @@ ${lanes.join("\n")} return state > 1 /* NodeModules */ ? { topLevelNodeModulesIndex, topLevelPackageNameIndex, packageRootIndex, fileNameIndex } : void 0; } function getParameterTypeNode(parameter) { - var _a2; - return parameter.kind === 344 /* JSDocParameterTag */ ? (_a2 = parameter.typeExpression) == null ? void 0 : _a2.type : parameter.type; + var _a; + return parameter.kind === 347 /* JSDocParameterTag */ ? (_a = parameter.typeExpression) == null ? void 0 : _a.type : parameter.type; } function isTypeDeclaration(node) { switch (node.kind) { - case 165 /* TypeParameter */: - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 263 /* EnumDeclaration */: - case 349 /* JSDocTypedefTag */: - case 341 /* JSDocCallbackTag */: - case 343 /* JSDocEnumTag */: + case 167 /* TypeParameter */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 265 /* EnumDeclaration */: + case 352 /* JSDocTypedefTag */: + case 344 /* JSDocCallbackTag */: + case 346 /* JSDocEnumTag */: return true; - case 270 /* ImportClause */: + case 272 /* ImportClause */: return node.isTypeOnly; - case 273 /* ImportSpecifier */: - case 278 /* ExportSpecifier */: + case 275 /* ImportSpecifier */: + case 280 /* ExportSpecifier */: return node.parent.parent.isTypeOnly; default: return false; @@ -18996,7 +19110,7 @@ ${lanes.join("\n")} return false; } const { isBracketed, typeExpression } = node; - return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 322 /* JSDocOptionalType */; } function canUsePropertyAccess(name, languageVersion) { if (name.length === 0) { @@ -19006,22 +19120,22 @@ ${lanes.join("\n")} return firstChar === 35 /* hash */ ? name.length > 1 && isIdentifierStart(name.charCodeAt(1), languageVersion) : isIdentifierStart(firstChar, languageVersion); } function hasTabstop(node) { - var _a2; - return ((_a2 = getSnippetElement(node)) == null ? void 0 : _a2.kind) === 0 /* TabStop */; + var _a; + return ((_a = getSnippetElement(node)) == null ? void 0 : _a.kind) === 0 /* TabStop */; } function isJSDocOptionalParameter(node) { return isInJSFile(node) && // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - (node.type && node.type.kind === 319 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(({ isBracketed, typeExpression }) => isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* JSDocOptionalType */)); + (node.type && node.type.kind === 322 /* JSDocOptionalType */ || getJSDocParameterTags(node).some(({ isBracketed, typeExpression }) => isBracketed || !!typeExpression && typeExpression.type.kind === 322 /* JSDocOptionalType */)); } function isOptionalDeclaration(declaration) { switch (declaration.kind) { - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: return !!declaration.questionToken; - case 166 /* Parameter */: + case 168 /* Parameter */: return !!declaration.questionToken || isJSDocOptionalParameter(declaration); - case 351 /* JSDocPropertyTag */: - case 344 /* JSDocParameterTag */: + case 354 /* JSDocPropertyTag */: + case 347 /* JSDocParameterTag */: return isOptionalJSDocPropertyLikeTag(declaration); default: return false; @@ -19029,7 +19143,7 @@ ${lanes.join("\n")} } function isNonNullAccess(node) { const kind = node.kind; - return (kind === 208 /* PropertyAccessExpression */ || kind === 209 /* ElementAccessExpression */) && isNonNullExpression(node.expression); + return (kind === 210 /* PropertyAccessExpression */ || kind === 211 /* ElementAccessExpression */) && isNonNullExpression(node.expression); } function isJSDocSatisfiesExpression(node) { return isInJSFile(node) && isParenthesizedExpression(node) && hasJSDocNodes(node) && !!getJSDocSatisfiesTag(node); @@ -19041,7 +19155,26 @@ ${lanes.join("\n")} const tag = getJSDocSatisfiesTag(node); return tag && tag.typeExpression && tag.typeExpression.type; } - var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashAMDReferencePathRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries; + function getEscapedTextOfJsxAttributeName(node) { + return isIdentifier(node) ? node.escapedText : getEscapedTextOfJsxNamespacedName(node); + } + function getTextOfJsxAttributeName(node) { + return isIdentifier(node) ? idText(node) : getTextOfJsxNamespacedName(node); + } + function isJsxAttributeName(node) { + const kind = node.kind; + return kind === 80 /* Identifier */ || kind === 294 /* JsxNamespacedName */; + } + function getEscapedTextOfJsxNamespacedName(node) { + return `${node.namespace.escapedText}:${idText(node.name)}`; + } + function getTextOfJsxNamespacedName(node) { + return `${idText(node.namespace)}:${idText(node.name)}`; + } + function intrinsicTagNameToString(node) { + return isIdentifier(node) ? idText(node) : getTextOfJsxNamespacedName(node); + } + var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashLibReferenceRegEx, fullTripleSlashAMDReferencePathRegEx, fullTripleSlashAMDModuleRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, extensionsNotSupportingExtensionlessResolution, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries; var init_utilities = __esm({ "src/compiler/utilities.ts"() { "use strict"; @@ -19061,7 +19194,9 @@ ${lanes.join("\n")} })(GetLiteralTextFlags || {}); fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*/; fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*/; + fullTripleSlashLibReferenceRegEx = /^(\/\/\/\s*/; fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; + fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*/; defaultLibReferenceRegEx = /^(\/\/\/\s*/; AssignmentKind = /* @__PURE__ */ ((AssignmentKind2) => { AssignmentKind2[AssignmentKind2["None"] = 0] = "None"; @@ -19198,13 +19333,14 @@ ${lanes.join("\n")} supportedTSExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */], [".cts" /* Cts */, ".d.cts" /* Dcts */], [".mts" /* Mts */, ".d.mts" /* Dmts */]]; supportedTSExtensionsFlat = flatten(supportedTSExtensions); supportedTSExtensionsWithJson = [...supportedTSExtensions, [".json" /* Json */]]; - supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".cts" /* Cts */, ".mts" /* Mts */]; + supportedTSExtensionsForExtractExtension = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */, ".cts" /* Cts */, ".mts" /* Mts */, ".ts" /* Ts */, ".tsx" /* Tsx */]; supportedJSExtensions = [[".js" /* Js */, ".jsx" /* Jsx */], [".mjs" /* Mjs */], [".cjs" /* Cjs */]]; supportedJSExtensionsFlat = flatten(supportedJSExtensions); allSupportedExtensions = [[".ts" /* Ts */, ".tsx" /* Tsx */, ".d.ts" /* Dts */, ".js" /* Js */, ".jsx" /* Jsx */], [".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */], [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */]]; allSupportedExtensionsWithJson = [...allSupportedExtensions, [".json" /* Json */]]; supportedDeclarationExtensions = [".d.ts" /* Dts */, ".d.cts" /* Dcts */, ".d.mts" /* Dmts */]; supportedTSImplementationExtensions = [".ts" /* Ts */, ".cts" /* Cts */, ".mts" /* Mts */, ".tsx" /* Tsx */]; + extensionsNotSupportingExtensionlessResolution = [".mts" /* Mts */, ".d.mts" /* Dmts */, ".mjs" /* Mjs */, ".cts" /* Cts */, ".d.cts" /* Dcts */, ".cjs" /* Cjs */]; ModuleSpecifierEnding = /* @__PURE__ */ ((ModuleSpecifierEnding2) => { ModuleSpecifierEnding2[ModuleSpecifierEnding2["Minimal"] = 0] = "Minimal"; ModuleSpecifierEnding2[ModuleSpecifierEnding2["Index"] = 1] = "Index"; @@ -19347,16 +19483,16 @@ ${lanes.join("\n")} return parenthesizerRule; } function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { - const binaryOperatorPrecedence = getOperatorPrecedence(223 /* BinaryExpression */, binaryOperator); - const binaryOperatorAssociativity = getOperatorAssociativity(223 /* BinaryExpression */, binaryOperator); + const binaryOperatorPrecedence = getOperatorPrecedence(225 /* BinaryExpression */, binaryOperator); + const binaryOperatorAssociativity = getOperatorAssociativity(225 /* BinaryExpression */, binaryOperator); const emittedOperand = skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 216 /* ArrowFunction */ && binaryOperatorPrecedence > 3 /* Assignment */) { + if (!isLeftSideOfBinary && operand.kind === 218 /* ArrowFunction */ && binaryOperatorPrecedence > 3 /* Assignment */) { return true; } const operandPrecedence = getExpressionPrecedence(emittedOperand); switch (compareValues(operandPrecedence, binaryOperatorPrecedence)) { case -1 /* LessThan */: - if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Right */ && operand.kind === 226 /* YieldExpression */) { + if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Right */ && operand.kind === 228 /* YieldExpression */) { return false; } return true; @@ -19370,7 +19506,7 @@ ${lanes.join("\n")} if (operatorHasAssociativeProperty(binaryOperator)) { return false; } - if (binaryOperator === 39 /* PlusToken */) { + if (binaryOperator === 40 /* PlusToken */) { const leftKind = leftOperand ? getLiteralKindOfBinaryPlusOperand(leftOperand) : 0 /* Unknown */; if (isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand(emittedOperand)) { return false; @@ -19383,14 +19519,14 @@ ${lanes.join("\n")} } } function operatorHasAssociativeProperty(binaryOperator) { - return binaryOperator === 41 /* AsteriskToken */ || binaryOperator === 51 /* BarToken */ || binaryOperator === 50 /* AmpersandToken */ || binaryOperator === 52 /* CaretToken */ || binaryOperator === 27 /* CommaToken */; + return binaryOperator === 42 /* AsteriskToken */ || binaryOperator === 52 /* BarToken */ || binaryOperator === 51 /* AmpersandToken */ || binaryOperator === 53 /* CaretToken */ || binaryOperator === 28 /* CommaToken */; } function getLiteralKindOfBinaryPlusOperand(node) { node = skipPartiallyEmittedExpressions(node); if (isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 223 /* BinaryExpression */ && node.operatorToken.kind === 39 /* PlusToken */) { + if (node.kind === 225 /* BinaryExpression */ && node.operatorToken.kind === 40 /* PlusToken */) { if (node.cachedLiteralKind !== void 0) { return node.cachedLiteralKind; } @@ -19403,7 +19539,7 @@ ${lanes.join("\n")} } function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { const skipped = skipPartiallyEmittedExpressions(operand); - if (skipped.kind === 214 /* ParenthesizedExpression */) { + if (skipped.kind === 216 /* ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) ? factory2.createParenthesizedExpression(operand) : operand; @@ -19429,7 +19565,7 @@ ${lanes.join("\n")} return isCommaSequence(expression) ? factory2.createParenthesizedExpression(expression) : expression; } function parenthesizeConditionOfConditionalExpression(condition) { - const conditionalPrecedence = getOperatorPrecedence(224 /* ConditionalExpression */, 57 /* QuestionToken */); + const conditionalPrecedence = getOperatorPrecedence(226 /* ConditionalExpression */, 58 /* QuestionToken */); const emittedCondition = skipPartiallyEmittedExpressions(condition); const conditionPrecedence = getExpressionPrecedence(emittedCondition); if (compareValues(conditionPrecedence, conditionalPrecedence) !== 1 /* GreaterThan */) { @@ -19447,11 +19583,11 @@ ${lanes.join("\n")} if (!needsParens) { switch (getLeftmostExpression( check, - /*stopAtCallExpression*/ + /*stopAtCallExpressions*/ false ).kind) { - case 228 /* ClassExpression */: - case 215 /* FunctionExpression */: + case 230 /* ClassExpression */: + case 217 /* FunctionExpression */: needsParens = true; } } @@ -19464,16 +19600,16 @@ ${lanes.join("\n")} true ); switch (leftmostExpr.kind) { - case 210 /* CallExpression */: + case 212 /* CallExpression */: return factory2.createParenthesizedExpression(expression); - case 211 /* NewExpression */: + case 213 /* NewExpression */: return !leftmostExpr.arguments ? factory2.createParenthesizedExpression(expression) : expression; } return parenthesizeLeftSideOfAccess(expression); } function parenthesizeLeftSideOfAccess(expression, optionalChain) { const emittedExpression = skipPartiallyEmittedExpressions(expression); - if (isLeftHandSideExpression(emittedExpression) && (emittedExpression.kind !== 211 /* NewExpression */ || emittedExpression.arguments) && (optionalChain || !isOptionalChain(emittedExpression))) { + if (isLeftHandSideExpression(emittedExpression) && (emittedExpression.kind !== 213 /* NewExpression */ || emittedExpression.arguments) && (optionalChain || !isOptionalChain(emittedExpression))) { return expression; } return setTextRange(factory2.createParenthesizedExpression(expression), expression); @@ -19491,7 +19627,7 @@ ${lanes.join("\n")} function parenthesizeExpressionForDisallowedComma(expression) { const emittedExpression = skipPartiallyEmittedExpressions(expression); const expressionPrecedence = getExpressionPrecedence(emittedExpression); - const commaPrecedence = getOperatorPrecedence(223 /* BinaryExpression */, 27 /* CommaToken */); + const commaPrecedence = getOperatorPrecedence(225 /* BinaryExpression */, 28 /* CommaToken */); return expressionPrecedence > commaPrecedence ? expression : setTextRange(factory2.createParenthesizedExpression(expression), expression); } function parenthesizeExpressionOfExpressionStatement(expression) { @@ -19499,7 +19635,7 @@ ${lanes.join("\n")} if (isCallExpression(emittedExpression)) { const callee = emittedExpression.expression; const kind = skipPartiallyEmittedExpressions(callee).kind; - if (kind === 215 /* FunctionExpression */ || kind === 216 /* ArrowFunction */) { + if (kind === 217 /* FunctionExpression */ || kind === 218 /* ArrowFunction */) { const updated = factory2.updateCallExpression( emittedExpression, setTextRange(factory2.createParenthesizedExpression(callee), callee), @@ -19514,7 +19650,7 @@ ${lanes.join("\n")} /*stopAtCallExpressions*/ false ).kind; - if (leftmostExpressionKind === 207 /* ObjectLiteralExpression */ || leftmostExpressionKind === 215 /* FunctionExpression */) { + if (leftmostExpressionKind === 209 /* ObjectLiteralExpression */ || leftmostExpressionKind === 217 /* FunctionExpression */) { return setTextRange(factory2.createParenthesizedExpression(expression), expression); } return expression; @@ -19524,31 +19660,31 @@ ${lanes.join("\n")} body, /*stopAtCallExpressions*/ false - ).kind === 207 /* ObjectLiteralExpression */)) { + ).kind === 209 /* ObjectLiteralExpression */)) { return setTextRange(factory2.createParenthesizedExpression(body), body); } return body; } function parenthesizeCheckTypeOfConditionalType(checkType) { switch (checkType.kind) { - case 181 /* FunctionType */: - case 182 /* ConstructorType */: - case 191 /* ConditionalType */: + case 183 /* FunctionType */: + case 184 /* ConstructorType */: + case 193 /* ConditionalType */: return factory2.createParenthesizedType(checkType); } return checkType; } function parenthesizeExtendsTypeOfConditionalType(extendsType) { switch (extendsType.kind) { - case 191 /* ConditionalType */: + case 193 /* ConditionalType */: return factory2.createParenthesizedType(extendsType); } return extendsType; } function parenthesizeConstituentTypeOfUnionType(type) { switch (type.kind) { - case 189 /* UnionType */: - case 190 /* IntersectionType */: + case 191 /* UnionType */: + case 192 /* IntersectionType */: return factory2.createParenthesizedType(type); } return parenthesizeCheckTypeOfConditionalType(type); @@ -19558,8 +19694,8 @@ ${lanes.join("\n")} } function parenthesizeConstituentTypeOfIntersectionType(type) { switch (type.kind) { - case 189 /* UnionType */: - case 190 /* IntersectionType */: + case 191 /* UnionType */: + case 192 /* IntersectionType */: return factory2.createParenthesizedType(type); } return parenthesizeConstituentTypeOfUnionType(type); @@ -19569,23 +19705,23 @@ ${lanes.join("\n")} } function parenthesizeOperandOfTypeOperator(type) { switch (type.kind) { - case 190 /* IntersectionType */: + case 192 /* IntersectionType */: return factory2.createParenthesizedType(type); } return parenthesizeConstituentTypeOfIntersectionType(type); } function parenthesizeOperandOfReadonlyTypeOperator(type) { switch (type.kind) { - case 195 /* TypeOperator */: + case 197 /* TypeOperator */: return factory2.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); } function parenthesizeNonArrayTypeOfPostfixType(type) { switch (type.kind) { - case 192 /* InferType */: - case 195 /* TypeOperator */: - case 183 /* TypeQuery */: + case 194 /* InferType */: + case 197 /* TypeOperator */: + case 185 /* TypeQuery */: return factory2.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -19750,11 +19886,11 @@ ${lanes.join("\n")} } function convertToAssignmentPattern(node) { switch (node.kind) { - case 204 /* ArrayBindingPattern */: - case 206 /* ArrayLiteralExpression */: + case 206 /* ArrayBindingPattern */: + case 208 /* ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 203 /* ObjectBindingPattern */: - case 207 /* ObjectLiteralExpression */: + case 205 /* ObjectBindingPattern */: + case 209 /* ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -20109,40 +20245,40 @@ ${lanes.join("\n")} updateExternalModuleReference, // lazily load factory members for JSDoc types with similar structure get createJSDocAllType() { - return getJSDocPrimaryTypeCreateFunction(315 /* JSDocAllType */); + return getJSDocPrimaryTypeCreateFunction(318 /* JSDocAllType */); }, get createJSDocUnknownType() { - return getJSDocPrimaryTypeCreateFunction(316 /* JSDocUnknownType */); + return getJSDocPrimaryTypeCreateFunction(319 /* JSDocUnknownType */); }, get createJSDocNonNullableType() { - return getJSDocPrePostfixUnaryTypeCreateFunction(318 /* JSDocNonNullableType */); + return getJSDocPrePostfixUnaryTypeCreateFunction(321 /* JSDocNonNullableType */); }, get updateJSDocNonNullableType() { - return getJSDocPrePostfixUnaryTypeUpdateFunction(318 /* JSDocNonNullableType */); + return getJSDocPrePostfixUnaryTypeUpdateFunction(321 /* JSDocNonNullableType */); }, get createJSDocNullableType() { - return getJSDocPrePostfixUnaryTypeCreateFunction(317 /* JSDocNullableType */); + return getJSDocPrePostfixUnaryTypeCreateFunction(320 /* JSDocNullableType */); }, get updateJSDocNullableType() { - return getJSDocPrePostfixUnaryTypeUpdateFunction(317 /* JSDocNullableType */); + return getJSDocPrePostfixUnaryTypeUpdateFunction(320 /* JSDocNullableType */); }, get createJSDocOptionalType() { - return getJSDocUnaryTypeCreateFunction(319 /* JSDocOptionalType */); + return getJSDocUnaryTypeCreateFunction(322 /* JSDocOptionalType */); }, get updateJSDocOptionalType() { - return getJSDocUnaryTypeUpdateFunction(319 /* JSDocOptionalType */); + return getJSDocUnaryTypeUpdateFunction(322 /* JSDocOptionalType */); }, get createJSDocVariadicType() { - return getJSDocUnaryTypeCreateFunction(321 /* JSDocVariadicType */); + return getJSDocUnaryTypeCreateFunction(324 /* JSDocVariadicType */); }, get updateJSDocVariadicType() { - return getJSDocUnaryTypeUpdateFunction(321 /* JSDocVariadicType */); + return getJSDocUnaryTypeUpdateFunction(324 /* JSDocVariadicType */); }, get createJSDocNamepathType() { - return getJSDocUnaryTypeCreateFunction(322 /* JSDocNamepathType */); + return getJSDocUnaryTypeCreateFunction(325 /* JSDocNamepathType */); }, get updateJSDocNamepathType() { - return getJSDocUnaryTypeUpdateFunction(322 /* JSDocNamepathType */); + return getJSDocUnaryTypeUpdateFunction(325 /* JSDocNamepathType */); }, createJSDocFunctionType, updateJSDocFunctionType, @@ -20182,82 +20318,82 @@ ${lanes.join("\n")} updateJSDocLinkPlain, // lazily load factory members for JSDoc tags with similar structure get createJSDocTypeTag() { - return getJSDocTypeLikeTagCreateFunction(347 /* JSDocTypeTag */); + return getJSDocTypeLikeTagCreateFunction(350 /* JSDocTypeTag */); }, get updateJSDocTypeTag() { - return getJSDocTypeLikeTagUpdateFunction(347 /* JSDocTypeTag */); + return getJSDocTypeLikeTagUpdateFunction(350 /* JSDocTypeTag */); }, get createJSDocReturnTag() { - return getJSDocTypeLikeTagCreateFunction(345 /* JSDocReturnTag */); + return getJSDocTypeLikeTagCreateFunction(348 /* JSDocReturnTag */); }, get updateJSDocReturnTag() { - return getJSDocTypeLikeTagUpdateFunction(345 /* JSDocReturnTag */); + return getJSDocTypeLikeTagUpdateFunction(348 /* JSDocReturnTag */); }, get createJSDocThisTag() { - return getJSDocTypeLikeTagCreateFunction(346 /* JSDocThisTag */); + return getJSDocTypeLikeTagCreateFunction(349 /* JSDocThisTag */); }, get updateJSDocThisTag() { - return getJSDocTypeLikeTagUpdateFunction(346 /* JSDocThisTag */); + return getJSDocTypeLikeTagUpdateFunction(349 /* JSDocThisTag */); }, get createJSDocAuthorTag() { - return getJSDocSimpleTagCreateFunction(333 /* JSDocAuthorTag */); + return getJSDocSimpleTagCreateFunction(336 /* JSDocAuthorTag */); }, get updateJSDocAuthorTag() { - return getJSDocSimpleTagUpdateFunction(333 /* JSDocAuthorTag */); + return getJSDocSimpleTagUpdateFunction(336 /* JSDocAuthorTag */); }, get createJSDocClassTag() { - return getJSDocSimpleTagCreateFunction(335 /* JSDocClassTag */); + return getJSDocSimpleTagCreateFunction(338 /* JSDocClassTag */); }, get updateJSDocClassTag() { - return getJSDocSimpleTagUpdateFunction(335 /* JSDocClassTag */); + return getJSDocSimpleTagUpdateFunction(338 /* JSDocClassTag */); }, get createJSDocPublicTag() { - return getJSDocSimpleTagCreateFunction(336 /* JSDocPublicTag */); + return getJSDocSimpleTagCreateFunction(339 /* JSDocPublicTag */); }, get updateJSDocPublicTag() { - return getJSDocSimpleTagUpdateFunction(336 /* JSDocPublicTag */); + return getJSDocSimpleTagUpdateFunction(339 /* JSDocPublicTag */); }, get createJSDocPrivateTag() { - return getJSDocSimpleTagCreateFunction(337 /* JSDocPrivateTag */); + return getJSDocSimpleTagCreateFunction(340 /* JSDocPrivateTag */); }, get updateJSDocPrivateTag() { - return getJSDocSimpleTagUpdateFunction(337 /* JSDocPrivateTag */); + return getJSDocSimpleTagUpdateFunction(340 /* JSDocPrivateTag */); }, get createJSDocProtectedTag() { - return getJSDocSimpleTagCreateFunction(338 /* JSDocProtectedTag */); + return getJSDocSimpleTagCreateFunction(341 /* JSDocProtectedTag */); }, get updateJSDocProtectedTag() { - return getJSDocSimpleTagUpdateFunction(338 /* JSDocProtectedTag */); + return getJSDocSimpleTagUpdateFunction(341 /* JSDocProtectedTag */); }, get createJSDocReadonlyTag() { - return getJSDocSimpleTagCreateFunction(339 /* JSDocReadonlyTag */); + return getJSDocSimpleTagCreateFunction(342 /* JSDocReadonlyTag */); }, get updateJSDocReadonlyTag() { - return getJSDocSimpleTagUpdateFunction(339 /* JSDocReadonlyTag */); + return getJSDocSimpleTagUpdateFunction(342 /* JSDocReadonlyTag */); }, get createJSDocOverrideTag() { - return getJSDocSimpleTagCreateFunction(340 /* JSDocOverrideTag */); + return getJSDocSimpleTagCreateFunction(343 /* JSDocOverrideTag */); }, get updateJSDocOverrideTag() { - return getJSDocSimpleTagUpdateFunction(340 /* JSDocOverrideTag */); + return getJSDocSimpleTagUpdateFunction(343 /* JSDocOverrideTag */); }, get createJSDocDeprecatedTag() { - return getJSDocSimpleTagCreateFunction(334 /* JSDocDeprecatedTag */); + return getJSDocSimpleTagCreateFunction(337 /* JSDocDeprecatedTag */); }, get updateJSDocDeprecatedTag() { - return getJSDocSimpleTagUpdateFunction(334 /* JSDocDeprecatedTag */); + return getJSDocSimpleTagUpdateFunction(337 /* JSDocDeprecatedTag */); }, get createJSDocThrowsTag() { - return getJSDocTypeLikeTagCreateFunction(352 /* JSDocThrowsTag */); + return getJSDocTypeLikeTagCreateFunction(355 /* JSDocThrowsTag */); }, get updateJSDocThrowsTag() { - return getJSDocTypeLikeTagUpdateFunction(352 /* JSDocThrowsTag */); + return getJSDocTypeLikeTagUpdateFunction(355 /* JSDocThrowsTag */); }, get createJSDocSatisfiesTag() { - return getJSDocTypeLikeTagCreateFunction(353 /* JSDocSatisfiesTag */); + return getJSDocTypeLikeTagCreateFunction(356 /* JSDocSatisfiesTag */); }, get updateJSDocSatisfiesTag() { - return getJSDocTypeLikeTagUpdateFunction(353 /* JSDocSatisfiesTag */); + return getJSDocTypeLikeTagUpdateFunction(356 /* JSDocSatisfiesTag */); }, createJSDocEnumTag, updateJSDocEnumTag, @@ -20289,6 +20425,8 @@ ${lanes.join("\n")} updateJsxSpreadAttribute, createJsxExpression, updateJsxExpression, + createJsxNamespacedName, + updateJsxNamespacedName, createCaseClause, updateCaseClause, createDefaultClause, @@ -20323,107 +20461,105 @@ ${lanes.join("\n")} updatePartiallyEmittedExpression, createCommaListExpression, updateCommaListExpression, - createEndOfDeclarationMarker, - createMergeDeclarationMarker, createSyntheticReferenceExpression, updateSyntheticReferenceExpression, cloneNode, // Lazily load factory methods for common operator factories and utilities get createComma() { - return getBinaryCreateFunction(27 /* CommaToken */); + return getBinaryCreateFunction(28 /* CommaToken */); }, get createAssignment() { - return getBinaryCreateFunction(63 /* EqualsToken */); + return getBinaryCreateFunction(64 /* EqualsToken */); }, get createLogicalOr() { - return getBinaryCreateFunction(56 /* BarBarToken */); + return getBinaryCreateFunction(57 /* BarBarToken */); }, get createLogicalAnd() { - return getBinaryCreateFunction(55 /* AmpersandAmpersandToken */); + return getBinaryCreateFunction(56 /* AmpersandAmpersandToken */); }, get createBitwiseOr() { - return getBinaryCreateFunction(51 /* BarToken */); + return getBinaryCreateFunction(52 /* BarToken */); }, get createBitwiseXor() { - return getBinaryCreateFunction(52 /* CaretToken */); + return getBinaryCreateFunction(53 /* CaretToken */); }, get createBitwiseAnd() { - return getBinaryCreateFunction(50 /* AmpersandToken */); + return getBinaryCreateFunction(51 /* AmpersandToken */); }, get createStrictEquality() { - return getBinaryCreateFunction(36 /* EqualsEqualsEqualsToken */); + return getBinaryCreateFunction(37 /* EqualsEqualsEqualsToken */); }, get createStrictInequality() { - return getBinaryCreateFunction(37 /* ExclamationEqualsEqualsToken */); + return getBinaryCreateFunction(38 /* ExclamationEqualsEqualsToken */); }, get createEquality() { - return getBinaryCreateFunction(34 /* EqualsEqualsToken */); + return getBinaryCreateFunction(35 /* EqualsEqualsToken */); }, get createInequality() { - return getBinaryCreateFunction(35 /* ExclamationEqualsToken */); + return getBinaryCreateFunction(36 /* ExclamationEqualsToken */); }, get createLessThan() { - return getBinaryCreateFunction(29 /* LessThanToken */); + return getBinaryCreateFunction(30 /* LessThanToken */); }, get createLessThanEquals() { - return getBinaryCreateFunction(32 /* LessThanEqualsToken */); + return getBinaryCreateFunction(33 /* LessThanEqualsToken */); }, get createGreaterThan() { - return getBinaryCreateFunction(31 /* GreaterThanToken */); + return getBinaryCreateFunction(32 /* GreaterThanToken */); }, get createGreaterThanEquals() { - return getBinaryCreateFunction(33 /* GreaterThanEqualsToken */); + return getBinaryCreateFunction(34 /* GreaterThanEqualsToken */); }, get createLeftShift() { - return getBinaryCreateFunction(47 /* LessThanLessThanToken */); + return getBinaryCreateFunction(48 /* LessThanLessThanToken */); }, get createRightShift() { - return getBinaryCreateFunction(48 /* GreaterThanGreaterThanToken */); + return getBinaryCreateFunction(49 /* GreaterThanGreaterThanToken */); }, get createUnsignedRightShift() { - return getBinaryCreateFunction(49 /* GreaterThanGreaterThanGreaterThanToken */); + return getBinaryCreateFunction(50 /* GreaterThanGreaterThanGreaterThanToken */); }, get createAdd() { - return getBinaryCreateFunction(39 /* PlusToken */); + return getBinaryCreateFunction(40 /* PlusToken */); }, get createSubtract() { - return getBinaryCreateFunction(40 /* MinusToken */); + return getBinaryCreateFunction(41 /* MinusToken */); }, get createMultiply() { - return getBinaryCreateFunction(41 /* AsteriskToken */); + return getBinaryCreateFunction(42 /* AsteriskToken */); }, get createDivide() { - return getBinaryCreateFunction(43 /* SlashToken */); + return getBinaryCreateFunction(44 /* SlashToken */); }, get createModulo() { - return getBinaryCreateFunction(44 /* PercentToken */); + return getBinaryCreateFunction(45 /* PercentToken */); }, get createExponent() { - return getBinaryCreateFunction(42 /* AsteriskAsteriskToken */); + return getBinaryCreateFunction(43 /* AsteriskAsteriskToken */); }, get createPrefixPlus() { - return getPrefixUnaryCreateFunction(39 /* PlusToken */); + return getPrefixUnaryCreateFunction(40 /* PlusToken */); }, get createPrefixMinus() { - return getPrefixUnaryCreateFunction(40 /* MinusToken */); + return getPrefixUnaryCreateFunction(41 /* MinusToken */); }, get createPrefixIncrement() { - return getPrefixUnaryCreateFunction(45 /* PlusPlusToken */); + return getPrefixUnaryCreateFunction(46 /* PlusPlusToken */); }, get createPrefixDecrement() { - return getPrefixUnaryCreateFunction(46 /* MinusMinusToken */); + return getPrefixUnaryCreateFunction(47 /* MinusMinusToken */); }, get createBitwiseNot() { - return getPrefixUnaryCreateFunction(54 /* TildeToken */); + return getPrefixUnaryCreateFunction(55 /* TildeToken */); }, get createLogicalNot() { - return getPrefixUnaryCreateFunction(53 /* ExclamationToken */); + return getPrefixUnaryCreateFunction(54 /* ExclamationToken */); }, get createPostfixIncrement() { - return getPostfixUnaryCreateFunction(45 /* PlusPlusToken */); + return getPostfixUnaryCreateFunction(46 /* PlusPlusToken */); }, get createPostfixDecrement() { - return getPostfixUnaryCreateFunction(46 /* MinusMinusToken */); + return getPostfixUnaryCreateFunction(47 /* MinusMinusToken */); }, // Compound nodes createImmediatelyInvokedFunctionExpression, @@ -20512,7 +20648,7 @@ ${lanes.join("\n")} return update(updated, original); } function createNumericLiteral(value, numericLiteralFlags = 0 /* None */) { - const node = createBaseDeclaration(8 /* NumericLiteral */); + const node = createBaseDeclaration(9 /* NumericLiteral */); node.text = typeof value === "number" ? value + "" : value; node.numericLiteralFlags = numericLiteralFlags; if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */) @@ -20520,13 +20656,13 @@ ${lanes.join("\n")} return node; } function createBigIntLiteral(value) { - const node = createBaseToken(9 /* BigIntLiteral */); + const node = createBaseToken(10 /* BigIntLiteral */); node.text = typeof value === "string" ? value : pseudoBigIntToString(value) + "n"; - node.transformFlags |= 4 /* ContainsESNext */; + node.transformFlags |= 32 /* ContainsES2020 */; return node; } function createBaseStringLiteral(text, isSingleQuote) { - const node = createBaseDeclaration(10 /* StringLiteral */); + const node = createBaseDeclaration(11 /* StringLiteral */); node.text = text; node.singleQuote = isSingleQuote; return node; @@ -20548,41 +20684,41 @@ ${lanes.join("\n")} return node; } function createRegularExpressionLiteral(text) { - const node = createBaseToken(13 /* RegularExpressionLiteral */); + const node = createBaseToken(14 /* RegularExpressionLiteral */); node.text = text; return node; } function createLiteralLikeNode(kind, text) { switch (kind) { - case 8 /* NumericLiteral */: + case 9 /* NumericLiteral */: return createNumericLiteral( text, /*numericLiteralFlags*/ 0 ); - case 9 /* BigIntLiteral */: + case 10 /* BigIntLiteral */: return createBigIntLiteral(text); - case 10 /* StringLiteral */: + case 11 /* StringLiteral */: return createStringLiteral( text, /*isSingleQuote*/ void 0 ); - case 11 /* JsxText */: + case 12 /* JsxText */: return createJsxText( text, /*containsOnlyTriviaWhiteSpaces*/ false ); - case 12 /* JsxTextAllWhiteSpaces */: + case 13 /* JsxTextAllWhiteSpaces */: return createJsxText( text, /*containsOnlyTriviaWhiteSpaces*/ true ); - case 13 /* RegularExpressionLiteral */: + case 14 /* RegularExpressionLiteral */: return createRegularExpressionLiteral(text); - case 14 /* NoSubstitutionTemplateLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: return createTemplateLiteralLikeNode( kind, text, @@ -20594,7 +20730,7 @@ ${lanes.join("\n")} } } function createBaseIdentifier(escapedText) { - const node = baseFactory2.createBaseIdentifierNode(79 /* Identifier */); + const node = baseFactory2.createBaseIdentifierNode(80 /* Identifier */); node.escapedText = escapedText; node.jsDoc = void 0; node.flowNode = void 0; @@ -20616,7 +20752,7 @@ ${lanes.join("\n")} if (originalKeywordKind === void 0 && text) { originalKeywordKind = stringToToken(text); } - if (originalKeywordKind === 79 /* Identifier */) { + if (originalKeywordKind === 80 /* Identifier */) { originalKeywordKind = void 0; } const node = createBaseIdentifier(escapeLeadingUnderscores(text)); @@ -20675,7 +20811,7 @@ ${lanes.join("\n")} return name; } function createBasePrivateIdentifier(escapedText) { - const node = baseFactory2.createBasePrivateIdentifierNode(80 /* PrivateIdentifier */); + const node = baseFactory2.createBasePrivateIdentifierNode(81 /* PrivateIdentifier */); node.escapedText = escapedText; node.transformFlags |= 16777216 /* ContainsClassFields */; return node; @@ -20700,7 +20836,7 @@ ${lanes.join("\n")} if (text && !startsWith(text, "#")) Debug.fail("First character of private identifier must be #: " + text); const autoGenerateFlags = 8 /* ReservedInNestedScopes */ | (text ? 3 /* Unique */ : 1 /* Auto */); - return createBaseGeneratedPrivateIdentifier(text != null ? text : "", autoGenerateFlags, prefix, suffix); + return createBaseGeneratedPrivateIdentifier(text ?? "", autoGenerateFlags, prefix, suffix); } function getGeneratedPrivateNameForNode(node, prefix, suffix) { const text = isMemberName(node) ? formatGeneratedName( @@ -20720,50 +20856,50 @@ ${lanes.join("\n")} return baseFactory2.createBaseTokenNode(kind); } function createToken(token) { - Debug.assert(token >= 0 /* FirstToken */ && token <= 162 /* LastToken */, "Invalid token"); - Debug.assert(token <= 14 /* FirstTemplateToken */ || token >= 17 /* LastTemplateToken */, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); - Debug.assert(token <= 8 /* FirstLiteralToken */ || token >= 14 /* LastLiteralToken */, "Invalid token. Use 'createLiteralLikeNode' to create literals."); - Debug.assert(token !== 79 /* Identifier */, "Invalid token. Use 'createIdentifier' to create identifiers"); + Debug.assert(token >= 0 /* FirstToken */ && token <= 164 /* LastToken */, "Invalid token"); + Debug.assert(token <= 15 /* FirstTemplateToken */ || token >= 18 /* LastTemplateToken */, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); + Debug.assert(token <= 9 /* FirstLiteralToken */ || token >= 15 /* LastLiteralToken */, "Invalid token. Use 'createLiteralLikeNode' to create literals."); + Debug.assert(token !== 80 /* Identifier */, "Invalid token. Use 'createIdentifier' to create identifiers"); const node = createBaseToken(token); let transformFlags = 0 /* None */; switch (token) { - case 132 /* AsyncKeyword */: + case 134 /* AsyncKeyword */: transformFlags = 256 /* ContainsES2017 */ | 128 /* ContainsES2018 */; break; - case 123 /* PublicKeyword */: - case 121 /* PrivateKeyword */: - case 122 /* ProtectedKeyword */: - case 146 /* ReadonlyKeyword */: - case 126 /* AbstractKeyword */: - case 136 /* DeclareKeyword */: - case 85 /* ConstKeyword */: - case 131 /* AnyKeyword */: - case 148 /* NumberKeyword */: - case 160 /* BigIntKeyword */: - case 144 /* NeverKeyword */: - case 149 /* ObjectKeyword */: - case 101 /* InKeyword */: - case 145 /* OutKeyword */: - case 161 /* OverrideKeyword */: - case 152 /* StringKeyword */: - case 134 /* BooleanKeyword */: - case 153 /* SymbolKeyword */: - case 114 /* VoidKeyword */: - case 157 /* UnknownKeyword */: - case 155 /* UndefinedKeyword */: + case 125 /* PublicKeyword */: + case 123 /* PrivateKeyword */: + case 124 /* ProtectedKeyword */: + case 148 /* ReadonlyKeyword */: + case 128 /* AbstractKeyword */: + case 138 /* DeclareKeyword */: + case 87 /* ConstKeyword */: + case 133 /* AnyKeyword */: + case 150 /* NumberKeyword */: + case 162 /* BigIntKeyword */: + case 146 /* NeverKeyword */: + case 151 /* ObjectKeyword */: + case 103 /* InKeyword */: + case 147 /* OutKeyword */: + case 163 /* OverrideKeyword */: + case 154 /* StringKeyword */: + case 136 /* BooleanKeyword */: + case 155 /* SymbolKeyword */: + case 116 /* VoidKeyword */: + case 159 /* UnknownKeyword */: + case 157 /* UndefinedKeyword */: transformFlags = 1 /* ContainsTypeScript */; break; - case 106 /* SuperKeyword */: + case 108 /* SuperKeyword */: transformFlags = 1024 /* ContainsES2015 */ | 134217728 /* ContainsLexicalSuper */; node.flowNode = void 0; break; - case 124 /* StaticKeyword */: + case 126 /* StaticKeyword */: transformFlags = 1024 /* ContainsES2015 */; break; - case 127 /* AccessorKeyword */: + case 129 /* AccessorKeyword */: transformFlags = 16777216 /* ContainsClassFields */; break; - case 108 /* ThisKeyword */: + case 110 /* ThisKeyword */: transformFlags = 16384 /* ContainsLexicalThis */; node.flowNode = void 0; break; @@ -20774,19 +20910,19 @@ ${lanes.join("\n")} return node; } function createSuper() { - return createToken(106 /* SuperKeyword */); + return createToken(108 /* SuperKeyword */); } function createThis() { - return createToken(108 /* ThisKeyword */); + return createToken(110 /* ThisKeyword */); } function createNull() { - return createToken(104 /* NullKeyword */); + return createToken(106 /* NullKeyword */); } function createTrue() { - return createToken(110 /* TrueKeyword */); + return createToken(112 /* TrueKeyword */); } function createFalse() { - return createToken(95 /* FalseKeyword */); + return createToken(97 /* FalseKeyword */); } function createModifier(kind) { return createToken(kind); @@ -20794,39 +20930,39 @@ ${lanes.join("\n")} function createModifiersFromModifierFlags(flags2) { const result = []; if (flags2 & 1 /* Export */) - result.push(createModifier(93 /* ExportKeyword */)); + result.push(createModifier(95 /* ExportKeyword */)); if (flags2 & 2 /* Ambient */) - result.push(createModifier(136 /* DeclareKeyword */)); + result.push(createModifier(138 /* DeclareKeyword */)); if (flags2 & 1024 /* Default */) - result.push(createModifier(88 /* DefaultKeyword */)); + result.push(createModifier(90 /* DefaultKeyword */)); if (flags2 & 2048 /* Const */) - result.push(createModifier(85 /* ConstKeyword */)); + result.push(createModifier(87 /* ConstKeyword */)); if (flags2 & 4 /* Public */) - result.push(createModifier(123 /* PublicKeyword */)); + result.push(createModifier(125 /* PublicKeyword */)); if (flags2 & 8 /* Private */) - result.push(createModifier(121 /* PrivateKeyword */)); + result.push(createModifier(123 /* PrivateKeyword */)); if (flags2 & 16 /* Protected */) - result.push(createModifier(122 /* ProtectedKeyword */)); + result.push(createModifier(124 /* ProtectedKeyword */)); if (flags2 & 256 /* Abstract */) - result.push(createModifier(126 /* AbstractKeyword */)); + result.push(createModifier(128 /* AbstractKeyword */)); if (flags2 & 32 /* Static */) - result.push(createModifier(124 /* StaticKeyword */)); + result.push(createModifier(126 /* StaticKeyword */)); if (flags2 & 16384 /* Override */) - result.push(createModifier(161 /* OverrideKeyword */)); + result.push(createModifier(163 /* OverrideKeyword */)); if (flags2 & 64 /* Readonly */) - result.push(createModifier(146 /* ReadonlyKeyword */)); + result.push(createModifier(148 /* ReadonlyKeyword */)); if (flags2 & 128 /* Accessor */) - result.push(createModifier(127 /* AccessorKeyword */)); + result.push(createModifier(129 /* AccessorKeyword */)); if (flags2 & 512 /* Async */) - result.push(createModifier(132 /* AsyncKeyword */)); + result.push(createModifier(134 /* AsyncKeyword */)); if (flags2 & 32768 /* In */) - result.push(createModifier(101 /* InKeyword */)); + result.push(createModifier(103 /* InKeyword */)); if (flags2 & 65536 /* Out */) - result.push(createModifier(145 /* OutKeyword */)); + result.push(createModifier(147 /* OutKeyword */)); return result.length ? result : void 0; } function createQualifiedName(left, right) { - const node = createBaseNode(163 /* QualifiedName */); + const node = createBaseNode(165 /* QualifiedName */); node.left = left; node.right = asName(right); node.transformFlags |= propagateChildFlags(node.left) | propagateIdentifierNameFlags(node.right); @@ -20837,7 +20973,7 @@ ${lanes.join("\n")} return node.left !== left || node.right !== right ? update(createQualifiedName(left, right), node) : node; } function createComputedPropertyName(expression) { - const node = createBaseNode(164 /* ComputedPropertyName */); + const node = createBaseNode(166 /* ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= propagateChildFlags(node.expression) | 1024 /* ContainsES2015 */ | 131072 /* ContainsComputedPropertyName */; return node; @@ -20846,7 +20982,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createComputedPropertyName(expression), node) : node; } function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { - const node = createBaseDeclaration(165 /* TypeParameter */); + const node = createBaseDeclaration(167 /* TypeParameter */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.constraint = constraint; @@ -20860,8 +20996,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.constraint !== constraint || node.default !== defaultType ? update(createTypeParameterDeclaration(modifiers, name, constraint, defaultType), node) : node; } function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var _a2, _b; - const node = createBaseDeclaration(166 /* Parameter */); + const node = createBaseDeclaration(168 /* Parameter */); node.modifiers = asNodeArray(modifiers); node.dotDotDotToken = dotDotDotToken; node.name = asName(name); @@ -20871,7 +21006,7 @@ ${lanes.join("\n")} if (isThisIdentifier(node.name)) { node.transformFlags = 1 /* ContainsTypeScript */; } else { - node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.dotDotDotToken) | propagateNameFlags(node.name) | propagateChildFlags(node.questionToken) | propagateChildFlags(node.initializer) | (((_a2 = node.questionToken) != null ? _a2 : node.type) ? 1 /* ContainsTypeScript */ : 0 /* None */) | (((_b = node.dotDotDotToken) != null ? _b : node.initializer) ? 1024 /* ContainsES2015 */ : 0 /* None */) | (modifiersToFlags(node.modifiers) & 16476 /* ParameterPropertyModifier */ ? 8192 /* ContainsTypeScriptClassSyntax */ : 0 /* None */); + node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.dotDotDotToken) | propagateNameFlags(node.name) | propagateChildFlags(node.questionToken) | propagateChildFlags(node.initializer) | (node.questionToken ?? node.type ? 1 /* ContainsTypeScript */ : 0 /* None */) | (node.dotDotDotToken ?? node.initializer ? 1024 /* ContainsES2015 */ : 0 /* None */) | (modifiersToFlags(node.modifiers) & 16476 /* ParameterPropertyModifier */ ? 8192 /* ContainsTypeScriptClassSyntax */ : 0 /* None */); } node.jsDoc = void 0; return node; @@ -20880,7 +21015,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.questionToken !== questionToken || node.type !== type || node.initializer !== initializer ? update(createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer), node) : node; } function createDecorator(expression) { - const node = createBaseNode(167 /* Decorator */); + const node = createBaseNode(169 /* Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( expression, /*optionalChain*/ @@ -20893,7 +21028,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createDecorator(expression), node) : node; } function createPropertySignature(modifiers, name, questionToken, type) { - const node = createBaseDeclaration(168 /* PropertySignature */); + const node = createBaseDeclaration(170 /* PropertySignature */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.type = type; @@ -20913,7 +21048,7 @@ ${lanes.join("\n")} return update(updated, original); } function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { - const node = createBaseDeclaration(169 /* PropertyDeclaration */); + const node = createBaseDeclaration(171 /* PropertyDeclaration */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.questionToken = questionOrExclamationToken && isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : void 0; @@ -20929,7 +21064,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.questionToken !== (questionOrExclamationToken !== void 0 && isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : void 0) || node.exclamationToken !== (questionOrExclamationToken !== void 0 && isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : void 0) || node.type !== type || node.initializer !== initializer ? update(createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer), node) : node; } function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { - const node = createBaseDeclaration(170 /* MethodSignature */); + const node = createBaseDeclaration(172 /* MethodSignature */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.questionToken = questionToken; @@ -20947,7 +21082,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.questionToken !== questionToken || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type ? finishUpdateBaseSignatureDeclaration(createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type), node) : node; } function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - const node = createBaseDeclaration(171 /* MethodDeclaration */); + const node = createBaseDeclaration(173 /* MethodDeclaration */); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; node.name = asName(name); @@ -20984,7 +21119,7 @@ ${lanes.join("\n")} return update(updated, original); } function createClassStaticBlockDeclaration(body) { - const node = createBaseDeclaration(172 /* ClassStaticBlockDeclaration */); + const node = createBaseDeclaration(174 /* ClassStaticBlockDeclaration */); node.body = body; node.transformFlags = propagateChildFlags(body) | 16777216 /* ContainsClassFields */; node.modifiers = void 0; @@ -21005,7 +21140,7 @@ ${lanes.join("\n")} return update(updated, original); } function createConstructorDeclaration(modifiers, parameters, body) { - const node = createBaseDeclaration(173 /* Constructor */); + const node = createBaseDeclaration(175 /* Constructor */); node.modifiers = asNodeArray(modifiers); node.parameters = createNodeArray(parameters); node.body = body; @@ -21031,7 +21166,7 @@ ${lanes.join("\n")} return finishUpdateBaseSignatureDeclaration(updated, original); } function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { - const node = createBaseDeclaration(174 /* GetAccessor */); + const node = createBaseDeclaration(176 /* GetAccessor */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.parameters = createNodeArray(parameters); @@ -21062,7 +21197,7 @@ ${lanes.join("\n")} return finishUpdateBaseSignatureDeclaration(updated, original); } function createSetAccessorDeclaration(modifiers, name, parameters, body) { - const node = createBaseDeclaration(175 /* SetAccessor */); + const node = createBaseDeclaration(177 /* SetAccessor */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.parameters = createNodeArray(parameters); @@ -21094,7 +21229,7 @@ ${lanes.join("\n")} return finishUpdateBaseSignatureDeclaration(updated, original); } function createCallSignature(typeParameters, parameters, type) { - const node = createBaseDeclaration(176 /* CallSignature */); + const node = createBaseDeclaration(178 /* CallSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = asNodeArray(parameters); node.type = type; @@ -21109,7 +21244,7 @@ ${lanes.join("\n")} return node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type ? finishUpdateBaseSignatureDeclaration(createCallSignature(typeParameters, parameters, type), node) : node; } function createConstructSignature(typeParameters, parameters, type) { - const node = createBaseDeclaration(177 /* ConstructSignature */); + const node = createBaseDeclaration(179 /* ConstructSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = asNodeArray(parameters); node.type = type; @@ -21124,7 +21259,7 @@ ${lanes.join("\n")} return node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type ? finishUpdateBaseSignatureDeclaration(createConstructSignature(typeParameters, parameters, type), node) : node; } function createIndexSignature(modifiers, parameters, type) { - const node = createBaseDeclaration(178 /* IndexSignature */); + const node = createBaseDeclaration(180 /* IndexSignature */); node.modifiers = asNodeArray(modifiers); node.parameters = asNodeArray(parameters); node.type = type; @@ -21139,7 +21274,7 @@ ${lanes.join("\n")} return node.parameters !== parameters || node.type !== type || node.modifiers !== modifiers ? finishUpdateBaseSignatureDeclaration(createIndexSignature(modifiers, parameters, type), node) : node; } function createTemplateLiteralTypeSpan(type, literal) { - const node = createBaseNode(201 /* TemplateLiteralTypeSpan */); + const node = createBaseNode(203 /* TemplateLiteralTypeSpan */); node.type = type; node.literal = literal; node.transformFlags = 1 /* ContainsTypeScript */; @@ -21152,7 +21287,7 @@ ${lanes.join("\n")} return createToken(kind); } function createTypePredicateNode(assertsModifier, parameterName, type) { - const node = createBaseNode(179 /* TypePredicate */); + const node = createBaseNode(181 /* TypePredicate */); node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; @@ -21163,7 +21298,7 @@ ${lanes.join("\n")} return node.assertsModifier !== assertsModifier || node.parameterName !== parameterName || node.type !== type ? update(createTypePredicateNode(assertsModifier, parameterName, type), node) : node; } function createTypeReferenceNode(typeName, typeArguments) { - const node = createBaseNode(180 /* TypeReference */); + const node = createBaseNode(182 /* TypeReference */); node.typeName = asName(typeName); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); node.transformFlags = 1 /* ContainsTypeScript */; @@ -21173,7 +21308,7 @@ ${lanes.join("\n")} return node.typeName !== typeName || node.typeArguments !== typeArguments ? update(createTypeReferenceNode(typeName, typeArguments), node) : node; } function createFunctionTypeNode(typeParameters, parameters, type) { - const node = createBaseDeclaration(181 /* FunctionType */); + const node = createBaseDeclaration(183 /* FunctionType */); node.typeParameters = asNodeArray(typeParameters); node.parameters = asNodeArray(parameters); node.type = type; @@ -21198,7 +21333,7 @@ ${lanes.join("\n")} return args.length === 4 ? createConstructorTypeNode1(...args) : args.length === 3 ? createConstructorTypeNode2(...args) : Debug.fail("Incorrect number of arguments specified."); } function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { - const node = createBaseDeclaration(182 /* ConstructorType */); + const node = createBaseDeclaration(184 /* ConstructorType */); node.modifiers = asNodeArray(modifiers); node.typeParameters = asNodeArray(typeParameters); node.parameters = asNodeArray(parameters); @@ -21229,7 +21364,7 @@ ${lanes.join("\n")} return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type); } function createTypeQueryNode(exprName, typeArguments) { - const node = createBaseNode(183 /* TypeQuery */); + const node = createBaseNode(185 /* TypeQuery */); node.exprName = exprName; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags = 1 /* ContainsTypeScript */; @@ -21239,7 +21374,7 @@ ${lanes.join("\n")} return node.exprName !== exprName || node.typeArguments !== typeArguments ? update(createTypeQueryNode(exprName, typeArguments), node) : node; } function createTypeLiteralNode(members) { - const node = createBaseDeclaration(184 /* TypeLiteral */); + const node = createBaseDeclaration(186 /* TypeLiteral */); node.members = createNodeArray(members); node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21248,7 +21383,7 @@ ${lanes.join("\n")} return node.members !== members ? update(createTypeLiteralNode(members), node) : node; } function createArrayTypeNode(elementType) { - const node = createBaseNode(185 /* ArrayType */); + const node = createBaseNode(187 /* ArrayType */); node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21257,7 +21392,7 @@ ${lanes.join("\n")} return node.elementType !== elementType ? update(createArrayTypeNode(elementType), node) : node; } function createTupleTypeNode(elements) { - const node = createBaseNode(186 /* TupleType */); + const node = createBaseNode(188 /* TupleType */); node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21266,7 +21401,7 @@ ${lanes.join("\n")} return node.elements !== elements ? update(createTupleTypeNode(elements), node) : node; } function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { - const node = createBaseDeclaration(199 /* NamedTupleMember */); + const node = createBaseDeclaration(201 /* NamedTupleMember */); node.dotDotDotToken = dotDotDotToken; node.name = name; node.questionToken = questionToken; @@ -21279,7 +21414,7 @@ ${lanes.join("\n")} return node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.questionToken !== questionToken || node.type !== type ? update(createNamedTupleMember(dotDotDotToken, name, questionToken, type), node) : node; } function createOptionalTypeNode(type) { - const node = createBaseNode(187 /* OptionalType */); + const node = createBaseNode(189 /* OptionalType */); node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21288,7 +21423,7 @@ ${lanes.join("\n")} return node.type !== type ? update(createOptionalTypeNode(type), node) : node; } function createRestTypeNode(type) { - const node = createBaseNode(188 /* RestType */); + const node = createBaseNode(190 /* RestType */); node.type = type; node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21306,19 +21441,19 @@ ${lanes.join("\n")} return node.types !== types ? update(createUnionOrIntersectionTypeNode(node.kind, types, parenthesize), node) : node; } function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(189 /* UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + return createUnionOrIntersectionTypeNode(191 /* UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } function updateUnionTypeNode(node, types) { return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(190 /* IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + return createUnionOrIntersectionTypeNode(192 /* IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } function updateIntersectionTypeNode(node, types) { return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - const node = createBaseNode(191 /* ConditionalType */); + const node = createBaseNode(193 /* ConditionalType */); node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; @@ -21332,7 +21467,7 @@ ${lanes.join("\n")} return node.checkType !== checkType || node.extendsType !== extendsType || node.trueType !== trueType || node.falseType !== falseType ? update(createConditionalTypeNode(checkType, extendsType, trueType, falseType), node) : node; } function createInferTypeNode(typeParameter) { - const node = createBaseNode(192 /* InferType */); + const node = createBaseNode(194 /* InferType */); node.typeParameter = typeParameter; node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21341,7 +21476,7 @@ ${lanes.join("\n")} return node.typeParameter !== typeParameter ? update(createInferTypeNode(typeParameter), node) : node; } function createTemplateLiteralType(head, templateSpans) { - const node = createBaseNode(200 /* TemplateLiteralType */); + const node = createBaseNode(202 /* TemplateLiteralType */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags = 1 /* ContainsTypeScript */; @@ -21351,7 +21486,7 @@ ${lanes.join("\n")} return node.head !== head || node.templateSpans !== templateSpans ? update(createTemplateLiteralType(head, templateSpans), node) : node; } function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf = false) { - const node = createBaseNode(202 /* ImportType */); + const node = createBaseNode(204 /* ImportType */); node.argument = argument; node.assertions = assertions; node.qualifier = qualifier; @@ -21364,7 +21499,7 @@ ${lanes.join("\n")} return node.argument !== argument || node.assertions !== assertions || node.qualifier !== qualifier || node.typeArguments !== typeArguments || node.isTypeOf !== isTypeOf ? update(createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf), node) : node; } function createParenthesizedType(type) { - const node = createBaseNode(193 /* ParenthesizedType */); + const node = createBaseNode(195 /* ParenthesizedType */); node.type = type; node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21373,14 +21508,14 @@ ${lanes.join("\n")} return node.type !== type ? update(createParenthesizedType(type), node) : node; } function createThisTypeNode() { - const node = createBaseNode(194 /* ThisType */); + const node = createBaseNode(196 /* ThisType */); node.transformFlags = 1 /* ContainsTypeScript */; return node; } function createTypeOperatorNode(operator, type) { - const node = createBaseNode(195 /* TypeOperator */); + const node = createBaseNode(197 /* TypeOperator */); node.operator = operator; - node.type = operator === 146 /* ReadonlyKeyword */ ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); + node.type = operator === 148 /* ReadonlyKeyword */ ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = 1 /* ContainsTypeScript */; return node; } @@ -21388,7 +21523,7 @@ ${lanes.join("\n")} return node.type !== type ? update(createTypeOperatorNode(node.operator, type), node) : node; } function createIndexedAccessTypeNode(objectType, indexType) { - const node = createBaseNode(196 /* IndexedAccessType */); + const node = createBaseNode(198 /* IndexedAccessType */); node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = 1 /* ContainsTypeScript */; @@ -21398,7 +21533,7 @@ ${lanes.join("\n")} return node.objectType !== objectType || node.indexType !== indexType ? update(createIndexedAccessTypeNode(objectType, indexType), node) : node; } function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { - const node = createBaseDeclaration(197 /* MappedType */); + const node = createBaseDeclaration(199 /* MappedType */); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.nameType = nameType; @@ -21414,7 +21549,7 @@ ${lanes.join("\n")} return node.readonlyToken !== readonlyToken || node.typeParameter !== typeParameter || node.nameType !== nameType || node.questionToken !== questionToken || node.type !== type || node.members !== members ? update(createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members), node) : node; } function createLiteralTypeNode(literal) { - const node = createBaseNode(198 /* LiteralType */); + const node = createBaseNode(200 /* LiteralType */); node.literal = literal; node.transformFlags = 1 /* ContainsTypeScript */; return node; @@ -21423,7 +21558,7 @@ ${lanes.join("\n")} return node.literal !== literal ? update(createLiteralTypeNode(literal), node) : node; } function createObjectBindingPattern(elements) { - const node = createBaseNode(203 /* ObjectBindingPattern */); + const node = createBaseNode(205 /* ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | 1024 /* ContainsES2015 */ | 524288 /* ContainsBindingPattern */; if (node.transformFlags & 32768 /* ContainsRestOrSpread */) { @@ -21435,7 +21570,7 @@ ${lanes.join("\n")} return node.elements !== elements ? update(createObjectBindingPattern(elements), node) : node; } function createArrayBindingPattern(elements) { - const node = createBaseNode(204 /* ArrayBindingPattern */); + const node = createBaseNode(206 /* ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | 1024 /* ContainsES2015 */ | 524288 /* ContainsBindingPattern */; return node; @@ -21444,7 +21579,7 @@ ${lanes.join("\n")} return node.elements !== elements ? update(createArrayBindingPattern(elements), node) : node; } function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - const node = createBaseDeclaration(205 /* BindingElement */); + const node = createBaseDeclaration(207 /* BindingElement */); node.dotDotDotToken = dotDotDotToken; node.propertyName = asName(propertyName); node.name = asName(name); @@ -21457,7 +21592,7 @@ ${lanes.join("\n")} return node.propertyName !== propertyName || node.dotDotDotToken !== dotDotDotToken || node.name !== name || node.initializer !== initializer ? update(createBindingElement(dotDotDotToken, propertyName, name, initializer), node) : node; } function createArrayLiteralExpression(elements, multiLine) { - const node = createBaseNode(206 /* ArrayLiteralExpression */); + const node = createBaseNode(208 /* ArrayLiteralExpression */); const lastElement = elements && lastOrUndefined(elements); const elementsArray = createNodeArray(elements, lastElement && isOmittedExpression(lastElement) ? true : void 0); node.elements = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(elementsArray); @@ -21469,7 +21604,7 @@ ${lanes.join("\n")} return node.elements !== elements ? update(createArrayLiteralExpression(elements, node.multiLine), node) : node; } function createObjectLiteralExpression(properties, multiLine) { - const node = createBaseDeclaration(207 /* ObjectLiteralExpression */); + const node = createBaseDeclaration(209 /* ObjectLiteralExpression */); node.properties = createNodeArray(properties); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.properties); @@ -21480,7 +21615,7 @@ ${lanes.join("\n")} return node.properties !== properties ? update(createObjectLiteralExpression(properties, node.multiLine), node) : node; } function createBasePropertyAccessExpression(expression, questionDotToken, name) { - const node = createBaseDeclaration(208 /* PropertyAccessExpression */); + const node = createBaseDeclaration(210 /* PropertyAccessExpression */); node.expression = expression; node.questionDotToken = questionDotToken; node.name = name; @@ -21530,7 +21665,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.questionDotToken !== questionDotToken || node.name !== name ? update(createPropertyAccessChain(expression, questionDotToken, name), node) : node; } function createBaseElementAccessExpression(expression, questionDotToken, argumentExpression) { - const node = createBaseDeclaration(209 /* ElementAccessExpression */); + const node = createBaseDeclaration(211 /* ElementAccessExpression */); node.expression = expression; node.questionDotToken = questionDotToken; node.argumentExpression = argumentExpression; @@ -21580,7 +21715,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.questionDotToken !== questionDotToken || node.argumentExpression !== argumentExpression ? update(createElementAccessChain(expression, questionDotToken, argumentExpression), node) : node; } function createBaseCallExpression(expression, questionDotToken, typeArguments, argumentsArray) { - const node = createBaseDeclaration(210 /* CallExpression */); + const node = createBaseDeclaration(212 /* CallExpression */); node.expression = expression; node.questionDotToken = questionDotToken; node.typeArguments = typeArguments; @@ -21637,7 +21772,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.questionDotToken !== questionDotToken || node.typeArguments !== typeArguments || node.arguments !== argumentsArray ? update(createCallChain(expression, questionDotToken, typeArguments, argumentsArray), node) : node; } function createNewExpression(expression, typeArguments, argumentsArray) { - const node = createBaseDeclaration(211 /* NewExpression */); + const node = createBaseDeclaration(213 /* NewExpression */); node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : void 0; @@ -21651,7 +21786,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.typeArguments !== typeArguments || node.arguments !== argumentsArray ? update(createNewExpression(expression, typeArguments, argumentsArray), node) : node; } function createTaggedTemplateExpression(tag, typeArguments, template) { - const node = createBaseNode(212 /* TaggedTemplateExpression */); + const node = createBaseNode(214 /* TaggedTemplateExpression */); node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess( tag, /*optionalChain*/ @@ -21672,7 +21807,7 @@ ${lanes.join("\n")} return node.tag !== tag || node.typeArguments !== typeArguments || node.template !== template ? update(createTaggedTemplateExpression(tag, typeArguments, template), node) : node; } function createTypeAssertion(type, expression) { - const node = createBaseNode(213 /* TypeAssertionExpression */); + const node = createBaseNode(215 /* TypeAssertionExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; @@ -21682,7 +21817,7 @@ ${lanes.join("\n")} return node.type !== type || node.expression !== expression ? update(createTypeAssertion(type, expression), node) : node; } function createParenthesizedExpression(expression) { - const node = createBaseNode(214 /* ParenthesizedExpression */); + const node = createBaseNode(216 /* ParenthesizedExpression */); node.expression = expression; node.transformFlags = propagateChildFlags(node.expression); node.jsDoc = void 0; @@ -21692,7 +21827,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createParenthesizedExpression(expression), node) : node; } function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - const node = createBaseDeclaration(215 /* FunctionExpression */); + const node = createBaseDeclaration(217 /* FunctionExpression */); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; node.name = asName(name); @@ -21717,12 +21852,12 @@ ${lanes.join("\n")} return node.name !== name || node.modifiers !== modifiers || node.asteriskToken !== asteriskToken || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.body !== body ? finishUpdateBaseSignatureDeclaration(createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) : node; } function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - const node = createBaseDeclaration(216 /* ArrowFunction */); + const node = createBaseDeclaration(218 /* ArrowFunction */); node.modifiers = asNodeArray(modifiers); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; - node.equalsGreaterThanToken = equalsGreaterThanToken != null ? equalsGreaterThanToken : createToken(38 /* EqualsGreaterThanToken */); + node.equalsGreaterThanToken = equalsGreaterThanToken ?? createToken(39 /* EqualsGreaterThanToken */); node.body = parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body); const isAsync = modifiersToFlags(node.modifiers) & 512 /* Async */; node.transformFlags = propagateChildrenFlags(node.modifiers) | propagateChildrenFlags(node.typeParameters) | propagateChildrenFlags(node.parameters) | propagateChildFlags(node.type) | propagateChildFlags(node.equalsGreaterThanToken) | propagateChildFlags(node.body) & ~67108864 /* ContainsPossibleTopLevelAwait */ | (node.typeParameters || node.type ? 1 /* ContainsTypeScript */ : 0 /* None */) | (isAsync ? 256 /* ContainsES2017 */ | 16384 /* ContainsLexicalThis */ : 0 /* None */) | 1024 /* ContainsES2015 */; @@ -21739,7 +21874,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.typeParameters !== typeParameters || node.parameters !== parameters || node.type !== type || node.equalsGreaterThanToken !== equalsGreaterThanToken || node.body !== body ? finishUpdateBaseSignatureDeclaration(createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body), node) : node; } function createDeleteExpression(expression) { - const node = createBaseNode(217 /* DeleteExpression */); + const node = createBaseNode(219 /* DeleteExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -21748,7 +21883,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createDeleteExpression(expression), node) : node; } function createTypeOfExpression(expression) { - const node = createBaseNode(218 /* TypeOfExpression */); + const node = createBaseNode(220 /* TypeOfExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -21757,7 +21892,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createTypeOfExpression(expression), node) : node; } function createVoidExpression(expression) { - const node = createBaseNode(219 /* VoidExpression */); + const node = createBaseNode(221 /* VoidExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -21766,7 +21901,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createVoidExpression(expression), node) : node; } function createAwaitExpression(expression) { - const node = createBaseNode(220 /* AwaitExpression */); + const node = createBaseNode(222 /* AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression) | 256 /* ContainsES2017 */ | 128 /* ContainsES2018 */ | 2097152 /* ContainsAwait */; return node; @@ -21775,11 +21910,11 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createAwaitExpression(expression), node) : node; } function createPrefixUnaryExpression(operator, operand) { - const node = createBaseNode(221 /* PrefixUnaryExpression */); + const node = createBaseNode(223 /* PrefixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); - if ((operator === 45 /* PlusPlusToken */ || operator === 46 /* MinusMinusToken */) && isIdentifier(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand)) { + if ((operator === 46 /* PlusPlusToken */ || operator === 47 /* MinusMinusToken */) && isIdentifier(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand)) { node.transformFlags |= 268435456 /* ContainsUpdateExpressionForIdentifier */; } return node; @@ -21788,7 +21923,7 @@ ${lanes.join("\n")} return node.operand !== operand ? update(createPrefixUnaryExpression(node.operator, operand), node) : node; } function createPostfixUnaryExpression(operand, operator) { - const node = createBaseNode(222 /* PostfixUnaryExpression */); + const node = createBaseNode(224 /* PostfixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -21801,27 +21936,27 @@ ${lanes.join("\n")} return node.operand !== operand ? update(createPostfixUnaryExpression(operand, node.operator), node) : node; } function createBinaryExpression(left, operator, right) { - const node = createBaseDeclaration(223 /* BinaryExpression */); + const node = createBaseDeclaration(225 /* BinaryExpression */); const operatorToken = asToken(operator); const operatorKind = operatorToken.kind; node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); node.operatorToken = operatorToken; node.right = parenthesizerRules().parenthesizeRightSideOfBinary(operatorKind, node.left, right); node.transformFlags |= propagateChildFlags(node.left) | propagateChildFlags(node.operatorToken) | propagateChildFlags(node.right); - if (operatorKind === 60 /* QuestionQuestionToken */) { + if (operatorKind === 61 /* QuestionQuestionToken */) { node.transformFlags |= 32 /* ContainsES2020 */; - } else if (operatorKind === 63 /* EqualsToken */) { + } else if (operatorKind === 64 /* EqualsToken */) { if (isObjectLiteralExpression(node.left)) { node.transformFlags |= 1024 /* ContainsES2015 */ | 128 /* ContainsES2018 */ | 4096 /* ContainsDestructuringAssignment */ | propagateAssignmentPatternFlags(node.left); } else if (isArrayLiteralExpression(node.left)) { node.transformFlags |= 1024 /* ContainsES2015 */ | 4096 /* ContainsDestructuringAssignment */ | propagateAssignmentPatternFlags(node.left); } - } else if (operatorKind === 42 /* AsteriskAsteriskToken */ || operatorKind === 67 /* AsteriskAsteriskEqualsToken */) { + } else if (operatorKind === 43 /* AsteriskAsteriskToken */ || operatorKind === 68 /* AsteriskAsteriskEqualsToken */) { node.transformFlags |= 512 /* ContainsES2016 */; } else if (isLogicalOrCoalescingAssignmentOperator(operatorKind)) { node.transformFlags |= 16 /* ContainsES2021 */; } - if (operatorKind === 101 /* InKeyword */ && isPrivateIdentifier(node.left)) { + if (operatorKind === 103 /* InKeyword */ && isPrivateIdentifier(node.left)) { node.transformFlags |= 536870912 /* ContainsPrivateIdentifierInExpression */; } node.jsDoc = void 0; @@ -21834,11 +21969,11 @@ ${lanes.join("\n")} return node.left !== left || node.operatorToken !== operator || node.right !== right ? update(createBinaryExpression(left, operator, right), node) : node; } function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { - const node = createBaseNode(224 /* ConditionalExpression */); + const node = createBaseNode(226 /* ConditionalExpression */); node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); - node.questionToken = questionToken != null ? questionToken : createToken(57 /* QuestionToken */); + node.questionToken = questionToken ?? createToken(58 /* QuestionToken */); node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); - node.colonToken = colonToken != null ? colonToken : createToken(58 /* ColonToken */); + node.colonToken = colonToken ?? createToken(59 /* ColonToken */); node.whenFalse = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenFalse); node.transformFlags |= propagateChildFlags(node.condition) | propagateChildFlags(node.questionToken) | propagateChildFlags(node.whenTrue) | propagateChildFlags(node.colonToken) | propagateChildFlags(node.whenFalse); return node; @@ -21847,7 +21982,7 @@ ${lanes.join("\n")} return node.condition !== condition || node.questionToken !== questionToken || node.whenTrue !== whenTrue || node.colonToken !== colonToken || node.whenFalse !== whenFalse ? update(createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse), node) : node; } function createTemplateExpression(head, templateSpans) { - const node = createBaseNode(225 /* TemplateExpression */); + const node = createBaseNode(227 /* TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= propagateChildFlags(node.head) | propagateChildrenFlags(node.templateSpans) | 1024 /* ContainsES2015 */; @@ -21857,7 +21992,7 @@ ${lanes.join("\n")} return node.head !== head || node.templateSpans !== templateSpans ? update(createTemplateExpression(head, templateSpans), node) : node; } function checkTemplateLiteralLikeNode(kind, text, rawText, templateFlags = 0 /* None */) { - Debug.assert(!(templateFlags & ~2048 /* TemplateLiteralLikeFlags */), "Unsupported template flags."); + Debug.assert(!(templateFlags & ~7176 /* TemplateLiteralLikeFlags */), "Unsupported template flags."); let cooked = void 0; if (rawText !== void 0 && rawText !== text) { cooked = getCookedText(kind, rawText); @@ -21886,7 +22021,7 @@ ${lanes.join("\n")} const node = createBaseToken(kind); node.text = text; node.rawText = rawText; - node.templateFlags = templateFlags & 2048 /* TemplateLiteralLikeFlags */; + node.templateFlags = templateFlags & 7176 /* TemplateLiteralLikeFlags */; node.transformFlags = getTransformFlagsOfTemplateLiteralLike(node.templateFlags); return node; } @@ -21894,35 +22029,35 @@ ${lanes.join("\n")} const node = createBaseDeclaration(kind); node.text = text; node.rawText = rawText; - node.templateFlags = templateFlags & 2048 /* TemplateLiteralLikeFlags */; + node.templateFlags = templateFlags & 7176 /* TemplateLiteralLikeFlags */; node.transformFlags = getTransformFlagsOfTemplateLiteralLike(node.templateFlags); return node; } function createTemplateLiteralLikeNode(kind, text, rawText, templateFlags) { - if (kind === 14 /* NoSubstitutionTemplateLiteral */) { + if (kind === 15 /* NoSubstitutionTemplateLiteral */) { return createTemplateLiteralLikeDeclaration(kind, text, rawText, templateFlags); } return createTemplateLiteralLikeToken(kind, text, rawText, templateFlags); } function createTemplateHead(text, rawText, templateFlags) { - text = checkTemplateLiteralLikeNode(15 /* TemplateHead */, text, rawText, templateFlags); - return createTemplateLiteralLikeNode(15 /* TemplateHead */, text, rawText, templateFlags); + text = checkTemplateLiteralLikeNode(16 /* TemplateHead */, text, rawText, templateFlags); + return createTemplateLiteralLikeNode(16 /* TemplateHead */, text, rawText, templateFlags); } function createTemplateMiddle(text, rawText, templateFlags) { - text = checkTemplateLiteralLikeNode(15 /* TemplateHead */, text, rawText, templateFlags); - return createTemplateLiteralLikeNode(16 /* TemplateMiddle */, text, rawText, templateFlags); + text = checkTemplateLiteralLikeNode(16 /* TemplateHead */, text, rawText, templateFlags); + return createTemplateLiteralLikeNode(17 /* TemplateMiddle */, text, rawText, templateFlags); } function createTemplateTail(text, rawText, templateFlags) { - text = checkTemplateLiteralLikeNode(15 /* TemplateHead */, text, rawText, templateFlags); - return createTemplateLiteralLikeNode(17 /* TemplateTail */, text, rawText, templateFlags); + text = checkTemplateLiteralLikeNode(16 /* TemplateHead */, text, rawText, templateFlags); + return createTemplateLiteralLikeNode(18 /* TemplateTail */, text, rawText, templateFlags); } function createNoSubstitutionTemplateLiteral(text, rawText, templateFlags) { - text = checkTemplateLiteralLikeNode(15 /* TemplateHead */, text, rawText, templateFlags); - return createTemplateLiteralLikeDeclaration(14 /* NoSubstitutionTemplateLiteral */, text, rawText, templateFlags); + text = checkTemplateLiteralLikeNode(16 /* TemplateHead */, text, rawText, templateFlags); + return createTemplateLiteralLikeDeclaration(15 /* NoSubstitutionTemplateLiteral */, text, rawText, templateFlags); } function createYieldExpression(asteriskToken, expression) { Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); - const node = createBaseNode(226 /* YieldExpression */); + const node = createBaseNode(228 /* YieldExpression */); node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.asteriskToken) | 1024 /* ContainsES2015 */ | 128 /* ContainsES2018 */ | 1048576 /* ContainsYield */; @@ -21932,7 +22067,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.asteriskToken !== asteriskToken ? update(createYieldExpression(asteriskToken, expression), node) : node; } function createSpreadElement(expression) { - const node = createBaseNode(227 /* SpreadElement */); + const node = createBaseNode(229 /* SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | 1024 /* ContainsES2015 */ | 32768 /* ContainsRestOrSpread */; return node; @@ -21941,7 +22076,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createSpreadElement(expression), node) : node; } function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - const node = createBaseDeclaration(228 /* ClassExpression */); + const node = createBaseDeclaration(230 /* ClassExpression */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.typeParameters = asNodeArray(typeParameters); @@ -21955,10 +22090,10 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members ? update(createClassExpression(modifiers, name, typeParameters, heritageClauses, members), node) : node; } function createOmittedExpression() { - return createBaseNode(229 /* OmittedExpression */); + return createBaseNode(231 /* OmittedExpression */); } function createExpressionWithTypeArguments(expression, typeArguments) { - const node = createBaseNode(230 /* ExpressionWithTypeArguments */); + const node = createBaseNode(232 /* ExpressionWithTypeArguments */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( expression, /*optionalChain*/ @@ -21972,7 +22107,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.typeArguments !== typeArguments ? update(createExpressionWithTypeArguments(expression, typeArguments), node) : node; } function createAsExpression(expression, type) { - const node = createBaseNode(231 /* AsExpression */); + const node = createBaseNode(233 /* AsExpression */); node.expression = expression; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; @@ -21982,7 +22117,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.type !== type ? update(createAsExpression(expression, type), node) : node; } function createNonNullExpression(expression) { - const node = createBaseNode(232 /* NonNullExpression */); + const node = createBaseNode(234 /* NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( expression, /*optionalChain*/ @@ -21998,7 +22133,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createNonNullExpression(expression), node) : node; } function createSatisfiesExpression(expression, type) { - const node = createBaseNode(235 /* SatisfiesExpression */); + const node = createBaseNode(237 /* SatisfiesExpression */); node.expression = expression; node.type = type; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.type) | 1 /* ContainsTypeScript */; @@ -22008,7 +22143,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.type !== type ? update(createSatisfiesExpression(expression, type), node) : node; } function createNonNullChain(expression) { - const node = createBaseNode(232 /* NonNullExpression */); + const node = createBaseNode(234 /* NonNullExpression */); node.flags |= 32 /* OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess( expression, @@ -22023,16 +22158,16 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createNonNullChain(expression), node) : node; } function createMetaProperty(keywordToken, name) { - const node = createBaseNode(233 /* MetaProperty */); + const node = createBaseNode(235 /* MetaProperty */); node.keywordToken = keywordToken; node.name = name; node.transformFlags |= propagateChildFlags(node.name); switch (keywordToken) { - case 103 /* NewKeyword */: + case 105 /* NewKeyword */: node.transformFlags |= 1024 /* ContainsES2015 */; break; - case 100 /* ImportKeyword */: - node.transformFlags |= 4 /* ContainsESNext */; + case 102 /* ImportKeyword */: + node.transformFlags |= 32 /* ContainsES2020 */; break; default: return Debug.assertNever(keywordToken); @@ -22044,7 +22179,7 @@ ${lanes.join("\n")} return node.name !== name ? update(createMetaProperty(node.keywordToken, name), node) : node; } function createTemplateSpan(expression, literal) { - const node = createBaseNode(236 /* TemplateSpan */); + const node = createBaseNode(238 /* TemplateSpan */); node.expression = expression; node.literal = literal; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.literal) | 1024 /* ContainsES2015 */; @@ -22054,12 +22189,12 @@ ${lanes.join("\n")} return node.expression !== expression || node.literal !== literal ? update(createTemplateSpan(expression, literal), node) : node; } function createSemicolonClassElement() { - const node = createBaseNode(237 /* SemicolonClassElement */); + const node = createBaseNode(239 /* SemicolonClassElement */); node.transformFlags |= 1024 /* ContainsES2015 */; return node; } function createBlock(statements, multiLine) { - const node = createBaseNode(238 /* Block */); + const node = createBaseNode(240 /* Block */); node.statements = createNodeArray(statements); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.statements); @@ -22072,7 +22207,7 @@ ${lanes.join("\n")} return node.statements !== statements ? update(createBlock(statements, node.multiLine), node) : node; } function createVariableStatement(modifiers, declarationList) { - const node = createBaseNode(240 /* VariableStatement */); + const node = createBaseNode(242 /* VariableStatement */); node.modifiers = asNodeArray(modifiers); node.declarationList = isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; node.transformFlags |= propagateChildrenFlags(node.modifiers) | propagateChildFlags(node.declarationList); @@ -22087,12 +22222,12 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.declarationList !== declarationList ? update(createVariableStatement(modifiers, declarationList), node) : node; } function createEmptyStatement() { - const node = createBaseNode(239 /* EmptyStatement */); + const node = createBaseNode(241 /* EmptyStatement */); node.jsDoc = void 0; return node; } function createExpressionStatement(expression) { - const node = createBaseNode(241 /* ExpressionStatement */); + const node = createBaseNode(243 /* ExpressionStatement */); node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); node.transformFlags |= propagateChildFlags(node.expression); node.jsDoc = void 0; @@ -22103,7 +22238,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createExpressionStatement(expression), node) : node; } function createIfStatement(expression, thenStatement, elseStatement) { - const node = createBaseNode(242 /* IfStatement */); + const node = createBaseNode(244 /* IfStatement */); node.expression = expression; node.thenStatement = asEmbeddedStatement(thenStatement); node.elseStatement = asEmbeddedStatement(elseStatement); @@ -22116,7 +22251,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.thenStatement !== thenStatement || node.elseStatement !== elseStatement ? update(createIfStatement(expression, thenStatement, elseStatement), node) : node; } function createDoStatement(statement, expression) { - const node = createBaseNode(243 /* DoStatement */); + const node = createBaseNode(245 /* DoStatement */); node.statement = asEmbeddedStatement(statement); node.expression = expression; node.transformFlags |= propagateChildFlags(node.statement) | propagateChildFlags(node.expression); @@ -22128,7 +22263,7 @@ ${lanes.join("\n")} return node.statement !== statement || node.expression !== expression ? update(createDoStatement(statement, expression), node) : node; } function createWhileStatement(expression, statement) { - const node = createBaseNode(244 /* WhileStatement */); + const node = createBaseNode(246 /* WhileStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.statement); @@ -22140,7 +22275,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.statement !== statement ? update(createWhileStatement(expression, statement), node) : node; } function createForStatement(initializer, condition, incrementor, statement) { - const node = createBaseNode(245 /* ForStatement */); + const node = createBaseNode(247 /* ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -22156,7 +22291,7 @@ ${lanes.join("\n")} return node.initializer !== initializer || node.condition !== condition || node.incrementor !== incrementor || node.statement !== statement ? update(createForStatement(initializer, condition, incrementor, statement), node) : node; } function createForInStatement(initializer, expression, statement) { - const node = createBaseNode(246 /* ForInStatement */); + const node = createBaseNode(248 /* ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = asEmbeddedStatement(statement); @@ -22171,7 +22306,7 @@ ${lanes.join("\n")} return node.initializer !== initializer || node.expression !== expression || node.statement !== statement ? update(createForInStatement(initializer, expression, statement), node) : node; } function createForOfStatement(awaitModifier, initializer, expression, statement) { - const node = createBaseNode(247 /* ForOfStatement */); + const node = createBaseNode(249 /* ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); @@ -22189,7 +22324,7 @@ ${lanes.join("\n")} return node.awaitModifier !== awaitModifier || node.initializer !== initializer || node.expression !== expression || node.statement !== statement ? update(createForOfStatement(awaitModifier, initializer, expression, statement), node) : node; } function createContinueStatement(label) { - const node = createBaseNode(248 /* ContinueStatement */); + const node = createBaseNode(250 /* ContinueStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | 4194304 /* ContainsHoistedDeclarationOrCompletion */; node.jsDoc = void 0; @@ -22200,7 +22335,7 @@ ${lanes.join("\n")} return node.label !== label ? update(createContinueStatement(label), node) : node; } function createBreakStatement(label) { - const node = createBaseNode(249 /* BreakStatement */); + const node = createBaseNode(251 /* BreakStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | 4194304 /* ContainsHoistedDeclarationOrCompletion */; node.jsDoc = void 0; @@ -22211,7 +22346,7 @@ ${lanes.join("\n")} return node.label !== label ? update(createBreakStatement(label), node) : node; } function createReturnStatement(expression) { - const node = createBaseNode(250 /* ReturnStatement */); + const node = createBaseNode(252 /* ReturnStatement */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | 128 /* ContainsES2018 */ | 4194304 /* ContainsHoistedDeclarationOrCompletion */; node.jsDoc = void 0; @@ -22222,7 +22357,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createReturnStatement(expression), node) : node; } function createWithStatement(expression, statement) { - const node = createBaseNode(251 /* WithStatement */); + const node = createBaseNode(253 /* WithStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.statement); @@ -22234,7 +22369,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.statement !== statement ? update(createWithStatement(expression, statement), node) : node; } function createSwitchStatement(expression, caseBlock) { - const node = createBaseNode(252 /* SwitchStatement */); + const node = createBaseNode(254 /* SwitchStatement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.caseBlock = caseBlock; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.caseBlock); @@ -22247,7 +22382,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.caseBlock !== caseBlock ? update(createSwitchStatement(expression, caseBlock), node) : node; } function createLabeledStatement(label, statement) { - const node = createBaseNode(253 /* LabeledStatement */); + const node = createBaseNode(255 /* LabeledStatement */); node.label = asName(label); node.statement = asEmbeddedStatement(statement); node.transformFlags |= propagateChildFlags(node.label) | propagateChildFlags(node.statement); @@ -22259,7 +22394,7 @@ ${lanes.join("\n")} return node.label !== label || node.statement !== statement ? update(createLabeledStatement(label, statement), node) : node; } function createThrowStatement(expression) { - const node = createBaseNode(254 /* ThrowStatement */); + const node = createBaseNode(256 /* ThrowStatement */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.jsDoc = void 0; @@ -22270,7 +22405,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createThrowStatement(expression), node) : node; } function createTryStatement(tryBlock, catchClause, finallyBlock) { - const node = createBaseNode(255 /* TryStatement */); + const node = createBaseNode(257 /* TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -22283,19 +22418,18 @@ ${lanes.join("\n")} return node.tryBlock !== tryBlock || node.catchClause !== catchClause || node.finallyBlock !== finallyBlock ? update(createTryStatement(tryBlock, catchClause, finallyBlock), node) : node; } function createDebuggerStatement() { - const node = createBaseNode(256 /* DebuggerStatement */); + const node = createBaseNode(258 /* DebuggerStatement */); node.jsDoc = void 0; node.flowNode = void 0; return node; } function createVariableDeclaration(name, exclamationToken, type, initializer) { - var _a2; - const node = createBaseDeclaration(257 /* VariableDeclaration */); + const node = createBaseDeclaration(259 /* VariableDeclaration */); node.name = asName(name); node.exclamationToken = exclamationToken; node.type = type; node.initializer = asInitializer(initializer); - node.transformFlags |= propagateNameFlags(node.name) | propagateChildFlags(node.initializer) | (((_a2 = node.exclamationToken) != null ? _a2 : node.type) ? 1 /* ContainsTypeScript */ : 0 /* None */); + node.transformFlags |= propagateNameFlags(node.name) | propagateChildFlags(node.initializer) | (node.exclamationToken ?? node.type ? 1 /* ContainsTypeScript */ : 0 /* None */); node.jsDoc = void 0; return node; } @@ -22303,7 +22437,7 @@ ${lanes.join("\n")} return node.name !== name || node.type !== type || node.exclamationToken !== exclamationToken || node.initializer !== initializer ? update(createVariableDeclaration(name, exclamationToken, type, initializer), node) : node; } function createVariableDeclarationList(declarations, flags2 = 0 /* None */) { - const node = createBaseNode(258 /* VariableDeclarationList */); + const node = createBaseNode(260 /* VariableDeclarationList */); node.flags |= flags2 & 3 /* BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= propagateChildrenFlags(node.declarations) | 4194304 /* ContainsHoistedDeclarationOrCompletion */; @@ -22316,7 +22450,7 @@ ${lanes.join("\n")} return node.declarations !== declarations ? update(createVariableDeclarationList(declarations, node.flags), node) : node; } function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - const node = createBaseDeclaration(259 /* FunctionDeclaration */); + const node = createBaseDeclaration(261 /* FunctionDeclaration */); node.modifiers = asNodeArray(modifiers); node.asteriskToken = asteriskToken; node.name = asName(name); @@ -22352,7 +22486,7 @@ ${lanes.join("\n")} return finishUpdateBaseSignatureDeclaration(updated, original); } function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - const node = createBaseDeclaration(260 /* ClassDeclaration */); + const node = createBaseDeclaration(262 /* ClassDeclaration */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.typeParameters = asNodeArray(typeParameters); @@ -22373,7 +22507,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members ? update(createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members), node) : node; } function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - const node = createBaseDeclaration(261 /* InterfaceDeclaration */); + const node = createBaseDeclaration(263 /* InterfaceDeclaration */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.typeParameters = asNodeArray(typeParameters); @@ -22387,7 +22521,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.heritageClauses !== heritageClauses || node.members !== members ? update(createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members), node) : node; } function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { - const node = createBaseDeclaration(262 /* TypeAliasDeclaration */); + const node = createBaseDeclaration(264 /* TypeAliasDeclaration */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.typeParameters = asNodeArray(typeParameters); @@ -22402,7 +22536,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.typeParameters !== typeParameters || node.type !== type ? update(createTypeAliasDeclaration(modifiers, name, typeParameters, type), node) : node; } function createEnumDeclaration(modifiers, name, members) { - const node = createBaseDeclaration(263 /* EnumDeclaration */); + const node = createBaseDeclaration(265 /* EnumDeclaration */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.members = createNodeArray(members); @@ -22415,7 +22549,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.members !== members ? update(createEnumDeclaration(modifiers, name, members), node) : node; } function createModuleDeclaration(modifiers, name, body, flags2 = 0 /* None */) { - const node = createBaseDeclaration(264 /* ModuleDeclaration */); + const node = createBaseDeclaration(266 /* ModuleDeclaration */); node.modifiers = asNodeArray(modifiers); node.flags |= flags2 & (16 /* Namespace */ | 4 /* NestedNamespace */ | 1024 /* GlobalAugmentation */); node.name = name; @@ -22435,7 +22569,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.name !== name || node.body !== body ? update(createModuleDeclaration(modifiers, name, body, node.flags), node) : node; } function createModuleBlock(statements) { - const node = createBaseNode(265 /* ModuleBlock */); + const node = createBaseNode(267 /* ModuleBlock */); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildrenFlags(node.statements); node.jsDoc = void 0; @@ -22445,7 +22579,7 @@ ${lanes.join("\n")} return node.statements !== statements ? update(createModuleBlock(statements), node) : node; } function createCaseBlock(clauses) { - const node = createBaseNode(266 /* CaseBlock */); + const node = createBaseNode(268 /* CaseBlock */); node.clauses = createNodeArray(clauses); node.transformFlags |= propagateChildrenFlags(node.clauses); node.locals = void 0; @@ -22456,7 +22590,7 @@ ${lanes.join("\n")} return node.clauses !== clauses ? update(createCaseBlock(clauses), node) : node; } function createNamespaceExportDeclaration(name) { - const node = createBaseDeclaration(267 /* NamespaceExportDeclaration */); + const node = createBaseDeclaration(269 /* NamespaceExportDeclaration */); node.name = asName(name); node.transformFlags |= propagateIdentifierNameFlags(node.name) | 1 /* ContainsTypeScript */; node.modifiers = void 0; @@ -22473,7 +22607,7 @@ ${lanes.join("\n")} return update(updated, original); } function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { - const node = createBaseDeclaration(268 /* ImportEqualsDeclaration */); + const node = createBaseDeclaration(270 /* ImportEqualsDeclaration */); node.modifiers = asNodeArray(modifiers); node.name = asName(name); node.isTypeOnly = isTypeOnly; @@ -22490,7 +22624,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.isTypeOnly !== isTypeOnly || node.name !== name || node.moduleReference !== moduleReference ? update(createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference), node) : node; } function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { - const node = createBaseNode(269 /* ImportDeclaration */); + const node = createBaseNode(271 /* ImportDeclaration */); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; @@ -22504,7 +22638,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.importClause !== importClause || node.moduleSpecifier !== moduleSpecifier || node.assertClause !== assertClause ? update(createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause), node) : node; } function createImportClause(isTypeOnly, name, namedBindings) { - const node = createBaseDeclaration(270 /* ImportClause */); + const node = createBaseDeclaration(272 /* ImportClause */); node.isTypeOnly = isTypeOnly; node.name = name; node.namedBindings = namedBindings; @@ -22519,7 +22653,7 @@ ${lanes.join("\n")} return node.isTypeOnly !== isTypeOnly || node.name !== name || node.namedBindings !== namedBindings ? update(createImportClause(isTypeOnly, name, namedBindings), node) : node; } function createAssertClause(elements, multiLine) { - const node = createBaseNode(296 /* AssertClause */); + const node = createBaseNode(299 /* AssertClause */); node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= 4 /* ContainsESNext */; @@ -22529,7 +22663,7 @@ ${lanes.join("\n")} return node.elements !== elements || node.multiLine !== multiLine ? update(createAssertClause(elements, multiLine), node) : node; } function createAssertEntry(name, value) { - const node = createBaseNode(297 /* AssertEntry */); + const node = createBaseNode(300 /* AssertEntry */); node.name = name; node.value = value; node.transformFlags |= 4 /* ContainsESNext */; @@ -22539,7 +22673,7 @@ ${lanes.join("\n")} return node.name !== name || node.value !== value ? update(createAssertEntry(name, value), node) : node; } function createImportTypeAssertionContainer(clause, multiLine) { - const node = createBaseNode(298 /* ImportTypeAssertionContainer */); + const node = createBaseNode(301 /* ImportTypeAssertionContainer */); node.assertClause = clause; node.multiLine = multiLine; return node; @@ -22548,7 +22682,7 @@ ${lanes.join("\n")} return node.assertClause !== clause || node.multiLine !== multiLine ? update(createImportTypeAssertionContainer(clause, multiLine), node) : node; } function createNamespaceImport(name) { - const node = createBaseDeclaration(271 /* NamespaceImport */); + const node = createBaseDeclaration(273 /* NamespaceImport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name); node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; @@ -22558,9 +22692,9 @@ ${lanes.join("\n")} return node.name !== name ? update(createNamespaceImport(name), node) : node; } function createNamespaceExport(name) { - const node = createBaseDeclaration(277 /* NamespaceExport */); + const node = createBaseDeclaration(279 /* NamespaceExport */); node.name = name; - node.transformFlags |= propagateChildFlags(node.name) | 4 /* ContainsESNext */; + node.transformFlags |= propagateChildFlags(node.name) | 32 /* ContainsES2020 */; node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; return node; } @@ -22568,7 +22702,7 @@ ${lanes.join("\n")} return node.name !== name ? update(createNamespaceExport(name), node) : node; } function createNamedImports(elements) { - const node = createBaseNode(272 /* NamedImports */); + const node = createBaseNode(274 /* NamedImports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; @@ -22578,7 +22712,7 @@ ${lanes.join("\n")} return node.elements !== elements ? update(createNamedImports(elements), node) : node; } function createImportSpecifier(isTypeOnly, propertyName, name) { - const node = createBaseDeclaration(273 /* ImportSpecifier */); + const node = createBaseDeclaration(275 /* ImportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = propertyName; node.name = name; @@ -22590,11 +22724,11 @@ ${lanes.join("\n")} return node.isTypeOnly !== isTypeOnly || node.propertyName !== propertyName || node.name !== name ? update(createImportSpecifier(isTypeOnly, propertyName, name), node) : node; } function createExportAssignment2(modifiers, isExportEquals, expression) { - const node = createBaseDeclaration(274 /* ExportAssignment */); + const node = createBaseDeclaration(276 /* ExportAssignment */); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = isExportEquals ? parenthesizerRules().parenthesizeRightSideOfBinary( - 63 /* EqualsToken */, + 64 /* EqualsToken */, /*leftSide*/ void 0, expression @@ -22608,7 +22742,7 @@ ${lanes.join("\n")} return node.modifiers !== modifiers || node.expression !== expression ? update(createExportAssignment2(modifiers, node.isExportEquals, expression), node) : node; } function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { - const node = createBaseDeclaration(275 /* ExportDeclaration */); + const node = createBaseDeclaration(277 /* ExportDeclaration */); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; @@ -22631,7 +22765,7 @@ ${lanes.join("\n")} return update(updated, original); } function createNamedExports(elements) { - const node = createBaseNode(276 /* NamedExports */); + const node = createBaseNode(278 /* NamedExports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; @@ -22641,7 +22775,7 @@ ${lanes.join("\n")} return node.elements !== elements ? update(createNamedExports(elements), node) : node; } function createExportSpecifier(isTypeOnly, propertyName, name) { - const node = createBaseNode(278 /* ExportSpecifier */); + const node = createBaseNode(280 /* ExportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = asName(propertyName); node.name = asName(name); @@ -22654,12 +22788,12 @@ ${lanes.join("\n")} return node.isTypeOnly !== isTypeOnly || node.propertyName !== propertyName || node.name !== name ? update(createExportSpecifier(isTypeOnly, propertyName, name), node) : node; } function createMissingDeclaration() { - const node = createBaseDeclaration(279 /* MissingDeclaration */); + const node = createBaseDeclaration(281 /* MissingDeclaration */); node.jsDoc = void 0; return node; } function createExternalModuleReference(expression) { - const node = createBaseNode(280 /* ExternalModuleReference */); + const node = createBaseNode(282 /* ExternalModuleReference */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* ContainsPossibleTopLevelAwait */; @@ -22691,7 +22825,7 @@ ${lanes.join("\n")} return node.type !== type ? update(createJSDocUnaryTypeWorker(kind, type), node) : node; } function createJSDocFunctionType(parameters, type) { - const node = createBaseDeclaration(320 /* JSDocFunctionType */); + const node = createBaseDeclaration(323 /* JSDocFunctionType */); node.parameters = asNodeArray(parameters); node.type = type; node.transformFlags = propagateChildrenFlags(node.parameters) | (node.type ? 1 /* ContainsTypeScript */ : 0 /* None */); @@ -22705,7 +22839,7 @@ ${lanes.join("\n")} return node.parameters !== parameters || node.type !== type ? update(createJSDocFunctionType(parameters, type), node) : node; } function createJSDocTypeLiteral(propertyTags, isArrayType = false) { - const node = createBaseDeclaration(325 /* JSDocTypeLiteral */); + const node = createBaseDeclaration(328 /* JSDocTypeLiteral */); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; return node; @@ -22714,7 +22848,7 @@ ${lanes.join("\n")} return node.jsDocPropertyTags !== propertyTags || node.isArrayType !== isArrayType ? update(createJSDocTypeLiteral(propertyTags, isArrayType), node) : node; } function createJSDocTypeExpression(type) { - const node = createBaseNode(312 /* JSDocTypeExpression */); + const node = createBaseNode(315 /* JSDocTypeExpression */); node.type = type; return node; } @@ -22722,7 +22856,7 @@ ${lanes.join("\n")} return node.type !== type ? update(createJSDocTypeExpression(type), node) : node; } function createJSDocSignature(typeParameters, parameters, type) { - const node = createBaseDeclaration(326 /* JSDocSignature */); + const node = createBaseDeclaration(329 /* JSDocSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; @@ -22751,7 +22885,7 @@ ${lanes.join("\n")} return node; } function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { - const node = createBaseJSDocTag(348 /* JSDocTemplateTag */, tagName != null ? tagName : createIdentifier("template"), comment); + const node = createBaseJSDocTag(351 /* JSDocTemplateTag */, tagName ?? createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); return node; @@ -22760,7 +22894,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.constraint !== constraint || node.typeParameters !== typeParameters || node.comment !== comment ? update(createJSDocTemplateTag(tagName, constraint, typeParameters, comment), node) : node; } function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { - const node = createBaseJSDocTagDeclaration(349 /* JSDocTypedefTag */, tagName != null ? tagName : createIdentifier("typedef"), comment); + const node = createBaseJSDocTagDeclaration(352 /* JSDocTypedefTag */, tagName ?? createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = getJSDocTypeAliasName(fullName); @@ -22772,7 +22906,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName || node.comment !== comment ? update(createJSDocTypedefTag(tagName, typeExpression, fullName, comment), node) : node; } function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - const node = createBaseJSDocTagDeclaration(344 /* JSDocParameterTag */, tagName != null ? tagName : createIdentifier("param"), comment); + const node = createBaseJSDocTagDeclaration(347 /* JSDocParameterTag */, tagName ?? createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -22783,7 +22917,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed || node.typeExpression !== typeExpression || node.isNameFirst !== isNameFirst || node.comment !== comment ? update(createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment), node) : node; } function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - const node = createBaseJSDocTagDeclaration(351 /* JSDocPropertyTag */, tagName != null ? tagName : createIdentifier("prop"), comment); + const node = createBaseJSDocTagDeclaration(354 /* JSDocPropertyTag */, tagName ?? createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -22794,7 +22928,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed || node.typeExpression !== typeExpression || node.isNameFirst !== isNameFirst || node.comment !== comment ? update(createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment), node) : node; } function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { - const node = createBaseJSDocTagDeclaration(341 /* JSDocCallbackTag */, tagName != null ? tagName : createIdentifier("callback"), comment); + const node = createBaseJSDocTagDeclaration(344 /* JSDocCallbackTag */, tagName ?? createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = getJSDocTypeAliasName(fullName); @@ -22806,7 +22940,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName || node.comment !== comment ? update(createJSDocCallbackTag(tagName, typeExpression, fullName, comment), node) : node; } function createJSDocOverloadTag(tagName, typeExpression, comment) { - const node = createBaseJSDocTag(342 /* JSDocOverloadTag */, tagName != null ? tagName : createIdentifier("overload"), comment); + const node = createBaseJSDocTag(345 /* JSDocOverloadTag */, tagName ?? createIdentifier("overload"), comment); node.typeExpression = typeExpression; return node; } @@ -22814,7 +22948,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment ? update(createJSDocOverloadTag(tagName, typeExpression, comment), node) : node; } function createJSDocAugmentsTag(tagName, className, comment) { - const node = createBaseJSDocTag(331 /* JSDocAugmentsTag */, tagName != null ? tagName : createIdentifier("augments"), comment); + const node = createBaseJSDocTag(334 /* JSDocAugmentsTag */, tagName ?? createIdentifier("augments"), comment); node.class = className; return node; } @@ -22822,12 +22956,12 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.class !== className || node.comment !== comment ? update(createJSDocAugmentsTag(tagName, className, comment), node) : node; } function createJSDocImplementsTag(tagName, className, comment) { - const node = createBaseJSDocTag(332 /* JSDocImplementsTag */, tagName != null ? tagName : createIdentifier("implements"), comment); + const node = createBaseJSDocTag(335 /* JSDocImplementsTag */, tagName ?? createIdentifier("implements"), comment); node.class = className; return node; } function createJSDocSeeTag(tagName, name, comment) { - const node = createBaseJSDocTag(350 /* JSDocSeeTag */, tagName != null ? tagName : createIdentifier("see"), comment); + const node = createBaseJSDocTag(353 /* JSDocSeeTag */, tagName ?? createIdentifier("see"), comment); node.name = name; return node; } @@ -22835,7 +22969,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.name !== name || node.comment !== comment ? update(createJSDocSeeTag(tagName, name, comment), node) : node; } function createJSDocNameReference(name) { - const node = createBaseNode(313 /* JSDocNameReference */); + const node = createBaseNode(316 /* JSDocNameReference */); node.name = name; return node; } @@ -22843,7 +22977,7 @@ ${lanes.join("\n")} return node.name !== name ? update(createJSDocNameReference(name), node) : node; } function createJSDocMemberName(left, right) { - const node = createBaseNode(314 /* JSDocMemberName */); + const node = createBaseNode(317 /* JSDocMemberName */); node.left = left; node.right = right; node.transformFlags |= propagateChildFlags(node.left) | propagateChildFlags(node.right); @@ -22853,7 +22987,7 @@ ${lanes.join("\n")} return node.left !== left || node.right !== right ? update(createJSDocMemberName(left, right), node) : node; } function createJSDocLink(name, text) { - const node = createBaseNode(327 /* JSDocLink */); + const node = createBaseNode(330 /* JSDocLink */); node.name = name; node.text = text; return node; @@ -22862,7 +22996,7 @@ ${lanes.join("\n")} return node.name !== name ? update(createJSDocLink(name, text), node) : node; } function createJSDocLinkCode(name, text) { - const node = createBaseNode(328 /* JSDocLinkCode */); + const node = createBaseNode(331 /* JSDocLinkCode */); node.name = name; node.text = text; return node; @@ -22871,7 +23005,7 @@ ${lanes.join("\n")} return node.name !== name ? update(createJSDocLinkCode(name, text), node) : node; } function createJSDocLinkPlain(name, text) { - const node = createBaseNode(329 /* JSDocLinkPlain */); + const node = createBaseNode(332 /* JSDocLinkPlain */); node.name = name; node.text = text; return node; @@ -22883,14 +23017,14 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.class !== className || node.comment !== comment ? update(createJSDocImplementsTag(tagName, className, comment), node) : node; } function createJSDocSimpleTagWorker(kind, tagName, comment) { - const node = createBaseJSDocTag(kind, tagName != null ? tagName : createIdentifier(getDefaultTagNameForKind(kind)), comment); + const node = createBaseJSDocTag(kind, tagName ?? createIdentifier(getDefaultTagNameForKind(kind)), comment); return node; } function updateJSDocSimpleTagWorker(kind, node, tagName = getDefaultTagName(node), comment) { return node.tagName !== tagName || node.comment !== comment ? update(createJSDocSimpleTagWorker(kind, tagName, comment), node) : node; } function createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment) { - const node = createBaseJSDocTag(kind, tagName != null ? tagName : createIdentifier(getDefaultTagNameForKind(kind)), comment); + const node = createBaseJSDocTag(kind, tagName ?? createIdentifier(getDefaultTagNameForKind(kind)), comment); node.typeExpression = typeExpression; return node; } @@ -22898,14 +23032,14 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment ? update(createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment), node) : node; } function createJSDocUnknownTag(tagName, comment) { - const node = createBaseJSDocTag(330 /* JSDocTag */, tagName, comment); + const node = createBaseJSDocTag(333 /* JSDocTag */, tagName, comment); return node; } function updateJSDocUnknownTag(node, tagName, comment) { return node.tagName !== tagName || node.comment !== comment ? update(createJSDocUnknownTag(tagName, comment), node) : node; } function createJSDocEnumTag(tagName, typeExpression, comment) { - const node = createBaseJSDocTagDeclaration(343 /* JSDocEnumTag */, tagName != null ? tagName : createIdentifier(getDefaultTagNameForKind(343 /* JSDocEnumTag */)), comment); + const node = createBaseJSDocTagDeclaration(346 /* JSDocEnumTag */, tagName ?? createIdentifier(getDefaultTagNameForKind(346 /* JSDocEnumTag */)), comment); node.typeExpression = typeExpression; node.locals = void 0; node.nextContainer = void 0; @@ -22915,7 +23049,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment ? update(createJSDocEnumTag(tagName, typeExpression, comment), node) : node; } function createJSDocText(text) { - const node = createBaseNode(324 /* JSDocText */); + const node = createBaseNode(327 /* JSDocText */); node.text = text; return node; } @@ -22923,7 +23057,7 @@ ${lanes.join("\n")} return node.text !== text ? update(createJSDocText(text), node) : node; } function createJSDocComment(comment, tags) { - const node = createBaseNode(323 /* JSDoc */); + const node = createBaseNode(326 /* JSDoc */); node.comment = comment; node.tags = asNodeArray(tags); return node; @@ -22932,7 +23066,7 @@ ${lanes.join("\n")} return node.comment !== comment || node.tags !== tags ? update(createJSDocComment(comment, tags), node) : node; } function createJsxElement(openingElement, children, closingElement) { - const node = createBaseNode(281 /* JsxElement */); + const node = createBaseNode(283 /* JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -22943,7 +23077,7 @@ ${lanes.join("\n")} return node.openingElement !== openingElement || node.children !== children || node.closingElement !== closingElement ? update(createJsxElement(openingElement, children, closingElement), node) : node; } function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - const node = createBaseNode(282 /* JsxSelfClosingElement */); + const node = createBaseNode(284 /* JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -22957,7 +23091,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.typeArguments !== typeArguments || node.attributes !== attributes ? update(createJsxSelfClosingElement(tagName, typeArguments, attributes), node) : node; } function createJsxOpeningElement(tagName, typeArguments, attributes) { - const node = createBaseNode(283 /* JsxOpeningElement */); + const node = createBaseNode(285 /* JsxOpeningElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -22971,7 +23105,7 @@ ${lanes.join("\n")} return node.tagName !== tagName || node.typeArguments !== typeArguments || node.attributes !== attributes ? update(createJsxOpeningElement(tagName, typeArguments, attributes), node) : node; } function createJsxClosingElement(tagName) { - const node = createBaseNode(284 /* JsxClosingElement */); + const node = createBaseNode(286 /* JsxClosingElement */); node.tagName = tagName; node.transformFlags |= propagateChildFlags(node.tagName) | 2 /* ContainsJsx */; return node; @@ -22980,7 +23114,7 @@ ${lanes.join("\n")} return node.tagName !== tagName ? update(createJsxClosingElement(tagName), node) : node; } function createJsxFragment(openingFragment, children, closingFragment) { - const node = createBaseNode(285 /* JsxFragment */); + const node = createBaseNode(287 /* JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -22991,7 +23125,7 @@ ${lanes.join("\n")} return node.openingFragment !== openingFragment || node.children !== children || node.closingFragment !== closingFragment ? update(createJsxFragment(openingFragment, children, closingFragment), node) : node; } function createJsxText(text, containsOnlyTriviaWhiteSpaces) { - const node = createBaseNode(11 /* JsxText */); + const node = createBaseNode(12 /* JsxText */); node.text = text; node.containsOnlyTriviaWhiteSpaces = !!containsOnlyTriviaWhiteSpaces; node.transformFlags |= 2 /* ContainsJsx */; @@ -23001,17 +23135,17 @@ ${lanes.join("\n")} return node.text !== text || node.containsOnlyTriviaWhiteSpaces !== containsOnlyTriviaWhiteSpaces ? update(createJsxText(text, containsOnlyTriviaWhiteSpaces), node) : node; } function createJsxOpeningFragment() { - const node = createBaseNode(286 /* JsxOpeningFragment */); + const node = createBaseNode(288 /* JsxOpeningFragment */); node.transformFlags |= 2 /* ContainsJsx */; return node; } function createJsxJsxClosingFragment() { - const node = createBaseNode(287 /* JsxClosingFragment */); + const node = createBaseNode(289 /* JsxClosingFragment */); node.transformFlags |= 2 /* ContainsJsx */; return node; } function createJsxAttribute(name, initializer) { - const node = createBaseDeclaration(288 /* JsxAttribute */); + const node = createBaseDeclaration(290 /* JsxAttribute */); node.name = name; node.initializer = initializer; node.transformFlags |= propagateChildFlags(node.name) | propagateChildFlags(node.initializer) | 2 /* ContainsJsx */; @@ -23021,7 +23155,7 @@ ${lanes.join("\n")} return node.name !== name || node.initializer !== initializer ? update(createJsxAttribute(name, initializer), node) : node; } function createJsxAttributes(properties) { - const node = createBaseDeclaration(289 /* JsxAttributes */); + const node = createBaseDeclaration(291 /* JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= propagateChildrenFlags(node.properties) | 2 /* ContainsJsx */; return node; @@ -23030,7 +23164,7 @@ ${lanes.join("\n")} return node.properties !== properties ? update(createJsxAttributes(properties), node) : node; } function createJsxSpreadAttribute(expression) { - const node = createBaseNode(290 /* JsxSpreadAttribute */); + const node = createBaseNode(292 /* JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | 2 /* ContainsJsx */; return node; @@ -23039,7 +23173,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createJsxSpreadAttribute(expression), node) : node; } function createJsxExpression(dotDotDotToken, expression) { - const node = createBaseNode(291 /* JsxExpression */); + const node = createBaseNode(293 /* JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; node.transformFlags |= propagateChildFlags(node.dotDotDotToken) | propagateChildFlags(node.expression) | 2 /* ContainsJsx */; @@ -23048,8 +23182,18 @@ ${lanes.join("\n")} function updateJsxExpression(node, expression) { return node.expression !== expression ? update(createJsxExpression(node.dotDotDotToken, expression), node) : node; } + function createJsxNamespacedName(namespace, name) { + const node = createBaseNode(294 /* JsxNamespacedName */); + node.namespace = namespace; + node.name = name; + node.transformFlags |= propagateChildFlags(node.namespace) | propagateChildFlags(node.name) | 2 /* ContainsJsx */; + return node; + } + function updateJsxNamespacedName(node, namespace, name) { + return node.namespace !== namespace || node.name !== name ? update(createJsxNamespacedName(namespace, name), node) : node; + } function createCaseClause(expression, statements) { - const node = createBaseNode(292 /* CaseClause */); + const node = createBaseNode(295 /* CaseClause */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildFlags(node.expression) | propagateChildrenFlags(node.statements); @@ -23060,7 +23204,7 @@ ${lanes.join("\n")} return node.expression !== expression || node.statements !== statements ? update(createCaseClause(expression, statements), node) : node; } function createDefaultClause(statements) { - const node = createBaseNode(293 /* DefaultClause */); + const node = createBaseNode(296 /* DefaultClause */); node.statements = createNodeArray(statements); node.transformFlags = propagateChildrenFlags(node.statements); return node; @@ -23069,15 +23213,15 @@ ${lanes.join("\n")} return node.statements !== statements ? update(createDefaultClause(statements), node) : node; } function createHeritageClause(token, types) { - const node = createBaseNode(294 /* HeritageClause */); + const node = createBaseNode(297 /* HeritageClause */); node.token = token; node.types = createNodeArray(types); node.transformFlags |= propagateChildrenFlags(node.types); switch (token) { - case 94 /* ExtendsKeyword */: + case 96 /* ExtendsKeyword */: node.transformFlags |= 1024 /* ContainsES2015 */; break; - case 117 /* ImplementsKeyword */: + case 119 /* ImplementsKeyword */: node.transformFlags |= 1 /* ContainsTypeScript */; break; default: @@ -23089,7 +23233,7 @@ ${lanes.join("\n")} return node.types !== types ? update(createHeritageClause(node.token, types), node) : node; } function createCatchClause(variableDeclaration, block) { - const node = createBaseNode(295 /* CatchClause */); + const node = createBaseNode(298 /* CatchClause */); node.variableDeclaration = asVariableDeclaration(variableDeclaration); node.block = block; node.transformFlags |= propagateChildFlags(node.variableDeclaration) | propagateChildFlags(node.block) | (!variableDeclaration ? 64 /* ContainsES2019 */ : 0 /* None */); @@ -23101,7 +23245,7 @@ ${lanes.join("\n")} return node.variableDeclaration !== variableDeclaration || node.block !== block ? update(createCatchClause(variableDeclaration, block), node) : node; } function createPropertyAssignment(name, initializer) { - const node = createBaseDeclaration(299 /* PropertyAssignment */); + const node = createBaseDeclaration(302 /* PropertyAssignment */); node.name = asName(name); node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= propagateNameFlags(node.name) | propagateChildFlags(node.initializer); @@ -23123,7 +23267,7 @@ ${lanes.join("\n")} return update(updated, original); } function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - const node = createBaseDeclaration(300 /* ShorthandPropertyAssignment */); + const node = createBaseDeclaration(303 /* ShorthandPropertyAssignment */); node.name = asName(name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= propagateIdentifierNameFlags(node.name) | propagateChildFlags(node.objectAssignmentInitializer) | 1024 /* ContainsES2015 */; @@ -23147,7 +23291,7 @@ ${lanes.join("\n")} return update(updated, original); } function createSpreadAssignment(expression) { - const node = createBaseDeclaration(301 /* SpreadAssignment */); + const node = createBaseDeclaration(304 /* SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | 128 /* ContainsES2018 */ | 65536 /* ContainsObjectRestOrSpread */; node.jsDoc = void 0; @@ -23157,7 +23301,7 @@ ${lanes.join("\n")} return node.expression !== expression ? update(createSpreadAssignment(expression), node) : node; } function createEnumMember(name, initializer) { - const node = createBaseDeclaration(302 /* EnumMember */); + const node = createBaseDeclaration(305 /* EnumMember */); node.name = asName(name); node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= propagateChildFlags(node.name) | propagateChildFlags(node.initializer) | 1 /* ContainsTypeScript */; @@ -23168,7 +23312,7 @@ ${lanes.join("\n")} return node.name !== name || node.initializer !== initializer ? update(createEnumMember(name, initializer), node) : node; } function createSourceFile2(statements, endOfFileToken, flags2) { - const node = baseFactory2.createBaseSourceFileNode(308 /* SourceFile */); + const node = baseFactory2.createBaseSourceFileNode(311 /* SourceFile */); node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags2; @@ -23249,7 +23393,7 @@ ${lanes.join("\n")} return node; } function cloneSourceFileWorker(source) { - const node = baseFactory2.createBaseSourceFileNode(308 /* SourceFile */); + const node = baseFactory2.createBaseSourceFileNode(311 /* SourceFile */); node.flags |= source.flags & ~8 /* Synthesized */; for (const p in source) { if (hasProperty(node, p) || !hasProperty(source, p)) { @@ -23283,7 +23427,7 @@ ${lanes.join("\n")} return node.statements !== statements || node.isDeclarationFile !== isDeclarationFile || node.referencedFiles !== referencedFiles || node.typeReferenceDirectives !== typeReferenceDirectives || node.hasNoDefaultLib !== hasNoDefaultLib || node.libReferenceDirectives !== libReferenceDirectives ? update(cloneSourceFileWithChanges(node, statements, isDeclarationFile, referencedFiles, typeReferenceDirectives, hasNoDefaultLib, libReferenceDirectives), node) : node; } function createBundle(sourceFiles, prepends = emptyArray) { - const node = createBaseNode(309 /* Bundle */); + const node = createBaseNode(312 /* Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; node.syntheticFileReferences = void 0; @@ -23296,7 +23440,7 @@ ${lanes.join("\n")} return node.sourceFiles !== sourceFiles || node.prepends !== prepends ? update(createBundle(sourceFiles, prepends), node) : node; } function createUnparsedSource(prologues, syntheticReferences, texts) { - const node = createBaseNode(310 /* UnparsedSource */); + const node = createBaseNode(313 /* UnparsedSource */); node.prologues = prologues; node.syntheticReferences = syntheticReferences; node.texts = texts; @@ -23313,48 +23457,48 @@ ${lanes.join("\n")} return node; } function createUnparsedPrologue(data) { - return createBaseUnparsedNode(303 /* UnparsedPrologue */, data); + return createBaseUnparsedNode(306 /* UnparsedPrologue */, data); } function createUnparsedPrepend(data, texts) { - const node = createBaseUnparsedNode(304 /* UnparsedPrepend */, data); + const node = createBaseUnparsedNode(307 /* UnparsedPrepend */, data); node.texts = texts; return node; } function createUnparsedTextLike(data, internal) { - return createBaseUnparsedNode(internal ? 306 /* UnparsedInternalText */ : 305 /* UnparsedText */, data); + return createBaseUnparsedNode(internal ? 309 /* UnparsedInternalText */ : 308 /* UnparsedText */, data); } function createUnparsedSyntheticReference(section) { - const node = createBaseNode(307 /* UnparsedSyntheticReference */); + const node = createBaseNode(310 /* UnparsedSyntheticReference */); node.data = section.data; node.section = section; return node; } function createInputFiles2() { - const node = createBaseNode(311 /* InputFiles */); + const node = createBaseNode(314 /* InputFiles */); node.javascriptText = ""; node.declarationText = ""; return node; } function createSyntheticExpression(type, isSpread = false, tupleNameSource) { - const node = createBaseNode(234 /* SyntheticExpression */); + const node = createBaseNode(236 /* SyntheticExpression */); node.type = type; node.isSpread = isSpread; node.tupleNameSource = tupleNameSource; return node; } function createSyntaxList3(children) { - const node = createBaseNode(354 /* SyntaxList */); + const node = createBaseNode(357 /* SyntaxList */); node._children = children; return node; } function createNotEmittedStatement(original) { - const node = createBaseNode(355 /* NotEmittedStatement */); + const node = createBaseNode(358 /* NotEmittedStatement */); node.original = original; setTextRange(node, original); return node; } function createPartiallyEmittedExpression(expression, original) { - const node = createBaseNode(356 /* PartiallyEmittedExpression */); + const node = createBaseNode(359 /* PartiallyEmittedExpression */); node.expression = expression; node.original = original; node.transformFlags |= propagateChildFlags(node.expression) | 1 /* ContainsTypeScript */; @@ -23376,7 +23520,7 @@ ${lanes.join("\n")} return node; } function createCommaListExpression(elements) { - const node = createBaseNode(357 /* CommaListExpression */); + const node = createBaseNode(360 /* CommaListExpression */); node.elements = createNodeArray(sameFlatMap(elements, flattenCommaElements)); node.transformFlags |= propagateChildrenFlags(node.elements); return node; @@ -23384,20 +23528,8 @@ ${lanes.join("\n")} function updateCommaListExpression(node, elements) { return node.elements !== elements ? update(createCommaListExpression(elements), node) : node; } - function createEndOfDeclarationMarker(original) { - const node = createBaseNode(359 /* EndOfDeclarationMarker */); - node.emitNode = {}; - node.original = original; - return node; - } - function createMergeDeclarationMarker(original) { - const node = createBaseNode(358 /* MergeDeclarationMarker */); - node.emitNode = {}; - node.original = original; - return node; - } function createSyntheticReferenceExpression(expression, thisArg) { - const node = createBaseNode(360 /* SyntheticReferenceExpression */); + const node = createBaseNode(361 /* SyntheticReferenceExpression */); node.expression = expression; node.thisArg = thisArg; node.transformFlags |= propagateChildFlags(node.expression) | propagateChildFlags(node.thisArg); @@ -23630,17 +23762,17 @@ ${lanes.join("\n")} } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); - case 213 /* TypeAssertionExpression */: + case 215 /* TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 231 /* AsExpression */: + case 233 /* AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); - case 235 /* SatisfiesExpression */: + case 237 /* SatisfiesExpression */: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); - case 232 /* NonNullExpression */: + case 234 /* NonNullExpression */: return updateNonNullExpression(outerExpression, expression); - case 356 /* PartiallyEmittedExpression */: + case 359 /* PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); } } @@ -23673,20 +23805,20 @@ ${lanes.join("\n")} function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { const target = skipParentheses(node); switch (target.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return cacheIdentifiers; - case 108 /* ThisKeyword */: - case 8 /* NumericLiteral */: - case 9 /* BigIntLiteral */: - case 10 /* StringLiteral */: + case 110 /* ThisKeyword */: + case 9 /* NumericLiteral */: + case 10 /* BigIntLiteral */: + case 11 /* StringLiteral */: return false; - case 206 /* ArrayLiteralExpression */: + case 208 /* ArrayLiteralExpression */: const elements = target.elements; if (elements.length === 0) { return false; } return true; - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -23789,8 +23921,8 @@ ${lanes.join("\n")} function inlineExpressions(expressions) { return expressions.length > 10 ? createCommaListExpression(expressions) : reduceLeft(expressions, factory2.createComma); } - function getName(node, allowComments, allowSourceMaps, emitFlags = 0) { - const nodeName = getNameOfDeclaration(node); + function getName(node, allowComments, allowSourceMaps, emitFlags = 0, ignoreAssignedName) { + const nodeName = ignoreAssignedName ? node && getNonAssignedNameOfDeclaration(node) : getNameOfDeclaration(node); if (nodeName && isIdentifier(nodeName) && !isGeneratedIdentifier(nodeName)) { const name = setParent(setTextRange(cloneNode(nodeName), nodeName), nodeName.parent); emitFlags |= getEmitFlags(nodeName); @@ -23807,8 +23939,8 @@ ${lanes.join("\n")} function getInternalName(node, allowComments, allowSourceMaps) { return getName(node, allowComments, allowSourceMaps, 32768 /* LocalName */ | 65536 /* InternalName */); } - function getLocalName(node, allowComments, allowSourceMaps) { - return getName(node, allowComments, allowSourceMaps, 32768 /* LocalName */); + function getLocalName(node, allowComments, allowSourceMaps, ignoreAssignedName) { + return getName(node, allowComments, allowSourceMaps, 32768 /* LocalName */, ignoreAssignedName); } function getExportName(node, allowComments, allowSourceMaps) { return getName(node, allowComments, allowSourceMaps, 16384 /* ExportName */); @@ -23941,14 +24073,13 @@ ${lanes.join("\n")} return statements; } function updateModifiers(node, modifiers) { - var _a2; let modifierArray; if (typeof modifiers === "number") { modifierArray = createModifiersFromModifierFlags(modifiers); } else { modifierArray = modifiers; } - return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, (_a2 = node.questionToken) != null ? _a2 : node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause) : isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) : Debug.assertNever(node); + return isTypeParameterDeclaration(node) ? updateTypeParameterDeclaration(node, modifierArray, node.name, node.constraint, node.default) : isParameter(node) ? updateParameterDeclaration(node, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) : isConstructorTypeNode(node) ? updateConstructorTypeNode1(node, modifierArray, node.typeParameters, node.parameters, node.type) : isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) : isPropertyDeclaration(node) ? updatePropertyDeclaration2(node, modifierArray, node.name, node.questionToken ?? node.exclamationToken, node.type, node.initializer) : isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) : isMethodDeclaration(node) ? updateMethodDeclaration(node, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) : isConstructorDeclaration(node) ? updateConstructorDeclaration(node, modifierArray, node.parameters, node.body) : isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.type, node.body) : isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, modifierArray, node.name, node.parameters, node.body) : isIndexSignatureDeclaration(node) ? updateIndexSignature(node, modifierArray, node.parameters, node.type) : isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) : isClassExpression(node) ? updateClassExpression(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) : isFunctionDeclaration(node) ? updateFunctionDeclaration(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) : isClassDeclaration(node) ? updateClassDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) : isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, modifierArray, node.name, node.typeParameters, node.type) : isEnumDeclaration(node) ? updateEnumDeclaration(node, modifierArray, node.name, node.members) : isModuleDeclaration(node) ? updateModuleDeclaration(node, modifierArray, node.name, node.body) : isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, modifierArray, node.isTypeOnly, node.name, node.moduleReference) : isImportDeclaration(node) ? updateImportDeclaration(node, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause) : isExportAssignment(node) ? updateExportAssignment(node, modifierArray, node.expression) : isExportDeclaration(node) ? updateExportDeclaration(node, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) : Debug.assertNever(node); } function asNodeArray(array) { return array ? createNodeArray(array) : void 0; @@ -23998,43 +24129,43 @@ ${lanes.join("\n")} } function getDefaultTagNameForKind(kind) { switch (kind) { - case 347 /* JSDocTypeTag */: + case 350 /* JSDocTypeTag */: return "type"; - case 345 /* JSDocReturnTag */: + case 348 /* JSDocReturnTag */: return "returns"; - case 346 /* JSDocThisTag */: + case 349 /* JSDocThisTag */: return "this"; - case 343 /* JSDocEnumTag */: + case 346 /* JSDocEnumTag */: return "enum"; - case 333 /* JSDocAuthorTag */: + case 336 /* JSDocAuthorTag */: return "author"; - case 335 /* JSDocClassTag */: + case 338 /* JSDocClassTag */: return "class"; - case 336 /* JSDocPublicTag */: + case 339 /* JSDocPublicTag */: return "public"; - case 337 /* JSDocPrivateTag */: + case 340 /* JSDocPrivateTag */: return "private"; - case 338 /* JSDocProtectedTag */: + case 341 /* JSDocProtectedTag */: return "protected"; - case 339 /* JSDocReadonlyTag */: + case 342 /* JSDocReadonlyTag */: return "readonly"; - case 340 /* JSDocOverrideTag */: + case 343 /* JSDocOverrideTag */: return "override"; - case 348 /* JSDocTemplateTag */: + case 351 /* JSDocTemplateTag */: return "template"; - case 349 /* JSDocTypedefTag */: + case 352 /* JSDocTypedefTag */: return "typedef"; - case 344 /* JSDocParameterTag */: + case 347 /* JSDocParameterTag */: return "param"; - case 351 /* JSDocPropertyTag */: + case 354 /* JSDocPropertyTag */: return "prop"; - case 341 /* JSDocCallbackTag */: + case 344 /* JSDocCallbackTag */: return "callback"; - case 342 /* JSDocOverloadTag */: + case 345 /* JSDocOverloadTag */: return "overload"; - case 331 /* JSDocAugmentsTag */: + case 334 /* JSDocAugmentsTag */: return "augments"; - case 332 /* JSDocImplementsTag */: + case 335 /* JSDocImplementsTag */: return "implements"; default: return Debug.fail(`Unsupported kind: ${Debug.formatSyntaxKind(kind)}`); @@ -24050,21 +24181,21 @@ ${lanes.join("\n")} ); } switch (kind) { - case 14 /* NoSubstitutionTemplateLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: rawTextScanner.setText("`" + rawText + "`"); break; - case 15 /* TemplateHead */: + case 16 /* TemplateHead */: rawTextScanner.setText("`" + rawText + "${"); break; - case 16 /* TemplateMiddle */: + case 17 /* TemplateMiddle */: rawTextScanner.setText("}" + rawText + "${"); break; - case 17 /* TemplateTail */: + case 18 /* TemplateTail */: rawTextScanner.setText("}" + rawText + "`"); break; } let token = rawTextScanner.scan(); - if (token === 19 /* CloseBraceToken */) { + if (token === 20 /* CloseBraceToken */) { token = rawTextScanner.reScanTemplateToken( /*isTaggedTemplate*/ false @@ -24076,10 +24207,10 @@ ${lanes.join("\n")} } let tokenValue; switch (token) { - case 14 /* NoSubstitutionTemplateLiteral */: - case 15 /* TemplateHead */: - case 16 /* TemplateMiddle */: - case 17 /* TemplateTail */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 16 /* TemplateHead */: + case 17 /* TemplateMiddle */: + case 18 /* TemplateTail */: tokenValue = rawTextScanner.getTokenValue(); break; } @@ -24116,70 +24247,70 @@ ${lanes.join("\n")} children.transformFlags = subtreeFlags; } function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 179 /* FirstTypeNode */ && kind <= 202 /* LastTypeNode */) { + if (kind >= 181 /* FirstTypeNode */ && kind <= 204 /* LastTypeNode */) { return -2 /* TypeExcludes */; } switch (kind) { - case 210 /* CallExpression */: - case 211 /* NewExpression */: - case 206 /* ArrayLiteralExpression */: + case 212 /* CallExpression */: + case 213 /* NewExpression */: + case 208 /* ArrayLiteralExpression */: return -2147450880 /* ArrayLiteralOrCallOrNewExcludes */; - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: return -1941676032 /* ModuleExcludes */; - case 166 /* Parameter */: + case 168 /* Parameter */: return -2147483648 /* ParameterExcludes */; - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: return -2072174592 /* ArrowFunctionExcludes */; - case 215 /* FunctionExpression */: - case 259 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 261 /* FunctionDeclaration */: return -1937940480 /* FunctionExcludes */; - case 258 /* VariableDeclarationList */: + case 260 /* VariableDeclarationList */: return -2146893824 /* VariableDeclarationListExcludes */; - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: return -2147344384 /* ClassExcludes */; - case 173 /* Constructor */: + case 175 /* Constructor */: return -1937948672 /* ConstructorExcludes */; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return -2013249536 /* PropertyExcludes */; - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return -2005057536 /* MethodOrAccessorExcludes */; - case 131 /* AnyKeyword */: - case 148 /* NumberKeyword */: - case 160 /* BigIntKeyword */: - case 144 /* NeverKeyword */: - case 152 /* StringKeyword */: - case 149 /* ObjectKeyword */: - case 134 /* BooleanKeyword */: - case 153 /* SymbolKeyword */: - case 114 /* VoidKeyword */: - case 165 /* TypeParameter */: - case 168 /* PropertySignature */: - case 170 /* MethodSignature */: - case 176 /* CallSignature */: - case 177 /* ConstructSignature */: - case 178 /* IndexSignature */: - case 261 /* InterfaceDeclaration */: - case 262 /* TypeAliasDeclaration */: + case 133 /* AnyKeyword */: + case 150 /* NumberKeyword */: + case 162 /* BigIntKeyword */: + case 146 /* NeverKeyword */: + case 154 /* StringKeyword */: + case 151 /* ObjectKeyword */: + case 136 /* BooleanKeyword */: + case 155 /* SymbolKeyword */: + case 116 /* VoidKeyword */: + case 167 /* TypeParameter */: + case 170 /* PropertySignature */: + case 172 /* MethodSignature */: + case 178 /* CallSignature */: + case 179 /* ConstructSignature */: + case 180 /* IndexSignature */: + case 263 /* InterfaceDeclaration */: + case 264 /* TypeAliasDeclaration */: return -2 /* TypeExcludes */; - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return -2147278848 /* ObjectLiteralExcludes */; - case 295 /* CatchClause */: + case 298 /* CatchClause */: return -2147418112 /* CatchClauseExcludes */; - case 203 /* ObjectBindingPattern */: - case 204 /* ArrayBindingPattern */: + case 205 /* ObjectBindingPattern */: + case 206 /* ArrayBindingPattern */: return -2147450880 /* BindingPatternExcludes */; - case 213 /* TypeAssertionExpression */: - case 235 /* SatisfiesExpression */: - case 231 /* AsExpression */: - case 356 /* PartiallyEmittedExpression */: - case 214 /* ParenthesizedExpression */: - case 106 /* SuperKeyword */: + case 215 /* TypeAssertionExpression */: + case 237 /* SatisfiesExpression */: + case 233 /* AsExpression */: + case 359 /* PartiallyEmittedExpression */: + case 216 /* ParenthesizedExpression */: + case 108 /* SuperKeyword */: return -2147483648 /* OuterExpressionExcludes */; - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: return -2147483648 /* PropertyAccessExcludes */; default: return -2147483648 /* NodeExcludes */; @@ -24229,7 +24360,7 @@ ${lanes.join("\n")} Object.defineProperty(node, "sourceMapText", { get: getSourceMapText }); } else { Debug.assert(!oldFileOfCurrentEmit); - node.text = text != null ? text : ""; + node.text = text ?? ""; node.sourceMapText = sourceMapText; } return node; @@ -24277,7 +24408,7 @@ ${lanes.join("\n")} } } prependChildren = addRange(prependChildren, prependTexts); - texts = append(texts, factory.createUnparsedPrepend(section.data, prependTexts != null ? prependTexts : emptyArray)); + texts = append(texts, factory.createUnparsedPrepend(section.data, prependTexts ?? emptyArray)); break; case "internal" /* Internal */: if (stripInternal) { @@ -24303,7 +24434,7 @@ ${lanes.join("\n")} texts = [textNode]; } const node = parseNodeFactory.createUnparsedSource( - prologues != null ? prologues : emptyArray, + prologues ?? emptyArray, /*syntheticReferences*/ void 0, texts @@ -24343,7 +24474,7 @@ ${lanes.join("\n")} Debug.assertNever(section); } } - const node = factory.createUnparsedSource(emptyArray, syntheticReferences, texts != null ? texts : emptyArray); + const node = factory.createUnparsedSource(emptyArray, syntheticReferences, texts ?? emptyArray); setEachParent(syntheticReferences, node); setEachParent(texts, node); node.helpers = map(bundleFileInfo.sources && bundleFileInfo.sources.helpers, (name) => getAllUnscopedEmitHelpers().get(name)); @@ -24395,13 +24526,12 @@ ${lanes.join("\n")} }; let buildInfo; const getAndCacheBuildInfo = () => { - var _a2, _b; if (buildInfo === void 0 && buildInfoPath) { if (host == null ? void 0 : host.getBuildInfo) { - buildInfo = (_a2 = host.getBuildInfo(buildInfoPath, options.configFilePath)) != null ? _a2 : false; + buildInfo = host.getBuildInfo(buildInfoPath, options.configFilePath) ?? false; } else { const result = textGetter(buildInfoPath); - buildInfo = result !== void 0 ? (_b = getBuildInfo(buildInfoPath, result)) != null ? _b : false : false; + buildInfo = result !== void 0 ? getBuildInfo(buildInfoPath, result) ?? false : false; } } return buildInfo || void 0; @@ -24525,13 +24655,12 @@ ${lanes.join("\n")} // src/compiler/factory/emitNode.ts function getOrCreateEmitNode(node) { - var _a2; if (!node.emitNode) { if (isParseTreeNode(node)) { - if (node.kind === 308 /* SourceFile */) { + if (node.kind === 311 /* SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } - const sourceFile = (_a2 = getSourceFileOfNode(getParseTreeNode(getSourceFileOfNode(node)))) != null ? _a2 : Debug.fail("Could not determine parsed source file."); + const sourceFile = getSourceFileOfNode(getParseTreeNode(getSourceFileOfNode(node))) ?? Debug.fail("Could not determine parsed source file."); getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); } node.emitNode = {}; @@ -24541,8 +24670,8 @@ ${lanes.join("\n")} return node.emitNode; } function disposeEmitNodes(sourceFile) { - var _a2, _b; - const annotatedNodes = (_b = (_a2 = getSourceFileOfNode(getParseTreeNode(sourceFile))) == null ? void 0 : _a2.emitNode) == null ? void 0 : _b.annotatedNodes; + var _a, _b; + const annotatedNodes = (_b = (_a = getSourceFileOfNode(getParseTreeNode(sourceFile))) == null ? void 0 : _a.emitNode) == null ? void 0 : _b.annotatedNodes; if (annotatedNodes) { for (const node of annotatedNodes) { node.emitNode = void 0; @@ -24575,43 +24704,42 @@ ${lanes.join("\n")} return node; } function getSourceMapRange(node) { - var _a2, _b; - return (_b = (_a2 = node.emitNode) == null ? void 0 : _a2.sourceMapRange) != null ? _b : node; + var _a; + return ((_a = node.emitNode) == null ? void 0 : _a.sourceMapRange) ?? node; } function setSourceMapRange(node, range) { getOrCreateEmitNode(node).sourceMapRange = range; return node; } function getTokenSourceMapRange(node, token) { - var _a2, _b; - return (_b = (_a2 = node.emitNode) == null ? void 0 : _a2.tokenSourceMapRanges) == null ? void 0 : _b[token]; + var _a, _b; + return (_b = (_a = node.emitNode) == null ? void 0 : _a.tokenSourceMapRanges) == null ? void 0 : _b[token]; } function setTokenSourceMapRange(node, token, range) { - var _a2; const emitNode = getOrCreateEmitNode(node); - const tokenSourceMapRanges = (_a2 = emitNode.tokenSourceMapRanges) != null ? _a2 : emitNode.tokenSourceMapRanges = []; + const tokenSourceMapRanges = emitNode.tokenSourceMapRanges ?? (emitNode.tokenSourceMapRanges = []); tokenSourceMapRanges[token] = range; return node; } function getStartsOnNewLine(node) { - var _a2; - return (_a2 = node.emitNode) == null ? void 0 : _a2.startsOnNewLine; + var _a; + return (_a = node.emitNode) == null ? void 0 : _a.startsOnNewLine; } function setStartsOnNewLine(node, newLine) { getOrCreateEmitNode(node).startsOnNewLine = newLine; return node; } function getCommentRange(node) { - var _a2, _b; - return (_b = (_a2 = node.emitNode) == null ? void 0 : _a2.commentRange) != null ? _b : node; + var _a; + return ((_a = node.emitNode) == null ? void 0 : _a.commentRange) ?? node; } function setCommentRange(node, range) { getOrCreateEmitNode(node).commentRange = range; return node; } function getSyntheticLeadingComments(node) { - var _a2; - return (_a2 = node.emitNode) == null ? void 0 : _a2.leadingComments; + var _a; + return (_a = node.emitNode) == null ? void 0 : _a.leadingComments; } function setSyntheticLeadingComments(node, comments) { getOrCreateEmitNode(node).leadingComments = comments; @@ -24621,8 +24749,8 @@ ${lanes.join("\n")} return setSyntheticLeadingComments(node, append(getSyntheticLeadingComments(node), { kind, pos: -1, end: -1, hasTrailingNewLine, text })); } function getSyntheticTrailingComments(node) { - var _a2; - return (_a2 = node.emitNode) == null ? void 0 : _a2.trailingComments; + var _a; + return (_a = node.emitNode) == null ? void 0 : _a.trailingComments; } function setSyntheticTrailingComments(node, comments) { getOrCreateEmitNode(node).trailingComments = comments; @@ -24640,8 +24768,8 @@ ${lanes.join("\n")} return node; } function getConstantValue(node) { - var _a2; - return (_a2 = node.emitNode) == null ? void 0 : _a2.constantValue; + var _a; + return (_a = node.emitNode) == null ? void 0 : _a.constantValue; } function setConstantValue(node, value) { const emitNode = getOrCreateEmitNode(node); @@ -24663,16 +24791,16 @@ ${lanes.join("\n")} return node; } function removeEmitHelper(node, helper) { - var _a2; - const helpers = (_a2 = node.emitNode) == null ? void 0 : _a2.helpers; + var _a; + const helpers = (_a = node.emitNode) == null ? void 0 : _a.helpers; if (helpers) { return orderedRemoveItem(helpers, helper); } return false; } function getEmitHelpers(node) { - var _a2; - return (_a2 = node.emitNode) == null ? void 0 : _a2.helpers; + var _a; + return (_a = node.emitNode) == null ? void 0 : _a.helpers; } function moveEmitHelpers(source, target, predicate) { const sourceEmitNode = source.emitNode; @@ -24695,8 +24823,8 @@ ${lanes.join("\n")} } } function getSnippetElement(node) { - var _a2; - return (_a2 = node.emitNode) == null ? void 0 : _a2.snippetElement; + var _a; + return (_a = node.emitNode) == null ? void 0 : _a.snippetElement; } function setSnippetElement(node, snippet) { const emitNode = getOrCreateEmitNode(node); @@ -24713,32 +24841,32 @@ ${lanes.join("\n")} return node; } function getTypeNode(node) { - var _a2; - return (_a2 = node.emitNode) == null ? void 0 : _a2.typeNode; + var _a; + return (_a = node.emitNode) == null ? void 0 : _a.typeNode; } function setIdentifierTypeArguments(node, typeArguments) { getOrCreateEmitNode(node).identifierTypeArguments = typeArguments; return node; } function getIdentifierTypeArguments(node) { - var _a2; - return (_a2 = node.emitNode) == null ? void 0 : _a2.identifierTypeArguments; + var _a; + return (_a = node.emitNode) == null ? void 0 : _a.identifierTypeArguments; } function setIdentifierAutoGenerate(node, autoGenerate) { getOrCreateEmitNode(node).autoGenerate = autoGenerate; return node; } function getIdentifierAutoGenerate(node) { - var _a2; - return (_a2 = node.emitNode) == null ? void 0 : _a2.autoGenerate; + var _a; + return (_a = node.emitNode) == null ? void 0 : _a.autoGenerate; } function setIdentifierGeneratedImportReference(node, value) { getOrCreateEmitNode(node).generatedImportReference = value; return node; } function getIdentifierGeneratedImportReference(node) { - var _a2; - return (_a2 = node.emitNode) == null ? void 0 : _a2.generatedImportReference; + var _a; + return (_a = node.emitNode) == null ? void 0 : _a.generatedImportReference; } var init_emitNode = __esm({ "src/compiler/factory/emitNode.ts"() { @@ -24937,7 +25065,7 @@ ${lanes.join("\n")} void 0, factory2.createBinaryExpression( propertyName, - 101 /* InKeyword */, + 103 /* InKeyword */, factory2.createIdentifier("obj") ) ) @@ -24971,8 +25099,8 @@ ${lanes.join("\n")} /*typeArguments*/ void 0, [ - ctor != null ? ctor : factory2.createNull(), - descriptorIn != null ? descriptorIn : factory2.createNull(), + ctor ?? factory2.createNull(), + descriptorIn ?? factory2.createNull(), decorators, createESDecorateContextObject(contextIn), initializers, @@ -25094,7 +25222,7 @@ ${lanes.join("\n")} const generatorFunc = factory2.createFunctionExpression( /*modifiers*/ void 0, - factory2.createToken(41 /* AsteriskToken */), + factory2.createToken(42 /* AsteriskToken */), /*name*/ void 0, /*typeParameters*/ @@ -25265,7 +25393,7 @@ ${lanes.join("\n")} context.requestEmitHelper(classPrivateFieldInHelper); return factory2.createCallExpression( getUnscopedHelperName("__classPrivateFieldIn"), - /* typeArguments*/ + /*typeArguments*/ void 0, [state, receiver] ); @@ -25395,10 +25523,10 @@ ${lanes.join("\n")} if (result === null || typeof result !== "object") throw new TypeError("Object expected"); if (_ = accept(result.get)) descriptor.get = _; if (_ = accept(result.set)) descriptor.set = _; - if (_ = accept(result.init)) initializers.push(_); + if (_ = accept(result.init)) initializers.unshift(_); } else if (_ = accept(result)) { - if (kind === "field") initializers.push(_); + if (kind === "field") initializers.unshift(_); else descriptor[key] = _; } } @@ -25780,682 +25908,679 @@ ${lanes.join("\n")} // src/compiler/factory/nodeTests.ts function isNumericLiteral(node) { - return node.kind === 8 /* NumericLiteral */; + return node.kind === 9 /* NumericLiteral */; } function isBigIntLiteral(node) { - return node.kind === 9 /* BigIntLiteral */; + return node.kind === 10 /* BigIntLiteral */; } function isStringLiteral(node) { - return node.kind === 10 /* StringLiteral */; + return node.kind === 11 /* StringLiteral */; } function isJsxText(node) { - return node.kind === 11 /* JsxText */; + return node.kind === 12 /* JsxText */; } function isRegularExpressionLiteral(node) { - return node.kind === 13 /* RegularExpressionLiteral */; + return node.kind === 14 /* RegularExpressionLiteral */; } function isNoSubstitutionTemplateLiteral(node) { - return node.kind === 14 /* NoSubstitutionTemplateLiteral */; + return node.kind === 15 /* NoSubstitutionTemplateLiteral */; } function isTemplateHead(node) { - return node.kind === 15 /* TemplateHead */; + return node.kind === 16 /* TemplateHead */; } function isTemplateMiddle(node) { - return node.kind === 16 /* TemplateMiddle */; + return node.kind === 17 /* TemplateMiddle */; } function isTemplateTail(node) { - return node.kind === 17 /* TemplateTail */; + return node.kind === 18 /* TemplateTail */; } function isDotDotDotToken(node) { - return node.kind === 25 /* DotDotDotToken */; + return node.kind === 26 /* DotDotDotToken */; } function isCommaToken(node) { - return node.kind === 27 /* CommaToken */; + return node.kind === 28 /* CommaToken */; } function isPlusToken(node) { - return node.kind === 39 /* PlusToken */; + return node.kind === 40 /* PlusToken */; } function isMinusToken(node) { - return node.kind === 40 /* MinusToken */; + return node.kind === 41 /* MinusToken */; } function isAsteriskToken(node) { - return node.kind === 41 /* AsteriskToken */; + return node.kind === 42 /* AsteriskToken */; } function isExclamationToken(node) { - return node.kind === 53 /* ExclamationToken */; + return node.kind === 54 /* ExclamationToken */; } function isQuestionToken(node) { - return node.kind === 57 /* QuestionToken */; + return node.kind === 58 /* QuestionToken */; } function isColonToken(node) { - return node.kind === 58 /* ColonToken */; + return node.kind === 59 /* ColonToken */; } function isQuestionDotToken(node) { - return node.kind === 28 /* QuestionDotToken */; + return node.kind === 29 /* QuestionDotToken */; } function isEqualsGreaterThanToken(node) { - return node.kind === 38 /* EqualsGreaterThanToken */; + return node.kind === 39 /* EqualsGreaterThanToken */; } function isIdentifier(node) { - return node.kind === 79 /* Identifier */; + return node.kind === 80 /* Identifier */; } function isPrivateIdentifier(node) { - return node.kind === 80 /* PrivateIdentifier */; + return node.kind === 81 /* PrivateIdentifier */; } function isExportModifier(node) { - return node.kind === 93 /* ExportKeyword */; + return node.kind === 95 /* ExportKeyword */; } function isDefaultModifier(node) { - return node.kind === 88 /* DefaultKeyword */; + return node.kind === 90 /* DefaultKeyword */; } function isAsyncModifier(node) { - return node.kind === 132 /* AsyncKeyword */; + return node.kind === 134 /* AsyncKeyword */; } function isAssertsKeyword(node) { - return node.kind === 129 /* AssertsKeyword */; + return node.kind === 131 /* AssertsKeyword */; } function isAwaitKeyword(node) { - return node.kind === 133 /* AwaitKeyword */; + return node.kind === 135 /* AwaitKeyword */; } function isReadonlyKeyword(node) { - return node.kind === 146 /* ReadonlyKeyword */; + return node.kind === 148 /* ReadonlyKeyword */; } function isStaticModifier(node) { - return node.kind === 124 /* StaticKeyword */; + return node.kind === 126 /* StaticKeyword */; } function isAbstractModifier(node) { - return node.kind === 126 /* AbstractKeyword */; + return node.kind === 128 /* AbstractKeyword */; } function isOverrideModifier(node) { - return node.kind === 161 /* OverrideKeyword */; + return node.kind === 163 /* OverrideKeyword */; } function isAccessorModifier(node) { - return node.kind === 127 /* AccessorKeyword */; + return node.kind === 129 /* AccessorKeyword */; } function isSuperKeyword(node) { - return node.kind === 106 /* SuperKeyword */; + return node.kind === 108 /* SuperKeyword */; } function isImportKeyword(node) { - return node.kind === 100 /* ImportKeyword */; + return node.kind === 102 /* ImportKeyword */; } function isCaseKeyword(node) { - return node.kind === 82 /* CaseKeyword */; + return node.kind === 84 /* CaseKeyword */; } function isQualifiedName(node) { - return node.kind === 163 /* QualifiedName */; + return node.kind === 165 /* QualifiedName */; } function isComputedPropertyName(node) { - return node.kind === 164 /* ComputedPropertyName */; + return node.kind === 166 /* ComputedPropertyName */; } function isTypeParameterDeclaration(node) { - return node.kind === 165 /* TypeParameter */; + return node.kind === 167 /* TypeParameter */; } function isParameter(node) { - return node.kind === 166 /* Parameter */; + return node.kind === 168 /* Parameter */; } function isDecorator(node) { - return node.kind === 167 /* Decorator */; + return node.kind === 169 /* Decorator */; } function isPropertySignature(node) { - return node.kind === 168 /* PropertySignature */; + return node.kind === 170 /* PropertySignature */; } function isPropertyDeclaration(node) { - return node.kind === 169 /* PropertyDeclaration */; + return node.kind === 171 /* PropertyDeclaration */; } function isMethodSignature(node) { - return node.kind === 170 /* MethodSignature */; + return node.kind === 172 /* MethodSignature */; } function isMethodDeclaration(node) { - return node.kind === 171 /* MethodDeclaration */; + return node.kind === 173 /* MethodDeclaration */; } function isClassStaticBlockDeclaration(node) { - return node.kind === 172 /* ClassStaticBlockDeclaration */; + return node.kind === 174 /* ClassStaticBlockDeclaration */; } function isConstructorDeclaration(node) { - return node.kind === 173 /* Constructor */; + return node.kind === 175 /* Constructor */; } function isGetAccessorDeclaration(node) { - return node.kind === 174 /* GetAccessor */; + return node.kind === 176 /* GetAccessor */; } function isSetAccessorDeclaration(node) { - return node.kind === 175 /* SetAccessor */; + return node.kind === 177 /* SetAccessor */; } function isCallSignatureDeclaration(node) { - return node.kind === 176 /* CallSignature */; + return node.kind === 178 /* CallSignature */; } function isConstructSignatureDeclaration(node) { - return node.kind === 177 /* ConstructSignature */; + return node.kind === 179 /* ConstructSignature */; } function isIndexSignatureDeclaration(node) { - return node.kind === 178 /* IndexSignature */; + return node.kind === 180 /* IndexSignature */; } function isTypePredicateNode(node) { - return node.kind === 179 /* TypePredicate */; + return node.kind === 181 /* TypePredicate */; } function isTypeReferenceNode(node) { - return node.kind === 180 /* TypeReference */; + return node.kind === 182 /* TypeReference */; } function isFunctionTypeNode(node) { - return node.kind === 181 /* FunctionType */; + return node.kind === 183 /* FunctionType */; } function isConstructorTypeNode(node) { - return node.kind === 182 /* ConstructorType */; + return node.kind === 184 /* ConstructorType */; } function isTypeQueryNode(node) { - return node.kind === 183 /* TypeQuery */; + return node.kind === 185 /* TypeQuery */; } function isTypeLiteralNode(node) { - return node.kind === 184 /* TypeLiteral */; + return node.kind === 186 /* TypeLiteral */; } function isArrayTypeNode(node) { - return node.kind === 185 /* ArrayType */; + return node.kind === 187 /* ArrayType */; } function isTupleTypeNode(node) { - return node.kind === 186 /* TupleType */; + return node.kind === 188 /* TupleType */; } function isNamedTupleMember(node) { - return node.kind === 199 /* NamedTupleMember */; + return node.kind === 201 /* NamedTupleMember */; } function isOptionalTypeNode(node) { - return node.kind === 187 /* OptionalType */; + return node.kind === 189 /* OptionalType */; } function isRestTypeNode(node) { - return node.kind === 188 /* RestType */; + return node.kind === 190 /* RestType */; } function isUnionTypeNode(node) { - return node.kind === 189 /* UnionType */; + return node.kind === 191 /* UnionType */; } function isIntersectionTypeNode(node) { - return node.kind === 190 /* IntersectionType */; + return node.kind === 192 /* IntersectionType */; } function isConditionalTypeNode(node) { - return node.kind === 191 /* ConditionalType */; + return node.kind === 193 /* ConditionalType */; } function isInferTypeNode(node) { - return node.kind === 192 /* InferType */; + return node.kind === 194 /* InferType */; } function isParenthesizedTypeNode(node) { - return node.kind === 193 /* ParenthesizedType */; + return node.kind === 195 /* ParenthesizedType */; } function isThisTypeNode(node) { - return node.kind === 194 /* ThisType */; + return node.kind === 196 /* ThisType */; } function isTypeOperatorNode(node) { - return node.kind === 195 /* TypeOperator */; + return node.kind === 197 /* TypeOperator */; } function isIndexedAccessTypeNode(node) { - return node.kind === 196 /* IndexedAccessType */; + return node.kind === 198 /* IndexedAccessType */; } function isMappedTypeNode(node) { - return node.kind === 197 /* MappedType */; + return node.kind === 199 /* MappedType */; } function isLiteralTypeNode(node) { - return node.kind === 198 /* LiteralType */; + return node.kind === 200 /* LiteralType */; } function isImportTypeNode(node) { - return node.kind === 202 /* ImportType */; + return node.kind === 204 /* ImportType */; } function isTemplateLiteralTypeSpan(node) { - return node.kind === 201 /* TemplateLiteralTypeSpan */; + return node.kind === 203 /* TemplateLiteralTypeSpan */; } function isTemplateLiteralTypeNode(node) { - return node.kind === 200 /* TemplateLiteralType */; + return node.kind === 202 /* TemplateLiteralType */; } function isObjectBindingPattern(node) { - return node.kind === 203 /* ObjectBindingPattern */; + return node.kind === 205 /* ObjectBindingPattern */; } function isArrayBindingPattern(node) { - return node.kind === 204 /* ArrayBindingPattern */; + return node.kind === 206 /* ArrayBindingPattern */; } function isBindingElement(node) { - return node.kind === 205 /* BindingElement */; + return node.kind === 207 /* BindingElement */; } function isArrayLiteralExpression(node) { - return node.kind === 206 /* ArrayLiteralExpression */; + return node.kind === 208 /* ArrayLiteralExpression */; } function isObjectLiteralExpression(node) { - return node.kind === 207 /* ObjectLiteralExpression */; + return node.kind === 209 /* ObjectLiteralExpression */; } function isPropertyAccessExpression(node) { - return node.kind === 208 /* PropertyAccessExpression */; + return node.kind === 210 /* PropertyAccessExpression */; } function isElementAccessExpression(node) { - return node.kind === 209 /* ElementAccessExpression */; + return node.kind === 211 /* ElementAccessExpression */; } function isCallExpression(node) { - return node.kind === 210 /* CallExpression */; + return node.kind === 212 /* CallExpression */; } function isNewExpression(node) { - return node.kind === 211 /* NewExpression */; + return node.kind === 213 /* NewExpression */; } function isTaggedTemplateExpression(node) { - return node.kind === 212 /* TaggedTemplateExpression */; + return node.kind === 214 /* TaggedTemplateExpression */; } function isTypeAssertionExpression(node) { - return node.kind === 213 /* TypeAssertionExpression */; + return node.kind === 215 /* TypeAssertionExpression */; } function isParenthesizedExpression(node) { - return node.kind === 214 /* ParenthesizedExpression */; + return node.kind === 216 /* ParenthesizedExpression */; } function isFunctionExpression(node) { - return node.kind === 215 /* FunctionExpression */; + return node.kind === 217 /* FunctionExpression */; } function isArrowFunction(node) { - return node.kind === 216 /* ArrowFunction */; + return node.kind === 218 /* ArrowFunction */; } function isDeleteExpression(node) { - return node.kind === 217 /* DeleteExpression */; + return node.kind === 219 /* DeleteExpression */; } function isTypeOfExpression(node) { - return node.kind === 218 /* TypeOfExpression */; + return node.kind === 220 /* TypeOfExpression */; } function isVoidExpression(node) { - return node.kind === 219 /* VoidExpression */; + return node.kind === 221 /* VoidExpression */; } function isAwaitExpression(node) { - return node.kind === 220 /* AwaitExpression */; + return node.kind === 222 /* AwaitExpression */; } function isPrefixUnaryExpression(node) { - return node.kind === 221 /* PrefixUnaryExpression */; + return node.kind === 223 /* PrefixUnaryExpression */; } function isPostfixUnaryExpression(node) { - return node.kind === 222 /* PostfixUnaryExpression */; + return node.kind === 224 /* PostfixUnaryExpression */; } function isBinaryExpression(node) { - return node.kind === 223 /* BinaryExpression */; + return node.kind === 225 /* BinaryExpression */; } function isConditionalExpression(node) { - return node.kind === 224 /* ConditionalExpression */; + return node.kind === 226 /* ConditionalExpression */; } function isTemplateExpression(node) { - return node.kind === 225 /* TemplateExpression */; + return node.kind === 227 /* TemplateExpression */; } function isYieldExpression(node) { - return node.kind === 226 /* YieldExpression */; + return node.kind === 228 /* YieldExpression */; } function isSpreadElement(node) { - return node.kind === 227 /* SpreadElement */; + return node.kind === 229 /* SpreadElement */; } function isClassExpression(node) { - return node.kind === 228 /* ClassExpression */; + return node.kind === 230 /* ClassExpression */; } function isOmittedExpression(node) { - return node.kind === 229 /* OmittedExpression */; + return node.kind === 231 /* OmittedExpression */; } function isExpressionWithTypeArguments(node) { - return node.kind === 230 /* ExpressionWithTypeArguments */; + return node.kind === 232 /* ExpressionWithTypeArguments */; } function isAsExpression(node) { - return node.kind === 231 /* AsExpression */; + return node.kind === 233 /* AsExpression */; } function isSatisfiesExpression(node) { - return node.kind === 235 /* SatisfiesExpression */; + return node.kind === 237 /* SatisfiesExpression */; } function isNonNullExpression(node) { - return node.kind === 232 /* NonNullExpression */; + return node.kind === 234 /* NonNullExpression */; } function isMetaProperty(node) { - return node.kind === 233 /* MetaProperty */; + return node.kind === 235 /* MetaProperty */; } function isSyntheticExpression(node) { - return node.kind === 234 /* SyntheticExpression */; + return node.kind === 236 /* SyntheticExpression */; } function isPartiallyEmittedExpression(node) { - return node.kind === 356 /* PartiallyEmittedExpression */; + return node.kind === 359 /* PartiallyEmittedExpression */; } function isCommaListExpression(node) { - return node.kind === 357 /* CommaListExpression */; + return node.kind === 360 /* CommaListExpression */; } function isTemplateSpan(node) { - return node.kind === 236 /* TemplateSpan */; + return node.kind === 238 /* TemplateSpan */; } function isSemicolonClassElement(node) { - return node.kind === 237 /* SemicolonClassElement */; + return node.kind === 239 /* SemicolonClassElement */; } function isBlock(node) { - return node.kind === 238 /* Block */; + return node.kind === 240 /* Block */; } function isVariableStatement(node) { - return node.kind === 240 /* VariableStatement */; + return node.kind === 242 /* VariableStatement */; } function isEmptyStatement(node) { - return node.kind === 239 /* EmptyStatement */; + return node.kind === 241 /* EmptyStatement */; } function isExpressionStatement(node) { - return node.kind === 241 /* ExpressionStatement */; + return node.kind === 243 /* ExpressionStatement */; } function isIfStatement(node) { - return node.kind === 242 /* IfStatement */; + return node.kind === 244 /* IfStatement */; } function isDoStatement(node) { - return node.kind === 243 /* DoStatement */; + return node.kind === 245 /* DoStatement */; } function isWhileStatement(node) { - return node.kind === 244 /* WhileStatement */; + return node.kind === 246 /* WhileStatement */; } function isForStatement(node) { - return node.kind === 245 /* ForStatement */; + return node.kind === 247 /* ForStatement */; } function isForInStatement(node) { - return node.kind === 246 /* ForInStatement */; + return node.kind === 248 /* ForInStatement */; } function isForOfStatement(node) { - return node.kind === 247 /* ForOfStatement */; + return node.kind === 249 /* ForOfStatement */; } function isContinueStatement(node) { - return node.kind === 248 /* ContinueStatement */; + return node.kind === 250 /* ContinueStatement */; } function isBreakStatement(node) { - return node.kind === 249 /* BreakStatement */; + return node.kind === 251 /* BreakStatement */; } function isReturnStatement(node) { - return node.kind === 250 /* ReturnStatement */; + return node.kind === 252 /* ReturnStatement */; } function isWithStatement(node) { - return node.kind === 251 /* WithStatement */; + return node.kind === 253 /* WithStatement */; } function isSwitchStatement(node) { - return node.kind === 252 /* SwitchStatement */; + return node.kind === 254 /* SwitchStatement */; } function isLabeledStatement(node) { - return node.kind === 253 /* LabeledStatement */; + return node.kind === 255 /* LabeledStatement */; } function isThrowStatement(node) { - return node.kind === 254 /* ThrowStatement */; + return node.kind === 256 /* ThrowStatement */; } function isTryStatement(node) { - return node.kind === 255 /* TryStatement */; + return node.kind === 257 /* TryStatement */; } function isDebuggerStatement(node) { - return node.kind === 256 /* DebuggerStatement */; + return node.kind === 258 /* DebuggerStatement */; } function isVariableDeclaration(node) { - return node.kind === 257 /* VariableDeclaration */; + return node.kind === 259 /* VariableDeclaration */; } function isVariableDeclarationList(node) { - return node.kind === 258 /* VariableDeclarationList */; + return node.kind === 260 /* VariableDeclarationList */; } function isFunctionDeclaration(node) { - return node.kind === 259 /* FunctionDeclaration */; + return node.kind === 261 /* FunctionDeclaration */; } function isClassDeclaration(node) { - return node.kind === 260 /* ClassDeclaration */; + return node.kind === 262 /* ClassDeclaration */; } function isInterfaceDeclaration(node) { - return node.kind === 261 /* InterfaceDeclaration */; + return node.kind === 263 /* InterfaceDeclaration */; } function isTypeAliasDeclaration(node) { - return node.kind === 262 /* TypeAliasDeclaration */; + return node.kind === 264 /* TypeAliasDeclaration */; } function isEnumDeclaration(node) { - return node.kind === 263 /* EnumDeclaration */; + return node.kind === 265 /* EnumDeclaration */; } function isModuleDeclaration(node) { - return node.kind === 264 /* ModuleDeclaration */; + return node.kind === 266 /* ModuleDeclaration */; } function isModuleBlock(node) { - return node.kind === 265 /* ModuleBlock */; + return node.kind === 267 /* ModuleBlock */; } function isCaseBlock(node) { - return node.kind === 266 /* CaseBlock */; + return node.kind === 268 /* CaseBlock */; } function isNamespaceExportDeclaration(node) { - return node.kind === 267 /* NamespaceExportDeclaration */; + return node.kind === 269 /* NamespaceExportDeclaration */; } function isImportEqualsDeclaration(node) { - return node.kind === 268 /* ImportEqualsDeclaration */; + return node.kind === 270 /* ImportEqualsDeclaration */; } function isImportDeclaration(node) { - return node.kind === 269 /* ImportDeclaration */; + return node.kind === 271 /* ImportDeclaration */; } function isImportClause(node) { - return node.kind === 270 /* ImportClause */; + return node.kind === 272 /* ImportClause */; } function isImportTypeAssertionContainer(node) { - return node.kind === 298 /* ImportTypeAssertionContainer */; + return node.kind === 301 /* ImportTypeAssertionContainer */; } function isAssertClause(node) { - return node.kind === 296 /* AssertClause */; + return node.kind === 299 /* AssertClause */; } function isAssertEntry(node) { - return node.kind === 297 /* AssertEntry */; + return node.kind === 300 /* AssertEntry */; } function isNamespaceImport(node) { - return node.kind === 271 /* NamespaceImport */; + return node.kind === 273 /* NamespaceImport */; } function isNamespaceExport(node) { - return node.kind === 277 /* NamespaceExport */; + return node.kind === 279 /* NamespaceExport */; } function isNamedImports(node) { - return node.kind === 272 /* NamedImports */; + return node.kind === 274 /* NamedImports */; } function isImportSpecifier(node) { - return node.kind === 273 /* ImportSpecifier */; + return node.kind === 275 /* ImportSpecifier */; } function isExportAssignment(node) { - return node.kind === 274 /* ExportAssignment */; + return node.kind === 276 /* ExportAssignment */; } function isExportDeclaration(node) { - return node.kind === 275 /* ExportDeclaration */; + return node.kind === 277 /* ExportDeclaration */; } function isNamedExports(node) { - return node.kind === 276 /* NamedExports */; + return node.kind === 278 /* NamedExports */; } function isExportSpecifier(node) { - return node.kind === 278 /* ExportSpecifier */; + return node.kind === 280 /* ExportSpecifier */; } function isMissingDeclaration(node) { - return node.kind === 279 /* MissingDeclaration */; + return node.kind === 281 /* MissingDeclaration */; } function isNotEmittedStatement(node) { - return node.kind === 355 /* NotEmittedStatement */; + return node.kind === 358 /* NotEmittedStatement */; } function isSyntheticReference(node) { - return node.kind === 360 /* SyntheticReferenceExpression */; - } - function isMergeDeclarationMarker(node) { - return node.kind === 358 /* MergeDeclarationMarker */; - } - function isEndOfDeclarationMarker(node) { - return node.kind === 359 /* EndOfDeclarationMarker */; + return node.kind === 361 /* SyntheticReferenceExpression */; } function isExternalModuleReference(node) { - return node.kind === 280 /* ExternalModuleReference */; + return node.kind === 282 /* ExternalModuleReference */; } function isJsxElement(node) { - return node.kind === 281 /* JsxElement */; + return node.kind === 283 /* JsxElement */; } function isJsxSelfClosingElement(node) { - return node.kind === 282 /* JsxSelfClosingElement */; + return node.kind === 284 /* JsxSelfClosingElement */; } function isJsxOpeningElement(node) { - return node.kind === 283 /* JsxOpeningElement */; + return node.kind === 285 /* JsxOpeningElement */; } function isJsxClosingElement(node) { - return node.kind === 284 /* JsxClosingElement */; + return node.kind === 286 /* JsxClosingElement */; } function isJsxFragment(node) { - return node.kind === 285 /* JsxFragment */; + return node.kind === 287 /* JsxFragment */; } function isJsxOpeningFragment(node) { - return node.kind === 286 /* JsxOpeningFragment */; + return node.kind === 288 /* JsxOpeningFragment */; } function isJsxClosingFragment(node) { - return node.kind === 287 /* JsxClosingFragment */; + return node.kind === 289 /* JsxClosingFragment */; } function isJsxAttribute(node) { - return node.kind === 288 /* JsxAttribute */; + return node.kind === 290 /* JsxAttribute */; } function isJsxAttributes(node) { - return node.kind === 289 /* JsxAttributes */; + return node.kind === 291 /* JsxAttributes */; } function isJsxSpreadAttribute(node) { - return node.kind === 290 /* JsxSpreadAttribute */; + return node.kind === 292 /* JsxSpreadAttribute */; } function isJsxExpression(node) { - return node.kind === 291 /* JsxExpression */; + return node.kind === 293 /* JsxExpression */; + } + function isJsxNamespacedName(node) { + return node.kind === 294 /* JsxNamespacedName */; } function isCaseClause(node) { - return node.kind === 292 /* CaseClause */; + return node.kind === 295 /* CaseClause */; } function isDefaultClause(node) { - return node.kind === 293 /* DefaultClause */; + return node.kind === 296 /* DefaultClause */; } function isHeritageClause(node) { - return node.kind === 294 /* HeritageClause */; + return node.kind === 297 /* HeritageClause */; } function isCatchClause(node) { - return node.kind === 295 /* CatchClause */; + return node.kind === 298 /* CatchClause */; } function isPropertyAssignment(node) { - return node.kind === 299 /* PropertyAssignment */; + return node.kind === 302 /* PropertyAssignment */; } function isShorthandPropertyAssignment(node) { - return node.kind === 300 /* ShorthandPropertyAssignment */; + return node.kind === 303 /* ShorthandPropertyAssignment */; } function isSpreadAssignment(node) { - return node.kind === 301 /* SpreadAssignment */; + return node.kind === 304 /* SpreadAssignment */; } function isEnumMember(node) { - return node.kind === 302 /* EnumMember */; + return node.kind === 305 /* EnumMember */; } function isUnparsedPrepend(node) { - return node.kind === 304 /* UnparsedPrepend */; + return node.kind === 307 /* UnparsedPrepend */; } function isSourceFile(node) { - return node.kind === 308 /* SourceFile */; + return node.kind === 311 /* SourceFile */; } function isBundle(node) { - return node.kind === 309 /* Bundle */; + return node.kind === 312 /* Bundle */; } function isUnparsedSource(node) { - return node.kind === 310 /* UnparsedSource */; + return node.kind === 313 /* UnparsedSource */; } function isJSDocTypeExpression(node) { - return node.kind === 312 /* JSDocTypeExpression */; + return node.kind === 315 /* JSDocTypeExpression */; } function isJSDocNameReference(node) { - return node.kind === 313 /* JSDocNameReference */; + return node.kind === 316 /* JSDocNameReference */; } function isJSDocMemberName(node) { - return node.kind === 314 /* JSDocMemberName */; + return node.kind === 317 /* JSDocMemberName */; } function isJSDocLink(node) { - return node.kind === 327 /* JSDocLink */; + return node.kind === 330 /* JSDocLink */; } function isJSDocLinkCode(node) { - return node.kind === 328 /* JSDocLinkCode */; + return node.kind === 331 /* JSDocLinkCode */; } function isJSDocLinkPlain(node) { - return node.kind === 329 /* JSDocLinkPlain */; + return node.kind === 332 /* JSDocLinkPlain */; } function isJSDocAllType(node) { - return node.kind === 315 /* JSDocAllType */; + return node.kind === 318 /* JSDocAllType */; } function isJSDocUnknownType(node) { - return node.kind === 316 /* JSDocUnknownType */; + return node.kind === 319 /* JSDocUnknownType */; } function isJSDocNullableType(node) { - return node.kind === 317 /* JSDocNullableType */; + return node.kind === 320 /* JSDocNullableType */; } function isJSDocNonNullableType(node) { - return node.kind === 318 /* JSDocNonNullableType */; + return node.kind === 321 /* JSDocNonNullableType */; } function isJSDocOptionalType(node) { - return node.kind === 319 /* JSDocOptionalType */; + return node.kind === 322 /* JSDocOptionalType */; } function isJSDocFunctionType(node) { - return node.kind === 320 /* JSDocFunctionType */; + return node.kind === 323 /* JSDocFunctionType */; } function isJSDocVariadicType(node) { - return node.kind === 321 /* JSDocVariadicType */; + return node.kind === 324 /* JSDocVariadicType */; } function isJSDocNamepathType(node) { - return node.kind === 322 /* JSDocNamepathType */; + return node.kind === 325 /* JSDocNamepathType */; } function isJSDoc(node) { - return node.kind === 323 /* JSDoc */; + return node.kind === 326 /* JSDoc */; } function isJSDocTypeLiteral(node) { - return node.kind === 325 /* JSDocTypeLiteral */; + return node.kind === 328 /* JSDocTypeLiteral */; } function isJSDocSignature(node) { - return node.kind === 326 /* JSDocSignature */; + return node.kind === 329 /* JSDocSignature */; } function isJSDocAugmentsTag(node) { - return node.kind === 331 /* JSDocAugmentsTag */; + return node.kind === 334 /* JSDocAugmentsTag */; } function isJSDocAuthorTag(node) { - return node.kind === 333 /* JSDocAuthorTag */; + return node.kind === 336 /* JSDocAuthorTag */; } function isJSDocClassTag(node) { - return node.kind === 335 /* JSDocClassTag */; + return node.kind === 338 /* JSDocClassTag */; } function isJSDocCallbackTag(node) { - return node.kind === 341 /* JSDocCallbackTag */; + return node.kind === 344 /* JSDocCallbackTag */; } function isJSDocPublicTag(node) { - return node.kind === 336 /* JSDocPublicTag */; + return node.kind === 339 /* JSDocPublicTag */; } function isJSDocPrivateTag(node) { - return node.kind === 337 /* JSDocPrivateTag */; + return node.kind === 340 /* JSDocPrivateTag */; } function isJSDocProtectedTag(node) { - return node.kind === 338 /* JSDocProtectedTag */; + return node.kind === 341 /* JSDocProtectedTag */; } function isJSDocReadonlyTag(node) { - return node.kind === 339 /* JSDocReadonlyTag */; + return node.kind === 342 /* JSDocReadonlyTag */; } function isJSDocOverrideTag(node) { - return node.kind === 340 /* JSDocOverrideTag */; + return node.kind === 343 /* JSDocOverrideTag */; } function isJSDocOverloadTag(node) { - return node.kind === 342 /* JSDocOverloadTag */; + return node.kind === 345 /* JSDocOverloadTag */; } function isJSDocDeprecatedTag(node) { - return node.kind === 334 /* JSDocDeprecatedTag */; + return node.kind === 337 /* JSDocDeprecatedTag */; } function isJSDocSeeTag(node) { - return node.kind === 350 /* JSDocSeeTag */; + return node.kind === 353 /* JSDocSeeTag */; } function isJSDocEnumTag(node) { - return node.kind === 343 /* JSDocEnumTag */; + return node.kind === 346 /* JSDocEnumTag */; } function isJSDocParameterTag(node) { - return node.kind === 344 /* JSDocParameterTag */; + return node.kind === 347 /* JSDocParameterTag */; } function isJSDocReturnTag(node) { - return node.kind === 345 /* JSDocReturnTag */; + return node.kind === 348 /* JSDocReturnTag */; } function isJSDocThisTag(node) { - return node.kind === 346 /* JSDocThisTag */; + return node.kind === 349 /* JSDocThisTag */; } function isJSDocTypeTag(node) { - return node.kind === 347 /* JSDocTypeTag */; + return node.kind === 350 /* JSDocTypeTag */; } function isJSDocTemplateTag(node) { - return node.kind === 348 /* JSDocTemplateTag */; + return node.kind === 351 /* JSDocTemplateTag */; } function isJSDocTypedefTag(node) { - return node.kind === 349 /* JSDocTypedefTag */; + return node.kind === 352 /* JSDocTypedefTag */; } function isJSDocUnknownTag(node) { - return node.kind === 330 /* JSDocTag */; + return node.kind === 333 /* JSDocTag */; } function isJSDocPropertyTag(node) { - return node.kind === 351 /* JSDocPropertyTag */; + return node.kind === 354 /* JSDocPropertyTag */; } function isJSDocImplementsTag(node) { - return node.kind === 332 /* JSDocImplementsTag */; + return node.kind === 335 /* JSDocImplementsTag */; } function isJSDocSatisfiesTag(node) { - return node.kind === 353 /* JSDocSatisfiesTag */; + return node.kind === 356 /* JSDocSatisfiesTag */; } function isJSDocThrowsTag(node) { - return node.kind === 352 /* JSDocThrowsTag */; + return node.kind === 355 /* JSDocThrowsTag */; } function isSyntaxList(n) { - return n.kind === 354 /* SyntaxList */; + return n.kind === 357 /* SyntaxList */; } var init_nodeTests = __esm({ "src/compiler/factory/nodeTests.ts"() { @@ -26769,20 +26894,20 @@ ${lanes.join("\n")} Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); } switch (property.kind) { - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return createExpressionForAccessorDeclaration(factory2, node.properties, property, receiver, !!node.multiLine); - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: return createExpressionForPropertyAssignment(factory2, property, receiver); - case 300 /* ShorthandPropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(factory2, property, receiver); - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: return createExpressionForMethodDeclaration(factory2, property, receiver); } } function expandPreOrPostfixIncrementOrDecrementExpression(factory2, node, expression, recordTempVariable, resultVariable) { const operator = node.operator; - Debug.assert(operator === 45 /* PlusPlusToken */ || operator === 46 /* MinusMinusToken */, "Expected 'node' to be a pre- or post-increment or pre- or post-decrement expression"); + Debug.assert(operator === 46 /* PlusPlusToken */ || operator === 47 /* MinusMinusToken */, "Expected 'node' to be a pre- or post-increment or pre- or post-decrement expression"); const temp = factory2.createTempVariable(recordTempVariable); expression = factory2.createAssignment(temp, expression); setTextRange(expression, node.operand); @@ -26829,7 +26954,7 @@ ${lanes.join("\n")} return firstStatement !== void 0 && isPrologueDirective(firstStatement) && isUseStrictPrologue(firstStatement); } function isCommaExpression(node) { - return node.kind === 223 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */; + return node.kind === 225 /* BinaryExpression */ && node.operatorToken.kind === 28 /* CommaToken */; } function isCommaSequence(node) { return isCommaExpression(node) || isCommaListExpression(node); @@ -26844,19 +26969,19 @@ ${lanes.join("\n")} } function isOuterExpression(node, kinds = 15 /* All */) { switch (node.kind) { - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: if (kinds & 16 /* ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) { return false; } return (kinds & 1 /* Parentheses */) !== 0; - case 213 /* TypeAssertionExpression */: - case 231 /* AsExpression */: - case 230 /* ExpressionWithTypeArguments */: - case 235 /* SatisfiesExpression */: + case 215 /* TypeAssertionExpression */: + case 233 /* AsExpression */: + case 232 /* ExpressionWithTypeArguments */: + case 237 /* SatisfiesExpression */: return (kinds & 2 /* TypeAssertions */) !== 0; - case 232 /* NonNullExpression */: + case 234 /* NonNullExpression */: return (kinds & 4 /* NonNullAssertions */) !== 0; - case 356 /* PartiallyEmittedExpression */: + case 359 /* PartiallyEmittedExpression */: return (kinds & 8 /* PartiallyEmittedExpressions */) !== 0; } return false; @@ -26993,10 +27118,10 @@ ${lanes.join("\n")} const name = namespaceDeclaration.name; return isGeneratedIdentifier(name) ? name : factory2.createIdentifier(getSourceTextOfNodeFromSourceFile(sourceFile, name) || idText(name)); } - if (node.kind === 269 /* ImportDeclaration */ && node.importClause) { + if (node.kind === 271 /* ImportDeclaration */ && node.importClause) { return factory2.getGeneratedNameForNode(node); } - if (node.kind === 275 /* ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 277 /* ExportDeclaration */ && node.moduleSpecifier) { return factory2.getGeneratedNameForNode(node); } return void 0; @@ -27059,11 +27184,11 @@ ${lanes.join("\n")} } if (isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 300 /* ShorthandPropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: return bindingElement.name; - case 301 /* SpreadAssignment */: + case 304 /* SpreadAssignment */: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return void 0; @@ -27082,11 +27207,11 @@ ${lanes.join("\n")} } function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 166 /* Parameter */: - case 205 /* BindingElement */: + case 168 /* Parameter */: + case 207 /* BindingElement */: return bindingElement.dotDotDotToken; - case 227 /* SpreadElement */: - case 301 /* SpreadAssignment */: + case 229 /* SpreadElement */: + case 304 /* SpreadAssignment */: return bindingElement; } return void 0; @@ -27098,7 +27223,7 @@ ${lanes.join("\n")} } function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 205 /* BindingElement */: + case 207 /* BindingElement */: if (bindingElement.propertyName) { const propertyName = bindingElement.propertyName; if (isPrivateIdentifier(propertyName)) { @@ -27107,7 +27232,7 @@ ${lanes.join("\n")} return isComputedPropertyName(propertyName) && isStringOrNumericLiteral(propertyName.expression) ? propertyName.expression : propertyName; } break; - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: if (bindingElement.name) { const propertyName = bindingElement.name; if (isPrivateIdentifier(propertyName)) { @@ -27116,7 +27241,7 @@ ${lanes.join("\n")} return isComputedPropertyName(propertyName) && isStringOrNumericLiteral(propertyName.expression) ? propertyName.expression : propertyName; } break; - case 301 /* SpreadAssignment */: + case 304 /* SpreadAssignment */: if (bindingElement.name && isPrivateIdentifier(bindingElement.name)) { return Debug.failBadSyntaxKind(bindingElement.name); } @@ -27129,15 +27254,15 @@ ${lanes.join("\n")} } function isStringOrNumericLiteral(node) { const kind = node.kind; - return kind === 10 /* StringLiteral */ || kind === 8 /* NumericLiteral */; + return kind === 11 /* StringLiteral */ || kind === 9 /* NumericLiteral */; } function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 203 /* ObjectBindingPattern */: - case 204 /* ArrayBindingPattern */: - case 206 /* ArrayLiteralExpression */: + case 205 /* ObjectBindingPattern */: + case 206 /* ArrayBindingPattern */: + case 208 /* ArrayLiteralExpression */: return name.elements; - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return name.properties; } } @@ -27154,19 +27279,19 @@ ${lanes.join("\n")} } function canHaveIllegalType(node) { const kind = node.kind; - return kind === 173 /* Constructor */ || kind === 175 /* SetAccessor */; + return kind === 175 /* Constructor */ || kind === 177 /* SetAccessor */; } function canHaveIllegalTypeParameters(node) { const kind = node.kind; - return kind === 173 /* Constructor */ || kind === 174 /* GetAccessor */ || kind === 175 /* SetAccessor */; + return kind === 175 /* Constructor */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */; } function canHaveIllegalDecorators(node) { const kind = node.kind; - return kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 259 /* FunctionDeclaration */ || kind === 173 /* Constructor */ || kind === 178 /* IndexSignature */ || kind === 172 /* ClassStaticBlockDeclaration */ || kind === 279 /* MissingDeclaration */ || kind === 240 /* VariableStatement */ || kind === 261 /* InterfaceDeclaration */ || kind === 262 /* TypeAliasDeclaration */ || kind === 263 /* EnumDeclaration */ || kind === 264 /* ModuleDeclaration */ || kind === 268 /* ImportEqualsDeclaration */ || kind === 269 /* ImportDeclaration */ || kind === 267 /* NamespaceExportDeclaration */ || kind === 275 /* ExportDeclaration */ || kind === 274 /* ExportAssignment */; + return kind === 302 /* PropertyAssignment */ || kind === 303 /* ShorthandPropertyAssignment */ || kind === 261 /* FunctionDeclaration */ || kind === 175 /* Constructor */ || kind === 180 /* IndexSignature */ || kind === 174 /* ClassStaticBlockDeclaration */ || kind === 281 /* MissingDeclaration */ || kind === 242 /* VariableStatement */ || kind === 263 /* InterfaceDeclaration */ || kind === 264 /* TypeAliasDeclaration */ || kind === 265 /* EnumDeclaration */ || kind === 266 /* ModuleDeclaration */ || kind === 270 /* ImportEqualsDeclaration */ || kind === 271 /* ImportDeclaration */ || kind === 269 /* NamespaceExportDeclaration */ || kind === 277 /* ExportDeclaration */ || kind === 276 /* ExportAssignment */; } function canHaveIllegalModifiers(node) { const kind = node.kind; - return kind === 172 /* ClassStaticBlockDeclaration */ || kind === 299 /* PropertyAssignment */ || kind === 300 /* ShorthandPropertyAssignment */ || kind === 279 /* MissingDeclaration */ || kind === 267 /* NamespaceExportDeclaration */; + return kind === 174 /* ClassStaticBlockDeclaration */ || kind === 302 /* PropertyAssignment */ || kind === 303 /* ShorthandPropertyAssignment */ || kind === 281 /* MissingDeclaration */ || kind === 269 /* NamespaceExportDeclaration */; } function isQuestionOrExclamationToken(node) { return isQuestionToken(node) || isExclamationToken(node); @@ -27185,58 +27310,58 @@ ${lanes.join("\n")} } function isLiteralTypeLikeExpression(node) { const kind = node.kind; - return kind === 104 /* NullKeyword */ || kind === 110 /* TrueKeyword */ || kind === 95 /* FalseKeyword */ || isLiteralExpression(node) || isPrefixUnaryExpression(node); + return kind === 106 /* NullKeyword */ || kind === 112 /* TrueKeyword */ || kind === 97 /* FalseKeyword */ || isLiteralExpression(node) || isPrefixUnaryExpression(node); } function isExponentiationOperator(kind) { - return kind === 42 /* AsteriskAsteriskToken */; + return kind === 43 /* AsteriskAsteriskToken */; } function isMultiplicativeOperator(kind) { - return kind === 41 /* AsteriskToken */ || kind === 43 /* SlashToken */ || kind === 44 /* PercentToken */; + return kind === 42 /* AsteriskToken */ || kind === 44 /* SlashToken */ || kind === 45 /* PercentToken */; } function isMultiplicativeOperatorOrHigher(kind) { return isExponentiationOperator(kind) || isMultiplicativeOperator(kind); } function isAdditiveOperator(kind) { - return kind === 39 /* PlusToken */ || kind === 40 /* MinusToken */; + return kind === 40 /* PlusToken */ || kind === 41 /* MinusToken */; } function isAdditiveOperatorOrHigher(kind) { return isAdditiveOperator(kind) || isMultiplicativeOperatorOrHigher(kind); } function isShiftOperator(kind) { - return kind === 47 /* LessThanLessThanToken */ || kind === 48 /* GreaterThanGreaterThanToken */ || kind === 49 /* GreaterThanGreaterThanGreaterThanToken */; + return kind === 48 /* LessThanLessThanToken */ || kind === 49 /* GreaterThanGreaterThanToken */ || kind === 50 /* GreaterThanGreaterThanGreaterThanToken */; } function isShiftOperatorOrHigher(kind) { return isShiftOperator(kind) || isAdditiveOperatorOrHigher(kind); } function isRelationalOperator(kind) { - return kind === 29 /* LessThanToken */ || kind === 32 /* LessThanEqualsToken */ || kind === 31 /* GreaterThanToken */ || kind === 33 /* GreaterThanEqualsToken */ || kind === 102 /* InstanceOfKeyword */ || kind === 101 /* InKeyword */; + return kind === 30 /* LessThanToken */ || kind === 33 /* LessThanEqualsToken */ || kind === 32 /* GreaterThanToken */ || kind === 34 /* GreaterThanEqualsToken */ || kind === 104 /* InstanceOfKeyword */ || kind === 103 /* InKeyword */; } function isRelationalOperatorOrHigher(kind) { return isRelationalOperator(kind) || isShiftOperatorOrHigher(kind); } function isEqualityOperator(kind) { - return kind === 34 /* EqualsEqualsToken */ || kind === 36 /* EqualsEqualsEqualsToken */ || kind === 35 /* ExclamationEqualsToken */ || kind === 37 /* ExclamationEqualsEqualsToken */; + return kind === 35 /* EqualsEqualsToken */ || kind === 37 /* EqualsEqualsEqualsToken */ || kind === 36 /* ExclamationEqualsToken */ || kind === 38 /* ExclamationEqualsEqualsToken */; } function isEqualityOperatorOrHigher(kind) { return isEqualityOperator(kind) || isRelationalOperatorOrHigher(kind); } function isBitwiseOperator(kind) { - return kind === 50 /* AmpersandToken */ || kind === 51 /* BarToken */ || kind === 52 /* CaretToken */; + return kind === 51 /* AmpersandToken */ || kind === 52 /* BarToken */ || kind === 53 /* CaretToken */; } function isBitwiseOperatorOrHigher(kind) { return isBitwiseOperator(kind) || isEqualityOperatorOrHigher(kind); } function isLogicalOperator2(kind) { - return kind === 55 /* AmpersandAmpersandToken */ || kind === 56 /* BarBarToken */; + return kind === 56 /* AmpersandAmpersandToken */ || kind === 57 /* BarBarToken */; } function isLogicalOperatorOrHigher(kind) { return isLogicalOperator2(kind) || isBitwiseOperatorOrHigher(kind); } function isAssignmentOperatorOrHigher(kind) { - return kind === 60 /* QuestionQuestionToken */ || isLogicalOperatorOrHigher(kind) || isAssignmentOperator(kind); + return kind === 61 /* QuestionQuestionToken */ || isLogicalOperatorOrHigher(kind) || isAssignmentOperator(kind); } function isBinaryOperator(kind) { - return isAssignmentOperatorOrHigher(kind) || kind === 27 /* CommaToken */; + return isAssignmentOperatorOrHigher(kind) || kind === 28 /* CommaToken */; } function isBinaryOperatorToken(node) { return isBinaryOperator(node.kind); @@ -27258,7 +27383,7 @@ ${lanes.join("\n")} } } function isExportOrDefaultKeywordKind(kind) { - return kind === 93 /* ExportKeyword */ || kind === 88 /* DefaultKeyword */; + return kind === 95 /* ExportKeyword */ || kind === 90 /* DefaultKeyword */; } function isExportOrDefaultModifier(node) { const kind = node.kind; @@ -27276,7 +27401,7 @@ ${lanes.join("\n")} return setTextRange(factory2.createNodeArray([], nodes.hasTrailingComma), nodes); } function getNodeForGeneratedName(name) { - var _a2; + var _a; const autoGenerate = name.emitNode.autoGenerate; if (autoGenerate.flags & 4 /* Node */) { const autoGenerateId = autoGenerate.id; @@ -27284,7 +27409,7 @@ ${lanes.join("\n")} let original = node.original; while (original) { node = original; - const autoGenerate2 = (_a2 = node.emitNode) == null ? void 0 : _a2.autoGenerate; + const autoGenerate2 = (_a = node.emitNode) == null ? void 0 : _a.autoGenerate; if (isMemberName(node) && (autoGenerate2 === void 0 || !!(autoGenerate2.flags & 4 /* Node */) && autoGenerate2.id !== autoGenerateId)) { break; } @@ -27362,7 +27487,7 @@ ${lanes.join("\n")} [factory2.createParameterDeclaration( /*modifiers*/ void 0, - /*dotdotDotToken*/ + /*dotDotDotToken*/ void 0, "value" )], @@ -27571,11 +27696,11 @@ ${lanes.join("\n")} } function canHaveModifiers(node) { const kind = node.kind; - return kind === 165 /* TypeParameter */ || kind === 166 /* Parameter */ || kind === 168 /* PropertySignature */ || kind === 169 /* PropertyDeclaration */ || kind === 170 /* MethodSignature */ || kind === 171 /* MethodDeclaration */ || kind === 173 /* Constructor */ || kind === 174 /* GetAccessor */ || kind === 175 /* SetAccessor */ || kind === 178 /* IndexSignature */ || kind === 182 /* ConstructorType */ || kind === 215 /* FunctionExpression */ || kind === 216 /* ArrowFunction */ || kind === 228 /* ClassExpression */ || kind === 240 /* VariableStatement */ || kind === 259 /* FunctionDeclaration */ || kind === 260 /* ClassDeclaration */ || kind === 261 /* InterfaceDeclaration */ || kind === 262 /* TypeAliasDeclaration */ || kind === 263 /* EnumDeclaration */ || kind === 264 /* ModuleDeclaration */ || kind === 268 /* ImportEqualsDeclaration */ || kind === 269 /* ImportDeclaration */ || kind === 274 /* ExportAssignment */ || kind === 275 /* ExportDeclaration */; + return kind === 167 /* TypeParameter */ || kind === 168 /* Parameter */ || kind === 170 /* PropertySignature */ || kind === 171 /* PropertyDeclaration */ || kind === 172 /* MethodSignature */ || kind === 173 /* MethodDeclaration */ || kind === 175 /* Constructor */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */ || kind === 180 /* IndexSignature */ || kind === 184 /* ConstructorType */ || kind === 217 /* FunctionExpression */ || kind === 218 /* ArrowFunction */ || kind === 230 /* ClassExpression */ || kind === 242 /* VariableStatement */ || kind === 261 /* FunctionDeclaration */ || kind === 262 /* ClassDeclaration */ || kind === 263 /* InterfaceDeclaration */ || kind === 264 /* TypeAliasDeclaration */ || kind === 265 /* EnumDeclaration */ || kind === 266 /* ModuleDeclaration */ || kind === 270 /* ImportEqualsDeclaration */ || kind === 271 /* ImportDeclaration */ || kind === 276 /* ExportAssignment */ || kind === 277 /* ExportDeclaration */; } function canHaveDecorators(node) { const kind = node.kind; - return kind === 166 /* Parameter */ || kind === 169 /* PropertyDeclaration */ || kind === 171 /* MethodDeclaration */ || kind === 174 /* GetAccessor */ || kind === 175 /* SetAccessor */ || kind === 228 /* ClassExpression */ || kind === 260 /* ClassDeclaration */; + return kind === 168 /* Parameter */ || kind === 171 /* PropertyDeclaration */ || kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */ || kind === 230 /* ClassExpression */ || kind === 262 /* ClassDeclaration */; } var init_utilitiesPublic2 = __esm({ "src/compiler/factory/utilitiesPublic.ts"() { @@ -27608,7 +27733,7 @@ ${lanes.join("\n")} return forEach(sourceFile.statements, isAnExternalModuleIndicatorNode) || getImportMetaIfNecessary(sourceFile); } function isAnExternalModuleIndicatorNode(node) { - return canHaveModifiers(node) && hasModifierOfKind(node, 93 /* ExportKeyword */) || isImportEqualsDeclaration(node) && isExternalModuleReference(node.moduleReference) || isImportDeclaration(node) || isExportAssignment(node) || isExportDeclaration(node) ? node : void 0; + return canHaveModifiers(node) && hasModifierOfKind(node, 95 /* ExportKeyword */) || isImportEqualsDeclaration(node) && isExternalModuleReference(node.moduleReference) || isImportDeclaration(node) || isExportAssignment(node) || isExportDeclaration(node) ? node : void 0; } function getImportMetaIfNecessary(sourceFile) { return sourceFile.flags & 4194304 /* PossiblyContainsImportMeta */ ? walkTreeForImportMeta(sourceFile) : void 0; @@ -27620,7 +27745,7 @@ ${lanes.join("\n")} return some(node.modifiers, (m) => m.kind === kind); } function isImportMeta2(node) { - return isMetaProperty(node) && node.keywordToken === 100 /* ImportKeyword */ && node.name.escapedText === "meta"; + return isMetaProperty(node) && node.keywordToken === 102 /* ImportKeyword */ && node.name.escapedText === "meta"; } function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type); @@ -27675,7 +27800,7 @@ ${lanes.join("\n")} return visitNode2(cbNode, node.expression); } function forEachChild(node, cbNode, cbNodes) { - if (node === void 0 || node.kind <= 162 /* LastToken */) { + if (node === void 0 || node.kind <= 164 /* LastToken */) { return; } const fn = forEachChildTable[node.kind]; @@ -27710,7 +27835,7 @@ ${lanes.join("\n")} continue; return res; } - if (current.kind >= 163 /* FirstNode */) { + if (current.kind >= 165 /* FirstNode */) { for (const child of gatherPossibleChildren(current)) { queue.push(child); parents.push(current); @@ -27731,8 +27856,8 @@ ${lanes.join("\n")} sourceFile.externalModuleIndicator = isFileProbablyExternalModule(sourceFile); } function createSourceFile(fileName, sourceText, languageVersionOrOptions, setParentNodes = false, scriptKind) { - var _a2, _b; - (_a2 = tracing) == null ? void 0 : _a2.push( + var _a, _b, _c, _d; + (_a = tracing) == null ? void 0 : _a.push( tracing.Phase.Parse, "createSourceFile", { path: fileName }, @@ -27741,7 +27866,7 @@ ${lanes.join("\n")} ); mark("beforeParse"); let result; - perfLogger.logStartParseSourceFile(fileName); + (_b = perfLogger) == null ? void 0 : _b.logStartParseSourceFile(fileName); const { languageVersion, setExternalModuleIndicator: overrideSetExternalModuleIndicator, @@ -27774,10 +27899,10 @@ ${lanes.join("\n")} setIndicator ); } - perfLogger.logStopParseSourceFile(); + (_c = perfLogger) == null ? void 0 : _c.logStopParseSourceFile(); mark("afterParse"); measure("Parse", "beforeParse", "afterParse"); - (_b = tracing) == null ? void 0 : _b.pop(); + (_d = tracing) == null ? void 0 : _d.pop(); return result; } function parseIsolatedEntityName(text, languageVersion) { @@ -28006,12 +28131,15 @@ ${lanes.join("\n")} if (lhs.kind !== rhs.kind) { return false; } - if (lhs.kind === 79 /* Identifier */) { + if (lhs.kind === 80 /* Identifier */) { return lhs.escapedText === rhs.escapedText; } - if (lhs.kind === 108 /* ThisKeyword */) { + if (lhs.kind === 110 /* ThisKeyword */) { return true; } + if (lhs.kind === 294 /* JsxNamespacedName */) { + return lhs.namespace.escapedText === rhs.namespace.escapedText && lhs.name.escapedText === rhs.name.escapedText; + } return lhs.name.escapedText === rhs.name.escapedText && tagNamesAreEquivalent(lhs.expression, rhs.expression); } var NodeConstructor, TokenConstructor, IdentifierConstructor, PrivateIdentifierConstructor, SourceFileConstructor, parseBaseNodeFactory, parseNodeFactory, forEachChildTable, Parser, IncrementalParser, namedArgRegExCache, tripleSlashXMLCommentStartRegEx, singleLinePragmaRegEx; @@ -28019,7 +28147,6 @@ ${lanes.join("\n")} "src/compiler/parser.ts"() { "use strict"; init_ts2(); - init_ts2(); init_ts_performance(); parseBaseNodeFactory = { createBaseSourceFileNode: (kind) => new (SourceFileConstructor || (SourceFileConstructor = objectAllocator.getSourceFileConstructor()))(kind, -1, -1), @@ -28030,425 +28157,428 @@ ${lanes.join("\n")} }; parseNodeFactory = createNodeFactory(1 /* NoParenthesizerRules */, parseBaseNodeFactory); forEachChildTable = { - [163 /* QualifiedName */]: function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + [165 /* QualifiedName */]: function forEachChildInQualifiedName(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.left) || visitNode2(cbNode, node.right); }, - [165 /* TypeParameter */]: function forEachChildInTypeParameter(node, cbNode, cbNodes) { + [167 /* TypeParameter */]: function forEachChildInTypeParameter(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.constraint) || visitNode2(cbNode, node.default) || visitNode2(cbNode, node.expression); }, - [300 /* ShorthandPropertyAssignment */]: function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + [303 /* ShorthandPropertyAssignment */]: function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.exclamationToken) || visitNode2(cbNode, node.equalsToken) || visitNode2(cbNode, node.objectAssignmentInitializer); }, - [301 /* SpreadAssignment */]: function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + [304 /* SpreadAssignment */]: function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [166 /* Parameter */]: function forEachChildInParameter(node, cbNode, cbNodes) { + [168 /* Parameter */]: function forEachChildInParameter(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.dotDotDotToken) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.initializer); }, - [169 /* PropertyDeclaration */]: function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + [171 /* PropertyDeclaration */]: function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.exclamationToken) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.initializer); }, - [168 /* PropertySignature */]: function forEachChildInPropertySignature(node, cbNode, cbNodes) { + [170 /* PropertySignature */]: function forEachChildInPropertySignature(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.initializer); }, - [299 /* PropertyAssignment */]: function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + [302 /* PropertyAssignment */]: function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.exclamationToken) || visitNode2(cbNode, node.initializer); }, - [257 /* VariableDeclaration */]: function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + [259 /* VariableDeclaration */]: function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.exclamationToken) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.initializer); }, - [205 /* BindingElement */]: function forEachChildInBindingElement(node, cbNode, _cbNodes) { + [207 /* BindingElement */]: function forEachChildInBindingElement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.dotDotDotToken) || visitNode2(cbNode, node.propertyName) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.initializer); }, - [178 /* IndexSignature */]: function forEachChildInIndexSignature(node, cbNode, cbNodes) { + [180 /* IndexSignature */]: function forEachChildInIndexSignature(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type); }, - [182 /* ConstructorType */]: function forEachChildInConstructorType(node, cbNode, cbNodes) { + [184 /* ConstructorType */]: function forEachChildInConstructorType(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type); }, - [181 /* FunctionType */]: function forEachChildInFunctionType(node, cbNode, cbNodes) { + [183 /* FunctionType */]: function forEachChildInFunctionType(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type); }, - [176 /* CallSignature */]: forEachChildInCallOrConstructSignature, - [177 /* ConstructSignature */]: forEachChildInCallOrConstructSignature, - [171 /* MethodDeclaration */]: function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + [178 /* CallSignature */]: forEachChildInCallOrConstructSignature, + [179 /* ConstructSignature */]: forEachChildInCallOrConstructSignature, + [173 /* MethodDeclaration */]: function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.asteriskToken) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.exclamationToken) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.body); }, - [170 /* MethodSignature */]: function forEachChildInMethodSignature(node, cbNode, cbNodes) { + [172 /* MethodSignature */]: function forEachChildInMethodSignature(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type); }, - [173 /* Constructor */]: function forEachChildInConstructor(node, cbNode, cbNodes) { + [175 /* Constructor */]: function forEachChildInConstructor(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.body); }, - [174 /* GetAccessor */]: function forEachChildInGetAccessor(node, cbNode, cbNodes) { + [176 /* GetAccessor */]: function forEachChildInGetAccessor(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.body); }, - [175 /* SetAccessor */]: function forEachChildInSetAccessor(node, cbNode, cbNodes) { + [177 /* SetAccessor */]: function forEachChildInSetAccessor(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.body); }, - [259 /* FunctionDeclaration */]: function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + [261 /* FunctionDeclaration */]: function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.asteriskToken) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.body); }, - [215 /* FunctionExpression */]: function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + [217 /* FunctionExpression */]: function forEachChildInFunctionExpression(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.asteriskToken) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.body); }, - [216 /* ArrowFunction */]: function forEachChildInArrowFunction(node, cbNode, cbNodes) { + [218 /* ArrowFunction */]: function forEachChildInArrowFunction(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type) || visitNode2(cbNode, node.equalsGreaterThanToken) || visitNode2(cbNode, node.body); }, - [172 /* ClassStaticBlockDeclaration */]: function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + [174 /* ClassStaticBlockDeclaration */]: function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.body); }, - [180 /* TypeReference */]: function forEachChildInTypeReference(node, cbNode, cbNodes) { + [182 /* TypeReference */]: function forEachChildInTypeReference(node, cbNode, cbNodes) { return visitNode2(cbNode, node.typeName) || visitNodes(cbNode, cbNodes, node.typeArguments); }, - [179 /* TypePredicate */]: function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + [181 /* TypePredicate */]: function forEachChildInTypePredicate(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.assertsModifier) || visitNode2(cbNode, node.parameterName) || visitNode2(cbNode, node.type); }, - [183 /* TypeQuery */]: function forEachChildInTypeQuery(node, cbNode, cbNodes) { + [185 /* TypeQuery */]: function forEachChildInTypeQuery(node, cbNode, cbNodes) { return visitNode2(cbNode, node.exprName) || visitNodes(cbNode, cbNodes, node.typeArguments); }, - [184 /* TypeLiteral */]: function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + [186 /* TypeLiteral */]: function forEachChildInTypeLiteral(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.members); }, - [185 /* ArrayType */]: function forEachChildInArrayType(node, cbNode, _cbNodes) { + [187 /* ArrayType */]: function forEachChildInArrayType(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.elementType); }, - [186 /* TupleType */]: function forEachChildInTupleType(node, cbNode, cbNodes) { + [188 /* TupleType */]: function forEachChildInTupleType(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.elements); }, - [189 /* UnionType */]: forEachChildInUnionOrIntersectionType, - [190 /* IntersectionType */]: forEachChildInUnionOrIntersectionType, - [191 /* ConditionalType */]: function forEachChildInConditionalType(node, cbNode, _cbNodes) { + [191 /* UnionType */]: forEachChildInUnionOrIntersectionType, + [192 /* IntersectionType */]: forEachChildInUnionOrIntersectionType, + [193 /* ConditionalType */]: function forEachChildInConditionalType(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.checkType) || visitNode2(cbNode, node.extendsType) || visitNode2(cbNode, node.trueType) || visitNode2(cbNode, node.falseType); }, - [192 /* InferType */]: function forEachChildInInferType(node, cbNode, _cbNodes) { + [194 /* InferType */]: function forEachChildInInferType(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.typeParameter); }, - [202 /* ImportType */]: function forEachChildInImportType(node, cbNode, cbNodes) { + [204 /* ImportType */]: function forEachChildInImportType(node, cbNode, cbNodes) { return visitNode2(cbNode, node.argument) || visitNode2(cbNode, node.assertions) || visitNode2(cbNode, node.qualifier) || visitNodes(cbNode, cbNodes, node.typeArguments); }, - [298 /* ImportTypeAssertionContainer */]: function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + [301 /* ImportTypeAssertionContainer */]: function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.assertClause); }, - [193 /* ParenthesizedType */]: forEachChildInParenthesizedTypeOrTypeOperator, - [195 /* TypeOperator */]: forEachChildInParenthesizedTypeOrTypeOperator, - [196 /* IndexedAccessType */]: function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + [195 /* ParenthesizedType */]: forEachChildInParenthesizedTypeOrTypeOperator, + [197 /* TypeOperator */]: forEachChildInParenthesizedTypeOrTypeOperator, + [198 /* IndexedAccessType */]: function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.objectType) || visitNode2(cbNode, node.indexType); }, - [197 /* MappedType */]: function forEachChildInMappedType(node, cbNode, cbNodes) { + [199 /* MappedType */]: function forEachChildInMappedType(node, cbNode, cbNodes) { return visitNode2(cbNode, node.readonlyToken) || visitNode2(cbNode, node.typeParameter) || visitNode2(cbNode, node.nameType) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.type) || visitNodes(cbNode, cbNodes, node.members); }, - [198 /* LiteralType */]: function forEachChildInLiteralType(node, cbNode, _cbNodes) { + [200 /* LiteralType */]: function forEachChildInLiteralType(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.literal); }, - [199 /* NamedTupleMember */]: function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + [201 /* NamedTupleMember */]: function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.dotDotDotToken) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.type); }, - [203 /* ObjectBindingPattern */]: forEachChildInObjectOrArrayBindingPattern, - [204 /* ArrayBindingPattern */]: forEachChildInObjectOrArrayBindingPattern, - [206 /* ArrayLiteralExpression */]: function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + [205 /* ObjectBindingPattern */]: forEachChildInObjectOrArrayBindingPattern, + [206 /* ArrayBindingPattern */]: forEachChildInObjectOrArrayBindingPattern, + [208 /* ArrayLiteralExpression */]: function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.elements); }, - [207 /* ObjectLiteralExpression */]: function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + [209 /* ObjectLiteralExpression */]: function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.properties); }, - [208 /* PropertyAccessExpression */]: function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + [210 /* PropertyAccessExpression */]: function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.questionDotToken) || visitNode2(cbNode, node.name); }, - [209 /* ElementAccessExpression */]: function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + [211 /* ElementAccessExpression */]: function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.questionDotToken) || visitNode2(cbNode, node.argumentExpression); }, - [210 /* CallExpression */]: forEachChildInCallOrNewExpression, - [211 /* NewExpression */]: forEachChildInCallOrNewExpression, - [212 /* TaggedTemplateExpression */]: function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + [212 /* CallExpression */]: forEachChildInCallOrNewExpression, + [213 /* NewExpression */]: forEachChildInCallOrNewExpression, + [214 /* TaggedTemplateExpression */]: function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { return visitNode2(cbNode, node.tag) || visitNode2(cbNode, node.questionDotToken) || visitNodes(cbNode, cbNodes, node.typeArguments) || visitNode2(cbNode, node.template); }, - [213 /* TypeAssertionExpression */]: function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + [215 /* TypeAssertionExpression */]: function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.type) || visitNode2(cbNode, node.expression); }, - [214 /* ParenthesizedExpression */]: function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + [216 /* ParenthesizedExpression */]: function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [217 /* DeleteExpression */]: function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + [219 /* DeleteExpression */]: function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [218 /* TypeOfExpression */]: function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + [220 /* TypeOfExpression */]: function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [219 /* VoidExpression */]: function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + [221 /* VoidExpression */]: function forEachChildInVoidExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [221 /* PrefixUnaryExpression */]: function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + [223 /* PrefixUnaryExpression */]: function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.operand); }, - [226 /* YieldExpression */]: function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + [228 /* YieldExpression */]: function forEachChildInYieldExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.asteriskToken) || visitNode2(cbNode, node.expression); }, - [220 /* AwaitExpression */]: function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + [222 /* AwaitExpression */]: function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [222 /* PostfixUnaryExpression */]: function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + [224 /* PostfixUnaryExpression */]: function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.operand); }, - [223 /* BinaryExpression */]: function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + [225 /* BinaryExpression */]: function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.left) || visitNode2(cbNode, node.operatorToken) || visitNode2(cbNode, node.right); }, - [231 /* AsExpression */]: function forEachChildInAsExpression(node, cbNode, _cbNodes) { + [233 /* AsExpression */]: function forEachChildInAsExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.type); }, - [232 /* NonNullExpression */]: function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + [234 /* NonNullExpression */]: function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [235 /* SatisfiesExpression */]: function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + [237 /* SatisfiesExpression */]: function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.type); }, - [233 /* MetaProperty */]: function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + [235 /* MetaProperty */]: function forEachChildInMetaProperty(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name); }, - [224 /* ConditionalExpression */]: function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + [226 /* ConditionalExpression */]: function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.condition) || visitNode2(cbNode, node.questionToken) || visitNode2(cbNode, node.whenTrue) || visitNode2(cbNode, node.colonToken) || visitNode2(cbNode, node.whenFalse); }, - [227 /* SpreadElement */]: function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + [229 /* SpreadElement */]: function forEachChildInSpreadElement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [238 /* Block */]: forEachChildInBlock, - [265 /* ModuleBlock */]: forEachChildInBlock, - [308 /* SourceFile */]: function forEachChildInSourceFile(node, cbNode, cbNodes) { + [240 /* Block */]: forEachChildInBlock, + [267 /* ModuleBlock */]: forEachChildInBlock, + [311 /* SourceFile */]: function forEachChildInSourceFile(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.statements) || visitNode2(cbNode, node.endOfFileToken); }, - [240 /* VariableStatement */]: function forEachChildInVariableStatement(node, cbNode, cbNodes) { + [242 /* VariableStatement */]: function forEachChildInVariableStatement(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.declarationList); }, - [258 /* VariableDeclarationList */]: function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + [260 /* VariableDeclarationList */]: function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.declarations); }, - [241 /* ExpressionStatement */]: function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + [243 /* ExpressionStatement */]: function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [242 /* IfStatement */]: function forEachChildInIfStatement(node, cbNode, _cbNodes) { + [244 /* IfStatement */]: function forEachChildInIfStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.thenStatement) || visitNode2(cbNode, node.elseStatement); }, - [243 /* DoStatement */]: function forEachChildInDoStatement(node, cbNode, _cbNodes) { + [245 /* DoStatement */]: function forEachChildInDoStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.statement) || visitNode2(cbNode, node.expression); }, - [244 /* WhileStatement */]: function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + [246 /* WhileStatement */]: function forEachChildInWhileStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.statement); }, - [245 /* ForStatement */]: function forEachChildInForStatement(node, cbNode, _cbNodes) { + [247 /* ForStatement */]: function forEachChildInForStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.initializer) || visitNode2(cbNode, node.condition) || visitNode2(cbNode, node.incrementor) || visitNode2(cbNode, node.statement); }, - [246 /* ForInStatement */]: function forEachChildInForInStatement(node, cbNode, _cbNodes) { + [248 /* ForInStatement */]: function forEachChildInForInStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.initializer) || visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.statement); }, - [247 /* ForOfStatement */]: function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + [249 /* ForOfStatement */]: function forEachChildInForOfStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.awaitModifier) || visitNode2(cbNode, node.initializer) || visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.statement); }, - [248 /* ContinueStatement */]: forEachChildInContinueOrBreakStatement, - [249 /* BreakStatement */]: forEachChildInContinueOrBreakStatement, - [250 /* ReturnStatement */]: function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + [250 /* ContinueStatement */]: forEachChildInContinueOrBreakStatement, + [251 /* BreakStatement */]: forEachChildInContinueOrBreakStatement, + [252 /* ReturnStatement */]: function forEachChildInReturnStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [251 /* WithStatement */]: function forEachChildInWithStatement(node, cbNode, _cbNodes) { + [253 /* WithStatement */]: function forEachChildInWithStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.statement); }, - [252 /* SwitchStatement */]: function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + [254 /* SwitchStatement */]: function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.caseBlock); }, - [266 /* CaseBlock */]: function forEachChildInCaseBlock(node, cbNode, cbNodes) { + [268 /* CaseBlock */]: function forEachChildInCaseBlock(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.clauses); }, - [292 /* CaseClause */]: function forEachChildInCaseClause(node, cbNode, cbNodes) { + [295 /* CaseClause */]: function forEachChildInCaseClause(node, cbNode, cbNodes) { return visitNode2(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.statements); }, - [293 /* DefaultClause */]: function forEachChildInDefaultClause(node, cbNode, cbNodes) { + [296 /* DefaultClause */]: function forEachChildInDefaultClause(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.statements); }, - [253 /* LabeledStatement */]: function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + [255 /* LabeledStatement */]: function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.label) || visitNode2(cbNode, node.statement); }, - [254 /* ThrowStatement */]: function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + [256 /* ThrowStatement */]: function forEachChildInThrowStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [255 /* TryStatement */]: function forEachChildInTryStatement(node, cbNode, _cbNodes) { + [257 /* TryStatement */]: function forEachChildInTryStatement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.tryBlock) || visitNode2(cbNode, node.catchClause) || visitNode2(cbNode, node.finallyBlock); }, - [295 /* CatchClause */]: function forEachChildInCatchClause(node, cbNode, _cbNodes) { + [298 /* CatchClause */]: function forEachChildInCatchClause(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.variableDeclaration) || visitNode2(cbNode, node.block); }, - [167 /* Decorator */]: function forEachChildInDecorator(node, cbNode, _cbNodes) { + [169 /* Decorator */]: function forEachChildInDecorator(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [260 /* ClassDeclaration */]: forEachChildInClassDeclarationOrExpression, - [228 /* ClassExpression */]: forEachChildInClassDeclarationOrExpression, - [261 /* InterfaceDeclaration */]: function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + [262 /* ClassDeclaration */]: forEachChildInClassDeclarationOrExpression, + [230 /* ClassExpression */]: forEachChildInClassDeclarationOrExpression, + [263 /* InterfaceDeclaration */]: function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNodes(cbNode, cbNodes, node.heritageClauses) || visitNodes(cbNode, cbNodes, node.members); }, - [262 /* TypeAliasDeclaration */]: function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + [264 /* TypeAliasDeclaration */]: function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode2(cbNode, node.type); }, - [263 /* EnumDeclaration */]: function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + [265 /* EnumDeclaration */]: function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNodes(cbNode, cbNodes, node.members); }, - [302 /* EnumMember */]: function forEachChildInEnumMember(node, cbNode, _cbNodes) { + [305 /* EnumMember */]: function forEachChildInEnumMember(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.initializer); }, - [264 /* ModuleDeclaration */]: function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + [266 /* ModuleDeclaration */]: function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.body); }, - [268 /* ImportEqualsDeclaration */]: function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + [270 /* ImportEqualsDeclaration */]: function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name) || visitNode2(cbNode, node.moduleReference); }, - [269 /* ImportDeclaration */]: function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + [271 /* ImportDeclaration */]: function forEachChildInImportDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.importClause) || visitNode2(cbNode, node.moduleSpecifier) || visitNode2(cbNode, node.assertClause); }, - [270 /* ImportClause */]: function forEachChildInImportClause(node, cbNode, _cbNodes) { + [272 /* ImportClause */]: function forEachChildInImportClause(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.namedBindings); }, - [296 /* AssertClause */]: function forEachChildInAssertClause(node, cbNode, cbNodes) { + [299 /* AssertClause */]: function forEachChildInAssertClause(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.elements); }, - [297 /* AssertEntry */]: function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + [300 /* AssertEntry */]: function forEachChildInAssertEntry(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.value); }, - [267 /* NamespaceExportDeclaration */]: function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + [269 /* NamespaceExportDeclaration */]: function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.name); }, - [271 /* NamespaceImport */]: function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + [273 /* NamespaceImport */]: function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name); }, - [277 /* NamespaceExport */]: function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + [279 /* NamespaceExport */]: function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name); }, - [272 /* NamedImports */]: forEachChildInNamedImportsOrExports, - [276 /* NamedExports */]: forEachChildInNamedImportsOrExports, - [275 /* ExportDeclaration */]: function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + [274 /* NamedImports */]: forEachChildInNamedImportsOrExports, + [278 /* NamedExports */]: forEachChildInNamedImportsOrExports, + [277 /* ExportDeclaration */]: function forEachChildInExportDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.exportClause) || visitNode2(cbNode, node.moduleSpecifier) || visitNode2(cbNode, node.assertClause); }, - [273 /* ImportSpecifier */]: forEachChildInImportOrExportSpecifier, - [278 /* ExportSpecifier */]: forEachChildInImportOrExportSpecifier, - [274 /* ExportAssignment */]: function forEachChildInExportAssignment(node, cbNode, cbNodes) { + [275 /* ImportSpecifier */]: forEachChildInImportOrExportSpecifier, + [280 /* ExportSpecifier */]: forEachChildInImportOrExportSpecifier, + [276 /* ExportAssignment */]: function forEachChildInExportAssignment(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers) || visitNode2(cbNode, node.expression); }, - [225 /* TemplateExpression */]: function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + [227 /* TemplateExpression */]: function forEachChildInTemplateExpression(node, cbNode, cbNodes) { return visitNode2(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans); }, - [236 /* TemplateSpan */]: function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + [238 /* TemplateSpan */]: function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression) || visitNode2(cbNode, node.literal); }, - [200 /* TemplateLiteralType */]: function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + [202 /* TemplateLiteralType */]: function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { return visitNode2(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans); }, - [201 /* TemplateLiteralTypeSpan */]: function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + [203 /* TemplateLiteralTypeSpan */]: function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.type) || visitNode2(cbNode, node.literal); }, - [164 /* ComputedPropertyName */]: function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + [166 /* ComputedPropertyName */]: function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [294 /* HeritageClause */]: function forEachChildInHeritageClause(node, cbNode, cbNodes) { + [297 /* HeritageClause */]: function forEachChildInHeritageClause(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.types); }, - [230 /* ExpressionWithTypeArguments */]: function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + [232 /* ExpressionWithTypeArguments */]: function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { return visitNode2(cbNode, node.expression) || visitNodes(cbNode, cbNodes, node.typeArguments); }, - [280 /* ExternalModuleReference */]: function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + [282 /* ExternalModuleReference */]: function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [279 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + [281 /* MissingDeclaration */]: function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.modifiers); }, - [357 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + [360 /* CommaListExpression */]: function forEachChildInCommaListExpression(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.elements); }, - [281 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) { + [283 /* JsxElement */]: function forEachChildInJsxElement(node, cbNode, cbNodes) { return visitNode2(cbNode, node.openingElement) || visitNodes(cbNode, cbNodes, node.children) || visitNode2(cbNode, node.closingElement); }, - [285 /* JsxFragment */]: function forEachChildInJsxFragment(node, cbNode, cbNodes) { + [287 /* JsxFragment */]: function forEachChildInJsxFragment(node, cbNode, cbNodes) { return visitNode2(cbNode, node.openingFragment) || visitNodes(cbNode, cbNodes, node.children) || visitNode2(cbNode, node.closingFragment); }, - [282 /* JsxSelfClosingElement */]: forEachChildInJsxOpeningOrSelfClosingElement, - [283 /* JsxOpeningElement */]: forEachChildInJsxOpeningOrSelfClosingElement, - [289 /* JsxAttributes */]: function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + [284 /* JsxSelfClosingElement */]: forEachChildInJsxOpeningOrSelfClosingElement, + [285 /* JsxOpeningElement */]: forEachChildInJsxOpeningOrSelfClosingElement, + [291 /* JsxAttributes */]: function forEachChildInJsxAttributes(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.properties); }, - [288 /* JsxAttribute */]: function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + [290 /* JsxAttribute */]: function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name) || visitNode2(cbNode, node.initializer); }, - [290 /* JsxSpreadAttribute */]: function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + [292 /* JsxSpreadAttribute */]: function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.expression); }, - [291 /* JsxExpression */]: function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + [293 /* JsxExpression */]: function forEachChildInJsxExpression(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.dotDotDotToken) || visitNode2(cbNode, node.expression); }, - [284 /* JsxClosingElement */]: function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + [286 /* JsxClosingElement */]: function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.tagName); }, - [187 /* OptionalType */]: forEachChildInOptionalRestOrJSDocParameterModifier, - [188 /* RestType */]: forEachChildInOptionalRestOrJSDocParameterModifier, - [312 /* JSDocTypeExpression */]: forEachChildInOptionalRestOrJSDocParameterModifier, - [318 /* JSDocNonNullableType */]: forEachChildInOptionalRestOrJSDocParameterModifier, - [317 /* JSDocNullableType */]: forEachChildInOptionalRestOrJSDocParameterModifier, - [319 /* JSDocOptionalType */]: forEachChildInOptionalRestOrJSDocParameterModifier, - [321 /* JSDocVariadicType */]: forEachChildInOptionalRestOrJSDocParameterModifier, - [320 /* JSDocFunctionType */]: function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + [294 /* JsxNamespacedName */]: function forEachChildInJsxNamespacedName(node, cbNode, _cbNodes) { + return visitNode2(cbNode, node.namespace) || visitNode2(cbNode, node.name); + }, + [189 /* OptionalType */]: forEachChildInOptionalRestOrJSDocParameterModifier, + [190 /* RestType */]: forEachChildInOptionalRestOrJSDocParameterModifier, + [315 /* JSDocTypeExpression */]: forEachChildInOptionalRestOrJSDocParameterModifier, + [321 /* JSDocNonNullableType */]: forEachChildInOptionalRestOrJSDocParameterModifier, + [320 /* JSDocNullableType */]: forEachChildInOptionalRestOrJSDocParameterModifier, + [322 /* JSDocOptionalType */]: forEachChildInOptionalRestOrJSDocParameterModifier, + [324 /* JSDocVariadicType */]: forEachChildInOptionalRestOrJSDocParameterModifier, + [323 /* JSDocFunctionType */]: function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { return visitNodes(cbNode, cbNodes, node.parameters) || visitNode2(cbNode, node.type); }, - [323 /* JSDoc */]: function forEachChildInJSDoc(node, cbNode, cbNodes) { + [326 /* JSDoc */]: function forEachChildInJSDoc(node, cbNode, cbNodes) { return (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)) || visitNodes(cbNode, cbNodes, node.tags); }, - [350 /* JSDocSeeTag */]: function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + [353 /* JSDocSeeTag */]: function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { return visitNode2(cbNode, node.tagName) || visitNode2(cbNode, node.name) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); }, - [313 /* JSDocNameReference */]: function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + [316 /* JSDocNameReference */]: function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.name); }, - [314 /* JSDocMemberName */]: function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + [317 /* JSDocMemberName */]: function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { return visitNode2(cbNode, node.left) || visitNode2(cbNode, node.right); }, - [344 /* JSDocParameterTag */]: forEachChildInJSDocParameterOrPropertyTag, - [351 /* JSDocPropertyTag */]: forEachChildInJSDocParameterOrPropertyTag, - [333 /* JSDocAuthorTag */]: function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + [347 /* JSDocParameterTag */]: forEachChildInJSDocParameterOrPropertyTag, + [354 /* JSDocPropertyTag */]: forEachChildInJSDocParameterOrPropertyTag, + [336 /* JSDocAuthorTag */]: function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { return visitNode2(cbNode, node.tagName) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); }, - [332 /* JSDocImplementsTag */]: function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + [335 /* JSDocImplementsTag */]: function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { return visitNode2(cbNode, node.tagName) || visitNode2(cbNode, node.class) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); }, - [331 /* JSDocAugmentsTag */]: function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + [334 /* JSDocAugmentsTag */]: function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { return visitNode2(cbNode, node.tagName) || visitNode2(cbNode, node.class) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); }, - [348 /* JSDocTemplateTag */]: function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + [351 /* JSDocTemplateTag */]: function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { return visitNode2(cbNode, node.tagName) || visitNode2(cbNode, node.constraint) || visitNodes(cbNode, cbNodes, node.typeParameters) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); }, - [349 /* JSDocTypedefTag */]: function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { - return visitNode2(cbNode, node.tagName) || (node.typeExpression && node.typeExpression.kind === 312 /* JSDocTypeExpression */ ? visitNode2(cbNode, node.typeExpression) || visitNode2(cbNode, node.fullName) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)) : visitNode2(cbNode, node.fullName) || visitNode2(cbNode, node.typeExpression) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment))); + [352 /* JSDocTypedefTag */]: function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode2(cbNode, node.tagName) || (node.typeExpression && node.typeExpression.kind === 315 /* JSDocTypeExpression */ ? visitNode2(cbNode, node.typeExpression) || visitNode2(cbNode, node.fullName) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)) : visitNode2(cbNode, node.fullName) || visitNode2(cbNode, node.typeExpression) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment))); }, - [341 /* JSDocCallbackTag */]: function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + [344 /* JSDocCallbackTag */]: function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { return visitNode2(cbNode, node.tagName) || visitNode2(cbNode, node.fullName) || visitNode2(cbNode, node.typeExpression) || (typeof node.comment === "string" ? void 0 : visitNodes(cbNode, cbNodes, node.comment)); }, - [345 /* JSDocReturnTag */]: forEachChildInJSDocTypeLikeTag, - [347 /* JSDocTypeTag */]: forEachChildInJSDocTypeLikeTag, - [346 /* JSDocThisTag */]: forEachChildInJSDocTypeLikeTag, - [343 /* JSDocEnumTag */]: forEachChildInJSDocTypeLikeTag, - [353 /* JSDocSatisfiesTag */]: forEachChildInJSDocTypeLikeTag, - [352 /* JSDocThrowsTag */]: forEachChildInJSDocTypeLikeTag, - [342 /* JSDocOverloadTag */]: forEachChildInJSDocTypeLikeTag, - [326 /* JSDocSignature */]: function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + [348 /* JSDocReturnTag */]: forEachChildInJSDocTypeLikeTag, + [350 /* JSDocTypeTag */]: forEachChildInJSDocTypeLikeTag, + [349 /* JSDocThisTag */]: forEachChildInJSDocTypeLikeTag, + [346 /* JSDocEnumTag */]: forEachChildInJSDocTypeLikeTag, + [356 /* JSDocSatisfiesTag */]: forEachChildInJSDocTypeLikeTag, + [355 /* JSDocThrowsTag */]: forEachChildInJSDocTypeLikeTag, + [345 /* JSDocOverloadTag */]: forEachChildInJSDocTypeLikeTag, + [329 /* JSDocSignature */]: function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { return forEach(node.typeParameters, cbNode) || forEach(node.parameters, cbNode) || visitNode2(cbNode, node.type); }, - [327 /* JSDocLink */]: forEachChildInJSDocLinkCodeOrPlain, - [328 /* JSDocLinkCode */]: forEachChildInJSDocLinkCodeOrPlain, - [329 /* JSDocLinkPlain */]: forEachChildInJSDocLinkCodeOrPlain, - [325 /* JSDocTypeLiteral */]: function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + [330 /* JSDocLink */]: forEachChildInJSDocLinkCodeOrPlain, + [331 /* JSDocLinkCode */]: forEachChildInJSDocLinkCodeOrPlain, + [332 /* JSDocLinkPlain */]: forEachChildInJSDocLinkCodeOrPlain, + [328 /* JSDocTypeLiteral */]: function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { return forEach(node.jsDocPropertyTags, cbNode); }, - [330 /* JSDocTag */]: forEachChildInJSDocTag, - [335 /* JSDocClassTag */]: forEachChildInJSDocTag, - [336 /* JSDocPublicTag */]: forEachChildInJSDocTag, - [337 /* JSDocPrivateTag */]: forEachChildInJSDocTag, - [338 /* JSDocProtectedTag */]: forEachChildInJSDocTag, - [339 /* JSDocReadonlyTag */]: forEachChildInJSDocTag, - [334 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag, - [340 /* JSDocOverrideTag */]: forEachChildInJSDocTag, - [356 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression + [333 /* JSDocTag */]: forEachChildInJSDocTag, + [338 /* JSDocClassTag */]: forEachChildInJSDocTag, + [339 /* JSDocPublicTag */]: forEachChildInJSDocTag, + [340 /* JSDocPrivateTag */]: forEachChildInJSDocTag, + [341 /* JSDocProtectedTag */]: forEachChildInJSDocTag, + [342 /* JSDocReadonlyTag */]: forEachChildInJSDocTag, + [337 /* JSDocDeprecatedTag */]: forEachChildInJSDocTag, + [343 /* JSDocOverrideTag */]: forEachChildInJSDocTag, + [359 /* PartiallyEmittedExpression */]: forEachChildInPartiallyEmittedExpression }; ((Parser2) => { var scanner2 = createScanner( @@ -28551,18 +28681,16 @@ ${lanes.join("\n")} var topLevel = true; var parseErrorBeforeNextFinishedNode = false; function parseSourceFile(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes = false, scriptKind2, setExternalModuleIndicatorOverride) { - var _a2; + var _a; scriptKind2 = ensureScriptKind(fileName2, scriptKind2); if (scriptKind2 === 6 /* JSON */) { const result2 = parseJsonText2(fileName2, sourceText2, languageVersion2, syntaxCursor2, setParentNodes); - convertToObjectWorker( + convertToJson( result2, - (_a2 = result2.statements[0]) == null ? void 0 : _a2.expression, + (_a = result2.statements[0]) == null ? void 0 : _a.expression, result2.parseDiagnostics, /*returnValue*/ false, - /*knownRootOptions*/ - void 0, /*jsonConversionNotifier*/ void 0 ); @@ -28613,24 +28741,24 @@ ${lanes.join("\n")} while (token() !== 1 /* EndOfFileToken */) { let expression2; switch (token()) { - case 22 /* OpenBracketToken */: + case 23 /* OpenBracketToken */: expression2 = parseArrayLiteralExpression(); break; - case 110 /* TrueKeyword */: - case 95 /* FalseKeyword */: - case 104 /* NullKeyword */: + case 112 /* TrueKeyword */: + case 97 /* FalseKeyword */: + case 106 /* NullKeyword */: expression2 = parseTokenNode(); break; - case 40 /* MinusToken */: - if (lookAhead(() => nextToken() === 8 /* NumericLiteral */ && nextToken() !== 58 /* ColonToken */)) { + case 41 /* MinusToken */: + if (lookAhead(() => nextToken() === 9 /* NumericLiteral */ && nextToken() !== 59 /* ColonToken */)) { expression2 = parsePrefixUnaryExpression(); } else { expression2 = parseObjectLiteralExpression(); } break; - case 8 /* NumericLiteral */: - case 10 /* StringLiteral */: - if (lookAhead(() => nextToken() !== 58 /* ColonToken */)) { + case 9 /* NumericLiteral */: + case 11 /* StringLiteral */: + if (lookAhead(() => nextToken() !== 59 /* ColonToken */)) { expression2 = parseLiteralNode(); break; } @@ -28659,7 +28787,7 @@ ${lanes.join("\n")} fileName2, 2 /* ES2015 */, 6 /* JSON */, - /*isDeclaration*/ + /*isDeclarationFile*/ false, statements, endOfFileToken, @@ -28801,13 +28929,13 @@ ${lanes.join("\n")} speculationHelper(() => { const savedContextFlags = contextFlags; contextFlags |= 32768 /* AwaitContext */; - scanner2.setTextPos(nextStatement.pos); + scanner2.resetTokenState(nextStatement.pos); nextToken(); while (token() !== 1 /* EndOfFileToken */) { - const startPos = scanner2.getStartPos(); + const startPos = scanner2.getTokenFullStart(); const statement = parseListElement(0 /* SourceElements */, parseStatement); statements.push(statement); - if (startPos === scanner2.getStartPos()) { + if (startPos === scanner2.getTokenFullStart()) { nextToken(); } if (pos >= 0) { @@ -28994,30 +29122,30 @@ ${lanes.join("\n")} function inAwaitContext() { return inContext(32768 /* AwaitContext */); } - function parseErrorAtCurrentToken(message, arg0) { - return parseErrorAt(scanner2.getTokenPos(), scanner2.getTextPos(), message, arg0); + function parseErrorAtCurrentToken(message, ...args) { + return parseErrorAt(scanner2.getTokenStart(), scanner2.getTokenEnd(), message, ...args); } - function parseErrorAtPosition(start, length2, message, arg0) { + function parseErrorAtPosition(start, length2, message, ...args) { const lastError = lastOrUndefined(parseDiagnostics); let result; if (!lastError || start !== lastError.start) { - result = createDetachedDiagnostic(fileName, start, length2, message, arg0); + result = createDetachedDiagnostic(fileName, start, length2, message, ...args); parseDiagnostics.push(result); } parseErrorBeforeNextFinishedNode = true; return result; } - function parseErrorAt(start, end, message, arg0) { - return parseErrorAtPosition(start, end - start, message, arg0); + function parseErrorAt(start, end, message, ...args) { + return parseErrorAtPosition(start, end - start, message, ...args); } - function parseErrorAtRange(range, message, arg0) { - parseErrorAt(range.pos, range.end, message, arg0); + function parseErrorAtRange(range, message, ...args) { + parseErrorAt(range.pos, range.end, message, ...args); } - function scanError(message, length2) { - parseErrorAtPosition(scanner2.getTextPos(), length2, message); + function scanError(message, length2, arg0) { + parseErrorAtPosition(scanner2.getTokenEnd(), length2, message, arg0); } function getNodePos() { - return scanner2.getStartPos(); + return scanner2.getTokenFullStart(); } function hasPrecedingJSDocComment() { return scanner2.hasPrecedingJSDocComment(); @@ -29034,13 +29162,16 @@ ${lanes.join("\n")} } function nextToken() { if (isKeyword(currentToken) && (scanner2.hasUnicodeEscape() || scanner2.hasExtendedUnicodeEscape())) { - parseErrorAt(scanner2.getTokenPos(), scanner2.getTextPos(), Diagnostics.Keywords_cannot_contain_escape_characters); + parseErrorAt(scanner2.getTokenStart(), scanner2.getTokenEnd(), Diagnostics.Keywords_cannot_contain_escape_characters); } return nextTokenWithoutCheck(); } function nextTokenJSDoc() { return currentToken = scanner2.scanJsDocToken(); } + function nextJSDocCommentTextToken(inBackticks) { + return currentToken = scanner2.scanJSDocCommentTextToken(inBackticks); + } function reScanGreaterToken() { return currentToken = scanner2.reScanGreaterToken(); } @@ -29050,9 +29181,6 @@ ${lanes.join("\n")} function reScanTemplateToken(isTaggedTemplate) { return currentToken = scanner2.reScanTemplateToken(isTaggedTemplate); } - function reScanTemplateHeadOrNoSubstitutionTemplate() { - return currentToken = scanner2.reScanTemplateHeadOrNoSubstitutionTemplate(); - } function reScanLessThanToken() { return currentToken = scanner2.reScanLessThanToken(); } @@ -29091,22 +29219,22 @@ ${lanes.join("\n")} return speculationHelper(callback, 0 /* TryParse */); } function isBindingIdentifier() { - if (token() === 79 /* Identifier */) { + if (token() === 80 /* Identifier */) { return true; } - return token() > 116 /* LastReservedWord */; + return token() > 118 /* LastReservedWord */; } function isIdentifier2() { - if (token() === 79 /* Identifier */) { + if (token() === 80 /* Identifier */) { return true; } - if (token() === 125 /* YieldKeyword */ && inYieldContext()) { + if (token() === 127 /* YieldKeyword */ && inYieldContext()) { return false; } - if (token() === 133 /* AwaitKeyword */ && inAwaitContext()) { + if (token() === 135 /* AwaitKeyword */ && inAwaitContext()) { return false; } - return token() > 116 /* LastReservedWord */; + return token() > 118 /* LastReservedWord */; } function parseExpected(kind, diagnosticMessage, shouldAdvance = true) { if (token() === kind) { @@ -29124,14 +29252,13 @@ ${lanes.join("\n")} } const viableKeywordSuggestions = Object.keys(textToKeywordObj).filter((keyword) => keyword.length > 2); function parseErrorForMissingSemicolonAfter(node) { - var _a2; if (isTaggedTemplateExpression(node)) { parseErrorAt(skipTrivia(sourceText, node.template.pos), node.template.end, Diagnostics.Module_declaration_names_may_only_use_or_quoted_strings); return; } const expressionText = isIdentifier(node) ? idText(node) : void 0; if (!expressionText || !isIdentifierText(expressionText, languageVersion)) { - parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(26 /* SemicolonToken */)); + parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(27 /* SemicolonToken */)); return; } const pos = skipTrivia(sourceText, node.pos); @@ -29144,20 +29271,20 @@ ${lanes.join("\n")} case "declare": return; case "interface": - parseErrorForInvalidName(Diagnostics.Interface_name_cannot_be_0, Diagnostics.Interface_must_be_given_a_name, 18 /* OpenBraceToken */); + parseErrorForInvalidName(Diagnostics.Interface_name_cannot_be_0, Diagnostics.Interface_must_be_given_a_name, 19 /* OpenBraceToken */); return; case "is": - parseErrorAt(pos, scanner2.getTextPos(), Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); + parseErrorAt(pos, scanner2.getTokenStart(), Diagnostics.A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods); return; case "module": case "namespace": - parseErrorForInvalidName(Diagnostics.Namespace_name_cannot_be_0, Diagnostics.Namespace_must_be_given_a_name, 18 /* OpenBraceToken */); + parseErrorForInvalidName(Diagnostics.Namespace_name_cannot_be_0, Diagnostics.Namespace_must_be_given_a_name, 19 /* OpenBraceToken */); return; case "type": - parseErrorForInvalidName(Diagnostics.Type_alias_name_cannot_be_0, Diagnostics.Type_alias_must_be_given_a_name, 63 /* EqualsToken */); + parseErrorForInvalidName(Diagnostics.Type_alias_name_cannot_be_0, Diagnostics.Type_alias_must_be_given_a_name, 64 /* EqualsToken */); return; } - const suggestion = (_a2 = getSpellingSuggestion(expressionText, viableKeywordSuggestions, (n) => n)) != null ? _a2 : getSpaceSuggestion(expressionText); + const suggestion = getSpellingSuggestion(expressionText, viableKeywordSuggestions, (n) => n) ?? getSpaceSuggestion(expressionText); if (suggestion) { parseErrorAt(pos, node.end, Diagnostics.Unknown_keyword_or_identifier_Did_you_mean_0, suggestion); return; @@ -29183,18 +29310,18 @@ ${lanes.join("\n")} return void 0; } function parseSemicolonAfterPropertyName(name, type, initializer) { - if (token() === 59 /* AtToken */ && !scanner2.hasPrecedingLineBreak()) { + if (token() === 60 /* AtToken */ && !scanner2.hasPrecedingLineBreak()) { parseErrorAtCurrentToken(Diagnostics.Decorators_must_precede_the_name_and_all_keywords_of_property_declarations); return; } - if (token() === 20 /* OpenParenToken */) { + if (token() === 21 /* OpenParenToken */) { parseErrorAtCurrentToken(Diagnostics.Cannot_start_a_function_call_in_a_type_annotation); nextToken(); return; } if (type && !canParseSemicolon()) { if (initializer) { - parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(26 /* SemicolonToken */)); + parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(27 /* SemicolonToken */)); } else { parseErrorAtCurrentToken(Diagnostics.Expected_for_property_initializer); } @@ -29204,7 +29331,7 @@ ${lanes.join("\n")} return; } if (initializer) { - parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(26 /* SemicolonToken */)); + parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(27 /* SemicolonToken */)); return; } parseErrorForMissingSemicolonAfter(name); @@ -29214,6 +29341,7 @@ ${lanes.join("\n")} nextTokenJSDoc(); return true; } + Debug.assert(isKeywordOrPunctuation(kind)); parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(kind)); return false; } @@ -29262,7 +29390,11 @@ ${lanes.join("\n")} ); } function parseExpectedTokenJSDoc(t) { - return parseOptionalTokenJSDoc(t) || createMissingNode( + const optional = parseOptionalTokenJSDoc(t); + if (optional) + return optional; + Debug.assert(isKeywordOrPunctuation(t)); + return createMissingNode( t, /*reportAtCurrentPosition*/ false, @@ -29283,30 +29415,30 @@ ${lanes.join("\n")} return finishNode(factoryCreateToken(kind), pos); } function canParseSemicolon() { - if (token() === 26 /* SemicolonToken */) { + if (token() === 27 /* SemicolonToken */) { return true; } - return token() === 19 /* CloseBraceToken */ || token() === 1 /* EndOfFileToken */ || scanner2.hasPrecedingLineBreak(); + return token() === 20 /* CloseBraceToken */ || token() === 1 /* EndOfFileToken */ || scanner2.hasPrecedingLineBreak(); } function tryParseSemicolon() { if (!canParseSemicolon()) { return false; } - if (token() === 26 /* SemicolonToken */) { + if (token() === 27 /* SemicolonToken */) { nextToken(); } return true; } function parseSemicolon() { - return tryParseSemicolon() || parseExpected(26 /* SemicolonToken */); + return tryParseSemicolon() || parseExpected(27 /* SemicolonToken */); } function createNodeArray(elements, pos, end, hasTrailingComma) { const array = factoryCreateNodeArray(elements, hasTrailingComma); - setTextRangePosEnd(array, pos, end != null ? end : scanner2.getStartPos()); + setTextRangePosEnd(array, pos, end ?? scanner2.getTokenFullStart()); return array; } function finishNode(node, pos, end) { - setTextRangePosEnd(node, pos, end != null ? end : scanner2.getStartPos()); + setTextRangePosEnd(node, pos, end ?? scanner2.getTokenFullStart()); if (contextFlags) { node.flags |= contextFlags; } @@ -29316,14 +29448,14 @@ ${lanes.join("\n")} } return node; } - function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, arg0) { + function createMissingNode(kind, reportAtCurrentPosition, diagnosticMessage, ...args) { if (reportAtCurrentPosition) { - parseErrorAtPosition(scanner2.getStartPos(), 0, diagnosticMessage, arg0); + parseErrorAtPosition(scanner2.getTokenFullStart(), 0, diagnosticMessage, ...args); } else if (diagnosticMessage) { - parseErrorAtCurrentToken(diagnosticMessage, arg0); + parseErrorAtCurrentToken(diagnosticMessage, ...args); } const pos = getNodePos(); - const result = kind === 79 /* Identifier */ ? factoryCreateIdentifier( + const result = kind === 80 /* Identifier */ ? factoryCreateIdentifier( "", /*originalKeywordKind*/ void 0 @@ -29333,15 +29465,15 @@ ${lanes.join("\n")} "", /*templateFlags*/ void 0 - ) : kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral( + ) : kind === 9 /* NumericLiteral */ ? factoryCreateNumericLiteral( "", /*numericLiteralFlags*/ void 0 - ) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral( + ) : kind === 11 /* StringLiteral */ ? factoryCreateStringLiteral( "", /*isSingleQuote*/ void 0 - ) : kind === 279 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factoryCreateToken(kind); + ) : kind === 281 /* MissingDeclaration */ ? factory2.createMissingDeclaration() : factoryCreateToken(kind); return finishNode(result, pos); } function internIdentifier(text) { @@ -29361,14 +29493,14 @@ ${lanes.join("\n")} nextTokenWithoutCheck(); return finishNode(factoryCreateIdentifier(text, originalKeywordKind, hasExtendedUnicodeEscape), pos); } - if (token() === 80 /* PrivateIdentifier */) { + if (token() === 81 /* PrivateIdentifier */) { parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); return createIdentifier( /*isIdentifier*/ true ); } - if (token() === 0 /* Unknown */ && scanner2.tryScan(() => scanner2.reScanInvalidIdentifier() === 79 /* Identifier */)) { + if (token() === 0 /* Unknown */ && scanner2.tryScan(() => scanner2.reScanInvalidIdentifier() === 80 /* Identifier */)) { return createIdentifier( /*isIdentifier*/ true @@ -29379,7 +29511,7 @@ ${lanes.join("\n")} const isReservedWord = scanner2.isReservedWord(); const msgArg = scanner2.getTokenText(); const defaultMessage = isReservedWord ? Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here : Diagnostics.Identifier_expected; - return createMissingNode(79 /* Identifier */, reportAtCurrentPosition, diagnosticMessage || defaultMessage, msgArg); + return createMissingNode(80 /* Identifier */, reportAtCurrentPosition, diagnosticMessage || defaultMessage, msgArg); } function parseBindingIdentifier(privateIdentifierDiagnosticMessage) { return createIdentifier( @@ -29396,21 +29528,21 @@ ${lanes.join("\n")} return createIdentifier(tokenIsIdentifierOrKeyword(token()), diagnosticMessage); } function isLiteralPropertyName() { - return tokenIsIdentifierOrKeyword(token()) || token() === 10 /* StringLiteral */ || token() === 8 /* NumericLiteral */; + return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */; } function isAssertionKey2() { - return tokenIsIdentifierOrKeyword(token()) || token() === 10 /* StringLiteral */; + return tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */; } function parsePropertyNameWorker(allowComputedPropertyNames) { - if (token() === 10 /* StringLiteral */ || token() === 8 /* NumericLiteral */) { + if (token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */) { const node = parseLiteralNode(); node.text = internIdentifier(node.text); return node; } - if (allowComputedPropertyNames && token() === 22 /* OpenBracketToken */) { + if (allowComputedPropertyNames && token() === 23 /* OpenBracketToken */) { return parseComputedPropertyName(); } - if (token() === 80 /* PrivateIdentifier */) { + if (token() === 81 /* PrivateIdentifier */) { return parsePrivateIdentifier(); } return parseIdentifierName(); @@ -29423,9 +29555,9 @@ ${lanes.join("\n")} } function parseComputedPropertyName() { const pos = getNodePos(); - parseExpected(22 /* OpenBracketToken */); + parseExpected(23 /* OpenBracketToken */); const expression = allowInAnd(parseExpression); - parseExpected(23 /* CloseBracketToken */); + parseExpected(24 /* CloseBracketToken */); return finishNode(factory2.createComputedPropertyName(expression), pos); } function parsePrivateIdentifier() { @@ -29446,22 +29578,22 @@ ${lanes.join("\n")} } function nextTokenCanFollowModifier() { switch (token()) { - case 85 /* ConstKeyword */: - return nextToken() === 92 /* EnumKeyword */; - case 93 /* ExportKeyword */: + case 87 /* ConstKeyword */: + return nextToken() === 94 /* EnumKeyword */; + case 95 /* ExportKeyword */: nextToken(); - if (token() === 88 /* DefaultKeyword */) { + if (token() === 90 /* DefaultKeyword */) { return lookAhead(nextTokenCanFollowDefaultKeyword); } - if (token() === 154 /* TypeKeyword */) { + if (token() === 156 /* TypeKeyword */) { return lookAhead(nextTokenCanFollowExportModifier); } return canFollowExportModifier(); - case 88 /* DefaultKeyword */: + case 90 /* DefaultKeyword */: return nextTokenCanFollowDefaultKeyword(); - case 124 /* StaticKeyword */: - case 137 /* GetKeyword */: - case 151 /* SetKeyword */: + case 126 /* StaticKeyword */: + case 139 /* GetKeyword */: + case 153 /* SetKeyword */: nextToken(); return canFollowModifier(); default: @@ -29469,7 +29601,7 @@ ${lanes.join("\n")} } } function canFollowExportModifier() { - return token() === 59 /* AtToken */ || token() !== 41 /* AsteriskToken */ && token() !== 128 /* AsKeyword */ && token() !== 18 /* OpenBraceToken */ && canFollowModifier(); + return token() === 60 /* AtToken */ || token() !== 42 /* AsteriskToken */ && token() !== 130 /* AsKeyword */ && token() !== 19 /* OpenBraceToken */ && canFollowModifier(); } function nextTokenCanFollowExportModifier() { nextToken(); @@ -29479,11 +29611,11 @@ ${lanes.join("\n")} return isModifierKind(token()) && tryParse(nextTokenCanFollowModifier); } function canFollowModifier() { - return token() === 22 /* OpenBracketToken */ || token() === 18 /* OpenBraceToken */ || token() === 41 /* AsteriskToken */ || token() === 25 /* DotDotDotToken */ || isLiteralPropertyName(); + return token() === 23 /* OpenBracketToken */ || token() === 19 /* OpenBraceToken */ || token() === 42 /* AsteriskToken */ || token() === 26 /* DotDotDotToken */ || isLiteralPropertyName(); } function nextTokenCanFollowDefaultKeyword() { nextToken(); - return token() === 84 /* ClassKeyword */ || token() === 98 /* FunctionKeyword */ || token() === 118 /* InterfaceKeyword */ || token() === 59 /* AtToken */ || token() === 126 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine) || token() === 132 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine); + return token() === 86 /* ClassKeyword */ || token() === 100 /* FunctionKeyword */ || token() === 120 /* InterfaceKeyword */ || token() === 60 /* AtToken */ || token() === 128 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine) || token() === 134 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine); } function isListElement2(parsingContext2, inErrorRecovery) { const node = currentNode(parsingContext2); @@ -29494,21 +29626,21 @@ ${lanes.join("\n")} case 0 /* SourceElements */: case 1 /* BlockStatements */: case 3 /* SwitchClauseStatements */: - return !(token() === 26 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement(); + return !(token() === 27 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement(); case 2 /* SwitchClauses */: - return token() === 82 /* CaseKeyword */ || token() === 88 /* DefaultKeyword */; + return token() === 84 /* CaseKeyword */ || token() === 90 /* DefaultKeyword */; case 4 /* TypeMembers */: return lookAhead(isTypeMemberStart); case 5 /* ClassMembers */: - return lookAhead(isClassMemberStart) || token() === 26 /* SemicolonToken */ && !inErrorRecovery; + return lookAhead(isClassMemberStart) || token() === 27 /* SemicolonToken */ && !inErrorRecovery; case 6 /* EnumMembers */: - return token() === 22 /* OpenBracketToken */ || isLiteralPropertyName(); + return token() === 23 /* OpenBracketToken */ || isLiteralPropertyName(); case 12 /* ObjectLiteralMembers */: switch (token()) { - case 22 /* OpenBracketToken */: - case 41 /* AsteriskToken */: - case 25 /* DotDotDotToken */: - case 24 /* DotToken */: + case 23 /* OpenBracketToken */: + case 42 /* AsteriskToken */: + case 26 /* DotDotDotToken */: + case 25 /* DotToken */: return true; default: return isLiteralPropertyName(); @@ -29516,11 +29648,11 @@ ${lanes.join("\n")} case 18 /* RestProperties */: return isLiteralPropertyName(); case 9 /* ObjectBindingElements */: - return token() === 22 /* OpenBracketToken */ || token() === 25 /* DotDotDotToken */ || isLiteralPropertyName(); + return token() === 23 /* OpenBracketToken */ || token() === 26 /* DotDotDotToken */ || isLiteralPropertyName(); case 24 /* AssertEntries */: return isAssertionKey2(); case 7 /* HeritageClauseElement */: - if (token() === 18 /* OpenBraceToken */) { + if (token() === 19 /* OpenBraceToken */) { return lookAhead(isValidHeritageClauseObjectLiteral); } if (!inErrorRecovery) { @@ -29531,17 +29663,17 @@ ${lanes.join("\n")} case 8 /* VariableDeclarations */: return isBindingIdentifierOrPrivateIdentifierOrPattern(); case 10 /* ArrayBindingElements */: - return token() === 27 /* CommaToken */ || token() === 25 /* DotDotDotToken */ || isBindingIdentifierOrPrivateIdentifierOrPattern(); + return token() === 28 /* CommaToken */ || token() === 26 /* DotDotDotToken */ || isBindingIdentifierOrPrivateIdentifierOrPattern(); case 19 /* TypeParameters */: - return token() === 101 /* InKeyword */ || token() === 85 /* ConstKeyword */ || isIdentifier2(); + return token() === 103 /* InKeyword */ || token() === 87 /* ConstKeyword */ || isIdentifier2(); case 15 /* ArrayLiteralMembers */: switch (token()) { - case 27 /* CommaToken */: - case 24 /* DotToken */: + case 28 /* CommaToken */: + case 25 /* DotToken */: return true; } case 11 /* ArgumentExpressions */: - return token() === 25 /* DotDotDotToken */ || isStartOfExpression(); + return token() === 26 /* DotDotDotToken */ || isStartOfExpression(); case 16 /* Parameters */: return isStartOfParameter( /*isJSDocParameter*/ @@ -29554,23 +29686,28 @@ ${lanes.join("\n")} ); case 20 /* TypeArguments */: case 21 /* TupleElementTypes */: - return token() === 27 /* CommaToken */ || isStartOfType(); + return token() === 28 /* CommaToken */ || isStartOfType(); case 22 /* HeritageClauses */: return isHeritageClause2(); case 23 /* ImportOrExportSpecifiers */: return tokenIsIdentifierOrKeyword(token()); case 13 /* JsxAttributes */: - return tokenIsIdentifierOrKeyword(token()) || token() === 18 /* OpenBraceToken */; + return tokenIsIdentifierOrKeyword(token()) || token() === 19 /* OpenBraceToken */; case 14 /* JsxChildren */: return true; + case 25 /* JSDocComment */: + return true; + case 26 /* Count */: + return Debug.fail("ParsingContext.Count used as a context"); + default: + Debug.assertNever(parsingContext2, "Non-exhaustive case in 'isListElement'."); } - return Debug.fail("Non-exhaustive case in 'isListElement'."); } function isValidHeritageClauseObjectLiteral() { - Debug.assert(token() === 18 /* OpenBraceToken */); - if (nextToken() === 19 /* CloseBraceToken */) { + Debug.assert(token() === 19 /* OpenBraceToken */); + if (nextToken() === 20 /* CloseBraceToken */) { const next = nextToken(); - return next === 27 /* CommaToken */ || next === 18 /* OpenBraceToken */ || next === 94 /* ExtendsKeyword */ || next === 117 /* ImplementsKeyword */; + return next === 28 /* CommaToken */ || next === 19 /* OpenBraceToken */ || next === 96 /* ExtendsKeyword */ || next === 119 /* ImplementsKeyword */; } return true; } @@ -29587,7 +29724,7 @@ ${lanes.join("\n")} return tokenIsIdentifierOrKeywordOrGreaterThan(token()); } function isHeritageClauseExtendsOrImplementsKeyword() { - if (token() === 117 /* ImplementsKeyword */ || token() === 94 /* ExtendsKeyword */) { + if (token() === 119 /* ImplementsKeyword */ || token() === 96 /* ExtendsKeyword */) { return lookAhead(nextTokenIsStartOfExpression); } return false; @@ -29614,33 +29751,33 @@ ${lanes.join("\n")} case 9 /* ObjectBindingElements */: case 23 /* ImportOrExportSpecifiers */: case 24 /* AssertEntries */: - return token() === 19 /* CloseBraceToken */; + return token() === 20 /* CloseBraceToken */; case 3 /* SwitchClauseStatements */: - return token() === 19 /* CloseBraceToken */ || token() === 82 /* CaseKeyword */ || token() === 88 /* DefaultKeyword */; + return token() === 20 /* CloseBraceToken */ || token() === 84 /* CaseKeyword */ || token() === 90 /* DefaultKeyword */; case 7 /* HeritageClauseElement */: - return token() === 18 /* OpenBraceToken */ || token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */; + return token() === 19 /* OpenBraceToken */ || token() === 96 /* ExtendsKeyword */ || token() === 119 /* ImplementsKeyword */; case 8 /* VariableDeclarations */: return isVariableDeclaratorListTerminator(); case 19 /* TypeParameters */: - return token() === 31 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */; + return token() === 32 /* GreaterThanToken */ || token() === 21 /* OpenParenToken */ || token() === 19 /* OpenBraceToken */ || token() === 96 /* ExtendsKeyword */ || token() === 119 /* ImplementsKeyword */; case 11 /* ArgumentExpressions */: - return token() === 21 /* CloseParenToken */ || token() === 26 /* SemicolonToken */; + return token() === 22 /* CloseParenToken */ || token() === 27 /* SemicolonToken */; case 15 /* ArrayLiteralMembers */: case 21 /* TupleElementTypes */: case 10 /* ArrayBindingElements */: - return token() === 23 /* CloseBracketToken */; + return token() === 24 /* CloseBracketToken */; case 17 /* JSDocParameters */: case 16 /* Parameters */: case 18 /* RestProperties */: - return token() === 21 /* CloseParenToken */ || token() === 23 /* CloseBracketToken */; + return token() === 22 /* CloseParenToken */ || token() === 24 /* CloseBracketToken */; case 20 /* TypeArguments */: - return token() !== 27 /* CommaToken */; + return token() !== 28 /* CommaToken */; case 22 /* HeritageClauses */: - return token() === 18 /* OpenBraceToken */ || token() === 19 /* CloseBraceToken */; + return token() === 19 /* OpenBraceToken */ || token() === 20 /* CloseBraceToken */; case 13 /* JsxAttributes */: - return token() === 31 /* GreaterThanToken */ || token() === 43 /* SlashToken */; + return token() === 32 /* GreaterThanToken */ || token() === 44 /* SlashToken */; case 14 /* JsxChildren */: - return token() === 29 /* LessThanToken */ && lookAhead(nextTokenIsSlash); + return token() === 30 /* LessThanToken */ && lookAhead(nextTokenIsSlash); default: return false; } @@ -29652,13 +29789,14 @@ ${lanes.join("\n")} if (isInOrOfKeyword(token())) { return true; } - if (token() === 38 /* EqualsGreaterThanToken */) { + if (token() === 39 /* EqualsGreaterThanToken */) { return true; } return false; } function isInSomeParsingContext() { - for (let kind = 0; kind < 25 /* Count */; kind++) { + Debug.assert(parsingContext, "Missing parsing context"); + for (let kind = 0; kind < 26 /* Count */; kind++) { if (parsingContext & 1 << kind) { if (isListElement2( kind, @@ -29700,11 +29838,11 @@ ${lanes.join("\n")} return parseElement(); } function currentNode(parsingContext2, pos) { - var _a2; + var _a; if (!syntaxCursor || !isReusableParsingContext(parsingContext2) || parseErrorBeforeNextFinishedNode) { return void 0; } - const node = syntaxCursor.currentNode(pos != null ? pos : scanner2.getStartPos()); + const node = syntaxCursor.currentNode(pos ?? scanner2.getTokenFullStart()); if (nodeIsMissing(node) || node.intersectsChange || containsParseError(node)) { return void 0; } @@ -29715,13 +29853,13 @@ ${lanes.join("\n")} if (!canReuseNode(node, parsingContext2)) { return void 0; } - if (canHaveJSDoc(node) && ((_a2 = node.jsDoc) == null ? void 0 : _a2.jsDocCache)) { + if (canHaveJSDoc(node) && ((_a = node.jsDoc) == null ? void 0 : _a.jsDocCache)) { node.jsDoc.jsDocCache = void 0; } return node; } function consumeNode(node) { - scanner2.setTextPos(node.end); + scanner2.resetTokenState(node.end); nextToken(); return node; } @@ -29766,16 +29904,16 @@ ${lanes.join("\n")} function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 173 /* Constructor */: - case 178 /* IndexSignature */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 169 /* PropertyDeclaration */: - case 237 /* SemicolonClassElement */: + case 175 /* Constructor */: + case 180 /* IndexSignature */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 171 /* PropertyDeclaration */: + case 239 /* SemicolonClassElement */: return true; - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: const methodDeclaration = node; - const nameIsConstructor = methodDeclaration.name.kind === 79 /* Identifier */ && methodDeclaration.name.escapedText === "constructor"; + const nameIsConstructor = methodDeclaration.name.kind === 80 /* Identifier */ && methodDeclaration.name.escapedText === "constructor"; return !nameIsConstructor; } } @@ -29784,8 +29922,8 @@ ${lanes.join("\n")} function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 292 /* CaseClause */: - case 293 /* DefaultClause */: + case 295 /* CaseClause */: + case 296 /* DefaultClause */: return true; } } @@ -29794,65 +29932,65 @@ ${lanes.join("\n")} function isReusableStatement(node) { if (node) { switch (node.kind) { - case 259 /* FunctionDeclaration */: - case 240 /* VariableStatement */: - case 238 /* Block */: - case 242 /* IfStatement */: - case 241 /* ExpressionStatement */: - case 254 /* ThrowStatement */: - case 250 /* ReturnStatement */: - case 252 /* SwitchStatement */: - case 249 /* BreakStatement */: - case 248 /* ContinueStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: - case 245 /* ForStatement */: - case 244 /* WhileStatement */: - case 251 /* WithStatement */: - case 239 /* EmptyStatement */: - case 255 /* TryStatement */: - case 253 /* LabeledStatement */: - case 243 /* DoStatement */: - case 256 /* DebuggerStatement */: - case 269 /* ImportDeclaration */: - case 268 /* ImportEqualsDeclaration */: - case 275 /* ExportDeclaration */: - case 274 /* ExportAssignment */: - case 264 /* ModuleDeclaration */: - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: - case 263 /* EnumDeclaration */: - case 262 /* TypeAliasDeclaration */: + case 261 /* FunctionDeclaration */: + case 242 /* VariableStatement */: + case 240 /* Block */: + case 244 /* IfStatement */: + case 243 /* ExpressionStatement */: + case 256 /* ThrowStatement */: + case 252 /* ReturnStatement */: + case 254 /* SwitchStatement */: + case 251 /* BreakStatement */: + case 250 /* ContinueStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 247 /* ForStatement */: + case 246 /* WhileStatement */: + case 253 /* WithStatement */: + case 241 /* EmptyStatement */: + case 257 /* TryStatement */: + case 255 /* LabeledStatement */: + case 245 /* DoStatement */: + case 258 /* DebuggerStatement */: + case 271 /* ImportDeclaration */: + case 270 /* ImportEqualsDeclaration */: + case 277 /* ExportDeclaration */: + case 276 /* ExportAssignment */: + case 266 /* ModuleDeclaration */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: + case 265 /* EnumDeclaration */: + case 264 /* TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 302 /* EnumMember */; + return node.kind === 305 /* EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 177 /* ConstructSignature */: - case 170 /* MethodSignature */: - case 178 /* IndexSignature */: - case 168 /* PropertySignature */: - case 176 /* CallSignature */: + case 179 /* ConstructSignature */: + case 172 /* MethodSignature */: + case 180 /* IndexSignature */: + case 170 /* PropertySignature */: + case 178 /* CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 257 /* VariableDeclaration */) { + if (node.kind !== 259 /* VariableDeclaration */) { return false; } const variableDeclarator = node; return variableDeclarator.initializer === void 0; } function isReusableParameter(node) { - if (node.kind !== 166 /* Parameter */) { + if (node.kind !== 168 /* Parameter */) { return false; } const parameter = node; @@ -29869,7 +30007,7 @@ ${lanes.join("\n")} function parsingContextErrors(context) { switch (context) { case 0 /* SourceElements */: - return token() === 88 /* DefaultKeyword */ ? parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(93 /* ExportKeyword */)) : parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected); + return token() === 90 /* DefaultKeyword */ ? parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(95 /* ExportKeyword */)) : parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected); case 1 /* BlockStatements */: return parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected); case 2 /* SwitchClauses */: @@ -29917,7 +30055,9 @@ ${lanes.join("\n")} return parseErrorAtCurrentToken(Diagnostics.Identifier_expected); case 24 /* AssertEntries */: return parseErrorAtCurrentToken(Diagnostics.Identifier_or_string_literal_expected); - case 25 /* Count */: + case 25 /* JSDocComment */: + return parseErrorAtCurrentToken(Diagnostics.Identifier_expected); + case 26 /* Count */: return Debug.fail("ParsingContext.Count used as a context"); default: Debug.assertNever(context); @@ -29935,26 +30075,26 @@ ${lanes.join("\n")} /*inErrorRecovery*/ false )) { - const startPos = scanner2.getStartPos(); + const startPos = scanner2.getTokenFullStart(); const result = parseListElement(kind, parseElement); if (!result) { parsingContext = saveParsingContext; return void 0; } list.push(result); - commaStart = scanner2.getTokenPos(); - if (parseOptional(27 /* CommaToken */)) { + commaStart = scanner2.getTokenStart(); + if (parseOptional(28 /* CommaToken */)) { continue; } commaStart = -1; if (isListTerminator(kind)) { break; } - parseExpected(27 /* CommaToken */, getExpectedCommaDiagnostic(kind)); - if (considerSemicolonAsDelimiter && token() === 26 /* SemicolonToken */ && !scanner2.hasPrecedingLineBreak()) { + parseExpected(28 /* CommaToken */, getExpectedCommaDiagnostic(kind)); + if (considerSemicolonAsDelimiter && token() === 27 /* SemicolonToken */ && !scanner2.hasPrecedingLineBreak()) { nextToken(); } - if (startPos === scanner2.getStartPos()) { + if (startPos === scanner2.getTokenFullStart()) { nextToken(); } continue; @@ -29997,8 +30137,8 @@ ${lanes.join("\n")} function parseEntityName(allowReservedWords, diagnosticMessage) { const pos = getNodePos(); let entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage); - while (parseOptional(24 /* DotToken */)) { - if (token() === 29 /* LessThanToken */) { + while (parseOptional(25 /* DotToken */)) { + if (token() === 30 /* LessThanToken */) { break; } entity = finishNode( @@ -30006,7 +30146,7 @@ ${lanes.join("\n")} entity, parseRightSideOfDot( allowReservedWords, - /* allowPrivateIdentifiers */ + /*allowPrivateIdentifiers*/ false ) ), @@ -30023,17 +30163,17 @@ ${lanes.join("\n")} const matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); if (matchesPattern) { return createMissingNode( - 79 /* Identifier */, + 80 /* Identifier */, /*reportAtCurrentPosition*/ true, Diagnostics.Identifier_expected ); } } - if (token() === 80 /* PrivateIdentifier */) { + if (token() === 81 /* PrivateIdentifier */) { const node = parsePrivateIdentifier(); return allowPrivateIdentifiers ? node : createMissingNode( - 79 /* Identifier */, + 80 /* Identifier */, /*reportAtCurrentPosition*/ true, Diagnostics.Identifier_expected @@ -30048,7 +30188,7 @@ ${lanes.join("\n")} do { node = parseTemplateSpan(isTaggedTemplate); list.push(node); - } while (node.literal.kind === 16 /* TemplateMiddle */); + } while (node.literal.kind === 17 /* TemplateMiddle */); return createNodeArray(list, pos); } function parseTemplateExpression(isTaggedTemplate) { @@ -30081,7 +30221,7 @@ ${lanes.join("\n")} do { node = parseTemplateTypeSpan(); list.push(node); - } while (node.literal.kind === 16 /* TemplateMiddle */); + } while (node.literal.kind === 17 /* TemplateMiddle */); return createNodeArray(list, pos); } function parseTemplateTypeSpan() { @@ -30098,11 +30238,11 @@ ${lanes.join("\n")} ); } function parseLiteralOfTemplateSpan(isTaggedTemplate) { - if (token() === 19 /* CloseBraceToken */) { + if (token() === 20 /* CloseBraceToken */) { reScanTemplateToken(isTaggedTemplate); return parseTemplateMiddleOrTemplateTail(); } else { - return parseExpectedToken(17 /* TemplateTail */, Diagnostics._0_expected, tokenToString(19 /* CloseBraceToken */)); + return parseExpectedToken(18 /* TemplateTail */, Diagnostics._0_expected, tokenToString(20 /* CloseBraceToken */)); } } function parseTemplateSpan(isTaggedTemplate) { @@ -30119,33 +30259,35 @@ ${lanes.join("\n")} return parseLiteralLikeNode(token()); } function parseTemplateHead(isTaggedTemplate) { - if (isTaggedTemplate) { - reScanTemplateHeadOrNoSubstitutionTemplate(); + if (!isTaggedTemplate && scanner2.getTokenFlags() & 26656 /* IsInvalid */) { + reScanTemplateToken( + /*isTaggedTemplate*/ + false + ); } const fragment = parseLiteralLikeNode(token()); - Debug.assert(fragment.kind === 15 /* TemplateHead */, "Template head has wrong token kind"); + Debug.assert(fragment.kind === 16 /* TemplateHead */, "Template head has wrong token kind"); return fragment; } function parseTemplateMiddleOrTemplateTail() { const fragment = parseLiteralLikeNode(token()); - Debug.assert(fragment.kind === 16 /* TemplateMiddle */ || fragment.kind === 17 /* TemplateTail */, "Template fragment has wrong token kind"); + Debug.assert(fragment.kind === 17 /* TemplateMiddle */ || fragment.kind === 18 /* TemplateTail */, "Template fragment has wrong token kind"); return fragment; } function getTemplateLiteralRawText(kind) { - const isLast = kind === 14 /* NoSubstitutionTemplateLiteral */ || kind === 17 /* TemplateTail */; + const isLast = kind === 15 /* NoSubstitutionTemplateLiteral */ || kind === 18 /* TemplateTail */; const tokenText = scanner2.getTokenText(); return tokenText.substring(1, tokenText.length - (scanner2.isUnterminated() ? 0 : isLast ? 1 : 2)); } function parseLiteralLikeNode(kind) { const pos = getNodePos(); - const node = isTemplateLiteralKind(kind) ? factory2.createTemplateLiteralLikeNode(kind, scanner2.getTokenValue(), getTemplateLiteralRawText(kind), scanner2.getTokenFlags() & 2048 /* TemplateLiteralLikeFlags */) : ( - // Octal literals are not allowed in strict mode or ES5 + const node = isTemplateLiteralKind(kind) ? factory2.createTemplateLiteralLikeNode(kind, scanner2.getTokenValue(), getTemplateLiteralRawText(kind), scanner2.getTokenFlags() & 7176 /* TemplateLiteralLikeFlags */) : ( // Note that theoretically the following condition would hold true literals like 009, // which is not octal. But because of how the scanner separates the tokens, we would // never get a token like this. Instead, we would get 00 and 9 as two separate tokens. // We also do not need to check for negatives because any prefix operator would be part of a // parent unary expression. - kind === 8 /* NumericLiteral */ ? factoryCreateNumericLiteral(scanner2.getTokenValue(), scanner2.getNumericLiteralFlags()) : kind === 10 /* StringLiteral */ ? factoryCreateStringLiteral( + kind === 9 /* NumericLiteral */ ? factoryCreateNumericLiteral(scanner2.getTokenValue(), scanner2.getNumericLiteralFlags()) : kind === 11 /* StringLiteral */ ? factoryCreateStringLiteral( scanner2.getTokenValue(), /*isSingleQuote*/ void 0, @@ -30169,8 +30311,8 @@ ${lanes.join("\n")} ); } function parseTypeArgumentsOfTypeReference() { - if (!scanner2.hasPrecedingLineBreak() && reScanLessThanToken() === 29 /* LessThanToken */) { - return parseBracketedList(20 /* TypeArguments */, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */); + if (!scanner2.hasPrecedingLineBreak() && reScanLessThanToken() === 30 /* LessThanToken */) { + return parseBracketedList(20 /* TypeArguments */, parseType, 30 /* LessThanToken */, 32 /* GreaterThanToken */); } } function parseTypeReference() { @@ -30185,14 +30327,14 @@ ${lanes.join("\n")} } function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 180 /* TypeReference */: + case 182 /* TypeReference */: return nodeIsMissing(node.typeName); - case 181 /* FunctionType */: - case 182 /* ConstructorType */: { + case 183 /* FunctionType */: + case 184 /* ConstructorType */: { const { parameters, type } = node; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 193 /* ParenthesizedType */: + case 195 /* ParenthesizedType */: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -30229,7 +30371,7 @@ ${lanes.join("\n")} function parseJSDocUnknownOrNullableType() { const pos = getNodePos(); nextToken(); - if (token() === 27 /* CommaToken */ || token() === 19 /* CloseBraceToken */ || token() === 21 /* CloseParenToken */ || token() === 31 /* GreaterThanToken */ || token() === 63 /* EqualsToken */ || token() === 51 /* BarToken */) { + if (token() === 28 /* CommaToken */ || token() === 20 /* CloseBraceToken */ || token() === 22 /* CloseParenToken */ || token() === 32 /* GreaterThanToken */ || token() === 64 /* EqualsToken */ || token() === 52 /* BarToken */) { return finishNode(factory2.createJSDocUnknownType(), pos); } else { return finishNode(factory2.createJSDocNullableType( @@ -30246,7 +30388,7 @@ ${lanes.join("\n")} nextToken(); const parameters = parseParameters(4 /* Type */ | 32 /* JSDoc */); const type = parseReturnType( - 58 /* ColonToken */, + 59 /* ColonToken */, /*isType*/ false ); @@ -30261,9 +30403,9 @@ ${lanes.join("\n")} function parseJSDocParameter() { const pos = getNodePos(); let name; - if (token() === 108 /* ThisKeyword */ || token() === 103 /* NewKeyword */) { + if (token() === 110 /* ThisKeyword */ || token() === 105 /* NewKeyword */) { name = parseIdentifierName(); - parseExpected(58 /* ColonToken */); + parseExpected(59 /* ColonToken */); } return finishNode( factory2.createParameterDeclaration( @@ -30285,7 +30427,7 @@ ${lanes.join("\n")} function parseJSDocType() { scanner2.setInJSDocType(true); const pos = getNodePos(); - if (parseOptional(142 /* ModuleKeyword */)) { + if (parseOptional(144 /* ModuleKeyword */)) { const moduleTag = factory2.createJSDocNamepathType( /*type*/ void 0 @@ -30293,9 +30435,9 @@ ${lanes.join("\n")} terminate: while (true) { switch (token()) { - case 19 /* CloseBraceToken */: + case 20 /* CloseBraceToken */: case 1 /* EndOfFileToken */: - case 27 /* CommaToken */: + case 28 /* CommaToken */: case 5 /* WhitespaceTrivia */: break terminate; default: @@ -30305,13 +30447,13 @@ ${lanes.join("\n")} scanner2.setInJSDocType(false); return finishNode(moduleTag, pos); } - const hasDotDotDot = parseOptional(25 /* DotDotDotToken */); + const hasDotDotDot = parseOptional(26 /* DotDotDotToken */); let type = parseTypeOrTypePredicate(); scanner2.setInJSDocType(false); if (hasDotDotDot) { type = finishNode(factory2.createJSDocVariadicType(type), pos); } - if (token() === 63 /* EqualsToken */) { + if (token() === 64 /* EqualsToken */) { nextToken(); return finishNode(factory2.createJSDocOptionalType(type), pos); } @@ -30319,7 +30461,7 @@ ${lanes.join("\n")} } function parseTypeQuery() { const pos = getNodePos(); - parseExpected(112 /* TypeOfKeyword */); + parseExpected(114 /* TypeOfKeyword */); const entityName = parseEntityName( /*allowReservedWords*/ true @@ -30338,25 +30480,25 @@ ${lanes.join("\n")} const name = parseIdentifier(); let constraint; let expression; - if (parseOptional(94 /* ExtendsKeyword */)) { + if (parseOptional(96 /* ExtendsKeyword */)) { if (isStartOfType() || !isStartOfExpression()) { constraint = parseType(); } else { expression = parseUnaryExpressionOrHigher(); } } - const defaultType = parseOptional(63 /* EqualsToken */) ? parseType() : void 0; + const defaultType = parseOptional(64 /* EqualsToken */) ? parseType() : void 0; const node = factory2.createTypeParameterDeclaration(modifiers, name, constraint, defaultType); node.expression = expression; return finishNode(node, pos); } function parseTypeParameters() { - if (token() === 29 /* LessThanToken */) { - return parseBracketedList(19 /* TypeParameters */, parseTypeParameter, 29 /* LessThanToken */, 31 /* GreaterThanToken */); + if (token() === 30 /* LessThanToken */) { + return parseBracketedList(19 /* TypeParameters */, parseTypeParameter, 30 /* LessThanToken */, 32 /* GreaterThanToken */); } } function isStartOfParameter(isJSDocParameter) { - return token() === 25 /* DotDotDotToken */ || isBindingIdentifierOrPrivateIdentifierOrPattern() || isModifierKind(token()) || token() === 59 /* AtToken */ || isStartOfType( + return token() === 26 /* DotDotDotToken */ || isBindingIdentifierOrPrivateIdentifierOrPattern() || isModifierKind(token()) || token() === 60 /* AtToken */ || isStartOfType( /*inStartOfParameter*/ !isJSDocParameter ); @@ -30369,7 +30511,7 @@ ${lanes.join("\n")} return name; } function isParameterNameStart() { - return isBindingIdentifier() || token() === 22 /* OpenBracketToken */ || token() === 18 /* OpenBraceToken */; + return isBindingIdentifier() || token() === 23 /* OpenBracketToken */ || token() === 19 /* OpenBraceToken */; } function parseParameter(inOuterAwaitContext) { return parseParameterWorker(inOuterAwaitContext); @@ -30391,7 +30533,7 @@ ${lanes.join("\n")} /*allowDecorators*/ true )); - if (token() === 108 /* ThisKeyword */) { + if (token() === 110 /* ThisKeyword */) { const node2 = factory2.createParameterDeclaration( modifiers, /*dotDotDotToken*/ @@ -30414,7 +30556,7 @@ ${lanes.join("\n")} } const savedTopLevel = topLevel; topLevel = false; - const dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */); + const dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */); if (!allowAmbiguity && !isParameterNameStart()) { return void 0; } @@ -30424,7 +30566,7 @@ ${lanes.join("\n")} modifiers, dotDotDotToken, parseNameOfParameter(modifiers), - parseOptionalToken(57 /* QuestionToken */), + parseOptionalToken(58 /* QuestionToken */), parseTypeAnnotation(), parseInitializer() ), @@ -30441,13 +30583,13 @@ ${lanes.join("\n")} } } function shouldParseReturnType(returnToken, isType) { - if (returnToken === 38 /* EqualsGreaterThanToken */) { + if (returnToken === 39 /* EqualsGreaterThanToken */) { parseExpected(returnToken); return true; - } else if (parseOptional(58 /* ColonToken */)) { + } else if (parseOptional(59 /* ColonToken */)) { return true; - } else if (isType && token() === 38 /* EqualsGreaterThanToken */) { - parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(58 /* ColonToken */)); + } else if (isType && token() === 39 /* EqualsGreaterThanToken */) { + parseErrorAtCurrentToken(Diagnostics._0_expected, tokenToString(59 /* ColonToken */)); nextToken(); return true; } @@ -30464,7 +30606,7 @@ ${lanes.join("\n")} return parameters; } function parseParameters(flags) { - if (!parseExpected(20 /* OpenParenToken */)) { + if (!parseExpected(21 /* OpenParenToken */)) { return createMissingList(); } const parameters = parseParametersWorker( @@ -30472,11 +30614,11 @@ ${lanes.join("\n")} /*allowAmbiguity*/ true ); - parseExpected(21 /* CloseParenToken */); + parseExpected(22 /* CloseParenToken */); return parameters; } function parseTypeMemberSemicolon() { - if (parseOptional(27 /* CommaToken */)) { + if (parseOptional(28 /* CommaToken */)) { return; } parseSemicolon(); @@ -30484,26 +30626,26 @@ ${lanes.join("\n")} function parseSignatureMember(kind) { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - if (kind === 177 /* ConstructSignature */) { - parseExpected(103 /* NewKeyword */); + if (kind === 179 /* ConstructSignature */) { + parseExpected(105 /* NewKeyword */); } const typeParameters = parseTypeParameters(); const parameters = parseParameters(4 /* Type */); const type = parseReturnType( - 58 /* ColonToken */, + 59 /* ColonToken */, /*isType*/ true ); parseTypeMemberSemicolon(); - const node = kind === 176 /* CallSignature */ ? factory2.createCallSignature(typeParameters, parameters, type) : factory2.createConstructSignature(typeParameters, parameters, type); + const node = kind === 178 /* CallSignature */ ? factory2.createCallSignature(typeParameters, parameters, type) : factory2.createConstructSignature(typeParameters, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); } function isIndexSignature() { - return token() === 22 /* OpenBracketToken */ && lookAhead(isUnambiguouslyIndexSignature); + return token() === 23 /* OpenBracketToken */ && lookAhead(isUnambiguouslyIndexSignature); } function isUnambiguouslyIndexSignature() { nextToken(); - if (token() === 25 /* DotDotDotToken */ || token() === 23 /* CloseBracketToken */) { + if (token() === 26 /* DotDotDotToken */ || token() === 24 /* CloseBracketToken */) { return true; } if (isModifierKind(token())) { @@ -30516,20 +30658,20 @@ ${lanes.join("\n")} } else { nextToken(); } - if (token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */) { + if (token() === 59 /* ColonToken */ || token() === 28 /* CommaToken */) { return true; } - if (token() !== 57 /* QuestionToken */) { + if (token() !== 58 /* QuestionToken */) { return false; } nextToken(); - return token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 23 /* CloseBracketToken */; + return token() === 59 /* ColonToken */ || token() === 28 /* CommaToken */ || token() === 24 /* CloseBracketToken */; } function parseIndexSignatureDeclaration(pos, hasJSDoc, modifiers) { const parameters = parseBracketedList(16 /* Parameters */, () => parseParameter( /*inOuterAwaitContext*/ false - ), 22 /* OpenBracketToken */, 23 /* CloseBracketToken */); + ), 23 /* OpenBracketToken */, 24 /* CloseBracketToken */); const type = parseTypeAnnotation(); parseTypeMemberSemicolon(); const node = factory2.createIndexSignature(modifiers, parameters, type); @@ -30537,13 +30679,13 @@ ${lanes.join("\n")} } function parsePropertyOrMethodSignature(pos, hasJSDoc, modifiers) { const name = parsePropertyName(); - const questionToken = parseOptionalToken(57 /* QuestionToken */); + const questionToken = parseOptionalToken(58 /* QuestionToken */); let node; - if (token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */) { + if (token() === 21 /* OpenParenToken */ || token() === 30 /* LessThanToken */) { const typeParameters = parseTypeParameters(); const parameters = parseParameters(4 /* Type */); const type = parseReturnType( - 58 /* ColonToken */, + 59 /* ColonToken */, /*isType*/ true ); @@ -30551,14 +30693,14 @@ ${lanes.join("\n")} } else { const type = parseTypeAnnotation(); node = factory2.createPropertySignature(modifiers, name, questionToken, type); - if (token() === 63 /* EqualsToken */) + if (token() === 64 /* EqualsToken */) node.initializer = parseInitializer(); } parseTypeMemberSemicolon(); return withJSDoc(finishNode(node, pos), hasJSDoc); } function isTypeMemberStart() { - if (token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */ || token() === 137 /* GetKeyword */ || token() === 151 /* SetKeyword */) { + if (token() === 21 /* OpenParenToken */ || token() === 30 /* LessThanToken */ || token() === 139 /* GetKeyword */ || token() === 153 /* SetKeyword */) { return true; } let idToken = false; @@ -30566,7 +30708,7 @@ ${lanes.join("\n")} idToken = true; nextToken(); } - if (token() === 22 /* OpenBracketToken */) { + if (token() === 23 /* OpenBracketToken */) { return true; } if (isLiteralPropertyName()) { @@ -30574,16 +30716,16 @@ ${lanes.join("\n")} nextToken(); } if (idToken) { - return token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */ || token() === 57 /* QuestionToken */ || token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || canParseSemicolon(); + return token() === 21 /* OpenParenToken */ || token() === 30 /* LessThanToken */ || token() === 58 /* QuestionToken */ || token() === 59 /* ColonToken */ || token() === 28 /* CommaToken */ || canParseSemicolon(); } return false; } function parseTypeMember() { - if (token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */) { - return parseSignatureMember(176 /* CallSignature */); + if (token() === 21 /* OpenParenToken */ || token() === 30 /* LessThanToken */) { + return parseSignatureMember(178 /* CallSignature */); } - if (token() === 103 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(177 /* ConstructSignature */); + if (token() === 105 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { + return parseSignatureMember(179 /* ConstructSignature */); } const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); @@ -30591,11 +30733,11 @@ ${lanes.join("\n")} /*allowDecorators*/ false ); - if (parseContextualModifier(137 /* GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 174 /* GetAccessor */, 4 /* Type */); + if (parseContextualModifier(139 /* GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 176 /* GetAccessor */, 4 /* Type */); } - if (parseContextualModifier(151 /* SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 175 /* SetAccessor */, 4 /* Type */); + if (parseContextualModifier(153 /* SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 177 /* SetAccessor */, 4 /* Type */); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, modifiers); @@ -30604,16 +30746,16 @@ ${lanes.join("\n")} } function nextTokenIsOpenParenOrLessThan() { nextToken(); - return token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */; + return token() === 21 /* OpenParenToken */ || token() === 30 /* LessThanToken */; } function nextTokenIsDot() { - return nextToken() === 24 /* DotToken */; + return nextToken() === 25 /* DotToken */; } function nextTokenIsOpenParenOrLessThanOrDot() { switch (nextToken()) { - case 20 /* OpenParenToken */: - case 29 /* LessThanToken */: - case 24 /* DotToken */: + case 21 /* OpenParenToken */: + case 30 /* LessThanToken */: + case 25 /* DotToken */: return true; } return false; @@ -30624,9 +30766,9 @@ ${lanes.join("\n")} } function parseObjectTypeMembers() { let members; - if (parseExpected(18 /* OpenBraceToken */)) { + if (parseExpected(19 /* OpenBraceToken */)) { members = parseList(4 /* TypeMembers */, parseTypeMember); - parseExpected(19 /* CloseBraceToken */); + parseExpected(20 /* CloseBraceToken */); } else { members = createMissingList(); } @@ -30634,18 +30776,18 @@ ${lanes.join("\n")} } function isStartOfMappedType() { nextToken(); - if (token() === 39 /* PlusToken */ || token() === 40 /* MinusToken */) { - return nextToken() === 146 /* ReadonlyKeyword */; + if (token() === 40 /* PlusToken */ || token() === 41 /* MinusToken */) { + return nextToken() === 148 /* ReadonlyKeyword */; } - if (token() === 146 /* ReadonlyKeyword */) { + if (token() === 148 /* ReadonlyKeyword */) { nextToken(); } - return token() === 22 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 101 /* InKeyword */; + return token() === 23 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 103 /* InKeyword */; } function parseMappedTypeParameter() { const pos = getNodePos(); const name = parseIdentifierName(); - parseExpected(101 /* InKeyword */); + parseExpected(103 /* InKeyword */); const type = parseType(); return finishNode(factory2.createTypeParameterDeclaration( /*modifiers*/ @@ -30658,34 +30800,34 @@ ${lanes.join("\n")} } function parseMappedType() { const pos = getNodePos(); - parseExpected(18 /* OpenBraceToken */); + parseExpected(19 /* OpenBraceToken */); let readonlyToken; - if (token() === 146 /* ReadonlyKeyword */ || token() === 39 /* PlusToken */ || token() === 40 /* MinusToken */) { + if (token() === 148 /* ReadonlyKeyword */ || token() === 40 /* PlusToken */ || token() === 41 /* MinusToken */) { readonlyToken = parseTokenNode(); - if (readonlyToken.kind !== 146 /* ReadonlyKeyword */) { - parseExpected(146 /* ReadonlyKeyword */); + if (readonlyToken.kind !== 148 /* ReadonlyKeyword */) { + parseExpected(148 /* ReadonlyKeyword */); } } - parseExpected(22 /* OpenBracketToken */); + parseExpected(23 /* OpenBracketToken */); const typeParameter = parseMappedTypeParameter(); - const nameType = parseOptional(128 /* AsKeyword */) ? parseType() : void 0; - parseExpected(23 /* CloseBracketToken */); + const nameType = parseOptional(130 /* AsKeyword */) ? parseType() : void 0; + parseExpected(24 /* CloseBracketToken */); let questionToken; - if (token() === 57 /* QuestionToken */ || token() === 39 /* PlusToken */ || token() === 40 /* MinusToken */) { + if (token() === 58 /* QuestionToken */ || token() === 40 /* PlusToken */ || token() === 41 /* MinusToken */) { questionToken = parseTokenNode(); - if (questionToken.kind !== 57 /* QuestionToken */) { - parseExpected(57 /* QuestionToken */); + if (questionToken.kind !== 58 /* QuestionToken */) { + parseExpected(58 /* QuestionToken */); } } const type = parseTypeAnnotation(); parseSemicolon(); const members = parseList(4 /* TypeMembers */, parseTypeMember); - parseExpected(19 /* CloseBraceToken */); + parseExpected(20 /* CloseBraceToken */); return finishNode(factory2.createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members), pos); } function parseTupleElementType() { const pos = getNodePos(); - if (parseOptional(25 /* DotDotDotToken */)) { + if (parseOptional(26 /* DotDotDotToken */)) { return finishNode(factory2.createRestTypeNode(parseType()), pos); } const type = parseType(); @@ -30698,10 +30840,10 @@ ${lanes.join("\n")} return type; } function isNextTokenColonOrQuestionColon() { - return nextToken() === 58 /* ColonToken */ || token() === 57 /* QuestionToken */ && nextToken() === 58 /* ColonToken */; + return nextToken() === 59 /* ColonToken */ || token() === 58 /* QuestionToken */ && nextToken() === 59 /* ColonToken */; } function isTupleElementName() { - if (token() === 25 /* DotDotDotToken */) { + if (token() === 26 /* DotDotDotToken */) { return tokenIsIdentifierOrKeyword(nextToken()) && isNextTokenColonOrQuestionColon(); } return tokenIsIdentifierOrKeyword(token()) && isNextTokenColonOrQuestionColon(); @@ -30710,10 +30852,10 @@ ${lanes.join("\n")} if (lookAhead(isTupleElementName)) { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - const dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */); + const dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */); const name = parseIdentifierName(); - const questionToken = parseOptionalToken(57 /* QuestionToken */); - parseExpected(58 /* ColonToken */); + const questionToken = parseOptionalToken(58 /* QuestionToken */); + parseExpected(59 /* ColonToken */); const type = parseTupleElementType(); const node = factory2.createNamedTupleMember(dotDotDotToken, name, questionToken, type); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -30724,24 +30866,24 @@ ${lanes.join("\n")} const pos = getNodePos(); return finishNode( factory2.createTupleTypeNode( - parseBracketedList(21 /* TupleElementTypes */, parseTupleElementNameOrTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */) + parseBracketedList(21 /* TupleElementTypes */, parseTupleElementNameOrTupleElementType, 23 /* OpenBracketToken */, 24 /* CloseBracketToken */) ), pos ); } function parseParenthesizedType() { const pos = getNodePos(); - parseExpected(20 /* OpenParenToken */); + parseExpected(21 /* OpenParenToken */); const type = parseType(); - parseExpected(21 /* CloseParenToken */); + parseExpected(22 /* CloseParenToken */); return finishNode(factory2.createParenthesizedType(type), pos); } function parseModifiersForConstructorType() { let modifiers; - if (token() === 126 /* AbstractKeyword */) { + if (token() === 128 /* AbstractKeyword */) { const pos = getNodePos(); nextToken(); - const modifier = finishNode(factoryCreateToken(126 /* AbstractKeyword */), pos); + const modifier = finishNode(factoryCreateToken(128 /* AbstractKeyword */), pos); modifiers = createNodeArray([modifier], pos); } return modifiers; @@ -30750,12 +30892,12 @@ ${lanes.join("\n")} const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); const modifiers = parseModifiersForConstructorType(); - const isConstructorType = parseOptional(103 /* NewKeyword */); + const isConstructorType = parseOptional(105 /* NewKeyword */); Debug.assert(!modifiers || isConstructorType, "Per isStartOfFunctionOrConstructorType, a function type cannot have modifiers."); const typeParameters = parseTypeParameters(); const parameters = parseParameters(4 /* Type */); const type = parseReturnType( - 38 /* EqualsGreaterThanToken */, + 39 /* EqualsGreaterThanToken */, /*isType*/ false ); @@ -30764,35 +30906,35 @@ ${lanes.join("\n")} } function parseKeywordAndNoDot() { const node = parseTokenNode(); - return token() === 24 /* DotToken */ ? void 0 : node; + return token() === 25 /* DotToken */ ? void 0 : node; } function parseLiteralTypeNode(negative) { const pos = getNodePos(); if (negative) { nextToken(); } - let expression = token() === 110 /* TrueKeyword */ || token() === 95 /* FalseKeyword */ || token() === 104 /* NullKeyword */ ? parseTokenNode() : parseLiteralLikeNode(token()); + let expression = token() === 112 /* TrueKeyword */ || token() === 97 /* FalseKeyword */ || token() === 106 /* NullKeyword */ ? parseTokenNode() : parseLiteralLikeNode(token()); if (negative) { - expression = finishNode(factory2.createPrefixUnaryExpression(40 /* MinusToken */, expression), pos); + expression = finishNode(factory2.createPrefixUnaryExpression(41 /* MinusToken */, expression), pos); } return finishNode(factory2.createLiteralTypeNode(expression), pos); } function isStartOfTypeOfImportType() { nextToken(); - return token() === 100 /* ImportKeyword */; + return token() === 102 /* ImportKeyword */; } function parseImportTypeAssertions() { const pos = getNodePos(); - const openBracePosition = scanner2.getTokenPos(); - parseExpected(18 /* OpenBraceToken */); + const openBracePosition = scanner2.getTokenStart(); + parseExpected(19 /* OpenBraceToken */); const multiLine = scanner2.hasPrecedingLineBreak(); - parseExpected(130 /* AssertKeyword */); - parseExpected(58 /* ColonToken */); + parseExpected(132 /* AssertKeyword */); + parseExpected(59 /* ColonToken */); const clause = parseAssertClause( /*skipAssertKeyword*/ true ); - if (!parseExpected(19 /* CloseBraceToken */)) { + if (!parseExpected(20 /* CloseBraceToken */)) { const lastError = lastOrUndefined(parseDiagnostics); if (lastError && lastError.code === Diagnostics._0_expected.code) { addRelatedInfo( @@ -30806,84 +30948,84 @@ ${lanes.join("\n")} function parseImportType() { sourceFlags |= 2097152 /* PossiblyContainsDynamicImport */; const pos = getNodePos(); - const isTypeOf = parseOptional(112 /* TypeOfKeyword */); - parseExpected(100 /* ImportKeyword */); - parseExpected(20 /* OpenParenToken */); + const isTypeOf = parseOptional(114 /* TypeOfKeyword */); + parseExpected(102 /* ImportKeyword */); + parseExpected(21 /* OpenParenToken */); const type = parseType(); let assertions; - if (parseOptional(27 /* CommaToken */)) { + if (parseOptional(28 /* CommaToken */)) { assertions = parseImportTypeAssertions(); } - parseExpected(21 /* CloseParenToken */); - const qualifier = parseOptional(24 /* DotToken */) ? parseEntityNameOfTypeReference() : void 0; + parseExpected(22 /* CloseParenToken */); + const qualifier = parseOptional(25 /* DotToken */) ? parseEntityNameOfTypeReference() : void 0; const typeArguments = parseTypeArgumentsOfTypeReference(); return finishNode(factory2.createImportTypeNode(type, assertions, qualifier, typeArguments, isTypeOf), pos); } function nextTokenIsNumericOrBigIntLiteral() { nextToken(); - return token() === 8 /* NumericLiteral */ || token() === 9 /* BigIntLiteral */; + return token() === 9 /* NumericLiteral */ || token() === 10 /* BigIntLiteral */; } function parseNonArrayType() { switch (token()) { - case 131 /* AnyKeyword */: - case 157 /* UnknownKeyword */: - case 152 /* StringKeyword */: - case 148 /* NumberKeyword */: - case 160 /* BigIntKeyword */: - case 153 /* SymbolKeyword */: - case 134 /* BooleanKeyword */: - case 155 /* UndefinedKeyword */: - case 144 /* NeverKeyword */: - case 149 /* ObjectKeyword */: + case 133 /* AnyKeyword */: + case 159 /* UnknownKeyword */: + case 154 /* StringKeyword */: + case 150 /* NumberKeyword */: + case 162 /* BigIntKeyword */: + case 155 /* SymbolKeyword */: + case 136 /* BooleanKeyword */: + case 157 /* UndefinedKeyword */: + case 146 /* NeverKeyword */: + case 151 /* ObjectKeyword */: return tryParse(parseKeywordAndNoDot) || parseTypeReference(); - case 66 /* AsteriskEqualsToken */: + case 67 /* AsteriskEqualsToken */: scanner2.reScanAsteriskEqualsToken(); - case 41 /* AsteriskToken */: + case 42 /* AsteriskToken */: return parseJSDocAllType(); - case 60 /* QuestionQuestionToken */: + case 61 /* QuestionQuestionToken */: scanner2.reScanQuestionToken(); - case 57 /* QuestionToken */: + case 58 /* QuestionToken */: return parseJSDocUnknownOrNullableType(); - case 98 /* FunctionKeyword */: + case 100 /* FunctionKeyword */: return parseJSDocFunctionType(); - case 53 /* ExclamationToken */: + case 54 /* ExclamationToken */: return parseJSDocNonNullableType(); - case 14 /* NoSubstitutionTemplateLiteral */: - case 10 /* StringLiteral */: - case 8 /* NumericLiteral */: - case 9 /* BigIntLiteral */: - case 110 /* TrueKeyword */: - case 95 /* FalseKeyword */: - case 104 /* NullKeyword */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 11 /* StringLiteral */: + case 9 /* NumericLiteral */: + case 10 /* BigIntLiteral */: + case 112 /* TrueKeyword */: + case 97 /* FalseKeyword */: + case 106 /* NullKeyword */: return parseLiteralTypeNode(); - case 40 /* MinusToken */: + case 41 /* MinusToken */: return lookAhead(nextTokenIsNumericOrBigIntLiteral) ? parseLiteralTypeNode( /*negative*/ true ) : parseTypeReference(); - case 114 /* VoidKeyword */: + case 116 /* VoidKeyword */: return parseTokenNode(); - case 108 /* ThisKeyword */: { + case 110 /* ThisKeyword */: { const thisKeyword = parseThisTypeNode(); - if (token() === 140 /* IsKeyword */ && !scanner2.hasPrecedingLineBreak()) { + if (token() === 142 /* IsKeyword */ && !scanner2.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { return thisKeyword; } } - case 112 /* TypeOfKeyword */: + case 114 /* TypeOfKeyword */: return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery(); - case 18 /* OpenBraceToken */: + case 19 /* OpenBraceToken */: return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral(); - case 22 /* OpenBracketToken */: + case 23 /* OpenBracketToken */: return parseTupleType(); - case 20 /* OpenParenToken */: + case 21 /* OpenParenToken */: return parseParenthesizedType(); - case 100 /* ImportKeyword */: + case 102 /* ImportKeyword */: return parseImportType(); - case 129 /* AssertsKeyword */: + case 131 /* AssertsKeyword */: return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); - case 15 /* TemplateHead */: + case 16 /* TemplateHead */: return parseTemplateType(); default: return parseTypeReference(); @@ -30891,48 +31033,48 @@ ${lanes.join("\n")} } function isStartOfType(inStartOfParameter) { switch (token()) { - case 131 /* AnyKeyword */: - case 157 /* UnknownKeyword */: - case 152 /* StringKeyword */: - case 148 /* NumberKeyword */: - case 160 /* BigIntKeyword */: - case 134 /* BooleanKeyword */: - case 146 /* ReadonlyKeyword */: - case 153 /* SymbolKeyword */: - case 156 /* UniqueKeyword */: - case 114 /* VoidKeyword */: - case 155 /* UndefinedKeyword */: - case 104 /* NullKeyword */: - case 108 /* ThisKeyword */: - case 112 /* TypeOfKeyword */: - case 144 /* NeverKeyword */: - case 18 /* OpenBraceToken */: - case 22 /* OpenBracketToken */: - case 29 /* LessThanToken */: - case 51 /* BarToken */: - case 50 /* AmpersandToken */: - case 103 /* NewKeyword */: - case 10 /* StringLiteral */: - case 8 /* NumericLiteral */: - case 9 /* BigIntLiteral */: - case 110 /* TrueKeyword */: - case 95 /* FalseKeyword */: - case 149 /* ObjectKeyword */: - case 41 /* AsteriskToken */: - case 57 /* QuestionToken */: - case 53 /* ExclamationToken */: - case 25 /* DotDotDotToken */: - case 138 /* InferKeyword */: - case 100 /* ImportKeyword */: - case 129 /* AssertsKeyword */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 15 /* TemplateHead */: + case 133 /* AnyKeyword */: + case 159 /* UnknownKeyword */: + case 154 /* StringKeyword */: + case 150 /* NumberKeyword */: + case 162 /* BigIntKeyword */: + case 136 /* BooleanKeyword */: + case 148 /* ReadonlyKeyword */: + case 155 /* SymbolKeyword */: + case 158 /* UniqueKeyword */: + case 116 /* VoidKeyword */: + case 157 /* UndefinedKeyword */: + case 106 /* NullKeyword */: + case 110 /* ThisKeyword */: + case 114 /* TypeOfKeyword */: + case 146 /* NeverKeyword */: + case 19 /* OpenBraceToken */: + case 23 /* OpenBracketToken */: + case 30 /* LessThanToken */: + case 52 /* BarToken */: + case 51 /* AmpersandToken */: + case 105 /* NewKeyword */: + case 11 /* StringLiteral */: + case 9 /* NumericLiteral */: + case 10 /* BigIntLiteral */: + case 112 /* TrueKeyword */: + case 97 /* FalseKeyword */: + case 151 /* ObjectKeyword */: + case 42 /* AsteriskToken */: + case 58 /* QuestionToken */: + case 54 /* ExclamationToken */: + case 26 /* DotDotDotToken */: + case 140 /* InferKeyword */: + case 102 /* ImportKeyword */: + case 131 /* AssertsKeyword */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 16 /* TemplateHead */: return true; - case 98 /* FunctionKeyword */: + case 100 /* FunctionKeyword */: return !inStartOfParameter; - case 40 /* MinusToken */: + case 41 /* MinusToken */: return !inStartOfParameter && lookAhead(nextTokenIsNumericOrBigIntLiteral); - case 20 /* OpenParenToken */: + case 21 /* OpenParenToken */: return !inStartOfParameter && lookAhead(isStartOfParenthesizedOrFunctionType); default: return isIdentifier2(); @@ -30940,7 +31082,7 @@ ${lanes.join("\n")} } function isStartOfParenthesizedOrFunctionType() { nextToken(); - return token() === 21 /* CloseParenToken */ || isStartOfParameter( + return token() === 22 /* CloseParenToken */ || isStartOfParameter( /*isJSDocParameter*/ false ) || isStartOfType(); @@ -30950,7 +31092,7 @@ ${lanes.join("\n")} let type = parseNonArrayType(); while (!scanner2.hasPrecedingLineBreak()) { switch (token()) { - case 53 /* ExclamationToken */: + case 54 /* ExclamationToken */: nextToken(); type = finishNode(factory2.createJSDocNonNullableType( type, @@ -30958,7 +31100,7 @@ ${lanes.join("\n")} true ), pos); break; - case 57 /* QuestionToken */: + case 58 /* QuestionToken */: if (lookAhead(nextTokenIsStartOfType)) { return type; } @@ -30969,14 +31111,14 @@ ${lanes.join("\n")} true ), pos); break; - case 22 /* OpenBracketToken */: - parseExpected(22 /* OpenBracketToken */); + case 23 /* OpenBracketToken */: + parseExpected(23 /* OpenBracketToken */); if (isStartOfType()) { const indexType = parseType(); - parseExpected(23 /* CloseBracketToken */); + parseExpected(24 /* CloseBracketToken */); type = finishNode(factory2.createIndexedAccessTypeNode(type, indexType), pos); } else { - parseExpected(23 /* CloseBracketToken */); + parseExpected(24 /* CloseBracketToken */); type = finishNode(factory2.createArrayTypeNode(type), pos); } break; @@ -30992,9 +31134,9 @@ ${lanes.join("\n")} return finishNode(factory2.createTypeOperatorNode(operator, parseTypeOperatorOrHigher()), pos); } function tryParseConstraintOfInferType() { - if (parseOptional(94 /* ExtendsKeyword */)) { + if (parseOptional(96 /* ExtendsKeyword */)) { const constraint = disallowConditionalTypesAnd(parseType); - if (inDisallowConditionalTypesContext() || token() !== 57 /* QuestionToken */) { + if (inDisallowConditionalTypesContext() || token() !== 58 /* QuestionToken */) { return constraint; } } @@ -31013,17 +31155,17 @@ ${lanes.join("\n")} } function parseInferType() { const pos = getNodePos(); - parseExpected(138 /* InferKeyword */); + parseExpected(140 /* InferKeyword */); return finishNode(factory2.createInferTypeNode(parseTypeParameterOfInferType()), pos); } function parseTypeOperatorOrHigher() { const operator = token(); switch (operator) { - case 141 /* KeyOfKeyword */: - case 156 /* UniqueKeyword */: - case 146 /* ReadonlyKeyword */: + case 143 /* KeyOfKeyword */: + case 158 /* UniqueKeyword */: + case 148 /* ReadonlyKeyword */: return parseTypeOperator(operator); - case 138 /* InferKeyword */: + case 140 /* InferKeyword */: return parseInferType(); } return allowConditionalTypesAnd(parsePostfixTypeOrHigher); @@ -31044,7 +31186,7 @@ ${lanes.join("\n")} } function parseUnionOrIntersectionType(operator, parseConstituentType, createTypeNode) { const pos = getNodePos(); - const isUnionType = operator === 51 /* BarToken */; + const isUnionType = operator === 52 /* BarToken */; const hasLeadingOperator = parseOptional(operator); let type = hasLeadingOperator && parseFunctionOrConstructorTypeToError(isUnionType) || parseConstituentType(); if (token() === operator || hasLeadingOperator) { @@ -31057,23 +31199,23 @@ ${lanes.join("\n")} return type; } function parseIntersectionTypeOrHigher() { - return parseUnionOrIntersectionType(50 /* AmpersandToken */, parseTypeOperatorOrHigher, factory2.createIntersectionTypeNode); + return parseUnionOrIntersectionType(51 /* AmpersandToken */, parseTypeOperatorOrHigher, factory2.createIntersectionTypeNode); } function parseUnionTypeOrHigher() { - return parseUnionOrIntersectionType(51 /* BarToken */, parseIntersectionTypeOrHigher, factory2.createUnionTypeNode); + return parseUnionOrIntersectionType(52 /* BarToken */, parseIntersectionTypeOrHigher, factory2.createUnionTypeNode); } function nextTokenIsNewKeyword() { nextToken(); - return token() === 103 /* NewKeyword */; + return token() === 105 /* NewKeyword */; } function isStartOfFunctionTypeOrConstructorType() { - if (token() === 29 /* LessThanToken */) { + if (token() === 30 /* LessThanToken */) { return true; } - if (token() === 20 /* OpenParenToken */ && lookAhead(isUnambiguouslyStartOfFunctionType)) { + if (token() === 21 /* OpenParenToken */ && lookAhead(isUnambiguouslyStartOfFunctionType)) { return true; } - return token() === 103 /* NewKeyword */ || token() === 126 /* AbstractKeyword */ && lookAhead(nextTokenIsNewKeyword); + return token() === 105 /* NewKeyword */ || token() === 128 /* AbstractKeyword */ && lookAhead(nextTokenIsNewKeyword); } function skipParameterStart() { if (isModifierKind(token())) { @@ -31082,11 +31224,11 @@ ${lanes.join("\n")} false ); } - if (isIdentifier2() || token() === 108 /* ThisKeyword */) { + if (isIdentifier2() || token() === 110 /* ThisKeyword */) { nextToken(); return true; } - if (token() === 22 /* OpenBracketToken */ || token() === 18 /* OpenBraceToken */) { + if (token() === 23 /* OpenBracketToken */ || token() === 19 /* OpenBraceToken */) { const previousErrorCount = parseDiagnostics.length; parseIdentifierOrPattern(); return previousErrorCount === parseDiagnostics.length; @@ -31095,16 +31237,16 @@ ${lanes.join("\n")} } function isUnambiguouslyStartOfFunctionType() { nextToken(); - if (token() === 21 /* CloseParenToken */ || token() === 25 /* DotDotDotToken */) { + if (token() === 22 /* CloseParenToken */ || token() === 26 /* DotDotDotToken */) { return true; } if (skipParameterStart()) { - if (token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 57 /* QuestionToken */ || token() === 63 /* EqualsToken */) { + if (token() === 59 /* ColonToken */ || token() === 28 /* CommaToken */ || token() === 58 /* QuestionToken */ || token() === 64 /* EqualsToken */) { return true; } - if (token() === 21 /* CloseParenToken */) { + if (token() === 22 /* CloseParenToken */) { nextToken(); - if (token() === 38 /* EqualsGreaterThanToken */) { + if (token() === 39 /* EqualsGreaterThanToken */) { return true; } } @@ -31128,16 +31270,16 @@ ${lanes.join("\n")} } function parseTypePredicatePrefix() { const id = parseIdentifier(); - if (token() === 140 /* IsKeyword */ && !scanner2.hasPrecedingLineBreak()) { + if (token() === 142 /* IsKeyword */ && !scanner2.hasPrecedingLineBreak()) { nextToken(); return id; } } function parseAssertsTypePredicate() { const pos = getNodePos(); - const assertsModifier = parseExpectedToken(129 /* AssertsKeyword */); - const parameterName = token() === 108 /* ThisKeyword */ ? parseThisTypeNode() : parseIdentifier(); - const type = parseOptional(140 /* IsKeyword */) ? parseType() : void 0; + const assertsModifier = parseExpectedToken(131 /* AssertsKeyword */); + const parameterName = token() === 110 /* ThisKeyword */ ? parseThisTypeNode() : parseIdentifier(); + const type = parseOptional(142 /* IsKeyword */) ? parseType() : void 0; return finishNode(factory2.createTypePredicateNode(assertsModifier, parameterName, type), pos); } function parseType() { @@ -31149,42 +31291,42 @@ ${lanes.join("\n")} } const pos = getNodePos(); const type = parseUnionTypeOrHigher(); - if (!inDisallowConditionalTypesContext() && !scanner2.hasPrecedingLineBreak() && parseOptional(94 /* ExtendsKeyword */)) { + if (!inDisallowConditionalTypesContext() && !scanner2.hasPrecedingLineBreak() && parseOptional(96 /* ExtendsKeyword */)) { const extendsType = disallowConditionalTypesAnd(parseType); - parseExpected(57 /* QuestionToken */); + parseExpected(58 /* QuestionToken */); const trueType = allowConditionalTypesAnd(parseType); - parseExpected(58 /* ColonToken */); + parseExpected(59 /* ColonToken */); const falseType = allowConditionalTypesAnd(parseType); return finishNode(factory2.createConditionalTypeNode(type, extendsType, trueType, falseType), pos); } return type; } function parseTypeAnnotation() { - return parseOptional(58 /* ColonToken */) ? parseType() : void 0; + return parseOptional(59 /* ColonToken */) ? parseType() : void 0; } function isStartOfLeftHandSideExpression() { switch (token()) { - case 108 /* ThisKeyword */: - case 106 /* SuperKeyword */: - case 104 /* NullKeyword */: - case 110 /* TrueKeyword */: - case 95 /* FalseKeyword */: - case 8 /* NumericLiteral */: - case 9 /* BigIntLiteral */: - case 10 /* StringLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 15 /* TemplateHead */: - case 20 /* OpenParenToken */: - case 22 /* OpenBracketToken */: - case 18 /* OpenBraceToken */: - case 98 /* FunctionKeyword */: - case 84 /* ClassKeyword */: - case 103 /* NewKeyword */: - case 43 /* SlashToken */: - case 68 /* SlashEqualsToken */: - case 79 /* Identifier */: + case 110 /* ThisKeyword */: + case 108 /* SuperKeyword */: + case 106 /* NullKeyword */: + case 112 /* TrueKeyword */: + case 97 /* FalseKeyword */: + case 9 /* NumericLiteral */: + case 10 /* BigIntLiteral */: + case 11 /* StringLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 16 /* TemplateHead */: + case 21 /* OpenParenToken */: + case 23 /* OpenBracketToken */: + case 19 /* OpenBraceToken */: + case 100 /* FunctionKeyword */: + case 86 /* ClassKeyword */: + case 105 /* NewKeyword */: + case 44 /* SlashToken */: + case 69 /* SlashEqualsToken */: + case 80 /* Identifier */: return true; - case 100 /* ImportKeyword */: + case 102 /* ImportKeyword */: return lookAhead(nextTokenIsOpenParenOrLessThanOrDot); default: return isIdentifier2(); @@ -31195,20 +31337,20 @@ ${lanes.join("\n")} return true; } switch (token()) { - case 39 /* PlusToken */: - case 40 /* MinusToken */: - case 54 /* TildeToken */: - case 53 /* ExclamationToken */: - case 89 /* DeleteKeyword */: - case 112 /* TypeOfKeyword */: - case 114 /* VoidKeyword */: - case 45 /* PlusPlusToken */: - case 46 /* MinusMinusToken */: - case 29 /* LessThanToken */: - case 133 /* AwaitKeyword */: - case 125 /* YieldKeyword */: - case 80 /* PrivateIdentifier */: - case 59 /* AtToken */: + case 40 /* PlusToken */: + case 41 /* MinusToken */: + case 55 /* TildeToken */: + case 54 /* ExclamationToken */: + case 91 /* DeleteKeyword */: + case 114 /* TypeOfKeyword */: + case 116 /* VoidKeyword */: + case 46 /* PlusPlusToken */: + case 47 /* MinusMinusToken */: + case 30 /* LessThanToken */: + case 135 /* AwaitKeyword */: + case 127 /* YieldKeyword */: + case 81 /* PrivateIdentifier */: + case 60 /* AtToken */: return true; default: if (isBinaryOperator2()) { @@ -31218,7 +31360,7 @@ ${lanes.join("\n")} } } function isStartOfExpressionStatement() { - return token() !== 18 /* OpenBraceToken */ && token() !== 98 /* FunctionKeyword */ && token() !== 84 /* ClassKeyword */ && token() !== 59 /* AtToken */ && isStartOfExpression(); + return token() !== 19 /* OpenBraceToken */ && token() !== 100 /* FunctionKeyword */ && token() !== 86 /* ClassKeyword */ && token() !== 60 /* AtToken */ && isStartOfExpression(); } function parseExpression() { const saveDecoratorContext = inDecoratorContext(); @@ -31234,7 +31376,7 @@ ${lanes.join("\n")} true ); let operatorToken; - while (operatorToken = parseOptionalToken(27 /* CommaToken */)) { + while (operatorToken = parseOptionalToken(28 /* CommaToken */)) { expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher( /*allowReturnTypeInArrowFunction*/ true @@ -31249,7 +31391,7 @@ ${lanes.join("\n")} return expr; } function parseInitializer() { - return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher( + return parseOptional(64 /* EqualsToken */) ? parseAssignmentExpressionOrHigher( /*allowReturnTypeInArrowFunction*/ true ) : void 0; @@ -31264,7 +31406,7 @@ ${lanes.join("\n")} } const pos = getNodePos(); const expr = parseBinaryExpressionOrHigher(0 /* Lowest */); - if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) { + if (expr.kind === 80 /* Identifier */ && token() === 39 /* EqualsGreaterThanToken */) { return parseSimpleArrowFunctionExpression( pos, expr, @@ -31279,7 +31421,7 @@ ${lanes.join("\n")} return parseConditionalExpressionRest(expr, pos, allowReturnTypeInArrowFunction); } function isYieldExpression2() { - if (token() === 125 /* YieldKeyword */) { + if (token() === 127 /* YieldKeyword */) { if (inYieldContext()) { return true; } @@ -31294,10 +31436,10 @@ ${lanes.join("\n")} function parseYieldExpression() { const pos = getNodePos(); nextToken(); - if (!scanner2.hasPrecedingLineBreak() && (token() === 41 /* AsteriskToken */ || isStartOfExpression())) { + if (!scanner2.hasPrecedingLineBreak() && (token() === 42 /* AsteriskToken */ || isStartOfExpression())) { return finishNode( factory2.createYieldExpression( - parseOptionalToken(41 /* AsteriskToken */), + parseOptionalToken(42 /* AsteriskToken */), parseAssignmentExpressionOrHigher( /*allowReturnTypeInArrowFunction*/ true @@ -31315,7 +31457,7 @@ ${lanes.join("\n")} } } function parseSimpleArrowFunctionExpression(pos, identifier, allowReturnTypeInArrowFunction, asyncModifier) { - Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); + Debug.assert(token() === 39 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>"); const parameter = factory2.createParameterDeclaration( /*modifiers*/ void 0, @@ -31331,7 +31473,7 @@ ${lanes.join("\n")} ); finishNode(parameter, identifier.pos); const parameters = createNodeArray([parameter], parameter.pos, parameter.end); - const equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */); + const equalsGreaterThanToken = parseExpectedToken(39 /* EqualsGreaterThanToken */); const body = parseArrowFunctionExpressionBody( /*isAsync*/ !!asyncModifier, @@ -31362,88 +31504,88 @@ ${lanes.join("\n")} ) : tryParse(() => parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction)); } function isParenthesizedArrowFunctionExpression() { - if (token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */ || token() === 132 /* AsyncKeyword */) { + if (token() === 21 /* OpenParenToken */ || token() === 30 /* LessThanToken */ || token() === 134 /* AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } - if (token() === 38 /* EqualsGreaterThanToken */) { + if (token() === 39 /* EqualsGreaterThanToken */) { return 1 /* True */; } return 0 /* False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 132 /* AsyncKeyword */) { + if (token() === 134 /* AsyncKeyword */) { nextToken(); if (scanner2.hasPrecedingLineBreak()) { return 0 /* False */; } - if (token() !== 20 /* OpenParenToken */ && token() !== 29 /* LessThanToken */) { + if (token() !== 21 /* OpenParenToken */ && token() !== 30 /* LessThanToken */) { return 0 /* False */; } } const first2 = token(); const second = nextToken(); - if (first2 === 20 /* OpenParenToken */) { - if (second === 21 /* CloseParenToken */) { + if (first2 === 21 /* OpenParenToken */) { + if (second === 22 /* CloseParenToken */) { const third = nextToken(); switch (third) { - case 38 /* EqualsGreaterThanToken */: - case 58 /* ColonToken */: - case 18 /* OpenBraceToken */: + case 39 /* EqualsGreaterThanToken */: + case 59 /* ColonToken */: + case 19 /* OpenBraceToken */: return 1 /* True */; default: return 0 /* False */; } } - if (second === 22 /* OpenBracketToken */ || second === 18 /* OpenBraceToken */) { + if (second === 23 /* OpenBracketToken */ || second === 19 /* OpenBraceToken */) { return 2 /* Unknown */; } - if (second === 25 /* DotDotDotToken */) { + if (second === 26 /* DotDotDotToken */) { return 1 /* True */; } - if (isModifierKind(second) && second !== 132 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { - if (nextToken() === 128 /* AsKeyword */) { + if (isModifierKind(second) && second !== 134 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { + if (nextToken() === 130 /* AsKeyword */) { return 0 /* False */; } return 1 /* True */; } - if (!isIdentifier2() && second !== 108 /* ThisKeyword */) { + if (!isIdentifier2() && second !== 110 /* ThisKeyword */) { return 0 /* False */; } switch (nextToken()) { - case 58 /* ColonToken */: + case 59 /* ColonToken */: return 1 /* True */; - case 57 /* QuestionToken */: + case 58 /* QuestionToken */: nextToken(); - if (token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 63 /* EqualsToken */ || token() === 21 /* CloseParenToken */) { + if (token() === 59 /* ColonToken */ || token() === 28 /* CommaToken */ || token() === 64 /* EqualsToken */ || token() === 22 /* CloseParenToken */) { return 1 /* True */; } return 0 /* False */; - case 27 /* CommaToken */: - case 63 /* EqualsToken */: - case 21 /* CloseParenToken */: + case 28 /* CommaToken */: + case 64 /* EqualsToken */: + case 22 /* CloseParenToken */: return 2 /* Unknown */; } return 0 /* False */; } else { - Debug.assert(first2 === 29 /* LessThanToken */); - if (!isIdentifier2() && token() !== 85 /* ConstKeyword */) { + Debug.assert(first2 === 30 /* LessThanToken */); + if (!isIdentifier2() && token() !== 87 /* ConstKeyword */) { return 0 /* False */; } if (languageVariant === 1 /* JSX */) { const isArrowFunctionInJsx = lookAhead(() => { - parseOptional(85 /* ConstKeyword */); + parseOptional(87 /* ConstKeyword */); const third = nextToken(); - if (third === 94 /* ExtendsKeyword */) { + if (third === 96 /* ExtendsKeyword */) { const fourth = nextToken(); switch (fourth) { - case 63 /* EqualsToken */: - case 31 /* GreaterThanToken */: - case 43 /* SlashToken */: + case 64 /* EqualsToken */: + case 32 /* GreaterThanToken */: + case 44 /* SlashToken */: return false; default: return true; } - } else if (third === 27 /* CommaToken */ || third === 63 /* EqualsToken */) { + } else if (third === 28 /* CommaToken */ || third === 64 /* EqualsToken */) { return true; } return false; @@ -31457,7 +31599,7 @@ ${lanes.join("\n")} } } function parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction) { - const tokenPos = scanner2.getTokenPos(); + const tokenPos = scanner2.getTokenStart(); if (notParenthesizedArrow == null ? void 0 : notParenthesizedArrow.has(tokenPos)) { return void 0; } @@ -31472,7 +31614,7 @@ ${lanes.join("\n")} return result; } function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) { - if (token() === 132 /* AsyncKeyword */) { + if (token() === 134 /* AsyncKeyword */) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) { const pos = getNodePos(); const asyncModifier = parseModifiersForArrowFunction(); @@ -31483,13 +31625,13 @@ ${lanes.join("\n")} return void 0; } function isUnParenthesizedAsyncArrowFunctionWorker() { - if (token() === 132 /* AsyncKeyword */) { + if (token() === 134 /* AsyncKeyword */) { nextToken(); - if (scanner2.hasPrecedingLineBreak() || token() === 38 /* EqualsGreaterThanToken */) { + if (scanner2.hasPrecedingLineBreak() || token() === 39 /* EqualsGreaterThanToken */) { return 0 /* False */; } const expr = parseBinaryExpressionOrHigher(0 /* Lowest */); - if (!scanner2.hasPrecedingLineBreak() && expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) { + if (!scanner2.hasPrecedingLineBreak() && expr.kind === 80 /* Identifier */ && token() === 39 /* EqualsGreaterThanToken */) { return 1 /* True */; } } @@ -31502,7 +31644,7 @@ ${lanes.join("\n")} const isAsync = some(modifiers, isAsyncModifier) ? 2 /* Await */ : 0 /* None */; const typeParameters = parseTypeParameters(); let parameters; - if (!parseExpected(20 /* OpenParenToken */)) { + if (!parseExpected(21 /* OpenParenToken */)) { if (!allowAmbiguity) { return void 0; } @@ -31517,13 +31659,13 @@ ${lanes.join("\n")} } else { parameters = parseParametersWorker(isAsync, allowAmbiguity); } - if (!parseExpected(21 /* CloseParenToken */) && !allowAmbiguity) { + if (!parseExpected(22 /* CloseParenToken */) && !allowAmbiguity) { return void 0; } } - const hasReturnColon = token() === 58 /* ColonToken */; + const hasReturnColon = token() === 59 /* ColonToken */; const type = parseReturnType( - 58 /* ColonToken */, + 59 /* ColonToken */, /*isType*/ false ); @@ -31531,18 +31673,18 @@ ${lanes.join("\n")} return void 0; } let unwrappedType = type; - while ((unwrappedType == null ? void 0 : unwrappedType.kind) === 193 /* ParenthesizedType */) { + while ((unwrappedType == null ? void 0 : unwrappedType.kind) === 195 /* ParenthesizedType */) { unwrappedType = unwrappedType.type; } const hasJSDocFunctionType = unwrappedType && isJSDocFunctionType(unwrappedType); - if (!allowAmbiguity && token() !== 38 /* EqualsGreaterThanToken */ && (hasJSDocFunctionType || token() !== 18 /* OpenBraceToken */)) { + if (!allowAmbiguity && token() !== 39 /* EqualsGreaterThanToken */ && (hasJSDocFunctionType || token() !== 19 /* OpenBraceToken */)) { return void 0; } const lastToken = token(); - const equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */); - const body = lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */ ? parseArrowFunctionExpressionBody(some(modifiers, isAsyncModifier), allowReturnTypeInArrowFunction) : parseIdentifier(); + const equalsGreaterThanToken = parseExpectedToken(39 /* EqualsGreaterThanToken */); + const body = lastToken === 39 /* EqualsGreaterThanToken */ || lastToken === 19 /* OpenBraceToken */ ? parseArrowFunctionExpressionBody(some(modifiers, isAsyncModifier), allowReturnTypeInArrowFunction) : parseIdentifier(); if (!allowReturnTypeInArrowFunction && hasReturnColon) { - if (token() !== 58 /* ColonToken */) { + if (token() !== 59 /* ColonToken */) { return void 0; } } @@ -31550,10 +31692,10 @@ ${lanes.join("\n")} return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseArrowFunctionExpressionBody(isAsync, allowReturnTypeInArrowFunction) { - if (token() === 18 /* OpenBraceToken */) { + if (token() === 19 /* OpenBraceToken */) { return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */); } - if (token() !== 26 /* SemicolonToken */ && token() !== 98 /* FunctionKeyword */ && token() !== 84 /* ClassKeyword */ && isStartOfStatement() && !isStartOfExpressionStatement()) { + if (token() !== 27 /* SemicolonToken */ && token() !== 100 /* FunctionKeyword */ && token() !== 86 /* ClassKeyword */ && isStartOfStatement() && !isStartOfExpressionStatement()) { return parseFunctionBlock(16 /* IgnoreMissingOpenBrace */ | (isAsync ? 2 /* Await */ : 0 /* None */)); } const savedTopLevel = topLevel; @@ -31563,7 +31705,7 @@ ${lanes.join("\n")} return node; } function parseConditionalExpressionRest(leftOperand, pos, allowReturnTypeInArrowFunction) { - const questionToken = parseOptionalToken(57 /* QuestionToken */); + const questionToken = parseOptionalToken(58 /* QuestionToken */); if (!questionToken) { return leftOperand; } @@ -31576,13 +31718,13 @@ ${lanes.join("\n")} /*allowReturnTypeInArrowFunction*/ false )), - colonToken = parseExpectedToken(58 /* ColonToken */), + colonToken = parseExpectedToken(59 /* ColonToken */), nodeIsPresent(colonToken) ? parseAssignmentExpressionOrHigher(allowReturnTypeInArrowFunction) : createMissingNode( - 79 /* Identifier */, + 80 /* Identifier */, /*reportAtCurrentPosition*/ false, Diagnostics._0_expected, - tokenToString(58 /* ColonToken */) + tokenToString(59 /* ColonToken */) ) ), pos @@ -31594,26 +31736,26 @@ ${lanes.join("\n")} return parseBinaryExpressionRest(precedence, leftOperand, pos); } function isInOrOfKeyword(t) { - return t === 101 /* InKeyword */ || t === 162 /* OfKeyword */; + return t === 103 /* InKeyword */ || t === 164 /* OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand, pos) { while (true) { reScanGreaterToken(); const newPrecedence = getBinaryOperatorPrecedence(token()); - const consumeCurrentOperator = token() === 42 /* AsteriskAsteriskToken */ ? newPrecedence >= precedence : newPrecedence > precedence; + const consumeCurrentOperator = token() === 43 /* AsteriskAsteriskToken */ ? newPrecedence >= precedence : newPrecedence > precedence; if (!consumeCurrentOperator) { break; } - if (token() === 101 /* InKeyword */ && inDisallowInContext()) { + if (token() === 103 /* InKeyword */ && inDisallowInContext()) { break; } - if (token() === 128 /* AsKeyword */ || token() === 150 /* SatisfiesKeyword */) { + if (token() === 130 /* AsKeyword */ || token() === 152 /* SatisfiesKeyword */) { if (scanner2.hasPrecedingLineBreak()) { break; } else { const keywordKind = token(); nextToken(); - leftOperand = keywordKind === 150 /* SatisfiesKeyword */ ? makeSatisfiesExpression(leftOperand, parseType()) : makeAsExpression(leftOperand, parseType()); + leftOperand = keywordKind === 152 /* SatisfiesKeyword */ ? makeSatisfiesExpression(leftOperand, parseType()) : makeAsExpression(leftOperand, parseType()); } } else { leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence), pos); @@ -31622,7 +31764,7 @@ ${lanes.join("\n")} return leftOperand; } function isBinaryOperator2() { - if (inDisallowInContext() && token() === 101 /* InKeyword */) { + if (inDisallowInContext() && token() === 103 /* InKeyword */) { return false; } return getBinaryOperatorPrecedence(token()) > 0; @@ -31653,7 +31795,7 @@ ${lanes.join("\n")} return finishNode(factory2.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); } function isAwaitExpression2() { - if (token() === 133 /* AwaitKeyword */) { + if (token() === 135 /* AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -31669,16 +31811,17 @@ ${lanes.join("\n")} if (isUpdateExpression()) { const pos = getNodePos(); const updateExpression = parseUpdateExpression(); - return token() === 42 /* AsteriskAsteriskToken */ ? parseBinaryExpressionRest(getBinaryOperatorPrecedence(token()), updateExpression, pos) : updateExpression; + return token() === 43 /* AsteriskAsteriskToken */ ? parseBinaryExpressionRest(getBinaryOperatorPrecedence(token()), updateExpression, pos) : updateExpression; } const unaryOperator = token(); const simpleUnaryExpression = parseSimpleUnaryExpression(); - if (token() === 42 /* AsteriskAsteriskToken */) { + if (token() === 43 /* AsteriskAsteriskToken */) { const pos = skipTrivia(sourceText, simpleUnaryExpression.pos); const { end } = simpleUnaryExpression; - if (simpleUnaryExpression.kind === 213 /* TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 215 /* TypeAssertionExpression */) { parseErrorAt(pos, end, Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { + Debug.assert(isKeywordOrPunctuation(unaryOperator)); parseErrorAt(pos, end, Diagnostics.An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses, tokenToString(unaryOperator)); } } @@ -31686,18 +31829,18 @@ ${lanes.join("\n")} } function parseSimpleUnaryExpression() { switch (token()) { - case 39 /* PlusToken */: - case 40 /* MinusToken */: - case 54 /* TildeToken */: - case 53 /* ExclamationToken */: + case 40 /* PlusToken */: + case 41 /* MinusToken */: + case 55 /* TildeToken */: + case 54 /* ExclamationToken */: return parsePrefixUnaryExpression(); - case 89 /* DeleteKeyword */: + case 91 /* DeleteKeyword */: return parseDeleteExpression(); - case 112 /* TypeOfKeyword */: + case 114 /* TypeOfKeyword */: return parseTypeOfExpression(); - case 114 /* VoidKeyword */: + case 116 /* VoidKeyword */: return parseVoidExpression(); - case 29 /* LessThanToken */: + case 30 /* LessThanToken */: if (languageVariant === 1 /* JSX */) { return parseJsxElementOrSelfClosingElementOrFragment( /*inExpressionContext*/ @@ -31711,7 +31854,7 @@ ${lanes.join("\n")} ); } return parseTypeAssertion(); - case 133 /* AwaitKeyword */: + case 135 /* AwaitKeyword */: if (isAwaitExpression2()) { return parseAwaitExpression(); } @@ -31721,16 +31864,16 @@ ${lanes.join("\n")} } function isUpdateExpression() { switch (token()) { - case 39 /* PlusToken */: - case 40 /* MinusToken */: - case 54 /* TildeToken */: - case 53 /* ExclamationToken */: - case 89 /* DeleteKeyword */: - case 112 /* TypeOfKeyword */: - case 114 /* VoidKeyword */: - case 133 /* AwaitKeyword */: + case 40 /* PlusToken */: + case 41 /* MinusToken */: + case 55 /* TildeToken */: + case 54 /* ExclamationToken */: + case 91 /* DeleteKeyword */: + case 114 /* TypeOfKeyword */: + case 116 /* VoidKeyword */: + case 135 /* AwaitKeyword */: return false; - case 29 /* LessThanToken */: + case 30 /* LessThanToken */: if (languageVariant !== 1 /* JSX */) { return false; } @@ -31739,10 +31882,10 @@ ${lanes.join("\n")} } } function parseUpdateExpression() { - if (token() === 45 /* PlusPlusToken */ || token() === 46 /* MinusMinusToken */) { + if (token() === 46 /* PlusPlusToken */ || token() === 47 /* MinusMinusToken */) { const pos = getNodePos(); return finishNode(factory2.createPrefixUnaryExpression(token(), nextTokenAnd(parseLeftHandSideExpressionOrHigher)), pos); - } else if (languageVariant === 1 /* JSX */ && token() === 29 /* LessThanToken */ && lookAhead(nextTokenIsIdentifierOrKeywordOrGreaterThan)) { + } else if (languageVariant === 1 /* JSX */ && token() === 30 /* LessThanToken */ && lookAhead(nextTokenIsIdentifierOrKeywordOrGreaterThan)) { return parseJsxElementOrSelfClosingElementOrFragment( /*inExpressionContext*/ true @@ -31750,7 +31893,7 @@ ${lanes.join("\n")} } const expression = parseLeftHandSideExpressionOrHigher(); Debug.assert(isLeftHandSideExpression(expression)); - if ((token() === 45 /* PlusPlusToken */ || token() === 46 /* MinusMinusToken */) && !scanner2.hasPrecedingLineBreak()) { + if ((token() === 46 /* PlusPlusToken */ || token() === 47 /* MinusMinusToken */) && !scanner2.hasPrecedingLineBreak()) { const operator = token(); nextToken(); return finishNode(factory2.createPostfixUnaryExpression(expression, operator), expression.pos); @@ -31760,20 +31903,20 @@ ${lanes.join("\n")} function parseLeftHandSideExpressionOrHigher() { const pos = getNodePos(); let expression; - if (token() === 100 /* ImportKeyword */) { + if (token() === 102 /* ImportKeyword */) { if (lookAhead(nextTokenIsOpenParenOrLessThan)) { sourceFlags |= 2097152 /* PossiblyContainsDynamicImport */; expression = parseTokenNode(); } else if (lookAhead(nextTokenIsDot)) { nextToken(); nextToken(); - expression = finishNode(factory2.createMetaProperty(100 /* ImportKeyword */, parseIdentifierName()), pos); + expression = finishNode(factory2.createMetaProperty(102 /* ImportKeyword */, parseIdentifierName()), pos); sourceFlags |= 4194304 /* PossiblyContainsImportMeta */; } else { expression = parseMemberExpressionOrHigher(); } } else { - expression = token() === 106 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher(); + expression = token() === 108 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher(); } return parseCallExpressionRest(pos, expression); } @@ -31790,7 +31933,7 @@ ${lanes.join("\n")} function parseSuperExpression() { const pos = getNodePos(); let expression = parseTokenNode(); - if (token() === 29 /* LessThanToken */) { + if (token() === 30 /* LessThanToken */) { const startPos = getNodePos(); const typeArguments = tryParse(parseTypeArgumentsInExpression); if (typeArguments !== void 0) { @@ -31800,10 +31943,10 @@ ${lanes.join("\n")} } } } - if (token() === 20 /* OpenParenToken */ || token() === 24 /* DotToken */ || token() === 22 /* OpenBracketToken */) { + if (token() === 21 /* OpenParenToken */ || token() === 25 /* DotToken */ || token() === 23 /* OpenBracketToken */) { return expression; } - parseExpectedToken(24 /* DotToken */, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); + parseExpectedToken(25 /* DotToken */, Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access); return finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot( /*allowIdentifierNames*/ true, @@ -31815,11 +31958,11 @@ ${lanes.join("\n")} const pos = getNodePos(); const opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); let result; - if (opening.kind === 283 /* JsxOpeningElement */) { + if (opening.kind === 285 /* JsxOpeningElement */) { let children = parseJsxChildren(opening); let closingElement; const lastChild = children[children.length - 1]; - if ((lastChild == null ? void 0 : lastChild.kind) === 281 /* JsxElement */ && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { + if ((lastChild == null ? void 0 : lastChild.kind) === 283 /* JsxElement */ && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { const end = lastChild.children.end; const newLast = finishNode( factory2.createJsxElement( @@ -31843,13 +31986,13 @@ ${lanes.join("\n")} } } result = finishNode(factory2.createJsxElement(opening, children, closingElement), pos); - } else if (opening.kind === 286 /* JsxOpeningFragment */) { + } else if (opening.kind === 288 /* JsxOpeningFragment */) { result = finishNode(factory2.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); } else { - Debug.assert(opening.kind === 282 /* JsxSelfClosingElement */); + Debug.assert(opening.kind === 284 /* JsxSelfClosingElement */); result = opening; } - if (!mustBeUnary && inExpressionContext && token() === 29 /* LessThanToken */) { + if (!mustBeUnary && inExpressionContext && token() === 30 /* LessThanToken */) { const topBadPos = typeof topInvalidNodePosition === "undefined" ? result.pos : topInvalidNodePosition; const invalidElement = tryParse(() => parseJsxElementOrSelfClosingElementOrFragment( /*inExpressionContext*/ @@ -31858,7 +32001,7 @@ ${lanes.join("\n")} )); if (invalidElement) { const operatorToken = createMissingNode( - 27 /* CommaToken */, + 28 /* CommaToken */, /*reportAtCurrentPosition*/ false ); @@ -31871,7 +32014,7 @@ ${lanes.join("\n")} } function parseJsxText() { const pos = getNodePos(); - const node = factory2.createJsxText(scanner2.getTokenValue(), currentToken === 12 /* JsxTextAllWhiteSpaces */); + const node = factory2.createJsxText(scanner2.getTokenValue(), currentToken === 13 /* JsxTextAllWhiteSpaces */); currentToken = scanner2.scanJsxToken(); return finishNode(node, pos); } @@ -31882,22 +32025,22 @@ ${lanes.join("\n")} parseErrorAtRange(openingTag, Diagnostics.JSX_fragment_has_no_corresponding_closing_tag); } else { const tag = openingTag.tagName; - const start = skipTrivia(sourceText, tag.pos); + const start = Math.min(skipTrivia(sourceText, tag.pos), tag.end); parseErrorAt(start, tag.end, Diagnostics.JSX_element_0_has_no_corresponding_closing_tag, getTextOfNodeFromSourceText(sourceText, openingTag.tagName)); } return void 0; - case 30 /* LessThanSlashToken */: + case 31 /* LessThanSlashToken */: case 7 /* ConflictMarkerTrivia */: return void 0; - case 11 /* JsxText */: - case 12 /* JsxTextAllWhiteSpaces */: + case 12 /* JsxText */: + case 13 /* JsxTextAllWhiteSpaces */: return parseJsxText(); - case 18 /* OpenBraceToken */: + case 19 /* OpenBraceToken */: return parseJsxExpression( /*inExpressionContext*/ false ); - case 29 /* LessThanToken */: + case 30 /* LessThanToken */: return parseJsxElementOrSelfClosingElementOrFragment( /*inExpressionContext*/ false, @@ -31919,7 +32062,7 @@ ${lanes.join("\n")} if (!child) break; list.push(child); - if (isJsxOpeningElement(openingTag) && (child == null ? void 0 : child.kind) === 281 /* JsxElement */ && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { + if (isJsxOpeningElement(openingTag) && (child == null ? void 0 : child.kind) === 283 /* JsxElement */ && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { break; } } @@ -31932,8 +32075,8 @@ ${lanes.join("\n")} } function parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext) { const pos = getNodePos(); - parseExpected(29 /* LessThanToken */); - if (token() === 31 /* GreaterThanToken */) { + parseExpected(30 /* LessThanToken */); + if (token() === 32 /* GreaterThanToken */) { scanJsxText(); return finishNode(factory2.createJsxOpeningFragment(), pos); } @@ -31941,14 +32084,14 @@ ${lanes.join("\n")} const typeArguments = (contextFlags & 262144 /* JavaScriptFile */) === 0 ? tryParseTypeArguments() : void 0; const attributes = parseJsxAttributes(); let node; - if (token() === 31 /* GreaterThanToken */) { + if (token() === 32 /* GreaterThanToken */) { scanJsxText(); node = factory2.createJsxOpeningElement(tagName, typeArguments, attributes); } else { - parseExpected(43 /* SlashToken */); + parseExpected(44 /* SlashToken */); if (parseExpected( - 31 /* GreaterThanToken */, - /*diagnostic*/ + 32 /* GreaterThanToken */, + /*diagnosticMessage*/ void 0, /*shouldAdvance*/ false @@ -31965,9 +32108,12 @@ ${lanes.join("\n")} } function parseJsxElementName() { const pos = getNodePos(); - scanJsxIdentifier(); - let expression = token() === 108 /* ThisKeyword */ ? parseTokenNode() : parseIdentifierName(); - while (parseOptional(24 /* DotToken */)) { + const initialExpression = parseJsxTagName(); + if (isJsxNamespacedName(initialExpression)) { + return initialExpression; + } + let expression = initialExpression; + while (parseOptional(25 /* DotToken */)) { expression = finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot( /*allowIdentifierNames*/ true, @@ -31977,23 +32123,34 @@ ${lanes.join("\n")} } return expression; } + function parseJsxTagName() { + const pos = getNodePos(); + scanJsxIdentifier(); + const isThis2 = token() === 110 /* ThisKeyword */; + const tagName = parseIdentifierName(); + if (parseOptional(59 /* ColonToken */)) { + scanJsxIdentifier(); + return finishNode(factory2.createJsxNamespacedName(tagName, parseIdentifierName()), pos); + } + return isThis2 ? finishNode(factory2.createToken(110 /* ThisKeyword */), pos) : tagName; + } function parseJsxExpression(inExpressionContext) { const pos = getNodePos(); - if (!parseExpected(18 /* OpenBraceToken */)) { + if (!parseExpected(19 /* OpenBraceToken */)) { return void 0; } let dotDotDotToken; let expression; - if (token() !== 19 /* CloseBraceToken */) { - dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */); + if (token() !== 20 /* CloseBraceToken */) { + dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */); expression = parseExpression(); } if (inExpressionContext) { - parseExpected(19 /* CloseBraceToken */); + parseExpected(20 /* CloseBraceToken */); } else { if (parseExpected( - 19 /* CloseBraceToken */, - /*message*/ + 20 /* CloseBraceToken */, + /*diagnosticMessage*/ void 0, /*shouldAdvance*/ false @@ -32004,25 +32161,24 @@ ${lanes.join("\n")} return finishNode(factory2.createJsxExpression(dotDotDotToken, expression), pos); } function parseJsxAttribute() { - if (token() === 18 /* OpenBraceToken */) { + if (token() === 19 /* OpenBraceToken */) { return parseJsxSpreadAttribute(); } - scanJsxIdentifier(); const pos = getNodePos(); - return finishNode(factory2.createJsxAttribute(parseIdentifierName(), parseJsxAttributeValue()), pos); + return finishNode(factory2.createJsxAttribute(parseJsxAttributeName(), parseJsxAttributeValue()), pos); } function parseJsxAttributeValue() { - if (token() === 63 /* EqualsToken */) { - if (scanJsxAttributeValue() === 10 /* StringLiteral */) { + if (token() === 64 /* EqualsToken */) { + if (scanJsxAttributeValue() === 11 /* StringLiteral */) { return parseLiteralNode(); } - if (token() === 18 /* OpenBraceToken */) { + if (token() === 19 /* OpenBraceToken */) { return parseJsxExpression( /*inExpressionContext*/ true ); } - if (token() === 29 /* LessThanToken */) { + if (token() === 30 /* LessThanToken */) { return parseJsxElementOrSelfClosingElementOrFragment( /*inExpressionContext*/ true @@ -32032,21 +32188,31 @@ ${lanes.join("\n")} } return void 0; } + function parseJsxAttributeName() { + const pos = getNodePos(); + scanJsxIdentifier(); + const attrName = parseIdentifierName(); + if (parseOptional(59 /* ColonToken */)) { + scanJsxIdentifier(); + return finishNode(factory2.createJsxNamespacedName(attrName, parseIdentifierName()), pos); + } + return attrName; + } function parseJsxSpreadAttribute() { const pos = getNodePos(); - parseExpected(18 /* OpenBraceToken */); - parseExpected(25 /* DotDotDotToken */); + parseExpected(19 /* OpenBraceToken */); + parseExpected(26 /* DotDotDotToken */); const expression = parseExpression(); - parseExpected(19 /* CloseBraceToken */); + parseExpected(20 /* CloseBraceToken */); return finishNode(factory2.createJsxSpreadAttribute(expression), pos); } function parseJsxClosingElement(open, inExpressionContext) { const pos = getNodePos(); - parseExpected(30 /* LessThanSlashToken */); + parseExpected(31 /* LessThanSlashToken */); const tagName = parseJsxElementName(); if (parseExpected( - 31 /* GreaterThanToken */, - /*diagnostic*/ + 32 /* GreaterThanToken */, + /*diagnosticMessage*/ void 0, /*shouldAdvance*/ false @@ -32061,9 +32227,9 @@ ${lanes.join("\n")} } function parseJsxClosingFragment(inExpressionContext) { const pos = getNodePos(); - parseExpected(30 /* LessThanSlashToken */); + parseExpected(31 /* LessThanSlashToken */); if (parseExpected( - 31 /* GreaterThanToken */, + 32 /* GreaterThanToken */, Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment, /*shouldAdvance*/ false @@ -32079,18 +32245,18 @@ ${lanes.join("\n")} function parseTypeAssertion() { Debug.assert(languageVariant !== 1 /* JSX */, "Type assertions should never be parsed in JSX; they should be parsed as comparisons or JSX elements/fragments."); const pos = getNodePos(); - parseExpected(29 /* LessThanToken */); + parseExpected(30 /* LessThanToken */); const type = parseType(); - parseExpected(31 /* GreaterThanToken */); + parseExpected(32 /* GreaterThanToken */); const expression = parseSimpleUnaryExpression(); return finishNode(factory2.createTypeAssertion(type, expression), pos); } function nextTokenIsIdentifierOrKeywordOrOpenBracketOrTemplate() { nextToken(); - return tokenIsIdentifierOrKeyword(token()) || token() === 22 /* OpenBracketToken */ || isTemplateStartOfTaggedTemplate(); + return tokenIsIdentifierOrKeyword(token()) || token() === 23 /* OpenBracketToken */ || isTemplateStartOfTaggedTemplate(); } function isStartOfOptionalPropertyOrElementAccessChain() { - return token() === 28 /* QuestionDotToken */ && lookAhead(nextTokenIsIdentifierOrKeywordOrOpenBracketOrTemplate); + return token() === 29 /* QuestionDotToken */ && lookAhead(nextTokenIsIdentifierOrKeywordOrOpenBracketOrTemplate); } function tryReparseOptionalChain(node) { if (node.flags & 32 /* OptionalChain */) { @@ -32132,9 +32298,9 @@ ${lanes.join("\n")} } function parseElementAccessExpressionRest(pos, expression, questionDotToken) { let argumentExpression; - if (token() === 23 /* CloseBracketToken */) { + if (token() === 24 /* CloseBracketToken */) { argumentExpression = createMissingNode( - 79 /* Identifier */, + 80 /* Identifier */, /*reportAtCurrentPosition*/ true, Diagnostics.An_element_access_expression_should_take_an_argument @@ -32146,7 +32312,7 @@ ${lanes.join("\n")} } argumentExpression = argument; } - parseExpected(23 /* CloseBracketToken */); + parseExpected(24 /* CloseBracketToken */); const indexedAccess = questionDotToken || tryReparseOptionalChain(expression) ? factoryCreateElementAccessChain(expression, questionDotToken, argumentExpression) : factoryCreateElementAccessExpression(expression, argumentExpression); return finishNode(indexedAccess, pos); } @@ -32155,21 +32321,21 @@ ${lanes.join("\n")} let questionDotToken; let isPropertyAccess = false; if (allowOptionalChain && isStartOfOptionalPropertyOrElementAccessChain()) { - questionDotToken = parseExpectedToken(28 /* QuestionDotToken */); + questionDotToken = parseExpectedToken(29 /* QuestionDotToken */); isPropertyAccess = tokenIsIdentifierOrKeyword(token()); } else { - isPropertyAccess = parseOptional(24 /* DotToken */); + isPropertyAccess = parseOptional(25 /* DotToken */); } if (isPropertyAccess) { expression = parsePropertyAccessExpressionRest(pos, expression, questionDotToken); continue; } - if ((questionDotToken || !inDecoratorContext()) && parseOptional(22 /* OpenBracketToken */)) { + if ((questionDotToken || !inDecoratorContext()) && parseOptional(23 /* OpenBracketToken */)) { expression = parseElementAccessExpressionRest(pos, expression, questionDotToken); continue; } if (isTemplateStartOfTaggedTemplate()) { - expression = !questionDotToken && expression.kind === 230 /* ExpressionWithTypeArguments */ ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest( + expression = !questionDotToken && expression.kind === 232 /* ExpressionWithTypeArguments */ ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest( pos, expression, questionDotToken, @@ -32179,7 +32345,7 @@ ${lanes.join("\n")} continue; } if (!questionDotToken) { - if (token() === 53 /* ExclamationToken */ && !scanner2.hasPrecedingLineBreak()) { + if (token() === 54 /* ExclamationToken */ && !scanner2.hasPrecedingLineBreak()) { nextToken(); expression = finishNode(factory2.createNonNullExpression(expression), pos); continue; @@ -32194,13 +32360,16 @@ ${lanes.join("\n")} } } function isTemplateStartOfTaggedTemplate() { - return token() === 14 /* NoSubstitutionTemplateLiteral */ || token() === 15 /* TemplateHead */; + return token() === 15 /* NoSubstitutionTemplateLiteral */ || token() === 16 /* TemplateHead */; } function parseTaggedTemplateRest(pos, tag, questionDotToken, typeArguments) { const tagExpression = factory2.createTaggedTemplateExpression( tag, typeArguments, - token() === 14 /* NoSubstitutionTemplateLiteral */ ? (reScanTemplateHeadOrNoSubstitutionTemplate(), parseLiteralNode()) : parseTemplateExpression( + token() === 15 /* NoSubstitutionTemplateLiteral */ ? (reScanTemplateToken( + /*isTaggedTemplate*/ + true + ), parseLiteralNode()) : parseTemplateExpression( /*isTaggedTemplate*/ true ) @@ -32220,7 +32389,7 @@ ${lanes.join("\n")} true ); let typeArguments; - const questionDotToken = parseOptionalToken(28 /* QuestionDotToken */); + const questionDotToken = parseOptionalToken(29 /* QuestionDotToken */); if (questionDotToken) { typeArguments = tryParse(parseTypeArgumentsInExpression); if (isTemplateStartOfTaggedTemplate()) { @@ -32228,8 +32397,8 @@ ${lanes.join("\n")} continue; } } - if (typeArguments || token() === 20 /* OpenParenToken */) { - if (!questionDotToken && expression.kind === 230 /* ExpressionWithTypeArguments */) { + if (typeArguments || token() === 21 /* OpenParenToken */) { + if (!questionDotToken && expression.kind === 232 /* ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -32240,7 +32409,7 @@ ${lanes.join("\n")} } if (questionDotToken) { const name = createMissingNode( - 79 /* Identifier */, + 80 /* Identifier */, /*reportAtCurrentPosition*/ false, Diagnostics.Identifier_expected @@ -32252,21 +32421,21 @@ ${lanes.join("\n")} return expression; } function parseArgumentList() { - parseExpected(20 /* OpenParenToken */); + parseExpected(21 /* OpenParenToken */); const result = parseDelimitedList(11 /* ArgumentExpressions */, parseArgumentExpression); - parseExpected(21 /* CloseParenToken */); + parseExpected(22 /* CloseParenToken */); return result; } function parseTypeArgumentsInExpression() { if ((contextFlags & 262144 /* JavaScriptFile */) !== 0) { return void 0; } - if (reScanLessThanToken() !== 29 /* LessThanToken */) { + if (reScanLessThanToken() !== 30 /* LessThanToken */) { return void 0; } nextToken(); const typeArguments = parseDelimitedList(20 /* TypeArguments */, parseType); - if (reScanGreaterToken() !== 31 /* GreaterThanToken */) { + if (reScanGreaterToken() !== 32 /* GreaterThanToken */) { return void 0; } nextToken(); @@ -32274,62 +32443,68 @@ ${lanes.join("\n")} } function canFollowTypeArgumentsInExpression() { switch (token()) { - case 20 /* OpenParenToken */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 15 /* TemplateHead */: + case 21 /* OpenParenToken */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 16 /* TemplateHead */: return true; - case 29 /* LessThanToken */: - case 31 /* GreaterThanToken */: - case 39 /* PlusToken */: - case 40 /* MinusToken */: + case 30 /* LessThanToken */: + case 32 /* GreaterThanToken */: + case 40 /* PlusToken */: + case 41 /* MinusToken */: return false; } return scanner2.hasPrecedingLineBreak() || isBinaryOperator2() || !isStartOfExpression(); } function parsePrimaryExpression() { switch (token()) { - case 8 /* NumericLiteral */: - case 9 /* BigIntLiteral */: - case 10 /* StringLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + if (scanner2.getTokenFlags() & 26656 /* IsInvalid */) { + reScanTemplateToken( + /*isTaggedTemplate*/ + false + ); + } + case 9 /* NumericLiteral */: + case 10 /* BigIntLiteral */: + case 11 /* StringLiteral */: return parseLiteralNode(); - case 108 /* ThisKeyword */: - case 106 /* SuperKeyword */: - case 104 /* NullKeyword */: - case 110 /* TrueKeyword */: - case 95 /* FalseKeyword */: + case 110 /* ThisKeyword */: + case 108 /* SuperKeyword */: + case 106 /* NullKeyword */: + case 112 /* TrueKeyword */: + case 97 /* FalseKeyword */: return parseTokenNode(); - case 20 /* OpenParenToken */: + case 21 /* OpenParenToken */: return parseParenthesizedExpression(); - case 22 /* OpenBracketToken */: + case 23 /* OpenBracketToken */: return parseArrayLiteralExpression(); - case 18 /* OpenBraceToken */: + case 19 /* OpenBraceToken */: return parseObjectLiteralExpression(); - case 132 /* AsyncKeyword */: + case 134 /* AsyncKeyword */: if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) { break; } return parseFunctionExpression(); - case 59 /* AtToken */: + case 60 /* AtToken */: return parseDecoratedExpression(); - case 84 /* ClassKeyword */: + case 86 /* ClassKeyword */: return parseClassExpression(); - case 98 /* FunctionKeyword */: + case 100 /* FunctionKeyword */: return parseFunctionExpression(); - case 103 /* NewKeyword */: + case 105 /* NewKeyword */: return parseNewExpressionOrNewDotTarget(); - case 43 /* SlashToken */: - case 68 /* SlashEqualsToken */: - if (reScanSlashToken() === 13 /* RegularExpressionLiteral */) { + case 44 /* SlashToken */: + case 69 /* SlashEqualsToken */: + if (reScanSlashToken() === 14 /* RegularExpressionLiteral */) { return parseLiteralNode(); } break; - case 15 /* TemplateHead */: + case 16 /* TemplateHead */: return parseTemplateExpression( - /* isTaggedTemplate */ + /*isTaggedTemplate*/ false ); - case 80 /* PrivateIdentifier */: + case 81 /* PrivateIdentifier */: return parsePrivateIdentifier(); } return parseIdentifier(Diagnostics.Expression_expected); @@ -32337,14 +32512,14 @@ ${lanes.join("\n")} function parseParenthesizedExpression() { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(20 /* OpenParenToken */); + parseExpected(21 /* OpenParenToken */); const expression = allowInAnd(parseExpression); - parseExpected(21 /* CloseParenToken */); + parseExpected(22 /* CloseParenToken */); return withJSDoc(finishNode(factoryCreateParenthesizedExpression(expression), pos), hasJSDoc); } function parseSpreadElement() { const pos = getNodePos(); - parseExpected(25 /* DotDotDotToken */); + parseExpected(26 /* DotDotDotToken */); const expression = parseAssignmentExpressionOrHigher( /*allowReturnTypeInArrowFunction*/ true @@ -32352,7 +32527,7 @@ ${lanes.join("\n")} return finishNode(factory2.createSpreadElement(expression), pos); } function parseArgumentOrArrayLiteralElement() { - return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() : token() === 27 /* CommaToken */ ? finishNode(factory2.createOmittedExpression(), getNodePos()) : parseAssignmentExpressionOrHigher( + return token() === 26 /* DotDotDotToken */ ? parseSpreadElement() : token() === 28 /* CommaToken */ ? finishNode(factory2.createOmittedExpression(), getNodePos()) : parseAssignmentExpressionOrHigher( /*allowReturnTypeInArrowFunction*/ true ); @@ -32362,17 +32537,17 @@ ${lanes.join("\n")} } function parseArrayLiteralExpression() { const pos = getNodePos(); - const openBracketPosition = scanner2.getTokenPos(); - const openBracketParsed = parseExpected(22 /* OpenBracketToken */); + const openBracketPosition = scanner2.getTokenStart(); + const openBracketParsed = parseExpected(23 /* OpenBracketToken */); const multiLine = scanner2.hasPrecedingLineBreak(); const elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement); - parseExpectedMatchingBrackets(22 /* OpenBracketToken */, 23 /* CloseBracketToken */, openBracketParsed, openBracketPosition); + parseExpectedMatchingBrackets(23 /* OpenBracketToken */, 24 /* CloseBracketToken */, openBracketParsed, openBracketPosition); return finishNode(factoryCreateArrayLiteralExpression(elements, multiLine), pos); } function parseObjectLiteralElement() { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - if (parseOptionalToken(25 /* DotDotDotToken */)) { + if (parseOptionalToken(26 /* DotDotDotToken */)) { const expression = parseAssignmentExpressionOrHigher( /*allowReturnTypeInArrowFunction*/ true @@ -32383,24 +32558,24 @@ ${lanes.join("\n")} /*allowDecorators*/ true ); - if (parseContextualModifier(137 /* GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 174 /* GetAccessor */, 0 /* None */); + if (parseContextualModifier(139 /* GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 176 /* GetAccessor */, 0 /* None */); } - if (parseContextualModifier(151 /* SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 175 /* SetAccessor */, 0 /* None */); + if (parseContextualModifier(153 /* SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 177 /* SetAccessor */, 0 /* None */); } - const asteriskToken = parseOptionalToken(41 /* AsteriskToken */); + const asteriskToken = parseOptionalToken(42 /* AsteriskToken */); const tokenIsIdentifier = isIdentifier2(); const name = parsePropertyName(); - const questionToken = parseOptionalToken(57 /* QuestionToken */); - const exclamationToken = parseOptionalToken(53 /* ExclamationToken */); - if (asteriskToken || token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */) { + const questionToken = parseOptionalToken(58 /* QuestionToken */); + const exclamationToken = parseOptionalToken(54 /* ExclamationToken */); + if (asteriskToken || token() === 21 /* OpenParenToken */ || token() === 30 /* LessThanToken */) { return parseMethodDeclaration(pos, hasJSDoc, modifiers, asteriskToken, name, questionToken, exclamationToken); } let node; - const isShorthandPropertyAssignment2 = tokenIsIdentifier && token() !== 58 /* ColonToken */; + const isShorthandPropertyAssignment2 = tokenIsIdentifier && token() !== 59 /* ColonToken */; if (isShorthandPropertyAssignment2) { - const equalsToken = parseOptionalToken(63 /* EqualsToken */); + const equalsToken = parseOptionalToken(64 /* EqualsToken */); const objectAssignmentInitializer = equalsToken ? allowInAnd(() => parseAssignmentExpressionOrHigher( /*allowReturnTypeInArrowFunction*/ true @@ -32408,7 +32583,7 @@ ${lanes.join("\n")} node = factory2.createShorthandPropertyAssignment(name, objectAssignmentInitializer); node.equalsToken = equalsToken; } else { - parseExpected(58 /* ColonToken */); + parseExpected(59 /* ColonToken */); const initializer = allowInAnd(() => parseAssignmentExpressionOrHigher( /*allowReturnTypeInArrowFunction*/ true @@ -32422,8 +32597,8 @@ ${lanes.join("\n")} } function parseObjectLiteralExpression() { const pos = getNodePos(); - const openBracePosition = scanner2.getTokenPos(); - const openBraceParsed = parseExpected(18 /* OpenBraceToken */); + const openBracePosition = scanner2.getTokenStart(); + const openBraceParsed = parseExpected(19 /* OpenBraceToken */); const multiLine = scanner2.hasPrecedingLineBreak(); const properties = parseDelimitedList( 12 /* ObjectLiteralMembers */, @@ -32431,7 +32606,7 @@ ${lanes.join("\n")} /*considerSemicolonAsDelimiter*/ true ); - parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition); + parseExpectedMatchingBrackets(19 /* OpenBraceToken */, 20 /* CloseBraceToken */, openBraceParsed, openBracePosition); return finishNode(factoryCreateObjectLiteralExpression(properties, multiLine), pos); } function parseFunctionExpression() { @@ -32446,15 +32621,15 @@ ${lanes.join("\n")} /*allowDecorators*/ false ); - parseExpected(98 /* FunctionKeyword */); - const asteriskToken = parseOptionalToken(41 /* AsteriskToken */); + parseExpected(100 /* FunctionKeyword */); + const asteriskToken = parseOptionalToken(42 /* AsteriskToken */); const isGenerator = asteriskToken ? 1 /* Yield */ : 0 /* None */; const isAsync = some(modifiers, isAsyncModifier) ? 2 /* Await */ : 0 /* None */; const name = isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalBindingIdentifier) : isGenerator ? doInYieldContext(parseOptionalBindingIdentifier) : isAsync ? doInAwaitContext(parseOptionalBindingIdentifier) : parseOptionalBindingIdentifier(); const typeParameters = parseTypeParameters(); const parameters = parseParameters(isGenerator | isAsync); const type = parseReturnType( - 58 /* ColonToken */, + 59 /* ColonToken */, /*isType*/ false ); @@ -32468,10 +32643,10 @@ ${lanes.join("\n")} } function parseNewExpressionOrNewDotTarget() { const pos = getNodePos(); - parseExpected(103 /* NewKeyword */); - if (parseOptional(24 /* DotToken */)) { + parseExpected(105 /* NewKeyword */); + if (parseOptional(25 /* DotToken */)) { const name = parseIdentifierName(); - return finishNode(factory2.createMetaProperty(103 /* NewKeyword */, name), pos); + return finishNode(factory2.createMetaProperty(105 /* NewKeyword */, name), pos); } const expressionPos = getNodePos(); let expression = parseMemberExpressionRest( @@ -32481,27 +32656,27 @@ ${lanes.join("\n")} false ); let typeArguments; - if (expression.kind === 230 /* ExpressionWithTypeArguments */) { + if (expression.kind === 232 /* ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } - if (token() === 28 /* QuestionDotToken */) { + if (token() === 29 /* QuestionDotToken */) { parseErrorAtCurrentToken(Diagnostics.Invalid_optional_chain_from_new_expression_Did_you_mean_to_call_0, getTextOfNodeFromSourceText(sourceText, expression)); } - const argumentList = token() === 20 /* OpenParenToken */ ? parseArgumentList() : void 0; + const argumentList = token() === 21 /* OpenParenToken */ ? parseArgumentList() : void 0; return finishNode(factoryCreateNewExpression(expression, typeArguments, argumentList), pos); } function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - const openBracePosition = scanner2.getTokenPos(); - const openBraceParsed = parseExpected(18 /* OpenBraceToken */, diagnosticMessage); + const openBracePosition = scanner2.getTokenStart(); + const openBraceParsed = parseExpected(19 /* OpenBraceToken */, diagnosticMessage); if (openBraceParsed || ignoreMissingOpenBrace) { const multiLine = scanner2.hasPrecedingLineBreak(); const statements = parseList(1 /* BlockStatements */, parseStatement); - parseExpectedMatchingBrackets(18 /* OpenBraceToken */, 19 /* CloseBraceToken */, openBraceParsed, openBracePosition); + parseExpectedMatchingBrackets(19 /* OpenBraceToken */, 20 /* CloseBraceToken */, openBraceParsed, openBracePosition); const result = withJSDoc(finishNode(factoryCreateBlock(statements, multiLine), pos), hasJSDoc); - if (token() === 63 /* EqualsToken */) { + if (token() === 64 /* EqualsToken */) { parseErrorAtCurrentToken(Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_whole_assignment_in_parentheses); nextToken(); } @@ -32544,54 +32719,54 @@ ${lanes.join("\n")} function parseEmptyStatement() { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(26 /* SemicolonToken */); + parseExpected(27 /* SemicolonToken */); return withJSDoc(finishNode(factory2.createEmptyStatement(), pos), hasJSDoc); } function parseIfStatement() { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(99 /* IfKeyword */); - const openParenPosition = scanner2.getTokenPos(); - const openParenParsed = parseExpected(20 /* OpenParenToken */); + parseExpected(101 /* IfKeyword */); + const openParenPosition = scanner2.getTokenStart(); + const openParenParsed = parseExpected(21 /* OpenParenToken */); const expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition); + parseExpectedMatchingBrackets(21 /* OpenParenToken */, 22 /* CloseParenToken */, openParenParsed, openParenPosition); const thenStatement = parseStatement(); - const elseStatement = parseOptional(91 /* ElseKeyword */) ? parseStatement() : void 0; + const elseStatement = parseOptional(93 /* ElseKeyword */) ? parseStatement() : void 0; return withJSDoc(finishNode(factoryCreateIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc); } function parseDoStatement() { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(90 /* DoKeyword */); + parseExpected(92 /* DoKeyword */); const statement = parseStatement(); - parseExpected(115 /* WhileKeyword */); - const openParenPosition = scanner2.getTokenPos(); - const openParenParsed = parseExpected(20 /* OpenParenToken */); + parseExpected(117 /* WhileKeyword */); + const openParenPosition = scanner2.getTokenStart(); + const openParenParsed = parseExpected(21 /* OpenParenToken */); const expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition); - parseOptional(26 /* SemicolonToken */); + parseExpectedMatchingBrackets(21 /* OpenParenToken */, 22 /* CloseParenToken */, openParenParsed, openParenPosition); + parseOptional(27 /* SemicolonToken */); return withJSDoc(finishNode(factory2.createDoStatement(statement, expression), pos), hasJSDoc); } function parseWhileStatement() { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(115 /* WhileKeyword */); - const openParenPosition = scanner2.getTokenPos(); - const openParenParsed = parseExpected(20 /* OpenParenToken */); + parseExpected(117 /* WhileKeyword */); + const openParenPosition = scanner2.getTokenStart(); + const openParenParsed = parseExpected(21 /* OpenParenToken */); const expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition); + parseExpectedMatchingBrackets(21 /* OpenParenToken */, 22 /* CloseParenToken */, openParenParsed, openParenPosition); const statement = parseStatement(); return withJSDoc(finishNode(factoryCreateWhileStatement(expression, statement), pos), hasJSDoc); } function parseForOrForInOrForOfStatement() { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(97 /* ForKeyword */); - const awaitToken = parseOptionalToken(133 /* AwaitKeyword */); - parseExpected(20 /* OpenParenToken */); + parseExpected(99 /* ForKeyword */); + const awaitToken = parseOptionalToken(135 /* AwaitKeyword */); + parseExpected(21 /* OpenParenToken */); let initializer; - if (token() !== 26 /* SemicolonToken */) { - if (token() === 113 /* VarKeyword */ || token() === 119 /* LetKeyword */ || token() === 85 /* ConstKeyword */) { + if (token() !== 27 /* SemicolonToken */) { + if (token() === 115 /* VarKeyword */ || token() === 121 /* LetKeyword */ || token() === 87 /* ConstKeyword */) { initializer = parseVariableDeclarationList( /*inForStatementInitializer*/ true @@ -32601,23 +32776,23 @@ ${lanes.join("\n")} } } let node; - if (awaitToken ? parseExpected(162 /* OfKeyword */) : parseOptional(162 /* OfKeyword */)) { + if (awaitToken ? parseExpected(164 /* OfKeyword */) : parseOptional(164 /* OfKeyword */)) { const expression = allowInAnd(() => parseAssignmentExpressionOrHigher( /*allowReturnTypeInArrowFunction*/ true )); - parseExpected(21 /* CloseParenToken */); + parseExpected(22 /* CloseParenToken */); node = factoryCreateForOfStatement(awaitToken, initializer, expression, parseStatement()); - } else if (parseOptional(101 /* InKeyword */)) { + } else if (parseOptional(103 /* InKeyword */)) { const expression = allowInAnd(parseExpression); - parseExpected(21 /* CloseParenToken */); + parseExpected(22 /* CloseParenToken */); node = factory2.createForInStatement(initializer, expression, parseStatement()); } else { - parseExpected(26 /* SemicolonToken */); - const condition = token() !== 26 /* SemicolonToken */ && token() !== 21 /* CloseParenToken */ ? allowInAnd(parseExpression) : void 0; - parseExpected(26 /* SemicolonToken */); - const incrementor = token() !== 21 /* CloseParenToken */ ? allowInAnd(parseExpression) : void 0; - parseExpected(21 /* CloseParenToken */); + parseExpected(27 /* SemicolonToken */); + const condition = token() !== 27 /* SemicolonToken */ && token() !== 22 /* CloseParenToken */ ? allowInAnd(parseExpression) : void 0; + parseExpected(27 /* SemicolonToken */); + const incrementor = token() !== 22 /* CloseParenToken */ ? allowInAnd(parseExpression) : void 0; + parseExpected(22 /* CloseParenToken */); node = factoryCreateForStatement(initializer, condition, incrementor, parseStatement()); } return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -32625,16 +32800,16 @@ ${lanes.join("\n")} function parseBreakOrContinueStatement(kind) { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(kind === 249 /* BreakStatement */ ? 81 /* BreakKeyword */ : 86 /* ContinueKeyword */); + parseExpected(kind === 251 /* BreakStatement */ ? 83 /* BreakKeyword */ : 88 /* ContinueKeyword */); const label = canParseSemicolon() ? void 0 : parseIdentifier(); parseSemicolon(); - const node = kind === 249 /* BreakStatement */ ? factory2.createBreakStatement(label) : factory2.createContinueStatement(label); + const node = kind === 251 /* BreakStatement */ ? factory2.createBreakStatement(label) : factory2.createContinueStatement(label); return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseReturnStatement() { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(105 /* ReturnKeyword */); + parseExpected(107 /* ReturnKeyword */); const expression = canParseSemicolon() ? void 0 : allowInAnd(parseExpression); parseSemicolon(); return withJSDoc(finishNode(factory2.createReturnStatement(expression), pos), hasJSDoc); @@ -32642,54 +32817,54 @@ ${lanes.join("\n")} function parseWithStatement() { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(116 /* WithKeyword */); - const openParenPosition = scanner2.getTokenPos(); - const openParenParsed = parseExpected(20 /* OpenParenToken */); + parseExpected(118 /* WithKeyword */); + const openParenPosition = scanner2.getTokenStart(); + const openParenParsed = parseExpected(21 /* OpenParenToken */); const expression = allowInAnd(parseExpression); - parseExpectedMatchingBrackets(20 /* OpenParenToken */, 21 /* CloseParenToken */, openParenParsed, openParenPosition); + parseExpectedMatchingBrackets(21 /* OpenParenToken */, 22 /* CloseParenToken */, openParenParsed, openParenPosition); const statement = doInsideOfContext(33554432 /* InWithStatement */, parseStatement); return withJSDoc(finishNode(factory2.createWithStatement(expression, statement), pos), hasJSDoc); } function parseCaseClause() { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(82 /* CaseKeyword */); + parseExpected(84 /* CaseKeyword */); const expression = allowInAnd(parseExpression); - parseExpected(58 /* ColonToken */); + parseExpected(59 /* ColonToken */); const statements = parseList(3 /* SwitchClauseStatements */, parseStatement); return withJSDoc(finishNode(factory2.createCaseClause(expression, statements), pos), hasJSDoc); } function parseDefaultClause() { const pos = getNodePos(); - parseExpected(88 /* DefaultKeyword */); - parseExpected(58 /* ColonToken */); + parseExpected(90 /* DefaultKeyword */); + parseExpected(59 /* ColonToken */); const statements = parseList(3 /* SwitchClauseStatements */, parseStatement); return finishNode(factory2.createDefaultClause(statements), pos); } function parseCaseOrDefaultClause() { - return token() === 82 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); + return token() === 84 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause(); } function parseCaseBlock() { const pos = getNodePos(); - parseExpected(18 /* OpenBraceToken */); + parseExpected(19 /* OpenBraceToken */); const clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause); - parseExpected(19 /* CloseBraceToken */); + parseExpected(20 /* CloseBraceToken */); return finishNode(factory2.createCaseBlock(clauses), pos); } function parseSwitchStatement() { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(107 /* SwitchKeyword */); - parseExpected(20 /* OpenParenToken */); + parseExpected(109 /* SwitchKeyword */); + parseExpected(21 /* OpenParenToken */); const expression = allowInAnd(parseExpression); - parseExpected(21 /* CloseParenToken */); + parseExpected(22 /* CloseParenToken */); const caseBlock = parseCaseBlock(); return withJSDoc(finishNode(factory2.createSwitchStatement(expression, caseBlock), pos), hasJSDoc); } function parseThrowStatement() { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(109 /* ThrowKeyword */); + parseExpected(111 /* ThrowKeyword */); let expression = scanner2.hasPrecedingLineBreak() ? void 0 : allowInAnd(parseExpression); if (expression === void 0) { identifierCount++; @@ -32703,15 +32878,15 @@ ${lanes.join("\n")} function parseTryStatement() { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(111 /* TryKeyword */); + parseExpected(113 /* TryKeyword */); const tryBlock = parseBlock( /*ignoreMissingOpenBrace*/ false ); - const catchClause = token() === 83 /* CatchKeyword */ ? parseCatchClause() : void 0; + const catchClause = token() === 85 /* CatchKeyword */ ? parseCatchClause() : void 0; let finallyBlock; - if (!catchClause || token() === 96 /* FinallyKeyword */) { - parseExpected(96 /* FinallyKeyword */, Diagnostics.catch_or_finally_expected); + if (!catchClause || token() === 98 /* FinallyKeyword */) { + parseExpected(98 /* FinallyKeyword */, Diagnostics.catch_or_finally_expected); finallyBlock = parseBlock( /*ignoreMissingOpenBrace*/ false @@ -32721,11 +32896,11 @@ ${lanes.join("\n")} } function parseCatchClause() { const pos = getNodePos(); - parseExpected(83 /* CatchKeyword */); + parseExpected(85 /* CatchKeyword */); let variableDeclaration; - if (parseOptional(20 /* OpenParenToken */)) { + if (parseOptional(21 /* OpenParenToken */)) { variableDeclaration = parseVariableDeclaration(); - parseExpected(21 /* CloseParenToken */); + parseExpected(22 /* CloseParenToken */); } else { variableDeclaration = void 0; } @@ -32738,7 +32913,7 @@ ${lanes.join("\n")} function parseDebuggerStatement() { const pos = getNodePos(); const hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(87 /* DebuggerKeyword */); + parseExpected(89 /* DebuggerKeyword */); parseSemicolon(); return withJSDoc(finishNode(factory2.createDebuggerStatement(), pos), hasJSDoc); } @@ -32746,9 +32921,9 @@ ${lanes.join("\n")} const pos = getNodePos(); let hasJSDoc = hasPrecedingJSDocComment(); let node; - const hasParen = token() === 20 /* OpenParenToken */; + const hasParen = token() === 21 /* OpenParenToken */; const expression = allowInAnd(parseExpression); - if (isIdentifier(expression) && parseOptional(58 /* ColonToken */)) { + if (isIdentifier(expression) && parseOptional(59 /* ColonToken */)) { node = factory2.createLabeledStatement(expression, parseStatement()); } else { if (!tryParseSemicolon()) { @@ -32767,61 +32942,61 @@ ${lanes.join("\n")} } function nextTokenIsClassKeywordOnSameLine() { nextToken(); - return token() === 84 /* ClassKeyword */ && !scanner2.hasPrecedingLineBreak(); + return token() === 86 /* ClassKeyword */ && !scanner2.hasPrecedingLineBreak(); } function nextTokenIsFunctionKeywordOnSameLine() { nextToken(); - return token() === 98 /* FunctionKeyword */ && !scanner2.hasPrecedingLineBreak(); + return token() === 100 /* FunctionKeyword */ && !scanner2.hasPrecedingLineBreak(); } function nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine() { nextToken(); - return (tokenIsIdentifierOrKeyword(token()) || token() === 8 /* NumericLiteral */ || token() === 9 /* BigIntLiteral */ || token() === 10 /* StringLiteral */) && !scanner2.hasPrecedingLineBreak(); + return (tokenIsIdentifierOrKeyword(token()) || token() === 9 /* NumericLiteral */ || token() === 10 /* BigIntLiteral */ || token() === 11 /* StringLiteral */) && !scanner2.hasPrecedingLineBreak(); } function isDeclaration2() { while (true) { switch (token()) { - case 113 /* VarKeyword */: - case 119 /* LetKeyword */: - case 85 /* ConstKeyword */: - case 98 /* FunctionKeyword */: - case 84 /* ClassKeyword */: - case 92 /* EnumKeyword */: + case 115 /* VarKeyword */: + case 121 /* LetKeyword */: + case 87 /* ConstKeyword */: + case 100 /* FunctionKeyword */: + case 86 /* ClassKeyword */: + case 94 /* EnumKeyword */: return true; - case 118 /* InterfaceKeyword */: - case 154 /* TypeKeyword */: + case 120 /* InterfaceKeyword */: + case 156 /* TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 142 /* ModuleKeyword */: - case 143 /* NamespaceKeyword */: + case 144 /* ModuleKeyword */: + case 145 /* NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); - case 126 /* AbstractKeyword */: - case 127 /* AccessorKeyword */: - case 132 /* AsyncKeyword */: - case 136 /* DeclareKeyword */: - case 121 /* PrivateKeyword */: - case 122 /* ProtectedKeyword */: - case 123 /* PublicKeyword */: - case 146 /* ReadonlyKeyword */: + case 128 /* AbstractKeyword */: + case 129 /* AccessorKeyword */: + case 134 /* AsyncKeyword */: + case 138 /* DeclareKeyword */: + case 123 /* PrivateKeyword */: + case 124 /* ProtectedKeyword */: + case 125 /* PublicKeyword */: + case 148 /* ReadonlyKeyword */: nextToken(); if (scanner2.hasPrecedingLineBreak()) { return false; } continue; - case 159 /* GlobalKeyword */: + case 161 /* GlobalKeyword */: nextToken(); - return token() === 18 /* OpenBraceToken */ || token() === 79 /* Identifier */ || token() === 93 /* ExportKeyword */; - case 100 /* ImportKeyword */: + return token() === 19 /* OpenBraceToken */ || token() === 80 /* Identifier */ || token() === 95 /* ExportKeyword */; + case 102 /* ImportKeyword */: nextToken(); - return token() === 10 /* StringLiteral */ || token() === 41 /* AsteriskToken */ || token() === 18 /* OpenBraceToken */ || tokenIsIdentifierOrKeyword(token()); - case 93 /* ExportKeyword */: + return token() === 11 /* StringLiteral */ || token() === 42 /* AsteriskToken */ || token() === 19 /* OpenBraceToken */ || tokenIsIdentifierOrKeyword(token()); + case 95 /* ExportKeyword */: let currentToken2 = nextToken(); - if (currentToken2 === 154 /* TypeKeyword */) { + if (currentToken2 === 156 /* TypeKeyword */) { currentToken2 = lookAhead(nextToken); } - if (currentToken2 === 63 /* EqualsToken */ || currentToken2 === 41 /* AsteriskToken */ || currentToken2 === 18 /* OpenBraceToken */ || currentToken2 === 88 /* DefaultKeyword */ || currentToken2 === 128 /* AsKeyword */ || currentToken2 === 59 /* AtToken */) { + if (currentToken2 === 64 /* EqualsToken */ || currentToken2 === 42 /* AsteriskToken */ || currentToken2 === 19 /* OpenBraceToken */ || currentToken2 === 90 /* DefaultKeyword */ || currentToken2 === 130 /* AsKeyword */ || currentToken2 === 60 /* AtToken */) { return true; } continue; - case 124 /* StaticKeyword */: + case 126 /* StaticKeyword */: nextToken(); continue; default: @@ -32834,48 +33009,48 @@ ${lanes.join("\n")} } function isStartOfStatement() { switch (token()) { - case 59 /* AtToken */: - case 26 /* SemicolonToken */: - case 18 /* OpenBraceToken */: - case 113 /* VarKeyword */: - case 119 /* LetKeyword */: - case 98 /* FunctionKeyword */: - case 84 /* ClassKeyword */: - case 92 /* EnumKeyword */: - case 99 /* IfKeyword */: - case 90 /* DoKeyword */: - case 115 /* WhileKeyword */: - case 97 /* ForKeyword */: - case 86 /* ContinueKeyword */: - case 81 /* BreakKeyword */: - case 105 /* ReturnKeyword */: - case 116 /* WithKeyword */: - case 107 /* SwitchKeyword */: - case 109 /* ThrowKeyword */: - case 111 /* TryKeyword */: - case 87 /* DebuggerKeyword */: - case 83 /* CatchKeyword */: - case 96 /* FinallyKeyword */: + case 60 /* AtToken */: + case 27 /* SemicolonToken */: + case 19 /* OpenBraceToken */: + case 115 /* VarKeyword */: + case 121 /* LetKeyword */: + case 100 /* FunctionKeyword */: + case 86 /* ClassKeyword */: + case 94 /* EnumKeyword */: + case 101 /* IfKeyword */: + case 92 /* DoKeyword */: + case 117 /* WhileKeyword */: + case 99 /* ForKeyword */: + case 88 /* ContinueKeyword */: + case 83 /* BreakKeyword */: + case 107 /* ReturnKeyword */: + case 118 /* WithKeyword */: + case 109 /* SwitchKeyword */: + case 111 /* ThrowKeyword */: + case 113 /* TryKeyword */: + case 89 /* DebuggerKeyword */: + case 85 /* CatchKeyword */: + case 98 /* FinallyKeyword */: return true; - case 100 /* ImportKeyword */: + case 102 /* ImportKeyword */: return isStartOfDeclaration() || lookAhead(nextTokenIsOpenParenOrLessThanOrDot); - case 85 /* ConstKeyword */: - case 93 /* ExportKeyword */: + case 87 /* ConstKeyword */: + case 95 /* ExportKeyword */: return isStartOfDeclaration(); - case 132 /* AsyncKeyword */: - case 136 /* DeclareKeyword */: - case 118 /* InterfaceKeyword */: - case 142 /* ModuleKeyword */: - case 143 /* NamespaceKeyword */: - case 154 /* TypeKeyword */: - case 159 /* GlobalKeyword */: + case 134 /* AsyncKeyword */: + case 138 /* DeclareKeyword */: + case 120 /* InterfaceKeyword */: + case 144 /* ModuleKeyword */: + case 145 /* NamespaceKeyword */: + case 156 /* TypeKeyword */: + case 161 /* GlobalKeyword */: return true; - case 127 /* AccessorKeyword */: - case 123 /* PublicKeyword */: - case 121 /* PrivateKeyword */: - case 122 /* ProtectedKeyword */: - case 124 /* StaticKeyword */: - case 146 /* ReadonlyKeyword */: + case 129 /* AccessorKeyword */: + case 125 /* PublicKeyword */: + case 123 /* PrivateKeyword */: + case 124 /* ProtectedKeyword */: + case 126 /* StaticKeyword */: + case 148 /* ReadonlyKeyword */: return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); default: return isStartOfExpression(); @@ -32883,28 +33058,28 @@ ${lanes.join("\n")} } function nextTokenIsBindingIdentifierOrStartOfDestructuring() { nextToken(); - return isBindingIdentifier() || token() === 18 /* OpenBraceToken */ || token() === 22 /* OpenBracketToken */; + return isBindingIdentifier() || token() === 19 /* OpenBraceToken */ || token() === 23 /* OpenBracketToken */; } function isLetDeclaration() { return lookAhead(nextTokenIsBindingIdentifierOrStartOfDestructuring); } function parseStatement() { switch (token()) { - case 26 /* SemicolonToken */: + case 27 /* SemicolonToken */: return parseEmptyStatement(); - case 18 /* OpenBraceToken */: + case 19 /* OpenBraceToken */: return parseBlock( /*ignoreMissingOpenBrace*/ false ); - case 113 /* VarKeyword */: + case 115 /* VarKeyword */: return parseVariableStatement( getNodePos(), hasPrecedingJSDocComment(), /*modifiers*/ void 0 ); - case 119 /* LetKeyword */: + case 121 /* LetKeyword */: if (isLetDeclaration()) { return parseVariableStatement( getNodePos(), @@ -32914,66 +33089,66 @@ ${lanes.join("\n")} ); } break; - case 98 /* FunctionKeyword */: + case 100 /* FunctionKeyword */: return parseFunctionDeclaration( getNodePos(), hasPrecedingJSDocComment(), /*modifiers*/ void 0 ); - case 84 /* ClassKeyword */: + case 86 /* ClassKeyword */: return parseClassDeclaration( getNodePos(), hasPrecedingJSDocComment(), /*modifiers*/ void 0 ); - case 99 /* IfKeyword */: + case 101 /* IfKeyword */: return parseIfStatement(); - case 90 /* DoKeyword */: + case 92 /* DoKeyword */: return parseDoStatement(); - case 115 /* WhileKeyword */: + case 117 /* WhileKeyword */: return parseWhileStatement(); - case 97 /* ForKeyword */: + case 99 /* ForKeyword */: return parseForOrForInOrForOfStatement(); - case 86 /* ContinueKeyword */: - return parseBreakOrContinueStatement(248 /* ContinueStatement */); - case 81 /* BreakKeyword */: - return parseBreakOrContinueStatement(249 /* BreakStatement */); - case 105 /* ReturnKeyword */: + case 88 /* ContinueKeyword */: + return parseBreakOrContinueStatement(250 /* ContinueStatement */); + case 83 /* BreakKeyword */: + return parseBreakOrContinueStatement(251 /* BreakStatement */); + case 107 /* ReturnKeyword */: return parseReturnStatement(); - case 116 /* WithKeyword */: + case 118 /* WithKeyword */: return parseWithStatement(); - case 107 /* SwitchKeyword */: + case 109 /* SwitchKeyword */: return parseSwitchStatement(); - case 109 /* ThrowKeyword */: + case 111 /* ThrowKeyword */: return parseThrowStatement(); - case 111 /* TryKeyword */: - case 83 /* CatchKeyword */: - case 96 /* FinallyKeyword */: + case 113 /* TryKeyword */: + case 85 /* CatchKeyword */: + case 98 /* FinallyKeyword */: return parseTryStatement(); - case 87 /* DebuggerKeyword */: + case 89 /* DebuggerKeyword */: return parseDebuggerStatement(); - case 59 /* AtToken */: + case 60 /* AtToken */: return parseDeclaration(); - case 132 /* AsyncKeyword */: - case 118 /* InterfaceKeyword */: - case 154 /* TypeKeyword */: - case 142 /* ModuleKeyword */: - case 143 /* NamespaceKeyword */: - case 136 /* DeclareKeyword */: - case 85 /* ConstKeyword */: - case 92 /* EnumKeyword */: - case 93 /* ExportKeyword */: - case 100 /* ImportKeyword */: - case 121 /* PrivateKeyword */: - case 122 /* ProtectedKeyword */: - case 123 /* PublicKeyword */: - case 126 /* AbstractKeyword */: - case 127 /* AccessorKeyword */: - case 124 /* StaticKeyword */: - case 146 /* ReadonlyKeyword */: - case 159 /* GlobalKeyword */: + case 134 /* AsyncKeyword */: + case 120 /* InterfaceKeyword */: + case 156 /* TypeKeyword */: + case 144 /* ModuleKeyword */: + case 145 /* NamespaceKeyword */: + case 138 /* DeclareKeyword */: + case 87 /* ConstKeyword */: + case 94 /* EnumKeyword */: + case 95 /* ExportKeyword */: + case 102 /* ImportKeyword */: + case 123 /* PrivateKeyword */: + case 124 /* ProtectedKeyword */: + case 125 /* PublicKeyword */: + case 128 /* AbstractKeyword */: + case 129 /* AccessorKeyword */: + case 126 /* StaticKeyword */: + case 148 /* ReadonlyKeyword */: + case 161 /* GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -32982,7 +33157,7 @@ ${lanes.join("\n")} return parseExpressionOrLabeledStatement(); } function isDeclareModifier(modifier) { - return modifier.kind === 136 /* DeclareKeyword */; + return modifier.kind === 138 /* DeclareKeyword */; } function parseDeclaration() { const pos = getNodePos(); @@ -33015,33 +33190,33 @@ ${lanes.join("\n")} } function parseDeclarationWorker(pos, hasJSDoc, modifiersIn) { switch (token()) { - case 113 /* VarKeyword */: - case 119 /* LetKeyword */: - case 85 /* ConstKeyword */: + case 115 /* VarKeyword */: + case 121 /* LetKeyword */: + case 87 /* ConstKeyword */: return parseVariableStatement(pos, hasJSDoc, modifiersIn); - case 98 /* FunctionKeyword */: + case 100 /* FunctionKeyword */: return parseFunctionDeclaration(pos, hasJSDoc, modifiersIn); - case 84 /* ClassKeyword */: + case 86 /* ClassKeyword */: return parseClassDeclaration(pos, hasJSDoc, modifiersIn); - case 118 /* InterfaceKeyword */: + case 120 /* InterfaceKeyword */: return parseInterfaceDeclaration(pos, hasJSDoc, modifiersIn); - case 154 /* TypeKeyword */: + case 156 /* TypeKeyword */: return parseTypeAliasDeclaration(pos, hasJSDoc, modifiersIn); - case 92 /* EnumKeyword */: + case 94 /* EnumKeyword */: return parseEnumDeclaration(pos, hasJSDoc, modifiersIn); - case 159 /* GlobalKeyword */: - case 142 /* ModuleKeyword */: - case 143 /* NamespaceKeyword */: + case 161 /* GlobalKeyword */: + case 144 /* ModuleKeyword */: + case 145 /* NamespaceKeyword */: return parseModuleDeclaration(pos, hasJSDoc, modifiersIn); - case 100 /* ImportKeyword */: + case 102 /* ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, modifiersIn); - case 93 /* ExportKeyword */: + case 95 /* ExportKeyword */: nextToken(); switch (token()) { - case 88 /* DefaultKeyword */: - case 63 /* EqualsToken */: + case 90 /* DefaultKeyword */: + case 64 /* EqualsToken */: return parseExportAssignment(pos, hasJSDoc, modifiersIn); - case 128 /* AsKeyword */: + case 130 /* AsKeyword */: return parseNamespaceExportDeclaration(pos, hasJSDoc, modifiersIn); default: return parseExportDeclaration(pos, hasJSDoc, modifiersIn); @@ -33049,7 +33224,7 @@ ${lanes.join("\n")} default: if (modifiersIn) { const missing = createMissingNode( - 279 /* MissingDeclaration */, + 281 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected @@ -33063,10 +33238,10 @@ ${lanes.join("\n")} } function nextTokenIsIdentifierOrStringLiteralOnSameLine() { nextToken(); - return !scanner2.hasPrecedingLineBreak() && (isIdentifier2() || token() === 10 /* StringLiteral */); + return !scanner2.hasPrecedingLineBreak() && (isIdentifier2() || token() === 11 /* StringLiteral */); } function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) { - if (token() !== 18 /* OpenBraceToken */) { + if (token() !== 19 /* OpenBraceToken */) { if (flags & 4 /* Type */) { parseTypeMemberSemicolon(); return; @@ -33080,10 +33255,10 @@ ${lanes.join("\n")} } function parseArrayBindingElement() { const pos = getNodePos(); - if (token() === 27 /* CommaToken */) { + if (token() === 28 /* CommaToken */) { return finishNode(factory2.createOmittedExpression(), pos); } - const dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */); + const dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */); const name = parseIdentifierOrPattern(); const initializer = parseInitializer(); return finishNode(factory2.createBindingElement( @@ -33096,15 +33271,15 @@ ${lanes.join("\n")} } function parseObjectBindingElement() { const pos = getNodePos(); - const dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */); + const dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */); const tokenIsIdentifier = isBindingIdentifier(); let propertyName = parsePropertyName(); let name; - if (tokenIsIdentifier && token() !== 58 /* ColonToken */) { + if (tokenIsIdentifier && token() !== 59 /* ColonToken */) { name = propertyName; propertyName = void 0; } else { - parseExpected(58 /* ColonToken */); + parseExpected(59 /* ColonToken */); name = parseIdentifierOrPattern(); } const initializer = parseInitializer(); @@ -33112,26 +33287,26 @@ ${lanes.join("\n")} } function parseObjectBindingPattern() { const pos = getNodePos(); - parseExpected(18 /* OpenBraceToken */); + parseExpected(19 /* OpenBraceToken */); const elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement); - parseExpected(19 /* CloseBraceToken */); + parseExpected(20 /* CloseBraceToken */); return finishNode(factory2.createObjectBindingPattern(elements), pos); } function parseArrayBindingPattern() { const pos = getNodePos(); - parseExpected(22 /* OpenBracketToken */); + parseExpected(23 /* OpenBracketToken */); const elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement); - parseExpected(23 /* CloseBracketToken */); + parseExpected(24 /* CloseBracketToken */); return finishNode(factory2.createArrayBindingPattern(elements), pos); } function isBindingIdentifierOrPrivateIdentifierOrPattern() { - return token() === 18 /* OpenBraceToken */ || token() === 22 /* OpenBracketToken */ || token() === 80 /* PrivateIdentifier */ || isBindingIdentifier(); + return token() === 19 /* OpenBraceToken */ || token() === 23 /* OpenBracketToken */ || token() === 81 /* PrivateIdentifier */ || isBindingIdentifier(); } function parseIdentifierOrPattern(privateIdentifierDiagnosticMessage) { - if (token() === 22 /* OpenBracketToken */) { + if (token() === 23 /* OpenBracketToken */) { return parseArrayBindingPattern(); } - if (token() === 18 /* OpenBraceToken */) { + if (token() === 19 /* OpenBraceToken */) { return parseObjectBindingPattern(); } return parseBindingIdentifier(privateIdentifierDiagnosticMessage); @@ -33147,7 +33322,7 @@ ${lanes.join("\n")} const hasJSDoc = hasPrecedingJSDocComment(); const name = parseIdentifierOrPattern(Diagnostics.Private_identifiers_are_not_allowed_in_variable_declarations); let exclamationToken; - if (allowExclamation && name.kind === 79 /* Identifier */ && token() === 53 /* ExclamationToken */ && !scanner2.hasPrecedingLineBreak()) { + if (allowExclamation && name.kind === 80 /* Identifier */ && token() === 54 /* ExclamationToken */ && !scanner2.hasPrecedingLineBreak()) { exclamationToken = parseTokenNode(); } const type = parseTypeAnnotation(); @@ -33159,12 +33334,12 @@ ${lanes.join("\n")} const pos = getNodePos(); let flags = 0; switch (token()) { - case 113 /* VarKeyword */: + case 115 /* VarKeyword */: break; - case 119 /* LetKeyword */: + case 121 /* LetKeyword */: flags |= 1 /* Let */; break; - case 85 /* ConstKeyword */: + case 87 /* ConstKeyword */: flags |= 2 /* Const */; break; default: @@ -33172,7 +33347,7 @@ ${lanes.join("\n")} } nextToken(); let declarations; - if (token() === 162 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 164 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { declarations = createMissingList(); } else { const savedDisallowIn = inDisallowInContext(); @@ -33186,7 +33361,7 @@ ${lanes.join("\n")} return finishNode(factoryCreateVariableDeclarationList(declarations, flags), pos); } function canFollowContextualOfKeyword() { - return nextTokenIsIdentifier() && nextToken() === 21 /* CloseParenToken */; + return nextTokenIsIdentifier() && nextToken() === 22 /* CloseParenToken */; } function parseVariableStatement(pos, hasJSDoc, modifiers) { const declarationList = parseVariableDeclarationList( @@ -33200,8 +33375,8 @@ ${lanes.join("\n")} function parseFunctionDeclaration(pos, hasJSDoc, modifiers) { const savedAwaitContext = inAwaitContext(); const modifierFlags = modifiersToFlags(modifiers); - parseExpected(98 /* FunctionKeyword */); - const asteriskToken = parseOptionalToken(41 /* AsteriskToken */); + parseExpected(100 /* FunctionKeyword */); + const asteriskToken = parseOptionalToken(42 /* AsteriskToken */); const name = modifierFlags & 1024 /* Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); const isGenerator = asteriskToken ? 1 /* Yield */ : 0 /* None */; const isAsync = modifierFlags & 512 /* Async */ ? 2 /* Await */ : 0 /* None */; @@ -33213,7 +33388,7 @@ ${lanes.join("\n")} ); const parameters = parseParameters(isGenerator | isAsync); const type = parseReturnType( - 58 /* ColonToken */, + 59 /* ColonToken */, /*isType*/ false ); @@ -33223,10 +33398,10 @@ ${lanes.join("\n")} return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { - if (token() === 135 /* ConstructorKeyword */) { - return parseExpected(135 /* ConstructorKeyword */); + if (token() === 137 /* ConstructorKeyword */) { + return parseExpected(137 /* ConstructorKeyword */); } - if (token() === 10 /* StringLiteral */ && lookAhead(nextToken) === 20 /* OpenParenToken */) { + if (token() === 11 /* StringLiteral */ && lookAhead(nextToken) === 21 /* OpenParenToken */) { return tryParse(() => { const literalNode = parseLiteralNode(); return literalNode.text === "constructor" ? literalNode : void 0; @@ -33239,7 +33414,7 @@ ${lanes.join("\n")} const typeParameters = parseTypeParameters(); const parameters = parseParameters(0 /* None */); const type = parseReturnType( - 58 /* ColonToken */, + 59 /* ColonToken */, /*isType*/ false ); @@ -33257,7 +33432,7 @@ ${lanes.join("\n")} const typeParameters = parseTypeParameters(); const parameters = parseParameters(isGenerator | isAsync); const type = parseReturnType( - 58 /* ColonToken */, + 59 /* ColonToken */, /*isType*/ false ); @@ -33276,7 +33451,7 @@ ${lanes.join("\n")} return withJSDoc(finishNode(node, pos), hasJSDoc); } function parsePropertyDeclaration(pos, hasJSDoc, modifiers, name, questionToken) { - const exclamationToken = !questionToken && !scanner2.hasPrecedingLineBreak() ? parseOptionalToken(53 /* ExclamationToken */) : void 0; + const exclamationToken = !questionToken && !scanner2.hasPrecedingLineBreak() ? parseOptionalToken(54 /* ExclamationToken */) : void 0; const type = parseTypeAnnotation(); const initializer = doOutsideOfContext(8192 /* YieldContext */ | 32768 /* AwaitContext */ | 4096 /* DisallowInContext */, parseInitializer); parseSemicolonAfterPropertyName(name, type, initializer); @@ -33290,10 +33465,10 @@ ${lanes.join("\n")} return withJSDoc(finishNode(node, pos), hasJSDoc); } function parsePropertyOrMethodDeclaration(pos, hasJSDoc, modifiers) { - const asteriskToken = parseOptionalToken(41 /* AsteriskToken */); + const asteriskToken = parseOptionalToken(42 /* AsteriskToken */); const name = parsePropertyName(); - const questionToken = parseOptionalToken(57 /* QuestionToken */); - if (asteriskToken || token() === 20 /* OpenParenToken */ || token() === 29 /* LessThanToken */) { + const questionToken = parseOptionalToken(58 /* QuestionToken */); + if (asteriskToken || token() === 21 /* OpenParenToken */ || token() === 30 /* LessThanToken */) { return parseMethodDeclaration( pos, hasJSDoc, @@ -33313,12 +33488,12 @@ ${lanes.join("\n")} const typeParameters = parseTypeParameters(); const parameters = parseParameters(0 /* None */); const type = parseReturnType( - 58 /* ColonToken */, + 59 /* ColonToken */, /*isType*/ false ); const body = parseFunctionBlockOrSemicolon(flags); - const node = kind === 174 /* GetAccessor */ ? factory2.createGetAccessorDeclaration(modifiers, name, parameters, type, body) : factory2.createSetAccessorDeclaration(modifiers, name, parameters, body); + const node = kind === 176 /* GetAccessor */ ? factory2.createGetAccessorDeclaration(modifiers, name, parameters, type, body) : factory2.createSetAccessorDeclaration(modifiers, name, parameters, body); node.typeParameters = typeParameters; if (isSetAccessorDeclaration(node)) node.type = type; @@ -33326,7 +33501,7 @@ ${lanes.join("\n")} } function isClassMemberStart() { let idToken; - if (token() === 59 /* AtToken */) { + if (token() === 60 /* AtToken */) { return true; } while (isModifierKind(token())) { @@ -33336,27 +33511,27 @@ ${lanes.join("\n")} } nextToken(); } - if (token() === 41 /* AsteriskToken */) { + if (token() === 42 /* AsteriskToken */) { return true; } if (isLiteralPropertyName()) { idToken = token(); nextToken(); } - if (token() === 22 /* OpenBracketToken */) { + if (token() === 23 /* OpenBracketToken */) { return true; } if (idToken !== void 0) { - if (!isKeyword(idToken) || idToken === 151 /* SetKeyword */ || idToken === 137 /* GetKeyword */) { + if (!isKeyword(idToken) || idToken === 153 /* SetKeyword */ || idToken === 139 /* GetKeyword */) { return true; } switch (token()) { - case 20 /* OpenParenToken */: - case 29 /* LessThanToken */: - case 53 /* ExclamationToken */: - case 58 /* ColonToken */: - case 63 /* EqualsToken */: - case 57 /* QuestionToken */: + case 21 /* OpenParenToken */: + case 30 /* LessThanToken */: + case 54 /* ExclamationToken */: + case 59 /* ColonToken */: + case 64 /* EqualsToken */: + case 58 /* QuestionToken */: return true; default: return canParseSemicolon(); @@ -33365,7 +33540,7 @@ ${lanes.join("\n")} return false; } function parseClassStaticBlockDeclaration(pos, hasJSDoc, modifiers) { - parseExpectedToken(124 /* StaticKeyword */); + parseExpectedToken(126 /* StaticKeyword */); const body = parseClassStaticBlockBody(); const node = withJSDoc(finishNode(factory2.createClassStaticBlockDeclaration(body), pos), hasJSDoc); node.modifiers = modifiers; @@ -33385,7 +33560,7 @@ ${lanes.join("\n")} return body; } function parseDecoratorExpression() { - if (inAwaitContext() && token() === 133 /* AwaitKeyword */) { + if (inAwaitContext() && token() === 135 /* AwaitKeyword */) { const pos = getNodePos(); const awaitExpression = parseIdentifier(Diagnostics.Expression_expected); nextToken(); @@ -33401,7 +33576,7 @@ ${lanes.join("\n")} } function tryParseDecorator() { const pos = getNodePos(); - if (!parseOptional(59 /* AtToken */)) { + if (!parseOptional(60 /* AtToken */)) { return void 0; } const expression = doInDecoratorContext(parseDecoratorExpression); @@ -33410,13 +33585,13 @@ ${lanes.join("\n")} function tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock) { const pos = getNodePos(); const kind = token(); - if (token() === 85 /* ConstKeyword */ && permitConstAsModifier) { + if (token() === 87 /* ConstKeyword */ && permitConstAsModifier) { if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) { return void 0; } - } else if (stopOnStartOfClassStaticBlock && token() === 124 /* StaticKeyword */ && lookAhead(nextTokenIsOpenBrace)) { + } else if (stopOnStartOfClassStaticBlock && token() === 126 /* StaticKeyword */ && lookAhead(nextTokenIsOpenBrace)) { return void 0; - } else if (hasSeenStaticModifier && token() === 124 /* StaticKeyword */) { + } else if (hasSeenStaticModifier && token() === 126 /* StaticKeyword */) { return void 0; } else { if (!parseAnyContextualModifier()) { @@ -33429,18 +33604,18 @@ ${lanes.join("\n")} const pos = getNodePos(); let list; let decorator, modifier, hasSeenStaticModifier = false, hasLeadingModifier = false, hasTrailingDecorator = false; - if (allowDecorators && token() === 59 /* AtToken */) { + if (allowDecorators && token() === 60 /* AtToken */) { while (decorator = tryParseDecorator()) { list = append(list, decorator); } } while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) { - if (modifier.kind === 124 /* StaticKeyword */) + if (modifier.kind === 126 /* StaticKeyword */) hasSeenStaticModifier = true; list = append(list, modifier); hasLeadingModifier = true; } - if (hasLeadingModifier && allowDecorators && token() === 59 /* AtToken */) { + if (hasLeadingModifier && allowDecorators && token() === 60 /* AtToken */) { while (decorator = tryParseDecorator()) { list = append(list, decorator); hasTrailingDecorator = true; @@ -33448,7 +33623,7 @@ ${lanes.join("\n")} } if (hasTrailingDecorator) { while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) { - if (modifier.kind === 124 /* StaticKeyword */) + if (modifier.kind === 126 /* StaticKeyword */) hasSeenStaticModifier = true; list = append(list, modifier); } @@ -33457,21 +33632,21 @@ ${lanes.join("\n")} } function parseModifiersForArrowFunction() { let modifiers; - if (token() === 132 /* AsyncKeyword */) { + if (token() === 134 /* AsyncKeyword */) { const pos = getNodePos(); nextToken(); - const modifier = finishNode(factoryCreateToken(132 /* AsyncKeyword */), pos); + const modifier = finishNode(factoryCreateToken(134 /* AsyncKeyword */), pos); modifiers = createNodeArray([modifier], pos); } return modifiers; } function parseClassElement() { const pos = getNodePos(); - if (token() === 26 /* SemicolonToken */) { - nextToken(); - return finishNode(factory2.createSemicolonClassElement(), pos); - } const hasJSDoc = hasPrecedingJSDocComment(); + if (token() === 27 /* SemicolonToken */) { + nextToken(); + return withJSDoc(finishNode(factory2.createSemicolonClassElement(), pos), hasJSDoc); + } const modifiers = parseModifiers( /*allowDecorators*/ true, @@ -33480,16 +33655,16 @@ ${lanes.join("\n")} /*stopOnStartOfClassStaticBlock*/ true ); - if (token() === 124 /* StaticKeyword */ && lookAhead(nextTokenIsOpenBrace)) { + if (token() === 126 /* StaticKeyword */ && lookAhead(nextTokenIsOpenBrace)) { return parseClassStaticBlockDeclaration(pos, hasJSDoc, modifiers); } - if (parseContextualModifier(137 /* GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 174 /* GetAccessor */, 0 /* None */); + if (parseContextualModifier(139 /* GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 176 /* GetAccessor */, 0 /* None */); } - if (parseContextualModifier(151 /* SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 175 /* SetAccessor */, 0 /* None */); + if (parseContextualModifier(153 /* SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, modifiers, 177 /* SetAccessor */, 0 /* None */); } - if (token() === 135 /* ConstructorKeyword */ || token() === 10 /* StringLiteral */) { + if (token() === 137 /* ConstructorKeyword */ || token() === 11 /* StringLiteral */) { const constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, modifiers); if (constructorDeclaration) { return constructorDeclaration; @@ -33498,7 +33673,7 @@ ${lanes.join("\n")} if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, modifiers); } - if (tokenIsIdentifierOrKeyword(token()) || token() === 10 /* StringLiteral */ || token() === 8 /* NumericLiteral */ || token() === 41 /* AsteriskToken */ || token() === 22 /* OpenBracketToken */) { + if (tokenIsIdentifierOrKeyword(token()) || token() === 11 /* StringLiteral */ || token() === 9 /* NumericLiteral */ || token() === 42 /* AsteriskToken */ || token() === 23 /* OpenBracketToken */) { const isAmbient = some(modifiers, isDeclareModifier); if (isAmbient) { for (const m of modifiers) { @@ -33511,7 +33686,7 @@ ${lanes.join("\n")} } if (modifiers) { const name = createMissingNode( - 79 /* Identifier */, + 80 /* Identifier */, /*reportAtCurrentPosition*/ true, Diagnostics.Declaration_expected @@ -33534,11 +33709,11 @@ ${lanes.join("\n")} /*allowDecorators*/ true ); - if (token() === 84 /* ClassKeyword */) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, modifiers, 228 /* ClassExpression */); + if (token() === 86 /* ClassKeyword */) { + return parseClassDeclarationOrExpression(pos, hasJSDoc, modifiers, 230 /* ClassExpression */); } const missing = createMissingNode( - 279 /* MissingDeclaration */, + 281 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, Diagnostics.Expression_expected @@ -33553,15 +33728,15 @@ ${lanes.join("\n")} hasPrecedingJSDocComment(), /*modifiers*/ void 0, - 228 /* ClassExpression */ + 230 /* ClassExpression */ ); } function parseClassDeclaration(pos, hasJSDoc, modifiers) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, modifiers, 260 /* ClassDeclaration */); + return parseClassDeclarationOrExpression(pos, hasJSDoc, modifiers, 262 /* ClassDeclaration */); } function parseClassDeclarationOrExpression(pos, hasJSDoc, modifiers, kind) { const savedAwaitContext = inAwaitContext(); - parseExpected(84 /* ClassKeyword */); + parseExpected(86 /* ClassKeyword */); const name = parseNameOfClassDeclarationOrExpression(); const typeParameters = parseTypeParameters(); if (some(modifiers, isExportModifier)) @@ -33571,21 +33746,21 @@ ${lanes.join("\n")} ); const heritageClauses = parseHeritageClauses(); let members; - if (parseExpected(18 /* OpenBraceToken */)) { + if (parseExpected(19 /* OpenBraceToken */)) { members = parseClassMembers(); - parseExpected(19 /* CloseBraceToken */); + parseExpected(20 /* CloseBraceToken */); } else { members = createMissingList(); } setAwaitContext(savedAwaitContext); - const node = kind === 260 /* ClassDeclaration */ ? factory2.createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) : factory2.createClassExpression(modifiers, name, typeParameters, heritageClauses, members); + const node = kind === 262 /* ClassDeclaration */ ? factory2.createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) : factory2.createClassExpression(modifiers, name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseNameOfClassDeclarationOrExpression() { return isBindingIdentifier() && !isImplementsClause() ? createIdentifier(isBindingIdentifier()) : void 0; } function isImplementsClause() { - return token() === 117 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword); + return token() === 119 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword); } function parseHeritageClauses() { if (isHeritageClause2()) { @@ -33596,7 +33771,7 @@ ${lanes.join("\n")} function parseHeritageClause() { const pos = getNodePos(); const tok = token(); - Debug.assert(tok === 94 /* ExtendsKeyword */ || tok === 117 /* ImplementsKeyword */); + Debug.assert(tok === 96 /* ExtendsKeyword */ || tok === 119 /* ImplementsKeyword */); nextToken(); const types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments); return finishNode(factory2.createHeritageClause(tok, types), pos); @@ -33604,23 +33779,23 @@ ${lanes.join("\n")} function parseExpressionWithTypeArguments() { const pos = getNodePos(); const expression = parseLeftHandSideExpressionOrHigher(); - if (expression.kind === 230 /* ExpressionWithTypeArguments */) { + if (expression.kind === 232 /* ExpressionWithTypeArguments */) { return expression; } const typeArguments = tryParseTypeArguments(); return finishNode(factory2.createExpressionWithTypeArguments(expression, typeArguments), pos); } function tryParseTypeArguments() { - return token() === 29 /* LessThanToken */ ? parseBracketedList(20 /* TypeArguments */, parseType, 29 /* LessThanToken */, 31 /* GreaterThanToken */) : void 0; + return token() === 30 /* LessThanToken */ ? parseBracketedList(20 /* TypeArguments */, parseType, 30 /* LessThanToken */, 32 /* GreaterThanToken */) : void 0; } function isHeritageClause2() { - return token() === 94 /* ExtendsKeyword */ || token() === 117 /* ImplementsKeyword */; + return token() === 96 /* ExtendsKeyword */ || token() === 119 /* ImplementsKeyword */; } function parseClassMembers() { return parseList(5 /* ClassMembers */, parseClassElement); } function parseInterfaceDeclaration(pos, hasJSDoc, modifiers) { - parseExpected(118 /* InterfaceKeyword */); + parseExpected(120 /* InterfaceKeyword */); const name = parseIdentifier(); const typeParameters = parseTypeParameters(); const heritageClauses = parseHeritageClauses(); @@ -33629,11 +33804,11 @@ ${lanes.join("\n")} return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, modifiers) { - parseExpected(154 /* TypeKeyword */); + parseExpected(156 /* TypeKeyword */); const name = parseIdentifier(); const typeParameters = parseTypeParameters(); - parseExpected(63 /* EqualsToken */); - const type = token() === 139 /* IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); + parseExpected(64 /* EqualsToken */); + const type = token() === 141 /* IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); const node = factory2.createTypeAliasDeclaration(modifiers, name, typeParameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -33646,12 +33821,12 @@ ${lanes.join("\n")} return withJSDoc(finishNode(factory2.createEnumMember(name, initializer), pos), hasJSDoc); } function parseEnumDeclaration(pos, hasJSDoc, modifiers) { - parseExpected(92 /* EnumKeyword */); + parseExpected(94 /* EnumKeyword */); const name = parseIdentifier(); let members; - if (parseExpected(18 /* OpenBraceToken */)) { + if (parseExpected(19 /* OpenBraceToken */)) { members = doOutsideOfYieldAndAwaitContext(() => parseDelimitedList(6 /* EnumMembers */, parseEnumMember)); - parseExpected(19 /* CloseBraceToken */); + parseExpected(20 /* CloseBraceToken */); } else { members = createMissingList(); } @@ -33661,9 +33836,9 @@ ${lanes.join("\n")} function parseModuleBlock() { const pos = getNodePos(); let statements; - if (parseExpected(18 /* OpenBraceToken */)) { + if (parseExpected(19 /* OpenBraceToken */)) { statements = parseList(1 /* BlockStatements */, parseStatement); - parseExpected(19 /* CloseBraceToken */); + parseExpected(20 /* CloseBraceToken */); } else { statements = createMissingList(); } @@ -33672,7 +33847,7 @@ ${lanes.join("\n")} function parseModuleOrNamespaceDeclaration(pos, hasJSDoc, modifiers, flags) { const namespaceFlag = flags & 16 /* Namespace */; const name = parseIdentifier(); - const body = parseOptional(24 /* DotToken */) ? parseModuleOrNamespaceDeclaration( + const body = parseOptional(25 /* DotToken */) ? parseModuleOrNamespaceDeclaration( getNodePos(), /*hasJSDoc*/ false, @@ -33686,7 +33861,7 @@ ${lanes.join("\n")} function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, modifiersIn) { let flags = 0; let name; - if (token() === 159 /* GlobalKeyword */) { + if (token() === 161 /* GlobalKeyword */) { name = parseIdentifier(); flags |= 1024 /* GlobalAugmentation */; } else { @@ -33694,7 +33869,7 @@ ${lanes.join("\n")} name.text = internIdentifier(name.text); } let body; - if (token() === 18 /* OpenBraceToken */) { + if (token() === 19 /* OpenBraceToken */) { body = parseModuleBlock(); } else { parseSemicolon(); @@ -33704,33 +33879,33 @@ ${lanes.join("\n")} } function parseModuleDeclaration(pos, hasJSDoc, modifiersIn) { let flags = 0; - if (token() === 159 /* GlobalKeyword */) { + if (token() === 161 /* GlobalKeyword */) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, modifiersIn); - } else if (parseOptional(143 /* NamespaceKeyword */)) { + } else if (parseOptional(145 /* NamespaceKeyword */)) { flags |= 16 /* Namespace */; } else { - parseExpected(142 /* ModuleKeyword */); - if (token() === 10 /* StringLiteral */) { + parseExpected(144 /* ModuleKeyword */); + if (token() === 11 /* StringLiteral */) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, modifiersIn); } } return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, modifiersIn, flags); } function isExternalModuleReference2() { - return token() === 147 /* RequireKeyword */ && lookAhead(nextTokenIsOpenParen); + return token() === 149 /* RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { - return nextToken() === 20 /* OpenParenToken */; + return nextToken() === 21 /* OpenParenToken */; } function nextTokenIsOpenBrace() { - return nextToken() === 18 /* OpenBraceToken */; + return nextToken() === 19 /* OpenBraceToken */; } function nextTokenIsSlash() { - return nextToken() === 43 /* SlashToken */; + return nextToken() === 44 /* SlashToken */; } function parseNamespaceExportDeclaration(pos, hasJSDoc, modifiers) { - parseExpected(128 /* AsKeyword */); - parseExpected(143 /* NamespaceKeyword */); + parseExpected(130 /* AsKeyword */); + parseExpected(145 /* NamespaceKeyword */); const name = parseIdentifier(); parseSemicolon(); const node = factory2.createNamespaceExportDeclaration(name); @@ -33738,14 +33913,14 @@ ${lanes.join("\n")} return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, modifiers) { - parseExpected(100 /* ImportKeyword */); - const afterImportPos = scanner2.getStartPos(); + parseExpected(102 /* ImportKeyword */); + const afterImportPos = scanner2.getTokenFullStart(); let identifier; if (isIdentifier2()) { identifier = parseIdentifier(); } let isTypeOnly = false; - if (token() !== 158 /* FromKeyword */ && (identifier == null ? void 0 : identifier.escapedText) === "type" && (isIdentifier2() || tokenAfterImportDefinitelyProducesImportDeclaration())) { + if (token() !== 160 /* FromKeyword */ && (identifier == null ? void 0 : identifier.escapedText) === "type" && (isIdentifier2() || tokenAfterImportDefinitelyProducesImportDeclaration())) { isTypeOnly = true; identifier = isIdentifier2() ? parseIdentifier() : void 0; } @@ -33754,14 +33929,14 @@ ${lanes.join("\n")} } let importClause; if (identifier || // import id - token() === 41 /* AsteriskToken */ || // import * - token() === 18 /* OpenBraceToken */) { + token() === 42 /* AsteriskToken */ || // import * + token() === 19 /* OpenBraceToken */) { importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); - parseExpected(158 /* FromKeyword */); + parseExpected(160 /* FromKeyword */); } const moduleSpecifier = parseModuleSpecifier(); let assertClause; - if (token() === 130 /* AssertKeyword */ && !scanner2.hasPrecedingLineBreak()) { + if (token() === 132 /* AssertKeyword */ && !scanner2.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -33770,8 +33945,8 @@ ${lanes.join("\n")} } function parseAssertEntry() { const pos = getNodePos(); - const name = tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */); - parseExpected(58 /* ColonToken */); + const name = tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(11 /* StringLiteral */); + parseExpected(59 /* ColonToken */); const value = parseAssignmentExpressionOrHigher( /*allowReturnTypeInArrowFunction*/ true @@ -33781,10 +33956,10 @@ ${lanes.join("\n")} function parseAssertClause(skipAssertKeyword) { const pos = getNodePos(); if (!skipAssertKeyword) { - parseExpected(130 /* AssertKeyword */); + parseExpected(132 /* AssertKeyword */); } - const openBracePosition = scanner2.getTokenPos(); - if (parseExpected(18 /* OpenBraceToken */)) { + const openBracePosition = scanner2.getTokenStart(); + if (parseExpected(19 /* OpenBraceToken */)) { const multiLine = scanner2.hasPrecedingLineBreak(); const elements = parseDelimitedList( 24 /* AssertEntries */, @@ -33792,7 +33967,7 @@ ${lanes.join("\n")} /*considerSemicolonAsDelimiter*/ true ); - if (!parseExpected(19 /* CloseBraceToken */)) { + if (!parseExpected(20 /* CloseBraceToken */)) { const lastError = lastOrUndefined(parseDiagnostics); if (lastError && lastError.code === Diagnostics._0_expected.code) { addRelatedInfo( @@ -33819,13 +33994,13 @@ ${lanes.join("\n")} } } function tokenAfterImportDefinitelyProducesImportDeclaration() { - return token() === 41 /* AsteriskToken */ || token() === 18 /* OpenBraceToken */; + return token() === 42 /* AsteriskToken */ || token() === 19 /* OpenBraceToken */; } function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { - return token() === 27 /* CommaToken */ || token() === 158 /* FromKeyword */; + return token() === 28 /* CommaToken */ || token() === 160 /* FromKeyword */; } function parseImportEqualsDeclaration(pos, hasJSDoc, modifiers, identifier, isTypeOnly) { - parseExpected(63 /* EqualsToken */); + parseExpected(64 /* EqualsToken */); const moduleReference = parseModuleReference(); parseSemicolon(); const node = factory2.createImportEqualsDeclaration(modifiers, isTypeOnly, identifier, moduleReference); @@ -33834,8 +34009,8 @@ ${lanes.join("\n")} } function parseImportClause(identifier, pos, isTypeOnly) { let namedBindings; - if (!identifier || parseOptional(27 /* CommaToken */)) { - namedBindings = token() === 41 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(272 /* NamedImports */); + if (!identifier || parseOptional(28 /* CommaToken */)) { + namedBindings = token() === 42 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(274 /* NamedImports */); } return finishNode(factory2.createImportClause(isTypeOnly, identifier, namedBindings), pos); } @@ -33847,14 +34022,14 @@ ${lanes.join("\n")} } function parseExternalModuleReference() { const pos = getNodePos(); - parseExpected(147 /* RequireKeyword */); - parseExpected(20 /* OpenParenToken */); + parseExpected(149 /* RequireKeyword */); + parseExpected(21 /* OpenParenToken */); const expression = parseModuleSpecifier(); - parseExpected(21 /* CloseParenToken */); + parseExpected(22 /* CloseParenToken */); return finishNode(factory2.createExternalModuleReference(expression), pos); } function parseModuleSpecifier() { - if (token() === 10 /* StringLiteral */) { + if (token() === 11 /* StringLiteral */) { const result = parseLiteralNode(); result.text = internIdentifier(result.text); return result; @@ -33864,36 +34039,36 @@ ${lanes.join("\n")} } function parseNamespaceImport() { const pos = getNodePos(); - parseExpected(41 /* AsteriskToken */); - parseExpected(128 /* AsKeyword */); + parseExpected(42 /* AsteriskToken */); + parseExpected(130 /* AsKeyword */); const name = parseIdentifier(); return finishNode(factory2.createNamespaceImport(name), pos); } function parseNamedImportsOrExports(kind) { const pos = getNodePos(); - const node = kind === 272 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */)); + const node = kind === 274 /* NamedImports */ ? factory2.createNamedImports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseImportSpecifier, 19 /* OpenBraceToken */, 20 /* CloseBraceToken */)) : factory2.createNamedExports(parseBracketedList(23 /* ImportOrExportSpecifiers */, parseExportSpecifier, 19 /* OpenBraceToken */, 20 /* CloseBraceToken */)); return finishNode(node, pos); } function parseExportSpecifier() { const hasJSDoc = hasPrecedingJSDocComment(); - return withJSDoc(parseImportOrExportSpecifier(278 /* ExportSpecifier */), hasJSDoc); + return withJSDoc(parseImportOrExportSpecifier(280 /* ExportSpecifier */), hasJSDoc); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(273 /* ImportSpecifier */); + return parseImportOrExportSpecifier(275 /* ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { const pos = getNodePos(); let checkIdentifierIsKeyword = isKeyword(token()) && !isIdentifier2(); - let checkIdentifierStart = scanner2.getTokenPos(); - let checkIdentifierEnd = scanner2.getTextPos(); + let checkIdentifierStart = scanner2.getTokenStart(); + let checkIdentifierEnd = scanner2.getTokenEnd(); let isTypeOnly = false; let propertyName; let canParseAsKeyword = true; let name = parseIdentifierName(); if (name.escapedText === "type") { - if (token() === 128 /* AsKeyword */) { + if (token() === 130 /* AsKeyword */) { const firstAs = parseIdentifierName(); - if (token() === 128 /* AsKeyword */) { + if (token() === 130 /* AsKeyword */) { const secondAs = parseIdentifierName(); if (tokenIsIdentifierOrKeyword(token())) { isTypeOnly = true; @@ -33918,20 +34093,20 @@ ${lanes.join("\n")} name = parseNameWithKeywordCheck(); } } - if (canParseAsKeyword && token() === 128 /* AsKeyword */) { + if (canParseAsKeyword && token() === 130 /* AsKeyword */) { propertyName = name; - parseExpected(128 /* AsKeyword */); + parseExpected(130 /* AsKeyword */); name = parseNameWithKeywordCheck(); } - if (kind === 273 /* ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 275 /* ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, Diagnostics.Identifier_expected); } - const node = kind === 273 /* ImportSpecifier */ ? factory2.createImportSpecifier(isTypeOnly, propertyName, name) : factory2.createExportSpecifier(isTypeOnly, propertyName, name); + const node = kind === 275 /* ImportSpecifier */ ? factory2.createImportSpecifier(isTypeOnly, propertyName, name) : factory2.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); function parseNameWithKeywordCheck() { checkIdentifierIsKeyword = isKeyword(token()) && !isIdentifier2(); - checkIdentifierStart = scanner2.getTokenPos(); - checkIdentifierEnd = scanner2.getTextPos(); + checkIdentifierStart = scanner2.getTokenStart(); + checkIdentifierEnd = scanner2.getTokenEnd(); return parseIdentifierName(); } } @@ -33947,22 +34122,22 @@ ${lanes.join("\n")} let exportClause; let moduleSpecifier; let assertClause; - const isTypeOnly = parseOptional(154 /* TypeKeyword */); + const isTypeOnly = parseOptional(156 /* TypeKeyword */); const namespaceExportPos = getNodePos(); - if (parseOptional(41 /* AsteriskToken */)) { - if (parseOptional(128 /* AsKeyword */)) { + if (parseOptional(42 /* AsteriskToken */)) { + if (parseOptional(130 /* AsKeyword */)) { exportClause = parseNamespaceExport(namespaceExportPos); } - parseExpected(158 /* FromKeyword */); + parseExpected(160 /* FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } else { - exportClause = parseNamedImportsOrExports(276 /* NamedExports */); - if (token() === 158 /* FromKeyword */ || token() === 10 /* StringLiteral */ && !scanner2.hasPrecedingLineBreak()) { - parseExpected(158 /* FromKeyword */); + exportClause = parseNamedImportsOrExports(278 /* NamedExports */); + if (token() === 160 /* FromKeyword */ || token() === 11 /* StringLiteral */ && !scanner2.hasPrecedingLineBreak()) { + parseExpected(160 /* FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } } - if (moduleSpecifier && token() === 130 /* AssertKeyword */ && !scanner2.hasPrecedingLineBreak()) { + if (moduleSpecifier && token() === 132 /* AssertKeyword */ && !scanner2.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -33977,10 +34152,10 @@ ${lanes.join("\n")} true ); let isExportEquals; - if (parseOptional(63 /* EqualsToken */)) { + if (parseOptional(64 /* EqualsToken */)) { isExportEquals = true; } else { - parseExpected(88 /* DefaultKeyword */); + parseExpected(90 /* DefaultKeyword */); } const expression = parseAssignmentExpressionOrHigher( /*allowReturnTypeInArrowFunction*/ @@ -34018,7 +34193,8 @@ ${lanes.join("\n")} ParsingContext2[ParsingContext2["HeritageClauses"] = 22] = "HeritageClauses"; ParsingContext2[ParsingContext2["ImportOrExportSpecifiers"] = 23] = "ImportOrExportSpecifiers"; ParsingContext2[ParsingContext2["AssertEntries"] = 24] = "AssertEntries"; - ParsingContext2[ParsingContext2["Count"] = 25] = "Count"; + ParsingContext2[ParsingContext2["JSDocComment"] = 25] = "JSDocComment"; + ParsingContext2[ParsingContext2["Count"] = 26] = "Count"; })(ParsingContext || (ParsingContext = {})); let Tristate; ((Tristate2) => { @@ -34033,7 +34209,7 @@ ${lanes.join("\n")} "file.js", content, 99 /* Latest */, - /*_syntaxCursor:*/ + /*syntaxCursor*/ void 0, 1 /* JS */ ); @@ -34061,10 +34237,10 @@ ${lanes.join("\n")} JSDocParser2.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests2; function parseJSDocTypeExpression(mayOmitBraces) { const pos = getNodePos(); - const hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(18 /* OpenBraceToken */); + const hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(19 /* OpenBraceToken */); const type = doInsideOfContext(8388608 /* JSDoc */, parseJSDocType); if (!mayOmitBraces || hasBrace) { - parseExpectedJSDoc(19 /* CloseBraceToken */); + parseExpectedJSDoc(20 /* CloseBraceToken */); } const result = factory2.createJSDocTypeExpression(type); fixupParentReferences(result); @@ -34073,19 +34249,19 @@ ${lanes.join("\n")} JSDocParser2.parseJSDocTypeExpression = parseJSDocTypeExpression; function parseJSDocNameReference() { const pos = getNodePos(); - const hasBrace = parseOptional(18 /* OpenBraceToken */); + const hasBrace = parseOptional(19 /* OpenBraceToken */); const p2 = getNodePos(); let entityName = parseEntityName( - /* allowReservedWords*/ + /*allowReservedWords*/ false ); - while (token() === 80 /* PrivateIdentifier */) { + while (token() === 81 /* PrivateIdentifier */) { reScanHashToken(); nextTokenJSDoc(); entityName = finishNode(factory2.createJSDocMemberName(entityName, parseIdentifier()), p2); } if (hasBrace) { - parseExpectedJSDoc(19 /* CloseBraceToken */); + parseExpectedJSDoc(20 /* CloseBraceToken */); } const result = factory2.createJSDocNameReference(entityName); fixupParentReferences(result); @@ -34097,7 +34273,7 @@ ${lanes.join("\n")} "", content, 99 /* Latest */, - /*_syntaxCursor:*/ + /*syntaxCursor*/ void 0, 1 /* JS */ ); @@ -34140,6 +34316,8 @@ ${lanes.join("\n")} PropertyLikeParse2[PropertyLikeParse2["CallbackParameter"] = 4] = "CallbackParameter"; })(PropertyLikeParse || (PropertyLikeParse = {})); function parseJSDocCommentWorker(start = 0, length2) { + const saveParsingContext = parsingContext; + parsingContext |= 1 << 25 /* JSDocComment */; const content = sourceText; const end = length2 === void 0 ? content.length : start + length2; length2 = end - start; @@ -34156,7 +34334,10 @@ ${lanes.join("\n")} let commentsPos; let comments = []; const parts = []; - return scanner2.scanRange(start + 3, length2 - 5, () => { + const result = scanner2.scanRange(start + 3, length2 - 5, doJSDocScan); + parsingContext = saveParsingContext; + return result; + function doJSDocScan() { let state = 1 /* SawAsterisk */; let margin; let indent2 = start - (content.lastIndexOf("\n", start) + 1) + 4; @@ -34177,57 +34358,57 @@ ${lanes.join("\n")} loop: while (true) { switch (token()) { - case 59 /* AtToken */: - if (state === 0 /* BeginningOfLine */ || state === 1 /* SawAsterisk */) { - removeTrailingWhitespace(comments); - if (!commentsPos) - commentsPos = getNodePos(); - addTag(parseTag(indent2)); - state = 0 /* BeginningOfLine */; - margin = void 0; - } else { - pushComment(scanner2.getTokenText()); - } + case 60 /* AtToken */: + removeTrailingWhitespace(comments); + if (!commentsPos) + commentsPos = getNodePos(); + addTag(parseTag(indent2)); + state = 0 /* BeginningOfLine */; + margin = void 0; break; case 4 /* NewLineTrivia */: comments.push(scanner2.getTokenText()); state = 0 /* BeginningOfLine */; indent2 = 0; break; - case 41 /* AsteriskToken */: + case 42 /* AsteriskToken */: const asterisk = scanner2.getTokenText(); - if (state === 1 /* SawAsterisk */ || state === 2 /* SavingComments */) { + if (state === 1 /* SawAsterisk */) { state = 2 /* SavingComments */; pushComment(asterisk); } else { + Debug.assert(state === 0 /* BeginningOfLine */); state = 1 /* SawAsterisk */; indent2 += asterisk.length; } break; case 5 /* WhitespaceTrivia */: + Debug.assert(state !== 2 /* SavingComments */, "whitespace shouldn't come from the scanner while saving top-level comment text"); const whitespace = scanner2.getTokenText(); - if (state === 2 /* SavingComments */) { - comments.push(whitespace); - } else if (margin !== void 0 && indent2 + whitespace.length > margin) { + if (margin !== void 0 && indent2 + whitespace.length > margin) { comments.push(whitespace.slice(margin - indent2)); } indent2 += whitespace.length; break; case 1 /* EndOfFileToken */: break loop; - case 18 /* OpenBraceToken */: + case 82 /* JSDocCommentTextToken */: state = 2 /* SavingComments */; - const commentEnd = scanner2.getStartPos(); - const linkStart = scanner2.getTextPos() - 1; + pushComment(scanner2.getTokenValue()); + break; + case 19 /* OpenBraceToken */: + state = 2 /* SavingComments */; + const commentEnd = scanner2.getTokenFullStart(); + const linkStart = scanner2.getTokenEnd() - 1; const link = parseJSDocLink(linkStart); if (link) { if (!linkEnd) { removeLeadingNewlines(comments); } - parts.push(finishNode(factory2.createJSDocText(comments.join("")), linkEnd != null ? linkEnd : start, commentEnd)); + parts.push(finishNode(factory2.createJSDocText(comments.join("")), linkEnd ?? start, commentEnd)); parts.push(link); comments = []; - linkEnd = scanner2.getTextPos(); + linkEnd = scanner2.getTokenEnd(); break; } default: @@ -34235,25 +34416,40 @@ ${lanes.join("\n")} pushComment(scanner2.getTokenText()); break; } - nextTokenJSDoc(); + if (state === 2 /* SavingComments */) { + nextJSDocCommentTextToken( + /*inBackticks*/ + false + ); + } else { + nextTokenJSDoc(); + } } - removeTrailingWhitespace(comments); - if (parts.length && comments.length) { - parts.push(finishNode(factory2.createJSDocText(comments.join("")), linkEnd != null ? linkEnd : start, commentsPos)); + const trimmedComments = trimStringEnd(comments.join("")); + if (parts.length && trimmedComments.length) { + parts.push(finishNode(factory2.createJSDocText(trimmedComments), linkEnd ?? start, commentsPos)); } if (parts.length && tags) Debug.assertIsDefined(commentsPos, "having parsed tags implies that the end of the comment span should be set"); const tagsArray = tags && createNodeArray(tags, tagsPos, tagsEnd); - return finishNode(factory2.createJSDocComment(parts.length ? createNodeArray(parts, start, commentsPos) : comments.length ? comments.join("") : void 0, tagsArray), start, end); - }); + return finishNode(factory2.createJSDocComment(parts.length ? createNodeArray(parts, start, commentsPos) : trimmedComments.length ? trimmedComments : void 0, tagsArray), start, end); + } function removeLeadingNewlines(comments2) { while (comments2.length && (comments2[0] === "\n" || comments2[0] === "\r")) { comments2.shift(); } } function removeTrailingWhitespace(comments2) { - while (comments2.length && comments2[comments2.length - 1].trim() === "") { - comments2.pop(); + while (comments2.length) { + const trimmed = trimStringEnd(comments2[comments2.length - 1]); + if (trimmed === "") { + comments2.pop(); + } else if (trimmed.length < comments2[comments2.length - 1].length) { + comments2[comments2.length - 1] = trimmed; + break; + } else { + break; + } } } function isNextNonwhitespaceTokenEndOfFile() { @@ -34286,13 +34482,13 @@ ${lanes.join("\n")} let precedingLineBreak = scanner2.hasPrecedingLineBreak(); let seenLineBreak = false; let indentText = ""; - while (precedingLineBreak && token() === 41 /* AsteriskToken */ || token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) { + while (precedingLineBreak && token() === 42 /* AsteriskToken */ || token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) { indentText += scanner2.getTokenText(); if (token() === 4 /* NewLineTrivia */) { precedingLineBreak = true; seenLineBreak = true; indentText = ""; - } else if (token() === 41 /* AsteriskToken */) { + } else if (token() === 42 /* AsteriskToken */) { precedingLineBreak = false; } nextTokenJSDoc(); @@ -34300,8 +34496,8 @@ ${lanes.join("\n")} return seenLineBreak ? indentText : ""; } function parseTag(margin) { - Debug.assert(token() === 59 /* AtToken */); - const start2 = scanner2.getTokenPos(); + Debug.assert(token() === 60 /* AtToken */); + const start2 = scanner2.getTokenStart(); nextTokenJSDoc(); const tagName = parseJSDocIdentifierName( /*message*/ @@ -34400,7 +34596,6 @@ ${lanes.join("\n")} const parts2 = []; let linkEnd2; let state = 0 /* BeginningOfLine */; - let previousWhitespace = true; let margin; function pushComment(text) { if (!margin) { @@ -34424,40 +34619,35 @@ ${lanes.join("\n")} comments2.push(scanner2.getTokenText()); indent2 = 0; break; - case 59 /* AtToken */: - if (state === 3 /* SavingBackticks */ || state === 2 /* SavingComments */ && (!previousWhitespace || lookAhead(isNextJSDocTokenWhitespace))) { - comments2.push(scanner2.getTokenText()); - break; - } - scanner2.setTextPos(scanner2.getTextPos() - 1); + case 60 /* AtToken */: + scanner2.resetTokenState(scanner2.getTokenEnd() - 1); + break loop; case 1 /* EndOfFileToken */: break loop; case 5 /* WhitespaceTrivia */: - if (state === 2 /* SavingComments */ || state === 3 /* SavingBackticks */) { - pushComment(scanner2.getTokenText()); - } else { - const whitespace = scanner2.getTokenText(); - if (margin !== void 0 && indent2 + whitespace.length > margin) { - comments2.push(whitespace.slice(margin - indent2)); - } - indent2 += whitespace.length; + Debug.assert(state !== 2 /* SavingComments */ && state !== 3 /* SavingBackticks */, "whitespace shouldn't come from the scanner while saving comment text"); + const whitespace = scanner2.getTokenText(); + if (margin !== void 0 && indent2 + whitespace.length > margin) { + comments2.push(whitespace.slice(margin - indent2)); + state = 2 /* SavingComments */; } + indent2 += whitespace.length; break; - case 18 /* OpenBraceToken */: + case 19 /* OpenBraceToken */: state = 2 /* SavingComments */; - const commentEnd = scanner2.getStartPos(); - const linkStart = scanner2.getTextPos() - 1; + const commentEnd = scanner2.getTokenFullStart(); + const linkStart = scanner2.getTokenEnd() - 1; const link = parseJSDocLink(linkStart); if (link) { - parts2.push(finishNode(factory2.createJSDocText(comments2.join("")), linkEnd2 != null ? linkEnd2 : commentsPos2, commentEnd)); + parts2.push(finishNode(factory2.createJSDocText(comments2.join("")), linkEnd2 ?? commentsPos2, commentEnd)); parts2.push(link); comments2 = []; - linkEnd2 = scanner2.getTextPos(); + linkEnd2 = scanner2.getTokenEnd(); } else { pushComment(scanner2.getTokenText()); } break; - case 61 /* BacktickToken */: + case 62 /* BacktickToken */: if (state === 3 /* SavingBackticks */) { state = 2 /* SavingComments */; } else { @@ -34465,7 +34655,13 @@ ${lanes.join("\n")} } pushComment(scanner2.getTokenText()); break; - case 41 /* AsteriskToken */: + case 82 /* JSDocCommentTextToken */: + if (state !== 3 /* SavingBackticks */) { + state = 2 /* SavingComments */; + } + pushComment(scanner2.getTokenValue()); + break; + case 42 /* AsteriskToken */: if (state === 0 /* BeginningOfLine */) { state = 1 /* SawAsterisk */; indent2 += 1; @@ -34478,24 +34674,23 @@ ${lanes.join("\n")} pushComment(scanner2.getTokenText()); break; } - previousWhitespace = token() === 5 /* WhitespaceTrivia */; - tok = nextTokenJSDoc(); + if (state === 2 /* SavingComments */ || state === 3 /* SavingBackticks */) { + tok = nextJSDocCommentTextToken(state === 3 /* SavingBackticks */); + } else { + tok = nextTokenJSDoc(); + } } removeLeadingNewlines(comments2); - removeTrailingWhitespace(comments2); + const trimmedComments = trimStringEnd(comments2.join("")); if (parts2.length) { - if (comments2.length) { - parts2.push(finishNode(factory2.createJSDocText(comments2.join("")), linkEnd2 != null ? linkEnd2 : commentsPos2)); + if (trimmedComments.length) { + parts2.push(finishNode(factory2.createJSDocText(trimmedComments), linkEnd2 ?? commentsPos2)); } - return createNodeArray(parts2, commentsPos2, scanner2.getTextPos()); - } else if (comments2.length) { - return comments2.join(""); + return createNodeArray(parts2, commentsPos2, scanner2.getTokenEnd()); + } else if (trimmedComments.length) { + return trimmedComments; } } - function isNextJSDocTokenWhitespace() { - const next = nextTokenJSDoc(); - return next === 5 /* WhitespaceTrivia */ || next === 4 /* NewLineTrivia */; - } function parseJSDocLink(start2) { const linkType = tryParse(parseJSDocLinkPrefix); if (!linkType) { @@ -34509,23 +34704,23 @@ ${lanes.join("\n")} true ) : void 0; if (name) { - while (token() === 80 /* PrivateIdentifier */) { + while (token() === 81 /* PrivateIdentifier */) { reScanHashToken(); nextTokenJSDoc(); name = finishNode(factory2.createJSDocMemberName(name, parseIdentifier()), p2); } } const text = []; - while (token() !== 19 /* CloseBraceToken */ && token() !== 4 /* NewLineTrivia */ && token() !== 1 /* EndOfFileToken */) { + while (token() !== 20 /* CloseBraceToken */ && token() !== 4 /* NewLineTrivia */ && token() !== 1 /* EndOfFileToken */) { text.push(scanner2.getTokenText()); nextTokenJSDoc(); } const create = linkType === "link" ? factory2.createJSDocLink : linkType === "linkcode" ? factory2.createJSDocLinkCode : factory2.createJSDocLinkPlain; - return finishNode(create(name, text.join("")), start2, scanner2.getTextPos()); + return finishNode(create(name, text.join("")), start2, scanner2.getTokenEnd()); } function parseJSDocLinkPrefix() { skipWhitespaceOrAsterisk(); - if (token() === 18 /* OpenBraceToken */ && nextTokenJSDoc() === 59 /* AtToken */ && tokenIsIdentifierOrKeyword(nextTokenJSDoc())) { + if (token() === 19 /* OpenBraceToken */ && nextTokenJSDoc() === 60 /* AtToken */ && tokenIsIdentifierOrKeyword(nextTokenJSDoc())) { const kind = scanner2.getTokenValue(); if (isJSDocLinkTag(kind)) return kind; @@ -34551,32 +34746,32 @@ ${lanes.join("\n")} } function tryParseTypeExpression() { skipWhitespaceOrAsterisk(); - return token() === 18 /* OpenBraceToken */ ? parseJSDocTypeExpression() : void 0; + return token() === 19 /* OpenBraceToken */ ? parseJSDocTypeExpression() : void 0; } function parseBracketNameInPropertyAndParamTag() { - const isBracketed = parseOptionalJsdoc(22 /* OpenBracketToken */); + const isBracketed = parseOptionalJsdoc(23 /* OpenBracketToken */); if (isBracketed) { skipWhitespace(); } - const isBackquoted = parseOptionalJsdoc(61 /* BacktickToken */); + const isBackquoted = parseOptionalJsdoc(62 /* BacktickToken */); const name = parseJSDocEntityName(); if (isBackquoted) { - parseExpectedTokenJSDoc(61 /* BacktickToken */); + parseExpectedTokenJSDoc(62 /* BacktickToken */); } if (isBracketed) { skipWhitespace(); - if (parseOptionalToken(63 /* EqualsToken */)) { + if (parseOptionalToken(64 /* EqualsToken */)) { parseExpression(); } - parseExpected(23 /* CloseBracketToken */); + parseExpected(24 /* CloseBracketToken */); } return { name, isBracketed }; } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { - case 149 /* ObjectKeyword */: + case 151 /* ObjectKeyword */: return true; - case 185 /* ArrayType */: + case 187 /* ArrayType */: return isObjectOrObjectArrayTypeReference(node.elementType); default: return isTypeReferenceNode(node) && isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; @@ -34597,8 +34792,8 @@ ${lanes.join("\n")} typeExpression = nestedTypeLiteral; isNameFirst = true; } - const result = target === 1 /* Property */ ? factory2.createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) : factory2.createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment); - return finishNode(result, start2); + const result2 = target === 1 /* Property */ ? factory2.createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) : factory2.createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment); + return finishNode(result2, start2); } function parseNestedTypeLiteral(typeExpression, name, target, indent2) { if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { @@ -34606,26 +34801,28 @@ ${lanes.join("\n")} let child; let children; while (child = tryParse(() => parseChildParameterOrPropertyTag(target, indent2, name))) { - if (child.kind === 344 /* JSDocParameterTag */ || child.kind === 351 /* JSDocPropertyTag */) { + if (child.kind === 347 /* JSDocParameterTag */ || child.kind === 354 /* JSDocPropertyTag */) { children = append(children, child); + } else if (child.kind === 351 /* JSDocTemplateTag */) { + parseErrorAtRange(child.tagName, Diagnostics.A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag); } } if (children) { - const literal = finishNode(factory2.createJSDocTypeLiteral(children, typeExpression.type.kind === 185 /* ArrayType */), pos); + const literal = finishNode(factory2.createJSDocTypeLiteral(children, typeExpression.type.kind === 187 /* ArrayType */), pos); return finishNode(factory2.createJSDocTypeExpression(literal), pos); } } } function parseReturnTag(start2, tagName, indent2, indentText) { if (some(tags, isJSDocReturnTag)) { - parseErrorAt(tagName.pos, scanner2.getTokenPos(), Diagnostics._0_tag_already_specified, tagName.escapedText); + parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText)); } const typeExpression = tryParseTypeExpression(); return finishNode(factory2.createJSDocReturnTag(tagName, typeExpression, parseTrailingTagComments(start2, getNodePos(), indent2, indentText)), start2); } function parseTypeTag(start2, tagName, indent2, indentText) { if (some(tags, isJSDocTypeTag)) { - parseErrorAt(tagName.pos, scanner2.getTokenPos(), Diagnostics._0_tag_already_specified, tagName.escapedText); + parseErrorAt(tagName.pos, scanner2.getTokenStart(), Diagnostics._0_tag_already_specified, unescapeLeadingUnderscores(tagName.escapedText)); } const typeExpression = parseJSDocTypeExpression( /*mayOmitBraces*/ @@ -34635,7 +34832,7 @@ ${lanes.join("\n")} return finishNode(factory2.createJSDocTypeTag(tagName, typeExpression, comments2), start2); } function parseSeeTag(start2, tagName, indent2, indentText) { - const isMarkdownOrJSDocLink = token() === 22 /* OpenBracketToken */ || lookAhead(() => nextTokenJSDoc() === 59 /* AtToken */ && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && isJSDocLinkTag(scanner2.getTokenValue())); + const isMarkdownOrJSDocLink = token() === 23 /* OpenBracketToken */ || lookAhead(() => nextTokenJSDoc() === 60 /* AtToken */ && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && isJSDocLinkTag(scanner2.getTokenValue())); const nameExpression = isMarkdownOrJSDocLink ? void 0 : parseJSDocNameReference(); const comments2 = indent2 !== void 0 && indentText !== void 0 ? parseTrailingTagComments(start2, getNodePos(), indent2, indentText) : void 0; return finishNode(factory2.createJSDocSeeTag(tagName, nameExpression, comments2), start2); @@ -34648,10 +34845,10 @@ ${lanes.join("\n")} function parseAuthorTag(start2, tagName, indent2, indentText) { const commentStart = getNodePos(); const textOnly = parseAuthorNameAndEmail(); - let commentEnd = scanner2.getStartPos(); + let commentEnd = scanner2.getTokenFullStart(); const comments2 = parseTrailingTagComments(start2, commentEnd, indent2, indentText); if (!comments2) { - commentEnd = scanner2.getStartPos(); + commentEnd = scanner2.getTokenFullStart(); } const allParts = typeof comments2 !== "string" ? createNodeArray(concatenate([finishNode(textOnly, commentStart, commentEnd)], comments2), commentStart) : textOnly.text + comments2; return finishNode(factory2.createJSDocAuthorTag(tagName, allParts), start2); @@ -34661,13 +34858,13 @@ ${lanes.join("\n")} let inEmail = false; let token2 = scanner2.getToken(); while (token2 !== 1 /* EndOfFileToken */ && token2 !== 4 /* NewLineTrivia */) { - if (token2 === 29 /* LessThanToken */) { + if (token2 === 30 /* LessThanToken */) { inEmail = true; - } else if (token2 === 59 /* AtToken */ && !inEmail) { + } else if (token2 === 60 /* AtToken */ && !inEmail) { break; - } else if (token2 === 31 /* GreaterThanToken */ && inEmail) { + } else if (token2 === 32 /* GreaterThanToken */ && inEmail) { comments2.push(scanner2.getTokenText()); - scanner2.setTextPos(scanner2.getTokenPos() + 1); + scanner2.resetTokenState(scanner2.getTokenEnd()); break; } comments2.push(scanner2.getTokenText()); @@ -34692,21 +34889,23 @@ ${lanes.join("\n")} return finishNode(factory2.createJSDocSatisfiesTag(tagName, typeExpression, comments2), start2); } function parseExpressionWithTypeArgumentsForAugments() { - const usedBrace = parseOptional(18 /* OpenBraceToken */); + const usedBrace = parseOptional(19 /* OpenBraceToken */); const pos = getNodePos(); const expression = parsePropertyAccessEntityNameExpression(); + scanner2.setInJSDocType(true); const typeArguments = tryParseTypeArguments(); + scanner2.setInJSDocType(false); const node = factory2.createExpressionWithTypeArguments(expression, typeArguments); const res = finishNode(node, pos); if (usedBrace) { - parseExpected(19 /* CloseBraceToken */); + parseExpected(20 /* CloseBraceToken */); } return res; } function parsePropertyAccessEntityNameExpression() { const pos = getNodePos(); let node = parseJSDocIdentifierName(); - while (parseOptional(24 /* DotToken */)) { + while (parseOptional(25 /* DotToken */)) { const name = parseJSDocIdentifierName(); node = finishNode(factoryCreatePropertyAccessExpression(node, name), pos); } @@ -34732,7 +34931,6 @@ ${lanes.join("\n")} return finishNode(factory2.createJSDocEnumTag(tagName, typeExpression, parseTrailingTagComments(start2, getNodePos(), margin, indentText)), start2); } function parseTypedefTag(start2, tagName, indent2, indentText) { - var _a2; let typeExpression = tryParseTypeExpression(); skipWhitespaceOrAsterisk(); const fullName = parseJSDocTypeNameWithNamespace(); @@ -34745,8 +34943,11 @@ ${lanes.join("\n")} let jsDocPropertyTags; let hasChildren = false; while (child = tryParse(() => parseChildPropertyTag(indent2))) { + if (child.kind === 351 /* JSDocTemplateTag */) { + break; + } hasChildren = true; - if (child.kind === 347 /* JSDocTypeTag */) { + if (child.kind === 350 /* JSDocTypeTag */) { if (childTypeTag) { const lastError = parseErrorAtCurrentToken(Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { @@ -34761,13 +34962,13 @@ ${lanes.join("\n")} } } if (hasChildren) { - const isArrayType = typeExpression && typeExpression.type.kind === 185 /* ArrayType */; + const isArrayType = typeExpression && typeExpression.type.kind === 187 /* ArrayType */; const jsdocTypeLiteral = factory2.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : finishNode(jsdocTypeLiteral, start2); end2 = typeExpression.end; } } - end2 = end2 || comment !== void 0 ? getNodePos() : ((_a2 = fullName != null ? fullName : typeExpression) != null ? _a2 : tagName).end; + end2 = end2 || comment !== void 0 ? getNodePos() : (fullName ?? typeExpression ?? tagName).end; if (!comment) { comment = parseTrailingTagComments(start2, end2, indent2, indentText); } @@ -34775,12 +34976,12 @@ ${lanes.join("\n")} return finishNode(typedefTag, start2, end2); } function parseJSDocTypeNameWithNamespace(nested) { - const pos = scanner2.getTokenPos(); + const start2 = scanner2.getTokenStart(); if (!tokenIsIdentifierOrKeyword(token())) { return void 0; } const typeNameOrNamespaceName = parseJSDocIdentifierName(); - if (parseOptional(24 /* DotToken */)) { + if (parseOptional(25 /* DotToken */)) { const body = parseJSDocTypeNameWithNamespace( /*nested*/ true @@ -34792,7 +34993,7 @@ ${lanes.join("\n")} body, nested ? 4 /* NestedNamespace */ : void 0 ); - return finishNode(jsDocNamespaceNode, pos); + return finishNode(jsDocNamespaceNode, start2); } if (nested) { typeNameOrNamespaceName.flags |= 2048 /* IdentifierIsInJSDocNamespace */; @@ -34804,6 +35005,10 @@ ${lanes.join("\n")} let child; let parameters; while (child = tryParse(() => parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent2))) { + if (child.kind === 351 /* JSDocTemplateTag */) { + parseErrorAtRange(child.tagName, Diagnostics.A_JSDoc_template_tag_may_not_follow_a_typedef_callback_or_overload_tag); + break; + } parameters = append(parameters, child); } return createNodeArray(parameters || [], pos); @@ -34811,9 +35016,9 @@ ${lanes.join("\n")} function parseJSDocSignature(start2, indent2) { const parameters = parseCallbackTagParameters(indent2); const returnTag = tryParse(() => { - if (parseOptionalJsdoc(59 /* AtToken */)) { + if (parseOptionalJsdoc(60 /* AtToken */)) { const tag = parseTag(indent2); - if (tag && tag.kind === 345 /* JSDocReturnTag */) { + if (tag && tag.kind === 348 /* JSDocReturnTag */) { return tag; } } @@ -34865,10 +35070,10 @@ ${lanes.join("\n")} let seenAsterisk = false; while (true) { switch (nextTokenJSDoc()) { - case 59 /* AtToken */: + case 60 /* AtToken */: if (canParseTag) { const child = tryParseChildTag(target, indent2); - if (child && (child.kind === 344 /* JSDocParameterTag */ || child.kind === 351 /* JSDocPropertyTag */) && target !== 4 /* CallbackParameter */ && name && (isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { + if (child && (child.kind === 347 /* JSDocParameterTag */ || child.kind === 354 /* JSDocPropertyTag */) && target !== 4 /* CallbackParameter */ && name && (isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; } return child; @@ -34879,13 +35084,13 @@ ${lanes.join("\n")} canParseTag = true; seenAsterisk = false; break; - case 41 /* AsteriskToken */: + case 42 /* AsteriskToken */: if (seenAsterisk) { canParseTag = false; } seenAsterisk = true; break; - case 79 /* Identifier */: + case 80 /* Identifier */: canParseTag = false; break; case 1 /* EndOfFileToken */: @@ -34894,11 +35099,11 @@ ${lanes.join("\n")} } } function tryParseChildTag(target, indent2) { - Debug.assert(token() === 59 /* AtToken */); - const start2 = scanner2.getStartPos(); + Debug.assert(token() === 60 /* AtToken */); + const start2 = scanner2.getTokenFullStart(); nextTokenJSDoc(); const tagName = parseJSDocIdentifierName(); - skipWhitespace(); + const indentText = skipWhitespaceOrAsterisk(); let t; switch (tagName.escapedText) { case "type": @@ -34912,6 +35117,8 @@ ${lanes.join("\n")} case "param": t = 2 /* Parameter */ | 4 /* CallbackParameter */; break; + case "template": + return parseTemplateTag(start2, tagName, indent2, indentText); default: return false; } @@ -34922,7 +35129,7 @@ ${lanes.join("\n")} } function parseTemplateTagTypeParameter() { const typeParameterPos = getNodePos(); - const isBracketed = parseOptionalJsdoc(22 /* OpenBracketToken */); + const isBracketed = parseOptionalJsdoc(23 /* OpenBracketToken */); if (isBracketed) { skipWhitespace(); } @@ -34930,9 +35137,9 @@ ${lanes.join("\n")} let defaultType; if (isBracketed) { skipWhitespace(); - parseExpected(63 /* EqualsToken */); + parseExpected(64 /* EqualsToken */); defaultType = doInsideOfContext(8388608 /* JSDoc */, parseJSDocType); - parseExpected(23 /* CloseBracketToken */); + parseExpected(24 /* CloseBracketToken */); } if (nodeIsMissing(name)) { return void 0; @@ -34956,11 +35163,11 @@ ${lanes.join("\n")} typeParameters.push(node); } skipWhitespaceOrAsterisk(); - } while (parseOptionalJsdoc(27 /* CommaToken */)); + } while (parseOptionalJsdoc(28 /* CommaToken */)); return createNodeArray(typeParameters, pos); } function parseTemplateTag(start2, tagName, indent2, indentText) { - const constraint = token() === 18 /* OpenBraceToken */ ? parseJSDocTypeExpression() : void 0; + const constraint = token() === 19 /* OpenBraceToken */ ? parseJSDocTypeExpression() : void 0; const typeParameters = parseTemplateTagTypeParameters(); return finishNode(factory2.createJSDocTemplateTag(tagName, constraint, typeParameters, parseTrailingTagComments(start2, getNodePos(), indent2, indentText)), start2); } @@ -34973,13 +35180,13 @@ ${lanes.join("\n")} } function parseJSDocEntityName() { let entity = parseJSDocIdentifierName(); - if (parseOptional(22 /* OpenBracketToken */)) { - parseExpected(23 /* CloseBracketToken */); + if (parseOptional(23 /* OpenBracketToken */)) { + parseExpected(24 /* CloseBracketToken */); } - while (parseOptional(24 /* DotToken */)) { + while (parseOptional(25 /* DotToken */)) { const name = parseJSDocIdentifierName(); - if (parseOptional(22 /* OpenBracketToken */)) { - parseExpected(23 /* CloseBracketToken */); + if (parseOptional(23 /* OpenBracketToken */)) { + parseExpected(24 /* CloseBracketToken */); } entity = createQualifiedName(entity, name); } @@ -34988,20 +35195,20 @@ ${lanes.join("\n")} function parseJSDocIdentifierName(message) { if (!tokenIsIdentifierOrKeyword(token())) { return createMissingNode( - 79 /* Identifier */, + 80 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || Diagnostics.Identifier_expected ); } identifierCount++; - const pos = scanner2.getTokenPos(); - const end2 = scanner2.getTextPos(); + const start2 = scanner2.getTokenStart(); + const end2 = scanner2.getTokenEnd(); const originalKeywordKind = token(); const text = internIdentifier(scanner2.getTokenValue()); - const result = finishNode(factoryCreateIdentifier(text, originalKeywordKind), pos, end2); + const result2 = finishNode(factoryCreateIdentifier(text, originalKeywordKind), start2, end2); nextTokenJSDoc(); - return result; + return result2; } } })(JSDocParser = Parser2.JSDocParser || (Parser2.JSDocParser = {})); @@ -35143,9 +35350,9 @@ ${lanes.join("\n")} } function shouldCheckNode(node) { switch (node.kind) { - case 10 /* StringLiteral */: - case 8 /* NumericLiteral */: - case 79 /* Identifier */: + case 11 /* StringLiteral */: + case 9 /* NumericLiteral */: + case 80 /* Identifier */: return true; } return false; @@ -35438,13 +35645,13 @@ ${lanes.join("\n")} function getOptionName(option) { return option.name; } - function createUnknownOptionError(unknownOption, diagnostics, createDiagnostics, unknownOptionErrorText) { - var _a2; - if ((_a2 = diagnostics.alternateMode) == null ? void 0 : _a2.getOptionsNameMap().optionsNameMap.has(unknownOption.toLowerCase())) { - return createDiagnostics(diagnostics.alternateMode.diagnostic, unknownOption); + function createUnknownOptionError(unknownOption, diagnostics, unknownOptionErrorText, node, sourceFile) { + var _a; + if ((_a = diagnostics.alternateMode) == null ? void 0 : _a.getOptionsNameMap().optionsNameMap.has(unknownOption.toLowerCase())) { + return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.alternateMode.diagnostic, unknownOption); } const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName); - return possibleOption ? createDiagnostics(diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnostics(diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption); + return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption); } function parseCommandLineWorker(diagnostics, commandLine, readFile) { const options = {}; @@ -35485,7 +35692,7 @@ ${lanes.join("\n")} if (watchOpt) { i = parseOptionValue(args, i, watchOptionsDidYouMeanDiagnostics, watchOpt, watchOptions || (watchOptions = {}), errors); } else { - errors.push(createUnknownOptionError(inputOptionName, diagnostics, createCompilerDiagnostic, s)); + errors.push(createUnknownOptionError(inputOptionName, diagnostics, s)); } } } else { @@ -35675,9 +35882,7 @@ ${lanes.join("\n")} config: convertConfigFileToObject( jsonSourceFile, jsonSourceFile.parseDiagnostics, - /*reportOptionsErrors*/ - false, - /*optionsIterator*/ + /*jsonConversionNotifier*/ void 0 ), error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0 @@ -35718,24 +35923,9 @@ ${lanes.join("\n")} // should never be needed since this is root type: "object", elementOptions: commandLineOptionsToMap([ - { - name: "compilerOptions", - type: "object", - elementOptions: getCommandLineCompilerOptionsMap(), - extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics - }, - { - name: "watchOptions", - type: "object", - elementOptions: getCommandLineWatchOptionsMap(), - extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics - }, - { - name: "typeAcquisition", - type: "object", - elementOptions: getCommandLineTypeAcquisitionMap(), - extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics - }, + compilerOptionsDeclaration, + watchOptionsDeclaration, + typeAcquisitionDeclaration, extendsOptionDeclaration, { name: "references", @@ -35781,11 +35971,10 @@ ${lanes.join("\n")} } return _tsconfigRootOptions; } - function convertConfigFileToObject(sourceFile, errors, reportOptionsErrors, optionsIterator) { - var _a2; - const rootExpression = (_a2 = sourceFile.statements[0]) == null ? void 0 : _a2.expression; - const knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : void 0; - if (rootExpression && rootExpression.kind !== 207 /* ObjectLiteralExpression */) { + function convertConfigFileToObject(sourceFile, errors, jsonConversionNotifier) { + var _a; + const rootExpression = (_a = sourceFile.statements[0]) == null ? void 0 : _a.expression; + if (rootExpression && rootExpression.kind !== 209 /* ObjectLiteralExpression */) { errors.push(createDiagnosticForNodeInSourceFile( sourceFile, rootExpression, @@ -35795,55 +35984,49 @@ ${lanes.join("\n")} if (isArrayLiteralExpression(rootExpression)) { const firstObject = find(rootExpression.elements, isObjectLiteralExpression); if (firstObject) { - return convertToObjectWorker( + return convertToJson( sourceFile, firstObject, errors, /*returnValue*/ true, - knownRootOptions, - optionsIterator + jsonConversionNotifier ); } } return {}; } - return convertToObjectWorker( + return convertToJson( sourceFile, rootExpression, errors, /*returnValue*/ true, - knownRootOptions, - optionsIterator + jsonConversionNotifier ); } function convertToObject(sourceFile, errors) { - var _a2; - return convertToObjectWorker( + var _a; + return convertToJson( sourceFile, - (_a2 = sourceFile.statements[0]) == null ? void 0 : _a2.expression, + (_a = sourceFile.statements[0]) == null ? void 0 : _a.expression, errors, /*returnValue*/ true, - /*knownRootOptions*/ - void 0, /*jsonConversionNotifier*/ void 0 ); } - function convertToObjectWorker(sourceFile, rootExpression, errors, returnValue, knownRootOptions, jsonConversionNotifier) { + function convertToJson(sourceFile, rootExpression, errors, returnValue, jsonConversionNotifier) { if (!rootExpression) { return returnValue ? {} : void 0; } - return convertPropertyValueToJson(rootExpression, knownRootOptions); - function isRootOptionMap(knownOptions) { - return knownRootOptions && knownRootOptions.elementOptions === knownOptions; - } - function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) { + return convertPropertyValueToJson(rootExpression, jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.rootOptions); + function convertObjectLiteralExpressionToJson(node, objectOption) { + var _a; const result = returnValue ? {} : void 0; for (const element of node.properties) { - if (element.kind !== 299 /* PropertyAssignment */) { + if (element.kind !== 302 /* PropertyAssignment */) { errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element, Diagnostics.Property_assignment_expected)); continue; } @@ -35855,38 +36038,13 @@ ${lanes.join("\n")} } const textOfKey = isComputedNonLiteralName(element.name) ? void 0 : getTextOfPropertyName(element.name); const keyText = textOfKey && unescapeLeadingUnderscores(textOfKey); - const option = keyText && knownOptions ? knownOptions.get(keyText) : void 0; - if (keyText && extraKeyDiagnostics && !option) { - if (knownOptions) { - errors.push(createUnknownOptionError( - keyText, - extraKeyDiagnostics, - (message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, element.name, message, arg0, arg1) - )); - } else { - errors.push(createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnostics.unknownOptionDiagnostic, keyText)); - } - } + const option = keyText ? (_a = objectOption == null ? void 0 : objectOption.elementOptions) == null ? void 0 : _a.get(keyText) : void 0; const value = convertPropertyValueToJson(element.initializer, option); if (typeof keyText !== "undefined") { if (returnValue) { result[keyText] = value; } - if (jsonConversionNotifier && // Current callbacks are only on known parent option or if we are setting values in the root - (parentOption || isRootOptionMap(knownOptions))) { - const isValidOptionValue = isCompilerOptionsValue(option, value); - if (parentOption) { - if (isValidOptionValue) { - jsonConversionNotifier.onSetValidOptionKeyValueInParent(parentOption, option, value); - } - } else if (isRootOptionMap(knownOptions)) { - if (isValidOptionValue) { - jsonConversionNotifier.onSetValidOptionKeyValueInRoot(keyText, element.name, value, element.initializer); - } else if (!option) { - jsonConversionNotifier.onSetUnknownOptionKeyValueInRoot(keyText, element.name, value, element.initializer); - } - } - } + jsonConversionNotifier == null ? void 0 : jsonConversionNotifier.onPropertySet(keyText, value, element, objectOption, option); } } return result; @@ -35899,112 +36057,40 @@ ${lanes.join("\n")} return filter(elements.map((element) => convertPropertyValueToJson(element, elementOption)), (v) => v !== void 0); } function convertPropertyValueToJson(valueExpression, option) { - let invalidReported; switch (valueExpression.kind) { - case 110 /* TrueKeyword */: - reportInvalidOptionValue(option && option.type !== "boolean" && (option.type !== "listOrElement" || option.element.type !== "boolean")); - return validateValue( - /*value*/ - true - ); - case 95 /* FalseKeyword */: - reportInvalidOptionValue(option && option.type !== "boolean" && (option.type !== "listOrElement" || option.element.type !== "boolean")); - return validateValue( - /*value*/ - false - ); - case 104 /* NullKeyword */: - reportInvalidOptionValue(option && option.name === "extends"); - return validateValue( - /*value*/ - null - ); - case 10 /* StringLiteral */: + case 112 /* TrueKeyword */: + return true; + case 97 /* FalseKeyword */: + return false; + case 106 /* NullKeyword */: + return null; + case 11 /* StringLiteral */: if (!isDoubleQuotedString(valueExpression)) { errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.String_literal_with_double_quotes_expected)); } - reportInvalidOptionValue(option && isString(option.type) && option.type !== "string" && (option.type !== "listOrElement" || isString(option.element.type) && option.element.type !== "string")); - const text = valueExpression.text; - if (option) { - Debug.assert(option.type !== "listOrElement" || option.element.type === "string", "Only string or array of string is handled for now"); - } - if (option && !isString(option.type)) { - const customOption = option; - if (!customOption.type.has(text.toLowerCase())) { - errors.push( - createDiagnosticForInvalidCustomType( - customOption, - (message, arg0, arg1) => createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, message, arg0, arg1) - ) - ); - invalidReported = true; - } - } - return validateValue(text); - case 8 /* NumericLiteral */: - reportInvalidOptionValue(option && option.type !== "number" && (option.type !== "listOrElement" || option.element.type !== "number")); - return validateValue(Number(valueExpression.text)); - case 221 /* PrefixUnaryExpression */: - if (valueExpression.operator !== 40 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) { + return valueExpression.text; + case 9 /* NumericLiteral */: + return Number(valueExpression.text); + case 223 /* PrefixUnaryExpression */: + if (valueExpression.operator !== 41 /* MinusToken */ || valueExpression.operand.kind !== 9 /* NumericLiteral */) { break; } - reportInvalidOptionValue(option && option.type !== "number" && (option.type !== "listOrElement" || option.element.type !== "number")); - return validateValue(-Number(valueExpression.operand.text)); - case 207 /* ObjectLiteralExpression */: - reportInvalidOptionValue(option && option.type !== "object" && (option.type !== "listOrElement" || option.element.type !== "object")); + return -Number(valueExpression.operand.text); + case 209 /* ObjectLiteralExpression */: const objectLiteralExpression = valueExpression; - if (option) { - const { elementOptions, extraKeyDiagnostics, name: optionName } = option; - return validateValue(convertObjectLiteralExpressionToJson( - objectLiteralExpression, - elementOptions, - extraKeyDiagnostics, - optionName - )); - } else { - return validateValue(convertObjectLiteralExpressionToJson( - objectLiteralExpression, - /* knownOptions*/ - void 0, - /*extraKeyDiagnosticMessage */ - void 0, - /*parentOption*/ - void 0 - )); - } - case 206 /* ArrayLiteralExpression */: - reportInvalidOptionValue(option && option.type !== "list" && option.type !== "listOrElement"); - return validateValue(convertArrayLiteralExpressionToJson( + return convertObjectLiteralExpressionToJson(objectLiteralExpression, option); + case 208 /* ArrayLiteralExpression */: + return convertArrayLiteralExpressionToJson( valueExpression.elements, option && option.element - )); + ); } if (option) { - reportInvalidOptionValue( - /*isError*/ - true - ); + errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option))); } else { errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal)); } return void 0; - function validateValue(value) { - var _a2; - if (!invalidReported) { - const diagnostic = (_a2 = option == null ? void 0 : option.extraValidation) == null ? void 0 : _a2.call(option, value); - if (diagnostic) { - errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ...diagnostic)); - return void 0; - } - } - return value; - } - function reportInvalidOptionValue(isError) { - if (isError) { - errors.push(createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option))); - invalidReported = true; - } - } } function isDoubleQuotedString(node) { return isStringLiteral(node) && isStringDoubleQuoted(node, sourceFile); @@ -36016,7 +36102,7 @@ ${lanes.join("\n")} function isCompilerOptionsValue(option, value) { if (option) { if (isNullOrUndefined(value)) - return true; + return !option.disallowNullOrUndefined; if (option.type === "list") { return isArray(value); } @@ -36029,12 +36115,12 @@ ${lanes.join("\n")} return false; } function convertToTSConfig(configParseResult, configFileName, host) { - var _a2, _b, _c; + var _a, _b, _c; const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames); const files = map( filter( configParseResult.fileNames, - !((_b = (_a2 = configParseResult.options.configFile) == null ? void 0 : _a2.configFileSpecs) == null ? void 0 : _b.validatedIncludeSpecs) ? returnTrue : matchesSpecs( + !((_b = (_a = configParseResult.options.configFile) == null ? void 0 : _a.configFileSpecs) == null ? void 0 : _b.validatedIncludeSpecs) ? returnTrue : matchesSpecs( configFileName, configParseResult.options.configFile.configFileSpecs.validatedIncludeSpecs, configParseResult.options.configFile.configFileSpecs.validatedExcludeSpecs, @@ -36244,8 +36330,8 @@ ${lanes.join("\n")} result.push(`${tab}${tab}/* ${getLocaleSpecificMessage(Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashtsconfig_to_read_more_about_this_file)} */`); result.push(""); for (const entry of entries) { - const { value, description: description2 = "" } = entry; - result.push(value && `${tab}${tab}${value}${description2 && makePadding(marginLength - value.length + 2) + description2}`); + const { value, description: description3 = "" } = entry; + result.push(value && `${tab}${tab}${value}${description3 && makePadding(marginLength - value.length + 2) + description3}`); } if (fileNames.length) { result.push(`${tab}},`); @@ -36308,8 +36394,8 @@ ${lanes.join("\n")} ); } function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache, existingWatchOptions) { - var _a2, _b; - (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Parse, "parseJsonSourceFileConfigFileContent", { path: sourceFile.fileName }); + var _a, _b; + (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Parse, "parseJsonSourceFileConfigFileContent", { path: sourceFile.fileName }); const result = parseJsonConfigFileContentWorker( /*json*/ void 0, @@ -36375,8 +36461,8 @@ ${lanes.join("\n")} if (sourceFile) { const fileName = configFileName || "tsconfig.json"; const diagnosticMessage = Diagnostics.The_files_list_in_config_file_0_is_empty; - const nodeValue = firstDefined(getTsConfigPropArray(sourceFile, "files"), (property) => property.initializer); - const error = nodeValue ? createDiagnosticForNodeInSourceFile(sourceFile, nodeValue, diagnosticMessage, fileName) : createCompilerDiagnostic(diagnosticMessage, fileName); + const nodeValue = forEachTsConfigPropArray(sourceFile, "files", (property) => property.initializer); + const error = createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, nodeValue, diagnosticMessage, fileName); errors.push(error); } else { createCompilerDiagnosticOnlyIfJson(Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json"); @@ -36478,9 +36564,9 @@ ${lanes.join("\n")} } return "no-prop"; } - function createCompilerDiagnosticOnlyIfJson(message, arg0, arg1) { + function createCompilerDiagnosticOnlyIfJson(message, ...args) { if (!sourceFile) { - errors.push(createCompilerDiagnostic(message, arg0, arg1)); + errors.push(createCompilerDiagnostic(message, ...args)); } } } @@ -36514,7 +36600,7 @@ ${lanes.join("\n")} return !!value.options; } function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache) { - var _a2; + var _a; basePath = normalizeSlashes(basePath); const resolvedPath = getNormalizedAbsolutePath(configFileName || "", basePath); if (resolutionStack.indexOf(resolvedPath) >= 0) { @@ -36522,7 +36608,7 @@ ${lanes.join("\n")} return { raw: json || convertToObject(sourceFile, errors) }; } const ownConfig = json ? parseOwnConfigOfJson(json, host, basePath, configFileName, errors) : parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors); - if ((_a2 = ownConfig.options) == null ? void 0 : _a2.paths) { + if ((_a = ownConfig.options) == null ? void 0 : _a.paths) { ownConfig.options.pathsBasePath = basePath; } if (ownConfig.extendedConfigPath) { @@ -36579,27 +36665,42 @@ ${lanes.join("\n")} const typeAcquisition = convertTypeAcquisitionFromJsonWorker(json.typeAcquisition, basePath, errors, configFileName); const watchOptions = convertWatchOptionsFromJsonWorker(json.watchOptions, basePath, errors); json.compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors); + const extendedConfigPath = json.extends || json.extends === "" ? getExtendsConfigPathOrArray(json.extends, host, basePath, configFileName, errors) : void 0; + return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath }; + } + function getExtendsConfigPathOrArray(value, host, basePath, configFileName, errors, propertyAssignment, valueExpression, sourceFile) { let extendedConfigPath; - if (json.extends || json.extends === "") { - if (!isCompilerOptionsValue(extendsOptionDeclaration, json.extends)) { - errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", getCompilerOptionValueTypeString(extendsOptionDeclaration))); - } else { - const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath; - if (isString(json.extends)) { - extendedConfigPath = getExtendsConfigPath(json.extends, host, newBase, errors, createCompilerDiagnostic); + const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath; + if (isString(value)) { + extendedConfigPath = getExtendsConfigPath( + value, + host, + newBase, + errors, + valueExpression, + sourceFile + ); + } else if (isArray(value)) { + extendedConfigPath = []; + for (let index = 0; index < value.length; index++) { + const fileName = value[index]; + if (isString(fileName)) { + extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath( + fileName, + host, + newBase, + errors, + valueExpression == null ? void 0 : valueExpression.elements[index], + sourceFile + )); } else { - extendedConfigPath = []; - for (const fileName of json.extends) { - if (isString(fileName)) { - extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath(fileName, host, newBase, errors, createCompilerDiagnostic)); - } else { - errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", getCompilerOptionValueTypeString(extendsOptionDeclaration.element))); - } - } + convertJsonOption(extendsOptionDeclaration.element, value, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile); } } + } else { + convertJsonOption(extendsOptionDeclaration, value, basePath, errors, propertyAssignment, valueExpression, sourceFile); } - return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath }; + return extendedConfigPath; } function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors) { const options = getDefaultCompilerOptions(configFileName); @@ -36607,69 +36708,11 @@ ${lanes.join("\n")} let watchOptions; let extendedConfigPath; let rootCompilerOptions; - const optionsIterator = { - onSetValidOptionKeyValueInParent(parentOption, option, value) { - let currentOption; - switch (parentOption) { - case "compilerOptions": - currentOption = options; - break; - case "watchOptions": - currentOption = watchOptions || (watchOptions = {}); - break; - case "typeAcquisition": - currentOption = typeAcquisition || (typeAcquisition = getDefaultTypeAcquisition(configFileName)); - break; - default: - Debug.fail("Unknown option"); - } - currentOption[option.name] = normalizeOptionValue(option, basePath, value); - }, - onSetValidOptionKeyValueInRoot(key, _keyNode, value, valueNode) { - switch (key) { - case "extends": - const newBase = configFileName ? directoryOfCombinedPath(configFileName, basePath) : basePath; - if (isString(value)) { - extendedConfigPath = getExtendsConfigPath( - value, - host, - newBase, - errors, - (message, arg0) => createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0) - ); - } else { - extendedConfigPath = []; - for (let index = 0; index < value.length; index++) { - const fileName = value[index]; - if (isString(fileName)) { - extendedConfigPath = append(extendedConfigPath, getExtendsConfigPath( - fileName, - host, - newBase, - errors, - (message, arg0) => createDiagnosticForNodeInSourceFile(sourceFile, valueNode.elements[index], message, arg0) - )); - } - } - } - return; - } - }, - onSetUnknownOptionKeyValueInRoot(key, keyNode, _value, _valueNode) { - if (key === "excludes") { - errors.push(createDiagnosticForNodeInSourceFile(sourceFile, keyNode, Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); - } - if (find(commandOptionsWithoutBuild, (opt) => opt.name === key)) { - rootCompilerOptions = append(rootCompilerOptions, keyNode); - } - } - }; + const rootOptions = getTsconfigRootOptionsMap(); const json = convertConfigFileToObject( sourceFile, errors, - /*reportOptionsErrors*/ - true, - optionsIterator + { rootOptions, onPropertySet } ); if (!typeAcquisition) { typeAcquisition = getDefaultTypeAcquisition(configFileName); @@ -36678,15 +36721,57 @@ ${lanes.join("\n")} errors.push(createDiagnosticForNodeInSourceFile(sourceFile, rootCompilerOptions[0], Diagnostics._0_should_be_set_inside_the_compilerOptions_object_of_the_config_json_file, getTextOfPropertyName(rootCompilerOptions[0]))); } return { raw: json, options, watchOptions, typeAcquisition, extendedConfigPath }; + function onPropertySet(keyText, value, propertyAssignment, parentOption, option) { + if (option && option !== extendsOptionDeclaration) + value = convertJsonOption(option, value, basePath, errors, propertyAssignment, propertyAssignment.initializer, sourceFile); + if (parentOption == null ? void 0 : parentOption.name) { + if (option) { + let currentOption; + if (parentOption === compilerOptionsDeclaration) + currentOption = options; + else if (parentOption === watchOptionsDeclaration) + currentOption = watchOptions ?? (watchOptions = {}); + else if (parentOption === typeAcquisitionDeclaration) + currentOption = typeAcquisition ?? (typeAcquisition = getDefaultTypeAcquisition(configFileName)); + else + Debug.fail("Unknown option"); + currentOption[option.name] = value; + } else if (keyText && (parentOption == null ? void 0 : parentOption.extraKeyDiagnostics)) { + if (parentOption.elementOptions) { + errors.push(createUnknownOptionError( + keyText, + parentOption.extraKeyDiagnostics, + /*unknownOptionErrorText*/ + void 0, + propertyAssignment.name, + sourceFile + )); + } else { + errors.push(createDiagnosticForNodeInSourceFile(sourceFile, propertyAssignment.name, parentOption.extraKeyDiagnostics.unknownOptionDiagnostic, keyText)); + } + } + } else if (parentOption === rootOptions) { + if (option === extendsOptionDeclaration) { + extendedConfigPath = getExtendsConfigPathOrArray(value, host, basePath, configFileName, errors, propertyAssignment, propertyAssignment.initializer, sourceFile); + } else if (!option) { + if (keyText === "excludes") { + errors.push(createDiagnosticForNodeInSourceFile(sourceFile, propertyAssignment.name, Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); + } + if (find(commandOptionsWithoutBuild, (opt) => opt.name === keyText)) { + rootCompilerOptions = append(rootCompilerOptions, propertyAssignment.name); + } + } + } + } } - function getExtendsConfigPath(extendedConfig, host, basePath, errors, createDiagnostic) { + function getExtendsConfigPath(extendedConfig, host, basePath, errors, valueExpression, sourceFile) { extendedConfig = normalizeSlashes(extendedConfig); if (isRootedDiskPath(extendedConfig) || startsWith(extendedConfig, "./") || startsWith(extendedConfig, "../")) { let extendedConfigPath = getNormalizedAbsolutePath(extendedConfig, basePath); if (!host.fileExists(extendedConfigPath) && !endsWith(extendedConfigPath, ".json" /* Json */)) { extendedConfigPath = `${extendedConfigPath}.json`; if (!host.fileExists(extendedConfigPath)) { - errors.push(createDiagnostic(Diagnostics.File_0_not_found, extendedConfig)); + errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.File_0_not_found, extendedConfig)); return void 0; } } @@ -36697,14 +36782,13 @@ ${lanes.join("\n")} return resolved.resolvedModule.resolvedFileName; } if (extendedConfig === "") { - errors.push(createDiagnostic(Diagnostics.Compiler_option_0_cannot_be_given_an_empty_string, "extends")); + errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Compiler_option_0_cannot_be_given_an_empty_string, "extends")); } else { - errors.push(createDiagnostic(Diagnostics.File_0_not_found, extendedConfig)); + errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.File_0_not_found, extendedConfig)); } return void 0; } function getExtendedConfig(sourceFile, extendedConfigPath, host, resolutionStack, errors, extendedConfigCache, result) { - var _a2; const path = host.useCaseSensitiveFileNames ? extendedConfigPath : toFileNameLowerCase(extendedConfigPath); let value; let extendedResult; @@ -36731,7 +36815,7 @@ ${lanes.join("\n")} } } if (sourceFile) { - ((_a2 = result.extendedSourceFiles) != null ? _a2 : result.extendedSourceFiles = /* @__PURE__ */ new Set()).add(extendedResult.fileName); + (result.extendedSourceFiles ?? (result.extendedSourceFiles = /* @__PURE__ */ new Set())).add(extendedResult.fileName); if (extendedResult.extendedSourceFiles) { for (const extenedSourceFile of extendedResult.extendedSourceFiles) { result.extendedSourceFiles.add(extenedSourceFile); @@ -36801,43 +36885,34 @@ ${lanes.join("\n")} if (opt) { (defaultOptions || (defaultOptions = {}))[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); } else { - errors.push(createUnknownOptionError(id, diagnostics, createCompilerDiagnostic)); + errors.push(createUnknownOptionError(id, diagnostics)); } } return defaultOptions; } - function convertJsonOption(opt, value, basePath, errors) { + function createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, message, ...args) { + return sourceFile && node ? createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args) : createCompilerDiagnostic(message, ...args); + } + function convertJsonOption(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile) { + if (opt.isCommandLineOnly) { + errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, propertyAssignment == null ? void 0 : propertyAssignment.name, Diagnostics.Option_0_can_only_be_specified_on_command_line, opt.name)); + return void 0; + } if (isCompilerOptionsValue(opt, value)) { const optType = opt.type; if (optType === "list" && isArray(value)) { - return convertJsonOptionOfListType(opt, value, basePath, errors); + return convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile); } else if (optType === "listOrElement") { - return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors) : convertJsonOption(opt.element, value, basePath, errors); + return isArray(value) ? convertJsonOptionOfListType(opt, value, basePath, errors, propertyAssignment, valueExpression, sourceFile) : convertJsonOption(opt.element, value, basePath, errors, propertyAssignment, valueExpression, sourceFile); } else if (!isString(opt.type)) { - return convertJsonOptionOfCustomType(opt, value, errors); + return convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile); } - const validatedValue = validateJsonOptionValue(opt, value, errors); + const validatedValue = validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile); return isNullOrUndefined(validatedValue) ? validatedValue : normalizeNonListOptionValue(opt, basePath, validatedValue); } else { - errors.push(createCompilerDiagnostic(Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt))); + errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt))); } } - function normalizeOptionValue(option, basePath, value) { - if (isNullOrUndefined(value)) - return void 0; - if (option.type === "listOrElement" && !isArray(value)) - return normalizeOptionValue(option.element, basePath, value); - else if (option.type === "list" || option.type === "listOrElement") { - const listOption = option; - if (listOption.element.isFilePath || !isString(listOption.element.type)) { - return filter(map(value, (v) => normalizeOptionValue(listOption.element, basePath, v)), (v) => listOption.listPreserveFalsyValues ? true : !!v); - } - return value; - } else if (!isString(option.type)) { - return option.type.get(isString(value) ? value.toLowerCase() : value); - } - return normalizeNonListOptionValue(option, basePath, value); - } function normalizeNonListOptionValue(option, basePath, value) { if (option.isFilePath) { value = getNormalizedAbsolutePath(value, basePath); @@ -36847,29 +36922,29 @@ ${lanes.join("\n")} } return value; } - function validateJsonOptionValue(opt, value, errors) { - var _a2; + function validateJsonOptionValue(opt, value, errors, valueExpression, sourceFile) { + var _a; if (isNullOrUndefined(value)) return void 0; - const d = (_a2 = opt.extraValidation) == null ? void 0 : _a2.call(opt, value); + const d = (_a = opt.extraValidation) == null ? void 0 : _a.call(opt, value); if (!d) return value; - errors.push(createCompilerDiagnostic(...d)); + errors.push(createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, ...d)); return void 0; } - function convertJsonOptionOfCustomType(opt, value, errors) { + function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sourceFile) { if (isNullOrUndefined(value)) return void 0; const key = value.toLowerCase(); const val = opt.type.get(key); if (val !== void 0) { - return validateJsonOptionValue(opt, val, errors); + return validateJsonOptionValue(opt, val, errors, valueExpression, sourceFile); } else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + errors.push(createDiagnosticForInvalidCustomType(opt, (message, ...args) => createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, valueExpression, message, ...args))); } } - function convertJsonOptionOfListType(option, values, basePath, errors) { - return filter(map(values, (v) => convertJsonOption(option.element, v, basePath, errors)), (v) => option.listPreserveFalsyValues ? true : !!v); + function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) { + return filter(map(values, (v, index) => convertJsonOption(option.element, v, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile)), (v) => option.listPreserveFalsyValues ? true : !!v); } function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions = emptyArray) { basePath = normalizePath(basePath); @@ -36976,7 +37051,7 @@ ${lanes.join("\n")} }); function createDiagnostic(message, spec) { const element = getTsConfigPropArrayElementValue(jsonSourceFile, specKey, spec); - return element ? createDiagnosticForNodeInSourceFile(jsonSourceFile, element, message, spec) : createCompilerDiagnostic(message, spec); + return createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(jsonSourceFile, element, message, spec); } } function specToDiagnostic(spec, disallowTrailingRecursion) { @@ -37087,6 +37162,8 @@ ${lanes.join("\n")} return out; } function getOptionValueWithEmptyStrings(value, option) { + if (value === void 0) + return value; switch (option.type) { case "object": return ""; @@ -37101,7 +37178,7 @@ ${lanes.join("\n")} return getOptionValueWithEmptyStrings(value, option.element); case "list": const elementType = option.element; - return isArray(value) ? value.map((v) => getOptionValueWithEmptyStrings(v, elementType)) : ""; + return isArray(value) ? mapDefined(value, (v) => getOptionValueWithEmptyStrings(v, elementType)) : ""; default: return forEachEntry(option.type, (optionEnumValue, optionStringValue) => { if (optionEnumValue === value) { @@ -37132,7 +37209,7 @@ ${lanes.join("\n")} return Debug.fail("Expected 'option.type' to have entries."); } } - var compileOnSaveCommandLineOption, jsxOptionMap, inverseJsxOptionMap, libEntries, libs, libMap, optionsForWatch, commonOptionsWithBuild, targetOptionDeclaration, moduleOptionDeclaration, commandOptionsWithoutBuild, optionDeclarations, semanticDiagnosticsOptionDeclarations, affectsEmitOptionDeclarations, affectsDeclarationPathOptionDeclarations, moduleResolutionOptionDeclarations, sourceFileAffectingCompilerOptions, optionsAffectingProgramStructure, transpileOptionValueCompilerOptions, optionsForBuild, buildOpts, typeAcquisitionDeclarations, optionsNameMapCache, compilerOptionsAlternateMode, defaultInitCompilerOptions, compilerOptionsDidYouMeanDiagnostics, buildOptionsNameMapCache, buildOptionsAlternateMode, buildOptionsDidYouMeanDiagnostics, typeAcquisitionDidYouMeanDiagnostics, watchOptionsNameMapCache, watchOptionsDidYouMeanDiagnostics, commandLineCompilerOptionsMapCache, commandLineWatchOptionsMapCache, commandLineTypeAcquisitionMapCache, extendsOptionDeclaration, _tsconfigRootOptions, defaultIncludeSpec, invalidTrailingRecursionPattern, wildcardDirectoryPattern; + var compileOnSaveCommandLineOption, jsxOptionMap, inverseJsxOptionMap, libEntries, libs, libMap, optionsForWatch, commonOptionsWithBuild, targetOptionDeclaration, moduleOptionDeclaration, commandOptionsWithoutBuild, optionDeclarations, semanticDiagnosticsOptionDeclarations, affectsEmitOptionDeclarations, affectsDeclarationPathOptionDeclarations, moduleResolutionOptionDeclarations, sourceFileAffectingCompilerOptions, optionsAffectingProgramStructure, transpileOptionValueCompilerOptions, optionsForBuild, buildOpts, typeAcquisitionDeclarations, optionsNameMapCache, compilerOptionsAlternateMode, defaultInitCompilerOptions, compilerOptionsDidYouMeanDiagnostics, buildOptionsNameMapCache, buildOptionsAlternateMode, buildOptionsDidYouMeanDiagnostics, typeAcquisitionDidYouMeanDiagnostics, watchOptionsNameMapCache, watchOptionsDidYouMeanDiagnostics, commandLineCompilerOptionsMapCache, commandLineWatchOptionsMapCache, commandLineTypeAcquisitionMapCache, extendsOptionDeclaration, compilerOptionsDeclaration, watchOptionsDeclaration, typeAcquisitionDeclaration, _tsconfigRootOptions, defaultIncludeSpec, invalidTrailingRecursionPattern, wildcardDirectoryPattern; var init_commandLineParser = __esm({ "src/compiler/commandLineParser.ts"() { "use strict"; @@ -38642,7 +38719,26 @@ ${lanes.join("\n")} name: "extends", type: "string" }, - category: Diagnostics.File_Management + category: Diagnostics.File_Management, + disallowNullOrUndefined: true + }; + compilerOptionsDeclaration = { + name: "compilerOptions", + type: "object", + elementOptions: getCommandLineCompilerOptionsMap(), + extraKeyDiagnostics: compilerOptionsDidYouMeanDiagnostics + }; + watchOptionsDeclaration = { + name: "watchOptions", + type: "object", + elementOptions: getCommandLineWatchOptionsMap(), + extraKeyDiagnostics: watchOptionsDidYouMeanDiagnostics + }; + typeAcquisitionDeclaration = { + name: "typeAcquisition", + type: "object", + elementOptions: getCommandLineTypeAcquisitionMap(), + extraKeyDiagnostics: typeAcquisitionDidYouMeanDiagnostics }; defaultIncludeSpec = "**/*"; invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/; @@ -38856,20 +38952,14 @@ ${lanes.join("\n")} currentDirectory = host.getCurrentDirectory(); } if (currentDirectory !== void 0) { - return getDefaultTypeRoots(currentDirectory, host); + return getDefaultTypeRoots(currentDirectory); } } - function getDefaultTypeRoots(currentDirectory, host) { - if (!host.directoryExists) { - return [combinePaths(currentDirectory, nodeModulesAtTypes)]; - } + function getDefaultTypeRoots(currentDirectory) { let typeRoots; forEachAncestorDirectory(normalizePath(currentDirectory), (directory) => { const atTypes = combinePaths(directory, nodeModulesAtTypes); - if (host.directoryExists(atTypes)) { - (typeRoots || (typeRoots = [])).push(atTypes); - } - return void 0; + (typeRoots ?? (typeRoots = [])).push(atTypes); }); return typeRoots; } @@ -38886,6 +38976,10 @@ ${lanes.join("\n")} originalPath: pathsAreEqual ? void 0 : fileName }; } + function getCandidateFromTypeRoot(typeRoot, typeReferenceDirectiveName, moduleResolutionState) { + const nameForLookup = endsWith(typeRoot, "/node_modules/@types") || endsWith(typeRoot, "/node_modules/@types/") ? mangleScopedPackageNameWithTrace(typeReferenceDirectiveName, moduleResolutionState) : typeReferenceDirectiveName; + return combinePaths(typeRoot, nameForLookup); + } function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference, cache, resolutionMode) { Debug.assert(typeof typeReferenceDirectiveName === "string", "Non-string value passed to `ts.resolveTypeReferenceDirective`, likely by a wrapping package working with an outdated `resolveTypeReferenceDirectives` signature. This is probably not a problem in TS itself."); const traceEnabled = isTraceEnabled(options, host); @@ -38989,8 +39083,8 @@ ${lanes.join("\n")} traceResult(result); return result; function traceResult(result2) { - var _a2; - if (!((_a2 = result2.resolvedTypeReferenceDirective) == null ? void 0 : _a2.resolvedFileName)) { + var _a; + if (!((_a = result2.resolvedTypeReferenceDirective) == null ? void 0 : _a.resolvedFileName)) { trace(host, Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); } else if (result2.resolvedTypeReferenceDirective.packageId) { trace(host, Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3, typeReferenceDirectiveName, result2.resolvedTypeReferenceDirective.resolvedFileName, packageIdToString(result2.resolvedTypeReferenceDirective.packageId), result2.resolvedTypeReferenceDirective.primary); @@ -39004,11 +39098,23 @@ ${lanes.join("\n")} trace(host, Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", ")); } return firstDefined(typeRoots, (typeRoot) => { - const candidate = combinePaths(typeRoot, typeReferenceDirectiveName); - const candidateDirectory = getDirectoryPath(candidate); - const directoryExists = directoryProbablyExists(candidateDirectory, host); + const candidate = getCandidateFromTypeRoot(typeRoot, typeReferenceDirectiveName, moduleResolutionState); + const directoryExists = directoryProbablyExists(typeRoot, host); if (!directoryExists && traceEnabled) { - trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); + trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot); + } + if (options.typeRoots) { + const resolvedFromFile = loadModuleFromFile(4 /* Declaration */, candidate, !directoryExists, moduleResolutionState); + if (resolvedFromFile) { + const packageDirectory = parseNodeModuleFromPath(resolvedFromFile.path); + const packageInfo = packageDirectory ? getPackageJsonInfo( + packageDirectory, + /*onlyRecordFailures*/ + false, + moduleResolutionState + ) : void 0; + return resolvedTypeScriptOnly(withPackageId(packageInfo, resolvedFromFile)); + } } return resolvedTypeScriptOnly( loadNodeModuleFromDirectory( @@ -39028,33 +39134,37 @@ ${lanes.join("\n")} function secondaryLookup() { const initialLocationForSecondaryLookup = containingFile && getDirectoryPath(containingFile); if (initialLocationForSecondaryLookup !== void 0) { - if (traceEnabled) { - trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); - } let result2; - if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) { - const searchResult = loadModuleFromNearestNodeModulesDirectory( - 4 /* Declaration */, - typeReferenceDirectiveName, - initialLocationForSecondaryLookup, - moduleResolutionState, - /*cache*/ - void 0, - /*redirectedReference*/ - void 0 - ); - result2 = searchResult && searchResult.value; - } else { - const { path: candidate } = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName); - result2 = nodeLoadModuleByRelativeName( - 4 /* Declaration */, - candidate, - /*onlyRecordFailures*/ - false, - moduleResolutionState, - /*considerPackageJson*/ - true - ); + if (!options.typeRoots || !endsWith(containingFile, inferredTypesContainingFile)) { + if (traceEnabled) { + trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); + } + if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) { + const searchResult = loadModuleFromNearestNodeModulesDirectory( + 4 /* Declaration */, + typeReferenceDirectiveName, + initialLocationForSecondaryLookup, + moduleResolutionState, + /*cache*/ + void 0, + /*redirectedReference*/ + void 0 + ); + result2 = searchResult && searchResult.value; + } else { + const { path: candidate } = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName); + result2 = nodeLoadModuleByRelativeName( + 4 /* Declaration */, + candidate, + /*onlyRecordFailures*/ + false, + moduleResolutionState, + /*considerPackageJson*/ + true + ); + } + } else if (traceEnabled) { + trace(host, Diagnostics.Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder); } return resolvedTypeScriptOnly(result2); } else { @@ -39142,12 +39252,12 @@ ${lanes.join("\n")} return result; } function compilerOptionValueToString(value) { - var _a2; + var _a; if (value === null || typeof value !== "object") { return "" + value; } if (isArray(value)) { - return `[${(_a2 = value.map((e) => compilerOptionValueToString(e))) == null ? void 0 : _a2.join(",")}]`; + return `[${(_a = value.map((e) => compilerOptionValueToString(e))) == null ? void 0 : _a.join(",")}]`; } let str = "{"; for (const key in value) { @@ -39215,7 +39325,7 @@ ${lanes.join("\n")} redirectsKeyToMap.set(ownKey, ownMap); } if (create) - result != null ? result : result = /* @__PURE__ */ new Map(); + result ?? (result = /* @__PURE__ */ new Map()); if (result) redirectsKeyToMap.set(key, result); } @@ -39291,9 +39401,9 @@ ${lanes.join("\n")} return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, () => createModeAwareCache()); } function getFromDirectoryCache(name, mode, directoryName, redirectedReference) { - var _a2, _b; + var _a, _b; const path = toPath(directoryName, currentDirectory, getCanonicalFileName); - return (_b = (_a2 = directoryToModuleNameMap.getMapOfCacheRedirects(redirectedReference)) == null ? void 0 : _a2.get(path)) == null ? void 0 : _b.get(name, mode); + return (_b = (_a = directoryToModuleNameMap.getMapOfCacheRedirects(redirectedReference)) == null ? void 0 : _a.get(path)) == null ? void 0 : _b.get(name, mode); } } function createModeAwareCacheKey(specifier, mode) { @@ -39364,9 +39474,9 @@ ${lanes.join("\n")} moduleNameToDirectoryMap.update(options2); } function getFromNonRelativeNameCache(nonRelativeModuleName, mode, directoryName, redirectedReference) { - var _a2, _b; + var _a, _b; Debug.assert(!isExternalModuleNameRelative(nonRelativeModuleName)); - return (_b = (_a2 = moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) == null ? void 0 : _a2.get(createModeAwareCacheKey(nonRelativeModuleName, mode))) == null ? void 0 : _b.get(directoryName); + return (_b = (_a = moduleNameToDirectoryMap.getMapOfCacheRedirects(redirectedReference)) == null ? void 0 : _a.get(createModeAwareCacheKey(nonRelativeModuleName, mode))) == null ? void 0 : _b.get(directoryName); } function getOrCreateCacheForNonRelativeName(nonRelativeModuleName, mode, redirectedReference) { Debug.assert(!isExternalModuleNameRelative(nonRelativeModuleName)); @@ -39426,7 +39536,7 @@ ${lanes.join("\n")} options, getResolvedFileName ); - packageJsonInfoCache != null ? packageJsonInfoCache : packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName); + packageJsonInfoCache ?? (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName)); return { ...packageJsonInfoCache, ...perDirectoryResolutionCache, @@ -39449,13 +39559,12 @@ ${lanes.join("\n")} nonRelativeNameResolutionCache.update(options2); } } - function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) { + function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache) { const result = createModuleOrTypeReferenceResolutionCache( currentDirectory, getCanonicalFileName, options, - /*packageJsonInfoCache*/ - void 0, + packageJsonInfoCache, getOriginalOrResolvedModuleFileName ); result.getOrCreateCacheForModuleName = (nonRelativeName, mode, redirectedReference) => result.getOrCreateCacheForNonRelativeName(nonRelativeName, mode, redirectedReference); @@ -39470,6 +39579,12 @@ ${lanes.join("\n")} getOriginalOrResolvedTypeReferenceFileName ); } + function getOptionsForLibraryResolution(options) { + return { moduleResolution: 2 /* Node10 */, traceResolution: options.traceResolution }; + } + function resolveLibrary(libraryName, resolveFrom, compilerOptions, host, cache) { + return resolveModuleName(libraryName, resolveFrom, getOptionsForLibraryResolution(compilerOptions), host, cache); + } function resolveModuleNameFromCache(moduleName, containingFile, cache, mode) { const containingDirectory = getDirectoryPath(containingFile); return cache.getFromDirectoryCache( @@ -39481,6 +39596,7 @@ ${lanes.join("\n")} ); } function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) { + var _a, _b, _c; const traceEnabled = isTraceEnabled(compilerOptions, host); if (redirectedReference) { compilerOptions = redirectedReference.commandLine.options; @@ -39522,10 +39638,7 @@ ${lanes.join("\n")} trace(host, Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ModuleResolutionKind[moduleResolution]); } } - perfLogger.logStartResolveModule( - moduleName - /* , containingFile, ModuleResolutionKind[moduleResolution]*/ - ); + (_a = perfLogger) == null ? void 0 : _a.logStartResolveModule(moduleName); switch (moduleResolution) { case 3 /* Node16 */: result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode); @@ -39546,8 +39659,8 @@ ${lanes.join("\n")} return Debug.fail(`Unexpected moduleResolution: ${moduleResolution}`); } if (result && result.resolvedModule) - perfLogger.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`); - perfLogger.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null"); + (_b = perfLogger) == null ? void 0 : _b.logInfoEvent(`Module "${moduleName}" resolved to "${result.resolvedModule.resolvedFileName}"`); + (_c = perfLogger) == null ? void 0 : _c.logStopResolveModule(result && result.resolvedModule ? "" + result.resolvedModule.resolvedFileName : "null"); cache == null ? void 0 : cache.getOrCreateCacheForDirectory(containingDirectory, redirectedReference).set(moduleName, resolutionMode, result); if (!isExternalModuleNameRelative(moduleName)) { cache == null ? void 0 : cache.getOrCreateCacheForNonRelativeName(moduleName, resolutionMode, redirectedReference).set(containingDirectory, result); @@ -39577,7 +39690,7 @@ ${lanes.join("\n")} } } function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state) { - var _a2; + var _a; const { baseUrl, paths, configFile } = state.compilerOptions; if (paths && !pathIsRelative(moduleName)) { if (state.traceEnabled) { @@ -39587,7 +39700,7 @@ ${lanes.join("\n")} trace(state.host, Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName); } const baseDirectory = getPathsBasePath(state.compilerOptions, state.host); - const pathPatterns = (configFile == null ? void 0 : configFile.configFileSpecs) ? (_a2 = configFile.configFileSpecs).pathPatterns || (_a2.pathPatterns = tryParsePatterns(paths)) : void 0; + const pathPatterns = (configFile == null ? void 0 : configFile.configFileSpecs) ? (_a = configFile.configFileSpecs).pathPatterns || (_a.pathPatterns = tryParsePatterns(paths)) : void 0; return tryLoadModuleUsingPaths( extensions, moduleName, @@ -39737,7 +39850,7 @@ ${lanes.join("\n")} 2 /* JavaScript */, /*isConfigLookup*/ false, - /*redirectedReferences*/ + /*redirectedReference*/ void 0 ); } @@ -39790,7 +39903,7 @@ ${lanes.join("\n")} ); } function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference) { - var _a2, _b, _c, _d; + var _a, _b, _c, _d; const traceEnabled = isTraceEnabled(compilerOptions, host); const failedLookupLocations = []; const affectingLocations = []; @@ -39822,13 +39935,11 @@ ${lanes.join("\n")} result = tryResolve(extensions, state); } let legacyResult; - if (((_a2 = result == null ? void 0 : result.value) == null ? void 0 : _a2.isExternalLibraryImport) && !isConfigLookup && extensions & (1 /* TypeScript */ | 4 /* Declaration */) && features & 8 /* Exports */ && !isExternalModuleNameRelative(moduleName) && !extensionIsOk(1 /* TypeScript */ | 4 /* Declaration */, result.value.resolved.extension) && conditions.indexOf("import") > -1) { + if (((_a = result == null ? void 0 : result.value) == null ? void 0 : _a.isExternalLibraryImport) && !isConfigLookup && extensions & (1 /* TypeScript */ | 4 /* Declaration */) && features & 8 /* Exports */ && !isExternalModuleNameRelative(moduleName) && !extensionIsOk(1 /* TypeScript */ | 4 /* Declaration */, result.value.resolved.extension) && conditions.indexOf("import") > -1) { traceIfEnabled(state, Diagnostics.Resolution_of_non_relative_name_failed_trying_with_modern_Node_resolution_features_disabled_to_see_if_npm_library_needs_configuration_update); const diagnosticState = { ...state, features: state.features & ~8 /* Exports */, - failedLookupLocations: [], - affectingLocations: [], reportDiagnostic: noop }; const diagnosticResult = tryResolve(extensions & (1 /* TypeScript */ | 4 /* Declaration */), diagnosticState); @@ -39868,11 +39979,20 @@ ${lanes.join("\n")} resolved2 = loadModuleFromSelfNameReference(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference); } if (!resolved2) { + if (moduleName.indexOf(":") > -1) { + if (traceEnabled) { + trace(host, Diagnostics.Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1, moduleName, formatExtensions(extensions2)); + } + return void 0; + } if (traceEnabled) { trace(host, Diagnostics.Loading_module_0_from_node_modules_folder_target_file_types_Colon_1, moduleName, formatExtensions(extensions2)); } resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference); } + if (extensions2 & 4 /* Declaration */) { + resolved2 ?? (resolved2 = resolveFromTypeRoot(moduleName, state2)); + } return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } }; } else { const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName); @@ -39950,22 +40070,22 @@ ${lanes.join("\n")} function pathContainsNodeModules(path) { return stringContains(path, nodeModulesPathPart); } - function parseNodeModuleFromPath(resolved) { + function parseNodeModuleFromPath(resolved, isFolder) { const path = normalizePath(resolved); const idx = path.lastIndexOf(nodeModulesPathPart); if (idx === -1) { return void 0; } const indexAfterNodeModules = idx + nodeModulesPathPart.length; - let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules); + let indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterNodeModules, isFolder); if (path.charCodeAt(indexAfterNodeModules) === 64 /* at */) { - indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName); + indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName, isFolder); } return path.slice(0, indexAfterPackageName); } - function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) { + function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex, isFolder) { const nextSeparatorIndex = path.indexOf(directorySeparator, prevSeparatorIndex + 1); - return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex; + return nextSeparatorIndex === -1 ? isFolder ? path.length : prevSeparatorIndex : nextSeparatorIndex; } function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) { return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state)); @@ -40043,15 +40163,16 @@ ${lanes.join("\n")} } } function tryFile(fileName, onlyRecordFailures, state) { - var _a2, _b; - if (!((_a2 = state.compilerOptions.moduleSuffixes) == null ? void 0 : _a2.length)) { + var _a; + if (!((_a = state.compilerOptions.moduleSuffixes) == null ? void 0 : _a.length)) { return tryFileLookup(fileName, onlyRecordFailures, state); } - const ext = (_b = tryGetExtensionFromPath2(fileName)) != null ? _b : ""; + const ext = tryGetExtensionFromPath2(fileName) ?? ""; const fileNameNoExtension = ext ? removeExtension(fileName, ext) : fileName; return forEach(state.compilerOptions.moduleSuffixes, (suffix) => tryFileLookup(fileNameNoExtension + suffix + ext, onlyRecordFailures, state)); } function tryFileLookup(fileName, onlyRecordFailures, state) { + var _a; if (!onlyRecordFailures) { if (state.host.fileExists(fileName)) { if (state.traceEnabled) { @@ -40064,7 +40185,7 @@ ${lanes.join("\n")} } } } - state.failedLookupLocations.push(fileName); + (_a = state.failedLookupLocations) == null ? void 0 : _a.push(fileName); return void 0; } function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) { @@ -40138,18 +40259,18 @@ ${lanes.join("\n")} } return entrypoints; function loadEntrypointsFromTargetExports(target) { - var _a2, _b; + var _a, _b; if (typeof target === "string" && startsWith(target, "./") && target.indexOf("*") === -1) { const partsAfterFirst = getPathComponents(target).slice(2); if (partsAfterFirst.indexOf("..") >= 0 || partsAfterFirst.indexOf(".") >= 0 || partsAfterFirst.indexOf("node_modules") >= 0) { return false; } const resolvedTarget = combinePaths(scope.packageDirectory, target); - const finalPath = getNormalizedAbsolutePath(resolvedTarget, (_b = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a2)); + const finalPath = getNormalizedAbsolutePath(resolvedTarget, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a)); const result = loadFileNameFromPackageJsonField( extensions, finalPath, - /*recordOnlyFailures*/ + /*onlyRecordFailures*/ false, state ); @@ -40179,8 +40300,8 @@ ${lanes.join("\n")} host, compilerOptions: options, traceEnabled: isTraceEnabled(options, host), - failedLookupLocations: noopPush, - affectingLocations: noopPush, + failedLookupLocations: void 0, + affectingLocations: void 0, packageJsonInfoCache, features: 0 /* None */, conditions: emptyArray, @@ -40214,24 +40335,24 @@ ${lanes.join("\n")} return packageJsonInfo.contents.versionPaths || void 0; } function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) { - var _a2, _b, _c; + var _a, _b, _c, _d, _e, _f, _g, _h; const { host, traceEnabled } = state; const packageJsonPath = combinePaths(packageDirectory, "package.json"); if (onlyRecordFailures) { - state.failedLookupLocations.push(packageJsonPath); + (_a = state.failedLookupLocations) == null ? void 0 : _a.push(packageJsonPath); return void 0; } - const existing = (_a2 = state.packageJsonInfoCache) == null ? void 0 : _a2.getPackageJsonInfo(packageJsonPath); + const existing = (_b = state.packageJsonInfoCache) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath); if (existing !== void 0) { if (typeof existing !== "boolean") { if (traceEnabled) trace(host, Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath); - state.affectingLocations.push(packageJsonPath); + (_c = state.affectingLocations) == null ? void 0 : _c.push(packageJsonPath); return existing.packageDirectory === packageDirectory ? existing : { packageDirectory, contents: existing.contents }; } else { if (existing && traceEnabled) trace(host, Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups, packageJsonPath); - state.failedLookupLocations.push(packageJsonPath); + (_d = state.failedLookupLocations) == null ? void 0 : _d.push(packageJsonPath); return void 0; } } @@ -40242,15 +40363,15 @@ ${lanes.join("\n")} trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath); } const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } }; - (_b = state.packageJsonInfoCache) == null ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result); - state.affectingLocations.push(packageJsonPath); + (_e = state.packageJsonInfoCache) == null ? void 0 : _e.setPackageJsonInfo(packageJsonPath, result); + (_f = state.affectingLocations) == null ? void 0 : _f.push(packageJsonPath); return result; } else { if (directoryExists && traceEnabled) { trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath); } - (_c = state.packageJsonInfoCache) == null ? void 0 : _c.setPackageJsonInfo(packageJsonPath, directoryExists); - state.failedLookupLocations.push(packageJsonPath); + (_g = state.packageJsonInfoCache) == null ? void 0 : _g.setPackageJsonInfo(packageJsonPath, directoryExists); + (_h = state.failedLookupLocations) == null ? void 0 : _h.push(packageJsonPath); } } function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) { @@ -40348,8 +40469,8 @@ ${lanes.join("\n")} return !some(getOwnKeys(obj), (k) => startsWith(k, ".")); } function loadModuleFromSelfNameReference(extensions, moduleName, directory, state, cache, redirectedReference) { - var _a2, _b; - const directoryPath = getNormalizedAbsolutePath(combinePaths(directory, "dummy"), (_b = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a2)); + var _a, _b; + const directoryPath = getNormalizedAbsolutePath(combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a)); const scope = getPackageScopeForPath(directoryPath, state); if (!scope || !scope.contents.packageJsonContent.exports) { return void 0; @@ -40432,7 +40553,7 @@ ${lanes.join("\n")} ); } function loadModuleFromImports(extensions, moduleName, directory, state, cache, redirectedReference) { - var _a2, _b; + var _a, _b; if (moduleName === "#" || startsWith(moduleName, "#/")) { if (state.traceEnabled) { trace(state.host, Diagnostics.Invalid_import_specifier_0_has_no_possible_resolutions, moduleName); @@ -40442,7 +40563,7 @@ ${lanes.join("\n")} void 0 ); } - const directoryPath = getNormalizedAbsolutePath(combinePaths(directory, "dummy"), (_b = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a2)); + const directoryPath = getNormalizedAbsolutePath(combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a)); const scope = getPackageScopeForPath(directoryPath, state); if (!scope) { if (state.traceEnabled) { @@ -40703,10 +40824,10 @@ ${lanes.join("\n")} void 0 ); function toAbsolutePath(path) { - var _a2, _b; + var _a, _b; if (path === void 0) return path; - return getNormalizedAbsolutePath(path, (_b = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a2)); + return getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a)); } function combineDirectoryPath(root, dir) { return ensureTrailingDirectorySeparator(combinePaths(root, dir)); @@ -40715,12 +40836,12 @@ ${lanes.join("\n")} return !state.host.useCaseSensitiveFileNames ? true : typeof state.host.useCaseSensitiveFileNames === "boolean" ? state.host.useCaseSensitiveFileNames : state.host.useCaseSensitiveFileNames(); } function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports2) { - var _a2, _b, _c, _d; + var _a, _b, _c, _d; if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && finalPath.indexOf("/node_modules/") === -1 && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames()) : true)) { const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames }); const commonSourceDirGuesses = []; if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) { - const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((_b = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a2)) || "", getCanonicalFileName)); + const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a)) || "", getCanonicalFileName)); commonSourceDirGuesses.push(commonDir); } else if (state.requestContainingDirectory) { const requestingFile = toAbsolutePath(combinePaths(state.requestContainingDirectory, "index.ts")); @@ -40775,8 +40896,8 @@ ${lanes.join("\n")} } return void 0; function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) { - var _a3, _b2; - const currentDir = state.compilerOptions.configFile ? ((_b2 = (_a3 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a3)) || "" : commonSourceDirGuess; + var _a2, _b2; + const currentDir = state.compilerOptions.configFile ? ((_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2)) || "" : commonSourceDirGuess; const candidateDirectories = []; if (state.compilerOptions.declarationDir) { candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir))); @@ -40874,13 +40995,13 @@ ${lanes.join("\n")} } } function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) { - var _a2, _b, _c; + var _a, _b; const candidate = normalizePath(combinePaths(nodeModulesDirectory, moduleName)); const { packageName, rest } = parsePackageName(moduleName); const packageDirectory = combinePaths(nodeModulesDirectory, packageName); let rootPackageInfo; let packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); - if (rest !== "" && packageInfo && (!(state.features & 8 /* Exports */) || !hasProperty((_b = (_a2 = rootPackageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state)) == null ? void 0 : _a2.contents.packageJsonContent) != null ? _b : emptyArray, "exports"))) { + if (rest !== "" && packageInfo && (!(state.features & 8 /* Exports */) || !hasProperty(((_a = rootPackageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state)) == null ? void 0 : _a.contents.packageJsonContent) ?? emptyArray, "exports"))) { const fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state); if (fromFile) { return noPackageId(fromFile); @@ -40896,7 +41017,7 @@ ${lanes.join("\n")} return withPackageId(packageInfo, fromDirectory); } const loader = (extensions2, candidate2, onlyRecordFailures, state2) => { - let pathAndExtension = loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker( + let pathAndExtension = (rest || !(state2.features & 32 /* EsmMode */)) && loadModuleFromFile(extensions2, candidate2, onlyRecordFailures, state2) || loadNodeModuleFromDirectoryWorker( extensions2, candidate2, onlyRecordFailures, @@ -40910,10 +41031,10 @@ ${lanes.join("\n")} return withPackageId(packageInfo, pathAndExtension); }; if (rest !== "") { - packageInfo = rootPackageInfo != null ? rootPackageInfo : getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); + packageInfo = rootPackageInfo ?? getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); } if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & 8 /* Exports */) { - return (_c = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _c.value; + return (_b = loadModuleFromExports(packageInfo, extensions, combinePaths(".", rest), state, cache, redirectedReference)) == null ? void 0 : _b.value; } const versionPaths = rest !== "" && packageInfo ? getVersionPathsOfPackageJsonInfo(packageInfo, state) : void 0; if (versionPaths) { @@ -41070,11 +41191,13 @@ ${lanes.join("\n")} state )); }); - if (resolved2) { + if (resolved2) return resolved2; - } if (extensions & (1 /* TypeScript */ | 4 /* Declaration */)) { - return loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state); + let resolved3 = loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state); + if (extensions & 4 /* Declaration */) + resolved3 ?? (resolved3 = resolveFromTypeRoot(moduleName, state)); + return resolved3; } } else { const candidate = normalizePath(combinePaths(containingDirectory, moduleName)); @@ -41088,6 +41211,31 @@ ${lanes.join("\n")} } } } + function resolveFromTypeRoot(moduleName, state) { + if (!state.compilerOptions.typeRoots) + return; + for (const typeRoot of state.compilerOptions.typeRoots) { + const candidate = getCandidateFromTypeRoot(typeRoot, moduleName, state); + const directoryExists = directoryProbablyExists(typeRoot, state.host); + if (!directoryExists && state.traceEnabled) { + trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot); + } + const resolvedFromFile = loadModuleFromFile(4 /* Declaration */, candidate, !directoryExists, state); + if (resolvedFromFile) { + const packageDirectory = parseNodeModuleFromPath(resolvedFromFile.path); + const packageInfo = packageDirectory ? getPackageJsonInfo( + packageDirectory, + /*onlyRecordFailures*/ + false, + state + ) : void 0; + return toSearchResult(withPackageId(packageInfo, resolvedFromFile)); + } + const resolved = loadNodeModuleFromDirectory(4 /* Declaration */, candidate, !directoryExists, state); + if (resolved) + return toSearchResult(resolved); + } + } function shouldAllowImportingTsExtension(compilerOptions, fromFileName) { return !!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName); } @@ -41191,23 +41339,23 @@ ${lanes.join("\n")} } function getModuleInstanceStateWorker(node, visited) { switch (node.kind) { - case 261 /* InterfaceDeclaration */: - case 262 /* TypeAliasDeclaration */: + case 263 /* InterfaceDeclaration */: + case 264 /* TypeAliasDeclaration */: return 0 /* NonInstantiated */; - case 263 /* EnumDeclaration */: + case 265 /* EnumDeclaration */: if (isEnumConst(node)) { return 2 /* ConstEnumOnly */; } break; - case 269 /* ImportDeclaration */: - case 268 /* ImportEqualsDeclaration */: + case 271 /* ImportDeclaration */: + case 270 /* ImportEqualsDeclaration */: if (!hasSyntacticModifier(node, 1 /* Export */)) { return 0 /* NonInstantiated */; } break; - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: const exportDeclaration = node; - if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 276 /* NamedExports */) { + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 278 /* NamedExports */) { let state = 0 /* NonInstantiated */; for (const specifier of exportDeclaration.exportClause.elements) { const specifierState = getModuleInstanceStateForAliasTarget(specifier, visited); @@ -41221,7 +41369,7 @@ ${lanes.join("\n")} return state; } break; - case 265 /* ModuleBlock */: { + case 267 /* ModuleBlock */: { let state = 0 /* NonInstantiated */; forEachChild(node, (n) => { const childState = getModuleInstanceStateCached(n, visited); @@ -41240,9 +41388,9 @@ ${lanes.join("\n")} }); return state; } - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: return getModuleInstanceState(node, visited); - case 79 /* Identifier */: + case 80 /* Identifier */: if (node.flags & 2048 /* IdentifierIsInJSDocNamespace */) { return 0 /* NonInstantiated */; } @@ -41288,10 +41436,11 @@ ${lanes.join("\n")} return node; } function bindSourceFile(file, options) { + var _a, _b; mark("beforeBind"); - perfLogger.logStartBindFile("" + file.fileName); + (_a = perfLogger) == null ? void 0 : _a.logStartBindFile("" + file.fileName); binder(file, options); - perfLogger.logStopBindFile(); + (_b = perfLogger) == null ? void 0 : _b.logStopBindFile(); mark("afterBind"); measure("Bind", "beforeBind", "afterBind"); } @@ -41320,28 +41469,28 @@ ${lanes.join("\n")} var inStrictMode; var inAssignmentPattern = false; var symbolCount = 0; - var Symbol46; + var Symbol47; var classifiableNames; var unreachableFlow = { flags: 1 /* Unreachable */ }; var reportedUnreachableFlow = { flags: 1 /* Unreachable */ }; var bindBinaryExpressionFlow = createBindBinaryExpressionFlow(); return bindSourceFile2; - function createDiagnosticForNode2(node, message, arg0, arg1, arg2) { - return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, arg0, arg1, arg2); + function createDiagnosticForNode2(node, message, ...args) { + return createDiagnosticForNodeInSourceFile(getSourceFileOfNode(node) || file, node, message, ...args); } function bindSourceFile2(f, opts) { - var _a2, _b; + var _a, _b; file = f; options = opts; languageVersion = getEmitScriptTarget(options); inStrictMode = bindInStrictMode(file, opts); classifiableNames = /* @__PURE__ */ new Set(); symbolCount = 0; - Symbol46 = objectAllocator.getSymbolConstructor(); + Symbol47 = objectAllocator.getSymbolConstructor(); Debug.attachFlowNodeDebugInfo(unreachableFlow); Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow); if (!file.locals) { - (_a2 = tracing) == null ? void 0 : _a2.push( + (_a = tracing) == null ? void 0 : _a.push( tracing.Phase.Bind, "bindSourceFile", { path: file.path }, @@ -41385,7 +41534,7 @@ ${lanes.join("\n")} } function createSymbol(flags, name) { symbolCount++; - return new Symbol46(flags, name); + return new Symbol47(flags, name); } function addDeclarationToSymbol(symbol, node, symbolFlags) { symbol.flags |= symbolFlags; @@ -41405,7 +41554,7 @@ ${lanes.join("\n")} } } function getDeclarationName(node) { - if (node.kind === 274 /* ExportAssignment */) { + if (node.kind === 276 /* ExportAssignment */) { return node.isExportEquals ? "export=" /* ExportEquals */ : "default" /* Default */; } const name = getNameOfDeclaration(node); @@ -41414,7 +41563,7 @@ ${lanes.join("\n")} const moduleName = getTextOfIdentifierOrLiteral(name); return isGlobalScopeAugmentation(node) ? "__global" : `"${moduleName}"`; } - if (name.kind === 164 /* ComputedPropertyName */) { + if (name.kind === 166 /* ComputedPropertyName */) { const nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return escapeLeadingUnderscores(nameExpression.text); @@ -41433,34 +41582,37 @@ ${lanes.join("\n")} const containingClassSymbol = containingClass.symbol; return getSymbolNameForPrivateIdentifier(containingClassSymbol, name.escapedText); } + if (isJsxNamespacedName(name)) { + return getEscapedTextOfJsxNamespacedName(name); + } return isPropertyNameLiteral(name) ? getEscapedTextOfIdentifierOrLiteral(name) : void 0; } switch (node.kind) { - case 173 /* Constructor */: + case 175 /* Constructor */: return "__constructor" /* Constructor */; - case 181 /* FunctionType */: - case 176 /* CallSignature */: - case 326 /* JSDocSignature */: + case 183 /* FunctionType */: + case 178 /* CallSignature */: + case 329 /* JSDocSignature */: return "__call" /* Call */; - case 182 /* ConstructorType */: - case 177 /* ConstructSignature */: + case 184 /* ConstructorType */: + case 179 /* ConstructSignature */: return "__new" /* New */; - case 178 /* IndexSignature */: + case 180 /* IndexSignature */: return "__index" /* Index */; - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: return "__export" /* ExportStar */; - case 308 /* SourceFile */: + case 311 /* SourceFile */: return "export=" /* ExportEquals */; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: if (getAssignmentDeclarationKind(node) === 2 /* ModuleExports */) { return "export=" /* ExportEquals */; } Debug.fail("Unknown binary declaration kind"); break; - case 320 /* JSDocFunctionType */: + case 323 /* JSDocFunctionType */: return isJSDocConstructSignature(node) ? "__new" /* New */ : "__call" /* Call */; - case 166 /* Parameter */: - Debug.assert(node.parent.kind === 320 /* JSDocFunctionType */, "Impossible parameter parent kind", () => `parent is: ${Debug.formatSyntaxKind(node.parent.kind)}, expected JSDocFunctionType`); + case 168 /* Parameter */: + Debug.assert(node.parent.kind === 323 /* JSDocFunctionType */, "Impossible parameter parent kind", () => `parent is: ${Debug.formatSyntaxKind(node.parent.kind)}, expected JSDocFunctionType`); const functionType = node.parent; const index = functionType.parameters.indexOf(node); return "arg" + index; @@ -41507,7 +41659,7 @@ ${lanes.join("\n")} messageNeedsName = false; multipleDefaultExports = true; } else { - if (symbol.declarations && symbol.declarations.length && (node.kind === 274 /* ExportAssignment */ && !node.isExportEquals)) { + if (symbol.declarations && symbol.declarations.length && (node.kind === 276 /* ExportAssignment */ && !node.isExportEquals)) { message = Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName = false; multipleDefaultExports = true; @@ -41521,7 +41673,7 @@ ${lanes.join("\n")} const declarationName = getNameOfDeclaration(node) || node; forEach(symbol.declarations, (declaration, index) => { const decl = getNameOfDeclaration(declaration) || declaration; - const diag3 = createDiagnosticForNode2(decl, message, messageNeedsName ? getDisplayName(declaration) : void 0); + const diag3 = messageNeedsName ? createDiagnosticForNode2(decl, message, getDisplayName(declaration)) : createDiagnosticForNode2(decl, message); file.bindDiagnostics.push( multipleDefaultExports ? addRelatedInfo(diag3, createDiagnosticForNode2(declarationName, index === 0 ? Diagnostics.Another_export_default_is_here : Diagnostics.and_here)) : diag3 ); @@ -41529,7 +41681,7 @@ ${lanes.join("\n")} relatedInformation.push(createDiagnosticForNode2(decl, Diagnostics.The_first_export_default_is_here)); } }); - const diag2 = createDiagnosticForNode2(declarationName, message, messageNeedsName ? getDisplayName(node) : void 0); + const diag2 = messageNeedsName ? createDiagnosticForNode2(declarationName, message, getDisplayName(node)) : createDiagnosticForNode2(declarationName, message); file.bindDiagnostics.push(addRelatedInfo(diag2, ...relatedInformation)); symbol = createSymbol(0 /* None */, name); } @@ -41546,7 +41698,7 @@ ${lanes.join("\n")} function declareModuleMember(node, symbolFlags, symbolExcludes) { const hasExportModifier = !!(getCombinedModifierFlags(node) & 1 /* Export */) || jsdocTreatAsExported(node); if (symbolFlags & 2097152 /* Alias */) { - if (node.kind === 278 /* ExportSpecifier */ || node.kind === 268 /* ImportEqualsDeclaration */ && hasExportModifier) { + if (node.kind === 280 /* ExportSpecifier */ || node.kind === 270 /* ImportEqualsDeclaration */ && hasExportModifier) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { Debug.assertNode(container, canHaveLocals); @@ -41613,7 +41765,7 @@ ${lanes.join("\n")} const saveThisParentContainer = thisParentContainer; const savedBlockScopeContainer = blockScopeContainer; if (containerFlags & 1 /* IsContainer */) { - if (node.kind !== 216 /* ArrowFunction */) { + if (node.kind !== 218 /* ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -41635,14 +41787,14 @@ ${lanes.join("\n")} const saveExceptionTarget = currentExceptionTarget; const saveActiveLabelList = activeLabelList; const saveHasExplicitReturn = hasExplicitReturn; - const isImmediatelyInvoked = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node, 512 /* Async */) && !node.asteriskToken && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 172 /* ClassStaticBlockDeclaration */; + const isImmediatelyInvoked = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node, 512 /* Async */) && !node.asteriskToken && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 174 /* ClassStaticBlockDeclaration */; if (!isImmediatelyInvoked) { currentFlow = initFlowNode({ flags: 2 /* Start */ }); if (containerFlags & (16 /* IsFunctionExpression */ | 128 /* IsObjectLiteralOrClassExpressionMethodOrAccessor */)) { currentFlow.node = node; } } - currentReturnTarget = isImmediatelyInvoked || node.kind === 173 /* Constructor */ || isInJSFile(node) && (node.kind === 259 /* FunctionDeclaration */ || node.kind === 215 /* FunctionExpression */) ? createBranchLabel() : void 0; + currentReturnTarget = isImmediatelyInvoked || node.kind === 175 /* Constructor */ || isInJSFile(node) && (node.kind === 261 /* FunctionDeclaration */ || node.kind === 217 /* FunctionExpression */) ? createBranchLabel() : void 0; currentExceptionTarget = void 0; currentBreakTarget = void 0; currentContinueTarget = void 0; @@ -41656,14 +41808,14 @@ ${lanes.join("\n")} node.flags |= 512 /* HasExplicitReturn */; node.endFlowNode = currentFlow; } - if (node.kind === 308 /* SourceFile */) { + if (node.kind === 311 /* SourceFile */) { node.flags |= emitFlags; node.endFlowNode = currentFlow; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 173 /* Constructor */ || node.kind === 172 /* ClassStaticBlockDeclaration */ || isInJSFile(node) && (node.kind === 259 /* FunctionDeclaration */ || node.kind === 215 /* FunctionExpression */)) { + if (node.kind === 175 /* Constructor */ || node.kind === 174 /* ClassStaticBlockDeclaration */ || isInJSFile(node) && (node.kind === 261 /* FunctionDeclaration */ || node.kind === 217 /* FunctionExpression */)) { node.returnFlowNode = currentFlow; } } @@ -41689,8 +41841,8 @@ ${lanes.join("\n")} blockScopeContainer = savedBlockScopeContainer; } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, (n) => n.kind === 259 /* FunctionDeclaration */ ? bind(n) : void 0); - bindEach(nodes, (n) => n.kind !== 259 /* FunctionDeclaration */ ? bind(n) : void 0); + bindEach(nodes, (n) => n.kind === 261 /* FunctionDeclaration */ ? bind(n) : void 0); + bindEach(nodes, (n) => n.kind !== 261 /* FunctionDeclaration */ ? bind(n) : void 0); } function bindEach(nodes, bindFunction = bind) { if (nodes === void 0) { @@ -41710,59 +41862,59 @@ ${lanes.join("\n")} inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 240 /* FirstStatement */ && node.kind <= 256 /* LastStatement */ && !options.allowUnreachableCode) { + if (node.kind >= 242 /* FirstStatement */ && node.kind <= 258 /* LastStatement */ && !options.allowUnreachableCode) { node.flowNode = currentFlow; } switch (node.kind) { - case 244 /* WhileStatement */: + case 246 /* WhileStatement */: bindWhileStatement(node); break; - case 243 /* DoStatement */: + case 245 /* DoStatement */: bindDoStatement(node); break; - case 245 /* ForStatement */: + case 247 /* ForStatement */: bindForStatement(node); break; - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: bindForInOrForOfStatement(node); break; - case 242 /* IfStatement */: + case 244 /* IfStatement */: bindIfStatement(node); break; - case 250 /* ReturnStatement */: - case 254 /* ThrowStatement */: + case 252 /* ReturnStatement */: + case 256 /* ThrowStatement */: bindReturnOrThrow(node); break; - case 249 /* BreakStatement */: - case 248 /* ContinueStatement */: + case 251 /* BreakStatement */: + case 250 /* ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 255 /* TryStatement */: + case 257 /* TryStatement */: bindTryStatement(node); break; - case 252 /* SwitchStatement */: + case 254 /* SwitchStatement */: bindSwitchStatement(node); break; - case 266 /* CaseBlock */: + case 268 /* CaseBlock */: bindCaseBlock(node); break; - case 292 /* CaseClause */: + case 295 /* CaseClause */: bindCaseClause(node); break; - case 241 /* ExpressionStatement */: + case 243 /* ExpressionStatement */: bindExpressionStatement(node); break; - case 253 /* LabeledStatement */: + case 255 /* LabeledStatement */: bindLabeledStatement(node); break; - case 221 /* PrefixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 222 /* PostfixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: if (isDestructuringAssignment(node)) { inAssignmentPattern = saveInAssignmentPattern; bindDestructuringAssignmentFlow(node); @@ -41770,49 +41922,49 @@ ${lanes.join("\n")} } bindBinaryExpressionFlow(node); break; - case 217 /* DeleteExpression */: + case 219 /* DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 224 /* ConditionalExpression */: + case 226 /* ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: bindAccessExpressionFlow(node); break; - case 210 /* CallExpression */: + case 212 /* CallExpression */: bindCallExpressionFlow(node); break; - case 232 /* NonNullExpression */: + case 234 /* NonNullExpression */: bindNonNullExpressionFlow(node); break; - case 349 /* JSDocTypedefTag */: - case 341 /* JSDocCallbackTag */: - case 343 /* JSDocEnumTag */: + case 352 /* JSDocTypedefTag */: + case 344 /* JSDocCallbackTag */: + case 346 /* JSDocEnumTag */: bindJSDocTypeAlias(node); break; - case 308 /* SourceFile */: { + case 311 /* SourceFile */: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 238 /* Block */: - case 265 /* ModuleBlock */: + case 240 /* Block */: + case 267 /* ModuleBlock */: bindEachFunctionsFirst(node.statements); break; - case 205 /* BindingElement */: + case 207 /* BindingElement */: bindBindingElementFlow(node); break; - case 166 /* Parameter */: + case 168 /* Parameter */: bindParameterFlow(node); break; - case 207 /* ObjectLiteralExpression */: - case 206 /* ArrayLiteralExpression */: - case 299 /* PropertyAssignment */: - case 227 /* SpreadElement */: + case 209 /* ObjectLiteralExpression */: + case 208 /* ArrayLiteralExpression */: + case 302 /* PropertyAssignment */: + case 229 /* SpreadElement */: inAssignmentPattern = saveInAssignmentPattern; default: bindEachChild(node); @@ -41823,28 +41975,28 @@ ${lanes.join("\n")} } function isNarrowingExpression(expr) { switch (expr.kind) { - case 79 /* Identifier */: - case 80 /* PrivateIdentifier */: - case 108 /* ThisKeyword */: - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 80 /* Identifier */: + case 81 /* PrivateIdentifier */: + case 110 /* ThisKeyword */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: return containsNarrowableReference(expr); - case 210 /* CallExpression */: + case 212 /* CallExpression */: return hasNarrowableArgument(expr); - case 214 /* ParenthesizedExpression */: - case 232 /* NonNullExpression */: + case 216 /* ParenthesizedExpression */: + case 234 /* NonNullExpression */: return isNarrowingExpression(expr.expression); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 221 /* PrefixUnaryExpression */: - return expr.operator === 53 /* ExclamationToken */ && isNarrowingExpression(expr.operand); - case 218 /* TypeOfExpression */: + case 223 /* PrefixUnaryExpression */: + return expr.operator === 54 /* ExclamationToken */ && isNarrowingExpression(expr.operand); + case 220 /* TypeOfExpression */: return isNarrowingExpression(expr.expression); } return false; } function isNarrowableReference(expr) { - return isDottedName(expr) || (isPropertyAccessExpression(expr) || isNonNullExpression(expr) || isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression) || isBinaryExpression(expr) && expr.operatorToken.kind === 27 /* CommaToken */ && isNarrowableReference(expr.right) || isElementAccessExpression(expr) && (isStringOrNumericLiteralLike(expr.argumentExpression) || isEntityNameExpression(expr.argumentExpression)) && isNarrowableReference(expr.expression) || isAssignmentExpression(expr) && isNarrowableReference(expr.left); + return isDottedName(expr) || (isPropertyAccessExpression(expr) || isNonNullExpression(expr) || isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression) || isBinaryExpression(expr) && expr.operatorToken.kind === 28 /* CommaToken */ && isNarrowableReference(expr.right) || isElementAccessExpression(expr) && (isStringOrNumericLiteralLike(expr.argumentExpression) || isEntityNameExpression(expr.argumentExpression)) && isNarrowableReference(expr.expression) || isAssignmentExpression(expr) && isNarrowableReference(expr.left); } function containsNarrowableReference(expr) { return isNarrowableReference(expr) || isOptionalChain(expr) && containsNarrowableReference(expr.expression); @@ -41857,7 +42009,7 @@ ${lanes.join("\n")} } } } - if (expr.expression.kind === 208 /* PropertyAccessExpression */ && containsNarrowableReference(expr.expression.expression)) { + if (expr.expression.kind === 210 /* PropertyAccessExpression */ && containsNarrowableReference(expr.expression.expression)) { return true; } return false; @@ -41867,34 +42019,34 @@ ${lanes.join("\n")} } function isNarrowingBinaryExpression(expr) { switch (expr.operatorToken.kind) { - case 63 /* EqualsToken */: - case 75 /* BarBarEqualsToken */: - case 76 /* AmpersandAmpersandEqualsToken */: - case 77 /* QuestionQuestionEqualsToken */: + case 64 /* EqualsToken */: + case 76 /* BarBarEqualsToken */: + case 77 /* AmpersandAmpersandEqualsToken */: + case 78 /* QuestionQuestionEqualsToken */: return containsNarrowableReference(expr.left); - case 34 /* EqualsEqualsToken */: - case 35 /* ExclamationEqualsToken */: - case 36 /* EqualsEqualsEqualsToken */: - case 37 /* ExclamationEqualsEqualsToken */: + case 35 /* EqualsEqualsToken */: + case 36 /* ExclamationEqualsToken */: + case 37 /* EqualsEqualsEqualsToken */: + case 38 /* ExclamationEqualsEqualsToken */: return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right); - case 102 /* InstanceOfKeyword */: + case 104 /* InstanceOfKeyword */: return isNarrowableOperand(expr.left); - case 101 /* InKeyword */: + case 103 /* InKeyword */: return isNarrowingExpression(expr.right); - case 27 /* CommaToken */: + case 28 /* CommaToken */: return isNarrowingExpression(expr.right); } return false; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: switch (expr.operatorToken.kind) { - case 63 /* EqualsToken */: + case 64 /* EqualsToken */: return isNarrowableOperand(expr.left); - case 27 /* CommaToken */: + case 28 /* CommaToken */: return isNarrowableOperand(expr.right); } } @@ -41925,7 +42077,7 @@ ${lanes.join("\n")} if (!expression) { return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow; } - if ((expression.kind === 110 /* TrueKeyword */ && flags & 64 /* FalseCondition */ || expression.kind === 95 /* FalseKeyword */ && flags & 32 /* TrueCondition */) && !isExpressionOfOptionalChainRoot(expression) && !isNullishCoalesce(expression.parent)) { + if ((expression.kind === 112 /* TrueKeyword */ && flags & 64 /* FalseCondition */ || expression.kind === 97 /* FalseKeyword */ && flags & 32 /* TrueCondition */) && !isExpressionOfOptionalChainRoot(expression) && !isNullishCoalesce(expression.parent)) { return unreachableFlow; } if (!isNarrowingExpression(expression)) { @@ -41963,21 +42115,21 @@ ${lanes.join("\n")} function isStatementCondition(node) { const parent3 = node.parent; switch (parent3.kind) { - case 242 /* IfStatement */: - case 244 /* WhileStatement */: - case 243 /* DoStatement */: + case 244 /* IfStatement */: + case 246 /* WhileStatement */: + case 245 /* DoStatement */: return parent3.expression === node; - case 245 /* ForStatement */: - case 224 /* ConditionalExpression */: + case 247 /* ForStatement */: + case 226 /* ConditionalExpression */: return parent3.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 214 /* ParenthesizedExpression */) { + if (node.kind === 216 /* ParenthesizedExpression */) { node = node.expression; - } else if (node.kind === 221 /* PrefixUnaryExpression */ && node.operator === 53 /* ExclamationToken */) { + } else if (node.kind === 223 /* PrefixUnaryExpression */ && node.operator === 54 /* ExclamationToken */) { node = node.operand; } else { return isLogicalOrCoalescingBinaryExpression(node); @@ -41988,7 +42140,7 @@ ${lanes.join("\n")} return isLogicalOrCoalescingAssignmentExpression(skipParentheses(node)); } function isTopLevelLogicalExpression(node) { - while (isParenthesizedExpression(node.parent) || isPrefixUnaryExpression(node.parent) && node.parent.operator === 53 /* ExclamationToken */) { + while (isParenthesizedExpression(node.parent) || isPrefixUnaryExpression(node.parent) && node.parent.operator === 54 /* ExclamationToken */) { node = node.parent; } return !isStatementCondition(node) && !isLogicalExpression(node.parent) && !(isOptionalChain(node.parent) && node.parent.expression === node); @@ -42020,7 +42172,7 @@ ${lanes.join("\n")} } function setContinueTarget(node, target) { let label = activeLabelList; - while (label && node.parent.kind === 253 /* LabeledStatement */) { + while (label && node.parent.kind === 255 /* LabeledStatement */) { label.continueTarget = target; label = label.next; node = node.parent; @@ -42071,12 +42223,12 @@ ${lanes.join("\n")} bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 247 /* ForOfStatement */) { + if (node.kind === 249 /* ForOfStatement */) { bind(node.awaitModifier); } addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 258 /* VariableDeclarationList */) { + if (node.initializer.kind !== 260 /* VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -42098,7 +42250,7 @@ ${lanes.join("\n")} } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 250 /* ReturnStatement */) { + if (node.kind === 252 /* ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -42115,7 +42267,7 @@ ${lanes.join("\n")} return void 0; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - const flowLabel = node.kind === 249 /* BreakStatement */ ? breakTarget : continueTarget; + const flowLabel = node.kind === 251 /* BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -42185,7 +42337,7 @@ ${lanes.join("\n")} preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - const hasDefault = forEach(node.caseBlock.clauses, (c) => c.kind === 293 /* DefaultClause */); + const hasDefault = forEach(node.caseBlock.clauses, (c) => c.kind === 296 /* DefaultClause */); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -42228,9 +42380,9 @@ ${lanes.join("\n")} maybeBindExpressionFlowIfCall(node.expression); } function maybeBindExpressionFlowIfCall(node) { - if (node.kind === 210 /* CallExpression */) { + if (node.kind === 212 /* CallExpression */) { const call = node; - if (call.expression.kind !== 106 /* SuperKeyword */ && isDottedName(call.expression)) { + if (call.expression.kind !== 108 /* SuperKeyword */ && isDottedName(call.expression)) { currentFlow = createFlowCall(currentFlow, call); } } @@ -42254,7 +42406,7 @@ ${lanes.join("\n")} currentFlow = finishFlowLabel(postStatementLabel); } function bindDestructuringTargetFlow(node) { - if (node.kind === 223 /* BinaryExpression */ && node.operatorToken.kind === 63 /* EqualsToken */) { + if (node.kind === 225 /* BinaryExpression */ && node.operatorToken.kind === 64 /* EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { bindAssignmentTargetFlow(node); @@ -42263,21 +42415,21 @@ ${lanes.join("\n")} function bindAssignmentTargetFlow(node) { if (isNarrowableReference(node)) { currentFlow = createFlowMutation(16 /* Assignment */, currentFlow, node); - } else if (node.kind === 206 /* ArrayLiteralExpression */) { + } else if (node.kind === 208 /* ArrayLiteralExpression */) { for (const e of node.elements) { - if (e.kind === 227 /* SpreadElement */) { + if (e.kind === 229 /* SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { bindDestructuringTargetFlow(e); } } - } else if (node.kind === 207 /* ObjectLiteralExpression */) { + } else if (node.kind === 209 /* ObjectLiteralExpression */) { for (const p of node.properties) { - if (p.kind === 299 /* PropertyAssignment */) { + if (p.kind === 302 /* PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); - } else if (p.kind === 300 /* ShorthandPropertyAssignment */) { + } else if (p.kind === 303 /* ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); - } else if (p.kind === 301 /* SpreadAssignment */) { + } else if (p.kind === 304 /* SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -42285,7 +42437,7 @@ ${lanes.join("\n")} } function bindLogicalLikeExpression(node, trueTarget, falseTarget) { const preRightLabel = createBranchLabel(); - if (node.operatorToken.kind === 55 /* AmpersandAmpersandToken */ || node.operatorToken.kind === 76 /* AmpersandAmpersandEqualsToken */) { + if (node.operatorToken.kind === 56 /* AmpersandAmpersandToken */ || node.operatorToken.kind === 77 /* AmpersandAmpersandEqualsToken */) { bindCondition(node.left, preRightLabel, falseTarget); } else { bindCondition(node.left, trueTarget, preRightLabel); @@ -42302,7 +42454,7 @@ ${lanes.join("\n")} } } function bindPrefixUnaryExpressionFlow(node) { - if (node.operator === 53 /* ExclamationToken */) { + if (node.operator === 54 /* ExclamationToken */) { const saveTrueTarget = currentTrueTarget; currentTrueTarget = currentFalseTarget; currentFalseTarget = saveTrueTarget; @@ -42311,14 +42463,14 @@ ${lanes.join("\n")} currentTrueTarget = saveTrueTarget; } else { bindEachChild(node); - if (node.operator === 45 /* PlusPlusToken */ || node.operator === 46 /* MinusMinusToken */) { + if (node.operator === 46 /* PlusPlusToken */ || node.operator === 47 /* MinusMinusToken */) { bindAssignmentTargetFlow(node.operand); } } } function bindPostfixUnaryExpressionFlow(node) { bindEachChild(node); - if (node.operator === 45 /* PlusPlusToken */ || node.operator === 46 /* MinusMinusToken */) { + if (node.operator === 46 /* PlusPlusToken */ || node.operator === 47 /* MinusMinusToken */) { bindAssignmentTargetFlow(node.operand); } } @@ -42383,7 +42535,7 @@ ${lanes.join("\n")} function onLeft(left, state, node) { if (!state.skip) { const maybeBound = maybeBind2(left); - if (node.operatorToken.kind === 27 /* CommaToken */) { + if (node.operatorToken.kind === 28 /* CommaToken */) { maybeBindExpressionFlowIfCall(left); } return maybeBound; @@ -42397,7 +42549,7 @@ ${lanes.join("\n")} function onRight(right, state, node) { if (!state.skip) { const maybeBound = maybeBind2(right); - if (node.operatorToken.kind === 27 /* CommaToken */) { + if (node.operatorToken.kind === 28 /* CommaToken */) { maybeBindExpressionFlowIfCall(right); } return maybeBound; @@ -42408,7 +42560,7 @@ ${lanes.join("\n")} const operator = node.operatorToken.kind; if (isAssignmentOperator(operator) && !isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 63 /* EqualsToken */ && node.left.kind === 209 /* ElementAccessExpression */) { + if (operator === 64 /* EqualsToken */ && node.left.kind === 211 /* ElementAccessExpression */) { const elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowMutation(256 /* ArrayMutation */, currentFlow, node); @@ -42436,7 +42588,7 @@ ${lanes.join("\n")} } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 208 /* PropertyAccessExpression */) { + if (node.expression.kind === 210 /* PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -42501,7 +42653,7 @@ ${lanes.join("\n")} } function bindJSDocTypeAlias(node) { bind(node.tagName); - if (node.kind !== 343 /* JSDocEnumTag */ && node.fullName) { + if (node.kind !== 346 /* JSDocEnumTag */ && node.fullName) { setParent(node.fullName, node); setParentRecursive( node.fullName, @@ -42516,7 +42668,7 @@ ${lanes.join("\n")} function bindJSDocClassTag(node) { bindEachChild(node); const host = getHostSignatureFromJSDoc(node); - if (host && host.kind !== 171 /* MethodDeclaration */) { + if (host && host.kind !== 173 /* MethodDeclaration */) { addDeclarationToSymbol(host.symbol, host, 32 /* Class */); } } @@ -42529,15 +42681,15 @@ ${lanes.join("\n")} } function bindOptionalChainRest(node) { switch (node.kind) { - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: bind(node.questionDotToken); bind(node.name); break; - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: bind(node.questionDotToken); bind(node.argumentExpression); break; - case 210 /* CallExpression */: + case 212 /* CallExpression */: bind(node.questionDotToken); bindEach(node.typeArguments); bindEach(node.arguments); @@ -42584,18 +42736,18 @@ ${lanes.join("\n")} bindOptionalChainFlow(node); } else { const expr = skipParentheses(node.expression); - if (expr.kind === 215 /* FunctionExpression */ || expr.kind === 216 /* ArrowFunction */) { + if (expr.kind === 217 /* FunctionExpression */ || expr.kind === 218 /* ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); } else { bindEachChild(node); - if (node.expression.kind === 106 /* SuperKeyword */) { + if (node.expression.kind === 108 /* SuperKeyword */) { currentFlow = createFlowCall(currentFlow, node); } } } - if (node.expression.kind === 208 /* PropertyAccessExpression */) { + if (node.expression.kind === 210 /* PropertyAccessExpression */) { const propertyAccess = node.expression; if (isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256 /* ArrayMutation */, currentFlow, node); @@ -42610,39 +42762,39 @@ ${lanes.join("\n")} } function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 308 /* SourceFile */: + case 311 /* SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 228 /* ClassExpression */: - case 260 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 262 /* ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 263 /* EnumDeclaration */: + case 265 /* EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 184 /* TypeLiteral */: - case 325 /* JSDocTypeLiteral */: - case 207 /* ObjectLiteralExpression */: - case 261 /* InterfaceDeclaration */: - case 289 /* JsxAttributes */: + case 186 /* TypeLiteral */: + case 328 /* JSDocTypeLiteral */: + case 209 /* ObjectLiteralExpression */: + case 263 /* InterfaceDeclaration */: + case 291 /* JsxAttributes */: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 181 /* FunctionType */: - case 182 /* ConstructorType */: - case 176 /* CallSignature */: - case 177 /* ConstructSignature */: - case 326 /* JSDocSignature */: - case 178 /* IndexSignature */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 320 /* JSDocFunctionType */: - case 172 /* ClassStaticBlockDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 197 /* MappedType */: + case 183 /* FunctionType */: + case 184 /* ConstructorType */: + case 178 /* CallSignature */: + case 179 /* ConstructSignature */: + case 329 /* JSDocSignature */: + case 180 /* IndexSignature */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 323 /* JSDocFunctionType */: + case 174 /* ClassStaticBlockDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 199 /* MappedType */: if (container.locals) Debug.assertNode(container, canHaveLocals); return declareSymbol( @@ -42689,7 +42841,7 @@ ${lanes.join("\n")} declareModuleSymbol(node); } else { let pattern; - if (node.name.kind === 10 /* StringLiteral */) { + if (node.name.kind === 11 /* StringLiteral */) { const { text } = node.name; pattern = tryParsePattern(text); if (pattern === void 0) { @@ -42744,10 +42896,10 @@ ${lanes.join("\n")} } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 308 /* SourceFile */: + case 311 /* SourceFile */: if (isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -42823,7 +42975,7 @@ ${lanes.join("\n")} } container = oldContainer; } - } else if (isJSDocEnumTag(typeAlias) || !typeAlias.fullName || typeAlias.fullName.kind === 79 /* Identifier */) { + } else if (isJSDocEnumTag(typeAlias) || !typeAlias.fullName || typeAlias.fullName.kind === 80 /* Identifier */) { parent2 = typeAlias.parent; bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */); } else { @@ -42842,13 +42994,13 @@ ${lanes.join("\n")} if (originalKeywordKind === void 0) { return; } - if (inStrictMode && originalKeywordKind >= 117 /* FirstFutureReservedWord */ && originalKeywordKind <= 125 /* LastFutureReservedWord */) { + if (inStrictMode && originalKeywordKind >= 119 /* FirstFutureReservedWord */ && originalKeywordKind <= 127 /* LastFutureReservedWord */) { file.bindDiagnostics.push(createDiagnosticForNode2( node, getStrictModeIdentifierMessage(node), declarationNameToString(node) )); - } else if (originalKeywordKind === 133 /* AwaitKeyword */) { + } else if (originalKeywordKind === 135 /* AwaitKeyword */) { if (isExternalModule(file) && isInTopLevelContext(node)) { file.bindDiagnostics.push(createDiagnosticForNode2( node, @@ -42862,7 +43014,7 @@ ${lanes.join("\n")} declarationNameToString(node) )); } - } else if (originalKeywordKind === 125 /* YieldKeyword */ && node.flags & 8192 /* YieldContext */) { + } else if (originalKeywordKind === 127 /* YieldKeyword */ && node.flags & 8192 /* YieldContext */) { file.bindDiagnostics.push(createDiagnosticForNode2( node, Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here, @@ -42902,7 +43054,7 @@ ${lanes.join("\n")} } } function checkStrictModeDeleteExpression(node) { - if (inStrictMode && node.expression.kind === 79 /* Identifier */) { + if (inStrictMode && node.expression.kind === 80 /* Identifier */) { const span = getErrorSpanForNode(file, node.expression); file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode)); } @@ -42911,7 +43063,7 @@ ${lanes.join("\n")} return isIdentifier(node) && (node.escapedText === "eval" || node.escapedText === "arguments"); } function checkStrictModeEvalOrArguments(contextNode, name) { - if (name && name.kind === 79 /* Identifier */) { + if (name && name.kind === 80 /* Identifier */) { const identifier = name; if (isEvalOrArgumentsIdentifier(identifier)) { const span = getErrorSpanForNode(file, name); @@ -42950,7 +43102,7 @@ ${lanes.join("\n")} } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ES2015 */) { - if (blockScopeContainer.kind !== 308 /* SourceFile */ && blockScopeContainer.kind !== 264 /* ModuleDeclaration */ && !isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { + if (blockScopeContainer.kind !== 311 /* SourceFile */ && blockScopeContainer.kind !== 266 /* ModuleDeclaration */ && !isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { const errorSpan = getErrorSpanForNode(file, node); file.bindDiagnostics.push(createFileDiagnostic( file, @@ -42961,11 +43113,6 @@ ${lanes.join("\n")} } } } - function checkStrictModeNumericLiteral(node) { - if (languageVersion < 1 /* ES5 */ && inStrictMode && node.numericLiteralFlags & 32 /* Octal */) { - file.bindDiagnostics.push(createDiagnosticForNode2(node, Diagnostics.Octal_literals_are_not_allowed_in_strict_mode)); - } - } function checkStrictModePostfixUnaryExpression(node) { if (inStrictMode) { checkStrictModeEvalOrArguments(node, node.operand); @@ -42973,7 +43120,7 @@ ${lanes.join("\n")} } function checkStrictModePrefixUnaryExpression(node) { if (inStrictMode) { - if (node.operator === 45 /* PlusPlusToken */ || node.operator === 46 /* MinusMinusToken */) { + if (node.operator === 46 /* PlusPlusToken */ || node.operator === 47 /* MinusMinusToken */) { checkStrictModeEvalOrArguments(node, node.operand); } } @@ -42990,9 +43137,9 @@ ${lanes.join("\n")} } } } - function errorOnFirstToken(node, message, arg0, arg1, arg2) { + function errorOnFirstToken(node, message, ...args) { const span = getSpanOfTokenAtPosition(file, node.pos); - file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)); + file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, ...args)); } function errorOrSuggestionOnNode(isError, node, message) { errorOrSuggestionOnRange(isError, node, node, message); @@ -43017,7 +43164,7 @@ ${lanes.join("\n")} node.tracingPath = file.path; const saveInStrictMode = inStrictMode; bindWorker(node); - if (node.kind > 162 /* LastToken */) { + if (node.kind > 164 /* LastToken */) { const saveParent = parent2; parent2 = node; const containerFlags = getContainerFlags(node); @@ -43073,7 +43220,7 @@ ${lanes.join("\n")} } function bindWorker(node) { switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: if (node.flags & 2048 /* IdentifierIsInJSDocNamespace */) { let parentNode = node.parent; while (parentNode && !isJSDocTypeAlias(parentNode)) { @@ -43082,24 +43229,24 @@ ${lanes.join("\n")} bindBlockScopedDeclaration(parentNode, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */); break; } - case 108 /* ThisKeyword */: - if (currentFlow && (isExpression(node) || parent2.kind === 300 /* ShorthandPropertyAssignment */)) { + case 110 /* ThisKeyword */: + if (currentFlow && (isExpression(node) || parent2.kind === 303 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkContextualIdentifier(node); - case 163 /* QualifiedName */: + case 165 /* QualifiedName */: if (currentFlow && isPartOfTypeQuery(node)) { node.flowNode = currentFlow; } break; - case 233 /* MetaProperty */: - case 106 /* SuperKeyword */: + case 235 /* MetaProperty */: + case 108 /* SuperKeyword */: node.flowNode = currentFlow; break; - case 80 /* PrivateIdentifier */: + case 81 /* PrivateIdentifier */: return checkPrivateIdentifier(node); - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: const expr = node; if (currentFlow && isNarrowableReference(expr)) { expr.flowNode = currentFlow; @@ -43118,7 +43265,7 @@ ${lanes.join("\n")} ); } break; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: const specialKind = getAssignmentDeclarationKind(node); switch (specialKind) { case 1 /* ExportsProperty */: @@ -43153,83 +43300,81 @@ ${lanes.join("\n")} Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 295 /* CatchClause */: + case 298 /* CatchClause */: return checkStrictModeCatchClause(node); - case 217 /* DeleteExpression */: + case 219 /* DeleteExpression */: return checkStrictModeDeleteExpression(node); - case 8 /* NumericLiteral */: - return checkStrictModeNumericLiteral(node); - case 222 /* PostfixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 221 /* PrefixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 251 /* WithStatement */: + case 253 /* WithStatement */: return checkStrictModeWithStatement(node); - case 253 /* LabeledStatement */: + case 255 /* LabeledStatement */: return checkStrictModeLabeledStatement(node); - case 194 /* ThisType */: + case 196 /* ThisType */: seenThisKeyword = true; return; - case 179 /* TypePredicate */: + case 181 /* TypePredicate */: break; - case 165 /* TypeParameter */: + case 167 /* TypeParameter */: return bindTypeParameter(node); - case 166 /* Parameter */: + case 168 /* Parameter */: return bindParameter(node); - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 205 /* BindingElement */: + case 207 /* BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: return bindPropertyWorker(node); - case 299 /* PropertyAssignment */: - case 300 /* ShorthandPropertyAssignment */: + case 302 /* PropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 302 /* EnumMember */: + case 305 /* EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 900095 /* EnumMemberExcludes */); - case 176 /* CallSignature */: - case 177 /* ConstructSignature */: - case 178 /* IndexSignature */: + case 178 /* CallSignature */: + case 179 /* ConstructSignature */: + case 180 /* IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */); - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: return bindPropertyOrMethodOrAccessor( node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 103359 /* MethodExcludes */ ); - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: return bindFunctionDeclaration(node); - case 173 /* Constructor */: + case 175 /* Constructor */: return declareSymbolAndAddToSymbolTable( node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */ ); - case 174 /* GetAccessor */: + case 176 /* GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 46015 /* GetAccessorExcludes */); - case 175 /* SetAccessor */: + case 177 /* SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 78783 /* SetAccessorExcludes */); - case 181 /* FunctionType */: - case 320 /* JSDocFunctionType */: - case 326 /* JSDocSignature */: - case 182 /* ConstructorType */: + case 183 /* FunctionType */: + case 323 /* JSDocFunctionType */: + case 329 /* JSDocSignature */: + case 184 /* ConstructorType */: return bindFunctionOrConstructorType(node); - case 184 /* TypeLiteral */: - case 325 /* JSDocTypeLiteral */: - case 197 /* MappedType */: + case 186 /* TypeLiteral */: + case 328 /* JSDocTypeLiteral */: + case 199 /* MappedType */: return bindAnonymousTypeWorker(node); - case 335 /* JSDocClassTag */: + case 338 /* JSDocClassTag */: return bindJSDocClassTag(node); - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: return bindFunctionExpression(node); - case 210 /* CallExpression */: + case 212 /* CallExpression */: const assignmentKind = getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7 /* ObjectDefinePropertyValue */: @@ -43247,60 +43392,60 @@ ${lanes.join("\n")} bindCallExpression(node); } break; - case 228 /* ClassExpression */: - case 260 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 262 /* ClassDeclaration */: inStrictMode = true; return bindClassLikeDeclaration(node); - case 261 /* InterfaceDeclaration */: + case 263 /* InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* Interface */, 788872 /* InterfaceExcludes */); - case 262 /* TypeAliasDeclaration */: + case 264 /* TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */); - case 263 /* EnumDeclaration */: + case 265 /* EnumDeclaration */: return bindEnumDeclaration(node); - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: return bindModuleDeclaration(node); - case 289 /* JsxAttributes */: + case 291 /* JsxAttributes */: return bindJsxAttributes(node); - case 288 /* JsxAttribute */: + case 290 /* JsxAttribute */: return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */); - case 268 /* ImportEqualsDeclaration */: - case 271 /* NamespaceImport */: - case 273 /* ImportSpecifier */: - case 278 /* ExportSpecifier */: + case 270 /* ImportEqualsDeclaration */: + case 273 /* NamespaceImport */: + case 275 /* ImportSpecifier */: + case 280 /* ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */); - case 267 /* NamespaceExportDeclaration */: + case 269 /* NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 270 /* ImportClause */: + case 272 /* ImportClause */: return bindImportClause(node); - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: return bindExportDeclaration(node); - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: return bindExportAssignment(node); - case 308 /* SourceFile */: + case 311 /* SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 238 /* Block */: + case 240 /* Block */: if (!isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { return; } - case 265 /* ModuleBlock */: + case 267 /* ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 344 /* JSDocParameterTag */: - if (node.parent.kind === 326 /* JSDocSignature */) { + case 347 /* JSDocParameterTag */: + if (node.parent.kind === 329 /* JSDocSignature */) { return bindParameter(node); } - if (node.parent.kind !== 325 /* JSDocTypeLiteral */) { + if (node.parent.kind !== 328 /* JSDocTypeLiteral */) { break; } - case 351 /* JSDocPropertyTag */: + case 354 /* JSDocPropertyTag */: const propTag = node; - const flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 319 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; + const flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 322 /* JSDocOptionalType */ ? 4 /* Property */ | 16777216 /* Optional */ : 4 /* Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */); - case 349 /* JSDocTypedefTag */: - case 341 /* JSDocCallbackTag */: - case 343 /* JSDocEnumTag */: + case 352 /* JSDocTypedefTag */: + case 344 /* JSDocCallbackTag */: + case 346 /* JSDocEnumTag */: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); - case 342 /* JSDocOverloadTag */: + case 345 /* JSDocOverloadTag */: return bind(node.typeExpression); } } @@ -43452,10 +43597,10 @@ ${lanes.join("\n")} false ); switch (thisContainer.kind) { - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: let constructorSymbol = thisContainer.symbol; - if (isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63 /* EqualsToken */) { + if (isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 64 /* EqualsToken */) { const l = thisContainer.parent.left; if (isBindableStaticAccessExpression(l) && isPrototypeAccess(l.expression)) { constructorSymbol = lookupSymbolForPropertyAccess(l.expression.expression, thisParentContainer); @@ -43471,12 +43616,12 @@ ${lanes.join("\n")} addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32 /* Class */); } break; - case 173 /* Constructor */: - case 169 /* PropertyDeclaration */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 172 /* ClassStaticBlockDeclaration */: + case 175 /* Constructor */: + case 171 /* PropertyDeclaration */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 174 /* ClassStaticBlockDeclaration */: const containingClass = thisContainer.parent; const symbolTable = isStatic(thisContainer) ? containingClass.symbol.exports : containingClass.symbol.members; if (hasDynamicName(node)) { @@ -43493,7 +43638,7 @@ ${lanes.join("\n")} ); } break; - case 308 /* SourceFile */: + case 311 /* SourceFile */: if (hasDynamicName(node)) { break; } else if (thisContainer.commonJsModuleIndicator) { @@ -43502,6 +43647,8 @@ ${lanes.join("\n")} declareSymbolAndAddToSymbolTable(node, 1 /* FunctionScopedVariable */, 111550 /* FunctionScopedVariableExcludes */); } break; + case 266 /* ModuleDeclaration */: + break; default: Debug.failBadSyntaxKind(thisContainer); } @@ -43526,9 +43673,9 @@ ${lanes.join("\n")} } } function bindSpecialPropertyDeclaration(node) { - if (node.expression.kind === 108 /* ThisKeyword */) { + if (node.expression.kind === 110 /* ThisKeyword */) { bindThisPropertyAssignment(node); - } else if (isBindableStaticAccessExpression(node) && node.parent.parent.kind === 308 /* SourceFile */) { + } else if (isBindableStaticAccessExpression(node) && node.parent.parent.kind === 311 /* SourceFile */) { if (isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } else { @@ -43577,7 +43724,7 @@ ${lanes.join("\n")} } function bindObjectDefinePropertyAssignment(node) { let namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - const isToplevel = node.parent.parent.kind === 308 /* SourceFile */; + const isToplevel = node.parent.parent.kind === 311 /* SourceFile */; namespaceSymbol = bindPotentiallyMissingNamespaces( namespaceSymbol, node.arguments[0], @@ -43595,13 +43742,13 @@ ${lanes.join("\n")} ); } function bindSpecialPropertyAssignment(node) { - var _a2; + var _a; const parentSymbol = lookupSymbolForPropertyAccess(node.left.expression, container) || lookupSymbolForPropertyAccess(node.left.expression, blockScopeContainer); if (!isInJSFile(node) && !isFunctionSymbol(parentSymbol)) { return; } const rootExpr = getLeftmostAccessExpression(node.left); - if (isIdentifier(rootExpr) && ((_a2 = lookupSymbolForName(container, rootExpr.escapedText)) == null ? void 0 : _a2.flags) & 2097152 /* Alias */) { + if (isIdentifier(rootExpr) && ((_a = lookupSymbolForName(container, rootExpr.escapedText)) == null ? void 0 : _a.flags) & 2097152 /* Alias */) { return; } setParent(node.left, node); @@ -43614,7 +43761,7 @@ ${lanes.join("\n")} parentSymbol, node.left.expression, isTopLevelNamespaceAssignment(node.left), - /*isPrototype*/ + /*isPrototypeProperty*/ false, /*containerIsClass*/ false @@ -43691,7 +43838,7 @@ ${lanes.join("\n")} declareSymbol(symbolTable, namespaceSymbol, declaration, includes | 67108864 /* Assignment */, excludes & ~67108864 /* Assignment */); } function isTopLevelNamespaceAssignment(propertyAccess) { - return isBinaryExpression(propertyAccess.parent) ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 308 /* SourceFile */ : propertyAccess.parent.parent.kind === 308 /* SourceFile */; + return isBinaryExpression(propertyAccess.parent) ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 311 /* SourceFile */ : propertyAccess.parent.parent.kind === 311 /* SourceFile */; } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { let namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); @@ -43711,7 +43858,7 @@ ${lanes.join("\n")} init = init && getRightMostAssignedExpression(init); if (init) { const isPrototypeAssignment = isPrototypeAccess(isVariableDeclaration(node) ? node.name : isBinaryExpression(node) ? node.left : node); - return !!getExpandoInitializer(isBinaryExpression(init) && (init.operatorToken.kind === 56 /* BarBarToken */ || init.operatorToken.kind === 60 /* QuestionQuestionToken */) ? init.right : init, isPrototypeAssignment); + return !!getExpandoInitializer(isBinaryExpression(init) && (init.operatorToken.kind === 57 /* BarBarToken */ || init.operatorToken.kind === 61 /* QuestionQuestionToken */) ? init.right : init, isPrototypeAssignment); } return false; } @@ -43746,14 +43893,14 @@ ${lanes.join("\n")} function bindCallExpression(node) { if (!file.commonJsModuleIndicator && isRequireCall( node, - /*checkArgumentIsStringLiteralLike*/ + /*requireStringLiteralLikeArgument*/ false )) { setCommonJsModuleIndicator(node); } } function bindClassLikeDeclaration(node) { - if (node.kind === 260 /* ClassDeclaration */) { + if (node.kind === 262 /* ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* Class */, 899503 /* ClassExcludes */); } else { const bindingName = node.name ? node.name.escapedText : "__class" /* Class */; @@ -43782,7 +43929,7 @@ ${lanes.join("\n")} checkStrictModeEvalOrArguments(node, node.name); } if (!isBindingPattern(node.name)) { - const possibleVariableDecl = node.kind === 257 /* VariableDeclaration */ ? node : node.parent.parent; + const possibleVariableDecl = node.kind === 259 /* VariableDeclaration */ ? node : node.parent.parent; if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 1 /* Export */)) { declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */); } else if (isBlockOrCatchScoped(node)) { @@ -43795,7 +43942,7 @@ ${lanes.join("\n")} } } function bindParameter(node) { - if (node.kind === 344 /* JSDocParameterTag */ && container.kind !== 326 /* JSDocSignature */) { + if (node.kind === 347 /* JSDocParameterTag */ && container.kind !== 329 /* JSDocSignature */) { return; } if (inStrictMode && !(node.flags & 16777216 /* Ambient */)) { @@ -43852,12 +43999,11 @@ ${lanes.join("\n")} return extendsType && extendsType.parent; } function bindTypeParameter(node) { - var _a2, _b; if (isJSDocTemplateTag(node.parent)) { const container2 = getEffectiveContainerForJSDocTemplateTag(node.parent); if (container2) { Debug.assertNode(container2, canHaveLocals); - (_a2 = container2.locals) != null ? _a2 : container2.locals = createSymbolTable(); + container2.locals ?? (container2.locals = createSymbolTable()); declareSymbol( container2.locals, /*parent*/ @@ -43869,11 +44015,11 @@ ${lanes.join("\n")} } else { declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */); } - } else if (node.parent.kind === 192 /* InferType */) { + } else if (node.parent.kind === 194 /* InferType */) { const container2 = getInferTypeContainer(node.parent); if (container2) { Debug.assertNode(container2, canHaveLocals); - (_b = container2.locals) != null ? _b : container2.locals = createSymbolTable(); + container2.locals ?? (container2.locals = createSymbolTable()); declareSymbol( container2.locals, /*parent*/ @@ -43900,9 +44046,9 @@ ${lanes.join("\n")} if (currentFlow === unreachableFlow) { const reportError = ( // report error on all statements except empty ones - isStatementButNotDeclaration(node) && node.kind !== 239 /* EmptyStatement */ || // report error on class declarations - node.kind === 260 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - node.kind === 264 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node) + isStatementButNotDeclaration(node) && node.kind !== 241 /* EmptyStatement */ || // report error on class declarations + node.kind === 262 /* ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set + node.kind === 266 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node) ); if (reportError) { currentFlow = reportedUnreachableFlow; @@ -43930,12 +44076,12 @@ ${lanes.join("\n")} } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 261 /* InterfaceDeclaration */: - case 262 /* TypeAliasDeclaration */: + case 263 /* InterfaceDeclaration */: + case 264 /* TypeAliasDeclaration */: return true; - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: return getModuleInstanceState(s) !== 1 /* Instantiated */; - case 263 /* EnumDeclaration */: + case 265 /* EnumDeclaration */: return hasSyntacticModifier(s, 2048 /* Const */); default: return false; @@ -43970,69 +44116,69 @@ ${lanes.join("\n")} } function getContainerFlags(node) { switch (node.kind) { - case 228 /* ClassExpression */: - case 260 /* ClassDeclaration */: - case 263 /* EnumDeclaration */: - case 207 /* ObjectLiteralExpression */: - case 184 /* TypeLiteral */: - case 325 /* JSDocTypeLiteral */: - case 289 /* JsxAttributes */: + case 230 /* ClassExpression */: + case 262 /* ClassDeclaration */: + case 265 /* EnumDeclaration */: + case 209 /* ObjectLiteralExpression */: + case 186 /* TypeLiteral */: + case 328 /* JSDocTypeLiteral */: + case 291 /* JsxAttributes */: return 1 /* IsContainer */; - case 261 /* InterfaceDeclaration */: + case 263 /* InterfaceDeclaration */: return 1 /* IsContainer */ | 64 /* IsInterface */; - case 264 /* ModuleDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 197 /* MappedType */: - case 178 /* IndexSignature */: + case 266 /* ModuleDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 199 /* MappedType */: + case 180 /* IndexSignature */: return 1 /* IsContainer */ | 32 /* HasLocals */; - case 308 /* SourceFile */: + case 311 /* SourceFile */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 171 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 173 /* MethodDeclaration */: if (isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethodOrAccessor */; } - case 173 /* Constructor */: - case 259 /* FunctionDeclaration */: - case 170 /* MethodSignature */: - case 176 /* CallSignature */: - case 326 /* JSDocSignature */: - case 320 /* JSDocFunctionType */: - case 181 /* FunctionType */: - case 177 /* ConstructSignature */: - case 182 /* ConstructorType */: - case 172 /* ClassStaticBlockDeclaration */: + case 175 /* Constructor */: + case 261 /* FunctionDeclaration */: + case 172 /* MethodSignature */: + case 178 /* CallSignature */: + case 329 /* JSDocSignature */: + case 323 /* JSDocFunctionType */: + case 183 /* FunctionType */: + case 179 /* ConstructSignature */: + case 184 /* ConstructorType */: + case 174 /* ClassStaticBlockDeclaration */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */; - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */; - case 265 /* ModuleBlock */: + case 267 /* ModuleBlock */: return 4 /* IsControlFlowContainer */; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return node.initializer ? 4 /* IsControlFlowContainer */ : 0; - case 295 /* CatchClause */: - case 245 /* ForStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: - case 266 /* CaseBlock */: + case 298 /* CatchClause */: + case 247 /* ForStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 268 /* CaseBlock */: return 2 /* IsBlockScopedContainer */ | 32 /* HasLocals */; - case 238 /* Block */: + case 240 /* Block */: return isFunctionLike(node.parent) || isClassStaticBlockDeclaration(node.parent) ? 0 /* None */ : 2 /* IsBlockScopedContainer */ | 32 /* HasLocals */; } return 0 /* None */; } function lookupSymbolForName(container, name) { - var _a2, _b, _c, _d, _e; - const local = (_b = (_a2 = tryCast(container, canHaveLocals)) == null ? void 0 : _a2.locals) == null ? void 0 : _b.get(name); + var _a, _b, _c, _d; + const local = (_b = (_a = tryCast(container, canHaveLocals)) == null ? void 0 : _a.locals) == null ? void 0 : _b.get(name); if (local) { - return (_c = local.exportSymbol) != null ? _c : local; + return local.exportSymbol ?? local; } if (isSourceFile(container) && container.jsGlobalAugmentations && container.jsGlobalAugmentations.has(name)) { return container.jsGlobalAugmentations.get(name); } if (canHaveSymbol(container)) { - return (_e = (_d = container.symbol) == null ? void 0 : _d.exports) == null ? void 0 : _e.get(name); + return (_d = (_c = container.symbol) == null ? void 0 : _c.exports) == null ? void 0 : _d.get(name); } } var ModuleInstanceState, binder; @@ -44047,7 +44193,7 @@ ${lanes.join("\n")} ModuleInstanceState2[ModuleInstanceState2["ConstEnumOnly"] = 2] = "ConstEnumOnly"; return ModuleInstanceState2; })(ModuleInstanceState || {}); - binder = createBinder(); + binder = /* @__PURE__ */ createBinder(); } }); @@ -44193,7 +44339,7 @@ ${lanes.join("\n")} symbol.exports.forEach(visitSymbol); } forEach(symbol.declarations, (d) => { - if (d.type && d.type.kind === 183 /* TypeQuery */) { + if (d.type && d.type.kind === 185 /* TypeQuery */) { const query = d.type; const entity = getResolvedSymbol(getFirstIdentifier2(query.exprName)); visitSymbol(entity); @@ -44216,24 +44362,25 @@ ${lanes.join("\n")} return { relativePreference: oldImportSpecifier !== void 0 ? isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* Relative */ : 1 /* NonRelative */ : importModuleSpecifierPreference === "relative" ? 0 /* Relative */ : importModuleSpecifierPreference === "non-relative" ? 1 /* NonRelative */ : importModuleSpecifierPreference === "project-relative" ? 3 /* ExternalNonRelative */ : 2 /* Shortest */, getAllowedEndingsInPreferredOrder: (syntaxImpliedNodeFormat) => { - if ((syntaxImpliedNodeFormat != null ? syntaxImpliedNodeFormat : importingSourceFile.impliedNodeFormat) === 99 /* ESNext */) { + if ((syntaxImpliedNodeFormat ?? importingSourceFile.impliedNodeFormat) === 99 /* ESNext */) { if (shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName)) { return [3 /* TsExtension */, 2 /* JsExtension */]; } return [2 /* JsExtension */]; } if (getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */) { - return [1 /* Index */, 2 /* JsExtension */]; + return preferredEnding === 2 /* JsExtension */ ? [2 /* JsExtension */, 1 /* Index */] : [1 /* Index */, 2 /* JsExtension */]; } + const allowImportingTsExtension = shouldAllowImportingTsExtension(compilerOptions, importingSourceFile.fileName); switch (preferredEnding) { case 2 /* JsExtension */: - return [2 /* JsExtension */, 0 /* Minimal */, 1 /* Index */]; + return allowImportingTsExtension ? [2 /* JsExtension */, 3 /* TsExtension */, 0 /* Minimal */, 1 /* Index */] : [2 /* JsExtension */, 0 /* Minimal */, 1 /* Index */]; case 3 /* TsExtension */: return [3 /* TsExtension */, 0 /* Minimal */, 2 /* JsExtension */, 1 /* Index */]; case 1 /* Index */: - return [1 /* Index */, 0 /* Minimal */, 2 /* JsExtension */]; + return allowImportingTsExtension ? [1 /* Index */, 0 /* Minimal */, 3 /* TsExtension */, 2 /* JsExtension */] : [1 /* Index */, 0 /* Minimal */, 2 /* JsExtension */]; case 0 /* Minimal */: - return [0 /* Minimal */, 1 /* Index */, 2 /* JsExtension */]; + return allowImportingTsExtension ? [0 /* Minimal */, 1 /* Index */, 3 /* TsExtension */, 2 /* JsExtension */] : [0 /* Minimal */, 1 /* Index */, 2 /* JsExtension */]; default: Debug.assertNever(preferredEnding); } @@ -44306,12 +44453,12 @@ ${lanes.join("\n")} )[0]; } function tryGetModuleSpecifiersFromCacheWorker(moduleSymbol, importingSourceFile, host, userPreferences, options = {}) { - var _a2; + var _a; const moduleSourceFile = getSourceFileOfModule(moduleSymbol); if (!moduleSourceFile) { return emptyArray; } - const cache = (_a2 = host.getModuleSpecifierCache) == null ? void 0 : _a2.call(host); + const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host); const cached = cache == null ? void 0 : cache.get(importingSourceFile.path, moduleSourceFile.path, userPreferences, options); return [cached == null ? void 0 : cached.moduleSpecifiers, moduleSourceFile, cached == null ? void 0 : cached.modulePaths, cache]; } @@ -44429,7 +44576,7 @@ ${lanes.join("\n")} return pathsOnly ? void 0 : relativePath; } const baseDirectory = getNormalizedAbsolutePath(getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory()); - const relativeToBaseUrl = getRelativePathIfInDirectory(moduleFileName, baseDirectory, getCanonicalFileName); + const relativeToBaseUrl = getRelativePathIfInSameVolume(moduleFileName, baseDirectory, getCanonicalFileName); if (!relativeToBaseUrl) { return pathsOnly ? void 0 : relativePath; } @@ -44481,7 +44628,7 @@ ${lanes.join("\n")} }); } function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) { - var _a2; + var _a; const getCanonicalFileName = hostGetCanonicalFileName(host); const cwd = host.getCurrentDirectory(); const referenceRedirect = host.isSourceOfProjectReferenceRedirect(importedFileName) ? host.getProjectReferenceRedirect(importedFileName) : void 0; @@ -44495,7 +44642,7 @@ ${lanes.join("\n")} if (result2) return result2; } - const symlinkedDirectories = (_a2 = host.getSymlinkCache) == null ? void 0 : _a2.call(host).getSymlinkedDirectoriesByRealpath(); + const symlinkedDirectories = (_a = host.getSymlinkCache) == null ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath(); const fullImportedFileName = getNormalizedAbsolutePath(importedFileName, cwd); const result = symlinkedDirectories && forEachAncestorDirectory(getDirectoryPath(fullImportedFileName), (realPathDirectory) => { const symlinkDirectories = symlinkedDirectories.get(ensureTrailingDirectorySeparator(toPath(realPathDirectory, cwd, getCanonicalFileName))); @@ -44521,9 +44668,9 @@ ${lanes.join("\n")} return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0); } function getAllModulePaths(importingFilePath, importedFileName, host, preferences, options = {}) { - var _a2; + var _a; const importedFilePath = toPath(importedFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host)); - const cache = (_a2 = host.getModuleSpecifierCache) == null ? void 0 : _a2.call(host); + const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host); if (cache) { const cached = cache.get(importingFilePath, importedFilePath, preferences, options); if (cached == null ? void 0 : cached.modulePaths) @@ -44581,8 +44728,8 @@ ${lanes.join("\n")} return sortedPaths; } function tryGetModuleNameFromAmbientModule(moduleSymbol, checker) { - var _a2; - const decl = (_a2 = moduleSymbol.declarations) == null ? void 0 : _a2.find( + var _a; + const decl = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find( (d) => isNonGlobalAmbientModule(d) && (!isExternalModuleAugmentation(d) || !isExternalModuleNameRelative(getTextOfIdentifierOrLiteral(d.name))) ); if (decl) { @@ -44591,11 +44738,11 @@ ${lanes.join("\n")} const ambientModuleDeclareCandidates = mapDefined( moduleSymbol.declarations, (d) => { - var _a3, _b, _c, _d; + var _a2, _b, _c, _d; if (!isModuleDeclaration(d)) return; const topNamespace = getTopNamespace(d); - if (!(((_a3 = topNamespace == null ? void 0 : topNamespace.parent) == null ? void 0 : _a3.parent) && isModuleBlock(topNamespace.parent) && isAmbientModule(topNamespace.parent.parent) && isSourceFile(topNamespace.parent.parent.parent))) + if (!(((_a2 = topNamespace == null ? void 0 : topNamespace.parent) == null ? void 0 : _a2.parent) && isModuleBlock(topNamespace.parent) && isAmbientModule(topNamespace.parent.parent) && isSourceFile(topNamespace.parent.parent.parent))) return; const exportAssignment = (_d = (_c = (_b = topNamespace.parent.parent.symbol.exports) == null ? void 0 : _b.get("export=")) == null ? void 0 : _c.valueDeclaration) == null ? void 0 : _d.expression; if (!exportAssignment) @@ -44637,7 +44784,7 @@ ${lanes.join("\n")} for (const { ending, value } of candidates) { if (value.length >= prefix.length + suffix.length && startsWith(value, prefix) && endsWith(value, suffix) && validateEnding({ ending, value })) { const matchedStar = value.substring(prefix.length, value.length - suffix.length); - return key.replace("*", matchedStar); + return pathIsRelative(matchedStar) ? void 0 : key.replace("*", matchedStar); } } } else if (some(candidates, (c) => c.ending !== 0 /* Minimal */ && pattern === c.value) || some(candidates, (c) => c.ending === 0 /* Minimal */ && pattern === c.value && validateEnding(c))) { @@ -44785,12 +44932,12 @@ ${lanes.join("\n")} const packageName = getPackageNameFromTypesPackageName(nodeModulesDirectoryName); return getEmitModuleResolutionKind(options) === 1 /* Classic */ && packageName === nodeModulesDirectoryName ? void 0 : packageName; function tryDirectoryWithPackageJson(packageRootIndex) { - var _a2, _b; + var _a, _b; const packageRootPath = path.substring(0, packageRootIndex); const packageJsonPath = combinePaths(packageRootPath, "package.json"); let moduleFileToTry = path; let maybeBlockedByTypesVersions = false; - const cachedPackageJson = (_b = (_a2 = host.getPackageJsonInfoCache) == null ? void 0 : _a2.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath); + const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath); if (typeof cachedPackageJson === "object" || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) { const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath)); const importMode = overrideMode || importingSourceFile.impliedNodeFormat; @@ -44826,7 +44973,10 @@ ${lanes.join("\n")} const mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js"; if (isString(mainFileRelative) && !(maybeBlockedByTypesVersions && matchPatternOrExact(tryParsePatterns(versionPaths.paths), mainFileRelative))) { const mainExportFile = toPath(mainFileRelative, packageRootPath, getCanonicalFileName); - if (removeFileExtension(mainExportFile) === removeFileExtension(getCanonicalFileName(moduleFileToTry))) { + const canonicalModuleFileToTry = getCanonicalFileName(moduleFileToTry); + if (removeFileExtension(mainExportFile) === removeFileExtension(canonicalModuleFileToTry)) { + return { packageRootPath, moduleFileToTry }; + } else if (packageJsonContent.type !== "module" && !fileExtensionIsOneOf(canonicalModuleFileToTry, extensionsNotSupportingExtensionlessResolution) && startsWith(canonicalModuleFileToTry, mainExportFile) && getDirectoryPath(canonicalModuleFileToTry) === removeTrailingDirectorySeparator(mainExportFile) && removeFileExtension(getBaseFileName(canonicalModuleFileToTry)) === "index") { return { packageRootPath, moduleFileToTry }; } } @@ -44852,7 +45002,7 @@ ${lanes.join("\n")} } function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { return mapDefined(rootDirs, (rootDir) => { - const relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName); + const relativePath = getRelativePathIfInSameVolume(path, rootDir, getCanonicalFileName); return relativePath !== void 0 && isPathRelativeToParent(relativePath) ? void 0 : relativePath; }); } @@ -44864,7 +45014,11 @@ ${lanes.join("\n")} if (fileName === noExtension) { return fileName; } - if (fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".d.cts" /* Dcts */, ".cts" /* Cts */])) { + const jsPriority = allowedEndings.indexOf(2 /* JsExtension */); + const tsPriority = allowedEndings.indexOf(3 /* TsExtension */); + if (fileExtensionIsOneOf(fileName, [".mts" /* Mts */, ".cts" /* Cts */]) && tsPriority !== -1 && tsPriority < jsPriority) { + return fileName; + } else if (fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".d.cts" /* Dcts */, ".cts" /* Cts */])) { return noExtension + getJSExtensionForFile(fileName, options); } else if (!fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */]) && fileExtensionIsOneOf(fileName, [".ts" /* Ts */]) && stringContains(fileName, ".d.")) { return tryGetRealFileNameForNonJsDeclarationFileName(fileName); @@ -44883,7 +45037,6 @@ ${lanes.join("\n")} case 3 /* TsExtension */: if (isDeclarationFileName(fileName)) { const extensionlessPriority = allowedEndings.findIndex((e) => e === 0 /* Minimal */ || e === 1 /* Index */); - const jsPriority = allowedEndings.indexOf(2 /* JsExtension */); return extensionlessPriority !== -1 && extensionlessPriority < jsPriority ? noExtension : noExtension + getJSExtensionForFile(fileName, options); } return fileName; @@ -44900,8 +45053,7 @@ ${lanes.join("\n")} return noExtension.substring(0, noExtension.indexOf(".d.")) + ext; } function getJSExtensionForFile(fileName, options) { - var _a2; - return (_a2 = tryGetJSExtensionForFile(fileName, options)) != null ? _a2 : Debug.fail(`Extension ${extensionFromPath(fileName)} is unsupported:: FileName:: ${fileName}`); + return tryGetJSExtensionForFile(fileName, options) ?? Debug.fail(`Extension ${extensionFromPath(fileName)} is unsupported:: FileName:: ${fileName}`); } function tryGetJSExtensionForFile(fileName, options) { const ext = tryGetExtensionFromPath2(fileName); @@ -44927,7 +45079,7 @@ ${lanes.join("\n")} return void 0; } } - function getRelativePathIfInDirectory(path, directoryPath, getCanonicalFileName) { + function getRelativePathIfInSameVolume(path, directoryPath, getCanonicalFileName) { const relativePath = getRelativePathToDirectoryOrUrl( directoryPath, path, @@ -44992,18 +45144,6 @@ ${lanes.join("\n")} return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */; } function createTypeChecker(host) { - var getPackagesMap = memoize(() => { - var map2 = /* @__PURE__ */ new Map(); - host.getSourceFiles().forEach((sf) => { - if (!sf.resolvedModules) - return; - sf.resolvedModules.forEach(({ resolvedModule }) => { - if (resolvedModule == null ? void 0 : resolvedModule.packageId) - map2.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!map2.get(resolvedModule.packageId.name)); - }); - }); - return map2; - }); var deferredDiagnosticsCallbacks = []; var addLazyDiagnostic = (arg) => { deferredDiagnosticsCallbacks.push(arg); @@ -45012,7 +45152,7 @@ ${lanes.join("\n")} var requestedExternalEmitHelperNames = /* @__PURE__ */ new Set(); var requestedExternalEmitHelpers; var externalHelpersModule; - var Symbol46 = objectAllocator.getSymbolConstructor(); + var Symbol47 = objectAllocator.getSymbolConstructor(); var Type27 = objectAllocator.getTypeConstructor(); var Signature15 = objectAllocator.getSignatureConstructor(); var typeCount = 0; @@ -45040,6 +45180,7 @@ ${lanes.join("\n")} var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis"); var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables"); var keyofStringsOnly = !!compilerOptions.keyofStringsOnly; + var defaultIndexFlags = keyofStringsOnly ? 1 /* StringsOnly */ : 0 /* None */; var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 8192 /* FreshLiteral */; var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes; var checkBinaryExpression = createCheckBinaryExpression(); @@ -45066,6 +45207,7 @@ ${lanes.join("\n")} var argumentsSymbol = createSymbol(4 /* Property */, "arguments"); var requireSymbol = createSymbol(4 /* Property */, "require"); var isolatedModulesLikeFlagName = compilerOptions.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules"; + var canCollectSymbolAliasAccessabilityData = !compilerOptions.verbatimModuleSyntax || !!compilerOptions.importsNotUsedAsValues; var apparentArgumentCount; const checker = { getNodeCount: () => reduceLeft(host.getSourceFiles(), (n, s) => n + s.nodeCount, 0), @@ -45322,7 +45464,10 @@ ${lanes.join("\n")} createIndexInfo, getAnyType: () => anyType, getStringType: () => stringType, + getStringLiteralType, getNumberType: () => numberType, + getNumberLiteralType, + getBigIntType: () => bigintType, createPromiseType, createArrayType, getElementTypeOfArrayType, @@ -45488,6 +45633,7 @@ ${lanes.join("\n")} } var tupleTypes = /* @__PURE__ */ new Map(); var unionTypes = /* @__PURE__ */ new Map(); + var unionOfUnionTypes = /* @__PURE__ */ new Map(); var intersectionTypes = /* @__PURE__ */ new Map(); var stringLiteralTypes = /* @__PURE__ */ new Map(); var numberLiteralTypes = /* @__PURE__ */ new Map(); @@ -45575,21 +45721,77 @@ ${lanes.join("\n")} } return t; }, () => "(unreliable reporter)"); - var emptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray); - var emptyJsxObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray); + var emptyObjectType = createAnonymousType( + /*symbol*/ + void 0, + emptySymbols, + emptyArray, + emptyArray, + emptyArray + ); + var emptyJsxObjectType = createAnonymousType( + /*symbol*/ + void 0, + emptySymbols, + emptyArray, + emptyArray, + emptyArray + ); emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */; var emptyTypeLiteralSymbol = createSymbol(2048 /* TypeLiteral */, "__type" /* Type */); emptyTypeLiteralSymbol.members = createSymbolTable(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, emptyArray); - var unknownEmptyObjectType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray); + var unknownEmptyObjectType = createAnonymousType( + /*symbol*/ + void 0, + emptySymbols, + emptyArray, + emptyArray, + emptyArray + ); var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType; - var emptyGenericType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray); + var emptyGenericType = createAnonymousType( + /*symbol*/ + void 0, + emptySymbols, + emptyArray, + emptyArray, + emptyArray + ); emptyGenericType.instantiations = /* @__PURE__ */ new Map(); - var anyFunctionType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray); + var anyFunctionType = createAnonymousType( + /*symbol*/ + void 0, + emptySymbols, + emptyArray, + emptyArray, + emptyArray + ); anyFunctionType.objectFlags |= 262144 /* NonInferrableType */; - var noConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray); - var circularConstraintType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray); - var resolvingDefaultType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray); + var noConstraintType = createAnonymousType( + /*symbol*/ + void 0, + emptySymbols, + emptyArray, + emptyArray, + emptyArray + ); + var circularConstraintType = createAnonymousType( + /*symbol*/ + void 0, + emptySymbols, + emptyArray, + emptyArray, + emptyArray + ); + var resolvingDefaultType = createAnonymousType( + /*symbol*/ + void 0, + emptySymbols, + emptyArray, + emptyArray, + emptyArray + ); var markerSuperType = createTypeParameter(); var markerSubType = createTypeParameter(); markerSubType.constraint = markerSuperType; @@ -45599,8 +45801,11 @@ ${lanes.join("\n")} markerSubTypeForCheck.constraint = markerSuperTypeForCheck; var noTypePredicate = createTypePredicate(1 /* Identifier */, "<>", 0, anyType); var anySignature = createSignature( + /*declaration*/ void 0, + /*typeParameters*/ void 0, + /*thisParameter*/ void 0, emptyArray, anyType, @@ -45610,8 +45815,11 @@ ${lanes.join("\n")} 0 /* None */ ); var unknownSignature = createSignature( + /*declaration*/ void 0, + /*typeParameters*/ void 0, + /*thisParameter*/ void 0, emptyArray, errorType, @@ -45621,8 +45829,11 @@ ${lanes.join("\n")} 0 /* None */ ); var resolvingSignature = createSignature( + /*declaration*/ void 0, + /*typeParameters*/ void 0, + /*thisParameter*/ void 0, emptyArray, anyType, @@ -45632,8 +45843,11 @@ ${lanes.join("\n")} 0 /* None */ ); var silentNeverSignature = createSignature( + /*declaration*/ void 0, + /*typeParameters*/ void 0, + /*thisParameter*/ void 0, emptyArray, silentNeverType, @@ -45671,7 +45885,7 @@ ${lanes.join("\n")} getGlobalIterableType: getGlobalAsyncIterableType, getGlobalIterableIteratorType: getGlobalAsyncIterableIteratorType, getGlobalGeneratorType: getGlobalAsyncGeneratorType, - resolveIterationType: getAwaitedType, + resolveIterationType: (type, errorNode) => getAwaitedType(type, errorNode, Diagnostics.Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member), mustHaveANextMethodDiagnostic: Diagnostics.An_async_iterator_must_have_a_next_method, mustBeAMethodDiagnostic: Diagnostics.The_0_property_of_an_async_iterator_must_be_a_method, mustHaveAValueDiagnostic: Diagnostics.The_type_returned_by_the_0_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property @@ -45769,6 +45983,8 @@ ${lanes.join("\n")} var resolutionTargets = []; var resolutionResults = []; var resolutionPropertyNames = []; + var resolutionStart = 0; + var inVarianceComputation = false; var suggestionCount = 0; var maximumSuggestionCount = 10; var mergedSymbols = []; @@ -45891,8 +46107,8 @@ ${lanes.join("\n")} getDiagnostics2(sourceFile, cancellationToken2); return emitResolver; } - function lookupOrIssueError(location, message, arg0, arg1, arg2, arg3) { - const diagnostic = location ? createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : createCompilerDiagnostic(message, arg0, arg1, arg2, arg3); + function lookupOrIssueError(location, message, ...args) { + const diagnostic = location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args); const existing = diagnostics.lookup(diagnostic); if (existing) { return existing; @@ -45901,16 +46117,16 @@ ${lanes.join("\n")} return diagnostic; } } - function errorSkippedOn(key, location, message, arg0, arg1, arg2, arg3) { - const diagnostic = error(location, message, arg0, arg1, arg2, arg3); + function errorSkippedOn(key, location, message, ...args) { + const diagnostic = error(location, message, ...args); diagnostic.skippedOn = key; return diagnostic; } - function createError(location, message, arg0, arg1, arg2, arg3) { - return location ? createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : createCompilerDiagnostic(message, arg0, arg1, arg2, arg3); + function createError(location, message, ...args) { + return location ? createDiagnosticForNode(location, message, ...args) : createCompilerDiagnostic(message, ...args); } - function error(location, message, arg0, arg1, arg2, arg3) { - const diagnostic = createError(location, message, arg0, arg1, arg2, arg3); + function error(location, message, ...args) { + const diagnostic = createError(location, message, ...args); diagnostics.add(diagnostic); return diagnostic; } @@ -45921,19 +46137,19 @@ ${lanes.join("\n")} suggestionDiagnostics.add({ ...diagnostic, category: 2 /* Suggestion */ }); } } - function errorOrSuggestion(isError, location, message, arg0, arg1, arg2, arg3) { + function errorOrSuggestion(isError, location, message, ...args) { if (location.pos < 0 || location.end < 0) { if (!isError) { return; } const file = getSourceFileOfNode(location); - addErrorOrSuggestion(isError, "message" in message ? createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : createDiagnosticForFileFromMessageChain(file, message)); + addErrorOrSuggestion(isError, "message" in message ? createFileDiagnostic(file, 0, 0, message, ...args) : createDiagnosticForFileFromMessageChain(file, message)); return; } - addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message)); + addErrorOrSuggestion(isError, "message" in message ? createDiagnosticForNode(location, message, ...args) : createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(location), location, message)); } - function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) { - const diagnostic = error(location, message, arg0, arg1, arg2, arg3); + function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, ...args) { + const diagnostic = error(location, message, ...args); if (maybeMissingAwait) { const related = createDiagnosticForNode(location, Diagnostics.Did_you_forget_to_use_await); addRelatedInfo(diagnostic, related); @@ -45952,13 +46168,14 @@ ${lanes.join("\n")} return diagnostic; } function isDeprecatedSymbol(symbol) { - if (length(symbol.declarations) > 1) { - const parentSymbol = getParentOfSymbol(symbol); - if (parentSymbol && parentSymbol.flags & 64 /* Interface */) { - return some(symbol.declarations, (d) => !!(getCombinedNodeFlags(d) & 268435456 /* Deprecated */)); - } + const parentSymbol = getParentOfSymbol(symbol); + if (parentSymbol && length(symbol.declarations) > 1) { + return parentSymbol.flags & 64 /* Interface */ ? some(symbol.declarations, isDeprecatedDeclaration2) : every(symbol.declarations, isDeprecatedDeclaration2); } - return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 268435456 /* Deprecated */); + return !!symbol.valueDeclaration && isDeprecatedDeclaration2(symbol.valueDeclaration) || length(symbol.declarations) && every(symbol.declarations, isDeprecatedDeclaration2); + } + function isDeprecatedDeclaration2(declaration) { + return !!(getCombinedNodeFlags(declaration) & 268435456 /* Deprecated */); } function addDeprecatedSuggestion(location, declarations, deprecatedEntity) { const diagnostic = createDiagnosticForNode(location, Diagnostics._0_is_deprecated, deprecatedEntity); @@ -45970,7 +46187,7 @@ ${lanes.join("\n")} } function createSymbol(flags, name, checkFlags) { symbolCount++; - const symbol = new Symbol46(flags | 33554432 /* Transient */, name); + const symbol = new Symbol47(flags | 33554432 /* Transient */, name); symbol.links = new SymbolLinks(); symbol.links.checkFlags = checkFlags || 0 /* None */; return symbol; @@ -46163,9 +46380,9 @@ ${lanes.join("\n")} }); } function mergeModuleAugmentation(moduleName) { - var _a2, _b, _c; + var _a, _b, _c; const moduleAugmentation = moduleName.parent; - if (((_a2 = moduleAugmentation.symbol.declarations) == null ? void 0 : _a2[0]) !== moduleAugmentation) { + if (((_a = moduleAugmentation.symbol.declarations) == null ? void 0 : _a[0]) !== moduleAugmentation) { Debug.assert(moduleAugmentation.symbol.declarations.length > 1); return; } @@ -46226,18 +46443,17 @@ ${lanes.join("\n")} } } function getSymbolLinks(symbol) { - var _a2; if (symbol.flags & 33554432 /* Transient */) return symbol.links; const id = getSymbolId(symbol); - return (_a2 = symbolLinks[id]) != null ? _a2 : symbolLinks[id] = new SymbolLinks(); + return symbolLinks[id] ?? (symbolLinks[id] = new SymbolLinks()); } function getNodeLinks(node) { const nodeId = getNodeId(node); return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); } function isGlobalSourceFile(node) { - return node.kind === 308 /* SourceFile */ && !isExternalOrCommonJsModule(node); + return node.kind === 311 /* SourceFile */ && !isExternalOrCommonJsModule(node); } function getSymbol2(symbols, name, meaning) { if (meaning) { @@ -46281,13 +46497,13 @@ ${lanes.join("\n")} return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile); } if (declaration.pos <= usage.pos && !(isPropertyDeclaration(declaration) && isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { - if (declaration.kind === 205 /* BindingElement */) { - const errorBindingElement = getAncestor(usage, 205 /* BindingElement */); + if (declaration.kind === 207 /* BindingElement */) { + const errorBindingElement = getAncestor(usage, 207 /* BindingElement */); if (errorBindingElement) { return findAncestor(errorBindingElement, isBindingElement) !== findAncestor(declaration, isBindingElement) || declaration.pos < errorBindingElement.pos; } - return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, 257 /* VariableDeclaration */), usage); - } else if (declaration.kind === 257 /* VariableDeclaration */) { + return isBlockScopedNameDeclaredBeforeUse(getAncestor(declaration, 259 /* VariableDeclaration */), usage); + } else if (declaration.kind === 259 /* VariableDeclaration */) { return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } else if (isClassDeclaration(declaration)) { return !findAncestor(usage, (n) => isComputedPropertyName(n) && n.parent.parent === declaration); @@ -46303,17 +46519,17 @@ ${lanes.join("\n")} } return true; } - if (usage.parent.kind === 278 /* ExportSpecifier */ || usage.parent.kind === 274 /* ExportAssignment */ && usage.parent.isExportEquals) { + if (usage.parent.kind === 280 /* ExportSpecifier */ || usage.parent.kind === 276 /* ExportAssignment */ && usage.parent.isExportEquals) { return true; } - if (usage.kind === 274 /* ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 276 /* ExportAssignment */ && usage.isExportEquals) { return true; } if (!!(usage.flags & 8388608 /* JSDoc */) || isInTypeQuery(usage) || isInAmbientOrTypeNode(usage)) { return true; } if (isUsedInFunctionOrInstanceProperty(usage, declaration)) { - if (getEmitScriptTarget(compilerOptions) === 99 /* ESNext */ && useDefineForClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) { + if (getEmitScriptTarget(compilerOptions) >= 9 /* ES2022 */ && useDefineForClassFields && getContainingClass(declaration) && (isPropertyDeclaration(declaration) || isParameterPropertyDeclaration(declaration, declaration.parent))) { return !isPropertyImmediatelyReferencedWithinDeclaration( declaration, usage, @@ -46327,9 +46543,9 @@ ${lanes.join("\n")} return false; function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration2, usage2) { switch (declaration2.parent.parent.kind) { - case 240 /* VariableStatement */: - case 245 /* ForStatement */: - case 247 /* ForOfStatement */: + case 242 /* VariableStatement */: + case 247 /* ForStatement */: + case 249 /* ForOfStatement */: if (isSameScopeDescendentOf(usage2, declaration2, declContainer)) { return true; } @@ -46354,7 +46570,7 @@ ${lanes.join("\n")} const initializerOfProperty = propertyDeclaration.initializer === current; if (initializerOfProperty) { if (isStatic(current.parent)) { - if (declaration2.kind === 171 /* MethodDeclaration */) { + if (declaration2.kind === 173 /* MethodDeclaration */) { return true; } if (isPropertyDeclaration(declaration2) && getContainingClass(usage2) === getContainingClass(declaration2)) { @@ -46368,7 +46584,7 @@ ${lanes.join("\n")} } } } else { - const isDeclarationInstanceProperty = declaration2.kind === 169 /* PropertyDeclaration */ && !isStatic(declaration2); + const isDeclarationInstanceProperty = declaration2.kind === 171 /* PropertyDeclaration */ && !isStatic(declaration2); if (!isDeclarationInstanceProperty || getContainingClass(usage2) !== getContainingClass(declaration2)) { return true; } @@ -46387,15 +46603,15 @@ ${lanes.join("\n")} return "quit"; } switch (node.kind) { - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: return true; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return stopAtAnyPropertyDeclaration && (isPropertyDeclaration(declaration2) && node.parent === declaration2.parent || isParameterPropertyDeclaration(declaration2, declaration2.parent) && node.parent === declaration2.parent.parent) ? "quit" : true; - case 238 /* Block */: + case 240 /* Block */: switch (node.parent.kind) { - case 174 /* GetAccessor */: - case 171 /* MethodDeclaration */: - case 175 /* SetAccessor */: + case 176 /* GetAccessor */: + case 173 /* MethodDeclaration */: + case 177 /* SetAccessor */: return true; default: return false; @@ -46425,17 +46641,17 @@ ${lanes.join("\n")} } function requiresScopeChangeWorker(node) { switch (node.kind) { - case 216 /* ArrowFunction */: - case 215 /* FunctionExpression */: - case 259 /* FunctionDeclaration */: - case 173 /* Constructor */: + case 218 /* ArrowFunction */: + case 217 /* FunctionExpression */: + case 261 /* FunctionDeclaration */: + case 175 /* Constructor */: return false; - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 299 /* PropertyAssignment */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 302 /* PropertyAssignment */: return requiresScopeChangeWorker(node.name); - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: if (hasStaticModifier(node)) { return target < 99 /* ESNext */ || !useDefineForClassFields; } @@ -46460,7 +46676,7 @@ ${lanes.join("\n")} return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol2); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { - var _a2, _b, _c; + var _a, _b, _c; const originalLocation = location; let result; let lastLocation; @@ -46476,21 +46692,25 @@ ${lanes.join("\n")} if (name === "const" && isConstAssertion(location)) { return void 0; } + if (isModuleDeclaration(location) && lastLocation && location.name === lastLocation) { + lastLocation = location; + location = location.parent; + } if (canHaveLocals(location) && location.locals && !isGlobalSourceFile(location)) { if (result = lookup(location.locals, name, meaning)) { let useResult = true; if (isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 323 /* JSDoc */) { - useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || lastLocation.kind === 166 /* Parameter */ || lastLocation.kind === 344 /* JSDocParameterTag */ || lastLocation.kind === 345 /* JSDocReturnTag */ || lastLocation.kind === 165 /* TypeParameter */ : false; + if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 326 /* JSDoc */) { + useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation === location.type || lastLocation.kind === 168 /* Parameter */ || lastLocation.kind === 347 /* JSDocParameterTag */ || lastLocation.kind === 348 /* JSDocReturnTag */ || lastLocation.kind === 167 /* TypeParameter */ : false; } if (meaning & result.flags & 3 /* Variable */) { if (useOuterVariableScopeInParameter(result, location, lastLocation)) { useResult = false; } else if (result.flags & 1 /* FunctionScopedVariable */) { - useResult = lastLocation.kind === 166 /* Parameter */ || lastLocation === location.type && !!findAncestor(result.valueDeclaration, isParameter); + useResult = lastLocation.kind === 168 /* Parameter */ || lastLocation === location.type && !!findAncestor(result.valueDeclaration, isParameter); } } - } else if (location.kind === 191 /* ConditionalType */) { + } else if (location.kind === 193 /* ConditionalType */) { useResult = lastLocation === location.trueType; } if (useResult) { @@ -46502,13 +46722,13 @@ ${lanes.join("\n")} } withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 308 /* SourceFile */: + case 311 /* SourceFile */: if (!isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 264 /* ModuleDeclaration */: - const moduleExports = ((_a2 = getSymbolOfDeclaration(location)) == null ? void 0 : _a2.exports) || emptySymbols; - if (location.kind === 308 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 16777216 /* Ambient */ && !isGlobalScopeAugmentation(location)) { + case 266 /* ModuleDeclaration */: + const moduleExports = ((_a = getSymbolOfDeclaration(location)) == null ? void 0 : _a.exports) || emptySymbols; + if (location.kind === 311 /* SourceFile */ || isModuleDeclaration(location) && location.flags & 16777216 /* Ambient */ && !isGlobalScopeAugmentation(location)) { if (result = moduleExports.get("default" /* Default */)) { const localSymbol = getLocalSymbolForExportDefault(result); if (localSymbol && result.flags & meaning && localSymbol.escapedName === name) { @@ -46517,7 +46737,7 @@ ${lanes.join("\n")} result = void 0; } const moduleExport = moduleExports.get(name); - if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && (getDeclarationOfKind(moduleExport, 278 /* ExportSpecifier */) || getDeclarationOfKind(moduleExport, 277 /* NamespaceExport */))) { + if (moduleExport && moduleExport.flags === 2097152 /* Alias */ && (getDeclarationOfKind(moduleExport, 280 /* ExportSpecifier */) || getDeclarationOfKind(moduleExport, 279 /* NamespaceExport */))) { break; } } @@ -46529,7 +46749,7 @@ ${lanes.join("\n")} } } break; - case 263 /* EnumDeclaration */: + case 265 /* EnumDeclaration */: if (result = lookup(((_c = getSymbolOfDeclaration(location)) == null ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* EnumMember */)) { if (nameNotFoundMessage && getIsolatedModules(compilerOptions) && !(location.flags & 16777216 /* Ambient */) && getSourceFileOfNode(location) !== getSourceFileOfNode(result.valueDeclaration)) { error( @@ -46543,7 +46763,7 @@ ${lanes.join("\n")} break loop; } break; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: if (!isStatic(location)) { const ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -46554,9 +46774,9 @@ ${lanes.join("\n")} } } break; - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 261 /* InterfaceDeclaration */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 263 /* InterfaceDeclaration */: if (result = lookup(getSymbolOfDeclaration(location).members || emptySymbols, name, meaning & 788968 /* Type */)) { if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { result = void 0; @@ -46578,8 +46798,8 @@ ${lanes.join("\n")} } } break; - case 230 /* ExpressionWithTypeArguments */: - if (lastLocation === location.expression && location.parent.token === 94 /* ExtendsKeyword */) { + case 232 /* ExpressionWithTypeArguments */: + if (lastLocation === location.expression && location.parent.token === 96 /* ExtendsKeyword */) { const container = location.parent.parent; if (isClassLike(container) && (result = lookup(getSymbolOfDeclaration(container).members, name, meaning & 788968 /* Type */))) { if (nameNotFoundMessage) { @@ -46589,9 +46809,9 @@ ${lanes.join("\n")} } } break; - case 164 /* ComputedPropertyName */: + case 166 /* ComputedPropertyName */: grandparent = location.parent.parent; - if (isClassLike(grandparent) || grandparent.kind === 261 /* InterfaceDeclaration */) { + if (isClassLike(grandparent) || grandparent.kind === 263 /* InterfaceDeclaration */) { if (result = lookup(getSymbolOfDeclaration(grandparent).members, name, meaning & 788968 /* Type */)) { if (nameNotFoundMessage) { error(errorLocation, Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); @@ -46600,21 +46820,21 @@ ${lanes.join("\n")} } } break; - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: if (getEmitScriptTarget(compilerOptions) >= 2 /* ES2015 */) { break; } - case 171 /* MethodDeclaration */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 259 /* FunctionDeclaration */: + case 173 /* MethodDeclaration */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 261 /* FunctionDeclaration */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 215 /* FunctionExpression */: + case 217 /* FunctionExpression */: if (meaning & 3 /* Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -46627,37 +46847,37 @@ ${lanes.join("\n")} } } break; - case 167 /* Decorator */: - if (location.parent && location.parent.kind === 166 /* Parameter */) { + case 169 /* Decorator */: + if (location.parent && location.parent.kind === 168 /* Parameter */) { location = location.parent; } - if (location.parent && (isClassElement(location.parent) || location.parent.kind === 260 /* ClassDeclaration */)) { + if (location.parent && (isClassElement(location.parent) || location.parent.kind === 262 /* ClassDeclaration */)) { location = location.parent; } break; - case 349 /* JSDocTypedefTag */: - case 341 /* JSDocCallbackTag */: - case 343 /* JSDocEnumTag */: + case 352 /* JSDocTypedefTag */: + case 344 /* JSDocCallbackTag */: + case 346 /* JSDocEnumTag */: const root = getJSDocRoot(location); if (root) { location = root.parent; } break; - case 166 /* Parameter */: + case 168 /* Parameter */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) { if (!associatedDeclarationForContainingInitializerOrBindingName) { associatedDeclarationForContainingInitializerOrBindingName = location; } } break; - case 205 /* BindingElement */: + case 207 /* BindingElement */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && isBindingPattern(lastLocation))) { if (isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { associatedDeclarationForContainingInitializerOrBindingName = location; } } break; - case 192 /* InferType */: + case 194 /* InferType */: if (meaning & 262144 /* TypeParameter */) { const parameterName = location.typeParameter.name; if (parameterName && name === parameterName.escapedText) { @@ -46666,6 +46886,11 @@ ${lanes.join("\n")} } } break; + case 280 /* ExportSpecifier */: + if (lastLocation && lastLocation === location.propertyName && location.parent.parent.moduleSpecifier) { + location = location.parent.parent.parent; + } + break; } if (isSelfReferenceLocation(location)) { lastSelfReferenceLocation = location; @@ -46696,7 +46921,7 @@ ${lanes.join("\n")} if (originalLocation && isInJSFile(originalLocation) && originalLocation.parent) { if (isRequireCall( originalLocation.parent, - /*checkArgumentIsStringLiteralLike*/ + /*requireStringLiteralLikeArgument*/ false )) { return requireSymbol; @@ -46718,7 +46943,7 @@ ${lanes.join("\n")} if (!result) { if (nameNotFoundMessage) { addLazyDiagnostic(() => { - if (!errorLocation || !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217 + if (!errorLocation || errorLocation.parent.kind !== 330 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217 !checkAndReportErrorForInvalidInitializer() && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) { let suggestion; let suggestedLib; @@ -46790,7 +47015,7 @@ ${lanes.join("\n")} if (result && errorLocation && meaning & 111551 /* Value */ && result.flags & 2097152 /* Alias */ && !(result.flags & 111551 /* Value */) && !isValidTypeOnlyAliasUseSite(errorLocation)) { const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* Value */); if (typeOnlyDeclaration) { - const message = typeOnlyDeclaration.kind === 278 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 275 /* ExportDeclaration */ || typeOnlyDeclaration.kind === 277 /* NamespaceExport */ ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; + const message = typeOnlyDeclaration.kind === 280 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 277 /* ExportDeclaration */ || typeOnlyDeclaration.kind === 279 /* NamespaceExport */ ? Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; const unescapedName = unescapeLeadingUnderscores(name); addTypeOnlyDeclarationRelatedInfo( error(errorLocation, message, unescapedName), @@ -46810,14 +47035,14 @@ ${lanes.join("\n")} diagnostic, createDiagnosticForNode( typeOnlyDeclaration, - typeOnlyDeclaration.kind === 278 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 275 /* ExportDeclaration */ || typeOnlyDeclaration.kind === 277 /* NamespaceExport */ ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here, + typeOnlyDeclaration.kind === 280 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 277 /* ExportDeclaration */ || typeOnlyDeclaration.kind === 279 /* NamespaceExport */ ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here, unescapedName ) ); } function getIsDeferredContext(location, lastLocation) { - if (location.kind !== 216 /* ArrowFunction */ && location.kind !== 215 /* FunctionExpression */) { - return isTypeQueryNode(location) || (isFunctionLikeDeclaration(location) || location.kind === 169 /* PropertyDeclaration */ && !isStatic(location)) && (!lastLocation || lastLocation !== location.name); + if (location.kind !== 218 /* ArrowFunction */ && location.kind !== 217 /* FunctionExpression */) { + return isTypeQueryNode(location) || (isFunctionLikeDeclaration(location) || location.kind === 171 /* PropertyDeclaration */ && !isStatic(location)) && (!lastLocation || lastLocation !== location.name); } if (lastLocation && lastLocation === location.name) { return false; @@ -46829,12 +47054,12 @@ ${lanes.join("\n")} } function isSelfReferenceLocation(node) { switch (node.kind) { - case 259 /* FunctionDeclaration */: - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: - case 263 /* EnumDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 264 /* ModuleDeclaration */: + case 261 /* FunctionDeclaration */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: + case 265 /* EnumDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 266 /* ModuleDeclaration */: return true; default: return false; @@ -46846,7 +47071,7 @@ ${lanes.join("\n")} function isTypeParameterSymbolDeclaredInContainer(symbol, container) { if (symbol.declarations) { for (const decl of symbol.declarations) { - if (decl.kind === 165 /* TypeParameter */) { + if (decl.kind === 167 /* TypeParameter */) { const parent2 = isJSDocTemplateTag(decl.parent) ? getJSDocHost(decl.parent) : decl.parent; if (parent2 === container) { return !(isJSDocTemplateTag(decl.parent) && find(decl.parent.parent.tags, isJSDocTypeAlias)); @@ -46906,10 +47131,10 @@ ${lanes.join("\n")} } function getEntityNameForExtendingInterface(node) { switch (node.kind) { - case 79 /* Identifier */: - case 208 /* PropertyAccessExpression */: + case 80 /* Identifier */: + case 210 /* PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : void 0; - case 230 /* ExpressionWithTypeArguments */: + case 232 /* ExpressionWithTypeArguments */: if (isEntityNameExpression(node.expression)) { return node.expression; } @@ -46977,7 +47202,7 @@ ${lanes.join("\n")} return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; } function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { - if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 278 /* ExportSpecifier */) { + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 280 /* ExportSpecifier */) { error(errorLocation, Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); return true; } @@ -47023,7 +47248,7 @@ ${lanes.join("\n")} const grandparent = node.parent.parent; const parentOfGrandparent = grandparent.parent; if (grandparent && parentOfGrandparent) { - const isExtending = isHeritageClause(grandparent) && grandparent.token === 94 /* ExtendsKeyword */; + const isExtending = isHeritageClause(grandparent) && grandparent.token === 96 /* ExtendsKeyword */; const isInterface = isInterfaceDeclaration(parentOfGrandparent); return isExtending && isInterface; } @@ -47095,13 +47320,13 @@ ${lanes.join("\n")} return false; } function checkResolvedBlockScopedVariable(result, errorLocation) { - var _a2; + var _a; Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */)); if (result.flags & (16 /* Function */ | 1 /* FunctionScopedVariable */ | 67108864 /* Assignment */) && result.flags & 32 /* Class */) { return; } - const declaration = (_a2 = result.declarations) == null ? void 0 : _a2.find( - (d) => isBlockOrCatchScoped(d) || isClassLike(d) || d.kind === 263 /* EnumDeclaration */ + const declaration = (_a = result.declarations) == null ? void 0 : _a.find( + (d) => isBlockOrCatchScoped(d) || isClassLike(d) || d.kind === 265 /* EnumDeclaration */ ); if (declaration === void 0) return Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); @@ -47114,11 +47339,6 @@ ${lanes.join("\n")} diagnosticMessage = error(errorLocation, Diagnostics.Class_0_used_before_its_declaration, declarationName); } else if (result.flags & 256 /* RegularEnum */) { diagnosticMessage = error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName); - } else { - Debug.assert(!!(result.flags & 128 /* ConstEnum */)); - if (shouldPreserveConstEnums(compilerOptions)) { - diagnosticMessage = error(errorLocation, Diagnostics.Enum_0_used_before_its_declaration, declarationName); - } } if (diagnosticMessage) { addRelatedInfo( @@ -47133,13 +47353,13 @@ ${lanes.join("\n")} } function getAnyImportSyntax(node) { switch (node.kind) { - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: return node; - case 270 /* ImportClause */: + case 272 /* ImportClause */: return node.parent; - case 271 /* NamespaceImport */: + case 273 /* NamespaceImport */: return node.parent.parent; - case 273 /* ImportSpecifier */: + case 275 /* ImportSpecifier */: return node.parent.parent.parent; default: return void 0; @@ -47149,7 +47369,7 @@ ${lanes.join("\n")} return symbol.declarations && findLast(symbol.declarations, isAliasSymbolDeclaration2); } function isAliasSymbolDeclaration2(node) { - return node.kind === 268 /* ImportEqualsDeclaration */ || node.kind === 267 /* NamespaceExportDeclaration */ || node.kind === 270 /* ImportClause */ && !!node.name || node.kind === 271 /* NamespaceImport */ || node.kind === 277 /* NamespaceExport */ || node.kind === 273 /* ImportSpecifier */ || node.kind === 278 /* ExportSpecifier */ || node.kind === 274 /* ExportAssignment */ && exportAssignmentIsAlias(node) || isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) || isAccessExpression(node) && isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* EqualsToken */ && isAliasableOrJsExpression(node.parent.right) || node.kind === 300 /* ShorthandPropertyAssignment */ || node.kind === 299 /* PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) || node.kind === 257 /* VariableDeclaration */ && isVariableDeclarationInitializedToBareOrAccessedRequire(node) || node.kind === 205 /* BindingElement */ && isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + return node.kind === 270 /* ImportEqualsDeclaration */ || node.kind === 269 /* NamespaceExportDeclaration */ || node.kind === 272 /* ImportClause */ && !!node.name || node.kind === 273 /* NamespaceImport */ || node.kind === 279 /* NamespaceExport */ || node.kind === 275 /* ImportSpecifier */ || node.kind === 280 /* ExportSpecifier */ || node.kind === 276 /* ExportAssignment */ && exportAssignmentIsAlias(node) || isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node) || isAccessExpression(node) && isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 64 /* EqualsToken */ && isAliasableOrJsExpression(node.parent.right) || node.kind === 303 /* ShorthandPropertyAssignment */ || node.kind === 302 /* PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) || node.kind === 259 /* VariableDeclaration */ && isVariableDeclarationInitializedToBareOrAccessedRequire(node) || node.kind === 207 /* BindingElement */ && isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e) { return isAliasableExpression(e) || isFunctionExpression(e) && isJSConstructor(e); @@ -47160,7 +47380,7 @@ ${lanes.join("\n")} const name = getLeftmostAccessExpression(commonJSPropertyAccess.expression).arguments[0]; return isIdentifier(commonJSPropertyAccess.name) ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : void 0; } - if (isVariableDeclaration(node) || node.moduleReference.kind === 280 /* ExternalModuleReference */) { + if (isVariableDeclaration(node) || node.moduleReference.kind === 282 /* ExternalModuleReference */) { const immediate = resolveExternalModuleName( node, getExternalModuleRequireArgument(node) || getExternalModuleImportEqualsDeclarationExpression(node) @@ -47189,10 +47409,10 @@ ${lanes.join("\n")} false ) && !node.isTypeOnly) { const typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfDeclaration(node)); - const isExport = typeOnlyDeclaration.kind === 278 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 275 /* ExportDeclaration */; + const isExport = typeOnlyDeclaration.kind === 280 /* ExportSpecifier */ || typeOnlyDeclaration.kind === 277 /* ExportDeclaration */; const message = isExport ? Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; const relatedMessage = isExport ? Diagnostics._0_was_exported_here : Diagnostics._0_was_imported_here; - const name = typeOnlyDeclaration.kind === 275 /* ExportDeclaration */ ? "*" : unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText); + const name = typeOnlyDeclaration.kind === 277 /* ExportDeclaration */ ? "*" : unescapeLeadingUnderscores(typeOnlyDeclaration.name.escapedText); addRelatedInfo(error(node.moduleReference, message), createDiagnosticForNode(typeOnlyDeclaration, relatedMessage, name)); } } @@ -47279,14 +47499,14 @@ ${lanes.join("\n")} } } function getTargetofModuleDefault(moduleSymbol, node, dontResolveAlias) { - var _a2; + var _a; let exportDefaultSymbol; if (isShorthandAmbientModuleSymbol(moduleSymbol)) { exportDefaultSymbol = moduleSymbol; } else { exportDefaultSymbol = resolveExportByName(moduleSymbol, "default" /* Default */, node, dontResolveAlias); } - const file = (_a2 = moduleSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile); + const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile); const specifier = getModuleSpecifierForImportOrExport(node); if (!specifier) { return exportDefaultSymbol; @@ -47317,7 +47537,7 @@ ${lanes.join("\n")} node, moduleSymbol, resolved, - /*overwriteTypeOnly*/ + /*overwriteEmpty*/ false ); return resolved; @@ -47327,30 +47547,30 @@ ${lanes.join("\n")} exportDefaultSymbol, /*finalTarget*/ void 0, - /*overwriteTypeOnly*/ + /*overwriteEmpty*/ false ); return exportDefaultSymbol; } function getModuleSpecifierForImportOrExport(node) { switch (node.kind) { - case 270 /* ImportClause */: + case 272 /* ImportClause */: return node.parent.moduleSpecifier; - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: return isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : void 0; - case 271 /* NamespaceImport */: + case 273 /* NamespaceImport */: return node.parent.parent.moduleSpecifier; - case 273 /* ImportSpecifier */: + case 275 /* ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; - case 278 /* ExportSpecifier */: + case 280 /* ExportSpecifier */: return node.parent.parent.moduleSpecifier; default: return Debug.assertNever(node); } } function reportNonDefaultExport(moduleSymbol, node) { - var _a2, _b, _c; - if ((_a2 = moduleSymbol.exports) == null ? void 0 : _a2.has(node.symbol.escapedName)) { + var _a, _b, _c; + if ((_a = moduleSymbol.exports) == null ? void 0 : _a.has(node.symbol.escapedName)) { error( node.name, Diagnostics.Module_0_has_no_default_export_Did_you_mean_to_use_import_1_from_0_instead, @@ -47362,8 +47582,8 @@ ${lanes.join("\n")} const exportStar = (_b = moduleSymbol.exports) == null ? void 0 : _b.get("__export" /* ExportStar */); if (exportStar) { const defaultExport = (_c = exportStar.declarations) == null ? void 0 : _c.find((decl) => { - var _a3, _b2; - return !!(isExportDeclaration(decl) && decl.moduleSpecifier && ((_b2 = (_a3 = resolveExternalModuleName(decl, decl.moduleSpecifier)) == null ? void 0 : _a3.exports) == null ? void 0 : _b2.has("default" /* Default */))); + var _a2, _b2; + return !!(isExportDeclaration(decl) && decl.moduleSpecifier && ((_b2 = (_a2 = resolveExternalModuleName(decl, decl.moduleSpecifier)) == null ? void 0 : _a2.exports) == null ? void 0 : _b2.has("default" /* Default */))); }); if (defaultExport) { addRelatedInfo(diagnostic, createDiagnosticForNode(defaultExport, Diagnostics.export_Asterisk_does_not_re_export_a_default)); @@ -47378,7 +47598,7 @@ ${lanes.join("\n")} immediate, moduleSpecifier, dontResolveAlias, - /*suppressUsageError*/ + /*suppressInteropError*/ false ); markSymbolOfAliasDeclarationIfTypeOnly( @@ -47397,7 +47617,7 @@ ${lanes.join("\n")} immediate, moduleSpecifier, dontResolveAlias, - /*suppressUsageError*/ + /*suppressInteropError*/ false ); markSymbolOfAliasDeclarationIfTypeOnly( @@ -47429,11 +47649,11 @@ ${lanes.join("\n")} return result; } function getExportOfModule(symbol, name, specifier, dontResolveAlias) { - var _a2; + var _a; if (symbol.flags & 1536 /* Module */) { const exportSymbol = getExportsOfSymbol(symbol).get(name.escapedText); const resolved = resolveSymbol(exportSymbol, dontResolveAlias); - const exportStarDeclaration = (_a2 = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a2.get(name.escapedText); + const exportStarDeclaration = (_a = getSymbolLinks(symbol).typeOnlyExportStarMap) == null ? void 0 : _a.get(name.escapedText); markSymbolOfAliasDeclarationIfTypeOnly( specifier, exportSymbol, @@ -47455,7 +47675,7 @@ ${lanes.join("\n")} } } function getExternalModuleMember(node, specifier, dontResolveAlias = false) { - var _a2; + var _a; const moduleSpecifier = getExternalModuleRequireArgument(node) || node.moduleSpecifier; const moduleSymbol = resolveExternalModuleName(node, moduleSpecifier); const name = !isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name; @@ -47489,7 +47709,7 @@ ${lanes.join("\n")} symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias); let symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias); if (symbolFromModule === void 0 && name.escapedText === "default" /* Default */) { - const file = (_a2 = moduleSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile); + const file = (_a = moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile); if (isOnlyImportedAsDefault(moduleSpecifier) || canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) { symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias); } @@ -47503,7 +47723,7 @@ ${lanes.join("\n")} } } function errorNoModuleMemberSymbol(moduleSymbol, targetSymbol, node, name) { - var _a2; + var _a; const moduleName = getFullyQualifiedName(moduleSymbol, node); const declarationName = declarationNameToString(name); const suggestion = getSuggestedSymbolForNonexistentModule(name, targetSymbol); @@ -47517,7 +47737,7 @@ ${lanes.join("\n")} ); } } else { - if ((_a2 = moduleSymbol.exports) == null ? void 0 : _a2.has("default" /* Default */)) { + if ((_a = moduleSymbol.exports) == null ? void 0 : _a.has("default" /* Default */)) { error( name, Diagnostics.Module_0_has_no_exported_member_1_Did_you_mean_to_use_import_1_from_0_instead, @@ -47530,8 +47750,8 @@ ${lanes.join("\n")} } } function reportNonExportedMember(node, name, declarationName, moduleSymbol, moduleName) { - var _a2, _b; - const localSymbol = (_b = (_a2 = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a2.locals) == null ? void 0 : _b.get(name.escapedText); + var _a, _b; + const localSymbol = (_b = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals) == null ? void 0 : _b.get(name.escapedText); const exports = moduleSymbol.exports; if (localSymbol) { const exportedEqualsSymbol = exports == null ? void 0 : exports.get("export=" /* ExportEquals */); @@ -47668,33 +47888,33 @@ ${lanes.join("\n")} return getNodeLinks(expression).resolvedSymbol; } function getTargetOfAccessExpression(node, dontRecursivelyResolve) { - if (!(isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* EqualsToken */)) { + if (!(isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 64 /* EqualsToken */)) { return void 0; } return getTargetOfAliasLikeExpression(node.parent.right, dontRecursivelyResolve); } function getTargetOfAliasDeclaration(node, dontRecursivelyResolve = false) { switch (node.kind) { - case 268 /* ImportEqualsDeclaration */: - case 257 /* VariableDeclaration */: + case 270 /* ImportEqualsDeclaration */: + case 259 /* VariableDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 270 /* ImportClause */: + case 272 /* ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 271 /* NamespaceImport */: + case 273 /* NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 277 /* NamespaceExport */: + case 279 /* NamespaceExport */: return getTargetOfNamespaceExport(node, dontRecursivelyResolve); - case 273 /* ImportSpecifier */: - case 205 /* BindingElement */: + case 275 /* ImportSpecifier */: + case 207 /* BindingElement */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 278 /* ExportSpecifier */: + case 280 /* ExportSpecifier */: return getTargetOfExportSpecifier(node, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve); - case 274 /* ExportAssignment */: - case 223 /* BinaryExpression */: + case 276 /* ExportAssignment */: + case 225 /* BinaryExpression */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 267 /* NamespaceExportDeclaration */: + case 269 /* NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); - case 300 /* ShorthandPropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: return resolveEntityName( node.name, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, @@ -47702,10 +47922,10 @@ ${lanes.join("\n")} true, dontRecursivelyResolve ); - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); - case 209 /* ElementAccessExpression */: - case 208 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: + case 210 /* PropertyAccessExpression */: return getTargetOfAccessExpression(node, dontRecursivelyResolve); default: return Debug.fail(); @@ -47789,11 +48009,11 @@ ${lanes.join("\n")} return markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, immediateTarget, overwriteEmpty) || markSymbolOfAliasDeclarationIfTypeOnlyWorker(links, finalTarget, overwriteEmpty); } function markSymbolOfAliasDeclarationIfTypeOnlyWorker(aliasDeclarationLinks, target, overwriteEmpty) { - var _a2, _b, _c; + var _a; if (target && (aliasDeclarationLinks.typeOnlyDeclaration === void 0 || overwriteEmpty && aliasDeclarationLinks.typeOnlyDeclaration === false)) { - const exportSymbol = (_b = (_a2 = target.exports) == null ? void 0 : _a2.get("export=" /* ExportEquals */)) != null ? _b : target; + const exportSymbol = ((_a = target.exports) == null ? void 0 : _a.get("export=" /* ExportEquals */)) ?? target; const typeOnly = exportSymbol.declarations && find(exportSymbol.declarations, isTypeOnlyImportOrExportDeclaration); - aliasDeclarationLinks.typeOnlyDeclaration = (_c = typeOnly != null ? typeOnly : getSymbolLinks(exportSymbol).typeOnlyDeclaration) != null ? _c : false; + aliasDeclarationLinks.typeOnlyDeclaration = typeOnly ?? getSymbolLinks(exportSymbol).typeOnlyDeclaration ?? false; } return !!aliasDeclarationLinks.typeOnlyDeclaration; } @@ -47806,13 +48026,13 @@ ${lanes.join("\n")} return links.typeOnlyDeclaration || void 0; } if (links.typeOnlyDeclaration) { - const resolved = links.typeOnlyDeclaration.kind === 275 /* ExportDeclaration */ ? resolveSymbol(getExportsOfModule(links.typeOnlyDeclaration.symbol.parent).get(links.typeOnlyExportStarName || symbol.escapedName)) : resolveAlias(links.typeOnlyDeclaration.symbol); + const resolved = links.typeOnlyDeclaration.kind === 277 /* ExportDeclaration */ ? resolveSymbol(getExportsOfModule(links.typeOnlyDeclaration.symbol.parent).get(links.typeOnlyExportStarName || symbol.escapedName)) : resolveAlias(links.typeOnlyDeclaration.symbol); return getAllSymbolFlags(resolved) & include ? links.typeOnlyDeclaration : void 0; } return void 0; } function markExportAsReferenced(node) { - if (compilerOptions.verbatimModuleSyntax) { + if (!canCollectSymbolAliasAccessabilityData) { return; } const symbol = getSymbolOfDeclaration(node); @@ -47825,7 +48045,7 @@ ${lanes.join("\n")} } } function markAliasSymbolAsReferenced(symbol) { - Debug.assert(!compilerOptions.verbatimModuleSyntax); + Debug.assert(canCollectSymbolAliasAccessabilityData); const links = getSymbolLinks(symbol); if (!links.referenced) { links.referenced = true; @@ -47846,10 +48066,10 @@ ${lanes.join("\n")} } } function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) { - if (entityName.kind === 79 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { + if (entityName.kind === 80 /* Identifier */ && isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 79 /* Identifier */ || entityName.parent.kind === 163 /* QualifiedName */) { + if (entityName.kind === 80 /* Identifier */ || entityName.parent.kind === 165 /* QualifiedName */) { return resolveEntityName( entityName, 1920 /* Namespace */, @@ -47858,7 +48078,7 @@ ${lanes.join("\n")} dontResolveAlias ); } else { - Debug.assert(entityName.parent.kind === 268 /* ImportEqualsDeclaration */); + Debug.assert(entityName.parent.kind === 270 /* ImportEqualsDeclaration */); return resolveEntityName( entityName, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, @@ -47889,6 +48109,7 @@ ${lanes.join("\n")} left, left.escapedText, 111551 /* Value */, + /*nameNotFoundMessage*/ void 0, left, /*isUse*/ @@ -47913,7 +48134,7 @@ ${lanes.join("\n")} } const namespaceMeaning = 1920 /* Namespace */ | (isInJSFile(name) ? meaning & 111551 /* Value */ : 0); let symbol; - if (name.kind === 79 /* Identifier */) { + if (name.kind === 80 /* Identifier */) { const message = meaning === namespaceMeaning || nodeIsSynthesized(name) ? Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name)); const symbolFromJSPrototype = isInJSFile(name) && !nodeIsSynthesized(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : void 0; symbol = getMergedSymbol(resolveName( @@ -47924,14 +48145,15 @@ ${lanes.join("\n")} name, /*isUse*/ true, + /*excludeGlobals*/ false )); if (!symbol) { return getMergedSymbol(symbolFromJSPrototype); } - } else if (name.kind === 163 /* QualifiedName */ || name.kind === 208 /* PropertyAccessExpression */) { - const left = name.kind === 163 /* QualifiedName */ ? name.left : name.expression; - const right = name.kind === 163 /* QualifiedName */ ? name.right : name.name; + } else if (name.kind === 165 /* QualifiedName */ || name.kind === 210 /* PropertyAccessExpression */) { + const left = name.kind === 165 /* QualifiedName */ ? name.left : name.expression; + const right = name.kind === 165 /* QualifiedName */ ? name.right : name.name; let namespace = resolveEntityName( left, namespaceMeaning, @@ -47956,6 +48178,9 @@ ${lanes.join("\n")} } } symbol = getMergedSymbol(getSymbol2(getExportsOfSymbol(namespace), right.escapedText, meaning)); + if (!symbol && namespace.flags & 2097152 /* Alias */) { + symbol = getMergedSymbol(getSymbol2(getExportsOfSymbol(resolveAlias(namespace)), right.escapedText, meaning)); + } if (!symbol) { if (!ignoreErrors) { const namespaceName = getFullyQualifiedName(namespace); @@ -47992,10 +48217,10 @@ ${lanes.join("\n")} return void 0; } } else { - throw Debug.assertNever(name, "Unknown entity name kind."); + Debug.assertNever(name, "Unknown entity name kind."); } Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here."); - if (!nodeIsSynthesized(name) && isEntityName(name) && (symbol.flags & 2097152 /* Alias */ || name.parent.kind === 274 /* ExportAssignment */)) { + if (!nodeIsSynthesized(name) && isEntityName(name) && (symbol.flags & 2097152 /* Alias */ || name.parent.kind === 276 /* ExportAssignment */)) { markSymbolOfAliasDeclarationIfTypeOnly( getAliasDeclarationFromName(name), symbol, @@ -48088,12 +48313,12 @@ ${lanes.join("\n")} return isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : void 0; } function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) { - var _a2; + var _a; const result = resolveExternalModuleInner(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation); - if (moduleReference.startsWith("npm:") && (result == null || ((_a2 = result == null ? void 0 : result.exports) == null ? void 0 : _a2.size) === 0)) { + if (moduleReference.startsWith("npm:") && (result === void 0 || ((_a = result == null ? void 0 : result.exports) == null ? void 0 : _a.size) === 0)) { const npmPackageRef = deno_exports.tryParseNpmPackageReference(moduleReference); if (npmPackageRef) { - const bareSpecifier = npmPackageRef.name + (npmPackageRef.subPath == null ? "" : "/" + npmPackageRef.subPath); + const bareSpecifier = npmPackageRef.name + (npmPackageRef.subPath === void 0 ? "" : "/" + npmPackageRef.subPath); const ambientModule = tryFindAmbientModule( bareSpecifier, /*withAugmentations*/ @@ -48107,7 +48332,7 @@ ${lanes.join("\n")} return result; } function resolveExternalModuleInner(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation = false) { - var _a2, _b, _c, _d, _e, _f, _g, _h, _i; + var _a, _b, _c, _d, _e, _f, _g, _h, _i; if (startsWith(moduleReference, "@types/")) { const diag2 = Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1; const withoutAtTypePrefix = removePrefix(moduleReference, "@types/"); @@ -48122,7 +48347,7 @@ ${lanes.join("\n")} return ambientModule; } const currentSourceFile = getSourceFileOfNode(location); - const contextSpecifier = isStringLiteralLike(location) ? location : ((_a2 = findAncestor(location, isImportCall)) == null ? void 0 : _a2.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal); + const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal); const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat; const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions); const resolvedModule = getResolvedModule(currentSourceFile, moduleReference, mode); @@ -48290,35 +48515,9 @@ ${lanes.join("\n")} } } function errorOnImplicitAnyModule(isError, errorNode, sourceFile, mode, { packageId, resolvedFileName }, moduleReference) { - var _a2, _b; let errorInfo; if (!isExternalModuleNameRelative(moduleReference) && packageId) { - const node10Result = (_b = (_a2 = sourceFile.resolvedModules) == null ? void 0 : _a2.get(moduleReference, mode)) == null ? void 0 : _b.node10Result; - errorInfo = node10Result ? chainDiagnosticMessages( - /*details*/ - void 0, - Diagnostics.There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The_1_library_may_need_to_update_its_package_json_or_typings, - node10Result, - node10Result.indexOf(nodeModulesPathPart + "@types/") > -1 ? `@types/${mangleScopedPackageName(packageId.name)}` : packageId.name - ) : typesPackageExists(packageId.name) ? chainDiagnosticMessages( - /*details*/ - void 0, - Diagnostics.If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1, - packageId.name, - mangleScopedPackageName(packageId.name) - ) : packageBundlesTypes(packageId.name) ? chainDiagnosticMessages( - /*details*/ - void 0, - Diagnostics.If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1, - packageId.name, - moduleReference - ) : chainDiagnosticMessages( - /*details*/ - void 0, - Diagnostics.Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0, - moduleReference, - mangleScopedPackageName(packageId.name) - ); + errorInfo = createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageId.name); } errorOrSuggestion(isError, errorNode, chainDiagnosticMessages( errorInfo, @@ -48327,12 +48526,6 @@ ${lanes.join("\n")} resolvedFileName )); } - function typesPackageExists(packageName) { - return getPackagesMap().has(getTypesPackageName(packageName)); - } - function packageBundlesTypes(packageName) { - return !!getPackagesMap().get(packageName); - } function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) { if (moduleSymbol == null ? void 0 : moduleSymbol.exports) { const exportEquals = resolveSymbol(moduleSymbol.exports.get("export=" /* ExportEquals */), dontResolveAlias); @@ -48359,14 +48552,18 @@ ${lanes.join("\n")} return; merged.exports.set(name, merged.exports.has(name) ? mergeSymbol(merged.exports.get(name), s) : s); }); + if (merged === exported) { + getSymbolLinks(merged).resolvedExports = void 0; + getSymbolLinks(merged).resolvedMembers = void 0; + } getSymbolLinks(merged).cjsExportMerged = merged; return links.cjsExportMerged = merged; } function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias, suppressInteropError) { - var _a2; + var _a; const symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!suppressInteropError && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !getDeclarationOfKind(symbol, 308 /* SourceFile */)) { + if (!suppressInteropError && !(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !getDeclarationOfKind(symbol, 311 /* SourceFile */)) { const compilerOptionName = moduleKind >= 5 /* ES2015 */ ? "allowSyntheticDefaultImports" : "esModuleInterop"; error(referencingLocation, Diagnostics.This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_referencing_its_default_export, compilerOptionName); return symbol; @@ -48379,7 +48576,7 @@ ${lanes.join("\n")} if (defaultOnlyType) { return cloneTypeAsModuleType(symbol, defaultOnlyType, referenceParent); } - const targetFile = (_a2 = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile); + const targetFile = (_a = moduleSymbol == null ? void 0 : moduleSymbol.declarations) == null ? void 0 : _a.find(isSourceFile); const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(getUsageModeForExpression(reference), targetFile.impliedNodeFormat); if (getESModuleInterop(compilerOptions) || isEsmCjsRef) { let sigs = getSignaturesOfStructuredType(type, 0 /* Call */); @@ -48392,7 +48589,7 @@ ${lanes.join("\n")} /*skipObjectFunctionPropertyAugment*/ true ) || isEsmCjsRef) { - const moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference); + const moduleType = type.flags & 3670016 /* StructuredType */ ? getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference) : createDefaultPropertyWrapperForModule(symbol, symbol.parent); return cloneTypeAsModuleType(symbol, moduleType, referenceParent); } } @@ -48471,7 +48668,7 @@ ${lanes.join("\n")} return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0; } function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) { - return !(resolvedExternalModuleType.flags & 134348796 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path + return !(resolvedExternalModuleType.flags & 402784252 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType)); } function getExportsOfSymbol(symbol) { @@ -48563,7 +48760,7 @@ ${lanes.join("\n")} extendExportSymbols(symbols, nestedSymbols); } if (exportStar == null ? void 0 : exportStar.isTypeOnly) { - typeOnlyExportStarMap != null ? typeOnlyExportStarMap : typeOnlyExportStarMap = /* @__PURE__ */ new Map(); + typeOnlyExportStarMap ?? (typeOnlyExportStarMap = /* @__PURE__ */ new Map()); symbols.forEach((_, escapedName) => typeOnlyExportStarMap.set( escapedName, exportStar @@ -48640,7 +48837,7 @@ ${lanes.join("\n")} container, enclosingDeclaration, 1920 /* Namespace */, - /*externalOnly*/ + /*useOnlyExternalAliasing*/ false )) { return append(concatenate(concatenate([container], additionalContainers), reexportContainers), objectLiteralContainer); @@ -48666,7 +48863,7 @@ ${lanes.join("\n")} return getSymbolOfDeclaration(d.parent.parent); } } - if (isClassExpression(d) && isBinaryExpression(d.parent) && d.parent.operatorToken.kind === 63 /* EqualsToken */ && isAccessExpression(d.parent.left) && isEntityNameExpression(d.parent.left.expression)) { + if (isClassExpression(d) && isBinaryExpression(d.parent) && d.parent.operatorToken.kind === 64 /* EqualsToken */ && isAccessExpression(d.parent.left) && isEntityNameExpression(d.parent.left.expression)) { if (isModuleExportsAccessExpression(d.parent.left) || isExportsIdentifier(d.parent.left.expression)) { return getSymbolOfDeclaration(getSourceFileOfNode(d)); } @@ -48728,17 +48925,17 @@ ${lanes.join("\n")} function findConstructorDeclaration(node) { const members = node.members; for (const member of members) { - if (member.kind === 173 /* Constructor */ && nodeIsPresent(member.body)) { + if (member.kind === 175 /* Constructor */ && nodeIsPresent(member.body)) { return member; } } } function createType(flags) { - var _a2; + var _a; const result = new Type27(checker, flags); typeCount++; result.id = typeCount; - (_a2 = tracing) == null ? void 0 : _a2.recordType(result); + (_a = tracing) == null ? void 0 : _a.recordType(result); return result; } function createTypeWithSymbol(flags, symbol) { @@ -48846,11 +49043,11 @@ ${lanes.join("\n")} } } switch (location.kind) { - case 308 /* SourceFile */: + case 311 /* SourceFile */: if (!isExternalOrCommonJsModule(location)) { break; } - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: const sym = getSymbolOfDeclaration(location); if (result = callback( (sym == null ? void 0 : sym.exports) || emptySymbols, @@ -48863,9 +49060,9 @@ ${lanes.join("\n")} return result; } break; - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 261 /* InterfaceDeclaration */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 263 /* InterfaceDeclaration */: let table; (getSymbolOfDeclaration(location).members || emptySymbols).forEach((memberSymbol, key) => { if (memberSymbol.flags & (788968 /* Type */ & ~67108864 /* Assignment */)) { @@ -48955,7 +49152,7 @@ ${lanes.join("\n")} return [symbol]; } const result2 = forEachEntry(symbols, (symbolFromSymbolTable) => { - if (symbolFromSymbolTable.flags & 2097152 /* Alias */ && symbolFromSymbolTable.escapedName !== "export=" /* ExportEquals */ && symbolFromSymbolTable.escapedName !== "default" /* Default */ && !(isUMDExportSymbol(symbolFromSymbolTable) && enclosingDeclaration && isExternalModule(getSourceFileOfNode(enclosingDeclaration))) && (!useOnlyExternalAliasing || some(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) && (isLocalNameLookup ? !some(symbolFromSymbolTable.declarations, isNamespaceReexportDeclaration) : true) && (ignoreQualification || !getDeclarationOfKind(symbolFromSymbolTable, 278 /* ExportSpecifier */))) { + if (symbolFromSymbolTable.flags & 2097152 /* Alias */ && symbolFromSymbolTable.escapedName !== "export=" /* ExportEquals */ && symbolFromSymbolTable.escapedName !== "default" /* Default */ && !(isUMDExportSymbol(symbolFromSymbolTable) && enclosingDeclaration && isExternalModule(getSourceFileOfNode(enclosingDeclaration))) && (!useOnlyExternalAliasing || some(symbolFromSymbolTable.declarations, isExternalModuleImportEqualsDeclaration)) && (isLocalNameLookup ? !some(symbolFromSymbolTable.declarations, isNamespaceReexportDeclaration) : true) && (ignoreQualification || !getDeclarationOfKind(symbolFromSymbolTable, 280 /* ExportSpecifier */))) { const resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); const candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { @@ -48965,7 +49162,7 @@ ${lanes.join("\n")} if (symbolFromSymbolTable.escapedName === symbol.escapedName && symbolFromSymbolTable.exportSymbol) { if (isAccessible( getMergedSymbol(symbolFromSymbolTable.exportSymbol), - /*aliasSymbol*/ + /*resolvedAliasSymbol*/ void 0, ignoreQualification )) { @@ -48977,7 +49174,7 @@ ${lanes.join("\n")} return result2; } const globalSymbol = symbols === nodeGlobals ? nodeGlobalThisSymbol : symbols === globals ? globalThisSymbol : void 0; - return globalSymbol != null ? getCandidateListForSymbol(globalSymbol, globalSymbol, ignoreQualification) : void 0; + return globalSymbol !== void 0 ? getCandidateListForSymbol(globalSymbol, globalSymbol, ignoreQualification) : void 0; } function getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification) { if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) { @@ -49004,7 +49201,7 @@ ${lanes.join("\n")} if (symbolFromSymbolTable === symbol) { return true; } - const shouldResolveAlias = symbolFromSymbolTable.flags & 2097152 /* Alias */ && !getDeclarationOfKind(symbolFromSymbolTable, 278 /* ExportSpecifier */); + const shouldResolveAlias = symbolFromSymbolTable.flags & 2097152 /* Alias */ && !getDeclarationOfKind(symbolFromSymbolTable, 280 /* ExportSpecifier */); symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; const flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags; if (flags & meaning) { @@ -49019,10 +49216,10 @@ ${lanes.join("\n")} if (symbol.declarations && symbol.declarations.length) { for (const declaration of symbol.declarations) { switch (declaration.kind) { - case 169 /* PropertyDeclaration */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 171 /* PropertyDeclaration */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: continue; default: return false; @@ -49158,19 +49355,19 @@ ${lanes.join("\n")} return node && getSymbolOfDeclaration(node); } function hasExternalModuleSymbol(declaration) { - return isAmbientModule(declaration) || declaration.kind === 308 /* SourceFile */ && isExternalOrCommonJsModule(declaration); + return isAmbientModule(declaration) || declaration.kind === 311 /* SourceFile */ && isExternalOrCommonJsModule(declaration); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return isModuleWithStringLiteralName(declaration) || declaration.kind === 308 /* SourceFile */ && isExternalOrCommonJsModule(declaration); + return isModuleWithStringLiteralName(declaration) || declaration.kind === 311 /* SourceFile */ && isExternalOrCommonJsModule(declaration); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { let aliasesToMakeVisible; - if (!every(filter(symbol.declarations, (d) => d.kind !== 79 /* Identifier */), getIsDeclarationVisible)) { + if (!every(filter(symbol.declarations, (d) => d.kind !== 80 /* Identifier */), getIsDeclarationVisible)) { return void 0; } return { accessibility: 0 /* Accessible */, aliasesToMakeVisible }; function getIsDeclarationVisible(declaration) { - var _a2, _b; + var _a, _b; if (!isDeclarationVisible(declaration)) { const anyImportSyntax = getAnyImportSyntax(declaration); if (anyImportSyntax && !hasSyntacticModifier(anyImportSyntax, 1 /* Export */) && // import clause without export @@ -49182,7 +49379,7 @@ ${lanes.join("\n")} } else if (isLateVisibilityPaintedStatement(declaration) && !hasSyntacticModifier(declaration, 1 /* Export */) && isDeclarationVisible(declaration.parent)) { return addVisibleAlias(declaration, declaration); } else if (isBindingElement(declaration)) { - if (symbol.flags & 2097152 /* Alias */ && isInJSFile(declaration) && ((_a2 = declaration.parent) == null ? void 0 : _a2.parent) && isVariableDeclaration(declaration.parent.parent) && ((_b = declaration.parent.parent.parent) == null ? void 0 : _b.parent) && isVariableStatement(declaration.parent.parent.parent.parent) && !hasSyntacticModifier(declaration.parent.parent.parent.parent, 1 /* Export */) && declaration.parent.parent.parent.parent.parent && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) { + if (symbol.flags & 2097152 /* Alias */ && isInJSFile(declaration) && ((_a = declaration.parent) == null ? void 0 : _a.parent) && isVariableDeclaration(declaration.parent.parent) && ((_b = declaration.parent.parent.parent) == null ? void 0 : _b.parent) && isVariableStatement(declaration.parent.parent.parent.parent) && !hasSyntacticModifier(declaration.parent.parent.parent.parent, 1 /* Export */) && declaration.parent.parent.parent.parent.parent && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) { return addVisibleAlias(declaration, declaration.parent.parent.parent.parent); } else if (symbol.flags & 2 /* BlockScopedVariable */) { const variableStatement = findAncestor(declaration, isVariableStatement); @@ -49209,9 +49406,9 @@ ${lanes.join("\n")} } function isEntityNameVisible(entityName, enclosingDeclaration) { let meaning; - if (entityName.parent.kind === 183 /* TypeQuery */ || entityName.parent.kind === 230 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 164 /* ComputedPropertyName */) { + if (entityName.parent.kind === 185 /* TypeQuery */ || entityName.parent.kind === 232 /* ExpressionWithTypeArguments */ && !isPartOfTypeNode(entityName.parent) || entityName.parent.kind === 166 /* ComputedPropertyName */) { meaning = 111551 /* Value */ | 1048576 /* ExportValue */; - } else if (entityName.kind === 163 /* QualifiedName */ || entityName.kind === 208 /* PropertyAccessExpression */ || entityName.parent.kind === 268 /* ImportEqualsDeclaration */) { + } else if (entityName.kind === 165 /* QualifiedName */ || entityName.kind === 210 /* PropertyAccessExpression */ || entityName.parent.kind === 270 /* ImportEqualsDeclaration */) { meaning = 1920 /* Namespace */; } else { meaning = 788968 /* Type */; @@ -49221,7 +49418,7 @@ ${lanes.join("\n")} enclosingDeclaration, firstIdentifier.escapedText, meaning, - /*nodeNotFoundErrorMessage*/ + /*nameNotFoundMessage*/ void 0, /*nameArg*/ void 0, @@ -49241,7 +49438,7 @@ ${lanes.join("\n")} )), firstIdentifier, meaning, - /*computeAliases*/ + /*shouldComputeAliasesToMakeVisible*/ false ).accessibility === 0 /* Accessible */) { return { accessibility: 0 /* Accessible */ }; @@ -49277,7 +49474,7 @@ ${lanes.join("\n")} return writer ? symbolToStringWorker(writer).getText() : usingSingleLineStringWriter(symbolToStringWorker); function symbolToStringWorker(writer2) { const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); - const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 308 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments(); + const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 311 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments(); const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration); printer.writeNode( 4 /* Unspecified */, @@ -49294,9 +49491,9 @@ ${lanes.join("\n")} function signatureToStringWorker(writer2) { let sigOutput; if (flags & 262144 /* WriteArrowStyleSignature */) { - sigOutput = kind === 1 /* Construct */ ? 182 /* ConstructorType */ : 181 /* FunctionType */; + sigOutput = kind === 1 /* Construct */ ? 184 /* ConstructorType */ : 183 /* FunctionType */; } else { - sigOutput = kind === 1 /* Construct */ ? 177 /* ConstructSignature */ : 176 /* CallSignature */; + sigOutput = kind === 1 /* Construct */ ? 179 /* ConstructSignature */ : 178 /* CallSignature */; } const sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */); const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon(); @@ -49430,7 +49627,7 @@ ${lanes.join("\n")} return typeNode; } function typeToTypeNodeWorker(type, context) { - var _a2, _b; + var _a, _b; if (cancellationToken && cancellationToken.throwIfCancellationRequested) { cancellationToken.throwIfCancellationRequested(); } @@ -49442,7 +49639,7 @@ ${lanes.join("\n")} return void 0; } context.approximateLength += 3; - return factory.createKeywordTypeNode(131 /* AnyKeyword */); + return factory.createKeywordTypeNode(133 /* AnyKeyword */); } if (!(context.flags & 536870912 /* NoTypeReduction */)) { type = getReducedType(type); @@ -49452,29 +49649,29 @@ ${lanes.join("\n")} return factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); } if (type === unresolvedType) { - return addSyntheticLeadingComment(factory.createKeywordTypeNode(131 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "unresolved"); + return addSyntheticLeadingComment(factory.createKeywordTypeNode(133 /* AnyKeyword */), 3 /* MultiLineCommentTrivia */, "unresolved"); } context.approximateLength += 3; - return factory.createKeywordTypeNode(type === intrinsicMarkerType ? 139 /* IntrinsicKeyword */ : 131 /* AnyKeyword */); + return factory.createKeywordTypeNode(type === intrinsicMarkerType ? 141 /* IntrinsicKeyword */ : 133 /* AnyKeyword */); } if (type.flags & 2 /* Unknown */) { - return factory.createKeywordTypeNode(157 /* UnknownKeyword */); + return factory.createKeywordTypeNode(159 /* UnknownKeyword */); } if (type.flags & 4 /* String */) { context.approximateLength += 6; - return factory.createKeywordTypeNode(152 /* StringKeyword */); + return factory.createKeywordTypeNode(154 /* StringKeyword */); } if (type.flags & 8 /* Number */) { context.approximateLength += 6; - return factory.createKeywordTypeNode(148 /* NumberKeyword */); + return factory.createKeywordTypeNode(150 /* NumberKeyword */); } if (type.flags & 64 /* BigInt */) { context.approximateLength += 6; - return factory.createKeywordTypeNode(160 /* BigIntKeyword */); + return factory.createKeywordTypeNode(162 /* BigIntKeyword */); } if (type.flags & 16 /* Boolean */ && !type.aliasSymbol) { context.approximateLength += 7; - return factory.createKeywordTypeNode(134 /* BooleanKeyword */); + return factory.createKeywordTypeNode(136 /* BooleanKeyword */); } if (type.flags & 1056 /* EnumLike */) { if (type.symbol.flags & 8 /* EnumMember */) { @@ -49507,12 +49704,12 @@ ${lanes.join("\n")} } if (type.flags & 128 /* StringLiteral */) { context.approximateLength += type.value.length + 2; - return factory.createLiteralTypeNode(setEmitFlags(factory.createStringLiteral(type.value, !!(context.flags & 268435456 /* UseSingleQuotesForStringLiteralType */)), 33554432 /* NoAsciiEscaping */)); + return factory.createLiteralTypeNode(setEmitFlags(factory.createStringLiteral(type.value, !!(context.flags & 268435456 /* UseSingleQuotesForStringLiteralType */)), 16777216 /* NoAsciiEscaping */)); } if (type.flags & 256 /* NumberLiteral */) { const value = type.value; context.approximateLength += ("" + value).length; - return factory.createLiteralTypeNode(value < 0 ? factory.createPrefixUnaryExpression(40 /* MinusToken */, factory.createNumericLiteral(-value)) : factory.createNumericLiteral(value)); + return factory.createLiteralTypeNode(value < 0 ? factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(-value)) : factory.createNumericLiteral(value)); } if (type.flags & 2048 /* BigIntLiteral */) { context.approximateLength += pseudoBigIntToString(type.value).length + 1; @@ -49533,15 +49730,15 @@ ${lanes.join("\n")} } } context.approximateLength += 13; - return factory.createTypeOperatorNode(156 /* UniqueKeyword */, factory.createKeywordTypeNode(153 /* SymbolKeyword */)); + return factory.createTypeOperatorNode(158 /* UniqueKeyword */, factory.createKeywordTypeNode(155 /* SymbolKeyword */)); } if (type.flags & 16384 /* Void */) { context.approximateLength += 4; - return factory.createKeywordTypeNode(114 /* VoidKeyword */); + return factory.createKeywordTypeNode(116 /* VoidKeyword */); } if (type.flags & 32768 /* Undefined */) { context.approximateLength += 9; - return factory.createKeywordTypeNode(155 /* UndefinedKeyword */); + return factory.createKeywordTypeNode(157 /* UndefinedKeyword */); } if (type.flags & 65536 /* Null */) { context.approximateLength += 4; @@ -49549,22 +49746,22 @@ ${lanes.join("\n")} } if (type.flags & 131072 /* Never */) { context.approximateLength += 5; - return factory.createKeywordTypeNode(144 /* NeverKeyword */); + return factory.createKeywordTypeNode(146 /* NeverKeyword */); } if (type.flags & 4096 /* ESSymbol */) { context.approximateLength += 6; - return factory.createKeywordTypeNode(153 /* SymbolKeyword */); + return factory.createKeywordTypeNode(155 /* SymbolKeyword */); } if (type.flags & 67108864 /* NonPrimitive */) { context.approximateLength += 6; - return factory.createKeywordTypeNode(149 /* ObjectKeyword */); + return factory.createKeywordTypeNode(151 /* ObjectKeyword */); } if (isThisTypeParameter(type)) { if (context.flags & 4194304 /* InObjectTypeLiteral */) { if (!context.encounteredError && !(context.flags & 32768 /* AllowThisInObjectLiteral */)) { context.encounteredError = true; } - (_b = (_a2 = context.tracker).reportInaccessibleThisError) == null ? void 0 : _b.call(_a2); + (_b = (_a = context.tracker).reportInaccessibleThisError) == null ? void 0 : _b.call(_a); } context.approximateLength += 4; return factory.createThisTypeNode(); @@ -49651,7 +49848,7 @@ ${lanes.join("\n")} const indexedType = type.type; context.approximateLength += 6; const indexTypeNode = typeToTypeNodeHelper(indexedType, context); - return factory.createTypeOperatorNode(141 /* KeyOfKeyword */, indexTypeNode); + return factory.createTypeOperatorNode(143 /* KeyOfKeyword */, indexTypeNode); } if (type.flags & 134217728 /* TemplateLiteral */) { const texts = type.texts; @@ -49709,9 +49906,9 @@ ${lanes.join("\n")} factory.createTypeReferenceNode(factory.cloneNode(name)), typeToTypeNodeHelper(type2.checkType, context), factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode2, trueTypeNode2, falseTypeNode2), - factory.createKeywordTypeNode(144 /* NeverKeyword */) + factory.createKeywordTypeNode(146 /* NeverKeyword */) ), - factory.createKeywordTypeNode(144 /* NeverKeyword */) + factory.createKeywordTypeNode(146 /* NeverKeyword */) ); } const saveInferTypeParameters = context.inferTypeParameters; @@ -49723,9 +49920,9 @@ ${lanes.join("\n")} return factory.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode); } function typeToTypeNodeOrCircularityElision(type2) { - var _a3, _b2, _c; + var _a2, _b2, _c; if (type2.flags & 1048576 /* Union */) { - if ((_a3 = context.visitedTypes) == null ? void 0 : _a3.has(getTypeId(type2))) { + if ((_a2 = context.visitedTypes) == null ? void 0 : _a2.has(getTypeId(type2))) { if (!(context.flags & 131072 /* AllowAnonymousIdentifier */)) { context.encounteredError = true; (_c = (_b2 = context.tracker) == null ? void 0 : _b2.reportCyclicStructureError) == null ? void 0 : _c.call(_b2); @@ -49736,8 +49933,11 @@ ${lanes.join("\n")} } return typeToTypeNodeHelper(type2, context); } + function isMappedTypeHomomorphic(type2) { + return !!getHomomorphicTypeVariable(type2); + } function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) { - return isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 262144 /* TypeParameter */); + return !!type2.target && isMappedTypeHomomorphic(type2.target) && !isMappedTypeHomomorphic(type2); } function createMappedTypeNodeFromType(type2) { Debug.assert(!!(type2.flags & 524288 /* Object */)); @@ -49751,7 +49951,7 @@ ${lanes.join("\n")} const name = typeParameterToName(newParam, context); newTypeVariable = factory.createTypeReferenceNode(name); } - appropriateConstraintTypeNode = factory.createTypeOperatorNode(141 /* KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context)); + appropriateConstraintTypeNode = factory.createTypeOperatorNode(143 /* KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context)); } else { appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type2), context); } @@ -49780,13 +49980,13 @@ ${lanes.join("\n")} originalConstraint.flags & 2 /* Unknown */ ? void 0 : typeToTypeNodeHelper(originalConstraint, context) )), result, - factory.createKeywordTypeNode(144 /* NeverKeyword */) + factory.createKeywordTypeNode(146 /* NeverKeyword */) ); } return result; } function createAnonymousTypeNode(type2) { - var _a3, _b2; + var _a2, _b2; const typeId = type2.id; const symbol = type2.symbol; if (symbol) { @@ -49797,11 +49997,11 @@ ${lanes.join("\n")} symbol, context.enclosingDeclaration, isInstanceType, - /*computeAliases*/ + /*shouldComputeAliasesToMakeVisible*/ false ).accessibility !== 0 /* Accessible */)) || symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) || shouldWriteTypeOfFunctionSymbol()) { return symbolToTypeNode(symbol, context, isInstanceType); - } else if ((_a3 = context.visitedTypes) == null ? void 0 : _a3.has(typeId)) { + } else if ((_a2 = context.visitedTypes) == null ? void 0 : _a2.has(typeId)) { const typeAlias = getTypeAliasForTypeLiteral(type2); if (typeAlias) { return symbolToTypeNode(typeAlias, context, 788968 /* Type */); @@ -49829,19 +50029,19 @@ ${lanes.join("\n")} return createTypeNodeFromObjectType(type2); } function shouldWriteTypeOfFunctionSymbol() { - var _a4; + var _a3; const isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */) && // typeof static method some(symbol.declarations, (declaration) => isStatic(declaration)); const isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol - forEach(symbol.declarations, (declaration) => declaration.parent.kind === 308 /* SourceFile */ || declaration.parent.kind === 265 /* ModuleBlock */)); + forEach(symbol.declarations, (declaration) => declaration.parent.kind === 311 /* SourceFile */ || declaration.parent.kind === 267 /* ModuleBlock */)); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { - return (!!(context.flags & 4096 /* UseTypeOfFunction */) || ((_a4 = context.visitedTypes) == null ? void 0 : _a4.has(typeId))) && // it is type of the symbol uses itself recursively + return (!!(context.flags & 4096 /* UseTypeOfFunction */) || ((_a3 = context.visitedTypes) == null ? void 0 : _a3.has(typeId))) && // it is type of the symbol uses itself recursively (!(context.flags & 8 /* UseStructuralFallback */) || isValueSymbolAccessible(symbol, context.enclosingDeclaration)); } } } function visitAndTransformType(type2, transform2) { - var _a3, _b2; + var _a2, _b2; const typeId = type2.id; const isConstructorObject = getObjectFlags(type2) & 16 /* Anonymous */ && type2.symbol && type2.symbol.flags & 32 /* Class */; const id = getObjectFlags(type2) & 4 /* Reference */ && type2.node ? "N" + getNodeId(type2.node) : type2.flags & 16777216 /* Conditional */ ? "N" + getNodeId(type2.root.node) : type2.symbol ? (isConstructorObject ? "+" : "") + getSymbolId(type2.symbol) : void 0; @@ -49856,7 +50056,7 @@ ${lanes.join("\n")} if (links) { links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map()); } - const cachedResult = (_a3 = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _a3.get(key); + const cachedResult = (_a2 = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _a2.get(key); if (cachedResult) { if (cachedResult.truncating) { context.truncating = true; @@ -49893,7 +50093,7 @@ ${lanes.join("\n")} function deepCloneOrReuseNodes(nodes, visitor, test, start, count) { if (nodes && nodes.length === 0) { return setTextRange(factory.createNodeArray( - /*nodes*/ + /*elements*/ void 0, nodes.hasTrailingComma ), nodes); @@ -49916,12 +50116,12 @@ ${lanes.join("\n")} } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { const signature = resolved.callSignatures[0]; - const signatureNode = signatureToSignatureDeclarationHelper(signature, 181 /* FunctionType */, context); + const signatureNode = signatureToSignatureDeclarationHelper(signature, 183 /* FunctionType */, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { const signature = resolved.constructSignatures[0]; - const signatureNode = signatureToSignatureDeclarationHelper(signature, 182 /* ConstructorType */, context); + const signatureNode = signatureToSignatureDeclarationHelper(signature, 184 /* ConstructorType */, context); return signatureNode; } } @@ -49954,7 +50154,7 @@ ${lanes.join("\n")} } const elementType = typeToTypeNodeHelper(typeArguments[0], context); const arrayType = factory.createArrayTypeNode(elementType); - return type2.target === globalArrayType ? arrayType : factory.createTypeOperatorNode(146 /* ReadonlyKeyword */, arrayType); + return type2.target === globalArrayType ? arrayType : factory.createTypeOperatorNode(148 /* ReadonlyKeyword */, arrayType); } else if (type2.target.objectFlags & 8 /* Tuple */) { typeArguments = sameMap(typeArguments, (t, i) => removeMissingType(t, !!(type2.target.elementFlags[i] & 2 /* Optional */))); if (typeArguments.length > 0) { @@ -49965,9 +50165,9 @@ ${lanes.join("\n")} for (let i = 0; i < tupleConstituentNodes.length; i++) { const flags = type2.target.elementFlags[i]; tupleConstituentNodes[i] = factory.createNamedTupleMember( - flags & 12 /* Variable */ ? factory.createToken(25 /* DotDotDotToken */) : void 0, + flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0, factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(type2.target.labeledElementDeclarations[i]))), - flags & 2 /* Optional */ ? factory.createToken(57 /* QuestionToken */) : void 0, + flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0, flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i] ); } @@ -49978,12 +50178,12 @@ ${lanes.join("\n")} } } const tupleTypeNode = setEmitFlags(factory.createTupleTypeNode(tupleConstituentNodes), 1 /* SingleLine */); - return type2.target.readonly ? factory.createTypeOperatorNode(146 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type2.target.readonly ? factory.createTypeOperatorNode(148 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || context.flags & 524288 /* AllowEmptyTuple */) { const tupleTypeNode = setEmitFlags(factory.createTupleTypeNode([]), 1 /* SingleLine */); - return type2.target.readonly ? factory.createTypeOperatorNode(146 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type2.target.readonly ? factory.createTypeOperatorNode(148 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; return void 0; @@ -50107,12 +50307,12 @@ ${lanes.join("\n")} } const typeElements = []; for (const signature of resolvedType.callSignatures) { - typeElements.push(signatureToSignatureDeclarationHelper(signature, 176 /* CallSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 178 /* CallSignature */, context)); } for (const signature of resolvedType.constructSignatures) { if (signature.flags & 4 /* Abstract */) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 177 /* ConstructSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 179 /* ConstructSignature */, context)); } for (const info of resolvedType.indexInfos) { typeElements.push(indexInfoToIndexSignatureDeclarationHelper(info, context, resolvedType.objectFlags & 1024 /* ReverseMapped */ ? createElidedInformationPlaceholder(context) : void 0)); @@ -50159,14 +50359,14 @@ ${lanes.join("\n")} void 0 ); } - return factory.createKeywordTypeNode(131 /* AnyKeyword */); + return factory.createKeywordTypeNode(133 /* AnyKeyword */); } function shouldUsePlaceholderForProperty(propertySymbol, context) { - var _a2; - return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a2 = context.reverseMappedStack) == null ? void 0 : _a2[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */)); + var _a; + return !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */) && (contains(context.reverseMappedStack, propertySymbol) || ((_a = context.reverseMappedStack) == null ? void 0 : _a[0]) && !(getObjectFlags(last(context.reverseMappedStack).links.propertyType) & 16 /* Anonymous */)); } function addPropertyToElementList(propertySymbol, context, typeElements) { - var _a2; + var _a; const propertyIsReverseMapped = !!(getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */); const propertyType = shouldUsePlaceholderForProperty(propertySymbol, context) ? anyType : getNonMissingTypeOfSymbol(propertySymbol); const saveEnclosingDeclaration = context.enclosingDeclaration; @@ -50188,15 +50388,15 @@ ${lanes.join("\n")} context.tracker.reportNonSerializableProperty(symbolToString(propertySymbol)); } } - context.enclosingDeclaration = propertySymbol.valueDeclaration || ((_a2 = propertySymbol.declarations) == null ? void 0 : _a2[0]) || saveEnclosingDeclaration; + context.enclosingDeclaration = propertySymbol.valueDeclaration || ((_a = propertySymbol.declarations) == null ? void 0 : _a[0]) || saveEnclosingDeclaration; const propertyName = getPropertyNameNodeForSymbol(propertySymbol, context); context.enclosingDeclaration = saveEnclosingDeclaration; context.approximateLength += symbolName(propertySymbol).length + 1; - const optionalToken = propertySymbol.flags & 16777216 /* Optional */ ? factory.createToken(57 /* QuestionToken */) : void 0; + const optionalToken = propertySymbol.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0; if (propertySymbol.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(propertyType).length && !isReadonlySymbol(propertySymbol)) { const signatures = getSignaturesOfType(filterType(propertyType, (t) => !(t.flags & 32768 /* Undefined */)), 0 /* Call */); for (const signature of signatures) { - const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 170 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); + const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration)); } } else { @@ -50208,12 +50408,12 @@ ${lanes.join("\n")} context.reverseMappedStack || (context.reverseMappedStack = []); context.reverseMappedStack.push(propertySymbol); } - propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(131 /* AnyKeyword */); + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */); if (propertyIsReverseMapped) { context.reverseMappedStack.pop(); } } - const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(146 /* ReadonlyKeyword */)] : void 0; + const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0; if (modifiers) { context.approximateLength += 9; } @@ -50226,9 +50426,9 @@ ${lanes.join("\n")} typeElements.push(preserveCommentsOn(propertySignature)); } function preserveCommentsOn(node) { - var _a3; - if (some(propertySymbol.declarations, (d) => d.kind === 351 /* JSDocPropertyTag */)) { - const d = (_a3 = propertySymbol.declarations) == null ? void 0 : _a3.find((d2) => d2.kind === 351 /* JSDocPropertyTag */); + var _a2; + if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) { + const d = (_a2 = propertySymbol.declarations) == null ? void 0 : _a2.find((d2) => d2.kind === 354 /* JSDocPropertyTag */); const commentText = getTextOfJSDocComment(d.comment); if (commentText) { setSyntheticLeadingComments(node, [{ kind: 3 /* MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); @@ -50261,7 +50461,7 @@ ${lanes.join("\n")} } } const mayHaveNameCollisions = !(context.flags & 64 /* UseFullyQualifiedType */); - const seenNames = mayHaveNameCollisions ? createUnderscoreEscapedMultiMap() : void 0; + const seenNames = mayHaveNameCollisions ? createMultiMap() : void 0; const result = []; let i = 0; for (const type of types) { @@ -50328,13 +50528,12 @@ ${lanes.join("\n")} } context.approximateLength += name.length + 4; return factory.createIndexSignature( - indexInfo.isReadonly ? [factory.createToken(146 /* ReadonlyKeyword */)] : void 0, + indexInfo.isReadonly ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0, [indexingParameter], typeNode ); } function signatureToSignatureDeclarationHelper(signature, kind, context, options) { - var _a2, _b, _c, _d, _e; const suppressAny = context.flags & 256 /* SuppressAnyReturnType */; if (suppressAny) context.flags &= ~256 /* SuppressAnyReturnType */; @@ -50355,7 +50554,7 @@ ${lanes.join("\n")} if (context.enclosingDeclaration && signature.declaration && signature.declaration !== context.enclosingDeclaration && !isInJSFile(signature.declaration) && some(expandedParams)) { const existingFakeScope = getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration ? context.enclosingDeclaration : void 0; Debug.assertOptionalNode(existingFakeScope, isBlock); - const locals = (_a2 = existingFakeScope == null ? void 0 : existingFakeScope.locals) != null ? _a2 : createSymbolTable(); + const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable(); let newLocals; for (const param of expandedParams) { if (!locals.has(param.escapedName)) { @@ -50384,7 +50583,7 @@ ${lanes.join("\n")} } } } - const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 173 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports)); + const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 175 /* Constructor */, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports)); const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context); if (thisParameter) { parameters.unshift(thisParameter); @@ -50392,8 +50591,8 @@ ${lanes.join("\n")} let returnTypeNode; const typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { - const assertsModifier = typePredicate.kind === 2 /* AssertsThis */ || typePredicate.kind === 3 /* AssertsIdentifier */ ? factory.createToken(129 /* AssertsKeyword */) : void 0; - const parameterName = typePredicate.kind === 1 /* Identifier */ || typePredicate.kind === 3 /* AssertsIdentifier */ ? setEmitFlags(factory.createIdentifier(typePredicate.parameterName), 33554432 /* NoAsciiEscaping */) : factory.createThisTypeNode(); + const assertsModifier = typePredicate.kind === 2 /* AssertsThis */ || typePredicate.kind === 3 /* AssertsIdentifier */ ? factory.createToken(131 /* AssertsKeyword */) : void 0; + const parameterName = typePredicate.kind === 1 /* Identifier */ || typePredicate.kind === 3 /* AssertsIdentifier */ ? setEmitFlags(factory.createIdentifier(typePredicate.parameterName), 16777216 /* NoAsciiEscaping */) : factory.createThisTypeNode(); const typeNode = typePredicate.type && typeToTypeNodeHelper(typePredicate.type, context); returnTypeNode = factory.createTypePredicateNode(assertsModifier, parameterName, typeNode); } else { @@ -50401,19 +50600,19 @@ ${lanes.join("\n")} if (returnType && !(suppressAny && isTypeAny(returnType))) { returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports); } else if (!suppressAny) { - returnTypeNode = factory.createKeywordTypeNode(131 /* AnyKeyword */); + returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */); } } let modifiers = options == null ? void 0 : options.modifiers; - if (kind === 182 /* ConstructorType */ && signature.flags & 4 /* Abstract */) { + if (kind === 184 /* ConstructorType */ && signature.flags & 4 /* Abstract */) { const flags = modifiersToFlags(modifiers); modifiers = factory.createModifiersFromModifierFlags(flags | 256 /* Abstract */); } - const node = kind === 176 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 177 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 170 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (_b = options == null ? void 0 : options.name) != null ? _b : factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 171 /* MethodDeclaration */ ? factory.createMethodDeclaration( + const node = kind === 178 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 179 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 172 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 173 /* MethodDeclaration */ ? factory.createMethodDeclaration( modifiers, /*asteriskToken*/ void 0, - (_c = options == null ? void 0 : options.name) != null ? _c : factory.createIdentifier(""), + (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), /*questionToken*/ void 0, typeParameters, @@ -50421,25 +50620,25 @@ ${lanes.join("\n")} returnTypeNode, /*body*/ void 0 - ) : kind === 173 /* Constructor */ ? factory.createConstructorDeclaration( + ) : kind === 175 /* Constructor */ ? factory.createConstructorDeclaration( modifiers, parameters, /*body*/ void 0 - ) : kind === 174 /* GetAccessor */ ? factory.createGetAccessorDeclaration( + ) : kind === 176 /* GetAccessor */ ? factory.createGetAccessorDeclaration( modifiers, - (_d = options == null ? void 0 : options.name) != null ? _d : factory.createIdentifier(""), + (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ void 0 - ) : kind === 175 /* SetAccessor */ ? factory.createSetAccessorDeclaration( + ) : kind === 177 /* SetAccessor */ ? factory.createSetAccessorDeclaration( modifiers, - (_e = options == null ? void 0 : options.name) != null ? _e : factory.createIdentifier(""), + (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), parameters, /*body*/ void 0 - ) : kind === 178 /* IndexSignature */ ? factory.createIndexSignature(modifiers, parameters, returnTypeNode) : kind === 320 /* JSDocFunctionType */ ? factory.createJSDocFunctionType(parameters, returnTypeNode) : kind === 181 /* FunctionType */ ? factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode != null ? returnTypeNode : factory.createTypeReferenceNode(factory.createIdentifier(""))) : kind === 182 /* ConstructorType */ ? factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode != null ? returnTypeNode : factory.createTypeReferenceNode(factory.createIdentifier(""))) : kind === 259 /* FunctionDeclaration */ ? factory.createFunctionDeclaration( + ) : kind === 180 /* IndexSignature */ ? factory.createIndexSignature(modifiers, parameters, returnTypeNode) : kind === 323 /* JSDocFunctionType */ ? factory.createJSDocFunctionType(parameters, returnTypeNode) : kind === 183 /* FunctionType */ ? factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode ?? factory.createTypeReferenceNode(factory.createIdentifier(""))) : kind === 184 /* ConstructorType */ ? factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode ?? factory.createTypeReferenceNode(factory.createIdentifier(""))) : kind === 261 /* FunctionDeclaration */ ? factory.createFunctionDeclaration( modifiers, /*asteriskToken*/ void 0, @@ -50449,7 +50648,7 @@ ${lanes.join("\n")} returnTypeNode, /*body*/ void 0 - ) : kind === 215 /* FunctionExpression */ ? factory.createFunctionExpression( + ) : kind === 217 /* FunctionExpression */ ? factory.createFunctionExpression( modifiers, /*asteriskToken*/ void 0, @@ -50458,7 +50657,7 @@ ${lanes.join("\n")} parameters, returnTypeNode, factory.createBlock([]) - ) : kind === 216 /* ArrowFunction */ ? factory.createArrowFunction( + ) : kind === 218 /* ArrowFunction */ ? factory.createArrowFunction( modifiers, typeParameters, parameters, @@ -50481,12 +50680,12 @@ ${lanes.join("\n")} const thisTag = getJSDocThisTag(signature.declaration); if (thisTag && thisTag.typeExpression) { return factory.createParameterDeclaration( - /* modifiers */ + /*modifiers*/ void 0, - /* dotDotDotToken */ + /*dotDotDotToken*/ void 0, "this", - /* questionToken */ + /*questionToken*/ void 0, typeToTypeNodeHelper(getTypeFromTypeNode(thisTag.typeExpression), context) ); @@ -50508,9 +50707,9 @@ ${lanes.join("\n")} return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { - let parameterDeclaration = getDeclarationOfKind(parameterSymbol, 166 /* Parameter */); + let parameterDeclaration = getDeclarationOfKind(parameterSymbol, 168 /* Parameter */); if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) { - parameterDeclaration = getDeclarationOfKind(parameterSymbol, 344 /* JSDocParameterTag */); + parameterDeclaration = getDeclarationOfKind(parameterSymbol, 347 /* JSDocParameterTag */); } let parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -50519,10 +50718,10 @@ ${lanes.join("\n")} const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports); const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0; const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */; - const dotDotDotToken = isRest ? factory.createToken(25 /* DotDotDotToken */) : void 0; - const name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 79 /* Identifier */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name), 33554432 /* NoAsciiEscaping */) : parameterDeclaration.name.kind === 163 /* QualifiedName */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name.right), 33554432 /* NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : symbolName(parameterSymbol) : symbolName(parameterSymbol); + const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0; + const name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 80 /* Identifier */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) : parameterDeclaration.name.kind === 165 /* QualifiedName */ ? setEmitFlags(factory.cloneNode(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : symbolName(parameterSymbol) : symbolName(parameterSymbol); const isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 16384 /* OptionalParameter */; - const questionToken = isOptional ? factory.createToken(57 /* QuestionToken */) : void 0; + const questionToken = isOptional ? factory.createToken(58 /* QuestionToken */) : void 0; const parameterNode = factory.createParameterDeclaration( modifiers, dotDotDotToken, @@ -50561,7 +50760,7 @@ ${lanes.join("\n")} if (!nodeIsSynthesized(visited)) { visited = factory.cloneNode(visited); } - return setEmitFlags(visited, 1 /* SingleLine */ | 33554432 /* NoAsciiEscaping */); + return setEmitFlags(visited, 1 /* SingleLine */ | 16777216 /* NoAsciiEscaping */); } } } @@ -50573,7 +50772,7 @@ ${lanes.join("\n")} firstIdentifier, firstIdentifier.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */, - /*nodeNotFoundErrorMessage*/ + /*nameNotFoundMessage*/ void 0, /*nameArg*/ void 0, @@ -50670,11 +50869,11 @@ ${lanes.join("\n")} return typeParameterNodes; } function lookupTypeParameterNodes(chain, index, context) { - var _a2; + var _a; Debug.assert(chain && 0 <= index && index < chain.length); const symbol = chain[index]; const symbolId = getSymbolId(symbol); - if ((_a2 = context.typeParameterSymbolList) == null ? void 0 : _a2.has(symbolId)) { + if ((_a = context.typeParameterSymbolList) == null ? void 0 : _a.has(symbolId)) { return void 0; } (context.typeParameterSymbolList || (context.typeParameterSymbolList = /* @__PURE__ */ new Set())).add(symbolId); @@ -50700,12 +50899,11 @@ ${lanes.join("\n")} return top; } function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { - var _a2; - let file = getDeclarationOfKind(symbol, 308 /* SourceFile */); + let file = getDeclarationOfKind(symbol, 311 /* SourceFile */); if (!file) { const equivalentFileSymbol = firstDefined(symbol.declarations, (d) => getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol)); if (equivalentFileSymbol) { - file = getDeclarationOfKind(equivalentFileSymbol, 308 /* SourceFile */); + file = getDeclarationOfKind(equivalentFileSymbol, 311 /* SourceFile */); } } if (file && file.moduleName !== void 0) { @@ -50751,7 +50949,7 @@ ${lanes.join("\n")} }, { overrideImportMode } )); - (_a2 = links.specifierCache) != null ? _a2 : links.specifierCache = /* @__PURE__ */ new Map(); + links.specifierCache ?? (links.specifierCache = /* @__PURE__ */ new Map()); links.specifierCache.set(cacheKey, specifier); } return specifier; @@ -50761,7 +50959,7 @@ ${lanes.join("\n")} return symbol.parent ? factory.createQualifiedName(symbolToEntityNameNode(symbol.parent), identifier) : identifier; } function symbolToTypeNode(symbol, context, meaning, overrideTypeArguments) { - var _a2, _b, _c, _d; + var _a, _b, _c, _d; const chain = lookupSymbolChain(symbol, context, meaning, !(context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */)); const isTypeOf = meaning === 111551 /* Value */; if (some(chain[0].declarations, hasNonGlobalAugmentationExternalModuleSymbol)) { @@ -50780,7 +50978,7 @@ ${lanes.join("\n")} factory.createStringLiteral("import") ) ]))); - (_b = (_a2 = context.tracker).reportImportTypeNodeResolutionModeOverride) == null ? void 0 : _b.call(_a2); + (_b = (_a = context.tracker).reportImportTypeNodeResolutionModeOverride) == null ? void 0 : _b.call(_a); } } if (!specifier) { @@ -50887,7 +51085,7 @@ ${lanes.join("\n")} return factory.createIndexedAccessTypeNode(factory.createTypeReferenceNode(LHS, typeParameterNodes), factory.createLiteralTypeNode(factory.createStringLiteral(symbolName2))); } } - const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 33554432 /* NoAsciiEscaping */); + const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 16777216 /* NoAsciiEscaping */); if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes)); identifier.symbol = symbol2; @@ -50906,7 +51104,7 @@ ${lanes.join("\n")} context.enclosingDeclaration, escapedName, 788968 /* Type */, - /*nameNotFoundArg*/ + /*nameNotFoundMessage*/ void 0, escapedName, /*isUse*/ @@ -50921,7 +51119,7 @@ ${lanes.join("\n")} return false; } function typeParameterToName(type, context) { - var _a2, _b; + var _a, _b; if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) { const cached = context.typeParameterNames.get(getTypeId(type)); if (cached) { @@ -50935,12 +51133,12 @@ ${lanes.join("\n")} /*expectsIdentifier*/ true ); - if (!(result.kind & 79 /* Identifier */)) { + if (!(result.kind & 80 /* Identifier */)) { return factory.createIdentifier("(Missing type parameter)"); } if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) { const rawtext = result.escapedText; - let i = ((_a2 = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _a2.get(rawtext)) || 0; + let i = ((_a = context.typeParameterNamesByTextNextNameCount) == null ? void 0 : _a.get(rawtext)) || 0; let text = rawtext; while (((_b = context.typeParameterNamesByText) == null ? void 0 : _b.has(text)) || typeParameterShadowsNameInScope(text, context, type)) { i++; @@ -50973,7 +51171,7 @@ ${lanes.join("\n")} if (index === 0) { context.flags ^= 16777216 /* InInitialEntityName */; } - const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 33554432 /* NoAsciiEscaping */); + const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 16777216 /* NoAsciiEscaping */); if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes)); identifier.symbol = symbol2; @@ -50998,7 +51196,7 @@ ${lanes.join("\n")} return factory.createStringLiteral(getSpecifierForModuleSymbol(symbol2, context)); } if (index === 0 || canUsePropertyAccess(symbolName2, languageVersion)) { - const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 33554432 /* NoAsciiEscaping */); + const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 16777216 /* NoAsciiEscaping */); if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes)); identifier.symbol = symbol2; @@ -51015,7 +51213,7 @@ ${lanes.join("\n")} expression = factory.createNumericLiteral(+symbolName2); } if (!expression) { - const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 33554432 /* NoAsciiEscaping */); + const identifier = setEmitFlags(factory.createIdentifier(symbolName2), 16777216 /* NoAsciiEscaping */); if (typeParameterNodes) setIdentifierTypeArguments(identifier, factory.createNodeArray(typeParameterNodes)); identifier.symbol = symbol2; @@ -51148,7 +51346,7 @@ ${lanes.join("\n")} 67108863 /* All */, /*ignoreErrors*/ true, - /*dontResolveALias*/ + /*dontResolveAlias*/ true ); if (sym) { @@ -51168,7 +51366,7 @@ ${lanes.join("\n")} const type = getDeclaredTypeOfSymbol(sym); const name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : factory.cloneNode(node); name.symbol = sym; - return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 33554432 /* NoAsciiEscaping */) }; + return { introducesError, node: setEmitFlags(setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) }; } } return { introducesError, node }; @@ -51185,17 +51383,17 @@ ${lanes.join("\n")} } return transformed === existing ? setTextRange(factory.cloneNode(existing), existing) : transformed; function visitExistingNodeTreeSymbols(node) { - if (isJSDocAllType(node) || node.kind === 322 /* JSDocNamepathType */) { - return factory.createKeywordTypeNode(131 /* AnyKeyword */); + if (isJSDocAllType(node) || node.kind === 325 /* JSDocNamepathType */) { + return factory.createKeywordTypeNode(133 /* AnyKeyword */); } if (isJSDocUnknownType(node)) { - return factory.createKeywordTypeNode(157 /* UnknownKeyword */); + return factory.createKeywordTypeNode(159 /* UnknownKeyword */); } if (isJSDocNullableType(node)) { return factory.createUnionTypeNode([visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode), factory.createLiteralTypeNode(factory.createNull())]); } if (isJSDocOptionalType(node)) { - return factory.createUnionTypeNode([visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode), factory.createKeywordTypeNode(155 /* UndefinedKeyword */)]); + return factory.createUnionTypeNode([visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode), factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]); } if (isJSDocNonNullableType(node)) { return visitNode(node.type, visitExistingNodeTreeSymbols); @@ -51212,13 +51410,13 @@ ${lanes.join("\n")} /*modifiers*/ void 0, name, - t.isBracketed || t.typeExpression && isJSDocOptionalType(t.typeExpression.type) ? factory.createToken(57 /* QuestionToken */) : void 0, - overrideTypeNode || t.typeExpression && visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols, isTypeNode) || factory.createKeywordTypeNode(131 /* AnyKeyword */) + t.isBracketed || t.typeExpression && isJSDocOptionalType(t.typeExpression.type) ? factory.createToken(58 /* QuestionToken */) : void 0, + overrideTypeNode || t.typeExpression && visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols, isTypeNode) || factory.createKeywordTypeNode(133 /* AnyKeyword */) ); })); } if (isTypeReferenceNode(node) && isIdentifier(node.typeName) && node.typeName.escapedText === "") { - return setOriginalNode(factory.createKeywordTypeNode(131 /* AnyKeyword */), node); + return setOriginalNode(factory.createKeywordTypeNode(133 /* AnyKeyword */), node); } if ((isExpressionWithTypeArguments(node) || isTypeReferenceNode(node)) && isJSDocIndexSignature(node)) { return factory.createTypeLiteralNode([factory.createIndexSignature( @@ -51227,7 +51425,7 @@ ${lanes.join("\n")} [factory.createParameterDeclaration( /*modifiers*/ void 0, - /*dotdotdotToken*/ + /*dotDotDotToken*/ void 0, "x", /*questionToken*/ @@ -51254,7 +51452,7 @@ ${lanes.join("\n")} /*initializer*/ void 0 )), - visitNode(newTypeNode || node.type, visitExistingNodeTreeSymbols, isTypeNode) || factory.createKeywordTypeNode(131 /* AnyKeyword */) + visitNode(newTypeNode || node.type, visitExistingNodeTreeSymbols, isTypeNode) || factory.createKeywordTypeNode(133 /* AnyKeyword */) ); } else { return factory.createFunctionTypeNode( @@ -51269,7 +51467,7 @@ ${lanes.join("\n")} /*initializer*/ void 0 )), - visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode) || factory.createKeywordTypeNode(131 /* AnyKeyword */) + visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode) || factory.createKeywordTypeNode(133 /* AnyKeyword */) ); } } @@ -51309,7 +51507,7 @@ ${lanes.join("\n")} } return visitEachChild(node, visitExistingNodeTreeSymbols, nullTransformationContext); function getEffectiveDotDotDotForParameter(p) { - return p.dotDotDotToken || (p.type && isJSDocVariadicType(p.type) ? factory.createToken(25 /* DotDotDotToken */) : void 0); + return p.dotDotDotToken || (p.type && isJSDocVariadicType(p.type) ? factory.createToken(26 /* DotDotDotToken */) : void 0); } function getNameForJSDocFunctionParameter(p, index) { return p.name && isIdentifier(p.name) && p.name.escapedText === "this" ? "this" : getEffectiveDotDotDotForParameter(p) ? `args` : `arg${index}`; @@ -51349,14 +51547,14 @@ ${lanes.join("\n")} function symbolTableToDeclarationStatements(symbolTable, context, bundled) { const serializePropertySymbolForClass = makeSerializePropertySymbol( factory.createPropertyDeclaration, - 171 /* MethodDeclaration */, - /*useAcessors*/ + 173 /* MethodDeclaration */, + /*useAccessors*/ true ); const serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol( (mods, name, question, type) => factory.createPropertySignature(mods, name, question, type), - 170 /* MethodSignature */, - /*useAcessors*/ + 172 /* MethodSignature */, + /*useAccessors*/ false ); const enclosingDeclaration = context.enclosingDeclaration; @@ -51373,12 +51571,12 @@ ${lanes.join("\n")} const tracker = { ...oldcontext.tracker.inner, trackSymbol: (sym, decl, meaning) => { - var _a2; + var _a; const accessibleResult = isSymbolAccessible( sym, decl, meaning, - /*computeAliases*/ + /*shouldComputeAliasesToMakeVisible*/ false ); if (accessibleResult.accessibility === 0 /* Accessible */) { @@ -51386,7 +51584,7 @@ ${lanes.join("\n")} if (!(sym.flags & 4 /* Property */)) { includePrivateSymbol(chain[0]); } - } else if ((_a2 = oldcontext.tracker.inner) == null ? void 0 : _a2.trackSymbol) { + } else if ((_a = oldcontext.tracker.inner) == null ? void 0 : _a.trackSymbol) { return oldcontext.tracker.inner.trackSymbol(sym, decl, meaning); } return false; @@ -51406,7 +51604,7 @@ ${lanes.join("\n")} visitSymbolTable(symbolTable); return mergeRedundantStatements(results); function isIdentifierAndNotUndefined(node) { - return !!node && node.kind === 79 /* Identifier */; + return !!node && node.kind === 80 /* Identifier */; } function getNamesOfDeclaration(statement) { if (isVariableStatement(statement)) { @@ -51437,7 +51635,7 @@ ${lanes.join("\n")} factory.createNamedExports(map(flatMap(excessExports, (e) => getNamesOfDeclaration(e)), (id) => factory.createExportSpecifier( /*isTypeOnly*/ false, - /*alias*/ + /*propertyName*/ void 0, id ))), @@ -51590,7 +51788,7 @@ ${lanes.join("\n")} } } function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias) { - var _a2, _b, _c, _d; + var _a, _b, _c, _d; const symbolName2 = unescapeLeadingUnderscores(symbol.escapedName); const isDefault = symbol.escapedName === "default" /* Default */; if (isPrivate && !(context.flags & 131072 /* AllowAnonymousIdentifier */) && isStringANonContextualKeyword(symbolName2) && !isDefault) { @@ -51611,7 +51809,7 @@ ${lanes.join("\n")} if (symbol.flags & 524288 /* TypeAlias */) { serializeTypeAlias(symbol, symbolName2, modifierFlags); } - if (symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */) && symbol.escapedName !== "export=" /* ExportEquals */ && !(symbol.flags & 4194304 /* Prototype */) && !(symbol.flags & 32 /* Class */) && !(symbol.flags & 8192 /* Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) { + if (symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */ | 98304 /* Accessor */) && symbol.escapedName !== "export=" /* ExportEquals */ && !(symbol.flags & 4194304 /* Prototype */) && !(symbol.flags & 32 /* Class */) && !(symbol.flags & 8192 /* Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) { if (propertyAsAlias) { const createdExport = serializeMaybeAliasAssignment(symbol); if (createdExport) { @@ -51624,7 +51822,7 @@ ${lanes.join("\n")} if (!(symbol.flags & 16 /* Function */) && isTypeRepresentableAsFunctionNamespaceMerge(type, symbol)) { serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags); } else { - const flags = !(symbol.flags & 2 /* BlockScopedVariable */) ? ((_a2 = symbol.parent) == null ? void 0 : _a2.valueDeclaration) && isSourceFile((_b = symbol.parent) == null ? void 0 : _b.valueDeclaration) ? 2 /* Const */ : void 0 : isConstVariable(symbol) ? 2 /* Const */ : 1 /* Let */; + const flags = !(symbol.flags & 2 /* BlockScopedVariable */) ? ((_a = symbol.parent) == null ? void 0 : _a.valueDeclaration) && isSourceFile((_b = symbol.parent) == null ? void 0 : _b.valueDeclaration) ? 2 /* Const */ : void 0 : isConstVariable(symbol) ? 2 /* Const */ : 1 /* Let */; const name = needsPostExportDefault || !(symbol.flags & 4 /* Property */) ? localName : getUnusedName(localName, symbol); let textRange = symbol.declarations && find(symbol.declarations, (d) => isVariableDeclaration(d)); if (textRange && isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) { @@ -51730,7 +51928,7 @@ ${lanes.join("\n")} addResult(factory.createExportAssignment( /*modifiers*/ void 0, - /*isExportAssignment*/ + /*isExportEquals*/ false, factory.createIdentifier(getInternalSymbolName(symbol, symbolName2)) ), 0 /* None */); @@ -51783,11 +51981,11 @@ ${lanes.join("\n")} results.push(node); } function serializeTypeAlias(symbol, symbolName2, modifierFlags) { - var _a2; + var _a; const aliasType = getDeclaredTypeOfTypeAlias(symbol); const typeParams = getSymbolLinks(symbol).typeParameters; const typeParamDecls = map(typeParams, (p) => typeParameterToDeclaration(p, context)); - const jsdocAliasDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isJSDocTypeAlias); + const jsdocAliasDecl = (_a = symbol.declarations) == null ? void 0 : _a.find(isJSDocTypeAlias); const commentText = getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : void 0); const oldFlags = context.flags; context.flags |= 8388608 /* InTypeAlias */; @@ -51814,10 +52012,10 @@ ${lanes.join("\n")} const baseTypes = getBaseTypes(interfaceType); const baseType = length(baseTypes) ? getIntersectionType(baseTypes) : void 0; const members = flatMap(getPropertiesOfType(interfaceType), (p) => serializePropertySymbolForInterface(p, baseType)); - const callSignatures = serializeSignatures(0 /* Call */, interfaceType, baseType, 176 /* CallSignature */); - const constructSignatures = serializeSignatures(1 /* Construct */, interfaceType, baseType, 177 /* ConstructSignature */); + const callSignatures = serializeSignatures(0 /* Call */, interfaceType, baseType, 178 /* CallSignature */); + const constructSignatures = serializeSignatures(1 /* Construct */, interfaceType, baseType, 179 /* ConstructSignature */); const indexSignatures = serializeIndexSignatures(interfaceType, baseType); - const heritageClauses = !length(baseTypes) ? void 0 : [factory.createHeritageClause(94 /* ExtendsKeyword */, mapDefined(baseTypes, (b) => trySerializeAsTypeReference(b, 111551 /* Value */)))]; + const heritageClauses = !length(baseTypes) ? void 0 : [factory.createHeritageClause(96 /* ExtendsKeyword */, mapDefined(baseTypes, (b) => trySerializeAsTypeReference(b, 111551 /* Value */)))]; addResult(factory.createInterfaceDeclaration( /*modifiers*/ void 0, @@ -51828,7 +52026,8 @@ ${lanes.join("\n")} ), modifierFlags); } function getNamespaceMembersForSerialization(symbol) { - return !symbol.exports ? [] : filter(arrayFrom(symbol.exports.values()), isNamespaceMember); + const exports = getExportsOfSymbol(symbol); + return !exports ? [] : filter(arrayFrom(exports.values()), (m) => isNamespaceMember(m) && isIdentifierText(m.escapedName, 99 /* ESNext */)); } function isTypeOnlyNamespace(symbol) { return every(getNamespaceMembersForSerialization(symbol), (m) => !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* Value */)); @@ -51851,12 +52050,12 @@ ${lanes.join("\n")} /*isTypeOnly*/ false, factory.createNamedExports(mapDefined(filter(mergedMembers, (n) => n.escapedName !== "export=" /* ExportEquals */), (s) => { - var _a2, _b; + var _a, _b; const name = unescapeLeadingUnderscores(s.escapedName); const localName2 = getInternalSymbolName(s, name); const aliasDecl = s.declarations && getDeclarationOfAliasSymbol(s); if (containingFile && (aliasDecl ? containingFile !== getSourceFileOfNode(aliasDecl) : !some(s.declarations, (d) => getSourceFileOfNode(d) === containingFile))) { - (_b = (_a2 = context.tracker) == null ? void 0 : _a2.reportNonlocalAugmentation) == null ? void 0 : _b.call(_a2, containingFile, symbol, s); + (_b = (_a = context.tracker) == null ? void 0 : _a.reportNonlocalAugmentation) == null ? void 0 : _b.call(_a, containingFile, symbol, s); return void 0; } const target = aliasDecl && getTargetOfAliasDeclaration( @@ -51896,7 +52095,7 @@ ${lanes.join("\n")} function serializeAsFunctionNamespaceMerge(type, symbol, localName, modifierFlags) { const signatures = getSignaturesOfType(type, 0 /* Call */); for (const sig of signatures) { - const decl = signatureToSignatureDeclarationHelper(sig, 259 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + const decl = signatureToSignatureDeclarationHelper(sig, 261 /* FunctionDeclaration */, context, { name: factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); addResult(setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); } if (!(symbol.flags & (512 /* ValueModule */ | 1024 /* NamespaceModule */) && !!symbol.exports && !!symbol.exports.size)) { @@ -52022,13 +52221,13 @@ ${lanes.join("\n")} return void 0; } function serializeAsClass(symbol, localName, modifierFlags) { - var _a2, _b; - const originalDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isClassLike); + var _a, _b; + const originalDecl = (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike); const oldEnclosing = context.enclosingDeclaration; context.enclosingDeclaration = originalDecl || oldEnclosing; const localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); const typeParamDecls = map(localParams, (p) => typeParameterToDeclaration(p, context)); - const classType = getDeclaredTypeOfClassOrInterface(symbol); + const classType = getTypeWithThisArgument(getDeclaredTypeOfClassOrInterface(symbol)); const baseTypes = getBaseTypes(classType); const originalImplements = originalDecl && getEffectiveImplementsTypeNodes(originalDecl); const implementsExpressions = originalImplements && sanitizeJSDocImplements(originalImplements) || mapDefined(getImplementsTypes(classType), serializeImplementedType); @@ -52036,8 +52235,8 @@ ${lanes.join("\n")} const isClass = !!((_b = staticType.symbol) == null ? void 0 : _b.valueDeclaration) && isClassLike(staticType.symbol.valueDeclaration); const staticBaseType = isClass ? getBaseConstructorTypeOfClass(staticType) : anyType; const heritageClauses = [ - ...!length(baseTypes) ? [] : [factory.createHeritageClause(94 /* ExtendsKeyword */, map(baseTypes, (b) => serializeBaseType(b, staticBaseType, localName)))], - ...!length(implementsExpressions) ? [] : [factory.createHeritageClause(117 /* ImplementsKeyword */, implementsExpressions)] + ...!length(baseTypes) ? [] : [factory.createHeritageClause(96 /* ExtendsKeyword */, map(baseTypes, (b) => serializeBaseType(b, staticBaseType, localName)))], + ...!length(implementsExpressions) ? [] : [factory.createHeritageClause(119 /* ImplementsKeyword */, implementsExpressions)] ]; const symbolProps = getNonInheritedProperties(classType, baseTypes, getPropertiesOfType(classType)); const publicSymbolProps = filter(symbolProps, (s) => { @@ -52080,7 +52279,7 @@ ${lanes.join("\n")} [], /*body*/ void 0 - )] : serializeSignatures(1 /* Construct */, staticType, staticBaseType, 173 /* Constructor */); + )] : serializeSignatures(1 /* Construct */, staticType, staticBaseType, 175 /* Constructor */); const indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); context.enclosingDeclaration = oldEnclosing; addResult(setTextRange(factory.createClassDeclaration( @@ -52113,7 +52312,7 @@ ${lanes.join("\n")} }); } function serializeAsAlias(symbol, localName, modifierFlags) { - var _a2, _b, _c, _d, _e; + var _a, _b, _c, _d, _e; const node = getDeclarationOfAliasSymbol(symbol); if (!node) return Debug.fail(); @@ -52132,8 +52331,8 @@ ${lanes.join("\n")} const targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); switch (node.kind) { - case 205 /* BindingElement */: - if (((_b = (_a2 = node.parent) == null ? void 0 : _a2.parent) == null ? void 0 : _b.kind) === 257 /* VariableDeclaration */) { + case 207 /* BindingElement */: + if (((_b = (_a = node.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.kind) === 259 /* VariableDeclaration */) { const specifier2 = getSpecifierForModuleSymbol(target.parent || target, context); const { propertyName } = node; addResult(factory.createImportDeclaration( @@ -52152,22 +52351,22 @@ ${lanes.join("\n")} )]) ), factory.createStringLiteral(specifier2), - /*importClause*/ + /*assertClause*/ void 0 ), 0 /* None */); break; } Debug.failBadSyntaxKind(((_c = node.parent) == null ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); break; - case 300 /* ShorthandPropertyAssignment */: - if (((_e = (_d = node.parent) == null ? void 0 : _d.parent) == null ? void 0 : _e.kind) === 223 /* BinaryExpression */) { + case 303 /* ShorthandPropertyAssignment */: + if (((_e = (_d = node.parent) == null ? void 0 : _d.parent) == null ? void 0 : _e.kind) === 225 /* BinaryExpression */) { serializeExportSpecifier( unescapeLeadingUnderscores(symbol.escapedName), targetName ); } break; - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: if (isPropertyAccessExpression(node.initializer)) { const initializer = node.initializer; const uniqueName = factory.createUniqueName(localName); @@ -52190,7 +52389,7 @@ ${lanes.join("\n")} ), modifierFlags); break; } - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: if (target.escapedName === "export=" /* ExportEquals */ && some(target.declarations, (d) => isSourceFile(d) && isJsonSourceFile(d))) { serializeMaybeAliasAssignment(symbol); break; @@ -52211,10 +52410,10 @@ ${lanes.join("\n")} ) : factory.createExternalModuleReference(factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))) ), isLocalImport ? modifierFlags : 0 /* None */); break; - case 267 /* NamespaceExportDeclaration */: + case 269 /* NamespaceExportDeclaration */: addResult(factory.createNamespaceExportDeclaration(idText(node.name)), 0 /* None */); break; - case 270 /* ImportClause */: { + case 272 /* ImportClause */: { const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context); const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.moduleSpecifier; addResult(factory.createImportDeclaration( @@ -52232,7 +52431,7 @@ ${lanes.join("\n")} ), 0 /* None */); break; } - case 271 /* NamespaceImport */: { + case 273 /* NamespaceImport */: { const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context); const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.moduleSpecifier; addResult(factory.createImportDeclaration( @@ -52241,7 +52440,7 @@ ${lanes.join("\n")} factory.createImportClause( /*isTypeOnly*/ false, - /*importClause*/ + /*name*/ void 0, factory.createNamespaceImport(factory.createIdentifier(localName)) ), @@ -52250,7 +52449,7 @@ ${lanes.join("\n")} ), 0 /* None */); break; } - case 277 /* NamespaceExport */: + case 279 /* NamespaceExport */: addResult(factory.createExportDeclaration( /*modifiers*/ void 0, @@ -52260,7 +52459,7 @@ ${lanes.join("\n")} factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)) ), 0 /* None */); break; - case 273 /* ImportSpecifier */: { + case 275 /* ImportSpecifier */: { const generatedSpecifier = getSpecifierForModuleSymbol(target.parent || target, context); const specifier2 = bundled ? factory.createStringLiteral(generatedSpecifier) : node.parent.parent.parent.moduleSpecifier; addResult(factory.createImportDeclaration( @@ -52269,7 +52468,7 @@ ${lanes.join("\n")} factory.createImportClause( /*isTypeOnly*/ false, - /*importClause*/ + /*name*/ void 0, factory.createNamedImports([ factory.createImportSpecifier( @@ -52285,7 +52484,7 @@ ${lanes.join("\n")} ), 0 /* None */); break; } - case 278 /* ExportSpecifier */: + case 280 /* ExportSpecifier */: const specifier = node.parent.parent.moduleSpecifier; serializeExportSpecifier( unescapeLeadingUnderscores(symbol.escapedName), @@ -52293,12 +52492,12 @@ ${lanes.join("\n")} specifier && isStringLiteralLike(specifier) ? factory.createStringLiteral(specifier.text) : void 0 ); break; - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: serializeMaybeAliasAssignment(symbol); break; - case 223 /* BinaryExpression */: - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 225 /* BinaryExpression */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: if (symbol.escapedName === "default" /* Default */ || symbol.escapedName === "export=" /* ExportEquals */) { serializeMaybeAliasAssignment(symbol); } else { @@ -52325,6 +52524,7 @@ ${lanes.join("\n")} ), 0 /* None */); } function serializeMaybeAliasAssignment(symbol) { + var _a; if (symbol.flags & 4194304 /* Prototype */) { return false; } @@ -52404,7 +52604,7 @@ ${lanes.join("\n")} void 0, serializeTypeForDeclaration(context, typeToSerialize, symbol, enclosingDeclaration, includePrivateSymbol, bundled) ) - ], 2 /* Const */) + ], ((_a = context.enclosingDeclaration) == null ? void 0 : _a.kind) === 266 /* ModuleDeclaration */ ? 1 /* Let */ : 2 /* Const */) ); addResult( statement, @@ -52434,18 +52634,18 @@ ${lanes.join("\n")} } function makeSerializePropertySymbol(createProperty2, methodKind, useAccessors) { return function serializePropertySymbol(p, isStatic2, baseType) { - var _a2, _b, _c, _d, _e; + var _a, _b, _c, _d, _e; const modifierFlags = getDeclarationModifierFlagsFromSymbol(p); const isPrivate = !!(modifierFlags & 8 /* Private */); if (isStatic2 && p.flags & (788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */)) { return []; } - if (p.flags & 4194304 /* Prototype */ || baseType && getPropertyOfType(baseType, p.escapedName) && isReadonlySymbol(getPropertyOfType(baseType, p.escapedName)) === isReadonlySymbol(p) && (p.flags & 16777216 /* Optional */) === (getPropertyOfType(baseType, p.escapedName).flags & 16777216 /* Optional */) && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName))) { + if (p.flags & 4194304 /* Prototype */ || p.escapedName === "constructor" || baseType && getPropertyOfType(baseType, p.escapedName) && isReadonlySymbol(getPropertyOfType(baseType, p.escapedName)) === isReadonlySymbol(p) && (p.flags & 16777216 /* Optional */) === (getPropertyOfType(baseType, p.escapedName).flags & 16777216 /* Optional */) && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName))) { return []; } const flag = modifierFlags & ~512 /* Async */ | (isStatic2 ? 32 /* Static */ : 0); const name = getPropertyNameNodeForSymbol(p, context); - const firstPropertyLikeDecl = (_a2 = p.declarations) == null ? void 0 : _a2.find(or(isPropertyDeclaration, isAccessor, isVariableDeclaration, isPropertySignature, isBinaryExpression, isPropertyAccessExpression)); + const firstPropertyLikeDecl = (_a = p.declarations) == null ? void 0 : _a.find(or(isPropertyDeclaration, isAccessor, isVariableDeclaration, isPropertySignature, isBinaryExpression, isPropertyAccessExpression)); if (p.flags & 98304 /* Accessor */ && useAccessors) { const result = []; if (p.flags & 65536 /* SetAccessor */) { @@ -52482,7 +52682,7 @@ ${lanes.join("\n")} return setTextRange(createProperty2( factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* Readonly */ : 0) | flag), name, - p.flags & 16777216 /* Optional */ ? factory.createToken(57 /* QuestionToken */) : void 0, + p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0, isPrivate ? void 0 : 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_ @@ -52497,7 +52697,7 @@ ${lanes.join("\n")} return setTextRange(createProperty2( factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* Readonly */ : 0) | flag), name, - p.flags & 16777216 /* Optional */ ? factory.createToken(57 /* QuestionToken */) : void 0, + p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0, /*type*/ void 0, /*initializer*/ @@ -52512,7 +52712,7 @@ ${lanes.join("\n")} context, { name, - questionToken: p.flags & 16777216 /* Optional */ ? factory.createToken(57 /* QuestionToken */) : void 0, + questionToken: p.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0, modifiers: flag ? factory.createModifiersFromModifierFlags(flag) : void 0 } ); @@ -52630,7 +52830,7 @@ ${lanes.join("\n")} addResult(statement, 0 /* None */); return factory.createExpressionWithTypeArguments( factory.createIdentifier(tempName), - /*typeArgs*/ + /*typeArguments*/ void 0 ); } @@ -52655,13 +52855,13 @@ ${lanes.join("\n")} if (t.symbol) { return factory.createExpressionWithTypeArguments( symbolToExpression(t.symbol, context, 788968 /* Type */), - /*typeArgs*/ + /*typeArguments*/ void 0 ); } } function getUnusedName(input, symbol) { - var _a2, _b; + var _a, _b; const id = symbol ? getSymbolId(symbol) : void 0; if (id) { if (context.remappedSymbolNames.has(id)) { @@ -52673,7 +52873,7 @@ ${lanes.join("\n")} } let i = 0; const original = input; - while ((_a2 = context.usedSymbolNames) == null ? void 0 : _a2.has(input)) { + while ((_a = context.usedSymbolNames) == null ? void 0 : _a.has(input)) { i++; input = `${original}_${i}`; } @@ -52714,7 +52914,7 @@ ${lanes.join("\n")} return writer ? typePredicateToStringWorker(writer).getText() : usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer2) { const predicate = factory.createTypePredicateNode( - typePredicate.kind === 2 /* AssertsThis */ || typePredicate.kind === 3 /* AssertsIdentifier */ ? factory.createToken(129 /* AssertsKeyword */) : void 0, + typePredicate.kind === 2 /* AssertsThis */ || typePredicate.kind === 3 /* AssertsIdentifier */ ? factory.createToken(131 /* AssertsKeyword */) : void 0, typePredicate.kind === 1 /* Identifier */ || typePredicate.kind === 3 /* AssertsIdentifier */ ? factory.createIdentifier(typePredicate.parameterName) : factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */) // TODO: GH#18217 @@ -52777,10 +52977,10 @@ ${lanes.join("\n")} return void 0; } function isTopLevelInExternalModuleAugmentation(node) { - return node && node.parent && node.parent.kind === 265 /* ModuleBlock */ && isExternalModuleAugmentation(node.parent.parent); + return node && node.parent && node.parent.kind === 267 /* ModuleBlock */ && isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 308 /* SourceFile */ || isAmbientModule(location); + return location.kind === 311 /* SourceFile */ || isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { const nameType = getSymbolLinks(symbol).nameType; @@ -52828,17 +53028,17 @@ ${lanes.join("\n")} if (!declaration) { declaration = symbol.declarations[0]; } - if (declaration.parent && declaration.parent.kind === 257 /* VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 259 /* VariableDeclaration */) { return declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 228 /* ClassExpression */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 230 /* ClassExpression */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: if (context && !context.encounteredError && !(context.flags & 131072 /* AllowAnonymousIdentifier */)) { context.encounteredError = true; } - return declaration.kind === 228 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 230 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; } } const name = getNameOfSymbolFromNameType(symbol, context); @@ -52855,66 +53055,66 @@ ${lanes.join("\n")} return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 341 /* JSDocCallbackTag */: - case 349 /* JSDocTypedefTag */: - case 343 /* JSDocEnumTag */: + case 344 /* JSDocCallbackTag */: + case 352 /* JSDocTypedefTag */: + case 346 /* JSDocEnumTag */: return !!(node.parent && node.parent.parent && node.parent.parent.parent && isSourceFile(node.parent.parent.parent)); - case 205 /* BindingElement */: + case 207 /* BindingElement */: return isDeclarationVisible(node.parent.parent); - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: if (isBindingPattern(node.name) && !node.name.elements.length) { return false; } - case 264 /* ModuleDeclaration */: - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 259 /* FunctionDeclaration */: - case 263 /* EnumDeclaration */: - case 268 /* ImportEqualsDeclaration */: + case 266 /* ModuleDeclaration */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 261 /* FunctionDeclaration */: + case 265 /* EnumDeclaration */: + case 270 /* ImportEqualsDeclaration */: if (isExternalModuleAugmentation(node)) { return true; } const parent2 = getDeclarationContainer(node); - if (!(getCombinedModifierFlags(node) & 1 /* Export */) && !(node.kind !== 268 /* ImportEqualsDeclaration */ && parent2.kind !== 308 /* SourceFile */ && parent2.flags & 16777216 /* Ambient */)) { + if (!(getCombinedModifierFlags(node) & 1 /* Export */) && !(node.kind !== 270 /* ImportEqualsDeclaration */ && parent2.kind !== 311 /* SourceFile */ && parent2.flags & 16777216 /* Ambient */)) { return isGlobalSourceFile(parent2); } return isDeclarationVisible(parent2); - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: if (hasEffectiveModifier(node, 8 /* Private */ | 16 /* Protected */)) { return false; } - case 173 /* Constructor */: - case 177 /* ConstructSignature */: - case 176 /* CallSignature */: - case 178 /* IndexSignature */: - case 166 /* Parameter */: - case 265 /* ModuleBlock */: - case 181 /* FunctionType */: - case 182 /* ConstructorType */: - case 184 /* TypeLiteral */: - case 180 /* TypeReference */: - case 185 /* ArrayType */: - case 186 /* TupleType */: - case 189 /* UnionType */: - case 190 /* IntersectionType */: - case 193 /* ParenthesizedType */: - case 199 /* NamedTupleMember */: + case 175 /* Constructor */: + case 179 /* ConstructSignature */: + case 178 /* CallSignature */: + case 180 /* IndexSignature */: + case 168 /* Parameter */: + case 267 /* ModuleBlock */: + case 183 /* FunctionType */: + case 184 /* ConstructorType */: + case 186 /* TypeLiteral */: + case 182 /* TypeReference */: + case 187 /* ArrayType */: + case 188 /* TupleType */: + case 191 /* UnionType */: + case 192 /* IntersectionType */: + case 195 /* ParenthesizedType */: + case 201 /* NamedTupleMember */: return isDeclarationVisible(node.parent); - case 270 /* ImportClause */: - case 271 /* NamespaceImport */: - case 273 /* ImportSpecifier */: + case 272 /* ImportClause */: + case 273 /* NamespaceImport */: + case 275 /* ImportSpecifier */: return false; - case 165 /* TypeParameter */: - case 308 /* SourceFile */: - case 267 /* NamespaceExportDeclaration */: + case 167 /* TypeParameter */: + case 311 /* SourceFile */: + case 269 /* NamespaceExportDeclaration */: return true; - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: return false; default: return false; @@ -52923,7 +53123,7 @@ ${lanes.join("\n")} } function collectLinkedAliases(node, setVisibility) { let exportSymbol; - if (node.parent && node.parent.kind === 274 /* ExportAssignment */) { + if (node.parent && node.parent.kind === 276 /* ExportAssignment */) { exportSymbol = resolveName( node, node.escapedText, @@ -52934,7 +53134,7 @@ ${lanes.join("\n")} /*isUse*/ false ); - } else if (node.parent.kind === 278 /* ExportSpecifier */) { + } else if (node.parent.kind === 280 /* ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */); } let result; @@ -52961,7 +53161,9 @@ ${lanes.join("\n")} declaration, firstIdentifier.escapedText, 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */, + /*nameNotFoundMessage*/ void 0, + /*nameArg*/ void 0, /*isUse*/ false @@ -52993,7 +53195,7 @@ ${lanes.join("\n")} return true; } function findResolutionCycleStartIndex(target, propertyName) { - for (let i = resolutionTargets.length - 1; i >= 0; i--) { + for (let i = resolutionTargets.length - 1; i >= resolutionStart; i--) { if (resolutionTargetHasProperty(resolutionTargets[i], resolutionPropertyNames[i])) { return -1; } @@ -53036,12 +53238,12 @@ ${lanes.join("\n")} function getDeclarationContainer(node) { return findAncestor(getRootDeclaration(node), (node2) => { switch (node2.kind) { - case 257 /* VariableDeclaration */: - case 258 /* VariableDeclarationList */: - case 273 /* ImportSpecifier */: - case 272 /* NamedImports */: - case 271 /* NamespaceImport */: - case 270 /* ImportClause */: + case 259 /* VariableDeclaration */: + case 260 /* VariableDeclarationList */: + case 275 /* ImportSpecifier */: + case 274 /* NamedImports */: + case 273 /* NamespaceImport */: + case 272 /* ImportClause */: return false; default: return true; @@ -53057,8 +53259,8 @@ ${lanes.join("\n")} return prop ? getTypeOfSymbol(prop) : void 0; } function getTypeOfPropertyOrIndexSignature(type, name) { - var _a2; - return getTypeOfPropertyOfType(type, name) || ((_a2 = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a2.type) || unknownType; + var _a; + return getTypeOfPropertyOfType(type, name) || ((_a = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a.type) || unknownType; } function isTypeAny(type) { return type && (type.flags & 1 /* Any */) !== 0; @@ -53159,23 +53361,23 @@ ${lanes.join("\n")} function getParentElementAccess(node) { const ancestor = node.parent.parent; switch (ancestor.kind) { - case 205 /* BindingElement */: - case 299 /* PropertyAssignment */: + case 207 /* BindingElement */: + case 302 /* PropertyAssignment */: return getSyntheticElementAccess(ancestor); - case 206 /* ArrayLiteralExpression */: + case 208 /* ArrayLiteralExpression */: return getSyntheticElementAccess(node.parent); - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: return ancestor.initializer; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return ancestor.right; } } function getDestructuringPropertyName(node) { const parent2 = node.parent; - if (node.kind === 205 /* BindingElement */ && parent2.kind === 203 /* ObjectBindingPattern */) { + if (node.kind === 207 /* BindingElement */ && parent2.kind === 205 /* ObjectBindingPattern */) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 299 /* PropertyAssignment */ || node.kind === 300 /* ShorthandPropertyAssignment */) { + if (node.kind === 302 /* PropertyAssignment */ || node.kind === 303 /* ShorthandPropertyAssignment */) { return getLiteralPropertyNameText(node.name); } return "" + parent2.elements.indexOf(node); @@ -53200,7 +53402,7 @@ ${lanes.join("\n")} parentType = getTypeWithFacts(parentType, 524288 /* NEUndefined */); } let type; - if (pattern.kind === 203 /* ObjectBindingPattern */) { + if (pattern.kind === 205 /* ObjectBindingPattern */) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 /* Unknown */ || !isValidSpreadType(parentType)) { @@ -53224,7 +53426,7 @@ ${lanes.join("\n")} const elementType = checkIteratedTypeOrElementType(65 /* Destructuring */ | (declaration.dotDotDotToken ? 0 : 128 /* PossiblyOutOfBounds */), parentType, undefinedType, pattern); const index = pattern.elements.indexOf(declaration); if (declaration.dotDotDotToken) { - const baseConstraint = getBaseConstraintOrType(parentType); + const baseConstraint = mapType(parentType, (t) => t.flags & 58982400 /* InstantiableNonPrimitive */ ? getBaseConstraintOrType(t) : t); type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType); } else if (isArrayLikeType(parentType)) { const indexType = getNumberLiteralType(index); @@ -53256,7 +53458,7 @@ ${lanes.join("\n")} /*excludeJSDocTypeAssertions*/ true ); - return expr.kind === 104 /* NullKeyword */ || expr.kind === 79 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol; + return expr.kind === 106 /* NullKeyword */ || expr.kind === 80 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol; } function isEmptyArrayLiteral2(node) { const expr = skipParentheses( @@ -53264,13 +53466,13 @@ ${lanes.join("\n")} /*excludeJSDocTypeAssertions*/ true ); - return expr.kind === 206 /* ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 208 /* ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, isProperty = false, isOptional = true) { return strictNullChecks && isOptional ? getOptionalType(type, isProperty) : type; } function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { - if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === 246 /* ForInStatement */) { + if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === 248 /* ForInStatement */) { const indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression( declaration.parent.parent.expression, /*checkMode*/ @@ -53278,7 +53480,7 @@ ${lanes.join("\n")} ))); return indexType.flags & (262144 /* TypeParameter */ | 4194304 /* Index */) ? getExtractStringType(indexType) : stringType; } - if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* ForOfStatement */) { + if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === 249 /* ForOfStatement */) { const forOfStatement = declaration.parent.parent; return checkRightHandSideOfForOf(forOfStatement) || anyType; } @@ -53307,8 +53509,8 @@ ${lanes.join("\n")} } if (isParameter(declaration)) { const func = declaration.parent; - if (func.kind === 175 /* SetAccessor */ && hasBindableName(func)) { - const getter = getDeclarationOfKind(getSymbolOfDeclaration(declaration.parent), 174 /* GetAccessor */); + if (func.kind === 177 /* SetAccessor */ && hasBindableName(func)) { + const getter = getDeclarationOfKind(getSymbolOfDeclaration(declaration.parent), 176 /* GetAccessor */); if (getter) { const getterSignature = getSignatureFromDeclaration(getter); const thisParameter = getAccessorThisParameter(func); @@ -53382,7 +53584,7 @@ ${lanes.join("\n")} const links = getSymbolLinks(symbol); if (links.isConstructorDeclaredProperty === void 0) { links.isConstructorDeclaredProperty = false; - links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && every(symbol.declarations, (declaration) => isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && (declaration.left.kind !== 209 /* ElementAccessExpression */ || isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration( + links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && every(symbol.declarations, (declaration) => isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && (declaration.left.kind !== 211 /* ElementAccessExpression */ || isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration( /*declaredType*/ void 0, declaration, @@ -53410,7 +53612,7 @@ ${lanes.join("\n")} /*includeClassComputedPropertyName*/ false ); - if (container && (container.kind === 173 /* Constructor */ || isJSConstructor(container))) { + if (container && (container.kind === 175 /* Constructor */ || isJSConstructor(container))) { return container; } } @@ -53532,14 +53734,14 @@ ${lanes.join("\n")} return widened; } function getJSContainerObjectType(decl, symbol, init) { - var _a2, _b; + var _a, _b; if (!isInJSFile(decl) || !init || !isObjectLiteralExpression(init) || init.properties.length) { return void 0; } const exports = createSymbolTable(); while (isBinaryExpression(decl) || isPropertyAccessExpression(decl)) { const s2 = getSymbolOfNode(decl); - if ((_a2 = s2 == null ? void 0 : s2.exports) == null ? void 0 : _a2.size) { + if ((_a = s2 == null ? void 0 : s2.exports) == null ? void 0 : _a.size) { mergeSymbolTable(exports, s2.exports); } decl = isBinaryExpression(decl) ? decl.parent : decl.parent.parent; @@ -53553,7 +53755,7 @@ ${lanes.join("\n")} return type; } function getAnnotatedTypeForAssignmentDeclaration(declaredType, expression, symbol, declaration) { - var _a2; + var _a; const typeNode = getEffectiveTypeAnnotationNode(expression.parent); if (typeNode) { const type = getWidenedType(getTypeFromTypeNode(typeNode)); @@ -53569,7 +53771,7 @@ ${lanes.join("\n")} ); } } - if ((_a2 = symbol.parent) == null ? void 0 : _a2.valueDeclaration) { + if ((_a = symbol.parent) == null ? void 0 : _a.valueDeclaration) { const typeNode2 = getEffectiveTypeAnnotationNode(symbol.parent.valueDeclaration); if (typeNode2) { const annotationSymbol = getPropertyOfType(getTypeFromTypeNode(typeNode2), symbol.escapedName); @@ -53620,13 +53822,13 @@ ${lanes.join("\n")} resolvedSymbol.exports = createSymbolTable(); } (resolvedSymbol || symbol).exports.forEach((s, name) => { - var _a2; + var _a; const exportedMember = members.get(name); if (exportedMember && exportedMember !== s && !(s.flags & 2097152 /* Alias */)) { if (s.flags & 111551 /* Value */ && exportedMember.flags & 111551 /* Value */) { if (s.valueDeclaration && exportedMember.valueDeclaration && getSourceFileOfNode(s.valueDeclaration) !== getSourceFileOfNode(exportedMember.valueDeclaration)) { const unescapedName = unescapeLeadingUnderscores(s.escapedName); - const exportedMemberName = ((_a2 = tryCast(exportedMember.valueDeclaration, isNamedDeclaration)) == null ? void 0 : _a2.name) || exportedMember.valueDeclaration; + const exportedMemberName = ((_a = tryCast(exportedMember.valueDeclaration, isNamedDeclaration)) == null ? void 0 : _a.name) || exportedMember.valueDeclaration; addRelatedInfo( error(s.valueDeclaration, Diagnostics.Duplicate_identifier_0, unescapedName), createDiagnosticForNode(exportedMemberName, Diagnostics._0_was_also_declared_here, unescapedName) @@ -53680,7 +53882,7 @@ ${lanes.join("\n")} return type; } function containsSameNamedThisProperty(thisProperty, expression) { - return isPropertyAccessExpression(thisProperty) && thisProperty.expression.kind === 108 /* ThisKeyword */ && forEachChildRecursively(expression, (n) => isMatchingReference(thisProperty, n)); + return isPropertyAccessExpression(thisProperty) && thisProperty.expression.kind === 110 /* ThisKeyword */ && forEachChildRecursively(expression, (n) => isMatchingReference(thisProperty, n)); } function isDeclarationInConstructor(expression) { const thisContainer = getThisContainer( @@ -53690,7 +53892,7 @@ ${lanes.join("\n")} /*includeClassComputedPropertyName*/ false ); - return thisContainer.kind === 173 /* Constructor */ || thisContainer.kind === 259 /* FunctionDeclaration */ || thisContainer.kind === 215 /* FunctionExpression */ && !isPrototypePropertyAssignment(thisContainer.parent); + return thisContainer.kind === 175 /* Constructor */ || thisContainer.kind === 261 /* FunctionDeclaration */ || thisContainer.kind === 217 /* FunctionExpression */ && !isPrototypePropertyAssignment(thisContainer.parent); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { Debug.assert(types.length === declarations.length); @@ -53746,7 +53948,14 @@ ${lanes.join("\n")} symbol.links.bindingElement = e; members.set(symbol.escapedName, symbol); }); - const result = createAnonymousType(void 0, members, emptyArray, emptyArray, stringIndexInfo ? [stringIndexInfo] : emptyArray); + const result = createAnonymousType( + /*symbol*/ + void 0, + members, + emptyArray, + emptyArray, + stringIndexInfo ? [stringIndexInfo] : emptyArray + ); result.objectFlags |= objectFlags; if (includePatternInType) { result.pattern = pattern; @@ -53757,7 +53966,7 @@ ${lanes.join("\n")} function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors2) { const elements = pattern.elements; const lastElement = lastOrUndefined(elements); - const restElement = lastElement && lastElement.kind === 205 /* BindingElement */ && lastElement.dotDotDotToken ? lastElement : void 0; + const restElement = lastElement && lastElement.kind === 207 /* BindingElement */ && lastElement.dotDotDotToken ? lastElement : void 0; if (elements.length === 0 || elements.length === 1 && restElement) { return languageVersion >= 2 /* ES2015 */ ? createIterableType(anyType) : anyArrayType; } @@ -53773,7 +53982,7 @@ ${lanes.join("\n")} return result; } function getTypeFromBindingPattern(pattern, includePatternInType = false, reportErrors2 = false) { - return pattern.kind === 203 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors2); + return pattern.kind === 205 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors2); } function getWidenedTypeForVariableLikeDeclaration(declaration, reportErrors2) { return widenTypeForVariableLikeDeclaration(getTypeForVariableLikeDeclaration( @@ -53814,7 +54023,7 @@ ${lanes.join("\n")} } function declarationBelongsToPrivateAmbientMember(declaration) { const root = getRootDeclaration(declaration); - const memberDeclaration = root.kind === 166 /* Parameter */ ? root.parent : root; + const memberDeclaration = root.kind === 168 /* Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(node) { @@ -53888,7 +54097,7 @@ ${lanes.join("\n")} return reportCircularityError(symbol); } let type; - if (declaration.kind === 274 /* ExportAssignment */) { + if (declaration.kind === 276 /* ExportAssignment */) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); } else if (isBinaryExpression(declaration) || isInJSFile(declaration) && (isCallExpression(declaration) || (isPropertyAccessExpression(declaration) || isBindableStaticElementAccessExpression(declaration)) && isBinaryExpression(declaration.parent))) { type = getWidenedTypeForAssignmentDeclaration(symbol); @@ -53908,7 +54117,7 @@ ${lanes.join("\n")} } else if (isParameter(declaration) || isPropertyDeclaration(declaration) || isPropertySignature(declaration) || isVariableDeclaration(declaration) || isBindingElement(declaration) || isJSDocPropertyLikeTag(declaration)) { type = getWidenedTypeForVariableLikeDeclaration( declaration, - /*includeOptionality*/ + /*reportErrors*/ true ); } else if (isEnumDeclaration(declaration)) { @@ -53929,13 +54138,13 @@ ${lanes.join("\n")} function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { switch (accessor.kind) { - case 174 /* GetAccessor */: + case 176 /* GetAccessor */: const getterTypeAnnotation = getEffectiveReturnTypeNode(accessor); return getterTypeAnnotation; - case 175 /* SetAccessor */: + case 177 /* SetAccessor */: const setterTypeAnnotation = getEffectiveSetAccessorTypeAnnotationNode(accessor); return setterTypeAnnotation; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: Debug.assert(hasAccessorModifier(accessor)); const accessorTypeAnnotation = getEffectiveTypeAnnotationNode(accessor); return accessorTypeAnnotation; @@ -53960,12 +54169,12 @@ ${lanes.join("\n")} if (!pushTypeResolution(symbol, 0 /* Type */)) { return errorType; } - const getter = getDeclarationOfKind(symbol, 174 /* GetAccessor */); - const setter = getDeclarationOfKind(symbol, 175 /* SetAccessor */); - const accessor = tryCast(getDeclarationOfKind(symbol, 169 /* PropertyDeclaration */), isAutoAccessorPropertyDeclaration); + const getter = getDeclarationOfKind(symbol, 176 /* GetAccessor */); + const setter = getDeclarationOfKind(symbol, 177 /* SetAccessor */); + const accessor = tryCast(getDeclarationOfKind(symbol, 171 /* PropertyDeclaration */), isAutoAccessorPropertyDeclaration); let type = getter && isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || getAnnotatedAccessorType(accessor) || getter && getter.body && getReturnTypeFromBody(getter) || accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration( accessor, - /*includeOptionality*/ + /*reportErrors*/ true ); if (!type) { @@ -53995,13 +54204,12 @@ ${lanes.join("\n")} return links.type; } function getWriteTypeOfAccessors(symbol) { - var _a2; const links = getSymbolLinks(symbol); if (!links.writeType) { if (!pushTypeResolution(symbol, 8 /* WriteType */)) { return errorType; } - const setter = (_a2 = getDeclarationOfKind(symbol, 175 /* SetAccessor */)) != null ? _a2 : tryCast(getDeclarationOfKind(symbol, 169 /* PropertyDeclaration */), isAutoAccessorPropertyDeclaration); + const setter = getDeclarationOfKind(symbol, 177 /* SetAccessor */) ?? tryCast(getDeclarationOfKind(symbol, 171 /* PropertyDeclaration */), isAutoAccessorPropertyDeclaration); let writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { @@ -54041,7 +54249,7 @@ ${lanes.join("\n")} const declaration = symbol.valueDeclaration; if (symbol.flags & 1536 /* Module */ && isShorthandAmbientModuleSymbol(symbol)) { return anyType; - } else if (declaration && (declaration.kind === 223 /* BinaryExpression */ || isAccessExpression(declaration) && declaration.parent.kind === 223 /* BinaryExpression */)) { + } else if (declaration && (declaration.kind === 225 /* BinaryExpression */ || isAccessExpression(declaration) && declaration.parent.kind === 225 /* BinaryExpression */)) { return getWidenedTypeForAssignmentDeclaration(symbol); } else if (symbol.flags & 512 /* ValueModule */ && declaration && isSourceFile(declaration) && declaration.commonJsModuleIndicator) { const resolvedModule = resolveExternalModuleSymbol(symbol); @@ -54062,7 +54270,11 @@ ${lanes.join("\n")} const baseTypeVariable = getBaseTypeVariableOfClass(symbol); return baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type; } else { - return strictNullChecks && symbol.flags & 16777216 /* Optional */ ? getOptionalType(type) : type; + return strictNullChecks && symbol.flags & 16777216 /* Optional */ ? getOptionalType( + type, + /*isProperty*/ + true + ) : type; } } function getTypeOfEnumMember(symbol) { @@ -54075,7 +54287,7 @@ ${lanes.join("\n")} const targetSymbol = resolveAlias(symbol); const exportSymbol = symbol.declarations && getTargetOfAliasDeclaration( getDeclarationOfAliasSymbol(symbol), - /*dontResolveAlias*/ + /*dontRecursivelyResolve*/ true ); const declaredType = firstDefined(exportSymbol == null ? void 0 : exportSymbol.declarations, (d) => isExportAssignment(d) ? tryGetTypeFromEffectiveTypeNode(d) : void 0); @@ -54101,7 +54313,7 @@ ${lanes.join("\n")} ); return errorType; } - if (noImplicitAny && (declaration.kind !== 166 /* Parameter */ || declaration.initializer)) { + if (noImplicitAny && (declaration.kind !== 168 /* Parameter */ || declaration.initializer)) { error( symbol.valueDeclaration, Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, @@ -54215,43 +54427,43 @@ ${lanes.join("\n")} return void 0; } switch (node.kind) { - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 261 /* InterfaceDeclaration */: - case 176 /* CallSignature */: - case 177 /* ConstructSignature */: - case 170 /* MethodSignature */: - case 181 /* FunctionType */: - case 182 /* ConstructorType */: - case 320 /* JSDocFunctionType */: - case 259 /* FunctionDeclaration */: - case 171 /* MethodDeclaration */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 262 /* TypeAliasDeclaration */: - case 348 /* JSDocTemplateTag */: - case 349 /* JSDocTypedefTag */: - case 343 /* JSDocEnumTag */: - case 341 /* JSDocCallbackTag */: - case 197 /* MappedType */: - case 191 /* ConditionalType */: { + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 263 /* InterfaceDeclaration */: + case 178 /* CallSignature */: + case 179 /* ConstructSignature */: + case 172 /* MethodSignature */: + case 183 /* FunctionType */: + case 184 /* ConstructorType */: + case 323 /* JSDocFunctionType */: + case 261 /* FunctionDeclaration */: + case 173 /* MethodDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 264 /* TypeAliasDeclaration */: + case 351 /* JSDocTemplateTag */: + case 352 /* JSDocTypedefTag */: + case 346 /* JSDocEnumTag */: + case 344 /* JSDocCallbackTag */: + case 199 /* MappedType */: + case 193 /* ConditionalType */: { const outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 197 /* MappedType */) { + if (node.kind === 199 /* MappedType */) { return append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node.typeParameter))); - } else if (node.kind === 191 /* ConditionalType */) { + } else if (node.kind === 193 /* ConditionalType */) { return concatenate(outerTypeParameters, getInferTypeParameters(node)); } const outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, getEffectiveTypeParameterDeclarations(node)); - const thisType = includeThisTypes && (node.kind === 260 /* ClassDeclaration */ || node.kind === 228 /* ClassExpression */ || node.kind === 261 /* InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(node)).thisType; + const thisType = includeThisTypes && (node.kind === 262 /* ClassDeclaration */ || node.kind === 230 /* ClassExpression */ || node.kind === 263 /* InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(node)).thisType; return thisType ? append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } - case 344 /* JSDocParameterTag */: + case 347 /* JSDocParameterTag */: const paramSymbol = getParameterSymbolFromJSDoc(node); if (paramSymbol) { node = paramSymbol.valueDeclaration; } break; - case 323 /* JSDoc */: { + case 326 /* JSDoc */: { const outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); return node.tags ? appendTypeParameters(outerTypeParameters, flatMap(node.tags, (t) => isJSDocTemplateTag(t) ? t.typeParameters : void 0)) : outerTypeParameters; } @@ -54259,16 +54471,16 @@ ${lanes.join("\n")} } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var _a2; - const declaration = symbol.flags & 32 /* Class */ || symbol.flags & 16 /* Function */ ? symbol.valueDeclaration : (_a2 = symbol.declarations) == null ? void 0 : _a2.find((decl) => { - if (decl.kind === 261 /* InterfaceDeclaration */) { + var _a; + const declaration = symbol.flags & 32 /* Class */ || symbol.flags & 16 /* Function */ ? symbol.valueDeclaration : (_a = symbol.declarations) == null ? void 0 : _a.find((decl) => { + if (decl.kind === 263 /* InterfaceDeclaration */) { return true; } - if (decl.kind !== 257 /* VariableDeclaration */) { + if (decl.kind !== 259 /* VariableDeclaration */) { return false; } const initializer = decl.initializer; - return !!initializer && (initializer.kind === 215 /* FunctionExpression */ || initializer.kind === 216 /* ArrowFunction */); + return !!initializer && (initializer.kind === 217 /* FunctionExpression */ || initializer.kind === 218 /* ArrowFunction */); }); Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); return getOuterTypeParameters(declaration); @@ -54279,7 +54491,7 @@ ${lanes.join("\n")} } let result; for (const node of symbol.declarations) { - if (node.kind === 261 /* InterfaceDeclaration */ || node.kind === 260 /* ClassDeclaration */ || node.kind === 228 /* ClassExpression */ || isJSConstructor(node) || isTypeAlias(node)) { + if (node.kind === 263 /* InterfaceDeclaration */ || node.kind === 262 /* ClassDeclaration */ || node.kind === 230 /* ClassExpression */ || isJSConstructor(node) || isTypeAlias(node)) { const declaration = node; result = appendTypeParameters(result, getEffectiveTypeParameterDeclarations(declaration)); } @@ -54417,7 +54629,7 @@ ${lanes.join("\n")} } if (!popTypeResolution() && type.symbol.declarations) { for (const declaration of type.symbol.declarations) { - if (declaration.kind === 260 /* ClassDeclaration */ || declaration.kind === 261 /* InterfaceDeclaration */) { + if (declaration.kind === 262 /* ClassDeclaration */ || declaration.kind === 263 /* InterfaceDeclaration */) { reportCircularBaseType(declaration, type); } } @@ -54506,7 +54718,7 @@ ${lanes.join("\n")} type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; if (type.symbol.declarations) { for (const declaration of type.symbol.declarations) { - if (declaration.kind === 261 /* InterfaceDeclaration */ && getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 263 /* InterfaceDeclaration */ && getInterfaceBaseTypeNodes(declaration)) { for (const node of getInterfaceBaseTypeNodes(declaration)) { const baseType = getReducedType(getTypeFromTypeNode(node)); if (!isErrorType(baseType)) { @@ -54534,7 +54746,7 @@ ${lanes.join("\n")} return true; } for (const declaration of symbol.declarations) { - if (declaration.kind === 261 /* InterfaceDeclaration */) { + if (declaration.kind === 263 /* InterfaceDeclaration */) { if (declaration.flags & 128 /* ContainsThis */) { return false; } @@ -54588,13 +54800,13 @@ ${lanes.join("\n")} return links.declaredType; } function getDeclaredTypeOfTypeAlias(symbol) { - var _a2; + var _a; const links = getSymbolLinks(symbol); if (!links.declaredType) { if (!pushTypeResolution(symbol, 2 /* DeclaredType */)) { return errorType; } - const declaration = Debug.checkDefined((_a2 = symbol.declarations) == null ? void 0 : _a2.find(isTypeAlias), "Type alias symbol with no valid declaration found"); + const declaration = Debug.checkDefined((_a = symbol.declarations) == null ? void 0 : _a.find(isTypeAlias), "Type alias symbol with no valid declaration found"); const typeNode = isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type; let type = typeNode ? getTypeFromTypeNode(typeNode) : errorType; if (popTypeResolution()) { @@ -54606,7 +54818,7 @@ ${lanes.join("\n")} } } else { type = errorType; - if (declaration.kind === 343 /* JSDocEnumTag */) { + if (declaration.kind === 346 /* JSDocEnumTag */) { error(declaration.typeExpression.type, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } else { error(isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); @@ -54625,7 +54837,7 @@ ${lanes.join("\n")} const memberTypeList = []; if (symbol.declarations) { for (const declaration of symbol.declarations) { - if (declaration.kind === 263 /* EnumDeclaration */) { + if (declaration.kind === 265 /* EnumDeclaration */) { for (const member of declaration.members) { if (hasBindableName(member)) { const memberSymbol = getSymbolOfDeclaration(member); @@ -54706,22 +54918,22 @@ ${lanes.join("\n")} } function isThislessType(node) { switch (node.kind) { - case 131 /* AnyKeyword */: - case 157 /* UnknownKeyword */: - case 152 /* StringKeyword */: - case 148 /* NumberKeyword */: - case 160 /* BigIntKeyword */: - case 134 /* BooleanKeyword */: - case 153 /* SymbolKeyword */: - case 149 /* ObjectKeyword */: - case 114 /* VoidKeyword */: - case 155 /* UndefinedKeyword */: - case 144 /* NeverKeyword */: - case 198 /* LiteralType */: + case 133 /* AnyKeyword */: + case 159 /* UnknownKeyword */: + case 154 /* StringKeyword */: + case 150 /* NumberKeyword */: + case 162 /* BigIntKeyword */: + case 136 /* BooleanKeyword */: + case 155 /* SymbolKeyword */: + case 151 /* ObjectKeyword */: + case 116 /* VoidKeyword */: + case 157 /* UndefinedKeyword */: + case 146 /* NeverKeyword */: + case 200 /* LiteralType */: return true; - case 185 /* ArrayType */: + case 187 /* ArrayType */: return isThislessType(node.elementType); - case 180 /* TypeReference */: + case 182 /* TypeReference */: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -54737,21 +54949,21 @@ ${lanes.join("\n")} function isThislessFunctionLikeDeclaration(node) { const returnType = getEffectiveReturnTypeNode(node); const typeParameters = getEffectiveTypeParameterDeclarations(node); - return (node.kind === 173 /* Constructor */ || !!returnType && isThislessType(returnType)) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); + return (node.kind === 175 /* Constructor */ || !!returnType && isThislessType(returnType)) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } function isThisless(symbol) { if (symbol.declarations && symbol.declarations.length === 1) { const declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: return isThislessVariableLikeDeclaration(declaration); - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return isThislessFunctionLikeDeclaration(declaration); } } @@ -54766,9 +54978,14 @@ ${lanes.join("\n")} return result; } function addInheritedMembers(symbols, baseSymbols) { - for (const s of baseSymbols) { - if (!symbols.has(s.escapedName) && !isStaticPrivateIdentifierProperty(s)) { - symbols.set(s.escapedName, s); + for (const base of baseSymbols) { + if (isStaticPrivateIdentifierProperty(base)) { + continue; + } + const derived = symbols.get(base.escapedName); + if (!derived || derived.valueDeclaration && isBinaryExpression(derived.valueDeclaration) && !isConstructorDeclaredProperty(derived) && !getContainingClassStaticBlock(derived.valueDeclaration)) { + symbols.set(base.escapedName, base); + symbols.set(base.escapedName, base); } } } @@ -54927,10 +55144,7 @@ ${lanes.join("\n")} if (getObjectFlags(type) & 4 /* Reference */) { const target = type.target; const typeArguments = getTypeArguments(type); - if (length(target.typeParameters) === length(typeArguments)) { - const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])); - return needApparentType ? getApparentType(ref) : ref; - } + return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type; } else if (type.flags & 2097152 /* Intersection */) { const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType)); return types !== type.types ? getIntersectionType(types) : type; @@ -55067,11 +55281,10 @@ ${lanes.join("\n")} } return [sig.parameters]; function expandSignatureParametersWithTupleMembers(restType, restIndex) { - const elementTypes = getTypeArguments(restType); - const associatedNames = restType.target.labeledElementDeclarations; + const elementTypes = getElementTypes(restType); + const associatedNames = getUniqAssociatedNamesFromTupleType(restType); const restParams = map(elementTypes, (t, i) => { - const tupleLabelName = !!associatedNames && getTupleElementLabel(associatedNames[i]); - const name = tupleLabelName || getParameterNameAtPosition(sig, restIndex + i, restType); + const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType); const flags = restType.target.elementFlags[i]; const checkFlags = flags & 12 /* Variable */ ? 32768 /* RestParameter */ : flags & 2 /* Optional */ ? 16384 /* OptionalParameter */ : 0; const symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags); @@ -55080,6 +55293,20 @@ ${lanes.join("\n")} }); return concatenate(sig.parameters.slice(0, restIndex), restParams); } + function getUniqAssociatedNamesFromTupleType(type) { + const associatedNamesMap = /* @__PURE__ */ new Map(); + return map(type.target.labeledElementDeclarations, (labeledElement) => { + const name = getTupleElementLabel(labeledElement); + const prevCounter = associatedNamesMap.get(name); + if (prevCounter === void 0) { + associatedNamesMap.set(name, 1); + return name; + } else { + associatedNamesMap.set(name, prevCounter + 1); + return `${name}_${prevCounter}`; + } + }); + } } function getDefaultConstructSignatures(classType) { const baseConstructorType = getBaseConstructorTypeOfClass(classType); @@ -55088,8 +55315,10 @@ ${lanes.join("\n")} const isAbstract = !!declaration && hasSyntacticModifier(declaration, 256 /* Abstract */); if (baseSignatures.length === 0) { return [createSignature( + /*declaration*/ void 0, classType.localTypeParameters, + /*thisParameter*/ void 0, emptyArray, classType, @@ -55460,8 +55689,8 @@ ${lanes.join("\n")} if (symbol === globalThisSymbol || symbol === nodeGlobalThisSymbol) { const varsOnly = /* @__PURE__ */ new Map(); members.forEach((p) => { - var _a2; - if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a2 = p.declarations) == null ? void 0 : _a2.length) && every(p.declarations, isAmbientModule))) { + var _a; + if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) == null ? void 0 : _a.length) && every(p.declarations, isAmbientModule))) { varsOnly.set(p.escapedName, p); } }); @@ -55711,7 +55940,7 @@ ${lanes.join("\n")} } function isMappedTypeWithKeyofConstraintDeclaration(type) { const constraintDeclaration = getConstraintDeclarationForMappedType(type); - return constraintDeclaration.kind === 195 /* TypeOperator */ && constraintDeclaration.operator === 141 /* KeyOfKeyword */; + return constraintDeclaration.kind === 197 /* TypeOperator */ && constraintDeclaration.operator === 143 /* KeyOfKeyword */; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -55728,7 +55957,7 @@ ${lanes.join("\n")} } function getMappedTypeModifiers(type) { const declaration = type.declaration; - return (declaration.readonlyToken ? declaration.readonlyToken.kind === 40 /* MinusToken */ ? 2 /* ExcludeReadonly */ : 1 /* IncludeReadonly */ : 0) | (declaration.questionToken ? declaration.questionToken.kind === 40 /* MinusToken */ ? 8 /* ExcludeOptional */ : 4 /* IncludeOptional */ : 0); + return (declaration.readonlyToken ? declaration.readonlyToken.kind === 41 /* MinusToken */ ? 2 /* ExcludeReadonly */ : 1 /* IncludeReadonly */ : 0) | (declaration.questionToken ? declaration.questionToken.kind === 41 /* MinusToken */ ? 8 /* ExcludeOptional */ : 4 /* IncludeOptional */ : 0); } function getMappedTypeOptionality(type) { const modifiers = getMappedTypeModifiers(type); @@ -55837,7 +56066,7 @@ ${lanes.join("\n")} function isTypeInvalidDueToUnionDiscriminant(contextualType, obj) { const list = obj.properties; return list.some((property) => { - const nameType = property.name && getLiteralTypeFromPropertyName(property.name); + const nameType = property.name && (isJsxNamespacedName(property.name) ? getStringLiteralType(getTextOfJsxAttributeName(property.name)) : getLiteralTypeFromPropertyName(property.name)); const name = nameType && isTypeUsableAsPropertyName(nameType) ? getPropertyNameFromType(nameType) : void 0; const expected = name === void 0 ? void 0 : getTypeOfPropertyOfType(contextualType, name); return !!expected && isLiteralType(expected) && !isTypeAssignableTo(getTypeOfNode(property), expected); @@ -55867,8 +56096,8 @@ ${lanes.join("\n")} return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : void 0; } function isConstTypeVariable(type) { - var _a2; - return !!(type.flags & 262144 /* TypeParameter */ && some((_a2 = type.symbol) == null ? void 0 : _a2.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || isGenericTupleType(type) && findIndex(getTypeArguments(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t)) >= 0 || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType)); + var _a; + return !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 1048576 /* Union */ && some(type.types, isConstTypeVariable) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type)) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t)) >= 0)); } function getConstraintOfIndexedAccess(type) { return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0; @@ -55882,7 +56111,7 @@ ${lanes.join("\n")} return simplified !== type ? simplified : getConstraintOfType(type); } function getConstraintFromIndexedAccess(type) { - if (isMappedTypeGenericIndexedAccess(type)) { + if (isMappedTypeGenericIndexedAccess(type) || isGenericMappedType(type.objectType)) { return substituteIndexedMappedType(type.objectType, type.indexType); } const indexConstraint = getSimplifiedTypeOrConstraint(type.indexType); @@ -55907,6 +56136,9 @@ ${lanes.join("\n")} return type.resolvedDefaultConstraint; } function getConstraintOfDistributiveConditionalType(type) { + if (type.resolvedConstraintOfDistributive !== void 0) { + return type.resolvedConstraintOfDistributive || void 0; + } if (type.root.isDistributive && type.restrictiveInstantiation !== type) { const simplified = getSimplifiedType( type.checkType, @@ -55917,10 +56149,12 @@ ${lanes.join("\n")} if (constraint && constraint !== type.checkType) { const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper)); if (!(instantiated.flags & 131072 /* Never */)) { + type.resolvedConstraintOfDistributive = instantiated; return instantiated; } } } + type.resolvedConstraintOfDistributive = false; return void 0; } function getConstraintFromConditionalType(type) { @@ -55965,7 +56199,7 @@ ${lanes.join("\n")} return void 0; } function getBaseConstraintOfType(type) { - if (type.flags & (58982400 /* InstantiableNonPrimitive */ | 3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) { + if (type.flags & (58982400 /* InstantiableNonPrimitive */ | 3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || isGenericTupleType(type)) { const constraint = getResolvedBaseConstraint(type); return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : void 0; } @@ -55982,7 +56216,7 @@ ${lanes.join("\n")} return type.resolvedBaseConstraint; } const stack = []; - return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), type); + return type.resolvedBaseConstraint = getImmediateBaseConstraint(type); function getImmediateBaseConstraint(t) { if (!t.immediateBaseConstraint) { if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) { @@ -56072,14 +56306,21 @@ ${lanes.join("\n")} if (t.flags & 33554432 /* Substitution */) { return getBaseConstraint(getSubstitutionIntersection(t)); } + if (isGenericTupleType(t)) { + const newElements = map(getElementTypes(t), (v, i) => { + const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v; + return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v; + }); + return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations); + } return t; } } - function getApparentTypeOfIntersectionType(type) { + function getApparentTypeOfIntersectionType(type, thisArgument) { return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument( type, - type, - /*apparentType*/ + thisArgument, + /*needApparentType*/ true )); } @@ -56118,7 +56359,7 @@ ${lanes.join("\n")} const typeVariable = getHomomorphicTypeVariable(type); if (typeVariable && !type.declaration.nameType) { const constraint = getConstraintOfTypeParameter(typeVariable); - if (constraint && isArrayOrTupleType(constraint)) { + if (constraint && everyType(constraint, isArrayOrTupleType)) { return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper)); } } @@ -56129,14 +56370,15 @@ ${lanes.join("\n")} return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType); } function getApparentType(type) { - const t = !(type.flags & 465829888 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType; - return getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t; + const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type; + const objectFlags = getObjectFlags(t); + return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t; } function getReducedApparentType(type) { return getReducedType(getApparentType(getReducedType(type))); } function createUnionOrIntersectionProperty(containingType, name, skipObjectFunctionPropertyAugment) { - var _a2, _b, _c; + var _a, _b, _c; let singleProp; let propSet; let indexTypes; @@ -56152,7 +56394,7 @@ ${lanes.join("\n")} const modifiers = prop ? getDeclarationModifierFlagsFromSymbol(prop) : 0; if (prop) { if (prop.flags & 106500 /* ClassMember */) { - optionalFlag != null ? optionalFlag : optionalFlag = isUnion ? 0 /* None */ : 16777216 /* Optional */; + optionalFlag ?? (optionalFlag = isUnion ? 0 /* None */ : 16777216 /* Optional */); if (isUnion) { optionalFlag |= prop.flags & 16777216 /* Optional */; } else { @@ -56204,7 +56446,7 @@ ${lanes.join("\n")} } if (!propSet && !(checkFlags & 16 /* ReadPartial */) && !indexTypes) { if (mergedInstantiations) { - const links = (_a2 = tryCast(singleProp, isTransientSymbol)) == null ? void 0 : _a2.links; + const links = (_a = tryCast(singleProp, isTransientSymbol)) == null ? void 0 : _a.links; const clone2 = createSymbolWithType(singleProp, links == null ? void 0 : links.type); clone2.parent = (_c = (_b = singleProp.valueDeclaration) == null ? void 0 : _b.symbol) == null ? void 0 : _c.parent; clone2.links.containingType = containingType; @@ -56240,7 +56482,7 @@ ${lanes.join("\n")} } else if (type !== firstType) { checkFlags |= 64 /* HasNonUniformType */; } - if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) { + if (isLiteralType(type) || isPatternLiteralType(type)) { checkFlags |= 128 /* HasLiteralType */; } if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) { @@ -56249,7 +56491,7 @@ ${lanes.join("\n")} propTypes.push(type); } addRange(propTypes, indexTypes); - const result = createSymbol(4 /* Property */ | (optionalFlag != null ? optionalFlag : 0), name, syntheticFlag | checkFlags); + const result = createSymbol(4 /* Property */ | (optionalFlag ?? 0), name, syntheticFlag | checkFlags); result.links.containingType = containingType; if (!hasNonUniformValueDeclaration && firstValueDeclaration) { result.valueDeclaration = firstValueDeclaration; @@ -56273,8 +56515,8 @@ ${lanes.join("\n")} return result; } function getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment) { - var _a2, _b; - let property = ((_a2 = type.propertyCacheWithoutObjectFunctionPropertyAugment) == null ? void 0 : _a2.get(name)) || !skipObjectFunctionPropertyAugment ? (_b = type.propertyCache) == null ? void 0 : _b.get(name) : void 0; + var _a, _b; + let property = ((_a = type.propertyCacheWithoutObjectFunctionPropertyAugment) == null ? void 0 : _a.get(name)) || !skipObjectFunctionPropertyAugment ? (_b = type.propertyCache) == null ? void 0 : _b.get(name) : void 0; if (!property) { property = createUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); if (property) { @@ -56340,6 +56582,13 @@ ${lanes.join("\n")} function isConflictingPrivateProperty(prop) { return !prop.valueDeclaration && !!(getCheckFlags(prop) & 1024 /* ContainsPrivate */); } + function isGenericReducibleType(type) { + return !!(type.flags & 1048576 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */ && some(type.types, isGenericReducibleType) || type.flags & 2097152 /* Intersection */ && isReducibleIntersection(type)); + } + function isReducibleIntersection(type) { + const uniqueFilled = type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper)); + return getReducedType(uniqueFilled) !== uniqueFilled; + } function elaborateNeverIntersection(errorInfo, type) { if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) { const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType); @@ -56453,8 +56702,8 @@ ${lanes.join("\n")} return findIndexInfo(getIndexInfosOfType(type), keyType); } function getIndexTypeOfType(type, keyType) { - var _a2; - return (_a2 = getIndexInfoOfType(type, keyType)) == null ? void 0 : _a2.type; + var _a; + return (_a = getIndexInfoOfType(type, keyType)) == null ? void 0 : _a.type; } function getApplicableIndexInfos(type, keyType) { return getIndexInfosOfType(type).filter((info) => isApplicableIndexType(keyType, info.keyType)); @@ -56466,12 +56715,12 @@ ${lanes.join("\n")} return getApplicableIndexInfo(type, isLateBoundName(name) ? esSymbolType : getStringLiteralType(unescapeLeadingUnderscores(name))); } function getTypeParametersFromDeclaration(declaration) { - var _a2; + var _a; let result; for (const node of getEffectiveTypeParameterDeclarations(declaration)) { result = appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol)); } - return (result == null ? void 0 : result.length) ? result : isFunctionDeclaration(declaration) ? (_a2 = getSignatureOfTypeTag(declaration)) == null ? void 0 : _a2.typeParameters : void 0; + return (result == null ? void 0 : result.length) ? result : isFunctionDeclaration(declaration) ? (_a = getSignatureOfTypeTag(declaration)) == null ? void 0 : _a.typeParameters : void 0; } function symbolsToArray(symbols) { const result = []; @@ -56569,7 +56818,9 @@ ${lanes.join("\n")} param, paramSymbol.escapedName, 111551 /* Value */, + /*nameNotFoundMessage*/ void 0, + /*nameArg*/ void 0, /*isUse*/ false @@ -56582,7 +56833,7 @@ ${lanes.join("\n")} } else { parameters.push(paramSymbol); } - if (type && type.kind === 198 /* LiteralType */) { + if (type && type.kind === 200 /* LiteralType */) { flags |= 2 /* HasLiteralTypes */; } const isOptionalParameter2 = isOptionalJSDocPropertyLikeTag(param) || param.initializer || param.questionToken || isRestParameter(param) || iife && parameters.length > iife.arguments.length && !type || isJSDocOptionalParameter(param); @@ -56590,8 +56841,8 @@ ${lanes.join("\n")} minArgumentCount = parameters.length; } } - if ((declaration.kind === 174 /* GetAccessor */ || declaration.kind === 175 /* SetAccessor */) && hasBindableName(declaration) && (!hasThisParameter2 || !thisParameter)) { - const otherKind = declaration.kind === 174 /* GetAccessor */ ? 175 /* SetAccessor */ : 174 /* GetAccessor */; + if ((declaration.kind === 176 /* GetAccessor */ || declaration.kind === 177 /* SetAccessor */) && hasBindableName(declaration) && (!hasThisParameter2 || !thisParameter)) { + const otherKind = declaration.kind === 176 /* GetAccessor */ ? 177 /* SetAccessor */ : 176 /* GetAccessor */; const other = getDeclarationOfKind(getSymbolOfDeclaration(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); @@ -56603,7 +56854,8 @@ ${lanes.join("\n")} thisParameter = createSymbolWithType(createSymbol(1 /* FunctionScopedVariable */, "this" /* This */), getTypeFromTypeNode(thisTag.typeExpression)); } } - const classType = declaration.kind === 173 /* Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : void 0; + const hostDeclaration = isJSDocSignature(declaration) ? getEffectiveJSDocHost(declaration) : declaration; + const classType = hostDeclaration && isConstructorDeclaration(hostDeclaration) ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(hostDeclaration.parent.symbol)) : void 0; const typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); if (hasRestParameter(declaration) || isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) { flags |= 1 /* HasRestParameter */; @@ -56679,17 +56931,17 @@ ${lanes.join("\n")} if (!node) return false; switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; - case 169 /* PropertyDeclaration */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - return node.name.kind === 164 /* ComputedPropertyName */ && traverse(node.name); - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 171 /* PropertyDeclaration */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + return node.name.kind === 166 /* ComputedPropertyName */ && traverse(node.name); + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: return traverse(node.expression); - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: return traverse(node.initializer); default: return !nodeStartsNewLexicalEnvironment(node) && !isPartOfTypeNode(node) && !!forEachChild(node, traverse); @@ -56776,7 +57028,7 @@ ${lanes.join("\n")} function createTypePredicateFromTypePredicateNode(node, signature) { const parameterName = node.parameterName; const type = node.type && getTypeFromTypeNode(node.type); - return parameterName.kind === 194 /* ThisType */ ? createTypePredicate( + return parameterName.kind === 196 /* ThisType */ ? createTypePredicate( node.assertsModifier ? 2 /* AssertsThis */ : 0 /* This */, /*parameterName*/ void 0, @@ -56826,28 +57078,28 @@ ${lanes.join("\n")} return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 173 /* Constructor */) { + if (declaration.kind === 175 /* Constructor */) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } + const typeNode = getEffectiveReturnTypeNode(declaration); if (isJSDocSignature(declaration)) { const root = getJSDocRoot(declaration); - if (root && isConstructorDeclaration(root.parent)) { + if (root && isConstructorDeclaration(root.parent) && !typeNode) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol)); } } if (isJSDocConstructSignature(declaration)) { return getTypeFromTypeNode(declaration.parameters[0].type); } - const typeNode = getEffectiveReturnTypeNode(declaration); if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 174 /* GetAccessor */ && hasBindableName(declaration)) { + if (declaration.kind === 176 /* GetAccessor */ && hasBindableName(declaration)) { const jsDocType = isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - const setter = getDeclarationOfKind(getSymbolOfDeclaration(declaration), 175 /* SetAccessor */); + const setter = getDeclarationOfKind(getSymbolOfDeclaration(declaration), 177 /* SetAccessor */); const setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -56947,10 +57199,10 @@ ${lanes.join("\n")} return signature; } function getOrCreateTypeFromSignature(signature) { - var _a2; + var _a; if (!signature.isolatedSignatureType) { - const kind = (_a2 = signature.declaration) == null ? void 0 : _a2.kind; - const isConstructor = kind === void 0 || kind === 173 /* Constructor */ || kind === 177 /* ConstructSignature */ || kind === 182 /* ConstructorType */; + const kind = (_a = signature.declaration) == null ? void 0 : _a.kind; + const isConstructor = kind === void 0 || kind === 175 /* Constructor */ || kind === 179 /* ConstructSignature */ || kind === 184 /* ConstructorType */; const type = createObjectType(16 /* Anonymous */); type.members = emptySymbols; type.properties = emptyArray; @@ -57005,13 +57257,13 @@ ${lanes.join("\n")} return mapDefined(filter(type.symbol && type.symbol.declarations, isTypeParameterDeclaration), getEffectiveConstraintOfTypeParameter)[0]; } function getInferredTypeParameterConstraint(typeParameter, omitTypeReferences) { - var _a2; + var _a; let inferences; - if ((_a2 = typeParameter.symbol) == null ? void 0 : _a2.declarations) { + if ((_a = typeParameter.symbol) == null ? void 0 : _a.declarations) { for (const declaration of typeParameter.symbol.declarations) { - if (declaration.parent.kind === 192 /* InferType */) { + if (declaration.parent.kind === 194 /* InferType */) { const [childTypeParameter = declaration.parent, grandParent] = walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent); - if (grandParent.kind === 180 /* TypeReference */ && !omitTypeReferences) { + if (grandParent.kind === 182 /* TypeReference */ && !omitTypeReferences) { const typeReference = grandParent; const typeParameters = getTypeParametersForTypeReferenceOrImport(typeReference); if (typeParameters) { @@ -57029,13 +57281,13 @@ ${lanes.join("\n")} } } } - } else if (grandParent.kind === 166 /* Parameter */ && grandParent.dotDotDotToken || grandParent.kind === 188 /* RestType */ || grandParent.kind === 199 /* NamedTupleMember */ && grandParent.dotDotDotToken) { + } else if (grandParent.kind === 168 /* Parameter */ && grandParent.dotDotDotToken || grandParent.kind === 190 /* RestType */ || grandParent.kind === 201 /* NamedTupleMember */ && grandParent.dotDotDotToken) { inferences = append(inferences, createArrayType(unknownType)); - } else if (grandParent.kind === 201 /* TemplateLiteralTypeSpan */) { + } else if (grandParent.kind === 203 /* TemplateLiteralTypeSpan */) { inferences = append(inferences, stringType); - } else if (grandParent.kind === 165 /* TypeParameter */ && grandParent.parent.kind === 197 /* MappedType */) { + } else if (grandParent.kind === 167 /* TypeParameter */ && grandParent.parent.kind === 199 /* MappedType */) { inferences = append(inferences, keyofConstraintType); - } else if (grandParent.kind === 197 /* MappedType */ && grandParent.type && skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 191 /* ConditionalType */ && grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 197 /* MappedType */ && grandParent.parent.checkType.type) { + } else if (grandParent.kind === 199 /* MappedType */ && grandParent.type && skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 193 /* ConditionalType */ && grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 199 /* MappedType */ && grandParent.parent.checkType.type) { const checkMappedType2 = grandParent.parent.checkType; const nodeType = getTypeFromTypeNode(checkMappedType2.type); inferences = append(inferences, instantiateType( @@ -57060,7 +57312,7 @@ ${lanes.join("\n")} } else { let type = getTypeFromTypeNode(constraintDeclaration); if (type.flags & 1 /* Any */ && !isErrorType(type)) { - type = constraintDeclaration.parent.parent.kind === 197 /* MappedType */ ? keyofConstraintType : unknownType; + type = constraintDeclaration.parent.parent.kind === 199 /* MappedType */ ? keyofConstraintType : unknownType; } typeParameter.constraint = type; } @@ -57069,7 +57321,7 @@ ${lanes.join("\n")} return typeParameter.constraint === noConstraintType ? void 0 : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - const tp = getDeclarationOfKind(typeParameter.symbol, 165 /* TypeParameter */); + const tp = getDeclarationOfKind(typeParameter.symbol, 167 /* TypeParameter */); const host2 = isJSDocTemplateTag(tp.parent) ? getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; return host2 && getSymbolOfNode(host2); } @@ -57148,13 +57400,13 @@ ${lanes.join("\n")} return type; } function getTypeArguments(type) { - var _a2, _b; + var _a, _b; if (!type.resolvedTypeArguments) { if (!pushTypeResolution(type, 6 /* ResolvedTypeArguments */)) { - return ((_a2 = type.target.localTypeParameters) == null ? void 0 : _a2.map(() => errorType)) || emptyArray; + return ((_a = type.target.localTypeParameters) == null ? void 0 : _a.map(() => errorType)) || emptyArray; } const node = type.node; - const typeArguments = !node ? emptyArray : node.kind === 180 /* TypeReference */ ? concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments2(node, type.target.localTypeParameters)) : node.kind === 185 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode); + const typeArguments = !node ? emptyArray : node.kind === 182 /* TypeReference */ ? concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments2(node, type.target.localTypeParameters)) : node.kind === 187 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; } else { @@ -57193,7 +57445,7 @@ ${lanes.join("\n")} return errorType; } } - if (node.kind === 180 /* TypeReference */ && isDeferredTypeReferenceNode(node, length(node.typeArguments) !== typeParameters.length)) { + if (node.kind === 182 /* TypeReference */ && isDeferredTypeReferenceNode(node, length(node.typeArguments) !== typeParameters.length)) { return createDeferredTypeReference( type, node, @@ -57278,15 +57530,15 @@ ${lanes.join("\n")} return checkNoTypeArguments(node, symbol) ? type : errorType; } function isLocalTypeAlias(symbol) { - var _a2; - const declaration = (_a2 = symbol.declarations) == null ? void 0 : _a2.find(isTypeAlias); + var _a; + const declaration = (_a = symbol.declarations) == null ? void 0 : _a.find(isTypeAlias); return !!(declaration && getContainingFunction(declaration)); } function getTypeReferenceName(node) { switch (node.kind) { - case 180 /* TypeReference */: + case 182 /* TypeReference */: return node.typeName; - case 230 /* ExpressionWithTypeArguments */: + case 232 /* ExpressionWithTypeArguments */: const expr = node.expression; if (isEntityNameExpression(expr)) { return expr; @@ -57298,10 +57550,10 @@ ${lanes.join("\n")} return symbol.parent ? `${getSymbolPath(symbol.parent)}.${symbol.escapedName}` : symbol.escapedName; } function getUnresolvedSymbolForEntityName(name) { - const identifier = name.kind === 163 /* QualifiedName */ ? name.right : name.kind === 208 /* PropertyAccessExpression */ ? name.name : name; + const identifier = name.kind === 165 /* QualifiedName */ ? name.right : name.kind === 210 /* PropertyAccessExpression */ ? name.name : name; const text = identifier.escapedText; if (text) { - const parentSymbol = name.kind === 163 /* QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : name.kind === 208 /* PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : void 0; + const parentSymbol = name.kind === 165 /* QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : name.kind === 210 /* PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : void 0; const path = parentSymbol ? `${getSymbolPath(parentSymbol)}.${text}` : text; let result = unresolvedSymbols.get(path); if (!result) { @@ -57353,7 +57605,7 @@ ${lanes.join("\n")} const valueType = getTypeOfSymbol(symbol); let typeType = valueType; if (symbol.valueDeclaration) { - const isImportTypeWithQualifier = node.kind === 202 /* ImportType */ && node.qualifier; + const isImportTypeWithQualifier = node.kind === 204 /* ImportType */ && node.qualifier; if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); } @@ -57381,7 +57633,7 @@ ${lanes.join("\n")} return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); } function isUnaryTupleTypeNode(node) { - return node.kind === 186 /* TupleType */ && node.elements.length === 1; + return node.kind === 188 /* TupleType */ && node.elements.length === 1; } function getImpliedConstraint(type, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : getActualTypeVariable(getTypeFromTypeNode(checkNode)) === getActualTypeVariable(type) ? getTypeFromTypeNode(extendsNode) : void 0; @@ -57389,17 +57641,17 @@ ${lanes.join("\n")} function getConditionalFlowTypeOfType(type, node) { let constraints; let covariant = true; - while (node && !isStatement(node) && node.kind !== 323 /* JSDoc */) { + while (node && !isStatement(node) && node.kind !== 326 /* JSDoc */) { const parent2 = node.parent; - if (parent2.kind === 166 /* Parameter */) { + if (parent2.kind === 168 /* Parameter */) { covariant = !covariant; } - if ((covariant || type.flags & 8650752 /* TypeVariable */) && parent2.kind === 191 /* ConditionalType */ && node === parent2.trueType) { + if ((covariant || type.flags & 8650752 /* TypeVariable */) && parent2.kind === 193 /* ConditionalType */ && node === parent2.trueType) { const constraint = getImpliedConstraint(type, parent2.checkType, parent2.extendsType); if (constraint) { constraints = append(constraints, constraint); } - } else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 197 /* MappedType */ && node === parent2.type) { + } else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 199 /* MappedType */ && node === parent2.type) { const mappedType = getTypeFromTypeNode(parent2); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { const typeParameter = getHomomorphicTypeVariable(mappedType); @@ -57416,7 +57668,7 @@ ${lanes.join("\n")} return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; } function isJSDocTypeReference(node) { - return !!(node.flags & 8388608 /* JSDoc */) && (node.kind === 180 /* TypeReference */ || node.kind === 202 /* ImportType */); + return !!(node.flags & 8388608 /* JSDoc */) && (node.kind === 182 /* TypeReference */ || node.kind === 204 /* ImportType */); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { @@ -57466,7 +57718,14 @@ ${lanes.join("\n")} /*isReadonly*/ false )] : emptyArray; - return createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, indexInfo); + return createAnonymousType( + /*symbol*/ + void 0, + emptySymbols, + emptyArray, + emptyArray, + indexInfo + ); } return anyType; } @@ -57532,9 +57791,9 @@ ${lanes.join("\n")} if (declarations) { for (const declaration of declarations) { switch (declaration.kind) { - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: - case 263 /* EnumDeclaration */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: + case 265 /* EnumDeclaration */: return declaration; } } @@ -57574,6 +57833,7 @@ ${lanes.join("\n")} } function getGlobalSymbol(name, meaning, diagnostic) { return resolveName( + /*location*/ void 0, name, meaning, @@ -57809,76 +58069,68 @@ ${lanes.join("\n")} )) || emptyObjectType; } function getGlobalClassDecoratorContextType(reportErrors2) { - var _a2; - return (_a2 = deferredGlobalClassDecoratorContextType != null ? deferredGlobalClassDecoratorContextType : deferredGlobalClassDecoratorContextType = getGlobalType( + return deferredGlobalClassDecoratorContextType ?? (deferredGlobalClassDecoratorContextType = getGlobalType( "ClassDecoratorContext", /*arity*/ 1, reportErrors2 - )) != null ? _a2 : emptyGenericType; + )) ?? emptyGenericType; } function getGlobalClassMethodDecoratorContextType(reportErrors2) { - var _a2; - return (_a2 = deferredGlobalClassMethodDecoratorContextType != null ? deferredGlobalClassMethodDecoratorContextType : deferredGlobalClassMethodDecoratorContextType = getGlobalType( + return deferredGlobalClassMethodDecoratorContextType ?? (deferredGlobalClassMethodDecoratorContextType = getGlobalType( "ClassMethodDecoratorContext", /*arity*/ 2, reportErrors2 - )) != null ? _a2 : emptyGenericType; + )) ?? emptyGenericType; } function getGlobalClassGetterDecoratorContextType(reportErrors2) { - var _a2; - return (_a2 = deferredGlobalClassGetterDecoratorContextType != null ? deferredGlobalClassGetterDecoratorContextType : deferredGlobalClassGetterDecoratorContextType = getGlobalType( + return deferredGlobalClassGetterDecoratorContextType ?? (deferredGlobalClassGetterDecoratorContextType = getGlobalType( "ClassGetterDecoratorContext", /*arity*/ 2, reportErrors2 - )) != null ? _a2 : emptyGenericType; + )) ?? emptyGenericType; } function getGlobalClassSetterDecoratorContextType(reportErrors2) { - var _a2; - return (_a2 = deferredGlobalClassSetterDecoratorContextType != null ? deferredGlobalClassSetterDecoratorContextType : deferredGlobalClassSetterDecoratorContextType = getGlobalType( + return deferredGlobalClassSetterDecoratorContextType ?? (deferredGlobalClassSetterDecoratorContextType = getGlobalType( "ClassSetterDecoratorContext", /*arity*/ 2, reportErrors2 - )) != null ? _a2 : emptyGenericType; + )) ?? emptyGenericType; } function getGlobalClassAccessorDecoratorContextType(reportErrors2) { - var _a2; - return (_a2 = deferredGlobalClassAccessorDecoratorContextType != null ? deferredGlobalClassAccessorDecoratorContextType : deferredGlobalClassAccessorDecoratorContextType = getGlobalType( + return deferredGlobalClassAccessorDecoratorContextType ?? (deferredGlobalClassAccessorDecoratorContextType = getGlobalType( "ClassAccessorDecoratorContext", /*arity*/ 2, reportErrors2 - )) != null ? _a2 : emptyGenericType; + )) ?? emptyGenericType; } function getGlobalClassAccessorDecoratorTargetType(reportErrors2) { - var _a2; - return (_a2 = deferredGlobalClassAccessorDecoratorTargetType != null ? deferredGlobalClassAccessorDecoratorTargetType : deferredGlobalClassAccessorDecoratorTargetType = getGlobalType( + return deferredGlobalClassAccessorDecoratorTargetType ?? (deferredGlobalClassAccessorDecoratorTargetType = getGlobalType( "ClassAccessorDecoratorTarget", /*arity*/ 2, reportErrors2 - )) != null ? _a2 : emptyGenericType; + )) ?? emptyGenericType; } function getGlobalClassAccessorDecoratorResultType(reportErrors2) { - var _a2; - return (_a2 = deferredGlobalClassAccessorDecoratorResultType != null ? deferredGlobalClassAccessorDecoratorResultType : deferredGlobalClassAccessorDecoratorResultType = getGlobalType( + return deferredGlobalClassAccessorDecoratorResultType ?? (deferredGlobalClassAccessorDecoratorResultType = getGlobalType( "ClassAccessorDecoratorResult", /*arity*/ 2, reportErrors2 - )) != null ? _a2 : emptyGenericType; + )) ?? emptyGenericType; } function getGlobalClassFieldDecoratorContextType(reportErrors2) { - var _a2; - return (_a2 = deferredGlobalClassFieldDecoratorContextType != null ? deferredGlobalClassFieldDecoratorContextType : deferredGlobalClassFieldDecoratorContextType = getGlobalType( + return deferredGlobalClassFieldDecoratorContextType ?? (deferredGlobalClassFieldDecoratorContextType = getGlobalType( "ClassFieldDecoratorContext", /*arity*/ 2, reportErrors2 - )) != null ? _a2 : emptyGenericType; + )) ?? emptyGenericType; } function getGlobalNaNSymbol() { return deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol( @@ -57914,11 +58166,11 @@ ${lanes.join("\n")} } function getTupleElementFlags(node) { switch (node.kind) { - case 187 /* OptionalType */: + case 189 /* OptionalType */: return 2 /* Optional */; - case 188 /* RestType */: + case 190 /* RestType */: return getRestTypeElementFlags(node); - case 199 /* NamedTupleMember */: + case 201 /* NamedTupleMember */: return node.questionToken ? 2 /* Optional */ : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* Required */; default: return 1 /* Required */; @@ -57934,7 +58186,7 @@ ${lanes.join("\n")} return readonly ? globalReadonlyArrayType : globalArrayType; } const elementFlags = map(node.elements, getTupleElementFlags); - const missingName = some(node.elements, (e) => e.kind !== 199 /* NamedTupleMember */); + const missingName = some(node.elements, (e) => e.kind !== 201 /* NamedTupleMember */); return getTupleTargetType( elementFlags, readonly, @@ -57943,51 +58195,51 @@ ${lanes.join("\n")} ); } function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { - return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 185 /* ArrayType */ ? mayResolveTypeAlias(node.elementType) : node.kind === 186 /* TupleType */ ? some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || some(node.typeArguments, mayResolveTypeAlias)); + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 187 /* ArrayType */ ? mayResolveTypeAlias(node.elementType) : node.kind === 188 /* TupleType */ ? some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || some(node.typeArguments, mayResolveTypeAlias)); } function isResolvedByTypeAlias(node) { const parent2 = node.parent; switch (parent2.kind) { - case 193 /* ParenthesizedType */: - case 199 /* NamedTupleMember */: - case 180 /* TypeReference */: - case 189 /* UnionType */: - case 190 /* IntersectionType */: - case 196 /* IndexedAccessType */: - case 191 /* ConditionalType */: - case 195 /* TypeOperator */: - case 185 /* ArrayType */: - case 186 /* TupleType */: + case 195 /* ParenthesizedType */: + case 201 /* NamedTupleMember */: + case 182 /* TypeReference */: + case 191 /* UnionType */: + case 192 /* IntersectionType */: + case 198 /* IndexedAccessType */: + case 193 /* ConditionalType */: + case 197 /* TypeOperator */: + case 187 /* ArrayType */: + case 188 /* TupleType */: return isResolvedByTypeAlias(parent2); - case 262 /* TypeAliasDeclaration */: + case 264 /* TypeAliasDeclaration */: return true; } return false; } function mayResolveTypeAlias(node) { switch (node.kind) { - case 180 /* TypeReference */: + case 182 /* TypeReference */: return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968 /* Type */).flags & 524288 /* TypeAlias */); - case 183 /* TypeQuery */: + case 185 /* TypeQuery */: return true; - case 195 /* TypeOperator */: - return node.operator !== 156 /* UniqueKeyword */ && mayResolveTypeAlias(node.type); - case 193 /* ParenthesizedType */: - case 187 /* OptionalType */: - case 199 /* NamedTupleMember */: - case 319 /* JSDocOptionalType */: - case 317 /* JSDocNullableType */: - case 318 /* JSDocNonNullableType */: - case 312 /* JSDocTypeExpression */: + case 197 /* TypeOperator */: + return node.operator !== 158 /* UniqueKeyword */ && mayResolveTypeAlias(node.type); + case 195 /* ParenthesizedType */: + case 189 /* OptionalType */: + case 201 /* NamedTupleMember */: + case 322 /* JSDocOptionalType */: + case 320 /* JSDocNullableType */: + case 321 /* JSDocNonNullableType */: + case 315 /* JSDocTypeExpression */: return mayResolveTypeAlias(node.type); - case 188 /* RestType */: - return node.type.kind !== 185 /* ArrayType */ || mayResolveTypeAlias(node.type.elementType); - case 189 /* UnionType */: - case 190 /* IntersectionType */: + case 190 /* RestType */: + return node.type.kind !== 187 /* ArrayType */ || mayResolveTypeAlias(node.type.elementType); + case 191 /* UnionType */: + case 192 /* IntersectionType */: return some(node.types, mayResolveTypeAlias); - case 196 /* IndexedAccessType */: + case 198 /* IndexedAccessType */: return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); - case 191 /* ConditionalType */: + case 193 /* ConditionalType */: return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); } return false; @@ -57998,22 +58250,22 @@ ${lanes.join("\n")} const target = getArrayOrTupleTargetType(node); if (target === emptyGenericType) { links.resolvedType = emptyObjectType; - } else if (!(node.kind === 186 /* TupleType */ && some(node.elements, (e) => !!(getTupleElementFlags(e) & 8 /* Variadic */))) && isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === 186 /* TupleType */ && node.elements.length === 0 ? target : createDeferredTypeReference( + } else if (!(node.kind === 188 /* TupleType */ && some(node.elements, (e) => !!(getTupleElementFlags(e) & 8 /* Variadic */))) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 188 /* TupleType */ && node.elements.length === 0 ? target : createDeferredTypeReference( target, node, /*mapper*/ void 0 ); } else { - const elementTypes = node.kind === 185 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode); + const elementTypes = node.kind === 187 /* ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : map(node.elements, getTypeFromTypeNode); links.resolvedType = createNormalizedTypeReference(target, elementTypes); } } return links.resolvedType; } function isReadonlyTypeOperator(node) { - return isTypeOperatorNode(node) && node.operator === 146 /* ReadonlyKeyword */; + return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */; } function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) { const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations); @@ -58093,7 +58345,7 @@ ${lanes.join("\n")} return target.objectFlags & 8 /* Tuple */ ? createNormalizedTupleType(target, typeArguments) : createTypeReference(target, typeArguments); } function createNormalizedTupleType(target, elementTypes) { - var _a2, _b, _c; + var _a, _b, _c; if (!(target.combinedFlags & 14 /* NonRequired */)) { return createTypeReference(target, elementTypes); } @@ -58114,16 +58366,16 @@ ${lanes.join("\n")} const flags = target.elementFlags[i]; if (flags & 8 /* Variadic */) { if (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) { - addElement(type, 8 /* Variadic */, (_a2 = target.labeledElementDeclarations) == null ? void 0 : _a2[i]); + addElement(type, 8 /* Variadic */, (_a = target.labeledElementDeclarations) == null ? void 0 : _a[i]); } else if (isTupleType(type)) { - const elements = getTypeArguments(type); + const elements = getElementTypes(type); if (elements.length + expandedTypes.length >= 1e4) { error(currentNode, isPartOfTypeNode(currentNode) ? Diagnostics.Type_produces_a_tuple_type_that_is_too_large_to_represent : Diagnostics.Expression_produces_a_tuple_type_that_is_too_large_to_represent); return errorType; } forEach(elements, (t, n) => { - var _a3; - return addElement(t, type.target.elementFlags[n], (_a3 = type.target.labeledElementDeclarations) == null ? void 0 : _a3[n]); + var _a2; + return addElement(t, type.target.elementFlags[n], (_a2 = type.target.labeledElementDeclarations) == null ? void 0 : _a2[n]); }); } else { addElement(isArrayLikeType(type) && getIndexTypeOfType(type, numberType) || errorType, 4 /* Rest */, (_b = target.labeledElementDeclarations) == null ? void 0 : _b[i]); @@ -58194,6 +58446,11 @@ ${lanes.join("\n")} function getEndElementCount(type, flags) { return type.elementFlags.length - findLastIndex(type.elementFlags, (f) => !(f & flags)) - 1; } + function getElementTypes(type) { + const typeArguments = getTypeArguments(type); + const arity = getTypeReferenceArity(type); + return typeArguments.length === arity ? typeArguments : typeArguments.slice(0, arity); + } function getTypeFromOptionalTypeNode(node) { return addOptionality( getTypeFromTypeNode(node.type), @@ -58217,11 +58474,8 @@ ${lanes.join("\n")} } function addTypeToUnion(typeSet, includes, type) { const flags = type.flags; - if (flags & 1048576 /* Union */) { - return addTypesToUnion(typeSet, includes | (isNamedUnionType(type) ? 1048576 /* Union */ : 0), type.types); - } if (!(flags & 131072 /* Never */)) { - includes |= flags & 205258751 /* IncludesMask */; + includes |= flags & 473694207 /* IncludesMask */; if (flags & 465829888 /* Instantiable */) includes |= 33554432 /* IncludesInstantiable */; if (type === wildcardType) @@ -58240,13 +58494,17 @@ ${lanes.join("\n")} return includes; } function addTypesToUnion(typeSet, includes, types) { + let lastType; for (const type of types) { - includes = addTypeToUnion(typeSet, includes, type); + if (type !== lastType) { + includes = type.flags & 1048576 /* Union */ ? addTypesToUnion(typeSet, includes | (isNamedUnionType(type) ? 1048576 /* Union */ : 0), type.types) : addTypeToUnion(typeSet, includes, type); + lastType = type; + } } return includes; } function removeSubtypes(types, hasObjectTypes) { - var _a2; + var _a; if (types.length < 2) { return types; } @@ -58276,7 +58534,7 @@ ${lanes.join("\n")} if (count === 1e5) { const estimatedCount = count / (len - i) * len; if (estimatedCount > 1e6) { - (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "removeSubtypes_DepthLimit", { typeIds: types.map((t) => t.id) }); + (_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "removeSubtypes_DepthLimit", { typeIds: types.map((t) => t.id) }); error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent); return void 0; } @@ -58351,6 +58609,27 @@ ${lanes.join("\n")} if (types.length === 1) { return types[0]; } + if (types.length === 2 && !origin && (types[0].flags & 1048576 /* Union */ || types[1].flags & 1048576 /* Union */)) { + const infix = unionReduction === 0 /* None */ ? "N" : unionReduction === 2 /* Subtype */ ? "S" : "L"; + const index = types[0].id < types[1].id ? 0 : 1; + const id = types[index].id + infix + types[1 - index].id + getAliasId(aliasSymbol, aliasTypeArguments); + let type = unionOfUnionTypes.get(id); + if (!type) { + type = getUnionTypeWorker( + types, + unionReduction, + aliasSymbol, + aliasTypeArguments, + /*origin*/ + void 0 + ); + unionOfUnionTypes.set(id, type); + } + return type; + } + return getUnionTypeWorker(types, unionReduction, aliasSymbol, aliasTypeArguments, origin); + } + function getUnionTypeWorker(types, unionReduction, aliasSymbol, aliasTypeArguments, origin) { let typeSet = []; const includes = addTypesToUnion(typeSet, 0, types); if (unionReduction !== 0 /* None */) { @@ -58398,35 +58677,32 @@ ${lanes.join("\n")} origin = createOriginUnionOrIntersectionType(1048576 /* Union */, reducedTypes); } } - const objectFlags = (includes & 36323363 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 2097152 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0); + const objectFlags = (includes & 36323331 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 2097152 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0); return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin); } function getUnionOrIntersectionTypePredicate(signatures, kind) { - let first2; + let last2; const types = []; for (const sig of signatures) { const pred = getTypePredicateOfSignature(sig); - if (!pred || pred.kind === 2 /* AssertsThis */ || pred.kind === 3 /* AssertsIdentifier */) { - if (kind !== 2097152 /* Intersection */) { - continue; - } else { - return; - } - } - if (first2) { - if (!typePredicateKindsMatch(first2, pred)) { + if (pred) { + if (pred.kind !== 0 /* This */ && pred.kind !== 1 /* Identifier */ || last2 && !typePredicateKindsMatch(last2, pred)) { return void 0; } + last2 = pred; + types.push(pred.type); } else { - first2 = pred; + const returnType = kind !== 2097152 /* Intersection */ ? getReturnTypeOfSignature(sig) : void 0; + if (returnType !== falseType && returnType !== regularFalseType) { + return void 0; + } } - types.push(pred.type); } - if (!first2) { + if (!last2) { return void 0; } const compositeType = getUnionOrIntersectionType(types, kind); - return createTypePredicate(first2.kind, first2.parameterName, first2.parameterIndex, compositeType); + return createTypePredicate(last2.kind, last2.parameterName, last2.parameterIndex, compositeType); } function typePredicateKindsMatch(a, b) { return a.kind === b.kind && a.parameterIndex === b.parameterIndex; @@ -58499,7 +58775,7 @@ ${lanes.join("\n")} typeSet.set(type.id.toString(), type); } } - includes |= flags & 205258751 /* IncludesMask */; + includes |= flags & 473694207 /* IncludesMask */; } return includes; } @@ -58523,7 +58799,7 @@ ${lanes.join("\n")} function eachUnionContains(unionTypes2, type) { for (const u of unionTypes2) { if (!containsType(u.types, type)) { - const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0; + const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & (32 /* Enum */ | 256 /* NumberLiteral */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0; if (!primitive || !containsType(u.types, primitive)) { return false; } @@ -58550,9 +58826,6 @@ ${lanes.join("\n")} } return false; } - function eachIsUnionContaining(types, flag) { - return every(types, (t) => !!(t.flags & 1048576 /* Union */) && some(t.types, (tt) => !!(tt.flags & flag))); - } function removeFromEach(types, flag) { for (let i = 0; i < types.length; i++) { types[i] = filterType(types[i], (t) => !(t.flags & flag)); @@ -58641,11 +58914,11 @@ ${lanes.join("\n")} if (includes & 1048576 /* Union */) { if (intersectUnionsOfPrimitiveTypes(typeSet)) { result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments); - } else if (eachIsUnionContaining(typeSet, 32768 /* Undefined */)) { + } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && t.types[0].flags & 32768 /* Undefined */))) { const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType; removeFromEach(typeSet, 32768 /* Undefined */); result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments); - } else if (eachIsUnionContaining(typeSet, 65536 /* Null */)) { + } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) { removeFromEach(typeSet, 65536 /* Null */); result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments); } else { @@ -58667,10 +58940,10 @@ ${lanes.join("\n")} return reduceLeft(types, (n, t) => t.flags & 1048576 /* Union */ ? n * t.types.length : t.flags & 131072 /* Never */ ? 0 : n, 1); } function checkCrossProductUnion(types) { - var _a2; + var _a; const size = getCrossProductUnionSize(types); if (size >= 1e5) { - (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size }); + (_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkCrossProductUnion_DepthLimit", { typeIds: types.map((t) => t.id), size }); error(currentNode, Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent); return false; } @@ -58702,20 +58975,23 @@ ${lanes.join("\n")} function getConstituentCountOfTypes(types) { return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0); } + function areIntersectedTypesAvoidingPrimitiveReduction(t1, t2) { + return !!(t1.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && t2 === emptyTypeLiteralType; + } function getTypeFromIntersectionTypeNode(node) { const links = getNodeLinks(node); if (!links.resolvedType) { const aliasSymbol = getAliasSymbolForTypeNode(node); const types = map(node.types, getTypeFromTypeNode); - const noSupertypeReduction = types.length === 2 && !!(types[0].flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && types[1] === emptyTypeLiteralType; + const noSupertypeReduction = types.length === 2 && (areIntersectedTypesAvoidingPrimitiveReduction(types[0], types[1]) || areIntersectedTypesAvoidingPrimitiveReduction(types[1], types[0])); links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction); } return links.resolvedType; } - function createIndexType(type, stringsOnly) { + function createIndexType(type, indexFlags) { const result = createType(4194304 /* Index */); result.type = type; - result.stringsOnly = stringsOnly; + result.indexFlags = indexFlags; return result; } function createOriginIndexType(type) { @@ -58723,31 +58999,23 @@ ${lanes.join("\n")} result.type = type; return result; } - function getIndexTypeForGenericType(type, stringsOnly) { - return stringsOnly ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType( - type, - /*stringsOnly*/ - true - )) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType( - type, - /*stringsOnly*/ - false - )); + function getIndexTypeForGenericType(type, indexFlags) { + return indexFlags & 1 /* StringsOnly */ ? type.resolvedStringIndexType || (type.resolvedStringIndexType = createIndexType(type, 1 /* StringsOnly */)) : type.resolvedIndexType || (type.resolvedIndexType = createIndexType(type, 0 /* None */)); } - function getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) { + function getIndexTypeForMappedType(type, indexFlags) { const typeParameter = getTypeParameterFromMappedType(type); const constraintType = getConstraintTypeFromMappedType(type); const nameType = getNameTypeFromMappedType(type.target || type); - if (!nameType && !noIndexSignatures) { + if (!nameType && !(indexFlags & 2 /* NoIndexSignatures */)) { return constraintType; } const keyTypes = []; if (isMappedTypeWithKeyofConstraintDeclaration(type)) { if (!isGenericIndexType(constraintType)) { const modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); - forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, stringsOnly, addMemberForKeyType); + forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType); } else { - return getIndexTypeForGenericType(type, stringsOnly); + return getIndexTypeForGenericType(type, indexFlags); } } else { forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType); @@ -58755,7 +59023,7 @@ ${lanes.join("\n")} if (isGenericIndexType(constraintType)) { forEachType(constraintType, addMemberForKeyType); } - const result = noIndexSignatures ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes); + const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes); if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) { return constraintType; } @@ -58769,14 +59037,27 @@ ${lanes.join("\n")} const typeVariable = getTypeParameterFromMappedType(mappedType); return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable); function isDistributive(type) { - return type.flags & (3 /* AnyOrUnknown */ | 134348796 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false; + return type.flags & (3 /* AnyOrUnknown */ | 402784252 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false; } } function getLiteralTypeFromPropertyName(name) { if (isPrivateIdentifier(name)) { return neverType; } - return isIdentifier(name) ? getStringLiteralType(unescapeLeadingUnderscores(name.escapedText)) : getRegularTypeOfLiteralType(isComputedPropertyName(name) ? checkComputedPropertyName(name) : checkExpression(name)); + if (isNumericLiteral(name)) { + return getRegularTypeOfLiteralType(checkExpression(name)); + } + if (isComputedPropertyName(name)) { + return getRegularTypeOfLiteralType(checkComputedPropertyName(name)); + } + const propertyName = getPropertyNameForPropertyNameNode(name); + if (propertyName !== void 0) { + return getStringLiteralType(unescapeLeadingUnderscores(propertyName)); + } + if (isExpression(name)) { + return getRegularTypeOfLiteralType(checkExpression(name)); + } + return neverType; } function getLiteralTypeFromProperty(prop, include, includeNonPublic) { if (includeNonPublic || !(getDeclarationModifierFlagsFromSymbol(prop) & 24 /* NonPublicAccessibilityModifier */)) { @@ -58808,19 +59089,15 @@ ${lanes.join("\n")} origin ); } - function isPossiblyReducibleByInstantiation(type) { - const uniqueFilled = getUniqueLiteralFilledInstantiation(type); - return getReducedType(uniqueFilled) !== uniqueFilled; + function shouldDeferIndexType(type, indexFlags = 0 /* None */) { + return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType)); } - function shouldDeferIndexType(type) { - return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) || type.flags & 1048576 /* Union */ && some(type.types, isPossiblyReducibleByInstantiation) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType)); - } - function getIndexType(type, stringsOnly = keyofStringsOnly, noIndexSignatures) { + function getIndexType(type, indexFlags = defaultIndexFlags) { type = getReducedType(type); - return shouldDeferIndexType(type) ? getIndexTypeForGenericType(type, stringsOnly) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, stringsOnly, noIndexSignatures))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, stringsOnly, noIndexSignatures))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties( + return shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties( type, - (noIndexSignatures ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (stringsOnly ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */), - stringsOnly === keyofStringsOnly && !noIndexSignatures + (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */), + indexFlags === defaultIndexFlags ); } function getExtractStringType(type) { @@ -58838,17 +59115,17 @@ ${lanes.join("\n")} const links = getNodeLinks(node); if (!links.resolvedType) { switch (node.operator) { - case 141 /* KeyOfKeyword */: + case 143 /* KeyOfKeyword */: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; - case 156 /* UniqueKeyword */: - links.resolvedType = node.type.kind === 153 /* SymbolKeyword */ ? getESSymbolLikeTypeForNode(walkUpParenthesizedTypes(node.parent)) : errorType; + case 158 /* UniqueKeyword */: + links.resolvedType = node.type.kind === 155 /* SymbolKeyword */ ? getESSymbolLikeTypeForNode(walkUpParenthesizedTypes(node.parent)) : errorType; break; - case 146 /* ReadonlyKeyword */: + case 148 /* ReadonlyKeyword */: links.resolvedType = getTypeFromTypeNode(node.type); break; default: - throw Debug.assertNever(node.operator); + Debug.assertNever(node.operator); } } return links.resolvedType; @@ -58896,31 +59173,21 @@ ${lanes.join("\n")} } return type; function addSpans(texts2, types2) { - const isTextsArray = isArray(texts2); for (let i = 0; i < types2.length; i++) { const t = types2[i]; - const addText = isTextsArray ? texts2[i + 1] : texts2; if (t.flags & (2944 /* Literal */ | 65536 /* Null */ | 32768 /* Undefined */)) { text += getTemplateStringForType(t) || ""; - text += addText; - if (!isTextsArray) - return true; + text += texts2[i + 1]; } else if (t.flags & 134217728 /* TemplateLiteral */) { text += t.texts[0]; if (!addSpans(t.texts, t.types)) return false; - text += addText; - if (!isTextsArray) - return true; + text += texts2[i + 1]; } else if (isGenericIndexType(t) || isPatternLiteralPlaceholderType(t)) { newTypes.push(t); newTexts.push(text); - text = addText; - } else if (t.flags & 2097152 /* Intersection */) { - const added = addSpans(texts2[i + 1], t.types); - if (!added) - return false; - } else if (isTextsArray) { + text = texts2[i + 1]; + } else { return false; } } @@ -58932,6 +59199,11 @@ ${lanes.join("\n")} } function createTemplateLiteralType(texts, types) { const type = createType(134217728 /* TemplateLiteral */); + type.objectFlags = getPropagatingFlagsOfTypes( + types, + /*excludeKinds*/ + 98304 /* Nullable */ + ); type.texts = texts; type.types = types; return type; @@ -59029,8 +59301,7 @@ ${lanes.join("\n")} return true; } function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { - var _a2; - const accessExpression = accessNode && accessNode.kind === 209 /* ElementAccessExpression */ ? accessNode : void 0; + const accessExpression = accessNode && accessNode.kind === 211 /* ElementAccessExpression */ ? accessNode : void 0; const propName = accessNode && isPrivateIdentifier(accessNode) ? void 0 : getPropertyNameFromIndex(indexType, accessNode); if (propName !== void 0) { if (accessFlags & 256 /* Contextual */) { @@ -59039,7 +59310,7 @@ ${lanes.join("\n")} const prop = getPropertyOfType(objectType, propName); if (prop) { if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) { - const deprecatedNode = (_a2 = accessExpression == null ? void 0 : accessExpression.argumentExpression) != null ? _a2 : isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode; + const deprecatedNode = (accessExpression == null ? void 0 : accessExpression.argumentExpression) ?? (isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode); addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName); } if (accessExpression) { @@ -59152,7 +59423,7 @@ ${lanes.join("\n")} let errorInfo; if (indexType.flags & 1024 /* EnumLiteral */) { errorInfo = chainDiagnosticMessages( - /* details */ + /*details*/ void 0, Diagnostics.Property_0_does_not_exist_on_type_1, "[" + typeToString(indexType) + "]", @@ -59161,7 +59432,7 @@ ${lanes.join("\n")} } else if (indexType.flags & 8192 /* UniqueESSymbol */) { const symbolName2 = getFullyQualifiedName(indexType.symbol, accessExpression); errorInfo = chainDiagnosticMessages( - /* details */ + /*details*/ void 0, Diagnostics.Property_0_does_not_exist_on_type_1, "[" + symbolName2 + "]", @@ -59169,7 +59440,7 @@ ${lanes.join("\n")} ); } else if (indexType.flags & 128 /* StringLiteral */) { errorInfo = chainDiagnosticMessages( - /* details */ + /*details*/ void 0, Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, @@ -59177,7 +59448,7 @@ ${lanes.join("\n")} ); } else if (indexType.flags & 256 /* NumberLiteral */) { errorInfo = chainDiagnosticMessages( - /* details */ + /*details*/ void 0, Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, @@ -59185,7 +59456,7 @@ ${lanes.join("\n")} ); } else if (indexType.flags & (8 /* Number */ | 4 /* String */)) { errorInfo = chainDiagnosticMessages( - /* details */ + /*details*/ void 0, Diagnostics.No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1, typeToString(indexType), @@ -59230,9 +59501,12 @@ ${lanes.join("\n")} } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 209 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.kind === 196 /* IndexedAccessType */ ? accessNode.indexType : accessNode.kind === 164 /* ComputedPropertyName */ ? accessNode.expression : accessNode; + return accessNode.kind === 211 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.kind === 198 /* IndexedAccessType */ ? accessNode.indexType : accessNode.kind === 166 /* ComputedPropertyName */ ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { + if (type.flags & 2097152 /* Intersection */) { + return some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 65536 /* Null */ | 32768 /* Undefined */)) || isPatternLiteralPlaceholderType(t)); + } return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type); } function isPatternLiteralType(type) { @@ -59248,7 +59522,7 @@ ${lanes.join("\n")} return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */); } function getGenericObjectFlags(type) { - if (type.flags & 3145728 /* UnionOrIntersection */) { + if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) { if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) { type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0); } @@ -59260,7 +59534,7 @@ ${lanes.join("\n")} } return type.objectFlags & 12582912 /* IsGenericType */; } - return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0); + return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0); } function getSimplifiedType(type, writing) { return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type; @@ -59361,12 +59635,13 @@ ${lanes.join("\n")} if (objectType === wildcardType || indexType === wildcardType) { return wildcardType; } + objectType = getReducedType(objectType); if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) { indexType = stringType; } if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */) accessFlags |= 1 /* IncludeUndefined */; - if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 196 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) { + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 198 /* IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)) || isGenericReducibleType(objectType))) { if (objectType.flags & 3 /* AnyOrUnknown */) { return objectType; } @@ -59438,7 +59713,7 @@ ${lanes.join("\n")} return isTupleTypeNode(node) && length(node.elements) > 0 && !some(node.elements, (e) => isOptionalTypeNode(e) || isRestTypeNode(e) || isNamedTupleMember(e) && !!(e.questionToken || e.dotDotDotToken)); } function isDeferredType(type, checkTuples) { - return isGenericType(type) || checkTuples && isTupleType(type) && some(getTypeArguments(type), isGenericType); + return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType); } function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) { let result; @@ -59447,16 +59722,18 @@ ${lanes.join("\n")} while (true) { if (tailCount === 1e3) { error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); - result = errorType; - break; + return errorType; } - const checkTuples = isSimpleTupleType(root.node.checkType) && isSimpleTupleType(root.node.extendsType) && length(root.node.checkType.elements) === length(root.node.extendsType.elements); const checkType = instantiateType(getActualTypeVariable(root.checkType), mapper); - const checkTypeDeferred = isDeferredType(checkType, checkTuples); const extendsType = instantiateType(root.extendsType, mapper); + if (checkType === errorType || extendsType === errorType) { + return errorType; + } if (checkType === wildcardType || extendsType === wildcardType) { return wildcardType; } + const checkTuples = isSimpleTupleType(root.node.checkType) && isSimpleTupleType(root.node.extendsType) && length(root.node.checkType.elements) === length(root.node.extendsType.elements); + const checkTypeDeferred = isDeferredType(checkType, checkTuples); let combinedMapper; if (root.inferTypeParameters) { const freshParams = sameMap(root.inferTypeParameters, maybeCloneTypeParameter); @@ -59618,7 +59895,7 @@ ${lanes.join("\n")} } } function getTypeFromImportTypeNode(node) { - var _a2; + var _a; const links = getNodeLinks(node); if (!links.resolvedType) { if (!isLiteralImportTypeNode(node)) { @@ -59632,7 +59909,7 @@ ${lanes.join("\n")} links.resolvedSymbol = unknownSymbol; return links.resolvedType = errorType; } - const isExportEquals = !!((_a2 = innerModuleSymbol.exports) == null ? void 0 : _a2.get("export=" /* ExportEquals */)); + const isExportEquals = !!((_a = innerModuleSymbol.exports) == null ? void 0 : _a.get("export=" /* ExportEquals */)); const moduleSymbol = resolveExternalModuleSymbol( innerModuleSymbol, /*dontResolveAlias*/ @@ -59654,7 +59931,7 @@ ${lanes.join("\n")} true ) : void 0; const symbolFromModule = node.isTypeOf ? void 0 : getSymbol2(getExportsOfSymbol(mergedResolvedSymbol), current.escapedText, meaning); - const next = symbolFromModule != null ? symbolFromModule : symbolFromVariable; + const next = symbolFromModule ?? symbolFromVariable; if (!next) { error(current, Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(currentNamespace), declarationNameToString(current)); return links.resolvedType = errorType; @@ -59706,7 +59983,7 @@ ${lanes.join("\n")} } function getAliasSymbolForTypeNode(node) { let host2 = node.parent; - while (isParenthesizedTypeNode(host2) || isJSDocTypeExpression(host2) || isTypeOperatorNode(host2) && host2.operator === 146 /* ReadonlyKeyword */) { + while (isParenthesizedTypeNode(host2) || isJSDocTypeExpression(host2) || isTypeOperatorNode(host2) && host2.operator === 148 /* ReadonlyKeyword */) { host2 = host2.parent; } return isTypeAlias(host2) ? getSymbolOfDeclaration(host2) : void 0; @@ -59818,7 +60095,10 @@ ${lanes.join("\n")} const declarations = concatenate(leftProp.declarations, rightProp.declarations); const flags = 4 /* Property */ | leftProp.flags & 16777216 /* Optional */; const result = createSymbol(flags, leftProp.escapedName); - result.links.type = getUnionType([getTypeOfSymbol(leftProp), removeMissingOrUndefinedType(rightType)], 2 /* Subtype */); + const leftType = getTypeOfSymbol(leftProp); + const leftTypeWithoutUndefined = removeMissingOrUndefinedType(leftType); + const rightTypeWithoutUndefined = removeMissingOrUndefinedType(rightType); + result.links.type = leftTypeWithoutUndefined === rightTypeWithoutUndefined ? leftType : getUnionType([leftType, rightTypeWithoutUndefined], 2 /* Subtype */); result.links.leftSpread = leftProp; result.links.rightSpread = rightProp; result.declarations = declarations; @@ -59834,8 +60114,8 @@ ${lanes.join("\n")} return spread; } function isSpreadableProperty(prop) { - var _a2; - return !some(prop.declarations, isPrivateIdentifierClassElementDeclaration) && (!(prop.flags & (8192 /* Method */ | 32768 /* GetAccessor */ | 65536 /* SetAccessor */)) || !((_a2 = prop.declarations) == null ? void 0 : _a2.some((decl) => isClassLike(decl.parent)))); + var _a; + return !some(prop.declarations, isPrivateIdentifierClassElementDeclaration) && (!(prop.flags & (8192 /* Method */ | 32768 /* GetAccessor */ | 65536 /* SetAccessor */)) || !((_a = prop.declarations) == null ? void 0 : _a.some((decl) => isClassLike(decl.parent)))); } function getSpreadSymbol(prop, readonly) { const isSetonlyAccessor = prop.flags & 65536 /* SetAccessor */ && !(prop.flags & 32768 /* GetAccessor */); @@ -59896,7 +60176,7 @@ ${lanes.join("\n")} return enumLiteralTypes.get(key) || (enumLiteralTypes.set(key, type = createLiteralType(flags, value, symbol)), type); } function getTypeFromLiteralTypeNode(node) { - if (node.literal.kind === 104 /* NullKeyword */) { + if (node.literal.kind === 106 /* NullKeyword */) { return nullType; } const links = getNodeLinks(node); @@ -59929,7 +60209,7 @@ ${lanes.join("\n")} false ); const parent2 = container && container.parent; - if (parent2 && (isClassLike(parent2) || parent2.kind === 261 /* InterfaceDeclaration */)) { + if (parent2 && (isClassLike(parent2) || parent2.kind === 263 /* InterfaceDeclaration */)) { if (!isStatic(container) && (!isConstructorDeclaration(container) || isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfDeclaration(parent2)).thisType; } @@ -59959,17 +60239,17 @@ ${lanes.join("\n")} } function getArrayElementTypeNode(node) { switch (node.kind) { - case 193 /* ParenthesizedType */: + case 195 /* ParenthesizedType */: return getArrayElementTypeNode(node.type); - case 186 /* TupleType */: + case 188 /* TupleType */: if (node.elements.length === 1) { node = node.elements[0]; - if (node.kind === 188 /* RestType */ || node.kind === 199 /* NamedTupleMember */ && node.dotDotDotToken) { + if (node.kind === 190 /* RestType */ || node.kind === 201 /* NamedTupleMember */ && node.dotDotDotToken) { return getArrayElementTypeNode(node.type); } } break; - case 185 /* ArrayType */: + case 187 /* ArrayType */: return node.elementType; } return void 0; @@ -59988,94 +60268,94 @@ ${lanes.join("\n")} } function getTypeFromTypeNodeWorker(node) { switch (node.kind) { - case 131 /* AnyKeyword */: - case 315 /* JSDocAllType */: - case 316 /* JSDocUnknownType */: + case 133 /* AnyKeyword */: + case 318 /* JSDocAllType */: + case 319 /* JSDocUnknownType */: return anyType; - case 157 /* UnknownKeyword */: + case 159 /* UnknownKeyword */: return unknownType; - case 152 /* StringKeyword */: + case 154 /* StringKeyword */: return stringType; - case 148 /* NumberKeyword */: + case 150 /* NumberKeyword */: return numberType; - case 160 /* BigIntKeyword */: + case 162 /* BigIntKeyword */: return bigintType; - case 134 /* BooleanKeyword */: + case 136 /* BooleanKeyword */: return booleanType; - case 153 /* SymbolKeyword */: + case 155 /* SymbolKeyword */: return esSymbolType; - case 114 /* VoidKeyword */: + case 116 /* VoidKeyword */: return voidType; - case 155 /* UndefinedKeyword */: + case 157 /* UndefinedKeyword */: return undefinedType; - case 104 /* NullKeyword */: + case 106 /* NullKeyword */: return nullType; - case 144 /* NeverKeyword */: + case 146 /* NeverKeyword */: return neverType; - case 149 /* ObjectKeyword */: + case 151 /* ObjectKeyword */: return node.flags & 262144 /* JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType; - case 139 /* IntrinsicKeyword */: + case 141 /* IntrinsicKeyword */: return intrinsicMarkerType; - case 194 /* ThisType */: - case 108 /* ThisKeyword */: + case 196 /* ThisType */: + case 110 /* ThisKeyword */: return getTypeFromThisTypeNode(node); - case 198 /* LiteralType */: + case 200 /* LiteralType */: return getTypeFromLiteralTypeNode(node); - case 180 /* TypeReference */: + case 182 /* TypeReference */: return getTypeFromTypeReference(node); - case 179 /* TypePredicate */: + case 181 /* TypePredicate */: return node.assertsModifier ? voidType : booleanType; - case 230 /* ExpressionWithTypeArguments */: + case 232 /* ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 183 /* TypeQuery */: + case 185 /* TypeQuery */: return getTypeFromTypeQueryNode(node); - case 185 /* ArrayType */: - case 186 /* TupleType */: + case 187 /* ArrayType */: + case 188 /* TupleType */: return getTypeFromArrayOrTupleTypeNode(node); - case 187 /* OptionalType */: + case 189 /* OptionalType */: return getTypeFromOptionalTypeNode(node); - case 189 /* UnionType */: + case 191 /* UnionType */: return getTypeFromUnionTypeNode(node); - case 190 /* IntersectionType */: + case 192 /* IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 317 /* JSDocNullableType */: + case 320 /* JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 319 /* JSDocOptionalType */: + case 322 /* JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); - case 199 /* NamedTupleMember */: + case 201 /* NamedTupleMember */: return getTypeFromNamedTupleTypeNode(node); - case 193 /* ParenthesizedType */: - case 318 /* JSDocNonNullableType */: - case 312 /* JSDocTypeExpression */: + case 195 /* ParenthesizedType */: + case 321 /* JSDocNonNullableType */: + case 315 /* JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 188 /* RestType */: + case 190 /* RestType */: return getTypeFromRestTypeNode(node); - case 321 /* JSDocVariadicType */: + case 324 /* JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); - case 181 /* FunctionType */: - case 182 /* ConstructorType */: - case 184 /* TypeLiteral */: - case 325 /* JSDocTypeLiteral */: - case 320 /* JSDocFunctionType */: - case 326 /* JSDocSignature */: + case 183 /* FunctionType */: + case 184 /* ConstructorType */: + case 186 /* TypeLiteral */: + case 328 /* JSDocTypeLiteral */: + case 323 /* JSDocFunctionType */: + case 329 /* JSDocSignature */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 195 /* TypeOperator */: + case 197 /* TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 196 /* IndexedAccessType */: + case 198 /* IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 197 /* MappedType */: + case 199 /* MappedType */: return getTypeFromMappedTypeNode(node); - case 191 /* ConditionalType */: + case 193 /* ConditionalType */: return getTypeFromConditionalTypeNode(node); - case 192 /* InferType */: + case 194 /* InferType */: return getTypeFromInferTypeNode(node); - case 200 /* TemplateLiteralType */: + case 202 /* TemplateLiteralType */: return getTypeFromTemplateTypeNode(node); - case 202 /* ImportType */: + case 204 /* ImportType */: return getTypeFromImportTypeNode(node); - case 79 /* Identifier */: - case 163 /* QualifiedName */: - case 208 /* PropertyAccessExpression */: + case 80 /* Identifier */: + case 165 /* QualifiedName */: + case 210 /* PropertyAccessExpression */: const symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -60273,6 +60553,12 @@ ${lanes.join("\n")} if (!result) { const newMapper = createTypeMapper(typeParameters, typeArguments); result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments); + if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) { + const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables); + if (!(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) { + result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0); + } + } target.instantiations.set(id, result); } return result; @@ -60280,13 +60566,13 @@ ${lanes.join("\n")} return type; } function maybeTypeParameterReference(node) { - return !(node.parent.kind === 180 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || node.parent.kind === 202 /* ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); + return !(node.parent.kind === 182 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || node.parent.kind === 204 /* ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); } function isTypeParameterPossiblyReferenced(tp, node) { if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { const container = tp.symbol.declarations[0].parent; for (let n = node; n !== container; n = n.parent) { - if (!n || n.kind === 238 /* Block */ || n.kind === 191 /* ConditionalType */ && forEachChild(n.extendsType, containsReference)) { + if (!n || n.kind === 240 /* Block */ || n.kind === 193 /* ConditionalType */ && forEachChild(n.extendsType, containsReference)) { return true; } } @@ -60295,29 +60581,30 @@ ${lanes.join("\n")} return true; function containsReference(node2) { switch (node2.kind) { - case 194 /* ThisType */: + case 196 /* ThisType */: return !!tp.isThisType; - case 79 /* Identifier */: + case 80 /* Identifier */: return !tp.isThisType && isPartOfTypeNode(node2) && maybeTypeParameterReference(node2) && getTypeFromTypeNodeWorker(node2) === tp; - case 183 /* TypeQuery */: + case 185 /* TypeQuery */: const entityName = node2.exprName; const firstIdentifier = getFirstIdentifier(entityName); - const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); - const tpDeclaration = tp.symbol.declarations[0]; - let tpScope; - if (tpDeclaration.kind === 165 /* TypeParameter */) { - tpScope = tpDeclaration.parent; - } else if (tp.isThisType) { - tpScope = tpDeclaration; - } else { - return true; - } - if (firstIdentifierSymbol.declarations) { - return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference); + if (!isThisIdentifier(firstIdentifier)) { + const firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); + const tpDeclaration = tp.symbol.declarations[0]; + const tpScope = tpDeclaration.kind === 167 /* TypeParameter */ ? tpDeclaration.parent : ( + // Type parameter is a regular type parameter, e.g. foo + tp.isThisType ? tpDeclaration : ( + // Type parameter is the this type, and its declaration is the class declaration. + void 0 + ) + ); + if (firstIdentifierSymbol.declarations && tpScope) { + return some(firstIdentifierSymbol.declarations, (idDecl) => isNodeDescendantOf(idDecl, tpScope)) || some(node2.typeArguments, containsReference); + } } return true; - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: return !node2.type && !!node2.body || some(node2.typeParameters, containsReference) || some(node2.parameters, containsReference) || !!node2.type && containsReference(node2.type); } return !!forEachChild(node2, containsReference); @@ -60365,7 +60652,7 @@ ${lanes.join("\n")} } function instantiateMappedGenericTupleType(tupleType, mappedType, typeVariable, mapper) { const elementFlags = tupleType.target.elementFlags; - const elementTypes = map(getTypeArguments(tupleType), (t, i) => { + const elementTypes = map(getElementTypes(tupleType), (t, i) => { const singleton = elementFlags[i] & 8 /* Variadic */ ? t : elementFlags[i] & 4 /* Rest */ ? createArrayType(t) : createTupleType([t], [elementFlags[i]]); return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper)); }); @@ -60384,7 +60671,7 @@ ${lanes.join("\n")} } function instantiateMappedTupleType(tupleType, mappedType, mapper) { const elementFlags = tupleType.target.elementFlags; - const elementTypes = map(getTypeArguments(tupleType), (_, i) => instantiateMappedTypeTemplate(mappedType, getStringLiteralType("" + i), !!(elementFlags[i] & 2 /* Optional */), mapper)); + const elementTypes = map(getElementTypes(tupleType), (_, i) => instantiateMappedTypeTemplate(mappedType, getStringLiteralType("" + i), !!(elementFlags[i] & 2 /* Optional */), mapper)); const modifiers = getMappedTypeModifiers(mappedType); const newTupleModifiers = modifiers & 4 /* IncludeOptional */ ? map(elementFlags, (f) => f & 1 /* Required */ ? 2 /* Optional */ : f) : modifiers & 8 /* ExcludeOptional */ ? map(elementFlags, (f) => f & 2 /* Optional */ ? 1 /* Required */ : f) : elementFlags; const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, modifiers); @@ -60401,7 +60688,7 @@ ${lanes.join("\n")} ) : strictNullChecks && modifiers & 8 /* ExcludeOptional */ && isOptional ? getTypeWithFacts(propType, 524288 /* NEUndefined */) : propType; } function instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments) { - const result = createObjectType(type.objectFlags | 64 /* Instantiated */, type.symbol); + const result = createObjectType(type.objectFlags & ~(524288 /* CouldContainTypeVariablesComputed */ | 1048576 /* CouldContainTypeVariables */) | 64 /* Instantiated */, type.symbol); if (type.objectFlags & 32 /* Mapped */) { result.declaration = type.declaration; const origTypeParameter = getTypeParameterFromMappedType(type); @@ -60448,12 +60735,12 @@ ${lanes.join("\n")} ) : type; } function instantiateTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) { - var _a2; + var _a; if (!couldContainTypeVariables(type)) { return type; } if (instantiationDepth === 100 || instantiationCount >= 5e6) { - (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount }); + (_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "instantiateType_DepthLimit", { typeId: type.id, instantiationDepth, instantiationCount }); error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); return errorType; } @@ -60552,14 +60839,11 @@ ${lanes.join("\n")} } return type; } - function getUniqueLiteralFilledInstantiation(type) { - return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper)); - } function getPermissiveInstantiation(type) { - return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper)); + return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper)); } function getRestrictiveInstantiation(type) { - if (type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) { + if (type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) { return type; } if (type.restrictiveInstantiation) { @@ -60573,32 +60857,32 @@ ${lanes.join("\n")} return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration); } function isContextSensitive(node) { - Debug.assert(node.kind !== 171 /* MethodDeclaration */ || isObjectLiteralMethod(node)); + Debug.assert(node.kind !== 173 /* MethodDeclaration */ || isObjectLiteralMethod(node)); switch (node.kind) { - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 171 /* MethodDeclaration */: - case 259 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 173 /* MethodDeclaration */: + case 261 /* FunctionDeclaration */: return isContextSensitiveFunctionLikeDeclaration(node); - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return some(node.properties, isContextSensitive); - case 206 /* ArrayLiteralExpression */: + case 208 /* ArrayLiteralExpression */: return some(node.elements, isContextSensitive); - case 224 /* ConditionalExpression */: + case 226 /* ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 223 /* BinaryExpression */: - return (node.operatorToken.kind === 56 /* BarBarToken */ || node.operatorToken.kind === 60 /* QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 299 /* PropertyAssignment */: + case 225 /* BinaryExpression */: + return (node.operatorToken.kind === 57 /* BarBarToken */ || node.operatorToken.kind === 61 /* QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right)); + case 302 /* PropertyAssignment */: return isContextSensitive(node.initializer); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return isContextSensitive(node.expression); - case 289 /* JsxAttributes */: + case 291 /* JsxAttributes */: return some(node.properties, isContextSensitive) || isJsxOpeningElement(node.parent) && some(node.parent.parent.children, isContextSensitive); - case 288 /* JsxAttribute */: { + case 290 /* JsxAttribute */: { const { initializer } = node; return !!initializer && isContextSensitive(initializer); } - case 291 /* JsxExpression */: { + case 293 /* JsxExpression */: { const { expression } = node; return !!expression && isContextSensitive(expression); } @@ -60609,7 +60893,13 @@ ${lanes.join("\n")} return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); } function hasContextSensitiveReturnExpression(node) { - return !node.typeParameters && !getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 /* Block */ && isContextSensitive(node.body); + if (node.typeParameters || getEffectiveReturnTypeNode(node) || !node.body) { + return false; + } + if (node.body.kind !== 240 /* Block */) { + return isContextSensitive(node.body); + } + return !!forEachReturnStatement(node.body, (statement) => !!statement.expression && isContextSensitive(statement.expression)); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); @@ -60701,23 +60991,23 @@ ${lanes.join("\n")} return true; } switch (node.kind) { - case 291 /* JsxExpression */: - case 214 /* ParenthesizedExpression */: + case 293 /* JsxExpression */: + case 216 /* ParenthesizedExpression */: return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: switch (node.operatorToken.kind) { - case 63 /* EqualsToken */: - case 27 /* CommaToken */: + case 64 /* EqualsToken */: + case 28 /* CommaToken */: return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 206 /* ArrayLiteralExpression */: + case 208 /* ArrayLiteralExpression */: return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 289 /* JsxAttributes */: + case 291 /* JsxAttributes */: return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); } return false; @@ -60792,7 +61082,7 @@ ${lanes.join("\n")} targetReturn, relation, returnExpression, - /*message*/ + /*headMessage*/ void 0, containingMessageChain, resultObj @@ -60995,9 +61285,9 @@ ${lanes.join("\n")} if (!length(node.properties)) return; for (const prop of node.properties) { - if (isJsxSpreadAttribute(prop) || isHyphenatedJsxName(idText(prop.name))) + if (isJsxSpreadAttribute(prop) || isHyphenatedJsxName(getTextOfJsxAttributeName(prop.name))) continue; - yield { errorNode: prop.name, innerExpression: prop.initializer, nameType: getStringLiteralType(idText(prop.name)) }; + yield { errorNode: prop.name, innerExpression: prop.initializer, nameType: getStringLiteralType(getTextOfJsxAttributeName(prop.name)) }; } } function* generateJsxChildren(node, getInvalidTextDiagnostic) { @@ -61017,16 +61307,16 @@ ${lanes.join("\n")} } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 291 /* JsxExpression */: + case 293 /* JsxExpression */: return { errorNode: child, innerExpression: child.expression, nameType }; - case 11 /* JsxText */: + case 12 /* JsxText */: if (child.containsOnlyTriviaWhiteSpaces) { break; } return { errorNode: child, innerExpression: void 0, nameType, errorMessage: getInvalidTextDiagnostic() }; - case 281 /* JsxElement */: - case 282 /* JsxSelfClosingElement */: - case 285 /* JsxFragment */: + case 283 /* JsxElement */: + case 284 /* JsxSelfClosingElement */: + case 287 /* JsxFragment */: return { errorNode: child, innerExpression: child, nameType }; default: return Debug.assertNever(child, "Found invalid jsx child"); @@ -61116,7 +61406,7 @@ ${lanes.join("\n")} const childrenTargetType = getIndexedAccessType(target, getStringLiteralType(childrenPropName)); const diagnostic = Diagnostics._0_components_don_t_accept_text_as_child_elements_Text_in_JSX_has_the_type_string_but_the_expected_type_of_1_is_2; invalidTextDiagnostic = { ...diagnostic, key: "!!ALREADY FORMATTED!!", message: formatMessage( - /*_dummy*/ + /*dummy*/ void 0, diagnostic, tagNameText, @@ -61142,7 +61432,7 @@ ${lanes.join("\n")} } } function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) { - if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */)) + if (target.flags & (402784252 /* Primitive */ | 131072 /* Never */)) return false; if (isTupleLikeType(source)) { return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer); @@ -61176,13 +61466,13 @@ ${lanes.join("\n")} continue; } switch (prop.kind) { - case 175 /* SetAccessor */: - case 174 /* GetAccessor */: - case 171 /* MethodDeclaration */: - case 300 /* ShorthandPropertyAssignment */: + case 177 /* SetAccessor */: + case 176 /* GetAccessor */: + case 173 /* MethodDeclaration */: + case 303 /* ShorthandPropertyAssignment */: yield { errorNode: prop.name, innerExpression: void 0, nameType: type }; break; - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: yield { errorNode: prop.name, innerExpression: prop.initializer, nameType: type, errorMessage: isComputedNonLiteralName(prop.name) ? Diagnostics.Type_of_computed_property_s_value_is_0_which_is_not_assignable_to_type_1 : void 0 }; break; default: @@ -61191,7 +61481,7 @@ ${lanes.join("\n")} } } function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) { - if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */)) + if (target.flags & (402784252 /* Primitive */ | 131072 /* Never */)) return false; return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer); } @@ -61207,7 +61497,7 @@ ${lanes.join("\n")} false, /*errorReporter*/ void 0, - /*errorReporter*/ + /*incompatibleErrorReporter*/ void 0, compareTypesAssignable, /*reportUnreliableMarkers*/ @@ -61235,6 +61525,9 @@ ${lanes.join("\n")} const targetCount = getParameterCount(target); const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount); if (sourceHasMoreParameters) { + if (reportErrors2 && !(checkMode & 8 /* StrictArity */)) { + errorReporter(Diagnostics.Target_signature_provides_too_few_arguments_Expected_0_or_more_but_got_1, getMinArgumentCount(source), targetCount); + } return 0 /* False */; } if (source.typeParameters && source.typeParameters !== target.typeParameters) { @@ -61254,7 +61547,7 @@ ${lanes.join("\n")} void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); } const kind = target.declaration ? target.declaration.kind : 0 /* Unknown */; - const strictVariance = !(checkMode & 3 /* Callback */) && strictFunctionTypes && kind !== 171 /* MethodDeclaration */ && kind !== 170 /* MethodSignature */ && kind !== 173 /* Constructor */; + const strictVariance = !(checkMode & 3 /* Callback */) && strictFunctionTypes && kind !== 173 /* MethodDeclaration */ && kind !== 172 /* MethodSignature */ && kind !== 175 /* Constructor */; let result = -1 /* True */; const sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -61544,7 +61837,7 @@ ${lanes.join("\n")} } function getNormalizedType(type, writing) { while (true) { - const t = isFreshLiteralType(type) ? type.regularType : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) : type; + const t = isFreshLiteralType(type) ? type.regularType : isGenericTupleType(type) ? getNormalizedTupleType(type, writing) : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) : type; if (t === type) return t; type = t; @@ -61563,8 +61856,13 @@ ${lanes.join("\n")} } return type; } + function getNormalizedTupleType(type, writing) { + const elements = getElementTypes(type); + const normalizedElements = sameMap(elements, (t) => t.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(t, writing) : t); + return elements !== normalizedElements ? createNormalizedTupleType(type.target, normalizedElements) : type; + } function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) { - var _a2; + var _a; let errorInfo; let relatedInfo; let maybeKeys; @@ -61591,7 +61889,7 @@ ${lanes.join("\n")} reportIncompatibleStack(); } if (overflow) { - (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth }); + (_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.CheckTypes, "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth }); const diag2 = error(errorNode || currentNode, Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target)); if (errorOutputContainer) { (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag2); @@ -61652,10 +61950,10 @@ ${lanes.join("\n")} relatedInfo: relatedInfo == null ? void 0 : relatedInfo.slice() }; } - function reportIncompatibleError(message, arg0, arg1, arg2, arg3) { + function reportIncompatibleError(message, ...args) { overrideNextErrorInfo++; lastSkippedInfo = void 0; - (incompatibleStack || (incompatibleStack = [])).push([message, arg0, arg1, arg2, arg3]); + (incompatibleStack || (incompatibleStack = [])).push([message, ...args]); } function reportIncompatibleStack() { const stack = incompatibleStack || []; @@ -61666,7 +61964,7 @@ ${lanes.join("\n")} reportError(...stack[0]); if (info) { reportRelationError( - /*headMessage*/ + /*message*/ void 0, ...info ); @@ -61741,19 +62039,19 @@ ${lanes.join("\n")} } if (info) { reportRelationError( - /*headMessage*/ + /*message*/ void 0, ...info ); } } - function reportError(message, arg0, arg1, arg2, arg3) { + function reportError(message, ...args) { Debug.assert(!!errorNode); if (incompatibleStack) reportIncompatibleStack(); if (message.elidedInCompatabilityPyramid) return; - errorInfo = chainDiagnosticMessages(errorInfo, message, arg0, arg1, arg2, arg3); + errorInfo = chainDiagnosticMessages(errorInfo, message, ...args); } function associateRelatedInfo(info) { Debug.assert(!!errorInfo); @@ -61848,7 +62146,9 @@ ${lanes.join("\n")} return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2); } function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) { - if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 134348796 /* Primitive */) { + if (originalSource === originalTarget) + return -1 /* True */; + if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 402784252 /* Primitive */) { if (relation === comparableRelation && !(originalTarget.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) { return -1 /* True */; } @@ -61912,7 +62212,7 @@ ${lanes.join("\n")} return 0 /* False */; } } - const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2)); + const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (402784252 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2)); const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */); if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) { if (reportErrors2) { @@ -61953,7 +62253,7 @@ ${lanes.join("\n")} return 0 /* False */; } function reportErrorResults(originalSource, originalTarget, source2, target2, headMessage2) { - var _a3, _b; + var _a2, _b; const sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource); const targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget); source2 = originalSource.aliasSymbol || sourceHasBase ? originalSource : source2; @@ -61974,7 +62274,7 @@ ${lanes.join("\n")} maybeSuppress = !!errorInfo; } } - if (source2.flags & 524288 /* Object */ && target2.flags & 134348796 /* Primitive */) { + if (source2.flags & 524288 /* Object */ && target2.flags & 402784252 /* Primitive */) { tryElaborateErrorsForPrimitivesAndObjects(source2, target2); } else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) { reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead); @@ -61993,7 +62293,7 @@ ${lanes.join("\n")} return; } reportRelationError(headMessage2, source2, target2); - if (source2.flags & 262144 /* TypeParameter */ && ((_b = (_a3 = source2.symbol) == null ? void 0 : _a3.declarations) == null ? void 0 : _b[0]) && !getConstraintOfType(source2)) { + if (source2.flags & 262144 /* TypeParameter */ && ((_b = (_a2 = source2.symbol) == null ? void 0 : _a2.declarations) == null ? void 0 : _b[0]) && !getConstraintOfType(source2)) { const syntheticParam = cloneTypeParameter(source2); syntheticParam.constraint = instantiateType(target2, makeUnaryTypeMapper(source2, syntheticParam)); if (hasNonCircularBaseConstraint(syntheticParam)) { @@ -62028,10 +62328,10 @@ ${lanes.join("\n")} } function getTypeOfPropertyInTypes(types, name) { const appendPropType = (propTypes, type) => { - var _a3; + var _a2; type = getApparentType(type); const prop = type.flags & 3145728 /* UnionOrIntersection */ ? getPropertyOfUnionOrIntersectionType(type, name) : getPropertyOfObjectType(type, name); - const propType = prop && getTypeOfSymbol(prop) || ((_a3 = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a3.type) || undefinedType; + const propType = prop && getTypeOfSymbol(prop) || ((_a2 = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a2.type) || undefinedType; return append(propTypes, propType); }; return getUnionType(reduceLeft( @@ -62042,7 +62342,7 @@ ${lanes.join("\n")} ) || emptyArray); } function hasExcessProperties(source2, target2, reportErrors2) { - var _a3; + var _a2; if (!isExcessPropertyCheckTarget(target2) || !noImplicitAny && getObjectFlags(target2) & 4096 /* JSLiteral */) { return false; } @@ -62076,13 +62376,13 @@ ${lanes.join("\n")} reportError(Diagnostics.Property_0_does_not_exist_on_type_1, propName, typeToString(errorTarget)); } } else { - const objectLiteralDeclaration = ((_a3 = source2.symbol) == null ? void 0 : _a3.declarations) && firstOrUndefined(source2.symbol.declarations); + const objectLiteralDeclaration = ((_a2 = source2.symbol) == null ? void 0 : _a2.declarations) && firstOrUndefined(source2.symbol.declarations); let suggestion; if (prop.valueDeclaration && findAncestor(prop.valueDeclaration, (d) => d === objectLiteralDeclaration) && getSourceFileOfNode(objectLiteralDeclaration) === getSourceFileOfNode(errorNode)) { const propDeclaration = prop.valueDeclaration; Debug.assertNode(propDeclaration, isObjectLiteralElementLike); - errorNode = propDeclaration; const name = propDeclaration.name; + errorNode = name; if (isIdentifier(name)) { suggestion = getSuggestionForNonexistentProperty(name, errorTarget); } @@ -62120,15 +62420,15 @@ ${lanes.join("\n")} } function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) { if (source2.flags & 1048576 /* Union */) { - return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState); + return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState); } if (target2.flags & 1048576 /* Union */) { - return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */) && !(target2.flags & 134348796 /* Primitive */)); + return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */)); } if (target2.flags & 2097152 /* Intersection */) { return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */); } - if (relation === comparableRelation && target2.flags & 134348796 /* Primitive */) { + if (relation === comparableRelation && target2.flags & 402784252 /* Primitive */) { const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t); if (constraints !== source2.types) { source2 = getIntersectionType(constraints); @@ -62183,6 +62483,11 @@ ${lanes.join("\n")} if (containsType(targetTypes, source2)) { return -1 /* True */; } + if (relation !== comparableRelation && getObjectFlags(target2) & 32768 /* PrimitiveUnion */ && !(source2.flags & 1024 /* EnumLiteral */) && (source2.flags & (128 /* StringLiteral */ | 512 /* BooleanLiteral */ | 2048 /* BigIntLiteral */) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 256 /* NumberLiteral */)) { + const alternateForm = source2 === source2.regularType ? source2.freshType : source2.regularType; + const primitive = source2.flags & 128 /* StringLiteral */ ? stringType : source2.flags & 256 /* NumberLiteral */ ? numberType : source2.flags & 2048 /* BigIntLiteral */ ? bigintType : void 0; + return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? -1 /* True */ : 0 /* False */; + } const match = getMatchingUnionConstituentForType(target2, source2); if (match) { const related = isRelatedTo( @@ -62400,7 +62705,7 @@ ${lanes.join("\n")} return result2; } function recursiveTypeRelatedTo(source2, target2, reportErrors2, intersectionState, recursionFlags) { - var _a3, _b, _c; + var _a2, _b, _c; if (overflow) { return 0 /* False */; } @@ -62409,7 +62714,7 @@ ${lanes.join("\n")} target2, intersectionState, relation, - /*ingnoreConstraints*/ + /*ignoreConstraints*/ false ); const entry = relation.get(id); @@ -62478,7 +62783,7 @@ ${lanes.join("\n")} } let result2; if (expandingFlags === 3 /* Both */) { - (_a3 = tracing) == null ? void 0 : _a3.instant(tracing.Phase.CheckTypes, "recursiveTypeRelatedTo_DepthLimit", { + (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "recursiveTypeRelatedTo_DepthLimit", { sourceId: source2.id, sourceIdStack: sourceStack.map((t) => t.id), targetId: target2.id, @@ -62749,7 +63054,7 @@ ${lanes.join("\n")} } else { const constraint = getSimplifiedTypeOrConstraint(targetType); if (constraint) { - if (isRelatedTo(source2, getIndexType(constraint, target2.stringsOnly), 2 /* Target */, reportErrors2) === -1 /* True */) { + if (isRelatedTo(source2, getIndexType(constraint, target2.indexFlags | 4 /* NoReducibleCheck */), 2 /* Target */, reportErrors2) === -1 /* True */) { return -1 /* True */; } } else if (isGenericMappedType(targetType)) { @@ -62804,7 +63109,7 @@ ${lanes.join("\n")} constraint, 2 /* Target */, reportErrors2, - /* headMessage */ + /*headMessage*/ void 0, intersectionState )) { @@ -62829,13 +63134,7 @@ ${lanes.join("\n")} } if (!isGenericMappedType(source2)) { const targetKeys = keysRemapped ? getNameTypeFromMappedType(target2) : getConstraintTypeFromMappedType(target2); - const sourceKeys = getIndexType( - source2, - /*stringsOnly*/ - void 0, - /*noIndexSignatures*/ - true - ); + const sourceKeys = getIndexType(source2, 2 /* NoIndexSignatures */); const includeOptional = modifiers & 4 /* IncludeOptional */; const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0; if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) { @@ -62863,7 +63162,7 @@ ${lanes.join("\n")} return 3 /* Maybe */; } const c = target2; - if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) { + if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) { const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType)); const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType)); if (result2 = skipTrue ? -1 /* True */ : isRelatedTo( @@ -62933,6 +63232,26 @@ ${lanes.join("\n")} )) { return result2; } + if (sourceFlags & 8388608 /* IndexedAccess */) { + const indexType = source2.indexType; + if (indexType.flags & 4194304 /* Index */) { + const unresolvedIndexConstraint = getBaseConstraintOfType(indexType.type); + const indexConstraint = unresolvedIndexConstraint && unresolvedIndexConstraint !== noConstraintType ? getIndexType(unresolvedIndexConstraint) : keyofConstraintType; + const constraint2 = getIndexedAccessType(source2.objectType, indexConstraint); + if (result2 = isRelatedTo( + constraint2, + target2, + 1 /* Source */, + /*reportErrors*/ + false, + /*headMessage*/ + void 0, + intersectionState + )) { + return result2; + } + } + } if (isMappedTypeGenericIndexedAccess(source2)) { const indexConstraint = getConstraintOfType(source2.indexType); if (indexConstraint) { @@ -63021,7 +63340,7 @@ ${lanes.join("\n")} } return 0 /* False */; } - const sourceIsPrimitive = !!(sourceFlags & 134348796 /* Primitive */); + const sourceIsPrimitive = !!(sourceFlags & 402784252 /* Primitive */); if (relation !== identityRelation) { source2 = getApparentType(source2); sourceFlags = source2.flags; @@ -63040,12 +63359,17 @@ ${lanes.join("\n")} if (varianceResult !== void 0) { return varianceResult; } - } else if (isReadonlyArrayType(target2) ? isArrayOrTupleType(source2) : isArrayType(target2) && isTupleType(source2) && !source2.target.readonly) { + } else if (isReadonlyArrayType(target2) ? everyType(source2, isArrayOrTupleType) : isArrayType(target2) && everyType(source2, (t) => isTupleType(t) && !t.target.readonly)) { if (relation !== identityRelation) { return isRelatedTo(getIndexTypeOfType(source2, numberType) || anyType, getIndexTypeOfType(target2, numberType) || anyType, 3 /* Both */, reportErrors2); } else { return 0 /* False */; } + } else if (isGenericTupleType(source2) && isTupleType(target2) && !isGenericTupleType(target2)) { + const constraint = getBaseConstraintOrType(source2); + if (constraint !== source2) { + return isRelatedTo(constraint, target2, 1 /* Source */, reportErrors2); + } } else if ((relation === subtypeRelation || relation === strictSubtypeRelation) && isEmptyObjectType(target2) && getObjectFlags(target2) & 8192 /* FreshLiteral */ && !isEmptyObjectType(source2)) { return 0 /* False */; } @@ -63128,7 +63452,7 @@ ${lanes.join("\n")} return 0 /* False */; } function typeRelatedToDiscriminatedType(source2, target2) { - var _a3; + var _a2; const sourceProperties = getPropertiesOfType(source2); const sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target2); if (!sourcePropertiesFiltered) @@ -63137,7 +63461,7 @@ ${lanes.join("\n")} for (const sourceProperty of sourcePropertiesFiltered) { numCombinations *= countTypes(getNonMissingTypeOfSymbol(sourceProperty)); if (numCombinations > 25) { - (_a3 = tracing) == null ? void 0 : _a3.instant(tracing.Phase.CheckTypes, "typeRelatedToDiscriminatedType_DepthLimit", { sourceId: source2.id, targetId: target2.id, numCombinations }); + (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "typeRelatedToDiscriminatedType_DepthLimit", { sourceId: source2.id, targetId: target2.id, numCombinations }); return 0 /* False */; } } @@ -63202,7 +63526,7 @@ ${lanes.join("\n")} source2, type, 0 /* Call */, - /*reportStructuralErrors*/ + /*reportErrors*/ false, 0 /* None */ ); @@ -63211,7 +63535,7 @@ ${lanes.join("\n")} source2, type, 1 /* Construct */, - /*reportStructuralErrors*/ + /*reportErrors*/ false, 0 /* None */ ); @@ -63221,7 +63545,7 @@ ${lanes.join("\n")} type, /*sourceIsPrimitive*/ false, - /*reportStructuralErrors*/ + /*reportErrors*/ false, 0 /* None */ ); @@ -63564,7 +63888,7 @@ ${lanes.join("\n")} return result2; } function signaturesRelatedTo(source2, target2, kind, reportErrors2, intersectionState) { - var _a3, _b; + var _a2, _b; if (relation === identityRelation) { return signaturesIdenticalTo(source2, target2, kind); } @@ -63613,7 +63937,7 @@ ${lanes.join("\n")} const sourceSignature = first(sourceSignatures); const targetSignature = first(targetSignatures); result2 = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors2, intersectionState, incompatibleReporter(sourceSignature, targetSignature)); - if (!result2 && reportErrors2 && kind === 1 /* Construct */ && sourceObjectFlags & targetObjectFlags && (((_a3 = targetSignature.declaration) == null ? void 0 : _a3.kind) === 173 /* Constructor */ || ((_b = sourceSignature.declaration) == null ? void 0 : _b.kind) === 173 /* Constructor */)) { + if (!result2 && reportErrors2 && kind === 1 /* Construct */ && sourceObjectFlags & targetObjectFlags && (((_a2 = targetSignature.declaration) == null ? void 0 : _a2.kind) === 175 /* Constructor */ || ((_b = sourceSignature.declaration) == null ? void 0 : _b.kind) === 175 /* Constructor */)) { const constructSignatureToString = (signature) => signatureToString( signature, /*enclosingDeclaration*/ @@ -63890,55 +64214,31 @@ ${lanes.join("\n")} return getPropertiesOfType(type).filter((targetProp) => containsMissingType(getTypeOfSymbol(targetProp))); } function getBestMatchingType(source, target, isRelatedTo = compareTypesAssignable) { - return findMatchingDiscriminantType( - source, - target, - isRelatedTo, - /*skipPartial*/ - true - ) || findMatchingTypeReferenceOrTypeAliasReference(source, target) || findBestTypeForObjectLiteral(source, target) || findBestTypeForInvokable(source, target) || findMostOverlappyType(source, target); + return findMatchingDiscriminantType(source, target, isRelatedTo) || findMatchingTypeReferenceOrTypeAliasReference(source, target) || findBestTypeForObjectLiteral(source, target) || findBestTypeForInvokable(source, target) || findMostOverlappyType(source, target); } - function discriminateTypeByDiscriminableItems(target, discriminators, related, defaultValue, skipPartial) { - const discriminable = target.types.map((_) => void 0); + function discriminateTypeByDiscriminableItems(target, discriminators, related) { + const types = target.types; + const include = types.map((t) => t.flags & 402784252 /* Primitive */ ? 0 /* False */ : -1 /* True */); for (const [getDiscriminatingType, propertyName] of discriminators) { - const targetProp = getUnionOrIntersectionProperty(target, propertyName); - if (skipPartial && targetProp && getCheckFlags(targetProp) & 16 /* ReadPartial */) { - continue; - } - let i = 0; - for (const type of target.types) { - const targetType = getTypeOfPropertyOfType(type, propertyName); - if (targetType && related(getDiscriminatingType(), targetType)) { - discriminable[i] = discriminable[i] === void 0 ? true : discriminable[i]; - } else { - discriminable[i] = false; + let matched = false; + for (let i = 0; i < types.length; i++) { + if (include[i]) { + const targetType = getTypeOfPropertyOfType(types[i], propertyName); + if (targetType && related(getDiscriminatingType(), targetType)) { + matched = true; + } else { + include[i] = 3 /* Maybe */; + } + } + } + for (let i = 0; i < types.length; i++) { + if (include[i] === 3 /* Maybe */) { + include[i] = matched ? 0 /* False */ : -1 /* True */; } - i++; } } - const match = discriminable.indexOf( - /*searchElement*/ - true - ); - if (match === -1) { - return defaultValue; - } - let nextMatch = discriminable.indexOf( - /*searchElement*/ - true, - match + 1 - ); - while (nextMatch !== -1) { - if (!isTypeIdenticalTo(target.types[match], target.types[nextMatch])) { - return defaultValue; - } - nextMatch = discriminable.indexOf( - /*searchElement*/ - true, - nextMatch + 1 - ); - } - return target.types[match]; + const filtered = contains(include, 0 /* False */) ? getUnionType(types.filter((_, i) => include[i])) : target; + return filtered.flags & 131072 /* Never */ ? target : filtered; } function isWeakType(type) { if (type.flags & 524288 /* Object */) { @@ -63965,10 +64265,15 @@ ${lanes.join("\n")} return getVariancesWorker(symbol, getSymbolLinks(symbol).typeParameters); } function getVariancesWorker(symbol, typeParameters = emptyArray) { - var _a2, _b; + var _a, _b; const links = getSymbolLinks(symbol); if (!links.variances) { - (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.CheckTypes, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) }); + (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) }); + const oldVarianceComputation = inVarianceComputation; + if (!inVarianceComputation) { + inVarianceComputation = true; + resolutionStart = resolutionTargets.length; + } links.variances = emptyArray; const variances = []; for (const tp of typeParameters) { @@ -63997,6 +64302,10 @@ ${lanes.join("\n")} } variances.push(variance); } + if (!oldVarianceComputation) { + inVarianceComputation = false; + resolutionStart = 0; + } links.variances = variances; (_b = tracing) == null ? void 0 : _b.pop({ variances: variances.map(Debug.formatVariance) }); } @@ -64016,8 +64325,8 @@ ${lanes.join("\n")} return markerTypes.has(getTypeId(type)); } function getTypeParameterModifiers(tp) { - var _a2; - return reduceLeft((_a2 = tp.symbol) == null ? void 0 : _a2.declarations, (modifiers, d) => modifiers | getEffectiveModifierFlags(d), 0 /* None */) & (32768 /* In */ | 65536 /* Out */ | 2048 /* Const */); + var _a; + return reduceLeft((_a = tp.symbol) == null ? void 0 : _a.declarations, (modifiers, d) => modifiers | getEffectiveModifierFlags(d), 0 /* None */) & (32768 /* In */ | 65536 /* Out */ | 2048 /* Const */); } function hasCovariantVoidArgument(typeArguments, variances) { for (let i = 0; i < variances.length; i++) { @@ -64262,7 +64571,7 @@ ${lanes.join("\n")} for (const t of types) { if (!(t.flags & 131072 /* Never */)) { const baseType = getBaseTypeOfLiteralType(t); - commonBaseType != null ? commonBaseType : commonBaseType = baseType; + commonBaseType ?? (commonBaseType = baseType); if (baseType === t || baseType !== commonBaseType) { return false; } @@ -64313,7 +64622,7 @@ ${lanes.join("\n")} const target = type.target; if (getObjectFlags(target) & 1 /* Class */) { const baseTypeNode = getBaseTypeNodeOfClass(target); - if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* Identifier */ && baseTypeNode.expression.kind !== 208 /* PropertyAccessExpression */) { + if (baseTypeNode && baseTypeNode.expression.kind !== 80 /* Identifier */ && baseTypeNode.expression.kind !== 210 /* PropertyAccessExpression */) { return void 0; } } @@ -64384,9 +64693,8 @@ ${lanes.join("\n")} return type.flags & 1056 /* EnumLike */ ? getBaseTypeOfEnumLikeType(type) : type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) : type; } function getBaseTypeOfLiteralTypeUnion(type) { - var _a2; const key = `B${getTypeId(type)}`; - return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType)); + return getCachedType(key) ?? setCachedType(key, mapType(type, getBaseTypeOfLiteralType)); } function getBaseTypeOfLiteralTypeForComparison(type) { return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type; @@ -64713,12 +65021,12 @@ ${lanes.join("\n")} } let diagnostic; switch (declaration.kind) { - case 223 /* BinaryExpression */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: + case 225 /* BinaryExpression */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: diagnostic = noImplicitAny ? Diagnostics.Member_0_implicitly_has_an_1_type : Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 166 /* Parameter */: + case 168 /* Parameter */: const param = declaration; if (isIdentifier(param.name)) { const originalKeywordKind = identifierToKeywordKind(param.name); @@ -64726,6 +65034,7 @@ ${lanes.join("\n")} param, param.name.escapedText, 788968 /* Type */, + /*nameNotFoundMessage*/ void 0, param.name.escapedText, /*isUse*/ @@ -64739,27 +65048,27 @@ ${lanes.join("\n")} } diagnostic = declaration.dotDotDotToken ? noImplicitAny ? Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? Diagnostics.Parameter_0_implicitly_has_an_1_type : Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 205 /* BindingElement */: + case 207 /* BindingElement */: diagnostic = Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { return; } break; - case 320 /* JSDocFunctionType */: + case 323 /* JSDocFunctionType */: error(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 326 /* JSDocSignature */: + case 329 /* JSDocSignature */: if (noImplicitAny && isJSDocOverloadTag(declaration.parent)) { error(declaration.parent.tagName, Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation, typeAsString); } return; - case 259 /* FunctionDeclaration */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 261 /* FunctionDeclaration */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: if (noImplicitAny && !declaration.name) { if (wideningKind === 3 /* GeneratorYield */) { error(declaration, Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); @@ -64770,7 +65079,7 @@ ${lanes.join("\n")} } diagnostic = !noImplicitAny ? Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage : wideningKind === 3 /* GeneratorYield */ ? Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; - case 197 /* MappedType */: + case 199 /* MappedType */: if (noImplicitAny) { error(declaration, Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } @@ -64862,13 +65171,12 @@ ${lanes.join("\n")} } } function addIntraExpressionInferenceSite(context, node, type) { - var _a2; - ((_a2 = context.intraExpressionInferenceSites) != null ? _a2 : context.intraExpressionInferenceSites = []).push({ node, type }); + (context.intraExpressionInferenceSites ?? (context.intraExpressionInferenceSites = [])).push({ node, type }); } function inferFromIntraExpressionSites(context) { if (context.intraExpressionInferenceSites) { for (const { node, type } of context.intraExpressionInferenceSites) { - const contextualType = node.kind === 171 /* MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* NoConstraints */) : getContextualType2(node, 2 /* NoConstraints */); + const contextualType = node.kind === 173 /* MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* NoConstraints */) : getContextualType2(node, 2 /* NoConstraints */); if (contextualType) { inferTypes(context.inferences, type, contextualType); } @@ -64912,16 +65220,16 @@ ${lanes.join("\n")} if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) { return !!(objectFlags & 1048576 /* CouldContainTypeVariables */); } - const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || forEach(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables)); - if (type.flags & 3899393 /* ObjectFlagsType */) { + const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables)); + if (type.flags & 138117121 /* ObjectFlagsType */) { type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0); } return result; } function isNonGenericTopLevelType(type) { if (type.aliasSymbol && !type.aliasTypeArguments) { - const declaration = getDeclarationOfKind(type.aliasSymbol, 262 /* TypeAliasDeclaration */); - return !!(declaration && findAncestor(declaration.parent, (n) => n.kind === 308 /* SourceFile */ ? true : n.kind === 264 /* ModuleDeclaration */ ? false : "quit")); + const declaration = getDeclarationOfKind(type.aliasSymbol, 264 /* TypeAliasDeclaration */); + return !!(declaration && findAncestor(declaration.parent, (n) => n.kind === 311 /* SourceFile */ ? true : n.kind === 266 /* ModuleDeclaration */ ? false : "quit")); } return false; } @@ -64953,7 +65261,14 @@ ${lanes.join("\n")} /*isReadonly*/ false )] : emptyArray; - return createAnonymousType(void 0, members, emptyArray, emptyArray, indexInfos); + return createAnonymousType( + /*symbol*/ + void 0, + members, + emptyArray, + emptyArray, + indexInfos + ); } function inferTypeForHomomorphicMappedType(source, target, constraint) { if (inInferTypeForHomomorphicMappedType) { @@ -64970,7 +65285,7 @@ ${lanes.join("\n")} return type; } function isPartiallyInferableType(type) { - return !(getObjectFlags(type) & 262144 /* NonInferrableType */) || isObjectLiteralType2(type) && some(getPropertiesOfType(type), (prop) => isPartiallyInferableType(getTypeOfSymbol(prop))) || isTupleType(type) && some(getTypeArguments(type), isPartiallyInferableType); + return !(getObjectFlags(type) & 262144 /* NonInferrableType */) || isObjectLiteralType2(type) && some(getPropertiesOfType(type), (prop) => isPartiallyInferableType(getTypeOfSymbol(prop))) || isTupleType(type) && some(getElementTypes(type), isPartiallyInferableType); } function createReverseMappedType(source, target, constraint) { if (!(getIndexInfoOfType(source, stringType) || getPropertiesOfType(source).length !== 0 && isPartiallyInferableType(source))) { @@ -64980,7 +65295,7 @@ ${lanes.join("\n")} return createArrayType(inferReverseMappedType(getTypeArguments(source)[0], target, constraint), isReadonlyArrayType(source)); } if (isTupleType(source)) { - const elementTypes = map(getTypeArguments(source), (t) => inferReverseMappedType(t, target, constraint)); + const elementTypes = map(getElementTypes(source), (t) => inferReverseMappedType(t, target, constraint)); const elementFlags = getMappedTypeModifiers(target) & 4 /* IncludeOptional */ ? sameMap(source.target.elementFlags, (f) => f & 2 /* Optional */ ? 1 /* Required */ : f) : source.target.elementFlags; return createTupleType(elementTypes, elementFlags, source.target.readonly, source.target.labeledElementDeclarations); } @@ -65382,21 +65697,19 @@ ${lanes.join("\n")} const saveInferencePriority = inferencePriority; inferencePriority = 2048 /* MaxValue */; const saveExpandingFlags = expandingFlags; - const sourceIdentity = getRecursionIdentity(source); - const targetIdentity = getRecursionIdentity(target); - if (contains(sourceStack, sourceIdentity)) + (sourceStack ?? (sourceStack = [])).push(source); + (targetStack ?? (targetStack = [])).push(target); + if (isDeeplyNestedType(source, sourceStack, sourceStack.length, 2)) expandingFlags |= 1 /* Source */; - if (contains(targetStack, targetIdentity)) + if (isDeeplyNestedType(target, targetStack, targetStack.length, 2)) expandingFlags |= 2 /* Target */; if (expandingFlags !== 3 /* Both */) { - (sourceStack || (sourceStack = [])).push(sourceIdentity); - (targetStack || (targetStack = [])).push(targetIdentity); action(source, target); - targetStack.pop(); - sourceStack.pop(); } else { inferencePriority = -1 /* Circularity */; } + targetStack.pop(); + sourceStack.pop(); expandingFlags = saveExpandingFlags; visited.set(key, inferencePriority); inferencePriority = Math.min(inferencePriority, saveInferencePriority); @@ -65538,7 +65851,11 @@ ${lanes.join("\n")} return true; } if (constraintType.flags & 262144 /* TypeParameter */) { - inferWithPriority(getIndexType(source), constraintType, 32 /* MappedTypeConstraint */); + inferWithPriority(getIndexType( + source, + /*indexFlags*/ + !!source.pattern ? 2 /* NoIndexSignatures */ : 0 /* None */ + ), constraintType, 32 /* MappedTypeConstraint */); const extendedConstraint = getConstraintOfType(constraintType); if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) { return true; @@ -65607,7 +65924,7 @@ ${lanes.join("\n")} } } function inferFromObjectTypes(source, target) { - var _a2, _b; + var _a, _b; if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && (source.target === target.target || isArrayType(source) && isArrayType(target))) { inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target)); return; @@ -65662,7 +65979,7 @@ ${lanes.join("\n")} inferFromTypes(sliceTupleType(source, startLength + targetInfo.impliedArity, endLength), elementTypes[startLength + 1]); } } else if (elementFlags[startLength] & 8 /* Variadic */ && elementFlags[startLength + 1] & 4 /* Rest */) { - const param = (_a2 = getInferenceInfoForType(elementTypes[startLength])) == null ? void 0 : _a2.typeParameter; + const param = (_a = getInferenceInfoForType(elementTypes[startLength])) == null ? void 0 : _a.typeParameter; const constraint = param && getBaseConstraintOfType(param); if (constraint && isTupleType(constraint) && !constraint.target.hasRestElement) { const impliedArity = constraint.target.fixedLength; @@ -65734,11 +66051,13 @@ ${lanes.join("\n")} } } function inferFromSignature(source, target) { - const saveBivariant = bivariant; - const kind = target.declaration ? target.declaration.kind : 0 /* Unknown */; - bivariant = bivariant || kind === 171 /* MethodDeclaration */ || kind === 170 /* MethodSignature */ || kind === 173 /* Constructor */; - applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); - bivariant = saveBivariant; + if (!(source.flags & 64 /* IsNonInferrable */)) { + const saveBivariant = bivariant; + const kind = target.declaration ? target.declaration.kind : 0 /* Unknown */; + bivariant = bivariant || kind === 173 /* MethodDeclaration */ || kind === 172 /* MethodSignature */ || kind === 175 /* Constructor */; + applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); + bivariant = saveBivariant; + } applyToReturnTypes(source, target, inferFromTypes); } function inferFromIndexTypes(source, target) { @@ -65779,7 +66098,7 @@ ${lanes.join("\n")} } function hasPrimitiveConstraint(type) { const constraint = getConstraintOfTypeParameter(type); - return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */); + return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 402784252 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */); } function isObjectLiteralType2(type) { return !!(getObjectFlags(type) & 128 /* ObjectLiteral */); @@ -65812,14 +66131,14 @@ ${lanes.join("\n")} const inference = context.inferences[index]; if (!inference.inferredType) { let inferredType; - const signature = context.signature; - if (signature) { - const inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : void 0; - if (inference.contraCandidates) { - const useCovariantType = inferredCovariantType && !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType))); - inferredType = useCovariantType ? inferredCovariantType : getContravariantInference(inference); - } else if (inferredCovariantType) { - inferredType = inferredCovariantType; + let fallbackType; + if (context.signature) { + const inferredCovariantType = inference.candidates ? getCovariantInference(inference, context.signature) : void 0; + const inferredContravariantType = inference.contraCandidates ? getContravariantInference(inference) : void 0; + if (inferredCovariantType || inferredContravariantType) { + const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType)))); + inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType; + fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType; } else if (context.flags & 1 /* NoDefault */) { inferredType = silentNeverType; } else { @@ -65836,7 +66155,7 @@ ${lanes.join("\n")} if (constraint) { const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper); if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { - inference.inferredType = inferredType = instantiatedConstraint; + inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint; } } } @@ -65893,7 +66212,7 @@ ${lanes.join("\n")} return Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function; } default: - if (node.parent.kind === 300 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 303 /* ShorthandPropertyAssignment */) { return Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; } else { return Diagnostics.Cannot_find_name_0; @@ -65919,75 +66238,75 @@ ${lanes.join("\n")} function isInTypeQuery(node) { return !!findAncestor( node, - (n) => n.kind === 183 /* TypeQuery */ ? true : n.kind === 79 /* Identifier */ || n.kind === 163 /* QualifiedName */ ? false : "quit" + (n) => n.kind === 185 /* TypeQuery */ ? true : n.kind === 80 /* Identifier */ || n.kind === 165 /* QualifiedName */ ? false : "quit" ); } function isInAmbientOrTypeNode(node) { - return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeLiteralNode(n))); + return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeAliasDeclaration(n) || isTypeLiteralNode(n))); } function getFlowCacheKey(node, declaredType, initialType, flowContainer) { switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: if (!isThisInTypeQuery(node)) { const symbol = getResolvedSymbol(node); return symbol !== unknownSymbol ? `${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}|${getSymbolId(symbol)}` : void 0; } - case 108 /* ThisKeyword */: + case 110 /* ThisKeyword */: return `0|${flowContainer ? getNodeId(flowContainer) : "-1"}|${getTypeId(declaredType)}|${getTypeId(initialType)}`; - case 232 /* NonNullExpression */: - case 214 /* ParenthesizedExpression */: + case 234 /* NonNullExpression */: + case 216 /* ParenthesizedExpression */: return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); - case 163 /* QualifiedName */: + case 165 /* QualifiedName */: const left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); return left && left + "." + node.right.escapedText; - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: const propName = getAccessedPropertyName(node); if (propName !== void 0) { const key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } break; - case 203 /* ObjectBindingPattern */: - case 204 /* ArrayBindingPattern */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 171 /* MethodDeclaration */: + case 205 /* ObjectBindingPattern */: + case 206 /* ArrayBindingPattern */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 173 /* MethodDeclaration */: return `${getNodeId(node)}#${getTypeId(declaredType)}`; } return void 0; } function isMatchingReference(source, target) { switch (target.kind) { - case 214 /* ParenthesizedExpression */: - case 232 /* NonNullExpression */: + case 216 /* ParenthesizedExpression */: + case 234 /* NonNullExpression */: return isMatchingReference(source, target.expression); - case 223 /* BinaryExpression */: - return isAssignmentExpression(target) && isMatchingReference(source, target.left) || isBinaryExpression(target) && target.operatorToken.kind === 27 /* CommaToken */ && isMatchingReference(source, target.right); + case 225 /* BinaryExpression */: + return isAssignmentExpression(target) && isMatchingReference(source, target.left) || isBinaryExpression(target) && target.operatorToken.kind === 28 /* CommaToken */ && isMatchingReference(source, target.right); } switch (source.kind) { - case 233 /* MetaProperty */: - return target.kind === 233 /* MetaProperty */ && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; - case 79 /* Identifier */: - case 80 /* PrivateIdentifier */: - return isThisInTypeQuery(source) ? target.kind === 108 /* ThisKeyword */ : target.kind === 79 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || (isVariableDeclaration(target) || isBindingElement(target)) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfDeclaration(target); - case 108 /* ThisKeyword */: - return target.kind === 108 /* ThisKeyword */; - case 106 /* SuperKeyword */: - return target.kind === 106 /* SuperKeyword */; - case 232 /* NonNullExpression */: - case 214 /* ParenthesizedExpression */: + case 235 /* MetaProperty */: + return target.kind === 235 /* MetaProperty */ && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; + case 80 /* Identifier */: + case 81 /* PrivateIdentifier */: + return isThisInTypeQuery(source) ? target.kind === 110 /* ThisKeyword */ : target.kind === 80 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || (isVariableDeclaration(target) || isBindingElement(target)) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfDeclaration(target); + case 110 /* ThisKeyword */: + return target.kind === 110 /* ThisKeyword */; + case 108 /* SuperKeyword */: + return target.kind === 108 /* SuperKeyword */; + case 234 /* NonNullExpression */: + case 216 /* ParenthesizedExpression */: return isMatchingReference(source.expression, target); - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: const sourcePropertyName = getAccessedPropertyName(source); const targetPropertyName = isAccessExpression(target) ? getAccessedPropertyName(target) : void 0; return sourcePropertyName !== void 0 && targetPropertyName !== void 0 && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); - case 163 /* QualifiedName */: + case 165 /* QualifiedName */: return isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); - case 223 /* BinaryExpression */: - return isBinaryExpression(source) && source.operatorToken.kind === 27 /* CommaToken */ && isMatchingReference(source.right, target); + case 225 /* BinaryExpression */: + return isBinaryExpression(source) && source.operatorToken.kind === 28 /* CommaToken */ && isMatchingReference(source.right, target); } return false; } @@ -66011,36 +66330,34 @@ ${lanes.join("\n")} return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName : type.flags & 384 /* StringOrNumberLiteral */ ? escapeLeadingUnderscores("" + type.value) : void 0; } function tryGetElementAccessExpressionName(node) { - if (isStringOrNumericLiteralLike(node.argumentExpression)) { - return escapeLeadingUnderscores(node.argumentExpression.text); - } - if (isEntityNameExpression(node.argumentExpression)) { - const symbol = resolveEntityName( - node.argumentExpression, - 111551 /* Value */, - /*ignoreErrors*/ - true - ); - if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */)) - return void 0; - const declaration = symbol.valueDeclaration; - if (declaration === void 0) - return void 0; - const type = tryGetTypeFromEffectiveTypeNode(declaration); - if (type) { - const name = tryGetNameFromType(type); - if (name !== void 0) { - return name; - } + return isStringOrNumericLiteralLike(node.argumentExpression) ? escapeLeadingUnderscores(node.argumentExpression.text) : isEntityNameExpression(node.argumentExpression) ? tryGetNameFromEntityNameExpression(node.argumentExpression) : void 0; + } + function tryGetNameFromEntityNameExpression(node) { + const symbol = resolveEntityName( + node, + 111551 /* Value */, + /*ignoreErrors*/ + true + ); + if (!symbol || !(isConstVariable(symbol) || symbol.flags & 8 /* EnumMember */)) + return void 0; + const declaration = symbol.valueDeclaration; + if (declaration === void 0) + return void 0; + const type = tryGetTypeFromEffectiveTypeNode(declaration); + if (type) { + const name = tryGetNameFromType(type); + if (name !== void 0) { + return name; } - if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) { - const initializer = getEffectiveInitializer(declaration); - if (initializer) { - return tryGetNameFromType(getTypeOfExpression(initializer)); - } - if (isEnumMember(declaration)) { - return getTextOfPropertyName(declaration.name); - } + } + if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node)) { + const initializer = getEffectiveInitializer(declaration); + if (initializer) { + return tryGetNameFromType(getTypeOfExpression(initializer)); + } + if (isEnumMember(declaration)) { + return getTextOfPropertyName(declaration.name); } } return void 0; @@ -66130,8 +66447,8 @@ ${lanes.join("\n")} return unionType.keyPropertyName.length ? unionType.keyPropertyName : void 0; } function getConstituentTypeForKeyType(unionType, keyType) { - var _a2; - const result = (_a2 = unionType.constituentMap) == null ? void 0 : _a2.get(getTypeId(getRegularTypeOfLiteralType(keyType))); + var _a; + const result = (_a = unionType.constituentMap) == null ? void 0 : _a.get(getTypeId(getRegularTypeOfLiteralType(keyType))); return result !== unknownType ? result : void 0; } function getMatchingUnionConstituentForType(unionType, type) { @@ -66141,7 +66458,7 @@ ${lanes.join("\n")} } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { const keyPropertyName = getKeyPropertyName(unionType); - const propNode = keyPropertyName && find(node.properties, (p) => p.symbol && p.kind === 299 /* PropertyAssignment */ && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer)); + const propNode = keyPropertyName && find(node.properties, (p) => p.symbol && p.kind === 302 /* PropertyAssignment */ && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer)); const propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); } @@ -66156,7 +66473,7 @@ ${lanes.join("\n")} } } } - if (expression.expression.kind === 208 /* PropertyAccessExpression */ && isOrContainsMatchingReference(reference, expression.expression.expression)) { + if (expression.expression.kind === 210 /* PropertyAccessExpression */ && isOrContainsMatchingReference(reference, expression.expression.expression)) { return true; } return false; @@ -66180,7 +66497,6 @@ ${lanes.join("\n")} return false; } function getAssignmentReducedType(declaredType, assignedType) { - var _a2; if (declaredType === assignedType) { return declaredType; } @@ -66188,7 +66504,7 @@ ${lanes.join("\n")} return assignedType; } const key = `A${getTypeId(declaredType)},${getTypeId(assignedType)}`; - return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, getAssignmentReducedTypeWorker(declaredType, assignedType)); + return getCachedType(key) ?? setCachedType(key, getAssignmentReducedTypeWorker(declaredType, assignedType)); } function getAssignmentReducedTypeWorker(declaredType, assignedType) { const filteredType = filterType(declaredType, (t) => typeMaybeAssignableTo(assignedType, t)); @@ -66261,7 +66577,7 @@ ${lanes.join("\n")} return 83886079 /* UnknownFacts */; } function getIntersectionTypeFacts(type) { - const ignoreObjects = maybeTypeOfKind(type, 134348796 /* Primitive */); + const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */); let oredFacts = 0 /* None */; let andedFacts = 134217727 /* All */; for (const t of type.types) { @@ -66298,12 +66614,12 @@ ${lanes.join("\n")} return defaultExpression ? getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) : type; } function getTypeOfDestructuredProperty(type, name) { - var _a2; + var _a; const nameType = getLiteralTypeFromPropertyName(name); if (!isTypeUsableAsPropertyName(nameType)) return errorType; const text = getPropertyNameFromType(nameType); - return getTypeOfPropertyOfType(type, text) || includeUndefinedInIndexSignature((_a2 = getApplicableIndexInfoForName(type, text)) == null ? void 0 : _a2.type) || errorType; + return getTypeOfPropertyOfType(type, text) || includeUndefinedInIndexSignature((_a = getApplicableIndexInfoForName(type, text)) == null ? void 0 : _a.type) || errorType; } function getTypeOfDestructuredArrayElement(type, index) { return everyType(type, isTupleLikeType) && getTupleElementType(type, index) || includeUndefinedInIndexSignature(checkIteratedTypeOrElementType( @@ -66329,11 +66645,11 @@ ${lanes.join("\n")} ) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - const isDestructuringDefaultAssignment = node.parent.kind === 206 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || node.parent.kind === 299 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + const isDestructuringDefaultAssignment = node.parent.kind === 208 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || node.parent.kind === 302 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent2) { - return parent2.parent.kind === 223 /* BinaryExpression */ && parent2.parent.left === parent2 || parent2.parent.kind === 247 /* ForOfStatement */ && parent2.parent.initializer === parent2; + return parent2.parent.kind === 225 /* BinaryExpression */ && parent2.parent.left === parent2 || parent2.parent.kind === 249 /* ForOfStatement */ && parent2.parent.initializer === parent2; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -66350,21 +66666,21 @@ ${lanes.join("\n")} function getAssignedType(node) { const { parent: parent2 } = node; switch (parent2.kind) { - case 246 /* ForInStatement */: + case 248 /* ForInStatement */: return stringType; - case 247 /* ForOfStatement */: + case 249 /* ForOfStatement */: return checkRightHandSideOfForOf(parent2) || errorType; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent2); - case 217 /* DeleteExpression */: + case 219 /* DeleteExpression */: return undefinedType; - case 206 /* ArrayLiteralExpression */: + case 208 /* ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent2, node); - case 227 /* SpreadElement */: + case 229 /* SpreadElement */: return getAssignedTypeOfSpreadExpression(parent2); - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent2); - case 300 /* ShorthandPropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent2); } return errorType; @@ -66372,7 +66688,7 @@ ${lanes.join("\n")} function getInitialTypeOfBindingElement(node) { const pattern = node.parent; const parentType = getInitialType(pattern.parent); - const type = pattern.kind === 203 /* ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : getTypeOfDestructuredSpreadExpression(parentType); + const type = pattern.kind === 205 /* ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : getTypeOfDestructuredSpreadExpression(parentType); return getTypeWithDefault(type, node.initializer); } function getTypeOfInitializer(node) { @@ -66383,32 +66699,32 @@ ${lanes.join("\n")} if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 246 /* ForInStatement */) { + if (node.parent.parent.kind === 248 /* ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 247 /* ForOfStatement */) { + if (node.parent.parent.kind === 249 /* ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 257 /* VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); + return node.kind === 259 /* VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function isEmptyArrayAssignment(node) { - return node.kind === 257 /* VariableDeclaration */ && node.initializer && isEmptyArrayLiteral2(node.initializer) || node.kind !== 205 /* BindingElement */ && node.parent.kind === 223 /* BinaryExpression */ && isEmptyArrayLiteral2(node.parent.right); + return node.kind === 259 /* VariableDeclaration */ && node.initializer && isEmptyArrayLiteral2(node.initializer) || node.kind !== 207 /* BindingElement */ && node.parent.kind === 225 /* BinaryExpression */ && isEmptyArrayLiteral2(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: switch (node.operatorToken.kind) { - case 63 /* EqualsToken */: - case 75 /* BarBarEqualsToken */: - case 76 /* AmpersandAmpersandEqualsToken */: - case 77 /* QuestionQuestionEqualsToken */: + case 64 /* EqualsToken */: + case 76 /* BarBarEqualsToken */: + case 77 /* AmpersandAmpersandEqualsToken */: + case 78 /* QuestionQuestionEqualsToken */: return getReferenceCandidate(node.left); - case 27 /* CommaToken */: + case 28 /* CommaToken */: return getReferenceCandidate(node.right); } } @@ -66416,10 +66732,10 @@ ${lanes.join("\n")} } function getReferenceRoot(node) { const { parent: parent2 } = node; - return parent2.kind === 214 /* ParenthesizedExpression */ || parent2.kind === 223 /* BinaryExpression */ && parent2.operatorToken.kind === 63 /* EqualsToken */ && parent2.left === node || parent2.kind === 223 /* BinaryExpression */ && parent2.operatorToken.kind === 27 /* CommaToken */ && parent2.right === node ? getReferenceRoot(parent2) : node; + return parent2.kind === 216 /* ParenthesizedExpression */ || parent2.kind === 225 /* BinaryExpression */ && parent2.operatorToken.kind === 64 /* EqualsToken */ && parent2.left === node || parent2.kind === 225 /* BinaryExpression */ && parent2.operatorToken.kind === 28 /* CommaToken */ && parent2.right === node ? getReferenceRoot(parent2) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 292 /* CaseClause */) { + if (clause.kind === 295 /* CaseClause */) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -66435,12 +66751,12 @@ ${lanes.join("\n")} return links.switchTypes; } function getSwitchClauseTypeOfWitnesses(switchStatement) { - if (some(switchStatement.caseBlock.clauses, (clause) => clause.kind === 292 /* CaseClause */ && !isStringLiteralLike(clause.expression))) { + if (some(switchStatement.caseBlock.clauses, (clause) => clause.kind === 295 /* CaseClause */ && !isStringLiteralLike(clause.expression))) { return void 0; } const witnesses = []; for (const clause of switchStatement.caseBlock.clauses) { - const text = clause.kind === 292 /* CaseClause */ ? clause.expression.text : void 0; + const text = clause.kind === 295 /* CaseClause */ ? clause.expression.text : void 0; witnesses.push(text && !contains(witnesses, text) ? text : void 0); } return witnesses; @@ -66449,7 +66765,7 @@ ${lanes.join("\n")} return source.flags & 1048576 /* Union */ ? !forEach(source.types, (t) => !contains(types, t)) : contains(types, source); } function isTypeSubsetOf(source, target) { - return source === target || target.flags & 1048576 /* Union */ && isTypeSubsetOfUnion(source, target); + return !!(source === target || source.flags & 131072 /* Never */ || target.flags & 1048576 /* Union */ && isTypeSubsetOfUnion(source, target)); } function isTypeSubsetOfUnion(source, target) { if (source.flags & 1048576 /* Union */) { @@ -66598,8 +66914,8 @@ ${lanes.join("\n")} function isEvolvingArrayOperationTarget(node) { const root = getReferenceRoot(node); const parent2 = root.parent; - const isLengthPushOrUnshift = isPropertyAccessExpression(parent2) && (parent2.name.escapedText === "length" || parent2.parent.kind === 210 /* CallExpression */ && isIdentifier(parent2.name) && isPushOrUnshiftIdentifier(parent2.name)); - const isElementAssignment = parent2.kind === 209 /* ElementAccessExpression */ && parent2.expression === root && parent2.parent.kind === 223 /* BinaryExpression */ && parent2.parent.operatorToken.kind === 63 /* EqualsToken */ && parent2.parent.left === parent2 && !isAssignmentTarget(parent2.parent) && isTypeAssignableToKind(getTypeOfExpression(parent2.argumentExpression), 296 /* NumberLike */); + const isLengthPushOrUnshift = isPropertyAccessExpression(parent2) && (parent2.name.escapedText === "length" || parent2.parent.kind === 212 /* CallExpression */ && isIdentifier(parent2.name) && isPushOrUnshiftIdentifier(parent2.name)); + const isElementAssignment = parent2.kind === 211 /* ElementAccessExpression */ && parent2.expression === root && parent2.parent.kind === 225 /* BinaryExpression */ && parent2.parent.operatorToken.kind === 64 /* EqualsToken */ && parent2.parent.left === parent2 && !isAssignmentTarget(parent2.parent) && isTypeAssignableToKind(getTypeOfExpression(parent2.argumentExpression), 296 /* NumberLike */); return isLengthPushOrUnshift || isElementAssignment; } function isDeclarationWithExplicitTypeAnnotation(node) { @@ -66622,7 +66938,7 @@ ${lanes.join("\n")} if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol); } - if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* ForOfStatement */) { + if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === 249 /* ForOfStatement */) { const statement = declaration.parent.parent; const expressionType = getTypeOfDottedName( statement.expression, @@ -66649,14 +66965,14 @@ ${lanes.join("\n")} function getTypeOfDottedName(node, diagnostic) { if (!(node.flags & 33554432 /* InWithStatement */)) { switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: const symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node)); return getExplicitTypeOfSymbol(symbol, diagnostic); - case 108 /* ThisKeyword */: + case 110 /* ThisKeyword */: return getExplicitThisType(node); - case 106 /* SuperKeyword */: + case 108 /* SuperKeyword */: return checkSuperExpression(node); - case 208 /* PropertyAccessExpression */: { + case 210 /* PropertyAccessExpression */: { const type = getTypeOfDottedName(node.expression, diagnostic); if (type) { const name = node.name; @@ -66673,7 +66989,7 @@ ${lanes.join("\n")} } return void 0; } - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return getTypeOfDottedName(node.expression, diagnostic); } } @@ -66683,13 +66999,13 @@ ${lanes.join("\n")} let signature = links.effectsSignature; if (signature === void 0) { let funcType; - if (node.parent.kind === 241 /* ExpressionStatement */) { + if (node.parent.kind === 243 /* ExpressionStatement */) { funcType = getTypeOfDottedName( node.expression, /*diagnostic*/ void 0 ); - } else if (node.expression.kind !== 106 /* SuperKeyword */) { + } else if (node.expression.kind !== 108 /* SuperKeyword */) { if (isOptionalChain(node)) { funcType = checkNonNullType( getOptionalExpressionType(checkExpression(node.expression), node.expression), @@ -66737,7 +67053,7 @@ ${lanes.join("\n")} /*excludeJSDocTypeAssertions*/ true ); - return node.kind === 95 /* FalseKeyword */ || node.kind === 223 /* BinaryExpression */ && (node.operatorToken.kind === 55 /* AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 56 /* BarBarToken */ && isFalseExpression(node.left) && isFalseExpression(node.right)); + return node.kind === 97 /* FalseKeyword */ || node.kind === 225 /* BinaryExpression */ && (node.operatorToken.kind === 56 /* AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 57 /* BarBarToken */ && isFalseExpression(node.left) && isFalseExpression(node.right)); } function isReachableFlowNodeWorker(flow, noCacheCheck) { while (true) { @@ -66826,7 +67142,7 @@ ${lanes.join("\n")} if (flags & (16 /* Assignment */ | 96 /* Condition */ | 256 /* ArrayMutation */ | 128 /* SwitchClause */)) { flow = flow.antecedent; } else if (flags & 512 /* Call */) { - if (flow.node.expression.kind === 106 /* SuperKeyword */) { + if (flow.node.expression.kind === 108 /* SuperKeyword */) { return true; } flow = flow.antecedent; @@ -66856,19 +67172,19 @@ ${lanes.join("\n")} } function isConstantReference(node) { switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: if (!isThisInTypeQuery(node)) { const symbol = getResolvedSymbol(node); return isConstVariable(symbol) || isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); } break; - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); } return false; } - function getFlowTypeOfReference(reference, declaredType, initialType = declaredType, flowContainer, flowNode = ((_a2) => (_a2 = tryCast(reference, canHaveFlowNode)) == null ? void 0 : _a2.flowNode)()) { + function getFlowTypeOfReference(reference, declaredType, initialType = declaredType, flowContainer, flowNode = ((_a) => (_a = tryCast(reference, canHaveFlowNode)) == null ? void 0 : _a.flowNode)()) { let key; let isKeySet = false; let flowDepth = 0; @@ -66883,7 +67199,7 @@ ${lanes.join("\n")} const evolvedType = getTypeFromFlowType(getTypeAtFlowNode(flowNode)); sharedFlowCount = sharedFlowStart; const resultType = getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 232 /* NonNullExpression */ && !(resultType.flags & 131072 /* Never */) && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 234 /* NonNullExpression */ && !(resultType.flags & 131072 /* Never */) && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) { return declaredType; } return resultType === nonNullUnknownType ? unknownType : resultType; @@ -66895,9 +67211,9 @@ ${lanes.join("\n")} return key = getFlowCacheKey(reference, declaredType, initialType, flowContainer); } function getTypeAtFlowNode(flow) { - var _a3; + var _a2; if (flowDepth === 2e3) { - (_a3 = tracing) == null ? void 0 : _a3.instant(tracing.Phase.CheckTypes, "getTypeAtFlowNode_DepthLimit", { flowId: flow.id }); + (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.CheckTypes, "getTypeAtFlowNode_DepthLimit", { flowId: flow.id }); flowAnalysisDisabled = true; reportFlowControlError(reference); return errorType; @@ -66952,7 +67268,7 @@ ${lanes.join("\n")} target.antecedents = saveAntecedents; } else if (flags & 2 /* Start */) { const container = flow.node; - if (container && container !== flowContainer && reference.kind !== 208 /* PropertyAccessExpression */ && reference.kind !== 209 /* ElementAccessExpression */ && reference.kind !== 108 /* ThisKeyword */) { + if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && reference.kind !== 110 /* ThisKeyword */) { flow = container.flowNode; continue; } @@ -66971,7 +67287,7 @@ ${lanes.join("\n")} } function getInitialOrAssignedType(flow) { const node = flow.node; - return getNarrowableTypeForReference(node.kind === 257 /* VariableDeclaration */ || node.kind === 205 /* BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); + return getNarrowableTypeForReference(node.kind === 259 /* VariableDeclaration */ || node.kind === 207 /* BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); } function getTypeAtFlowAssignment(flow) { const node = flow.node; @@ -67001,13 +67317,13 @@ ${lanes.join("\n")} } if (isVariableDeclaration(node) && (isInJSFile(node) || isVarConst(node))) { const init = getDeclaredExpandoInitializer(node); - if (init && (init.kind === 215 /* FunctionExpression */ || init.kind === 216 /* ArrowFunction */)) { + if (init && (init.kind === 217 /* FunctionExpression */ || init.kind === 218 /* ArrowFunction */)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } - if (isVariableDeclaration(node) && node.parent.parent.kind === 246 /* ForInStatement */ && (isMatchingReference(reference, node.parent.parent.expression) || optionalChainContainsReference(node.parent.parent.expression, reference))) { + if (isVariableDeclaration(node) && node.parent.parent.kind === 248 /* ForInStatement */ && (isMatchingReference(reference, node.parent.parent.expression) || optionalChainContainsReference(node.parent.parent.expression, reference))) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } return void 0; @@ -67018,14 +67334,14 @@ ${lanes.join("\n")} /*excludeJSDocTypeAssertions*/ true ); - if (node.kind === 95 /* FalseKeyword */) { + if (node.kind === 97 /* FalseKeyword */) { return unreachableNeverType; } - if (node.kind === 223 /* BinaryExpression */) { - if (node.operatorToken.kind === 55 /* AmpersandAmpersandToken */) { + if (node.kind === 225 /* BinaryExpression */) { + if (node.operatorToken.kind === 56 /* AmpersandAmpersandToken */) { return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); } - if (node.operatorToken.kind === 56 /* BarBarToken */) { + if (node.operatorToken.kind === 57 /* BarBarToken */) { return getUnionType([narrowTypeByAssertion(type, node.left), narrowTypeByAssertion(type, node.right)]); } } @@ -67061,13 +67377,13 @@ ${lanes.join("\n")} function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { const node = flow.node; - const expr = node.kind === 210 /* CallExpression */ ? node.expression.expression : node.left.expression; + const expr = node.kind === 212 /* CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { const flowType = getTypeAtFlowNode(flow.antecedent); const type = getTypeFromFlowType(flowType); if (getObjectFlags(type) & 256 /* EvolvingArray */) { let evolvedType2 = type; - if (node.kind === 210 /* CallExpression */) { + if (node.kind === 212 /* CallExpression */) { for (const arg of node.arguments) { evolvedType2 = addEvolvingArrayElementType(evolvedType2, arg); } @@ -67104,7 +67420,7 @@ ${lanes.join("\n")} let type = getTypeFromFlowType(flowType); if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); - } else if (expr.kind === 218 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { + } else if (expr.kind === 220 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else { if (strictNullChecks) { @@ -67116,7 +67432,7 @@ ${lanes.join("\n")} flow.clauseEnd, (t) => !(t.flags & (32768 /* Undefined */ | 131072 /* Never */)) ); - } else if (expr.kind === 218 /* TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { + } else if (expr.kind === 220 /* TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { type = narrowTypeBySwitchOptionalChainContainment( type, flow.switchStatement, @@ -67149,7 +67465,7 @@ ${lanes.join("\n")} return type; } pushIfUnique(antecedentTypes, type); - if (!isTypeSubsetOf(type, declaredType)) { + if (!isTypeSubsetOf(type, initialType)) { subtypeReduction = true; } if (isIncomplete(flowType)) { @@ -67164,7 +67480,7 @@ ${lanes.join("\n")} return type; } antecedentTypes.push(type); - if (!isTypeSubsetOf(type, declaredType)) { + if (!isTypeSubsetOf(type, initialType)) { subtypeReduction = true; } if (isIncomplete(flowType)) { @@ -67218,7 +67534,7 @@ ${lanes.join("\n")} } const type = getTypeFromFlowType(flowType); pushIfUnique(antecedentTypes, type); - if (!isTypeSubsetOf(type, declaredType)) { + if (!isTypeSubsetOf(type, initialType)) { subtypeReduction = true; } if (type === declaredType) { @@ -67308,12 +67624,12 @@ ${lanes.join("\n")} }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { - if ((operator === 36 /* EqualsEqualsEqualsToken */ || operator === 37 /* ExclamationEqualsEqualsToken */) && type.flags & 1048576 /* Union */) { + if ((operator === 37 /* EqualsEqualsEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */) && type.flags & 1048576 /* Union */) { const keyPropertyName = getKeyPropertyName(type); if (keyPropertyName && keyPropertyName === getAccessedPropertyName(access)) { const candidate = getConstituentTypeForKeyType(type, getTypeOfExpression(value)); if (candidate) { - return operator === (assumeTrue ? 36 /* EqualsEqualsEqualsToken */ : 37 /* ExclamationEqualsEqualsToken */) ? candidate : isUnitType(getTypeOfPropertyOfType(candidate, keyPropertyName) || unknownType) ? removeType(type, candidate) : type; + return operator === (assumeTrue ? 37 /* EqualsEqualsEqualsToken */ : 38 /* ExclamationEqualsEqualsToken */) ? candidate : isUnitType(getTypeOfPropertyOfType(candidate, keyPropertyName) || unknownType) ? removeType(type, candidate) : type; } } } @@ -67344,7 +67660,7 @@ ${lanes.join("\n")} } function isTypePresencePossible(type, propName, assumeTrue) { const prop = getPropertyOfType(type, propName); - return prop ? !!(prop.flags & 16777216 /* Optional */) || assumeTrue : !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; + return prop ? !!(prop.flags & 16777216 /* Optional */ || getCheckFlags(prop) & 48 /* Partial */) || assumeTrue : !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; } function narrowTypeByInKeyword(type, nameType, assumeTrue) { const name = getPropertyNameFromType(nameType); @@ -67367,22 +67683,22 @@ ${lanes.join("\n")} } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { switch (expr.operatorToken.kind) { - case 63 /* EqualsToken */: - case 75 /* BarBarEqualsToken */: - case 76 /* AmpersandAmpersandEqualsToken */: - case 77 /* QuestionQuestionEqualsToken */: + case 64 /* EqualsToken */: + case 76 /* BarBarEqualsToken */: + case 77 /* AmpersandAmpersandEqualsToken */: + case 78 /* QuestionQuestionEqualsToken */: return narrowTypeByTruthiness(narrowType(type, expr.right, assumeTrue), expr.left, assumeTrue); - case 34 /* EqualsEqualsToken */: - case 35 /* ExclamationEqualsToken */: - case 36 /* EqualsEqualsEqualsToken */: - case 37 /* ExclamationEqualsEqualsToken */: + case 35 /* EqualsEqualsToken */: + case 36 /* ExclamationEqualsToken */: + case 37 /* EqualsEqualsEqualsToken */: + case 38 /* ExclamationEqualsEqualsToken */: const operator = expr.operatorToken.kind; const left = getReferenceCandidate(expr.left); const right = getReferenceCandidate(expr.right); - if (left.kind === 218 /* TypeOfExpression */ && isStringLiteralLike(right)) { + if (left.kind === 220 /* TypeOfExpression */ && isStringLiteralLike(right)) { return narrowTypeByTypeof(type, left, operator, right, assumeTrue); } - if (right.kind === 218 /* TypeOfExpression */ && isStringLiteralLike(left)) { + if (right.kind === 220 /* TypeOfExpression */ && isStringLiteralLike(left)) { return narrowTypeByTypeof(type, right, operator, left, assumeTrue); } if (isMatchingReference(reference, left)) { @@ -67413,9 +67729,9 @@ ${lanes.join("\n")} return narrowTypeByConstructor(type, operator, left, assumeTrue); } break; - case 102 /* InstanceOfKeyword */: + case 104 /* InstanceOfKeyword */: return narrowTypeByInstanceof(type, expr, assumeTrue); - case 101 /* InKeyword */: + case 103 /* InKeyword */: if (isPrivateIdentifier(expr.left)) { return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); } @@ -67430,9 +67746,9 @@ ${lanes.join("\n")} } } break; - case 27 /* CommaToken */: + case 28 /* CommaToken */: return narrowType(type, expr.right, assumeTrue); - case 55 /* AmpersandAmpersandToken */: + case 56 /* AmpersandAmpersandToken */: return assumeTrue ? narrowType( narrowType( type, @@ -67454,7 +67770,7 @@ ${lanes.join("\n")} /*assumeTrue*/ false )]); - case 56 /* BarBarToken */: + case 57 /* BarBarToken */: return assumeTrue ? getUnionType([narrowType( type, expr.left, @@ -67500,8 +67816,8 @@ ${lanes.join("\n")} ); } function narrowTypeByOptionalChainContainment(type, operator, value, assumeTrue) { - const equalsOperator = operator === 34 /* EqualsEqualsToken */ || operator === 36 /* EqualsEqualsEqualsToken */; - const nullableFlags = operator === 34 /* EqualsEqualsToken */ || operator === 35 /* ExclamationEqualsToken */ ? 98304 /* Nullable */ : 32768 /* Undefined */; + const equalsOperator = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */; + const nullableFlags = operator === 35 /* EqualsEqualsToken */ || operator === 36 /* ExclamationEqualsToken */ ? 98304 /* Nullable */ : 32768 /* Undefined */; const valueType = getTypeOfExpression(value); const removeNullable = equalsOperator !== assumeTrue && everyType(valueType, (t) => !!(t.flags & nullableFlags)) || equalsOperator === assumeTrue && everyType(valueType, (t) => !(t.flags & (3 /* AnyOrUnknown */ | nullableFlags))); return removeNullable ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type; @@ -67510,11 +67826,11 @@ ${lanes.join("\n")} if (type.flags & 1 /* Any */) { return type; } - if (operator === 35 /* ExclamationEqualsToken */ || operator === 37 /* ExclamationEqualsEqualsToken */) { + if (operator === 36 /* ExclamationEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */) { assumeTrue = !assumeTrue; } const valueType = getTypeOfExpression(value); - const doubleEquals = operator === 34 /* EqualsEqualsToken */ || operator === 35 /* ExclamationEqualsToken */; + const doubleEquals = operator === 35 /* EqualsEqualsToken */ || operator === 36 /* ExclamationEqualsToken */; if (valueType.flags & 98304 /* Nullable */) { if (!strictNullChecks) { return type; @@ -67524,7 +67840,7 @@ ${lanes.join("\n")} } if (assumeTrue) { if (!doubleEquals && (type.flags & 2 /* Unknown */ || someType(type, isEmptyAnonymousObjectType))) { - if (valueType.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) { + if (valueType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) { return valueType; } if (valueType.flags & 524288 /* Object */) { @@ -67540,7 +67856,7 @@ ${lanes.join("\n")} return type; } function narrowTypeByTypeof(type, typeOfExpr, operator, literal, assumeTrue) { - if (operator === 35 /* ExclamationEqualsToken */ || operator === 37 /* ExclamationEqualsEqualsToken */) { + if (operator === 36 /* ExclamationEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */) { assumeTrue = !assumeTrue; } const target = getReferenceCandidate(typeOfExpr.expression); @@ -67574,7 +67890,7 @@ ${lanes.join("\n")} let groundClauseTypes; for (let i = 0; i < clauseTypes.length; i += 1) { const t = clauseTypes[i]; - if (t.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */)) { + if (t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) { if (groundClauseTypes !== void 0) { groundClauseTypes.push(t); } @@ -67641,7 +67957,7 @@ ${lanes.join("\n")} if (!witnesses) { return type; } - const defaultIndex = findIndex(switchStatement.caseBlock.clauses, (clause) => clause.kind === 293 /* DefaultClause */); + const defaultIndex = findIndex(switchStatement.caseBlock.clauses, (clause) => clause.kind === 296 /* DefaultClause */); const hasDefaultClause = clauseStart === clauseEnd || defaultIndex >= clauseStart && defaultIndex < clauseEnd; if (hasDefaultClause) { const notEqualFacts = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses); @@ -67654,7 +67970,7 @@ ${lanes.join("\n")} return (isPropertyAccessExpression(expr) && idText(expr.name) === "constructor" || isElementAccessExpression(expr) && isStringLiteralLike(expr.argumentExpression) && expr.argumentExpression.text === "constructor") && isMatchingReference(reference, expr.expression); } function narrowTypeByConstructor(type, operator, identifier, assumeTrue) { - if (assumeTrue ? operator !== 34 /* EqualsEqualsToken */ && operator !== 36 /* EqualsEqualsEqualsToken */ : operator !== 35 /* ExclamationEqualsToken */ && operator !== 37 /* ExclamationEqualsEqualsToken */) { + if (assumeTrue ? operator !== 35 /* EqualsEqualsToken */ && operator !== 37 /* EqualsEqualsEqualsToken */ : operator !== 36 /* ExclamationEqualsToken */ && operator !== 38 /* ExclamationEqualsEqualsToken */) { return type; } const identifierType = getTypeOfExpression(identifier); @@ -67717,9 +68033,8 @@ ${lanes.join("\n")} return emptyObjectType; } function getNarrowedType(type, candidate, assumeTrue, checkDerived) { - var _a3; const key2 = type.flags & 1048576 /* Union */ ? `N${getTypeId(type)},${getTypeId(candidate)},${(assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)}` : void 0; - return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived)); + return getCachedType(key2) ?? setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived)); } function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) { if (!assumeTrue) { @@ -67799,11 +68114,11 @@ ${lanes.join("\n")} return type; } function narrowType(type, expr, assumeTrue) { - if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && (expr.parent.operatorToken.kind === 60 /* QuestionQuestionToken */ || expr.parent.operatorToken.kind === 77 /* QuestionQuestionEqualsToken */) && expr.parent.left === expr) { + if (isExpressionOfOptionalChainRoot(expr) || isBinaryExpression(expr.parent) && (expr.parent.operatorToken.kind === 61 /* QuestionQuestionToken */ || expr.parent.operatorToken.kind === 78 /* QuestionQuestionEqualsToken */) && expr.parent.left === expr) { return narrowTypeByOptionality(type, expr, assumeTrue); } switch (expr.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: if (!isMatchingReference(reference, expr) && inlineLevel < 5) { const symbol = getResolvedSymbol(expr); if (isConstVariable(symbol)) { @@ -67816,20 +68131,20 @@ ${lanes.join("\n")} } } } - case 108 /* ThisKeyword */: - case 106 /* SuperKeyword */: - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 110 /* ThisKeyword */: + case 108 /* SuperKeyword */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 210 /* CallExpression */: + case 212 /* CallExpression */: return narrowTypeByCallExpression(type, expr, assumeTrue); - case 214 /* ParenthesizedExpression */: - case 232 /* NonNullExpression */: + case 216 /* ParenthesizedExpression */: + case 234 /* NonNullExpression */: return narrowType(type, expr.expression, assumeTrue); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 221 /* PrefixUnaryExpression */: - if (expr.operator === 53 /* ExclamationToken */) { + case 223 /* PrefixUnaryExpression */: + if (expr.operator === 54 /* ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } break; @@ -67849,7 +68164,7 @@ ${lanes.join("\n")} } function getTypeOfSymbolAtLocation(symbol, location) { symbol = getExportSymbolOfValueSymbolIfExported(symbol); - if (location.kind === 79 /* Identifier */ || location.kind === 80 /* PrivateIdentifier */) { + if (location.kind === 80 /* Identifier */ || location.kind === 81 /* PrivateIdentifier */) { if (isRightSideOfQualifiedNameOrPropertyAccess(location)) { location = location.parent; } @@ -67866,7 +68181,7 @@ ${lanes.join("\n")} return getNonMissingTypeOfSymbol(symbol); } function getControlFlowContainer(node) { - return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 169 /* PropertyDeclaration */); + return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 267 /* ModuleBlock */ || node2.kind === 311 /* SourceFile */ || node2.kind === 171 /* PropertyDeclaration */); } function isSymbolAssigned(symbol) { if (!symbol.valueDeclaration) { @@ -67886,7 +68201,7 @@ ${lanes.join("\n")} return !!findAncestor(node.parent, (node2) => (isFunctionLike(node2) || isCatchClause(node2)) && !!(getNodeLinks(node2).flags & 524288 /* AssignmentsMarked */)); } function markNodeAssignments(node) { - if (node.kind === 79 /* Identifier */) { + if (node.kind === 80 /* Identifier */) { if (isAssignmentTarget(node)) { const symbol = getResolvedSymbol(node); if (isParameterOrCatchClauseVariable(symbol)) { @@ -67917,12 +68232,12 @@ ${lanes.join("\n")} return links.parameterInitializerContainsUndefined; } function removeOptionalityFromDeclaredType(declaredType, declaration) { - const removeUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration); + const removeUndefined = strictNullChecks && declaration.kind === 168 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration); return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType; } function isConstraintPosition(type, node) { const parent2 = node.parent; - return parent2.kind === 208 /* PropertyAccessExpression */ || parent2.kind === 163 /* QualifiedName */ || parent2.kind === 210 /* CallExpression */ && parent2.expression === node || parent2.kind === 209 /* ElementAccessExpression */ && parent2.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent2.argumentExpression))); + return parent2.kind === 210 /* PropertyAccessExpression */ || parent2.kind === 165 /* QualifiedName */ || parent2.kind === 212 /* CallExpression */ && parent2.expression === node || parent2.kind === 211 /* ElementAccessExpression */ && parent2.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent2.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */)); @@ -67958,7 +68273,7 @@ ${lanes.join("\n")} }); } function markAliasReferenced(symbol, location) { - if (compilerOptions.verbatimModuleSyntax) { + if (!canCollectSymbolAliasAccessabilityData) { return; } if (isNonLocalAlias( @@ -67977,20 +68292,20 @@ ${lanes.join("\n")} } } function getNarrowedTypeOfSymbol(symbol, location) { - var _a2; + var _a; const type = getTypeOfSymbol(symbol); const declaration = symbol.valueDeclaration; if (declaration) { if (isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { const parent2 = declaration.parent.parent; - if (parent2.kind === 257 /* VariableDeclaration */ && getCombinedNodeFlags(declaration) & 2 /* Const */ || parent2.kind === 166 /* Parameter */) { + if (parent2.kind === 259 /* VariableDeclaration */ && getCombinedNodeFlags(declaration) & 2 /* Const */ || parent2.kind === 168 /* Parameter */) { const links = getNodeLinks(parent2); if (!(links.flags & 16777216 /* InCheckIdentifier */)) { links.flags |= 16777216 /* InCheckIdentifier */; const parentType = getTypeForBindingElementParent(parent2, 0 /* Normal */); const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~16777216 /* InCheckIdentifier */; - if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(parent2.kind === 166 /* Parameter */ && isSymbolAssigned(symbol))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(parent2.kind === 168 /* Parameter */ && isSymbolAssigned(symbol))) { const pattern = declaration.parent; const narrowedType = getFlowTypeOfReference( pattern, @@ -68013,7 +68328,7 @@ ${lanes.join("\n")} if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) { const contextualSignature = getContextualSignature(func); if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) { - const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (_a2 = getInferenceContext(func)) == null ? void 0 : _a2.nonFixingMapper)); + const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (_a = getInferenceContext(func)) == null ? void 0 : _a.nonFixingMapper)); if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !isSymbolAssigned(symbol)) { const narrowedType = getFlowTypeOfReference( func, @@ -68047,7 +68362,7 @@ ${lanes.join("\n")} } const container = getContainingFunction(node); if (languageVersion < 2 /* ES2015 */) { - if (container.kind === 216 /* ArrowFunction */) { + if (container.kind === 218 /* ArrowFunction */) { error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } else if (hasSyntacticModifier(container, 512 /* Async */)) { error(node, Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); @@ -68060,13 +68375,13 @@ ${lanes.join("\n")} markAliasReferenced(symbol, node); } const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); - const targetSymbol = checkDeprecatedAliasedSymbol(localOrExportSymbol, node); + const targetSymbol = resolveAliasWithDeprecationCheck(localOrExportSymbol, node); if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) { addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText); } let declaration = localOrExportSymbol.valueDeclaration; if (declaration && localOrExportSymbol.flags & 32 /* Class */) { - if (declaration.kind === 260 /* ClassDeclaration */ && nodeIsDecorated(legacyDecorators, declaration)) { + if (declaration.kind === 262 /* ClassDeclaration */ && nodeIsDecorated(legacyDecorators, declaration)) { let container = getContainingClass(node); while (container !== void 0) { if (container === declaration && container.name !== node) { @@ -68076,7 +68391,7 @@ ${lanes.join("\n")} } container = getContainingClass(container); } - } else if (declaration.kind === 228 /* ClassExpression */) { + } else if (declaration.kind === 230 /* ClassExpression */) { let container = getThisContainer( node, /*includeArrowFunctions*/ @@ -68084,7 +68399,7 @@ ${lanes.join("\n")} /*includeClassComputedPropertyName*/ false ); - while (container.kind !== 308 /* SourceFile */) { + while (container.kind !== 311 /* SourceFile */) { if (container.parent === declaration) { if (isPropertyDeclaration(container) && isStatic(container) || isClassStaticBlockDeclaration(container)) { getNodeLinks(declaration).flags |= 1048576 /* ClassWithConstructorReference */; @@ -68134,18 +68449,20 @@ ${lanes.join("\n")} return type; } type = getNarrowableTypeForReference(type, node, checkMode); - const isParameter2 = getRootDeclaration(declaration).kind === 166 /* Parameter */; + const isParameter2 = getRootDeclaration(declaration).kind === 168 /* Parameter */; const declarationContainer = getControlFlowContainer(declaration); let flowContainer = getControlFlowContainer(node); const isOuterVariable = flowContainer !== declarationContainer; const isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent); const isModuleExports = symbol.flags & 134217728 /* ModuleExports */; - while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* FunctionExpression */ || flowContainer.kind === 216 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) { + const typeIsAutomatic = type === autoType || type === autoArrayType; + const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 234 /* NonNullExpression */; + while (flowContainer !== declarationContainer && (flowContainer.kind === 217 /* FunctionExpression */ || flowContainer.kind === 218 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } - const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */; - const initialType = assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : type === autoType || type === autoArrayType ? undefinedType : getOptionalType(type); - const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer); + const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 280 /* ExportSpecifier */) || node.parent.kind === 234 /* NonNullExpression */ || declaration.kind === 259 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */; + const initialType = isAutomaticTypeInNonNull ? undefinedType : assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : typeIsAutomatic ? undefinedType : getOptionalType(type); + const flowType = isAutomaticTypeInNonNull ? getNonNullableType(getFlowTypeOfReference(node, type, initialType, flowContainer)) : getFlowTypeOfReference(node, type, initialType, flowContainer); if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) { if (flowType === autoType || flowType === autoArrayType) { if (noImplicitAny) { @@ -68167,7 +68484,7 @@ ${lanes.join("\n")} } } function shouldMarkIdentifierAliasReferenced(node) { - var _a2; + var _a; const parent2 = node.parent; if (parent2) { if (isPropertyAccessExpression(parent2) && parent2.expression === node) { @@ -68176,7 +68493,7 @@ ${lanes.join("\n")} if (isExportSpecifier(parent2) && parent2.isTypeOnly) { return false; } - const greatGrandparent = (_a2 = parent2.parent) == null ? void 0 : _a2.parent; + const greatGrandparent = (_a = parent2.parent) == null ? void 0 : _a.parent; if (greatGrandparent && isExportDeclaration(greatGrandparent) && greatGrandparent.isTypeOnly) { return false; } @@ -68197,7 +68514,7 @@ ${lanes.join("\n")} )); } function checkNestedBlockScopedBinding(node, symbol) { - if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || !symbol.valueDeclaration || isSourceFile(symbol.valueDeclaration) || symbol.valueDeclaration.parent.kind === 295 /* CatchClause */) { + if (languageVersion >= 2 /* ES2015 */ || (symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 || !symbol.valueDeclaration || isSourceFile(symbol.valueDeclaration) || symbol.valueDeclaration.parent.kind === 298 /* CatchClause */) { return; } const container = getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -68207,7 +68524,7 @@ ${lanes.join("\n")} if (isCaptured) { let capturesBlockScopeBindingInLoopBody = true; if (isForStatement(container)) { - const varDeclList = getAncestor(symbol.valueDeclaration, 258 /* VariableDeclarationList */); + const varDeclList = getAncestor(symbol.valueDeclaration, 260 /* VariableDeclarationList */); if (varDeclList && varDeclList.parent === container) { const part = getPartOfForStatementContainingNode(node.parent, container); if (part) { @@ -68226,7 +68543,7 @@ ${lanes.join("\n")} } } if (isForStatement(container)) { - const varDeclList = getAncestor(symbol.valueDeclaration, 258 /* VariableDeclarationList */); + const varDeclList = getAncestor(symbol.valueDeclaration, 260 /* VariableDeclarationList */); if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 262144 /* NeedsLoopOutParameter */; } @@ -68243,15 +68560,15 @@ ${lanes.join("\n")} } function isAssignedInBodyOfForStatement(node, container) { let current = node; - while (current.parent.kind === 214 /* ParenthesizedExpression */) { + while (current.parent.kind === 216 /* ParenthesizedExpression */) { current = current.parent; } let isAssigned = false; if (isAssignmentTarget(current)) { isAssigned = true; - } else if (current.parent.kind === 221 /* PrefixUnaryExpression */ || current.parent.kind === 222 /* PostfixUnaryExpression */) { + } else if (current.parent.kind === 223 /* PrefixUnaryExpression */ || current.parent.kind === 224 /* PostfixUnaryExpression */) { const expr = current.parent; - isAssigned = expr.operator === 45 /* PlusPlusToken */ || expr.operator === 46 /* MinusMinusToken */; + isAssigned = expr.operator === 46 /* PlusPlusToken */ || expr.operator === 47 /* MinusMinusToken */; } if (!isAssigned) { return false; @@ -68260,7 +68577,7 @@ ${lanes.join("\n")} } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* LexicalThis */; - if (container.kind === 169 /* PropertyDeclaration */ || container.kind === 173 /* Constructor */) { + if (container.kind === 171 /* PropertyDeclaration */ || container.kind === 175 /* Constructor */) { const classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* CaptureThis */; } else { @@ -68298,27 +68615,27 @@ ${lanes.join("\n")} const isNodeInTypeQuery = isInTypeQuery(node); let container = getThisContainer( node, - /* includeArrowFunctions */ + /*includeArrowFunctions*/ true, /*includeClassComputedPropertyName*/ true ); let capturedByArrowFunction = false; let thisInComputedPropertyName = false; - if (container.kind === 173 /* Constructor */) { + if (container.kind === 175 /* Constructor */) { checkThisBeforeSuper(node, container, Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } while (true) { - if (container.kind === 216 /* ArrowFunction */) { + if (container.kind === 218 /* ArrowFunction */) { container = getThisContainer( container, - /* includeArrowFunctions */ + /*includeArrowFunctions*/ false, !thisInComputedPropertyName ); capturedByArrowFunction = true; } - if (container.kind === 164 /* ComputedPropertyName */) { + if (container.kind === 166 /* ComputedPropertyName */) { container = getThisContainer( container, !capturedByArrowFunction, @@ -68335,13 +68652,13 @@ ${lanes.join("\n")} error(node, Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); } else { switch (container.kind) { - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: error(node, Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 263 /* EnumDeclaration */: + case 265 /* EnumDeclaration */: error(node, Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 173 /* Constructor */: + case 175 /* Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } @@ -68438,13 +68755,13 @@ ${lanes.join("\n")} } } function getClassNameFromPrototypeMethod(container) { - if (container.kind === 215 /* FunctionExpression */ && isBinaryExpression(container.parent) && getAssignmentDeclarationKind(container.parent) === 3 /* PrototypeProperty */) { + if (container.kind === 217 /* FunctionExpression */ && isBinaryExpression(container.parent) && getAssignmentDeclarationKind(container.parent) === 3 /* PrototypeProperty */) { return container.parent.left.expression.expression; - } else if (container.kind === 171 /* MethodDeclaration */ && container.parent.kind === 207 /* ObjectLiteralExpression */ && isBinaryExpression(container.parent.parent) && getAssignmentDeclarationKind(container.parent.parent) === 6 /* Prototype */) { + } else if (container.kind === 173 /* MethodDeclaration */ && container.parent.kind === 209 /* ObjectLiteralExpression */ && isBinaryExpression(container.parent.parent) && getAssignmentDeclarationKind(container.parent.parent) === 6 /* Prototype */) { return container.parent.parent.left.expression; - } else if (container.kind === 215 /* FunctionExpression */ && container.parent.kind === 299 /* PropertyAssignment */ && container.parent.parent.kind === 207 /* ObjectLiteralExpression */ && isBinaryExpression(container.parent.parent.parent) && getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* Prototype */) { + } else if (container.kind === 217 /* FunctionExpression */ && container.parent.kind === 302 /* PropertyAssignment */ && container.parent.parent.kind === 209 /* ObjectLiteralExpression */ && isBinaryExpression(container.parent.parent.parent) && getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* Prototype */) { return container.parent.parent.parent.left.expression; - } else if (container.kind === 215 /* FunctionExpression */ && isPropertyAssignment(container.parent) && isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && isObjectLiteralExpression(container.parent.parent) && isCallExpression(container.parent.parent.parent) && container.parent.parent.parent.arguments[2] === container.parent.parent && getAssignmentDeclarationKind(container.parent.parent.parent) === 9 /* ObjectDefinePrototypeProperty */) { + } else if (container.kind === 217 /* FunctionExpression */ && isPropertyAssignment(container.parent) && isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && isObjectLiteralExpression(container.parent.parent) && isCallExpression(container.parent.parent.parent) && container.parent.parent.parent.arguments[2] === container.parent.parent && getAssignmentDeclarationKind(container.parent.parent.parent) === 9 /* ObjectDefinePrototypeProperty */) { return container.parent.parent.parent.arguments[0].expression; } else if (isMethodDeclaration(container) && isIdentifier(container.name) && (container.name.escapedText === "value" || container.name.escapedText === "get" || container.name.escapedText === "set") && isObjectLiteralExpression(container.parent) && isCallExpression(container.parent.parent) && container.parent.parent.arguments[2] === container.parent && getAssignmentDeclarationKind(container.parent.parent) === 9 /* ObjectDefinePrototypeProperty */) { return container.parent.parent.arguments[0].expression; @@ -68452,7 +68769,7 @@ ${lanes.join("\n")} } function getTypeForThisExpressionFromJSDoc(node) { const jsdocType = getJSDocType(node); - if (jsdocType && jsdocType.kind === 320 /* JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 323 /* JSDocFunctionType */) { const jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && jsDocFunctionType.parameters[0].name.escapedText === "this" /* This */) { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); @@ -68464,10 +68781,10 @@ ${lanes.join("\n")} } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!findAncestor(node, (n) => isFunctionLikeDeclaration(n) ? "quit" : n.kind === 166 /* Parameter */ && n.parent === constructorDecl); + return !!findAncestor(node, (n) => isFunctionLikeDeclaration(n) ? "quit" : n.kind === 168 /* Parameter */ && n.parent === constructorDecl); } function checkSuperExpression(node) { - const isCallExpression2 = node.parent.kind === 210 /* CallExpression */ && node.parent.expression === node; + const isCallExpression2 = node.parent.kind === 212 /* CallExpression */ && node.parent.expression === node; const immediateContainer = getSuperContainer( node, /*stopOnFunctions*/ @@ -68477,7 +68794,7 @@ ${lanes.join("\n")} let needToCaptureLexicalThis = false; let inAsyncFunction = false; if (!isCallExpression2) { - while (container && container.kind === 216 /* ArrowFunction */) { + while (container && container.kind === 218 /* ArrowFunction */) { if (hasSyntacticModifier(container, 512 /* Async */)) inAsyncFunction = true; container = getSuperContainer( @@ -68492,19 +68809,19 @@ ${lanes.join("\n")} } let nodeCheckFlag = 0; if (!container || !isLegalUsageOfSuperExpression(container)) { - const current = findAncestor(node, (n) => n === container ? "quit" : n.kind === 164 /* ComputedPropertyName */); - if (current && current.kind === 164 /* ComputedPropertyName */) { + const current = findAncestor(node, (n) => n === container ? "quit" : n.kind === 166 /* ComputedPropertyName */); + if (current && current.kind === 166 /* ComputedPropertyName */) { error(node, Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression2) { error(node, Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); - } else if (!container || !container.parent || !(isClassLike(container.parent) || container.parent.kind === 207 /* ObjectLiteralExpression */)) { + } else if (!container || !container.parent || !(isClassLike(container.parent) || container.parent.kind === 209 /* ObjectLiteralExpression */)) { error(node, Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { error(node, Diagnostics.super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class); } return errorType; } - if (!isCallExpression2 && immediateContainer.kind === 173 /* Constructor */) { + if (!isCallExpression2 && immediateContainer.kind === 175 /* Constructor */) { checkThisBeforeSuper(node, container, Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (isStatic(container) || isCallExpression2) { @@ -68520,7 +68837,7 @@ ${lanes.join("\n")} nodeCheckFlag = 16 /* SuperInstance */; } getNodeLinks(node).flags |= nodeCheckFlag; - if (container.kind === 171 /* MethodDeclaration */ && inAsyncFunction) { + if (container.kind === 173 /* MethodDeclaration */ && inAsyncFunction) { if (isSuperProperty(node.parent) && isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 256 /* MethodWithSuperPropertyAssignmentInAsync */; } else { @@ -68530,7 +68847,7 @@ ${lanes.join("\n")} if (needToCaptureLexicalThis) { captureLexicalThis(node.parent, container); } - if (container.parent.kind === 207 /* ObjectLiteralExpression */) { + if (container.parent.kind === 209 /* ObjectLiteralExpression */) { if (languageVersion < 2 /* ES2015 */) { error(node, Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; @@ -68548,20 +68865,20 @@ ${lanes.join("\n")} if (!baseClassType) { return errorType; } - if (container.kind === 173 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 175 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) { error(node, Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; } return nodeCheckFlag === 32 /* SuperStatic */ ? getBaseConstructorTypeOfClass(classType) : getTypeWithThisArgument(baseClassType, classType.thisType); function isLegalUsageOfSuperExpression(container2) { if (isCallExpression2) { - return container2.kind === 173 /* Constructor */; + return container2.kind === 175 /* Constructor */; } else { - if (isClassLike(container2.parent) || container2.parent.kind === 207 /* ObjectLiteralExpression */) { + if (isClassLike(container2.parent) || container2.parent.kind === 209 /* ObjectLiteralExpression */) { if (isStatic(container2)) { - return container2.kind === 171 /* MethodDeclaration */ || container2.kind === 170 /* MethodSignature */ || container2.kind === 174 /* GetAccessor */ || container2.kind === 175 /* SetAccessor */ || container2.kind === 169 /* PropertyDeclaration */ || container2.kind === 172 /* ClassStaticBlockDeclaration */; + return container2.kind === 173 /* MethodDeclaration */ || container2.kind === 172 /* MethodSignature */ || container2.kind === 176 /* GetAccessor */ || container2.kind === 177 /* SetAccessor */ || container2.kind === 171 /* PropertyDeclaration */ || container2.kind === 174 /* ClassStaticBlockDeclaration */; } else { - return container2.kind === 171 /* MethodDeclaration */ || container2.kind === 170 /* MethodSignature */ || container2.kind === 174 /* GetAccessor */ || container2.kind === 175 /* SetAccessor */ || container2.kind === 169 /* PropertyDeclaration */ || container2.kind === 168 /* PropertySignature */ || container2.kind === 173 /* Constructor */; + return container2.kind === 173 /* MethodDeclaration */ || container2.kind === 172 /* MethodSignature */ || container2.kind === 176 /* GetAccessor */ || container2.kind === 177 /* SetAccessor */ || container2.kind === 171 /* PropertyDeclaration */ || container2.kind === 170 /* PropertySignature */ || container2.kind === 175 /* Constructor */; } } } @@ -68569,7 +68886,7 @@ ${lanes.join("\n")} } } function getContainingObjectLiteral(func) { - return (func.kind === 171 /* MethodDeclaration */ || func.kind === 174 /* GetAccessor */ || func.kind === 175 /* SetAccessor */) && func.parent.kind === 207 /* ObjectLiteralExpression */ ? func.parent : func.kind === 215 /* FunctionExpression */ && func.parent.kind === 299 /* PropertyAssignment */ ? func.parent.parent : void 0; + return (func.kind === 173 /* MethodDeclaration */ || func.kind === 176 /* GetAccessor */ || func.kind === 177 /* SetAccessor */) && func.parent.kind === 209 /* ObjectLiteralExpression */ ? func.parent : func.kind === 217 /* FunctionExpression */ && func.parent.kind === 302 /* PropertyAssignment */ ? func.parent.parent : void 0; } function getThisTypeArgument(type) { return getObjectFlags(type) & 4 /* Reference */ && type.target === globalThisType ? getTypeArguments(type)[0] : void 0; @@ -68580,7 +68897,7 @@ ${lanes.join("\n")} }); } function getContextualThisParameterType(func) { - if (func.kind === 216 /* ArrowFunction */) { + if (func.kind === 218 /* ArrowFunction */) { return void 0; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -68608,7 +68925,7 @@ ${lanes.join("\n")} if (thisType) { return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } - if (literal.parent.kind !== 299 /* PropertyAssignment */) { + if (literal.parent.kind !== 302 /* PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -68621,7 +68938,7 @@ ${lanes.join("\n")} return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral)); } const parent2 = walkUpParenthesizedExpressions(func.parent); - if (parent2.kind === 223 /* BinaryExpression */ && parent2.operatorToken.kind === 63 /* EqualsToken */) { + if (parent2.kind === 225 /* BinaryExpression */ && parent2.operatorToken.kind === 64 /* EqualsToken */) { const target = parent2.left; if (isAccessExpression(target)) { const { expression } = target; @@ -68676,11 +68993,11 @@ ${lanes.join("\n")} return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 166 /* Parameter */: + case 168 /* Parameter */: return getContextuallyTypedParameterType(declaration); - case 205 /* BindingElement */: + case 207 /* BindingElement */: return getContextualTypeForBindingElement(declaration, contextFlags); - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: if (isStatic(declaration)) { return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); } @@ -68689,10 +69006,10 @@ ${lanes.join("\n")} function getContextualTypeForBindingElement(declaration, contextFlags) { const parent2 = declaration.parent.parent; const name = declaration.propertyName || declaration.name; - const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 205 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */); + const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */); if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name)) return void 0; - if (parent2.name.kind === 204 /* ArrayBindingPattern */) { + if (parent2.name.kind === 206 /* ArrayBindingPattern */) { const index = indexOfNode(declaration.parent.elements, declaration); if (index < 0) return void 0; @@ -68842,7 +69159,7 @@ ${lanes.join("\n")} return signature ? getOrCreateTypeFromSignature(signature) : void 0; } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 212 /* TaggedTemplateExpression */) { + if (template.parent.kind === 214 /* TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return void 0; @@ -68851,17 +69168,17 @@ ${lanes.join("\n")} const binaryExpression = node.parent; const { left, operatorToken, right } = binaryExpression; switch (operatorToken.kind) { - case 63 /* EqualsToken */: - case 76 /* AmpersandAmpersandEqualsToken */: - case 75 /* BarBarEqualsToken */: - case 77 /* QuestionQuestionEqualsToken */: + case 64 /* EqualsToken */: + case 77 /* AmpersandAmpersandEqualsToken */: + case 76 /* BarBarEqualsToken */: + case 78 /* QuestionQuestionEqualsToken */: return node === right ? getContextualTypeForAssignmentDeclaration(binaryExpression) : void 0; - case 56 /* BarBarToken */: - case 60 /* QuestionQuestionToken */: + case 57 /* BarBarToken */: + case 61 /* QuestionQuestionToken */: const type = getContextualType2(binaryExpression, contextFlags); return node === right && (type && type.pattern || !type && !isDefaultedExpandoInitializer(binaryExpression)) ? getTypeOfExpression(left) : type; - case 55 /* AmpersandAmpersandToken */: - case 27 /* CommaToken */: + case 56 /* AmpersandAmpersandToken */: + case 28 /* CommaToken */: return node === right ? getContextualType2(binaryExpression, contextFlags) : void 0; default: return void 0; @@ -68893,7 +69210,7 @@ ${lanes.join("\n")} } } function getContextualTypeForAssignmentDeclaration(binaryExpression) { - var _a2, _b; + var _a, _b; const kind = getAssignmentDeclarationKind(binaryExpression); switch (kind) { case 0 /* None */: @@ -68928,6 +69245,7 @@ ${lanes.join("\n")} id, id.escapedText, 111551 /* Value */, + /*nameNotFoundMessage*/ void 0, id.escapedText, /*isUse*/ @@ -68944,7 +69262,7 @@ ${lanes.join("\n")} return void 0; } } - return isInJSFile(decl2) ? void 0 : getTypeOfExpression(binaryExpression.left); + return isInJSFile(decl2) || decl2 === binaryExpression.left ? void 0 : getTypeOfExpression(binaryExpression.left); } case 1 /* ExportsProperty */: case 6 /* Prototype */: @@ -68952,7 +69270,7 @@ ${lanes.join("\n")} case 2 /* ModuleExports */: let valueDeclaration; if (kind !== 2 /* ModuleExports */) { - valueDeclaration = canHaveSymbol(binaryExpression.left) ? (_a2 = binaryExpression.left.symbol) == null ? void 0 : _a2.valueDeclaration : void 0; + valueDeclaration = canHaveSymbol(binaryExpression.left) ? (_a = binaryExpression.left.symbol) == null ? void 0 : _a.valueDeclaration : void 0; } valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) == null ? void 0 : _b.valueDeclaration); const annotated = valueDeclaration && getEffectiveTypeAnnotationNode(valueDeclaration); @@ -68977,7 +69295,9 @@ ${lanes.join("\n")} declaration.left, name, 111551 /* Value */, + /*nameNotFoundMessage*/ void 0, + /*nameArg*/ void 0, /*isUse*/ true, @@ -69019,7 +69339,7 @@ ${lanes.join("\n")} return mapType( type, (t) => { - var _a2; + var _a; if (isGenericMappedType(t) && !t.declaration.nameType) { const constraint = getConstraintTypeFromMappedType(t); const constraintOfConstraint = getBaseConstraintOfType(constraint) || constraint; @@ -69047,7 +69367,7 @@ ${lanes.join("\n")} return restType; } } - return (_a2 = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a2.type; + return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType || getStringLiteralType(unescapeLeadingUnderscores(name)))) == null ? void 0 : _a.type; } return void 0; }, @@ -69074,13 +69394,23 @@ ${lanes.join("\n")} const symbol = getSymbolOfDeclaration(element); return getTypeOfPropertyOfContextualType(type, symbol.escapedName, getSymbolLinks(symbol).nameType); } + if (hasDynamicName(element)) { + const name = getNameOfDeclaration(element); + if (name && isComputedPropertyName(name)) { + const exprType = checkExpression(name.expression); + const propType = isTypeUsableAsPropertyName(exprType) && getTypeOfPropertyOfContextualType(type, getPropertyNameFromType(exprType)); + if (propType) { + return propType; + } + } + } if (element.name) { const nameType = getLiteralTypeFromPropertyName(element.name); return mapType( type, (t) => { - var _a2; - return (_a2 = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType)) == null ? void 0 : _a2.type; + var _a; + return (_a = findApplicableIndexInfo(getIndexInfosOfStructuredType(t), nameType)) == null ? void 0 : _a.type; }, /*noReductions*/ true @@ -69089,37 +69419,59 @@ ${lanes.join("\n")} } return void 0; } - function getContextualTypeForElementExpression(arrayContextualType, index) { - return arrayContextualType && (index >= 0 && getTypeOfPropertyOfContextualType(arrayContextualType, "" + index) || mapType( - arrayContextualType, - (t) => isTupleType(t) ? getElementTypeOfSliceOfTupleType( - t, - 0, - /*endSkipCount*/ - 0, - /*writing*/ - false, - /*noReductions*/ - true - ) : getIteratedTypeOrElementType( - 1 /* Element */, - t, - undefinedType, - /*errorNode*/ - void 0, - /*checkAssignability*/ - false - ), + function getSpreadIndices(elements) { + let first2, last2; + for (let i = 0; i < elements.length; i++) { + if (isSpreadElement(elements[i])) { + first2 ?? (first2 = i); + last2 = i; + } + } + return { first: first2, last: last2 }; + } + function getContextualTypeForElementExpression(type, index, length2, firstSpreadIndex, lastSpreadIndex) { + return type && mapType( + type, + (t) => { + if (isTupleType(t)) { + if ((firstSpreadIndex === void 0 || index < firstSpreadIndex) && index < t.target.fixedLength) { + return getTypeArguments(t)[index]; + } + const offset = length2 !== void 0 && (lastSpreadIndex === void 0 || index > lastSpreadIndex) ? length2 - index : 0; + const fixedEndLength = offset > 0 && t.target.hasRestElement ? getEndElementCount(t.target, 3 /* Fixed */) : 0; + if (offset > 0 && offset <= fixedEndLength) { + return getTypeArguments(t)[getTypeReferenceArity(t) - offset]; + } + return getElementTypeOfSliceOfTupleType( + t, + firstSpreadIndex === void 0 ? t.target.fixedLength : Math.min(t.target.fixedLength, firstSpreadIndex), + length2 === void 0 || lastSpreadIndex === void 0 ? fixedEndLength : Math.min(fixedEndLength, length2 - lastSpreadIndex), + /*writing*/ + false, + /*noReductions*/ + true + ); + } + return (!firstSpreadIndex || index < firstSpreadIndex) && getTypeOfPropertyOfContextualType(t, "" + index) || getIteratedTypeOrElementType( + 1 /* Element */, + t, + undefinedType, + /*errorNode*/ + void 0, + /*checkAssignability*/ + false + ); + }, /*noReductions*/ true - )); + ); } function getContextualTypeForConditionalOperand(node, contextFlags) { const conditional = node.parent; return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType2(conditional, contextFlags) : void 0; } function getContextualTypeForChildJsxExpression(node, child, contextFlags) { - const attributesType = getApparentTypeOfContextualType(node.openingElement.tagName, contextFlags); + const attributesType = getApparentTypeOfContextualType(node.openingElement.attributes, contextFlags); const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node)); if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) { return void 0; @@ -69150,27 +69502,27 @@ ${lanes.join("\n")} if (!attributesType || isTypeAny(attributesType)) { return void 0; } - return getTypeOfPropertyOfContextualType(attributesType, attribute.name.escapedText); + return getTypeOfPropertyOfContextualType(attributesType, getEscapedTextOfJsxAttributeName(attribute.name)); } else { return getContextualType2(attribute.parent, contextFlags); } } function isPossiblyDiscriminantValue(node) { switch (node.kind) { - case 10 /* StringLiteral */: - case 8 /* NumericLiteral */: - case 9 /* BigIntLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 110 /* TrueKeyword */: - case 95 /* FalseKeyword */: - case 104 /* NullKeyword */: - case 79 /* Identifier */: - case 155 /* UndefinedKeyword */: + case 11 /* StringLiteral */: + case 9 /* NumericLiteral */: + case 10 /* BigIntLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 112 /* TrueKeyword */: + case 97 /* FalseKeyword */: + case 106 /* NullKeyword */: + case 80 /* Identifier */: + case 157 /* UndefinedKeyword */: return true; - case 208 /* PropertyAccessExpression */: - case 214 /* ParenthesizedExpression */: + case 210 /* PropertyAccessExpression */: + case 216 /* ParenthesizedExpression */: return isPossiblyDiscriminantValue(node.expression); - case 291 /* JsxExpression */: + case 293 /* JsxExpression */: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; @@ -69180,39 +69532,45 @@ ${lanes.join("\n")} contextualType, concatenate( map( - filter(node.properties, (p) => !!p.symbol && p.kind === 299 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName)), + filter(node.properties, (p) => !!p.symbol && p.kind === 302 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName)), (prop) => [() => getContextFreeTypeOfExpression(prop.initializer), prop.symbol.escapedName] ), map( filter(getPropertiesOfType(contextualType), (s) => { - var _a2; - return !!(s.flags & 16777216 /* Optional */) && !!((_a2 = node == null ? void 0 : node.symbol) == null ? void 0 : _a2.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); + var _a; + return !!(s.flags & 16777216 /* Optional */) && !!((_a = node == null ? void 0 : node.symbol) == null ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), (s) => [() => undefinedType, s.escapedName] ) ), - isTypeAssignableTo, - contextualType + isTypeAssignableTo ); } function discriminateContextualTypeByJSXAttributes(node, contextualType) { + const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node)); return discriminateTypeByDiscriminableItems( contextualType, concatenate( map( - filter(node.properties, (p) => !!p.symbol && p.kind === 288 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer))), + filter(node.properties, (p) => !!p.symbol && p.kind === 290 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer))), (prop) => [!prop.initializer ? () => trueType : () => getContextFreeTypeOfExpression(prop.initializer), prop.symbol.escapedName] ), map( filter(getPropertiesOfType(contextualType), (s) => { - var _a2; - return !!(s.flags & 16777216 /* Optional */) && !!((_a2 = node == null ? void 0 : node.symbol) == null ? void 0 : _a2.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); + var _a; + if (!(s.flags & 16777216 /* Optional */) || !((_a = node == null ? void 0 : node.symbol) == null ? void 0 : _a.members)) { + return false; + } + const element = node.parent.parent; + if (s.escapedName === jsxChildrenPropertyName && isJsxElement(element) && getSemanticJsxChildren(element.children).length) { + return false; + } + return !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), (s) => [() => undefinedType, s.escapedName] ) ), - isTypeAssignableTo, - contextualType + isTypeAssignableTo ); } function getApparentTypeOfContextualType(node, contextFlags) { @@ -69221,7 +69579,11 @@ ${lanes.join("\n")} if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) { const apparentType = mapType( instantiatedType, - getApparentType, + // When obtaining apparent type of *contextual* type we don't want to get apparent type of mapped types. + // That would evaluate mapped types with array or tuple type constraints too eagerly + // and thus it would prevent `getTypeOfPropertyOfContextualType` from obtaining per-position contextual type for elements of array literal expressions. + // Apparent type of other mapped types is already the mapped type itself so we can just avoid calling `getApparentType` here for all mapped types. + (t) => getObjectFlags(t) & 32 /* Mapped */ ? t : getApparentType(t), /*noReductions*/ true ); @@ -69254,7 +69616,7 @@ ${lanes.join("\n")} return type; } function getContextualType2(node, contextFlags) { - var _a2, _b; + var _a; if (node.flags & 33554432 /* InWithStatement */) { return void 0; } @@ -69268,47 +69630,47 @@ ${lanes.join("\n")} } const { parent: parent2 } = node; switch (parent2.kind) { - case 257 /* VariableDeclaration */: - case 166 /* Parameter */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 205 /* BindingElement */: + case 259 /* VariableDeclaration */: + case 168 /* Parameter */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 207 /* BindingElement */: return getContextualTypeForInitializerExpression(node, contextFlags); - case 216 /* ArrowFunction */: - case 250 /* ReturnStatement */: + case 218 /* ArrowFunction */: + case 252 /* ReturnStatement */: return getContextualTypeForReturnExpression(node, contextFlags); - case 226 /* YieldExpression */: + case 228 /* YieldExpression */: return getContextualTypeForYieldOperand(parent2, contextFlags); - case 220 /* AwaitExpression */: + case 222 /* AwaitExpression */: return getContextualTypeForAwaitOperand(parent2, contextFlags); - case 210 /* CallExpression */: - case 211 /* NewExpression */: + case 212 /* CallExpression */: + case 213 /* NewExpression */: return getContextualTypeForArgument(parent2, node); - case 167 /* Decorator */: + case 169 /* Decorator */: return getContextualTypeForDecorator(parent2); - case 213 /* TypeAssertionExpression */: - case 231 /* AsExpression */: + case 215 /* TypeAssertionExpression */: + case 233 /* AsExpression */: return isConstTypeReference(parent2.type) ? getContextualType2(parent2, contextFlags) : getTypeFromTypeNode(parent2.type); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return getContextualTypeForBinaryOperand(node, contextFlags); - case 299 /* PropertyAssignment */: - case 300 /* ShorthandPropertyAssignment */: + case 302 /* PropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent2, contextFlags); - case 301 /* SpreadAssignment */: + case 304 /* SpreadAssignment */: return getContextualType2(parent2.parent, contextFlags); - case 206 /* ArrayLiteralExpression */: { + case 208 /* ArrayLiteralExpression */: { const arrayLiteral = parent2; const type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); - const spreadIndex = (_b = (_a2 = getNodeLinks(arrayLiteral)).firstSpreadIndex) != null ? _b : _a2.firstSpreadIndex = findIndex(arrayLiteral.elements, isSpreadElement); const elementIndex = indexOfNode(arrayLiteral.elements, node); - return getContextualTypeForElementExpression(type, spreadIndex < 0 || elementIndex < spreadIndex ? elementIndex : -1); + const spreadIndices = (_a = getNodeLinks(arrayLiteral)).spreadIndices ?? (_a.spreadIndices = getSpreadIndices(arrayLiteral.elements)); + return getContextualTypeForElementExpression(type, elementIndex, arrayLiteral.elements.length, spreadIndices.first, spreadIndices.last); } - case 224 /* ConditionalExpression */: + case 226 /* ConditionalExpression */: return getContextualTypeForConditionalOperand(node, contextFlags); - case 236 /* TemplateSpan */: - Debug.assert(parent2.parent.kind === 225 /* TemplateExpression */); + case 238 /* TemplateSpan */: + Debug.assert(parent2.parent.kind === 227 /* TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent2.parent, node); - case 214 /* ParenthesizedExpression */: { + case 216 /* ParenthesizedExpression */: { if (isInJSFile(parent2)) { if (isJSDocSatisfiesExpression(parent2)) { return getTypeFromTypeNode(getJSDocSatisfiesExpressionType(parent2)); @@ -69320,19 +69682,19 @@ ${lanes.join("\n")} } return getContextualType2(parent2, contextFlags); } - case 232 /* NonNullExpression */: + case 234 /* NonNullExpression */: return getContextualType2(parent2, contextFlags); - case 235 /* SatisfiesExpression */: + case 237 /* SatisfiesExpression */: return getTypeFromTypeNode(parent2.type); - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: return tryGetTypeFromEffectiveTypeNode(parent2); - case 291 /* JsxExpression */: + case 293 /* JsxExpression */: return getContextualTypeForJsxExpression(parent2, contextFlags); - case 288 /* JsxAttribute */: - case 290 /* JsxSpreadAttribute */: + case 290 /* JsxAttribute */: + case 292 /* JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent2, contextFlags); - case 283 /* JsxOpeningElement */: - case 282 /* JsxSelfClosingElement */: + case 285 /* JsxOpeningElement */: + case 284 /* JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent2, contextFlags); } return void 0; @@ -69426,7 +69788,7 @@ ${lanes.join("\n")} return isTypeAny(instanceType) ? instanceType : getTypeOfPropertyOfType(instanceType, forcedLookupLocation); } function getStaticTypeOfReferencedJsxConstructor(context) { - if (isJsxIntrinsicIdentifier(context.tagName)) { + if (isJsxIntrinsicTagName(context.tagName)) { const result = getIntrinsicAttributesTypeFromJsxOpeningLikeElement(context); const fakeSignature = createSignatureForJSXIntrinsic(context, result); return getOrCreateTypeFromSignature(fakeSignature); @@ -69445,18 +69807,10 @@ ${lanes.join("\n")} function getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType) { const managedSym = getJsxLibraryManagedAttributes(ns); if (managedSym) { - const declaredManagedType = getDeclaredTypeOfSymbol(managedSym); const ctorType = getStaticTypeOfReferencedJsxConstructor(context); - if (managedSym.flags & 524288 /* TypeAlias */) { - const params = getSymbolLinks(managedSym).typeParameters; - if (length(params) >= 2) { - const args = fillMissingTypeArguments([ctorType, attributesType], params, 2, isInJSFile(context)); - return getTypeAliasInstantiation(managedSym, args); - } - } - if (length(declaredManagedType.typeParameters) >= 2) { - const args = fillMissingTypeArguments([ctorType, attributesType], declaredManagedType.typeParameters, 2, isInJSFile(context)); - return createTypeReference(declaredManagedType, args); + const result = instantiateAliasOrInterfaceWithDefaults(managedSym, isInJSFile(context), ctorType, attributesType); + if (result) { + return result; } } return attributesType; @@ -69600,7 +69954,7 @@ ${lanes.join("\n")} return isFunctionExpressionOrArrowFunction(node) || isObjectLiteralMethod(node) ? getContextualSignature(node) : void 0; } function getContextualSignature(node) { - Debug.assert(node.kind !== 171 /* MethodDeclaration */ || isObjectLiteralMethod(node)); + Debug.assert(node.kind !== 173 /* MethodDeclaration */ || isObjectLiteralMethod(node)); const typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; @@ -69651,7 +70005,7 @@ ${lanes.join("\n")} return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; } function hasDefaultValue(node) { - return node.kind === 205 /* BindingElement */ && !!node.initializer || node.kind === 223 /* BinaryExpression */ && node.operatorToken.kind === 63 /* EqualsToken */; + return node.kind === 207 /* BindingElement */ && !!node.initializer || node.kind === 225 /* BinaryExpression */ && node.operatorToken.kind === 64 /* EqualsToken */; } function checkArrayLiteral(node, checkMode, forceTuple) { const elements = node.elements; @@ -69660,17 +70014,18 @@ ${lanes.join("\n")} const elementFlags = []; pushCachedContextualType(node); const inDestructuringPattern = isAssignmentTarget(node); - const inConstContext = isConstContext(node); + const isSpreadIntoCallOrNew = isSpreadElement(node.parent) && isCallOrNewExpression(node.parent.parent); + const inConstContext = isSpreadIntoCallOrNew || isConstContext(node); const contextualType = getApparentTypeOfContextualType( node, /*contextFlags*/ void 0 ); - const inTupleContext = !!contextualType && someType(contextualType, isTupleLikeType); + const inTupleContext = isSpreadIntoCallOrNew || !!contextualType && someType(contextualType, isTupleLikeType); let hasOmittedExpression = false; for (let i = 0; i < elementCount; i++) { const e = elements[i]; - if (e.kind === 227 /* SpreadElement */) { + if (e.kind === 229 /* SpreadElement */) { if (languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* SpreadIncludes */ : 1024 /* SpreadArray */); } @@ -69694,7 +70049,7 @@ ${lanes.join("\n")} elementTypes.push(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, e.expression)); elementFlags.push(4 /* Rest */); } - } else if (exactOptionalPropertyTypes && e.kind === 229 /* OmittedExpression */) { + } else if (exactOptionalPropertyTypes && e.kind === 231 /* OmittedExpression */) { hasOmittedExpression = true; elementTypes.push(undefinedOrMissingType); elementFlags.push(2 /* Optional */); @@ -69741,12 +70096,12 @@ ${lanes.join("\n")} } function isNumericName(name) { switch (name.kind) { - case 164 /* ComputedPropertyName */: + case 166 /* ComputedPropertyName */: return isNumericComputedName(name); - case 79 /* Identifier */: + case 80 /* Identifier */: return isNumericLiteralName(name.escapedText); - case 8 /* NumericLiteral */: - case 10 /* StringLiteral */: + case 9 /* NumericLiteral */: + case 11 /* StringLiteral */: return isNumericLiteralName(name.text); default: return false; @@ -69758,7 +70113,7 @@ ${lanes.join("\n")} function checkComputedPropertyName(node) { const links = getNodeLinks(node.expression); if (!links.resolvedType) { - if ((isTypeLiteralNode(node.parent.parent) || isClassLike(node.parent.parent) || isInterfaceDeclaration(node.parent.parent)) && isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101 /* InKeyword */ && node.parent.kind !== 174 /* GetAccessor */ && node.parent.kind !== 175 /* SetAccessor */) { + if ((isTypeLiteralNode(node.parent.parent) || isClassLike(node.parent.parent) || isInterfaceDeclaration(node.parent.parent)) && isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 103 /* InKeyword */ && node.parent.kind !== 176 /* GetAccessor */ && node.parent.kind !== 177 /* SetAccessor */) { return links.resolvedType = errorType; } links.resolvedType = checkExpression(node.expression); @@ -69778,13 +70133,13 @@ ${lanes.join("\n")} return links.resolvedType; } function isSymbolWithNumericName(symbol) { - var _a2; - const firstDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2[0]; + var _a; + const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0]; return isNumericLiteralName(symbol.escapedName) || firstDecl && isNamedDeclaration(firstDecl) && isNumericName(firstDecl.name); } function isSymbolWithSymbolName(symbol) { - var _a2; - const firstDecl = (_a2 = symbol.declarations) == null ? void 0 : _a2[0]; + var _a; + const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0]; return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096 /* ESSymbol */); } function getObjectLiteralIndexInfo(node, offset, properties, keyType) { @@ -69813,8 +70168,8 @@ ${lanes.join("\n")} } return links.immediateTarget; } - function checkObjectLiteral(node, checkMode) { - var _a2; + function checkObjectLiteral(node, checkMode = 0 /* Normal */) { + var _a; const inDestructuringPattern = isAssignmentTarget(node); checkGrammarObjectLiteralExpression(node, inDestructuringPattern); const allPropertiesTable = strictNullChecks ? createSymbolTable() : void 0; @@ -69827,11 +70182,11 @@ ${lanes.join("\n")} /*contextFlags*/ void 0 ); - const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 203 /* ObjectBindingPattern */ || contextualType.pattern.kind === 207 /* ObjectLiteralExpression */); + const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 205 /* ObjectBindingPattern */ || contextualType.pattern.kind === 209 /* ObjectLiteralExpression */); const inConstContext = isConstContext(node); const checkFlags = inConstContext ? 8 /* Readonly */ : 0; const isInJavascript = isInJSFile(node) && !isInJsonFile(node); - const enumTag = getJSDocEnumTag(node); + const enumTag = isInJavascript ? getJSDocEnumTag(node) : void 0; const isJSObjectLiteral = !contextualType && isInJavascript && !enumTag; let objectFlags = freshObjectLiteralFlag; let patternWithComputedProperties = false; @@ -69846,13 +70201,13 @@ ${lanes.join("\n")} let offset = 0; for (const memberDecl of node.properties) { let member = getSymbolOfDeclaration(memberDecl); - const computedNameType = memberDecl.name && memberDecl.name.kind === 164 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0; - if (memberDecl.kind === 299 /* PropertyAssignment */ || memberDecl.kind === 300 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) { - let type = memberDecl.kind === 299 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : ( + const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0; + if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) { + let type = memberDecl.kind === 302 /* 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 === 300 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode) + memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode) ); if (isInJavascript) { const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -69870,7 +70225,7 @@ ${lanes.join("\n")} prop.links.nameType = nameType; } if (inDestructuringPattern) { - const isOptional = memberDecl.kind === 299 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer) || memberDecl.kind === 300 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer; + const isOptional = memberDecl.kind === 302 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer) || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer; if (isOptional) { prop.flags |= 16777216 /* Optional */; } @@ -69896,13 +70251,13 @@ ${lanes.join("\n")} prop.links.target = member; member = prop; allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop); - if (contextualType && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 299 /* PropertyAssignment */ || memberDecl.kind === 171 /* MethodDeclaration */) && isContextSensitive(memberDecl)) { + if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) { const inferenceContext = getInferenceContext(node); Debug.assert(inferenceContext); - const inferenceNode = memberDecl.kind === 299 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl; + const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl; addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); } - } else if (memberDecl.kind === 301 /* SpreadAssignment */) { + } else if (memberDecl.kind === 304 /* SpreadAssignment */) { if (languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* Assign */); } @@ -69914,7 +70269,7 @@ ${lanes.join("\n")} hasComputedNumberProperty = false; hasComputedSymbolProperty = false; } - const type = getReducedType(checkExpression(memberDecl.expression)); + const type = getReducedType(checkExpression(memberDecl.expression, checkMode & 2 /* Inferential */)); if (isValidSpreadType(type)) { const mergedType = tryMergeUnionOfObjectTypeAndEmptyObject(type, inConstContext); if (allPropertiesTable) { @@ -69931,7 +70286,7 @@ ${lanes.join("\n")} } continue; } else { - Debug.assert(memberDecl.kind === 174 /* GetAccessor */ || memberDecl.kind === 175 /* SetAccessor */); + Debug.assert(memberDecl.kind === 176 /* GetAccessor */ || memberDecl.kind === 177 /* SetAccessor */); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576 /* StringOrNumberLiteralOrUnique */)) { @@ -69956,18 +70311,18 @@ ${lanes.join("\n")} if (contextualTypeHasPattern) { const rootPatternParent = findAncestor( contextualType.pattern.parent, - (n) => n.kind === 257 /* VariableDeclaration */ || n.kind === 223 /* BinaryExpression */ || n.kind === 166 /* Parameter */ + (n) => n.kind === 259 /* VariableDeclaration */ || n.kind === 225 /* BinaryExpression */ || n.kind === 168 /* Parameter */ ); const spreadOrOutsideRootObject = findAncestor( node, - (n) => n === rootPatternParent || n.kind === 301 /* SpreadAssignment */ + (n) => n === rootPatternParent || n.kind === 304 /* SpreadAssignment */ ); - if (spreadOrOutsideRootObject.kind !== 301 /* SpreadAssignment */) { + if (spreadOrOutsideRootObject.kind !== 304 /* SpreadAssignment */) { for (const prop of getPropertiesOfType(contextualType)) { if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { if (!(prop.flags & 16777216 /* Optional */)) { error( - prop.valueDeclaration || ((_a2 = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a2.links.bindingElement), + prop.valueDeclaration || ((_a = tryCast(prop, isTransientSymbol)) == null ? void 0 : _a.links.bindingElement), Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value ); } @@ -70026,7 +70381,7 @@ ${lanes.join("\n")} } function checkJsxElementDeferred(node) { checkJsxOpeningLikeElementOrOpeningFragment(node.openingElement); - if (isJsxIntrinsicIdentifier(node.closingElement.tagName)) { + if (isJsxIntrinsicTagName(node.closingElement.tagName)) { getIntrinsicTagSymbol(node.closingElement); } else { checkExpression(node.closingElement.tagName); @@ -70049,15 +70404,15 @@ ${lanes.join("\n")} function isHyphenatedJsxName(name) { return stringContains(name, "-"); } - function isJsxIntrinsicIdentifier(tagName) { - return tagName.kind === 79 /* Identifier */ && isIntrinsicJsxName(tagName.escapedText); + function isJsxIntrinsicTagName(tagName) { + return isIdentifier(tagName) && isIntrinsicJsxName(tagName.escapedText) || isJsxNamespacedName(tagName); } function checkJsxAttribute(node, checkMode) { return node.initializer ? checkExpressionForMutableLocation(node.initializer, checkMode) : trueType; } - function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { + function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode = 0 /* Normal */) { const attributes = openingLikeElement.attributes; - const attributesType = getContextualType2(attributes, 0 /* None */); + const contextualType = getContextualType2(attributes, 0 /* None */); const allAttributesTable = strictNullChecks ? createSymbolTable() : void 0; let attributesTable = createSymbolTable(); let spread = emptyJsxObjectType; @@ -70081,17 +70436,23 @@ ${lanes.join("\n")} attributeSymbol.links.target = member; attributesTable.set(attributeSymbol.escapedName, attributeSymbol); allAttributesTable == null ? void 0 : allAttributesTable.set(attributeSymbol.escapedName, attributeSymbol); - if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { + if (getEscapedTextOfJsxAttributeName(attributeDecl.name) === jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute = true; } - if (attributesType) { - const prop = getPropertyOfType(attributesType, member.escapedName); - if (prop && prop.declarations && isDeprecatedSymbol(prop)) { + if (contextualType) { + const prop = getPropertyOfType(contextualType, member.escapedName); + if (prop && prop.declarations && isDeprecatedSymbol(prop) && isIdentifier(attributeDecl.name)) { addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); } } + if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) { + const inferenceContext = getInferenceContext(attributes); + Debug.assert(inferenceContext); + const inferenceNode = attributeDecl.initializer.expression; + addIntraExpressionInferenceSite(inferenceContext, inferenceNode, exprType); + } } else { - Debug.assert(attributeDecl.kind === 290 /* JsxSpreadAttribute */); + Debug.assert(attributeDecl.kind === 292 /* JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType( spread, @@ -70103,7 +70464,7 @@ ${lanes.join("\n")} ); attributesTable = createSymbolTable(); } - const exprType = getReducedType(checkExpressionCached(attributeDecl.expression, checkMode)); + const exprType = getReducedType(checkExpression(attributeDecl.expression, checkMode & 2 /* Inferential */)); if (isTypeAny(exprType)) { hasSpreadAnyType = true; } @@ -70137,19 +70498,19 @@ ${lanes.join("\n")} ); } } - const parent2 = openingLikeElement.parent.kind === 281 /* JsxElement */ ? openingLikeElement.parent : void 0; + const parent2 = openingLikeElement.parent.kind === 283 /* JsxElement */ ? openingLikeElement.parent : void 0; if (parent2 && parent2.openingElement === openingLikeElement && parent2.children.length > 0) { const childrenTypes = checkJsxChildren(parent2, checkMode); if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") { if (explicitlySpecifyChildrenAttribute) { error(attributes, Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, unescapeLeadingUnderscores(jsxChildrenPropertyName)); } - const contextualType = getApparentTypeOfContextualType( + const contextualType2 = getApparentTypeOfContextualType( openingLikeElement.attributes, /*contextFlags*/ void 0 ); - const childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName); + const childrenContextualType = contextualType2 && getTypeOfPropertyOfContextualType(contextualType2, jsxChildrenPropertyName); const childrenPropSymbol = createSymbol(4 /* Property */, jsxChildrenPropertyName); childrenPropSymbol.links.type = childrenTypes.length === 1 ? childrenTypes[0] : childrenContextualType && someType(childrenContextualType, isTupleLikeType) ? createTupleType(childrenTypes) : createArrayType(getUnionType(childrenTypes)); childrenPropSymbol.valueDeclaration = factory.createPropertySignature( @@ -70192,11 +70553,11 @@ ${lanes.join("\n")} function checkJsxChildren(node, checkMode) { const childrenTypes = []; for (const child of node.children) { - if (child.kind === 11 /* JsxText */) { + if (child.kind === 12 /* JsxText */) { if (!child.containsOnlyTriviaWhiteSpaces) { childrenTypes.push(stringType); } - } else if (child.kind === 291 /* JsxExpression */ && !child.expression) { + } else if (child.kind === 293 /* JsxExpression */ && !child.expression) { continue; } else { childrenTypes.push(checkExpressionForMutableLocation(child, checkMode)); @@ -70229,9 +70590,9 @@ ${lanes.join("\n")} if (!links.resolvedSymbol) { const intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements, node); if (!isErrorType(intrinsicElementsType)) { - if (!isIdentifier(node.tagName)) + if (!isIdentifier(node.tagName) && !isJsxNamespacedName(node.tagName)) return Debug.fail(); - const intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.escapedText); + const intrinsicProp = getPropertyOfType(intrinsicElementsType, isJsxNamespacedName(node.tagName) ? getEscapedTextOfJsxNamespacedName(node.tagName) : node.tagName.escapedText); if (intrinsicProp) { links.jsxFlags |= 1 /* IntrinsicNamedElement */; return links.resolvedSymbol = intrinsicProp; @@ -70241,7 +70602,7 @@ ${lanes.join("\n")} links.jsxFlags |= 2 /* IntrinsicIndexedElement */; return links.resolvedSymbol = intrinsicElementsType.symbol; } - error(node, Diagnostics.Property_0_does_not_exist_on_type_1, idText(node.tagName), "JSX." + JsxNames.IntrinsicElements); + error(node, Diagnostics.Property_0_does_not_exist_on_type_1, intrinsicTagNameToString(node.tagName), "JSX." + JsxNames.IntrinsicElements); return links.resolvedSymbol = unknownSymbol; } else { if (noImplicitAny) { @@ -70287,7 +70648,7 @@ ${lanes.join("\n")} location, namespaceName, 1920 /* Namespace */, - /*diagnosticMessage*/ + /*nameNotFoundMessage*/ void 0, namespaceName, /*isUse*/ @@ -70310,7 +70671,7 @@ ${lanes.join("\n")} const s = resolveSymbol(getGlobalSymbol( JsxNames.JSX, 1920 /* Namespace */, - /*diagnosticMessage*/ + /*diagnostic*/ void 0 )); if (s === unknownSymbol) { @@ -70336,6 +70697,9 @@ ${lanes.join("\n")} function getJsxLibraryManagedAttributes(jsxNamespace) { return jsxNamespace && getSymbol2(jsxNamespace.exports, JsxNames.LibraryManagedAttributes, 788968 /* Type */); } + function getJsxElementTypeSymbol(jsxNamespace) { + return jsxNamespace && getSymbol2(jsxNamespace.exports, JsxNames.ElementType, 788968 /* Type */); + } function getJsxElementPropertiesName(jsxNamespace) { return getNameFromJsxElementAttributesContainer(JsxNames.ElementAttributesPropertyNameContainer, jsxNamespace); } @@ -70404,7 +70768,7 @@ ${lanes.join("\n")} function generateInitialErrorChain() { const componentName = getTextOfNode(openingLikeElement.tagName); return chainDiagnosticMessages( - /* details */ + /*details*/ void 0, Diagnostics._0_cannot_be_used_as_a_JSX_component, componentName @@ -70412,7 +70776,7 @@ ${lanes.join("\n")} } } function getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node) { - Debug.assert(isJsxIntrinsicIdentifier(node.tagName)); + Debug.assert(isJsxIntrinsicTagName(node.tagName)); const links = getNodeLinks(node); if (!links.resolvedJsxElementAttributesType) { const symbol = getIntrinsicTagSymbol(node); @@ -70441,6 +70805,33 @@ ${lanes.join("\n")} return getUnionType([jsxElementType, nullType]); } } + function getJsxElementTypeTypeAt(location) { + const ns = getJsxNamespaceAt(location); + if (!ns) + return void 0; + const sym = getJsxElementTypeSymbol(ns); + if (!sym) + return void 0; + const type = instantiateAliasOrInterfaceWithDefaults(sym, isInJSFile(location)); + if (!type || isErrorType(type)) + return void 0; + return type; + } + function instantiateAliasOrInterfaceWithDefaults(managedSym, inJs, ...typeArguments) { + const declaredManagedType = getDeclaredTypeOfSymbol(managedSym); + if (managedSym.flags & 524288 /* TypeAlias */) { + const params = getSymbolLinks(managedSym).typeParameters; + if (length(params) >= typeArguments.length) { + const args = fillMissingTypeArguments(typeArguments, params, typeArguments.length, inJs); + return length(args) === 0 ? declaredManagedType : getTypeAliasInstantiation(managedSym, args); + } + } + if (length(declaredManagedType.typeParameters) >= typeArguments.length) { + const args = fillMissingTypeArguments(typeArguments, declaredManagedType.typeParameters, typeArguments.length, inJs); + return createTypeReference(declaredManagedType, args); + } + return void 0; + } function getJsxIntrinsicTagNamesAt(location) { const intrinsics = getJsxType(JsxNames.IntrinsicElements, location); return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray; @@ -70479,7 +70870,7 @@ ${lanes.join("\n")} } if (jsxFactorySym) { jsxFactorySym.isReferenced = 67108863 /* All */; - if (!compilerOptions.verbatimModuleSyntax && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) { + if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) { markAliasSymbolAsReferenced(jsxFactorySym); } } @@ -70503,7 +70894,22 @@ ${lanes.join("\n")} const jsxOpeningLikeNode = node; const sig = getResolvedSignature(jsxOpeningLikeNode); checkDeprecatedSignature(sig, node); - checkJsxReturnAssignableToAppropriateBound(getJsxReferenceKind(jsxOpeningLikeNode), getReturnTypeOfSignature(sig), jsxOpeningLikeNode); + const elementTypeConstraint = getJsxElementTypeTypeAt(jsxOpeningLikeNode); + if (elementTypeConstraint !== void 0) { + const tagName = jsxOpeningLikeNode.tagName; + const tagType = isJsxIntrinsicTagName(tagName) ? getStringLiteralType(intrinsicTagNameToString(tagName)) : checkExpression(tagName); + checkTypeRelatedTo(tagType, elementTypeConstraint, assignableRelation, tagName, Diagnostics.Its_type_0_is_not_a_valid_JSX_element_type, () => { + const componentName = getTextOfNode(tagName); + return chainDiagnosticMessages( + /*details*/ + void 0, + Diagnostics._0_cannot_be_used_as_a_JSX_component, + componentName + ); + }); + } else { + checkJsxReturnAssignableToAppropriateBound(getJsxReferenceKind(jsxOpeningLikeNode), getReturnTypeOfSignature(sig), jsxOpeningLikeNode); + } } } function isKnownProperty(targetType, name, isComparingJsxAttributes) { @@ -70548,7 +70954,7 @@ ${lanes.join("\n")} } } function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError = true) { - const errorNode = !reportError ? void 0 : node.kind === 163 /* QualifiedName */ ? node.right : node.kind === 202 /* ImportType */ ? node : node.kind === 205 /* BindingElement */ && node.propertyName ? node.propertyName : node.name; + const errorNode = !reportError ? void 0 : node.kind === 165 /* QualifiedName */ ? node.right : node.kind === 204 /* ImportType */ ? node : node.kind === 207 /* BindingElement */ && node.propertyName ? node.propertyName : node.name; return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); } function checkPropertyAccessibilityAtLocation(location, isSuper, writing, containingType, prop, errorNode) { @@ -70662,7 +71068,7 @@ ${lanes.join("\n")} function getThisParameterFromNodeContext(node) { const thisContainer = getThisContainer( node, - /* includeArrowFunctions */ + /*includeArrowFunctions*/ false, /*includeClassComputedPropertyName*/ false @@ -70683,7 +71089,7 @@ ${lanes.join("\n")} } function reportObjectPossiblyNullOrUndefinedError(node, facts) { const nodeText2 = isEntityNameExpression(node) ? entityNameToString(node) : void 0; - if (node.kind === 104 /* NullKeyword */) { + if (node.kind === 106 /* NullKeyword */) { error(node, Diagnostics.The_value_0_cannot_be_used_here, "null"); return; } @@ -70751,8 +71157,8 @@ ${lanes.join("\n")} } return nonNullType; } - function checkPropertyAccessExpression(node, checkMode) { - return node.flags & 32 /* OptionalChain */ ? checkPropertyAccessChain(node, checkMode) : checkPropertyAccessExpressionOrQualifiedName(node, node.expression, checkNonNullExpression(node.expression), node.name, checkMode); + function checkPropertyAccessExpression(node, checkMode, writeOnly) { + return node.flags & 32 /* OptionalChain */ ? checkPropertyAccessChain(node, checkMode) : checkPropertyAccessExpressionOrQualifiedName(node, node.expression, checkNonNullExpression(node.expression), node.name, checkMode, writeOnly); } function checkPropertyAccessChain(node, checkMode) { const leftType = checkExpression(node.expression); @@ -70764,7 +71170,7 @@ ${lanes.join("\n")} return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); } function isMethodAccessForCall(node) { - while (node.parent.kind === 214 /* ParenthesizedExpression */) { + while (node.parent.kind === 216 /* ParenthesizedExpression */) { node = node.parent; } return isCallOrNewExpression(node.parent) && node.parent.expression === node; @@ -70787,7 +71193,7 @@ ${lanes.join("\n")} if (!isExpressionNode(privId)) { return grammarErrorOnNode(privId, Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression); } - const isInOperation = isBinaryExpression(privId.parent) && privId.parent.operatorToken.kind === 101 /* InKeyword */; + const isInOperation = isBinaryExpression(privId.parent) && privId.parent.operatorToken.kind === 103 /* InKeyword */; if (!getSymbolForPrivateIdentifierExpression(privId) && !isInOperation) { return grammarErrorOnNode(privId, Diagnostics.Cannot_find_name_0, idText(privId)); } @@ -70800,9 +71206,9 @@ ${lanes.join("\n")} if (symbol) { markPropertyAsReferenced( symbol, - /* nodeForCheckWriteOnly: */ + /*nodeForCheckWriteOnly*/ void 0, - /* isThisAccess: */ + /*isSelfTypeAccess*/ false ); } @@ -70883,7 +71289,7 @@ ${lanes.join("\n")} false ) === getDeclaringConstructor(prop); } - function checkPropertyAccessExpressionOrQualifiedName(node, left, leftType, right, checkMode) { + function checkPropertyAccessExpressionOrQualifiedName(node, left, leftType, right, checkMode, writeOnly) { const parentSymbol = getNodeLinks(left).resolvedSymbol; const assignmentKind = getAssignmentTargetKind(node); const apparentType = getApparentType(assignmentKind !== 0 /* None */ || isMethodAccessForCall(node) ? getWidenedType(leftType) : leftType); @@ -70933,10 +71339,10 @@ ${lanes.join("\n")} /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ - node.kind === 163 /* QualifiedName */ + node.kind === 165 /* QualifiedName */ ); } - if (isIdentifier(left) && parentSymbol && (getIsolatedModules(compilerOptions) || !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && node.parent.kind === 302 /* EnumMember */)) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { + if (isIdentifier(left) && parentSymbol && (getIsolatedModules(compilerOptions) || !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* EnumMember */ && node.parent.kind === 305 /* EnumMember */)) || shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { markAliasReferenced(parentSymbol, node); } let propType; @@ -70979,19 +71385,19 @@ ${lanes.join("\n")} addDeprecatedSuggestion(right, [indexInfo.declaration], right.escapedText); } } else { - if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) { - addDeprecatedSuggestion(right, prop.declarations, right.escapedText); + const targetPropSymbol = resolveAliasWithDeprecationCheck(prop, right); + if (isDeprecatedSymbol(targetPropSymbol) && isUncalledFunctionReference(node, targetPropSymbol) && targetPropSymbol.declarations) { + addDeprecatedSuggestion(right, targetPropSymbol.declarations, right.escapedText); } checkPropertyNotUsedBeforeDeclaration(prop, node, right); markPropertyAsReferenced(prop, node, isSelfTypeAccess(left, parentSymbol)); getNodeLinks(node).resolvedSymbol = prop; - const writing = isWriteAccess(node); - checkPropertyAccessibility(node, left.kind === 106 /* SuperKeyword */, writing, apparentType, prop); + checkPropertyAccessibility(node, left.kind === 108 /* SuperKeyword */, isWriteAccess(node), apparentType, prop); if (isAssignmentToReadonlyEntity(node, prop, assignmentKind)) { error(right, Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, idText(right)); return errorType; } - propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writing ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop); + propType = isThisPropertyAccessInConstructor(node, prop) ? autoType : writeOnly || isWriteOnlyAccess(node) ? getWriteTypeOfSymbol(prop) : getTypeOfSymbol(prop); } return getFlowTypeOfAccessExpression(node, prop, propType, right, checkMode); } @@ -71000,7 +71406,7 @@ ${lanes.join("\n")} if (file) { if (compilerOptions.checkJs === void 0 && file.checkJsDirective === void 0 && (file.scriptKind === 1 /* JS */ || file.scriptKind === 2 /* JSX */)) { const declarationFile = forEach(suggestion == null ? void 0 : suggestion.declarations, getSourceFileOfNode); - return !(file !== declarationFile && !!declarationFile && isGlobalSourceFile(declarationFile)) && !(excludeClasses && suggestion && suggestion.flags & 32 /* Class */) && !(!!node && excludeClasses && isPropertyAccessExpression(node) && node.expression.kind === 108 /* ThisKeyword */); + return !(file !== declarationFile && !!declarationFile && isGlobalSourceFile(declarationFile)) && !(excludeClasses && suggestion && suggestion.flags & 32 /* Class */) && !(!!node && excludeClasses && isPropertyAccessExpression(node) && node.expression.kind === 110 /* ThisKeyword */); } } return false; @@ -71018,12 +71424,12 @@ ${lanes.join("\n")} } propType = getNarrowableTypeForReference(propType, node, checkMode); let assumeUninitialized = false; - if (strictNullChecks && strictPropertyInitialization && isAccessExpression(node) && node.expression.kind === 108 /* ThisKeyword */) { + if (strictNullChecks && strictPropertyInitialization && isAccessExpression(node) && node.expression.kind === 110 /* ThisKeyword */) { const declaration = prop && prop.valueDeclaration; if (declaration && isPropertyWithoutInitializer(declaration)) { if (!isStatic(declaration)) { const flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 173 /* Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* Ambient */)) { + if (flowContainer.kind === 175 /* Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* Ambient */)) { assumeUninitialized = true; } } @@ -71047,7 +71453,7 @@ ${lanes.join("\n")} const declarationName = idText(right); if (isInPropertyInitializerOrClassStaticBlock(node) && !isOptionalPropertyDeclaration(valueDeclaration) && !(isAccessExpression(node) && isAccessExpression(node.expression)) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right) && !(isMethodDeclaration(valueDeclaration) && getCombinedModifierFlags(valueDeclaration) & 32 /* Static */) && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { diagnosticMessage = error(right, Diagnostics.Property_0_is_used_before_its_initialization, declarationName); - } else if (valueDeclaration.kind === 260 /* ClassDeclaration */ && node.parent.kind !== 180 /* TypeReference */ && !(valueDeclaration.flags & 16777216 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { + } else if (valueDeclaration.kind === 262 /* ClassDeclaration */ && node.parent.kind !== 182 /* TypeReference */ && !(valueDeclaration.flags & 16777216 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { diagnosticMessage = error(right, Diagnostics.Class_0_used_before_its_declaration, declarationName); } if (diagnosticMessage) { @@ -71060,25 +71466,25 @@ ${lanes.join("\n")} function isInPropertyInitializerOrClassStaticBlock(node) { return !!findAncestor(node, (node2) => { switch (node2.kind) { - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return true; - case 299 /* PropertyAssignment */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 301 /* SpreadAssignment */: - case 164 /* ComputedPropertyName */: - case 236 /* TemplateSpan */: - case 291 /* JsxExpression */: - case 288 /* JsxAttribute */: - case 289 /* JsxAttributes */: - case 290 /* JsxSpreadAttribute */: - case 283 /* JsxOpeningElement */: - case 230 /* ExpressionWithTypeArguments */: - case 294 /* HeritageClause */: + case 302 /* PropertyAssignment */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 304 /* SpreadAssignment */: + case 166 /* ComputedPropertyName */: + case 238 /* TemplateSpan */: + case 293 /* JsxExpression */: + case 290 /* JsxAttribute */: + case 291 /* JsxAttributes */: + case 292 /* JsxSpreadAttribute */: + case 285 /* JsxOpeningElement */: + case 232 /* ExpressionWithTypeArguments */: + case 297 /* HeritageClause */: return false; - case 216 /* ArrowFunction */: - case 241 /* ExpressionStatement */: + case 218 /* ArrowFunction */: + case 243 /* ExpressionStatement */: return isBlock(node2.parent) && isClassStaticBlockDeclaration(node2.parent.parent) ? true : "quit"; default: return isExpressionNode(node2) ? false : "quit"; @@ -71111,7 +71517,7 @@ ${lanes.join("\n")} function reportNonexistentProperty(propNode, containingType, isUncheckedJS) { let errorInfo; let relatedInfo; - if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 134348796 /* Primitive */)) { + if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 402784252 /* Primitive */)) { for (const subtype of containingType.types) { if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) { errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype)); @@ -71201,7 +71607,7 @@ ${lanes.join("\n")} const strName = isString(name) ? name : idText(name); const properties = getPropertiesOfType(containingType); const jsxSpecific = strName === "for" ? find(properties, (x) => symbolName(x) === "htmlFor") : strName === "class" ? find(properties, (x) => symbolName(x) === "className") : void 0; - return jsxSpecific != null ? jsxSpecific : getSpellingSuggestionForName(strName, properties, 111551 /* Value */); + return jsxSpecific ?? getSpellingSuggestionForName(strName, properties, 111551 /* Value */); } function getSuggestionForNonexistentProperty(name, containingType) { const suggestion = getSuggestedSymbolForNonexistentProperty(name, containingType); @@ -71319,13 +71725,13 @@ ${lanes.join("\n")} (getCheckFlags(prop) & 1 /* Instantiated */ ? getSymbolLinks(prop).target : prop).isReferenced = 67108863 /* All */; } function isSelfTypeAccess(name, parent2) { - return name.kind === 108 /* ThisKeyword */ || !!parent2 && isEntityNameExpression(name) && parent2 === getResolvedSymbol(getFirstIdentifier(name)); + return name.kind === 110 /* ThisKeyword */ || !!parent2 && isEntityNameExpression(name) && parent2 === getResolvedSymbol(getFirstIdentifier(name)); } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 208 /* PropertyAccessExpression */: - return isValidPropertyAccessWithType(node, node.expression.kind === 106 /* SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); - case 163 /* QualifiedName */: + case 210 /* PropertyAccessExpression */: + return isValidPropertyAccessWithType(node, node.expression.kind === 108 /* SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); + case 165 /* QualifiedName */: return isValidPropertyAccessWithType( node, /*isSuper*/ @@ -71333,7 +71739,7 @@ ${lanes.join("\n")} propertyName, getWidenedType(checkExpression(node.left)) ); - case 202 /* ImportType */: + case 204 /* ImportType */: return isValidPropertyAccessWithType( node, /*isSuper*/ @@ -71346,8 +71752,8 @@ ${lanes.join("\n")} function isValidPropertyAccessForCompletions(node, type, property) { return isPropertyAccessible( node, - node.kind === 208 /* PropertyAccessExpression */ && node.expression.kind === 106 /* SuperKeyword */, - /* isWrite */ + node.kind === 210 /* PropertyAccessExpression */ && node.expression.kind === 108 /* SuperKeyword */, + /*isWrite*/ false, type, property @@ -71361,7 +71767,7 @@ ${lanes.join("\n")} return !!prop && isPropertyAccessible( node, isSuper, - /* isWrite */ + /*isWrite*/ false, type, prop @@ -71379,12 +71785,12 @@ ${lanes.join("\n")} } function getForInVariableSymbol(node) { const initializer = node.initializer; - if (initializer.kind === 258 /* VariableDeclarationList */) { + if (initializer.kind === 260 /* VariableDeclarationList */) { const variable = initializer.declarations[0]; if (variable && !isBindingPattern(variable.name)) { return getSymbolOfDeclaration(variable); } - } else if (initializer.kind === 79 /* Identifier */) { + } else if (initializer.kind === 80 /* Identifier */) { return getResolvedSymbol(initializer); } return void 0; @@ -71394,13 +71800,13 @@ ${lanes.join("\n")} } function isForInVariableForNumericPropertyNames(expr) { const e = skipParentheses(expr); - if (e.kind === 79 /* Identifier */) { + if (e.kind === 80 /* Identifier */) { const symbol = getResolvedSymbol(e); if (symbol.flags & 3 /* Variable */) { let child = expr; let node = expr.parent; while (node) { - if (node.kind === 246 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { + if (node.kind === 248 /* ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { return true; } child = node; @@ -71441,11 +71847,11 @@ ${lanes.join("\n")} if (callLikeExpressionMayHaveTypeArguments(node)) { forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 212 /* TaggedTemplateExpression */) { + if (node.kind === 214 /* TaggedTemplateExpression */) { checkExpression(node.template); } else if (isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); - } else if (node.kind !== 167 /* Decorator */) { + } else if (node.kind !== 169 /* Decorator */) { forEach(node.arguments, (argument) => { checkExpression(argument); }); @@ -71490,7 +71896,7 @@ ${lanes.join("\n")} } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 227 /* SpreadElement */ || arg.kind === 234 /* SyntheticExpression */ && arg.isSpread); + return !!arg && (arg.kind === 229 /* SpreadElement */ || arg.kind === 236 /* SyntheticExpression */ && arg.isSpread); } function getSpreadArgumentIndex(args) { return findIndex(args, isSpreadArgument); @@ -71506,17 +71912,17 @@ ${lanes.join("\n")} let callIsIncomplete = false; let effectiveParameterCount = getParameterCount(signature); let effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 212 /* TaggedTemplateExpression */) { + if (node.kind === 214 /* TaggedTemplateExpression */) { argCount = args.length; - if (node.template.kind === 225 /* TemplateExpression */) { + if (node.template.kind === 227 /* TemplateExpression */) { const lastSpan = last(node.template.templateSpans); callIsIncomplete = nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; } else { const templateLiteral = node.template; - Debug.assert(templateLiteral.kind === 14 /* NoSubstitutionTemplateLiteral */); + Debug.assert(templateLiteral.kind === 15 /* NoSubstitutionTemplateLiteral */); callIsIncomplete = !!templateLiteral.isUnterminated; } - } else if (node.kind === 167 /* Decorator */) { + } else if (node.kind === 169 /* Decorator */) { argCount = getDecoratorArgumentCount(node, signature); } else if (isJsxOpeningLikeElement(node)) { callIsIncomplete = node.attributes.end === node.end; @@ -71527,7 +71933,7 @@ ${lanes.join("\n")} effectiveParameterCount = args.length === 0 ? effectiveParameterCount : 1; effectiveMinimumArguments = Math.min(effectiveMinimumArguments, 1); } else if (!node.arguments) { - Debug.assert(node.kind === 211 /* NewExpression */); + Debug.assert(node.kind === 213 /* NewExpression */); return getMinArgumentCount(signature) === 0; } else { argCount = signatureHelpTrailingComma ? args.length + 1 : args.length; @@ -71623,7 +72029,7 @@ ${lanes.join("\n")} if (isJsxOpeningLikeElement(node)) { return inferJsxTypeArguments(node, signature, checkMode, context); } - if (node.kind !== 167 /* Decorator */) { + if (node.kind !== 169 /* Decorator */) { const skipBindingPatterns = every(signature.typeParameters, (p) => !!getDefaultFromTypeParameter(p)); const contextualType = getContextualType2(node, skipBindingPatterns ? 8 /* SkipBindingPatterns */ : 0 /* None */); if (contextualType) { @@ -71660,7 +72066,7 @@ ${lanes.join("\n")} } for (let i = 0; i < argCount; i++) { const arg = args[i]; - if (arg.kind !== 229 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { + if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { const paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); @@ -71676,7 +72082,7 @@ ${lanes.join("\n")} } function getMutableArrayOrTupleType(type) { return type.flags & 1048576 /* Union */ ? mapType(type, getMutableArrayOrTupleType) : type.flags & 1 /* Any */ || isMutableArrayOrTuple(getBaseConstraintOfType(type) || type) ? type : isTupleType(type) ? createTupleType( - getTypeArguments(type), + getElementTypes(type), type.target.elementFlags, /*readonly*/ false, @@ -71684,35 +72090,39 @@ ${lanes.join("\n")} ) : createTupleType([type], [8 /* Variadic */]); } function getSpreadArgumentType(args, index, argCount, restType, context, checkMode) { + const inConstContext = isConstTypeVariable(restType); if (index >= argCount - 1) { const arg = args[argCount - 1]; if (isSpreadArgument(arg)) { - return getMutableArrayOrTupleType(arg.kind === 234 /* SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode)); + const spreadType = arg.kind === 236 /* SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode); + if (isArrayLikeType(spreadType)) { + return getMutableArrayOrTupleType(spreadType); + } + return createArrayType(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 229 /* SpreadElement */ ? arg.expression : arg), inConstContext); } } const types = []; const flags = []; const names = []; - const inConstContext = isConstTypeVariable(restType); for (let i = index; i < argCount; i++) { const arg = args[i]; if (isSpreadArgument(arg)) { - const spreadType = arg.kind === 234 /* SyntheticExpression */ ? arg.type : checkExpression(arg.expression); + const spreadType = arg.kind === 236 /* SyntheticExpression */ ? arg.type : checkExpression(arg.expression); if (isArrayLikeType(spreadType)) { types.push(spreadType); flags.push(8 /* Variadic */); } else { - types.push(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 227 /* SpreadElement */ ? arg.expression : arg)); + types.push(checkIteratedTypeOrElementType(33 /* Spread */, spreadType, undefinedType, arg.kind === 229 /* SpreadElement */ ? arg.expression : arg)); flags.push(4 /* Rest */); } } else { - const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */); + const contextualType = isTupleType(restType) ? getContextualTypeForElementExpression(restType, i - index, argCount - index) || unknownType : getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */); const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode); - const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */); + const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 402784252 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */); types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1 /* Required */); } - if (arg.kind === 234 /* SyntheticExpression */ && arg.tupleNameSource) { + if (arg.kind === 236 /* SyntheticExpression */ && arg.tupleNameSource) { names.push(arg.tupleNameSource); } } @@ -71751,7 +72161,7 @@ ${lanes.join("\n")} return typeArgumentTypes; } function getJsxReferenceKind(node) { - if (isJsxIntrinsicIdentifier(node.tagName)) { + if (isJsxIntrinsicTagName(node.tagName)) { return 2 /* Mixed */; } const tagType = getApparentType(checkExpression(node.tagName)); @@ -71784,11 +72194,11 @@ ${lanes.join("\n")} errorOutputContainer ); function checkTagNameDoesNotExpectTooManyArguments() { - var _a2; + var _a; if (getJsxNamespaceContainerForImplicitImport(node)) { return true; } - const tagType = isJsxOpeningElement(node) || isJsxSelfClosingElement(node) && !isJsxIntrinsicIdentifier(node.tagName) ? checkExpression(node.tagName) : void 0; + const tagType = (isJsxOpeningElement(node) || isJsxSelfClosingElement(node)) && !(isJsxIntrinsicTagName(node.tagName) || isJsxNamespacedName(node.tagName)) ? checkExpression(node.tagName) : void 0; if (!tagType) { return true; } @@ -71850,7 +72260,7 @@ ${lanes.join("\n")} } if (reportErrors2) { const diag2 = createDiagnosticForNode(node.tagName, Diagnostics.Tag_0_expects_at_least_1_arguments_but_the_JSX_factory_2_provides_at_most_3, entityNameToString(node.tagName), absoluteMinArgCount, entityNameToString(factory2), maxParamCount); - const tagNameDeclaration = (_a2 = getSymbolAtLocation(node.tagName)) == null ? void 0 : _a2.valueDeclaration; + const tagNameDeclaration = (_a = getSymbolAtLocation(node.tagName)) == null ? void 0 : _a.valueDeclaration; if (tagNameDeclaration) { addRelatedInfo(diag2, createDiagnosticForNode(tagNameDeclaration, Diagnostics._0_is_declared_here, entityNameToString(node.tagName))); } @@ -71889,7 +72299,7 @@ ${lanes.join("\n")} const argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (let i = 0; i < argCount; i++) { const arg = args[i]; - if (arg.kind !== 229 /* OmittedExpression */) { + if (arg.kind !== 231 /* OmittedExpression */) { const paramType = getTypeAtPosition(signature, i); const argType = checkExpressionWithContextualType( arg, @@ -71947,7 +72357,7 @@ ${lanes.join("\n")} } } function getThisArgumentOfCall(node) { - const expression = node.kind === 210 /* CallExpression */ ? node.expression : node.kind === 212 /* TaggedTemplateExpression */ ? node.tag : void 0; + const expression = node.kind === 212 /* CallExpression */ ? node.expression : node.kind === 214 /* TaggedTemplateExpression */ ? node.tag : void 0; if (expression) { const callee = skipOuterExpressions(expression); if (isAccessExpression(callee)) { @@ -71962,17 +72372,17 @@ ${lanes.join("\n")} return result; } function getEffectiveCallArguments(node) { - if (node.kind === 212 /* TaggedTemplateExpression */) { + if (node.kind === 214 /* TaggedTemplateExpression */) { const template = node.template; const args2 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 225 /* TemplateExpression */) { + if (template.kind === 227 /* TemplateExpression */) { forEach(template.templateSpans, (span) => { args2.push(span.expression); }); } return args2; } - if (node.kind === 167 /* Decorator */) { + if (node.kind === 169 /* Decorator */) { return getEffectiveDecoratorArguments(node); } if (isJsxOpeningLikeElement(node)) { @@ -71984,16 +72394,16 @@ ${lanes.join("\n")} const effectiveArgs = args.slice(0, spreadIndex); for (let i = spreadIndex; i < args.length; i++) { const arg = args[i]; - const spreadType = arg.kind === 227 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + const spreadType = arg.kind === 229 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); if (spreadType && isTupleType(spreadType)) { - forEach(getTypeArguments(spreadType), (t, i2) => { - var _a2; + forEach(getElementTypes(spreadType), (t, i2) => { + var _a; const flags = spreadType.target.elementFlags[i2]; const syntheticArg = createSyntheticExpression( arg, flags & 4 /* Rest */ ? createArrayType(t) : t, !!(flags & 12 /* Variable */), - (_a2 = spreadType.target.labeledElementDeclarations) == null ? void 0 : _a2[i2] + (_a = spreadType.target.labeledElementDeclarations) == null ? void 0 : _a[i2] ); effectiveArgs.push(syntheticArg); }); @@ -72023,16 +72433,16 @@ ${lanes.join("\n")} } function getLegacyDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: return 1; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return hasAccessorModifier(node.parent) ? 3 : 2; - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return languageVersion === 0 /* ES3 */ || signature.parameters.length <= 2 ? 2 : 3; - case 166 /* Parameter */: + case 168 /* Parameter */: return 3; default: return Debug.fail(); @@ -72053,16 +72463,16 @@ ${lanes.join("\n")} } return { start, length: length2, sourceFile }; } - function getDiagnosticForCallNode(node, message, arg0, arg1, arg2, arg3) { + function getDiagnosticForCallNode(node, message, ...args) { if (isCallExpression(node)) { const { sourceFile, start, length: length2 } = getDiagnosticSpanForCallNode(node); if ("message" in message) { - return createFileDiagnostic(sourceFile, start, length2, message, arg0, arg1, arg2, arg3); + return createFileDiagnostic(sourceFile, start, length2, message, ...args); } return createDiagnosticForFileFromMessageChain(sourceFile, message); } else { if ("message" in message) { - return createDiagnosticForNode(node, message, arg0, arg1, arg2, arg3); + return createDiagnosticForNode(node, message, ...args); } return createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(node), node, message); } @@ -72070,7 +72480,17 @@ ${lanes.join("\n")} function isPromiseResolveArityError(node) { if (!isCallExpression(node) || !isIdentifier(node.expression)) return false; - const symbol = resolveName(node.expression, node.expression.escapedText, 111551 /* Value */, void 0, void 0, false); + const symbol = resolveName( + node.expression, + node.expression.escapedText, + 111551 /* Value */, + /*nameNotFoundMessage*/ + void 0, + /*nameArg*/ + void 0, + /*isUse*/ + false + ); const decl = symbol == null ? void 0 : symbol.valueDeclaration; if (!decl || !isParameter(decl) || !isFunctionExpressionOrArrowFunction(decl.parent) || !isNewExpression(decl.parent.parent) || !isIdentifier(decl.parent.parent.expression)) { return false; @@ -72089,7 +72509,7 @@ ${lanes.join("\n")} return constructorSymbol === globalPromiseSymbol; } function getArgumentArityError(node, signatures, args, headMessage) { - var _a2; + var _a; const spreadIndex = getSpreadArgumentIndex(args); if (spreadIndex > -1) { return createDiagnosticForNode(args[spreadIndex], Diagnostics.A_spread_argument_must_either_have_a_tuple_type_or_be_passed_to_a_rest_parameter); @@ -72148,13 +72568,10 @@ ${lanes.join("\n")} } else { diagnostic = getDiagnosticForCallNode(node, error2, parameterRange, args.length); } - const parameter = (_a2 = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a2.parameters[closestSignature.thisParameter ? args.length + 1 : args.length]; + const parameter = (_a = closestSignature == null ? void 0 : closestSignature.declaration) == null ? void 0 : _a.parameters[closestSignature.thisParameter ? args.length + 1 : args.length]; if (parameter) { - const parameterError = createDiagnosticForNode( - parameter, - isBindingPattern(parameter.name) ? Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided : isRestParameter(parameter) ? Diagnostics.Arguments_for_the_rest_parameter_0_were_not_provided : Diagnostics.An_argument_for_0_was_not_provided, - !parameter.name ? args.length : !isBindingPattern(parameter.name) ? idText(getFirstIdentifier(parameter.name)) : void 0 - ); + const messageAndArgs = isBindingPattern(parameter.name) ? [Diagnostics.An_argument_matching_this_binding_pattern_was_not_provided] : isRestParameter(parameter) ? [Diagnostics.Arguments_for_the_rest_parameter_0_were_not_provided, idText(getFirstIdentifier(parameter.name))] : [Diagnostics.An_argument_for_0_was_not_provided, !parameter.name ? args.length : idText(getFirstIdentifier(parameter.name))]; + const parameterError = createDiagnosticForNode(parameter, ...messageAndArgs); return addRelatedInfo(diagnostic, parameterError); } return diagnostic; @@ -72239,14 +72656,14 @@ ${lanes.join("\n")} return createDiagnosticForNodeArray(getSourceFileOfNode(node), typeArguments, Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, headMessage) { - const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */; - const isDecorator2 = node.kind === 167 /* Decorator */; + const isTaggedTemplate = node.kind === 214 /* TaggedTemplateExpression */; + const isDecorator2 = node.kind === 169 /* Decorator */; const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node); const reportErrors2 = !isInferencePartiallyBlocked && !candidatesOutArray; let typeArguments; if (!isDecorator2 && !isSuperCall(node)) { typeArguments = node.typeArguments; - if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106 /* SuperKeyword */) { + if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 108 /* SuperKeyword */) { forEach(typeArguments, checkSourceElement); } } @@ -72266,7 +72683,7 @@ ${lanes.join("\n")} let candidateForArgumentArityError; let candidateForTypeArgumentError; let result; - const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 210 /* CallExpression */ && node.arguments.hasTrailingComma; + const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma); } @@ -72389,11 +72806,11 @@ ${lanes.join("\n")} } return result; function addImplementationSuccessElaboration(failed, diagnostic) { - var _a2, _b; + var _a, _b; const oldCandidatesForArgumentError = candidatesForArgumentError; const oldCandidateForArgumentArityError = candidateForArgumentArityError; const oldCandidateForTypeArgumentError = candidateForTypeArgumentError; - const failedSignatureDeclarations = ((_b = (_a2 = failed.declaration) == null ? void 0 : _a2.symbol) == null ? void 0 : _b.declarations) || emptyArray; + const failedSignatureDeclarations = ((_b = (_a = failed.declaration) == null ? void 0 : _a.symbol) == null ? void 0 : _b.declarations) || emptyArray; const isOverload = failedSignatureDeclarations.length > 1; const implDecl = isOverload ? find(failedSignatureDeclarations, (d) => isFunctionLikeDeclaration(d) && nodeIsPresent(d.body)) : void 0; if (implDecl) { @@ -72552,7 +72969,7 @@ ${lanes.join("\n")} parameters, /*resolvedReturnType*/ getIntersectionType(candidates.map(getReturnTypeOfSignature)), - /*typePredicate*/ + /*resolvedTypePredicate*/ void 0, minArgumentCount, flags @@ -72617,7 +73034,7 @@ ${lanes.join("\n")} return maxParamsIndex; } function resolveCallExpression(node, candidatesOutArray, checkMode) { - if (node.expression.kind === 106 /* SuperKeyword */) { + if (node.expression.kind === 108 /* SuperKeyword */) { const superType = checkSuperExpression(node.expression); if (isTypeAny(superType)) { for (const arg of node.arguments) { @@ -72673,7 +73090,7 @@ ${lanes.join("\n")} if (isLineBreak(text.charCodeAt(skipTrivia( text, node.expression.end, - /* stopAfterLineBreak */ + /*stopAfterLineBreak*/ true ) - 1))) { relatedInformation = createDiagnosticForNode(node.expression, Diagnostics.Are_you_missing_a_semicolon); @@ -72794,7 +73211,7 @@ ${lanes.join("\n")} } const declaration = signature.declaration; const modifiers = getSelectedEffectiveModifierFlags(declaration, 24 /* NonPublicAccessibilityModifier */); - if (!modifiers || declaration.kind !== 173 /* Constructor */) { + if (!modifiers || declaration.kind !== 175 /* Constructor */) { return true; } const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -72852,7 +73269,7 @@ ${lanes.join("\n")} } if (!hasSignatures) { errorInfo = chainDiagnosticMessages( - /* detials */ + /*details*/ void 0, isCall ? Diagnostics.No_constituent_of_type_0_is_callable : Diagnostics.No_constituent_of_type_0_is_constructable, typeToString(apparentType) @@ -72893,7 +73310,7 @@ ${lanes.join("\n")} if (isCallExpression(errorTarget.parent)) { const { start, length: length2 } = getDiagnosticSpanForCallNode( errorTarget.parent, - /* doNotIncludeArguments */ + /*doNotIncludeArguments*/ true ); diagnostic.start = start; @@ -72941,16 +73358,16 @@ ${lanes.join("\n")} } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: return Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 166 /* Parameter */: + case 168 /* Parameter */: return Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return Debug.fail(); @@ -73001,10 +73418,10 @@ ${lanes.join("\n")} [factory.createParameterDeclaration( /*modifiers*/ void 0, - /*dotdotdot*/ + /*dotDotDotToken*/ void 0, "props", - /*questionMark*/ + /*questionToken*/ void 0, nodeBuilder.typeToTypeNode(result, node) )], @@ -73012,7 +73429,7 @@ ${lanes.join("\n")} returnNode, /*typeArguments*/ void 0 - ) : factory.createKeywordTypeNode(131 /* AnyKeyword */) + ) : factory.createKeywordTypeNode(133 /* AnyKeyword */) ); const parameterSymbol = createSymbol(1 /* FunctionScopedVariable */, "props"); parameterSymbol.links.type = result; @@ -73024,14 +73441,14 @@ ${lanes.join("\n")} void 0, [parameterSymbol], typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType, - /*returnTypePredicate*/ + /*resolvedTypePredicate*/ void 0, 1, 0 /* None */ ); } function resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode) { - if (isJsxIntrinsicIdentifier(node.tagName)) { + if (isJsxIntrinsicTagName(node.tagName)) { const result = getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node); const fakeSignature = createSignatureForJSXIntrinsic(node, result); checkTypeAssignableToAndOptionallyElaborate(checkExpressionWithContextualType( @@ -73073,19 +73490,19 @@ ${lanes.join("\n")} } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 210 /* CallExpression */: + case 212 /* CallExpression */: return resolveCallExpression(node, candidatesOutArray, checkMode); - case 211 /* NewExpression */: + case 213 /* NewExpression */: return resolveNewExpression(node, candidatesOutArray, checkMode); - case 212 /* TaggedTemplateExpression */: + case 214 /* TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 167 /* Decorator */: + case 169 /* Decorator */: return resolveDecorator(node, candidatesOutArray, checkMode); - case 283 /* JsxOpeningElement */: - case 282 /* JsxSelfClosingElement */: + case 285 /* JsxOpeningElement */: + case 284 /* JsxSelfClosingElement */: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } - throw Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); + Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); } function getResolvedSignature(node, candidatesOutArray, checkMode) { const links = getNodeLinks(node); @@ -73094,14 +73511,17 @@ ${lanes.join("\n")} return cached; } links.resolvedSignature = resolvingSignature; - const result = resolveSignature(node, candidatesOutArray, checkMode || 0 /* Normal */); + let result = resolveSignature(node, candidatesOutArray, checkMode || 0 /* Normal */); if (result !== resolvingSignature) { + if (links.resolvedSignature !== resolvingSignature) { + result = links.resolvedSignature; + } links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached; } return result; } function isJSConstructor(node) { - var _a2; + var _a; if (!node || !isInJSFile(node)) { return false; } @@ -73112,12 +73532,12 @@ ${lanes.join("\n")} if (isPropertyAssignment(walkUpParenthesizedExpressions(func.parent))) return false; const symbol = getSymbolOfDeclaration(func); - return !!((_a2 = symbol == null ? void 0 : symbol.members) == null ? void 0 : _a2.size); + return !!((_a = symbol == null ? void 0 : symbol.members) == null ? void 0 : _a.size); } return false; } function mergeJSSymbols(target, source) { - var _a2, _b; + var _a, _b; if (source) { const links = getSymbolLinks(source); if (!links.inferredClassSymbol || !links.inferredClassSymbol.has(getSymbolId(target))) { @@ -73125,7 +73545,7 @@ ${lanes.join("\n")} inferred.exports = inferred.exports || createSymbolTable(); inferred.members = inferred.members || createSymbolTable(); inferred.flags |= source.flags & 32 /* Class */; - if ((_a2 = source.exports) == null ? void 0 : _a2.size) { + if ((_a = source.exports) == null ? void 0 : _a.size) { mergeSymbolTable(inferred.exports, source.exports); } if ((_b = source.members) == null ? void 0 : _b.size) { @@ -73138,13 +73558,13 @@ ${lanes.join("\n")} } } function getAssignedClassSymbol(decl) { - var _a2; + var _a; const assignmentSymbol = decl && getSymbolOfExpando( decl, /*allowDeclaration*/ true ); - const prototype = (_a2 = assignmentSymbol == null ? void 0 : assignmentSymbol.exports) == null ? void 0 : _a2.get("prototype"); + const prototype = (_a = assignmentSymbol == null ? void 0 : assignmentSymbol.exports) == null ? void 0 : _a.get("prototype"); const init = (prototype == null ? void 0 : prototype.valueDeclaration) && getAssignedJSPrototype(prototype.valueDeclaration); return init ? getSymbolOfDeclaration(init) : void 0; } @@ -73163,14 +73583,14 @@ ${lanes.join("\n")} } else if (isBinaryExpression(node.parent)) { const parentNode = node.parent; const parentNodeOperator = node.parent.operatorToken.kind; - if (parentNodeOperator === 63 /* EqualsToken */ && (allowDeclaration || parentNode.right === node)) { + if (parentNodeOperator === 64 /* EqualsToken */ && (allowDeclaration || parentNode.right === node)) { name = parentNode.left; decl = name; - } else if (parentNodeOperator === 56 /* BarBarToken */ || parentNodeOperator === 60 /* QuestionQuestionToken */) { + } else if (parentNodeOperator === 57 /* BarBarToken */ || parentNodeOperator === 61 /* QuestionQuestionToken */) { if (isVariableDeclaration(parentNode.parent) && parentNode.parent.initializer === parentNode) { name = parentNode.parent.name; decl = parentNode.parent; - } else if (isBinaryExpression(parentNode.parent) && parentNode.parent.operatorToken.kind === 63 /* EqualsToken */ && (allowDeclaration || parentNode.parent.right === parentNode)) { + } else if (isBinaryExpression(parentNode.parent) && parentNode.parent.operatorToken.kind === 64 /* EqualsToken */ && (allowDeclaration || parentNode.parent.right === parentNode)) { name = parentNode.parent.left; decl = name; } @@ -73192,16 +73612,16 @@ ${lanes.join("\n")} return false; } let parent2 = node.parent; - while (parent2 && parent2.kind === 208 /* PropertyAccessExpression */) { + while (parent2 && parent2.kind === 210 /* PropertyAccessExpression */) { parent2 = parent2.parent; } - if (parent2 && isBinaryExpression(parent2) && isPrototypeAccess(parent2.left) && parent2.operatorToken.kind === 63 /* EqualsToken */) { + if (parent2 && isBinaryExpression(parent2) && isPrototypeAccess(parent2.left) && parent2.operatorToken.kind === 64 /* EqualsToken */) { const right = getInitializerOfBinaryExpression(parent2); return isObjectLiteralExpression(right) && right; } } function checkCallExpression(node, checkMode) { - var _a2, _b, _c; + var _a, _b, _c; checkGrammarTypeArguments(node, node.typeArguments); const signature = getResolvedSignature( node, @@ -73213,12 +73633,12 @@ ${lanes.join("\n")} return silentNeverType; } checkDeprecatedSignature(signature, node); - if (node.expression.kind === 106 /* SuperKeyword */) { + if (node.expression.kind === 108 /* SuperKeyword */) { return voidType; } - if (node.kind === 211 /* NewExpression */) { + if (node.kind === 213 /* NewExpression */) { const declaration = signature.declaration; - if (declaration && declaration.kind !== 173 /* Constructor */ && declaration.kind !== 177 /* ConstructSignature */ && declaration.kind !== 182 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (_a2 = getJSDocRoot(declaration)) == null ? void 0 : _a2.parent) == null ? void 0 : _b.kind) === 173 /* Constructor */) && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { + if (declaration && declaration.kind !== 175 /* Constructor */ && declaration.kind !== 179 /* ConstructSignature */ && declaration.kind !== 184 /* ConstructorType */ && !(isJSDocSignature(declaration) && ((_b = (_a = getJSDocRoot(declaration)) == null ? void 0 : _a.parent) == null ? void 0 : _b.kind) === 175 /* Constructor */) && !isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { if (noImplicitAny) { error(node, Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } @@ -73232,7 +73652,7 @@ ${lanes.join("\n")} if (returnType.flags & 12288 /* ESSymbolLike */ && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 210 /* CallExpression */ && !node.questionDotToken && node.parent.kind === 241 /* ExpressionStatement */ && returnType.flags & 16384 /* Void */ && getTypePredicateOfSignature(signature)) { + if (node.kind === 212 /* CallExpression */ && !node.questionDotToken && node.parent.kind === 243 /* ExpressionStatement */ && returnType.flags & 16384 /* Void */ && getTypePredicateOfSignature(signature)) { if (!isDottedName(node.expression)) { error(node.expression, Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); } else if (!getEffectsSignature(node)) { @@ -73264,20 +73684,20 @@ ${lanes.join("\n")} function getDeprecatedSuggestionNode(node) { node = skipParentheses(node); switch (node.kind) { - case 210 /* CallExpression */: - case 167 /* Decorator */: - case 211 /* NewExpression */: + case 212 /* CallExpression */: + case 169 /* Decorator */: + case 213 /* NewExpression */: return getDeprecatedSuggestionNode(node.expression); - case 212 /* TaggedTemplateExpression */: + case 214 /* TaggedTemplateExpression */: return getDeprecatedSuggestionNode(node.tag); - case 283 /* JsxOpeningElement */: - case 282 /* JsxSelfClosingElement */: + case 285 /* JsxOpeningElement */: + case 284 /* JsxSelfClosingElement */: return getDeprecatedSuggestionNode(node.tagName); - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: return node.argumentExpression; - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: return node.name; - case 180 /* TypeReference */: + case 182 /* TypeReference */: const typeReference = node; return isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; default: @@ -73341,9 +73761,9 @@ ${lanes.join("\n")} const esModuleSymbol = resolveESModuleSymbol( moduleSymbol, specifier, - /*dontRecursivelyResolve*/ + /*dontResolveAlias*/ true, - /*suppressUsageError*/ + /*suppressInteropError*/ false ); if (esModuleSymbol) { @@ -73377,11 +73797,11 @@ ${lanes.join("\n")} return void 0; } function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) { - var _a2; + var _a; if (allowSyntheticDefaultImports && type && !isErrorType(type)) { const synthType = type; if (!synthType.syntheticType) { - const file = (_a2 = originalSymbol.declarations) == null ? void 0 : _a2.find(isSourceFile); + const file = (_a = originalSymbol.declarations) == null ? void 0 : _a.find(isSourceFile); const hasSyntheticDefault = canHaveSyntheticDefault( file, originalSymbol, @@ -73413,7 +73833,7 @@ ${lanes.join("\n")} function isCommonJsRequire(node) { if (!isRequireCall( node, - /*checkArgumentIsStringLiteralLike*/ + /*requireStringLiteralLikeArgument*/ true )) { return false; @@ -73437,7 +73857,7 @@ ${lanes.join("\n")} if (resolvedRequire.flags & 2097152 /* Alias */) { return false; } - const targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ ? 259 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ ? 257 /* VariableDeclaration */ : 0 /* Unknown */; + const targetDeclarationKind = resolvedRequire.flags & 16 /* Function */ ? 261 /* FunctionDeclaration */ : resolvedRequire.flags & 3 /* Variable */ ? 259 /* VariableDeclaration */ : 0 /* Unknown */; if (targetDeclarationKind !== 0 /* Unknown */) { const decl = getDeclarationOfKind(resolvedRequire, targetDeclarationKind); return !!decl && !!(decl.flags & 16777216 /* Ambient */); @@ -73454,35 +73874,35 @@ ${lanes.join("\n")} checkDeprecatedSignature(signature, node); return getReturnTypeOfSignature(signature); } - function checkAssertion(node) { - if (node.kind === 213 /* TypeAssertionExpression */) { + function checkAssertion(node, checkMode) { + if (node.kind === 215 /* TypeAssertionExpression */) { const file = getSourceFileOfNode(node); if (file && fileExtensionIsOneOf(file.fileName, [".cts" /* Cts */, ".mts" /* Mts */])) { grammarErrorOnNode(node, Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); } } - return checkAssertionWorker(node, node.type, node.expression); + return checkAssertionWorker(node, checkMode); } function isValidConstAssertionArgument(node) { switch (node.kind) { - case 10 /* StringLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 8 /* NumericLiteral */: - case 9 /* BigIntLiteral */: - case 110 /* TrueKeyword */: - case 95 /* FalseKeyword */: - case 206 /* ArrayLiteralExpression */: - case 207 /* ObjectLiteralExpression */: - case 225 /* TemplateExpression */: + case 11 /* StringLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 9 /* NumericLiteral */: + case 10 /* BigIntLiteral */: + case 112 /* TrueKeyword */: + case 97 /* FalseKeyword */: + case 208 /* ArrayLiteralExpression */: + case 209 /* ObjectLiteralExpression */: + case 227 /* TemplateExpression */: return true; - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return isValidConstAssertionArgument(node.expression); - case 221 /* PrefixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: const op = node.operator; const arg = node.operand; - return op === 40 /* MinusToken */ && (arg.kind === 8 /* NumericLiteral */ || arg.kind === 9 /* BigIntLiteral */) || op === 39 /* PlusToken */ && arg.kind === 8 /* NumericLiteral */; - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + return op === 41 /* MinusToken */ && (arg.kind === 9 /* NumericLiteral */ || arg.kind === 10 /* BigIntLiteral */) || op === 40 /* PlusToken */ && arg.kind === 9 /* NumericLiteral */; + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: const expr = skipParentheses(node.expression); const symbol = isEntityNameExpression(expr) ? resolveEntityName( expr, @@ -73494,16 +73914,43 @@ ${lanes.join("\n")} } return false; } - function checkAssertionWorker(errNode, type, expression, checkMode) { - let exprType = checkExpression(expression, checkMode); + function checkAssertionWorker(node, checkMode) { + const { type, expression } = getAssertionTypeAndExpression(node); + const exprType = checkExpression(expression, checkMode); if (isConstTypeReference(type)) { if (!isValidConstAssertionArgument(expression)) { error(expression, Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals); } return getRegularTypeOfLiteralType(exprType); } + const links = getNodeLinks(node); + links.assertionExpressionType = exprType; checkSourceElement(type); - exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(exprType)); + checkNodeDeferred(node); + return getTypeFromTypeNode(type); + } + function getAssertionTypeAndExpression(node) { + let type; + let expression; + switch (node.kind) { + case 233 /* AsExpression */: + case 215 /* TypeAssertionExpression */: + type = node.type; + expression = node.expression; + break; + case 216 /* ParenthesizedExpression */: + type = getJSDocTypeAssertionType(node); + expression = node.expression; + break; + } + return { type, expression }; + } + function checkAssertionDeferred(node) { + const { type } = getAssertionTypeAndExpression(node); + const errNode = isParenthesizedExpression(node) ? type : node; + const links = getNodeLinks(node); + Debug.assertIsDefined(links.assertionExpressionType); + const exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(links.assertionExpressionType)); const targetType = getTypeFromTypeNode(type); if (!isErrorType(targetType)) { addLazyDiagnostic(() => { @@ -73518,7 +73965,6 @@ ${lanes.join("\n")} } }); } - return targetType; } function checkNonNullChain(node) { const leftType = checkExpression(node.expression); @@ -73531,7 +73977,13 @@ ${lanes.join("\n")} function checkExpressionWithTypeArguments(node) { checkGrammarExpressionWithTypeArguments(node); forEach(node.typeArguments, checkSourceElement); - const exprType = node.kind === 230 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); + if (node.kind === 232 /* ExpressionWithTypeArguments */) { + const parent2 = walkUpParenthesizedExpressions(node.parent); + if (parent2.kind === 225 /* BinaryExpression */ && parent2.operatorToken.kind === 104 /* InstanceOfKeyword */ && isNodeDescendantOf(node, parent2.right)) { + error(node, Diagnostics.The_right_hand_side_of_an_instanceof_expression_must_not_be_an_instantiation_expression); + } + } + const exprType = node.kind === 232 /* ExpressionWithTypeArguments */ ? checkExpression(node.expression) : isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); return getInstantiationExpressionType(exprType, node); } function getInstantiationExpressionType(exprType, node) { @@ -73553,7 +74005,7 @@ ${lanes.join("\n")} const result2 = getInstantiatedTypePart(type); hasSomeApplicableSignature || (hasSomeApplicableSignature = hasApplicableSignature); if (hasSignatures && !hasApplicableSignature) { - nonApplicableType != null ? nonApplicableType : nonApplicableType = type; + nonApplicableType ?? (nonApplicableType = type); } return result2; function getInstantiatedTypePart(type2) { @@ -73564,7 +74016,14 @@ ${lanes.join("\n")} hasSignatures || (hasSignatures = resolved.callSignatures.length !== 0 || resolved.constructSignatures.length !== 0); hasApplicableSignature || (hasApplicableSignature = callSignatures.length !== 0 || constructSignatures.length !== 0); if (callSignatures !== resolved.callSignatures || constructSignatures !== resolved.constructSignatures) { - const result3 = createAnonymousType(void 0, resolved.members, callSignatures, constructSignatures, resolved.indexInfos); + const result3 = createAnonymousType( + /*symbol*/ + void 0, + resolved.members, + callSignatures, + constructSignatures, + resolved.indexInfos + ); result3.objectFlags |= 8388608 /* InstantiationExpressionType */; result3.node = node; return result3; @@ -73608,24 +74067,25 @@ ${lanes.join("\n")} if (isErrorType(targetType)) { return targetType; } - checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, target, expression, Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); + const errorNode = findAncestor(target.parent, (n) => n.kind === 237 /* SatisfiesExpression */ || n.kind === 356 /* JSDocSatisfiesTag */); + checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, errorNode, expression, Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); return exprType; } function checkMetaProperty(node) { checkGrammarMetaProperty(node); - if (node.keywordToken === 103 /* NewKeyword */) { + if (node.keywordToken === 105 /* NewKeyword */) { return checkNewTargetMetaProperty(node); } - if (node.keywordToken === 100 /* ImportKeyword */) { + if (node.keywordToken === 102 /* ImportKeyword */) { return checkImportMetaProperty(node); } return Debug.assertNever(node.keywordToken); } function checkMetaPropertyKeyword(node) { switch (node.keywordToken) { - case 100 /* ImportKeyword */: + case 102 /* ImportKeyword */: return getGlobalImportMetaExpressionType(); - case 103 /* NewKeyword */: + case 105 /* NewKeyword */: const type = checkNewTargetMetaProperty(node); return isErrorType(type) ? errorType : createNewTargetExpressionType(type); default: @@ -73637,7 +74097,7 @@ ${lanes.join("\n")} if (!container) { error(node, 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 === 173 /* Constructor */) { + } else if (container.kind === 175 /* Constructor */) { const symbol = getSymbolOfDeclaration(container.parent); return getTypeOfSymbol(symbol); } else { @@ -73686,8 +74146,8 @@ ${lanes.join("\n")} return restParameter.escapedName; } function getParameterIdentifierNameAtPosition(signature, pos) { - var _a2; - if (((_a2 = signature.declaration) == null ? void 0 : _a2.kind) === 320 /* JSDocFunctionType */) { + var _a; + if (((_a = signature.declaration) == null ? void 0 : _a.kind) === 323 /* JSDocFunctionType */) { return void 0; } const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -73719,7 +74179,7 @@ ${lanes.join("\n")} return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name); } function isValidDeclarationForTupleLabel(d) { - return d.kind === 199 /* NamedTupleMember */ || isParameter(d) && d.name && isIdentifier(d.name); + return d.kind === 201 /* NamedTupleMember */ || isParameter(d) && d.name && isIdentifier(d.name); } function getNameableDeclarationAtPosition(signature, pos) { const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -73850,7 +74310,7 @@ ${lanes.join("\n")} } function getNonArrayRestType(signature) { const restType = getEffectiveRestType(signature); - return restType && !isArrayType(restType) && !isTypeAny(restType) && (getReducedType(restType).flags & 131072 /* Never */) === 0 ? restType : void 0; + return restType && !isArrayType(restType) && !isTypeAny(restType) ? restType : void 0; } function getTypeOfFirstParameterOfSignature(signature) { return getTypeOfFirstParameterOfSignatureWithFallback(signature, neverType); @@ -73924,7 +74384,7 @@ ${lanes.join("\n")} /*reportErrors*/ true ) : getTypeOfSymbol(parameter)); - if (declaration && declaration.name.kind !== 79 /* Identifier */) { + if (declaration && declaration.name.kind !== 80 /* Identifier */) { if (links.type === unknownType) { links.type = getTypeFromBindingPattern(declaration.name); } @@ -73938,7 +74398,7 @@ ${lanes.join("\n")} for (const element of pattern.elements) { if (!isOmittedExpression(element)) { const type = getBindingElementTypeFromParentType(element, parentType); - if (element.name.kind === 79 /* Identifier */) { + if (element.name.kind === 80 /* Identifier */) { getSymbolLinks(getSymbolOfDeclaration(element)).type = type; } else { assignBindingElementTypes(element.name, type); @@ -74012,13 +74472,13 @@ ${lanes.join("\n")} } function createClassAccessorDecoratorTargetType(thisType, valueType) { return tryCreateTypeReference(getGlobalClassAccessorDecoratorTargetType( - /*reportError*/ + /*reportErrors*/ true ), [thisType, valueType]); } function createClassAccessorDecoratorResultType(thisType, valueType) { return tryCreateTypeReference(getGlobalClassAccessorDecoratorResultType( - /*reportError*/ + /*reportErrors*/ true ), [thisType, valueType]); } @@ -74055,17 +74515,17 @@ ${lanes.join("\n")} if (!links.decoratorSignature) { links.decoratorSignature = anySignature; switch (parent2.kind) { - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: { + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: { const node = parent2; const targetType = getTypeOfSymbol(getSymbolOfDeclaration(node)); const contextType = createClassDecoratorContextType(targetType); links.decoratorSignature = createESDecoratorCallSignature(targetType, contextType, targetType); break; } - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: { + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: { const node = parent2; if (!isClassLike(node.parent)) break; @@ -74077,7 +74537,7 @@ ${lanes.join("\n")} links.decoratorSignature = createESDecoratorCallSignature(targetType, contextType, returnType); break; } - case 169 /* PropertyDeclaration */: { + case 171 /* PropertyDeclaration */: { const node = parent2; if (!isClassLike(node.parent)) break; @@ -74099,8 +74559,8 @@ ${lanes.join("\n")} if (!links.decoratorSignature) { links.decoratorSignature = anySignature; switch (parent2.kind) { - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: { + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: { const node = parent2; const targetType = getTypeOfSymbol(getSymbolOfDeclaration(node)); const targetParam = createParameter("target", targetType); @@ -74114,7 +74574,7 @@ ${lanes.join("\n")} ); break; } - case 166 /* Parameter */: { + case 168 /* Parameter */: { const node = parent2; if (!isConstructorDeclaration(node.parent) && !(isMethodDeclaration(node.parent) || isSetAccessorDeclaration(node.parent) && isClassLike(node.parent.parent))) { break; @@ -74140,10 +74600,10 @@ ${lanes.join("\n")} ); break; } - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 169 /* PropertyDeclaration */: { + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 171 /* PropertyDeclaration */: { const node = parent2; if (!isClassLike(node.parent)) break; @@ -74238,7 +74698,7 @@ ${lanes.join("\n")} let yieldType; let nextType; let fallbackReturnType = voidType; - if (func.body.kind !== 238 /* Block */) { + if (func.body.kind !== 240 /* Block */) { returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* SkipGenericFunctions */); if (isAsync) { returnType = unwrapAwaitedType(checkAwaitedType( @@ -74266,7 +74726,16 @@ ${lanes.join("\n")} return functionFlags & 2 /* Async */ ? createPromiseReturnType(func, neverType) : neverType; } if (types.length === 0) { - return functionFlags & 2 /* Async */ ? createPromiseReturnType(func, voidType) : voidType; + const contextualReturnType = getContextualReturnType( + func, + /*contextFlags*/ + void 0 + ); + const returnType2 = contextualReturnType && (unwrapReturnType(contextualReturnType, functionFlags) || voidType).flags & 32768 /* Undefined */ ? undefinedType : voidType; + return functionFlags & 2 /* Async */ ? createPromiseReturnType(func, returnType2) : ( + // Async function + returnType2 + ); } returnType = getUnionType(types, 2 /* Subtype */); } @@ -74412,7 +74881,7 @@ ${lanes.join("\n")} return links.isExhaustive; } function computeExhaustiveSwitchStatement(node) { - if (node.expression.kind === 218 /* TypeOfExpression */) { + if (node.expression.kind === 220 /* TypeOfExpression */) { const witnesses = getSwitchClauseTypeOfWitnesses(node); if (!witnesses) { return false; @@ -74445,6 +74914,10 @@ ${lanes.join("\n")} forEachReturnStatement(func.body, (returnStatement) => { const expr = returnStatement.expression; if (expr) { + if (expr.kind === 212 /* CallExpression */ && expr.expression.kind === 80 /* Identifier */ && checkExpressionCached(expr.expression).symbol === func.symbol) { + hasReturnOfTypeNever = true; + return; + } let type = checkExpressionCached(expr, checkMode && checkMode & ~8 /* SkipGenericFunctions */); if (functionFlags & 2 /* Async */) { type = unwrapAwaitedType(checkAwaitedType( @@ -74473,11 +74946,11 @@ ${lanes.join("\n")} } function mayReturnNever(func) { switch (func.kind) { - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: return true; - case 171 /* MethodDeclaration */: - return func.parent.kind === 207 /* ObjectLiteralExpression */; + case 173 /* MethodDeclaration */: + return func.parent.kind === 209 /* ObjectLiteralExpression */; default: return false; } @@ -74488,10 +74961,10 @@ ${lanes.join("\n")} function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() { const functionFlags = getFunctionFlags(func); const type = returnType && unwrapReturnType(returnType, functionFlags); - if (type && maybeTypeOfKind(type, 1 /* Any */ | 16384 /* Void */)) { + if (type && (maybeTypeOfKind(type, 16384 /* Void */) || type.flags & (1 /* Any */ | 32768 /* Undefined */))) { return; } - if (func.kind === 170 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 238 /* Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 172 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 240 /* Block */ || !functionHasImplicitReturn(func)) { return; } const hasExplicitReturn = func.flags & 512 /* HasExplicitReturn */; @@ -74499,7 +74972,7 @@ ${lanes.join("\n")} if (type && type.flags & 131072 /* Never */) { error(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point); } else if (type && !hasExplicitReturn) { - error(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value); + error(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value); } else if (type && strictNullChecks && !isTypeAssignableTo(undefinedType, type)) { error(errorNode, Diagnostics.Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined); } else if (compilerOptions.noImplicitReturns) { @@ -74508,7 +74981,7 @@ ${lanes.join("\n")} return; } const inferredReturnType = getReturnTypeOfSignature(getSignatureFromDeclaration(func)); - if (isUnwrappedReturnTypeVoidOrAny(func, inferredReturnType)) { + if (isUnwrappedReturnTypeUndefinedVoidOrAny(func, inferredReturnType)) { return; } } @@ -74517,7 +74990,7 @@ ${lanes.join("\n")} } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - Debug.assert(node.kind !== 171 /* MethodDeclaration */ || isObjectLiteralMethod(node)); + Debug.assert(node.kind !== 173 /* MethodDeclaration */ || isObjectLiteralMethod(node)); checkNodeDeferred(node); if (isFunctionExpression(node)) { checkCollisionsForDeclarationName(node, node.name); @@ -74532,15 +75005,18 @@ ${lanes.join("\n")} } const returnType = getReturnTypeFromBody(node, checkMode); const returnOnlySignature = createSignature( + /*declaration*/ void 0, + /*typeParameters*/ void 0, + /*thisParameter*/ void 0, emptyArray, returnType, /*resolvedTypePredicate*/ void 0, 0, - 0 /* None */ + 64 /* IsNonInferrable */ ); const returnOnlyType = createAnonymousType(node.symbol, emptySymbols, [returnOnlySignature], emptyArray, emptyArray); returnOnlyType.objectFlags |= 262144 /* NonInferrableType */; @@ -74550,7 +75026,7 @@ ${lanes.join("\n")} return anyFunctionType; } const hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 215 /* FunctionExpression */) { + if (!hasGrammarError && node.kind === 217 /* FunctionExpression */) { checkGrammarForGenerator(node); } contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -74582,6 +75058,11 @@ ${lanes.join("\n")} } else { assignNonContextualParameterTypes(signature); } + } else if (contextualSignature && !node.typeParameters && contextualSignature.parameters.length > node.parameters.length) { + const inferenceContext = getInferenceContext(node); + if (checkMode && checkMode & 2 /* Inferential */) { + inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext); + } } if (contextualSignature && !getReturnTypeFromAnnotation(node) && !signature.resolvedReturnType) { const returnType = getReturnTypeFromBody(node, checkMode); @@ -74594,7 +75075,7 @@ ${lanes.join("\n")} } } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - Debug.assert(node.kind !== 171 /* MethodDeclaration */ || isObjectLiteralMethod(node)); + Debug.assert(node.kind !== 173 /* MethodDeclaration */ || isObjectLiteralMethod(node)); const functionFlags = getFunctionFlags(node); const returnType = getReturnTypeFromAnnotation(node); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); @@ -74602,7 +75083,7 @@ ${lanes.join("\n")} if (!getEffectiveReturnTypeNode(node)) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 238 /* Block */) { + if (node.body.kind === 240 /* Block */) { checkSourceElement(node.body); } else { const exprType = checkExpression(node.body); @@ -74667,21 +75148,21 @@ ${lanes.join("\n")} return !!(getCheckFlags(symbol) & 8 /* Readonly */ || symbol.flags & 4 /* Property */ && getDeclarationModifierFlagsFromSymbol(symbol) & 64 /* Readonly */ || symbol.flags & 3 /* Variable */ && getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */ || symbol.flags & 98304 /* Accessor */ && !(symbol.flags & 65536 /* SetAccessor */) || symbol.flags & 8 /* EnumMember */ || some(symbol.declarations, isReadonlyAssignmentDeclaration)); } function isAssignmentToReadonlyEntity(expr, symbol, assignmentKind) { - var _a2, _b; + var _a, _b; if (assignmentKind === 0 /* None */) { return false; } if (isReadonlySymbol(symbol)) { - if (symbol.flags & 4 /* Property */ && isAccessExpression(expr) && expr.expression.kind === 108 /* ThisKeyword */) { + if (symbol.flags & 4 /* Property */ && isAccessExpression(expr) && expr.expression.kind === 110 /* ThisKeyword */) { const ctor = getContainingFunction(expr); - if (!(ctor && (ctor.kind === 173 /* Constructor */ || isJSConstructor(ctor)))) { + if (!(ctor && (ctor.kind === 175 /* Constructor */ || isJSConstructor(ctor)))) { return true; } if (symbol.valueDeclaration) { const isAssignmentDeclaration2 = isBinaryExpression(symbol.valueDeclaration); const isLocalPropertyDeclaration = ctor.parent === symbol.valueDeclaration.parent; const isLocalParameterProperty = ctor === symbol.valueDeclaration.parent; - const isLocalThisPropertyAssignment = isAssignmentDeclaration2 && ((_a2 = symbol.parent) == null ? void 0 : _a2.valueDeclaration) === ctor.parent; + const isLocalThisPropertyAssignment = isAssignmentDeclaration2 && ((_a = symbol.parent) == null ? void 0 : _a.valueDeclaration) === ctor.parent; const isLocalThisPropertyAssignmentConstructorFunction = isAssignmentDeclaration2 && ((_b = symbol.parent) == null ? void 0 : _b.valueDeclaration) === ctor; const isWriteableSymbol = isLocalPropertyDeclaration || isLocalParameterProperty || isLocalThisPropertyAssignment || isLocalThisPropertyAssignmentConstructorFunction; return !isWriteableSymbol; @@ -74691,11 +75172,11 @@ ${lanes.join("\n")} } if (isAccessExpression(expr)) { const node = skipParentheses(expr.expression); - if (node.kind === 79 /* Identifier */) { + if (node.kind === 80 /* Identifier */) { const symbol2 = getNodeLinks(node).resolvedSymbol; if (symbol2.flags & 2097152 /* Alias */) { const declaration = getDeclarationOfAliasSymbol(symbol2); - return !!declaration && declaration.kind === 271 /* NamespaceImport */; + return !!declaration && declaration.kind === 273 /* NamespaceImport */; } } } @@ -74703,7 +75184,7 @@ ${lanes.join("\n")} } function checkReferenceExpression(expr, invalidReferenceMessage, invalidOptionalChainMessage) { const node = skipOuterExpressions(expr, 6 /* Assertions */ | 1 /* Parentheses */); - if (node.kind !== 79 /* Identifier */ && !isAccessExpression(node)) { + if (node.kind !== 80 /* Identifier */ && !isAccessExpression(node)) { error(expr, invalidReferenceMessage); return false; } @@ -74757,7 +75238,7 @@ ${lanes.join("\n")} if (!hasParseDiagnostics(sourceFile)) { let span; if (!isEffectiveExternalModule(sourceFile, compilerOptions)) { - span != null ? span : span = getSpanOfTokenAtPosition(sourceFile, node.pos); + span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos)); const diagnostic = createFileDiagnostic( sourceFile, span.start, @@ -74770,7 +75251,7 @@ ${lanes.join("\n")} case 100 /* Node16 */: case 199 /* NodeNext */: if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) { - span != null ? span : span = getSpanOfTokenAtPosition(sourceFile, node.pos); + span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos)); diagnostics.add( createFileDiagnostic(sourceFile, span.start, span.length, Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level) ); @@ -74783,7 +75264,7 @@ ${lanes.join("\n")} break; } default: - span != null ? span : span = getSpanOfTokenAtPosition(sourceFile, node.pos); + span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos)); diagnostics.add( createFileDiagnostic( sourceFile, @@ -74800,7 +75281,7 @@ ${lanes.join("\n")} if (!hasParseDiagnostics(sourceFile)) { const span = getSpanOfTokenAtPosition(sourceFile, node.pos); const diagnostic = createFileDiagnostic(sourceFile, span.start, span.length, Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - if (container && container.kind !== 173 /* Constructor */ && (getFunctionFlags(container) & 2 /* Async */) === 0) { + if (container && container.kind !== 175 /* Constructor */ && (getFunctionFlags(container) & 2 /* Async */) === 0) { const relatedInfo = createDiagnosticForNode(container, Diagnostics.Did_you_mean_to_mark_this_function_as_async); addRelatedInfo(diagnostic, relatedInfo); } @@ -74837,16 +75318,16 @@ ${lanes.join("\n")} return silentNeverType; } switch (node.operand.kind) { - case 8 /* NumericLiteral */: + case 9 /* NumericLiteral */: switch (node.operator) { - case 40 /* MinusToken */: + case 41 /* MinusToken */: return getFreshTypeOfLiteralType(getNumberLiteralType(-node.operand.text)); - case 39 /* PlusToken */: + case 40 /* PlusToken */: return getFreshTypeOfLiteralType(getNumberLiteralType(+node.operand.text)); } break; - case 9 /* BigIntLiteral */: - if (node.operator === 40 /* MinusToken */) { + case 10 /* BigIntLiteral */: + if (node.operator === 41 /* MinusToken */) { return getFreshTypeOfLiteralType(getBigIntLiteralType({ negative: true, base10Value: parsePseudoBigInt(node.operand.text) @@ -74854,26 +75335,26 @@ ${lanes.join("\n")} } } switch (node.operator) { - case 39 /* PlusToken */: - case 40 /* MinusToken */: - case 54 /* TildeToken */: + case 40 /* PlusToken */: + case 41 /* MinusToken */: + case 55 /* TildeToken */: checkNonNullType(operandType, node.operand); if (maybeTypeOfKindConsideringBaseConstraint(operandType, 12288 /* ESSymbolLike */)) { error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator)); } - if (node.operator === 39 /* PlusToken */) { + if (node.operator === 40 /* PlusToken */) { if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112 /* BigIntLike */)) { error(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType))); } return numberType; } return getUnaryResultType(operandType); - case 53 /* ExclamationToken */: - checkTruthinessExpression(node.operand); + case 54 /* ExclamationToken */: + checkTruthinessOfType(operandType, node.operand); const facts = getTypeFacts(operandType) & (4194304 /* Truthy */ | 8388608 /* Falsy */); return facts === 4194304 /* Truthy */ ? falseType : facts === 8388608 /* Falsy */ ? trueType : booleanType; - case 45 /* PlusPlusToken */: - case 46 /* MinusMinusToken */: + case 46 /* PlusPlusToken */: + case 47 /* MinusMinusToken */: const ok = checkArithmeticOperandType( node.operand, checkNonNullType(operandType, node.operand), @@ -74958,7 +75439,7 @@ ${lanes.join("\n")} if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) { + if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) { error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) { @@ -75009,7 +75490,7 @@ ${lanes.join("\n")} function checkObjectLiteralDestructuringPropertyAssignment(node, objectLiteralType, propertyIndex, allProperties, rightIsThis = false) { const properties = node.properties; const property = properties[propertyIndex]; - if (property.kind === 299 /* PropertyAssignment */ || property.kind === 300 /* ShorthandPropertyAssignment */) { + if (property.kind === 302 /* PropertyAssignment */ || property.kind === 303 /* ShorthandPropertyAssignment */) { const name = property.name; const exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -75030,8 +75511,8 @@ ${lanes.join("\n")} } const elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* ExpressionPosition */, name); const type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 300 /* ShorthandPropertyAssignment */ ? property : property.initializer, type); - } else if (property.kind === 301 /* SpreadAssignment */) { + return checkDestructuringAssignment(property.kind === 303 /* ShorthandPropertyAssignment */ ? property : property.initializer, type); + } else if (property.kind === 304 /* SpreadAssignment */) { if (propertyIndex < properties.length - 1) { error(property, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } else { @@ -75063,8 +75544,8 @@ ${lanes.join("\n")} let inBoundsType = compilerOptions.noUncheckedIndexedAccess ? void 0 : possiblyOutOfBoundsType; for (let i = 0; i < elements.length; i++) { let type = possiblyOutOfBoundsType; - if (node.elements[i].kind === 227 /* SpreadElement */) { - type = inBoundsType = inBoundsType != null ? inBoundsType : checkIteratedTypeOrElementType(65 /* Destructuring */, sourceType, undefinedType, node) || errorType; + if (node.elements[i].kind === 229 /* SpreadElement */) { + type = inBoundsType = inBoundsType ?? (checkIteratedTypeOrElementType(65 /* Destructuring */, sourceType, undefinedType, node) || errorType); } checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); } @@ -75073,8 +75554,8 @@ ${lanes.join("\n")} function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { const elements = node.elements; const element = elements[elementIndex]; - if (element.kind !== 229 /* OmittedExpression */) { - if (element.kind !== 227 /* SpreadElement */) { + if (element.kind !== 231 /* OmittedExpression */) { + if (element.kind !== 229 /* SpreadElement */) { const indexType = getNumberLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { const accessFlags = 32 /* ExpressionPosition */ | (hasDefaultValue(element) ? 16 /* NoTupleBoundsCheck */ : 0); @@ -75089,7 +75570,7 @@ ${lanes.join("\n")} error(element, Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } else { const restExpression = element.expression; - if (restExpression.kind === 223 /* BinaryExpression */ && restExpression.operatorToken.kind === 63 /* EqualsToken */) { + if (restExpression.kind === 225 /* BinaryExpression */ && restExpression.operatorToken.kind === 64 /* EqualsToken */) { error(restExpression.operatorToken, Diagnostics.A_rest_element_cannot_have_an_initializer); } else { checkGrammarForDisallowedTrailingComma(node.elements, Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma); @@ -75102,7 +75583,7 @@ ${lanes.join("\n")} } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { let target; - if (exprOrAssignment.kind === 300 /* ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 303 /* ShorthandPropertyAssignment */) { const prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && !(getTypeFacts(checkExpression(prop.objectAssignmentInitializer)) & 16777216 /* IsUndefined */)) { @@ -75114,25 +75595,25 @@ ${lanes.join("\n")} } else { target = exprOrAssignment; } - if (target.kind === 223 /* BinaryExpression */ && target.operatorToken.kind === 63 /* EqualsToken */) { + if (target.kind === 225 /* BinaryExpression */ && target.operatorToken.kind === 64 /* EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; if (strictNullChecks) { sourceType = getTypeWithFacts(sourceType, 524288 /* NEUndefined */); } } - if (target.kind === 207 /* ObjectLiteralExpression */) { + if (target.kind === 209 /* ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 206 /* ArrayLiteralExpression */) { + if (target.kind === 208 /* ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { const targetType = checkExpression(target, checkMode); - const error2 = target.parent.kind === 301 /* SpreadAssignment */ ? Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - const optionalError = target.parent.kind === 301 /* SpreadAssignment */ ? Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; + const error2 = target.parent.kind === 304 /* SpreadAssignment */ ? Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; + const optionalError = target.parent.kind === 304 /* SpreadAssignment */ ? Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; if (checkReferenceExpression(target, error2, optionalError)) { checkTypeAssignableToAndOptionallyElaborate(sourceType, targetType, target, target); } @@ -75144,48 +75625,48 @@ ${lanes.join("\n")} function isSideEffectFree(node) { node = skipParentheses(node); switch (node.kind) { - case 79 /* Identifier */: - case 10 /* StringLiteral */: - case 13 /* RegularExpressionLiteral */: - case 212 /* TaggedTemplateExpression */: - case 225 /* TemplateExpression */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 8 /* NumericLiteral */: - case 9 /* BigIntLiteral */: - case 110 /* TrueKeyword */: - case 95 /* FalseKeyword */: - case 104 /* NullKeyword */: - case 155 /* UndefinedKeyword */: - case 215 /* FunctionExpression */: - case 228 /* ClassExpression */: - case 216 /* ArrowFunction */: - case 206 /* ArrayLiteralExpression */: - case 207 /* ObjectLiteralExpression */: - case 218 /* TypeOfExpression */: - case 232 /* NonNullExpression */: - case 282 /* JsxSelfClosingElement */: - case 281 /* JsxElement */: + case 80 /* Identifier */: + case 11 /* StringLiteral */: + case 14 /* RegularExpressionLiteral */: + case 214 /* TaggedTemplateExpression */: + case 227 /* TemplateExpression */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 9 /* NumericLiteral */: + case 10 /* BigIntLiteral */: + case 112 /* TrueKeyword */: + case 97 /* FalseKeyword */: + case 106 /* NullKeyword */: + case 157 /* UndefinedKeyword */: + case 217 /* FunctionExpression */: + case 230 /* ClassExpression */: + case 218 /* ArrowFunction */: + case 208 /* ArrayLiteralExpression */: + case 209 /* ObjectLiteralExpression */: + case 220 /* TypeOfExpression */: + case 234 /* NonNullExpression */: + case 284 /* JsxSelfClosingElement */: + case 283 /* JsxElement */: return true; - case 224 /* ConditionalExpression */: + case 226 /* ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: if (isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 221 /* PrefixUnaryExpression */: - case 222 /* PostfixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: switch (node.operator) { - case 53 /* ExclamationToken */: - case 39 /* PlusToken */: - case 40 /* MinusToken */: - case 54 /* TildeToken */: + case 54 /* ExclamationToken */: + case 40 /* PlusToken */: + case 41 /* MinusToken */: + case 55 /* TildeToken */: return true; } return false; - case 219 /* VoidExpression */: - case 213 /* TypeAssertionExpression */: - case 231 /* AsExpression */: + case 221 /* VoidExpression */: + case 215 /* TypeAssertionExpression */: + case 233 /* AsExpression */: default: return false; } @@ -75229,9 +75710,9 @@ ${lanes.join("\n")} } checkGrammarNullishCoalesceWithLogicalExpression(node); const operator = node.operatorToken.kind; - if (operator === 63 /* EqualsToken */ && (node.left.kind === 207 /* ObjectLiteralExpression */ || node.left.kind === 206 /* ArrayLiteralExpression */)) { + if (operator === 64 /* EqualsToken */ && (node.left.kind === 209 /* ObjectLiteralExpression */ || node.left.kind === 208 /* ArrayLiteralExpression */)) { state.skip = true; - setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 108 /* ThisKeyword */)); + setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 110 /* ThisKeyword */)); return state; } return state; @@ -75254,10 +75735,10 @@ ${lanes.join("\n")} const operator = operatorToken.kind; if (isLogicalOrCoalescingBinaryOperator(operator)) { let parent2 = node.parent; - while (parent2.kind === 214 /* ParenthesizedExpression */ || isLogicalOrCoalescingBinaryExpression(parent2)) { + while (parent2.kind === 216 /* ParenthesizedExpression */ || isLogicalOrCoalescingBinaryExpression(parent2)) { parent2 = parent2.parent; } - if (operator === 55 /* AmpersandAmpersandToken */ || isIfStatement(parent2)) { + if (operator === 56 /* AmpersandAmpersandToken */ || isIfStatement(parent2)) { checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, isIfStatement(parent2) ? parent2.thenStatement : void 0); } checkTruthinessOfType(leftType, node.left); @@ -75319,19 +75800,19 @@ ${lanes.join("\n")} } function checkGrammarNullishCoalesceWithLogicalExpression(node) { const { left, operatorToken, right } = node; - if (operatorToken.kind === 60 /* QuestionQuestionToken */) { - if (isBinaryExpression(left) && (left.operatorToken.kind === 56 /* BarBarToken */ || left.operatorToken.kind === 55 /* AmpersandAmpersandToken */)) { + if (operatorToken.kind === 61 /* QuestionQuestionToken */) { + if (isBinaryExpression(left) && (left.operatorToken.kind === 57 /* BarBarToken */ || left.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) { grammarErrorOnNode(left, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(left.operatorToken.kind), tokenToString(operatorToken.kind)); } - if (isBinaryExpression(right) && (right.operatorToken.kind === 56 /* BarBarToken */ || right.operatorToken.kind === 55 /* AmpersandAmpersandToken */)) { + if (isBinaryExpression(right) && (right.operatorToken.kind === 57 /* BarBarToken */ || right.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) { grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind)); } } } function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { const operator = operatorToken.kind; - if (operator === 63 /* EqualsToken */ && (left.kind === 207 /* ObjectLiteralExpression */ || left.kind === 206 /* ArrayLiteralExpression */)) { - return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 108 /* ThisKeyword */); + if (operator === 64 /* EqualsToken */ && (left.kind === 209 /* ObjectLiteralExpression */ || left.kind === 208 /* ArrayLiteralExpression */)) { + return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 110 /* ThisKeyword */); } let leftType; if (isLogicalOrCoalescingBinaryOperator(operator)) { @@ -75345,28 +75826,28 @@ ${lanes.join("\n")} function checkBinaryLikeExpressionWorker(left, operatorToken, right, leftType, rightType, errorNode) { const operator = operatorToken.kind; switch (operator) { - case 41 /* AsteriskToken */: - case 42 /* AsteriskAsteriskToken */: - case 66 /* AsteriskEqualsToken */: - case 67 /* AsteriskAsteriskEqualsToken */: - case 43 /* SlashToken */: - case 68 /* SlashEqualsToken */: - case 44 /* PercentToken */: - case 69 /* PercentEqualsToken */: - case 40 /* MinusToken */: - case 65 /* MinusEqualsToken */: - case 47 /* LessThanLessThanToken */: - case 70 /* LessThanLessThanEqualsToken */: - case 48 /* GreaterThanGreaterThanToken */: - case 71 /* GreaterThanGreaterThanEqualsToken */: - case 49 /* GreaterThanGreaterThanGreaterThanToken */: - case 72 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 51 /* BarToken */: - case 74 /* BarEqualsToken */: - case 52 /* CaretToken */: - case 78 /* CaretEqualsToken */: - case 50 /* AmpersandToken */: - case 73 /* AmpersandEqualsToken */: + case 42 /* AsteriskToken */: + case 43 /* AsteriskAsteriskToken */: + case 67 /* AsteriskEqualsToken */: + case 68 /* AsteriskAsteriskEqualsToken */: + case 44 /* SlashToken */: + case 69 /* SlashEqualsToken */: + case 45 /* PercentToken */: + case 70 /* PercentEqualsToken */: + case 41 /* MinusToken */: + case 66 /* MinusEqualsToken */: + case 48 /* LessThanLessThanToken */: + case 71 /* LessThanLessThanEqualsToken */: + case 49 /* GreaterThanGreaterThanToken */: + case 72 /* GreaterThanGreaterThanEqualsToken */: + case 50 /* GreaterThanGreaterThanGreaterThanToken */: + case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 52 /* BarToken */: + case 75 /* BarEqualsToken */: + case 53 /* CaretToken */: + case 79 /* CaretEqualsToken */: + case 51 /* AmpersandToken */: + case 74 /* AmpersandEqualsToken */: if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } @@ -75397,12 +75878,12 @@ ${lanes.join("\n")} resultType2 = numberType; } else if (bothAreBigIntLike(leftType, rightType)) { switch (operator) { - case 49 /* GreaterThanGreaterThanGreaterThanToken */: - case 72 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 50 /* GreaterThanGreaterThanGreaterThanToken */: + case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */: reportOperatorError(); break; - case 42 /* AsteriskAsteriskToken */: - case 67 /* AsteriskAsteriskEqualsToken */: + case 43 /* AsteriskAsteriskToken */: + case 68 /* AsteriskAsteriskEqualsToken */: if (languageVersion < 3 /* ES2016 */) { error(errorNode, Diagnostics.Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_later); } @@ -75417,8 +75898,8 @@ ${lanes.join("\n")} } return resultType2; } - case 39 /* PlusToken */: - case 64 /* PlusEqualsToken */: + case 40 /* PlusToken */: + case 65 /* PlusEqualsToken */: if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } @@ -75474,14 +75955,14 @@ ${lanes.join("\n")} reportOperatorError((left2, right2) => isTypeAssignableToKind(left2, closeEnoughKind) && isTypeAssignableToKind(right2, closeEnoughKind)); return anyType; } - if (operator === 64 /* PlusEqualsToken */) { + if (operator === 65 /* PlusEqualsToken */) { checkAssignmentOperator(resultType); } return resultType; - case 29 /* LessThanToken */: - case 31 /* GreaterThanToken */: - case 32 /* LessThanEqualsToken */: - case 33 /* GreaterThanEqualsToken */: + case 30 /* LessThanToken */: + case 32 /* GreaterThanToken */: + case 33 /* LessThanEqualsToken */: + case 34 /* GreaterThanEqualsToken */: if (checkForDisallowedESSymbolOperand(operator)) { leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left)); rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right)); @@ -75495,46 +75976,46 @@ ${lanes.join("\n")} }); } return booleanType; - case 34 /* EqualsEqualsToken */: - case 35 /* ExclamationEqualsToken */: - case 36 /* EqualsEqualsEqualsToken */: - case 37 /* ExclamationEqualsEqualsToken */: + case 35 /* EqualsEqualsToken */: + case 36 /* ExclamationEqualsToken */: + case 37 /* EqualsEqualsEqualsToken */: + case 38 /* ExclamationEqualsEqualsToken */: if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) { - const eqType = operator === 34 /* EqualsEqualsToken */ || operator === 36 /* EqualsEqualsEqualsToken */; + const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */; error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); } checkNaNEquality(errorNode, operator, left, right); reportOperatorErrorUnless((left2, right2) => isTypeEqualityComparableTo(left2, right2) || isTypeEqualityComparableTo(right2, left2)); return booleanType; - case 102 /* InstanceOfKeyword */: + case 104 /* InstanceOfKeyword */: return checkInstanceOfExpression(left, right, leftType, rightType); - case 101 /* InKeyword */: + case 103 /* InKeyword */: return checkInExpression(left, right, leftType, rightType); - case 55 /* AmpersandAmpersandToken */: - case 76 /* AmpersandAmpersandEqualsToken */: { + case 56 /* AmpersandAmpersandToken */: + case 77 /* AmpersandAmpersandEqualsToken */: { const resultType2 = getTypeFacts(leftType) & 4194304 /* Truthy */ ? getUnionType([extractDefinitelyFalsyTypes(strictNullChecks ? leftType : getBaseTypeOfLiteralType(rightType)), rightType]) : leftType; - if (operator === 76 /* AmpersandAmpersandEqualsToken */) { + if (operator === 77 /* AmpersandAmpersandEqualsToken */) { checkAssignmentOperator(rightType); } return resultType2; } - case 56 /* BarBarToken */: - case 75 /* BarBarEqualsToken */: { + case 57 /* BarBarToken */: + case 76 /* BarBarEqualsToken */: { const resultType2 = getTypeFacts(leftType) & 8388608 /* Falsy */ ? getUnionType([getNonNullableType(removeDefinitelyFalsyTypes(leftType)), rightType], 2 /* Subtype */) : leftType; - if (operator === 75 /* BarBarEqualsToken */) { + if (operator === 76 /* BarBarEqualsToken */) { checkAssignmentOperator(rightType); } return resultType2; } - case 60 /* QuestionQuestionToken */: - case 77 /* QuestionQuestionEqualsToken */: { + case 61 /* QuestionQuestionToken */: + case 78 /* QuestionQuestionEqualsToken */: { const resultType2 = getTypeFacts(leftType) & 262144 /* EQUndefinedOrNull */ ? getUnionType([getNonNullableType(leftType), rightType], 2 /* Subtype */) : leftType; - if (operator === 77 /* QuestionQuestionEqualsToken */) { + if (operator === 78 /* QuestionQuestionEqualsToken */) { checkAssignmentOperator(rightType); } return resultType2; } - case 63 /* EqualsToken */: + case 64 /* EqualsToken */: const declKind = isBinaryExpression(left.parent) ? getAssignmentDeclarationKind(left.parent) : 0 /* None */; checkAssignmentDeclaration(declKind, rightType); if (isAssignmentDeclaration2(declKind)) { @@ -75546,7 +76027,7 @@ ${lanes.join("\n")} checkAssignmentOperator(rightType); return rightType; } - case 27 /* CommaToken */: + case 28 /* CommaToken */: if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) { const sf = getSourceFileOfNode(left); const sourceText = sf.text; @@ -75576,6 +76057,7 @@ ${lanes.join("\n")} prop.valueDeclaration, name, 788968 /* Type */, + /*nameNotFoundMessage*/ void 0, name, /*isUse*/ @@ -75590,7 +76072,7 @@ ${lanes.join("\n")} } } function isIndirectCall(node) { - return node.parent.kind === 214 /* ParenthesizedExpression */ && isNumericLiteral(node.left) && node.left.text === "0" && (isCallExpression(node.parent.parent) && node.parent.parent.expression === node.parent || node.parent.parent.kind === 212 /* TaggedTemplateExpression */) && // special-case for "eval" because it's the only non-access case where an indirect call actually affects behavior. + return node.parent.kind === 216 /* ParenthesizedExpression */ && isNumericLiteral(node.left) && node.left.text === "0" && (isCallExpression(node.parent.parent) && node.parent.parent.expression === node.parent || node.parent.parent.kind === 214 /* TaggedTemplateExpression */) && // special-case for "eval" because it's the only non-access case where an indirect call actually affects behavior. (isAccessExpression(node.right) || isIdentifier(node.right) && node.right.escapedText === "eval"); } function checkForDisallowedESSymbolOperand(operator2) { @@ -75603,15 +76085,15 @@ ${lanes.join("\n")} } function getSuggestedBooleanOperator(operator2) { switch (operator2) { - case 51 /* BarToken */: - case 74 /* BarEqualsToken */: - return 56 /* BarBarToken */; - case 52 /* CaretToken */: - case 78 /* CaretEqualsToken */: - return 37 /* ExclamationEqualsEqualsToken */; - case 50 /* AmpersandToken */: - case 73 /* AmpersandEqualsToken */: - return 55 /* AmpersandAmpersandToken */; + case 52 /* BarToken */: + case 75 /* BarEqualsToken */: + return 57 /* BarBarToken */; + case 53 /* CaretToken */: + case 79 /* CaretEqualsToken */: + return 38 /* ExclamationEqualsEqualsToken */; + case 51 /* AmpersandToken */: + case 74 /* AmpersandEqualsToken */: + return 56 /* AmpersandAmpersandToken */; default: return void 0; } @@ -75621,6 +76103,16 @@ ${lanes.join("\n")} addLazyDiagnostic(checkAssignmentOperatorWorker); } function checkAssignmentOperatorWorker() { + let assigneeType = leftType; + if (isCompoundAssignment(operatorToken.kind) && left.kind === 210 /* PropertyAccessExpression */) { + assigneeType = checkPropertyAccessExpression( + left, + /*checkMode*/ + void 0, + /*writeOnly*/ + true + ); + } if (checkReferenceExpression( left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access, @@ -75633,12 +76125,12 @@ ${lanes.join("\n")} headMessage = Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target; } } - checkTypeAssignableToAndOptionallyElaborate(valueType, leftType, left, right, headMessage); + checkTypeAssignableToAndOptionallyElaborate(valueType, assigneeType, left, right, headMessage); } } } function isAssignmentDeclaration2(kind) { - var _a2; + var _a; switch (kind) { case 2 /* ModuleExports */: return true; @@ -75649,7 +76141,7 @@ ${lanes.join("\n")} case 4 /* ThisProperty */: const symbol = getSymbolOfNode(left); const init = getAssignedExpandoInitializer(right); - return !!init && isObjectLiteralExpression(init) && !!((_a2 = symbol == null ? void 0 : symbol.exports) == null ? void 0 : _a2.size); + return !!init && isObjectLiteralExpression(init) && !!((_a = symbol == null ? void 0 : symbol.exports) == null ? void 0 : _a.size); default: return false; } @@ -75688,10 +76180,10 @@ ${lanes.join("\n")} } function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) { switch (operatorToken.kind) { - case 36 /* EqualsEqualsEqualsToken */: - case 34 /* EqualsEqualsToken */: - case 37 /* ExclamationEqualsEqualsToken */: - case 35 /* ExclamationEqualsToken */: + case 37 /* EqualsEqualsEqualsToken */: + case 35 /* EqualsEqualsToken */: + case 38 /* ExclamationEqualsEqualsToken */: + case 36 /* ExclamationEqualsToken */: return errorAndMaybeSuggestAwait( errNode, maybeMissingAwait, @@ -75710,11 +76202,11 @@ ${lanes.join("\n")} const err = error( errorNode2, Diagnostics.This_condition_will_always_return_0, - tokenToString(operator2 === 36 /* EqualsEqualsEqualsToken */ || operator2 === 34 /* EqualsEqualsToken */ ? 95 /* FalseKeyword */ : 110 /* TrueKeyword */) + tokenToString(operator2 === 37 /* EqualsEqualsEqualsToken */ || operator2 === 35 /* EqualsEqualsToken */ ? 97 /* FalseKeyword */ : 112 /* TrueKeyword */) ); if (isLeftNaN && isRightNaN) return; - const operatorString = operator2 === 37 /* ExclamationEqualsEqualsToken */ || operator2 === 35 /* ExclamationEqualsToken */ ? tokenToString(53 /* ExclamationToken */) : ""; + const operatorString = operator2 === 38 /* ExclamationEqualsEqualsToken */ || operator2 === 36 /* ExclamationEqualsToken */ ? tokenToString(54 /* ExclamationToken */) : ""; const location = isLeftNaN ? right2 : left2; const expression = skipParentheses(location); addRelatedInfo(err, createDiagnosticForNode( @@ -75885,7 +76377,7 @@ ${lanes.join("\n")} /*excludeJSDocTypeAssertions*/ true ); - return node.kind === 213 /* TypeAssertionExpression */ || node.kind === 231 /* AsExpression */ || isJSDocTypeAssertion(node); + return node.kind === 215 /* TypeAssertionExpression */ || node.kind === 233 /* AsExpression */ || isJSDocTypeAssertion(node); } function checkDeclarationInitializer(declaration, checkMode, contextualType) { const initializer = getEffectiveInitializer(declaration); @@ -75902,15 +76394,15 @@ ${lanes.join("\n")} void 0, checkMode || 0 /* Normal */ ) : checkExpressionCached(initializer, checkMode)); - return isParameter(declaration) && declaration.name.kind === 204 /* ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; + return isParameter(declaration) && declaration.name.kind === 206 /* ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; } function padTupleType(type, pattern) { const patternElements = pattern.elements; - const elementTypes = getTypeArguments(type).slice(); + const elementTypes = getElementTypes(type).slice(); const elementFlags = type.target.elementFlags.slice(); for (let i = getTypeReferenceArity(type); i < patternElements.length; i++) { const e = patternElements[i]; - if (i < patternElements.length - 1 || !(e.kind === 205 /* BindingElement */ && e.dotDotDotToken)) { + if (i < patternElements.length - 1 || !(e.kind === 207 /* BindingElement */ && e.dotDotDotToken)) { elementTypes.push(!isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement( e, /*includePatternInType*/ @@ -75955,11 +76447,7 @@ ${lanes.join("\n")} } function isConstContext(node) { const parent2 = node.parent; - return isAssertionExpression(parent2) && isConstTypeReference(parent2.type) || isJSDocTypeAssertion(parent2) && isConstTypeReference(getJSDocTypeAssertionType(parent2)) || isValidConstAssertionArgument(node) && isConstTypeParameterContext(node) || (isParenthesizedExpression(parent2) || isArrayLiteralExpression(parent2) || isSpreadElement(parent2)) && isConstContext(parent2) || (isPropertyAssignment(parent2) || isShorthandPropertyAssignment(parent2) || isTemplateSpan(parent2)) && isConstContext(parent2.parent); - } - function isConstTypeParameterContext(node) { - const contextualType = getContextualType2(node, 0 /* None */); - return !!contextualType && someType(contextualType, isConstTypeVariable); + return isAssertionExpression(parent2) && isConstTypeReference(parent2.type) || isJSDocTypeAssertion(parent2) && isConstTypeReference(getJSDocTypeAssertionType(parent2)) || isValidConstAssertionArgument(node) && isConstTypeVariable(getContextualType2(node, 0 /* None */)) || (isParenthesizedExpression(parent2) || isArrayLiteralExpression(parent2) || isSpreadElement(parent2)) && isConstContext(parent2) || (isPropertyAssignment(parent2) || isShorthandPropertyAssignment(parent2) || isTemplateSpan(parent2)) && isConstContext(parent2.parent); } function checkExpressionForMutableLocation(node, checkMode, forceTuple) { const type = checkExpression(node, checkMode, forceTuple); @@ -75975,14 +76463,14 @@ ${lanes.join("\n")} )); } function checkPropertyAssignment(node, checkMode) { - if (node.name.kind === 164 /* ComputedPropertyName */) { + if (node.name.kind === 166 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); } function checkObjectLiteralMethod(node, checkMode) { checkGrammarMethod(node); - if (node.name.kind === 164 /* ComputedPropertyName */) { + if (node.name.kind === 166 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } const uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -76170,9 +76658,9 @@ ${lanes.join("\n")} const type = getQuickTypeOfExpression(expr.expression); return type ? getAwaitedType(type) : void 0; } - if (isCallExpression(expr) && expr.expression.kind !== 106 /* SuperKeyword */ && !isRequireCall( + if (isCallExpression(expr) && expr.expression.kind !== 108 /* SuperKeyword */ && !isRequireCall( expr, - /*checkArgumentIsStringLiteralLike*/ + /*requireStringLiteralLikeArgument*/ true ) && !isSymbolOrSymbolForCall(expr)) { return isCallChain(expr) ? getReturnTypeOfSingleNonGenericSignatureOfCallChain(expr) : getReturnTypeOfSingleNonGenericCallSignature(checkNonNullExpression(expr.expression)); @@ -76199,8 +76687,8 @@ ${lanes.join("\n")} return type; } function checkExpression(node, checkMode, forceTuple) { - var _a2, _b; - (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Check, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath }); + var _a, _b; + (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Check, "checkExpression", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath }); const saveCurrentNode = currentNode; currentNode = node; instantiationCount = 0; @@ -76214,7 +76702,7 @@ ${lanes.join("\n")} return type; } function checkConstEnumAccess(node, type) { - const ok = node.parent.kind === 208 /* PropertyAccessExpression */ && node.parent.expression === node || node.parent.kind === 209 /* ElementAccessExpression */ && node.parent.expression === node || ((node.kind === 79 /* Identifier */ || node.kind === 163 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || node.parent.kind === 183 /* TypeQuery */ && node.parent.exprName === node) || node.parent.kind === 278 /* ExportSpecifier */; + const ok = node.parent.kind === 210 /* PropertyAccessExpression */ && node.parent.expression === node || node.parent.kind === 211 /* ElementAccessExpression */ && node.parent.expression === node || ((node.kind === 80 /* Identifier */ || node.kind === 165 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || node.parent.kind === 185 /* TypeQuery */ && node.parent.exprName === node) || node.parent.kind === 280 /* ExportSpecifier */; if (!ok) { error(node, 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); } @@ -76232,8 +76720,7 @@ ${lanes.join("\n")} return checkSatisfiesExpressionWorker(node.expression, getJSDocSatisfiesExpressionType(node), checkMode); } if (isJSDocTypeAssertion(node)) { - const type = getJSDocTypeAssertionType(node); - return checkAssertionWorker(type, type, node.expression, checkMode); + return checkAssertionWorker(node, checkMode); } } return checkExpression(node.expression, checkMode); @@ -76242,114 +76729,114 @@ ${lanes.join("\n")} const kind = node.kind; if (cancellationToken) { switch (kind) { - case 228 /* ClassExpression */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 230 /* ClassExpression */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } switch (kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return checkIdentifier(node, checkMode); - case 80 /* PrivateIdentifier */: + case 81 /* PrivateIdentifier */: return checkPrivateIdentifierExpression(node); - case 108 /* ThisKeyword */: + case 110 /* ThisKeyword */: return checkThisExpression(node); - case 106 /* SuperKeyword */: + case 108 /* SuperKeyword */: return checkSuperExpression(node); - case 104 /* NullKeyword */: + case 106 /* NullKeyword */: return nullWideningType; - case 14 /* NoSubstitutionTemplateLiteral */: - case 10 /* StringLiteral */: - return getFreshTypeOfLiteralType(getStringLiteralType(node.text)); - case 8 /* NumericLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 11 /* StringLiteral */: + return hasSkipDirectInferenceFlag(node) ? anyType : getFreshTypeOfLiteralType(getStringLiteralType(node.text)); + case 9 /* NumericLiteral */: checkGrammarNumericLiteral(node); return getFreshTypeOfLiteralType(getNumberLiteralType(+node.text)); - case 9 /* BigIntLiteral */: + case 10 /* BigIntLiteral */: checkGrammarBigIntLiteral(node); return getFreshTypeOfLiteralType(getBigIntLiteralType({ negative: false, base10Value: parsePseudoBigInt(node.text) })); - case 110 /* TrueKeyword */: + case 112 /* TrueKeyword */: return trueType; - case 95 /* FalseKeyword */: + case 97 /* FalseKeyword */: return falseType; - case 225 /* TemplateExpression */: + case 227 /* TemplateExpression */: return checkTemplateExpression(node); - case 13 /* RegularExpressionLiteral */: + case 14 /* RegularExpressionLiteral */: return globalRegExpType; - case 206 /* ArrayLiteralExpression */: + case 208 /* ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode, forceTuple); - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: return checkPropertyAccessExpression(node, checkMode); - case 163 /* QualifiedName */: + case 165 /* QualifiedName */: return checkQualifiedName(node, checkMode); - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: return checkIndexedAccess(node, checkMode); - case 210 /* CallExpression */: - if (node.expression.kind === 100 /* ImportKeyword */) { + case 212 /* CallExpression */: + if (node.expression.kind === 102 /* ImportKeyword */) { return checkImportCallExpression(node); } - case 211 /* NewExpression */: + case 213 /* NewExpression */: return checkCallExpression(node, checkMode); - case 212 /* TaggedTemplateExpression */: + case 214 /* TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: return checkClassExpression(node); - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 218 /* TypeOfExpression */: + case 220 /* TypeOfExpression */: return checkTypeOfExpression(node); - case 213 /* TypeAssertionExpression */: - case 231 /* AsExpression */: - return checkAssertion(node); - case 232 /* NonNullExpression */: + case 215 /* TypeAssertionExpression */: + case 233 /* AsExpression */: + return checkAssertion(node, checkMode); + case 234 /* NonNullExpression */: return checkNonNullAssertion(node); - case 230 /* ExpressionWithTypeArguments */: + case 232 /* ExpressionWithTypeArguments */: return checkExpressionWithTypeArguments(node); - case 235 /* SatisfiesExpression */: + case 237 /* SatisfiesExpression */: return checkSatisfiesExpression(node); - case 233 /* MetaProperty */: + case 235 /* MetaProperty */: return checkMetaProperty(node); - case 217 /* DeleteExpression */: + case 219 /* DeleteExpression */: return checkDeleteExpression(node); - case 219 /* VoidExpression */: + case 221 /* VoidExpression */: return checkVoidExpression(node); - case 220 /* AwaitExpression */: + case 222 /* AwaitExpression */: return checkAwaitExpression(node); - case 221 /* PrefixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 222 /* PostfixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 224 /* ConditionalExpression */: + case 226 /* ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 227 /* SpreadElement */: + case 229 /* SpreadElement */: return checkSpreadExpression(node, checkMode); - case 229 /* OmittedExpression */: + case 231 /* OmittedExpression */: return undefinedWideningType; - case 226 /* YieldExpression */: + case 228 /* YieldExpression */: return checkYieldExpression(node); - case 234 /* SyntheticExpression */: + case 236 /* SyntheticExpression */: return checkSyntheticExpression(node); - case 291 /* JsxExpression */: + case 293 /* JsxExpression */: return checkJsxExpression(node, checkMode); - case 281 /* JsxElement */: + case 283 /* JsxElement */: return checkJsxElement(node, checkMode); - case 282 /* JsxSelfClosingElement */: + case 284 /* JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 285 /* JsxFragment */: + case 287 /* JsxFragment */: return checkJsxFragment(node); - case 289 /* JsxAttributes */: + case 291 /* JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 283 /* JsxOpeningElement */: + case 285 /* JsxOpeningElement */: Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -76375,7 +76862,7 @@ ${lanes.join("\n")} addLazyDiagnostic(() => checkTypeNameIsReserved(node.name, Diagnostics.Type_parameter_name_cannot_be_0)); } function checkTypeParameterDeferred(node) { - var _a2, _b; + var _a, _b; if (isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent)) { const typeParameter = getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node)); const modifiers = getTypeParameterModifiers(typeParameter) & (32768 /* In */ | 65536 /* Out */); @@ -76384,7 +76871,7 @@ ${lanes.join("\n")} if (isTypeAliasDeclaration(node.parent) && !(getObjectFlags(getDeclaredTypeOfSymbol(symbol)) & (16 /* Anonymous */ | 32 /* Mapped */))) { error(node, Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types); } else if (modifiers === 32768 /* In */ || modifiers === 65536 /* Out */) { - (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) }); + (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.CheckTypes, "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) }); const source = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSubTypeForCheck : markerSuperTypeForCheck); const target = createMarkerType(symbol, typeParameter, modifiers === 65536 /* Out */ ? markerSuperTypeForCheck : markerSubTypeForCheck); const saveVarianceTypeParameter = typeParameter; @@ -76401,10 +76888,10 @@ ${lanes.join("\n")} checkVariableLikeDeclaration(node); const func = getContainingFunction(node); if (hasSyntacticModifier(node, 16476 /* ParameterPropertyModifier */)) { - if (!(func.kind === 173 /* Constructor */ && nodeIsPresent(func.body))) { + if (!(func.kind === 175 /* Constructor */ && nodeIsPresent(func.body))) { error(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 173 /* Constructor */ && isIdentifier(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 175 /* Constructor */ && isIdentifier(node.name) && node.name.escapedText === "constructor") { error(node.name, Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } @@ -76415,13 +76902,13 @@ ${lanes.join("\n")} if (func.parameters.indexOf(node) !== 0) { error(node, Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 173 /* Constructor */ || func.kind === 177 /* ConstructSignature */ || func.kind === 182 /* ConstructorType */) { + if (func.kind === 175 /* Constructor */ || func.kind === 179 /* ConstructSignature */ || func.kind === 184 /* ConstructorType */) { error(node, Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 216 /* ArrowFunction */) { + if (func.kind === 218 /* ArrowFunction */) { error(node, Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } - if (func.kind === 174 /* GetAccessor */ || func.kind === 175 /* SetAccessor */) { + if (func.kind === 176 /* GetAccessor */ || func.kind === 177 /* SetAccessor */) { error(node, Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); } } @@ -76481,13 +76968,13 @@ ${lanes.join("\n")} } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 216 /* ArrowFunction */: - case 176 /* CallSignature */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 181 /* FunctionType */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: + case 218 /* ArrowFunction */: + case 178 /* CallSignature */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 183 /* FunctionType */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: const parent2 = node.parent; if (node === parent2.type) { return parent2; @@ -76500,14 +76987,14 @@ ${lanes.join("\n")} continue; } const name = element.name; - if (name.kind === 79 /* Identifier */ && name.escapedText === predicateVariableName) { + if (name.kind === 80 /* Identifier */ && name.escapedText === predicateVariableName) { error( predicateVariableNode, Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName ); return true; - } else if (name.kind === 204 /* ArrayBindingPattern */ || name.kind === 203 /* ObjectBindingPattern */) { + } else if (name.kind === 206 /* ArrayBindingPattern */ || name.kind === 205 /* ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern( name, predicateVariableNode, @@ -76519,9 +77006,9 @@ ${lanes.join("\n")} } } function checkSignatureDeclaration(node) { - if (node.kind === 178 /* IndexSignature */) { + if (node.kind === 180 /* IndexSignature */) { checkGrammarIndexSignature(node); - } else if (node.kind === 181 /* FunctionType */ || node.kind === 259 /* FunctionDeclaration */ || node.kind === 182 /* ConstructorType */ || node.kind === 176 /* CallSignature */ || node.kind === 173 /* Constructor */ || node.kind === 177 /* ConstructSignature */) { + } else if (node.kind === 183 /* FunctionType */ || node.kind === 261 /* FunctionDeclaration */ || node.kind === 184 /* ConstructorType */ || node.kind === 178 /* CallSignature */ || node.kind === 175 /* Constructor */ || node.kind === 179 /* ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } const functionFlags = getFunctionFlags(node); @@ -76548,10 +77035,10 @@ ${lanes.join("\n")} const returnTypeNode = getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 177 /* ConstructSignature */: + case 179 /* ConstructSignature */: error(node, Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 176 /* CallSignature */: + case 178 /* CallSignature */: error(node, Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -76573,7 +77060,7 @@ ${lanes.join("\n")} checkAsyncFunctionReturnType(node, returnTypeNode); } } - if (node.kind !== 178 /* IndexSignature */ && node.kind !== 320 /* JSDocFunctionType */) { + if (node.kind !== 180 /* IndexSignature */ && node.kind !== 323 /* JSDocFunctionType */) { registerForUnusedIdentifiersCheck(node); } } @@ -76583,7 +77070,7 @@ ${lanes.join("\n")} const staticNames = /* @__PURE__ */ new Map(); const privateIdentifiers = /* @__PURE__ */ new Map(); for (const member of node.members) { - if (member.kind === 173 /* Constructor */) { + if (member.kind === 175 /* Constructor */) { for (const param of member.parameters) { if (isParameterPropertyDeclaration(param, member) && !isBindingPattern(param.name)) { addName(instanceNames, param.name, param.name.escapedText, 3 /* GetOrSetAccessor */); @@ -76601,16 +77088,16 @@ ${lanes.join("\n")} const memberName = name && getPropertyNameForPropertyNameNode(name); if (memberName) { switch (member.kind) { - case 174 /* GetAccessor */: + case 176 /* GetAccessor */: addName(names, name, memberName, 1 /* GetAccessor */ | privateStaticFlags); break; - case 175 /* SetAccessor */: + case 177 /* SetAccessor */: addName(names, name, memberName, 2 /* SetAccessor */ | privateStaticFlags); break; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: addName(names, name, memberName, 3 /* GetOrSetAccessor */ | privateStaticFlags); break; - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: addName(names, name, memberName, 8 /* Method */ | privateStaticFlags); break; } @@ -76663,15 +77150,15 @@ ${lanes.join("\n")} function checkObjectTypeForDuplicateDeclarations(node) { const names = /* @__PURE__ */ new Map(); for (const member of node.members) { - if (member.kind === 168 /* PropertySignature */) { + if (member.kind === 170 /* PropertySignature */) { let memberName; const name = member.name; switch (name.kind) { - case 10 /* StringLiteral */: - case 8 /* NumericLiteral */: + case 11 /* StringLiteral */: + case 9 /* NumericLiteral */: memberName = name.text; break; - case 79 /* Identifier */: + case 80 /* Identifier */: memberName = idText(name); break; default: @@ -76687,7 +77174,7 @@ ${lanes.join("\n")} } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 261 /* InterfaceDeclaration */) { + if (node.kind === 263 /* InterfaceDeclaration */) { const nodeSymbol = getSymbolOfDeclaration(node); if (nodeSymbol.declarations && nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -76722,7 +77209,7 @@ ${lanes.join("\n")} checkGrammarComputedPropertyName(node.name); checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); - if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 169 /* PropertyDeclaration */ && node.initializer) { + if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 171 /* PropertyDeclaration */ && node.initializer) { error(node, Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, declarationNameToString(node.name)); } } @@ -76739,7 +77226,7 @@ ${lanes.join("\n")} error(node.name, Diagnostics.Class_constructor_may_not_be_a_generator); } checkFunctionOrMethodDeclaration(node); - if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 171 /* MethodDeclaration */ && node.body) { + if (hasSyntacticModifier(node, 256 /* Abstract */) && node.kind === 173 /* MethodDeclaration */ && node.body) { error(node, Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, declarationNameToString(node.name)); } if (isPrivateIdentifier(node.name) && !getContainingClass(node)) { @@ -76784,7 +77271,7 @@ ${lanes.join("\n")} if (isPrivateIdentifierClassElementDeclaration(n)) { return true; } - return n.kind === 169 /* PropertyDeclaration */ && !isStatic(n) && !!n.initializer; + return n.kind === 171 /* PropertyDeclaration */ && !isStatic(n) && !!n.initializer; } function checkConstructorDeclarationDiagnostics() { const containingClassDecl = node.parent; @@ -76827,7 +77314,7 @@ ${lanes.join("\n")} return isExpressionStatement(superCallParent) && superCallParent.parent === body; } function nodeImmediatelyReferencesSuperOrThis(node) { - if (node.kind === 106 /* SuperKeyword */ || node.kind === 108 /* ThisKeyword */) { + if (node.kind === 108 /* SuperKeyword */ || node.kind === 110 /* ThisKeyword */) { return true; } if (isThisContainerOrFunctionBlock(node)) { @@ -76836,7 +77323,7 @@ ${lanes.join("\n")} return !!forEachChild(node, nodeImmediatelyReferencesSuperOrThis); } function checkAccessorDeclaration(node) { - if (isIdentifier(node.name) && idText(node.name) === "constructor") { + if (isIdentifier(node.name) && idText(node.name) === "constructor" && isClassLike(node.parent)) { error(node.name, Diagnostics.Class_constructor_may_not_be_an_accessor); } addLazyDiagnostic(checkAccessorDeclarationDiagnostics); @@ -76847,20 +77334,20 @@ ${lanes.join("\n")} checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 174 /* GetAccessor */) { + if (node.kind === 176 /* GetAccessor */) { if (!(node.flags & 16777216 /* Ambient */) && nodeIsPresent(node.body) && node.flags & 256 /* HasImplicitReturn */) { if (!(node.flags & 512 /* HasExplicitReturn */)) { error(node.name, Diagnostics.A_get_accessor_must_return_a_value); } } } - if (node.name.kind === 164 /* ComputedPropertyName */) { + if (node.name.kind === 166 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { const symbol = getSymbolOfDeclaration(node); - const getter = getDeclarationOfKind(symbol, 174 /* GetAccessor */); - const setter = getDeclarationOfKind(symbol, 175 /* SetAccessor */); + const getter = getDeclarationOfKind(symbol, 176 /* GetAccessor */); + const setter = getDeclarationOfKind(symbol, 177 /* SetAccessor */); if (getter && setter && !(getNodeCheckFlags(getter) & 1 /* TypeChecked */)) { getNodeLinks(getter).flags |= 1 /* TypeChecked */; const getterFlags = getEffectiveModifierFlags(getter); @@ -76873,15 +77360,10 @@ ${lanes.join("\n")} error(getter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter); error(setter.name, Diagnostics.A_get_accessor_must_be_at_least_as_accessible_as_the_setter); } - const getterType = getAnnotatedAccessorType(getter); - const setterType = getAnnotatedAccessorType(setter); - if (getterType && setterType) { - checkTypeAssignableTo(getterType, setterType, getter, Diagnostics.The_return_type_of_a_get_accessor_must_be_assignable_to_its_set_accessor_type); - } } } const returnType = getTypeOfAccessors(getSymbolOfDeclaration(node)); - if (node.kind === 174 /* GetAccessor */) { + if (node.kind === 176 /* GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -76942,9 +77424,9 @@ ${lanes.join("\n")} } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 180 /* TypeReference */ && !isInJSFile(node) && !isInJSDoc(node) && node.typeArguments && node.typeName.end !== node.typeArguments.pos) { + if (node.kind === 182 /* TypeReference */ && !isInJSFile(node) && !isInJSDoc(node) && node.typeArguments && node.typeName.end !== node.typeArguments.pos) { const sourceFile = getSourceFileOfNode(node); - if (scanTokenAtPosition(sourceFile, node.typeName.end) === 24 /* DotToken */) { + if (scanTokenAtPosition(sourceFile, node.typeName.end) === 25 /* DotToken */) { grammarErrorAtPos(node, skipTrivia(sourceFile.text, node.typeName.end), 1, Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } } @@ -77006,7 +77488,7 @@ ${lanes.join("\n")} let seenRestElement = false; const hasNamedElement = some(elementTypes, isNamedTupleMember); for (const e of elementTypes) { - if (e.kind !== 199 /* NamedTupleMember */ && hasNamedElement) { + if (e.kind !== 201 /* NamedTupleMember */ && hasNamedElement) { grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); break; } @@ -77050,12 +77532,8 @@ ${lanes.join("\n")} } const objectType = type.objectType; const indexType = type.indexType; - if (isTypeAssignableTo(indexType, getIndexType( - objectType, - /*stringsOnly*/ - false - ))) { - if (accessNode.kind === 209 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) { + if (isTypeAssignableTo(indexType, getIndexType(objectType, 0 /* None */))) { + if (accessNode.kind === 211 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) { error(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } return type; @@ -77100,8 +77578,8 @@ ${lanes.join("\n")} } } function checkGrammarMappedType(node) { - var _a2; - if ((_a2 = node.members) == null ? void 0 : _a2.length) { + var _a; + if ((_a = node.members) == null ? void 0 : _a.length) { return grammarErrorOnNode(node.members[0], Diagnostics.A_mapped_type_may_not_declare_properties_or_methods); } } @@ -77116,7 +77594,7 @@ ${lanes.join("\n")} forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!findAncestor(node, (n) => n.parent && n.parent.kind === 191 /* ConditionalType */ && n.parent.extendsType === n)) { + if (!findAncestor(node, (n) => n.parent && n.parent.kind === 193 /* ConditionalType */ && n.parent.extendsType === n)) { grammarErrorOnNode(node, Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -77126,7 +77604,7 @@ ${lanes.join("\n")} if (!links.typeParametersChecked) { links.typeParametersChecked = true; const typeParameter = getDeclaredTypeOfTypeParameter(symbol); - const declarations = getDeclarationsOfKind(symbol, 165 /* TypeParameter */); + const declarations = getDeclarationsOfKind(symbol, 167 /* TypeParameter */); if (!areTypeParametersIdentical(declarations, [typeParameter], (decl) => [decl])) { const name = symbolToString(symbol); for (const declaration of declarations) { @@ -77164,10 +77642,10 @@ ${lanes.join("\n")} if (node.dotDotDotToken && node.questionToken) { grammarErrorOnNode(node, Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); } - if (node.type.kind === 187 /* OptionalType */) { + if (node.type.kind === 189 /* OptionalType */) { grammarErrorOnNode(node.type, 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 === 188 /* RestType */) { + if (node.type.kind === 190 /* RestType */) { grammarErrorOnNode(node.type, Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); } checkSourceElement(node.type); @@ -77178,7 +77656,7 @@ ${lanes.join("\n")} } function getEffectiveDeclarationFlags(n, flagsToCheck) { let flags = getCombinedModifierFlags(n); - if (n.parent.kind !== 261 /* InterfaceDeclaration */ && n.parent.kind !== 260 /* ClassDeclaration */ && n.parent.kind !== 228 /* ClassExpression */ && n.flags & 16777216 /* Ambient */) { + if (n.parent.kind !== 263 /* InterfaceDeclaration */ && n.parent.kind !== 262 /* ClassDeclaration */ && n.parent.kind !== 230 /* ClassExpression */ && n.flags & 16777216 /* Ambient */) { if (!(flags & 2 /* Ambient */) && !(isModuleBlock(n.parent) && isModuleDeclaration(n.parent.parent) && isGlobalScopeAugmentation(n.parent.parent))) { flags |= 1 /* Export */; } @@ -77252,10 +77730,9 @@ ${lanes.join("\n")} const subsequentName = subsequentNode.name; if (node.name && subsequentName && // both are private identifiers (isPrivateIdentifier(node.name) && isPrivateIdentifier(subsequentName) && node.name.escapedText === subsequentName.escapedText || // Both are computed property names - // TODO: GH#17345: These are methods, so handle computed name case. (`Always allowing computed property names is *not* the correct behavior!) - isComputedPropertyName(node.name) && isComputedPropertyName(subsequentName) || // Both are literal property names that are the same. + isComputedPropertyName(node.name) && isComputedPropertyName(subsequentName) && isTypeIdenticalTo(checkComputedPropertyName(node.name), checkComputedPropertyName(subsequentName)) || // Both are literal property names that are the same. isPropertyNameLiteral(node.name) && isPropertyNameLiteral(subsequentName) && getEscapedTextOfIdentifierOrLiteral(node.name) === getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - const reportError = (node.kind === 171 /* MethodDeclaration */ || node.kind === 170 /* MethodSignature */) && isStatic(node) !== isStatic(subsequentNode); + const reportError = (node.kind === 173 /* MethodDeclaration */ || node.kind === 172 /* MethodSignature */) && isStatic(node) !== isStatic(subsequentNode); if (reportError) { const diagnostic = isStatic(node) ? Diagnostics.Function_overload_must_be_static : Diagnostics.Function_overload_must_not_be_static; error(errorNode2, diagnostic); @@ -77287,14 +77764,14 @@ ${lanes.join("\n")} for (const current of declarations) { const node = current; const inAmbientContext = node.flags & 16777216 /* Ambient */; - const inAmbientContextOrInterface = node.parent && (node.parent.kind === 261 /* InterfaceDeclaration */ || node.parent.kind === 184 /* TypeLiteral */) || inAmbientContext; + const inAmbientContextOrInterface = node.parent && (node.parent.kind === 263 /* InterfaceDeclaration */ || node.parent.kind === 186 /* TypeLiteral */) || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = void 0; } - if ((node.kind === 260 /* ClassDeclaration */ || node.kind === 228 /* ClassExpression */) && !inAmbientContext) { + if ((node.kind === 262 /* ClassDeclaration */ || node.kind === 230 /* ClassExpression */) && !inAmbientContext) { hasNonAmbientClass = true; } - if (node.kind === 259 /* FunctionDeclaration */ || node.kind === 171 /* MethodDeclaration */ || node.kind === 170 /* MethodSignature */ || node.kind === 173 /* Constructor */) { + if (node.kind === 261 /* FunctionDeclaration */ || node.kind === 173 /* MethodDeclaration */ || node.kind === 172 /* MethodSignature */ || node.kind === 175 /* Constructor */) { functionDeclarations.push(node); const currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; @@ -77347,9 +77824,9 @@ ${lanes.join("\n")} }); } if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* Function */ && declarations) { - const relatedDiagnostics = filter(declarations, (d) => d.kind === 260 /* ClassDeclaration */).map((d) => createDiagnosticForNode(d, Diagnostics.Consider_adding_a_declare_modifier_to_this_class)); + const relatedDiagnostics = filter(declarations, (d) => d.kind === 262 /* ClassDeclaration */).map((d) => createDiagnosticForNode(d, Diagnostics.Consider_adding_a_declare_modifier_to_this_class)); forEach(declarations, (declaration) => { - const diagnostic = declaration.kind === 260 /* ClassDeclaration */ ? Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 : declaration.kind === 259 /* FunctionDeclaration */ ? Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : void 0; + const diagnostic = declaration.kind === 262 /* ClassDeclaration */ ? Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 : declaration.kind === 261 /* FunctionDeclaration */ ? Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : void 0; if (diagnostic) { addRelatedInfo( error(getNameOfDeclaration(declaration) || declaration, diagnostic, symbolName(symbol)), @@ -77429,54 +77906,54 @@ ${lanes.join("\n")} function getDeclarationSpaces(decl) { let d = decl; switch (d.kind) { - case 261 /* InterfaceDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 349 /* JSDocTypedefTag */: - case 341 /* JSDocCallbackTag */: - case 343 /* JSDocEnumTag */: + case 263 /* InterfaceDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 352 /* JSDocTypedefTag */: + case 344 /* JSDocCallbackTag */: + case 346 /* JSDocEnumTag */: return 2 /* ExportType */; - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: return isAmbientModule(d) || getModuleInstanceState(d) !== 0 /* NonInstantiated */ ? 4 /* ExportNamespace */ | 1 /* ExportValue */ : 4 /* ExportNamespace */; - case 260 /* ClassDeclaration */: - case 263 /* EnumDeclaration */: - case 302 /* EnumMember */: + case 262 /* ClassDeclaration */: + case 265 /* EnumDeclaration */: + case 305 /* EnumMember */: return 2 /* ExportType */ | 1 /* ExportValue */; - case 308 /* SourceFile */: + case 311 /* SourceFile */: return 2 /* ExportType */ | 1 /* ExportValue */ | 4 /* ExportNamespace */; - case 274 /* ExportAssignment */: - case 223 /* BinaryExpression */: + case 276 /* ExportAssignment */: + case 225 /* BinaryExpression */: const node2 = d; const expression = isExportAssignment(node2) ? node2.expression : node2.right; if (!isEntityNameExpression(expression)) { return 1 /* ExportValue */; } d = expression; - case 268 /* ImportEqualsDeclaration */: - case 271 /* NamespaceImport */: - case 270 /* ImportClause */: + case 270 /* ImportEqualsDeclaration */: + case 273 /* NamespaceImport */: + case 272 /* ImportClause */: let result = 0 /* None */; const target = resolveAlias(getSymbolOfDeclaration(d)); forEach(target.declarations, (d2) => { result |= getDeclarationSpaces(d2); }); return result; - case 257 /* VariableDeclaration */: - case 205 /* BindingElement */: - case 259 /* FunctionDeclaration */: - case 273 /* ImportSpecifier */: - case 79 /* Identifier */: + case 259 /* VariableDeclaration */: + case 207 /* BindingElement */: + case 261 /* FunctionDeclaration */: + case 275 /* ImportSpecifier */: + case 80 /* Identifier */: return 1 /* ExportValue */; - case 170 /* MethodSignature */: - case 168 /* PropertySignature */: + case 172 /* MethodSignature */: + case 170 /* PropertySignature */: return 2 /* ExportType */; default: return Debug.failBadSyntaxKind(d); } } } - function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, arg0) { + function getAwaitedTypeOfPromise(type, errorNode, diagnosticMessage, ...args) { const promisedType = getPromisedTypeOfPromise(type, errorNode); - return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, arg0); + return promisedType && getAwaitedType(promisedType, errorNode, diagnosticMessage, ...args); } function getPromisedTypeOfPromise(type, errorNode, thisTypeForErrorOut) { if (isTypeAny(type)) { @@ -77492,7 +77969,7 @@ ${lanes.join("\n")} ))) { return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0]; } - if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 402784252 /* Primitive */ | 131072 /* Never */)) { return void 0; } const thenFunction = getTypeOfPropertyOfType(type, "then"); @@ -77539,25 +78016,25 @@ ${lanes.join("\n")} } return typeAsPromise.promisedTypeOfPromise = getUnionType(map(onfulfilledParameterSignatures, getTypeOfFirstParameterOfSignature), 2 /* Subtype */); } - function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage, arg0) { - const awaitedType = withAlias ? getAwaitedType(type, errorNode, diagnosticMessage, arg0) : getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0); + function checkAwaitedType(type, withAlias, errorNode, diagnosticMessage, ...args) { + const awaitedType = withAlias ? getAwaitedType(type, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args); return awaitedType || errorType; } function isThenableType(type) { - if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 402784252 /* Primitive */ | 131072 /* Never */)) { return false; } const thenFunction = getTypeOfPropertyOfType(type, "then"); return !!thenFunction && getSignaturesOfType(getTypeWithFacts(thenFunction, 2097152 /* NEUndefinedOrNull */), 0 /* Call */).length > 0; } function isAwaitedTypeInstantiation(type) { - var _a2; + var _a; if (type.flags & 16777216 /* Conditional */) { const awaitedSymbol = getGlobalAwaitedSymbol( /*reportErrors*/ false ); - return !!awaitedSymbol && type.aliasSymbol === awaitedSymbol && ((_a2 = type.aliasTypeArguments) == null ? void 0 : _a2.length) === 1; + return !!awaitedSymbol && type.aliasSymbol === awaitedSymbol && ((_a = type.aliasTypeArguments) == null ? void 0 : _a.length) === 1; } return false; } @@ -77596,11 +78073,11 @@ ${lanes.join("\n")} Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like."); return type; } - function getAwaitedType(type, errorNode, diagnosticMessage, arg0) { - const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0); + function getAwaitedType(type, errorNode, diagnosticMessage, ...args) { + const awaitedType = getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args); return awaitedType && createAwaitedTypeIfNeeded(awaitedType); } - function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, arg0) { + function getAwaitedTypeNoAlias(type, errorNode, diagnosticMessage, ...args) { if (isTypeAny(type)) { return type; } @@ -77618,7 +78095,7 @@ ${lanes.join("\n")} } return void 0; } - const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0) : getAwaitedTypeNoAlias; + const mapper = errorNode ? (constituentType) => getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, ...args) : getAwaitedTypeNoAlias; awaitedTypeStack.push(type.id); const mapped = mapType(type, mapper); awaitedTypeStack.pop(); @@ -77642,7 +78119,7 @@ ${lanes.join("\n")} return void 0; } awaitedTypeStack.push(type.id); - const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, arg0); + const awaitedType = getAwaitedTypeNoAlias(promisedType, errorNode, diagnosticMessage, ...args); awaitedTypeStack.pop(); if (!awaitedType) { return void 0; @@ -77656,7 +78133,7 @@ ${lanes.join("\n")} if (thisTypeForErrorOut.value) { chain = chainDiagnosticMessages(chain, Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1, typeToString(type), typeToString(thisTypeForErrorOut.value)); } - chain = chainDiagnosticMessages(chain, diagnosticMessage, arg0); + chain = chainDiagnosticMessages(chain, diagnosticMessage, ...args); diagnostics.add(createDiagnosticForNodeFromMessageChain(getSourceFileOfNode(errorNode), errorNode, chain)); } return void 0; @@ -77695,7 +78172,7 @@ ${lanes.join("\n")} ); const promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType; if (isErrorType(promiseConstructorType)) { - if (promiseConstructorName.kind === 79 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType( + if (promiseConstructorName.kind === 80 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType( /*reportErrors*/ false )) { @@ -77754,21 +78231,21 @@ ${lanes.join("\n")} let headMessage; const expectedReturnType = decoratorSignature.resolvedReturnType; switch (node.parent.kind) { - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; break; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: if (!legacyDecorators) { headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; break; } - case 166 /* Parameter */: + case 168 /* Parameter */: headMessage = Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; break; - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: headMessage = Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; break; default: @@ -77781,7 +78258,7 @@ ${lanes.join("\n")} /*typeParameters*/ void 0, emptyArray, - factory.createKeywordTypeNode(131 /* AnyKeyword */) + factory.createKeywordTypeNode(133 /* AnyKeyword */) ); return createSignature(decl, typeParameters, thisParameter, parameters, returnType, typePredicate, minArgumentCount, flags); } @@ -77821,7 +78298,7 @@ ${lanes.join("\n")} if (!typeName) return; const rootName = getFirstIdentifier(typeName); - const meaning = (typeName.kind === 79 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */; + const meaning = (typeName.kind === 80 /* Identifier */ ? 788968 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */; const rootSymbol = resolveName( rootName, rootName.escapedText, @@ -77830,11 +78307,11 @@ ${lanes.join("\n")} void 0, /*nameArg*/ void 0, - /*isReference*/ + /*isUse*/ true ); if (rootSymbol && rootSymbol.flags & 2097152 /* Alias */) { - if (!compilerOptions.verbatimModuleSyntax && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) { + if (canCollectSymbolAliasAccessabilityData && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol)) && !getTypeOnlyAliasDeclaration(rootSymbol)) { markAliasSymbolAsReferenced(rootSymbol); } else if (forDecoratorMetadata && getIsolatedModules(compilerOptions) && getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */ && !symbolIsValue(rootSymbol) && !some(rootSymbol.declarations, isTypeOnlyImportOrExportDeclaration)) { const diag2 = error(typeName, Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled); @@ -77858,15 +78335,15 @@ ${lanes.join("\n")} function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 190 /* IntersectionType */: - case 189 /* UnionType */: + case 192 /* IntersectionType */: + case 191 /* UnionType */: return getEntityNameForDecoratorMetadataFromTypeList(node.types); - case 191 /* ConditionalType */: + case 193 /* ConditionalType */: return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); - case 193 /* ParenthesizedType */: - case 199 /* NamedTupleMember */: + case 195 /* ParenthesizedType */: + case 201 /* NamedTupleMember */: return getEntityNameForDecoratorMetadata(node.type); - case 180 /* TypeReference */: + case 182 /* TypeReference */: return node.typeName; } } @@ -77874,13 +78351,13 @@ ${lanes.join("\n")} function getEntityNameForDecoratorMetadataFromTypeList(types) { let commonEntityName; for (let typeNode of types) { - while (typeNode.kind === 193 /* ParenthesizedType */ || typeNode.kind === 199 /* NamedTupleMember */) { + while (typeNode.kind === 195 /* ParenthesizedType */ || typeNode.kind === 201 /* NamedTupleMember */) { typeNode = typeNode.type; } - if (typeNode.kind === 144 /* NeverKeyword */) { + if (typeNode.kind === 146 /* NeverKeyword */) { continue; } - if (!strictNullChecks && (typeNode.kind === 198 /* LiteralType */ && typeNode.literal.kind === 104 /* NullKeyword */ || typeNode.kind === 155 /* UndefinedKeyword */)) { + if (!strictNullChecks && (typeNode.kind === 200 /* LiteralType */ && typeNode.literal.kind === 106 /* NullKeyword */ || typeNode.kind === 157 /* UndefinedKeyword */)) { continue; } const individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -77911,7 +78388,7 @@ ${lanes.join("\n")} } if (legacyDecorators) { checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */); - if (node.kind === 166 /* Parameter */) { + if (node.kind === 168 /* Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* Param */); } } else if (languageVersion < 99 /* ESNext */) { @@ -77937,7 +78414,7 @@ ${lanes.join("\n")} if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */); switch (node.kind) { - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: const constructor = getFirstConstructorWithBody(node); if (constructor) { for (const parameter of constructor.parameters) { @@ -77945,22 +78422,22 @@ ${lanes.join("\n")} } } break; - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - const otherKind = node.kind === 174 /* GetAccessor */ ? 175 /* SetAccessor */ : 174 /* GetAccessor */; + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + const otherKind = node.kind === 176 /* GetAccessor */ ? 177 /* SetAccessor */ : 176 /* GetAccessor */; const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: for (const parameter of node.parameters) { markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveReturnTypeNode(node)); break; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: markDecoratorMedataDataTypeNodeAsReferenced(getEffectiveTypeAnnotationNode(node)); break; - case 166 /* Parameter */: + case 168 /* Parameter */: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); const containingSignature = node.parent; for (const parameter of containingSignature.parameters) { @@ -78073,26 +78550,26 @@ ${lanes.join("\n")} } function getIdentifierFromEntityNameExpression(node) { switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return node; - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: return node.name; default: return void 0; } } function checkFunctionOrMethodDeclaration(node) { - var _a2; + var _a; checkDecorators(node); checkSignatureDeclaration(node); const functionFlags = getFunctionFlags(node); - if (node.name && node.name.kind === 164 /* ComputedPropertyName */) { + if (node.name && node.name.kind === 166 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { const symbol = getSymbolOfDeclaration(node); const localSymbol = node.localSymbol || symbol; - const firstDeclaration = (_a2 = localSymbol.declarations) == null ? void 0 : _a2.find( + const firstDeclaration = (_a = localSymbol.declarations) == null ? void 0 : _a.find( // Get first non javascript function declaration (declaration) => declaration.kind === node.kind && !(declaration.flags & 262144 /* JavaScriptFile */) ); @@ -78103,7 +78580,7 @@ ${lanes.join("\n")} checkFunctionOrConstructorSymbol(symbol); } } - const body = node.kind === 170 /* MethodSignature */ ? void 0 : node.body; + const body = node.kind === 172 /* MethodSignature */ ? void 0 : node.body; checkSourceElement(body); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); @@ -78139,42 +78616,42 @@ ${lanes.join("\n")} function checkUnusedIdentifiers(potentiallyUnusedIdentifiers, addDiagnostic) { for (const node of potentiallyUnusedIdentifiers) { switch (node.kind) { - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 308 /* SourceFile */: - case 264 /* ModuleDeclaration */: - case 238 /* Block */: - case 266 /* CaseBlock */: - case 245 /* ForStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: + case 311 /* SourceFile */: + case 266 /* ModuleDeclaration */: + case 240 /* Block */: + case 268 /* CaseBlock */: + case 247 /* ForStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 173 /* Constructor */: - case 215 /* FunctionExpression */: - case 259 /* FunctionDeclaration */: - case 216 /* ArrowFunction */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 175 /* Constructor */: + case 217 /* FunctionExpression */: + case 261 /* FunctionDeclaration */: + case 218 /* ArrowFunction */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: if (node.body) { checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 170 /* MethodSignature */: - case 176 /* CallSignature */: - case 177 /* ConstructSignature */: - case 181 /* FunctionType */: - case 182 /* ConstructorType */: - case 262 /* TypeAliasDeclaration */: - case 261 /* InterfaceDeclaration */: + case 172 /* MethodSignature */: + case 178 /* CallSignature */: + case 179 /* ConstructSignature */: + case 183 /* FunctionType */: + case 184 /* ConstructorType */: + case 264 /* TypeAliasDeclaration */: + case 263 /* InterfaceDeclaration */: checkUnusedTypeParameters(node, addDiagnostic); break; - case 192 /* InferType */: + case 194 /* InferType */: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -78193,11 +78670,11 @@ ${lanes.join("\n")} function checkUnusedClassMembers(node, addDiagnostic) { for (const member of node.members) { switch (member.kind) { - case 171 /* MethodDeclaration */: - case 169 /* PropertyDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - if (member.kind === 175 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) { + case 173 /* MethodDeclaration */: + case 171 /* PropertyDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + if (member.kind === 177 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) { break; } const symbol = getSymbolOfDeclaration(member); @@ -78205,16 +78682,16 @@ ${lanes.join("\n")} addDiagnostic(member, 0 /* Local */, createDiagnosticForNode(member.name, Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 173 /* Constructor */: + case 175 /* Constructor */: for (const parameter of member.parameters) { if (!parameter.symbol.isReferenced && hasSyntacticModifier(parameter, 8 /* Private */)) { addDiagnostic(parameter, 0 /* Local */, createDiagnosticForNode(parameter.name, Diagnostics.Property_0_is_declared_but_its_value_is_never_read, symbolName(parameter.symbol))); } } break; - case 178 /* IndexSignature */: - case 237 /* SemicolonClassElement */: - case 172 /* ClassStaticBlockDeclaration */: + case 180 /* IndexSignature */: + case 239 /* SemicolonClassElement */: + case 174 /* ClassStaticBlockDeclaration */: break; default: Debug.fail("Unexpected class member"); @@ -78238,14 +78715,13 @@ ${lanes.join("\n")} continue; const name = idText(typeParameter.name); const { parent: parent2 } = typeParameter; - if (parent2.kind !== 192 /* InferType */ && parent2.typeParameters.every(isTypeParameterUnused)) { + if (parent2.kind !== 194 /* InferType */ && parent2.typeParameters.every(isTypeParameterUnused)) { if (tryAddToSet(seenParentsWithEveryUnused, parent2)) { const sourceFile = getSourceFileOfNode(parent2); const range = isJSDocTemplateTag(parent2) ? rangeOfNode(parent2) : rangeOfTypeParameters(sourceFile, parent2.typeParameters); const only = parent2.typeParameters.length === 1; - const message = only ? Diagnostics._0_is_declared_but_its_value_is_never_read : Diagnostics.All_type_parameters_are_unused; - const arg0 = only ? name : void 0; - addDiagnostic(typeParameter, 1 /* Parameter */, createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, message, arg0)); + const messageAndArg = only ? [Diagnostics._0_is_declared_but_its_value_is_never_read, name] : [Diagnostics.All_type_parameters_are_unused]; + addDiagnostic(typeParameter, 1 /* Parameter */, createFileDiagnostic(sourceFile, range.pos, range.end - range.pos, ...messageAndArg)); } } else { addDiagnostic(typeParameter, 1 /* Parameter */, createDiagnosticForNode(typeParameter, Diagnostics._0_is_declared_but_its_value_is_never_read, name)); @@ -78318,7 +78794,7 @@ ${lanes.join("\n")} }); unusedImports.forEach(([importClause, unuseds]) => { const importDecl = importClause.parent; - const nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? importClause.namedBindings.kind === 271 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length : 0); + const nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? importClause.namedBindings.kind === 273 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0 /* Local */, unuseds.length === 1 ? createDiagnosticForNode(importDecl, Diagnostics._0_is_declared_but_its_value_is_never_read, idText(first(unuseds).name)) : createDiagnosticForNode(importDecl, Diagnostics.All_imports_in_import_declaration_are_unused)); } else { @@ -78329,7 +78805,7 @@ ${lanes.join("\n")} unusedDestructures.forEach(([bindingPattern, bindingElements]) => { const kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* Parameter */ : 0 /* Local */; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 257 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 258 /* VariableDeclarationList */) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 259 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 260 /* VariableDeclarationList */) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { addDiagnostic(bindingPattern, kind, bindingElements.length === 1 ? createDiagnosticForNode(bindingPattern, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(first(bindingElements).name)) : createDiagnosticForNode(bindingPattern, Diagnostics.All_destructured_elements_are_unused)); @@ -78342,7 +78818,7 @@ ${lanes.join("\n")} }); unusedVariables.forEach(([declarationList, declarations]) => { if (declarationList.declarations.length === declarations.length) { - addDiagnostic(declarationList, 0 /* Local */, declarations.length === 1 ? createDiagnosticForNode(first(declarations).name, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(first(declarations).name)) : createDiagnosticForNode(declarationList.parent.kind === 240 /* VariableStatement */ ? declarationList.parent : declarationList, Diagnostics.All_variables_are_unused)); + addDiagnostic(declarationList, 0 /* Local */, declarations.length === 1 ? createDiagnosticForNode(first(declarations).name, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(first(declarations).name)) : createDiagnosticForNode(declarationList.parent.kind === 242 /* VariableStatement */ ? declarationList.parent : declarationList, Diagnostics.All_variables_are_unused)); } else { for (const decl of declarations) { addDiagnostic(decl, 0 /* Local */, createDiagnosticForNode(decl, Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(decl.name))); @@ -78351,9 +78827,9 @@ ${lanes.join("\n")} }); } function checkPotentialUncheckedRenamedBindingElementsInTypes() { - var _a2; + var _a; for (const node of potentialUnusedRenamedBindingElementsInTypes) { - if (!((_a2 = getSymbolOfDeclaration(node)) == null ? void 0 : _a2.isReferenced)) { + if (!((_a = getSymbolOfDeclaration(node)) == null ? void 0 : _a.isReferenced)) { const wrappingDeclaration = walkUpBindingElementsAndPatterns(node); Debug.assert(isParameterDeclaration(wrappingDeclaration), "Only parameter declaration should be checked here"); const diagnostic = createDiagnosticForNode(node.name, Diagnostics._0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation, declarationNameToString(node.name), declarationNameToString(node.propertyName)); @@ -78369,23 +78845,23 @@ ${lanes.join("\n")} } function bindingNameText(name) { switch (name.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return idText(name); - case 204 /* ArrayBindingPattern */: - case 203 /* ObjectBindingPattern */: + case 206 /* ArrayBindingPattern */: + case 205 /* ObjectBindingPattern */: return bindingNameText(cast(first(name.elements), isBindingElement).name); default: return Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 270 /* ImportClause */ || node.kind === 273 /* ImportSpecifier */ || node.kind === 271 /* NamespaceImport */; + return node.kind === 272 /* ImportClause */ || node.kind === 275 /* ImportSpecifier */ || node.kind === 273 /* NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 270 /* ImportClause */ ? decl : decl.kind === 271 /* NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 272 /* ImportClause */ ? decl : decl.kind === 273 /* NamespaceImport */ ? decl.parent : decl.parent.parent; } function checkBlock(node) { - if (node.kind === 238 /* Block */) { + if (node.kind === 240 /* Block */) { checkGrammarStatementInAmbientContext(node); } if (isFunctionOrModuleBlock(node)) { @@ -78413,7 +78889,7 @@ ${lanes.join("\n")} if ((identifier == null ? void 0 : identifier.escapedText) !== name) { return false; } - if (node.kind === 169 /* PropertyDeclaration */ || node.kind === 168 /* PropertySignature */ || node.kind === 171 /* MethodDeclaration */ || node.kind === 170 /* MethodSignature */ || node.kind === 174 /* GetAccessor */ || node.kind === 175 /* SetAccessor */ || node.kind === 299 /* PropertyAssignment */) { + if (node.kind === 171 /* PropertyDeclaration */ || node.kind === 170 /* PropertySignature */ || node.kind === 173 /* MethodDeclaration */ || node.kind === 172 /* MethodSignature */ || node.kind === 176 /* GetAccessor */ || node.kind === 177 /* SetAccessor */ || node.kind === 302 /* PropertyAssignment */) { return false; } if (node.flags & 16777216 /* Ambient */) { @@ -78433,7 +78909,7 @@ ${lanes.join("\n")} function checkIfThisIsCapturedInEnclosingScope(node) { findAncestor(node, (current) => { if (getNodeCheckFlags(current) & 4 /* CaptureThis */) { - const isDeclaration2 = node.kind !== 79 /* Identifier */; + const isDeclaration2 = node.kind !== 80 /* Identifier */; if (isDeclaration2) { error(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference); } else { @@ -78447,7 +78923,7 @@ ${lanes.join("\n")} function checkIfNewTargetIsCapturedInEnclosingScope(node) { findAncestor(node, (current) => { if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) { - const isDeclaration2 = node.kind !== 79 /* Identifier */; + const isDeclaration2 = node.kind !== 80 /* Identifier */; if (isDeclaration2) { error(getNameOfDeclaration(node), Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference); } else { @@ -78469,7 +78945,7 @@ ${lanes.join("\n")} return; } const parent2 = getDeclarationContainer(node); - if (parent2.kind === 308 /* SourceFile */ && isExternalOrCommonJsModule(parent2)) { + if (parent2.kind === 311 /* SourceFile */ && isExternalOrCommonJsModule(parent2)) { errorSkippedOn( "noEmit", name, @@ -78487,7 +78963,7 @@ ${lanes.join("\n")} return; } const parent2 = getDeclarationContainer(node); - if (parent2.kind === 308 /* SourceFile */ && isExternalOrCommonJsModule(parent2) && parent2.flags & 2048 /* HasAsyncFunctions */) { + if (parent2.kind === 311 /* SourceFile */ && isExternalOrCommonJsModule(parent2) && parent2.flags & 2048 /* HasAsyncFunctions */) { errorSkippedOn( "noEmit", name, @@ -78564,7 +79040,7 @@ ${lanes.join("\n")} if ((getCombinedNodeFlags(node) & 3 /* BlockScoped */) !== 0 || isParameterDeclaration(node)) { return; } - if (node.kind === 257 /* VariableDeclaration */ && !node.initializer) { + if (node.kind === 259 /* VariableDeclaration */ && !node.initializer) { return; } const symbol = getSymbolOfDeclaration(node); @@ -78575,7 +79051,7 @@ ${lanes.join("\n")} node, node.name.escapedText, 3 /* Variable */, - /*nodeNotFoundErrorMessage*/ + /*nameNotFoundMessage*/ void 0, /*nameArg*/ void 0, @@ -78584,9 +79060,9 @@ ${lanes.join("\n")} ); if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) { - const varDeclList = getAncestor(localDeclarationSymbol.valueDeclaration, 258 /* VariableDeclarationList */); - const container = varDeclList.parent.kind === 240 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : void 0; - const namesShareScope = container && (container.kind === 238 /* Block */ && isFunctionLike(container.parent) || container.kind === 265 /* ModuleBlock */ || container.kind === 264 /* ModuleDeclaration */ || container.kind === 308 /* SourceFile */); + const varDeclList = getAncestor(localDeclarationSymbol.valueDeclaration, 260 /* VariableDeclarationList */); + const container = varDeclList.parent.kind === 242 /* VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : void 0; + const namesShareScope = container && (container.kind === 240 /* Block */ && isFunctionLike(container.parent) || container.kind === 267 /* ModuleBlock */ || container.kind === 266 /* ModuleDeclaration */ || container.kind === 311 /* SourceFile */); if (!namesShareScope) { const name = symbolToString(localDeclarationSymbol); error(node, Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); @@ -78599,7 +79075,7 @@ ${lanes.join("\n")} return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type; } function checkVariableLikeDeclaration(node) { - var _a2; + var _a; checkDecorators(node); if (!isBindingElement(node)) { checkSourceElement(node.type); @@ -78607,7 +79083,7 @@ ${lanes.join("\n")} if (!node.name) { return; } - if (node.name.kind === 164 /* ComputedPropertyName */) { + if (node.name.kind === 166 /* ComputedPropertyName */) { checkComputedPropertyName(node.name); if (hasOnlyExpressionInitializer(node) && node.initializer) { checkExpressionCached(node.initializer); @@ -78621,7 +79097,7 @@ ${lanes.join("\n")} if (isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5 /* ES2018 */) { checkExternalEmitHelpers(node, 4 /* Rest */); } - if (node.propertyName && node.propertyName.kind === 164 /* ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 166 /* ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } const parent2 = node.parent.parent; @@ -78643,7 +79119,7 @@ ${lanes.join("\n")} ); checkPropertyAccessibility( node, - !!parent2.initializer && parent2.initializer.kind === 106 /* SuperKeyword */, + !!parent2.initializer && parent2.initializer.kind === 108 /* SuperKeyword */, /*writing*/ false, parentType, @@ -78654,7 +79130,7 @@ ${lanes.join("\n")} } } if (isBindingPattern(node.name)) { - if (node.name.kind === 204 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 206 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* Read */); } forEach(node.name.elements, checkSourceElement); @@ -78664,7 +79140,10 @@ ${lanes.join("\n")} return; } if (isBindingPattern(node.name)) { - const needCheckInitializer = hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* ForInStatement */; + if (isInAmbientOrTypeNode(node)) { + return; + } + const needCheckInitializer = hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 248 /* ForInStatement */; const needCheckWidenedType = !some(node.name.elements, not(isOmittedExpression)); if (needCheckInitializer || needCheckWidenedType) { const widenedType = getWidenedTypeForVariableLikeDeclaration(node); @@ -78695,8 +79174,8 @@ ${lanes.join("\n")} if (node === symbol.valueDeclaration) { const initializer = hasOnlyExpressionInitializer(node) && getEffectiveInitializer(node); if (initializer) { - const isJSObjectLiteralInitializer = isInJSFile(node) && isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAccess(node.name)) && !!((_a2 = symbol.exports) == null ? void 0 : _a2.size); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 246 /* ForInStatement */) { + const isJSObjectLiteralInitializer = isInJSFile(node) && isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAccess(node.name)) && !!((_a = symbol.exports) == null ? void 0 : _a.size); + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 248 /* ForInStatement */) { checkTypeAssignableToAndOptionallyElaborate( checkExpressionCached(initializer), type, @@ -78731,9 +79210,9 @@ ${lanes.join("\n")} error(node.name, Diagnostics.All_declarations_of_0_must_have_identical_modifiers, declarationNameToString(node.name)); } } - if (node.kind !== 169 /* PropertyDeclaration */ && node.kind !== 168 /* PropertySignature */) { + if (node.kind !== 171 /* PropertyDeclaration */ && node.kind !== 170 /* PropertySignature */) { checkExportsOnMergedDeclarations(node); - if (node.kind === 257 /* VariableDeclaration */ || node.kind === 205 /* BindingElement */) { + if (node.kind === 259 /* VariableDeclaration */ || node.kind === 207 /* BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionsForDeclarationName(node, node.name); @@ -78741,7 +79220,7 @@ ${lanes.join("\n")} } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { const nextDeclarationName = getNameOfDeclaration(nextDeclaration); - const message = nextDeclaration.kind === 169 /* PropertyDeclaration */ || nextDeclaration.kind === 168 /* PropertySignature */ ? Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; + const message = nextDeclaration.kind === 171 /* PropertyDeclaration */ || nextDeclaration.kind === 170 /* PropertySignature */ ? Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; const declName = declarationNameToString(nextDeclarationName); const err = error( nextDeclarationName, @@ -78758,7 +79237,7 @@ ${lanes.join("\n")} } } function areDeclarationFlagsIdentical(left, right) { - if (left.kind === 166 /* Parameter */ && right.kind === 257 /* VariableDeclaration */ || left.kind === 257 /* VariableDeclaration */ && right.kind === 166 /* Parameter */) { + if (left.kind === 168 /* Parameter */ && right.kind === 259 /* VariableDeclaration */ || left.kind === 259 /* VariableDeclaration */ && right.kind === 168 /* Parameter */) { return true; } if (hasQuestionToken(left) !== hasQuestionToken(right)) { @@ -78768,8 +79247,8 @@ ${lanes.join("\n")} return getSelectedEffectiveModifierFlags(left, interestingFlags) === getSelectedEffectiveModifierFlags(right, interestingFlags); } function checkVariableDeclaration(node) { - var _a2, _b; - (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Check, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath }); + var _a, _b; + (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Check, "checkVariableDeclaration", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath }); checkGrammarVariableDeclaration(node); checkVariableLikeDeclaration(node); (_b = tracing) == null ? void 0 : _b.pop(); @@ -78792,7 +79271,7 @@ ${lanes.join("\n")} const type = checkTruthinessExpression(node.expression); checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 239 /* EmptyStatement */) { + if (node.thenStatement.kind === 241 /* EmptyStatement */) { error(node.thenStatement, Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); @@ -78804,7 +79283,7 @@ ${lanes.join("\n")} function bothHelper(condExpr2, body2) { condExpr2 = skipParentheses(condExpr2); helper(condExpr2, body2); - while (isBinaryExpression(condExpr2) && (condExpr2.operatorToken.kind === 56 /* BarBarToken */ || condExpr2.operatorToken.kind === 60 /* QuestionQuestionToken */)) { + while (isBinaryExpression(condExpr2) && (condExpr2.operatorToken.kind === 57 /* BarBarToken */ || condExpr2.operatorToken.kind === 61 /* QuestionQuestionToken */)) { condExpr2 = skipParentheses(condExpr2.left); helper(condExpr2, body2); } @@ -78859,7 +79338,7 @@ ${lanes.join("\n")} let testedExpression = testedNode.parent; let childExpression = childNode.parent; while (testedExpression && childExpression) { - if (isIdentifier(testedExpression) && isIdentifier(childExpression) || testedExpression.kind === 108 /* ThisKeyword */ && childExpression.kind === 108 /* ThisKeyword */) { + if (isIdentifier(testedExpression) && isIdentifier(childExpression) || testedExpression.kind === 110 /* ThisKeyword */ && childExpression.kind === 110 /* ThisKeyword */) { return getSymbolAtLocation(testedExpression) === getSymbolAtLocation(childExpression); } else if (isPropertyAccessExpression(testedExpression) && isPropertyAccessExpression(childExpression)) { if (getSymbolAtLocation(testedExpression.name) !== getSymbolAtLocation(childExpression.name)) { @@ -78880,7 +79359,7 @@ ${lanes.join("\n")} }); } function isSymbolUsedInBinaryExpressionChain(node, testedSymbol) { - while (isBinaryExpression(node) && node.operatorToken.kind === 55 /* AmpersandAmpersandToken */) { + while (isBinaryExpression(node) && node.operatorToken.kind === 56 /* AmpersandAmpersandToken */) { const isUsed = forEachChild(node.right, function visit(child) { if (isIdentifier(child)) { const symbol = getSymbolAtLocation(child); @@ -78918,12 +79397,12 @@ ${lanes.join("\n")} } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 258 /* VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 260 /* VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 258 /* VariableDeclarationList */) { + if (node.initializer.kind === 260 /* VariableDeclarationList */) { forEach(node.initializer.declarations, checkVariableDeclaration); } else { checkExpression(node.initializer); @@ -78953,12 +79432,12 @@ ${lanes.join("\n")} } else if (compilerOptions.downlevelIteration && languageVersion < 2 /* ES2015 */) { checkExternalEmitHelpers(node, 256 /* ForOfIncludes */); } - if (node.initializer.kind === 258 /* VariableDeclarationList */) { + if (node.initializer.kind === 260 /* VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { const varExpr = node.initializer; const iteratedType = checkRightHandSideOfForOf(node); - if (varExpr.kind === 206 /* ArrayLiteralExpression */ || varExpr.kind === 207 /* ObjectLiteralExpression */) { + if (varExpr.kind === 208 /* ArrayLiteralExpression */ || varExpr.kind === 209 /* ObjectLiteralExpression */) { checkDestructuringAssignment(varExpr, iteratedType || errorType); } else { const leftType = checkExpression(varExpr); @@ -78980,7 +79459,7 @@ ${lanes.join("\n")} function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); const rightType = getNonNullableTypeIfNeeded(checkExpression(node.expression)); - if (node.initializer.kind === 258 /* VariableDeclarationList */) { + if (node.initializer.kind === 260 /* VariableDeclarationList */) { const variable = node.initializer.declarations[0]; if (variable && isBindingPattern(variable.name)) { error(variable.name, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -78989,7 +79468,7 @@ ${lanes.join("\n")} } else { const varExpr = node.initializer; const leftType = checkExpression(varExpr); - if (varExpr.kind === 206 /* ArrayLiteralExpression */ || varExpr.kind === 207 /* ObjectLiteralExpression */) { + if (varExpr.kind === 208 /* ArrayLiteralExpression */ || varExpr.kind === 209 /* ObjectLiteralExpression */) { error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); @@ -79104,7 +79583,7 @@ ${lanes.join("\n")} } return use & 128 /* PossiblyOutOfBounds */ ? includeUndefinedInIndexSignature(arrayElementType) : arrayElementType; function getIterationDiagnosticDetails(allowsStrings, downlevelIteration2) { - var _a2; + var _a; if (downlevelIteration2) { return allowsStrings ? [Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator, true] : [Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator, true]; } @@ -79118,7 +79597,7 @@ ${lanes.join("\n")} if (yieldType) { return [Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, false]; } - if (isES2015OrLaterIterable((_a2 = inputType.symbol) == null ? void 0 : _a2.escapedName)) { + if (isES2015OrLaterIterable((_a = inputType.symbol) == null ? void 0 : _a.escapedName)) { return [Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, true]; } return allowsStrings ? [Diagnostics.Type_0_is_not_an_array_type_or_a_string_type, true] : [Diagnostics.Type_0_is_not_an_array_type, true]; @@ -79190,7 +79669,7 @@ ${lanes.join("\n")} return type[cacheKey] = cachedTypes2; } function getIterationTypesOfIterable(type, use, errorNode) { - var _a2, _b; + var _a, _b; if (isTypeAny(type)) { return anyIterationTypes; } @@ -79205,7 +79684,7 @@ ${lanes.join("\n")} } } return void 0; - } else if ((_a2 = errorOutputContainer == null ? void 0 : errorOutputContainer.errors) == null ? void 0 : _a2.length) { + } else if ((_a = errorOutputContainer == null ? void 0 : errorOutputContainer.errors) == null ? void 0 : _a.length) { for (const diag2 of errorOutputContainer.errors) { diagnostics.add(diag2); } @@ -79371,7 +79850,6 @@ ${lanes.join("\n")} return uniqueType && isTypeUsableAsPropertyName(uniqueType) ? getPropertyNameFromType(uniqueType) : `__@${symbolName2}`; } function getIterationTypesOfIterableSlow(type, resolver, errorNode, errorOutputContainer, noCache) { - var _a2; const method = getPropertyOfType(type, getPropertyNameForKnownSymbolName(resolver.iteratorSymbolName)); const methodType = method && !(method.flags & 16777216 /* Optional */) ? getTypeOfSymbol(method) : void 0; if (isTypeAny(methodType)) { @@ -79382,7 +79860,7 @@ ${lanes.join("\n")} return noCache ? noIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, noIterationTypes); } const iteratorType = getIntersectionType(map(signatures, getReturnTypeOfSignature)); - const iterationTypes = (_a2 = getIterationTypesOfIteratorWorker(iteratorType, resolver, errorNode, errorOutputContainer, noCache)) != null ? _a2 : noIterationTypes; + const iterationTypes = getIterationTypesOfIteratorWorker(iteratorType, resolver, errorNode, errorOutputContainer, noCache) ?? noIterationTypes; return noCache ? iterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, iterationTypes); } function reportTypeNotIterableError(errorNode, type, allowAsyncIterables) { @@ -79390,12 +79868,12 @@ ${lanes.join("\n")} const suggestAwait = ( // for (const x of Promise<...>) or [...Promise<...>] !!getAwaitedTypeOfPromise(type) || !allowAsyncIterables && isForOfStatement(errorNode.parent) && errorNode.parent.expression === errorNode && getGlobalAsyncIterableType( - /** reportErrors */ + /*reportErrors*/ false ) !== emptyGenericType && isTypeAssignableTo( type, getGlobalAsyncIterableType( - /** reportErrors */ + /*reportErrors*/ false ) ) @@ -79421,7 +79899,7 @@ ${lanes.join("\n")} iterationTypes = void 0; noCache = true; } - iterationTypes != null ? iterationTypes : iterationTypes = getIterationTypesOfIteratorSlow(type, resolver, errorNode, errorOutputContainer, noCache); + iterationTypes ?? (iterationTypes = getIterationTypesOfIteratorSlow(type, resolver, errorNode, errorOutputContainer, noCache)); return iterationTypes === noIterationTypes ? void 0 : iterationTypes; } function getIterationTypesOfIteratorCached(type, resolver) { @@ -79517,7 +79995,7 @@ ${lanes.join("\n")} )); } function getIterationTypesOfMethod(type, resolver, methodName, errorNode, errorOutputContainer) { - var _a2, _b, _c, _d, _e, _f; + var _a, _b, _c, _d; const method = getPropertyOfType(type, methodName); if (!method && methodName !== "next") { return void 0; @@ -79531,7 +80009,7 @@ ${lanes.join("\n")} if (errorNode) { const diagnostic = methodName === "next" ? resolver.mustHaveANextMethodDiagnostic : resolver.mustBeAMethodDiagnostic; if (errorOutputContainer) { - (_a2 = errorOutputContainer.errors) != null ? _a2 : errorOutputContainer.errors = []; + errorOutputContainer.errors ?? (errorOutputContainer.errors = []); errorOutputContainer.errors.push(createDiagnosticForNode(errorNode, diagnostic, methodName)); } else { error(errorNode, diagnostic, methodName); @@ -79548,8 +80026,8 @@ ${lanes.join("\n")} /*reportErrors*/ false ); - const isGeneratorMethod = ((_c = (_b = globalGeneratorType.symbol) == null ? void 0 : _b.members) == null ? void 0 : _c.get(methodName)) === methodType.symbol; - const isIteratorMethod = !isGeneratorMethod && ((_e = (_d = globalIteratorType.symbol) == null ? void 0 : _d.members) == null ? void 0 : _e.get(methodName)) === methodType.symbol; + const isGeneratorMethod = ((_b = (_a = globalGeneratorType.symbol) == null ? void 0 : _a.members) == null ? void 0 : _b.get(methodName)) === methodType.symbol; + const isIteratorMethod = !isGeneratorMethod && ((_d = (_c = globalIteratorType.symbol) == null ? void 0 : _c.members) == null ? void 0 : _d.get(methodName)) === methodType.symbol; if (isGeneratorMethod || isIteratorMethod) { const globalType = isGeneratorMethod ? globalGeneratorType : globalIteratorType; const { mapper } = methodType; @@ -79586,7 +80064,7 @@ ${lanes.join("\n")} if (iterationTypes === noIterationTypes) { if (errorNode) { if (errorOutputContainer) { - (_f = errorOutputContainer.errors) != null ? _f : errorOutputContainer.errors = []; + errorOutputContainer.errors ?? (errorOutputContainer.errors = []); errorOutputContainer.errors.push(createDiagnosticForNode(errorNode, resolver.mustHaveAValueDiagnostic, methodName)); } else { error(errorNode, resolver.mustHaveAValueDiagnostic, methodName); @@ -79651,12 +80129,11 @@ ${lanes.join("\n")} } return isAsync ? getAwaitedTypeNoAlias(returnType) || errorType : returnType; } - function isUnwrappedReturnTypeVoidOrAny(func, returnType) { - const unwrappedReturnType = unwrapReturnType(returnType, getFunctionFlags(func)); - return !!unwrappedReturnType && maybeTypeOfKind(unwrappedReturnType, 16384 /* Void */ | 3 /* AnyOrUnknown */); + function isUnwrappedReturnTypeUndefinedVoidOrAny(func, returnType) { + const type = unwrapReturnType(returnType, getFunctionFlags(func)); + return !!(type && (maybeTypeOfKind(type, 16384 /* Void */) || type.flags & (1 /* Any */ | 32768 /* Undefined */))); } function checkReturnStatement(node) { - var _a2; if (checkGrammarStatementInAmbientContext(node)) { return; } @@ -79674,16 +80151,16 @@ ${lanes.join("\n")} const functionFlags = getFunctionFlags(container); if (strictNullChecks || node.expression || returnType.flags & 131072 /* Never */) { const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (container.kind === 175 /* SetAccessor */) { + if (container.kind === 177 /* SetAccessor */) { if (node.expression) { error(node, Diagnostics.Setters_cannot_return_a_value); } - } else if (container.kind === 173 /* Constructor */) { + } else if (container.kind === 175 /* Constructor */) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } } else if (getReturnTypeFromAnnotation(container)) { - const unwrappedReturnType = (_a2 = unwrapReturnType(returnType, functionFlags)) != null ? _a2 : returnType; + const unwrappedReturnType = unwrapReturnType(returnType, functionFlags) ?? returnType; const unwrappedExprType = functionFlags & 2 /* Async */ ? checkAwaitedType( exprType, /*withAlias*/ @@ -79695,7 +80172,7 @@ ${lanes.join("\n")} checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, node, node.expression); } } - } else if (container.kind !== 173 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { + } else if (container.kind !== 175 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeUndefinedVoidOrAny(container, returnType)) { error(node, Diagnostics.Not_all_code_paths_return_a_value); } } @@ -79719,7 +80196,7 @@ ${lanes.join("\n")} let hasDuplicateDefaultClause = false; const expressionType = checkExpression(node.expression); forEach(node.caseBlock.clauses, (clause) => { - if (clause.kind === 293 /* DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 296 /* DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === void 0) { firstDefaultClause = clause; } else { @@ -79727,7 +80204,7 @@ ${lanes.join("\n")} hasDuplicateDefaultClause = true; } } - if (clause.kind === 292 /* CaseClause */) { + if (clause.kind === 295 /* CaseClause */) { addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); } forEach(clause.statements, checkSourceElement); @@ -79759,7 +80236,7 @@ ${lanes.join("\n")} if (isFunctionLike(current)) { return "quit"; } - if (current.kind === 253 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 255 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, Diagnostics.Duplicate_label_0, getTextOfNode(node.label)); return true; } @@ -79800,7 +80277,7 @@ ${lanes.join("\n")} forEachKey(catchClause.locals, (caughtName) => { const blockLocal = blockLocals.get(caughtName); if ((blockLocal == null ? void 0 : blockLocal.valueDeclaration) && (blockLocal.flags & 2 /* BlockScopedVariable */) !== 0) { - grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, caughtName); + grammarErrorOnNode(blockLocal.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, unescapeLeadingUnderscores(caughtName)); } }); } @@ -79849,8 +80326,8 @@ ${lanes.join("\n")} return; } const indexInfos = getApplicableIndexInfos(type, propNameType); - const interfaceDeclaration = getObjectFlags(type) & 2 /* Interface */ ? getDeclarationOfKind(type.symbol, 261 /* InterfaceDeclaration */) : void 0; - const propDeclaration = declaration && declaration.kind === 223 /* BinaryExpression */ || name && name.kind === 164 /* ComputedPropertyName */ ? declaration : void 0; + const interfaceDeclaration = getObjectFlags(type) & 2 /* Interface */ ? getDeclarationOfKind(type.symbol, 263 /* InterfaceDeclaration */) : void 0; + const propDeclaration = declaration && declaration.kind === 225 /* BinaryExpression */ || name && name.kind === 166 /* ComputedPropertyName */ ? declaration : void 0; const localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : void 0; for (const info of indexInfos) { const localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfDeclaration(info.declaration)) === type.symbol ? info.declaration : void 0; @@ -79874,7 +80351,7 @@ ${lanes.join("\n")} function checkIndexConstraintForIndexSignature(type, checkInfo) { const declaration = checkInfo.declaration; const indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); - const interfaceDeclaration = getObjectFlags(type) & 2 /* Interface */ ? getDeclarationOfKind(type.symbol, 261 /* InterfaceDeclaration */) : void 0; + const interfaceDeclaration = getObjectFlags(type) & 2 /* Interface */ ? getDeclarationOfKind(type.symbol, 263 /* InterfaceDeclaration */) : void 0; const localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfDeclaration(declaration)) === type.symbol ? declaration : void 0; for (const info of indexInfos) { if (info === checkInfo) @@ -79980,7 +80457,7 @@ ${lanes.join("\n")} function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 180 /* TypeReference */) { + if (node.kind === 182 /* TypeReference */) { const type = getTypeFromTypeReference(node); if (type.flags & 262144 /* TypeParameter */) { for (let i = index; i < typeParameters.length; i++) { @@ -80044,7 +80521,6 @@ ${lanes.join("\n")} return true; } function getFirstTransformableStaticClassElement(node) { - var _a2; const willTransformStaticElementsOfDecoratedClass = !legacyDecorators && languageVersion < 99 /* ESNext */ && classOrConstructorParameterIsDecorated( /*useLegacyDecorators*/ false, @@ -80060,7 +80536,7 @@ ${lanes.join("\n")} member, node )) { - return (_a2 = firstOrUndefined(getDecorators(node))) != null ? _a2 : node; + return firstOrUndefined(getDecorators(node)) ?? node; } else if (willTransformPrivateElementsOrClassStaticBlocks) { if (isClassStaticBlockDeclaration(member)) { return member; @@ -80074,7 +80550,6 @@ ${lanes.join("\n")} } } function checkClassExpressionExternalHelpers(node) { - var _a2; if (node.name) return; const parent2 = walkUpOuterExpressions(node); @@ -80087,7 +80562,7 @@ ${lanes.join("\n")} false, node )) { - location = (_a2 = firstOrUndefined(getDecorators(node))) != null ? _a2 : node; + location = firstOrUndefined(getDecorators(node)) ?? node; } else { location = getFirstTransformableStaticClassElement(node); } @@ -80263,7 +80738,7 @@ ${lanes.join("\n")} type, typeWithThis, param, - /* memberIsParameterProperty */ + /*memberIsParameterProperty*/ true ); } @@ -80277,7 +80752,7 @@ ${lanes.join("\n")} type, typeWithThis, member, - /* memberIsParameterProperty */ + /*memberIsParameterProperty*/ false ); } @@ -80381,7 +80856,7 @@ ${lanes.join("\n")} getTypeOfSymbol(prop), getTypeOfSymbol(baseProp), member.name || member, - /*message*/ + /*headMessage*/ void 0, rootChain )) { @@ -80429,7 +80904,7 @@ ${lanes.join("\n")} memberHasOverrideModifier, hasAbstractModifier(member), isStatic(member), - /* memberIsParameterProperty */ + /*memberIsParameterProperty*/ false, symbolName(memberSymbol) ); @@ -80438,11 +80913,12 @@ ${lanes.join("\n")} return getCheckFlags(s) & 1 /* Instantiated */ ? s.links.target : s; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { - return filter(symbol.declarations, (d) => d.kind === 260 /* ClassDeclaration */ || d.kind === 261 /* InterfaceDeclaration */); + return filter(symbol.declarations, (d) => d.kind === 262 /* ClassDeclaration */ || d.kind === 263 /* InterfaceDeclaration */); } function checkKindsOfPropertyMemberOverrides(type, baseType) { - var _a2, _b, _c, _d; + var _a, _b, _c, _d; const baseProperties = getPropertiesOfType(baseType); + let inheritedAbstractMemberNotImplementedError; basePropertyCheck: for (const baseProperty of baseProperties) { const base = getTargetSymbol(baseProperty); @@ -80468,20 +80944,34 @@ ${lanes.join("\n")} continue basePropertyCheck; } } - if (derivedClassDecl.kind === 228 /* ClassExpression */) { - error( + if (!inheritedAbstractMemberNotImplementedError) { + inheritedAbstractMemberNotImplementedError = error( derivedClassDecl, - Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, - symbolToString(baseProperty), + Diagnostics.Non_abstract_class_0_does_not_implement_all_abstract_members_of_1, + typeToString(type), typeToString(baseType) ); + } + if (derivedClassDecl.kind === 230 /* ClassExpression */) { + addRelatedInfo( + inheritedAbstractMemberNotImplementedError, + createDiagnosticForNode( + baseProperty.valueDeclaration ?? (baseProperty.declarations && first(baseProperty.declarations)) ?? derivedClassDecl, + Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, + symbolToString(baseProperty), + typeToString(baseType) + ) + ); } else { - error( - derivedClassDecl, - Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, - typeToString(type), - symbolToString(baseProperty), - typeToString(baseType) + addRelatedInfo( + inheritedAbstractMemberNotImplementedError, + createDiagnosticForNode( + baseProperty.valueDeclaration ?? (baseProperty.declarations && first(baseProperty.declarations)) ?? derivedClassDecl, + Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2, + typeToString(type), + symbolToString(baseProperty), + typeToString(baseType) + ) ); } } @@ -80494,7 +80984,7 @@ ${lanes.join("\n")} const basePropertyFlags = base.flags & 98308 /* PropertyOrAccessor */; const derivedPropertyFlags = derived.flags & 98308 /* PropertyOrAccessor */; if (basePropertyFlags && derivedPropertyFlags) { - if ((getCheckFlags(base) & 6 /* Synthetic */ ? (_a2 = base.declarations) == null ? void 0 : _a2.some((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags)) : (_b = base.declarations) == null ? void 0 : _b.every((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags))) || getCheckFlags(base) & 262144 /* Mapped */ || derived.valueDeclaration && isBinaryExpression(derived.valueDeclaration)) { + if ((getCheckFlags(base) & 6 /* Synthetic */ ? (_a = base.declarations) == null ? void 0 : _a.some((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags)) : (_b = base.declarations) == null ? void 0 : _b.every((d) => isPropertyAbstractOrInterface(d, baseDeclarationFlags))) || getCheckFlags(base) & 262144 /* Mapped */ || derived.valueDeclaration && isBinaryExpression(derived.valueDeclaration)) { continue; } const overriddenInstanceProperty = basePropertyFlags !== 4 /* Property */ && derivedPropertyFlags === 4 /* Property */; @@ -80503,7 +80993,7 @@ ${lanes.join("\n")} const errorMessage2 = overriddenInstanceProperty ? Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property : Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor; error(getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage2, symbolToString(base), typeToString(baseType), typeToString(type)); } else if (useDefineForClassFields) { - const uninitialized = (_c = derived.declarations) == null ? void 0 : _c.find((d) => d.kind === 169 /* PropertyDeclaration */ && !d.initializer); + const uninitialized = (_c = derived.declarations) == null ? void 0 : _c.find((d) => d.kind === 171 /* PropertyDeclaration */ && !d.initializer); if (uninitialized && !(derived.flags & 33554432 /* Transient */) && !(baseDeclarationFlags & 256 /* Abstract */) && !(derivedDeclarationFlags & 256 /* Abstract */) && !((_d = derived.declarations) == null ? void 0 : _d.some((d) => !!(d.flags & 16777216 /* Ambient */)))) { const constructor = findConstructorDeclaration(getClassLikeDeclarationOfSymbol(type.symbol)); const propName = uninitialized.name; @@ -80613,7 +81103,7 @@ ${lanes.join("\n")} } } function isPropertyWithoutInitializer(node) { - return node.kind === 169 /* PropertyDeclaration */ && !hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; + return node.kind === 171 /* PropertyDeclaration */ && !hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; } function isPropertyInitializedInStaticBlocks(propName, propType, staticBlocks, startPos, endPos) { for (const staticBlock of staticBlocks) { @@ -80647,7 +81137,7 @@ ${lanes.join("\n")} checkExportsOnMergedDeclarations(node); const symbol = getSymbolOfDeclaration(node); checkTypeParameterListsIdentical(symbol); - const firstInterfaceDecl = getDeclarationOfKind(symbol, 261 /* InterfaceDeclaration */); + const firstInterfaceDecl = getDeclarationOfKind(symbol, 263 /* InterfaceDeclaration */); if (node === firstInterfaceDecl) { const type = getDeclaredTypeOfSymbol(symbol); const typeWithThis = getTypeWithThisArgument(type); @@ -80677,7 +81167,7 @@ ${lanes.join("\n")} checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); - if (node.type.kind === 139 /* IntrinsicKeyword */) { + if (node.type.kind === 141 /* IntrinsicKeyword */) { if (!intrinsicTypeKinds.has(node.name.escapedText) || length(node.typeParameters) !== 1) { error(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); } @@ -80738,68 +81228,68 @@ ${lanes.join("\n")} } function evaluate(expr, location) { switch (expr.kind) { - case 221 /* PrefixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: const value = evaluate(expr.operand, location); if (typeof value === "number") { switch (expr.operator) { - case 39 /* PlusToken */: + case 40 /* PlusToken */: return value; - case 40 /* MinusToken */: + case 41 /* MinusToken */: return -value; - case 54 /* TildeToken */: + case 55 /* TildeToken */: return ~value; } } break; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: const left = evaluate(expr.left, location); const right = evaluate(expr.right, location); if (typeof left === "number" && typeof right === "number") { switch (expr.operatorToken.kind) { - case 51 /* BarToken */: + case 52 /* BarToken */: return left | right; - case 50 /* AmpersandToken */: + case 51 /* AmpersandToken */: return left & right; - case 48 /* GreaterThanGreaterThanToken */: + case 49 /* GreaterThanGreaterThanToken */: return left >> right; - case 49 /* GreaterThanGreaterThanGreaterThanToken */: + case 50 /* GreaterThanGreaterThanGreaterThanToken */: return left >>> right; - case 47 /* LessThanLessThanToken */: + case 48 /* LessThanLessThanToken */: return left << right; - case 52 /* CaretToken */: + case 53 /* CaretToken */: return left ^ right; - case 41 /* AsteriskToken */: + case 42 /* AsteriskToken */: return left * right; - case 43 /* SlashToken */: + case 44 /* SlashToken */: return left / right; - case 39 /* PlusToken */: + case 40 /* PlusToken */: return left + right; - case 40 /* MinusToken */: + case 41 /* MinusToken */: return left - right; - case 44 /* PercentToken */: + case 45 /* PercentToken */: return left % right; - case 42 /* AsteriskAsteriskToken */: + case 43 /* AsteriskAsteriskToken */: return left ** right; } - } else if ((typeof left === "string" || typeof left === "number") && (typeof right === "string" || typeof right === "number") && expr.operatorToken.kind === 39 /* PlusToken */) { + } else if ((typeof left === "string" || typeof left === "number") && (typeof right === "string" || typeof right === "number") && expr.operatorToken.kind === 40 /* PlusToken */) { return "" + left + right; } break; - case 10 /* StringLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: + case 11 /* StringLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: return expr.text; - case 225 /* TemplateExpression */: + case 227 /* TemplateExpression */: return evaluateTemplateExpression(expr, location); - case 8 /* NumericLiteral */: + case 9 /* NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return evaluate(expr.expression, location); - case 79 /* Identifier */: + case 80 /* Identifier */: if (isInfinityOrNaNString(expr.escapedText)) { return +expr.escapedText; } - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: if (isEntityNameExpression(expr)) { const symbol = resolveEntityName( expr, @@ -80820,7 +81310,7 @@ ${lanes.join("\n")} } } break; - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: const root = expr.expression; if (isEntityNameExpression(root) && isStringLiteralLike(expr.argumentExpression)) { const rootSymbol = resolveEntityName( @@ -80887,7 +81377,7 @@ ${lanes.join("\n")} } let seenEnumMissingInitialInitializer = false; forEach(enumSymbol.declarations, (declaration) => { - if (declaration.kind !== 263 /* EnumDeclaration */) { + if (declaration.kind !== 265 /* EnumDeclaration */) { return false; } const enumDeclaration = declaration; @@ -80917,7 +81407,7 @@ ${lanes.join("\n")} const declarations = symbol.declarations; if (declarations) { for (const declaration of declarations) { - if ((declaration.kind === 260 /* ClassDeclaration */ || declaration.kind === 259 /* FunctionDeclaration */ && nodeIsPresent(declaration.body)) && !(declaration.flags & 16777216 /* Ambient */)) { + if ((declaration.kind === 262 /* ClassDeclaration */ || declaration.kind === 261 /* FunctionDeclaration */ && nodeIsPresent(declaration.body)) && !(declaration.flags & 16777216 /* Ambient */)) { return declaration; } } @@ -80944,7 +81434,7 @@ ${lanes.join("\n")} } addLazyDiagnostic(checkModuleDeclarationDiagnostics); function checkModuleDeclarationDiagnostics() { - var _a2, _b; + var _a, _b; const isGlobalAugmentation = isGlobalScopeAugmentation(node); const inAmbientContext = node.flags & 16777216 /* Ambient */; if (isGlobalAugmentation && !inAmbientContext) { @@ -80956,7 +81446,7 @@ ${lanes.join("\n")} return; } if (!checkGrammarModifiers(node)) { - if (!inAmbientContext && node.name.kind === 10 /* StringLiteral */) { + if (!inAmbientContext && node.name.kind === 11 /* StringLiteral */) { grammarErrorOnNode(node.name, Diagnostics.Only_ambient_modules_can_use_quoted_names); } } @@ -80969,7 +81459,7 @@ ${lanes.join("\n")} if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) { error(node.name, Diagnostics.Namespaces_are_not_allowed_in_global_script_files_when_0_is_enabled_If_this_file_is_not_intended_to_be_a_global_script_set_moduleDetection_to_force_or_add_an_empty_export_statement, isolatedModulesLikeFlagName); } - if (((_a2 = symbol.declarations) == null ? void 0 : _a2.length) > 1) { + if (((_a = symbol.declarations) == null ? void 0 : _a.length) > 1) { const firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (firstNonAmbientClassOrFunc) { if (getSourceFileOfNode(node) !== getSourceFileOfNode(firstNonAmbientClassOrFunc)) { @@ -80978,13 +81468,13 @@ ${lanes.join("\n")} error(node.name, Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - const mergedClass = getDeclarationOfKind(symbol, 260 /* ClassDeclaration */); + const mergedClass = getDeclarationOfKind(symbol, 262 /* ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 2048 /* LexicalModuleMergesWithClass */; } } - if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 308 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) { - const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 93 /* ExportKeyword */); + if (compilerOptions.verbatimModuleSyntax && node.parent.kind === 311 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || node.parent.impliedNodeFormat === 1 /* CommonJS */)) { + const exportModifier = (_b = node.modifiers) == null ? void 0 : _b.find((m) => m.kind === 95 /* ExportKeyword */); if (exportModifier) { error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled); } @@ -81016,21 +81506,21 @@ ${lanes.join("\n")} } function checkModuleAugmentationElement(node, isGlobalAugmentation) { switch (node.kind) { - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: for (const decl of node.declarationList.declarations) { checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 274 /* ExportAssignment */: - case 275 /* ExportDeclaration */: + case 276 /* ExportAssignment */: + case 277 /* ExportDeclaration */: grammarErrorOnFirstToken(node, Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 268 /* ImportEqualsDeclaration */: - case 269 /* ImportDeclaration */: + case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportDeclaration */: grammarErrorOnFirstToken(node, Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 205 /* BindingElement */: - case 257 /* VariableDeclaration */: + case 207 /* BindingElement */: + case 259 /* VariableDeclaration */: const name = node.name; if (isBindingPattern(name)) { for (const el of name.elements) { @@ -81038,12 +81528,12 @@ ${lanes.join("\n")} } break; } - case 260 /* ClassDeclaration */: - case 263 /* EnumDeclaration */: - case 259 /* FunctionDeclaration */: - case 261 /* InterfaceDeclaration */: - case 264 /* ModuleDeclaration */: - case 262 /* TypeAliasDeclaration */: + case 262 /* ClassDeclaration */: + case 265 /* EnumDeclaration */: + case 261 /* FunctionDeclaration */: + case 263 /* InterfaceDeclaration */: + case 266 /* ModuleDeclaration */: + case 264 /* TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } @@ -81052,20 +81542,20 @@ ${lanes.join("\n")} } function getFirstNonModuleExportsIdentifier(node) { switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return node; - case 163 /* QualifiedName */: + case 165 /* QualifiedName */: do { node = node.left; - } while (node.kind !== 79 /* Identifier */); + } while (node.kind !== 80 /* Identifier */); return node; - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: do { if (isModuleExportsAccessExpression(node.expression) && !isPrivateIdentifier(node.name)) { return node.name; } node = node.expression; - } while (node.kind !== 79 /* Identifier */); + } while (node.kind !== 80 /* Identifier */); return node; } } @@ -81078,9 +81568,9 @@ ${lanes.join("\n")} error(moduleName, Diagnostics.String_literal_expected); return false; } - const inAmbientExternalModule = node.parent.kind === 265 /* ModuleBlock */ && isAmbientModule(node.parent.parent); - if (node.parent.kind !== 308 /* SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 275 /* ExportDeclaration */ ? Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); + const inAmbientExternalModule = node.parent.kind === 267 /* ModuleBlock */ && isAmbientModule(node.parent.parent); + if (node.parent.kind !== 311 /* SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 277 /* ExportDeclaration */ ? Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) { @@ -81102,17 +81592,17 @@ ${lanes.join("\n")} return true; } function checkAliasSymbol(node) { - var _a2, _b, _c, _d, _e; + var _a, _b, _c, _d; let symbol = getSymbolOfDeclaration(node); const target = resolveAlias(symbol); if (target !== unknownSymbol) { symbol = getMergedSymbol(symbol.exportSymbol || symbol); if (isInJSFile(node) && !(target.flags & 111551 /* Value */) && !isTypeOnlyImportOrExportDeclaration(node)) { const errorNode = isImportOrExportSpecifier(node) ? node.propertyName || node.name : isNamedDeclaration(node) ? node.name : node; - Debug.assert(node.kind !== 277 /* NamespaceExport */); - if (node.kind === 278 /* ExportSpecifier */) { + Debug.assert(node.kind !== 279 /* NamespaceExport */); + if (node.kind === 280 /* ExportSpecifier */) { const diag2 = error(errorNode, Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); - const alreadyExportedSymbol = (_b = (_a2 = getSourceFileOfNode(node).symbol) == null ? void 0 : _a2.exports) == null ? void 0 : _b.get((node.propertyName || node.name).escapedText); + const alreadyExportedSymbol = (_b = (_a = getSourceFileOfNode(node).symbol) == null ? void 0 : _a.exports) == null ? void 0 : _b.get((node.propertyName || node.name).escapedText); if (alreadyExportedSymbol === target) { const exportingDeclaration = (_c = alreadyExportedSymbol.declarations) == null ? void 0 : _c.find(isJSDocNode); if (exportingDeclaration) { @@ -81124,9 +81614,9 @@ ${lanes.join("\n")} } } } else { - Debug.assert(node.kind !== 257 /* VariableDeclaration */); + Debug.assert(node.kind !== 259 /* VariableDeclaration */); const importDeclaration = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration)); - const moduleSpecifier = (_e = importDeclaration && ((_d = tryGetModuleSpecifierFromDeclaration(importDeclaration)) == null ? void 0 : _d.text)) != null ? _e : "..."; + const moduleSpecifier = (importDeclaration && ((_d = tryGetModuleSpecifierFromDeclaration(importDeclaration)) == null ? void 0 : _d.text)) ?? "..."; const importedIdentifier = unescapeLeadingUnderscores(isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); error( errorNode, @@ -81140,7 +81630,7 @@ ${lanes.join("\n")} const targetFlags = getAllSymbolFlags(target); const excludedMeanings = (symbol.flags & (111551 /* Value */ | 1048576 /* ExportValue */) ? 111551 /* Value */ : 0) | (symbol.flags & 788968 /* Type */ ? 788968 /* Type */ : 0) | (symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0); if (targetFlags & excludedMeanings) { - const message = node.kind === 278 /* ExportSpecifier */ ? Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; + const message = node.kind === 280 /* ExportSpecifier */ ? Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); } if (getIsolatedModules(compilerOptions) && !isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 16777216 /* Ambient */)) { @@ -81148,25 +81638,25 @@ ${lanes.join("\n")} const isType = !(targetFlags & 111551 /* Value */); if (isType || typeOnlyAlias) { switch (node.kind) { - case 270 /* ImportClause */: - case 273 /* ImportSpecifier */: - case 268 /* ImportEqualsDeclaration */: { + case 272 /* ImportClause */: + case 275 /* ImportSpecifier */: + case 270 /* ImportEqualsDeclaration */: { if (compilerOptions.preserveValueImports || compilerOptions.verbatimModuleSyntax) { Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); const message = compilerOptions.verbatimModuleSyntax && isInternalModuleImportEqualsDeclaration(node) ? Diagnostics.An_import_alias_cannot_resolve_to_a_type_or_type_only_declaration_when_verbatimModuleSyntax_is_enabled : isType ? compilerOptions.verbatimModuleSyntax ? Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled : Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : compilerOptions.verbatimModuleSyntax ? Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled : Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - const name = idText(node.kind === 273 /* ImportSpecifier */ ? node.propertyName || node.name : node.name); + const name = idText(node.kind === 275 /* ImportSpecifier */ ? node.propertyName || node.name : node.name); addTypeOnlyDeclarationRelatedInfo( error(node, message, name), isType ? void 0 : typeOnlyAlias, name ); } - if (isType && node.kind === 268 /* ImportEqualsDeclaration */ && hasEffectiveModifier(node, 1 /* Export */)) { + if (isType && node.kind === 270 /* ImportEqualsDeclaration */ && hasEffectiveModifier(node, 1 /* Export */)) { error(node, Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_0_is_enabled, isolatedModulesLikeFlagName); } break; } - case 278 /* ExportSpecifier */: { + case 280 /* ExportSpecifier */: { if (compilerOptions.verbatimModuleSyntax || getSourceFileOfNode(typeOnlyAlias) !== getSourceFileOfNode(node)) { const name = idText(node.propertyName || node.name); const diagnostic = isType ? error(node, Diagnostics.Re_exporting_a_type_when_0_is_enabled_requires_using_export_type, isolatedModulesLikeFlagName) : error(node, Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_re_exported_using_a_type_only_re_export_when_1_is_enabled, name, isolatedModulesLikeFlagName); @@ -81176,24 +81666,22 @@ ${lanes.join("\n")} } } } - if (compilerOptions.verbatimModuleSyntax && node.kind !== 268 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) { + if (compilerOptions.verbatimModuleSyntax && node.kind !== 270 /* ImportEqualsDeclaration */ && !isInJSFile(node) && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) { error(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled); } } if (isImportSpecifier(node)) { - const targetSymbol = checkDeprecatedAliasedSymbol(symbol, node); - if (isDeprecatedAliasedSymbol(targetSymbol) && targetSymbol.declarations) { + const targetSymbol = resolveAliasWithDeprecationCheck(symbol, node); + if (isDeprecatedSymbol(targetSymbol) && targetSymbol.declarations) { addDeprecatedSuggestion(node, targetSymbol.declarations, targetSymbol.escapedName); } } } } - function isDeprecatedAliasedSymbol(symbol) { - return !!symbol.declarations && every(symbol.declarations, (d) => !!(getCombinedNodeFlags(d) & 268435456 /* Deprecated */)); - } - function checkDeprecatedAliasedSymbol(symbol, location) { - if (!(symbol.flags & 2097152 /* Alias */)) + function resolveAliasWithDeprecationCheck(symbol, location) { + if (!(symbol.flags & 2097152 /* Alias */) || isDeprecatedSymbol(symbol) || !getDeclarationOfAliasSymbol(symbol)) { return symbol; + } const targetSymbol = resolveAlias(symbol); if (targetSymbol === unknownSymbol) return targetSymbol; @@ -81203,7 +81691,7 @@ ${lanes.join("\n")} if (target === targetSymbol) break; if (target.declarations && length(target.declarations)) { - if (isDeprecatedAliasedSymbol(target)) { + if (isDeprecatedSymbol(target)) { addDeprecatedSuggestion(location, target.declarations, target.escapedName); break; } else { @@ -81221,12 +81709,12 @@ ${lanes.join("\n")} function checkImportBinding(node) { checkCollisionsForDeclarationName(node, node.name); checkAliasSymbol(node); - if (node.kind === 273 /* ImportSpecifier */ && idText(node.propertyName || node.name) === "default" && getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) { + if (node.kind === 275 /* ImportSpecifier */ && idText(node.propertyName || node.name) === "default" && getESModuleInterop(compilerOptions) && moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) { checkExternalEmitHelpers(node, 131072 /* ImportDefault */); } } function checkAssertClause(declaration) { - var _a2; + var _a; if (declaration.assertClause) { const validForTypeAssertions = isExclusivelyTypeOnlyImportOrExport(declaration); const override = getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : void 0); @@ -81246,7 +81734,7 @@ ${lanes.join("\n")} moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext ); } - if (isImportDeclaration(declaration) ? (_a2 = declaration.importClause) == null ? void 0 : _a2.isTypeOnly : declaration.isTypeOnly) { + if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) { return grammarErrorOnNode(declaration.assertClause, Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports); } if (override) { @@ -81268,7 +81756,7 @@ ${lanes.join("\n")} checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 271 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 273 /* NamespaceImport */) { checkImportBinding(importClause.namedBindings); if (moduleKind !== 4 /* System */ && (moduleKind < 5 /* ES2015 */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */) && getESModuleInterop(compilerOptions)) { checkExternalEmitHelpers(node, 65536 /* ImportStar */); @@ -81294,7 +81782,7 @@ ${lanes.join("\n")} if (hasSyntacticModifier(node, 1 /* Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 280 /* ExternalModuleReference */) { + if (node.moduleReference.kind !== 282 /* ExternalModuleReference */) { const target = resolveAlias(getSymbolOfDeclaration(node)); if (target !== unknownSymbol) { const targetFlags = getAllSymbolFlags(target); @@ -81332,9 +81820,9 @@ ${lanes.join("\n")} if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause && !isNamespaceExport(node.exportClause)) { forEach(node.exportClause.elements, checkExportSpecifier); - const inAmbientExternalModule = node.parent.kind === 265 /* ModuleBlock */ && isAmbientModule(node.parent.parent); - const inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 265 /* ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* Ambient */; - if (node.parent.kind !== 308 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + const inAmbientExternalModule = node.parent.kind === 267 /* ModuleBlock */ && isAmbientModule(node.parent.parent); + const inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 267 /* ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* Ambient */; + if (node.parent.kind !== 311 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } else { @@ -81358,14 +81846,14 @@ ${lanes.join("\n")} checkAssertClause(node); } function checkGrammarExportDeclaration(node) { - var _a2; - if (node.isTypeOnly && ((_a2 = node.exportClause) == null ? void 0 : _a2.kind) === 276 /* NamedExports */) { + var _a; + if (node.isTypeOnly && ((_a = node.exportClause) == null ? void 0 : _a.kind) === 278 /* NamedExports */) { return checkGrammarNamedImportsOrExports(node.exportClause); } return false; } function checkGrammarModuleElementContext(node, errorMessage) { - const isInAppropriateContext = node.parent.kind === 308 /* SourceFile */ || node.parent.kind === 265 /* ModuleBlock */ || node.parent.kind === 264 /* ModuleDeclaration */; + const isInAppropriateContext = node.parent.kind === 311 /* SourceFile */ || node.parent.kind === 267 /* ModuleBlock */ || node.parent.kind === 266 /* ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -81396,6 +81884,9 @@ ${lanes.join("\n")} ) && !getSymbolLinks(getSymbolOfDeclaration(statement)).constEnumReferenced; } function checkImportsForTypeOnlyConversion(sourceFile) { + if (!canCollectSymbolAliasAccessabilityData) { + return; + } for (const statement of sourceFile.statements) { if (canConvertImportDeclarationToTypeOnly(statement) || canConvertImportEqualsDeclarationToTypeOnly(statement)) { error( @@ -81449,8 +81940,8 @@ ${lanes.join("\n")} if (checkGrammarModuleElementContext(node, illegalContextMessage)) { return; } - const container = node.parent.kind === 308 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 264 /* ModuleDeclaration */ && !isAmbientModule(container)) { + const container = node.parent.kind === 311 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 266 /* ModuleDeclaration */ && !isAmbientModule(container)) { if (node.isExportEquals) { error(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } else { @@ -81466,7 +81957,7 @@ ${lanes.join("\n")} checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression); } const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */); - if (node.expression.kind === 79 /* Identifier */) { + if (node.expression.kind === 80 /* Identifier */) { const id = node.expression; const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName( id, @@ -81593,182 +82084,182 @@ ${lanes.join("\n")} const kind = node.kind; if (cancellationToken) { switch (kind) { - case 264 /* ModuleDeclaration */: - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: - case 259 /* FunctionDeclaration */: + case 266 /* ModuleDeclaration */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: + case 261 /* FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 240 /* FirstStatement */ && kind <= 256 /* LastStatement */ && canHaveFlowNode(node) && node.flowNode && !isReachableFlowNode(node.flowNode)) { + if (kind >= 242 /* FirstStatement */ && kind <= 258 /* LastStatement */ && canHaveFlowNode(node) && node.flowNode && !isReachableFlowNode(node.flowNode)) { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, Diagnostics.Unreachable_code_detected); } switch (kind) { - case 165 /* TypeParameter */: + case 167 /* TypeParameter */: return checkTypeParameter(node); - case 166 /* Parameter */: + case 168 /* Parameter */: return checkParameter(node); - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return checkPropertyDeclaration(node); - case 168 /* PropertySignature */: + case 170 /* PropertySignature */: return checkPropertySignature(node); - case 182 /* ConstructorType */: - case 181 /* FunctionType */: - case 176 /* CallSignature */: - case 177 /* ConstructSignature */: - case 178 /* IndexSignature */: + case 184 /* ConstructorType */: + case 183 /* FunctionType */: + case 178 /* CallSignature */: + case 179 /* ConstructSignature */: + case 180 /* IndexSignature */: return checkSignatureDeclaration(node); - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: return checkMethodDeclaration(node); - case 172 /* ClassStaticBlockDeclaration */: + case 174 /* ClassStaticBlockDeclaration */: return checkClassStaticBlockDeclaration(node); - case 173 /* Constructor */: + case 175 /* Constructor */: return checkConstructorDeclaration(node); - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return checkAccessorDeclaration(node); - case 180 /* TypeReference */: + case 182 /* TypeReference */: return checkTypeReferenceNode(node); - case 179 /* TypePredicate */: + case 181 /* TypePredicate */: return checkTypePredicate(node); - case 183 /* TypeQuery */: + case 185 /* TypeQuery */: return checkTypeQuery(node); - case 184 /* TypeLiteral */: + case 186 /* TypeLiteral */: return checkTypeLiteral(node); - case 185 /* ArrayType */: + case 187 /* ArrayType */: return checkArrayType(node); - case 186 /* TupleType */: + case 188 /* TupleType */: return checkTupleType(node); - case 189 /* UnionType */: - case 190 /* IntersectionType */: + case 191 /* UnionType */: + case 192 /* IntersectionType */: return checkUnionOrIntersectionType(node); - case 193 /* ParenthesizedType */: - case 187 /* OptionalType */: - case 188 /* RestType */: + case 195 /* ParenthesizedType */: + case 189 /* OptionalType */: + case 190 /* RestType */: return checkSourceElement(node.type); - case 194 /* ThisType */: + case 196 /* ThisType */: return checkThisType(node); - case 195 /* TypeOperator */: + case 197 /* TypeOperator */: return checkTypeOperator(node); - case 191 /* ConditionalType */: + case 193 /* ConditionalType */: return checkConditionalType(node); - case 192 /* InferType */: + case 194 /* InferType */: return checkInferType(node); - case 200 /* TemplateLiteralType */: + case 202 /* TemplateLiteralType */: return checkTemplateLiteralType(node); - case 202 /* ImportType */: + case 204 /* ImportType */: return checkImportType(node); - case 199 /* NamedTupleMember */: + case 201 /* NamedTupleMember */: return checkNamedTupleMember(node); - case 331 /* JSDocAugmentsTag */: + case 334 /* JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 332 /* JSDocImplementsTag */: + case 335 /* JSDocImplementsTag */: return checkJSDocImplementsTag(node); - case 349 /* JSDocTypedefTag */: - case 341 /* JSDocCallbackTag */: - case 343 /* JSDocEnumTag */: + case 352 /* JSDocTypedefTag */: + case 344 /* JSDocCallbackTag */: + case 346 /* JSDocEnumTag */: return checkJSDocTypeAliasTag(node); - case 348 /* JSDocTemplateTag */: + case 351 /* JSDocTemplateTag */: return checkJSDocTemplateTag(node); - case 347 /* JSDocTypeTag */: + case 350 /* JSDocTypeTag */: return checkJSDocTypeTag(node); - case 327 /* JSDocLink */: - case 328 /* JSDocLinkCode */: - case 329 /* JSDocLinkPlain */: + case 330 /* JSDocLink */: + case 331 /* JSDocLinkCode */: + case 332 /* JSDocLinkPlain */: return checkJSDocLinkLikeTag(node); - case 344 /* JSDocParameterTag */: + case 347 /* JSDocParameterTag */: return checkJSDocParameterTag(node); - case 351 /* JSDocPropertyTag */: + case 354 /* JSDocPropertyTag */: return checkJSDocPropertyTag(node); - case 320 /* JSDocFunctionType */: + case 323 /* JSDocFunctionType */: checkJSDocFunctionType(node); - case 318 /* JSDocNonNullableType */: - case 317 /* JSDocNullableType */: - case 315 /* JSDocAllType */: - case 316 /* JSDocUnknownType */: - case 325 /* JSDocTypeLiteral */: + case 321 /* JSDocNonNullableType */: + case 320 /* JSDocNullableType */: + case 318 /* JSDocAllType */: + case 319 /* JSDocUnknownType */: + case 328 /* JSDocTypeLiteral */: checkJSDocTypeIsInJsFile(node); forEachChild(node, checkSourceElement); return; - case 321 /* JSDocVariadicType */: + case 324 /* JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 312 /* JSDocTypeExpression */: + case 315 /* JSDocTypeExpression */: return checkSourceElement(node.type); - case 336 /* JSDocPublicTag */: - case 338 /* JSDocProtectedTag */: - case 337 /* JSDocPrivateTag */: + case 339 /* JSDocPublicTag */: + case 341 /* JSDocProtectedTag */: + case 340 /* JSDocPrivateTag */: return checkJSDocAccessibilityModifiers(node); - case 353 /* JSDocSatisfiesTag */: + case 356 /* JSDocSatisfiesTag */: return checkJSDocSatisfiesTag(node); - case 196 /* IndexedAccessType */: + case 198 /* IndexedAccessType */: return checkIndexedAccessType(node); - case 197 /* MappedType */: + case 199 /* MappedType */: return checkMappedType(node); - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: return checkFunctionDeclaration(node); - case 238 /* Block */: - case 265 /* ModuleBlock */: + case 240 /* Block */: + case 267 /* ModuleBlock */: return checkBlock(node); - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: return checkVariableStatement(node); - case 241 /* ExpressionStatement */: + case 243 /* ExpressionStatement */: return checkExpressionStatement(node); - case 242 /* IfStatement */: + case 244 /* IfStatement */: return checkIfStatement(node); - case 243 /* DoStatement */: + case 245 /* DoStatement */: return checkDoStatement(node); - case 244 /* WhileStatement */: + case 246 /* WhileStatement */: return checkWhileStatement(node); - case 245 /* ForStatement */: + case 247 /* ForStatement */: return checkForStatement(node); - case 246 /* ForInStatement */: + case 248 /* ForInStatement */: return checkForInStatement(node); - case 247 /* ForOfStatement */: + case 249 /* ForOfStatement */: return checkForOfStatement(node); - case 248 /* ContinueStatement */: - case 249 /* BreakStatement */: + case 250 /* ContinueStatement */: + case 251 /* BreakStatement */: return checkBreakOrContinueStatement(node); - case 250 /* ReturnStatement */: + case 252 /* ReturnStatement */: return checkReturnStatement(node); - case 251 /* WithStatement */: + case 253 /* WithStatement */: return checkWithStatement(node); - case 252 /* SwitchStatement */: + case 254 /* SwitchStatement */: return checkSwitchStatement(node); - case 253 /* LabeledStatement */: + case 255 /* LabeledStatement */: return checkLabeledStatement(node); - case 254 /* ThrowStatement */: + case 256 /* ThrowStatement */: return checkThrowStatement(node); - case 255 /* TryStatement */: + case 257 /* TryStatement */: return checkTryStatement(node); - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: return checkVariableDeclaration(node); - case 205 /* BindingElement */: + case 207 /* BindingElement */: return checkBindingElement(node); - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: return checkClassDeclaration(node); - case 261 /* InterfaceDeclaration */: + case 263 /* InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 262 /* TypeAliasDeclaration */: + case 264 /* TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 263 /* EnumDeclaration */: + case 265 /* EnumDeclaration */: return checkEnumDeclaration(node); - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: return checkModuleDeclaration(node); - case 269 /* ImportDeclaration */: + case 271 /* ImportDeclaration */: return checkImportDeclaration(node); - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: return checkExportDeclaration(node); - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: return checkExportAssignment(node); - case 239 /* EmptyStatement */: - case 256 /* DebuggerStatement */: + case 241 /* EmptyStatement */: + case 258 /* DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 279 /* MissingDeclaration */: + case 281 /* MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -81784,7 +82275,7 @@ ${lanes.join("\n")} function checkJSDocTypeIsInJsFile(node) { if (!isInJSFile(node)) { if (isJSDocNonNullableType(node) || isJSDocNullableType(node)) { - const token = tokenToString(isJSDocNonNullableType(node) ? 53 /* ExclamationToken */ : 57 /* QuestionToken */); + const token = tokenToString(isJSDocNonNullableType(node) ? 54 /* ExclamationToken */ : 58 /* QuestionToken */); const diagnostic = node.postfix ? Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1 : Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1; const typeNode = node.type; const type = getTypeFromTypeNode(typeNode); @@ -81861,48 +82352,52 @@ ${lanes.join("\n")} links.deferredNodes = void 0; } function checkDeferredNode(node) { - var _a2, _b; - (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Check, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath }); + var _a, _b; + (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Check, "checkDeferredNode", { kind: node.kind, pos: node.pos, end: node.end, path: node.tracingPath }); const saveCurrentNode = currentNode; currentNode = node; instantiationCount = 0; switch (node.kind) { - case 210 /* CallExpression */: - case 211 /* NewExpression */: - case 212 /* TaggedTemplateExpression */: - case 167 /* Decorator */: - case 283 /* JsxOpeningElement */: + case 212 /* CallExpression */: + case 213 /* NewExpression */: + case 214 /* TaggedTemplateExpression */: + case 169 /* Decorator */: + case 285 /* JsxOpeningElement */: resolveUntypedCall(node); break; - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: checkAccessorDeclaration(node); break; - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: checkClassExpressionDeferred(node); break; - case 165 /* TypeParameter */: + case 167 /* TypeParameter */: checkTypeParameterDeferred(node); break; - case 282 /* JsxSelfClosingElement */: + case 284 /* JsxSelfClosingElement */: checkJsxSelfClosingElementDeferred(node); break; - case 281 /* JsxElement */: + case 283 /* JsxElement */: checkJsxElementDeferred(node); break; + case 215 /* TypeAssertionExpression */: + case 233 /* AsExpression */: + case 216 /* ParenthesizedExpression */: + checkAssertionDeferred(node); } currentNode = saveCurrentNode; (_b = tracing) == null ? void 0 : _b.pop(); } function checkSourceFile(node) { - var _a2, _b; - (_a2 = tracing) == null ? void 0 : _a2.push( + var _a, _b; + (_a = tracing) == null ? void 0 : _a.push( tracing.Phase.Check, "checkSourceFile", { path: node.path }, @@ -82045,27 +82540,27 @@ ${lanes.join("\n")} copySymbols(location.locals, meaning); } switch (location.kind) { - case 308 /* SourceFile */: + case 311 /* SourceFile */: if (!isExternalModule(location)) break; - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: copyLocallyVisibleExportSymbols(getSymbolOfDeclaration(location).exports, meaning & 2623475 /* ModuleMember */); break; - case 263 /* EnumDeclaration */: + case 265 /* EnumDeclaration */: copySymbols(getSymbolOfDeclaration(location).exports, meaning & 8 /* EnumMember */); break; - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: const className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: if (!isStaticSymbol) { copySymbols(getMembersOfSymbol(getSymbolOfDeclaration(location)), meaning & 788968 /* Type */); } break; - case 215 /* FunctionExpression */: + case 217 /* FunctionExpression */: const funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -82101,7 +82596,7 @@ ${lanes.join("\n")} function copyLocallyVisibleExportSymbols(source, meaning2) { if (meaning2) { source.forEach((symbol) => { - if (!getDeclarationOfKind(symbol, 278 /* ExportSpecifier */) && !getDeclarationOfKind(symbol, 277 /* NamespaceExport */)) { + if (!getDeclarationOfKind(symbol, 280 /* ExportSpecifier */) && !getDeclarationOfKind(symbol, 279 /* NamespaceExport */)) { copySymbol(symbol, meaning2); } }); @@ -82109,19 +82604,19 @@ ${lanes.join("\n")} } } function isTypeDeclarationName(name) { - return name.kind === 79 /* Identifier */ && isTypeDeclaration(name.parent) && getNameOfDeclaration(name.parent) === name; + return name.kind === 80 /* Identifier */ && isTypeDeclaration(name.parent) && getNameOfDeclaration(name.parent) === name; } function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 163 /* QualifiedName */) { + while (node.parent.kind === 165 /* QualifiedName */) { node = node.parent; } - return node.parent.kind === 180 /* TypeReference */; + return node.parent.kind === 182 /* TypeReference */; } function isInNameOfExpressionWithTypeArguments(node) { - while (node.parent.kind === 208 /* PropertyAccessExpression */) { + while (node.parent.kind === 210 /* PropertyAccessExpression */) { node = node.parent; } - return node.parent.kind === 230 /* ExpressionWithTypeArguments */; + return node.parent.kind === 232 /* ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { let result; @@ -82147,13 +82642,13 @@ ${lanes.join("\n")} return !!forEachEnclosingClass(node, (n) => n === classDeclaration); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 163 /* QualifiedName */) { + while (nodeOnRightSide.parent.kind === 165 /* QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 268 /* ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 270 /* ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : void 0; } - if (nodeOnRightSide.parent.kind === 274 /* ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 276 /* ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : void 0; } return void 0; @@ -82179,24 +82674,47 @@ ${lanes.join("\n")} node = parent2; parent2 = parent2.parent; } - if (parent2 && parent2.kind === 202 /* ImportType */ && parent2.qualifier === node) { + if (parent2 && parent2.kind === 204 /* ImportType */ && parent2.qualifier === node) { return parent2; } return void 0; } + function isThisPropertyAndThisTyped(node) { + if (node.expression.kind === 110 /* ThisKeyword */) { + const container = getThisContainer( + node, + /*includeArrowFunctions*/ + false, + /*includeClassComputedPropertyName*/ + false + ); + if (isFunctionLike(container)) { + const containingLiteral = getContainingObjectLiteral(container); + if (containingLiteral) { + const contextualType = getApparentTypeOfContextualType( + containingLiteral, + /*contextFlags*/ + void 0 + ); + const type = contextualType && getThisTypeFromContextualType(contextualType); + return type && !isTypeAny(type); + } + } + } + } function getSymbolOfNameOrPropertyAccessExpression(name) { if (isDeclarationName(name)) { return getSymbolOfNode(name.parent); } - if (isInJSFile(name) && name.parent.kind === 208 /* PropertyAccessExpression */ && name.parent === name.parent.parent.left) { - if (!isPrivateIdentifier(name) && !isJSDocMemberName(name)) { + if (isInJSFile(name) && name.parent.kind === 210 /* PropertyAccessExpression */ && name.parent === name.parent.parent.left) { + if (!isPrivateIdentifier(name) && !isJSDocMemberName(name) && !isThisPropertyAndThisTyped(name.parent)) { const specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(name); if (specialPropertyAssignmentSymbol) { return specialPropertyAssignmentSymbol; } } } - if (name.parent.kind === 274 /* ExportAssignment */ && isEntityNameExpression(name)) { + if (name.parent.kind === 276 /* ExportAssignment */ && isEntityNameExpression(name)) { const success = resolveEntityName( name, /*all meanings*/ @@ -82208,7 +82726,7 @@ ${lanes.join("\n")} return success; } } else if (isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { - const importEqualsDeclaration = getAncestor(name, 268 /* ImportEqualsDeclaration */); + const importEqualsDeclaration = getAncestor(name, 270 /* ImportEqualsDeclaration */); Debug.assert(importEqualsDeclaration !== void 0); return getSymbolOfPartOfRightHandSideOfImportEquals( name, @@ -82229,7 +82747,7 @@ ${lanes.join("\n")} } if (isInNameOfExpressionWithTypeArguments(name)) { let meaning = 0 /* None */; - if (name.parent.kind === 230 /* ExpressionWithTypeArguments */) { + if (name.parent.kind === 232 /* ExpressionWithTypeArguments */) { meaning = isPartOfTypeNode(name) ? 788968 /* Type */ : 111551 /* Value */; if (isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { meaning |= 111551 /* Value */; @@ -82238,15 +82756,20 @@ ${lanes.join("\n")} meaning = 1920 /* Namespace */; } meaning |= 2097152 /* Alias */; - const entityNameSymbol = isEntityNameExpression(name) ? resolveEntityName(name, meaning) : void 0; + const entityNameSymbol = isEntityNameExpression(name) ? resolveEntityName( + name, + meaning, + /*ignoreErrors*/ + true + ) : void 0; if (entityNameSymbol) { return entityNameSymbol; } } - if (name.parent.kind === 344 /* JSDocParameterTag */) { + if (name.parent.kind === 347 /* JSDocParameterTag */) { return getParameterSymbolFromJSDoc(name.parent); } - if (name.parent.kind === 165 /* TypeParameter */ && name.parent.parent.kind === 348 /* JSDocTemplateTag */) { + if (name.parent.kind === 167 /* TypeParameter */ && name.parent.parent.kind === 351 /* JSDocTemplateTag */) { Debug.assert(!isInJSFile(name)); const typeParameter = getTypeParameterFromJsDoc(name.parent); return typeParameter && typeParameter.symbol; @@ -82257,8 +82780,8 @@ ${lanes.join("\n")} } const isJSDoc2 = findAncestor(name, or(isJSDocLinkLike, isJSDocNameReference, isJSDocMemberName)); const meaning = isJSDoc2 ? 788968 /* Type */ | 1920 /* Namespace */ | 111551 /* Value */ : 111551 /* Value */; - if (name.kind === 79 /* Identifier */) { - if (isJSXTagName(name) && isJsxIntrinsicIdentifier(name)) { + if (name.kind === 80 /* Identifier */) { + if (isJSXTagName(name) && isJsxIntrinsicTagName(name)) { const symbol = getIntrinsicTagSymbol(name.parent); return symbol === unknownSymbol ? void 0 : symbol; } @@ -82266,8 +82789,8 @@ ${lanes.join("\n")} name, meaning, /*ignoreErrors*/ - false, - /* dontResolveAlias */ + true, + /*dontResolveAlias*/ true, getHostSignatureFromJSDoc(name) ); @@ -82277,7 +82800,7 @@ ${lanes.join("\n")} return resolveJSDocMemberName( name, /*ignoreErrors*/ - false, + true, getSymbolOfDeclaration(container) ); } @@ -82290,7 +82813,7 @@ ${lanes.join("\n")} meaning, /*ignoreErrors*/ true, - /* dontResolveAlias */ + /*dontResolveAlias*/ true, getSourceFileOfNode(container) ) || result; @@ -82299,12 +82822,12 @@ ${lanes.join("\n")} return result; } else if (isPrivateIdentifier(name)) { return getSymbolForPrivateIdentifierExpression(name); - } else if (name.kind === 208 /* PropertyAccessExpression */ || name.kind === 163 /* QualifiedName */) { + } else if (name.kind === 210 /* PropertyAccessExpression */ || name.kind === 165 /* QualifiedName */) { const links = getNodeLinks(name); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (name.kind === 208 /* PropertyAccessExpression */) { + if (name.kind === 210 /* PropertyAccessExpression */) { checkPropertyAccessExpression(name, 0 /* Normal */); if (!links.resolvedSymbol) { const expressionType = checkExpressionCached(name.expression); @@ -82344,7 +82867,7 @@ ${lanes.join("\n")} return resolveJSDocMemberName(name); } } else if (isTypeReferenceIdentifier(name)) { - const meaning = name.parent.kind === 180 /* TypeReference */ ? 788968 /* Type */ : 1920 /* Namespace */; + const meaning = name.parent.kind === 182 /* TypeReference */ ? 788968 /* Type */ : 1920 /* Namespace */; const symbol = resolveEntityName( name, meaning, @@ -82355,7 +82878,7 @@ ${lanes.join("\n")} ); return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } - if (name.parent.kind === 179 /* TypePredicate */) { + if (name.parent.kind === 181 /* TypePredicate */) { return resolveEntityName( name, /*meaning*/ @@ -82405,34 +82928,34 @@ ${lanes.join("\n")} } else if (isLiteralComputedPropertyDeclarationName(node)) { return getSymbolOfDeclaration(parent2.parent); } - if (node.kind === 79 /* Identifier */) { + if (node.kind === 80 /* Identifier */) { if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); - } else if (parent2.kind === 205 /* BindingElement */ && grandParent.kind === 203 /* ObjectBindingPattern */ && node === parent2.propertyName) { + } else if (parent2.kind === 207 /* BindingElement */ && grandParent.kind === 205 /* ObjectBindingPattern */ && node === parent2.propertyName) { const typeOfPattern = getTypeOfNode(grandParent); const propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); if (propertyDeclaration) { return propertyDeclaration; } } else if (isMetaProperty(parent2) && parent2.name === node) { - if (parent2.keywordToken === 103 /* NewKeyword */ && idText(node) === "target") { + if (parent2.keywordToken === 105 /* NewKeyword */ && idText(node) === "target") { return checkNewTargetMetaProperty(parent2).symbol; } - if (parent2.keywordToken === 100 /* ImportKeyword */ && idText(node) === "meta") { + if (parent2.keywordToken === 102 /* ImportKeyword */ && idText(node) === "meta") { return getGlobalImportMetaExpressionType().members.get("meta"); } return void 0; } } switch (node.kind) { - case 79 /* Identifier */: - case 80 /* PrivateIdentifier */: - case 208 /* PropertyAccessExpression */: - case 163 /* QualifiedName */: + case 80 /* Identifier */: + case 81 /* PrivateIdentifier */: + case 210 /* PropertyAccessExpression */: + case 165 /* QualifiedName */: if (!isThisInTypeQuery(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } - case 108 /* ThisKeyword */: + case 110 /* ThisKeyword */: const container = getThisContainer( node, /*includeArrowFunctions*/ @@ -82449,21 +82972,21 @@ ${lanes.join("\n")} if (isInExpressionContext(node)) { return checkExpression(node).symbol; } - case 194 /* ThisType */: + case 196 /* ThisType */: return getTypeFromThisTypeNode(node).symbol; - case 106 /* SuperKeyword */: + case 108 /* SuperKeyword */: return checkExpression(node).symbol; - case 135 /* ConstructorKeyword */: + case 137 /* ConstructorKeyword */: const constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 173 /* Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 175 /* Constructor */) { return constructorDeclaration.parent.symbol; } return void 0; - case 10 /* StringLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: - if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 269 /* ImportDeclaration */ || node.parent.kind === 275 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || (isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */ && isRequireCall( + case 11 /* StringLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 271 /* ImportDeclaration */ || node.parent.kind === 277 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || (isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */ && isRequireCall( node.parent, - /*checkArgumentIsStringLiteralLike*/ + /*requireStringLiteralLikeArgument*/ false ) || isImportCall(node.parent)) || isLiteralTypeNode(node.parent) && isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent) { return resolveExternalModuleName(node, node, ignoreErrors); @@ -82471,23 +82994,28 @@ ${lanes.join("\n")} if (isCallExpression(parent2) && isBindableObjectDefinePropertyCall(parent2) && parent2.arguments[1] === node) { return getSymbolOfDeclaration(parent2); } - case 8 /* NumericLiteral */: + case 9 /* NumericLiteral */: const objectType = isElementAccessExpression(parent2) ? parent2.argumentExpression === node ? getTypeOfExpression(parent2.expression) : void 0 : isLiteralTypeNode(parent2) && isIndexedAccessTypeNode(grandParent) ? getTypeFromTypeNode(grandParent.objectType) : void 0; return objectType && getPropertyOfType(objectType, escapeLeadingUnderscores(node.text)); - case 88 /* DefaultKeyword */: - case 98 /* FunctionKeyword */: - case 38 /* EqualsGreaterThanToken */: - case 84 /* ClassKeyword */: + case 90 /* DefaultKeyword */: + case 100 /* FunctionKeyword */: + case 39 /* EqualsGreaterThanToken */: + case 86 /* ClassKeyword */: return getSymbolOfNode(node.parent); - case 202 /* ImportType */: + case 204 /* ImportType */: return isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : void 0; - case 93 /* ExportKeyword */: + case 95 /* ExportKeyword */: return isExportAssignment(node.parent) ? Debug.checkDefined(node.parent.symbol) : void 0; - case 100 /* ImportKeyword */: - case 103 /* NewKeyword */: + case 102 /* ImportKeyword */: + case 105 /* NewKeyword */: return isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : void 0; - case 233 /* MetaProperty */: + case 235 /* MetaProperty */: return checkExpression(node).symbol; + case 294 /* JsxNamespacedName */: + if (isJSXTagName(node) && isJsxIntrinsicTagName(node)) { + const symbol = getIntrinsicTagSymbol(node.parent); + return symbol === unknownSymbol ? void 0 : symbol; + } default: return void 0; } @@ -82502,7 +83030,7 @@ ${lanes.join("\n")} return void 0; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 300 /* ShorthandPropertyAssignment */) { + if (location && location.kind === 303 /* ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 111551 /* Value */ | 2097152 /* Alias */); } return void 0; @@ -82542,6 +83070,14 @@ ${lanes.join("\n")} const symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; } + if (isBindingElement(node)) { + return getTypeForVariableLikeDeclaration( + node, + /*includeOptionality*/ + true, + 0 /* Normal */ + ) || errorType; + } if (isDeclaration(node)) { const symbol = getSymbolOfDeclaration(node); return symbol ? getTypeOfSymbol(symbol) : errorType; @@ -82574,16 +83110,16 @@ ${lanes.join("\n")} return errorType; } function getTypeOfAssignmentPattern(expr) { - Debug.assert(expr.kind === 207 /* ObjectLiteralExpression */ || expr.kind === 206 /* ArrayLiteralExpression */); - if (expr.parent.kind === 247 /* ForOfStatement */) { + Debug.assert(expr.kind === 209 /* ObjectLiteralExpression */ || expr.kind === 208 /* ArrayLiteralExpression */); + if (expr.parent.kind === 249 /* ForOfStatement */) { const iteratedType = checkRightHandSideOfForOf(expr.parent); return checkDestructuringAssignment(expr, iteratedType || errorType); } - if (expr.parent.kind === 223 /* BinaryExpression */) { + if (expr.parent.kind === 225 /* BinaryExpression */) { const iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } - if (expr.parent.kind === 299 /* PropertyAssignment */) { + if (expr.parent.kind === 302 /* PropertyAssignment */) { const node2 = cast(expr.parent.parent, isObjectLiteralExpression); const typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node2) || errorType; const propertyIndex = indexOfNode(node2.properties, expr.parent); @@ -82611,12 +83147,12 @@ ${lanes.join("\n")} function getClassElementPropertyKeyType(element) { const name = element.name; switch (name.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return getStringLiteralType(idText(name)); - case 8 /* NumericLiteral */: - case 10 /* StringLiteral */: + case 9 /* NumericLiteral */: + case 11 /* StringLiteral */: return getStringLiteralType(name.text); - case 164 /* ComputedPropertyName */: + case 166 /* ComputedPropertyName */: const nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288 /* ESSymbolLike */) ? nameType : stringType; default: @@ -82693,7 +83229,7 @@ ${lanes.join("\n")} return isModuleOrEnumDeclaration(node.parent) && node === node.parent.name; } function getReferencedExportContainer(nodeIn, prefixLocals) { - var _a2; + var _a; const node = getParseTreeNode(nodeIn, isIdentifier); if (node) { let symbol = getReferencedValueSymbol( @@ -82711,7 +83247,7 @@ ${lanes.join("\n")} } const parentSymbol = getParentOfSymbol(symbol); if (parentSymbol) { - if (parentSymbol.flags & 512 /* ValueModule */ && ((_a2 = parentSymbol.valueDeclaration) == null ? void 0 : _a2.kind) === 308 /* SourceFile */) { + if (parentSymbol.flags & 512 /* ValueModule */ && ((_a = parentSymbol.valueDeclaration) == null ? void 0 : _a.kind) === 311 /* SourceFile */) { const symbolFile = parentSymbol.valueDeclaration; const referenceFile = getSourceFileOfNode(node); const symbolIsUmdExport = symbolFile !== referenceFile; @@ -82741,7 +83277,7 @@ ${lanes.join("\n")} return void 0; } function isSymbolOfDestructuredElementOfCatchBinding(symbol) { - return symbol.valueDeclaration && isBindingElement(symbol.valueDeclaration) && walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 295 /* CatchClause */; + return symbol.valueDeclaration && isBindingElement(symbol.valueDeclaration) && walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 298 /* CatchClause */; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* BlockScoped */ && symbol.valueDeclaration && !isSourceFile(symbol.valueDeclaration)) { @@ -82769,7 +83305,7 @@ ${lanes.join("\n")} /*lookInLabeledStatements*/ false ); - const inLoopBodyBlock = container.kind === 238 /* Block */ && isIterationStatement( + const inLoopBodyBlock = container.kind === 240 /* Block */ && isIterationStatement( container.parent, /*lookInLabeledStatements*/ false @@ -82807,34 +83343,33 @@ ${lanes.join("\n")} return false; } function isValueAliasDeclaration(node) { - Debug.assert(!compilerOptions.verbatimModuleSyntax); + Debug.assert(canCollectSymbolAliasAccessabilityData); switch (node.kind) { - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: return isAliasResolvedToValue(getSymbolOfDeclaration(node)); - case 270 /* ImportClause */: - case 271 /* NamespaceImport */: - case 273 /* ImportSpecifier */: - case 278 /* ExportSpecifier */: + case 272 /* ImportClause */: + case 273 /* NamespaceImport */: + case 275 /* ImportSpecifier */: + case 280 /* ExportSpecifier */: const symbol = getSymbolOfDeclaration(node); return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* Value */); - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: const exportClause = node.exportClause; return !!exportClause && (isNamespaceExport(exportClause) || some(exportClause.elements, isValueAliasDeclaration)); - case 274 /* ExportAssignment */: - return node.expression && node.expression.kind === 79 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfDeclaration(node)) : true; + case 276 /* ExportAssignment */: + return node.expression && node.expression.kind === 80 /* Identifier */ ? isAliasResolvedToValue(getSymbolOfDeclaration(node)) : true; } return false; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { const node = getParseTreeNode(nodeIn, isImportEqualsDeclaration); - if (node === void 0 || node.parent.kind !== 308 /* SourceFile */ || !isInternalModuleImportEqualsDeclaration(node)) { + if (node === void 0 || node.parent.kind !== 311 /* SourceFile */ || !isInternalModuleImportEqualsDeclaration(node)) { return false; } const isValue = isAliasResolvedToValue(getSymbolOfDeclaration(node)); return isValue && node.moduleReference && !nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { - var _a2; if (!symbol) { return false; } @@ -82842,13 +83377,13 @@ ${lanes.join("\n")} if (target === unknownSymbol) { return true; } - return !!(((_a2 = getAllSymbolFlags(target)) != null ? _a2 : -1) & 111551 /* Value */) && (shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target)); + return !!((getAllSymbolFlags(target) ?? -1) & 111551 /* Value */) && (shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { return isConstEnumSymbol(s) || !!s.constEnumOnlyModule; } function isReferencedAliasDeclaration(node, checkChildren) { - Debug.assert(!compilerOptions.verbatimModuleSyntax); + Debug.assert(canCollectSymbolAliasAccessabilityData); if (isAliasSymbolDeclaration2(node)) { const symbol = getSymbolOfDeclaration(node); const links = symbol && getSymbolLinks(symbol); @@ -82906,11 +83441,11 @@ ${lanes.join("\n")} return symbol && getPropertiesOfType(getTypeOfSymbol(symbol)) || emptyArray; } function getNodeCheckFlags(node) { - var _a2; + var _a; const nodeId = node.id || 0; if (nodeId < 0 || nodeId >= nodeLinks.length) return 0; - return ((_a2 = nodeLinks[nodeId]) == null ? void 0 : _a2.flags) || 0; + return ((_a = nodeLinks[nodeId]) == null ? void 0 : _a.flags) || 0; } function getEnumMemberValue(node) { computeEnumMemberValues(node.parent); @@ -82918,15 +83453,15 @@ ${lanes.join("\n")} } function canHaveConstantValue(node) { switch (node.kind) { - case 302 /* EnumMember */: - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 305 /* EnumMember */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: return true; } return false; } function getConstantValue2(node) { - if (node.kind === 302 /* EnumMember */) { + if (node.kind === 305 /* EnumMember */) { return getEnumMemberValue(node); } const symbol = getNodeLinks(node).resolvedSymbol; @@ -82942,7 +83477,7 @@ ${lanes.join("\n")} return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0; } function getTypeReferenceSerializationKind(typeNameIn, location) { - var _a2; + var _a; const typeName = getParseTreeNode(typeNameIn, isEntityName); if (!typeName) return 0 /* Unknown */; @@ -82962,7 +83497,7 @@ ${lanes.join("\n")} true, location ); - isTypeOnly = !!((_a2 = rootValueSymbol == null ? void 0 : rootValueSymbol.declarations) == null ? void 0 : _a2.every(isTypeOnlyImportOrExportDeclaration)); + isTypeOnly = !!((_a = rootValueSymbol == null ? void 0 : rootValueSymbol.declarations) == null ? void 0 : _a.every(isTypeOnlyImportOrExportDeclaration)); } const valueSymbol = resolveEntityName( typeName, @@ -83030,7 +83565,7 @@ ${lanes.join("\n")} function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { const declaration = getParseTreeNode(declarationIn, isVariableLikeOrAccessor); if (!declaration) { - return factory.createToken(131 /* AnyKeyword */); + return factory.createToken(133 /* AnyKeyword */); } const symbol = getSymbolOfDeclaration(declaration); let type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType; @@ -83045,7 +83580,7 @@ ${lanes.join("\n")} function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { const signatureDeclaration = getParseTreeNode(signatureDeclarationIn, isFunctionLike); if (!signatureDeclaration) { - return factory.createToken(131 /* AnyKeyword */); + return factory.createToken(133 /* AnyKeyword */); } const signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker); @@ -83053,7 +83588,7 @@ ${lanes.join("\n")} function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { const expr = getParseTreeNode(exprIn, isExpression); if (!expr) { - return factory.createToken(131 /* AnyKeyword */); + return factory.createToken(133 /* AnyKeyword */); } const type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker); @@ -83077,7 +83612,7 @@ ${lanes.join("\n")} location, reference.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */, - /*nodeNotFoundMessage*/ + /*nameNotFoundMessage*/ void 0, /*nameArg*/ void 0, @@ -83094,7 +83629,7 @@ ${lanes.join("\n")} reference, reference.escapedText, 111551 /* Value */ | 1048576 /* ExportValue */ | 2097152 /* Alias */, - /*nodeNotFoundMessage*/ + /*nameNotFoundMessage*/ void 0, /*nameArg*/ void 0, @@ -83118,6 +83653,41 @@ ${lanes.join("\n")} } return void 0; } + function getReferencedValueDeclarations(referenceIn) { + if (!isGeneratedIdentifier(referenceIn)) { + const reference = getParseTreeNode(referenceIn, isIdentifier); + if (reference) { + const symbol = getReferencedValueSymbol(reference); + if (symbol) { + return filter(getExportSymbolOfValueSymbolIfExported(symbol).declarations, (declaration) => { + switch (declaration.kind) { + case 259 /* VariableDeclaration */: + case 168 /* Parameter */: + case 207 /* BindingElement */: + case 171 /* PropertyDeclaration */: + case 302 /* PropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: + case 305 /* EnumMember */: + case 209 /* ObjectLiteralExpression */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 265 /* EnumDeclaration */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 266 /* ModuleDeclaration */: + return true; + } + return false; + }); + } + } + } + return void 0; + } function isLiteralConstDeclaration(node) { if (isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConst(node)) { return isFreshLiteralType(getTypeOfSymbol(getSymbolOfDeclaration(node))); @@ -83186,12 +83756,12 @@ ${lanes.join("\n")} isDeclarationWithCollidingName, isValueAliasDeclaration: (nodeIn) => { const node = getParseTreeNode(nodeIn); - return node ? isValueAliasDeclaration(node) : true; + return node && canCollectSymbolAliasAccessabilityData ? isValueAliasDeclaration(node) : true; }, hasGlobalName, isReferencedAliasDeclaration: (nodeIn, checkChildren) => { const node = getParseTreeNode(nodeIn); - return node ? isReferencedAliasDeclaration(node, checkChildren) : true; + return node && canCollectSymbolAliasAccessabilityData ? isReferencedAliasDeclaration(node, checkChildren) : true; }, getNodeCheckFlags: (nodeIn) => { const node = getParseTreeNode(nodeIn); @@ -83216,6 +83786,7 @@ ${lanes.join("\n")} }, collectLinkedAliases, getReferencedValueDeclaration, + getReferencedValueDeclarations, getTypeReferenceSerializationKind, isOptionalParameter, moduleExportsSomeValue, @@ -83236,12 +83807,12 @@ ${lanes.join("\n")} getJsxFragmentFactoryEntity, getAllAccessorDeclarations(accessor) { accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration); - const otherKind = accessor.kind === 175 /* SetAccessor */ ? 174 /* GetAccessor */ : 175 /* SetAccessor */; + const otherKind = accessor.kind === 177 /* SetAccessor */ ? 176 /* GetAccessor */ : 177 /* SetAccessor */; const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(accessor), otherKind); const firstAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? otherAccessor : accessor; const secondAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? accessor : otherAccessor; - const setAccessor = accessor.kind === 175 /* SetAccessor */ ? accessor : otherAccessor; - const getAccessor = accessor.kind === 174 /* GetAccessor */ ? accessor : otherAccessor; + const setAccessor = accessor.kind === 177 /* SetAccessor */ ? accessor : otherAccessor; + const getAccessor = accessor.kind === 176 /* GetAccessor */ ? accessor : otherAccessor; return { firstAccessor, secondAccessor, @@ -83262,7 +83833,7 @@ ${lanes.join("\n")} }, getDeclarationStatementsForSourceFile: (node, flags, tracker, bundled) => { const n = getParseTreeNode(node); - Debug.assert(n && n.kind === 308 /* SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + Debug.assert(n && n.kind === 311 /* SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); const sym = getSymbolOfDeclaration(node); if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); @@ -83297,18 +83868,18 @@ ${lanes.join("\n")} return false; } function isInHeritageClause(node) { - return node.parent && node.parent.kind === 230 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 294 /* HeritageClause */; + return node.parent && node.parent.kind === 232 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 297 /* HeritageClause */; } function getTypeReferenceDirectivesForEntityName(node) { if (!fileToDirective) { return void 0; } let meaning; - if (node.parent.kind === 164 /* ComputedPropertyName */) { + if (node.parent.kind === 166 /* ComputedPropertyName */) { meaning = 111551 /* Value */ | 1048576 /* ExportValue */; } else { meaning = 788968 /* Type */ | 1920 /* Namespace */; - if (node.kind === 79 /* Identifier */ && isInTypeQuery(node) || node.kind === 208 /* PropertyAccessExpression */ && !isInHeritageClause(node)) { + if (node.kind === 80 /* Identifier */ && isInTypeQuery(node) || node.kind === 210 /* PropertyAccessExpression */ && !isInHeritageClause(node)) { meaning = 111551 /* Value */ | 1048576 /* ExportValue */; } } @@ -83351,7 +83922,7 @@ ${lanes.join("\n")} break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 308 /* SourceFile */ && current.flags & 512 /* ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 311 /* SourceFile */ && current.flags & 512 /* ValueModule */) { return false; } for (const decl of symbol.declarations) { @@ -83376,7 +83947,7 @@ ${lanes.join("\n")} } } function getExternalModuleFileFromDeclaration(declaration) { - const specifier = declaration.kind === 264 /* ModuleDeclaration */ ? tryCast(declaration.name, isStringLiteral) : getExternalModuleName(declaration); + const specifier = declaration.kind === 266 /* ModuleDeclaration */ ? tryCast(declaration.name, isStringLiteral) : getExternalModuleName(declaration); const moduleSymbol = resolveExternalModuleNameWorker( specifier, specifier, @@ -83386,7 +83957,7 @@ ${lanes.join("\n")} if (!moduleSymbol) { return void 0; } - return getDeclarationOfKind(moduleSymbol, 308 /* SourceFile */); + return getDeclarationOfKind(moduleSymbol, 311 /* SourceFile */); } function initializeTypeChecker() { for (const file of host.getSourceFiles()) { @@ -83514,7 +84085,14 @@ ${lanes.join("\n")} anyArrayType = createArrayType(anyType); autoArrayType = createArrayType(autoType); if (autoArrayType === emptyObjectType) { - autoArrayType = createAnonymousType(void 0, emptySymbols, emptyArray, emptyArray, emptyArray); + autoArrayType = createAnonymousType( + /*symbol*/ + void 0, + emptySymbols, + emptyArray, + emptyArray, + emptyArray + ); } globalReadonlyArrayType = getGlobalTypeOrUndefined( "ReadonlyArray", @@ -83574,7 +84152,7 @@ ${lanes.join("\n")} if (requestedExternalEmitHelperNames.has(name)) continue; requestedExternalEmitHelperNames.add(name); - const symbol = getSymbol2(helpersModule.exports, escapeLeadingUnderscores(name), 111551 /* Value */); + const symbol = resolveSymbol(getSymbol2(getExportsOfModule(helpersModule), escapeLeadingUnderscores(name), 111551 /* Value */)); if (!symbol) { error(location, Diagnostics.This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0, externalHelpersModuleNameText, name); } else if (helper & 524288 /* ClassPrivateFieldGet */) { @@ -83675,12 +84253,12 @@ ${lanes.join("\n")} for (const modifier of node.modifiers) { if (isDecorator(modifier)) { if (!nodeCanBeDecorated(legacyDecorators, node, node.parent, node.parent.parent)) { - if (node.kind === 171 /* MethodDeclaration */ && !nodeIsPresent(node.body)) { + if (node.kind === 173 /* MethodDeclaration */ && !nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here); } - } else if (legacyDecorators && (node.kind === 174 /* GetAccessor */ || node.kind === 175 /* SetAccessor */)) { + } else if (legacyDecorators && (node.kind === 176 /* GetAccessor */ || node.kind === 177 /* SetAccessor */)) { const accessors = getAllAccessorDeclarations(node.parent.members, node); if (hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -83707,32 +84285,32 @@ ${lanes.join("\n")} } else if (flags & 1 /* Export */) { sawExportBeforeDecorators = true; } - firstDecorator != null ? firstDecorator : firstDecorator = modifier; + firstDecorator ?? (firstDecorator = modifier); } else { - if (modifier.kind !== 146 /* ReadonlyKeyword */) { - if (node.kind === 168 /* PropertySignature */ || node.kind === 170 /* MethodSignature */) { + if (modifier.kind !== 148 /* ReadonlyKeyword */) { + if (node.kind === 170 /* PropertySignature */ || node.kind === 172 /* MethodSignature */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_type_member, tokenToString(modifier.kind)); } - if (node.kind === 178 /* IndexSignature */ && (modifier.kind !== 124 /* StaticKeyword */ || !isClassLike(node.parent))) { + if (node.kind === 180 /* IndexSignature */ && (modifier.kind !== 126 /* StaticKeyword */ || !isClassLike(node.parent))) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_an_index_signature, tokenToString(modifier.kind)); } } - if (modifier.kind !== 101 /* InKeyword */ && modifier.kind !== 145 /* OutKeyword */ && modifier.kind !== 85 /* ConstKeyword */) { - if (node.kind === 165 /* TypeParameter */) { + if (modifier.kind !== 103 /* InKeyword */ && modifier.kind !== 147 /* OutKeyword */ && modifier.kind !== 87 /* ConstKeyword */) { + if (node.kind === 167 /* TypeParameter */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, tokenToString(modifier.kind)); } } switch (modifier.kind) { - case 85 /* ConstKeyword */: - if (node.kind !== 263 /* EnumDeclaration */ && node.kind !== 165 /* TypeParameter */) { - return grammarErrorOnNode(node, Diagnostics.A_class_member_cannot_have_the_0_keyword, tokenToString(85 /* ConstKeyword */)); + case 87 /* ConstKeyword */: + if (node.kind !== 265 /* EnumDeclaration */ && node.kind !== 167 /* TypeParameter */) { + return grammarErrorOnNode(node, Diagnostics.A_class_member_cannot_have_the_0_keyword, tokenToString(87 /* ConstKeyword */)); } const parent2 = node.parent; - if (node.kind === 165 /* TypeParameter */ && !(isFunctionLikeDeclaration(parent2) || isClassLike(parent2) || isFunctionTypeNode(parent2) || isConstructorTypeNode(parent2) || isCallSignatureDeclaration(parent2) || isConstructSignatureDeclaration(parent2) || isMethodSignature(parent2))) { + if (node.kind === 167 /* TypeParameter */ && !(isFunctionLikeDeclaration(parent2) || isClassLike(parent2) || isFunctionTypeNode(parent2) || isConstructorTypeNode(parent2) || isCallSignatureDeclaration(parent2) || isConstructSignatureDeclaration(parent2) || isMethodSignature(parent2))) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_function_method_or_class, tokenToString(modifier.kind)); } break; - case 161 /* OverrideKeyword */: + case 163 /* OverrideKeyword */: if (flags & 16384 /* Override */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "override"); } else if (flags & 2 /* Ambient */) { @@ -83747,9 +84325,9 @@ ${lanes.join("\n")} flags |= 16384 /* Override */; lastOverride = modifier; break; - case 123 /* PublicKeyword */: - case 122 /* ProtectedKeyword */: - case 121 /* PrivateKeyword */: + case 125 /* PublicKeyword */: + case 124 /* ProtectedKeyword */: + case 123 /* PrivateKeyword */: const text = visibilityToString(modifierToFlag(modifier.kind)); if (flags & 28 /* AccessibilityModifier */) { return grammarErrorOnNode(modifier, Diagnostics.Accessibility_modifier_already_seen); @@ -83763,10 +84341,10 @@ ${lanes.join("\n")} return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } else if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); - } else if (node.parent.kind === 265 /* ModuleBlock */ || node.parent.kind === 308 /* SourceFile */) { + } else if (node.parent.kind === 267 /* ModuleBlock */ || node.parent.kind === 311 /* SourceFile */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } else if (flags & 256 /* Abstract */) { - if (modifier.kind === 121 /* PrivateKeyword */) { + if (modifier.kind === 123 /* PrivateKeyword */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } else { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, text, "abstract"); @@ -83776,7 +84354,7 @@ ${lanes.join("\n")} } flags |= modifierToFlag(modifier.kind); break; - case 124 /* StaticKeyword */: + case 126 /* StaticKeyword */: if (flags & 32 /* Static */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "static"); } else if (flags & 64 /* Readonly */) { @@ -83785,9 +84363,9 @@ ${lanes.join("\n")} return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } else if (flags & 128 /* Accessor */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); - } else if (node.parent.kind === 265 /* ModuleBlock */ || node.parent.kind === 308 /* SourceFile */) { + } else if (node.parent.kind === 267 /* ModuleBlock */ || node.parent.kind === 311 /* SourceFile */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); - } else if (node.kind === 166 /* Parameter */) { + } else if (node.kind === 168 /* Parameter */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } else if (flags & 256 /* Abstract */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); @@ -83797,31 +84375,31 @@ ${lanes.join("\n")} flags |= 32 /* Static */; lastStatic = modifier; break; - case 127 /* AccessorKeyword */: + case 129 /* AccessorKeyword */: if (flags & 128 /* Accessor */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "accessor"); } else if (flags & 64 /* Readonly */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); } else if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); - } else if (node.kind !== 169 /* PropertyDeclaration */) { + } else if (node.kind !== 171 /* PropertyDeclaration */) { return grammarErrorOnNode(modifier, Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); } flags |= 128 /* Accessor */; break; - case 146 /* ReadonlyKeyword */: + case 148 /* ReadonlyKeyword */: if (flags & 64 /* Readonly */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "readonly"); - } else if (node.kind !== 169 /* PropertyDeclaration */ && node.kind !== 168 /* PropertySignature */ && node.kind !== 178 /* IndexSignature */ && node.kind !== 166 /* Parameter */) { + } else if (node.kind !== 171 /* PropertyDeclaration */ && node.kind !== 170 /* PropertySignature */ && node.kind !== 180 /* IndexSignature */ && node.kind !== 168 /* Parameter */) { return grammarErrorOnNode(modifier, Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } else if (flags & 128 /* Accessor */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "readonly", "accessor"); } flags |= 64 /* Readonly */; break; - case 93 /* ExportKeyword */: - if (compilerOptions.verbatimModuleSyntax && !(node.flags & 16777216 /* Ambient */) && node.kind !== 262 /* TypeAliasDeclaration */ && node.kind !== 261 /* InterfaceDeclaration */ && // ModuleDeclaration needs to be checked that it is uninstantiated later - node.kind !== 264 /* ModuleDeclaration */ && node.parent.kind === 308 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) { + case 95 /* ExportKeyword */: + if (compilerOptions.verbatimModuleSyntax && !(node.flags & 16777216 /* Ambient */) && node.kind !== 264 /* TypeAliasDeclaration */ && node.kind !== 263 /* InterfaceDeclaration */ && // ModuleDeclaration needs to be checked that it is uninstantiated later + node.kind !== 266 /* ModuleDeclaration */ && node.parent.kind === 311 /* SourceFile */ && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */)) { return grammarErrorOnNode(modifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled); } if (flags & 1 /* Export */) { @@ -83834,14 +84412,14 @@ ${lanes.join("\n")} return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (isClassLike(node.parent)) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); - } else if (node.kind === 166 /* Parameter */) { + } else if (node.kind === 168 /* Parameter */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* Export */; break; - case 88 /* DefaultKeyword */: - const container = node.parent.kind === 308 /* SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 264 /* ModuleDeclaration */ && !isAmbientModule(container)) { + case 90 /* DefaultKeyword */: + const container = node.parent.kind === 311 /* SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 266 /* ModuleDeclaration */ && !isAmbientModule(container)) { return grammarErrorOnNode(modifier, Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } else if (!(flags & 1 /* Export */)) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); @@ -83850,7 +84428,7 @@ ${lanes.join("\n")} } flags |= 1024 /* Default */; break; - case 136 /* DeclareKeyword */: + case 138 /* DeclareKeyword */: if (flags & 2 /* Ambient */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "declare"); } else if (flags & 512 /* Async */) { @@ -83859,9 +84437,9 @@ ${lanes.join("\n")} return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "override"); } else if (isClassLike(node.parent) && !isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); - } else if (node.kind === 166 /* Parameter */) { + } else if (node.kind === 168 /* Parameter */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); - } else if (node.parent.flags & 16777216 /* Ambient */ && node.parent.kind === 265 /* ModuleBlock */) { + } else if (node.parent.flags & 16777216 /* Ambient */ && node.parent.kind === 267 /* ModuleBlock */) { return grammarErrorOnNode(modifier, Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } else if (isPrivateIdentifierClassElementDeclaration(node)) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "declare"); @@ -83871,16 +84449,17 @@ ${lanes.join("\n")} flags |= 2 /* Ambient */; lastDeclare = modifier; break; - case 126 /* AbstractKeyword */: + case 128 /* AbstractKeyword */: if (flags & 256 /* Abstract */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 260 /* ClassDeclaration */ && node.kind !== 182 /* ConstructorType */) { - if (node.kind !== 171 /* MethodDeclaration */ && node.kind !== 169 /* PropertyDeclaration */ && node.kind !== 174 /* GetAccessor */ && node.kind !== 175 /* SetAccessor */) { + if (node.kind !== 262 /* ClassDeclaration */ && node.kind !== 184 /* ConstructorType */) { + if (node.kind !== 173 /* MethodDeclaration */ && node.kind !== 171 /* PropertyDeclaration */ && node.kind !== 176 /* GetAccessor */ && node.kind !== 177 /* SetAccessor */) { return grammarErrorOnNode(modifier, Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 260 /* ClassDeclaration */ && hasSyntacticModifier(node.parent, 256 /* Abstract */))) { - return grammarErrorOnNode(modifier, Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); + if (!(node.parent.kind === 262 /* ClassDeclaration */ && hasSyntacticModifier(node.parent, 256 /* Abstract */))) { + const message = node.kind === 171 /* PropertyDeclaration */ ? Diagnostics.Abstract_properties_can_only_appear_within_an_abstract_class : Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class; + return grammarErrorOnNode(modifier, message); } if (flags & 32 /* Static */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); @@ -83898,17 +84477,17 @@ ${lanes.join("\n")} return grammarErrorOnNode(modifier, Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); } } - if (isNamedDeclaration(node) && node.name.kind === 80 /* PrivateIdentifier */) { + if (isNamedDeclaration(node) && node.name.kind === 81 /* PrivateIdentifier */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); } flags |= 256 /* Abstract */; break; - case 132 /* AsyncKeyword */: + case 134 /* AsyncKeyword */: if (flags & 512 /* Async */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* Ambient */ || node.parent.flags & 16777216 /* Ambient */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); - } else if (node.kind === 166 /* Parameter */) { + } else if (node.kind === 168 /* Parameter */) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } if (flags & 256 /* Abstract */) { @@ -83917,11 +84496,11 @@ ${lanes.join("\n")} flags |= 512 /* Async */; lastAsync = modifier; break; - case 101 /* InKeyword */: - case 145 /* OutKeyword */: - const inOutFlag = modifier.kind === 101 /* InKeyword */ ? 32768 /* In */ : 65536 /* Out */; - const inOutText = modifier.kind === 101 /* InKeyword */ ? "in" : "out"; - if (node.kind !== 165 /* TypeParameter */ || !(isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent))) { + case 103 /* InKeyword */: + case 147 /* OutKeyword */: + const inOutFlag = modifier.kind === 103 /* InKeyword */ ? 32768 /* In */ : 65536 /* Out */; + const inOutText = modifier.kind === 103 /* InKeyword */ ? "in" : "out"; + if (node.kind !== 167 /* TypeParameter */ || !(isInterfaceDeclaration(node.parent) || isClassLike(node.parent) || isTypeAliasDeclaration(node.parent))) { return grammarErrorOnNode(modifier, Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -83935,7 +84514,7 @@ ${lanes.join("\n")} } } } - if (node.kind === 173 /* Constructor */) { + if (node.kind === 175 /* Constructor */) { if (flags & 32 /* Static */) { return grammarErrorOnNode(lastStatic, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } @@ -83946,11 +84525,11 @@ ${lanes.join("\n")} return grammarErrorOnNode(lastAsync, Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return false; - } else if ((node.kind === 269 /* ImportDeclaration */ || node.kind === 268 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { + } else if ((node.kind === 271 /* ImportDeclaration */ || node.kind === 270 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) { return grammarErrorOnNode(lastDeclare, Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); - } else if (node.kind === 166 /* Parameter */ && flags & 16476 /* ParameterPropertyModifier */ && isBindingPattern(node.name)) { + } else if (node.kind === 168 /* Parameter */ && flags & 16476 /* ParameterPropertyModifier */ && isBindingPattern(node.name)) { return grammarErrorOnNode(node, Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); - } else if (node.kind === 166 /* Parameter */ && flags & 16476 /* ParameterPropertyModifier */ && node.dotDotDotToken) { + } else if (node.kind === 168 /* Parameter */ && flags & 16476 /* ParameterPropertyModifier */ && node.dotDotDotToken) { return grammarErrorOnNode(node, Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } if (flags & 512 /* Async */) { @@ -83970,47 +84549,47 @@ ${lanes.join("\n")} } function findFirstIllegalModifier(node) { switch (node.kind) { - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 173 /* Constructor */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 178 /* IndexSignature */: - case 264 /* ModuleDeclaration */: - case 269 /* ImportDeclaration */: - case 268 /* ImportEqualsDeclaration */: - case 275 /* ExportDeclaration */: - case 274 /* ExportAssignment */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 166 /* Parameter */: - case 165 /* TypeParameter */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 175 /* Constructor */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 180 /* IndexSignature */: + case 266 /* ModuleDeclaration */: + case 271 /* ImportDeclaration */: + case 270 /* ImportEqualsDeclaration */: + case 277 /* ExportDeclaration */: + case 276 /* ExportAssignment */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 168 /* Parameter */: + case 167 /* TypeParameter */: return void 0; - case 172 /* ClassStaticBlockDeclaration */: - case 299 /* PropertyAssignment */: - case 300 /* ShorthandPropertyAssignment */: - case 267 /* NamespaceExportDeclaration */: - case 279 /* MissingDeclaration */: + case 174 /* ClassStaticBlockDeclaration */: + case 302 /* PropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: + case 269 /* NamespaceExportDeclaration */: + case 281 /* MissingDeclaration */: return find(node.modifiers, isModifier); default: - if (node.parent.kind === 265 /* ModuleBlock */ || node.parent.kind === 308 /* SourceFile */) { + if (node.parent.kind === 267 /* ModuleBlock */ || node.parent.kind === 311 /* SourceFile */) { return void 0; } switch (node.kind) { - case 259 /* FunctionDeclaration */: - return findFirstModifierExcept(node, 132 /* AsyncKeyword */); - case 260 /* ClassDeclaration */: - case 182 /* ConstructorType */: - return findFirstModifierExcept(node, 126 /* AbstractKeyword */); - case 228 /* ClassExpression */: - case 261 /* InterfaceDeclaration */: - case 240 /* VariableStatement */: - case 262 /* TypeAliasDeclaration */: + case 261 /* FunctionDeclaration */: + return findFirstModifierExcept(node, 134 /* AsyncKeyword */); + case 262 /* ClassDeclaration */: + case 184 /* ConstructorType */: + return findFirstModifierExcept(node, 128 /* AbstractKeyword */); + case 230 /* ClassExpression */: + case 263 /* InterfaceDeclaration */: + case 242 /* VariableStatement */: + case 264 /* TypeAliasDeclaration */: return find(node.modifiers, isModifier); - case 263 /* EnumDeclaration */: - return findFirstModifierExcept(node, 85 /* ConstKeyword */); + case 265 /* EnumDeclaration */: + return findFirstModifierExcept(node, 87 /* ConstKeyword */); default: Debug.assertNever(node); } @@ -84025,10 +84604,10 @@ ${lanes.join("\n")} } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 171 /* MethodDeclaration */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 173 /* MethodDeclaration */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -84200,7 +84779,7 @@ ${lanes.join("\n")} let seenImplementsClause = false; if (!checkGrammarModifiers(node) && node.heritageClauses) { for (const heritageClause of node.heritageClauses) { - if (heritageClause.token === 94 /* ExtendsKeyword */) { + if (heritageClause.token === 96 /* ExtendsKeyword */) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_already_seen); } @@ -84212,7 +84791,7 @@ ${lanes.join("\n")} } seenExtendsClause = true; } else { - Debug.assert(heritageClause.token === 117 /* ImplementsKeyword */); + Debug.assert(heritageClause.token === 119 /* ImplementsKeyword */); if (seenImplementsClause) { return grammarErrorOnFirstToken(heritageClause, Diagnostics.implements_clause_already_seen); } @@ -84226,13 +84805,13 @@ ${lanes.join("\n")} let seenExtendsClause = false; if (node.heritageClauses) { for (const heritageClause of node.heritageClauses) { - if (heritageClause.token === 94 /* ExtendsKeyword */) { + if (heritageClause.token === 96 /* ExtendsKeyword */) { if (seenExtendsClause) { return grammarErrorOnFirstToken(heritageClause, Diagnostics.extends_clause_already_seen); } seenExtendsClause = true; } else { - Debug.assert(heritageClause.token === 117 /* ImplementsKeyword */); + Debug.assert(heritageClause.token === 119 /* ImplementsKeyword */); return grammarErrorOnFirstToken(heritageClause, Diagnostics.Interface_declaration_cannot_have_implements_clause); } checkGrammarHeritageClause(heritageClause); @@ -84241,11 +84820,11 @@ ${lanes.join("\n")} return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 164 /* ComputedPropertyName */) { + if (node.kind !== 166 /* ComputedPropertyName */) { return false; } const computedPropertyName = node; - if (computedPropertyName.expression.kind === 223 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* CommaToken */) { + if (computedPropertyName.expression.kind === 225 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 28 /* CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; @@ -84253,7 +84832,7 @@ ${lanes.join("\n")} function checkGrammarForGenerator(node) { if (node.asteriskToken) { Debug.assert( - node.kind === 259 /* FunctionDeclaration */ || node.kind === 215 /* FunctionExpression */ || node.kind === 171 /* MethodDeclaration */ + node.kind === 261 /* FunctionDeclaration */ || node.kind === 217 /* FunctionExpression */ || node.kind === 173 /* MethodDeclaration */ ); if (node.flags & 16777216 /* Ambient */) { return grammarErrorOnNode(node.asteriskToken, Diagnostics.Generators_are_not_allowed_in_an_ambient_context); @@ -84272,7 +84851,7 @@ ${lanes.join("\n")} function checkGrammarObjectLiteralExpression(node, inDestructuring) { const seen = /* @__PURE__ */ new Map(); for (const prop of node.properties) { - if (prop.kind === 301 /* SpreadAssignment */) { + if (prop.kind === 304 /* SpreadAssignment */) { if (inDestructuring) { const expression = skipParentheses(prop.expression); if (isArrayLiteralExpression(expression) || isObjectLiteralExpression(expression)) { @@ -84282,18 +84861,18 @@ ${lanes.join("\n")} continue; } const name = prop.name; - if (name.kind === 164 /* ComputedPropertyName */) { + if (name.kind === 166 /* ComputedPropertyName */) { checkGrammarComputedPropertyName(name); } - if (prop.kind === 300 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 303 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { grammarErrorOnNode(prop.equalsToken, 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); } - if (name.kind === 80 /* PrivateIdentifier */) { + if (name.kind === 81 /* PrivateIdentifier */) { grammarErrorOnNode(name, Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); } if (canHaveModifiers(prop) && prop.modifiers) { for (const mod of prop.modifiers) { - if (isModifier(mod) && (mod.kind !== 132 /* AsyncKeyword */ || prop.kind !== 171 /* MethodDeclaration */)) { + if (isModifier(mod) && (mod.kind !== 134 /* AsyncKeyword */ || prop.kind !== 173 /* MethodDeclaration */)) { grammarErrorOnNode(mod, Diagnostics._0_modifier_cannot_be_used_here, getTextOfNode(mod)); } } @@ -84306,29 +84885,29 @@ ${lanes.join("\n")} } let currentKind; switch (prop.kind) { - case 300 /* ShorthandPropertyAssignment */: - case 299 /* PropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: + case 302 /* PropertyAssignment */: checkGrammarForInvalidExclamationToken(prop.exclamationToken, Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); checkGrammarForInvalidQuestionMark(prop.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional); - if (name.kind === 8 /* NumericLiteral */) { + if (name.kind === 9 /* NumericLiteral */) { checkGrammarNumericLiteral(name); } currentKind = 4 /* PropertyAssignment */; break; - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: currentKind = 8 /* Method */; break; - case 174 /* GetAccessor */: + case 176 /* GetAccessor */: currentKind = 1 /* GetAccessor */; break; - case 175 /* SetAccessor */: + case 177 /* SetAccessor */: currentKind = 2 /* SetAccessor */; break; default: - throw Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind); + Debug.assertNever(prop, "Unexpected syntax kind:" + prop.kind); } if (!inDestructuring) { - const effectiveName = getPropertyNameForPropertyNameNode(name); + const effectiveName = getEffectivePropertyNameForPropertyNameNode(name); if (effectiveName === void 0) { continue; } @@ -84358,39 +84937,27 @@ ${lanes.join("\n")} checkGrammarTypeArguments(node, node.typeArguments); const seen = /* @__PURE__ */ new Map(); for (const attr of node.attributes.properties) { - if (attr.kind === 290 /* JsxSpreadAttribute */) { + if (attr.kind === 292 /* JsxSpreadAttribute */) { continue; } const { name, initializer } = attr; - if (!seen.get(name.escapedText)) { - seen.set(name.escapedText, true); + const escapedText = getEscapedTextOfJsxAttributeName(name); + if (!seen.get(escapedText)) { + seen.set(escapedText, true); } else { return grammarErrorOnNode(name, Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 291 /* JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 293 /* JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } } function checkGrammarJsxName(node) { - if (isPropertyAccessExpression(node)) { - let propName = node; - do { - const check2 = checkGrammarJsxNestedIdentifier(propName.name); - if (check2) { - return check2; - } - propName = propName.expression; - } while (isPropertyAccessExpression(propName)); - const check = checkGrammarJsxNestedIdentifier(propName); - if (check) { - return check; - } + if (isPropertyAccessExpression(node) && isJsxNamespacedName(node.expression)) { + return grammarErrorOnNode(node.expression, Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names); } - function checkGrammarJsxNestedIdentifier(name) { - if (isIdentifier(name) && idText(name).indexOf(":") !== -1) { - return grammarErrorOnNode(name, Diagnostics.JSX_property_access_expressions_cannot_include_JSX_namespace_names); - } + if (isJsxNamespacedName(node) && getJSXTransformEnabled(compilerOptions) && !isIntrinsicJsxName(node.namespace.escapedText)) { + return grammarErrorOnNode(node, Diagnostics.React_components_cannot_include_JSX_namespace_names); } } function checkGrammarJsxExpression(node) { @@ -84402,7 +84969,7 @@ ${lanes.join("\n")} if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 247 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 249 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) { if (!(forInOrOfStatement.flags & 32768 /* AwaitContext */)) { const sourceFile = getSourceFileOfNode(forInOrOfStatement); if (isInTopLevelContext(forInOrOfStatement)) { @@ -84442,7 +85009,7 @@ ${lanes.join("\n")} if (!hasParseDiagnostics(sourceFile)) { const diagnostic = createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); const func = getContainingFunction(forInOrOfStatement); - if (func && func.kind !== 173 /* Constructor */) { + if (func && func.kind !== 175 /* Constructor */) { Debug.assert((getFunctionFlags(func) & 2 /* Async */) === 0, "Enclosing function should never be an async function."); const relatedInfo = createDiagnosticForNode(func, Diagnostics.Did_you_mean_to_mark_this_function_as_async); addRelatedInfo(diagnostic, relatedInfo); @@ -84458,7 +85025,7 @@ ${lanes.join("\n")} grammarErrorOnNode(forInOrOfStatement.initializer, Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } - if (forInOrOfStatement.initializer.kind === 258 /* VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 260 /* VariableDeclarationList */) { const variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { const declarations = variableList.declarations; @@ -84466,16 +85033,16 @@ ${lanes.join("\n")} return false; } if (declarations.length > 1) { - const diagnostic = forInOrOfStatement.kind === 246 /* ForInStatement */ ? Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + const diagnostic = forInOrOfStatement.kind === 248 /* ForInStatement */ ? Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } const firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - const diagnostic = forInOrOfStatement.kind === 246 /* ForInStatement */ ? Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + const diagnostic = forInOrOfStatement.kind === 248 /* ForInStatement */ ? Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - const diagnostic = forInOrOfStatement.kind === 246 /* ForInStatement */ ? Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + const diagnostic = forInOrOfStatement.kind === 248 /* ForInStatement */ ? Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); } } @@ -84483,7 +85050,7 @@ ${lanes.join("\n")} return false; } function checkGrammarAccessor(accessor) { - if (!(accessor.flags & 16777216 /* Ambient */) && accessor.parent.kind !== 184 /* TypeLiteral */ && accessor.parent.kind !== 261 /* InterfaceDeclaration */) { + if (!(accessor.flags & 16777216 /* Ambient */) && accessor.parent.kind !== 186 /* TypeLiteral */ && accessor.parent.kind !== 263 /* InterfaceDeclaration */) { if (languageVersion < 1 /* ES5 */) { return grammarErrorOnNode(accessor.name, Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } @@ -84498,7 +85065,7 @@ ${lanes.join("\n")} if (hasSyntacticModifier(accessor, 256 /* Abstract */)) { return grammarErrorOnNode(accessor, Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } - if (accessor.parent.kind === 184 /* TypeLiteral */ || accessor.parent.kind === 261 /* InterfaceDeclaration */) { + if (accessor.parent.kind === 186 /* TypeLiteral */ || accessor.parent.kind === 263 /* InterfaceDeclaration */) { return grammarErrorOnNode(accessor.body, Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } } @@ -84508,10 +85075,10 @@ ${lanes.join("\n")} if (!doesAccessorHaveCorrectParameterCount(accessor)) { return grammarErrorOnNode( accessor.name, - accessor.kind === 174 /* GetAccessor */ ? Diagnostics.A_get_accessor_cannot_have_parameters : Diagnostics.A_set_accessor_must_have_exactly_one_parameter + accessor.kind === 176 /* GetAccessor */ ? Diagnostics.A_get_accessor_cannot_have_parameters : Diagnostics.A_set_accessor_must_have_exactly_one_parameter ); } - if (accessor.kind === 175 /* SetAccessor */) { + if (accessor.kind === 177 /* SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -84529,17 +85096,17 @@ ${lanes.join("\n")} return false; } function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 174 /* GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 176 /* GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 174 /* GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 176 /* GetAccessor */ ? 1 : 2)) { return getThisParameter(accessor); } } function checkGrammarTypeOperatorNode(node) { - if (node.operator === 156 /* UniqueKeyword */) { - if (node.type.kind !== 153 /* SymbolKeyword */) { - return grammarErrorOnNode(node.type, Diagnostics._0_expected, tokenToString(153 /* SymbolKeyword */)); + if (node.operator === 158 /* UniqueKeyword */) { + if (node.type.kind !== 155 /* SymbolKeyword */) { + return grammarErrorOnNode(node.type, Diagnostics._0_expected, tokenToString(155 /* SymbolKeyword */)); } let parent2 = walkUpParenthesizedTypes(node.parent); if (isInJSFile(parent2) && isJSDocTypeExpression(parent2)) { @@ -84549,9 +85116,9 @@ ${lanes.join("\n")} } } switch (parent2.kind) { - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: const decl = parent2; - if (decl.name.kind !== 79 /* Identifier */) { + if (decl.name.kind !== 80 /* Identifier */) { return grammarErrorOnNode(node, Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); } if (!isVariableDeclarationInVariableStatement(decl)) { @@ -84561,12 +85128,12 @@ ${lanes.join("\n")} return grammarErrorOnNode(parent2.name, Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: if (!isStatic(parent2) || !hasEffectiveReadonlyModifier(parent2)) { return grammarErrorOnNode(parent2.name, Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 168 /* PropertySignature */: + case 170 /* PropertySignature */: if (!hasSyntacticModifier(parent2, 64 /* Readonly */)) { return grammarErrorOnNode(parent2.name, Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -84574,9 +85141,9 @@ ${lanes.join("\n")} default: return grammarErrorOnNode(node, Diagnostics.unique_symbol_types_are_not_allowed_here); } - } else if (node.operator === 146 /* ReadonlyKeyword */) { - if (node.type.kind !== 185 /* ArrayType */ && node.type.kind !== 186 /* TupleType */) { - return grammarErrorOnFirstToken(node, Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, tokenToString(153 /* SymbolKeyword */)); + } else if (node.operator === 148 /* ReadonlyKeyword */) { + if (node.type.kind !== 187 /* ArrayType */ && node.type.kind !== 188 /* TupleType */) { + return grammarErrorOnFirstToken(node, Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, tokenToString(155 /* SymbolKeyword */)); } } } @@ -84589,9 +85156,9 @@ ${lanes.join("\n")} if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 171 /* MethodDeclaration */) { - if (node.parent.kind === 207 /* ObjectLiteralExpression */) { - if (node.modifiers && !(node.modifiers.length === 1 && first(node.modifiers).kind === 132 /* AsyncKeyword */)) { + if (node.kind === 173 /* MethodDeclaration */) { + if (node.parent.kind === 209 /* ObjectLiteralExpression */) { + if (node.modifiers && !(node.modifiers.length === 1 && first(node.modifiers).kind === 134 /* AsyncKeyword */)) { return grammarErrorOnFirstToken(node, Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, Diagnostics.An_object_member_cannot_be_declared_optional)) { return true; @@ -84611,12 +85178,12 @@ ${lanes.join("\n")} } if (node.flags & 16777216 /* Ambient */) { return checkGrammarForInvalidDynamicName(node.name, 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 === 171 /* MethodDeclaration */ && !node.body) { + } else if (node.kind === 173 /* MethodDeclaration */ && !node.body) { return checkGrammarForInvalidDynamicName(node.name, 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 === 261 /* InterfaceDeclaration */) { + } else if (node.parent.kind === 263 /* InterfaceDeclaration */) { return checkGrammarForInvalidDynamicName(node.name, 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 === 184 /* TypeLiteral */) { + } else if (node.parent.kind === 186 /* TypeLiteral */) { return checkGrammarForInvalidDynamicName(node.name, 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); } } @@ -84627,11 +85194,11 @@ ${lanes.join("\n")} return grammarErrorOnNode(node, Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 253 /* LabeledStatement */: + case 255 /* LabeledStatement */: if (node.label && current.label.escapedText === node.label.escapedText) { - const isMisplacedContinueLabel = node.kind === 248 /* ContinueStatement */ && !isIterationStatement( + const isMisplacedContinueLabel = node.kind === 250 /* ContinueStatement */ && !isIterationStatement( current.statement, - /*lookInLabeledStatement*/ + /*lookInLabeledStatements*/ true ); if (isMisplacedContinueLabel) { @@ -84640,15 +85207,15 @@ ${lanes.join("\n")} return false; } break; - case 252 /* SwitchStatement */: - if (node.kind === 249 /* BreakStatement */ && !node.label) { + case 254 /* SwitchStatement */: + if (node.kind === 251 /* BreakStatement */ && !node.label) { return false; } break; default: if (isIterationStatement( current, - /*lookInLabeledStatement*/ + /*lookInLabeledStatements*/ false ) && !node.label) { return false; @@ -84658,10 +85225,10 @@ ${lanes.join("\n")} current = current.parent; } if (node.label) { - const message = node.kind === 249 /* BreakStatement */ ? Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; + const message = node.kind === 251 /* BreakStatement */ ? Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - const message = node.kind === 249 /* BreakStatement */ ? Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; + const message = node.kind === 251 /* BreakStatement */ ? Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } } @@ -84681,10 +85248,10 @@ ${lanes.join("\n")} } } function isStringOrNumberLiteralExpression(expr) { - return isStringOrNumericLiteralLike(expr) || expr.kind === 221 /* PrefixUnaryExpression */ && expr.operator === 40 /* MinusToken */ && expr.operand.kind === 8 /* NumericLiteral */; + return isStringOrNumericLiteralLike(expr) || expr.kind === 223 /* PrefixUnaryExpression */ && expr.operator === 41 /* MinusToken */ && expr.operand.kind === 9 /* NumericLiteral */; } function isBigIntLiteralExpression(expr) { - return expr.kind === 9 /* BigIntLiteral */ || expr.kind === 221 /* PrefixUnaryExpression */ && expr.operator === 40 /* MinusToken */ && expr.operand.kind === 9 /* BigIntLiteral */; + return expr.kind === 10 /* BigIntLiteral */ || expr.kind === 223 /* PrefixUnaryExpression */ && expr.operator === 41 /* MinusToken */ && expr.operand.kind === 10 /* BigIntLiteral */; } function isSimpleLiteralEnumReference(expr) { if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) { @@ -84694,7 +85261,7 @@ ${lanes.join("\n")} function checkAmbientInitializer(node) { const initializer = node.initializer; if (initializer) { - const isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer) || isSimpleLiteralEnumReference(initializer) || initializer.kind === 110 /* TrueKeyword */ || initializer.kind === 95 /* FalseKeyword */ || isBigIntLiteralExpression(initializer)); + const isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer) || isSimpleLiteralEnumReference(initializer) || initializer.kind === 112 /* TrueKeyword */ || initializer.kind === 97 /* FalseKeyword */ || isBigIntLiteralExpression(initializer)); const isConstOrReadonly = isDeclarationReadonly(node) || isVariableDeclaration(node) && isVarConst(node); if (isConstOrReadonly && !node.type) { if (isInvalidInitializer) { @@ -84706,7 +85273,7 @@ ${lanes.join("\n")} } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 246 /* ForInStatement */ && node.parent.parent.kind !== 247 /* ForOfStatement */) { + if (node.parent.parent.kind !== 248 /* ForInStatement */ && node.parent.parent.kind !== 249 /* ForOfStatement */) { if (node.flags & 16777216 /* Ambient */) { checkAmbientInitializer(node); } else if (!node.initializer) { @@ -84718,7 +85285,7 @@ ${lanes.join("\n")} } } } - if (node.exclamationToken && (node.parent.parent.kind !== 240 /* VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 242 /* VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* Ambient */)) { const message = node.initializer ? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type ? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations : Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context; return grammarErrorOnNode(node.exclamationToken, message); } @@ -84729,7 +85296,7 @@ ${lanes.join("\n")} return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name); } function checkESModuleMarker(name) { - if (name.kind === 79 /* Identifier */) { + if (name.kind === 80 /* Identifier */) { if (idText(name) === "__esModule") { return grammarErrorOnNodeSkippedOn("noEmit", name, Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules); } @@ -84744,7 +85311,7 @@ ${lanes.join("\n")} return false; } function checkGrammarNameInLetOrConstDeclarations(name) { - if (name.kind === 79 /* Identifier */) { + if (name.kind === 80 /* Identifier */) { if (name.escapedText === "let") { return grammarErrorOnNode(name, Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations); } @@ -84770,15 +85337,15 @@ ${lanes.join("\n")} } function allowLetAndConstDeclarations(parent2) { switch (parent2.kind) { - case 242 /* IfStatement */: - case 243 /* DoStatement */: - case 244 /* WhileStatement */: - case 251 /* WithStatement */: - case 245 /* ForStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: + case 244 /* IfStatement */: + case 245 /* DoStatement */: + case 246 /* WhileStatement */: + case 253 /* WithStatement */: + case 247 /* ForStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: return false; - case 253 /* LabeledStatement */: + case 255 /* LabeledStatement */: return allowLetAndConstDeclarations(parent2.parent); } return true; @@ -84795,14 +85362,14 @@ ${lanes.join("\n")} function checkGrammarMetaProperty(node) { const escapedText = node.name.escapedText; switch (node.keywordToken) { - case 103 /* NewKeyword */: + case 105 /* NewKeyword */: if (escapedText !== "target") { - return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, tokenToString(node.keywordToken), "target"); + return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, unescapeLeadingUnderscores(node.name.escapedText), tokenToString(node.keywordToken), "target"); } break; - case 100 /* ImportKeyword */: + case 102 /* ImportKeyword */: if (escapedText !== "meta") { - return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, tokenToString(node.keywordToken), "meta"); + return grammarErrorOnNode(node.name, Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, unescapeLeadingUnderscores(node.name.escapedText), tokenToString(node.keywordToken), "meta"); } break; } @@ -84810,35 +85377,35 @@ ${lanes.join("\n")} function hasParseDiagnostics(sourceFile) { return sourceFile.parseDiagnostics.length > 0; } - function grammarErrorOnFirstToken(node, message, arg0, arg1, arg2) { + function grammarErrorOnFirstToken(node, message, ...args) { const sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { const span = getSpanOfTokenAtPosition(sourceFile, node.pos); - diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2)); + diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, ...args)); return true; } return false; } - function grammarErrorAtPos(nodeForSourceFile, start, length2, message, arg0, arg1, arg2) { + function grammarErrorAtPos(nodeForSourceFile, start, length2, message, ...args) { const sourceFile = getSourceFileOfNode(nodeForSourceFile); if (!hasParseDiagnostics(sourceFile)) { - diagnostics.add(createFileDiagnostic(sourceFile, start, length2, message, arg0, arg1, arg2)); + diagnostics.add(createFileDiagnostic(sourceFile, start, length2, message, ...args)); return true; } return false; } - function grammarErrorOnNodeSkippedOn(key, node, message, arg0, arg1, arg2) { + function grammarErrorOnNodeSkippedOn(key, node, message, ...args) { const sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { - errorSkippedOn(key, node, message, arg0, arg1, arg2); + errorSkippedOn(key, node, message, ...args); return true; } return false; } - function grammarErrorOnNode(node, message, arg0, arg1, arg2) { + function grammarErrorOnNode(node, message, ...args) { const sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { - diagnostics.add(createDiagnosticForNode(node, message, arg0, arg1, arg2)); + diagnostics.add(createDiagnosticForNode(node, message, ...args)); return true; } return false; @@ -84858,7 +85425,7 @@ ${lanes.join("\n")} } } function checkGrammarProperty(node) { - if (isComputedPropertyName(node.name) && isBinaryExpression(node.name.expression) && node.name.expression.operatorToken.kind === 101 /* InKeyword */) { + if (isComputedPropertyName(node.name) && isBinaryExpression(node.name.expression) && node.name.expression.operatorToken.kind === 103 /* InKeyword */) { return grammarErrorOnNode(node.parent.members[0], Diagnostics.A_mapped_type_may_not_declare_properties_or_methods); } if (isClassLike(node.parent)) { @@ -84877,7 +85444,7 @@ ${lanes.join("\n")} if (isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, Diagnostics.An_accessor_property_cannot_be_declared_optional)) { return true; } - } else if (node.parent.kind === 261 /* InterfaceDeclaration */) { + } else if (node.parent.kind === 263 /* InterfaceDeclaration */) { if (checkGrammarForInvalidDynamicName(node.name, 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; } @@ -84903,14 +85470,14 @@ ${lanes.join("\n")} } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 261 /* InterfaceDeclaration */ || node.kind === 262 /* TypeAliasDeclaration */ || node.kind === 269 /* ImportDeclaration */ || node.kind === 268 /* ImportEqualsDeclaration */ || node.kind === 275 /* ExportDeclaration */ || node.kind === 274 /* ExportAssignment */ || node.kind === 267 /* NamespaceExportDeclaration */ || hasSyntacticModifier(node, 2 /* Ambient */ | 1 /* Export */ | 1024 /* Default */)) { + if (node.kind === 263 /* InterfaceDeclaration */ || node.kind === 264 /* TypeAliasDeclaration */ || node.kind === 271 /* ImportDeclaration */ || node.kind === 270 /* ImportEqualsDeclaration */ || node.kind === 277 /* ExportDeclaration */ || node.kind === 276 /* ExportAssignment */ || node.kind === 269 /* NamespaceExportDeclaration */ || hasSyntacticModifier(node, 2 /* Ambient */ | 1 /* Export */ | 1024 /* Default */)) { return false; } return grammarErrorOnFirstToken(node, Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); } function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (const decl of file.statements) { - if (isDeclaration(decl) || decl.kind === 240 /* VariableStatement */) { + if (isDeclaration(decl) || decl.kind === 242 /* VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -84927,7 +85494,7 @@ ${lanes.join("\n")} if (!links.hasReportedStatementInAmbientContext && (isFunctionLike(node.parent) || isAccessor(node.parent))) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 238 /* Block */ || node.parent.kind === 265 /* ModuleBlock */ || node.parent.kind === 308 /* SourceFile */) { + if (node.parent.kind === 240 /* Block */ || node.parent.kind === 267 /* ModuleBlock */ || node.parent.kind === 311 /* SourceFile */) { const links2 = getNodeLinks(node.parent); if (!links2.hasReportedStatementInAmbientContext) { return links2.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -84938,25 +85505,6 @@ ${lanes.join("\n")} return false; } function checkGrammarNumericLiteral(node) { - if (node.numericLiteralFlags & 32 /* Octal */) { - let diagnosticMessage; - if (languageVersion >= 1 /* ES5 */) { - diagnosticMessage = Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; - } else if (isChildOfNodeWithKind(node, 198 /* LiteralType */)) { - diagnosticMessage = Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; - } else if (isChildOfNodeWithKind(node, 302 /* EnumMember */)) { - diagnosticMessage = Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; - } - if (diagnosticMessage) { - const withMinus = isPrefixUnaryExpression(node.parent) && node.parent.operator === 40 /* MinusToken */; - const literal = (withMinus ? "-" : "") + "0o" + node.text; - return grammarErrorOnNode(withMinus ? node.parent : node, diagnosticMessage, literal); - } - } - checkNumericLiteralValueSize(node); - return false; - } - function checkNumericLiteralValueSize(node) { const isFractional = getTextOfNode(node).indexOf(".") !== -1; const isScientific = node.numericLiteralFlags & 16 /* Scientific */; if (isFractional || isScientific) { @@ -84983,7 +85531,7 @@ ${lanes.join("\n")} } return false; } - function grammarErrorAfterFirstToken(node, message, arg0, arg1, arg2) { + function grammarErrorAfterFirstToken(node, message, ...args) { const sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { const span = getSpanOfTokenAtPosition(sourceFile, node.pos); @@ -84993,9 +85541,7 @@ ${lanes.join("\n")} /*length*/ 0, message, - arg0, - arg1, - arg2 + ...args )); return true; } @@ -85015,21 +85561,21 @@ ${lanes.join("\n")} return ambientModulesCache; } function getAmbientModules2(envGlobals) { - const cache = []; + const result = []; envGlobals.forEach((global2, sym) => { if (ambientModuleSymbolRegex.test(sym)) { - cache.push(global2); + result.push(global2); } }); - return cache; + return result; } } function checkGrammarImportClause(node) { - var _a2; + var _a; if (node.isTypeOnly && node.name && node.namedBindings) { return grammarErrorOnNode(node, Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); } - if (node.isTypeOnly && ((_a2 = node.namedBindings) == null ? void 0 : _a2.kind) === 272 /* NamedImports */) { + if (node.isTypeOnly && ((_a = node.namedBindings) == null ? void 0 : _a.kind) === 274 /* NamedImports */) { return checkGrammarNamedImportsOrExports(node.namedBindings); } return false; @@ -85039,7 +85585,7 @@ ${lanes.join("\n")} if (specifier.isTypeOnly) { return grammarErrorOnFirstToken( specifier, - specifier.kind === 273 /* ImportSpecifier */ ? Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement + specifier.kind === 275 /* ImportSpecifier */ ? Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement ); } }); @@ -85102,10 +85648,10 @@ ${lanes.join("\n")} } function findMostOverlappyType(source, unionTarget) { let bestMatch; - if (!(source.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) { + if (!(source.flags & (402784252 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) { let matchingCount = 0; for (const target of unionTarget.types) { - if (!(target.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) { + if (!(target.flags & (402784252 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) { const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]); if (overlap.flags & 4194304 /* Index */) { return target; @@ -85123,14 +85669,14 @@ ${lanes.join("\n")} } function filterPrimitivesIfContainsNonPrimitive(type) { if (maybeTypeOfKind(type, 67108864 /* NonPrimitive */)) { - const result = filterType(type, (t) => !(t.flags & 134348796 /* Primitive */)); + const result = filterType(type, (t) => !(t.flags & 402784252 /* Primitive */)); if (!(result.flags & 131072 /* Never */)) { return result; } } return type; } - function findMatchingDiscriminantType(source, target, isRelatedTo, skipPartial) { + function findMatchingDiscriminantType(source, target, isRelatedTo) { if (target.flags & 1048576 /* Union */ && source.flags & (2097152 /* Intersection */ | 524288 /* Object */)) { const match = getMatchingUnionConstituentForType(target, source); if (match) { @@ -85140,30 +85686,30 @@ ${lanes.join("\n")} if (sourceProperties) { const sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target); if (sourcePropertiesFiltered) { - return discriminateTypeByDiscriminableItems( - target, - map(sourcePropertiesFiltered, (p) => [() => getTypeOfSymbol(p), p.escapedName]), - isRelatedTo, - /*defaultValue*/ - void 0, - skipPartial - ); + const discriminated = discriminateTypeByDiscriminableItems(target, map(sourcePropertiesFiltered, (p) => [() => getTypeOfSymbol(p), p.escapedName]), isRelatedTo); + if (discriminated !== target) { + return discriminated; + } } } } return void 0; } + function getEffectivePropertyNameForPropertyNameNode(node) { + const name = getPropertyNameForPropertyNameNode(node); + return name ? name : isComputedPropertyName(node) && isEntityNameExpression(node.expression) ? tryGetNameFromEntityNameExpression(node.expression) : void 0; + } } function isNotAccessor(declaration) { return !isAccessor(declaration); } function isNotOverload(declaration) { - return declaration.kind !== 259 /* FunctionDeclaration */ && declaration.kind !== 171 /* MethodDeclaration */ || !!declaration.body; + return declaration.kind !== 261 /* FunctionDeclaration */ && declaration.kind !== 173 /* MethodDeclaration */ || !!declaration.body; } function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 273 /* ImportSpecifier */: - case 278 /* ExportSpecifier */: + case 275 /* ImportSpecifier */: + case 280 /* ExportSpecifier */: return isIdentifier(name); default: return isDeclarationName(name); @@ -85191,8 +85737,8 @@ ${lanes.join("\n")} getCurrentDirectory: () => host.getCurrentDirectory(), getSymlinkCache: maybeBind(host, host.getSymlinkCache), getPackageJsonInfoCache: () => { - var _a2; - return (_a2 = host.getPackageJsonInfoCache) == null ? void 0 : _a2.call(host); + var _a; + return (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host); }, useCaseSensitiveFileNames: maybeBind(host, host.useCaseSensitiveFileNames), redirectTargetsMap: host.redirectTargetsMap, @@ -85342,6 +85888,7 @@ ${lanes.join("\n")} JsxNames2.ElementAttributesPropertyNameContainer = "ElementAttributesProperty"; JsxNames2.ElementChildrenAttributeNameContainer = "ElementChildrenAttribute"; JsxNames2.Element = "Element"; + JsxNames2.ElementType = "ElementType"; JsxNames2.IntrinsicAttributes = "IntrinsicAttributes"; JsxNames2.IntrinsicClassAttributes = "IntrinsicClassAttributes"; JsxNames2.LibraryManagedAttributes = "LibraryManagedAttributes"; @@ -85351,18 +85898,18 @@ ${lanes.join("\n")} this.moduleResolverHost = void 0; this.inner = void 0; this.disableTrackSymbol = false; - var _a2; + var _a; while (tracker instanceof SymbolTrackerImpl) { tracker = tracker.inner; } this.inner = tracker; this.moduleResolverHost = moduleResolverHost; this.context = context; - this.canTrackSymbol = !!((_a2 = this.inner) == null ? void 0 : _a2.trackSymbol); + this.canTrackSymbol = !!((_a = this.inner) == null ? void 0 : _a.trackSymbol); } trackSymbol(symbol, enclosingDeclaration, meaning) { - var _a2; - if (((_a2 = this.inner) == null ? void 0 : _a2.trackSymbol) && !this.disableTrackSymbol) { + var _a; + if (((_a = this.inner) == null ? void 0 : _a.trackSymbol) && !this.disableTrackSymbol) { if (this.inner.trackSymbol(symbol, enclosingDeclaration, meaning)) { this.onDiagnosticReported(); return true; @@ -85371,78 +85918,78 @@ ${lanes.join("\n")} return false; } reportInaccessibleThisError() { - var _a2; - if ((_a2 = this.inner) == null ? void 0 : _a2.reportInaccessibleThisError) { + var _a; + if ((_a = this.inner) == null ? void 0 : _a.reportInaccessibleThisError) { this.onDiagnosticReported(); this.inner.reportInaccessibleThisError(); } } reportPrivateInBaseOfClassExpression(propertyName) { - var _a2; - if ((_a2 = this.inner) == null ? void 0 : _a2.reportPrivateInBaseOfClassExpression) { + var _a; + if ((_a = this.inner) == null ? void 0 : _a.reportPrivateInBaseOfClassExpression) { this.onDiagnosticReported(); this.inner.reportPrivateInBaseOfClassExpression(propertyName); } } reportInaccessibleUniqueSymbolError() { - var _a2; - if ((_a2 = this.inner) == null ? void 0 : _a2.reportInaccessibleUniqueSymbolError) { + var _a; + if ((_a = this.inner) == null ? void 0 : _a.reportInaccessibleUniqueSymbolError) { this.onDiagnosticReported(); this.inner.reportInaccessibleUniqueSymbolError(); } } reportCyclicStructureError() { - var _a2; - if ((_a2 = this.inner) == null ? void 0 : _a2.reportCyclicStructureError) { + var _a; + if ((_a = this.inner) == null ? void 0 : _a.reportCyclicStructureError) { this.onDiagnosticReported(); this.inner.reportCyclicStructureError(); } } reportLikelyUnsafeImportRequiredError(specifier) { - var _a2; - if ((_a2 = this.inner) == null ? void 0 : _a2.reportLikelyUnsafeImportRequiredError) { + var _a; + if ((_a = this.inner) == null ? void 0 : _a.reportLikelyUnsafeImportRequiredError) { this.onDiagnosticReported(); this.inner.reportLikelyUnsafeImportRequiredError(specifier); } } reportTruncationError() { - var _a2; - if ((_a2 = this.inner) == null ? void 0 : _a2.reportTruncationError) { + var _a; + if ((_a = this.inner) == null ? void 0 : _a.reportTruncationError) { this.onDiagnosticReported(); this.inner.reportTruncationError(); } } trackReferencedAmbientModule(decl, symbol) { - var _a2; - if ((_a2 = this.inner) == null ? void 0 : _a2.trackReferencedAmbientModule) { + var _a; + if ((_a = this.inner) == null ? void 0 : _a.trackReferencedAmbientModule) { this.onDiagnosticReported(); this.inner.trackReferencedAmbientModule(decl, symbol); } } trackExternalModuleSymbolOfImportTypeNode(symbol) { - var _a2; - if ((_a2 = this.inner) == null ? void 0 : _a2.trackExternalModuleSymbolOfImportTypeNode) { + var _a; + if ((_a = this.inner) == null ? void 0 : _a.trackExternalModuleSymbolOfImportTypeNode) { this.onDiagnosticReported(); this.inner.trackExternalModuleSymbolOfImportTypeNode(symbol); } } reportNonlocalAugmentation(containingFile, parentSymbol, augmentingSymbol) { - var _a2; - if ((_a2 = this.inner) == null ? void 0 : _a2.reportNonlocalAugmentation) { + var _a; + if ((_a = this.inner) == null ? void 0 : _a.reportNonlocalAugmentation) { this.onDiagnosticReported(); this.inner.reportNonlocalAugmentation(containingFile, parentSymbol, augmentingSymbol); } } reportNonSerializableProperty(propertyName) { - var _a2; - if ((_a2 = this.inner) == null ? void 0 : _a2.reportNonSerializableProperty) { + var _a; + if ((_a = this.inner) == null ? void 0 : _a.reportNonSerializableProperty) { this.onDiagnosticReported(); this.inner.reportNonSerializableProperty(propertyName); } } reportImportTypeNodeResolutionModeOverride() { - var _a2; - if ((_a2 = this.inner) == null ? void 0 : _a2.reportImportTypeNodeResolutionModeOverride) { + var _a; + if ((_a = this.inner) == null ? void 0 : _a.reportImportTypeNodeResolutionModeOverride) { this.onDiagnosticReported(); this.inner.reportImportTypeNodeResolutionModeOverride(); } @@ -85518,8 +86065,7 @@ ${lanes.join("\n")} get(target, prop, receiver) { if (prop === "get") { return (key) => { - var _a2; - return (_a2 = nodeGlobals.get(key)) != null ? _a2 : globals.get(key); + return nodeGlobals.get(key) ?? globals.get(key); }; } else if (prop === "has") { return (key) => { @@ -85580,7 +86126,7 @@ ${lanes.join("\n")} function tryParseNpmPackageReference(text) { try { return parseNpmPackageReference(text); - } catch (e) { + } catch { return void 0; } } @@ -85597,7 +86143,7 @@ ${lanes.join("\n")} const nameParts = parts.slice(0, namePartLen); const lastNamePart = nameParts.at(-1); const lastAtIndex = lastNamePart.lastIndexOf("@"); - let versionReq = void 0; + let versionReq; if (lastAtIndex > 0) { versionReq = lastNamePart.substring(lastAtIndex + 1); nameParts[nameParts.length - 1] = lastNamePart.substring(0, lastAtIndex); @@ -85890,21 +86436,21 @@ ${lanes.join("\n")} "use strict"; init_ts2(); visitEachChildTable = { - [163 /* QualifiedName */]: function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [165 /* QualifiedName */]: function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateQualifiedName( node, Debug.checkDefined(nodeVisitor(node.left, visitor, isEntityName)), Debug.checkDefined(nodeVisitor(node.right, visitor, isIdentifier)) ); }, - [164 /* ComputedPropertyName */]: function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [166 /* ComputedPropertyName */]: function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateComputedPropertyName( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, // Signature elements - [165 /* TypeParameter */]: function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [167 /* TypeParameter */]: function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypeParameterDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifier), @@ -85913,7 +86459,7 @@ ${lanes.join("\n")} nodeVisitor(node.default, visitor, isTypeNode) ); }, - [166 /* Parameter */]: function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [168 /* Parameter */]: function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateParameterDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -85924,14 +86470,14 @@ ${lanes.join("\n")} nodeVisitor(node.initializer, visitor, isExpression) ); }, - [167 /* Decorator */]: function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [169 /* Decorator */]: function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateDecorator( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, // Type elements - [168 /* PropertySignature */]: function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [170 /* PropertySignature */]: function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updatePropertySignature( node, nodesVisitor(node.modifiers, visitor, isModifier), @@ -85940,19 +86486,18 @@ ${lanes.join("\n")} nodeVisitor(node.type, visitor, isTypeNode) ); }, - [169 /* PropertyDeclaration */]: function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { - var _a2, _b; + [171 /* PropertyDeclaration */]: function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updatePropertyDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)), // QuestionToken and ExclamationToken are mutually exclusive in PropertyDeclaration - tokenVisitor ? nodeVisitor((_a2 = node.questionToken) != null ? _a2 : node.exclamationToken, tokenVisitor, isQuestionOrExclamationToken) : (_b = node.questionToken) != null ? _b : node.exclamationToken, + tokenVisitor ? nodeVisitor(node.questionToken ?? node.exclamationToken, tokenVisitor, isQuestionOrExclamationToken) : node.questionToken ?? node.exclamationToken, nodeVisitor(node.type, visitor, isTypeNode), nodeVisitor(node.initializer, visitor, isExpression) ); }, - [170 /* MethodSignature */]: function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [172 /* MethodSignature */]: function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateMethodSignature( node, nodesVisitor(node.modifiers, visitor, isModifier), @@ -85963,7 +86508,7 @@ ${lanes.join("\n")} nodeVisitor(node.type, visitor, isTypeNode) ); }, - [171 /* MethodDeclaration */]: function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [173 /* MethodDeclaration */]: function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateMethodDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -85976,7 +86521,7 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [173 /* Constructor */]: function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [175 /* Constructor */]: function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateConstructorDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -85984,7 +86529,7 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [174 /* GetAccessor */]: function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [176 /* GetAccessor */]: function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateGetAccessorDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -85994,7 +86539,7 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [175 /* SetAccessor */]: function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [177 /* SetAccessor */]: function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateSetAccessorDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86003,7 +86548,7 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [172 /* ClassStaticBlockDeclaration */]: function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [174 /* ClassStaticBlockDeclaration */]: function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { context.startLexicalEnvironment(); context.suspendLexicalEnvironment(); return context.factory.updateClassStaticBlockDeclaration( @@ -86011,7 +86556,7 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [176 /* CallSignature */]: function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [178 /* CallSignature */]: function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateCallSignature( node, nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), @@ -86019,7 +86564,7 @@ ${lanes.join("\n")} nodeVisitor(node.type, visitor, isTypeNode) ); }, - [177 /* ConstructSignature */]: function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [179 /* ConstructSignature */]: function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateConstructSignature( node, nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), @@ -86027,7 +86572,7 @@ ${lanes.join("\n")} nodeVisitor(node.type, visitor, isTypeNode) ); }, - [178 /* IndexSignature */]: function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [180 /* IndexSignature */]: function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateIndexSignature( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86036,7 +86581,7 @@ ${lanes.join("\n")} ); }, // Types - [179 /* TypePredicate */]: function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [181 /* TypePredicate */]: function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypePredicateNode( node, nodeVisitor(node.assertsModifier, visitor, isAssertsKeyword), @@ -86044,14 +86589,14 @@ ${lanes.join("\n")} nodeVisitor(node.type, visitor, isTypeNode) ); }, - [180 /* TypeReference */]: function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [182 /* TypeReference */]: function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypeReferenceNode( node, Debug.checkDefined(nodeVisitor(node.typeName, visitor, isEntityName)), nodesVisitor(node.typeArguments, visitor, isTypeNode) ); }, - [181 /* FunctionType */]: function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [183 /* FunctionType */]: function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateFunctionTypeNode( node, nodesVisitor(node.typeParameters, visitor, isTypeParameterDeclaration), @@ -86059,7 +86604,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [182 /* ConstructorType */]: function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [184 /* ConstructorType */]: function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateConstructorTypeNode( node, nodesVisitor(node.modifiers, visitor, isModifier), @@ -86068,56 +86613,56 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [183 /* TypeQuery */]: function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [185 /* TypeQuery */]: function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypeQueryNode( node, Debug.checkDefined(nodeVisitor(node.exprName, visitor, isEntityName)), nodesVisitor(node.typeArguments, visitor, isTypeNode) ); }, - [184 /* TypeLiteral */]: function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [186 /* TypeLiteral */]: function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateTypeLiteralNode( node, nodesVisitor(node.members, visitor, isTypeElement) ); }, - [185 /* ArrayType */]: function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [187 /* ArrayType */]: function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateArrayTypeNode( node, Debug.checkDefined(nodeVisitor(node.elementType, visitor, isTypeNode)) ); }, - [186 /* TupleType */]: function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [188 /* TupleType */]: function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateTupleTypeNode( node, nodesVisitor(node.elements, visitor, isTypeNode) ); }, - [187 /* OptionalType */]: function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [189 /* OptionalType */]: function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateOptionalTypeNode( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [188 /* RestType */]: function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [190 /* RestType */]: function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateRestTypeNode( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [189 /* UnionType */]: function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [191 /* UnionType */]: function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateUnionTypeNode( node, nodesVisitor(node.types, visitor, isTypeNode) ); }, - [190 /* IntersectionType */]: function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [192 /* IntersectionType */]: function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateIntersectionTypeNode( node, nodesVisitor(node.types, visitor, isTypeNode) ); }, - [191 /* ConditionalType */]: function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [193 /* ConditionalType */]: function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateConditionalTypeNode( node, Debug.checkDefined(nodeVisitor(node.checkType, visitor, isTypeNode)), @@ -86126,13 +86671,13 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.falseType, visitor, isTypeNode)) ); }, - [192 /* InferType */]: function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [194 /* InferType */]: function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateInferTypeNode( node, Debug.checkDefined(nodeVisitor(node.typeParameter, visitor, isTypeParameterDeclaration)) ); }, - [202 /* ImportType */]: function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [204 /* ImportType */]: function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportTypeNode( node, Debug.checkDefined(nodeVisitor(node.argument, visitor, isTypeNode)), @@ -86142,14 +86687,14 @@ ${lanes.join("\n")} node.isTypeOf ); }, - [298 /* ImportTypeAssertionContainer */]: function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [301 /* ImportTypeAssertionContainer */]: function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportTypeAssertionContainer( node, Debug.checkDefined(nodeVisitor(node.assertClause, visitor, isAssertClause)), node.multiLine ); }, - [199 /* NamedTupleMember */]: function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [201 /* NamedTupleMember */]: function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateNamedTupleMember( node, tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken, @@ -86158,26 +86703,26 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [193 /* ParenthesizedType */]: function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [195 /* ParenthesizedType */]: function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateParenthesizedType( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [195 /* TypeOperator */]: function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [197 /* TypeOperator */]: function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypeOperatorNode( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [196 /* IndexedAccessType */]: function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [198 /* IndexedAccessType */]: function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateIndexedAccessTypeNode( node, Debug.checkDefined(nodeVisitor(node.objectType, visitor, isTypeNode)), Debug.checkDefined(nodeVisitor(node.indexType, visitor, isTypeNode)) ); }, - [197 /* MappedType */]: function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [199 /* MappedType */]: function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateMappedTypeNode( node, tokenVisitor ? nodeVisitor(node.readonlyToken, tokenVisitor, isReadonlyKeywordOrPlusOrMinusToken) : node.readonlyToken, @@ -86188,20 +86733,20 @@ ${lanes.join("\n")} nodesVisitor(node.members, visitor, isTypeElement) ); }, - [198 /* LiteralType */]: function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [200 /* LiteralType */]: function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateLiteralTypeNode( node, Debug.checkDefined(nodeVisitor(node.literal, visitor, isLiteralTypeLiteral)) ); }, - [200 /* TemplateLiteralType */]: function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [202 /* TemplateLiteralType */]: function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTemplateLiteralType( node, Debug.checkDefined(nodeVisitor(node.head, visitor, isTemplateHead)), nodesVisitor(node.templateSpans, visitor, isTemplateLiteralTypeSpan) ); }, - [201 /* TemplateLiteralTypeSpan */]: function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [203 /* TemplateLiteralTypeSpan */]: function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTemplateLiteralTypeSpan( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)), @@ -86209,19 +86754,19 @@ ${lanes.join("\n")} ); }, // Binding patterns - [203 /* ObjectBindingPattern */]: function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [205 /* ObjectBindingPattern */]: function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateObjectBindingPattern( node, nodesVisitor(node.elements, visitor, isBindingElement) ); }, - [204 /* ArrayBindingPattern */]: function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [206 /* ArrayBindingPattern */]: function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateArrayBindingPattern( node, nodesVisitor(node.elements, visitor, isArrayBindingElement) ); }, - [205 /* BindingElement */]: function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [207 /* BindingElement */]: function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateBindingElement( node, tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken, @@ -86231,19 +86776,19 @@ ${lanes.join("\n")} ); }, // Expression - [206 /* ArrayLiteralExpression */]: function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [208 /* ArrayLiteralExpression */]: function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateArrayLiteralExpression( node, nodesVisitor(node.elements, visitor, isExpression) ); }, - [207 /* ObjectLiteralExpression */]: function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [209 /* ObjectLiteralExpression */]: function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateObjectLiteralExpression( node, nodesVisitor(node.properties, visitor, isObjectLiteralElementLike) ); }, - [208 /* PropertyAccessExpression */]: function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [210 /* PropertyAccessExpression */]: function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return isPropertyAccessChain(node) ? context.factory.updatePropertyAccessChain( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), @@ -86255,7 +86800,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.name, visitor, isMemberName)) ); }, - [209 /* ElementAccessExpression */]: function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [211 /* ElementAccessExpression */]: function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return isElementAccessChain(node) ? context.factory.updateElementAccessChain( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), @@ -86267,7 +86812,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.argumentExpression, visitor, isExpression)) ); }, - [210 /* CallExpression */]: function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [212 /* CallExpression */]: function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return isCallChain(node) ? context.factory.updateCallChain( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), @@ -86281,7 +86826,7 @@ ${lanes.join("\n")} nodesVisitor(node.arguments, visitor, isExpression) ); }, - [211 /* NewExpression */]: function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [213 /* NewExpression */]: function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateNewExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), @@ -86289,7 +86834,7 @@ ${lanes.join("\n")} nodesVisitor(node.arguments, visitor, isExpression) ); }, - [212 /* TaggedTemplateExpression */]: function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [214 /* TaggedTemplateExpression */]: function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTaggedTemplateExpression( node, Debug.checkDefined(nodeVisitor(node.tag, visitor, isExpression)), @@ -86297,20 +86842,20 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.template, visitor, isTemplateLiteral)) ); }, - [213 /* TypeAssertionExpression */]: function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [215 /* TypeAssertionExpression */]: function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypeAssertion( node, Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)), Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [214 /* ParenthesizedExpression */]: function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [216 /* ParenthesizedExpression */]: function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateParenthesizedExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [215 /* FunctionExpression */]: function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [217 /* FunctionExpression */]: function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateFunctionExpression( node, nodesVisitor(node.modifiers, visitor, isModifier), @@ -86322,7 +86867,7 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [216 /* ArrowFunction */]: function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [218 /* ArrowFunction */]: function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateArrowFunction( node, nodesVisitor(node.modifiers, visitor, isModifier), @@ -86333,43 +86878,43 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [217 /* DeleteExpression */]: function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [219 /* DeleteExpression */]: function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateDeleteExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [218 /* TypeOfExpression */]: function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [220 /* TypeOfExpression */]: function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypeOfExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [219 /* VoidExpression */]: function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [221 /* VoidExpression */]: function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateVoidExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [220 /* AwaitExpression */]: function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [222 /* AwaitExpression */]: function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateAwaitExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [221 /* PrefixUnaryExpression */]: function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [223 /* PrefixUnaryExpression */]: function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updatePrefixUnaryExpression( node, Debug.checkDefined(nodeVisitor(node.operand, visitor, isExpression)) ); }, - [222 /* PostfixUnaryExpression */]: function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [224 /* PostfixUnaryExpression */]: function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updatePostfixUnaryExpression( node, Debug.checkDefined(nodeVisitor(node.operand, visitor, isExpression)) ); }, - [223 /* BinaryExpression */]: function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [225 /* BinaryExpression */]: function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateBinaryExpression( node, Debug.checkDefined(nodeVisitor(node.left, visitor, isExpression)), @@ -86377,7 +86922,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.right, visitor, isExpression)) ); }, - [224 /* ConditionalExpression */]: function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [226 /* ConditionalExpression */]: function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateConditionalExpression( node, Debug.checkDefined(nodeVisitor(node.condition, visitor, isExpression)), @@ -86387,27 +86932,27 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.whenFalse, visitor, isExpression)) ); }, - [225 /* TemplateExpression */]: function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [227 /* TemplateExpression */]: function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTemplateExpression( node, Debug.checkDefined(nodeVisitor(node.head, visitor, isTemplateHead)), nodesVisitor(node.templateSpans, visitor, isTemplateSpan) ); }, - [226 /* YieldExpression */]: function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [228 /* YieldExpression */]: function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateYieldExpression( node, tokenVisitor ? nodeVisitor(node.asteriskToken, tokenVisitor, isAsteriskToken) : node.asteriskToken, nodeVisitor(node.expression, visitor, isExpression) ); }, - [227 /* SpreadElement */]: function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [229 /* SpreadElement */]: function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateSpreadElement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [228 /* ClassExpression */]: function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [230 /* ClassExpression */]: function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateClassExpression( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86417,28 +86962,28 @@ ${lanes.join("\n")} nodesVisitor(node.members, visitor, isClassElement) ); }, - [230 /* ExpressionWithTypeArguments */]: function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [232 /* ExpressionWithTypeArguments */]: function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateExpressionWithTypeArguments( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), nodesVisitor(node.typeArguments, visitor, isTypeNode) ); }, - [231 /* AsExpression */]: function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [233 /* AsExpression */]: function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateAsExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [235 /* SatisfiesExpression */]: function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [237 /* SatisfiesExpression */]: function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateSatisfiesExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [232 /* NonNullExpression */]: function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [234 /* NonNullExpression */]: function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return isOptionalChain(node) ? context.factory.updateNonNullChain( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) @@ -86447,14 +86992,14 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [233 /* MetaProperty */]: function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [235 /* MetaProperty */]: function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateMetaProperty( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)) ); }, // Misc - [236 /* TemplateSpan */]: function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [238 /* TemplateSpan */]: function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTemplateSpan( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), @@ -86462,26 +87007,26 @@ ${lanes.join("\n")} ); }, // Element - [238 /* Block */]: function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [240 /* Block */]: function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateBlock( node, nodesVisitor(node.statements, visitor, isStatement) ); }, - [240 /* VariableStatement */]: function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [242 /* VariableStatement */]: function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateVariableStatement( node, nodesVisitor(node.modifiers, visitor, isModifierLike), Debug.checkDefined(nodeVisitor(node.declarationList, visitor, isVariableDeclarationList)) ); }, - [241 /* ExpressionStatement */]: function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [243 /* ExpressionStatement */]: function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateExpressionStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [242 /* IfStatement */]: function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [244 /* IfStatement */]: function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateIfStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), @@ -86489,21 +87034,21 @@ ${lanes.join("\n")} nodeVisitor(node.elseStatement, visitor, isStatement, context.factory.liftToBlock) ); }, - [243 /* DoStatement */]: function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [245 /* DoStatement */]: function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateDoStatement( node, visitIterationBody(node.statement, visitor, context, nodeVisitor), Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [244 /* WhileStatement */]: function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [246 /* WhileStatement */]: function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateWhileStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), visitIterationBody(node.statement, visitor, context, nodeVisitor) ); }, - [245 /* ForStatement */]: function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [247 /* ForStatement */]: function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateForStatement( node, nodeVisitor(node.initializer, visitor, isForInitializer), @@ -86512,7 +87057,7 @@ ${lanes.join("\n")} visitIterationBody(node.statement, visitor, context, nodeVisitor) ); }, - [246 /* ForInStatement */]: function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [248 /* ForInStatement */]: function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateForInStatement( node, Debug.checkDefined(nodeVisitor(node.initializer, visitor, isForInitializer)), @@ -86520,7 +87065,7 @@ ${lanes.join("\n")} visitIterationBody(node.statement, visitor, context, nodeVisitor) ); }, - [247 /* ForOfStatement */]: function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [249 /* ForOfStatement */]: function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateForOfStatement( node, tokenVisitor ? nodeVisitor(node.awaitModifier, tokenVisitor, isAwaitKeyword) : node.awaitModifier, @@ -86529,52 +87074,52 @@ ${lanes.join("\n")} visitIterationBody(node.statement, visitor, context, nodeVisitor) ); }, - [248 /* ContinueStatement */]: function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [250 /* ContinueStatement */]: function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateContinueStatement( node, nodeVisitor(node.label, visitor, isIdentifier) ); }, - [249 /* BreakStatement */]: function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [251 /* BreakStatement */]: function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateBreakStatement( node, nodeVisitor(node.label, visitor, isIdentifier) ); }, - [250 /* ReturnStatement */]: function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [252 /* ReturnStatement */]: function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateReturnStatement( node, nodeVisitor(node.expression, visitor, isExpression) ); }, - [251 /* WithStatement */]: function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [253 /* WithStatement */]: function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateWithStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), Debug.checkDefined(nodeVisitor(node.statement, visitor, isStatement, context.factory.liftToBlock)) ); }, - [252 /* SwitchStatement */]: function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [254 /* SwitchStatement */]: function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateSwitchStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), Debug.checkDefined(nodeVisitor(node.caseBlock, visitor, isCaseBlock)) ); }, - [253 /* LabeledStatement */]: function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [255 /* LabeledStatement */]: function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateLabeledStatement( node, Debug.checkDefined(nodeVisitor(node.label, visitor, isIdentifier)), Debug.checkDefined(nodeVisitor(node.statement, visitor, isStatement, context.factory.liftToBlock)) ); }, - [254 /* ThrowStatement */]: function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [256 /* ThrowStatement */]: function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateThrowStatement( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [255 /* TryStatement */]: function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [257 /* TryStatement */]: function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTryStatement( node, Debug.checkDefined(nodeVisitor(node.tryBlock, visitor, isBlock)), @@ -86582,7 +87127,7 @@ ${lanes.join("\n")} nodeVisitor(node.finallyBlock, visitor, isBlock) ); }, - [257 /* VariableDeclaration */]: function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + [259 /* VariableDeclaration */]: function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateVariableDeclaration( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isBindingName)), @@ -86591,13 +87136,13 @@ ${lanes.join("\n")} nodeVisitor(node.initializer, visitor, isExpression) ); }, - [258 /* VariableDeclarationList */]: function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [260 /* VariableDeclarationList */]: function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateVariableDeclarationList( node, nodesVisitor(node.declarations, visitor, isVariableDeclaration) ); }, - [259 /* FunctionDeclaration */]: function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + [261 /* FunctionDeclaration */]: function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { return context.factory.updateFunctionDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifier), @@ -86609,7 +87154,7 @@ ${lanes.join("\n")} visitFunctionBody(node.body, visitor, context, nodeVisitor) ); }, - [260 /* ClassDeclaration */]: function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [262 /* ClassDeclaration */]: function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateClassDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86619,7 +87164,7 @@ ${lanes.join("\n")} nodesVisitor(node.members, visitor, isClassElement) ); }, - [261 /* InterfaceDeclaration */]: function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [263 /* InterfaceDeclaration */]: function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateInterfaceDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86629,7 +87174,7 @@ ${lanes.join("\n")} nodesVisitor(node.members, visitor, isTypeElement) ); }, - [262 /* TypeAliasDeclaration */]: function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [264 /* TypeAliasDeclaration */]: function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateTypeAliasDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86638,7 +87183,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode)) ); }, - [263 /* EnumDeclaration */]: function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [265 /* EnumDeclaration */]: function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateEnumDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86646,7 +87191,7 @@ ${lanes.join("\n")} nodesVisitor(node.members, visitor, isEnumMember) ); }, - [264 /* ModuleDeclaration */]: function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [266 /* ModuleDeclaration */]: function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateModuleDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86654,25 +87199,25 @@ ${lanes.join("\n")} nodeVisitor(node.body, visitor, isModuleBody) ); }, - [265 /* ModuleBlock */]: function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [267 /* ModuleBlock */]: function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateModuleBlock( node, nodesVisitor(node.statements, visitor, isStatement) ); }, - [266 /* CaseBlock */]: function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [268 /* CaseBlock */]: function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateCaseBlock( node, nodesVisitor(node.clauses, visitor, isCaseOrDefaultClause) ); }, - [267 /* NamespaceExportDeclaration */]: function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [269 /* NamespaceExportDeclaration */]: function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateNamespaceExportDeclaration( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)) ); }, - [268 /* ImportEqualsDeclaration */]: function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [270 /* ImportEqualsDeclaration */]: function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportEqualsDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86681,7 +87226,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.moduleReference, visitor, isModuleReference)) ); }, - [269 /* ImportDeclaration */]: function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [271 /* ImportDeclaration */]: function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86690,21 +87235,21 @@ ${lanes.join("\n")} nodeVisitor(node.assertClause, visitor, isAssertClause) ); }, - [296 /* AssertClause */]: function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [299 /* AssertClause */]: function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateAssertClause( node, nodesVisitor(node.elements, visitor, isAssertEntry), node.multiLine ); }, - [297 /* AssertEntry */]: function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [300 /* AssertEntry */]: function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateAssertEntry( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isAssertionKey)), Debug.checkDefined(nodeVisitor(node.value, visitor, isExpression)) ); }, - [270 /* ImportClause */]: function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [272 /* ImportClause */]: function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportClause( node, node.isTypeOnly, @@ -86712,25 +87257,25 @@ ${lanes.join("\n")} nodeVisitor(node.namedBindings, visitor, isNamedImportBindings) ); }, - [271 /* NamespaceImport */]: function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [273 /* NamespaceImport */]: function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateNamespaceImport( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)) ); }, - [277 /* NamespaceExport */]: function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [279 /* NamespaceExport */]: function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateNamespaceExport( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)) ); }, - [272 /* NamedImports */]: function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [274 /* NamedImports */]: function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateNamedImports( node, nodesVisitor(node.elements, visitor, isImportSpecifier) ); }, - [273 /* ImportSpecifier */]: function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [275 /* ImportSpecifier */]: function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateImportSpecifier( node, node.isTypeOnly, @@ -86738,14 +87283,14 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)) ); }, - [274 /* ExportAssignment */]: function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [276 /* ExportAssignment */]: function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateExportAssignment( node, nodesVisitor(node.modifiers, visitor, isModifierLike), Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [275 /* ExportDeclaration */]: function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [277 /* ExportDeclaration */]: function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateExportDeclaration( node, nodesVisitor(node.modifiers, visitor, isModifierLike), @@ -86755,13 +87300,13 @@ ${lanes.join("\n")} nodeVisitor(node.assertClause, visitor, isAssertClause) ); }, - [276 /* NamedExports */]: function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [278 /* NamedExports */]: function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateNamedExports( node, nodesVisitor(node.elements, visitor, isExportSpecifier) ); }, - [278 /* ExportSpecifier */]: function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [280 /* ExportSpecifier */]: function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateExportSpecifier( node, node.isTypeOnly, @@ -86770,14 +87315,14 @@ ${lanes.join("\n")} ); }, // Module references - [280 /* ExternalModuleReference */]: function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [282 /* ExternalModuleReference */]: function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateExternalModuleReference( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, // JSX - [281 /* JsxElement */]: function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [283 /* JsxElement */]: function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxElement( node, Debug.checkDefined(nodeVisitor(node.openingElement, visitor, isJsxOpeningElement)), @@ -86785,7 +87330,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.closingElement, visitor, isJsxClosingElement)) ); }, - [282 /* JsxSelfClosingElement */]: function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [284 /* JsxSelfClosingElement */]: function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxSelfClosingElement( node, Debug.checkDefined(nodeVisitor(node.tagName, visitor, isJsxTagNameExpression)), @@ -86793,7 +87338,7 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.attributes, visitor, isJsxAttributes)) ); }, - [283 /* JsxOpeningElement */]: function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [285 /* JsxOpeningElement */]: function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxOpeningElement( node, Debug.checkDefined(nodeVisitor(node.tagName, visitor, isJsxTagNameExpression)), @@ -86801,13 +87346,20 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.attributes, visitor, isJsxAttributes)) ); }, - [284 /* JsxClosingElement */]: function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [286 /* JsxClosingElement */]: function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxClosingElement( node, Debug.checkDefined(nodeVisitor(node.tagName, visitor, isJsxTagNameExpression)) ); }, - [285 /* JsxFragment */]: function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [294 /* JsxNamespacedName */]: function forEachChildInJsxNamespacedName2(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxNamespacedName( + node, + Debug.checkDefined(nodeVisitor(node.namespace, visitor, isIdentifier)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)) + ); + }, + [287 /* JsxFragment */]: function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxFragment( node, Debug.checkDefined(nodeVisitor(node.openingFragment, visitor, isJsxOpeningFragment)), @@ -86815,52 +87367,52 @@ ${lanes.join("\n")} Debug.checkDefined(nodeVisitor(node.closingFragment, visitor, isJsxClosingFragment)) ); }, - [288 /* JsxAttribute */]: function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [290 /* JsxAttribute */]: function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxAttribute( node, - Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)), + Debug.checkDefined(nodeVisitor(node.name, visitor, isJsxAttributeName)), nodeVisitor(node.initializer, visitor, isStringLiteralOrJsxExpression) ); }, - [289 /* JsxAttributes */]: function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [291 /* JsxAttributes */]: function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateJsxAttributes( node, nodesVisitor(node.properties, visitor, isJsxAttributeLike) ); }, - [290 /* JsxSpreadAttribute */]: function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [292 /* JsxSpreadAttribute */]: function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxSpreadAttribute( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [291 /* JsxExpression */]: function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [293 /* JsxExpression */]: function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateJsxExpression( node, nodeVisitor(node.expression, visitor, isExpression) ); }, // Clauses - [292 /* CaseClause */]: function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + [295 /* CaseClause */]: function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateCaseClause( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)), nodesVisitor(node.statements, visitor, isStatement) ); }, - [293 /* DefaultClause */]: function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [296 /* DefaultClause */]: function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateDefaultClause( node, nodesVisitor(node.statements, visitor, isStatement) ); }, - [294 /* HeritageClause */]: function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [297 /* HeritageClause */]: function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateHeritageClause( node, nodesVisitor(node.types, visitor, isExpressionWithTypeArguments) ); }, - [295 /* CatchClause */]: function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [298 /* CatchClause */]: function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateCatchClause( node, nodeVisitor(node.variableDeclaration, visitor, isVariableDeclaration), @@ -86868,28 +87420,28 @@ ${lanes.join("\n")} ); }, // Property assignments - [299 /* PropertyAssignment */]: function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [302 /* PropertyAssignment */]: function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updatePropertyAssignment( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)), Debug.checkDefined(nodeVisitor(node.initializer, visitor, isExpression)) ); }, - [300 /* ShorthandPropertyAssignment */]: function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [303 /* ShorthandPropertyAssignment */]: function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateShorthandPropertyAssignment( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)), nodeVisitor(node.objectAssignmentInitializer, visitor, isExpression) ); }, - [301 /* SpreadAssignment */]: function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [304 /* SpreadAssignment */]: function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateSpreadAssignment( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, // Enum - [302 /* EnumMember */]: function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [305 /* EnumMember */]: function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updateEnumMember( node, Debug.checkDefined(nodeVisitor(node.name, visitor, isPropertyName)), @@ -86897,20 +87449,20 @@ ${lanes.join("\n")} ); }, // Top-level nodes - [308 /* SourceFile */]: function visitEachChildOfSourceFile(node, visitor, context, _nodesVisitor, _nodeVisitor, _tokenVisitor) { + [311 /* SourceFile */]: function visitEachChildOfSourceFile(node, visitor, context, _nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateSourceFile( node, visitLexicalEnvironment(node.statements, visitor, context) ); }, // Transformation nodes - [356 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + [359 /* PartiallyEmittedExpression */]: function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { return context.factory.updatePartiallyEmittedExpression( node, Debug.checkDefined(nodeVisitor(node.expression, visitor, isExpression)) ); }, - [357 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + [360 /* CommaListExpression */]: function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { return context.factory.updateCommaListExpression( node, nodesVisitor(node.elements, visitor, isExpression) @@ -87190,7 +87742,7 @@ ${lanes.join("\n")} if (isRawSourceMap(parsed)) { return parsed; } - } catch (e) { + } catch { } return void 0; } @@ -87511,7 +88063,7 @@ ${lanes.join("\n")} function chainBundle(context, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 308 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 311 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(map(node.sourceFiles, transformSourceFile), node.prepends); @@ -87554,7 +88106,7 @@ ${lanes.join("\n")} let hasImportDefault = false; for (const node of sourceFile.statements) { switch (node.kind) { - case 269 /* ImportDeclaration */: + case 271 /* ImportDeclaration */: externalImports.push(node); if (!hasImportStar && getImportNeedsImportStarHelper(node)) { hasImportStar = true; @@ -87563,12 +88115,12 @@ ${lanes.join("\n")} hasImportDefault = true; } break; - case 268 /* ImportEqualsDeclaration */: - if (node.moduleReference.kind === 280 /* ExternalModuleReference */) { + case 270 /* ImportEqualsDeclaration */: + if (node.moduleReference.kind === 282 /* ExternalModuleReference */) { externalImports.push(node); } break; - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -87591,19 +88143,19 @@ ${lanes.join("\n")} addExportedNamesForExportDeclaration(node); } break; - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: if (node.isExportEquals && !exportEquals) { exportEquals = node; } break; - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: if (hasSyntacticModifier(node, 1 /* Export */)) { for (const decl of node.declarationList.declarations) { - exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames); + exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames, exportedBindings); } } break; - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: if (hasSyntacticModifier(node, 1 /* Export */)) { if (hasSyntacticModifier(node, 1024 /* Default */)) { if (!hasExportDefault) { @@ -87620,7 +88172,7 @@ ${lanes.join("\n")} } } break; - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: if (hasSyntacticModifier(node, 1 /* Export */)) { if (hasSyntacticModifier(node, 1024 /* Default */)) { if (!hasExportDefault) { @@ -87661,11 +88213,11 @@ ${lanes.join("\n")} } } } - function collectExportedVariableInfo(decl, uniqueExports, exportedNames) { + function collectExportedVariableInfo(decl, uniqueExports, exportedNames, exportedBindings) { if (isBindingPattern(decl.name)) { for (const element of decl.name.elements) { if (!isOmittedExpression(element)) { - exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames); + exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames, exportedBindings); } } } else if (!isGeneratedIdentifier(decl.name)) { @@ -87673,6 +88225,9 @@ ${lanes.join("\n")} if (!uniqueExports.get(text)) { uniqueExports.set(text, true); exportedNames = append(exportedNames, decl.name); + if (isLocalName(decl.name)) { + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), decl.name); + } } } return exportedNames; @@ -87687,46 +88242,46 @@ ${lanes.join("\n")} return values; } function isSimpleCopiableExpression(expression) { - return isStringLiteralLike(expression) || expression.kind === 8 /* NumericLiteral */ || isKeyword(expression.kind) || isIdentifier(expression); + return isStringLiteralLike(expression) || expression.kind === 9 /* NumericLiteral */ || isKeyword(expression.kind) || isIdentifier(expression); } function isSimpleInlineableExpression(expression) { return !isIdentifier(expression) && isSimpleCopiableExpression(expression); } function isCompoundAssignment(kind) { - return kind >= 64 /* FirstCompoundAssignment */ && kind <= 78 /* LastCompoundAssignment */; + return kind >= 65 /* FirstCompoundAssignment */ && kind <= 79 /* LastCompoundAssignment */; } function getNonAssignmentOperatorForCompoundAssignment(kind) { switch (kind) { - case 64 /* PlusEqualsToken */: - return 39 /* PlusToken */; - case 65 /* MinusEqualsToken */: - return 40 /* MinusToken */; - case 66 /* AsteriskEqualsToken */: - return 41 /* AsteriskToken */; - case 67 /* AsteriskAsteriskEqualsToken */: - return 42 /* AsteriskAsteriskToken */; - case 68 /* SlashEqualsToken */: - return 43 /* SlashToken */; - case 69 /* PercentEqualsToken */: - return 44 /* PercentToken */; - case 70 /* LessThanLessThanEqualsToken */: - return 47 /* LessThanLessThanToken */; - case 71 /* GreaterThanGreaterThanEqualsToken */: - return 48 /* GreaterThanGreaterThanToken */; - case 72 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - return 49 /* GreaterThanGreaterThanGreaterThanToken */; - case 73 /* AmpersandEqualsToken */: - return 50 /* AmpersandToken */; - case 74 /* BarEqualsToken */: - return 51 /* BarToken */; - case 78 /* CaretEqualsToken */: - return 52 /* CaretToken */; - case 75 /* BarBarEqualsToken */: - return 56 /* BarBarToken */; - case 76 /* AmpersandAmpersandEqualsToken */: - return 55 /* AmpersandAmpersandToken */; - case 77 /* QuestionQuestionEqualsToken */: - return 60 /* QuestionQuestionToken */; + case 65 /* PlusEqualsToken */: + return 40 /* PlusToken */; + case 66 /* MinusEqualsToken */: + return 41 /* MinusToken */; + case 67 /* AsteriskEqualsToken */: + return 42 /* AsteriskToken */; + case 68 /* AsteriskAsteriskEqualsToken */: + return 43 /* AsteriskAsteriskToken */; + case 69 /* SlashEqualsToken */: + return 44 /* SlashToken */; + case 70 /* PercentEqualsToken */: + return 45 /* PercentToken */; + case 71 /* LessThanLessThanEqualsToken */: + return 48 /* LessThanLessThanToken */; + case 72 /* GreaterThanGreaterThanEqualsToken */: + return 49 /* GreaterThanGreaterThanToken */; + case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + return 50 /* GreaterThanGreaterThanGreaterThanToken */; + case 74 /* AmpersandEqualsToken */: + return 51 /* AmpersandToken */; + case 75 /* BarEqualsToken */: + return 52 /* BarToken */; + case 79 /* CaretEqualsToken */: + return 53 /* CaretToken */; + case 76 /* BarBarEqualsToken */: + return 57 /* BarBarToken */; + case 77 /* AmpersandAmpersandEqualsToken */: + return 56 /* AmpersandAmpersandToken */; + case 78 /* QuestionQuestionEqualsToken */: + return 61 /* QuestionQuestionToken */; } } function getSuperCallFromStatement(statement) { @@ -87761,7 +88316,7 @@ ${lanes.join("\n")} return isPropertyDeclaration(member) && hasStaticModifier(member); } function isInitializedProperty(member) { - return member.kind === 169 /* PropertyDeclaration */ && member.initializer !== void 0; + return member.kind === 171 /* PropertyDeclaration */ && member.initializer !== void 0; } function isNonStaticMethodOrAccessorWithPrivateName(member) { return !isStatic(member) && (isMethodOrAccessor(member) || isAutoAccessorPropertyDeclaration(member)) && isPrivateIdentifier(member.name); @@ -87798,15 +88353,15 @@ ${lanes.join("\n")} } function getAllDecoratorsOfClassElement(member, parent2, useLegacyDecorators) { switch (member.kind) { - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: if (!useLegacyDecorators) { return getAllDecoratorsOfMethod(member); } return getAllDecoratorsOfAccessors(member, parent2); - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return void 0; @@ -87863,16 +88418,15 @@ ${lanes.join("\n")} return { data }; } function getPrivateIdentifier(privateEnv, name) { - var _a2, _b; - return isGeneratedPrivateIdentifier(name) ? (_a2 = privateEnv == null ? void 0 : privateEnv.generatedIdentifiers) == null ? void 0 : _a2.get(getNodeForGeneratedName(name)) : (_b = privateEnv == null ? void 0 : privateEnv.identifiers) == null ? void 0 : _b.get(name.escapedText); + var _a, _b; + return isGeneratedPrivateIdentifier(name) ? (_a = privateEnv == null ? void 0 : privateEnv.generatedIdentifiers) == null ? void 0 : _a.get(getNodeForGeneratedName(name)) : (_b = privateEnv == null ? void 0 : privateEnv.identifiers) == null ? void 0 : _b.get(name.escapedText); } function setPrivateIdentifier(privateEnv, name, entry) { - var _a2, _b; if (isGeneratedPrivateIdentifier(name)) { - (_a2 = privateEnv.generatedIdentifiers) != null ? _a2 : privateEnv.generatedIdentifiers = /* @__PURE__ */ new Map(); + privateEnv.generatedIdentifiers ?? (privateEnv.generatedIdentifiers = /* @__PURE__ */ new Map()); privateEnv.generatedIdentifiers.set(getNodeForGeneratedName(name), entry); } else { - (_b = privateEnv.identifiers) != null ? _b : privateEnv.identifiers = /* @__PURE__ */ new Map(); + privateEnv.identifiers ?? (privateEnv.identifiers = /* @__PURE__ */ new Map()); privateEnv.identifiers.set(name.escapedText, entry); } } @@ -88271,6 +88825,7 @@ ${lanes.join("\n")} ); } function createDestructuringPropertyAccess(flattenContext, value, propertyName) { + const { factory: factory2 } = flattenContext.context; if (isComputedPropertyName(propertyName)) { const argumentExpression = ensureIdentifier( flattenContext, @@ -88282,7 +88837,7 @@ ${lanes.join("\n")} ); return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression); } else if (isStringOrNumericLiteralLike(propertyName)) { - const argumentExpression = factory.cloneNode(propertyName); + const argumentExpression = factory2.cloneNode(propertyName); return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression); } else { const name = flattenContext.context.factory.createIdentifier(idText(propertyName)); @@ -88364,28 +88919,29 @@ ${lanes.join("\n")} if (level === 0 /* LiftRestriction */ && !hasInvalidEscape(template)) { return visitEachChild(node, visitor, context); } + const { factory: factory2 } = context; if (isNoSubstitutionTemplateLiteral(template)) { - cookedStrings.push(createTemplateCooked(template)); - rawStrings.push(getRawLiteral(template, currentSourceFile)); + cookedStrings.push(createTemplateCooked(factory2, template)); + rawStrings.push(getRawLiteral(factory2, template, currentSourceFile)); } else { - cookedStrings.push(createTemplateCooked(template.head)); - rawStrings.push(getRawLiteral(template.head, currentSourceFile)); + cookedStrings.push(createTemplateCooked(factory2, template.head)); + rawStrings.push(getRawLiteral(factory2, template.head, currentSourceFile)); for (const templateSpan of template.templateSpans) { - cookedStrings.push(createTemplateCooked(templateSpan.literal)); - rawStrings.push(getRawLiteral(templateSpan.literal, currentSourceFile)); + cookedStrings.push(createTemplateCooked(factory2, templateSpan.literal)); + rawStrings.push(getRawLiteral(factory2, templateSpan.literal, currentSourceFile)); templateArguments.push(Debug.checkDefined(visitNode(templateSpan.expression, visitor, isExpression))); } } const helperCall = context.getEmitHelperFactory().createTemplateObjectHelper( - factory.createArrayLiteralExpression(cookedStrings), - factory.createArrayLiteralExpression(rawStrings) + factory2.createArrayLiteralExpression(cookedStrings), + factory2.createArrayLiteralExpression(rawStrings) ); if (isExternalModule(currentSourceFile)) { - const tempVar = factory.createUniqueName("templateObject"); + const tempVar = factory2.createUniqueName("templateObject"); recordTaggedTemplateString(tempVar); - templateArguments[0] = factory.createLogicalOr( + templateArguments[0] = factory2.createLogicalOr( tempVar, - factory.createAssignment( + factory2.createAssignment( tempVar, helperCall ) @@ -88393,17 +88949,17 @@ ${lanes.join("\n")} } else { templateArguments[0] = helperCall; } - return factory.createCallExpression( + return factory2.createCallExpression( tag, /*typeArguments*/ void 0, templateArguments ); } - function createTemplateCooked(template) { - return template.templateFlags ? factory.createVoidZero() : factory.createStringLiteral(template.text); + function createTemplateCooked(factory2, template) { + return template.templateFlags & 26656 /* IsInvalid */ ? factory2.createVoidZero() : factory2.createStringLiteral(template.text); } - function getRawLiteral(node, currentSourceFile) { + function getRawLiteral(factory2, node, currentSourceFile) { let text = node.rawText; if (text === void 0) { Debug.assertIsDefined( @@ -88411,11 +88967,11 @@ ${lanes.join("\n")} "Template literal node is missing 'rawText' and does not have a source file. Possibly bad transform." ); text = getSourceTextOfNodeFromSourceFile(currentSourceFile, node); - const isLast = node.kind === 14 /* NoSubstitutionTemplateLiteral */ || node.kind === 17 /* TemplateTail */; + const isLast = node.kind === 15 /* NoSubstitutionTemplateLiteral */ || node.kind === 18 /* TemplateTail */; text = text.substring(1, text.length - (isLast ? 1 : 2)); } text = text.replace(/\r\n?/g, "\n"); - return setTextRange(factory.createStringLiteral(text), node); + return setTextRange(factory2.createStringLiteral(text), node); } var ProcessLevel; var init_taggedTemplate = __esm({ @@ -88450,8 +89006,8 @@ ${lanes.join("\n")} const previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(208 /* PropertyAccessExpression */); - context.enableSubstitution(209 /* ElementAccessExpression */); + context.enableSubstitution(210 /* PropertyAccessExpression */); + context.enableSubstitution(211 /* ElementAccessExpression */); let currentSourceFile; let currentNamespace; let currentNamespaceContainerName; @@ -88462,14 +89018,14 @@ ${lanes.join("\n")} let applicableSubstitutions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 309 /* Bundle */) { + if (node.kind === 312 /* Bundle */) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return factory2.createBundle(node.sourceFiles.map(transformSourceFile), mapDefined(node.prepends, (prepend) => { - if (prepend.kind === 311 /* InputFiles */) { + if (prepend.kind === 314 /* InputFiles */) { return createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -88500,22 +89056,22 @@ ${lanes.join("\n")} } function onBeforeVisitNode(node) { switch (node.kind) { - case 308 /* SourceFile */: - case 266 /* CaseBlock */: - case 265 /* ModuleBlock */: - case 238 /* Block */: + case 311 /* SourceFile */: + case 268 /* CaseBlock */: + case 267 /* ModuleBlock */: + case 240 /* Block */: currentLexicalScope = node; currentScopeFirstDeclarationsOfName = void 0; break; - case 260 /* ClassDeclaration */: - case 259 /* FunctionDeclaration */: + case 262 /* ClassDeclaration */: + case 261 /* FunctionDeclaration */: if (hasSyntacticModifier(node, 2 /* Ambient */)) { break; } if (node.name) { recordEmittedDeclarationInScope(node); } else { - Debug.assert(node.kind === 260 /* ClassDeclaration */ || hasSyntacticModifier(node, 1024 /* Default */)); + Debug.assert(node.kind === 262 /* ClassDeclaration */ || hasSyntacticModifier(node, 1024 /* Default */)); } break; } @@ -88534,10 +89090,10 @@ ${lanes.join("\n")} } function sourceElementVisitorWorker(node) { switch (node.kind) { - case 269 /* ImportDeclaration */: - case 268 /* ImportEqualsDeclaration */: - case 274 /* ExportAssignment */: - case 275 /* ExportDeclaration */: + case 271 /* ImportDeclaration */: + case 270 /* ImportEqualsDeclaration */: + case 276 /* ExportAssignment */: + case 277 /* ExportDeclaration */: return visitElidableStatement(node); default: return visitorWorker(node); @@ -88552,13 +89108,13 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 269 /* ImportDeclaration */: + case 271 /* ImportDeclaration */: return visitImportDeclaration(node); - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: return visitExportAssignment(node); - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: return visitExportDeclaration(node); default: Debug.fail("Unhandled ellided statement"); @@ -88568,7 +89124,7 @@ ${lanes.join("\n")} return saveStateAndInvoke(node, namespaceElementVisitorWorker); } function namespaceElementVisitorWorker(node) { - if (node.kind === 275 /* ExportDeclaration */ || node.kind === 269 /* ImportDeclaration */ || node.kind === 270 /* ImportClause */ || node.kind === 268 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 280 /* ExternalModuleReference */) { + if (node.kind === 277 /* ExportDeclaration */ || node.kind === 271 /* ImportDeclaration */ || node.kind === 272 /* ImportClause */ || node.kind === 270 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 282 /* ExternalModuleReference */) { return void 0; } else if (node.transformFlags & 1 /* ContainsTypeScript */ || hasSyntacticModifier(node, 1 /* Export */)) { return visitTypeScript(node); @@ -88580,21 +89136,21 @@ ${lanes.join("\n")} } function classElementVisitorWorker(node, parent2) { switch (node.kind) { - case 173 /* Constructor */: + case 175 /* Constructor */: return visitConstructor(node); - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return visitPropertyDeclaration(node, parent2); - case 174 /* GetAccessor */: + case 176 /* GetAccessor */: return visitGetAccessor(node, parent2); - case 175 /* SetAccessor */: + case 177 /* SetAccessor */: return visitSetAccessor(node, parent2); - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: return visitMethodDeclaration(node, parent2); - case 172 /* ClassStaticBlockDeclaration */: + case 174 /* ClassStaticBlockDeclaration */: return visitEachChild(node, visitor, context); - case 237 /* SemicolonClassElement */: + case 239 /* SemicolonClassElement */: return node; - case 178 /* IndexSignature */: + case 180 /* IndexSignature */: return; default: return Debug.failBadSyntaxKind(node); @@ -88605,15 +89161,15 @@ ${lanes.join("\n")} } function objectLiteralElementVisitorWorker(node, parent2) { switch (node.kind) { - case 299 /* PropertyAssignment */: - case 300 /* ShorthandPropertyAssignment */: - case 301 /* SpreadAssignment */: + case 302 /* PropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: + case 304 /* SpreadAssignment */: return visitor(node); - case 174 /* GetAccessor */: + case 176 /* GetAccessor */: return visitGetAccessor(node, parent2); - case 175 /* SetAccessor */: + case 177 /* SetAccessor */: return visitSetAccessor(node, parent2); - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: return visitMethodDeclaration(node, parent2); default: return Debug.failBadSyntaxKind(node); @@ -88630,7 +89186,7 @@ ${lanes.join("\n")} return void 0; if (modifierToFlag(node.kind) & 117086 /* TypeScriptModifier */) { return void 0; - } else if (currentNamespace && node.kind === 93 /* ExportKeyword */) { + } else if (currentNamespace && node.kind === 95 /* ExportKeyword */) { return void 0; } return node; @@ -88640,108 +89196,108 @@ ${lanes.join("\n")} return factory2.createNotEmittedStatement(node); } switch (node.kind) { - case 93 /* ExportKeyword */: - case 88 /* DefaultKeyword */: + case 95 /* ExportKeyword */: + case 90 /* DefaultKeyword */: return currentNamespace ? void 0 : node; - case 123 /* PublicKeyword */: - case 121 /* PrivateKeyword */: - case 122 /* ProtectedKeyword */: - case 126 /* AbstractKeyword */: - case 161 /* OverrideKeyword */: - case 85 /* ConstKeyword */: - case 136 /* DeclareKeyword */: - case 146 /* ReadonlyKeyword */: - case 101 /* InKeyword */: - case 145 /* OutKeyword */: - case 185 /* ArrayType */: - case 186 /* TupleType */: - case 187 /* OptionalType */: - case 188 /* RestType */: - case 184 /* TypeLiteral */: - case 179 /* TypePredicate */: - case 165 /* TypeParameter */: - case 131 /* AnyKeyword */: - case 157 /* UnknownKeyword */: - case 134 /* BooleanKeyword */: - case 152 /* StringKeyword */: - case 148 /* NumberKeyword */: - case 144 /* NeverKeyword */: - case 114 /* VoidKeyword */: - case 153 /* SymbolKeyword */: - case 182 /* ConstructorType */: - case 181 /* FunctionType */: - case 183 /* TypeQuery */: - case 180 /* TypeReference */: - case 189 /* UnionType */: - case 190 /* IntersectionType */: - case 191 /* ConditionalType */: - case 193 /* ParenthesizedType */: - case 194 /* ThisType */: - case 195 /* TypeOperator */: - case 196 /* IndexedAccessType */: - case 197 /* MappedType */: - case 198 /* LiteralType */: - case 178 /* IndexSignature */: + case 125 /* PublicKeyword */: + case 123 /* PrivateKeyword */: + case 124 /* ProtectedKeyword */: + case 128 /* AbstractKeyword */: + case 163 /* OverrideKeyword */: + case 87 /* ConstKeyword */: + case 138 /* DeclareKeyword */: + case 148 /* ReadonlyKeyword */: + case 103 /* InKeyword */: + case 147 /* OutKeyword */: + case 187 /* ArrayType */: + case 188 /* TupleType */: + case 189 /* OptionalType */: + case 190 /* RestType */: + case 186 /* TypeLiteral */: + case 181 /* TypePredicate */: + case 167 /* TypeParameter */: + case 133 /* AnyKeyword */: + case 159 /* UnknownKeyword */: + case 136 /* BooleanKeyword */: + case 154 /* StringKeyword */: + case 150 /* NumberKeyword */: + case 146 /* NeverKeyword */: + case 116 /* VoidKeyword */: + case 155 /* SymbolKeyword */: + case 184 /* ConstructorType */: + case 183 /* FunctionType */: + case 185 /* TypeQuery */: + case 182 /* TypeReference */: + case 191 /* UnionType */: + case 192 /* IntersectionType */: + case 193 /* ConditionalType */: + case 195 /* ParenthesizedType */: + case 196 /* ThisType */: + case 197 /* TypeOperator */: + case 198 /* IndexedAccessType */: + case 199 /* MappedType */: + case 200 /* LiteralType */: + case 180 /* IndexSignature */: return void 0; - case 262 /* TypeAliasDeclaration */: + case 264 /* TypeAliasDeclaration */: return factory2.createNotEmittedStatement(node); - case 267 /* NamespaceExportDeclaration */: + case 269 /* NamespaceExportDeclaration */: return void 0; - case 261 /* InterfaceDeclaration */: + case 263 /* InterfaceDeclaration */: return factory2.createNotEmittedStatement(node); - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: return visitClassDeclaration(node); - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: return visitClassExpression(node); - case 294 /* HeritageClause */: + case 297 /* HeritageClause */: return visitHeritageClause(node); - case 230 /* ExpressionWithTypeArguments */: + case 232 /* ExpressionWithTypeArguments */: return visitExpressionWithTypeArguments(node); - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 173 /* Constructor */: - case 169 /* PropertyDeclaration */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 172 /* ClassStaticBlockDeclaration */: + case 175 /* Constructor */: + case 171 /* PropertyDeclaration */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 174 /* ClassStaticBlockDeclaration */: return Debug.fail("Class and object literal elements must be visited with their respective visitors"); - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 215 /* FunctionExpression */: + case 217 /* FunctionExpression */: return visitFunctionExpression(node); - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: return visitArrowFunction(node); - case 166 /* Parameter */: + case 168 /* Parameter */: return visitParameter(node); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return visitParenthesizedExpression(node); - case 213 /* TypeAssertionExpression */: - case 231 /* AsExpression */: + case 215 /* TypeAssertionExpression */: + case 233 /* AsExpression */: return visitAssertionExpression(node); - case 235 /* SatisfiesExpression */: + case 237 /* SatisfiesExpression */: return visitSatisfiesExpression(node); - case 210 /* CallExpression */: + case 212 /* CallExpression */: return visitCallExpression(node); - case 211 /* NewExpression */: + case 213 /* NewExpression */: return visitNewExpression(node); - case 212 /* TaggedTemplateExpression */: + case 214 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 232 /* NonNullExpression */: + case 234 /* NonNullExpression */: return visitNonNullExpression(node); - case 263 /* EnumDeclaration */: + case 265 /* EnumDeclaration */: return visitEnumDeclaration(node); - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: return visitVariableStatement(node); - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: return visitModuleDeclaration(node); - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 282 /* JsxSelfClosingElement */: + case 284 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement(node); - case 283 /* JsxOpeningElement */: + case 285 /* JsxOpeningElement */: return visitJsxJsxOpeningElement(node); default: return visitEachChild(node, visitor, context); @@ -88771,14 +89327,14 @@ ${lanes.join("\n")} let facts = 0 /* None */; if (some(getProperties( node, - /*requireInitialized*/ + /*requireInitializer*/ true, /*isStatic*/ true ))) facts |= 1 /* HasStaticInitializedProperties */; const extendsClauseElement = getEffectiveBaseTypeNode(node); - if (extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* NullKeyword */) + if (extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== 106 /* NullKeyword */) facts |= 64 /* IsDerivedClass */; if (classOrConstructorParameterIsDecorated(legacyDecorators, node)) facts |= 2 /* HasClassOrConstructorParameterDecorators */; @@ -88799,7 +89355,6 @@ ${lanes.join("\n")} return hasDecorators(node) || some(node.typeParameters) || some(node.heritageClauses, hasTypeScriptClassSyntax) || some(node.members, hasTypeScriptClassSyntax); } function visitClassDeclaration(node) { - var _a2; const facts = getClassFacts(node); const promoteToIIFE = languageVersion <= 1 /* ES5 */ && !!(facts & 7 /* MayNeedImmediatelyInvokedFunctionExpression */); if (!isClassLikeDeclarationWithTypeScriptSyntax(node) && !classOrConstructorParameterIsDecorated(legacyDecorators, node) && !isExportOfNamespace(node)) { @@ -88816,13 +89371,13 @@ ${lanes.join("\n")} if (promoteToIIFE) { context.startLexicalEnvironment(); } - const moveModifiers = promoteToIIFE || facts & 8 /* IsExportOfNamespace */ || facts & 2 /* HasClassOrConstructorParameterDecorators */ && legacyDecorators || facts & 1 /* HasStaticInitializedProperties */; + const moveModifiers = promoteToIIFE || facts & 8 /* IsExportOfNamespace */; let modifiers = moveModifiers ? visitNodes2(node.modifiers, modifierElidingVisitor, isModifierLike) : visitNodes2(node.modifiers, visitor, isModifierLike); if (facts & 2 /* HasClassOrConstructorParameterDecorators */) { modifiers = injectClassTypeMetadata(modifiers, node); } const needsName = moveModifiers && !node.name || facts & 4 /* HasMemberDecorators */ || facts & 1 /* HasStaticInitializedProperties */; - const name = needsName ? (_a2 = node.name) != null ? _a2 : factory2.getGeneratedNameForNode(node) : node.name; + const name = needsName ? node.name ?? factory2.getGeneratedNameForNode(node) : node.name; const classDeclaration = factory2.updateClassDeclaration( node, modifiers, @@ -88840,7 +89395,7 @@ ${lanes.join("\n")} let statement; if (promoteToIIFE) { const statements = [classDeclaration]; - const closingBraceLocation = createTokenRange(skipTrivia(currentSourceFile.text, node.members.end), 19 /* CloseBraceToken */); + const closingBraceLocation = createTokenRange(skipTrivia(currentSourceFile.text, node.members.end), 20 /* CloseBraceToken */); const localName = factory2.getInternalName(node); const outer = factory2.createPartiallyEmittedExpression(localName); setTextRangeEnd(outer, closingBraceLocation.end); @@ -88882,13 +89437,13 @@ ${lanes.join("\n")} } if (moveModifiers) { if (facts & 8 /* IsExportOfNamespace */) { - return demarcateMultiStatementExport( + return [ statement, createExportMemberAssignmentStatement(node) - ); + ]; } if (facts & 32 /* IsDefaultExternalExport */) { - return demarcateMultiStatementExport( + return [ statement, factory2.createExportDefault(factory2.getLocalName( node, @@ -88897,10 +89452,10 @@ ${lanes.join("\n")} /*allowSourceMaps*/ true )) - ); + ]; } if (facts & 16 /* IsNamedExternalExport */ && !promoteToIIFE) { - return demarcateMultiStatementExport( + return [ statement, factory2.createExternalModuleExport(factory2.getLocalName( node, @@ -88909,19 +89464,11 @@ ${lanes.join("\n")} /*allowSourceMaps*/ true )) - ); + ]; } } return statement; } - function demarcateMultiStatementExport(declarationStatement, exportStatement) { - addEmitFlags(declarationStatement, 8388608 /* HasEndOfDeclarationMarker */); - return [ - declarationStatement, - exportStatement, - factory2.createEndOfDeclarationMarker(declarationStatement) - ]; - } function visitClassExpression(node) { let modifiers = visitNodes2(node.modifiers, modifierElidingVisitor, isModifierLike); if (classOrConstructorParameterIsDecorated(legacyDecorators, node)) { @@ -89029,7 +89576,7 @@ ${lanes.join("\n")} [], /*type*/ void 0, - factory2.createToken(38 /* EqualsGreaterThanToken */), + factory2.createToken(39 /* EqualsGreaterThanToken */), typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node) )); properties = append(properties, typeProperty); @@ -89043,7 +89590,7 @@ ${lanes.join("\n")} [], /*type*/ void 0, - factory2.createToken(38 /* EqualsGreaterThanToken */), + factory2.createToken(39 /* EqualsGreaterThanToken */), typeSerializer.serializeParameterTypesOfNode({ currentLexicalScope, currentNameScope: container }, node, container) )); properties = append(properties, paramTypeProperty); @@ -89057,7 +89604,7 @@ ${lanes.join("\n")} [], /*type*/ void 0, - factory2.createToken(38 /* EqualsGreaterThanToken */), + factory2.createToken(39 /* EqualsGreaterThanToken */), typeSerializer.serializeReturnTypeOfNode({ currentLexicalScope, currentNameScope: container }, node) )); properties = append(properties, returnTypeProperty); @@ -89074,19 +89621,19 @@ ${lanes.join("\n")} } function shouldAddTypeMetadata(node) { const kind = node.kind; - return kind === 171 /* MethodDeclaration */ || kind === 174 /* GetAccessor */ || kind === 175 /* SetAccessor */ || kind === 169 /* PropertyDeclaration */; + return kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */ || kind === 171 /* PropertyDeclaration */; } function shouldAddReturnTypeMetadata(node) { - return node.kind === 171 /* MethodDeclaration */; + return node.kind === 173 /* MethodDeclaration */; } function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: return getFirstConstructorWithBody(node) !== void 0; - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return true; } return false; @@ -89118,7 +89665,7 @@ ${lanes.join("\n")} return Debug.checkDefined(visitNode(name, visitor, isPropertyName)); } function visitHeritageClause(node) { - if (node.token === 117 /* ImplementsKeyword */) { + if (node.token === 119 /* ImplementsKeyword */) { return void 0; } return visitEachChild(node, visitor, context); @@ -89539,14 +90086,14 @@ ${lanes.join("\n")} } const parameterName = getNamespaceParameterName(node); const containerName = getNamespaceContainerName(node); - const exportName = hasSyntacticModifier(node, 1 /* Export */) ? factory2.getExternalModuleOrNamespaceExportName( + const exportName = isExportOfNamespace(node) ? factory2.getExternalModuleOrNamespaceExportName( currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true - ) : factory2.getLocalName( + ) : factory2.getDeclarationName( node, /*allowComments*/ false, @@ -89560,7 +90107,7 @@ ${lanes.join("\n")} factory2.createObjectLiteralExpression() ) ); - if (hasNamespaceQualifiedExportName(node)) { + if (isExportOfNamespace(node)) { const localName = factory2.getLocalName( node, /*allowComments*/ @@ -89605,7 +90152,6 @@ ${lanes.join("\n")} setTextRange(enumStatement, node); addEmitFlags(enumStatement, emitFlags); statements.push(enumStatement); - statements.push(factory2.createEndOfDeclarationMarker(node)); return statements; } function transformEnumBody(node, localName) { @@ -89641,7 +90187,7 @@ ${lanes.join("\n")} ), valueExpression ); - const outerAssignment = valueExpression.kind === 10 /* StringLiteral */ ? innerAssignment : factory2.createAssignment( + const outerAssignment = valueExpression.kind === 11 /* StringLiteral */ ? innerAssignment : factory2.createAssignment( factory2.createElementAccessExpression( currentNamespaceContainerName, innerAssignment @@ -89678,9 +90224,6 @@ ${lanes.join("\n")} } return isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions)); } - function hasNamespaceQualifiedExportName(node) { - return isExportOfNamespace(node) || isExternalModuleExport(node) && moduleKind !== 5 /* ES2015 */ && moduleKind !== 6 /* ES2020 */ && moduleKind !== 7 /* ES2022 */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 4 /* System */; - } function recordEmittedDeclarationInScope(node) { if (!currentScopeFirstDeclarationsOfName) { currentScopeFirstDeclarationsOfName = /* @__PURE__ */ new Map(); @@ -89702,38 +90245,35 @@ ${lanes.join("\n")} return node.name.escapedText; } function addVarForEnumOrModuleDeclaration(statements, node) { + const varDecl = factory2.createVariableDeclaration(factory2.getLocalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + )); + const varFlags = currentLexicalScope.kind === 311 /* SourceFile */ ? 0 /* None */ : 1 /* Let */; const statement = factory2.createVariableStatement( visitNodes2(node.modifiers, modifierVisitor, isModifier), - factory2.createVariableDeclarationList([ - factory2.createVariableDeclaration( - factory2.getLocalName( - node, - /*allowComments*/ - false, - /*allowSourceMaps*/ - true - ) - ) - ], currentLexicalScope.kind === 308 /* SourceFile */ ? 0 /* None */ : 1 /* Let */) + factory2.createVariableDeclarationList([varDecl], varFlags) ); + setOriginalNode(varDecl, node); + setSyntheticLeadingComments(varDecl, void 0); + setSyntheticTrailingComments(varDecl, void 0); setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { - if (node.kind === 263 /* EnumDeclaration */) { + if (node.kind === 265 /* EnumDeclaration */) { setSourceMapRange(statement.declarationList, node); } else { setSourceMapRange(statement, node); } setCommentRange(statement, node); - addEmitFlags(statement, 2048 /* NoTrailingComments */ | 8388608 /* HasEndOfDeclarationMarker */); + addEmitFlags(statement, 2048 /* NoTrailingComments */); statements.push(statement); return true; - } else { - const mergeMarker = factory2.createMergeDeclarationMarker(statement); - setEmitFlags(mergeMarker, 3072 /* NoComments */ | 8388608 /* HasEndOfDeclarationMarker */); - statements.push(mergeMarker); - return false; } + return false; } function visitModuleDeclaration(node) { if (!shouldEmitModuleDeclaration(node)) { @@ -89751,14 +90291,14 @@ ${lanes.join("\n")} } const parameterName = getNamespaceParameterName(node); const containerName = getNamespaceContainerName(node); - const exportName = hasSyntacticModifier(node, 1 /* Export */) ? factory2.getExternalModuleOrNamespaceExportName( + const exportName = isExportOfNamespace(node) ? factory2.getExternalModuleOrNamespaceExportName( currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true - ) : factory2.getLocalName( + ) : factory2.getDeclarationName( node, /*allowComments*/ false, @@ -89772,7 +90312,7 @@ ${lanes.join("\n")} factory2.createObjectLiteralExpression() ) ); - if (hasNamespaceQualifiedExportName(node)) { + if (isExportOfNamespace(node)) { const localName = factory2.getLocalName( node, /*allowComments*/ @@ -89817,7 +90357,6 @@ ${lanes.join("\n")} setTextRange(moduleStatement, node); addEmitFlags(moduleStatement, emitFlags); statements.push(moduleStatement); - statements.push(factory2.createEndOfDeclarationMarker(node)); return statements; } function transformModuleBody(node, namespaceLocalName) { @@ -89832,7 +90371,7 @@ ${lanes.join("\n")} let statementsLocation; let blockLocation; if (node.body) { - if (node.body.kind === 265 /* ModuleBlock */) { + if (node.body.kind === 267 /* ModuleBlock */) { saveStateAndInvoke(node.body, (body) => addRange(statements, visitNodes2(body.statements, namespaceElementVisitor, isStatement))); statementsLocation = node.body.statements; blockLocation = node.body; @@ -89863,13 +90402,13 @@ ${lanes.join("\n")} true ); setTextRange(block, blockLocation); - if (!node.body || node.body.kind !== 265 /* ModuleBlock */) { + if (!node.body || node.body.kind !== 267 /* ModuleBlock */) { setEmitFlags(block, getEmitFlags(block) | 3072 /* NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 264 /* ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 266 /* ModuleDeclaration */) { const recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -89904,7 +90443,7 @@ ${lanes.join("\n")} ) : void 0; } function visitNamedImportBindings(node) { - if (node.kind === 271 /* NamespaceImport */) { + if (node.kind === 273 /* NamespaceImport */) { return shouldEmitAliasDeclaration(node) ? node : void 0; } else { const allowEmpty = compilerOptions.verbatimModuleSyntax || compilerOptions.preserveValueImports && (compilerOptions.importsNotUsedAsValues === 1 /* Preserve */ || compilerOptions.importsNotUsedAsValues === 2 /* Error */); @@ -90095,22 +90634,22 @@ ${lanes.join("\n")} function enableSubstitutionForNonQualifiedEnumMembers() { if ((enabledSubstitutions & 8 /* NonQualifiedEnumMembers */) === 0) { enabledSubstitutions |= 8 /* NonQualifiedEnumMembers */; - context.enableSubstitution(79 /* Identifier */); + context.enableSubstitution(80 /* Identifier */); } } function enableSubstitutionForNamespaceExports() { if ((enabledSubstitutions & 2 /* NamespaceExports */) === 0) { enabledSubstitutions |= 2 /* NamespaceExports */; - context.enableSubstitution(79 /* Identifier */); - context.enableSubstitution(300 /* ShorthandPropertyAssignment */); - context.enableEmitNotification(264 /* ModuleDeclaration */); + context.enableSubstitution(80 /* Identifier */); + context.enableSubstitution(303 /* ShorthandPropertyAssignment */); + context.enableEmitNotification(266 /* ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return getOriginalNode(node).kind === 264 /* ModuleDeclaration */; + return getOriginalNode(node).kind === 266 /* ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return getOriginalNode(node).kind === 263 /* EnumDeclaration */; + return getOriginalNode(node).kind === 265 /* EnumDeclaration */; } function onEmitNode(hint, node, emitCallback) { const savedApplicableSubstitutions = applicableSubstitutions; @@ -90153,11 +90692,11 @@ ${lanes.join("\n")} } function substituteExpression(node) { switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return substituteExpressionIdentifier(node); - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -90172,8 +90711,8 @@ ${lanes.join("\n")} /*prefixLocals*/ false ); - if (container && container.kind !== 308 /* SourceFile */) { - const substitute = applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 264 /* ModuleDeclaration */ || applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 263 /* EnumDeclaration */; + if (container && container.kind !== 311 /* SourceFile */) { + const substitute = applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 266 /* ModuleDeclaration */ || applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 265 /* EnumDeclaration */; if (substitute) { return setTextRange( factory2.createPropertyAccessExpression(factory2.getGeneratedNameForNode(container), node), @@ -90281,7 +90820,7 @@ ${lanes.join("\n")} } function modifierVisitor(node) { switch (node.kind) { - case 127 /* AccessorKeyword */: + case 129 /* AccessorKeyword */: return shouldTransformAutoAccessorsInCurrentClass() ? void 0 : node; default: return tryCast(node, isModifier); @@ -90292,51 +90831,51 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 127 /* AccessorKeyword */: + case 129 /* AccessorKeyword */: return Debug.fail("Use `modifierVisitor` instead."); - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: return visitClassDeclaration(node); - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: return visitClassExpression( node, /*referencedName*/ void 0 ); - case 172 /* ClassStaticBlockDeclaration */: - case 169 /* PropertyDeclaration */: + case 174 /* ClassStaticBlockDeclaration */: + case 171 /* PropertyDeclaration */: return Debug.fail("Use `classElementVisitor` instead."); - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: return visitPropertyAssignment(node); - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: return visitVariableStatement(node); - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 166 /* Parameter */: + case 168 /* Parameter */: return visitParameterDeclaration(node); - case 205 /* BindingElement */: + case 207 /* BindingElement */: return visitBindingElement(node); - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: return visitExportAssignment(node); - case 80 /* PrivateIdentifier */: + case 81 /* PrivateIdentifier */: return visitPrivateIdentifier(node); - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: return visitPropertyAccessExpression(node); - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: return visitElementAccessExpression(node); - case 221 /* PrefixUnaryExpression */: - case 222 /* PostfixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression( node, /*discarded*/ false ); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return visitBinaryExpression( node, /*discarded*/ false ); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return visitParenthesizedExpression( node, /*discarded*/ @@ -90344,20 +90883,20 @@ ${lanes.join("\n")} /*referencedName*/ void 0 ); - case 210 /* CallExpression */: + case 212 /* CallExpression */: return visitCallExpression(node); - case 241 /* ExpressionStatement */: + case 243 /* ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* TaggedTemplateExpression */: + case 214 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 245 /* ForStatement */: + case 247 /* ForStatement */: return visitForStatement(node); - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 173 /* Constructor */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: { + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 175 /* Constructor */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: { return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( /*current*/ void 0, @@ -90374,21 +90913,21 @@ ${lanes.join("\n")} } function namedEvaluationVisitor(node, referencedName) { switch (node.kind) { - case 356 /* PartiallyEmittedExpression */: + case 359 /* PartiallyEmittedExpression */: return visitPartiallyEmittedExpression( node, /*discarded*/ false, referencedName ); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return visitParenthesizedExpression( node, /*discarded*/ false, referencedName ); - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: return visitClassExpression(node, referencedName); default: return visitor(node); @@ -90396,26 +90935,26 @@ ${lanes.join("\n")} } function discardedValueVisitor(node) { switch (node.kind) { - case 221 /* PrefixUnaryExpression */: - case 222 /* PostfixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression( node, /*discarded*/ true ); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return visitBinaryExpression( node, /*discarded*/ true ); - case 357 /* CommaListExpression */: + case 360 /* CommaListExpression */: return visitCommaListExpression( node, /*discarded*/ true ); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return visitParenthesizedExpression( node, /*discarded*/ @@ -90429,9 +90968,9 @@ ${lanes.join("\n")} } function heritageClauseVisitor(node) { switch (node.kind) { - case 294 /* HeritageClause */: + case 297 /* HeritageClause */: return visitEachChild(node, heritageClauseVisitor, context); - case 230 /* ExpressionWithTypeArguments */: + case 232 /* ExpressionWithTypeArguments */: return visitExpressionWithTypeArgumentsInHeritageClause(node); default: return visitor(node); @@ -90439,8 +90978,8 @@ ${lanes.join("\n")} } function assignmentTargetVisitor(node) { switch (node.kind) { - case 207 /* ObjectLiteralExpression */: - case 206 /* ArrayLiteralExpression */: + case 209 /* ObjectLiteralExpression */: + case 208 /* ArrayLiteralExpression */: return visitAssignmentPattern(node); default: return visitor(node); @@ -90448,29 +90987,29 @@ ${lanes.join("\n")} } function classElementVisitor(node) { switch (node.kind) { - case 173 /* Constructor */: + case 175 /* Constructor */: return visitConstructorDeclaration(node); - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 171 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 173 /* MethodDeclaration */: return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( /*current*/ void 0, visitMethodOrAccessorDeclaration, node ); - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( /*current*/ void 0, visitPropertyDeclaration, node ); - case 172 /* ClassStaticBlockDeclaration */: + case 174 /* ClassStaticBlockDeclaration */: return visitClassStaticBlockDeclaration(node); - case 164 /* ComputedPropertyName */: + case 166 /* ComputedPropertyName */: return visitComputedPropertyName(node); - case 237 /* SemicolonClassElement */: + case 239 /* SemicolonClassElement */: return node; default: return isModifierLike(node) ? modifierVisitor(node) : visitor(node); @@ -90478,7 +91017,7 @@ ${lanes.join("\n")} } function propertyNameVisitor(node) { switch (node.kind) { - case 164 /* ComputedPropertyName */: + case 166 /* ComputedPropertyName */: return visitComputedPropertyName(node); default: return visitor(node); @@ -90486,10 +91025,10 @@ ${lanes.join("\n")} } function accessorFieldResultVisitor(node) { switch (node.kind) { - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return transformFieldInitializer(node); - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return classElementVisitor(node); default: Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); @@ -90649,10 +91188,10 @@ ${lanes.join("\n")} filter(node.modifiers, (m) => isModifier(m) && !isStaticModifier(m) && !isAccessorModifier(m)), node.asteriskToken, functionName, - /* typeParameters */ + /*typeParameters*/ void 0, visitParameterList(node.parameters, visitor, context), - /* type */ + /*type*/ void 0, visitFunctionBody(node.body, visitor, context) ) @@ -90912,7 +91451,7 @@ ${lanes.join("\n")} return visitEachChild(node, visitor, context); } function visitPreOrPostfixUnaryExpression(node, discarded) { - if (node.operator === 45 /* PlusPlusToken */ || node.operator === 46 /* MinusMinusToken */) { + if (node.operator === 46 /* PlusPlusToken */ || node.operator === 47 /* MinusMinusToken */) { const operand = skipParentheses(node.operand); if (isPrivateIdentifierPropertyAccessExpression(operand)) { let info; @@ -90926,7 +91465,7 @@ ${lanes.join("\n")} info, initializeExpression || readExpression, expression, - 63 /* EqualsToken */ + 64 /* EqualsToken */ ); setOriginalNode(expression, node); setTextRange(expression, node); @@ -91001,7 +91540,7 @@ ${lanes.join("\n")} return { readExpression, initializeExpression }; } function visitCallExpression(node) { - var _a2; + var _a; if (isPrivateIdentifierPropertyAccessExpression(node.expression) && accessPrivateIdentifier2(node.expression.name)) { const { thisArg, target } = factory2.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion); if (isCallChain(node)) { @@ -91023,7 +91562,7 @@ ${lanes.join("\n")} [visitNode(thisArg, visitor, isExpression), ...visitNodes2(node.arguments, visitor, isExpression)] ); } - if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && ((_a2 = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a2.classConstructor)) { + if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) { const invocation = factory2.createFunctionCallCall( visitNode(node.expression, visitor, isExpression), lexicalEnvironment.data.classConstructor, @@ -91036,7 +91575,7 @@ ${lanes.join("\n")} return visitEachChild(node, visitor, context); } function visitTaggedTemplateExpression(node) { - var _a2; + var _a; if (isPrivateIdentifierPropertyAccessExpression(node.tag) && accessPrivateIdentifier2(node.tag.name)) { const { thisArg, target } = factory2.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion); return factory2.updateTaggedTemplateExpression( @@ -91052,7 +91591,7 @@ ${lanes.join("\n")} visitNode(node.template, visitor, isTemplateLiteral) ); } - if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.tag) && currentStaticPropertyDeclarationOrStaticBlock && ((_a2 = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a2.classConstructor)) { + if (shouldTransformSuperInStaticInitializers && isSuperProperty(node.tag) && currentStaticPropertyDeclarationOrStaticBlock && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.classConstructor)) { const invocation = factory2.createFunctionBindCall( visitNode(node.tag, visitor, isExpression), lexicalEnvironment.data.classConstructor, @@ -91122,16 +91661,17 @@ ${lanes.join("\n")} if (isAssignmentExpression(node)) { if (isNamedEvaluation(node, isAnonymousClassNeedingAssignedName)) { const assignedName = getAssignedNameOfIdentifier(node.left, node.right); - const left = visitNode(node.left, visitor, isExpression); + const left2 = visitNode(node.left, visitor, isExpression); const right = visitNode(node.right, (node2) => namedEvaluationVisitor(node2, assignedName), isExpression); - return factory2.updateBinaryExpression(node, left, node.operatorToken, right); + return factory2.updateBinaryExpression(node, left2, node.operatorToken, right); } - if (isPrivateIdentifierPropertyAccessExpression(node.left)) { - const info = accessPrivateIdentifier2(node.left.name); + const left = skipOuterExpressions(node.left, 8 /* PartiallyEmittedExpressions */ | 1 /* Parentheses */); + if (isPrivateIdentifierPropertyAccessExpression(left)) { + const info = accessPrivateIdentifier2(left.name); if (info) { return setTextRange( setOriginalNode( - createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), + createPrivateIdentifierAssignment(info, left.expression, node.right, node.operatorToken.kind), node ), node @@ -91257,7 +91797,7 @@ ${lanes.join("\n")} info.brandCheckIdentifier, right, info.kind, - /* f */ + /*f*/ void 0 ); case "f" /* Field */: @@ -91324,12 +91864,12 @@ ${lanes.join("\n")} return facts; } function visitExpressionWithTypeArgumentsInHeritageClause(node) { - var _a2; - const facts = ((_a2 = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a2.facts) || 0 /* None */; + var _a; + const facts = ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.facts) || 0 /* None */; if (facts & 4 /* NeedsClassSuperReference */) { const temp = factory2.createTempVariable( hoistVariableDeclaration, - /*reserveInNestedScopes*/ + /*reservedInNestedScopes*/ true ); getClassLexicalEnvironment().superClassReference = temp; @@ -91391,10 +91931,10 @@ ${lanes.join("\n")} ); } function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { - var _a2, _b; + var _a, _b; let pendingClassReferenceAssignment; if (facts & 2 /* NeedsClassConstructorReference */) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a = node.emitNode) == null ? void 0 : _a.classThis)) { getClassLexicalEnvironment().classConstructor = node.emitNode.classThis; pendingClassReferenceAssignment = factory2.createAssignment(node.emitNode.classThis, factory2.getInternalName(node)); } else { @@ -91410,23 +91950,12 @@ ${lanes.join("\n")} getClassLexicalEnvironment().classThis = node.emitNode.classThis; } } - const modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier); + const isExport = hasSyntacticModifier(node, 1 /* Export */); + const isDefault = hasSyntacticModifier(node, 1024 /* Default */); + let modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier); const heritageClauses = visitNodes2(node.heritageClauses, heritageClauseVisitor, isHeritageClause); const { members, prologue } = transformClassMembers(node); - const classDecl = factory2.updateClassDeclaration( - node, - modifiers, - node.name, - /*typeParameters*/ - void 0, - heritageClauses, - members - ); const statements = []; - if (prologue) { - statements.push(factory2.createExpressionStatement(prologue)); - } - statements.push(classDecl); if (pendingClassReferenceAssignment) { getPendingExpressions().unshift(pendingClassReferenceAssignment); } @@ -91439,20 +91968,49 @@ ${lanes.join("\n")} addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory2.getInternalName(node)); } } + if (statements.length > 0 && isExport && isDefault) { + modifiers = visitNodes2(modifiers, (node2) => isExportOrDefaultModifier(node2) ? void 0 : node2, isModifier); + statements.push(factory2.createExportAssignment( + /*modifiers*/ + void 0, + /*isExportEquals*/ + false, + factory2.getLocalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ) + )); + } + const classDecl = factory2.updateClassDeclaration( + node, + modifiers, + node.name, + /*typeParameters*/ + void 0, + heritageClauses, + members + ); + statements.unshift(classDecl); + if (prologue) { + statements.unshift(factory2.createExpressionStatement(prologue)); + } return statements; } function visitClassExpression(node, referencedName) { return visitInNewClassLexicalEnvironment(node, referencedName, visitClassExpressionInNewClassLexicalEnvironment); } function visitClassExpressionInNewClassLexicalEnvironment(node, facts, referencedName) { - var _a2, _b, _c, _d, _e, _f; + var _a, _b, _c, _d; const isDecoratedClassDeclaration = !!(facts & 1 /* ClassWasDecorated */); const staticPropertiesOrClassStaticBlocks = getStaticPropertiesAndClassStaticBlock(node); const isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 1048576 /* ClassWithConstructorReference */; let temp; function createClassTempVar() { - var _a3; - if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a3 = node.emitNode) == null ? void 0 : _a3.classThis)) { + var _a2; + if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis)) { return getClassLexicalEnvironment().classConstructor = node.emitNode.classThis; } const classCheckFlags = resolver.getNodeCheckFlags(node); @@ -91462,11 +92020,11 @@ ${lanes.join("\n")} getClassLexicalEnvironment().classConstructor = factory2.cloneNode(temp2); return temp2; } - if ((_a2 = node.emitNode) == null ? void 0 : _a2.classThis) { + if ((_a = node.emitNode) == null ? void 0 : _a.classThis) { getClassLexicalEnvironment().classThis = node.emitNode.classThis; } if (facts & 2 /* NeedsClassConstructorReference */) { - temp != null ? temp : temp = createClassTempVar(); + temp ?? (temp = createClassTempVar()); } const modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier); const heritageClauses = visitNodes2(node.heritageClauses, heritageClauseVisitor, isHeritageClause); @@ -91493,7 +92051,7 @@ ${lanes.join("\n")} } if (referencedName) { if (shouldTransformPrivateElementsOrClassStaticBlocks) { - const setNameExpression = emitHelpers().createSetFunctionNameHelper((_c = temp != null ? temp : (_b = node.emitNode) == null ? void 0 : _b.classThis) != null ? _c : factory2.getInternalName(node), referencedName); + const setNameExpression = emitHelpers().createSetFunctionNameHelper(temp ?? ((_b = node.emitNode) == null ? void 0 : _b.classThis) ?? factory2.getInternalName(node), referencedName); pendingStatements.push(factory2.createExpressionStatement(setNameExpression)); } else { const setNameExpression = emitHelpers().createSetFunctionNameHelper(factory2.createThis(), referencedName); @@ -91515,17 +92073,17 @@ ${lanes.join("\n")} } } if (some(staticPropertiesOrClassStaticBlocks)) { - addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, (_e = (_d = node.emitNode) == null ? void 0 : _d.classThis) != null ? _e : factory2.getInternalName(node)); + addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, ((_c = node.emitNode) == null ? void 0 : _c.classThis) ?? factory2.getInternalName(node)); } if (temp) { expressions.push(factory2.createAssignment(temp, classExpression)); - } else if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_f = node.emitNode) == null ? void 0 : _f.classThis)) { + } else if (shouldTransformPrivateElementsOrClassStaticBlocks && ((_d = node.emitNode) == null ? void 0 : _d.classThis)) { expressions.push(factory2.createAssignment(node.emitNode.classThis, classExpression)); } else { expressions.push(classExpression); } } else { - temp != null ? temp : temp = createClassTempVar(); + temp ?? (temp = createClassTempVar()); if (isClassWithConstructorReference) { enableSubstitutionForClassAliases(); const alias = factory2.cloneNode(temp); @@ -91666,7 +92224,7 @@ ${lanes.join("\n")} return constructor; } const extendsClauseElement = getEffectiveBaseTypeNode(container); - const isDerivedClass = !!(extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* NullKeyword */); + const isDerivedClass = !!(extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== 106 /* NullKeyword */); const parameters = visitParameterList(constructor ? constructor.parameters : void 0, visitor, context); const body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { @@ -91688,7 +92246,7 @@ ${lanes.join("\n")} factory2.createConstructorDeclaration( /*modifiers*/ void 0, - parameters != null ? parameters : [], + parameters ?? [], body ), constructor || container @@ -91698,7 +92256,7 @@ ${lanes.join("\n")} ); } function transformConstructorBody(node, constructor, isDerivedClass) { - var _a2, _b; + var _a; const instanceProperties = getProperties( node, /*requireInitializer*/ @@ -91726,7 +92284,7 @@ ${lanes.join("\n")} let prologueStatementCount = 0; let superStatementIndex = -1; let statements = []; - if ((_a2 = constructor == null ? void 0 : constructor.body) == null ? void 0 : _a2.statements) { + if ((_a = constructor == null ? void 0 : constructor.body) == null ? void 0 : _a.statements) { prologueStatementCount = factory2.copyPrologue( constructor.body.statements, statements, @@ -91789,7 +92347,7 @@ ${lanes.join("\n")} if (statements.length === 0 && !constructor) { return void 0; } - const multiLine = (constructor == null ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? (_b = constructor.body.multiLine) != null ? _b : statements.length > 0 : statements.length > 0; + const multiLine = (constructor == null ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? constructor.body.multiLine ?? statements.length > 0 : statements.length > 0; return setTextRange( factory2.createBlock( setTextRange( @@ -91855,10 +92413,10 @@ ${lanes.join("\n")} return expressions; } function transformProperty(property, receiver) { - var _a2; + var _a; const savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; const transformed = transformPropertyWorker(property, receiver); - if (transformed && hasStaticModifier(property) && ((_a2 = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a2.facts)) { + if (transformed && hasStaticModifier(property) && ((_a = lexicalEnvironment == null ? void 0 : lexicalEnvironment.data) == null ? void 0 : _a.facts)) { setOriginalNode(transformed, property); addEmitFlags(transformed, 4 /* AdviseOnEmitNode */); setSourceMapRange(transformed, getSourceMapRange(property.name)); @@ -91890,12 +92448,14 @@ ${lanes.join("\n")} if (privateIdentifierInfo.kind === "f" /* Field */) { if (!privateIdentifierInfo.isStatic) { return createPrivateInstanceFieldInitializer( + factory2, receiver, visitNode(property.initializer, initializerVisitor, isExpression), privateIdentifierInfo.brandCheckIdentifier ); } else { return createPrivateStaticFieldInitializer( + factory2, privateIdentifierInfo.variableName, visitNode(property.initializer, initializerVisitor, isExpression) ); @@ -91929,7 +92489,7 @@ ${lanes.join("\n")} setSourceMapRange(localName, propertyOriginalNode.name); setEmitFlags(localName, 3072 /* NoComments */); } else { - initializer != null ? initializer : initializer = factory2.createVoidZero(); + initializer ?? (initializer = factory2.createVoidZero()); } if (emitAssignment || isPrivateIdentifier(propertyName)) { const memberAccess = createMemberAccessForPropertyName( @@ -91951,22 +92511,22 @@ ${lanes.join("\n")} function enableSubstitutionForClassAliases() { if ((enabledSubstitutions & 1 /* ClassAliases */) === 0) { enabledSubstitutions |= 1 /* ClassAliases */; - context.enableSubstitution(79 /* Identifier */); + context.enableSubstitution(80 /* Identifier */); classAliases = []; } } function enableSubstitutionForClassStaticThisOrSuperReference() { if ((enabledSubstitutions & 2 /* ClassStaticThisOrSuperReference */) === 0) { enabledSubstitutions |= 2 /* ClassStaticThisOrSuperReference */; - context.enableSubstitution(108 /* ThisKeyword */); - context.enableEmitNotification(259 /* FunctionDeclaration */); - context.enableEmitNotification(215 /* FunctionExpression */); - context.enableEmitNotification(173 /* Constructor */); - context.enableEmitNotification(174 /* GetAccessor */); - context.enableEmitNotification(175 /* SetAccessor */); - context.enableEmitNotification(171 /* MethodDeclaration */); - context.enableEmitNotification(169 /* PropertyDeclaration */); - context.enableEmitNotification(164 /* ComputedPropertyName */); + context.enableSubstitution(110 /* ThisKeyword */); + context.enableEmitNotification(261 /* FunctionDeclaration */); + context.enableEmitNotification(217 /* FunctionExpression */); + context.enableEmitNotification(175 /* Constructor */); + context.enableEmitNotification(176 /* GetAccessor */); + context.enableEmitNotification(177 /* SetAccessor */); + context.enableEmitNotification(173 /* MethodDeclaration */); + context.enableEmitNotification(171 /* PropertyDeclaration */); + context.enableEmitNotification(166 /* ComputedPropertyName */); } } function addInstanceMethodStatements(statements, methods, receiver) { @@ -91977,7 +92537,7 @@ ${lanes.join("\n")} Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); statements.push( factory2.createExpressionStatement( - createPrivateInstanceMethodInitializer(receiver, weakSetName) + createPrivateInstanceMethodInitializer(factory2, receiver, weakSetName) ) ); } @@ -92021,26 +92581,24 @@ ${lanes.join("\n")} lexicalEnvironment = lexicalEnvironment == null ? void 0 : lexicalEnvironment.previous; } function getClassLexicalEnvironment() { - var _a2; Debug.assert(lexicalEnvironment); - return (_a2 = lexicalEnvironment.data) != null ? _a2 : lexicalEnvironment.data = { + return lexicalEnvironment.data ?? (lexicalEnvironment.data = { facts: 0 /* None */, classConstructor: void 0, classThis: void 0, superClassReference: void 0 // privateIdentifierEnvironment: undefined, - }; - } - function getPrivateIdentifierEnvironment() { - var _a2; - Debug.assert(lexicalEnvironment); - return (_a2 = lexicalEnvironment.privateEnv) != null ? _a2 : lexicalEnvironment.privateEnv = newPrivateEnvironment({ - className: void 0, - weakSetName: void 0 }); } + function getPrivateIdentifierEnvironment() { + Debug.assert(lexicalEnvironment); + return lexicalEnvironment.privateEnv ?? (lexicalEnvironment.privateEnv = newPrivateEnvironment({ + className: void 0, + weakSetName: void 0 + })); + } function getPendingExpressions() { - return pendingExpressions != null ? pendingExpressions : pendingExpressions = []; + return pendingExpressions ?? (pendingExpressions = []); } function addPrivateIdentifierClassElementToEnvironment(node, name, lex, privateEnv, isStatic2, isValid, previousInfo) { if (isAutoAccessorPropertyDeclaration(node)) { @@ -92056,9 +92614,8 @@ ${lanes.join("\n")} } } function addPrivateIdentifierPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic2, isValid, _previousInfo) { - var _a2; if (isStatic2) { - const brandCheckIdentifier = Debug.checkDefined((_a2 = lex.classThis) != null ? _a2 : lex.classConstructor, "classConstructor should be set in private identifier environment"); + const brandCheckIdentifier = Debug.checkDefined(lex.classThis ?? lex.classConstructor, "classConstructor should be set in private identifier environment"); const variableName = createHoistedVariableForPrivateName(name); setPrivateIdentifier(privateEnv, name, { kind: "f" /* Field */, @@ -92087,9 +92644,8 @@ ${lanes.join("\n")} } } function addPrivateIdentifierMethodDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic2, isValid, _previousInfo) { - var _a2; const methodName = createHoistedVariableForPrivateName(name); - const brandCheckIdentifier = isStatic2 ? Debug.checkDefined((_a2 = lex.classThis) != null ? _a2 : lex.classConstructor, "classConstructor should be set in private identifier environment") : Debug.checkDefined(privateEnv.data.weakSetName, "weakSetName should be set in private identifier environment"); + const brandCheckIdentifier = isStatic2 ? Debug.checkDefined(lex.classThis ?? lex.classConstructor, "classConstructor should be set in private identifier environment") : Debug.checkDefined(privateEnv.data.weakSetName, "weakSetName should be set in private identifier environment"); setPrivateIdentifier(privateEnv, name, { kind: "m" /* Method */, methodName, @@ -92099,9 +92655,8 @@ ${lanes.join("\n")} }); } function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic2, isValid, previousInfo) { - var _a2; const getterName = createHoistedVariableForPrivateName(name, "_get"); - const brandCheckIdentifier = isStatic2 ? Debug.checkDefined((_a2 = lex.classThis) != null ? _a2 : lex.classConstructor, "classConstructor should be set in private identifier environment") : Debug.checkDefined(privateEnv.data.weakSetName, "weakSetName should be set in private identifier environment"); + const brandCheckIdentifier = isStatic2 ? Debug.checkDefined(lex.classThis ?? lex.classConstructor, "classConstructor should be set in private identifier environment") : Debug.checkDefined(privateEnv.data.weakSetName, "weakSetName should be set in private identifier environment"); if ((previousInfo == null ? void 0 : previousInfo.kind) === "a" /* Accessor */ && previousInfo.isStatic === isStatic2 && !previousInfo.getterName) { previousInfo.getterName = getterName; } else { @@ -92116,9 +92671,8 @@ ${lanes.join("\n")} } } function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic2, isValid, previousInfo) { - var _a2; const setterName = createHoistedVariableForPrivateName(name, "_set"); - const brandCheckIdentifier = isStatic2 ? Debug.checkDefined((_a2 = lex.classThis) != null ? _a2 : lex.classConstructor, "classConstructor should be set in private identifier environment") : Debug.checkDefined(privateEnv.data.weakSetName, "weakSetName should be set in private identifier environment"); + const brandCheckIdentifier = isStatic2 ? Debug.checkDefined(lex.classThis ?? lex.classConstructor, "classConstructor should be set in private identifier environment") : Debug.checkDefined(privateEnv.data.weakSetName, "weakSetName should be set in private identifier environment"); if ((previousInfo == null ? void 0 : previousInfo.kind) === "a" /* Accessor */ && previousInfo.isStatic === isStatic2 && !previousInfo.setterName) { previousInfo.setterName = setterName; } else { @@ -92133,10 +92687,9 @@ ${lanes.join("\n")} } } function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic2, isValid, _previousInfo) { - var _a2; const getterName = createHoistedVariableForPrivateName(name, "_get"); const setterName = createHoistedVariableForPrivateName(name, "_set"); - const brandCheckIdentifier = isStatic2 ? Debug.checkDefined((_a2 = lex.classThis) != null ? _a2 : lex.classConstructor, "classConstructor should be set in private identifier environment") : Debug.checkDefined(privateEnv.data.weakSetName, "weakSetName should be set in private identifier environment"); + const brandCheckIdentifier = isStatic2 ? Debug.checkDefined(lex.classThis ?? lex.classConstructor, "classConstructor should be set in private identifier environment") : Debug.checkDefined(privateEnv.data.weakSetName, "weakSetName should be set in private identifier environment"); setPrivateIdentifier(privateEnv, name, { kind: "a" /* Accessor */, getterName, @@ -92160,7 +92713,7 @@ ${lanes.join("\n")} const identifier = typeof name === "object" ? factory2.getGeneratedNameForNode(name, 16 /* Optimistic */ | 8 /* ReservedInNestedScopes */, prefix, suffix) : typeof name === "string" ? factory2.createUniqueName(name, 16 /* Optimistic */, prefix, suffix) : factory2.createTempVariable( /*recordTempVariable*/ void 0, - /*reserveInNestedScopes*/ + /*reservedInNestedScopes*/ true, prefix, suffix @@ -92173,9 +92726,8 @@ ${lanes.join("\n")} return identifier; } function createHoistedVariableForPrivateName(name, suffix) { - var _a2; const text = tryGetTextOfPropertyName(name); - return createHoistedVariableForClass((_a2 = text == null ? void 0 : text.substring(1)) != null ? _a2 : name, name, suffix); + return createHoistedVariableForClass((text == null ? void 0 : text.substring(1)) ?? name, name, suffix); } function accessPrivateIdentifier2(name) { const info = accessPrivateIdentifier(lexicalEnvironment, name); @@ -92194,7 +92746,7 @@ ${lanes.join("\n")} /*reservedInNestedScopes*/ true ); - getPendingExpressions().push(factory2.createBinaryExpression(receiver, 63 /* EqualsToken */, visitNode(node.expression, visitor, isExpression))); + getPendingExpressions().push(factory2.createBinaryExpression(receiver, 64 /* EqualsToken */, visitNode(node.expression, visitor, isExpression))); } return factory2.createAssignmentTargetWrapper( parameter, @@ -92202,7 +92754,7 @@ ${lanes.join("\n")} info, receiver, parameter, - 63 /* EqualsToken */ + 64 /* EqualsToken */ ) ); } @@ -92341,16 +92893,16 @@ ${lanes.join("\n")} return; } switch (node.kind) { - case 215 /* FunctionExpression */: + case 217 /* FunctionExpression */: if (isArrowFunction(original) || getEmitFlags(node) & 524288 /* AsyncFunctionBody */) { break; } - case 259 /* FunctionDeclaration */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 171 /* MethodDeclaration */: - case 169 /* PropertyDeclaration */: { + case 261 /* FunctionDeclaration */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 173 /* MethodDeclaration */: + case 171 /* PropertyDeclaration */: { const savedLexicalEnvironment = lexicalEnvironment; const savedPreviousShouldSubstituteThisWithClassThis = previousShouldSubstituteThisWithClassThis; lexicalEnvironment = void 0; @@ -92362,7 +92914,7 @@ ${lanes.join("\n")} lexicalEnvironment = savedLexicalEnvironment; return; } - case 164 /* ComputedPropertyName */: { + case 166 /* ComputedPropertyName */: { const savedLexicalEnvironment = lexicalEnvironment; const savedShouldSubstituteThisWithClassThis = shouldSubstituteThisWithClassThis; lexicalEnvironment = lexicalEnvironment == null ? void 0 : lexicalEnvironment.previous; @@ -92384,9 +92936,9 @@ ${lanes.join("\n")} } function substituteExpression(node) { switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return substituteExpressionIdentifier(node); - case 108 /* ThisKeyword */: + case 110 /* ThisKeyword */: return substituteThisExpression(node); } return node; @@ -92397,7 +92949,7 @@ ${lanes.join("\n")} if (facts & 1 /* ClassWasDecorated */ && legacyDecorators) { return factory2.createParenthesizedExpression(factory2.createVoidZero()); } - const substituteThis = shouldSubstituteThisWithClassThis ? classThis != null ? classThis : classConstructor : classConstructor; + const substituteThis = shouldSubstituteThisWithClassThis ? classThis ?? classConstructor : classConstructor; if (substituteThis) { return setTextRange( setOriginalNode( @@ -92431,25 +92983,25 @@ ${lanes.join("\n")} return void 0; } } - function createPrivateStaticFieldInitializer(variableName, initializer) { - return factory.createAssignment( + function createPrivateStaticFieldInitializer(factory2, variableName, initializer) { + return factory2.createAssignment( variableName, - factory.createObjectLiteralExpression([ - factory.createPropertyAssignment("value", initializer || factory.createVoidZero()) + factory2.createObjectLiteralExpression([ + factory2.createPropertyAssignment("value", initializer || factory2.createVoidZero()) ]) ); } - function createPrivateInstanceFieldInitializer(receiver, initializer, weakMapName) { - return factory.createCallExpression( - factory.createPropertyAccessExpression(weakMapName, "set"), + function createPrivateInstanceFieldInitializer(factory2, receiver, initializer, weakMapName) { + return factory2.createCallExpression( + factory2.createPropertyAccessExpression(weakMapName, "set"), /*typeArguments*/ void 0, - [receiver, initializer || factory.createVoidZero()] + [receiver, initializer || factory2.createVoidZero()] ); } - function createPrivateInstanceMethodInitializer(receiver, weakSetName) { - return factory.createCallExpression( - factory.createPropertyAccessExpression(weakSetName, "add"), + function createPrivateInstanceMethodInitializer(factory2, receiver, weakSetName) { + return factory2.createCallExpression( + factory2.createPropertyAccessExpression(weakSetName, "add"), /*typeArguments*/ void 0, [receiver] @@ -92459,7 +93011,7 @@ ${lanes.join("\n")} return !isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; } function isPrivateIdentifierInExpression(node) { - return isPrivateIdentifier(node.left) && node.operatorToken.kind === 101 /* InKeyword */; + return isPrivateIdentifier(node.left) && node.operatorToken.kind === 103 /* InKeyword */; } var init_classFields = __esm({ "src/compiler/transformers/classFields.ts"() { @@ -92471,6 +93023,7 @@ ${lanes.join("\n")} // src/compiler/transformers/typeSerializer.ts function createRuntimeTypeSerializer(context) { const { + factory: factory2, hoistVariableDeclaration } = context; const resolver = context.getEmitResolver(); @@ -92501,18 +93054,18 @@ ${lanes.join("\n")} } function serializeTypeOfNode(node) { switch (node.kind) { - case 169 /* PropertyDeclaration */: - case 166 /* Parameter */: + case 171 /* PropertyDeclaration */: + case 168 /* Parameter */: return serializeTypeNode(node.type); - case 175 /* SetAccessor */: - case 174 /* GetAccessor */: + case 177 /* SetAccessor */: + case 176 /* GetAccessor */: return serializeTypeNode(getAccessorTypeNode(node)); - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 171 /* MethodDeclaration */: - return factory.createIdentifier("Function"); + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 173 /* MethodDeclaration */: + return factory2.createIdentifier("Function"); default: - return factory.createVoidZero(); + return factory2.createVoidZero(); } } function serializeParameterTypesOfNode(node, container) { @@ -92533,10 +93086,10 @@ ${lanes.join("\n")} } } } - return factory.createArrayLiteralExpression(expressions); + return factory2.createArrayLiteralExpression(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 174 /* GetAccessor */) { + if (container && node.kind === 176 /* GetAccessor */) { const { setAccessor } = getAllAccessorDeclarations(container.members, node); if (setAccessor) { return setAccessor.parameters; @@ -92548,116 +93101,116 @@ ${lanes.join("\n")} if (isFunctionLike(node) && node.type) { return serializeTypeNode(node.type); } else if (isAsyncFunction(node)) { - return factory.createIdentifier("Promise"); + return factory2.createIdentifier("Promise"); } - return factory.createVoidZero(); + return factory2.createVoidZero(); } function serializeTypeNode(node) { if (node === void 0) { - return factory.createIdentifier("Object"); + return factory2.createIdentifier("Object"); } node = skipTypeParentheses(node); switch (node.kind) { - case 114 /* VoidKeyword */: - case 155 /* UndefinedKeyword */: - case 144 /* NeverKeyword */: - return factory.createVoidZero(); - case 181 /* FunctionType */: - case 182 /* ConstructorType */: - return factory.createIdentifier("Function"); - case 185 /* ArrayType */: - case 186 /* TupleType */: - return factory.createIdentifier("Array"); - case 179 /* TypePredicate */: - return node.assertsModifier ? factory.createVoidZero() : factory.createIdentifier("Boolean"); - case 134 /* BooleanKeyword */: - return factory.createIdentifier("Boolean"); - case 200 /* TemplateLiteralType */: - case 152 /* StringKeyword */: - return factory.createIdentifier("String"); - case 149 /* ObjectKeyword */: - return factory.createIdentifier("Object"); - case 198 /* LiteralType */: + case 116 /* VoidKeyword */: + case 157 /* UndefinedKeyword */: + case 146 /* NeverKeyword */: + return factory2.createVoidZero(); + case 183 /* FunctionType */: + case 184 /* ConstructorType */: + return factory2.createIdentifier("Function"); + case 187 /* ArrayType */: + case 188 /* TupleType */: + return factory2.createIdentifier("Array"); + case 181 /* TypePredicate */: + return node.assertsModifier ? factory2.createVoidZero() : factory2.createIdentifier("Boolean"); + case 136 /* BooleanKeyword */: + return factory2.createIdentifier("Boolean"); + case 202 /* TemplateLiteralType */: + case 154 /* StringKeyword */: + return factory2.createIdentifier("String"); + case 151 /* ObjectKeyword */: + return factory2.createIdentifier("Object"); + case 200 /* LiteralType */: return serializeLiteralOfLiteralTypeNode(node.literal); - case 148 /* NumberKeyword */: - return factory.createIdentifier("Number"); - case 160 /* BigIntKeyword */: + case 150 /* NumberKeyword */: + return factory2.createIdentifier("Number"); + case 162 /* BigIntKeyword */: return getGlobalConstructor("BigInt", 7 /* ES2020 */); - case 153 /* SymbolKeyword */: + case 155 /* SymbolKeyword */: return getGlobalConstructor("Symbol", 2 /* ES2015 */); - case 180 /* TypeReference */: + case 182 /* TypeReference */: return serializeTypeReferenceNode(node); - case 190 /* IntersectionType */: + case 192 /* IntersectionType */: return serializeUnionOrIntersectionConstituents( node.types, /*isIntersection*/ true ); - case 189 /* UnionType */: + case 191 /* UnionType */: return serializeUnionOrIntersectionConstituents( node.types, /*isIntersection*/ false ); - case 191 /* ConditionalType */: + case 193 /* ConditionalType */: return serializeUnionOrIntersectionConstituents( [node.trueType, node.falseType], /*isIntersection*/ false ); - case 195 /* TypeOperator */: - if (node.operator === 146 /* ReadonlyKeyword */) { + case 197 /* TypeOperator */: + if (node.operator === 148 /* ReadonlyKeyword */) { return serializeTypeNode(node.type); } break; - case 183 /* TypeQuery */: - case 196 /* IndexedAccessType */: - case 197 /* MappedType */: - case 184 /* TypeLiteral */: - case 131 /* AnyKeyword */: - case 157 /* UnknownKeyword */: - case 194 /* ThisType */: - case 202 /* ImportType */: + case 185 /* TypeQuery */: + case 198 /* IndexedAccessType */: + case 199 /* MappedType */: + case 186 /* TypeLiteral */: + case 133 /* AnyKeyword */: + case 159 /* UnknownKeyword */: + case 196 /* ThisType */: + case 204 /* ImportType */: break; - case 315 /* JSDocAllType */: - case 316 /* JSDocUnknownType */: - case 320 /* JSDocFunctionType */: - case 321 /* JSDocVariadicType */: - case 322 /* JSDocNamepathType */: + case 318 /* JSDocAllType */: + case 319 /* JSDocUnknownType */: + case 323 /* JSDocFunctionType */: + case 324 /* JSDocVariadicType */: + case 325 /* JSDocNamepathType */: break; - case 317 /* JSDocNullableType */: - case 318 /* JSDocNonNullableType */: - case 319 /* JSDocOptionalType */: + case 320 /* JSDocNullableType */: + case 321 /* JSDocNonNullableType */: + case 322 /* JSDocOptionalType */: return serializeTypeNode(node.type); default: return Debug.failBadSyntaxKind(node); } - return factory.createIdentifier("Object"); + return factory2.createIdentifier("Object"); } function serializeLiteralOfLiteralTypeNode(node) { switch (node.kind) { - case 10 /* StringLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: - return factory.createIdentifier("String"); - case 221 /* PrefixUnaryExpression */: { + case 11 /* StringLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + return factory2.createIdentifier("String"); + case 223 /* PrefixUnaryExpression */: { const operand = node.operand; switch (operand.kind) { - case 8 /* NumericLiteral */: - case 9 /* BigIntLiteral */: + case 9 /* NumericLiteral */: + case 10 /* BigIntLiteral */: return serializeLiteralOfLiteralTypeNode(operand); default: return Debug.failBadSyntaxKind(operand); } } - case 8 /* NumericLiteral */: - return factory.createIdentifier("Number"); - case 9 /* BigIntLiteral */: + case 9 /* NumericLiteral */: + return factory2.createIdentifier("Number"); + case 10 /* BigIntLiteral */: return getGlobalConstructor("BigInt", 7 /* ES2020 */); - case 110 /* TrueKeyword */: - case 95 /* FalseKeyword */: - return factory.createIdentifier("Boolean"); - case 104 /* NullKeyword */: - return factory.createVoidZero(); + case 112 /* TrueKeyword */: + case 97 /* FalseKeyword */: + return factory2.createIdentifier("Boolean"); + case 106 /* NullKeyword */: + return factory2.createVoidZero(); default: return Debug.failBadSyntaxKind(node); } @@ -92666,20 +93219,20 @@ ${lanes.join("\n")} let serializedType; for (let typeNode of types) { typeNode = skipTypeParentheses(typeNode); - if (typeNode.kind === 144 /* NeverKeyword */) { + if (typeNode.kind === 146 /* NeverKeyword */) { if (isIntersection) - return factory.createVoidZero(); + return factory2.createVoidZero(); continue; } - if (typeNode.kind === 157 /* UnknownKeyword */) { + if (typeNode.kind === 159 /* UnknownKeyword */) { if (!isIntersection) - return factory.createIdentifier("Object"); + return factory2.createIdentifier("Object"); continue; } - if (typeNode.kind === 131 /* AnyKeyword */) { - return factory.createIdentifier("Object"); + if (typeNode.kind === 133 /* AnyKeyword */) { + return factory2.createIdentifier("Object"); } - if (!strictNullChecks && (isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* NullKeyword */ || typeNode.kind === 155 /* UndefinedKeyword */)) { + if (!strictNullChecks && (isLiteralTypeNode(typeNode) && typeNode.literal.kind === 106 /* NullKeyword */ || typeNode.kind === 157 /* UndefinedKeyword */)) { continue; } const serializedConstituent = serializeTypeNode(typeNode); @@ -92688,13 +93241,13 @@ ${lanes.join("\n")} } if (serializedType) { if (!equateSerializedTypeNodes(serializedType, serializedConstituent)) { - return factory.createIdentifier("Object"); + return factory2.createIdentifier("Object"); } } else { serializedType = serializedConstituent; } } - return serializedType != null ? serializedType : factory.createVoidZero(); + return serializedType ?? factory2.createVoidZero(); } function equateSerializedTypeNodes(left, right) { return ( @@ -92724,100 +93277,100 @@ ${lanes.join("\n")} ); } function serializeTypeReferenceNode(node) { - const kind = resolver.getTypeReferenceSerializationKind(node.typeName, currentNameScope != null ? currentNameScope : currentLexicalScope); + const kind = resolver.getTypeReferenceSerializationKind(node.typeName, currentNameScope ?? currentLexicalScope); switch (kind) { case 0 /* Unknown */: if (findAncestor(node, (n) => n.parent && isConditionalTypeNode(n.parent) && (n.parent.trueType === n || n.parent.falseType === n))) { - return factory.createIdentifier("Object"); + return factory2.createIdentifier("Object"); } const serialized = serializeEntityNameAsExpressionFallback(node.typeName); - const temp = factory.createTempVariable(hoistVariableDeclaration); - return factory.createConditionalExpression( - factory.createTypeCheck(factory.createAssignment(temp, serialized), "function"), + const temp = factory2.createTempVariable(hoistVariableDeclaration); + return factory2.createConditionalExpression( + factory2.createTypeCheck(factory2.createAssignment(temp, serialized), "function"), /*questionToken*/ void 0, temp, /*colonToken*/ void 0, - factory.createIdentifier("Object") + factory2.createIdentifier("Object") ); case 1 /* TypeWithConstructSignatureAndValue */: return serializeEntityNameAsExpression(node.typeName); case 2 /* VoidNullableOrNeverType */: - return factory.createVoidZero(); + return factory2.createVoidZero(); case 4 /* BigIntLikeType */: return getGlobalConstructor("BigInt", 7 /* ES2020 */); case 6 /* BooleanType */: - return factory.createIdentifier("Boolean"); + return factory2.createIdentifier("Boolean"); case 3 /* NumberLikeType */: - return factory.createIdentifier("Number"); + return factory2.createIdentifier("Number"); case 5 /* StringLikeType */: - return factory.createIdentifier("String"); + return factory2.createIdentifier("String"); case 7 /* ArrayLikeType */: - return factory.createIdentifier("Array"); + return factory2.createIdentifier("Array"); case 8 /* ESSymbolType */: return getGlobalConstructor("Symbol", 2 /* ES2015 */); case 10 /* TypeWithCallSignature */: - return factory.createIdentifier("Function"); + return factory2.createIdentifier("Function"); case 9 /* Promise */: - return factory.createIdentifier("Promise"); + return factory2.createIdentifier("Promise"); case 11 /* ObjectType */: - return factory.createIdentifier("Object"); + return factory2.createIdentifier("Object"); default: return Debug.assertNever(kind); } } function createCheckedValue(left, right) { - return factory.createLogicalAnd( - factory.createStrictInequality(factory.createTypeOfExpression(left), factory.createStringLiteral("undefined")), + return factory2.createLogicalAnd( + factory2.createStrictInequality(factory2.createTypeOfExpression(left), factory2.createStringLiteral("undefined")), right ); } function serializeEntityNameAsExpressionFallback(node) { - if (node.kind === 79 /* Identifier */) { + if (node.kind === 80 /* Identifier */) { const copied = serializeEntityNameAsExpression(node); return createCheckedValue(copied, copied); } - if (node.left.kind === 79 /* Identifier */) { + if (node.left.kind === 80 /* Identifier */) { return createCheckedValue(serializeEntityNameAsExpression(node.left), serializeEntityNameAsExpression(node)); } const left = serializeEntityNameAsExpressionFallback(node.left); - const temp = factory.createTempVariable(hoistVariableDeclaration); - return factory.createLogicalAnd( - factory.createLogicalAnd( + const temp = factory2.createTempVariable(hoistVariableDeclaration); + return factory2.createLogicalAnd( + factory2.createLogicalAnd( left.left, - factory.createStrictInequality(factory.createAssignment(temp, left.right), factory.createVoidZero()) + factory2.createStrictInequality(factory2.createAssignment(temp, left.right), factory2.createVoidZero()) ), - factory.createPropertyAccessExpression(temp, node.right) + factory2.createPropertyAccessExpression(temp, node.right) ); } function serializeEntityNameAsExpression(node) { switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: const name = setParent(setTextRange(parseNodeFactory.cloneNode(node), node), node.parent); name.original = void 0; setParent(name, getParseTreeNode(currentLexicalScope)); return name; - case 163 /* QualifiedName */: + case 165 /* QualifiedName */: return serializeQualifiedNameAsExpression(node); } } function serializeQualifiedNameAsExpression(node) { - return factory.createPropertyAccessExpression(serializeEntityNameAsExpression(node.left), node.right); + return factory2.createPropertyAccessExpression(serializeEntityNameAsExpression(node.left), node.right); } function getGlobalConstructorWithFallback(name) { - return factory.createConditionalExpression( - factory.createTypeCheck(factory.createIdentifier(name), "function"), + return factory2.createConditionalExpression( + factory2.createTypeCheck(factory2.createIdentifier(name), "function"), /*questionToken*/ void 0, - factory.createIdentifier(name), + factory2.createIdentifier(name), /*colonToken*/ void 0, - factory.createIdentifier("Object") + factory2.createIdentifier("Object") ); } function getGlobalConstructor(name, minLanguageVersion) { - return languageVersion < minLanguageVersion ? getGlobalConstructorWithFallback(name) : factory.createIdentifier(name); + return languageVersion < minLanguageVersion ? getGlobalConstructorWithFallback(name) : factory2.createIdentifier(name); } } var init_typeSerializer = __esm({ @@ -92854,23 +93407,23 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 167 /* Decorator */: + case 169 /* Decorator */: return void 0; - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: return visitClassDeclaration(node); - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: return visitClassExpression(node); - case 173 /* Constructor */: + case 175 /* Constructor */: return visitConstructorDeclaration(node); - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 175 /* SetAccessor */: + case 177 /* SetAccessor */: return visitSetAccessorDeclaration(node); - case 174 /* GetAccessor */: + case 176 /* GetAccessor */: return visitGetAccessorDeclaration(node); - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return visitPropertyDeclaration(node); - case 166 /* Parameter */: + case 168 /* Parameter */: return visitParameterDeclaration(node); default: return visitEachChild(node, visitor, context); @@ -92878,11 +93431,11 @@ ${lanes.join("\n")} } function visitClassDeclaration(node) { if (!(classOrConstructorParameterIsDecorated( - /*legacyDecorators*/ + /*useLegacyDecorators*/ true, node ) || childIsDecorated( - /*legacyDecorators*/ + /*useLegacyDecorators*/ true, node ))) { @@ -92893,10 +93446,6 @@ ${lanes.join("\n")} true, node ) ? transformClassDeclarationWithClassDecorators(node, node.name) : transformClassDeclarationWithoutClassDecorators(node, node.name); - if (statements.length > 1) { - statements.push(factory2.createEndOfDeclarationMarker(node)); - setEmitFlags(statements[0], getEmitFlags(statements[0]) | 8388608 /* HasEndOfDeclarationMarker */); - } return singleOrMany(statements); } function decoratorContainsPrivateIdentifierInExpression(decorator) { @@ -92969,9 +93518,12 @@ ${lanes.join("\n")} return addRange([updated], decorationStatements); } function transformClassDeclarationWithClassDecorators(node, name) { + const isExport = hasSyntacticModifier(node, 1 /* Export */); + const isDefault = hasSyntacticModifier(node, 1024 /* Default */); + const modifiers = visitNodes2(node.modifiers, (node2) => isExportOrDefaultModifier(node2) || isDecorator(node2) ? void 0 : node2, isModifierLike); const location = moveRangePastModifiers(node); const classAlias = getClassAliasIfNeeded(node); - const declName = languageVersion <= 2 /* ES2015 */ ? factory2.getInternalName( + const declName = languageVersion < 2 /* ES2015 */ ? factory2.getInternalName( node, /*allowComments*/ false, @@ -92988,9 +93540,21 @@ ${lanes.join("\n")} let members = visitNodes2(node.members, visitor, isClassElement); let decorationStatements = []; ({ members, decorationStatements } = transformDecoratorsOfClassElements(node, members)); + const assignClassAliasInStaticBlock = languageVersion >= 9 /* ES2022 */ && !!classAlias && some(members, (member) => isPropertyDeclaration(member) && hasSyntacticModifier(member, 32 /* Static */) || isClassStaticBlockDeclaration(member)); + if (assignClassAliasInStaticBlock) { + members = setTextRange(factory2.createNodeArray([ + factory2.createClassStaticBlockDeclaration( + factory2.createBlock([ + factory2.createExpressionStatement( + factory2.createAssignment(classAlias, factory2.createThis()) + ) + ]) + ), + ...members + ]), members); + } const classExpression = factory2.createClassExpression( - /*modifiers*/ - void 0, + modifiers, name && isGeneratedIdentifier(name) ? void 0 : name, /*typeParameters*/ void 0, @@ -92999,18 +93563,23 @@ ${lanes.join("\n")} ); setOriginalNode(classExpression, node); setTextRange(classExpression, location); - const statement = factory2.createVariableStatement( - /*modifiers*/ + const varDecl = factory2.createVariableDeclaration( + declName, + /*exclamationToken*/ void 0, + /*type*/ + void 0, + classAlias && !assignClassAliasInStaticBlock ? factory2.createAssignment(classAlias, classExpression) : classExpression + ); + setOriginalNode(varDecl, node); + let varModifiers; + if (isExport && !isDefault) { + varModifiers = factory2.createModifiersFromModifierFlags(1 /* Export */); + } + const statement = factory2.createVariableStatement( + varModifiers, factory2.createVariableDeclarationList([ - factory2.createVariableDeclaration( - declName, - /*exclamationToken*/ - void 0, - /*type*/ - void 0, - classAlias ? factory2.createAssignment(classAlias, classExpression) : classExpression - ) + varDecl ], 1 /* Let */) ); setOriginalNode(statement, node); @@ -93019,6 +93588,15 @@ ${lanes.join("\n")} const statements = [statement]; addRange(statements, decorationStatements); addConstructorDecorationStatement(statements, node); + if (isExport && isDefault) { + statements.push(factory2.createExportAssignment( + /*modifiers*/ + void 0, + /*isExportEquals*/ + false, + declName + )); + } return statements; } function visitClassExpression(node) { @@ -93137,7 +93715,7 @@ ${lanes.join("\n")} } function isDecoratedClassElement(member, isStaticElement, parent2) { return nodeOrChildIsDecorated( - /*legacyDecorators*/ + /*useLegacyDecorators*/ true, member, parent2 @@ -93195,13 +93773,13 @@ ${lanes.join("\n")} return void 0; } const classAlias = classAliases && classAliases[getOriginalNodeId(node)]; - const localName = languageVersion <= 2 /* ES2015 */ ? factory2.getInternalName( + const localName = languageVersion < 2 /* ES2015 */ ? factory2.getInternalName( node, /*allowComments*/ false, /*allowSourceMaps*/ true - ) : factory2.getLocalName( + ) : factory2.getDeclarationName( node, /*allowComments*/ false, @@ -93247,7 +93825,7 @@ ${lanes.join("\n")} } function enableSubstitutionForClassAliases() { if (!classAliases) { - context.enableSubstitution(79 /* Identifier */); + context.enableSubstitution(80 /* Identifier */); classAliases = []; } } @@ -93275,14 +93853,13 @@ ${lanes.join("\n")} } function substituteExpression(node) { switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return substituteExpressionIdentifier(node); } return node; } function substituteExpressionIdentifier(node) { - var _a2; - return (_a2 = trySubstituteClassAlias(node)) != null ? _a2 : node; + return trySubstituteClassAlias(node) ?? node; } function trySubstituteClassAlias(node) { if (classAliases) { @@ -93318,6 +93895,8 @@ ${lanes.join("\n")} endLexicalEnvironment, hoistVariableDeclaration } = context; + const compilerOptions = context.getCompilerOptions(); + const languageVersion = getEmitScriptTarget(compilerOptions); let top; let classInfo; let classThis; @@ -93371,21 +93950,21 @@ ${lanes.join("\n")} updateState(); } function enterClassElement(node) { - var _a2, _b; + var _a, _b; Debug.assert((top == null ? void 0 : top.kind) === "class", "Incorrect value for top.kind.", () => `Expected top.kind to be 'class' but got '${top == null ? void 0 : top.kind}' instead.`); top = { kind: "class-element", next: top }; if (isClassStaticBlockDeclaration(node) || isPropertyDeclaration(node) && hasStaticModifier(node)) { - top.classThis = (_a2 = top.next.classInfo) == null ? void 0 : _a2.classThis; + top.classThis = (_a = top.next.classInfo) == null ? void 0 : _a.classThis; top.classSuper = (_b = top.next.classInfo) == null ? void 0 : _b.classSuper; } updateState(); } function exitClassElement() { - var _a2; + var _a; Debug.assert((top == null ? void 0 : top.kind) === "class-element", "Incorrect value for top.kind.", () => `Expected top.kind to be 'class-element' but got '${top == null ? void 0 : top.kind}' instead.`); - Debug.assert(((_a2 = top.next) == null ? void 0 : _a2.kind) === "class", "Incorrect value for top.next.kind.", () => { - var _a3; - return `Expected top.next.kind to be 'class' but got '${(_a3 = top.next) == null ? void 0 : _a3.kind}' instead.`; + Debug.assert(((_a = top.next) == null ? void 0 : _a.kind) === "class", "Incorrect value for top.next.kind.", () => { + var _a2; + return `Expected top.next.kind to be 'class' but got '${(_a2 = top.next) == null ? void 0 : _a2.kind}' instead.`; }); top = top.next; updateState(); @@ -93429,49 +94008,49 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 167 /* Decorator */: + case 169 /* Decorator */: return Debug.fail("Use `modifierVisitor` instead."); - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: return visitClassDeclaration(node); - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: return visitClassExpression( node, /*referencedName*/ void 0 ); - case 173 /* Constructor */: - case 169 /* PropertyDeclaration */: - case 172 /* ClassStaticBlockDeclaration */: + case 175 /* Constructor */: + case 171 /* PropertyDeclaration */: + case 174 /* ClassStaticBlockDeclaration */: return Debug.fail("Not supported outside of a class. Use 'classElementVisitor' instead."); - case 166 /* Parameter */: + case 168 /* Parameter */: return visitParameterDeclaration(node); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return visitBinaryExpression( node, /*discarded*/ false ); - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: return visitPropertyAssignment(node); - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 205 /* BindingElement */: + case 207 /* BindingElement */: return visitBindingElement(node); - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: return visitExportAssignment(node); - case 108 /* ThisKeyword */: + case 110 /* ThisKeyword */: return visitThisExpression(node); - case 245 /* ForStatement */: + case 247 /* ForStatement */: return visitForStatement(node); - case 241 /* ExpressionStatement */: + case 243 /* ExpressionStatement */: return visitExpressionStatement(node); - case 357 /* CommaListExpression */: + case 360 /* CommaListExpression */: return visitCommaListExpression( node, /*discarded*/ false ); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return visitParenthesizedExpression( node, /*discarded*/ @@ -93479,7 +94058,7 @@ ${lanes.join("\n")} /*referencedName*/ void 0 ); - case 356 /* PartiallyEmittedExpression */: + case 359 /* PartiallyEmittedExpression */: return visitPartiallyEmittedExpression( node, /*discarded*/ @@ -93487,28 +94066,28 @@ ${lanes.join("\n")} /*referencedName*/ void 0 ); - case 210 /* CallExpression */: + case 212 /* CallExpression */: return visitCallExpression(node); - case 212 /* TaggedTemplateExpression */: + case 214 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 221 /* PrefixUnaryExpression */: - case 222 /* PostfixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression( node, - /*discard*/ + /*discarded*/ false ); - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: return visitPropertyAccessExpression(node); - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: return visitElementAccessExpression(node); - case 164 /* ComputedPropertyName */: + case 166 /* ComputedPropertyName */: return visitComputedPropertyName(node); - case 171 /* MethodDeclaration */: - case 175 /* SetAccessor */: - case 174 /* GetAccessor */: - case 215 /* FunctionExpression */: - case 259 /* FunctionDeclaration */: { + case 173 /* MethodDeclaration */: + case 177 /* SetAccessor */: + case 176 /* GetAccessor */: + case 217 /* FunctionExpression */: + case 261 /* FunctionDeclaration */: { enterOther(); const result = visitEachChild(node, fallbackVisitor, context); exitOther(); @@ -93520,7 +94099,7 @@ ${lanes.join("\n")} } function fallbackVisitor(node) { switch (node.kind) { - case 167 /* Decorator */: + case 169 /* Decorator */: return void 0; default: return visitor(node); @@ -93528,7 +94107,7 @@ ${lanes.join("\n")} } function modifierVisitor(node) { switch (node.kind) { - case 167 /* Decorator */: + case 169 /* Decorator */: return void 0; default: return node; @@ -93536,17 +94115,17 @@ ${lanes.join("\n")} } function classElementVisitor(node) { switch (node.kind) { - case 173 /* Constructor */: + case 175 /* Constructor */: return visitConstructorDeclaration(node); - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 174 /* GetAccessor */: + case 176 /* GetAccessor */: return visitGetAccessorDeclaration(node); - case 175 /* SetAccessor */: + case 177 /* SetAccessor */: return visitSetAccessorDeclaration(node); - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return visitPropertyDeclaration(node); - case 172 /* ClassStaticBlockDeclaration */: + case 174 /* ClassStaticBlockDeclaration */: return visitClassStaticBlockDeclaration(node); default: return visitor(node); @@ -93554,21 +94133,21 @@ ${lanes.join("\n")} } function namedEvaluationVisitor(node, referencedName) { switch (node.kind) { - case 356 /* PartiallyEmittedExpression */: + case 359 /* PartiallyEmittedExpression */: return visitPartiallyEmittedExpression( node, /*discarded*/ false, referencedName ); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return visitParenthesizedExpression( node, /*discarded*/ false, referencedName ); - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: return visitClassExpression(node, referencedName); default: return visitor(node); @@ -93576,26 +94155,26 @@ ${lanes.join("\n")} } function discardedValueVisitor(node) { switch (node.kind) { - case 221 /* PrefixUnaryExpression */: - case 222 /* PostfixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression( node, /*discarded*/ true ); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return visitBinaryExpression( node, /*discarded*/ true ); - case 357 /* CommaListExpression */: + case 360 /* CommaListExpression */: return visitCommaListExpression( node, /*discarded*/ true ); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return visitParenthesizedExpression( node, /*discarded*/ @@ -93646,15 +94225,15 @@ ${lanes.join("\n")} let hasStaticPrivateClassElements = false; for (const member of node.members) { if (isNamedClassElement(member) && nodeOrChildIsDecorated( - /*legacyDecorators*/ + /*useLegacyDecorators*/ false, member, node )) { if (hasStaticModifier(member)) { - staticExtraInitializersName != null ? staticExtraInitializersName : staticExtraInitializersName = factory2.createUniqueName("_staticExtraInitializers", 16 /* Optimistic */); + staticExtraInitializersName ?? (staticExtraInitializersName = factory2.createUniqueName("_staticExtraInitializers", 16 /* Optimistic */)); } else { - instanceExtraInitializersName != null ? instanceExtraInitializersName : instanceExtraInitializersName = factory2.createUniqueName("_instanceExtraInitializers", 16 /* Optimistic */); + instanceExtraInitializersName ?? (instanceExtraInitializersName = factory2.createUniqueName("_instanceExtraInitializers", 16 /* Optimistic */)); } } if (isClassStaticBlockDeclaration(member)) { @@ -93693,9 +94272,17 @@ ${lanes.join("\n")} return false; } function transformClassLike(node, className) { - var _a2, _b, _c, _d, _e; + var _a; startLexicalEnvironment(); - const classReference = (_a2 = node.name) != null ? _a2 : factory2.getGeneratedNameForNode(node); + const classReference = factory2.getLocalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + false, + /*ignoreAssignedName*/ + true + ); const classInfo2 = createClassInfo(node); const classDefinitionStatements = []; let leadingBlockStatements; @@ -93721,7 +94308,7 @@ ${lanes.join("\n")} } } if (classDecorators && containsLexicalSuperInStaticInitializer(node)) { - const extendsClause = getHeritageClause(node.heritageClauses, 94 /* ExtendsKeyword */); + const extendsClause = getHeritageClause(node.heritageClauses, 96 /* ExtendsKeyword */); const extendsElement = extendsClause && firstOrUndefined(extendsClause.types); const extendsExpression = extendsElement && visitNode(extendsElement.expression, visitor, isExpression); if (extendsExpression) { @@ -93741,8 +94328,8 @@ ${lanes.join("\n")} } else { heritageClauses = visitNodes2(node.heritageClauses, visitor, isHeritageClause); } - const renamedClassThis = (_b = classInfo2.classThis) != null ? _b : factory2.createThis(); - const needsSetNameHelper = !((_c = getOriginalNode(node, isClassLike)) == null ? void 0 : _c.name) && (classDecorators || !isStringLiteral(className) || !isEmptyStringLiteral(className)); + const renamedClassThis = classInfo2.classThis ?? factory2.createThis(); + const needsSetNameHelper = !((_a = getOriginalNode(node, isClassLike)) == null ? void 0 : _a.name) && (classDecorators || !isStringLiteral(className) || !isEmptyStringLiteral(className)); if (needsSetNameHelper) { const setNameExpr = emitHelpers().createSetFunctionNameHelper(factory2.createThis(), className); leadingBlockStatements = append(leadingBlockStatements, factory2.createExpressionStatement(setNameExpr)); @@ -93757,7 +94344,7 @@ ${lanes.join("\n")} return node2; } switch (node2.kind) { - case 108 /* ThisKeyword */: + case 110 /* ThisKeyword */: if (!outerThis) { outerThis = factory2.createUniqueName("_outerThis", 16 /* Optimistic */); classDefinitionStatements.unshift(createLet(outerThis, factory2.createThis())); @@ -93777,7 +94364,7 @@ ${lanes.join("\n")} const initializerStatements = prepareConstructor(node, classInfo2); if (initializerStatements) { const extendsClauseElement = getEffectiveBaseTypeNode(node); - const isDerivedClass = !!(extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* NullKeyword */); + const isDerivedClass = !!(extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== 106 /* NullKeyword */); const constructorStatements = []; if (isDerivedClass) { const spreadArguments = factory2.createSpreadElement(factory2.createIdentifier("arguments")); @@ -93844,7 +94431,7 @@ ${lanes.join("\n")} leadingBlockStatements = addRange(leadingBlockStatements, classInfo2.staticFieldDecorationStatements); leadingBlockStatements = addRange(leadingBlockStatements, classInfo2.nonStaticFieldDecorationStatements); if (classInfo2.classDescriptorName && classInfo2.classDecoratorsName && classInfo2.classExtraInitializersName && classInfo2.classThis) { - leadingBlockStatements != null ? leadingBlockStatements : leadingBlockStatements = []; + leadingBlockStatements ?? (leadingBlockStatements = []); const valueProperty = factory2.createPropertyAssignment("value", factory2.createThis()); const classDescriptor = factory2.createObjectLiteralExpression([valueProperty]); const classDescriptorAssignment = factory2.createAssignment(classInfo2.classDescriptorName, classDescriptor); @@ -93868,13 +94455,13 @@ ${lanes.join("\n")} if (classInfo2.staticExtraInitializersName) { const runStaticInitializersHelper = emitHelpers().createRunInitializersHelper(renamedClassThis, classInfo2.staticExtraInitializersName); const runStaticInitializersStatement = factory2.createExpressionStatement(runStaticInitializersHelper); - setSourceMapRange(runStaticInitializersStatement, (_d = node.name) != null ? _d : moveRangePastDecorators(node)); + setSourceMapRange(runStaticInitializersStatement, node.name ?? moveRangePastDecorators(node)); leadingBlockStatements = append(leadingBlockStatements, runStaticInitializersStatement); } if (classInfo2.classExtraInitializersName) { const runClassInitializersHelper = emitHelpers().createRunInitializersHelper(renamedClassThis, classInfo2.classExtraInitializersName); const runClassInitializersStatement = factory2.createExpressionStatement(runClassInitializersHelper); - setSourceMapRange(runClassInitializersStatement, (_e = node.name) != null ? _e : moveRangePastDecorators(node)); + setSourceMapRange(runClassInitializersStatement, node.name ?? moveRangePastDecorators(node)); trailingBlockStatements = append(trailingBlockStatements, runClassInitializersStatement); } if (leadingBlockStatements && trailingBlockStatements && !classInfo2.hasStaticInitializers) { @@ -93885,7 +94472,7 @@ ${lanes.join("\n")} if (leadingBlockStatements) { const leadingStaticBlockBody = factory2.createBlock( leadingBlockStatements, - /*multiline*/ + /*multiLine*/ true ); const leadingStaticBlock = factory2.createClassStaticBlockDeclaration(leadingStaticBlockBody); @@ -93900,7 +94487,7 @@ ${lanes.join("\n")} if (trailingBlockStatements) { const trailingStaticBlockBody = factory2.createBlock( trailingBlockStatements, - /*multiline*/ + /*multiLine*/ true ); const trailingStaticBlock = factory2.createClassStaticBlockDeclaration(trailingStaticBlockBody); @@ -93966,20 +94553,19 @@ ${lanes.join("\n")} } function isDecoratedClassLike(node) { return classOrConstructorParameterIsDecorated( - /*legacyDecorators*/ + /*useLegacyDecorators*/ false, node ) || childIsDecorated( - /*legacyDecorators*/ + /*useLegacyDecorators*/ false, node ); } function visitClassDeclaration(node) { - var _a2; if (isDecoratedClassLike(node)) { if (hasSyntacticModifier(node, 1 /* Export */) && hasSyntacticModifier(node, 1024 /* Default */)) { - const originalClass = (_a2 = getOriginalNode(node, isClassLike)) != null ? _a2 : node; + const originalClass = getOriginalNode(node, isClassLike) ?? node; const className = originalClass.name ? factory2.createStringLiteralFromNode(originalClass.name) : factory2.createStringLiteral("default"); const iife = transformClassLike(node, className); const statement = factory2.createExportDefault(iife); @@ -93991,14 +94577,28 @@ ${lanes.join("\n")} Debug.assertIsDefined(node.name, "A class declaration that is not a default export must have a name."); const iife = transformClassLike(node, factory2.createStringLiteralFromNode(node.name)); const modifiers = visitNodes2(node.modifiers, modifierVisitor, isModifier); + const declName = languageVersion <= 2 /* ES2015 */ ? factory2.getInternalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ) : factory2.getLocalName( + node, + /*allowComments*/ + false, + /*allowSourceMaps*/ + true + ); const varDecl = factory2.createVariableDeclaration( - node.name, + declName, /*exclamationToken*/ void 0, /*type*/ void 0, iife ); + setOriginalNode(varDecl, node); const varDecls = factory2.createVariableDeclarationList([varDecl], 1 /* Let */); const statement = factory2.createVariableStatement(modifiers, varDecls); setOriginalNode(statement, node); @@ -94027,7 +94627,7 @@ ${lanes.join("\n")} } function visitClassExpression(node, referencedName) { if (isDecoratedClassLike(node)) { - const className = node.name ? factory2.createStringLiteralFromNode(node.name) : referencedName != null ? referencedName : factory2.createStringLiteral(""); + const className = node.name ? factory2.createStringLiteralFromNode(node.name) : referencedName ?? factory2.createStringLiteral(""); const iife = transformClassLike(node, className); setOriginalNode(iife, node); return iife; @@ -94099,7 +94699,7 @@ ${lanes.join("\n")} setTextRange(body, node.body); } } - body != null ? body : body = visitNode(node.body, visitor, isBlock); + body ?? (body = visitNode(node.body, visitor, isBlock)); exitClassElement(); return factory2.updateConstructorDeclaration(node, modifiers, parameters, body); } @@ -94111,7 +94711,6 @@ ${lanes.join("\n")} return updated; } function partialTransformClassElement(member, useNamedEvaluation, classInfo2, createDescriptor) { - var _a2, _b, _c, _d, _e, _f, _g, _h; let referencedName; let name; let initializersName; @@ -94140,11 +94739,11 @@ ${lanes.join("\n")} const memberDecoratorsArray = factory2.createArrayLiteralExpression(memberDecorators); const memberDecoratorsAssignment = factory2.createAssignment(memberDecoratorsName, memberDecoratorsArray); const memberInfo = { memberDecoratorsName }; - (_a2 = classInfo2.memberInfos) != null ? _a2 : classInfo2.memberInfos = /* @__PURE__ */ new Map(); + classInfo2.memberInfos ?? (classInfo2.memberInfos = /* @__PURE__ */ new Map()); classInfo2.memberInfos.set(member, memberInfo); - pendingExpressions != null ? pendingExpressions : pendingExpressions = []; + pendingExpressions ?? (pendingExpressions = []); pendingExpressions.push(memberDecoratorsAssignment); - const statements = isMethodOrAccessor(member) || isAutoAccessorPropertyDeclaration(member) ? isStatic(member) ? (_b = classInfo2.staticNonFieldDecorationStatements) != null ? _b : classInfo2.staticNonFieldDecorationStatements = [] : (_c = classInfo2.nonStaticNonFieldDecorationStatements) != null ? _c : classInfo2.nonStaticNonFieldDecorationStatements = [] : isPropertyDeclaration(member) && !isAutoAccessorPropertyDeclaration(member) ? isStatic(member) ? (_d = classInfo2.staticFieldDecorationStatements) != null ? _d : classInfo2.staticFieldDecorationStatements = [] : (_e = classInfo2.nonStaticFieldDecorationStatements) != null ? _e : classInfo2.nonStaticFieldDecorationStatements = [] : Debug.fail(); + const statements = isMethodOrAccessor(member) || isAutoAccessorPropertyDeclaration(member) ? isStatic(member) ? classInfo2.staticNonFieldDecorationStatements ?? (classInfo2.staticNonFieldDecorationStatements = []) : classInfo2.nonStaticNonFieldDecorationStatements ?? (classInfo2.nonStaticNonFieldDecorationStatements = []) : isPropertyDeclaration(member) && !isAutoAccessorPropertyDeclaration(member) ? isStatic(member) ? classInfo2.staticFieldDecorationStatements ?? (classInfo2.staticFieldDecorationStatements = []) : classInfo2.nonStaticFieldDecorationStatements ?? (classInfo2.nonStaticFieldDecorationStatements = []) : Debug.fail(); const kind = isGetAccessorDeclaration(member) ? "getter" : isSetAccessorDeclaration(member) ? "setter" : isMethodDeclaration(member) ? "method" : isAutoAccessorPropertyDeclaration(member) ? "accessor" : isPropertyDeclaration(member) ? "field" : Debug.fail(); let propertyName; if (isIdentifier(member.name) || isPrivateIdentifier(member.name)) { @@ -94175,7 +94774,7 @@ ${lanes.join("\n")} set: isPropertyDeclaration(member) || isSetAccessorDeclaration(member) } }; - const extraInitializers = isStatic(member) ? (_f = classInfo2.staticExtraInitializersName) != null ? _f : classInfo2.staticExtraInitializersName = factory2.createUniqueName("_staticExtraInitializers", 16 /* Optimistic */) : (_g = classInfo2.instanceExtraInitializersName) != null ? _g : classInfo2.instanceExtraInitializersName = factory2.createUniqueName("_instanceExtraInitializers", 16 /* Optimistic */); + const extraInitializers = isStatic(member) ? classInfo2.staticExtraInitializersName ?? (classInfo2.staticExtraInitializersName = factory2.createUniqueName("_staticExtraInitializers", 16 /* Optimistic */)) : classInfo2.instanceExtraInitializersName ?? (classInfo2.instanceExtraInitializersName = factory2.createUniqueName("_instanceExtraInitializers", 16 /* Optimistic */)); if (isMethodOrAccessor(member)) { let descriptor; if (isPrivateIdentifierClassElementDeclaration(member) && createDescriptor) { @@ -94183,12 +94782,12 @@ ${lanes.join("\n")} memberInfo.memberDescriptorName = descriptorName = createHelperVariable(member, "descriptor"); descriptor = factory2.createAssignment(descriptorName, descriptor); } - const esDecorateExpression = emitHelpers().createESDecorateHelper(factory2.createThis(), descriptor != null ? descriptor : factory2.createNull(), memberDecoratorsName, context2, factory2.createNull(), extraInitializers); + const esDecorateExpression = emitHelpers().createESDecorateHelper(factory2.createThis(), descriptor ?? factory2.createNull(), memberDecoratorsName, context2, factory2.createNull(), extraInitializers); const esDecorateStatement = factory2.createExpressionStatement(esDecorateExpression); setSourceMapRange(esDecorateStatement, moveRangePastDecorators(member)); statements.push(esDecorateStatement); } else if (isPropertyDeclaration(member)) { - initializersName = (_h = memberInfo.memberInitializersName) != null ? _h : memberInfo.memberInitializersName = createHelperVariable(member, "initializers"); + initializersName = memberInfo.memberInitializersName ?? (memberInfo.memberInitializersName = createHelperVariable(member, "initializers")); if (isStatic(member)) { thisArg = classInfo2.classThis; } @@ -94204,7 +94803,7 @@ ${lanes.join("\n")} } const esDecorateExpression = emitHelpers().createESDecorateHelper( isAutoAccessorPropertyDeclaration(member) ? factory2.createThis() : factory2.createNull(), - descriptor != null ? descriptor : factory2.createNull(), + descriptor ?? factory2.createNull(), memberDecoratorsName, context2, initializersName, @@ -94324,14 +94923,14 @@ ${lanes.join("\n")} let initializer = referencedName ? visitNode(node.initializer, (node2) => namedEvaluationVisitor(node2, referencedName), isExpression) : visitNode(node.initializer, visitor, isExpression); if (initializersName) { initializer = emitHelpers().createRunInitializersHelper( - thisArg != null ? thisArg : factory2.createThis(), + thisArg ?? factory2.createThis(), initializersName, - initializer != null ? initializer : factory2.createVoidZero() + initializer ?? factory2.createVoidZero() ); } if (!isStatic(node) && (classInfo == null ? void 0 : classInfo.instanceExtraInitializersName) && !(classInfo == null ? void 0 : classInfo.hasInjectedInstanceInitializers)) { classInfo.hasInjectedInstanceInitializers = true; - initializer != null ? initializer : initializer = factory2.createVoidZero(); + initializer ?? (initializer = factory2.createVoidZero()); initializer = factory2.createParenthesizedExpression(factory2.createComma( emitHelpers().createRunInitializersHelper( factory2.createThis(), @@ -94372,7 +94971,7 @@ ${lanes.join("\n")} setterName = factory2.updateComputedPropertyName(name2, temp); } } - const modifiersWithoutAccessor = visitNodes2(modifiers, (node2) => node2.kind !== 127 /* AccessorKeyword */ ? node2 : void 0, isModifier); + const modifiersWithoutAccessor = visitNodes2(modifiers, (node2) => node2.kind !== 129 /* AccessorKeyword */ ? node2 : void 0, isModifier); const backingField = createAccessorPropertyBackingField(factory2, node, modifiersWithoutAccessor, initializer); setOriginalNode(backingField, node); setEmitFlags(backingField, 3072 /* NoComments */); @@ -94400,7 +94999,7 @@ ${lanes.join("\n")} ), node); } function visitThisExpression(node) { - return classThis != null ? classThis : node; + return classThis ?? node; } function visitCallExpression(node) { if (isSuperProperty(node.expression) && classThis) { @@ -94564,7 +95163,7 @@ ${lanes.join("\n")} } } } - if (node.operatorToken.kind === 27 /* CommaToken */) { + if (node.operatorToken.kind === 28 /* CommaToken */) { const left = visitNode(node.left, discardedValueVisitor, isExpression); const right = visitNode(node.right, discarded ? discardedValueVisitor : visitor, isExpression); return factory2.updateBinaryExpression(node, left, node.operatorToken, right); @@ -94572,7 +95171,7 @@ ${lanes.join("\n")} return visitEachChild(node, visitor, context); } function visitPreOrPostfixUnaryExpression(node, discarded) { - if (node.operator === 45 /* PlusPlusToken */ || node.operator === 46 /* MinusMinusToken */) { + if (node.operator === 46 /* PlusPlusToken */ || node.operator === 47 /* MinusMinusToken */) { const operand = skipParentheses(node.operand); if (isSuperProperty(operand) && classThis && classSuper) { let setterName = isElementAccessExpression(operand) ? visitNode(operand.argumentExpression, visitor, isExpression) : isIdentifier(operand.name) ? factory2.createStringLiteralFromNode(operand.name) : void 0; @@ -94845,7 +95444,7 @@ ${lanes.join("\n")} parameters, /*type*/ void 0, - body != null ? body : factory2.createBlock([]) + body ?? factory2.createBlock([]) ); setOriginalNode(func, original); setSourceMapRange(func, moveRangePastDecorators(original)); @@ -95101,36 +95700,36 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 132 /* AsyncKeyword */: + case 134 /* AsyncKeyword */: return void 0; - case 220 /* AwaitExpression */: + case 222 /* AwaitExpression */: return visitAwaitExpression(node); - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: return doWithContext(1 /* NonTopLevel */ | 2 /* HasLexicalThis */, visitMethodDeclaration, node); - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: return doWithContext(1 /* NonTopLevel */ | 2 /* HasLexicalThis */, visitFunctionDeclaration, node); - case 215 /* FunctionExpression */: + case 217 /* FunctionExpression */: return doWithContext(1 /* NonTopLevel */ | 2 /* HasLexicalThis */, visitFunctionExpression, node); - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: return doWithContext(1 /* NonTopLevel */, visitArrowFunction, node); - case 208 /* PropertyAccessExpression */: - if (capturedSuperProperties && isPropertyAccessExpression(node) && node.expression.kind === 106 /* SuperKeyword */) { + case 210 /* PropertyAccessExpression */: + if (capturedSuperProperties && isPropertyAccessExpression(node) && node.expression.kind === 108 /* SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return visitEachChild(node, visitor, context); - case 209 /* ElementAccessExpression */: - if (capturedSuperProperties && node.expression.kind === 106 /* SuperKeyword */) { + case 211 /* ElementAccessExpression */: + if (capturedSuperProperties && node.expression.kind === 108 /* SuperKeyword */) { hasSuperElementAccess = true; } return visitEachChild(node, visitor, context); - case 174 /* GetAccessor */: + case 176 /* GetAccessor */: return doWithContext(1 /* NonTopLevel */ | 2 /* HasLexicalThis */, visitGetAccessorDeclaration, node); - case 175 /* SetAccessor */: + case 177 /* SetAccessor */: return doWithContext(1 /* NonTopLevel */ | 2 /* HasLexicalThis */, visitSetAccessorDeclaration, node); - case 173 /* Constructor */: + case 175 /* Constructor */: return doWithContext(1 /* NonTopLevel */ | 2 /* HasLexicalThis */, visitConstructorDeclaration, node); - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: return doWithContext(1 /* NonTopLevel */ | 2 /* HasLexicalThis */, visitDefault, node); default: return visitEachChild(node, visitor, context); @@ -95139,27 +95738,27 @@ ${lanes.join("\n")} function asyncBodyVisitor(node) { if (isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 245 /* ForStatement */: + case 247 /* ForStatement */: return visitForStatementInAsyncBody(node); - case 246 /* ForInStatement */: + case 248 /* ForInStatement */: return visitForInStatementInAsyncBody(node); - case 247 /* ForOfStatement */: + case 249 /* ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 295 /* CatchClause */: + case 298 /* CatchClause */: return visitCatchClauseInAsyncBody(node); - case 238 /* Block */: - case 252 /* SwitchStatement */: - case 266 /* CaseBlock */: - case 292 /* CaseClause */: - case 293 /* DefaultClause */: - case 255 /* TryStatement */: - case 243 /* DoStatement */: - case 244 /* WhileStatement */: - case 242 /* IfStatement */: - case 251 /* WithStatement */: - case 253 /* LabeledStatement */: + case 240 /* Block */: + case 254 /* SwitchStatement */: + case 268 /* CaseBlock */: + case 295 /* CaseClause */: + case 296 /* DefaultClause */: + case 257 /* TryStatement */: + case 245 /* DoStatement */: + case 246 /* WhileStatement */: + case 244 /* IfStatement */: + case 253 /* WithStatement */: + case 255 /* LabeledStatement */: return visitEachChild(node, asyncBodyVisitor, context); default: return Debug.assertNever(node, "Unhandled node."); @@ -95436,7 +96035,7 @@ ${lanes.join("\n")} const original = getOriginalNode(node, isFunctionLike); const nodeType = original.type; const promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : void 0; - const isArrowFunction2 = node.kind === 216 /* ArrowFunction */; + const isArrowFunction2 = node.kind === 218 /* ArrowFunction */; const hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 512 /* CaptureArguments */) !== 0; const savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames; enclosingFunctionParameterNames = /* @__PURE__ */ new Set(); @@ -95535,15 +96134,15 @@ ${lanes.join("\n")} function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) === 0) { enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; - context.enableSubstitution(210 /* CallExpression */); - context.enableSubstitution(208 /* PropertyAccessExpression */); - context.enableSubstitution(209 /* ElementAccessExpression */); - context.enableEmitNotification(260 /* ClassDeclaration */); - context.enableEmitNotification(171 /* MethodDeclaration */); - context.enableEmitNotification(174 /* GetAccessor */); - context.enableEmitNotification(175 /* SetAccessor */); - context.enableEmitNotification(173 /* Constructor */); - context.enableEmitNotification(240 /* VariableStatement */); + context.enableSubstitution(212 /* CallExpression */); + context.enableSubstitution(210 /* PropertyAccessExpression */); + context.enableSubstitution(211 /* ElementAccessExpression */); + context.enableEmitNotification(262 /* ClassDeclaration */); + context.enableEmitNotification(173 /* MethodDeclaration */); + context.enableEmitNotification(176 /* GetAccessor */); + context.enableEmitNotification(177 /* SetAccessor */); + context.enableEmitNotification(175 /* Constructor */); + context.enableEmitNotification(242 /* VariableStatement */); } } function onEmitNode(hint, node, emitCallback) { @@ -95574,17 +96173,17 @@ ${lanes.join("\n")} } function substituteExpression(node) { switch (node.kind) { - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: return substituteElementAccessExpression(node); - case 210 /* CallExpression */: + case 212 /* CallExpression */: return substituteCallExpression(node); } return node; } function substitutePropertyAccessExpression(node) { - if (node.expression.kind === 106 /* SuperKeyword */) { + if (node.expression.kind === 108 /* SuperKeyword */) { return setTextRange( factory2.createPropertyAccessExpression( factory2.createUniqueName("_super", 16 /* Optimistic */ | 32 /* FileLevel */), @@ -95596,7 +96195,7 @@ ${lanes.join("\n")} return node; } function substituteElementAccessExpression(node) { - if (node.expression.kind === 106 /* SuperKeyword */) { + if (node.expression.kind === 108 /* SuperKeyword */) { return createSuperElementAccessInAsyncMethod( node.argumentExpression, node @@ -95622,7 +96221,7 @@ ${lanes.join("\n")} } function isSuperContainer(node) { const kind = node.kind; - return kind === 260 /* ClassDeclaration */ || kind === 173 /* Constructor */ || kind === 171 /* MethodDeclaration */ || kind === 174 /* GetAccessor */ || kind === 175 /* SetAccessor */; + return kind === 262 /* ClassDeclaration */ || kind === 175 /* Constructor */ || kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 256 /* MethodWithSuperPropertyAssignmentInAsync */) { @@ -95660,15 +96259,15 @@ ${lanes.join("\n")} getterAndSetter.push(factory2.createPropertyAssignment( "get", factory2.createArrowFunction( - /* modifiers */ + /*modifiers*/ void 0, - /* typeParameters */ + /*typeParameters*/ void 0, /* parameters */ [], - /* type */ + /*type*/ void 0, - /* equalsGreaterThanToken */ + /*equalsGreaterThanToken*/ void 0, setEmitFlags( factory2.createPropertyAccessExpression( @@ -95687,29 +96286,29 @@ ${lanes.join("\n")} factory2.createPropertyAssignment( "set", factory2.createArrowFunction( - /* modifiers */ + /*modifiers*/ void 0, - /* typeParameters */ + /*typeParameters*/ void 0, /* parameters */ [ factory2.createParameterDeclaration( - /* modifiers */ + /*modifiers*/ void 0, - /* dotDotDotToken */ + /*dotDotDotToken*/ void 0, "v", - /* questionToken */ + /*questionToken*/ void 0, - /* type */ + /*type*/ void 0, - /* initializer */ + /*initializer*/ void 0 ) ], - /* type */ + /*type*/ void 0, - /* equalsGreaterThanToken */ + /*equalsGreaterThanToken*/ void 0, factory2.createAssignment( setEmitFlags( @@ -95736,7 +96335,7 @@ ${lanes.join("\n")} ); }); return factory2.createVariableStatement( - /* modifiers */ + /*modifiers*/ void 0, factory2.createVariableDeclarationList( [ @@ -95744,20 +96343,20 @@ ${lanes.join("\n")} factory2.createUniqueName("_super", 16 /* Optimistic */ | 32 /* FileLevel */), /*exclamationToken*/ void 0, - /* type */ + /*type*/ void 0, factory2.createCallExpression( factory2.createPropertyAccessExpression( factory2.createIdentifier("Object"), "create" ), - /* typeArguments */ + /*typeArguments*/ void 0, [ factory2.createNull(), factory2.createObjectLiteralExpression( accessors, - /* multiline */ + /*multiLine*/ true ) ] @@ -95846,7 +96445,7 @@ ${lanes.join("\n")} ); } function visitorNoAsyncModifier(node) { - if (node.kind === 132 /* AsyncKeyword */) { + if (node.kind === 134 /* AsyncKeyword */) { return void 0; } return node; @@ -95868,119 +96467,119 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 220 /* AwaitExpression */: + case 222 /* AwaitExpression */: return visitAwaitExpression(node); - case 226 /* YieldExpression */: + case 228 /* YieldExpression */: return visitYieldExpression(node); - case 250 /* ReturnStatement */: + case 252 /* ReturnStatement */: return visitReturnStatement(node); - case 253 /* LabeledStatement */: + case 255 /* LabeledStatement */: return visitLabeledStatement(node); - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused2); - case 357 /* CommaListExpression */: + case 360 /* CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused2); - case 295 /* CatchClause */: + case 298 /* CatchClause */: return visitCatchClause(node); - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: return visitVariableStatement(node); - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 243 /* DoStatement */: - case 244 /* WhileStatement */: - case 246 /* ForInStatement */: + case 245 /* DoStatement */: + case 246 /* WhileStatement */: + case 248 /* ForInStatement */: return doWithHierarchyFacts( visitDefault, node, 0 /* IterationStatementExcludes */, 2 /* IterationStatementIncludes */ ); - case 247 /* ForOfStatement */: + case 249 /* ForOfStatement */: return visitForOfStatement( node, /*outermostLabeledStatement*/ void 0 ); - case 245 /* ForStatement */: + case 247 /* ForStatement */: return doWithHierarchyFacts( visitForStatement, node, 0 /* IterationStatementExcludes */, 2 /* IterationStatementIncludes */ ); - case 219 /* VoidExpression */: + case 221 /* VoidExpression */: return visitVoidExpression(node); - case 173 /* Constructor */: + case 175 /* Constructor */: return doWithHierarchyFacts( visitConstructorDeclaration, node, 2 /* ClassOrFunctionExcludes */, 1 /* ClassOrFunctionIncludes */ ); - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: return doWithHierarchyFacts( visitMethodDeclaration, node, 2 /* ClassOrFunctionExcludes */, 1 /* ClassOrFunctionIncludes */ ); - case 174 /* GetAccessor */: + case 176 /* GetAccessor */: return doWithHierarchyFacts( visitGetAccessorDeclaration, node, 2 /* ClassOrFunctionExcludes */, 1 /* ClassOrFunctionIncludes */ ); - case 175 /* SetAccessor */: + case 177 /* SetAccessor */: return doWithHierarchyFacts( visitSetAccessorDeclaration, node, 2 /* ClassOrFunctionExcludes */, 1 /* ClassOrFunctionIncludes */ ); - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: return doWithHierarchyFacts( visitFunctionDeclaration, node, 2 /* ClassOrFunctionExcludes */, 1 /* ClassOrFunctionIncludes */ ); - case 215 /* FunctionExpression */: + case 217 /* FunctionExpression */: return doWithHierarchyFacts( visitFunctionExpression, node, 2 /* ClassOrFunctionExcludes */, 1 /* ClassOrFunctionIncludes */ ); - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: return doWithHierarchyFacts( visitArrowFunction, node, 2 /* ArrowFunctionExcludes */, 0 /* ArrowFunctionIncludes */ ); - case 166 /* Parameter */: + case 168 /* Parameter */: return visitParameter(node); - case 241 /* ExpressionStatement */: + case 243 /* ExpressionStatement */: return visitExpressionStatement(node); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused2); - case 212 /* TaggedTemplateExpression */: + case 214 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 208 /* PropertyAccessExpression */: - if (capturedSuperProperties && isPropertyAccessExpression(node) && node.expression.kind === 106 /* SuperKeyword */) { + case 210 /* PropertyAccessExpression */: + if (capturedSuperProperties && isPropertyAccessExpression(node) && node.expression.kind === 108 /* SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return visitEachChild(node, visitor, context); - case 209 /* ElementAccessExpression */: - if (capturedSuperProperties && node.expression.kind === 106 /* SuperKeyword */) { + case 211 /* ElementAccessExpression */: + if (capturedSuperProperties && node.expression.kind === 108 /* SuperKeyword */) { hasSuperElementAccess = true; } return visitEachChild(node, visitor, context); - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: return doWithHierarchyFacts( visitDefault, node, @@ -96065,7 +96664,7 @@ ${lanes.join("\n")} function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* Async */) { const statement = unwrapInnermostStatementOfLabel(node); - if (statement.kind === 247 /* ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 249 /* ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return factory2.restoreEnclosingLabel(visitNode(statement, visitor, isStatement, factory2.liftToBlock), node); @@ -96076,7 +96675,7 @@ ${lanes.join("\n")} let chunkObject; const objects = []; for (const e of elements) { - if (e.kind === 301 /* SpreadAssignment */) { + if (e.kind === 304 /* SpreadAssignment */) { if (chunkObject) { objects.push(factory2.createObjectLiteralExpression(chunkObject)); chunkObject = void 0; @@ -96084,7 +96683,7 @@ ${lanes.join("\n")} const target = e.expression; objects.push(visitNode(target, visitor, isExpression)); } else { - chunkObject = append(chunkObject, e.kind === 299 /* PropertyAssignment */ ? factory2.createPropertyAssignment(e.name, visitNode(e.initializer, visitor, isExpression)) : visitNode(e, visitor, isObjectLiteralElementLike)); + chunkObject = append(chunkObject, e.kind === 302 /* PropertyAssignment */ ? factory2.createPropertyAssignment(e.name, visitNode(e.initializer, visitor, isExpression)) : visitNode(e, visitor, isObjectLiteralElementLike)); } } if (chunkObject) { @@ -96095,7 +96694,7 @@ ${lanes.join("\n")} function visitObjectLiteralExpression(node) { if (node.transformFlags & 65536 /* ContainsObjectRestOrSpread */) { const objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 207 /* ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 209 /* ObjectLiteralExpression */) { objects.unshift(factory2.createObjectLiteralExpression()); } let expression = objects[0]; @@ -96154,7 +96753,7 @@ ${lanes.join("\n")} !expressionResultIsUnused2 ); } - if (node.operatorToken.kind === 27 /* CommaToken */) { + if (node.operatorToken.kind === 28 /* CommaToken */) { return factory2.updateBinaryExpression( node, visitNode(node.left, visitorWithUnusedExpressionResult, isExpression), @@ -96336,10 +96935,7 @@ ${lanes.join("\n")} const exitNonUserCodeExpression = factory2.createAssignment(nonUserCode, factory2.createFalse()); const exitNonUserCodeStatement = factory2.createExpressionStatement(exitNonUserCodeExpression); setSourceMapRange(exitNonUserCodeStatement, node.expression); - const enterNonUserCodeExpression = factory2.createAssignment(nonUserCode, factory2.createTrue()); - const enterNonUserCodeStatement = factory2.createExpressionStatement(enterNonUserCodeExpression); - setSourceMapRange(exitNonUserCodeStatement, node.expression); - const statements = []; + const statements = [iteratorValueStatement, exitNonUserCodeStatement]; const binding = createForOfBindingStatement(factory2, node.initializer, value); statements.push(visitNode(binding, visitor, isStatement)); let bodyLocation; @@ -96352,29 +96948,14 @@ ${lanes.join("\n")} } else { statements.push(statement); } - const body = setEmitFlags( - setTextRange( - factory2.createBlock( - setTextRange(factory2.createNodeArray(statements), statementsLocation), - /*multiLine*/ - true - ), - bodyLocation + return setTextRange( + factory2.createBlock( + setTextRange(factory2.createNodeArray(statements), statementsLocation), + /*multiLine*/ + true ), - 96 /* NoSourceMap */ | 768 /* NoTokenSourceMaps */ + bodyLocation ); - return factory2.createBlock([ - iteratorValueStatement, - exitNonUserCodeStatement, - factory2.createTryStatement( - body, - /*catchClause*/ - void 0, - factory2.createBlock([ - enterNonUserCodeStatement - ]) - ) - ]); } function createDownlevelAwait(expression) { return enclosingFunctionFlags & 1 /* Generator */ ? factory2.createYieldExpression( @@ -96453,7 +97034,7 @@ ${lanes.join("\n")} factory2.createLogicalNot(done) ]), /*incrementor*/ - void 0, + factory2.createAssignment(nonUserCode, factory2.createTrue()), /*statement*/ convertForOfStatementHead(node, getValue, nonUserCode) ), @@ -96635,7 +97216,7 @@ ${lanes.join("\n")} enclosingFunctionFlags & 2 /* Async */ ? void 0 : node.asteriskToken, visitNode(node.name, visitor, isPropertyName), visitNode( - /*questionToken*/ + /*node*/ void 0, visitor, isQuestionToken @@ -96733,7 +97314,7 @@ ${lanes.join("\n")} factory2.createFunctionExpression( /*modifiers*/ void 0, - factory2.createToken(41 /* AsteriskToken */), + factory2.createToken(42 /* AsteriskToken */), node.name && factory2.getGeneratedNameForNode(node.name), /*typeParameters*/ void 0, @@ -96771,11 +97352,10 @@ ${lanes.join("\n")} return block; } function transformFunctionBody2(node) { - var _a2; resumeLexicalEnvironment(); let statementOffset = 0; const statements = []; - const body = (_a2 = visitNode(node.body, visitor, isConciseBody)) != null ? _a2 : factory2.createBlock([]); + const body = visitNode(node.body, visitor, isConciseBody) ?? factory2.createBlock([]); if (isBlock(body)) { statementOffset = factory2.copyPrologue( body.statements, @@ -96861,7 +97441,7 @@ ${lanes.join("\n")} context, 1 /* ObjectRest */, factory2.getGeneratedNameForNode(parameter), - /*doNotRecordTempVariablesInLine*/ + /*hoistTempVariables*/ false, /*skipInitializer*/ true @@ -96883,15 +97463,15 @@ ${lanes.join("\n")} function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1 /* AsyncMethodsWithSuper */) === 0) { enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */; - context.enableSubstitution(210 /* CallExpression */); - context.enableSubstitution(208 /* PropertyAccessExpression */); - context.enableSubstitution(209 /* ElementAccessExpression */); - context.enableEmitNotification(260 /* ClassDeclaration */); - context.enableEmitNotification(171 /* MethodDeclaration */); - context.enableEmitNotification(174 /* GetAccessor */); - context.enableEmitNotification(175 /* SetAccessor */); - context.enableEmitNotification(173 /* Constructor */); - context.enableEmitNotification(240 /* VariableStatement */); + context.enableSubstitution(212 /* CallExpression */); + context.enableSubstitution(210 /* PropertyAccessExpression */); + context.enableSubstitution(211 /* ElementAccessExpression */); + context.enableEmitNotification(262 /* ClassDeclaration */); + context.enableEmitNotification(173 /* MethodDeclaration */); + context.enableEmitNotification(176 /* GetAccessor */); + context.enableEmitNotification(177 /* SetAccessor */); + context.enableEmitNotification(175 /* Constructor */); + context.enableEmitNotification(242 /* VariableStatement */); } } function onEmitNode(hint, node, emitCallback) { @@ -96922,17 +97502,17 @@ ${lanes.join("\n")} } function substituteExpression(node) { switch (node.kind) { - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: return substituteElementAccessExpression(node); - case 210 /* CallExpression */: + case 212 /* CallExpression */: return substituteCallExpression(node); } return node; } function substitutePropertyAccessExpression(node) { - if (node.expression.kind === 106 /* SuperKeyword */) { + if (node.expression.kind === 108 /* SuperKeyword */) { return setTextRange( factory2.createPropertyAccessExpression( factory2.createUniqueName("_super", 16 /* Optimistic */ | 32 /* FileLevel */), @@ -96944,7 +97524,7 @@ ${lanes.join("\n")} return node; } function substituteElementAccessExpression(node) { - if (node.expression.kind === 106 /* SuperKeyword */) { + if (node.expression.kind === 108 /* SuperKeyword */) { return createSuperElementAccessInAsyncMethod( node.argumentExpression, node @@ -96970,7 +97550,7 @@ ${lanes.join("\n")} } function isSuperContainer(node) { const kind = node.kind; - return kind === 260 /* ClassDeclaration */ || kind === 173 /* Constructor */ || kind === 171 /* MethodDeclaration */ || kind === 174 /* GetAccessor */ || kind === 175 /* SetAccessor */; + return kind === 262 /* ClassDeclaration */ || kind === 175 /* Constructor */ || kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 256 /* MethodWithSuperPropertyAssignmentInAsync */) { @@ -97021,7 +97601,7 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 295 /* CatchClause */: + case 298 /* CatchClause */: return visitCatchClause(node); default: return visitEachChild(node, visitor, context); @@ -97066,7 +97646,7 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 210 /* CallExpression */: { + case 212 /* CallExpression */: { const updated = visitNonOptionalCallExpression( node, /*captureThisArg*/ @@ -97075,8 +97655,8 @@ ${lanes.join("\n")} Debug.assertNotNode(updated, isSyntheticReference); return updated; } - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: if (isOptionalChain(node)) { const updated = visitOptionalExpression( node, @@ -97089,12 +97669,12 @@ ${lanes.join("\n")} return updated; } return visitEachChild(node, visitor, context); - case 223 /* BinaryExpression */: - if (node.operatorToken.kind === 60 /* QuestionQuestionToken */) { + case 225 /* BinaryExpression */: + if (node.operatorToken.kind === 61 /* QuestionQuestionToken */) { return transformNullishCoalescingExpression(node); } return visitEachChild(node, visitor, context); - case 217 /* DeleteExpression */: + case 219 /* DeleteExpression */: return visitDeleteExpression(node); default: return visitEachChild(node, visitor, context); @@ -97132,7 +97712,7 @@ ${lanes.join("\n")} thisArg = expression; } } - expression = node.kind === 208 /* PropertyAccessExpression */ ? factory2.updatePropertyAccessExpression(node, expression, visitNode(node.name, visitor, isIdentifier)) : factory2.updateElementAccessExpression(node, expression, visitNode(node.argumentExpression, visitor, isExpression)); + expression = node.kind === 210 /* PropertyAccessExpression */ ? factory2.updatePropertyAccessExpression(node, expression, visitNode(node.name, visitor, isIdentifier)) : factory2.updateElementAccessExpression(node, expression, visitNode(node.argumentExpression, visitor, isExpression)); return thisArg ? factory2.createSyntheticReferenceExpression(expression, thisArg) : expression; } function visitNonOptionalCallExpression(node, captureThisArg) { @@ -97168,12 +97748,12 @@ ${lanes.join("\n")} } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); - case 210 /* CallExpression */: + case 212 /* CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); default: return visitNode(node, visitor, isExpression); @@ -97199,8 +97779,8 @@ ${lanes.join("\n")} for (let i = 0; i < chain.length; i++) { const segment = chain[i]; switch (segment.kind) { - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: if (i === chain.length - 1 && captureThisArg) { if (!isSimpleCopiableExpression(rightExpression)) { thisArg = factory2.createTempVariable(hoistVariableDeclaration); @@ -97209,9 +97789,9 @@ ${lanes.join("\n")} thisArg = rightExpression; } } - rightExpression = segment.kind === 208 /* PropertyAccessExpression */ ? factory2.createPropertyAccessExpression(rightExpression, visitNode(segment.name, visitor, isIdentifier)) : factory2.createElementAccessExpression(rightExpression, visitNode(segment.argumentExpression, visitor, isExpression)); + rightExpression = segment.kind === 210 /* PropertyAccessExpression */ ? factory2.createPropertyAccessExpression(rightExpression, visitNode(segment.name, visitor, isIdentifier)) : factory2.createElementAccessExpression(rightExpression, visitNode(segment.argumentExpression, visitor, isExpression)); break; - case 210 /* CallExpression */: + case 212 /* CallExpression */: if (i === 0 && leftThisArg) { if (!isGeneratedIdentifier(leftThisArg)) { leftThisArg = factory2.cloneNode(leftThisArg); @@ -97219,7 +97799,7 @@ ${lanes.join("\n")} } rightExpression = factory2.createFunctionCallCall( rightExpression, - leftThisArg.kind === 106 /* SuperKeyword */ ? factory2.createThis() : leftThisArg, + leftThisArg.kind === 108 /* SuperKeyword */ ? factory2.createThis() : leftThisArg, visitNodes2(segment.arguments, visitor, isExpression) ); } else { @@ -97268,13 +97848,13 @@ ${lanes.join("\n")} return factory2.createBinaryExpression( factory2.createBinaryExpression( left, - factory2.createToken(invert ? 36 /* EqualsEqualsEqualsToken */ : 37 /* ExclamationEqualsEqualsToken */), + factory2.createToken(invert ? 37 /* EqualsEqualsEqualsToken */ : 38 /* ExclamationEqualsEqualsToken */), factory2.createNull() ), - factory2.createToken(invert ? 56 /* BarBarToken */ : 55 /* AmpersandAmpersandToken */), + factory2.createToken(invert ? 57 /* BarBarToken */ : 56 /* AmpersandAmpersandToken */), factory2.createBinaryExpression( right, - factory2.createToken(invert ? 36 /* EqualsEqualsEqualsToken */ : 37 /* ExclamationEqualsEqualsToken */), + factory2.createToken(invert ? 37 /* EqualsEqualsEqualsToken */ : 38 /* ExclamationEqualsEqualsToken */), factory2.createVoidZero() ) ); @@ -97434,7 +98014,7 @@ ${lanes.join("\n")} } const declaration = factory2.createVariableDeclaration( factory2.createUniqueName("_jsxFileName", 16 /* Optimistic */ | 32 /* FileLevel */), - /*exclaimationToken*/ + /*exclamationToken*/ void 0, /*type*/ void 0, @@ -97454,9 +98034,9 @@ ${lanes.join("\n")} return getImplicitImportForName("Fragment"); } function getImplicitImportForName(name) { - var _a2, _b; + var _a, _b; const importSource = name === "createElement" ? currentFileState.importSpecifier : getJSXRuntimeImport(currentFileState.importSpecifier, compilerOptions); - const existing = (_b = (_a2 = currentFileState.utilizedImplicitRuntimeImports) == null ? void 0 : _a2.get(importSource)) == null ? void 0 : _b.get(name); + const existing = (_b = (_a = currentFileState.utilizedImplicitRuntimeImports) == null ? void 0 : _a.get(importSource)) == null ? void 0 : _b.get(name); if (existing) { return existing.name; } @@ -97503,7 +98083,7 @@ ${lanes.join("\n")} /*modifiers*/ void 0, factory2.createImportClause( - /*typeOnly*/ + /*isTypeOnly*/ false, /*name*/ void 0, @@ -97526,12 +98106,12 @@ ${lanes.join("\n")} factory2.createVariableDeclarationList([ factory2.createVariableDeclaration( factory2.createObjectBindingPattern(arrayFrom(importSpecifiersMap.values(), (s) => factory2.createBindingElement( - /*dotdotdot*/ + /*dotDotDotToken*/ void 0, s.propertyName, s.name ))), - /*exclaimationToken*/ + /*exclamationToken*/ void 0, /*type*/ void 0, @@ -97569,25 +98149,25 @@ ${lanes.join("\n")} } function visitorWorker(node) { switch (node.kind) { - case 281 /* JsxElement */: + case 283 /* JsxElement */: return visitJsxElement( node, /*isChild*/ false ); - case 282 /* JsxSelfClosingElement */: + case 284 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement( node, /*isChild*/ false ); - case 285 /* JsxFragment */: + case 287 /* JsxFragment */: return visitJsxFragment( node, /*isChild*/ false ); - case 291 /* JsxExpression */: + case 293 /* JsxExpression */: return visitJsxExpression(node); default: return visitEachChild(node, visitor, context); @@ -97595,23 +98175,23 @@ ${lanes.join("\n")} } function transformJsxChildToExpression(node) { switch (node.kind) { - case 11 /* JsxText */: + case 12 /* JsxText */: return visitJsxText(node); - case 291 /* JsxExpression */: + case 293 /* JsxExpression */: return visitJsxExpression(node); - case 281 /* JsxElement */: + case 283 /* JsxElement */: return visitJsxElement( node, /*isChild*/ true ); - case 282 /* JsxSelfClosingElement */: + case 284 /* JsxSelfClosingElement */: return visitJsxSelfClosingElement( node, /*isChild*/ true ); - case 285 /* JsxFragment */: + case 287 /* JsxFragment */: return visitJsxFragment( node, /*isChild*/ @@ -97621,12 +98201,15 @@ ${lanes.join("\n")} return Debug.failBadSyntaxKind(node); } } + function hasProto(obj) { + return obj.properties.some((p) => isPropertyAssignment(p) && (isIdentifier(p.name) && idText(p.name) === "__proto__" || isStringLiteral(p.name) && p.name.text === "__proto__")); + } function hasKeyAfterPropsSpread(node) { let spread = false; for (const elem of node.attributes.properties) { - if (isJsxSpreadAttribute(elem)) { + if (isJsxSpreadAttribute(elem) && (!isObjectLiteralExpression(elem.expression) || elem.expression.properties.some(isSpreadAssignment))) { spread = true; - } else if (spread && isJsxAttribute(elem) && elem.name.escapedText === "key") { + } else if (spread && isJsxAttribute(elem) && isIdentifier(elem.name) && elem.name.escapedText === "key") { return true; } } @@ -97695,9 +98278,9 @@ ${lanes.join("\n")} ); } function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children, isChild, location) { - var _a2; + var _a; const nonWhitespaceChildren = getSemanticJsxChildren(children); - const isStaticChildren = length(nonWhitespaceChildren) > 1 || !!((_a2 = nonWhitespaceChildren[0]) == null ? void 0 : _a2.dotDotDotToken); + const isStaticChildren = length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) == null ? void 0 : _a.dotDotDotToken); const args = [tagName, objectProperties]; if (keyAttr) { args.push(transformJsxAttributeInitializer(keyAttr.initializer)); @@ -97790,7 +98373,10 @@ ${lanes.join("\n")} } return element; } - function transformJsxSpreadAttributeToSpreadAssignment(node) { + function transformJsxSpreadAttributeToProps(node) { + if (isObjectLiteralExpression(node.expression) && !hasProto(node.expression)) { + return node.expression.properties; + } return factory2.createSpreadAssignment(Debug.checkDefined(visitNode(node.expression, visitor, isExpression))); } function transformJsxAttributesToObjectProps(attrs, children) { @@ -97798,30 +98384,48 @@ ${lanes.join("\n")} return target && target >= 5 /* ES2018 */ ? factory2.createObjectLiteralExpression(transformJsxAttributesToProps(attrs, children)) : transformJsxAttributesToExpression(attrs, children); } function transformJsxAttributesToProps(attrs, children) { - const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToSpreadAssignment(attr) : transformJsxAttributeToObjectLiteralElement(attr)))); + const props = flatten(spanMap(attrs, isJsxSpreadAttribute, (attrs2, isSpread) => flatten(map(attrs2, (attr) => isSpread ? transformJsxSpreadAttributeToProps(attr) : transformJsxAttributeToObjectLiteralElement(attr))))); if (children) { props.push(children); } return props; } function transformJsxAttributesToExpression(attrs, children) { - const expressions = flatten( - spanMap( - attrs, - isJsxSpreadAttribute, - (attrs2, isSpread) => isSpread ? map(attrs2, transformJsxSpreadAttributeToExpression) : factory2.createObjectLiteralExpression(map(attrs2, transformJsxAttributeToObjectLiteralElement)) - ) - ); - if (isJsxSpreadAttribute(attrs[0])) { - expressions.unshift(factory2.createObjectLiteralExpression()); + const expressions = []; + let properties = []; + for (const attr of attrs) { + if (isJsxSpreadAttribute(attr)) { + if (isObjectLiteralExpression(attr.expression) && !hasProto(attr.expression)) { + for (const prop of attr.expression.properties) { + if (isSpreadAssignment(prop)) { + finishObjectLiteralIfNeeded(); + expressions.push(prop.expression); + continue; + } + properties.push(prop); + } + continue; + } + finishObjectLiteralIfNeeded(); + expressions.push(Debug.checkDefined(visitNode(attr.expression, visitor, isExpression))); + continue; + } + properties.push(transformJsxAttributeToObjectLiteralElement(attr)); } if (children) { - expressions.push(factory2.createObjectLiteralExpression([children])); + properties.push(children); + } + finishObjectLiteralIfNeeded(); + if (expressions.length && !isObjectLiteralExpression(expressions[0])) { + expressions.unshift(factory2.createObjectLiteralExpression()); } return singleOrUndefined(expressions) || emitHelpers().createAssignHelper(expressions); - } - function transformJsxSpreadAttributeToExpression(node) { - return Debug.checkDefined(visitNode(node.expression, visitor, isExpression)); + function finishObjectLiteralIfNeeded() { + if (properties.length) { + expressions.push(factory2.createObjectLiteralExpression(properties)); + properties = []; + } + } } function transformJsxAttributeToObjectLiteralElement(node) { const name = getAttributeName(node); @@ -97832,12 +98436,12 @@ ${lanes.join("\n")} if (node === void 0) { return factory2.createTrue(); } - if (node.kind === 10 /* StringLiteral */) { + if (node.kind === 11 /* StringLiteral */) { const singleQuote = node.singleQuote !== void 0 ? node.singleQuote : !isStringDoubleQuoted(node, currentSourceFile); const literal = factory2.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); return setTextRange(literal, node); } - if (node.kind === 291 /* JsxExpression */) { + if (node.kind === 293 /* JsxExpression */) { if (node.expression === void 0) { return factory2.createTrue(); } @@ -97911,25 +98515,26 @@ ${lanes.join("\n")} return decoded === text ? void 0 : decoded; } function getTagName(node) { - if (node.kind === 281 /* JsxElement */) { + if (node.kind === 283 /* JsxElement */) { return getTagName(node.openingElement); } else { - const name = node.tagName; - if (isIdentifier(name) && isIntrinsicJsxName(name.escapedText)) { - return factory2.createStringLiteral(idText(name)); + const tagName = node.tagName; + if (isIdentifier(tagName) && isIntrinsicJsxName(tagName.escapedText)) { + return factory2.createStringLiteral(idText(tagName)); + } else if (isJsxNamespacedName(tagName)) { + return factory2.createStringLiteral(idText(tagName.namespace) + ":" + idText(tagName.name)); } else { - return createExpressionFromEntityName(factory2, name); + return createExpressionFromEntityName(factory2, tagName); } } } function getAttributeName(node) { const name = node.name; - const text = idText(name); - if (/^[A-Za-z_]\w*$/.test(text)) { - return name; - } else { - return factory2.createStringLiteral(text); + if (isIdentifier(name)) { + const text = idText(name); + return /^[A-Za-z_]\w*$/.test(text) ? name : factory2.createStringLiteral(text); } + return factory2.createStringLiteral(idText(name.namespace) + ":" + idText(name.name)); } function visitJsxExpression(node) { const expression = visitNode(node.expression, visitor, isExpression); @@ -98217,7 +98822,7 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return visitBinaryExpression(node); default: return visitEachChild(node, visitor, context); @@ -98225,9 +98830,9 @@ ${lanes.join("\n")} } function visitBinaryExpression(node) { switch (node.operatorToken.kind) { - case 67 /* AsteriskAsteriskEqualsToken */: + case 68 /* AsteriskAsteriskEqualsToken */: return visitExponentiationAssignmentExpression(node); - case 42 /* AsteriskAsteriskToken */: + case 43 /* AsteriskAsteriskToken */: return visitExponentiationExpression(node); default: return visitEachChild(node, visitor, context); @@ -98351,7 +98956,7 @@ ${lanes.join("\n")} hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -32768 /* SubtreeFactsMask */ | ancestorFacts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { - return (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */) !== 0 && node.kind === 250 /* ReturnStatement */ && !node.expression; + return (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */) !== 0 && node.kind === 252 /* ReturnStatement */ && !node.expression; } function isOrMayContainReturnCompletion(node) { return node.transformFlags & 4194304 /* ContainsHoistedDeclarationOrCompletion */ && (isReturnStatement(node) || isIfStatement(node) || isWithStatement(node) || isSwitchStatement(node) || isCaseBlock(node) || isCaseClause(node) || isDefaultClause(node) || isTryStatement(node) || isCatchClause(node) || isLabeledStatement(node) || isIterationStatement( @@ -98406,7 +99011,7 @@ ${lanes.join("\n")} return node; } function callExpressionVisitor(node) { - if (node.kind === 106 /* SuperKeyword */) { + if (node.kind === 108 /* SuperKeyword */) { return visitSuperKeyword( /*isExpressionOfCall*/ true @@ -98416,124 +99021,124 @@ ${lanes.join("\n")} } function visitorWorker(node, expressionResultIsUnused2) { switch (node.kind) { - case 124 /* StaticKeyword */: + case 126 /* StaticKeyword */: return void 0; - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: return visitClassDeclaration(node); - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: return visitClassExpression(node); - case 166 /* Parameter */: + case 168 /* Parameter */: return visitParameter(node); - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: return visitArrowFunction(node); - case 215 /* FunctionExpression */: + case 217 /* FunctionExpression */: return visitFunctionExpression(node); - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: return visitVariableDeclaration(node); - case 79 /* Identifier */: + case 80 /* Identifier */: return visitIdentifier(node); - case 258 /* VariableDeclarationList */: + case 260 /* VariableDeclarationList */: return visitVariableDeclarationList(node); - case 252 /* SwitchStatement */: + case 254 /* SwitchStatement */: return visitSwitchStatement(node); - case 266 /* CaseBlock */: + case 268 /* CaseBlock */: return visitCaseBlock(node); - case 238 /* Block */: + case 240 /* Block */: return visitBlock( node, /*isFunctionBody*/ false ); - case 249 /* BreakStatement */: - case 248 /* ContinueStatement */: + case 251 /* BreakStatement */: + case 250 /* ContinueStatement */: return visitBreakOrContinueStatement(node); - case 253 /* LabeledStatement */: + case 255 /* LabeledStatement */: return visitLabeledStatement(node); - case 243 /* DoStatement */: - case 244 /* WhileStatement */: + case 245 /* DoStatement */: + case 246 /* WhileStatement */: return visitDoOrWhileStatement( node, /*outermostLabeledStatement*/ void 0 ); - case 245 /* ForStatement */: + case 247 /* ForStatement */: return visitForStatement( node, /*outermostLabeledStatement*/ void 0 ); - case 246 /* ForInStatement */: + case 248 /* ForInStatement */: return visitForInStatement( node, /*outermostLabeledStatement*/ void 0 ); - case 247 /* ForOfStatement */: + case 249 /* ForOfStatement */: return visitForOfStatement( node, /*outermostLabeledStatement*/ void 0 ); - case 241 /* ExpressionStatement */: + case 243 /* ExpressionStatement */: return visitExpressionStatement(node); - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 295 /* CatchClause */: + case 298 /* CatchClause */: return visitCatchClause(node); - case 300 /* ShorthandPropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 164 /* ComputedPropertyName */: + case 166 /* ComputedPropertyName */: return visitComputedPropertyName(node); - case 206 /* ArrayLiteralExpression */: + case 208 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 210 /* CallExpression */: + case 212 /* CallExpression */: return visitCallExpression(node); - case 211 /* NewExpression */: + case 213 /* NewExpression */: return visitNewExpression(node); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused2); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused2); - case 357 /* CommaListExpression */: + case 360 /* CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused2); - case 14 /* NoSubstitutionTemplateLiteral */: - case 15 /* TemplateHead */: - case 16 /* TemplateMiddle */: - case 17 /* TemplateTail */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 16 /* TemplateHead */: + case 17 /* TemplateMiddle */: + case 18 /* TemplateTail */: return visitTemplateLiteral(node); - case 10 /* StringLiteral */: + case 11 /* StringLiteral */: return visitStringLiteral(node); - case 8 /* NumericLiteral */: + case 9 /* NumericLiteral */: return visitNumericLiteral(node); - case 212 /* TaggedTemplateExpression */: + case 214 /* TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 225 /* TemplateExpression */: + case 227 /* TemplateExpression */: return visitTemplateExpression(node); - case 226 /* YieldExpression */: + case 228 /* YieldExpression */: return visitYieldExpression(node); - case 227 /* SpreadElement */: + case 229 /* SpreadElement */: return visitSpreadElement(node); - case 106 /* SuperKeyword */: + case 108 /* SuperKeyword */: return visitSuperKeyword( /*isExpressionOfCall*/ false ); - case 108 /* ThisKeyword */: + case 110 /* ThisKeyword */: return visitThisKeyword(node); - case 233 /* MetaProperty */: + case 235 /* MetaProperty */: return visitMetaProperty(node); - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: return visitMethodDeclaration(node); - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return visitAccessorDeclaration(node); - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: return visitVariableStatement(node); - case 250 /* ReturnStatement */: + case 252 /* ReturnStatement */: return visitReturnStatement(node); - case 219 /* VoidExpression */: + case 221 /* VoidExpression */: return visitVoidExpression(node); default: return visitEachChild(node, visitor, context); @@ -98641,13 +99246,13 @@ ${lanes.join("\n")} } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { - const jump = node.kind === 249 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; + const jump = node.kind === 251 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */; const canUseBreakOrContinue = node.label && convertedLoopState.labels && convertedLoopState.labels.get(idText(node.label)) || !node.label && convertedLoopState.allowedNonLabeledJumps & jump; if (!canUseBreakOrContinue) { let labelMarker; const label = node.label; if (!label) { - if (node.kind === 249 /* BreakStatement */) { + if (node.kind === 251 /* BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Break */; labelMarker = "break"; } else { @@ -98655,7 +99260,7 @@ ${lanes.join("\n")} labelMarker = "continue"; } } else { - if (node.kind === 249 /* BreakStatement */) { + if (node.kind === 251 /* BreakStatement */) { labelMarker = `break-${label.escapedText}`; setLabeledJump( convertedLoopState, @@ -98684,10 +99289,10 @@ ${lanes.join("\n")} if (i === 0) { expr = copyExpr; } else { - expr = factory2.createBinaryExpression(expr, 27 /* CommaToken */, copyExpr); + expr = factory2.createBinaryExpression(expr, 28 /* CommaToken */, copyExpr); } } - returnExpression = factory2.createBinaryExpression(expr, 27 /* CommaToken */, returnExpression); + returnExpression = factory2.createBinaryExpression(expr, 28 /* CommaToken */, returnExpression); } return factory2.createReturnStatement(returnExpression); } @@ -98723,11 +99328,6 @@ ${lanes.join("\n")} setOriginalNode(exportStatement, statement); statements.push(exportStatement); } - const emitFlags = getEmitFlags(node); - if ((emitFlags & 8388608 /* HasEndOfDeclarationMarker */) === 0) { - statements.push(factory2.createEndOfDeclarationMarker(node)); - setEmitFlags(statement, emitFlags | 8388608 /* HasEndOfDeclarationMarker */); - } return singleOrMany(statements); } function visitClassExpression(node) { @@ -98784,7 +99384,7 @@ ${lanes.join("\n")} addExtendsHelperIfNeeded(statements, node, extendsClauseElement); addConstructor(statements, node, constructorLikeName, extendsClauseElement); addClassMembers(statements, node); - const closingBraceLocation = createTokenRange(skipTrivia(currentText, node.members.end), 19 /* CloseBraceToken */); + const closingBraceLocation = createTokenRange(skipTrivia(currentText, node.members.end), 20 /* CloseBraceToken */); const outer = factory2.createPartiallyEmittedExpression(constructorLikeName); setTextRangeEnd(outer, closingBraceLocation.end); setEmitFlags(outer, 3072 /* NoComments */); @@ -98867,7 +99467,7 @@ ${lanes.join("\n")} return block; } function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) { - const isDerivedClass = !!extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* NullKeyword */; + const isDerivedClass = !!extendsClauseElement && skipOuterExpressions(extendsClauseElement.expression).kind !== 106 /* NullKeyword */; if (!constructor) return createDefaultConstructorBody(node, isDerivedClass); const prologue = []; @@ -98976,14 +99576,14 @@ ${lanes.join("\n")} }; } function isSufficientlyCoveredByReturnStatements(statement) { - if (statement.kind === 250 /* ReturnStatement */) { + if (statement.kind === 252 /* ReturnStatement */) { return true; - } else if (statement.kind === 242 /* IfStatement */) { + } else if (statement.kind === 244 /* IfStatement */) { const ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } - } else if (statement.kind === 238 /* Block */) { + } else if (statement.kind === 240 /* Block */) { const lastStatement = lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -99162,12 +99762,12 @@ ${lanes.join("\n")} if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) { return false; } - const declarationName = parameter.name.kind === 79 /* Identifier */ ? setParent(setTextRange(factory2.cloneNode(parameter.name), parameter.name), parameter.name.parent) : factory2.createTempVariable( + const declarationName = parameter.name.kind === 80 /* Identifier */ ? setParent(setTextRange(factory2.cloneNode(parameter.name), parameter.name), parameter.name.parent) : factory2.createTempVariable( /*recordTempVariable*/ void 0 ); setEmitFlags(declarationName, 96 /* NoSourceMap */); - const expressionName = parameter.name.kind === 79 /* Identifier */ ? factory2.cloneNode(parameter.name) : declarationName; + const expressionName = parameter.name.kind === 80 /* Identifier */ ? factory2.cloneNode(parameter.name) : declarationName; const restIndex = node.parameters.length - 1; const temp = factory2.createLoopVariable(); prologueStatements.push( @@ -99236,7 +99836,7 @@ ${lanes.join("\n")} setEmitFlags(forStatement, 2097152 /* CustomPrologue */); startOnNewLine(forStatement); prologueStatements.push(forStatement); - if (parameter.name.kind !== 79 /* Identifier */) { + if (parameter.name.kind !== 80 /* Identifier */) { prologueStatements.push( setEmitFlags( setTextRange( @@ -99257,7 +99857,7 @@ ${lanes.join("\n")} return true; } function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 65536 /* CapturedLexicalThis */ && node.kind !== 216 /* ArrowFunction */) { + if (hierarchyFacts & 65536 /* CapturedLexicalThis */ && node.kind !== 218 /* ArrowFunction */) { insertCaptureThisForNode(statements, node, factory2.createThis()); return true; } @@ -99268,7 +99868,7 @@ ${lanes.join("\n")} const assignSuperExpression = factory2.createExpressionStatement( factory2.createBinaryExpression( factory2.createThis(), - 63 /* EqualsToken */, + 64 /* EqualsToken */, superExpression ) ); @@ -99299,27 +99899,27 @@ ${lanes.join("\n")} if (hierarchyFacts & 32768 /* NewTarget */) { let newTarget; switch (node.kind) { - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: return statements; - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: newTarget = factory2.createVoidZero(); break; - case 173 /* Constructor */: + case 175 /* Constructor */: newTarget = factory2.createPropertyAccessExpression( setEmitFlags(factory2.createThis(), 8 /* NoSubstitution */), "constructor" ); break; - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: newTarget = factory2.createConditionalExpression( factory2.createLogicalAnd( setEmitFlags(factory2.createThis(), 8 /* NoSubstitution */), factory2.createBinaryExpression( setEmitFlags(factory2.createThis(), 8 /* NoSubstitution */), - 102 /* InstanceOfKeyword */, + 104 /* InstanceOfKeyword */, factory2.getLocalName(node) ) ), @@ -99362,21 +99962,21 @@ ${lanes.join("\n")} function addClassMembers(statements, node) { for (const member of node.members) { switch (member.kind) { - case 237 /* SemicolonClassElement */: + case 239 /* SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: const accessors = getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 173 /* Constructor */: - case 172 /* ClassStaticBlockDeclaration */: + case 175 /* Constructor */: + case 174 /* ClassStaticBlockDeclaration */: break; default: Debug.failBadSyntaxKind(member, currentSourceFile && currentSourceFile.fileName); @@ -99583,7 +100183,7 @@ ${lanes.join("\n")} const ancestorFacts = container && isClassLike(container) && !isStatic(node) ? enterSubtree(32670 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */) : enterSubtree(32670 /* FunctionExcludes */, 65 /* FunctionIncludes */); const parameters = visitParameterList(node.parameters, visitor, context); const body = transformFunctionBody2(node); - if (hierarchyFacts & 32768 /* NewTarget */ && !name && (node.kind === 259 /* FunctionDeclaration */ || node.kind === 215 /* FunctionExpression */)) { + if (hierarchyFacts & 32768 /* NewTarget */ && !name && (node.kind === 261 /* FunctionDeclaration */ || node.kind === 217 /* FunctionExpression */)) { name = factory2.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 98304 /* FunctionSubtreeExcludes */, 0 /* None */); @@ -99644,7 +100244,7 @@ ${lanes.join("\n")} multiLine = true; } } else { - Debug.assert(node.kind === 216 /* ArrowFunction */); + Debug.assert(node.kind === 218 /* ArrowFunction */); statementsLocation = moveRangeEnd(body, -1); const equalsGreaterThanToken = node.equalsGreaterThanToken; if (!nodeIsSynthesized(equalsGreaterThanToken) && !nodeIsSynthesized(body)) { @@ -99683,7 +100283,7 @@ ${lanes.join("\n")} setEmitFlags(block, 1 /* SingleLine */); } if (closeBraceLocation) { - setTokenSourceMapRange(block, 19 /* CloseBraceToken */, closeBraceLocation); + setTokenSourceMapRange(block, 20 /* CloseBraceToken */, closeBraceLocation); } setOriginalNode(block, node.body); return block; @@ -99713,7 +100313,7 @@ ${lanes.join("\n")} !expressionResultIsUnused2 ); } - if (node.operatorToken.kind === 27 /* CommaToken */) { + if (node.operatorToken.kind === 28 /* CommaToken */) { return factory2.updateBinaryExpression( node, Debug.checkDefined(visitNode(node.left, visitorWithUnusedExpressionResult, isExpression)), @@ -99760,7 +100360,7 @@ ${lanes.join("\n")} 0 /* All */ ); } else { - assignment = factory2.createBinaryExpression(decl.name, 63 /* EqualsToken */, Debug.checkDefined(visitNode(decl.initializer, visitor, isExpression))); + assignment = factory2.createBinaryExpression(decl.name, 64 /* EqualsToken */, Debug.checkDefined(visitNode(decl.initializer, visitor, isExpression))); setTextRange(assignment, decl); } assignments = append(assignments, assignment); @@ -99837,7 +100437,7 @@ ${lanes.join("\n")} visitor, context, 0 /* All */, - /*value*/ + /*rval*/ void 0, (ancestorFacts & 32 /* ExportedVariableStatement */) !== 0 ); @@ -99870,14 +100470,14 @@ ${lanes.join("\n")} } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 243 /* DoStatement */: - case 244 /* WhileStatement */: + case 245 /* DoStatement */: + case 246 /* WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 245 /* ForStatement */: + case 247 /* ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 246 /* ForInStatement */: + case 248 /* ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 247 /* ForOfStatement */: + case 249 /* ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -100227,7 +100827,7 @@ ${lanes.join("\n")} let numInitialProperties = -1, hasComputed = false; for (let i = 0; i < properties.length; i++) { const property = properties[i]; - if (property.transformFlags & 1048576 /* ContainsYield */ && hierarchyFacts & 4 /* AsyncFunctionBody */ || (hasComputed = Debug.checkDefined(property.name).kind === 164 /* ComputedPropertyName */)) { + if (property.transformFlags & 1048576 /* ContainsYield */ && hierarchyFacts & 4 /* AsyncFunctionBody */ || (hasComputed = Debug.checkDefined(property.name).kind === 166 /* ComputedPropertyName */)) { numInitialProperties = i; break; } @@ -100279,7 +100879,7 @@ ${lanes.join("\n")} } visit(node.name); function visit(node2) { - if (node2.kind === 79 /* Identifier */) { + if (node2.kind === 80 /* Identifier */) { state.hoistedLocalVariables.push(node2); } else { for (const element of node2.elements) { @@ -100349,15 +100949,15 @@ ${lanes.join("\n")} } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 245 /* ForStatement */: + case 247 /* ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 246 /* ForInStatement */: + case 248 /* ForInStatement */: return convertForInStatement(node, convertedLoopBody); - case 247 /* ForOfStatement */: + case 249 /* ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); - case 243 /* DoStatement */: + case 245 /* DoStatement */: return convertDoStatement(node, convertedLoopBody); - case 244 /* WhileStatement */: + case 246 /* WhileStatement */: return convertWhileStatement(node, convertedLoopBody); default: return Debug.failBadSyntaxKind(node, "IterationStatement expected"); @@ -100409,11 +101009,11 @@ ${lanes.join("\n")} function createConvertedLoopState(node) { let loopInitializer; switch (node.kind) { - case 245 /* ForStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: + case 247 /* ForStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: const initializer = node.initializer; - if (initializer && initializer.kind === 258 /* VariableDeclarationList */) { + if (initializer && initializer.kind === 260 /* VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -100555,7 +101155,7 @@ ${lanes.join("\n")} factory2.createFunctionExpression( /*modifiers*/ void 0, - containsYield ? factory2.createToken(41 /* AsteriskToken */) : void 0, + containsYield ? factory2.createToken(42 /* AsteriskToken */) : void 0, /*name*/ void 0, /*typeParameters*/ @@ -100606,7 +101206,7 @@ ${lanes.join("\n")} } if (shouldConvertConditionOfForStatement(node)) { statements.push(factory2.createIfStatement( - factory2.createPrefixUnaryExpression(53 /* ExclamationToken */, Debug.checkDefined(visitNode(node.condition, visitor, isExpression))), + factory2.createPrefixUnaryExpression(54 /* ExclamationToken */, Debug.checkDefined(visitNode(node.condition, visitor, isExpression))), Debug.checkDefined(visitNode(factory2.createBreakStatement(), visitor, isStatement)) )); } @@ -100648,7 +101248,7 @@ ${lanes.join("\n")} factory2.createFunctionExpression( /*modifiers*/ void 0, - containsYield ? factory2.createToken(41 /* AsteriskToken */) : void 0, + containsYield ? factory2.createToken(42 /* AsteriskToken */) : void 0, /*name*/ void 0, /*typeParameters*/ @@ -100672,7 +101272,7 @@ ${lanes.join("\n")} function copyOutParameter(outParam, copyDirection) { const source = copyDirection === 0 /* ToOriginal */ ? outParam.outParamName : outParam.originalName; const target = copyDirection === 0 /* ToOriginal */ ? outParam.originalName : outParam.outParamName; - return factory2.createBinaryExpression(target, 63 /* EqualsToken */, source); + return factory2.createBinaryExpression(target, 64 /* EqualsToken */, source); } function copyOutParameters(outParams, partFlags, copyDirection, statements) { for (const outParam of outParams) { @@ -100689,8 +101289,8 @@ ${lanes.join("\n")} [] ); const callResult = containsYield ? factory2.createYieldExpression( - factory2.createToken(41 /* AsteriskToken */), - setEmitFlags(call, 16777216 /* Iterator */) + factory2.createToken(42 /* AsteriskToken */), + setEmitFlags(call, 8388608 /* Iterator */) ) : call; return factory2.createExpressionStatement(callResult); } @@ -100704,8 +101304,8 @@ ${lanes.join("\n")} map(state.loopParameters, (p) => p.name) ); const callResult = containsYield ? factory2.createYieldExpression( - factory2.createToken(41 /* AsteriskToken */), - setEmitFlags(call, 16777216 /* Iterator */) + factory2.createToken(42 /* AsteriskToken */), + setEmitFlags(call, 8388608 /* Iterator */) ) : call; if (isSimpleLoop) { statements.push(factory2.createExpressionStatement(callResult)); @@ -100852,20 +101452,20 @@ ${lanes.join("\n")} for (let i = start; i < numProperties; i++) { const property = properties[i]; switch (property.kind) { - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: const accessors = getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 300 /* ShorthandPropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -100991,7 +101591,7 @@ ${lanes.join("\n")} let updated; const parameters = visitParameterList(node.parameters, visitor, context); const body = transformFunctionBody2(node); - if (node.kind === 174 /* GetAccessor */) { + if (node.kind === 176 /* GetAccessor */) { updated = factory2.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); } else { updated = factory2.updateSetAccessorDeclaration(node, node.modifiers, node.name, parameters, body); @@ -101034,7 +101634,7 @@ ${lanes.join("\n")} return visitTypeScriptClassWrapper(node); } const expression = skipOuterExpressions(node.expression); - if (expression.kind === 106 /* SuperKeyword */ || isSuperProperty(expression) || some(node.arguments, isSpreadElement)) { + if (expression.kind === 108 /* SuperKeyword */ || isSuperProperty(expression) || some(node.arguments, isSpreadElement)) { return visitCallExpressionWithPotentialCapturedThisAssignment( node, /*assignToCapturedThis*/ @@ -101062,7 +101662,7 @@ ${lanes.join("\n")} const variable = varStatement.declarationList.declarations[0]; const initializer = skipOuterExpressions(variable.initializer); let aliasAssignment = tryCast(initializer, isAssignmentExpression); - if (!aliasAssignment && isBinaryExpression(initializer) && initializer.operatorToken.kind === 27 /* CommaToken */) { + if (!aliasAssignment && isBinaryExpression(initializer) && initializer.operatorToken.kind === 28 /* CommaToken */) { aliasAssignment = tryCast(initializer.left, isAssignmentExpression); } const call = cast(aliasAssignment ? skipOuterExpressions(aliasAssignment.right) : initializer, isCallExpression); @@ -101154,16 +101754,16 @@ ${lanes.join("\n")} ); } function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) { - if (node.transformFlags & 32768 /* ContainsRestOrSpread */ || node.expression.kind === 106 /* SuperKeyword */ || isSuperProperty(skipOuterExpressions(node.expression))) { + if (node.transformFlags & 32768 /* ContainsRestOrSpread */ || node.expression.kind === 108 /* SuperKeyword */ || isSuperProperty(skipOuterExpressions(node.expression))) { const { target, thisArg } = factory2.createCallBinding(node.expression, hoistVariableDeclaration); - if (node.expression.kind === 106 /* SuperKeyword */) { + if (node.expression.kind === 108 /* SuperKeyword */) { setEmitFlags(thisArg, 8 /* NoSubstitution */); } let resultingCall; if (node.transformFlags & 32768 /* ContainsRestOrSpread */) { resultingCall = factory2.createFunctionApplyCall( Debug.checkDefined(visitNode(target, callExpressionVisitor, isExpression)), - node.expression.kind === 106 /* SuperKeyword */ ? thisArg : Debug.checkDefined(visitNode(thisArg, visitor, isExpression)), + node.expression.kind === 108 /* SuperKeyword */ ? thisArg : Debug.checkDefined(visitNode(thisArg, visitor, isExpression)), transformAndSpreadElements( node.arguments, /*isArgumentList*/ @@ -101178,13 +101778,13 @@ ${lanes.join("\n")} resultingCall = setTextRange( factory2.createFunctionCallCall( Debug.checkDefined(visitNode(target, callExpressionVisitor, isExpression)), - node.expression.kind === 106 /* SuperKeyword */ ? thisArg : Debug.checkDefined(visitNode(thisArg, visitor, isExpression)), + node.expression.kind === 108 /* SuperKeyword */ ? thisArg : Debug.checkDefined(visitNode(thisArg, visitor, isExpression)), visitNodes2(node.arguments, visitor, isExpression) ), node ); } - if (node.expression.kind === 106 /* SuperKeyword */) { + if (node.expression.kind === 108 /* SuperKeyword */) { const initializer = factory2.createLogicalOr( resultingCall, createActualThis() @@ -101327,7 +101927,7 @@ ${lanes.join("\n")} return hierarchyFacts & 8 /* NonStaticClassElement */ && !isExpressionOfCall ? factory2.createPropertyAccessExpression(factory2.createUniqueName("_super", 16 /* Optimistic */ | 32 /* FileLevel */), "prototype") : factory2.createUniqueName("_super", 16 /* Optimistic */ | 32 /* FileLevel */); } function visitMetaProperty(node) { - if (node.keywordToken === 103 /* NewKeyword */ && node.name.escapedText === "target") { + if (node.keywordToken === 105 /* NewKeyword */ && node.name.escapedText === "target") { hierarchyFacts |= 32768 /* NewTarget */; return factory2.createUniqueName("_newTarget", 16 /* Optimistic */ | 32 /* FileLevel */); } @@ -101348,20 +101948,20 @@ ${lanes.join("\n")} function enableSubstitutionsForBlockScopedBindings() { if ((enabledSubstitutions & 2 /* BlockScopedBindings */) === 0) { enabledSubstitutions |= 2 /* BlockScopedBindings */; - context.enableSubstitution(79 /* Identifier */); + context.enableSubstitution(80 /* Identifier */); } } function enableSubstitutionsForCapturedThis() { if ((enabledSubstitutions & 1 /* CapturedThis */) === 0) { enabledSubstitutions |= 1 /* CapturedThis */; - context.enableSubstitution(108 /* ThisKeyword */); - context.enableEmitNotification(173 /* Constructor */); - context.enableEmitNotification(171 /* MethodDeclaration */); - context.enableEmitNotification(174 /* GetAccessor */); - context.enableEmitNotification(175 /* SetAccessor */); - context.enableEmitNotification(216 /* ArrowFunction */); - context.enableEmitNotification(215 /* FunctionExpression */); - context.enableEmitNotification(259 /* FunctionDeclaration */); + context.enableSubstitution(110 /* ThisKeyword */); + context.enableEmitNotification(175 /* Constructor */); + context.enableEmitNotification(173 /* MethodDeclaration */); + context.enableEmitNotification(176 /* GetAccessor */); + context.enableEmitNotification(177 /* SetAccessor */); + context.enableEmitNotification(218 /* ArrowFunction */); + context.enableEmitNotification(217 /* FunctionExpression */); + context.enableEmitNotification(261 /* FunctionDeclaration */); } } function onSubstituteNode(hint, node) { @@ -101385,19 +101985,19 @@ ${lanes.join("\n")} } function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 205 /* BindingElement */: - case 260 /* ClassDeclaration */: - case 263 /* EnumDeclaration */: - case 257 /* VariableDeclaration */: + case 207 /* BindingElement */: + case 262 /* ClassDeclaration */: + case 265 /* EnumDeclaration */: + case 259 /* VariableDeclaration */: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } return false; } function substituteExpression(node) { switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return substituteExpressionIdentifier(node); - case 108 /* ThisKeyword */: + case 110 /* ThisKeyword */: return substituteThisKeyword(node); } return node; @@ -101445,19 +102045,19 @@ ${lanes.join("\n")} return false; } const statement = firstOrUndefined(constructor.body.statements); - if (!statement || !nodeIsSynthesized(statement) || statement.kind !== 241 /* ExpressionStatement */) { + if (!statement || !nodeIsSynthesized(statement) || statement.kind !== 243 /* ExpressionStatement */) { return false; } const statementExpression = statement.expression; - if (!nodeIsSynthesized(statementExpression) || statementExpression.kind !== 210 /* CallExpression */) { + if (!nodeIsSynthesized(statementExpression) || statementExpression.kind !== 212 /* CallExpression */) { return false; } const callTarget = statementExpression.expression; - if (!nodeIsSynthesized(callTarget) || callTarget.kind !== 106 /* SuperKeyword */) { + if (!nodeIsSynthesized(callTarget) || callTarget.kind !== 108 /* SuperKeyword */) { return false; } const callArgument = singleOrUndefined(statementExpression.arguments); - if (!callArgument || !nodeIsSynthesized(callArgument) || callArgument.kind !== 227 /* SpreadElement */) { + if (!callArgument || !nodeIsSynthesized(callArgument) || callArgument.kind !== 229 /* SpreadElement */) { return false; } const expression = callArgument.expression; @@ -101480,24 +102080,24 @@ ${lanes.join("\n")} if (compilerOptions.jsx === 1 /* Preserve */ || compilerOptions.jsx === 3 /* ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(283 /* JsxOpeningElement */); - context.enableEmitNotification(284 /* JsxClosingElement */); - context.enableEmitNotification(282 /* JsxSelfClosingElement */); + context.enableEmitNotification(285 /* JsxOpeningElement */); + context.enableEmitNotification(286 /* JsxClosingElement */); + context.enableEmitNotification(284 /* JsxSelfClosingElement */); noSubstitution = []; } const previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(208 /* PropertyAccessExpression */); - context.enableSubstitution(299 /* PropertyAssignment */); + context.enableSubstitution(210 /* PropertyAccessExpression */); + context.enableSubstitution(302 /* PropertyAssignment */); return chainBundle(context, transformSourceFile); function transformSourceFile(node) { return node; } function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 283 /* JsxOpeningElement */: - case 284 /* JsxClosingElement */: - case 282 /* JsxSelfClosingElement */: + case 285 /* JsxOpeningElement */: + case 286 /* JsxClosingElement */: + case 284 /* JsxSelfClosingElement */: const tagName = node.tagName; noSubstitution[getOriginalNodeId(tagName)] = true; break; @@ -101535,7 +102135,7 @@ ${lanes.join("\n")} } function trySubstituteReservedName(name) { const token = identifierToKeywordKind(name); - if (token !== void 0 && token >= 81 /* FirstReservedWord */ && token <= 116 /* LastReservedWord */) { + if (token !== void 0 && token >= 83 /* FirstReservedWord */ && token <= 118 /* LastReservedWord */) { return setTextRange(factory2.createStringLiteralFromNode(name), name); } return void 0; @@ -101629,13 +102229,13 @@ ${lanes.join("\n")} } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 243 /* DoStatement */: + case 245 /* DoStatement */: return visitDoStatement(node); - case 244 /* WhileStatement */: + case 246 /* WhileStatement */: return visitWhileStatement(node); - case 252 /* SwitchStatement */: + case 254 /* SwitchStatement */: return visitSwitchStatement(node); - case 253 /* LabeledStatement */: + case 255 /* LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -101643,24 +102243,24 @@ ${lanes.join("\n")} } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 215 /* FunctionExpression */: + case 217 /* FunctionExpression */: return visitFunctionExpression(node); - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return visitAccessorDeclaration(node); - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: return visitVariableStatement(node); - case 245 /* ForStatement */: + case 247 /* ForStatement */: return visitForStatement(node); - case 246 /* ForInStatement */: + case 248 /* ForInStatement */: return visitForInStatement(node); - case 249 /* BreakStatement */: + case 251 /* BreakStatement */: return visitBreakStatement(node); - case 248 /* ContinueStatement */: + case 250 /* ContinueStatement */: return visitContinueStatement(node); - case 250 /* ReturnStatement */: + case 252 /* ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 1048576 /* ContainsYield */) { @@ -101674,23 +102274,23 @@ ${lanes.join("\n")} } function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return visitBinaryExpression(node); - case 357 /* CommaListExpression */: + case 360 /* CommaListExpression */: return visitCommaListExpression(node); - case 224 /* ConditionalExpression */: + case 226 /* ConditionalExpression */: return visitConditionalExpression(node); - case 226 /* YieldExpression */: + case 228 /* YieldExpression */: return visitYieldExpression(node); - case 206 /* ArrayLiteralExpression */: + case 208 /* ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: return visitElementAccessExpression(node); - case 210 /* CallExpression */: + case 212 /* CallExpression */: return visitCallExpression(node); - case 211 /* NewExpression */: + case 213 /* NewExpression */: return visitNewExpression(node); default: return visitEachChild(node, visitor, context); @@ -101698,9 +102298,9 @@ ${lanes.join("\n")} } function visitGenerator(node) { switch (node.kind) { - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 215 /* FunctionExpression */: + case 217 /* FunctionExpression */: return visitFunctionExpression(node); default: return Debug.failBadSyntaxKind(node); @@ -101885,14 +102485,14 @@ ${lanes.join("\n")} if (containsYield(right)) { let target; switch (left.kind) { - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: target = factory2.updatePropertyAccessExpression( left, cacheExpression(Debug.checkDefined(visitNode(left.expression, visitor, isLeftHandSideExpression))), left.name ); break; - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: target = factory2.updateElementAccessExpression( left, cacheExpression(Debug.checkDefined(visitNode(left.expression, visitor, isLeftHandSideExpression))), @@ -101929,7 +102529,7 @@ ${lanes.join("\n")} if (containsYield(node.right)) { if (isLogicalOperator(node.operatorToken.kind)) { return visitLogicalBinaryExpression(node); - } else if (node.operatorToken.kind === 27 /* CommaToken */) { + } else if (node.operatorToken.kind === 28 /* CommaToken */) { return visitCommaExpression(node); } return factory2.updateBinaryExpression( @@ -101947,7 +102547,7 @@ ${lanes.join("\n")} visit(node.right); return factory2.inlineExpressions(pendingExpressions); function visit(node2) { - if (isBinaryExpression(node2) && node2.operatorToken.kind === 27 /* CommaToken */) { + if (isBinaryExpression(node2) && node2.operatorToken.kind === 28 /* CommaToken */) { visit(node2.left); visit(node2.right); } else { @@ -101962,7 +102562,7 @@ ${lanes.join("\n")} function visitCommaListExpression(node) { let pendingExpressions = []; for (const elem of node.elements) { - if (isBinaryExpression(elem) && elem.operatorToken.kind === 27 /* CommaToken */) { + if (isBinaryExpression(elem) && elem.operatorToken.kind === 28 /* CommaToken */) { pendingExpressions.push(visitCommaExpression(elem)); } else { if (containsYield(elem) && pendingExpressions.length > 0) { @@ -101983,7 +102583,7 @@ ${lanes.join("\n")} /*location*/ node.left ); - if (node.operatorToken.kind === 55 /* AmpersandAmpersandToken */) { + if (node.operatorToken.kind === 56 /* AmpersandAmpersandToken */) { emitBreakWhenFalse( resultLabel, resultLocal, @@ -102041,7 +102641,7 @@ ${lanes.join("\n")} const resumeLabel = defineLabel(); const expression = visitNode(node.expression, visitor, isExpression); if (node.asteriskToken) { - const iterator = (getEmitFlags(node.expression) & 16777216 /* Iterator */) === 0 ? setTextRange(emitHelpers().createValuesHelper(expression), node) : expression; + const iterator = (getEmitFlags(node.expression) & 8388608 /* Iterator */) === 0 ? setTextRange(emitHelpers().createValuesHelper(expression), node) : expression; emitYieldStar( iterator, /*location*/ @@ -102225,35 +102825,35 @@ ${lanes.join("\n")} } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 238 /* Block */: + case 240 /* Block */: return transformAndEmitBlock(node); - case 241 /* ExpressionStatement */: + case 243 /* ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 242 /* IfStatement */: + case 244 /* IfStatement */: return transformAndEmitIfStatement(node); - case 243 /* DoStatement */: + case 245 /* DoStatement */: return transformAndEmitDoStatement(node); - case 244 /* WhileStatement */: + case 246 /* WhileStatement */: return transformAndEmitWhileStatement(node); - case 245 /* ForStatement */: + case 247 /* ForStatement */: return transformAndEmitForStatement(node); - case 246 /* ForInStatement */: + case 248 /* ForInStatement */: return transformAndEmitForInStatement(node); - case 248 /* ContinueStatement */: + case 250 /* ContinueStatement */: return transformAndEmitContinueStatement(node); - case 249 /* BreakStatement */: + case 251 /* BreakStatement */: return transformAndEmitBreakStatement(node); - case 250 /* ReturnStatement */: + case 252 /* ReturnStatement */: return transformAndEmitReturnStatement(node); - case 251 /* WithStatement */: + case 253 /* WithStatement */: return transformAndEmitWithStatement(node); - case 252 /* SwitchStatement */: + case 254 /* SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 253 /* LabeledStatement */: + case 255 /* LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 254 /* ThrowStatement */: + case 256 /* ThrowStatement */: return transformAndEmitThrowStatement(node); - case 255 /* TryStatement */: + case 257 /* TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(visitNode(node, visitor, isStatement)); @@ -102477,7 +103077,7 @@ ${lanes.join("\n")} markLabel(conditionLabel); emitBreakWhenFalse(endLoopLabel, factory2.createLessThan(keysIndex, factory2.createPropertyAccessExpression(keysArray, "length"))); emitAssignment(key, factory2.createElementAccessExpression(keysArray, keysIndex)); - emitBreakWhenFalse(incrementLabel, factory2.createBinaryExpression(key, 101 /* InKeyword */, obj)); + emitBreakWhenFalse(incrementLabel, factory2.createBinaryExpression(key, 103 /* InKeyword */, obj)); let variable; if (isVariableDeclarationList(initializer)) { for (const variable2 of initializer.declarations) { @@ -102605,7 +103205,7 @@ ${lanes.join("\n")} for (let i = 0; i < numClauses; i++) { const clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 293 /* DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 296 /* DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -102615,7 +103215,7 @@ ${lanes.join("\n")} let defaultClausesSkipped = 0; for (let i = clausesWritten; i < numClauses; i++) { const clause = caseBlock.clauses[i]; - if (clause.kind === 292 /* CaseClause */) { + if (clause.kind === 295 /* CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -102689,9 +103289,8 @@ ${lanes.join("\n")} return node; } function transformAndEmitThrowStatement(node) { - var _a2; emitThrow( - Debug.checkDefined(visitNode((_a2 = node.expression) != null ? _a2 : factory2.createVoidZero(), visitor, isExpression)), + Debug.checkDefined(visitNode(node.expression ?? factory2.createVoidZero(), visitor, isExpression)), /*location*/ node ); @@ -102863,7 +103462,7 @@ ${lanes.join("\n")} if (!renamedCatchVariables) { renamedCatchVariables = /* @__PURE__ */ new Map(); renamedCatchVariableDeclarations = []; - context.enableSubstitution(79 /* Identifier */); + context.enableSubstitution(80 /* Identifier */); } renamedCatchVariables.set(text, true); renamedCatchVariableDeclarations[getOriginalNodeId(variable)] = name; @@ -103589,14 +104188,13 @@ ${lanes.join("\n")} const previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(210 /* CallExpression */); - context.enableSubstitution(212 /* TaggedTemplateExpression */); - context.enableSubstitution(79 /* Identifier */); - context.enableSubstitution(223 /* BinaryExpression */); - context.enableSubstitution(300 /* ShorthandPropertyAssignment */); - context.enableEmitNotification(308 /* SourceFile */); + context.enableSubstitution(212 /* CallExpression */); + context.enableSubstitution(214 /* TaggedTemplateExpression */); + context.enableSubstitution(80 /* Identifier */); + context.enableSubstitution(225 /* BinaryExpression */); + context.enableSubstitution(303 /* ShorthandPropertyAssignment */); + context.enableEmitNotification(311 /* SourceFile */); const moduleInfoMap = []; - const deferredExports = []; let currentSourceFile; let currentModuleInfo; const noSubstitution = []; @@ -104007,24 +104605,64 @@ ${lanes.join("\n")} } function topLevelVisitor(node) { switch (node.kind) { - case 269 /* ImportDeclaration */: + case 271 /* ImportDeclaration */: return visitImportDeclaration(node); - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: return visitExportDeclaration(node); - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: return visitExportAssignment(node); - case 240 /* VariableStatement */: - return visitVariableStatement(node); - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: return visitClassDeclaration(node); - case 358 /* MergeDeclarationMarker */: - return visitMergeDeclarationMarker(node); - case 359 /* EndOfDeclarationMarker */: - return visitEndOfDeclarationMarker(node); + default: + return topLevelNestedVisitor(node); + } + } + function topLevelNestedVisitor(node) { + switch (node.kind) { + case 242 /* VariableStatement */: + return visitVariableStatement(node); + case 261 /* FunctionDeclaration */: + return visitFunctionDeclaration(node); + case 262 /* ClassDeclaration */: + return visitClassDeclaration(node); + case 247 /* ForStatement */: + return visitForStatement( + node, + /*isTopLevel*/ + true + ); + case 248 /* ForInStatement */: + return visitForInStatement(node); + case 249 /* ForOfStatement */: + return visitForOfStatement(node); + case 245 /* DoStatement */: + return visitDoStatement(node); + case 246 /* WhileStatement */: + return visitWhileStatement(node); + case 255 /* LabeledStatement */: + return visitLabeledStatement(node); + case 253 /* WithStatement */: + return visitWithStatement(node); + case 244 /* IfStatement */: + return visitIfStatement(node); + case 254 /* SwitchStatement */: + return visitSwitchStatement(node); + case 268 /* CaseBlock */: + return visitCaseBlock(node); + case 295 /* CaseClause */: + return visitCaseClause(node); + case 296 /* DefaultClause */: + return visitDefaultClause(node); + case 257 /* TryStatement */: + return visitTryStatement(node); + case 298 /* CatchClause */: + return visitCatchClause(node); + case 240 /* Block */: + return visitBlock(node); default: return visitor(node); } @@ -104034,26 +104672,30 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 245 /* ForStatement */: - return visitForStatement(node); - case 241 /* ExpressionStatement */: + case 247 /* ForStatement */: + return visitForStatement( + node, + /*isTopLevel*/ + false + ); + case 243 /* ExpressionStatement */: return visitExpressionStatement(node); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 356 /* PartiallyEmittedExpression */: + case 359 /* PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 210 /* CallExpression */: + case 212 /* CallExpression */: if (isImportCall(node) && currentSourceFile.impliedNodeFormat === void 0) { return visitImportCallExpression(node); } break; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: if (isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 221 /* PrefixUnaryExpression */: - case 222 /* PostfixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } return visitEachChild(node, visitor, context); @@ -104076,24 +104718,24 @@ ${lanes.join("\n")} if (isObjectLiteralExpression(node)) { for (const elem of node.properties) { switch (elem.kind) { - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 300 /* ShorthandPropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 301 /* SpreadAssignment */: + case 304 /* SpreadAssignment */: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return false; default: Debug.assertNever(elem, "Unhandled object member kind"); @@ -104120,15 +104762,177 @@ ${lanes.join("\n")} } return visitEachChild(node, visitor, context); } - function visitForStatement(node) { + function visitForStatement(node, isTopLevel) { + if (isTopLevel && node.initializer && isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) { + const exportStatements = appendExportsOfVariableDeclarationList( + /*statements*/ + void 0, + node.initializer, + /*isForInOrOfInitializer*/ + false + ); + if (exportStatements) { + const statements = []; + const varDeclList = visitNode(node.initializer, discardedValueVisitor, isVariableDeclarationList); + const varStatement = factory2.createVariableStatement( + /*modifiers*/ + void 0, + varDeclList + ); + statements.push(varStatement); + addRange(statements, exportStatements); + const condition = visitNode(node.condition, visitor, isExpression); + const incrementor = visitNode(node.incrementor, discardedValueVisitor, isExpression); + const body = visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context); + statements.push(factory2.updateForStatement( + node, + /*initializer*/ + void 0, + condition, + incrementor, + body + )); + return statements; + } + } return factory2.updateForStatement( node, visitNode(node.initializer, discardedValueVisitor, isForInitializer), visitNode(node.condition, visitor, isExpression), visitNode(node.incrementor, discardedValueVisitor, isExpression), - visitIterationBody(node.statement, visitor, context) + visitIterationBody(node.statement, isTopLevel ? topLevelNestedVisitor : visitor, context) ); } + function visitForInStatement(node) { + if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) { + const exportStatements = appendExportsOfVariableDeclarationList( + /*statements*/ + void 0, + node.initializer, + /*isForInOrOfInitializer*/ + true + ); + if (some(exportStatements)) { + const initializer = visitNode(node.initializer, discardedValueVisitor, isForInitializer); + const expression = visitNode(node.expression, visitor, isExpression); + const body = visitIterationBody(node.statement, topLevelNestedVisitor, context); + const mergedBody = isBlock(body) ? factory2.updateBlock(body, [...exportStatements, ...body.statements]) : factory2.createBlock( + [...exportStatements, body], + /*multiLine*/ + true + ); + return factory2.updateForInStatement(node, initializer, expression, mergedBody); + } + } + return factory2.updateForInStatement( + node, + visitNode(node.initializer, discardedValueVisitor, isForInitializer), + visitNode(node.expression, visitor, isExpression), + visitIterationBody(node.statement, topLevelNestedVisitor, context) + ); + } + function visitForOfStatement(node) { + if (isVariableDeclarationList(node.initializer) && !(node.initializer.flags & 3 /* BlockScoped */)) { + const exportStatements = appendExportsOfVariableDeclarationList( + /*statements*/ + void 0, + node.initializer, + /*isForInOrOfInitializer*/ + true + ); + const initializer = visitNode(node.initializer, discardedValueVisitor, isForInitializer); + const expression = visitNode(node.expression, visitor, isExpression); + let body = visitIterationBody(node.statement, topLevelNestedVisitor, context); + if (some(exportStatements)) { + body = isBlock(body) ? factory2.updateBlock(body, [...exportStatements, ...body.statements]) : factory2.createBlock( + [...exportStatements, body], + /*multiLine*/ + true + ); + } + return factory2.updateForOfStatement(node, node.awaitModifier, initializer, expression, body); + } + return factory2.updateForOfStatement( + node, + node.awaitModifier, + visitNode(node.initializer, discardedValueVisitor, isForInitializer), + visitNode(node.expression, visitor, isExpression), + visitIterationBody(node.statement, topLevelNestedVisitor, context) + ); + } + function visitDoStatement(node) { + return factory2.updateDoStatement( + node, + visitIterationBody(node.statement, topLevelNestedVisitor, context), + visitNode(node.expression, visitor, isExpression) + ); + } + function visitWhileStatement(node) { + return factory2.updateWhileStatement( + node, + visitNode(node.expression, visitor, isExpression), + visitIterationBody(node.statement, topLevelNestedVisitor, context) + ); + } + function visitLabeledStatement(node) { + return factory2.updateLabeledStatement( + node, + node.label, + Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)) + ); + } + function visitWithStatement(node) { + return factory2.updateWithStatement( + node, + visitNode(node.expression, visitor, isExpression), + Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)) + ); + } + function visitIfStatement(node) { + return factory2.updateIfStatement( + node, + visitNode(node.expression, visitor, isExpression), + Debug.checkDefined(visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)), + visitNode(node.elseStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) + ); + } + function visitSwitchStatement(node) { + return factory2.updateSwitchStatement( + node, + visitNode(node.expression, visitor, isExpression), + Debug.checkDefined(visitNode(node.caseBlock, topLevelNestedVisitor, isCaseBlock)) + ); + } + function visitCaseBlock(node) { + return factory2.updateCaseBlock( + node, + visitNodes2(node.clauses, topLevelNestedVisitor, isCaseOrDefaultClause) + ); + } + function visitCaseClause(node) { + return factory2.updateCaseClause( + node, + visitNode(node.expression, visitor, isExpression), + visitNodes2(node.statements, topLevelNestedVisitor, isStatement) + ); + } + function visitDefaultClause(node) { + return visitEachChild(node, topLevelNestedVisitor, context); + } + function visitTryStatement(node) { + return visitEachChild(node, topLevelNestedVisitor, context); + } + function visitCatchClause(node) { + return factory2.updateCatchClause( + node, + node.variableDeclaration, + Debug.checkDefined(visitNode(node.block, topLevelNestedVisitor, isBlock)) + ); + } + function visitBlock(node) { + node = visitEachChild(node, topLevelNestedVisitor, context); + return node; + } function visitExpressionStatement(node) { return factory2.updateExpressionStatement( node, @@ -104142,7 +104946,7 @@ ${lanes.join("\n")} return factory2.updatePartiallyEmittedExpression(node, visitNode(node.expression, valueIsDiscarded ? discardedValueVisitor : visitor, isExpression)); } function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { - if ((node.operator === 45 /* PlusPlusToken */ || node.operator === 46 /* MinusMinusToken */) && isIdentifier(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand) && !isDeclarationNameOfEnumOrNamespace(node.operand)) { + if ((node.operator === 46 /* PlusPlusToken */ || node.operator === 47 /* MinusMinusToken */) && isIdentifier(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand) && !isDeclarationNameOfEnumOrNamespace(node.operand)) { const exportedNames = getExports(node.operand); if (exportedNames) { let temp; @@ -104186,7 +104990,7 @@ ${lanes.join("\n")} case 2 /* AMD */: return createImportCallExpressionAMD(argument, containsLexicalThis); case 3 /* UMD */: - return createImportCallExpressionUMD(argument != null ? argument : factory2.createVoidZero(), containsLexicalThis); + return createImportCallExpressionUMD(argument ?? factory2.createVoidZero(), containsLexicalThis); case 1 /* CommonJS */: default: return createImportCallExpressionCommonJS(argument); @@ -104218,7 +105022,7 @@ ${lanes.join("\n")} /*whenTrue*/ createImportCallExpressionCommonJS( temp, - /* isInlineable */ + /*isInlineable*/ true ), /*colonToken*/ @@ -104501,12 +105305,7 @@ ${lanes.join("\n")} ) ); } - if (hasAssociatedEndOfDeclarationMarker(node)) { - const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node); - } else { - statements = appendExportsOfImportDeclaration(statements, node); - } + statements = appendExportsOfImportDeclaration(statements, node); return singleOrMany(statements); } function createRequireCall2(importNode) { @@ -104587,12 +105386,7 @@ ${lanes.join("\n")} ); } } - if (hasAssociatedEndOfDeclarationMarker(node)) { - const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); - } else { - statements = appendExportsOfImportEqualsDeclaration(statements, node); - } + statements = appendExportsOfImportEqualsDeclaration(statements, node); return singleOrMany(statements); } function visitExportDeclaration(node) { @@ -104654,9 +105448,9 @@ ${lanes.join("\n")} createExportExpression( factory2.getExportName(specifier), exportedValue, - /* location */ + /*location*/ void 0, - /* liveBinding */ + /*liveBinding*/ true ) ), @@ -104701,31 +105495,14 @@ ${lanes.join("\n")} if (node.isExportEquals) { return void 0; } - let statements; - const original = node.original; - if (original && hasAssociatedEndOfDeclarationMarker(original)) { - const id = getOriginalNodeId(node); - deferredExports[id] = appendExportStatement( - deferredExports[id], - factory2.createIdentifier("default"), - visitNode(node.expression, visitor, isExpression), - /*location*/ - node, - /*allowComments*/ - true - ); - } else { - statements = appendExportStatement( - statements, - factory2.createIdentifier("default"), - visitNode(node.expression, visitor, isExpression), - /*location*/ - node, - /*allowComments*/ - true - ); - } - return singleOrMany(statements); + return createExportStatement( + factory2.createIdentifier("default"), + visitNode(node.expression, visitor, isExpression), + /*location*/ + node, + /*allowComments*/ + true + ); } function visitFunctionDeclaration(node) { let statements; @@ -104761,12 +105538,7 @@ ${lanes.join("\n")} } else { statements = append(statements, visitEachChild(node, visitor, context)); } - if (hasAssociatedEndOfDeclarationMarker(node)) { - const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); - } else { - statements = appendExportsOfHoistedDeclaration(statements, node); - } + statements = appendExportsOfHoistedDeclaration(statements, node); return singleOrMany(statements); } function visitClassDeclaration(node) { @@ -104798,12 +105570,7 @@ ${lanes.join("\n")} } else { statements = append(statements, visitEachChild(node, visitor, context)); } - if (hasAssociatedEndOfDeclarationMarker(node)) { - const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); - } else { - statements = appendExportsOfHoistedDeclaration(statements, node); - } + statements = appendExportsOfHoistedDeclaration(statements, node); return singleOrMany(statements); } function visitVariableStatement(node) { @@ -104875,12 +105642,7 @@ ${lanes.join("\n")} } else { statements = append(statements, visitEachChild(node, visitor, context)); } - if (hasAssociatedEndOfDeclarationMarker(node)) { - const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node); - } else { - statements = appendExportsOfVariableStatement(statements, node); - } + statements = appendExportsOfVariableStatement(statements, node); return singleOrMany(statements); } function createAllExportExpressions(name, value, location) { @@ -104925,25 +105687,6 @@ ${lanes.join("\n")} ); } } - function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* VariableStatement */) { - const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); - } - return node; - } - function hasAssociatedEndOfDeclarationMarker(node) { - return (getEmitFlags(node) & 8388608 /* HasEndOfDeclarationMarker */) !== 0; - } - function visitEndOfDeclarationMarker(node) { - const id = getOriginalNodeId(node); - const statements = deferredExports[id]; - if (statements) { - delete deferredExports[id]; - return append(statements, node); - } - return node; - } function appendExportsOfImportDeclaration(statements, decl) { if (currentModuleInfo.exportEquals) { return statements; @@ -104958,15 +105701,15 @@ ${lanes.join("\n")} const namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 271 /* NamespaceImport */: + case 273 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 272 /* NamedImports */: + case 274 /* NamedImports */: for (const importBinding of namedBindings.elements) { statements = appendExportsOfDeclaration( statements, importBinding, - /* liveBinding */ + /*liveBinding*/ true ); } @@ -104982,25 +105725,33 @@ ${lanes.join("\n")} return appendExportsOfDeclaration(statements, decl); } function appendExportsOfVariableStatement(statements, node) { + return appendExportsOfVariableDeclarationList( + statements, + node.declarationList, + /*isForInOrOfInitializer*/ + false + ); + } + function appendExportsOfVariableDeclarationList(statements, node, isForInOrOfInitializer) { if (currentModuleInfo.exportEquals) { return statements; } - for (const decl of node.declarationList.declarations) { - statements = appendExportsOfBindingElement(statements, decl); + for (const decl of node.declarations) { + statements = appendExportsOfBindingElement(statements, decl, isForInOrOfInitializer); } return statements; } - function appendExportsOfBindingElement(statements, decl) { + function appendExportsOfBindingElement(statements, decl, isForInOrOfInitializer) { if (currentModuleInfo.exportEquals) { return statements; } if (isBindingPattern(decl.name)) { for (const element of decl.name.elements) { if (!isOmittedExpression(element)) { - statements = appendExportsOfBindingElement(statements, element); + statements = appendExportsOfBindingElement(statements, element, isForInOrOfInitializer); } } - } else if (!isGeneratedIdentifier(decl.name)) { + } else if (!isGeneratedIdentifier(decl.name) && (!isVariableDeclaration(decl) || decl.initializer || isForInOrOfInitializer)) { statements = appendExportsOfDeclaration(statements, decl); } return statements; @@ -105035,7 +105786,7 @@ ${lanes.join("\n")} name, /*location*/ exportSpecifier.name, - /* allowComments */ + /*allowComments*/ void 0, liveBinding ); @@ -105079,7 +105830,7 @@ ${lanes.join("\n")} const statement = setTextRange(factory2.createExpressionStatement(createExportExpression( name, value, - /* location */ + /*location*/ void 0, liveBinding )), location); @@ -105132,14 +105883,14 @@ ${lanes.join("\n")} } function modifierVisitor(node) { switch (node.kind) { - case 93 /* ExportKeyword */: - case 88 /* DefaultKeyword */: + case 95 /* ExportKeyword */: + case 90 /* DefaultKeyword */: return void 0; } return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 308 /* SourceFile */) { + if (node.kind === 311 /* SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[getOriginalNodeId(currentSourceFile)]; previousOnEmitNode(hint, node, emitCallback); @@ -105175,13 +105926,13 @@ ${lanes.join("\n")} } function substituteExpression(node) { switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return substituteExpressionIdentifier(node); - case 210 /* CallExpression */: + case 212 /* CallExpression */: return substituteCallExpression(node); - case 212 /* TaggedTemplateExpression */: + case 214 /* TaggedTemplateExpression */: return substituteTaggedTemplateExpression(node); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return substituteBinaryExpression(node); } return node; @@ -105225,7 +105976,7 @@ ${lanes.join("\n")} return node; } function substituteExpressionIdentifier(node) { - var _a2, _b; + var _a, _b; if (getEmitFlags(node) & 8192 /* HelperName */) { const externalHelpersModuleName = getExternalHelpersModuleName(currentSourceFile); if (externalHelpersModuleName) { @@ -105234,7 +105985,7 @@ ${lanes.join("\n")} return node; } else if (!(isGeneratedIdentifier(node) && !(node.emitNode.autoGenerate.flags & 64 /* AllowNameSubstitution */)) && !isLocalName(node)) { const exportContainer = resolver.getReferencedExportContainer(node, isExportName(node)); - if (exportContainer && exportContainer.kind === 308 /* SourceFile */) { + if (exportContainer && exportContainer.kind === 311 /* SourceFile */) { return setTextRange( factory2.createPropertyAccessExpression( factory2.createIdentifier("exports"), @@ -105259,7 +106010,7 @@ ${lanes.join("\n")} const name = importDeclaration.propertyName || importDeclaration.name; return setTextRange( factory2.createPropertyAccessExpression( - factory2.getGeneratedNameForNode(((_b = (_a2 = importDeclaration.parent) == null ? void 0 : _a2.parent) == null ? void 0 : _b.parent) || importDeclaration), + factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration), factory2.cloneNode(name) ), /*location*/ @@ -105271,7 +106022,7 @@ ${lanes.join("\n")} return node; } function substituteBinaryExpression(node) { - if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier(node.left) && !isGeneratedIdentifier(node.left) && !isLocalName(node.left) && !isDeclarationNameOfEnumOrNamespace(node.left)) { + if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier(node.left) && !isGeneratedIdentifier(node.left) && !isLocalName(node.left)) { const exportedNames = getExports(node.left); if (exportedNames) { let expression = node; @@ -105291,9 +106042,24 @@ ${lanes.join("\n")} } function getExports(name) { if (!isGeneratedIdentifier(name)) { - const valueDeclaration = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); - if (valueDeclaration) { - return currentModuleInfo && currentModuleInfo.exportedBindings[getOriginalNodeId(valueDeclaration)]; + const importDeclaration = resolver.getReferencedImportDeclaration(name); + if (importDeclaration) { + return currentModuleInfo == null ? void 0 : currentModuleInfo.exportedBindings[getOriginalNodeId(importDeclaration)]; + } + const bindingsSet = /* @__PURE__ */ new Set(); + const declarations = resolver.getReferencedValueDeclarations(name); + if (declarations) { + for (const declaration of declarations) { + const bindings = currentModuleInfo == null ? void 0 : currentModuleInfo.exportedBindings[getOriginalNodeId(declaration)]; + if (bindings) { + for (const binding of bindings) { + bindingsSet.add(binding); + } + } + } + if (bindingsSet.size) { + return arrayFrom(bindingsSet); + } } } } @@ -105327,13 +106093,12 @@ ${lanes.join("\n")} const previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(79 /* Identifier */); - context.enableSubstitution(300 /* ShorthandPropertyAssignment */); - context.enableSubstitution(223 /* BinaryExpression */); - context.enableSubstitution(233 /* MetaProperty */); - context.enableEmitNotification(308 /* SourceFile */); + context.enableSubstitution(80 /* Identifier */); + context.enableSubstitution(303 /* ShorthandPropertyAssignment */); + context.enableSubstitution(225 /* BinaryExpression */); + context.enableSubstitution(235 /* MetaProperty */); + context.enableEmitNotification(311 /* SourceFile */); const moduleInfoMap = []; - const deferredExports = []; const exportFunctionsMap = []; const noSubstitutionMap = []; const contextObjectMap = []; @@ -105519,7 +106284,7 @@ ${lanes.join("\n")} if (!moduleInfo.exportedNames && moduleInfo.exportSpecifiers.size === 0) { let hasExportDeclarationWithExportClause = false; for (const externalImport of moduleInfo.externalImports) { - if (externalImport.kind === 275 /* ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 277 /* ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -105561,7 +106326,7 @@ ${lanes.join("\n")} void 0, factory2.createObjectLiteralExpression( exportedNames, - /*multiline*/ + /*multiLine*/ true ) ) @@ -105653,7 +106418,7 @@ ${lanes.join("\n")} ) ) ], - /*multiline*/ + /*multiLine*/ true ) ); @@ -105667,11 +106432,11 @@ ${lanes.join("\n")} for (const entry of group2.externalImports) { const importVariableName = getLocalNameForExternalImport(factory2, entry, currentSourceFile); switch (entry.kind) { - case 269 /* ImportDeclaration */: + case 271 /* ImportDeclaration */: if (!entry.importClause) { break; } - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: Debug.assert(importVariableName !== void 0); statements.push( factory2.createExpressionStatement( @@ -105694,7 +106459,7 @@ ${lanes.join("\n")} ); } break; - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: Debug.assert(importVariableName !== void 0); if (entry.exportClause) { if (isNamedExports(entry.exportClause)) { @@ -105718,7 +106483,7 @@ ${lanes.join("\n")} void 0, [factory2.createObjectLiteralExpression( properties, - /*multiline*/ + /*multiLine*/ true )] ) @@ -105789,13 +106554,13 @@ ${lanes.join("\n")} } function topLevelVisitor(node) { switch (node.kind) { - case 269 /* ImportDeclaration */: + case 271 /* ImportDeclaration */: return visitImportDeclaration(node); - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: return visitExportDeclaration(node); - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: return visitExportAssignment(node); default: return topLevelNestedVisitor(node); @@ -105806,13 +106571,7 @@ ${lanes.join("\n")} if (node.importClause) { hoistVariableDeclaration(getLocalNameForExternalImport(factory2, node, currentSourceFile)); } - if (hasAssociatedEndOfDeclarationMarker(node)) { - const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfImportDeclaration(deferredExports[id], node); - } else { - statements = appendExportsOfImportDeclaration(statements, node); - } - return singleOrMany(statements); + return singleOrMany(appendExportsOfImportDeclaration(statements, node)); } function visitExportDeclaration(node) { Debug.assertIsDefined(node); @@ -105822,37 +106581,19 @@ ${lanes.join("\n")} Debug.assert(isExternalModuleImportEqualsDeclaration(node), "import= for internal module references should be handled in an earlier transformer."); let statements; hoistVariableDeclaration(getLocalNameForExternalImport(factory2, node, currentSourceFile)); - if (hasAssociatedEndOfDeclarationMarker(node)) { - const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfImportEqualsDeclaration(deferredExports[id], node); - } else { - statements = appendExportsOfImportEqualsDeclaration(statements, node); - } - return singleOrMany(statements); + return singleOrMany(appendExportsOfImportEqualsDeclaration(statements, node)); } function visitExportAssignment(node) { if (node.isExportEquals) { return void 0; } const expression = visitNode(node.expression, visitor, isExpression); - const original = node.original; - if (original && hasAssociatedEndOfDeclarationMarker(original)) { - const id = getOriginalNodeId(node); - deferredExports[id] = appendExportStatement( - deferredExports[id], - factory2.createIdentifier("default"), - expression, - /*allowComments*/ - true - ); - } else { - return createExportStatement( - factory2.createIdentifier("default"), - expression, - /*allowComments*/ - true - ); - } + return createExportStatement( + factory2.createIdentifier("default"), + expression, + /*allowComments*/ + true + ); } function visitFunctionDeclaration(node) { if (hasSyntacticModifier(node, 1 /* Export */)) { @@ -105880,12 +106621,7 @@ ${lanes.join("\n")} } else { hoistedStatements = append(hoistedStatements, visitEachChild(node, visitor, context)); } - if (hasAssociatedEndOfDeclarationMarker(node)) { - const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); - } else { - hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node); - } + hoistedStatements = appendExportsOfHoistedDeclaration(hoistedStatements, node); return void 0; } function visitClassDeclaration(node) { @@ -105914,12 +106650,7 @@ ${lanes.join("\n")} node ) ); - if (hasAssociatedEndOfDeclarationMarker(node)) { - const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfHoistedDeclaration(deferredExports[id], node); - } else { - statements = appendExportsOfHoistedDeclaration(statements, node); - } + statements = appendExportsOfHoistedDeclaration(statements, node); return singleOrMany(statements); } function visitVariableStatement(node) { @@ -105928,10 +106659,9 @@ ${lanes.join("\n")} } let expressions; const isExportedDeclaration = hasSyntacticModifier(node, 1 /* Export */); - const isMarkedDeclaration = hasAssociatedEndOfDeclarationMarker(node); for (const variable of node.declarationList.declarations) { if (variable.initializer) { - expressions = append(expressions, transformInitializedVariable(variable, isExportedDeclaration && !isMarkedDeclaration)); + expressions = append(expressions, transformInitializedVariable(variable, isExportedDeclaration)); } else { hoistBindingElement(variable); } @@ -105940,17 +106670,12 @@ ${lanes.join("\n")} if (expressions) { statements = append(statements, setTextRange(factory2.createExpressionStatement(factory2.inlineExpressions(expressions)), node)); } - if (isMarkedDeclaration) { - const id = getOriginalNodeId(node); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node, isExportedDeclaration); - } else { - statements = appendExportsOfVariableStatement( - statements, - node, - /*exportSelf*/ - false - ); - } + statements = appendExportsOfVariableStatement( + statements, + node, + /*exportSelf*/ + false + ); return singleOrMany(statements); } function hoistBindingElement(node) { @@ -105965,7 +106690,7 @@ ${lanes.join("\n")} } } function shouldHoistVariableDeclarationList(node) { - return (getEmitFlags(node) & 4194304 /* NoHoisting */) === 0 && (enclosingBlockScopedContainer.kind === 308 /* SourceFile */ || (getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); + return (getEmitFlags(node) & 4194304 /* NoHoisting */) === 0 && (enclosingBlockScopedContainer.kind === 311 /* SourceFile */ || (getOriginalNode(node).flags & 3 /* BlockScoped */) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { const createAssignment = isExportedDeclaration ? createExportedVariableAssignment : createNonExportedVariableAssignment; @@ -106001,31 +106726,6 @@ ${lanes.join("\n")} hoistVariableDeclaration(factory2.cloneNode(name)); return isExportedDeclaration ? createExportExpression(name, preventSubstitution(setTextRange(factory2.createAssignment(name, value), location))) : preventSubstitution(setTextRange(factory2.createAssignment(name, value), location)); } - function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* VariableStatement */) { - const id = getOriginalNodeId(node); - const isExportedDeclaration = hasSyntacticModifier(node.original, 1 /* Export */); - deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); - } - return node; - } - function hasAssociatedEndOfDeclarationMarker(node) { - return (getEmitFlags(node) & 8388608 /* HasEndOfDeclarationMarker */) !== 0; - } - function visitEndOfDeclarationMarker(node) { - const id = getOriginalNodeId(node); - const statements = deferredExports[id]; - if (statements) { - delete deferredExports[id]; - return append(statements, node); - } else { - const original = getOriginalNode(node); - if (isModuleOrEnumDeclaration(original)) { - return append(appendExportsOfDeclaration(statements, original), node); - } - } - return node; - } function appendExportsOfImportDeclaration(statements, decl) { if (moduleInfo.exportEquals) { return statements; @@ -106040,10 +106740,10 @@ ${lanes.join("\n")} const namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 271 /* NamespaceImport */: + case 273 /* NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 272 /* NamedImports */: + case 274 /* NamedImports */: for (const importBinding of namedBindings.elements) { statements = appendExportsOfDeclaration(statements, importBinding); } @@ -106143,48 +106843,46 @@ ${lanes.join("\n")} } function topLevelNestedVisitor(node) { switch (node.kind) { - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: return visitVariableStatement(node); - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: return visitFunctionDeclaration(node); - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: return visitClassDeclaration(node); - case 245 /* ForStatement */: + case 247 /* ForStatement */: return visitForStatement( node, /*isTopLevel*/ true ); - case 246 /* ForInStatement */: + case 248 /* ForInStatement */: return visitForInStatement(node); - case 247 /* ForOfStatement */: + case 249 /* ForOfStatement */: return visitForOfStatement(node); - case 243 /* DoStatement */: + case 245 /* DoStatement */: return visitDoStatement(node); - case 244 /* WhileStatement */: + case 246 /* WhileStatement */: return visitWhileStatement(node); - case 253 /* LabeledStatement */: + case 255 /* LabeledStatement */: return visitLabeledStatement(node); - case 251 /* WithStatement */: + case 253 /* WithStatement */: return visitWithStatement(node); - case 252 /* SwitchStatement */: + case 244 /* IfStatement */: + return visitIfStatement(node); + case 254 /* SwitchStatement */: return visitSwitchStatement(node); - case 266 /* CaseBlock */: + case 268 /* CaseBlock */: return visitCaseBlock(node); - case 292 /* CaseClause */: + case 295 /* CaseClause */: return visitCaseClause(node); - case 293 /* DefaultClause */: + case 296 /* DefaultClause */: return visitDefaultClause(node); - case 255 /* TryStatement */: + case 257 /* TryStatement */: return visitTryStatement(node); - case 295 /* CatchClause */: + case 298 /* CatchClause */: return visitCatchClause(node); - case 238 /* Block */: + case 240 /* Block */: return visitBlock(node); - case 358 /* MergeDeclarationMarker */: - return visitMergeDeclarationMarker(node); - case 359 /* EndOfDeclarationMarker */: - return visitEndOfDeclarationMarker(node); default: return visitor(node); } @@ -106276,6 +106974,14 @@ ${lanes.join("\n")} Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)) ); } + function visitIfStatement(node) { + return factory2.updateIfStatement( + node, + visitNode(node.expression, visitor, isExpression), + Debug.checkDefined(visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)), + visitNode(node.elseStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock) + ); + } function visitSwitchStatement(node) { return factory2.updateSwitchStatement( node, @@ -106329,30 +107035,30 @@ ${lanes.join("\n")} return node; } switch (node.kind) { - case 245 /* ForStatement */: + case 247 /* ForStatement */: return visitForStatement( node, /*isTopLevel*/ false ); - case 241 /* ExpressionStatement */: + case 243 /* ExpressionStatement */: return visitExpressionStatement(node); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 356 /* PartiallyEmittedExpression */: + case 359 /* PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: if (isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 210 /* CallExpression */: + case 212 /* CallExpression */: if (isImportCall(node)) { return visitImportCallExpression(node); } break; - case 221 /* PrefixUnaryExpression */: - case 222 /* PostfixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } return visitEachChild(node, visitor, context); @@ -106425,13 +107131,13 @@ ${lanes.join("\n")} return hasExportedReferenceInDestructuringTarget(node.initializer); } else if (isIdentifier(node)) { const container = resolver.getReferencedExportContainer(node); - return container !== void 0 && container.kind === 308 /* SourceFile */; + return container !== void 0 && container.kind === 311 /* SourceFile */; } else { return false; } } function visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded) { - if ((node.operator === 45 /* PlusPlusToken */ || node.operator === 46 /* MinusMinusToken */) && isIdentifier(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand) && !isDeclarationNameOfEnumOrNamespace(node.operand)) { + if ((node.operator === 46 /* PlusPlusToken */ || node.operator === 47 /* MinusMinusToken */) && isIdentifier(node.operand) && !isGeneratedIdentifier(node.operand) && !isLocalName(node.operand) && !isDeclarationNameOfEnumOrNamespace(node.operand)) { const exportedNames = getExports(node.operand); if (exportedNames) { let temp; @@ -106462,14 +107168,14 @@ ${lanes.join("\n")} } function modifierVisitor(node) { switch (node.kind) { - case 93 /* ExportKeyword */: - case 88 /* DefaultKeyword */: + case 95 /* ExportKeyword */: + case 90 /* DefaultKeyword */: return void 0; } return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 308 /* SourceFile */) { + if (node.kind === 311 /* SourceFile */) { const id = getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -106503,13 +107209,13 @@ ${lanes.join("\n")} } function substituteUnspecified(node) { switch (node.kind) { - case 300 /* ShorthandPropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; } function substituteShorthandPropertyAssignment(node) { - var _a2, _b; + var _a, _b; const name = node.name; if (!isGeneratedIdentifier(name) && !isLocalName(name)) { const importDeclaration = resolver.getReferencedImportDeclaration(name); @@ -106531,7 +107237,7 @@ ${lanes.join("\n")} factory2.createPropertyAssignment( factory2.cloneNode(name), factory2.createPropertyAccessExpression( - factory2.getGeneratedNameForNode(((_b = (_a2 = importDeclaration.parent) == null ? void 0 : _a2.parent) == null ? void 0 : _b.parent) || importDeclaration), + factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration), factory2.cloneNode(importDeclaration.propertyName || importDeclaration.name) ) ), @@ -106545,17 +107251,17 @@ ${lanes.join("\n")} } function substituteExpression(node) { switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return substituteExpressionIdentifier(node); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return substituteBinaryExpression(node); - case 233 /* MetaProperty */: + case 235 /* MetaProperty */: return substituteMetaProperty(node); } return node; } function substituteExpressionIdentifier(node) { - var _a2, _b; + var _a, _b; if (getEmitFlags(node) & 8192 /* HelperName */) { const externalHelpersModuleName = getExternalHelpersModuleName(currentSourceFile); if (externalHelpersModuleName) { @@ -106578,7 +107284,7 @@ ${lanes.join("\n")} } else if (isImportSpecifier(importDeclaration)) { return setTextRange( factory2.createPropertyAccessExpression( - factory2.getGeneratedNameForNode(((_b = (_a2 = importDeclaration.parent) == null ? void 0 : _a2.parent) == null ? void 0 : _b.parent) || importDeclaration), + factory2.getGeneratedNameForNode(((_b = (_a = importDeclaration.parent) == null ? void 0 : _a.parent) == null ? void 0 : _b.parent) || importDeclaration), factory2.cloneNode(importDeclaration.propertyName || importDeclaration.name) ), /*location*/ @@ -106590,7 +107296,7 @@ ${lanes.join("\n")} return node; } function substituteBinaryExpression(node) { - if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier(node.left) && !isGeneratedIdentifier(node.left) && !isLocalName(node.left) && !isDeclarationNameOfEnumOrNamespace(node.left)) { + if (isAssignmentOperator(node.operatorToken.kind) && isIdentifier(node.left) && !isGeneratedIdentifier(node.left) && !isLocalName(node.left)) { const exportedNames = getExports(node.left); if (exportedNames) { let expression = node; @@ -106610,22 +107316,38 @@ ${lanes.join("\n")} } function getExports(name) { let exportedNames; - if (!isGeneratedIdentifier(name)) { - const valueDeclaration = resolver.getReferencedImportDeclaration(name) || resolver.getReferencedValueDeclaration(name); - if (valueDeclaration) { - const exportContainer = resolver.getReferencedExportContainer( - name, - /*prefixLocals*/ - false - ); - if (exportContainer && exportContainer.kind === 308 /* SourceFile */) { - exportedNames = append(exportedNames, factory2.getDeclarationName(valueDeclaration)); - } - exportedNames = addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[getOriginalNodeId(valueDeclaration)]); + const valueDeclaration = getReferencedDeclaration(name); + if (valueDeclaration) { + const exportContainer = resolver.getReferencedExportContainer( + name, + /*prefixLocals*/ + false + ); + if (exportContainer && exportContainer.kind === 311 /* SourceFile */) { + exportedNames = append(exportedNames, factory2.getDeclarationName(valueDeclaration)); } + exportedNames = addRange(exportedNames, moduleInfo == null ? void 0 : moduleInfo.exportedBindings[getOriginalNodeId(valueDeclaration)]); } return exportedNames; } + function getReferencedDeclaration(name) { + if (!isGeneratedIdentifier(name)) { + const importDeclaration = resolver.getReferencedImportDeclaration(name); + if (importDeclaration) + return importDeclaration; + const valueDeclaration = resolver.getReferencedValueDeclaration(name); + if (valueDeclaration && (moduleInfo == null ? void 0 : moduleInfo.exportedBindings[getOriginalNodeId(valueDeclaration)])) + return valueDeclaration; + const declarations = resolver.getReferencedValueDeclarations(name); + if (declarations) { + for (const declaration of declarations) { + if (declaration !== valueDeclaration && (moduleInfo == null ? void 0 : moduleInfo.exportedBindings[getOriginalNodeId(declaration)])) + return declaration; + } + } + return valueDeclaration; + } + } function preventSubstitution(node) { if (noSubstitution === void 0) noSubstitution = []; @@ -106657,8 +107379,8 @@ ${lanes.join("\n")} const previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(308 /* SourceFile */); - context.enableSubstitution(79 /* Identifier */); + context.enableEmitNotification(311 /* SourceFile */); + context.enableSubstitution(80 /* Identifier */); let helperNameSubstitutions; let currentSourceFile; let importRequireStatements; @@ -106705,11 +107427,11 @@ ${lanes.join("\n")} } function visitor(node) { switch (node.kind) { - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: return getEmitModuleKind(compilerOptions) >= 100 /* Node16 */ ? visitImportEqualsDeclaration(node) : void 0; - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: return visitExportAssignment(node); - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: const exportDecl = node; return visitExportDeclaration(exportDecl); } @@ -106759,7 +107481,7 @@ ${lanes.join("\n")} /*typeArguments*/ void 0, [ - factory2.createPropertyAccessExpression(factory2.createMetaProperty(100 /* ImportKeyword */, factory2.createIdentifier("meta")), factory2.createIdentifier("url")) + factory2.createPropertyAccessExpression(factory2.createMetaProperty(102 /* ImportKeyword */, factory2.createIdentifier("meta")), factory2.createIdentifier("url")) ] ) ) @@ -106920,8 +107642,8 @@ ${lanes.join("\n")} const cjsOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(308 /* SourceFile */); - context.enableEmitNotification(308 /* SourceFile */); + context.enableSubstitution(311 /* SourceFile */); + context.enableEmitNotification(311 /* SourceFile */); let currentSourceFile; return transformSourceFileOrBundle; function onSubstituteNode(hint, node) { @@ -106964,7 +107686,7 @@ ${lanes.join("\n")} return result; } function transformSourceFileOrBundle(node) { - return node.kind === 308 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 311 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(map(node.sourceFiles, transformSourceFile), node.prepends); @@ -106979,7 +107701,7 @@ ${lanes.join("\n")} // src/compiler/transformers/declarations/diagnostics.ts function canProduceDiagnostics(node) { - return isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isBindingElement(node) || isSetAccessor(node) || isGetAccessor(node) || isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration(node) || isConstructorDeclaration(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression(node) || isJSDocTypeAlias(node); + return isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isBindingElement(node) || isSetAccessor(node) || isGetAccessor(node) || isConstructSignatureDeclaration(node) || isCallSignatureDeclaration(node) || isMethodDeclaration(node) || isMethodSignature(node) || isFunctionDeclaration(node) || isParameter(node) || isTypeParameterDeclaration(node) || isExpressionWithTypeArguments(node) || isImportEqualsDeclaration(node) || isTypeAliasDeclaration(node) || isConstructorDeclaration(node) || isIndexSignatureDeclaration(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node) || isJSDocTypeAlias(node); } function createGetSymbolAccessibilityDiagnosticForNodeName(node) { if (isSetAccessor(node) || isGetAccessor(node)) { @@ -107000,7 +107722,7 @@ ${lanes.join("\n")} function getAccessorNameVisibilityDiagnosticMessage(symbolAccessibilityResult) { if (isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; - } else if (node.parent.kind === 260 /* ClassDeclaration */) { + } else if (node.parent.kind === 262 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { return symbolAccessibilityResult.errorModuleName ? Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; @@ -107017,7 +107739,7 @@ ${lanes.join("\n")} function getMethodNameVisibilityDiagnosticMessage(symbolAccessibilityResult) { if (isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; - } else if (node.parent.kind === 260 /* ClassDeclaration */) { + } else if (node.parent.kind === 262 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_method_0_of_exported_class_has_or_is_using_private_name_1; } else { return symbolAccessibilityResult.errorModuleName ? Diagnostics.Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Method_0_of_exported_interface_has_or_is_using_private_name_1; @@ -107025,7 +107747,7 @@ ${lanes.join("\n")} } } function createGetSymbolAccessibilityDiagnosticForNode(node) { - if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) { + if (isVariableDeclaration(node) || isPropertyDeclaration(node) || isPropertySignature(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node) || isBinaryExpression(node) || isBindingElement(node) || isConstructorDeclaration(node)) { return getVariableDeclarationTypeVisibilityError; } else if (isSetAccessor(node) || isGetAccessor(node)) { return getAccessorDeclarationTypeVisibilityError; @@ -107048,12 +107770,12 @@ ${lanes.join("\n")} return Debug.assertNever(node, `Attempted to set a declaration diagnostic context for unhandled node kind: ${Debug.formatSyntaxKind(node.kind)}`); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 257 /* VariableDeclaration */ || node.kind === 205 /* BindingElement */) { + if (node.kind === 259 /* VariableDeclaration */ || node.kind === 207 /* BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; - } else if (node.kind === 169 /* PropertyDeclaration */ || node.kind === 208 /* PropertyAccessExpression */ || node.kind === 168 /* PropertySignature */ || node.kind === 166 /* Parameter */ && hasSyntacticModifier(node.parent, 8 /* Private */)) { + } else if (node.kind === 171 /* PropertyDeclaration */ || node.kind === 210 /* PropertyAccessExpression */ || node.kind === 211 /* ElementAccessExpression */ || node.kind === 225 /* BinaryExpression */ || node.kind === 170 /* PropertySignature */ || node.kind === 168 /* Parameter */ && hasSyntacticModifier(node.parent, 8 /* Private */)) { if (isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; - } else if (node.parent.kind === 260 /* ClassDeclaration */ || node.kind === 166 /* Parameter */) { + } else if (node.parent.kind === 262 /* ClassDeclaration */ || node.kind === 168 /* Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Public_property_0_of_exported_class_has_or_is_using_private_name_1; } else { return symbolAccessibilityResult.errorModuleName ? Diagnostics.Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Property_0_of_exported_interface_has_or_is_using_private_name_1; @@ -107070,7 +107792,7 @@ ${lanes.join("\n")} } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { let diagnosticMessage; - if (node.kind === 175 /* SetAccessor */) { + if (node.kind === 177 /* SetAccessor */) { if (isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_private_name_1; } else { @@ -107092,26 +107814,26 @@ ${lanes.join("\n")} function getReturnTypeVisibilityError(symbolAccessibilityResult) { let diagnosticMessage; switch (node.kind) { - case 177 /* ConstructSignature */: + case 179 /* ConstructSignature */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 176 /* CallSignature */: + case 178 /* CallSignature */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 178 /* IndexSignature */: + case 180 /* IndexSignature */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: if (isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; - } else if (node.parent.kind === 260 /* ClassDeclaration */) { + } else if (node.parent.kind === 262 /* ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0; } else { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1 : Diagnostics.Return_type_of_exported_function_has_or_is_using_private_name_0; break; default: @@ -107132,29 +107854,29 @@ ${lanes.join("\n")} } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 173 /* Constructor */: + case 175 /* Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 177 /* ConstructSignature */: - case 182 /* ConstructorType */: + case 179 /* ConstructSignature */: + case 184 /* ConstructorType */: return symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 176 /* CallSignature */: + case 178 /* CallSignature */: return symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 178 /* IndexSignature */: + case 180 /* IndexSignature */: return symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: if (isStatic(node.parent)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; - } else if (node.parent.parent.kind === 260 /* ClassDeclaration */) { + } else if (node.parent.parent.kind === 262 /* ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { return symbolAccessibilityResult.errorModuleName ? Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 259 /* FunctionDeclaration */: - case 181 /* FunctionType */: + case 261 /* FunctionDeclaration */: + case 183 /* FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - case 175 /* SetAccessor */: - case 174 /* GetAccessor */: + case 177 /* SetAccessor */: + case 176 /* GetAccessor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ? Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_private_module_2 : Diagnostics.Parameter_0_of_accessor_has_or_is_using_private_name_1; default: return Debug.fail(`Unknown parent for parameter: ${Debug.formatSyntaxKind(node.parent.kind)}`); @@ -107163,40 +107885,40 @@ ${lanes.join("\n")} function getTypeParameterConstraintVisibilityError() { let diagnosticMessage; switch (node.parent.kind) { - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 261 /* InterfaceDeclaration */: + case 263 /* InterfaceDeclaration */: diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 197 /* MappedType */: + case 199 /* MappedType */: diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 182 /* ConstructorType */: - case 177 /* ConstructSignature */: + case 184 /* ConstructorType */: + case 179 /* ConstructSignature */: diagnosticMessage = Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 176 /* CallSignature */: + case 178 /* CallSignature */: diagnosticMessage = Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: if (isStatic(node.parent)) { diagnosticMessage = Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; - } else if (node.parent.parent.kind === 260 /* ClassDeclaration */) { + } else if (node.parent.parent.kind === 262 /* ClassDeclaration */) { diagnosticMessage = Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 181 /* FunctionType */: - case 259 /* FunctionDeclaration */: + case 183 /* FunctionType */: + case 261 /* FunctionDeclaration */: diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 192 /* InferType */: + case 194 /* InferType */: diagnosticMessage = Diagnostics.Extends_clause_for_inferred_type_0_has_or_is_using_private_name_1; break; - case 262 /* TypeAliasDeclaration */: + case 264 /* TypeAliasDeclaration */: diagnosticMessage = Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -107211,7 +107933,7 @@ ${lanes.join("\n")} function getHeritageClauseVisibilityError() { let diagnosticMessage; if (isClassDeclaration(node.parent.parent)) { - diagnosticMessage = isHeritageClause(node.parent) && node.parent.token === 117 /* ImplementsKeyword */ ? Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : node.parent.parent.name ? Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1 : Diagnostics.extends_clause_of_exported_class_has_or_is_using_private_name_0; + diagnosticMessage = isHeritageClause(node.parent) && node.parent.token === 119 /* ImplementsKeyword */ ? Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 : node.parent.parent.name ? Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1 : Diagnostics.extends_clause_of_exported_class_has_or_is_using_private_name_0; } else { diagnosticMessage = Diagnostics.extends_clause_of_exported_interface_0_has_or_is_using_private_name_1; } @@ -107264,7 +107986,7 @@ ${lanes.join("\n")} } function isInternalDeclaration(node, currentSourceFile) { const parseTreeNode = getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 166 /* Parameter */) { + if (parseTreeNode && parseTreeNode.kind === 168 /* Parameter */) { const paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); const previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : void 0; const text = currentSourceFile.text; @@ -107275,18 +107997,18 @@ ${lanes.join("\n")} getTrailingCommentRanges(text, skipTrivia( text, previousSibling.end + 1, - /* stopAfterLineBreak */ + /*stopAfterLineBreak*/ false, - /* stopAtComments */ + /*stopAtComments*/ true )), getLeadingCommentRanges(text, node.pos) ) : getTrailingCommentRanges(text, skipTrivia( text, node.pos, - /* stopAfterLineBreak */ + /*stopAfterLineBreak*/ false, - /* stopAtComments */ + /*stopAtComments*/ true )); return commentRanges && commentRanges.length && hasInternalAnnotation(last(commentRanges), currentSourceFile); @@ -107401,7 +108123,7 @@ ${lanes.join("\n")} symbol, enclosingDeclaration2, meaning, - /*shouldComputeAliasesToMakeVisible*/ + /*shouldComputeAliasToMarkVisible*/ true )); recordTypeReferenceDirectivesIfNecessary(resolver.getTypeReferenceDirectivesForSymbol(symbol, meaning)); @@ -107462,8 +108184,8 @@ ${lanes.join("\n")} } } function reportNonlocalAugmentation(containingFile, parentSymbol, symbol) { - var _a2; - const primaryDeclaration = (_a2 = parentSymbol.declarations) == null ? void 0 : _a2.find((d) => getSourceFileOfNode(d) === containingFile); + var _a; + const primaryDeclaration = (_a = parentSymbol.declarations) == null ? void 0 : _a.find((d) => getSourceFileOfNode(d) === containingFile); const augmentingDeclarations = filter(symbol.declarations, (d) => getSourceFileOfNode(d) !== containingFile); if (primaryDeclaration && augmentingDeclarations) { for (const augmentations of augmentingDeclarations) { @@ -107495,10 +108217,10 @@ ${lanes.join("\n")} return result; } function transformRoot(node) { - if (node.kind === 308 /* SourceFile */ && node.isDeclarationFile) { + if (node.kind === 311 /* SourceFile */ && node.isDeclarationFile) { return node; } - if (node.kind === 309 /* Bundle */) { + if (node.kind === 312 /* Bundle */) { isBundledEmit = true; refs = /* @__PURE__ */ new Map(); libs2 = /* @__PURE__ */ new Map(); @@ -107530,7 +108252,7 @@ ${lanes.join("\n")} const newFile = factory2.updateSourceFile( sourceFile, [factory2.createModuleDeclaration( - [factory2.createModifier(136 /* DeclareKeyword */)], + [factory2.createModifier(138 /* DeclareKeyword */)], factory2.createStringLiteral(getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory2.createModuleBlock(setTextRange(factory2.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)) )], @@ -107565,7 +108287,7 @@ ${lanes.join("\n")} ); } ), mapDefined(node.prepends, (prepend) => { - if (prepend.kind === 311 /* InputFiles */) { + if (prepend.kind === 314 /* InputFiles */) { const sourceFile = createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib = hasNoDefaultLib || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -107730,24 +108452,24 @@ ${lanes.join("\n")} return ret; } function filterBindingPatternInitializersAndRenamings(name) { - if (name.kind === 79 /* Identifier */) { + if (name.kind === 80 /* Identifier */) { return name; } else { - if (name.kind === 204 /* ArrayBindingPattern */) { + if (name.kind === 206 /* ArrayBindingPattern */) { return factory2.updateArrayBindingPattern(name, visitNodes2(name.elements, visitBindingElement, isArrayBindingElement)); } else { return factory2.updateObjectBindingPattern(name, visitNodes2(name.elements, visitBindingElement, isBindingElement)); } } function visitBindingElement(elem) { - if (elem.kind === 229 /* OmittedExpression */) { + if (elem.kind === 231 /* OmittedExpression */) { return elem; } if (elem.propertyName && isIdentifier(elem.propertyName) && isIdentifier(elem.name) && !elem.symbol.isReferenced && !isIdentifierANonContextualKeyword(elem.propertyName)) { return factory2.updateBindingElement( elem, elem.dotDotDotToken, - /* propertyName */ + /*propertyName*/ void 0, elem.propertyName, shouldPrintWithInitializer(elem) ? elem.initializer : void 0 @@ -107770,10 +108492,10 @@ ${lanes.join("\n")} } const newParam = factory2.updateParameterDeclaration( p, - maskModifiers(p, modifierMask), + maskModifiers(factory2, p, modifierMask), p.dotDotDotToken, filterBindingPatternInitializersAndRenamings(p.name), - resolver.isOptionalParameter(p) ? p.questionToken || factory2.createToken(57 /* QuestionToken */) : void 0, + resolver.isOptionalParameter(p) ? p.questionToken || factory2.createToken(58 /* QuestionToken */) : void 0, ensureType( p, type || p.type, @@ -107804,15 +108526,15 @@ ${lanes.join("\n")} if (shouldPrintWithInitializer(node)) { return; } - const shouldUseResolverType = node.kind === 166 /* Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); + const shouldUseResolverType = node.kind === 168 /* Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return visitNode(type, visitDeclarationSubtree, isTypeNode); } if (!getParseTreeNode(node)) { - return type ? visitNode(type, visitDeclarationSubtree, isTypeNode) : factory2.createKeywordTypeNode(131 /* AnyKeyword */); + return type ? visitNode(type, visitDeclarationSubtree, isTypeNode) : factory2.createKeywordTypeNode(133 /* AnyKeyword */); } - if (node.kind === 175 /* SetAccessor */) { - return factory2.createKeywordTypeNode(131 /* AnyKeyword */); + if (node.kind === 177 /* SetAccessor */) { + return factory2.createKeywordTypeNode(133 /* AnyKeyword */); } errorNameNode = node.name; let oldDiag; @@ -107820,10 +108542,10 @@ ${lanes.join("\n")} oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 257 /* VariableDeclaration */ || node.kind === 205 /* BindingElement */) { + if (node.kind === 259 /* VariableDeclaration */ || node.kind === 207 /* BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 166 /* Parameter */ || node.kind === 169 /* PropertyDeclaration */ || node.kind === 168 /* PropertySignature */) { + if (node.kind === 168 /* Parameter */ || node.kind === 171 /* PropertyDeclaration */ || node.kind === 170 /* PropertySignature */) { if (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)); @@ -107834,37 +108556,37 @@ ${lanes.join("\n")} if (!suppressNewDiagnosticContexts) { getSymbolAccessibilityDiagnostic = oldDiag; } - return returnValue || factory2.createKeywordTypeNode(131 /* AnyKeyword */); + return returnValue || factory2.createKeywordTypeNode(133 /* AnyKeyword */); } } function isDeclarationAndNotVisible(node) { node = getParseTreeNode(node); switch (node.kind) { - case 259 /* FunctionDeclaration */: - case 264 /* ModuleDeclaration */: - case 261 /* InterfaceDeclaration */: - case 260 /* ClassDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 263 /* EnumDeclaration */: + case 261 /* FunctionDeclaration */: + case 266 /* ModuleDeclaration */: + case 263 /* InterfaceDeclaration */: + case 262 /* ClassDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 265 /* EnumDeclaration */: return !resolver.isDeclarationVisible(node); - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: return !getBindingNameVisible(node); - case 268 /* ImportEqualsDeclaration */: - case 269 /* ImportDeclaration */: - case 275 /* ExportDeclaration */: - case 274 /* ExportAssignment */: + case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportDeclaration */: + case 277 /* ExportDeclaration */: + case 276 /* ExportAssignment */: return false; - case 172 /* ClassStaticBlockDeclaration */: + case 174 /* ClassStaticBlockDeclaration */: return true; } return false; } function shouldEmitFunctionProperties(input) { - var _a2; + var _a; if (input.body) { return true; } - const overloadSignatures = (_a2 = input.symbol.declarations) == null ? void 0 : _a2.filter((decl) => isFunctionDeclaration(decl) && !decl.body); + const overloadSignatures = (_a = input.symbol.declarations) == null ? void 0 : _a.filter((decl) => isFunctionDeclaration(decl) && !decl.body); return !overloadSignatures || overloadSignatures.indexOf(input) === overloadSignatures.length - 1; } function getBindingNameVisible(elem) { @@ -107942,7 +108664,7 @@ ${lanes.join("\n")} function rewriteModuleSpecifier(parent2, input) { if (!input) return void 0; - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent2.kind !== 264 /* ModuleDeclaration */ && parent2.kind !== 202 /* ImportType */; + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || parent2.kind !== 266 /* ModuleDeclaration */ && parent2.kind !== 204 /* ImportType */; if (isStringLiteralLike(input)) { if (isBundledEmit) { const newName = getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent2); @@ -107961,7 +108683,7 @@ ${lanes.join("\n")} function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 280 /* ExternalModuleReference */) { + if (decl.moduleReference.kind === 282 /* ExternalModuleReference */) { const specifier = getExternalModuleImportEqualsDeclarationExpression(decl); return factory2.updateImportEqualsDeclaration( decl, @@ -107998,7 +108720,7 @@ ${lanes.join("\n")} void 0 ), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); } - if (decl.importClause.namedBindings.kind === 271 /* NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 273 /* NamespaceImport */) { const namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : ( /*namedBindings*/ void 0 @@ -108101,7 +108823,7 @@ ${lanes.join("\n")} const oldDiag = getSymbolAccessibilityDiagnostic; const canProduceDiagnostic = canProduceDiagnostics(input); const oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - let shouldEnterSuppressNewDiagnosticsContextContext = (input.kind === 184 /* TypeLiteral */ || input.kind === 197 /* MappedType */) && input.parent.kind !== 262 /* TypeAliasDeclaration */; + let shouldEnterSuppressNewDiagnosticsContextContext = (input.kind === 186 /* TypeLiteral */ || input.kind === 199 /* MappedType */) && input.parent.kind !== 264 /* TypeAliasDeclaration */; if (isMethodDeclaration(input) || isMethodSignature(input)) { if (hasEffectiveModifier(input, 8 /* Private */)) { if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input) @@ -108109,7 +108831,7 @@ ${lanes.join("\n")} return cleanup(factory2.createPropertyDeclaration( ensureModifiers(input), input.name, - /*questionToken*/ + /*questionOrExclamationToken*/ void 0, /*type*/ void 0, @@ -108129,26 +108851,26 @@ ${lanes.join("\n")} } if (isProcessedComponent(input)) { switch (input.kind) { - case 230 /* ExpressionWithTypeArguments */: { + case 232 /* ExpressionWithTypeArguments */: { if (isEntityName(input.expression) || isEntityNameExpression(input.expression)) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } const node = visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory2.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } - case 180 /* TypeReference */: { + case 182 /* TypeReference */: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); const node = visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory2.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } - case 177 /* ConstructSignature */: + case 179 /* ConstructSignature */: return cleanup(factory2.updateConstructSignature( input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type) )); - case 173 /* Constructor */: { + case 175 /* Constructor */: { const ctor = factory2.createConstructorDeclaration( /*modifiers*/ ensureModifiers(input), @@ -108158,7 +108880,7 @@ ${lanes.join("\n")} ); return cleanup(ctor); } - case 171 /* MethodDeclaration */: { + case 173 /* MethodDeclaration */: { if (isPrivateIdentifier(input.name)) { return cleanup( /*returnValue*/ @@ -108179,7 +108901,7 @@ ${lanes.join("\n")} ); return cleanup(sig); } - case 174 /* GetAccessor */: { + case 176 /* GetAccessor */: { if (isPrivateIdentifier(input.name)) { return cleanup( /*returnValue*/ @@ -108197,7 +108919,7 @@ ${lanes.join("\n")} void 0 )); } - case 175 /* SetAccessor */: { + case 177 /* SetAccessor */: { if (isPrivateIdentifier(input.name)) { return cleanup( /*returnValue*/ @@ -108213,7 +108935,7 @@ ${lanes.join("\n")} void 0 )); } - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: if (isPrivateIdentifier(input.name)) { return cleanup( /*returnValue*/ @@ -108228,7 +108950,7 @@ ${lanes.join("\n")} ensureType(input, input.type), ensureNoInitializer(input) )); - case 168 /* PropertySignature */: + case 170 /* PropertySignature */: if (isPrivateIdentifier(input.name)) { return cleanup( /*returnValue*/ @@ -108242,7 +108964,7 @@ ${lanes.join("\n")} input.questionToken, ensureType(input, input.type) )); - case 170 /* MethodSignature */: { + case 172 /* MethodSignature */: { if (isPrivateIdentifier(input.name)) { return cleanup( /*returnValue*/ @@ -108259,7 +108981,7 @@ ${lanes.join("\n")} ensureType(input, input.type) )); } - case 176 /* CallSignature */: { + case 178 /* CallSignature */: { return cleanup(factory2.updateCallSignature( input, ensureTypeParams(input, input.typeParameters), @@ -108267,15 +108989,15 @@ ${lanes.join("\n")} ensureType(input, input.type) )); } - case 178 /* IndexSignature */: { + case 180 /* IndexSignature */: { return cleanup(factory2.updateIndexSignature( input, ensureModifiers(input), updateParamsList(input, input.parameters), - visitNode(input.type, visitDeclarationSubtree, isTypeNode) || factory2.createKeywordTypeNode(131 /* AnyKeyword */) + visitNode(input.type, visitDeclarationSubtree, isTypeNode) || factory2.createKeywordTypeNode(133 /* AnyKeyword */) )); } - case 257 /* VariableDeclaration */: { + case 259 /* VariableDeclaration */: { if (isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -108290,7 +109012,7 @@ ${lanes.join("\n")} ensureNoInitializer(input) )); } - case 165 /* TypeParameter */: { + case 167 /* TypeParameter */: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(factory2.updateTypeParameterDeclaration( input, @@ -108304,7 +109026,7 @@ ${lanes.join("\n")} } return cleanup(visitEachChild(input, visitDeclarationSubtree, context)); } - case 191 /* ConditionalType */: { + case 193 /* ConditionalType */: { const checkType = visitNode(input.checkType, visitDeclarationSubtree, isTypeNode); const extendsType = visitNode(input.extendsType, visitDeclarationSubtree, isTypeNode); const oldEnclosingDecl = enclosingDeclaration; @@ -108318,13 +109040,13 @@ ${lanes.join("\n")} Debug.assert(falseType); return cleanup(factory2.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 181 /* FunctionType */: { + case 183 /* FunctionType */: { return cleanup(factory2.updateFunctionTypeNode(input, visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration), updateParamsList(input, input.parameters), Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode)))); } - case 182 /* ConstructorType */: { + case 184 /* ConstructorType */: { return cleanup(factory2.updateConstructorTypeNode(input, ensureModifiers(input), visitNodes2(input.typeParameters, visitDeclarationSubtree, isTypeParameterDeclaration), updateParamsList(input, input.parameters), Debug.checkDefined(visitNode(input.type, visitDeclarationSubtree, isTypeNode)))); } - case 202 /* ImportType */: { + case 204 /* ImportType */: { if (!isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(factory2.updateImportTypeNode( @@ -108364,7 +109086,7 @@ ${lanes.join("\n")} } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 171 /* MethodDeclaration */ && hasEffectiveModifier(node.parent, 8 /* Private */); + return node.parent.kind === 173 /* MethodDeclaration */ && hasEffectiveModifier(node.parent, 8 /* Private */); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -108373,7 +109095,7 @@ ${lanes.join("\n")} if (shouldStripInternal(input)) return; switch (input.kind) { - case 275 /* ExportDeclaration */: { + case 277 /* ExportDeclaration */: { if (isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -108387,12 +109109,12 @@ ${lanes.join("\n")} getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : void 0 ); } - case 274 /* ExportAssignment */: { + case 276 /* ExportAssignment */: { if (isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } resultHasScopeMarker = true; - if (input.expression.kind === 79 /* Identifier */) { + if (input.expression.kind === 80 /* Identifier */) { return input; } else { const newId = factory2.createUniqueName("_default", 16 /* Optimistic */); @@ -108410,7 +109132,7 @@ ${lanes.join("\n")} void 0 ); errorFallbackNode = void 0; - const statement = factory2.createVariableStatement(needsDeclare ? [factory2.createModifier(136 /* DeclareKeyword */)] : [], factory2.createVariableDeclarationList([varDecl], 2 /* Const */)); + const statement = factory2.createVariableStatement(needsDeclare ? [factory2.createModifier(138 /* DeclareKeyword */)] : [], factory2.createVariableDeclarationList([varDecl], 2 /* Const */)); preserveJsDoc(statement, input); removeAllComments(input); return [statement, factory2.updateExportAssignment(input, input.modifiers, newId)]; @@ -108436,10 +109158,10 @@ ${lanes.join("\n")} if (shouldStripInternal(input)) return; switch (input.kind) { - case 268 /* ImportEqualsDeclaration */: { + case 270 /* ImportEqualsDeclaration */: { return transformImportEqualsDeclaration(input); } - case 269 /* ImportDeclaration */: { + case 271 /* ImportDeclaration */: { return transformImportDeclaration(input); } } @@ -108459,7 +109181,7 @@ ${lanes.join("\n")} } const previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 262 /* TypeAliasDeclaration */: { + case 264 /* TypeAliasDeclaration */: { needsDeclare = false; const clean2 = cleanup(factory2.updateTypeAliasDeclaration( input, @@ -108471,7 +109193,7 @@ ${lanes.join("\n")} needsDeclare = previousNeedsDeclare; return clean2; } - case 261 /* InterfaceDeclaration */: { + case 263 /* InterfaceDeclaration */: { return cleanup(factory2.updateInterfaceDeclaration( input, ensureModifiers(input), @@ -108481,7 +109203,7 @@ ${lanes.join("\n")} visitNodes2(input.members, visitDeclarationSubtree, isTypeElement) )); } - case 259 /* FunctionDeclaration */: { + case 261 /* FunctionDeclaration */: { const clean2 = cleanup(factory2.updateFunctionDeclaration( input, ensureModifiers(input), @@ -108508,13 +109230,16 @@ ${lanes.join("\n")} fakespace.symbol = props[0].parent; const exportMappings = []; let declarations = mapDefined(props, (p) => { - if (!p.valueDeclaration || !isPropertyAccessExpression(p.valueDeclaration)) { + if (!p.valueDeclaration || !(isPropertyAccessExpression(p.valueDeclaration) || isElementAccessExpression(p.valueDeclaration) || isBinaryExpression(p.valueDeclaration))) { + return void 0; + } + const nameStr = unescapeLeadingUnderscores(p.escapedName); + if (!isIdentifierText(nameStr, 99 /* ESNext */)) { return void 0; } getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(p.valueDeclaration); const type = resolver.createTypeOfDeclaration(p.valueDeclaration, fakespace, declarationEmitNodeBuilderFlags, symbolTracker); getSymbolAccessibilityDiagnostic = oldDiag; - const nameStr = unescapeLeadingUnderscores(p.escapedName); const isNonContextualKeywordName = isStringANonContextualKeyword(nameStr); const name = isNonContextualKeywordName ? factory2.getGeneratedNameForNode(p.valueDeclaration) : factory2.createIdentifier(nameStr); if (isNonContextualKeywordName) { @@ -108528,7 +109253,7 @@ ${lanes.join("\n")} /*initializer*/ void 0 ); - return factory2.createVariableStatement(isNonContextualKeywordName ? void 0 : [factory2.createToken(93 /* ExportKeyword */)], factory2.createVariableDeclarationList([varDecl])); + return factory2.createVariableStatement(isNonContextualKeywordName ? void 0 : [factory2.createToken(95 /* ExportKeyword */)], factory2.createVariableDeclarationList([varDecl])); }); if (!exportMappings.length) { declarations = mapDefined(declarations, (declaration) => factory2.updateModifiers(declaration, 0 /* None */)); @@ -108587,10 +109312,10 @@ ${lanes.join("\n")} return clean2; } } - case 264 /* ModuleDeclaration */: { + case 266 /* ModuleDeclaration */: { needsDeclare = false; const inner = input.body; - if (inner && inner.kind === 265 /* ModuleBlock */) { + if (inner && inner.kind === 267 /* ModuleBlock */) { const oldNeedsScopeFix = needsScopeFixMarker; const oldHasScopeFix = resultHasScopeMarker; resultHasScopeMarker = false; @@ -108634,7 +109359,7 @@ ${lanes.join("\n")} )); } } - case 260 /* ClassDeclaration */: { + case 262 /* ClassDeclaration */: { errorNameNode = input.name; errorFallbackNode = input; const modifiers = factory2.createNodeArray(ensureModifiers(input)); @@ -108647,7 +109372,7 @@ ${lanes.join("\n")} if (!hasSyntacticModifier(param, 16476 /* ParameterPropertyModifier */) || shouldStripInternal(param)) return; getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(param); - if (param.name.kind === 79 /* Identifier */) { + if (param.name.kind === 80 /* Identifier */) { return preserveJsDoc(factory2.createPropertyDeclaration( ensureModifiers(param), param.name, @@ -108670,7 +109395,7 @@ ${lanes.join("\n")} elems.push(factory2.createPropertyDeclaration( ensureModifiers(param), elem.name, - /*questionToken*/ + /*questionOrExclamationToken*/ void 0, ensureType( elem, @@ -108692,7 +109417,7 @@ ${lanes.join("\n")} /*modifiers*/ void 0, factory2.createPrivateIdentifier("#private"), - /*questionToken*/ + /*questionOrExclamationToken*/ void 0, /*type*/ void 0, @@ -108703,7 +109428,7 @@ ${lanes.join("\n")} const memberNodes = concatenate(concatenate(privateIdentifier, parameterProperties), visitNodes2(input.members, visitDeclarationSubtree, isClassElement)); const members = factory2.createNodeArray(memberNodes); const extendsClause = getEffectiveBaseTypeNode(input); - if (extendsClause && !isEntityNameExpression(extendsClause.expression) && extendsClause.expression.kind !== 104 /* NullKeyword */) { + if (extendsClause && !isEntityNameExpression(extendsClause.expression) && extendsClause.expression.kind !== 106 /* NullKeyword */) { const oldId = input.name ? unescapeLeadingUnderscores(input.name.escapedText) : "default"; const newId = factory2.createUniqueName(`${oldId}_base`, 16 /* Optimistic */); getSymbolAccessibilityDiagnostic = () => ({ @@ -108719,16 +109444,16 @@ ${lanes.join("\n")} /*initializer*/ void 0 ); - const statement = factory2.createVariableStatement(needsDeclare ? [factory2.createModifier(136 /* DeclareKeyword */)] : [], factory2.createVariableDeclarationList([varDecl], 2 /* Const */)); + const statement = factory2.createVariableStatement(needsDeclare ? [factory2.createModifier(138 /* DeclareKeyword */)] : [], factory2.createVariableDeclarationList([varDecl], 2 /* Const */)); const heritageClauses = factory2.createNodeArray(map(input.heritageClauses, (clause) => { - if (clause.token === 94 /* ExtendsKeyword */) { + if (clause.token === 96 /* ExtendsKeyword */) { const oldDiag2 = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = createGetSymbolAccessibilityDiagnosticForNode(clause.types[0]); const newClause = factory2.updateHeritageClause(clause, map(clause.types, (t) => factory2.updateExpressionWithTypeArguments(t, newId, visitNodes2(t.typeArguments, visitDeclarationSubtree, isTypeNode)))); getSymbolAccessibilityDiagnostic = oldDiag2; return newClause; } - return factory2.updateHeritageClause(clause, visitNodes2(factory2.createNodeArray(filter(clause.types, (t) => isEntityNameExpression(t.expression) || t.expression.kind === 104 /* NullKeyword */)), visitDeclarationSubtree, isExpressionWithTypeArguments)); + return factory2.updateHeritageClause(clause, visitNodes2(factory2.createNodeArray(filter(clause.types, (t) => isEntityNameExpression(t.expression) || t.expression.kind === 106 /* NullKeyword */)), visitDeclarationSubtree, isExpressionWithTypeArguments)); })); return [statement, cleanup(factory2.updateClassDeclaration( input, @@ -108750,10 +109475,10 @@ ${lanes.join("\n")} )); } } - case 240 /* VariableStatement */: { + case 242 /* VariableStatement */: { return cleanup(transformVariableStatement(input)); } - case 263 /* EnumDeclaration */: { + case 265 /* EnumDeclaration */: { return cleanup(factory2.updateEnumDeclaration(input, factory2.createNodeArray(ensureModifiers(input)), input.name, factory2.createNodeArray(mapDefined(input.members, (m) => { if (shouldStripInternal(m)) return; @@ -108770,7 +109495,7 @@ ${lanes.join("\n")} if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 264 /* ModuleDeclaration */) { + if (input.kind === 266 /* ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -108793,7 +109518,7 @@ ${lanes.join("\n")} return flatten(mapDefined(d.elements, (e) => recreateBindingElement(e))); } function recreateBindingElement(e) { - if (e.kind === 229 /* OmittedExpression */) { + if (e.kind === 231 /* OmittedExpression */) { return; } if (e.name) { @@ -108853,7 +109578,7 @@ ${lanes.join("\n")} function ensureModifierFlags(node) { let mask2 = 258047 /* All */ ^ (4 /* Public */ | 512 /* Async */ | 16384 /* Override */); let additions = needsDeclare && !isAlwaysType(node) ? 2 /* Ambient */ : 0 /* None */; - const parentIsFile = node.parent.kind === 308 /* SourceFile */; + const parentIsFile = node.parent.kind === 311 /* SourceFile */; if (!parentIsFile || isBundledEmit && parentIsFile && isExternalModule(node.parent)) { mask2 ^= 2 /* Ambient */; additions = 0 /* None */; @@ -108874,18 +109599,18 @@ ${lanes.join("\n")} } function transformHeritageClauses(nodes) { return factory2.createNodeArray(filter(map(nodes, (clause) => factory2.updateHeritageClause(clause, visitNodes2(factory2.createNodeArray(filter(clause.types, (t) => { - return isEntityNameExpression(t.expression) || clause.token === 94 /* ExtendsKeyword */ && t.expression.kind === 104 /* NullKeyword */; + return isEntityNameExpression(t.expression) || clause.token === 96 /* ExtendsKeyword */ && t.expression.kind === 106 /* NullKeyword */; })), visitDeclarationSubtree, isExpressionWithTypeArguments))), (clause) => clause.types && !!clause.types.length)); } } function isAlwaysType(node) { - if (node.kind === 261 /* InterfaceDeclaration */) { + if (node.kind === 263 /* InterfaceDeclaration */) { return true; } return false; } - function maskModifiers(node, modifierMask, modifierAdditions) { - return factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); + function maskModifiers(factory2, node, modifierMask, modifierAdditions) { + return factory2.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask = 258047 /* All */ ^ 4 /* Public */, modifierAdditions = 0 /* None */) { let flags = getEffectiveModifierFlags(node) & modifierMask | modifierAdditions; @@ -108899,57 +109624,57 @@ ${lanes.join("\n")} } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 174 /* GetAccessor */ ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : void 0; + return accessor.kind === 176 /* GetAccessor */ ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type : void 0; } } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: return !hasEffectiveModifier(node, 8 /* Private */); - case 166 /* Parameter */: - case 257 /* VariableDeclaration */: + case 168 /* Parameter */: + case 259 /* VariableDeclaration */: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 259 /* FunctionDeclaration */: - case 264 /* ModuleDeclaration */: - case 268 /* ImportEqualsDeclaration */: - case 261 /* InterfaceDeclaration */: - case 260 /* ClassDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 263 /* EnumDeclaration */: - case 240 /* VariableStatement */: - case 269 /* ImportDeclaration */: - case 275 /* ExportDeclaration */: - case 274 /* ExportAssignment */: + case 261 /* FunctionDeclaration */: + case 266 /* ModuleDeclaration */: + case 270 /* ImportEqualsDeclaration */: + case 263 /* InterfaceDeclaration */: + case 262 /* ClassDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 265 /* EnumDeclaration */: + case 242 /* VariableStatement */: + case 271 /* ImportDeclaration */: + case 277 /* ExportDeclaration */: + case 276 /* ExportAssignment */: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 177 /* ConstructSignature */: - case 173 /* Constructor */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 170 /* MethodSignature */: - case 176 /* CallSignature */: - case 178 /* IndexSignature */: - case 257 /* VariableDeclaration */: - case 165 /* TypeParameter */: - case 230 /* ExpressionWithTypeArguments */: - case 180 /* TypeReference */: - case 191 /* ConditionalType */: - case 181 /* FunctionType */: - case 182 /* ConstructorType */: - case 202 /* ImportType */: + case 179 /* ConstructSignature */: + case 175 /* Constructor */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 172 /* MethodSignature */: + case 178 /* CallSignature */: + case 180 /* IndexSignature */: + case 259 /* VariableDeclaration */: + case 167 /* TypeParameter */: + case 232 /* ExpressionWithTypeArguments */: + case 182 /* TypeReference */: + case 193 /* ConditionalType */: + case 183 /* FunctionType */: + case 184 /* ConstructorType */: + case 204 /* ImportType */: return true; } return false; @@ -109065,8 +109790,8 @@ ${lanes.join("\n")} callback(hint, node); } function transformNodes(resolver, host, factory2, options, nodes, transformers, allowDtsFiles) { - var _a2, _b; - const enabledSyntaxKindFeatures = new Array(361 /* Count */); + var _a, _b; + const enabledSyntaxKindFeatures = new Array(362 /* Count */); let lexicalEnvironmentVariableDeclarations; let lexicalEnvironmentFunctionDeclarations; let lexicalEnvironmentStatements; @@ -109145,7 +109870,7 @@ ${lanes.join("\n")} state = 1 /* Initialized */; const transformed = []; for (const node of nodes) { - (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Emit, "transformNodes", node.kind === 308 /* SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Emit, "transformNodes", node.kind === 311 /* SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); (_b = tracing) == null ? void 0 : _b.pop(); } @@ -109473,7 +110198,7 @@ ${lanes.join("\n")} } function getOutputPathsFor(sourceFile, host, forceDtsPaths) { const options = host.getCompilerOptions(); - if (sourceFile.kind === 309 /* Bundle */) { + if (sourceFile.kind === 312 /* Bundle */) { return getOutputPathsForBundle(options, forceDtsPaths); } else { const ownOutputFilePath = getOwnEmitOutputFilePath(sourceFile.fileName, host, getOutputExtension(sourceFile.fileName, options)); @@ -109658,7 +110383,7 @@ ${lanes.join("\n")} sourceMaps: sourceMapDataList }; function emitSourceFileOrBundle({ jsFilePath, sourceMapFilePath, declarationFilePath, declarationMapPath, buildInfoPath }, sourceFileOrBundle) { - var _a2, _b, _c, _d, _e, _f; + var _a, _b, _c, _d, _e, _f; let buildInfoDirectory; if (buildInfoPath && sourceFileOrBundle && isBundle(sourceFileOrBundle)) { buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory())); @@ -109667,7 +110392,7 @@ ${lanes.join("\n")} sourceFiles: sourceFileOrBundle.sourceFiles.map((file) => relativeToBuildInfo(getNormalizedAbsolutePath(file.fileName, host.getCurrentDirectory()))) }; } - (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Emit, "emitJsFileOrBundle", { jsFilePath }); + (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Emit, "emitJsFileOrBundle", { jsFilePath }); emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath, relativeToBuildInfo); (_b = tracing) == null ? void 0 : _b.pop(); (_c = tracing) == null ? void 0 : _c.push(tracing.Phase.Emit, "emitDeclarationFileOrBundle", { declarationFilePath }); @@ -109845,7 +110570,7 @@ ${lanes.join("\n")} } function collectLinkedAliases(node) { if (isExportAssignment(node)) { - if (node.expression.kind === 79 /* Identifier */) { + if (node.expression.kind === 80 /* Identifier */) { resolver.collectLinkedAliases( node.expression, /*setVisibility*/ @@ -109865,8 +110590,8 @@ ${lanes.join("\n")} } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform2, printer, mapOptions) { const sourceFileOrBundle = transform2.transformed[0]; - const bundle = sourceFileOrBundle.kind === 309 /* Bundle */ ? sourceFileOrBundle : void 0; - const sourceFile = sourceFileOrBundle.kind === 308 /* SourceFile */ ? sourceFileOrBundle : void 0; + const bundle = sourceFileOrBundle.kind === 312 /* Bundle */ ? sourceFileOrBundle : void 0; + const sourceFile = sourceFileOrBundle.kind === 311 /* SourceFile */ ? sourceFileOrBundle : void 0; const sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; let sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -109928,7 +110653,7 @@ ${lanes.join("\n")} writer.clear(); } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { - return (mapOptions.sourceMap || mapOptions.inlineSourceMap) && (sourceFileOrBundle.kind !== 308 /* SourceFile */ || !fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */)); + return (mapOptions.sourceMap || mapOptions.inlineSourceMap) && (sourceFileOrBundle.kind !== 311 /* SourceFile */ || !fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */)); } function getSourceRoot(mapOptions) { const sourceRoot = normalizeSlashes(mapOptions.sourceRoot || ""); @@ -109983,8 +110708,7 @@ ${lanes.join("\n")} } } function createBuildInfo(program, bundle) { - const version2 = version; - return { bundle, program, version: version2 }; + return { bundle, program, version }; } function getBuildInfoText(buildInfo) { return JSON.stringify(buildInfo); @@ -109993,11 +110717,10 @@ ${lanes.join("\n")} return readJsonOrUndefined(buildInfoFile, buildInfoText); } function createSourceFilesFromBundleBuildInfo(bundle, buildInfoDirectory, host) { - var _a2; + var _a; const jsBundle = Debug.checkDefined(bundle.js); - const prologueMap = ((_a2 = jsBundle.sources) == null ? void 0 : _a2.prologues) && arrayToMap(jsBundle.sources.prologues, (prologueInfo) => prologueInfo.file); + const prologueMap = ((_a = jsBundle.sources) == null ? void 0 : _a.prologues) && arrayToMap(jsBundle.sources.prologues, (prologueInfo) => prologueInfo.file); return bundle.sourceFiles.map((fileName, index) => { - var _a3, _b; const prologueInfo = prologueMap == null ? void 0 : prologueMap.get(index); const statements = prologueInfo == null ? void 0 : prologueInfo.directives.map((directive) => { const literal = setTextRange(factory.createStringLiteral(directive.expression.text), directive.expression); @@ -110006,14 +110729,14 @@ ${lanes.join("\n")} return statement; }); const eofToken = factory.createToken(1 /* EndOfFileToken */); - const sourceFile = factory.createSourceFile(statements != null ? statements : [], eofToken, 0 /* None */); + const sourceFile = factory.createSourceFile(statements ?? [], eofToken, 0 /* None */); sourceFile.fileName = getRelativePathFromDirectory( host.getCurrentDirectory(), getNormalizedAbsolutePath(fileName, buildInfoDirectory), !host.useCaseSensitiveFileNames() ); - sourceFile.text = (_a3 = prologueInfo == null ? void 0 : prologueInfo.text) != null ? _a3 : ""; - setTextRangePosWidth(sourceFile, 0, (_b = prologueInfo == null ? void 0 : prologueInfo.text.length) != null ? _b : 0); + sourceFile.text = (prologueInfo == null ? void 0 : prologueInfo.text) ?? ""; + setTextRangePosWidth(sourceFile, 0, (prologueInfo == null ? void 0 : prologueInfo.text.length) ?? 0); setEachParent(sourceFile.statements, sourceFile); setTextRangePosWidth(eofToken, sourceFile.end, 0); setParent(eofToken, sourceFile); @@ -110021,18 +110744,18 @@ ${lanes.join("\n")} }); } function emitUsingBuildInfo(config, host, getCommandLine, customTransformers) { - var _a2, _b; - (_a2 = tracing) == null ? void 0 : _a2.push( + var _a, _b; + (_a = tracing) == null ? void 0 : _a.push( tracing.Phase.Emit, "emitUsingBuildInfo", {}, /*separateBeginAndEnd*/ true ); - ts_performance_exports.mark("beforeEmit"); + mark("beforeEmit"); const result = emitUsingBuildInfoWorker(config, host, getCommandLine, customTransformers); - ts_performance_exports.mark("afterEmit"); - ts_performance_exports.measure("Emit", "beforeEmit", "afterEmit"); + mark("afterEmit"); + measure("Emit", "beforeEmit", "afterEmit"); (_b = tracing) == null ? void 0 : _b.pop(); return result; } @@ -110079,7 +110802,7 @@ ${lanes.join("\n")} declarationMapText, buildInfoPath, buildInfo, - /*onlyOwnText*/ + /*oldFileOfCurrentEmit*/ true ); const outputFiles = []; @@ -110250,11 +110973,11 @@ ${lanes.join("\n")} break; } switch (node.kind) { - case 308 /* SourceFile */: + case 311 /* SourceFile */: return printFile(node); - case 309 /* Bundle */: + case 312 /* Bundle */: return printBundle(node); - case 310 /* UnparsedSource */: + case 313 /* UnparsedSource */: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); @@ -110268,7 +110991,7 @@ ${lanes.join("\n")} writeBundle( bundle, beginPrint(), - /*sourceMapEmitter*/ + /*sourceMapGenerator*/ void 0 ); return endPrint(); @@ -110277,7 +111000,7 @@ ${lanes.join("\n")} writeFile2( sourceFile, beginPrint(), - /*sourceMapEmitter*/ + /*sourceMapGenerator*/ void 0 ); return endPrint(); @@ -110621,313 +111344,313 @@ ${lanes.join("\n")} } if (hint === 4 /* Unspecified */) { switch (node.kind) { - case 15 /* TemplateHead */: - case 16 /* TemplateMiddle */: - case 17 /* TemplateTail */: + case 16 /* TemplateHead */: + case 17 /* TemplateMiddle */: + case 18 /* TemplateTail */: return emitLiteral( node, /*jsxAttributeEscape*/ false ); - case 79 /* Identifier */: + case 80 /* Identifier */: return emitIdentifier(node); - case 80 /* PrivateIdentifier */: + case 81 /* PrivateIdentifier */: return emitPrivateIdentifier(node); - case 163 /* QualifiedName */: + case 165 /* QualifiedName */: return emitQualifiedName(node); - case 164 /* ComputedPropertyName */: + case 166 /* ComputedPropertyName */: return emitComputedPropertyName(node); - case 165 /* TypeParameter */: + case 167 /* TypeParameter */: return emitTypeParameter(node); - case 166 /* Parameter */: + case 168 /* Parameter */: return emitParameter(node); - case 167 /* Decorator */: + case 169 /* Decorator */: return emitDecorator(node); - case 168 /* PropertySignature */: + case 170 /* PropertySignature */: return emitPropertySignature(node); - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: return emitPropertyDeclaration(node); - case 170 /* MethodSignature */: + case 172 /* MethodSignature */: return emitMethodSignature(node); - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: return emitMethodDeclaration(node); - case 172 /* ClassStaticBlockDeclaration */: + case 174 /* ClassStaticBlockDeclaration */: return emitClassStaticBlockDeclaration(node); - case 173 /* Constructor */: + case 175 /* Constructor */: return emitConstructor(node); - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return emitAccessorDeclaration(node); - case 176 /* CallSignature */: + case 178 /* CallSignature */: return emitCallSignature(node); - case 177 /* ConstructSignature */: + case 179 /* ConstructSignature */: return emitConstructSignature(node); - case 178 /* IndexSignature */: + case 180 /* IndexSignature */: return emitIndexSignature(node); - case 179 /* TypePredicate */: + case 181 /* TypePredicate */: return emitTypePredicate(node); - case 180 /* TypeReference */: + case 182 /* TypeReference */: return emitTypeReference(node); - case 181 /* FunctionType */: + case 183 /* FunctionType */: return emitFunctionType(node); - case 182 /* ConstructorType */: + case 184 /* ConstructorType */: return emitConstructorType(node); - case 183 /* TypeQuery */: + case 185 /* TypeQuery */: return emitTypeQuery(node); - case 184 /* TypeLiteral */: + case 186 /* TypeLiteral */: return emitTypeLiteral(node); - case 185 /* ArrayType */: + case 187 /* ArrayType */: return emitArrayType(node); - case 186 /* TupleType */: + case 188 /* TupleType */: return emitTupleType(node); - case 187 /* OptionalType */: + case 189 /* OptionalType */: return emitOptionalType(node); - case 189 /* UnionType */: + case 191 /* UnionType */: return emitUnionType(node); - case 190 /* IntersectionType */: + case 192 /* IntersectionType */: return emitIntersectionType(node); - case 191 /* ConditionalType */: + case 193 /* ConditionalType */: return emitConditionalType(node); - case 192 /* InferType */: + case 194 /* InferType */: return emitInferType(node); - case 193 /* ParenthesizedType */: + case 195 /* ParenthesizedType */: return emitParenthesizedType(node); - case 230 /* ExpressionWithTypeArguments */: + case 232 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 194 /* ThisType */: + case 196 /* ThisType */: return emitThisType(); - case 195 /* TypeOperator */: + case 197 /* TypeOperator */: return emitTypeOperator(node); - case 196 /* IndexedAccessType */: + case 198 /* IndexedAccessType */: return emitIndexedAccessType(node); - case 197 /* MappedType */: + case 199 /* MappedType */: return emitMappedType(node); - case 198 /* LiteralType */: + case 200 /* LiteralType */: return emitLiteralType(node); - case 199 /* NamedTupleMember */: + case 201 /* NamedTupleMember */: return emitNamedTupleMember(node); - case 200 /* TemplateLiteralType */: + case 202 /* TemplateLiteralType */: return emitTemplateType(node); - case 201 /* TemplateLiteralTypeSpan */: + case 203 /* TemplateLiteralTypeSpan */: return emitTemplateTypeSpan(node); - case 202 /* ImportType */: + case 204 /* ImportType */: return emitImportTypeNode(node); - case 203 /* ObjectBindingPattern */: + case 205 /* ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 204 /* ArrayBindingPattern */: + case 206 /* ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 205 /* BindingElement */: + case 207 /* BindingElement */: return emitBindingElement(node); - case 236 /* TemplateSpan */: + case 238 /* TemplateSpan */: return emitTemplateSpan(node); - case 237 /* SemicolonClassElement */: + case 239 /* SemicolonClassElement */: return emitSemicolonClassElement(); - case 238 /* Block */: + case 240 /* Block */: return emitBlock(node); - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: return emitVariableStatement(node); - case 239 /* EmptyStatement */: + case 241 /* EmptyStatement */: return emitEmptyStatement( /*isEmbeddedStatement*/ false ); - case 241 /* ExpressionStatement */: + case 243 /* ExpressionStatement */: return emitExpressionStatement(node); - case 242 /* IfStatement */: + case 244 /* IfStatement */: return emitIfStatement(node); - case 243 /* DoStatement */: + case 245 /* DoStatement */: return emitDoStatement(node); - case 244 /* WhileStatement */: + case 246 /* WhileStatement */: return emitWhileStatement(node); - case 245 /* ForStatement */: + case 247 /* ForStatement */: return emitForStatement(node); - case 246 /* ForInStatement */: + case 248 /* ForInStatement */: return emitForInStatement(node); - case 247 /* ForOfStatement */: + case 249 /* ForOfStatement */: return emitForOfStatement(node); - case 248 /* ContinueStatement */: + case 250 /* ContinueStatement */: return emitContinueStatement(node); - case 249 /* BreakStatement */: + case 251 /* BreakStatement */: return emitBreakStatement(node); - case 250 /* ReturnStatement */: + case 252 /* ReturnStatement */: return emitReturnStatement(node); - case 251 /* WithStatement */: + case 253 /* WithStatement */: return emitWithStatement(node); - case 252 /* SwitchStatement */: + case 254 /* SwitchStatement */: return emitSwitchStatement(node); - case 253 /* LabeledStatement */: + case 255 /* LabeledStatement */: return emitLabeledStatement(node); - case 254 /* ThrowStatement */: + case 256 /* ThrowStatement */: return emitThrowStatement(node); - case 255 /* TryStatement */: + case 257 /* TryStatement */: return emitTryStatement(node); - case 256 /* DebuggerStatement */: + case 258 /* DebuggerStatement */: return emitDebuggerStatement(node); - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: return emitVariableDeclaration(node); - case 258 /* VariableDeclarationList */: + case 260 /* VariableDeclarationList */: return emitVariableDeclarationList(node); - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: return emitFunctionDeclaration(node); - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: return emitClassDeclaration(node); - case 261 /* InterfaceDeclaration */: + case 263 /* InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 262 /* TypeAliasDeclaration */: + case 264 /* TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 263 /* EnumDeclaration */: + case 265 /* EnumDeclaration */: return emitEnumDeclaration(node); - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: return emitModuleDeclaration(node); - case 265 /* ModuleBlock */: + case 267 /* ModuleBlock */: return emitModuleBlock(node); - case 266 /* CaseBlock */: + case 268 /* CaseBlock */: return emitCaseBlock(node); - case 267 /* NamespaceExportDeclaration */: + case 269 /* NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 269 /* ImportDeclaration */: + case 271 /* ImportDeclaration */: return emitImportDeclaration(node); - case 270 /* ImportClause */: + case 272 /* ImportClause */: return emitImportClause(node); - case 271 /* NamespaceImport */: + case 273 /* NamespaceImport */: return emitNamespaceImport(node); - case 277 /* NamespaceExport */: + case 279 /* NamespaceExport */: return emitNamespaceExport(node); - case 272 /* NamedImports */: + case 274 /* NamedImports */: return emitNamedImports(node); - case 273 /* ImportSpecifier */: + case 275 /* ImportSpecifier */: return emitImportSpecifier(node); - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: return emitExportAssignment(node); - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: return emitExportDeclaration(node); - case 276 /* NamedExports */: + case 278 /* NamedExports */: return emitNamedExports(node); - case 278 /* ExportSpecifier */: + case 280 /* ExportSpecifier */: return emitExportSpecifier(node); - case 296 /* AssertClause */: + case 299 /* AssertClause */: return emitAssertClause(node); - case 297 /* AssertEntry */: + case 300 /* AssertEntry */: return emitAssertEntry(node); - case 279 /* MissingDeclaration */: + case 281 /* MissingDeclaration */: return; - case 280 /* ExternalModuleReference */: + case 282 /* ExternalModuleReference */: return emitExternalModuleReference(node); - case 11 /* JsxText */: + case 12 /* JsxText */: return emitJsxText(node); - case 283 /* JsxOpeningElement */: - case 286 /* JsxOpeningFragment */: + case 285 /* JsxOpeningElement */: + case 288 /* JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 284 /* JsxClosingElement */: - case 287 /* JsxClosingFragment */: + case 286 /* JsxClosingElement */: + case 289 /* JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 288 /* JsxAttribute */: + case 290 /* JsxAttribute */: return emitJsxAttribute(node); - case 289 /* JsxAttributes */: + case 291 /* JsxAttributes */: return emitJsxAttributes(node); - case 290 /* JsxSpreadAttribute */: + case 292 /* JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 291 /* JsxExpression */: + case 293 /* JsxExpression */: return emitJsxExpression(node); - case 292 /* CaseClause */: + case 294 /* JsxNamespacedName */: + return emitJsxNamespacedName(node); + case 295 /* CaseClause */: return emitCaseClause(node); - case 293 /* DefaultClause */: + case 296 /* DefaultClause */: return emitDefaultClause(node); - case 294 /* HeritageClause */: + case 297 /* HeritageClause */: return emitHeritageClause(node); - case 295 /* CatchClause */: + case 298 /* CatchClause */: return emitCatchClause(node); - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: return emitPropertyAssignment(node); - case 300 /* ShorthandPropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 301 /* SpreadAssignment */: + case 304 /* SpreadAssignment */: return emitSpreadAssignment(node); - case 302 /* EnumMember */: + case 305 /* EnumMember */: return emitEnumMember(node); - case 303 /* UnparsedPrologue */: + case 306 /* UnparsedPrologue */: return writeUnparsedNode(node); - case 310 /* UnparsedSource */: - case 304 /* UnparsedPrepend */: + case 313 /* UnparsedSource */: + case 307 /* UnparsedPrepend */: return emitUnparsedSourceOrPrepend(node); - case 305 /* UnparsedText */: - case 306 /* UnparsedInternalText */: + case 308 /* UnparsedText */: + case 309 /* UnparsedInternalText */: return emitUnparsedTextLike(node); - case 307 /* UnparsedSyntheticReference */: + case 310 /* UnparsedSyntheticReference */: return emitUnparsedSyntheticReference(node); - case 308 /* SourceFile */: + case 311 /* SourceFile */: return emitSourceFile(node); - case 309 /* Bundle */: + case 312 /* Bundle */: return Debug.fail("Bundles should be printed using printBundle"); - case 311 /* InputFiles */: + case 314 /* InputFiles */: return Debug.fail("InputFiles should not be printed"); - case 312 /* JSDocTypeExpression */: + case 315 /* JSDocTypeExpression */: return emitJSDocTypeExpression(node); - case 313 /* JSDocNameReference */: + case 316 /* JSDocNameReference */: return emitJSDocNameReference(node); - case 315 /* JSDocAllType */: + case 318 /* JSDocAllType */: return writePunctuation("*"); - case 316 /* JSDocUnknownType */: + case 319 /* JSDocUnknownType */: return writePunctuation("?"); - case 317 /* JSDocNullableType */: + case 320 /* JSDocNullableType */: return emitJSDocNullableType(node); - case 318 /* JSDocNonNullableType */: + case 321 /* JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 319 /* JSDocOptionalType */: + case 322 /* JSDocOptionalType */: return emitJSDocOptionalType(node); - case 320 /* JSDocFunctionType */: + case 323 /* JSDocFunctionType */: return emitJSDocFunctionType(node); - case 188 /* RestType */: - case 321 /* JSDocVariadicType */: + case 190 /* RestType */: + case 324 /* JSDocVariadicType */: return emitRestOrJSDocVariadicType(node); - case 322 /* JSDocNamepathType */: + case 325 /* JSDocNamepathType */: return; - case 323 /* JSDoc */: + case 326 /* JSDoc */: return emitJSDoc(node); - case 325 /* JSDocTypeLiteral */: + case 328 /* JSDocTypeLiteral */: return emitJSDocTypeLiteral(node); - case 326 /* JSDocSignature */: + case 329 /* JSDocSignature */: return emitJSDocSignature(node); - case 330 /* JSDocTag */: - case 335 /* JSDocClassTag */: - case 340 /* JSDocOverrideTag */: + case 333 /* JSDocTag */: + case 338 /* JSDocClassTag */: + case 343 /* JSDocOverrideTag */: return emitJSDocSimpleTag(node); - case 331 /* JSDocAugmentsTag */: - case 332 /* JSDocImplementsTag */: + case 334 /* JSDocAugmentsTag */: + case 335 /* JSDocImplementsTag */: return emitJSDocHeritageTag(node); - case 333 /* JSDocAuthorTag */: - case 334 /* JSDocDeprecatedTag */: + case 336 /* JSDocAuthorTag */: + case 337 /* JSDocDeprecatedTag */: return; - case 336 /* JSDocPublicTag */: - case 337 /* JSDocPrivateTag */: - case 338 /* JSDocProtectedTag */: - case 339 /* JSDocReadonlyTag */: + case 339 /* JSDocPublicTag */: + case 340 /* JSDocPrivateTag */: + case 341 /* JSDocProtectedTag */: + case 342 /* JSDocReadonlyTag */: return; - case 341 /* JSDocCallbackTag */: + case 344 /* JSDocCallbackTag */: return emitJSDocCallbackTag(node); - case 342 /* JSDocOverloadTag */: + case 345 /* JSDocOverloadTag */: return emitJSDocOverloadTag(node); - case 344 /* JSDocParameterTag */: - case 351 /* JSDocPropertyTag */: + case 347 /* JSDocParameterTag */: + case 354 /* JSDocPropertyTag */: return emitJSDocPropertyLikeTag(node); - case 343 /* JSDocEnumTag */: - case 345 /* JSDocReturnTag */: - case 346 /* JSDocThisTag */: - case 347 /* JSDocTypeTag */: - case 352 /* JSDocThrowsTag */: - case 353 /* JSDocSatisfiesTag */: + case 346 /* JSDocEnumTag */: + case 348 /* JSDocReturnTag */: + case 349 /* JSDocThisTag */: + case 350 /* JSDocTypeTag */: + case 355 /* JSDocThrowsTag */: + case 356 /* JSDocSatisfiesTag */: return emitJSDocSimpleTypedTag(node); - case 348 /* JSDocTemplateTag */: + case 351 /* JSDocTemplateTag */: return emitJSDocTemplateTag(node); - case 349 /* JSDocTypedefTag */: + case 352 /* JSDocTypedefTag */: return emitJSDocTypedefTag(node); - case 350 /* JSDocSeeTag */: + case 353 /* JSDocSeeTag */: return emitJSDocSeeTag(node); - case 355 /* NotEmittedStatement */: - case 359 /* EndOfDeclarationMarker */: - case 358 /* MergeDeclarationMarker */: + case 358 /* NotEmittedStatement */: return; } if (isExpression(node)) { @@ -110945,101 +111668,98 @@ ${lanes.join("\n")} } if (hint === 1 /* Expression */) { switch (node.kind) { - case 8 /* NumericLiteral */: - case 9 /* BigIntLiteral */: + case 9 /* NumericLiteral */: + case 10 /* BigIntLiteral */: return emitNumericOrBigIntLiteral(node); - case 10 /* StringLiteral */: - case 13 /* RegularExpressionLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: + case 11 /* StringLiteral */: + case 14 /* RegularExpressionLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: return emitLiteral( node, /*jsxAttributeEscape*/ false ); - case 79 /* Identifier */: + case 80 /* Identifier */: return emitIdentifier(node); - case 80 /* PrivateIdentifier */: + case 81 /* PrivateIdentifier */: return emitPrivateIdentifier(node); - case 206 /* ArrayLiteralExpression */: + case 208 /* ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: return emitElementAccessExpression(node); - case 210 /* CallExpression */: + case 212 /* CallExpression */: return emitCallExpression(node); - case 211 /* NewExpression */: + case 213 /* NewExpression */: return emitNewExpression(node); - case 212 /* TaggedTemplateExpression */: + case 214 /* TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 213 /* TypeAssertionExpression */: + case 215 /* TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 215 /* FunctionExpression */: + case 217 /* FunctionExpression */: return emitFunctionExpression(node); - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: return emitArrowFunction(node); - case 217 /* DeleteExpression */: + case 219 /* DeleteExpression */: return emitDeleteExpression(node); - case 218 /* TypeOfExpression */: + case 220 /* TypeOfExpression */: return emitTypeOfExpression(node); - case 219 /* VoidExpression */: + case 221 /* VoidExpression */: return emitVoidExpression(node); - case 220 /* AwaitExpression */: + case 222 /* AwaitExpression */: return emitAwaitExpression(node); - case 221 /* PrefixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 222 /* PostfixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return emitBinaryExpression(node); - case 224 /* ConditionalExpression */: + case 226 /* ConditionalExpression */: return emitConditionalExpression(node); - case 225 /* TemplateExpression */: + case 227 /* TemplateExpression */: return emitTemplateExpression(node); - case 226 /* YieldExpression */: + case 228 /* YieldExpression */: return emitYieldExpression(node); - case 227 /* SpreadElement */: + case 229 /* SpreadElement */: return emitSpreadElement(node); - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: return emitClassExpression(node); - case 229 /* OmittedExpression */: + case 231 /* OmittedExpression */: return; - case 231 /* AsExpression */: + case 233 /* AsExpression */: return emitAsExpression(node); - case 232 /* NonNullExpression */: + case 234 /* NonNullExpression */: return emitNonNullExpression(node); - case 230 /* ExpressionWithTypeArguments */: + case 232 /* ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 235 /* SatisfiesExpression */: + case 237 /* SatisfiesExpression */: return emitSatisfiesExpression(node); - case 233 /* MetaProperty */: + case 235 /* MetaProperty */: return emitMetaProperty(node); - case 234 /* SyntheticExpression */: + case 236 /* SyntheticExpression */: return Debug.fail("SyntheticExpression should never be printed."); - case 279 /* MissingDeclaration */: + case 281 /* MissingDeclaration */: return; - case 281 /* JsxElement */: + case 283 /* JsxElement */: return emitJsxElement(node); - case 282 /* JsxSelfClosingElement */: + case 284 /* JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 285 /* JsxFragment */: + case 287 /* JsxFragment */: return emitJsxFragment(node); - case 354 /* SyntaxList */: + case 357 /* SyntaxList */: return Debug.fail("SyntaxList should not be printed"); - case 355 /* NotEmittedStatement */: + case 358 /* NotEmittedStatement */: return; - case 356 /* PartiallyEmittedExpression */: + case 359 /* PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 357 /* CommaListExpression */: + case 360 /* CommaListExpression */: return emitCommaList(node); - case 358 /* MergeDeclarationMarker */: - case 359 /* EndOfDeclarationMarker */: - return; - case 360 /* SyntheticReferenceExpression */: + case 361 /* SyntheticReferenceExpression */: return Debug.fail("SyntheticReferenceExpression should not be printed"); } } @@ -111085,7 +111805,7 @@ ${lanes.join("\n")} } function emitHelpers(node) { let helpersEmitted = false; - const bundle = node.kind === 309 /* Bundle */ ? node : void 0; + const bundle = node.kind === 312 /* Bundle */ ? node : void 0; if (bundle && moduleKind === 0 /* None */) { return; } @@ -111138,7 +111858,7 @@ ${lanes.join("\n")} } function emitLiteral(node, jsxAttributeEscape) { const text = getLiteralTextOfNode(node, printerOptions.neverAsciiEscape, jsxAttributeEscape); - if ((printerOptions.sourceMap || printerOptions.inlineSourceMap) && (node.kind === 10 /* StringLiteral */ || isTemplateLiteralKind(node.kind))) { + if ((printerOptions.sourceMap || printerOptions.inlineSourceMap) && (node.kind === 11 /* StringLiteral */ || isTemplateLiteralKind(node.kind))) { writeLiteral(text); } else { writeStringLiteral(text); @@ -111160,7 +111880,7 @@ ${lanes.join("\n")} updateOrPushBundleFileTextLike( pos, writer.getTextPos(), - unparsed.kind === 305 /* UnparsedText */ ? "text" /* Text */ : "internal" /* Internal */ + unparsed.kind === 308 /* UnparsedText */ ? "text" /* Text */ : "internal" /* Internal */ ); } } @@ -111196,7 +111916,7 @@ ${lanes.join("\n")} } function emitTabStop(hint, node, snippet) { Debug.assert( - node.kind === 239 /* EmptyStatement */, + node.kind === 241 /* EmptyStatement */, `A tab stop cannot be attached to a node of kind ${Debug.formatSyntaxKind(node.kind)}.` ); Debug.assert( @@ -111227,7 +111947,7 @@ ${lanes.join("\n")} emit(node.right); } function emitEntityName(node) { - if (node.kind === 79 /* Identifier */) { + if (node.kind === 80 /* Identifier */) { emitExpression(node); } else { emit(node); @@ -111268,7 +111988,7 @@ ${lanes.join("\n")} emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 320 /* JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 323 /* JSDocFunctionType */ && !node.name) { emit(node.type); } else { emitTypeAnnotation(node.type); @@ -111344,7 +112064,7 @@ ${lanes.join("\n")} /*allowDecorators*/ true ); - const token = node.kind === 174 /* GetAccessor */ ? 137 /* GetKeyword */ : 151 /* SetKeyword */; + const token = node.kind === 176 /* GetAccessor */ ? 139 /* GetKeyword */ : 153 /* SetKeyword */; emitTokenWithComment(token, pos, writeKeyword, node); writeSpace(); emit(node.name); @@ -111472,16 +112192,16 @@ ${lanes.join("\n")} emit(node.type); } function emitTupleType(node) { - emitTokenWithComment(22 /* OpenBracketToken */, node.pos, writePunctuation, node); + emitTokenWithComment(23 /* OpenBracketToken */, node.pos, writePunctuation, node); const flags = getEmitFlags(node) & 1 /* SingleLine */ ? 528 /* SingleLineTupleTypeElements */ : 657 /* MultiLineTupleTypeElements */; emitList(node, node.elements, flags | 524288 /* NoSpaceIfEmpty */, parenthesizer.parenthesizeElementTypeOfTupleType); - emitTokenWithComment(23 /* CloseBracketToken */, node.elements.end, writePunctuation, node); + emitTokenWithComment(24 /* CloseBracketToken */, node.elements.end, writePunctuation, node); } function emitNamedTupleMember(node) { emit(node.dotDotDotToken); emit(node.name); emit(node.questionToken); - emitTokenWithComment(58 /* ColonToken */, node.name.end, writePunctuation, node); + emitTokenWithComment(59 /* ColonToken */, node.name.end, writePunctuation, node); writeSpace(); emit(node.type); } @@ -111526,7 +112246,7 @@ ${lanes.join("\n")} function emitTypeOperator(node) { writeTokenText(node.operator, writeKeyword); writeSpace(); - const parenthesizerRule = node.operator === 146 /* ReadonlyKeyword */ ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; + const parenthesizerRule = node.operator === 148 /* ReadonlyKeyword */ ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; emit(node.type, parenthesizerRule); } function emitIndexedAccessType(node) { @@ -111546,7 +112266,7 @@ ${lanes.join("\n")} } if (node.readonlyToken) { emit(node.readonlyToken); - if (node.readonlyToken.kind !== 146 /* ReadonlyKeyword */) { + if (node.readonlyToken.kind !== 148 /* ReadonlyKeyword */) { writeKeyword("readonly"); } writeSpace(); @@ -111562,7 +112282,7 @@ ${lanes.join("\n")} writePunctuation("]"); if (node.questionToken) { emit(node.questionToken); - if (node.questionToken.kind !== 57 /* QuestionToken */) { + if (node.questionToken.kind !== 58 /* QuestionToken */) { writePunctuation("?"); } } @@ -111660,7 +112380,7 @@ ${lanes.join("\n")} } function emitPropertyAccessExpression(node) { emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); - const token = node.questionDotToken || setTextRangePosEnd(factory.createToken(24 /* DotToken */), node.expression.end, node.name.pos); + const token = node.questionDotToken || setTextRangePosEnd(factory.createToken(25 /* DotToken */), node.expression.end, node.name.pos); const linesBeforeDot = getLinesBetweenNodes(node, node.expression, token); const linesAfterDot = getLinesBetweenNodes(node, token, node.name); writeLinesAndIndent( @@ -111668,7 +112388,7 @@ ${lanes.join("\n")} /*writeSpaceIfNotIndenting*/ false ); - const shouldEmitDotDot = token.kind !== 28 /* QuestionDotToken */ && mayNeedDotDotForPropertyAccess(node.expression) && !writer.hasTrailingComment() && !writer.hasTrailingWhitespace(); + const shouldEmitDotDot = token.kind !== 29 /* QuestionDotToken */ && mayNeedDotDotForPropertyAccess(node.expression) && !writer.hasTrailingComment() && !writer.hasTrailingWhitespace(); if (shouldEmitDotDot) { writePunctuation("."); } @@ -111695,7 +112415,7 @@ ${lanes.join("\n")} /*jsxAttributeEscape*/ false ); - return !expression.numericLiteralFlags && !stringContains(text, tokenToString(24 /* DotToken */)); + return !(expression.numericLiteralFlags & 448 /* WithSpecifier */) && !stringContains(text, tokenToString(25 /* DotToken */)) && !stringContains(text, String.fromCharCode(69 /* E */)) && !stringContains(text, String.fromCharCode(101 /* e */)); } else if (isAccessExpression(expression)) { const constantValue = getConstantValue(expression); return typeof constantValue === "number" && isFinite(constantValue) && Math.floor(constantValue) === constantValue; @@ -111704,9 +112424,9 @@ ${lanes.join("\n")} function emitElementAccessExpression(node) { emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); emit(node.questionDotToken); - emitTokenWithComment(22 /* OpenBracketToken */, node.expression.end, writePunctuation, node); + emitTokenWithComment(23 /* OpenBracketToken */, node.expression.end, writePunctuation, node); emitExpression(node.argumentExpression); - emitTokenWithComment(23 /* CloseBracketToken */, node.argumentExpression.end, writePunctuation, node); + emitTokenWithComment(24 /* CloseBracketToken */, node.argumentExpression.end, writePunctuation, node); } function emitCallExpression(node) { const indirectCall = getInternalEmitFlags(node) & 16 /* IndirectCall */; @@ -111725,7 +112445,7 @@ ${lanes.join("\n")} emitExpressionList(node, node.arguments, 2576 /* CallExpressionArguments */, parenthesizer.parenthesizeExpressionForDisallowedComma); } function emitNewExpression(node) { - emitTokenWithComment(103 /* NewKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(105 /* NewKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeExpressionOfNew); emitTypeArguments(node, node.typeArguments); @@ -111754,16 +112474,16 @@ ${lanes.join("\n")} emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitParenthesizedExpression(node) { - const openParenPos = emitTokenWithComment(20 /* OpenParenToken */, node.pos, writePunctuation, node); + const openParenPos = emitTokenWithComment(21 /* OpenParenToken */, node.pos, writePunctuation, node); const indented = writeLineSeparatorsAndIndentBefore(node.expression, node); emitExpression( node.expression, - /*parenthesizerRules*/ + /*parenthesizerRule*/ void 0 ); writeLineSeparatorsAfter(node.expression, node); decreaseIndentIf(indented); - emitTokenWithComment(21 /* CloseParenToken */, node.expression ? node.expression.end : openParenPos, writePunctuation, node); + emitTokenWithComment(22 /* CloseParenToken */, node.expression ? node.expression.end : openParenPos, writePunctuation, node); } function emitFunctionExpression(node) { generateNameIfNeeded(node.name); @@ -111781,22 +112501,22 @@ ${lanes.join("\n")} emit(node.equalsGreaterThanToken); } function emitDeleteExpression(node) { - emitTokenWithComment(89 /* DeleteKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(91 /* DeleteKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitTypeOfExpression(node) { - emitTokenWithComment(112 /* TypeOfKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(114 /* TypeOfKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitVoidExpression(node) { - emitTokenWithComment(114 /* VoidKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(116 /* VoidKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitAwaitExpression(node) { - emitTokenWithComment(133 /* AwaitKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(135 /* AwaitKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } @@ -111809,7 +112529,7 @@ ${lanes.join("\n")} } function shouldEmitWhitespaceBeforeOperand(node) { const operand = node.operand; - return operand.kind === 221 /* PrefixUnaryExpression */ && (node.operator === 39 /* PlusToken */ && (operand.operator === 39 /* PlusToken */ || operand.operator === 45 /* PlusPlusToken */) || node.operator === 40 /* MinusToken */ && (operand.operator === 40 /* MinusToken */ || operand.operator === 46 /* MinusMinusToken */)); + return operand.kind === 223 /* PrefixUnaryExpression */ && (node.operator === 40 /* PlusToken */ && (operand.operator === 40 /* PlusToken */ || operand.operator === 46 /* PlusPlusToken */) || node.operator === 41 /* MinusToken */ && (operand.operator === 41 /* MinusToken */ || operand.operator === 47 /* MinusMinusToken */)); } function emitPostfixUnaryExpression(node) { emitExpression(node.operand, parenthesizer.parenthesizeOperandOfPostfixUnary); @@ -111857,12 +112577,12 @@ ${lanes.join("\n")} return maybeEmitExpression(next, parent2, "left"); } function onOperator(operatorToken, _state, node) { - const isCommaOperator = operatorToken.kind !== 27 /* CommaToken */; + const isCommaOperator = operatorToken.kind !== 28 /* CommaToken */; const linesBeforeOperator = getLinesBetweenNodes(node, node.left, operatorToken); const linesAfterOperator = getLinesBetweenNodes(node, operatorToken, node.right); writeLinesAndIndent(linesBeforeOperator, isCommaOperator); emitLeadingCommentsOfPosition(operatorToken.pos); - writeTokenNode(operatorToken, operatorToken.kind === 101 /* InKeyword */ ? writeKeyword : writeOperator); + writeTokenNode(operatorToken, operatorToken.kind === 103 /* InKeyword */ ? writeKeyword : writeOperator); emitTrailingCommentsOfPosition( operatorToken.end, /*prefixSpace*/ @@ -111953,12 +112673,12 @@ ${lanes.join("\n")} emitList(node, node.templateSpans, 262144 /* TemplateExpressionSpans */); } function emitYieldExpression(node) { - emitTokenWithComment(125 /* YieldKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(127 /* YieldKeyword */, node.pos, writeKeyword, node); emit(node.asteriskToken); emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsiAndDisallowedComma); } function emitSpreadElement(node) { - emitTokenWithComment(25 /* DotDotDotToken */, node.pos, writePunctuation, node); + emitTokenWithComment(26 /* DotDotDotToken */, node.pos, writePunctuation, node); emitExpression(node.expression, parenthesizer.parenthesizeExpressionForDisallowedComma); } function emitClassExpression(node) { @@ -111972,7 +112692,7 @@ ${lanes.join("\n")} function emitAsExpression(node) { emitExpression( node.expression, - /*parenthesizerRules*/ + /*parenthesizerRule*/ void 0 ); if (node.type) { @@ -111989,7 +112709,7 @@ ${lanes.join("\n")} function emitSatisfiesExpression(node) { emitExpression( node.expression, - /*parenthesizerRules*/ + /*parenthesizerRule*/ void 0 ); if (node.type) { @@ -112017,7 +112737,7 @@ ${lanes.join("\n")} } function emitBlockStatements(node, forceSingleLine) { emitTokenWithComment( - 18 /* OpenBraceToken */, + 19 /* OpenBraceToken */, node.pos, writePunctuation, /*contextNode*/ @@ -112026,7 +112746,7 @@ ${lanes.join("\n")} const format = forceSingleLine || getEmitFlags(node) & 1 /* SingleLine */ ? 768 /* SingleLineBlockStatements */ : 129 /* MultiLineBlockStatements */; emitList(node, node.statements, format); emitTokenWithComment( - 19 /* CloseBraceToken */, + 20 /* CloseBraceToken */, node.statements.end, writePunctuation, /*contextNode*/ @@ -112059,16 +112779,16 @@ ${lanes.join("\n")} } } function emitIfStatement(node) { - const openParenPos = emitTokenWithComment(99 /* IfKeyword */, node.pos, writeKeyword, node); + const openParenPos = emitTokenWithComment(101 /* IfKeyword */, node.pos, writeKeyword, node); writeSpace(); - emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node); + emitTokenWithComment(21 /* OpenParenToken */, openParenPos, writePunctuation, node); emitExpression(node.expression); - emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node); + emitTokenWithComment(22 /* CloseParenToken */, node.expression.end, writePunctuation, node); emitEmbeddedStatement(node, node.thenStatement); if (node.elseStatement) { writeLineOrSpace(node, node.thenStatement, node.elseStatement); - emitTokenWithComment(91 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 242 /* IfStatement */) { + emitTokenWithComment(93 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node); + if (node.elseStatement.kind === 244 /* IfStatement */) { writeSpace(); emit(node.elseStatement); } else { @@ -112077,14 +112797,14 @@ ${lanes.join("\n")} } } function emitWhileClause(node, startPos) { - const openParenPos = emitTokenWithComment(115 /* WhileKeyword */, startPos, writeKeyword, node); + const openParenPos = emitTokenWithComment(117 /* WhileKeyword */, startPos, writeKeyword, node); writeSpace(); - emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node); + emitTokenWithComment(21 /* OpenParenToken */, openParenPos, writePunctuation, node); emitExpression(node.expression); - emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node); + emitTokenWithComment(22 /* CloseParenToken */, node.expression.end, writePunctuation, node); } function emitDoStatement(node) { - emitTokenWithComment(90 /* DoKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(92 /* DoKeyword */, node.pos, writeKeyword, node); emitEmbeddedStatement(node, node.statement); if (isBlock(node.statement) && !preserveSourceNewlines) { writeSpace(); @@ -112099,51 +112819,51 @@ ${lanes.join("\n")} emitEmbeddedStatement(node, node.statement); } function emitForStatement(node) { - const openParenPos = emitTokenWithComment(97 /* ForKeyword */, node.pos, writeKeyword, node); + const openParenPos = emitTokenWithComment(99 /* ForKeyword */, node.pos, writeKeyword, node); writeSpace(); let pos = emitTokenWithComment( - 20 /* OpenParenToken */, + 21 /* OpenParenToken */, openParenPos, writePunctuation, /*contextNode*/ node ); emitForBinding(node.initializer); - pos = emitTokenWithComment(26 /* SemicolonToken */, node.initializer ? node.initializer.end : pos, writePunctuation, node); + pos = emitTokenWithComment(27 /* SemicolonToken */, node.initializer ? node.initializer.end : pos, writePunctuation, node); emitExpressionWithLeadingSpace(node.condition); - pos = emitTokenWithComment(26 /* SemicolonToken */, node.condition ? node.condition.end : pos, writePunctuation, node); + pos = emitTokenWithComment(27 /* SemicolonToken */, node.condition ? node.condition.end : pos, writePunctuation, node); emitExpressionWithLeadingSpace(node.incrementor); - emitTokenWithComment(21 /* CloseParenToken */, node.incrementor ? node.incrementor.end : pos, writePunctuation, node); + emitTokenWithComment(22 /* CloseParenToken */, node.incrementor ? node.incrementor.end : pos, writePunctuation, node); emitEmbeddedStatement(node, node.statement); } function emitForInStatement(node) { - const openParenPos = emitTokenWithComment(97 /* ForKeyword */, node.pos, writeKeyword, node); + const openParenPos = emitTokenWithComment(99 /* ForKeyword */, node.pos, writeKeyword, node); writeSpace(); - emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node); + emitTokenWithComment(21 /* OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(101 /* InKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(103 /* InKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); - emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node); + emitTokenWithComment(22 /* CloseParenToken */, node.expression.end, writePunctuation, node); emitEmbeddedStatement(node, node.statement); } function emitForOfStatement(node) { - const openParenPos = emitTokenWithComment(97 /* ForKeyword */, node.pos, writeKeyword, node); + const openParenPos = emitTokenWithComment(99 /* ForKeyword */, node.pos, writeKeyword, node); writeSpace(); emitWithTrailingSpace(node.awaitModifier); - emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node); + emitTokenWithComment(21 /* OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(162 /* OfKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(164 /* OfKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); - emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node); + emitTokenWithComment(22 /* CloseParenToken */, node.expression.end, writePunctuation, node); emitEmbeddedStatement(node, node.statement); } function emitForBinding(node) { if (node !== void 0) { - if (node.kind === 258 /* VariableDeclarationList */) { + if (node.kind === 260 /* VariableDeclarationList */) { emit(node); } else { emitExpression(node); @@ -112151,12 +112871,12 @@ ${lanes.join("\n")} } } function emitContinueStatement(node) { - emitTokenWithComment(86 /* ContinueKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(88 /* ContinueKeyword */, node.pos, writeKeyword, node); emitWithLeadingSpace(node.label); writeTrailingSemicolon(); } function emitBreakStatement(node) { - emitTokenWithComment(81 /* BreakKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(83 /* BreakKeyword */, node.pos, writeKeyword, node); emitWithLeadingSpace(node.label); writeTrailingSemicolon(); } @@ -112179,7 +112899,7 @@ ${lanes.join("\n")} } pos = writeTokenText(token, writer2, pos); if (isSimilarNode && contextNode.end !== pos) { - const isJsxExprContext = contextNode.kind === 291 /* JsxExpression */; + const isJsxExprContext = contextNode.kind === 293 /* JsxExpression */; emitTrailingCommentsOfPosition( pos, /*prefixSpace*/ @@ -112227,7 +112947,7 @@ ${lanes.join("\n")} } function emitReturnStatement(node) { emitTokenWithComment( - 105 /* ReturnKeyword */, + 107 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ @@ -112237,35 +112957,35 @@ ${lanes.join("\n")} writeTrailingSemicolon(); } function emitWithStatement(node) { - const openParenPos = emitTokenWithComment(116 /* WithKeyword */, node.pos, writeKeyword, node); + const openParenPos = emitTokenWithComment(118 /* WithKeyword */, node.pos, writeKeyword, node); writeSpace(); - emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node); + emitTokenWithComment(21 /* OpenParenToken */, openParenPos, writePunctuation, node); emitExpression(node.expression); - emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node); + emitTokenWithComment(22 /* CloseParenToken */, node.expression.end, writePunctuation, node); emitEmbeddedStatement(node, node.statement); } function emitSwitchStatement(node) { - const openParenPos = emitTokenWithComment(107 /* SwitchKeyword */, node.pos, writeKeyword, node); + const openParenPos = emitTokenWithComment(109 /* SwitchKeyword */, node.pos, writeKeyword, node); writeSpace(); - emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node); + emitTokenWithComment(21 /* OpenParenToken */, openParenPos, writePunctuation, node); emitExpression(node.expression); - emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node); + emitTokenWithComment(22 /* CloseParenToken */, node.expression.end, writePunctuation, node); writeSpace(); emit(node.caseBlock); } function emitLabeledStatement(node) { emit(node.label); - emitTokenWithComment(58 /* ColonToken */, node.label.end, writePunctuation, node); + emitTokenWithComment(59 /* ColonToken */, node.label.end, writePunctuation, node); writeSpace(); emit(node.statement); } function emitThrowStatement(node) { - emitTokenWithComment(109 /* ThrowKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(111 /* ThrowKeyword */, node.pos, writeKeyword, node); emitExpressionWithLeadingSpace(parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi); writeTrailingSemicolon(); } function emitTryStatement(node) { - emitTokenWithComment(111 /* TryKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(113 /* TryKeyword */, node.pos, writeKeyword, node); writeSpace(); emit(node.tryBlock); if (node.catchClause) { @@ -112274,21 +112994,21 @@ ${lanes.join("\n")} } if (node.finallyBlock) { writeLineOrSpace(node, node.catchClause || node.tryBlock, node.finallyBlock); - emitTokenWithComment(96 /* FinallyKeyword */, (node.catchClause || node.tryBlock).end, writeKeyword, node); + emitTokenWithComment(98 /* FinallyKeyword */, (node.catchClause || node.tryBlock).end, writeKeyword, node); writeSpace(); emit(node.finallyBlock); } } function emitDebuggerStatement(node) { - writeToken(87 /* DebuggerKeyword */, node.pos, writeKeyword); + writeToken(89 /* DebuggerKeyword */, node.pos, writeKeyword); writeTrailingSemicolon(); } function emitVariableDeclaration(node) { - var _a2, _b, _c, _d, _e; + var _a, _b, _c; emit(node.name); emit(node.exclamationToken); emitTypeAnnotation(node.type); - emitInitializer(node.initializer, (_e = (_d = (_a2 = node.type) == null ? void 0 : _a2.end) != null ? _d : (_c = (_b = node.name.emitNode) == null ? void 0 : _b.typeNode) == null ? void 0 : _c.end) != null ? _e : node.name.end, node, parenthesizer.parenthesizeExpressionForDisallowedComma); + emitInitializer(node.initializer, ((_a = node.type) == null ? void 0 : _a.end) ?? ((_c = (_b = node.name.emitNode) == null ? void 0 : _b.typeNode) == null ? void 0 : _c.end) ?? node.name.end, node, parenthesizer.parenthesizeExpressionForDisallowedComma); } function emitVariableDeclarationList(node) { writeKeyword(isLet(node) ? "let" : isVarConst(node) ? "const" : "var"); @@ -112373,7 +113093,7 @@ ${lanes.join("\n")} const emitBlockFunctionBody2 = shouldEmitBlockFunctionBodyOnSingleLine(body) ? emitBlockFunctionBodyOnSingleLine : emitBlockFunctionBodyWorker; emitBodyWithDetachedComments(body, body.statements, emitBlockFunctionBody2); decreaseIndent(); - writeToken(19 /* CloseBraceToken */, body.statements.end, writePunctuation, body); + writeToken(20 /* CloseBraceToken */, body.statements.end, writePunctuation, body); onAfterEmitNode == null ? void 0 : onAfterEmitNode(body); } function emitBlockFunctionBodyOnSingleLine(body) { @@ -112418,7 +113138,7 @@ ${lanes.join("\n")} /*allowDecorators*/ true ); - emitTokenWithComment(84 /* ClassKeyword */, moveRangePastModifiers(node).pos, writeKeyword, node); + emitTokenWithComment(86 /* ClassKeyword */, moveRangePastModifiers(node).pos, writeKeyword, node); if (node.name) { writeSpace(); emitIdentifierName(node.name); @@ -112527,10 +113247,10 @@ ${lanes.join("\n")} popNameGenerationScope(node); } function emitCaseBlock(node) { - emitTokenWithComment(18 /* OpenBraceToken */, node.pos, writePunctuation, node); + emitTokenWithComment(19 /* OpenBraceToken */, node.pos, writePunctuation, node); emitList(node, node.clauses, 129 /* CaseBlockClauses */); emitTokenWithComment( - 19 /* CloseBraceToken */, + 20 /* CloseBraceToken */, node.clauses.end, writePunctuation, node, @@ -112545,21 +113265,21 @@ ${lanes.join("\n")} /*allowDecorators*/ false ); - emitTokenWithComment(100 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); + emitTokenWithComment(102 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - emitTokenWithComment(154 /* TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(156 /* TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); writeSpace(); - emitTokenWithComment(63 /* EqualsToken */, node.name.end, writePunctuation, node); + emitTokenWithComment(64 /* EqualsToken */, node.name.end, writePunctuation, node); writeSpace(); emitModuleReference(node.moduleReference); writeTrailingSemicolon(); } function emitModuleReference(node) { - if (node.kind === 79 /* Identifier */) { + if (node.kind === 80 /* Identifier */) { emitExpression(node); } else { emit(node); @@ -112572,12 +113292,12 @@ ${lanes.join("\n")} /*allowDecorators*/ false ); - emitTokenWithComment(100 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); + emitTokenWithComment(102 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(158 /* FromKeyword */, node.importClause.end, writeKeyword, node); + emitTokenWithComment(160 /* FromKeyword */, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -112588,20 +113308,20 @@ ${lanes.join("\n")} } function emitImportClause(node) { if (node.isTypeOnly) { - emitTokenWithComment(154 /* TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(156 /* TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); if (node.name && node.namedBindings) { - emitTokenWithComment(27 /* CommaToken */, node.name.end, writePunctuation, node); + emitTokenWithComment(28 /* CommaToken */, node.name.end, writePunctuation, node); writeSpace(); } emit(node.namedBindings); } function emitNamespaceImport(node) { - const asPos = emitTokenWithComment(41 /* AsteriskToken */, node.pos, writePunctuation, node); + const asPos = emitTokenWithComment(42 /* AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(128 /* AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(130 /* AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -112612,15 +113332,15 @@ ${lanes.join("\n")} emitImportOrExportSpecifier(node); } function emitExportAssignment(node) { - const nextPos = emitTokenWithComment(93 /* ExportKeyword */, node.pos, writeKeyword, node); + const nextPos = emitTokenWithComment(95 /* ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.isExportEquals) { - emitTokenWithComment(63 /* EqualsToken */, nextPos, writeOperator, node); + emitTokenWithComment(64 /* EqualsToken */, nextPos, writeOperator, node); } else { - emitTokenWithComment(88 /* DefaultKeyword */, nextPos, writeKeyword, node); + emitTokenWithComment(90 /* DefaultKeyword */, nextPos, writeKeyword, node); } writeSpace(); - emitExpression(node.expression, node.isExportEquals ? parenthesizer.getParenthesizeRightSideOfBinaryForOperator(63 /* EqualsToken */) : parenthesizer.parenthesizeExpressionOfExportDefault); + emitExpression(node.expression, node.isExportEquals ? parenthesizer.getParenthesizeRightSideOfBinaryForOperator(64 /* EqualsToken */) : parenthesizer.parenthesizeExpressionOfExportDefault); writeTrailingSemicolon(); } function emitExportDeclaration(node) { @@ -112630,21 +113350,21 @@ ${lanes.join("\n")} /*allowDecorators*/ false ); - let nextPos = emitTokenWithComment(93 /* ExportKeyword */, node.pos, writeKeyword, node); + let nextPos = emitTokenWithComment(95 /* ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - nextPos = emitTokenWithComment(154 /* TypeKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(156 /* TypeKeyword */, nextPos, writeKeyword, node); writeSpace(); } if (node.exportClause) { emit(node.exportClause); } else { - nextPos = emitTokenWithComment(41 /* AsteriskToken */, nextPos, writePunctuation, node); + nextPos = emitTokenWithComment(42 /* AsteriskToken */, nextPos, writePunctuation, node); } if (node.moduleSpecifier) { writeSpace(); const fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(158 /* FromKeyword */, fromPos, writeKeyword, node); + emitTokenWithComment(160 /* FromKeyword */, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } @@ -112654,7 +113374,7 @@ ${lanes.join("\n")} writeTrailingSemicolon(); } function emitAssertClause(node) { - emitTokenWithComment(130 /* AssertKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(132 /* AssertKeyword */, node.pos, writeKeyword, node); writeSpace(); const elements = node.elements; emitList(node, elements, 526226 /* ImportClauseEntries */); @@ -112671,19 +113391,19 @@ ${lanes.join("\n")} emit(value); } function emitNamespaceExportDeclaration(node) { - let nextPos = emitTokenWithComment(93 /* ExportKeyword */, node.pos, writeKeyword, node); + let nextPos = emitTokenWithComment(95 /* ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(128 /* AsKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(130 /* AsKeyword */, nextPos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(143 /* NamespaceKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(145 /* NamespaceKeyword */, nextPos, writeKeyword, node); writeSpace(); emit(node.name); writeTrailingSemicolon(); } function emitNamespaceExport(node) { - const asPos = emitTokenWithComment(41 /* AsteriskToken */, node.pos, writePunctuation, node); + const asPos = emitTokenWithComment(42 /* AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(128 /* AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(130 /* AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -112706,7 +113426,7 @@ ${lanes.join("\n")} if (node.propertyName) { emit(node.propertyName); writeSpace(); - emitTokenWithComment(128 /* AsKeyword */, node.propertyName.end, writeKeyword, node); + emitTokenWithComment(130 /* AsKeyword */, node.propertyName.end, writeKeyword, node); writeSpace(); } emit(node.name); @@ -112786,36 +113506,41 @@ ${lanes.join("\n")} return hasTrailingCommentsAtPosition(pos) || hasLeadingCommentsAtPosition(pos); } function emitJsxExpression(node) { - var _a2; + var _a; if (node.expression || !commentsDisabled && !nodeIsSynthesized(node) && hasCommentsAtPosition(node.pos)) { const isMultiline = currentSourceFile && !nodeIsSynthesized(node) && getLineAndCharacterOfPosition(currentSourceFile, node.pos).line !== getLineAndCharacterOfPosition(currentSourceFile, node.end).line; if (isMultiline) { writer.increaseIndent(); } - const end = emitTokenWithComment(18 /* OpenBraceToken */, node.pos, writePunctuation, node); + const end = emitTokenWithComment(19 /* OpenBraceToken */, node.pos, writePunctuation, node); emit(node.dotDotDotToken); emitExpression(node.expression); - emitTokenWithComment(19 /* CloseBraceToken */, ((_a2 = node.expression) == null ? void 0 : _a2.end) || end, writePunctuation, node); + emitTokenWithComment(20 /* CloseBraceToken */, ((_a = node.expression) == null ? void 0 : _a.end) || end, writePunctuation, node); if (isMultiline) { writer.decreaseIndent(); } } } + function emitJsxNamespacedName(node) { + emitIdentifierName(node.namespace); + writePunctuation(":"); + emitIdentifierName(node.name); + } function emitJsxTagName(node) { - if (node.kind === 79 /* Identifier */) { + if (node.kind === 80 /* Identifier */) { emitExpression(node); } else { emit(node); } } function emitCaseClause(node) { - emitTokenWithComment(82 /* CaseKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(84 /* CaseKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeExpressionForDisallowedComma); emitCaseOrDefaultClauseRest(node, node.statements, node.expression.end); } function emitDefaultClause(node) { - const pos = emitTokenWithComment(88 /* DefaultKeyword */, node.pos, writeKeyword, node); + const pos = emitTokenWithComment(90 /* DefaultKeyword */, node.pos, writeKeyword, node); emitCaseOrDefaultClauseRest(node, node.statements, pos); } function emitCaseOrDefaultClauseRest(parentNode, statements, colonPos) { @@ -112823,11 +113548,11 @@ ${lanes.join("\n")} (!currentSourceFile || nodeIsSynthesized(parentNode) || nodeIsSynthesized(statements[0]) || rangeStartPositionsAreOnSameLine(parentNode, statements[0], currentSourceFile)); let format = 163969 /* CaseOrDefaultClauseStatements */; if (emitAsSingleStatement) { - writeToken(58 /* ColonToken */, colonPos, writePunctuation, parentNode); + writeToken(59 /* ColonToken */, colonPos, writePunctuation, parentNode); writeSpace(); format &= ~(1 /* MultiLine */ | 128 /* Indented */); } else { - emitTokenWithComment(58 /* ColonToken */, colonPos, writePunctuation, parentNode); + emitTokenWithComment(59 /* ColonToken */, colonPos, writePunctuation, parentNode); } emitList(parentNode, statements, format); } @@ -112838,12 +113563,12 @@ ${lanes.join("\n")} emitList(node, node.types, 528 /* HeritageClauseTypes */); } function emitCatchClause(node) { - const openParenPos = emitTokenWithComment(83 /* CatchKeyword */, node.pos, writeKeyword, node); + const openParenPos = emitTokenWithComment(85 /* CatchKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.variableDeclaration) { - emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node); + emitTokenWithComment(21 /* OpenParenToken */, openParenPos, writePunctuation, node); emit(node.variableDeclaration); - emitTokenWithComment(21 /* CloseParenToken */, node.variableDeclaration.end, writePunctuation, node); + emitTokenWithComment(22 /* CloseParenToken */, node.variableDeclaration.end, writePunctuation, node); writeSpace(); } emit(node.block); @@ -112870,7 +113595,7 @@ ${lanes.join("\n")} } function emitSpreadAssignment(node) { if (node.expression) { - emitTokenWithComment(25 /* DotDotDotToken */, node.pos, writePunctuation, node); + emitTokenWithComment(26 /* DotDotDotToken */, node.pos, writePunctuation, node); emitExpression(node.expression, parenthesizer.parenthesizeExpressionForDisallowedComma); } } @@ -112894,7 +113619,7 @@ ${lanes.join("\n")} } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 347 /* JSDocTypeTag */ && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 350 /* JSDocTypeTag */ && !node.comment) { writeSpace(); emit(node.tags[0]); } else { @@ -112938,7 +113663,7 @@ ${lanes.join("\n")} function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 312 /* JSDocTypeExpression */) { + if (tag.typeExpression.kind === 315 /* JSDocTypeExpression */) { emitJSDocTypeExpression(tag.typeExpression); } else { writeSpace(); @@ -112956,7 +113681,7 @@ ${lanes.join("\n")} emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 325 /* JSDocTypeLiteral */) { + if (tag.typeExpression && tag.typeExpression.kind === 328 /* JSDocTypeLiteral */) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -113326,7 +114051,7 @@ ${lanes.join("\n")} function emitInitializer(node, equalCommentStartPos, container, parenthesizerRule) { if (node) { writeSpace(); - emitTokenWithComment(63 /* EqualsToken */, equalCommentStartPos, writeOperator, container); + emitTokenWithComment(64 /* EqualsToken */, equalCommentStartPos, writeOperator, container); writeSpace(); emitExpression(node, parenthesizerRule); } @@ -113356,7 +114081,7 @@ ${lanes.join("\n")} } } function emitEmbeddedStatement(parent2, node) { - if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */) { + if (isBlock(node) || getEmitFlags(parent2) & 1 /* SingleLine */ || preserveSourceNewlines && !getLeadingLineTerminatorCount(parent2, node, 0 /* None */)) { writeSpace(); emit(node); } else { @@ -113539,7 +114264,7 @@ ${lanes.join("\n")} const emitTrailingComma = hasTrailingComma && format & 64 /* AllowTrailingComma */ && format & 16 /* CommaDelimited */; if (emitTrailingComma) { if (previousSibling && !skipTrailingComments) { - emitTokenWithComment(27 /* CommaToken */, previousSibling.end, writePunctuation, previousSibling); + emitTokenWithComment(28 /* CommaToken */, previousSibling.end, writePunctuation, previousSibling); } else { writePunctuation(","); } @@ -113681,7 +114406,7 @@ ${lanes.join("\n")} if (firstChild.pos === nextListElementPos) { return 0; } - if (firstChild.kind === 11 /* JsxText */) { + if (firstChild.kind === 12 /* JsxText */) { return 0; } if (currentSourceFile && parentNode && !positionIsSynthesized(parentNode.pos) && !nodeIsSynthesized(firstChild) && (!firstChild.parent || getOriginalNode(firstChild.parent) === getOriginalNode(parentNode))) { @@ -113708,7 +114433,7 @@ ${lanes.join("\n")} if (previousNode === void 0 || nextNode === void 0) { return 0; } - if (nextNode.kind === 11 /* JsxText */) { + if (nextNode.kind === 12 /* JsxText */) { return 0; } else if (currentSourceFile && !nodeIsSynthesized(previousNode) && !nodeIsSynthesized(nextNode)) { if (preserveSourceNewlines && siblingNodePositionsAreComparable(previousNode, nextNode)) { @@ -113839,7 +114564,7 @@ ${lanes.join("\n")} return block.statements.length === 0 && (!currentSourceFile || rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); } function skipSynthesizedParentheses(node) { - while (node.kind === 214 /* ParenthesizedExpression */ && nodeIsSynthesized(node)) { + while (node.kind === 216 /* ParenthesizedExpression */ && nodeIsSynthesized(node)) { node = node.expression; } return node; @@ -113857,6 +114582,10 @@ ${lanes.join("\n")} if (!canUseSourceFile || getSourceFileOfNode(node) !== getOriginalNode(sourceFile)) { return idText(node); } + } else if (isJsxNamespacedName(node)) { + if (!canUseSourceFile || getSourceFileOfNode(node) !== getOriginalNode(sourceFile)) { + return getTextOfJsxNamespacedName(node); + } } else { Debug.assertNode(node, isLiteralExpression); if (!canUseSourceFile) { @@ -113866,11 +114595,11 @@ ${lanes.join("\n")} return getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia); } function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) { - if (node.kind === 10 /* StringLiteral */ && node.textSourceNode) { + if (node.kind === 11 /* StringLiteral */ && node.textSourceNode) { const textSourceNode = node.textSourceNode; - if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode)) { + if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode) || isJsxNamespacedName(textSourceNode)) { const text = isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode2(textSourceNode); - return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || getEmitFlags(node) & 33554432 /* NoAsciiEscaping */ ? `"${escapeString(text)}"` : `"${escapeNonAsciiString(text)}"`; + return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || getEmitFlags(node) & 16777216 /* NoAsciiEscaping */ ? `"${escapeString(text)}"` : `"${escapeNonAsciiString(text)}"`; } else { return getLiteralTextOfNode(textSourceNode, neverAsciiEscape, jsxAttributeEscape); } @@ -113922,84 +114651,84 @@ ${lanes.join("\n")} if (!node) return; switch (node.kind) { - case 238 /* Block */: + case 240 /* Block */: forEach(node.statements, generateNames); break; - case 253 /* LabeledStatement */: - case 251 /* WithStatement */: - case 243 /* DoStatement */: - case 244 /* WhileStatement */: + case 255 /* LabeledStatement */: + case 253 /* WithStatement */: + case 245 /* DoStatement */: + case 246 /* WhileStatement */: generateNames(node.statement); break; - case 242 /* IfStatement */: + case 244 /* IfStatement */: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 245 /* ForStatement */: - case 247 /* ForOfStatement */: - case 246 /* ForInStatement */: + case 247 /* ForStatement */: + case 249 /* ForOfStatement */: + case 248 /* ForInStatement */: generateNames(node.initializer); generateNames(node.statement); break; - case 252 /* SwitchStatement */: + case 254 /* SwitchStatement */: generateNames(node.caseBlock); break; - case 266 /* CaseBlock */: + case 268 /* CaseBlock */: forEach(node.clauses, generateNames); break; - case 292 /* CaseClause */: - case 293 /* DefaultClause */: + case 295 /* CaseClause */: + case 296 /* DefaultClause */: forEach(node.statements, generateNames); break; - case 255 /* TryStatement */: + case 257 /* TryStatement */: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 295 /* CatchClause */: + case 298 /* CatchClause */: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: generateNames(node.declarationList); break; - case 258 /* VariableDeclarationList */: + case 260 /* VariableDeclarationList */: forEach(node.declarations, generateNames); break; - case 257 /* VariableDeclaration */: - case 166 /* Parameter */: - case 205 /* BindingElement */: - case 260 /* ClassDeclaration */: + case 259 /* VariableDeclaration */: + case 168 /* Parameter */: + case 207 /* BindingElement */: + case 262 /* ClassDeclaration */: generateNameIfNeeded(node.name); break; - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: generateNameIfNeeded(node.name); if (getEmitFlags(node) & 1048576 /* ReuseTempVariableScope */) { forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 203 /* ObjectBindingPattern */: - case 204 /* ArrayBindingPattern */: + case 205 /* ObjectBindingPattern */: + case 206 /* ArrayBindingPattern */: forEach(node.elements, generateNames); break; - case 269 /* ImportDeclaration */: + case 271 /* ImportDeclaration */: generateNames(node.importClause); break; - case 270 /* ImportClause */: + case 272 /* ImportClause */: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 271 /* NamespaceImport */: + case 273 /* NamespaceImport */: generateNameIfNeeded(node.name); break; - case 277 /* NamespaceExport */: + case 279 /* NamespaceExport */: generateNameIfNeeded(node.name); break; - case 272 /* NamedImports */: + case 274 /* NamedImports */: forEach(node.elements, generateNames); break; - case 273 /* ImportSpecifier */: + case 275 /* ImportSpecifier */: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -114008,12 +114737,12 @@ ${lanes.join("\n")} if (!node) return; switch (node.kind) { - case 299 /* PropertyAssignment */: - case 300 /* ShorthandPropertyAssignment */: - case 169 /* PropertyDeclaration */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 302 /* PropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: + case 171 /* PropertyDeclaration */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: generateNameIfNeeded(node.name); break; } @@ -114039,15 +114768,15 @@ ${lanes.join("\n")} function generateNameCached(node, privateName, flags, prefix, suffix) { const nodeId = getNodeId(node); const cache = privateName ? nodeIdToGeneratedPrivateName : nodeIdToGeneratedName; - return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags != null ? flags : 0 /* None */, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix))); + return cache[nodeId] || (cache[nodeId] = generateNameForNode(node, privateName, flags ?? 0 /* None */, formatGeneratedNamePart(prefix, generateName), formatGeneratedNamePart(suffix))); } function isUniqueName(name, privateName) { - return isFileLevelUniqueName2(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name); + return isFileLevelUniqueNameInCurrentFile(name, privateName) && !isReservedName(name, privateName) && !generatedNames.has(name); } function isReservedName(name, privateName) { return privateName ? !!(reservedPrivateNames == null ? void 0 : reservedPrivateNames.has(name)) : !!(reservedNames == null ? void 0 : reservedNames.has(name)); } - function isFileLevelUniqueName2(name, _isPrivate) { + function isFileLevelUniqueNameInCurrentFile(name, _isPrivate) { return currentSourceFile ? isFileLevelUniqueName(currentSourceFile, name, hasGlobalName) : true; } function isUniqueLocalName(name, container) { @@ -114062,14 +114791,13 @@ ${lanes.join("\n")} return true; } function getTempFlags(formattedNameKey) { - var _a2; switch (formattedNameKey) { case "": return tempFlags; case "#": return privateNameTempFlags; default: - return (_a2 = formattedNameTempFlags == null ? void 0 : formattedNameTempFlags.get(formattedNameKey)) != null ? _a2 : 0 /* Auto */; + return (formattedNameTempFlags == null ? void 0 : formattedNameTempFlags.get(formattedNameKey)) ?? 0 /* Auto */; } } function setTempFlags(formattedNameKey, flags) { @@ -114081,7 +114809,7 @@ ${lanes.join("\n")} privateNameTempFlags = flags; break; default: - formattedNameTempFlags != null ? formattedNameTempFlags : formattedNameTempFlags = /* @__PURE__ */ new Map(); + formattedNameTempFlags ?? (formattedNameTempFlags = /* @__PURE__ */ new Map()); formattedNameTempFlags.set(formattedNameKey, flags); break; } @@ -114166,7 +114894,7 @@ ${lanes.join("\n")} function makeFileLevelOptimisticUniqueName(name) { return makeUniqueName2( name, - isFileLevelUniqueName2, + isFileLevelUniqueNameInCurrentFile, /*optimistic*/ true, /*scoped*/ @@ -114261,8 +114989,8 @@ ${lanes.join("\n")} } function generateNameForNode(node, privateName, flags, prefix, suffix) { switch (node.kind) { - case 79 /* Identifier */: - case 80 /* PrivateIdentifier */: + case 80 /* Identifier */: + case 81 /* PrivateIdentifier */: return makeUniqueName2( getTextOfNode2(node), isUniqueName, @@ -114272,16 +115000,16 @@ ${lanes.join("\n")} prefix, suffix ); - case 264 /* ModuleDeclaration */: - case 263 /* EnumDeclaration */: + case 266 /* ModuleDeclaration */: + case 265 /* EnumDeclaration */: Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node); - case 269 /* ImportDeclaration */: - case 275 /* ExportDeclaration */: + case 271 /* ImportDeclaration */: + case 277 /* ExportDeclaration */: Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node); - case 259 /* FunctionDeclaration */: - case 260 /* ClassDeclaration */: { + case 261 /* FunctionDeclaration */: + case 262 /* ClassDeclaration */: { Debug.assert(!prefix && !suffix && !privateName); const name = node.name; if (name && !isGeneratedIdentifier(name)) { @@ -114296,20 +115024,20 @@ ${lanes.join("\n")} } return generateNameForExportDefault(); } - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return generateNameForMethodOrAccessor(node, privateName, prefix, suffix); - case 164 /* ComputedPropertyName */: + case 166 /* ComputedPropertyName */: return makeTempVariableName( 0 /* Auto */, - /*reserveInNestedScopes*/ + /*reservedInNestedScopes*/ true, privateName, prefix, @@ -114318,7 +115046,7 @@ ${lanes.join("\n")} default: return makeTempVariableName( 0 /* Auto */, - /*reserveInNestedScopes*/ + /*reservedInNestedScopes*/ false, privateName, prefix, @@ -114346,7 +115074,7 @@ ${lanes.join("\n")} case 3 /* Unique */: return makeUniqueName2( idText(name), - autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueName2 : isUniqueName, + autoGenerate.flags & 32 /* FileLevel */ ? isFileLevelUniqueNameInCurrentFile : isUniqueName, !!(autoGenerate.flags & 16 /* Optimistic */), !!(autoGenerate.flags & 8 /* ReservedInNestedScopes */), isPrivateIdentifier(name), @@ -114393,14 +115121,14 @@ ${lanes.join("\n")} function emitLeadingCommentsOfNode(node, emitFlags, pos, end) { enterComment(); hasWrittenComment = false; - const skipLeadingComments = pos < 0 || (emitFlags & 1024 /* NoLeadingComments */) !== 0 || node.kind === 11 /* JsxText */; - const skipTrailingComments = end < 0 || (emitFlags & 2048 /* NoTrailingComments */) !== 0 || node.kind === 11 /* JsxText */; + const skipLeadingComments = pos < 0 || (emitFlags & 1024 /* NoLeadingComments */) !== 0 || node.kind === 12 /* JsxText */; + const skipTrailingComments = end < 0 || (emitFlags & 2048 /* NoTrailingComments */) !== 0 || node.kind === 12 /* JsxText */; if ((pos > 0 || end > 0) && pos !== end) { if (!skipLeadingComments) { emitLeadingComments( pos, /*isEmittedNode*/ - node.kind !== 355 /* NotEmittedStatement */ + node.kind !== 358 /* NotEmittedStatement */ ); } if (!skipLeadingComments || pos >= 0 && (emitFlags & 1024 /* NoLeadingComments */) !== 0) { @@ -114408,7 +115136,7 @@ ${lanes.join("\n")} } if (!skipTrailingComments || end >= 0 && (emitFlags & 2048 /* NoTrailingComments */) !== 0) { containerEnd = end; - if (node.kind === 258 /* VariableDeclarationList */) { + if (node.kind === 260 /* VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -114418,13 +115146,13 @@ ${lanes.join("\n")} } function emitTrailingCommentsOfNode(node, emitFlags, pos, end, savedContainerPos, savedContainerEnd, savedDeclarationListContainerEnd) { enterComment(); - const skipTrailingComments = end < 0 || (emitFlags & 2048 /* NoTrailingComments */) !== 0 || node.kind === 11 /* JsxText */; + const skipTrailingComments = end < 0 || (emitFlags & 2048 /* NoTrailingComments */) !== 0 || node.kind === 12 /* JsxText */; forEach(getSyntheticTrailingComments(node), emitTrailingSynthesizedComment); if ((pos > 0 || end > 0) && pos !== end) { containerPos = savedContainerPos; containerEnd = savedContainerEnd; declarationListContainerEnd = savedDeclarationListContainerEnd; - if (!skipTrailingComments && node.kind !== 355 /* NotEmittedStatement */) { + if (!skipTrailingComments && node.kind !== 358 /* NotEmittedStatement */) { emitTrailingComments(end); } } @@ -114696,7 +115424,7 @@ ${lanes.join("\n")} } } else { const source = sourceMapRange.source || sourceMapSource; - if (node.kind !== 355 /* NotEmittedStatement */ && (emitFlags & 32 /* NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) { + if (node.kind !== 358 /* NotEmittedStatement */ && (emitFlags & 32 /* NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); } if (emitFlags & 128 /* NoNestedSourceMaps */) { @@ -114711,7 +115439,7 @@ ${lanes.join("\n")} if (emitFlags & 128 /* NoNestedSourceMaps */) { sourceMapsDisabled = false; } - if (node.kind !== 355 /* NotEmittedStatement */ && (emitFlags & 64 /* NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) { + if (node.kind !== 358 /* NotEmittedStatement */ && (emitFlags & 64 /* NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); } } @@ -114853,6 +115581,7 @@ ${lanes.join("\n")} // Returns the constant value this property access resolves to: notImplemented, or 'undefined' for a non-constant getConstantValue: notImplemented, getReferencedValueDeclaration: notImplemented, + getReferencedValueDeclarations: notImplemented, getTypeReferenceSerializationKind: notImplemented, isOptionalParameter: notImplemented, moduleExportsSomeValue: notImplemented, @@ -114918,7 +115647,7 @@ ${lanes.join("\n")} return getBaseFileName(normalizePath(fileName)); } function createCachedFileSystemEntries(rootDir, rootDirPath) { - var _a2; + var _a; if (!host.realpath || ensureTrailingDirectorySeparator(toPath3(host.realpath(rootDir))) === rootDirPath) { const resultFromHost = { files: map(host.readDirectory( @@ -114935,7 +115664,7 @@ ${lanes.join("\n")} cachedReadDirectoryResult.set(ensureTrailingDirectorySeparator(rootDirPath), resultFromHost); return resultFromHost; } - if ((_a2 = host.directoryExists) == null ? void 0 : _a2.call(host, rootDir)) { + if ((_a = host.directoryExists) == null ? void 0 : _a.call(host, rootDir)) { cachedReadDirectoryResult.set(rootDirPath, false); return false; } @@ -115096,8 +115825,8 @@ ${lanes.join("\n")} } } function updateSharedExtendedConfigFileWatcher(projectPath, options, extendedConfigFilesMap, createExtendedConfigFileWatch, toPath3) { - var _a2; - const extendedConfigs = arrayToMap(((_a2 = options == null ? void 0 : options.configFile) == null ? void 0 : _a2.extendedSourceFiles) || emptyArray, toPath3); + var _a; + const extendedConfigs = arrayToMap(((_a = options == null ? void 0 : options.configFile) == null ? void 0 : _a.extendedSourceFiles) || emptyArray, toPath3); extendedConfigFilesMap.forEach((watcher, extendedConfigFilePath) => { if (!extendedConfigs.has(extendedConfigFilePath)) { watcher.projects.delete(projectPath); @@ -115133,8 +115862,8 @@ ${lanes.join("\n")} if (!extendedConfigCache.delete(extendedConfigFilePath)) return; extendedConfigCache.forEach(({ extendedResult }, key) => { - var _a2; - if ((_a2 = extendedResult.extendedSourceFiles) == null ? void 0 : _a2.some((extendedFile) => toPath3(extendedFile) === extendedConfigFilePath)) { + var _a; + if ((_a = extendedResult.extendedSourceFiles) == null ? void 0 : _a.some((extendedFile) => toPath3(extendedFile) === extendedConfigFilePath)) { cleanExtendedConfigCache(extendedConfigCache, key, toPath3); } }); @@ -115273,8 +116002,8 @@ ${lanes.join("\n")} }; function createExcludeHandlingAddWatch(key) { return (file, cb, flags, options, detailInfo1, detailInfo2) => { - var _a2; - return !matchesExclude(file, key === "watchFile" ? options == null ? void 0 : options.excludeFiles : options == null ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames(), ((_a2 = host.getCurrentDirectory) == null ? void 0 : _a2.call(host)) || "") ? factory2[key].call( + var _a; + return !matchesExclude(file, key === "watchFile" ? options == null ? void 0 : options.excludeFiles : options == null ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames(), ((_a = host.getCurrentDirectory) == null ? void 0 : _a.call(host)) || "") ? factory2[key].call( /*thisArgs*/ void 0, file, @@ -115364,7 +116093,6 @@ ${lanes.join("\n")} "src/compiler/watchUtilities.ts"() { "use strict"; init_ts2(); - init_ts2(); ConfigFileProgramReloadLevel = /* @__PURE__ */ ((ConfigFileProgramReloadLevel2) => { ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["None"] = 0] = "None"; ConfigFileProgramReloadLevel2[ConfigFileProgramReloadLevel2["Partial"] = 1] = "Partial"; @@ -115713,7 +116441,7 @@ ${lanes.join("\n")} output += formatColorAndReset(diagnosticCategoryName(diagnostic), getCategoryFormat(diagnostic.category)); output += formatColorAndReset(` TS${diagnostic.code}: `, "\x1B[90m" /* Grey */); output += flattenDiagnosticMessageText(diagnostic.messageText, host.getNewLine()); - if (diagnostic.file) { + if (diagnostic.file && diagnostic.code !== Diagnostics.File_appears_to_be_binary.code) { output += host.getNewLine(); output += formatCodeSpan(diagnostic.file, diagnostic.start, diagnostic.length, "", getCategoryFormat(diagnostic.category), host); } @@ -115764,17 +116492,17 @@ ${lanes.join("\n")} return getModeForUsageLocation(file, getModuleNameStringLiteralAt(file, index)); } function isExclusivelyTypeOnlyImportOrExport(decl) { - var _a2; + var _a; if (isExportDeclaration(decl)) { return decl.isTypeOnly; } - if ((_a2 = decl.importClause) == null ? void 0 : _a2.isTypeOnly) { + if ((_a = decl.importClause) == null ? void 0 : _a.isTypeOnly) { return true; } return false; } function getModeForUsageLocation(file, usage) { - var _a2, _b; + var _a, _b; if (file.impliedNodeFormat === void 0) return void 0; if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) { @@ -115787,7 +116515,7 @@ ${lanes.join("\n")} } } if (usage.parent.parent && isImportTypeNode(usage.parent.parent)) { - const override = getResolutionModeOverrideForClause((_a2 = usage.parent.parent.assertions) == null ? void 0 : _a2.assertClause); + const override = getResolutionModeOverrideForClause((_a = usage.parent.parent.assertions) == null ? void 0 : _a.assertClause); if (override) { return override; } @@ -115906,6 +116634,25 @@ ${lanes.join("\n")} }); } } + function getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName) { + const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory; + return combinePaths(containingDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`); + } + function getLibraryNameFromLibFileName(libFileName) { + const components = libFileName.split("."); + let path = components[1]; + let i = 2; + while (components[i] && components[i] !== "d") { + path += (i === 2 ? "/" : "-") + components[i]; + i++; + } + return "@typescript/lib-" + path; + } + function getLibFileNameFromLibReference(libReference) { + const libName = toFileNameLowerCase(libReference.fileName); + const libFileName = libMap.get(libName); + return { libName, libFileName }; + } function isReferencedFile(reason) { switch (reason == null ? void 0 : reason.kind) { case 3 /* Import */: @@ -115921,14 +116668,14 @@ ${lanes.join("\n")} return location.pos !== void 0; } function getReferencedFileLocation(getSourceFileByPath, ref) { - var _a2, _b, _c, _d, _e, _f; + var _a, _b, _c, _d, _e, _f; const file = Debug.checkDefined(getSourceFileByPath(ref.file)); const { kind, index } = ref; let pos, end, packageId, resolutionMode; switch (kind) { case 3 /* Import */: const importLiteral = getModuleNameStringLiteralAt(file, index); - packageId = (_c = (_b = (_a2 = file.resolvedModules) == null ? void 0 : _a2.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _b.resolvedModule) == null ? void 0 : _c.packageId; + packageId = (_c = (_b = (_a = file.resolvedModules) == null ? void 0 : _a.get(importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _b.resolvedModule) == null ? void 0 : _c.packageId; if (importLiteral.pos === -1) return { file, packageId, text: importLiteral.text }; pos = skipTrivia(file.text, importLiteral.pos); @@ -115949,7 +116696,7 @@ ${lanes.join("\n")} } return { file, pos, end, packageId }; } - function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { + function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { if (!program || (hasChangedAutomaticTypeDirectiveNames == null ? void 0 : hasChangedAutomaticTypeDirectiveNames())) return false; if (!arrayIsEqualTo(program.getRootFileNames(), rootFileNames)) @@ -115964,6 +116711,8 @@ ${lanes.join("\n")} const currentOptions = program.getCompilerOptions(); if (!compareDataObjects(currentOptions, newOptions)) return false; + if (program.resolvedLibReferences && forEachEntry(program.resolvedLibReferences, (_value, libFileName) => hasInvalidatedLibResolutions(libFileName))) + return false; if (currentOptions.configFile && newOptions.configFile) return currentOptions.configFile.text === newOptions.configFile.text; return true; @@ -116036,7 +116785,7 @@ ${lanes.join("\n")} }; } function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) { - var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p; + var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p; const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions; const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions; let { oldProgram } = createProgramOptions; @@ -116056,11 +116805,14 @@ ${lanes.join("\n")} let fileProcessingDiagnostics; let automaticTypeDirectiveNames; let automaticTypeDirectiveResolutions; + let resolvedLibReferences; + let resolvedLibProcessing; + let packageMap; const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0; let currentNodeModulesDepth = 0; const modulesWithElidedImports = /* @__PURE__ */ new Map(); const sourceFilesFoundSearchingNodeModules = /* @__PURE__ */ new Map(); - (_a2 = tracing) == null ? void 0 : _a2.push( + (_a = tracing) == null ? void 0 : _a.push( tracing.Phase.Program, "createProgram", { configFilePath: options.configFilePath, rootDir: options.rootDir }, @@ -116143,6 +116895,14 @@ ${lanes.join("\n")} createTypeReferenceResolutionLoader ); } + const hasInvalidatedLibResolutions = host.hasInvalidatedLibResolutions || returnFalse; + let actualResolveLibrary; + if (host.resolveLibrary) { + actualResolveLibrary = host.resolveLibrary.bind(host); + } else { + const libraryResolutionCache = createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()); + actualResolveLibrary = (libraryName, resolveFrom, options2) => resolveLibrary(libraryName, resolveFrom, options2, host, libraryResolutionCache); + } const packageIdToSourceFile = /* @__PURE__ */ new Map(); let sourceFileToPackageName = /* @__PURE__ */ new Map(); let redirectTargetsMap = createMultiMap(); @@ -116215,11 +116975,11 @@ ${lanes.join("\n")} { kind: 0 /* RootFile */, index } )); (_j = tracing) == null ? void 0 : _j.pop(); - automaticTypeDirectiveNames != null ? automaticTypeDirectiveNames : automaticTypeDirectiveNames = rootNames.length ? getAutomaticTypeDirectiveNames(options, host) : emptyArray; + automaticTypeDirectiveNames ?? (automaticTypeDirectiveNames = rootNames.length ? getAutomaticTypeDirectiveNames(options, host) : emptyArray); automaticTypeDirectiveResolutions = createModeAwareCache(); if (automaticTypeDirectiveNames.length) { (_k = tracing) == null ? void 0 : _k.push(tracing.Phase.Program, "processTypeReferences", { count: automaticTypeDirectiveNames.length }); - const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : host.getCurrentDirectory(); + const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory; const containingFilename = combinePaths(containingDirectory, inferredTypesContainingFile); const resolutions = resolveTypeReferenceDirectiveNamesReusingOldState(automaticTypeDirectiveNames, containingFilename); for (let i = 0; i < automaticTypeDirectiveNames.length; i++) { @@ -116309,6 +117069,7 @@ ${lanes.join("\n")} ); } oldProgram = void 0; + resolvedLibProcessing = void 0; const program = { getRootFileNames: () => rootNames, getSourceFile, @@ -116350,6 +117111,10 @@ ${lanes.join("\n")} sourceFileToPackageName, redirectTargetsMap, usesUriStyleNodeCoreModules, + resolvedLibReferences, + getCurrentPackagesMap: () => packageMap, + typesPackageExists, + packageBundlesTypes, isEmittedFile, getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2, getProjectReferences, @@ -116390,11 +117155,31 @@ ${lanes.join("\n")} measure("Program", "beforeProgram", "afterProgram"); (_p = tracing) == null ? void 0 : _p.pop(); return program; + function getPackagesMap() { + if (packageMap) + return packageMap; + packageMap = /* @__PURE__ */ new Map(); + files.forEach((sf) => { + if (!sf.resolvedModules) + return; + sf.resolvedModules.forEach(({ resolvedModule }) => { + if (resolvedModule == null ? void 0 : resolvedModule.packageId) + packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name)); + }); + }); + return packageMap; + } + function typesPackageExists(packageName) { + return getPackagesMap().has(getTypesPackageName(packageName)); + } + function packageBundlesTypes(packageName) { + return !!getPackagesMap().get(packageName); + } function addResolutionDiagnostics(resolution) { - var _a3; - if (!((_a3 = resolution.resolutionDiagnostics) == null ? void 0 : _a3.length)) + var _a2; + if (!((_a2 = resolution.resolutionDiagnostics) == null ? void 0 : _a2.length)) return; - (fileProcessingDiagnostics != null ? fileProcessingDiagnostics : fileProcessingDiagnostics = []).push({ + (fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push({ kind: 2 /* ResolutionDiagnostics */, diagnostics: resolution.resolutionDiagnostics }); @@ -116412,12 +117197,12 @@ ${lanes.join("\n")} addResolutionDiagnostics(fromCache); } function resolveModuleNamesWorker(moduleNames, containingFile, reusedNames) { - var _a3, _b2; + var _a2, _b2; if (!moduleNames.length) return emptyArray; const containingFileName = getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory); const redirectedReference = getRedirectReferenceForResolution(containingFile); - (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName }); + (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "resolveModuleNamesWorker", { containingFileName }); mark("beforeResolveModule"); const result = actualResolveModuleNamesWorker(moduleNames, containingFileName, redirectedReference, options, containingFile, reusedNames); mark("afterResolveModule"); @@ -116426,13 +117211,13 @@ ${lanes.join("\n")} return result; } function resolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFile, reusedNames) { - var _a3, _b2; + var _a2, _b2; if (!typeDirectiveNames.length) return []; const containingSourceFile = !isString(containingFile) ? containingFile : void 0; const containingFileName = !isString(containingFile) ? getNormalizedAbsolutePath(containingFile.originalFileName, currentDirectory) : containingFile; const redirectedReference = containingSourceFile && getRedirectReferenceForResolution(containingSourceFile); - (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName }); + (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "resolveTypeReferenceDirectiveNamesWorker", { containingFileName }); mark("beforeResolveTypeReference"); const result = actualResolveTypeReferenceDirectiveNamesWorker(typeDirectiveNames, containingFileName, redirectedReference, options, containingSourceFile, reusedNames); mark("afterResolveTypeReference"); @@ -116502,18 +117287,18 @@ ${lanes.join("\n")} return commonSourceDirectory; } function getClassifiableNames() { - var _a3; + var _a2; if (!classifiableNames) { getTypeChecker(); classifiableNames = /* @__PURE__ */ new Set(); for (const sourceFile of files) { - (_a3 = sourceFile.classifiableNames) == null ? void 0 : _a3.forEach((value) => classifiableNames.add(value)); + (_a2 = sourceFile.classifiableNames) == null ? void 0 : _a2.forEach((value) => classifiableNames.add(value)); } } return classifiableNames; } function resolveModuleNamesReusingOldState(moduleNames, file) { - var _a3; + var _a2; if (structureIsReused === 0 /* Not */ && !file.ambientModuleNames.length) { return resolveModuleNamesWorker( moduleNames, @@ -116539,7 +117324,7 @@ ${lanes.join("\n")} const moduleName = moduleNames[i]; if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) { const mode = getModeForUsageLocation(file, moduleName); - const oldResolution = (_a3 = oldSourceFile.resolvedModules) == null ? void 0 : _a3.get(moduleName.text, mode); + const oldResolution = (_a2 = oldSourceFile.resolvedModules) == null ? void 0 : _a2.get(moduleName.text, mode); if (oldResolution == null ? void 0 : oldResolution.resolvedModule) { if (isTraceEnabled(options, host)) { trace( @@ -116551,8 +117336,8 @@ ${lanes.join("\n")} oldResolution.resolvedModule.packageId && packageIdToString(oldResolution.resolvedModule.packageId) ); } - (result != null ? result : result = new Array(moduleNames.length))[i] = oldResolution; - (reusedNames != null ? reusedNames : reusedNames = []).push(moduleName); + (result ?? (result = new Array(moduleNames.length)))[i] = oldResolution; + (reusedNames ?? (reusedNames = [])).push(moduleName); continue; } } @@ -116568,7 +117353,7 @@ ${lanes.join("\n")} if (resolvesToAmbientModuleInNonModifiedFile) { (result || (result = new Array(moduleNames.length)))[i] = predictedToResolveToAmbientModuleMarker; } else { - (unknownModuleNames != null ? unknownModuleNames : unknownModuleNames = []).push(moduleName); + (unknownModuleNames ?? (unknownModuleNames = [])).push(moduleName); } } const resolutions = unknownModuleNames && unknownModuleNames.length ? resolveModuleNamesWorker(unknownModuleNames, file, reusedNames) : emptyArray; @@ -116602,12 +117387,12 @@ ${lanes.join("\n")} } } function resolveTypeReferenceDirectiveNamesReusingOldState(typeDirectiveNames, containingFile) { - var _a3; + var _a2; if (structureIsReused === 0 /* Not */) { return resolveTypeReferenceDirectiveNamesWorker( typeDirectiveNames, containingFile, - /*resuedNames*/ + /*reusedNames*/ void 0 ); } @@ -116632,7 +117417,7 @@ ${lanes.join("\n")} if (canReuseResolutions) { const typeDirectiveName = getTypeReferenceResolutionName(entry); const mode = getModeForFileReference(entry, containingSourceFile == null ? void 0 : containingSourceFile.impliedNodeFormat); - const oldResolution = (_a3 = !isString(containingFile) ? oldSourceFile == null ? void 0 : oldSourceFile.resolvedTypeReferenceDirectiveNames : oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a3.get(typeDirectiveName, mode); + const oldResolution = (_a2 = !isString(containingFile) ? oldSourceFile == null ? void 0 : oldSourceFile.resolvedTypeReferenceDirectiveNames : oldProgram == null ? void 0 : oldProgram.getAutomaticTypeDirectiveResolutions()) == null ? void 0 : _a2.get(typeDirectiveName, mode); if (oldResolution == null ? void 0 : oldResolution.resolvedTypeReferenceDirective) { if (isTraceEnabled(options, host)) { trace( @@ -116644,12 +117429,12 @@ ${lanes.join("\n")} oldResolution.resolvedTypeReferenceDirective.packageId && packageIdToString(oldResolution.resolvedTypeReferenceDirective.packageId) ); } - (result != null ? result : result = new Array(typeDirectiveNames.length))[i] = oldResolution; - (reusedNames != null ? reusedNames : reusedNames = []).push(entry); + (result ?? (result = new Array(typeDirectiveNames.length)))[i] = oldResolution; + (reusedNames ?? (reusedNames = [])).push(entry); continue; } } - (unknownTypeReferenceDirectiveNames != null ? unknownTypeReferenceDirectiveNames : unknownTypeReferenceDirectiveNames = []).push(entry); + (unknownTypeReferenceDirectiveNames ?? (unknownTypeReferenceDirectiveNames = [])).push(entry); } if (!unknownTypeReferenceDirectiveNames) return result || emptyArray; @@ -116692,7 +117477,7 @@ ${lanes.join("\n")} ); } function tryReuseStructureFromOldProgram() { - var _a3; + var _a2; if (!oldProgram) { return 0 /* Not */; } @@ -116742,7 +117527,7 @@ ${lanes.join("\n")} if (!newSourceFile) { return 0 /* Not */; } - newSourceFile.packageJsonLocations = ((_a3 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _a3.length) ? sourceFileOptions.packageJsonLocations : void 0; + newSourceFile.packageJsonLocations = ((_a2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _a2.length) ? sourceFileOptions.packageJsonLocations : void 0; newSourceFile.packageJsonScope = sourceFileOptions.packageJsonScope; Debug.assert(!newSourceFile.redirectInfo, "Host should not return a redirect source file from `getSourceFile`"); let fileChanged; @@ -116838,6 +117623,9 @@ ${lanes.join("\n")} if (changesAffectingProgramStructure(oldOptions, options)) { return 1 /* SafeModules */; } + if (oldProgram.resolvedLibReferences && forEachEntry(oldProgram.resolvedLibReferences, (resolution, libFileName) => pathForLibFileWorker(libFileName).actual !== resolution.actual)) { + return 1 /* SafeModules */; + } if (host.hasChangedAutomaticTypeDirectiveNames) { if (host.hasChangedAutomaticTypeDirectiveNames()) return 1 /* SafeModules */; @@ -116874,6 +117662,8 @@ ${lanes.join("\n")} sourceFileToPackageName = oldProgram.sourceFileToPackageName; redirectTargetsMap = oldProgram.redirectTargetsMap; usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules; + resolvedLibReferences = oldProgram.resolvedLibReferences; + packageMap = oldProgram.getCurrentPackagesMap(); return 2 /* Completely */; } function getEmitHost(writeFileCallback) { @@ -116905,8 +117695,8 @@ ${lanes.join("\n")} }, useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(), getBuildInfo: (bundle) => { - var _a3; - return (_a3 = program.getBuildInfo) == null ? void 0 : _a3.call(program, bundle); + var _a2; + return (_a2 = program.getBuildInfo) == null ? void 0 : _a2.call(program, bundle); }, getSourceFileFromReference: (file, ref) => program.getSourceFileFromReference(file, ref), redirectTargetsMap, @@ -116918,9 +117708,9 @@ ${lanes.join("\n")} host.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data); } function emitBuildInfo(writeFileCallback) { - var _a3, _b2; + var _a2, _b2; Debug.assert(!outFile(options)); - (_a3 = tracing) == null ? void 0 : _a3.push( + (_a2 = tracing) == null ? void 0 : _a2.push( tracing.Phase.Emit, "emitBuildInfo", {}, @@ -116935,7 +117725,7 @@ ${lanes.join("\n")} void 0, /*transformers*/ noTransformers, - /*emitOnlyDtsFiles*/ + /*emitOnly*/ false, /*onlyBuildInfo*/ true @@ -116955,8 +117745,8 @@ ${lanes.join("\n")} return createPrependNodes( projectReferences, (_ref, index) => { - var _a3; - return (_a3 = resolvedProjectReferences[index]) == null ? void 0 : _a3.commandLine; + var _a2; + return (_a2 = resolvedProjectReferences[index]) == null ? void 0 : _a2.commandLine; }, (fileName) => { const path = toPath3(fileName); @@ -116983,15 +117773,15 @@ ${lanes.join("\n")} if (!options.lib) { return equalityComparer(file.fileName, getDefaultLibraryFileName()); } else { - return some(options.lib, (libFileName) => equalityComparer(file.fileName, pathForLibFile(libFileName))); + return some(options.lib, (libFileName) => equalityComparer(file.fileName, resolvedLibReferences.get(libFileName).actual)); } } function getTypeChecker() { return typeChecker || (typeChecker = createTypeChecker(program)); } function emit(sourceFile, writeFileCallback, cancellationToken, emitOnly, transformers, forceDtsEmit) { - var _a3, _b2; - (_a3 = tracing) == null ? void 0 : _a3.push( + var _a2, _b2; + (_a2 = tracing) == null ? void 0 : _a2.push( tracing.Phase.Emit, "emit", { path: sourceFile == null ? void 0 : sourceFile.path }, @@ -117051,19 +117841,19 @@ ${lanes.join("\n")} return getDiagnosticsHelper(sourceFile, getSemanticDiagnosticsForFile, cancellationToken); } function getCachedSemanticDiagnostics(sourceFile) { - var _a3; - return sourceFile ? (_a3 = cachedBindAndCheckDiagnosticsForFile.perFile) == null ? void 0 : _a3.get(sourceFile.path) : cachedBindAndCheckDiagnosticsForFile.allDiagnostics; + var _a2; + return sourceFile ? (_a2 = cachedBindAndCheckDiagnosticsForFile.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cachedBindAndCheckDiagnosticsForFile.allDiagnostics; } function getBindAndCheckDiagnostics(sourceFile, cancellationToken) { return getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken); } function getProgramDiagnostics(sourceFile) { - var _a3; + var _a2; if (skipTypeChecking(sourceFile, options, program)) { return emptyArray; } const programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); - if (!((_a3 = sourceFile.commentDirectives) == null ? void 0 : _a3.length)) { + if (!((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) { return programDiagnosticsInFile; } return getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, programDiagnosticsInFile).diagnostics; @@ -117126,9 +117916,9 @@ ${lanes.join("\n")} }); } function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics, ...allDiagnostics) { - var _a3; + var _a2; const flatDiagnostics = flatten(allDiagnostics); - if (!includeBindAndCheckDiagnostics || !((_a3 = sourceFile.commentDirectives) == null ? void 0 : _a3.length)) { + if (!includeBindAndCheckDiagnostics || !((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) { return flatDiagnostics; } const { diagnostics, directives } = getDiagnosticsWithPrecedingDirectives(sourceFile, sourceFile.commentDirectives, flatDiagnostics); @@ -117174,89 +117964,89 @@ ${lanes.join("\n")} return diagnostics; function walk(node, parent2) { switch (parent2.kind) { - case 166 /* Parameter */: - case 169 /* PropertyDeclaration */: - case 171 /* MethodDeclaration */: + case 168 /* Parameter */: + case 171 /* PropertyDeclaration */: + case 173 /* MethodDeclaration */: if (parent2.questionToken === node) { diagnostics.push(createDiagnosticForNode2(node, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return "skip"; } - case 170 /* MethodSignature */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 215 /* FunctionExpression */: - case 259 /* FunctionDeclaration */: - case 216 /* ArrowFunction */: - case 257 /* VariableDeclaration */: + case 172 /* MethodSignature */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 217 /* FunctionExpression */: + case 261 /* FunctionDeclaration */: + case 218 /* ArrowFunction */: + case 259 /* VariableDeclaration */: if (parent2.type === node) { diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); return "skip"; } } switch (node.kind) { - case 270 /* ImportClause */: + case 272 /* ImportClause */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode2(parent2, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); return "skip"; } break; - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode2(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); return "skip"; } break; - case 273 /* ImportSpecifier */: - case 278 /* ExportSpecifier */: + case 275 /* ImportSpecifier */: + case 280 /* ExportSpecifier */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode2(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, isImportSpecifier(node) ? "import...type" : "export...type")); return "skip"; } break; - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode2(node, Diagnostics.import_can_only_be_used_in_TypeScript_files)); return "skip"; - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode2(node, Diagnostics.export_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 294 /* HeritageClause */: + case 297 /* HeritageClause */: const heritageClause = node; - if (heritageClause.token === 117 /* ImplementsKeyword */) { + if (heritageClause.token === 119 /* ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode2(node, Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 261 /* InterfaceDeclaration */: - const interfaceKeyword = tokenToString(118 /* InterfaceKeyword */); + case 263 /* InterfaceDeclaration */: + const interfaceKeyword = tokenToString(120 /* InterfaceKeyword */); Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode2(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); return "skip"; - case 264 /* ModuleDeclaration */: - const moduleKeyword = node.flags & 16 /* Namespace */ ? tokenToString(143 /* NamespaceKeyword */) : tokenToString(142 /* ModuleKeyword */); + case 266 /* ModuleDeclaration */: + const moduleKeyword = node.flags & 16 /* Namespace */ ? tokenToString(145 /* NamespaceKeyword */) : tokenToString(144 /* ModuleKeyword */); Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode2(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return "skip"; - case 262 /* TypeAliasDeclaration */: + case 264 /* TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return "skip"; - case 263 /* EnumDeclaration */: - const enumKeyword = Debug.checkDefined(tokenToString(92 /* EnumKeyword */)); + case 265 /* EnumDeclaration */: + const enumKeyword = Debug.checkDefined(tokenToString(94 /* EnumKeyword */)); diagnostics.push(createDiagnosticForNode2(node, Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return "skip"; - case 232 /* NonNullExpression */: + case 234 /* NonNullExpression */: diagnostics.push(createDiagnosticForNode2(node, Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 231 /* AsExpression */: + case 233 /* AsExpression */: diagnostics.push(createDiagnosticForNode2(node.type, Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 235 /* SatisfiesExpression */: + case 237 /* SatisfiesExpression */: diagnostics.push(createDiagnosticForNode2(node.type, Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 213 /* TypeAssertionExpression */: + case 215 /* TypeAssertionExpression */: Debug.fail(); } } @@ -117291,47 +118081,47 @@ ${lanes.join("\n")} } } switch (parent2.kind) { - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 171 /* MethodDeclaration */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 215 /* FunctionExpression */: - case 259 /* FunctionDeclaration */: - case 216 /* ArrowFunction */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 173 /* MethodDeclaration */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 217 /* FunctionExpression */: + case 261 /* FunctionDeclaration */: + case 218 /* ArrowFunction */: if (nodes === parent2.typeParameters) { diagnostics.push(createDiagnosticForNodeArray2(nodes, Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return "skip"; } - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: if (nodes === parent2.modifiers) { - checkModifiers(parent2.modifiers, parent2.kind === 240 /* VariableStatement */); + checkModifiers(parent2.modifiers, parent2.kind === 242 /* VariableStatement */); return "skip"; } break; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: if (nodes === parent2.modifiers) { for (const modifier of nodes) { - if (isModifier(modifier) && modifier.kind !== 124 /* StaticKeyword */ && modifier.kind !== 127 /* AccessorKeyword */) { + if (isModifier(modifier) && modifier.kind !== 126 /* StaticKeyword */ && modifier.kind !== 129 /* AccessorKeyword */) { diagnostics.push(createDiagnosticForNode2(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind))); } } return "skip"; } break; - case 166 /* Parameter */: + case 168 /* Parameter */: if (nodes === parent2.modifiers && some(nodes, isModifier)) { diagnostics.push(createDiagnosticForNodeArray2(nodes, Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 210 /* CallExpression */: - case 211 /* NewExpression */: - case 230 /* ExpressionWithTypeArguments */: - case 282 /* JsxSelfClosingElement */: - case 283 /* JsxOpeningElement */: - case 212 /* TaggedTemplateExpression */: + case 212 /* CallExpression */: + case 213 /* NewExpression */: + case 232 /* ExpressionWithTypeArguments */: + case 284 /* JsxSelfClosingElement */: + case 285 /* JsxOpeningElement */: + case 214 /* TaggedTemplateExpression */: if (nodes === parent2.typeArguments) { diagnostics.push(createDiagnosticForNodeArray2(nodes, Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); return "skip"; @@ -117342,34 +118132,34 @@ ${lanes.join("\n")} function checkModifiers(modifiers, isConstValid) { for (const modifier of modifiers) { switch (modifier.kind) { - case 85 /* ConstKeyword */: + case 87 /* ConstKeyword */: if (isConstValid) { continue; } - case 123 /* PublicKeyword */: - case 121 /* PrivateKeyword */: - case 122 /* ProtectedKeyword */: - case 146 /* ReadonlyKeyword */: - case 136 /* DeclareKeyword */: - case 126 /* AbstractKeyword */: - case 161 /* OverrideKeyword */: - case 101 /* InKeyword */: - case 145 /* OutKeyword */: + case 125 /* PublicKeyword */: + case 123 /* PrivateKeyword */: + case 124 /* ProtectedKeyword */: + case 148 /* ReadonlyKeyword */: + case 138 /* DeclareKeyword */: + case 128 /* AbstractKeyword */: + case 163 /* OverrideKeyword */: + case 103 /* InKeyword */: + case 147 /* OutKeyword */: diagnostics.push(createDiagnosticForNode2(modifier, Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, tokenToString(modifier.kind))); break; - case 124 /* StaticKeyword */: - case 93 /* ExportKeyword */: - case 88 /* DefaultKeyword */: - case 127 /* AccessorKeyword */: + case 126 /* StaticKeyword */: + case 95 /* ExportKeyword */: + case 90 /* DefaultKeyword */: + case 129 /* AccessorKeyword */: } } } - function createDiagnosticForNodeArray2(nodes, message, arg0, arg1, arg2) { + function createDiagnosticForNodeArray2(nodes, message, ...args) { const start = nodes.pos; - return createFileDiagnostic(sourceFile, start, nodes.end - start, message, arg0, arg1, arg2); + return createFileDiagnostic(sourceFile, start, nodes.end - start, message, ...args); } - function createDiagnosticForNode2(node, message, arg0, arg1, arg2) { - return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2); + function createDiagnosticForNode2(node, message, ...args) { + return createDiagnosticForNodeInSourceFile(sourceFile, node, message, ...args); } }); } @@ -117383,8 +118173,8 @@ ${lanes.join("\n")} }); } function getAndCacheDiagnostics(sourceFile, cancellationToken, cache, getDiagnostics2) { - var _a3; - const cachedResult = sourceFile ? (_a3 = cache.perFile) == null ? void 0 : _a3.get(sourceFile.path) : cache.allDiagnostics; + var _a2; + const cachedResult = sourceFile ? (_a2 = cache.perFile) == null ? void 0 : _a2.get(sourceFile.path) : cache.allDiagnostics; if (cachedResult) { return cachedResult; } @@ -117434,7 +118224,7 @@ ${lanes.join("\n")} return a.fileName === b.fileName; } function moduleNameIsEqualTo(a, b) { - return a.kind === 79 /* Identifier */ ? b.kind === 79 /* Identifier */ && a.escapedText === b.escapedText : b.kind === 10 /* StringLiteral */ && a.text === b.text; + return a.kind === 80 /* Identifier */ ? b.kind === 80 /* Identifier */ && a.escapedText === b.escapedText : b.kind === 11 /* StringLiteral */ && a.text === b.text; } function createSyntheticImport(text, file) { const externalHelpersModuleReference = factory.createStringLiteral(text); @@ -117531,7 +118321,7 @@ ${lanes.join("\n")} const node = getNodeAtPosition(file2, r.lastIndex); if (shouldProcessRequires && isRequireCall( node, - /*checkArgumentIsStringLiteralLike*/ + /*requireStringLiteralLikeArgument*/ true )) { setParentRecursive( @@ -117574,11 +118364,10 @@ ${lanes.join("\n")} } } function getLibFileFromReference(ref) { - const libName = toFileNameLowerCase(ref.fileName); - const libFileName = libMap.get(libName); - if (libFileName) { - return getSourceFile(pathForLibFile(libFileName)); - } + var _a2; + const { libFileName } = getLibFileNameFromLibReference(ref); + const actualFileName = libFileName && ((_a2 = resolvedLibReferences == null ? void 0 : resolvedLibReferences.get(libFileName)) == null ? void 0 : _a2.actual); + return actualFileName !== void 0 ? getSourceFile(actualFileName) : void 0; } function getSourceFileFromReference(referencingFile, ref) { return getSourceFileFromReferenceWorker(resolveTripleslashReference(ref.fileName, referencingFile.fileName), getSourceFile); @@ -117660,20 +118449,20 @@ ${lanes.join("\n")} } } function createRedirectedSourceFile(redirectTarget, unredirected, fileName, path, resolvedPath, originalFileName, sourceFileOptions) { - var _a3; + var _a2; const redirect = parseNodeFactory.createRedirectedSourceFile({ redirectTarget, unredirected }); redirect.fileName = fileName; redirect.path = path; redirect.resolvedPath = resolvedPath; redirect.originalFileName = originalFileName; - redirect.packageJsonLocations = ((_a3 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _a3.length) ? sourceFileOptions.packageJsonLocations : void 0; + redirect.packageJsonLocations = ((_a2 = sourceFileOptions.packageJsonLocations) == null ? void 0 : _a2.length) ? sourceFileOptions.packageJsonLocations : void 0; redirect.packageJsonScope = sourceFileOptions.packageJsonScope; sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); return redirect; } function findSourceFile(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) { - var _a3, _b2; - (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "findSourceFile", { + var _a2, _b2; + (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "findSourceFile", { fileName, isDefaultLib: isDefaultLib || void 0, fileIncludeKind: FileIncludeKind[reason.kind] @@ -117689,7 +118478,7 @@ ${lanes.join("\n")} return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2 } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2 }; } function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) { - var _a3, _b2; + var _a2, _b2; const path = toPath3(fileName); if (useSourceOfProjectReferenceRedirect) { let source = getSourceOfProjectReferenceRedirect(path); @@ -117768,7 +118557,7 @@ ${lanes.join("\n")} Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage] ), - shouldCreateNewSourceFile || ((_a3 = oldProgram == null ? void 0 : oldProgram.getSourceFileByPath(toPath3(fileName))) == null ? void 0 : _a3.impliedNodeFormat) !== sourceFileOptions.impliedNodeFormat + shouldCreateNewSourceFile || ((_a2 = oldProgram == null ? void 0 : oldProgram.getSourceFileByPath(toPath3(fileName))) == null ? void 0 : _a2.impliedNodeFormat) !== sourceFileOptions.impliedNodeFormat ); if (packageId) { const packageIdKey = packageIdToString(packageId); @@ -117922,7 +118711,7 @@ ${lanes.join("\n")} setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective, getModeForFileReference(ref, file.impliedNodeFormat)); const mode = ref.resolutionMode || file.impliedNodeFormat; if (mode && getEmitModuleResolutionKind(options) !== 3 /* Node16 */ && getEmitModuleResolutionKind(options) !== 99 /* NodeNext */) { - (fileProcessingDiagnostics != null ? fileProcessingDiagnostics : fileProcessingDiagnostics = []).push({ + (fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push({ kind: 2 /* ResolutionDiagnostics */, diagnostics: [ createDiagnosticForRange(file, ref, Diagnostics.resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext) @@ -117933,15 +118722,15 @@ ${lanes.join("\n")} } } function processTypeReferenceDirective(typeReferenceDirective, mode, resolution, reason) { - var _a3, _b2; - (_a3 = tracing) == null ? void 0 : _a3.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolution.resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : void 0 }); + var _a2, _b2; + (_a2 = tracing) == null ? void 0 : _a2.push(tracing.Phase.Program, "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolution.resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : void 0 }); processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason); (_b2 = tracing) == null ? void 0 : _b2.pop(); } function processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolution, reason) { - var _a3; + var _a2; addResolutionDiagnostics(resolution); - const previousResolution = (_a3 = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode)) == null ? void 0 : _a3.resolvedTypeReferenceDirective; + const previousResolution = (_a2 = resolvedTypeReferenceDirectives.get(typeReferenceDirective, mode)) == null ? void 0 : _a2.resolvedTypeReferenceDirective; if (previousResolution && previousResolution.primary) { return; } @@ -118003,24 +118792,55 @@ ${lanes.join("\n")} } } function pathForLibFile(libFileName) { - const components = libFileName.split("."); - let path = components[1]; - let i = 2; - while (components[i] && components[i] !== "d") { - path += (i === 2 ? "/" : "-") + components[i]; - i++; + const existing = resolvedLibReferences == null ? void 0 : resolvedLibReferences.get(libFileName); + if (existing) + return existing.actual; + const result = pathForLibFileWorker(libFileName); + (resolvedLibReferences ?? (resolvedLibReferences = /* @__PURE__ */ new Map())).set(libFileName, result); + return result.actual; + } + function pathForLibFileWorker(libFileName) { + var _a2, _b2, _c2, _d2, _e2; + const existing = resolvedLibProcessing == null ? void 0 : resolvedLibProcessing.get(libFileName); + if (existing) + return existing; + if (structureIsReused !== 0 /* Not */ && oldProgram && !hasInvalidatedLibResolutions(libFileName)) { + const oldResolution = (_a2 = oldProgram.resolvedLibReferences) == null ? void 0 : _a2.get(libFileName); + if (oldResolution) { + if (oldResolution.resolution && isTraceEnabled(options, host)) { + const libraryName2 = getLibraryNameFromLibFileName(libFileName); + const resolveFrom2 = getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName); + trace( + host, + oldResolution.resolution.resolvedModule ? oldResolution.resolution.resolvedModule.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved, + libraryName2, + getNormalizedAbsolutePath(resolveFrom2, currentDirectory), + (_b2 = oldResolution.resolution.resolvedModule) == null ? void 0 : _b2.resolvedFileName, + ((_c2 = oldResolution.resolution.resolvedModule) == null ? void 0 : _c2.packageId) && packageIdToString(oldResolution.resolution.resolvedModule.packageId) + ); + } + (resolvedLibProcessing ?? (resolvedLibProcessing = /* @__PURE__ */ new Map())).set(libFileName, oldResolution); + return oldResolution; + } } - const resolveFrom = combinePaths(currentDirectory, `__lib_node_modules_lookup_${libFileName}__.ts`); - const localOverrideModuleResult = resolveModuleName("@typescript/lib-" + path, resolveFrom, { moduleResolution: 2 /* Node10 */ }, host, moduleResolutionCache); - if (localOverrideModuleResult == null ? void 0 : localOverrideModuleResult.resolvedModule) { - return localOverrideModuleResult.resolvedModule.resolvedFileName; - } - return combinePaths(defaultLibraryPath, libFileName); + const libraryName = getLibraryNameFromLibFileName(libFileName); + const resolveFrom = getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName); + (_d2 = tracing) == null ? void 0 : _d2.push(tracing.Phase.Program, "resolveLibrary", { resolveFrom }); + mark("beforeResolveLibrary"); + const resolution = actualResolveLibrary(libraryName, resolveFrom, options, libFileName); + mark("afterResolveLibrary"); + measure("ResolveLibrary", "beforeResolveLibrary", "afterResolveLibrary"); + (_e2 = tracing) == null ? void 0 : _e2.pop(); + const result = { + resolution, + actual: resolution.resolvedModule ? resolution.resolvedModule.resolvedFileName : combinePaths(defaultLibraryPath, libFileName) + }; + (resolvedLibProcessing ?? (resolvedLibProcessing = /* @__PURE__ */ new Map())).set(libFileName, result); + return result; } function processLibReferenceDirectives(file) { forEach(file.libReferenceDirectives, (libReference, index) => { - const libName = toFileNameLowerCase(libReference.fileName); - const libFileName = libMap.get(libName); + const { libName, libFileName } = getLibFileNameFromLibReference(libReference); if (libFileName) { processRootFile( pathForLibFile(libFileName), @@ -118034,11 +118854,12 @@ ${lanes.join("\n")} const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts"); const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity); const diagnostic = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0; + const args = suggestion ? [libName, suggestion] : [libName]; (fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({ kind: 0 /* FilePreprocessingReferencedDiagnostic */, reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index }, diagnostic, - args: [libName, suggestion] + args }); } }); @@ -118047,13 +118868,13 @@ ${lanes.join("\n")} return host.getCanonicalFileName(fileName); } function processImportedModules(file) { - var _a3; + var _a2; collectExternalModuleReferences(file); if (file.imports.length || file.moduleAugmentations.length) { const moduleNames = getModuleNames(file); const resolutions = resolveModuleNamesReusingOldState(moduleNames, file); Debug.assert(resolutions.length === moduleNames.length); - const optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a3 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a3.commandLine.options : void 0) || options; + const optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options : void 0) || options; for (let index = 0; index < moduleNames.length; index++) { const resolution = resolutions[index].resolvedModule; const moduleName = moduleNames[index].text; @@ -118127,7 +118948,7 @@ ${lanes.join("\n")} commandLine = host.getParsedCommandLine(refPath); if (!commandLine) { addFileToFilesByName( - /*sourceFile*/ + /*file*/ void 0, sourceFilePath, /*redirectedPath*/ @@ -118145,7 +118966,7 @@ ${lanes.join("\n")} void 0 ); } else { - const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), host.getCurrentDirectory()); + const basePath = getNormalizedAbsolutePath(getDirectoryPath(refPath), currentDirectory); sourceFile = host.getSourceFile(refPath, 100 /* JSON */); addFileToFilesByName( sourceFile, @@ -118500,7 +119321,7 @@ ${lanes.join("\n")} } } function verifyDeprecatedCompilerOptions() { - function createDiagnostic(name, value, useInstead, message, arg0, arg1, arg2, arg3) { + function createDiagnostic(name, value, useInstead, message, ...args) { if (useInstead) { const details = chainDiagnosticMessages( /*details*/ @@ -118508,7 +119329,7 @@ ${lanes.join("\n")} Diagnostics.Use_0_instead, useInstead ); - const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2, arg3); + const chain = chainDiagnosticMessages(details, message, ...args); createDiagnosticForOption( /*onKey*/ !value, @@ -118525,10 +119346,7 @@ ${lanes.join("\n")} /*option2*/ void 0, message, - arg0, - arg1, - arg2, - arg3 + ...args ); } } @@ -118581,8 +119399,8 @@ ${lanes.join("\n")} }); } function verifyDeprecatedProjectReference(ref, parentFile, index) { - function createDiagnostic(_name, _value, _useInstead, message, arg0, arg1, arg2, arg3) { - createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2, arg3); + function createDiagnostic(_name, _value, _useInstead, message, ...args) { + createDiagnosticForReference(parentFile, index, message, ...args); } checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => { if (ref.prepend) { @@ -118591,12 +119409,12 @@ ${lanes.join("\n")} }); } function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) { - var _a3; + var _a2; let fileIncludeReasons; let relatedInfo; let locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : void 0; if (file) - (_a3 = fileReasons.get(file.path)) == null ? void 0 : _a3.forEach(processReason); + (_a2 = fileReasons.get(file.path)) == null ? void 0 : _a2.forEach(processReason); if (fileProcessingReason) processReason(fileProcessingReason); if (locationReason && (fileIncludeReasons == null ? void 0 : fileIncludeReasons.length) === 1) @@ -118694,8 +119512,9 @@ ${lanes.join("\n")} if (!referenceInfo) return void 0; const { sourceFile, index } = referenceInfo; - const referencesSyntax = firstDefined( - getTsConfigPropArray(sourceFile, "references"), + const referencesSyntax = forEachTsConfigPropArray( + sourceFile, + "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0 ); return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile( @@ -118764,28 +119583,26 @@ ${lanes.join("\n")} } }); } - function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, arg0, arg1, arg2) { + function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) { let needCompilerDiagnostic = true; - const pathsSyntax = getOptionPathsSyntax(); - for (const pathProp of pathsSyntax) { + forEachOptionPathsSyntax((pathProp) => { if (isObjectLiteralExpression(pathProp.initializer)) { - for (const keyProps of getPropertyAssignment(pathProp.initializer, key)) { + forEachPropertyAssignment(pathProp.initializer, key, (keyProps) => { const initializer = keyProps.initializer; if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) { - programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, arg0, arg1, arg2)); + programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args)); needCompilerDiagnostic = false; } - } + }); } - } + }); if (needCompilerDiagnostic) { - programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2)); + programDiagnostics.add(createCompilerDiagnostic(message, ...args)); } } - function createDiagnosticForOptionPaths(onKey, key, message, arg0) { + function createDiagnosticForOptionPaths(onKey, key, message, ...args) { let needCompilerDiagnostic = true; - const pathsSyntax = getOptionPathsSyntax(); - for (const pathProp of pathsSyntax) { + forEachOptionPathsSyntax((pathProp) => { if (isObjectLiteralExpression(pathProp.initializer) && createOptionDiagnosticInObjectLiteralSyntax( pathProp.initializer, onKey, @@ -118793,25 +119610,23 @@ ${lanes.join("\n")} /*key2*/ void 0, message, - arg0 + ...args )) { needCompilerDiagnostic = false; } - } + }); if (needCompilerDiagnostic) { - programDiagnostics.add(createCompilerDiagnostic(message, arg0)); + programDiagnostics.add(createCompilerDiagnostic(message, ...args)); } } - function getOptionsSyntaxByName(name) { - const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); - return compilerOptionsObjectLiteralSyntax && getPropertyAssignment(compilerOptionsObjectLiteralSyntax, name); + function forEachOptionsSyntaxByName(name, callback) { + return forEachPropertyAssignment(getCompilerOptionsObjectLiteralSyntax(), name, callback); } - function getOptionPathsSyntax() { - return getOptionsSyntaxByName("paths") || emptyArray; + function forEachOptionPathsSyntax(callback) { + return forEachOptionsSyntaxByName("paths", callback); } function getOptionsSyntaxByValue(name, value) { - const syntaxByName = getOptionsSyntaxByName(name); - return syntaxByName && firstDefined(syntaxByName, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0); + return forEachOptionsSyntaxByName(name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0); } function getOptionsSyntaxByArrayElementValue(name, value) { const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); @@ -118829,7 +119644,7 @@ ${lanes.join("\n")} option3 ); } - function createOptionValueDiagnostic(option1, message, arg0, arg1) { + function createOptionValueDiagnostic(option1, message, ...args) { createDiagnosticForOption( /*onKey*/ false, @@ -118837,57 +119652,53 @@ ${lanes.join("\n")} /*option2*/ void 0, message, - arg0, - arg1 + ...args ); } - function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2, arg3) { - const referencesSyntax = firstDefined( - getTsConfigPropArray(sourceFile || options.configFile, "references"), + function createDiagnosticForReference(sourceFile, index, message, ...args) { + const referencesSyntax = forEachTsConfigPropArray( + sourceFile || options.configFile, + "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0 ); if (referencesSyntax && referencesSyntax.elements.length > index) { - programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2, arg3)); + programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args)); } else { - programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3)); + programDiagnostics.add(createCompilerDiagnostic(message, ...args)); } } - function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2, arg3) { + function createDiagnosticForOption(onKey, option1, option2, message, ...args) { const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); - const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2, arg3); + const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, ...args); if (needCompilerDiagnostic) { if ("messageText" in message) { programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message)); } else { - programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3)); + programDiagnostics.add(createCompilerDiagnostic(message, ...args)); } } } function getCompilerOptionsObjectLiteralSyntax() { if (_compilerOptionsObjectLiteralSyntax === void 0) { - _compilerOptionsObjectLiteralSyntax = false; - const jsonObjectLiteral = getTsConfigObjectLiteralExpression(options.configFile); - if (jsonObjectLiteral) { - for (const prop of getPropertyAssignment(jsonObjectLiteral, "compilerOptions")) { - if (isObjectLiteralExpression(prop.initializer)) { - _compilerOptionsObjectLiteralSyntax = prop.initializer; - break; - } - } - } + _compilerOptionsObjectLiteralSyntax = forEachPropertyAssignment( + getTsConfigObjectLiteralExpression(options.configFile), + "compilerOptions", + (prop) => isObjectLiteralExpression(prop.initializer) ? prop.initializer : void 0 + ) || false; } return _compilerOptionsObjectLiteralSyntax || void 0; } - function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2, arg3) { - const props = getPropertyAssignment(objectLiteral, key1, key2); - for (const prop of props) { + function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, ...args) { + let needsCompilerDiagnostic = false; + forEachPropertyAssignment(objectLiteral, key1, (prop) => { if ("messageText" in message) { programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message)); } else { - programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2, arg3)); + programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args)); } - } - return !!props.length; + needsCompilerDiagnostic = true; + }, key2); + return needsCompilerDiagnostic; } function createRedundantOptionDiagnostic(errorOnOption, redundantWithOption) { const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); @@ -118995,8 +119806,8 @@ ${lanes.join("\n")} } if (originalRealpath) { host.compilerHost.realpath = (s) => { - var _a2; - return ((_a2 = host.getSymlinkCache().getSymlinkedFiles()) == null ? void 0 : _a2.get(host.toPath(s))) || originalRealpath.call(host.compilerHost, s); + var _a; + return ((_a = host.getSymlinkCache().getSymlinkedFiles()) == null ? void 0 : _a.get(host.toPath(s))) || originalRealpath.call(host.compilerHost, s); }; } return { onProgramCreateComplete, fileExists, directoryExists }; @@ -119033,14 +119844,14 @@ ${lanes.join("\n")} ); } function handleDirectoryCouldBeSymlink(directory) { - var _a2; + var _a; if (!host.getResolvedProjectReferences() || containsIgnoredPath(directory)) return; if (!originalRealpath || !stringContains(directory, nodeModulesPathPart)) return; const symlinkCache = host.getSymlinkCache(); const directoryPath = ensureTrailingDirectorySeparator(host.toPath(directory)); - if ((_a2 = symlinkCache.getSymlinkedDirectories()) == null ? void 0 : _a2.has(directoryPath)) + if ((_a = symlinkCache.getSymlinkedDirectories()) == null ? void 0 : _a.has(directoryPath)) return; const real = normalizePath(originalRealpath.call(host.compilerHost, directory)); let realPath2; @@ -119054,7 +119865,7 @@ ${lanes.join("\n")} }); } function fileOrDirectoryExistsUsingSource(fileOrDirectory, isFile) { - var _a2; + var _a; const fileOrDirectoryExistsUsingSource2 = isFile ? (file) => fileExistsIfProjectReferenceDts(file) : (dir) => directoryExistsIfProjectReferenceDeclDir(dir); const result = fileOrDirectoryExistsUsingSource2(fileOrDirectory); if (result !== void 0) @@ -119066,7 +119877,7 @@ ${lanes.join("\n")} const fileOrDirectoryPath = host.toPath(fileOrDirectory); if (!stringContains(fileOrDirectoryPath, nodeModulesPathPart)) return false; - if (isFile && ((_a2 = symlinkCache.getSymlinkedFiles()) == null ? void 0 : _a2.has(fileOrDirectoryPath))) + if (isFile && ((_a = symlinkCache.getSymlinkedFiles()) == null ? void 0 : _a.has(fileOrDirectoryPath))) return true; return firstDefinedIterator( symlinkedDirectories.entries(), @@ -119198,7 +120009,7 @@ ${lanes.join("\n")} function getModuleNames({ imports, moduleAugmentations }) { const res = imports.map((i) => i); for (const aug of moduleAugmentations) { - if (aug.kind === 10 /* StringLiteral */) { + if (aug.kind === 11 /* StringLiteral */) { res.push(aug); } } @@ -119209,7 +120020,7 @@ ${lanes.join("\n")} return imports[index]; let augIndex = imports.length; for (const aug of moduleAugmentations) { - if (aug.kind === 10 /* StringLiteral */) { + if (aug.kind === 11 /* StringLiteral */) { if (index === augIndex) return aug; augIndex++; @@ -119222,7 +120033,6 @@ ${lanes.join("\n")} "src/compiler/program.ts"() { "use strict"; init_ts2(); - init_ts2(); init_ts_performance(); ForegroundColorEscapeSequences = /* @__PURE__ */ ((ForegroundColorEscapeSequences2) => { ForegroundColorEscapeSequences2["Grey"] = "\x1B[90m"; @@ -119266,7 +120076,6 @@ ${lanes.join("\n")} Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code, Diagnostics.Invalid_use_of_0_in_strict_mode.code, Diagnostics.A_label_is_not_allowed_here.code, - Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code, Diagnostics.with_statements_are_not_allowed_in_strict_mode.code, // grammar errors Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement.code, @@ -119435,8 +120244,8 @@ ${lanes.join("\n")} } function getReferencedFilesFromImportedModuleSymbol(symbol) { return mapDefined(symbol.declarations, (declaration) => { - var _a2; - return (_a2 = getSourceFileOfNode(declaration)) == null ? void 0 : _a2.resolvedPath; + var _a; + return (_a = getSourceFileOfNode(declaration)) == null ? void 0 : _a.resolvedPath; }); } function getReferencedFilesFromImportLiteral(checker, importName) { @@ -119509,7 +120318,7 @@ ${lanes.join("\n")} } BuilderState2.canReuseOldState = canReuseOldState; function create(newProgram, oldState, disableUseFileVersionAsSignature) { - var _a2, _b, _c; + var _a, _b, _c; const fileInfos = /* @__PURE__ */ new Map(); const options = newProgram.getCompilerOptions(); const isOutFile = outFile(options); @@ -119519,7 +120328,7 @@ ${lanes.join("\n")} newProgram.getTypeChecker(); for (const sourceFile of newProgram.getSourceFiles()) { const version2 = Debug.checkDefined(sourceFile.version, "Program intended to be used with Builder should have source files with versions set"); - const oldUncommittedSignature = useOldState ? (_a2 = oldState.oldSignatures) == null ? void 0 : _a2.get(sourceFile.resolvedPath) : void 0; + const oldUncommittedSignature = useOldState ? (_a = oldState.oldSignatures) == null ? void 0 : _a.get(sourceFile.resolvedPath) : void 0; const signature = oldUncommittedSignature === void 0 ? useOldState ? (_b = oldState.fileInfos.get(sourceFile.resolvedPath)) == null ? void 0 : _b.signature : void 0 : oldUncommittedSignature || void 0; if (referencedMap) { const newReferences = getReferencedFiles(newProgram, sourceFile, newProgram.getCanonicalFileName); @@ -119556,7 +120365,7 @@ ${lanes.join("\n")} } BuilderState2.releaseCache = releaseCache2; function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, host) { - var _a2, _b; + var _a, _b; const result = getFilesAffectedByWithOldState( state, programOfThisState, @@ -119564,7 +120373,7 @@ ${lanes.join("\n")} cancellationToken, host ); - (_a2 = state.oldSignatures) == null ? void 0 : _a2.clear(); + (_a = state.oldSignatures) == null ? void 0 : _a.clear(); (_b = state.oldExportedModulesMap) == null ? void 0 : _b.clear(); return result; } @@ -119599,7 +120408,7 @@ ${lanes.join("\n")} ), sourceFiles); }, cancellationToken, - /*emitOnlyDtsFiles*/ + /*emitOnly*/ true, /*customTransformers*/ void 0, @@ -119609,8 +120418,8 @@ ${lanes.join("\n")} } BuilderState2.computeDtsSignature = computeDtsSignature; function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, host, useFileVersionAsSignature = state.useFileVersionAsSignature) { - var _a2; - if ((_a2 = state.hasCalledUpdateShapeSignature) == null ? void 0 : _a2.has(sourceFile.resolvedPath)) + var _a; + if ((_a = state.hasCalledUpdateShapeSignature) == null ? void 0 : _a.has(sourceFile.resolvedPath)) return false; const info = state.fileInfos.get(sourceFile.resolvedPath); const prevSignature = info.signature; @@ -119657,7 +120466,7 @@ ${lanes.join("\n")} let exportedModules; exportedModulesFromDeclarationEmit == null ? void 0 : exportedModulesFromDeclarationEmit.forEach( (symbol) => getReferencedFilesFromImportedModuleSymbol(symbol).forEach( - (path) => (exportedModules != null ? exportedModules : exportedModules = /* @__PURE__ */ new Set()).add(path) + (path) => (exportedModules ?? (exportedModules = /* @__PURE__ */ new Set())).add(path) ) ); return exportedModules; @@ -119686,8 +120495,8 @@ ${lanes.join("\n")} } } return arrayFrom(mapDefinedIterator(seenMap.keys(), (path) => { - var _a2, _b; - return (_b = (_a2 = programOfThisState.getSourceFileByPath(path)) == null ? void 0 : _a2.fileName) != null ? _b : path; + var _a; + return ((_a = programOfThisState.getSourceFileByPath(path)) == null ? void 0 : _a.fileName) ?? path; })); } BuilderState2.getAllDependencies = getAllDependencies; @@ -119806,7 +120615,7 @@ ${lanes.join("\n")} return map1 === map2 || map1 !== void 0 && map2 !== void 0 && map1.size === map2.size && !forEachKey(map1, (key) => !map2.has(key)); } function createBuilderProgramState(newProgram, oldState) { - var _a2, _b; + var _a, _b; const state = BuilderState.create( newProgram, oldState, @@ -119829,7 +120638,7 @@ ${lanes.join("\n")} const canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile && !compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions); const canCopyEmitSignatures = compilerOptions.composite && (oldState == null ? void 0 : oldState.emitSignatures) && !outFilePath && !compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions); if (useOldState) { - (_a2 = oldState.changedFilesSet) == null ? void 0 : _a2.forEach((value) => state.changedFilesSet.add(value)); + (_a = oldState.changedFilesSet) == null ? void 0 : _a.forEach((value) => state.changedFilesSet.add(value)); if (!outFilePath && ((_b = oldState.affectedFilesPendingEmit) == null ? void 0 : _b.size)) { state.affectedFilesPendingEmit = new Map(oldState.affectedFilesPendingEmit); state.seenAffectedFiles = /* @__PURE__ */ new Set(); @@ -119843,7 +120652,6 @@ ${lanes.join("\n")} const copyDeclarationFileDiagnostics = canCopySemanticDiagnostics && !compilerOptions.skipLibCheck === !oldCompilerOptions.skipLibCheck; const copyLibFileDiagnostics = copyDeclarationFileDiagnostics && !compilerOptions.skipDefaultLibCheck === !oldCompilerOptions.skipDefaultLibCheck; state.fileInfos.forEach((info, sourceFilePath) => { - var _a3; let oldInfo; let newReferences; if (!useOldState || // File wasn't present in old state @@ -119861,7 +120669,10 @@ ${lanes.join("\n")} return; const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath); if (diagnostics) { - state.semanticDiagnosticsPerFile.set(sourceFilePath, oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : diagnostics); + state.semanticDiagnosticsPerFile.set( + sourceFilePath, + oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram) + ); if (!state.semanticDiagnosticsFromOldState) { state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set(); } @@ -119871,7 +120682,7 @@ ${lanes.join("\n")} if (canCopyEmitSignatures) { const oldEmitSignature = oldState.emitSignatures.get(sourceFilePath); if (oldEmitSignature) { - ((_a3 = state.emitSignatures) != null ? _a3 : state.emitSignatures = /* @__PURE__ */ new Map()).set(sourceFilePath, getEmitSignatureFromOldSignature(compilerOptions, oldState.compilerOptions, oldEmitSignature)); + (state.emitSignatures ?? (state.emitSignatures = /* @__PURE__ */ new Map())).set(sourceFilePath, getEmitSignatureFromOldSignature(compilerOptions, oldState.compilerOptions, oldEmitSignature)); } } }); @@ -119932,30 +120743,59 @@ ${lanes.join("\n")} isString(oldEmitSignature) ? [oldEmitSignature] : oldEmitSignature[0] ); } + function repopulateDiagnostics(diagnostics, newProgram) { + if (!diagnostics.length) + return diagnostics; + return sameMap(diagnostics, (diag2) => { + if (isString(diag2.messageText)) + return diag2; + const repopulatedChain = convertOrRepopulateDiagnosticMessageChain(diag2.messageText, diag2.file, newProgram, (chain) => { + var _a; + return (_a = chain.repopulateInfo) == null ? void 0 : _a.call(chain); + }); + return repopulatedChain === diag2.messageText ? diag2 : { ...diag2, messageText: repopulatedChain }; + }); + } + function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo) { + const info = repopulateInfo(chain); + if (info) { + return { + ...createModuleNotFoundChain(sourceFile, newProgram, info.moduleReference, info.mode, info.packageName || info.moduleReference), + next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo) + }; + } + const next = convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo); + return next === chain.next ? chain : { ...chain, next }; + } + function convertOrRepopulateDiagnosticMessageChainArray(array, sourceFile, newProgram, repopulateInfo) { + return sameMap(array, (chain) => convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo)); + } function convertToDiagnostics(diagnostics, newProgram) { if (!diagnostics.length) return emptyArray; let buildInfoDirectory; return diagnostics.map((diagnostic) => { - const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3); + const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPathInBuildInfoDirectory); result.reportsUnnecessary = diagnostic.reportsUnnecessary; result.reportsDeprecated = diagnostic.reportDeprecated; result.source = diagnostic.source; result.skippedOn = diagnostic.skippedOn; const { relatedInformation } = diagnostic; - result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram, toPath3)) : [] : void 0; + result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram, toPathInBuildInfoDirectory)) : [] : void 0; return result; }); - function toPath3(path) { - buildInfoDirectory != null ? buildInfoDirectory : buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory())); + function toPathInBuildInfoDirectory(path) { + buildInfoDirectory ?? (buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(newProgram.getCompilerOptions()), newProgram.getCurrentDirectory()))); return toPath(path, buildInfoDirectory, newProgram.getCanonicalFileName); } } function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3) { const { file } = diagnostic; + const sourceFile = file ? newProgram.getSourceFileByPath(toPath3(file)) : void 0; return { ...diagnostic, - file: file ? newProgram.getSourceFileByPath(toPath3(file)) : void 0 + file: sourceFile, + messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertOrRepopulateDiagnosticMessageChain(diagnostic.messageText, sourceFile, newProgram, (chain) => chain.info) }; } function releaseCache(state) { @@ -119991,7 +120831,7 @@ ${lanes.join("\n")} Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath)); } function getNextAffectedFile(state, cancellationToken, host) { - var _a2, _b; + var _a, _b; while (true) { const { affectedFiles } = state; if (affectedFiles) { @@ -120014,7 +120854,7 @@ ${lanes.join("\n")} } state.changedFilesSet.delete(state.currentChangedFilePath); state.currentChangedFilePath = void 0; - (_a2 = state.oldSignatures) == null ? void 0 : _a2.clear(); + (_a = state.oldSignatures) == null ? void 0 : _a.clear(); (_b = state.oldExportedModulesMap) == null ? void 0 : _b.clear(); state.affectedFiles = void 0; } @@ -120042,8 +120882,8 @@ ${lanes.join("\n")} } } function clearAffectedFilesPendingEmit(state, emitOnlyDtsFiles) { - var _a2; - if (!((_a2 = state.affectedFilesPendingEmit) == null ? void 0 : _a2.size)) + var _a; + if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size)) return; if (!emitOnlyDtsFiles) return state.affectedFilesPendingEmit = void 0; @@ -120056,17 +120896,17 @@ ${lanes.join("\n")} }); } function getNextAffectedFilePendingEmit(state, emitOnlyDtsFiles) { - var _a2; - if (!((_a2 = state.affectedFilesPendingEmit) == null ? void 0 : _a2.size)) + var _a; + if (!((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size)) return void 0; return forEachEntry(state.affectedFilesPendingEmit, (emitKind, path) => { - var _a3; + var _a2; const affectedFile = state.program.getSourceFileByPath(path); if (!affectedFile || !sourceFileMayBeEmitted(affectedFile, state.program)) { state.affectedFilesPendingEmit.delete(path); return void 0; } - const seenKind = (_a3 = state.seenEmittedFiles) == null ? void 0 : _a3.get(affectedFile.resolvedPath); + const seenKind = (_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedFile.resolvedPath); let pendingKind = getPendingEmitKind(emitKind, seenKind); if (emitOnlyDtsFiles) pendingKind = pendingKind & 24 /* AllDts */; @@ -120142,8 +120982,8 @@ ${lanes.join("\n")} return newSignature !== oldSignature; } function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host) { - var _a2; - if (!((_a2 = state.fileInfos.get(filePath)) == null ? void 0 : _a2.affectsGlobalScope)) + var _a; + if (!((_a = state.fileInfos.get(filePath)) == null ? void 0 : _a.affectsGlobalScope)) return false; BuilderState.getAllFilesExcludingDefaultLibraryFile( state, @@ -120160,7 +121000,7 @@ ${lanes.join("\n")} return true; } function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host) { - var _a2; + var _a; if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath)) return; if (!isChangedSignature(state, affectedFile.resolvedPath)) @@ -120184,7 +121024,7 @@ ${lanes.join("\n")} } } const seenFileAndExportsOfFile = /* @__PURE__ */ new Set(); - (_a2 = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) == null ? void 0 : _a2.forEach((exportedFromPath) => { + (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) == null ? void 0 : _a.forEach((exportedFromPath) => { if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host)) return true; const references = state.referencedMap.getKeys(exportedFromPath); @@ -120201,13 +121041,13 @@ ${lanes.join("\n")} }); } function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) { - var _a2, _b; + var _a, _b; if (!tryAddToSet(seenFileAndExportsOfFile, filePath)) return void 0; if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host)) return true; handleDtsMayChangeOf(state, filePath, cancellationToken, host); - (_a2 = state.exportedModulesMap.getKeys(filePath)) == null ? void 0 : _a2.forEach( + (_a = state.exportedModulesMap.getKeys(filePath)) == null ? void 0 : _a.forEach( (exportedFromPath) => handleDtsMayChangeOfFileAndExportsOfFile( state, exportedFromPath, @@ -120252,7 +121092,7 @@ ${lanes.join("\n")} return !!outFile(info.options || {}); } function getBuildInfo2(state, bundle) { - var _a2, _b, _c; + var _a, _b, _c; const currentDirectory = Debug.checkDefined(state.program).getCurrentDirectory(); const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory)); const latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0; @@ -120285,7 +121125,7 @@ ${lanes.join("\n")} state.bundle = bundle = { commonSourceDirectory, sourceFiles, - js: js || (!state.compilerOptions.emitDeclarationOnly ? (_a2 = state.bundle) == null ? void 0 : _a2.js : void 0), + js: js || (!state.compilerOptions.emitDeclarationOnly ? (_a = state.bundle) == null ? void 0 : _a.js : void 0), dts: dts || (getEmitDeclarations(state.compilerOptions) ? (_b = state.bundle) == null ? void 0 : _b.dts : void 0) }; return createBuildInfo(program2, bundle); @@ -120294,11 +121134,11 @@ ${lanes.join("\n")} let fileNamesToFileIdListId; let emitSignatures; const fileInfos = arrayFrom(state.fileInfos.entries(), ([key, value]) => { - var _a3, _b2; + var _a2, _b2; const fileId = toFileId(key); tryAddRoot(key, fileId); Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key)); - const oldSignature = (_a3 = state.oldSignatures) == null ? void 0 : _a3.get(key); + const oldSignature = (_a2 = state.oldSignatures) == null ? void 0 : _a2.get(key); const actualSignature = oldSignature !== void 0 ? oldSignature || void 0 : value.signature; if (state.compilerOptions.composite) { const file = state.program.getSourceFileByPath(key); @@ -120343,8 +121183,8 @@ ${lanes.join("\n")} let exportedModulesMap; if (state.exportedModulesMap) { exportedModulesMap = mapDefined(arrayFrom(state.exportedModulesMap.keys()).sort(compareStringsCaseSensitive), (key) => { - var _a3; - const oldValue = (_a3 = state.oldExportedModulesMap) == null ? void 0 : _a3.get(key); + var _a2; + const oldValue = (_a2 = state.oldExportedModulesMap) == null ? void 0 : _a2.get(key); if (oldValue === void 0) return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))]; if (oldValue) @@ -120497,9 +121337,35 @@ ${lanes.join("\n")} const { file } = diagnostic; return { ...diagnostic, - file: file ? relativeToBuildInfo(file.resolvedPath) : void 0 + file: file ? relativeToBuildInfo(file.resolvedPath) : void 0, + messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText) }; } + function convertToReusableDiagnosticMessageChain(chain) { + if (chain.repopulateInfo) { + return { + info: chain.repopulateInfo(), + next: convertToReusableDiagnosticMessageChainArray(chain.next) + }; + } + const next = convertToReusableDiagnosticMessageChainArray(chain.next); + return next === chain.next ? chain : { ...chain, next }; + } + function convertToReusableDiagnosticMessageChainArray(array) { + if (!array) + return array; + return forEach(array, (chain, index) => { + const reusable = convertToReusableDiagnosticMessageChain(chain); + if (chain === reusable) + return void 0; + const result = index > 0 ? array.slice(0, index - 1) : []; + result.push(reusable); + for (let i = index + 1; i < array.length; i++) { + result.push(convertToReusableDiagnosticMessageChain(array[i])); + } + return result; + }) || array; + } function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) { let host; let newProgram; @@ -120533,15 +121399,15 @@ ${lanes.join("\n")} return (data == null ? void 0 : data.sourceMapUrlPos) !== void 0 ? text.substring(0, data.sourceMapUrlPos) : text; } function computeSignatureWithDiagnostics(program, sourceFile, text, host, data) { - var _a2, _b; + var _a; text = getTextHandlingSourceMapForSignature(text, data); let sourceFileDirectory; - if ((_a2 = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a2.length) { + if ((_a = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a.length) { text += data.diagnostics.map( (diagnostic) => `${locationInfo(diagnostic)}${DiagnosticCategory[diagnostic.category]}${diagnostic.code}: ${flattenDiagnosticMessageText2(diagnostic.messageText)}` ).join("\n"); } - return ((_b = host.createHash) != null ? _b : generateDjb2Hash)(text); + return (host.createHash ?? generateDjb2Hash)(text); function flattenDiagnosticMessageText2(diagnostic) { return isString(diagnostic) ? diagnostic : diagnostic === void 0 ? "" : !diagnostic.next ? diagnostic.messageText : diagnostic.messageText + diagnostic.next.map(flattenDiagnosticMessageText2).join("\n"); } @@ -120558,8 +121424,7 @@ ${lanes.join("\n")} } } function computeSignature(text, host, data) { - var _a2; - return ((_a2 = host.createHash) != null ? _a2 : generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data)); + return (host.createHash ?? generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data)); } function createBuilderProgram(kind, { newProgram, host, oldProgram, configFileParsingDiagnostics }) { let oldState = oldProgram && oldProgram.getState(); @@ -120602,7 +121467,7 @@ ${lanes.join("\n")} return emitSkippedWithNoDiagnostics; } function emitNextAffectedFile(writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers) { - var _a2, _b, _c, _d, _e; + var _a, _b, _c; let affected = getNextAffectedFile(state, cancellationToken, host); const programEmitKind = getBuilderFileEmit(state.compilerOptions); let emitKind = emitOnlyDtsFiles ? programEmitKind & 24 /* AllDts */ : programEmitKind; @@ -120650,14 +121515,14 @@ ${lanes.join("\n")} if (state.affectedFilesIndex !== void 0) state.affectedFilesIndex++; state.buildInfoEmitPending = true; - const existing = ((_a2 = state.seenEmittedFiles) == null ? void 0 : _a2.get(affectedSourceFile.resolvedPath)) || 0 /* None */; - ((_b = state.seenEmittedFiles) != null ? _b : state.seenEmittedFiles = /* @__PURE__ */ new Map()).set(affectedSourceFile.resolvedPath, emitKind | existing); - const existingPending = ((_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.get(affectedSourceFile.resolvedPath)) || programEmitKind; + const existing = ((_a = state.seenEmittedFiles) == null ? void 0 : _a.get(affectedSourceFile.resolvedPath)) || 0 /* None */; + (state.seenEmittedFiles ?? (state.seenEmittedFiles = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, emitKind | existing); + const existingPending = ((_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.get(affectedSourceFile.resolvedPath)) || programEmitKind; const pendingKind = getPendingEmitKind(existingPending, emitKind | existing); if (pendingKind) - ((_d = state.affectedFilesPendingEmit) != null ? _d : state.affectedFilesPendingEmit = /* @__PURE__ */ new Map()).set(affectedSourceFile.resolvedPath, pendingKind); + (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedSourceFile.resolvedPath, pendingKind); else - (_e = state.affectedFilesPendingEmit) == null ? void 0 : _e.delete(affectedSourceFile.resolvedPath); + (_c = state.affectedFilesPendingEmit) == null ? void 0 : _c.delete(affectedSourceFile.resolvedPath); } else { state.changedFilesSet.clear(); } @@ -120667,7 +121532,7 @@ ${lanes.join("\n")} if (!getEmitDeclarations(state.compilerOptions)) return writeFile2 || maybeBind(host, host.writeFile); return (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => { - var _a2, _b, _c, _d, _e, _f, _g; + var _a, _b, _c, _d; if (isDeclarationFileName(fileName)) { if (!outFile(state.compilerOptions)) { Debug.assert((sourceFiles == null ? void 0 : sourceFiles.length) === 1); @@ -120683,31 +121548,31 @@ ${lanes.join("\n")} host, data ); - if (!((_a2 = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a2.length)) + if (!((_a = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a.length)) emitSignature = signature; if (signature !== file.version) { if (host.storeFilesChangingSignatureDuringEmit) - ((_b = state.filesChangingSignature) != null ? _b : state.filesChangingSignature = /* @__PURE__ */ new Set()).add(file.resolvedPath); + (state.filesChangingSignature ?? (state.filesChangingSignature = /* @__PURE__ */ new Set())).add(file.resolvedPath); if (state.exportedModulesMap) BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit); if (state.affectedFiles) { - const existing = (_c = state.oldSignatures) == null ? void 0 : _c.get(file.resolvedPath); + const existing = (_b = state.oldSignatures) == null ? void 0 : _b.get(file.resolvedPath); if (existing === void 0) - ((_d = state.oldSignatures) != null ? _d : state.oldSignatures = /* @__PURE__ */ new Map()).set(file.resolvedPath, info.signature || false); + (state.oldSignatures ?? (state.oldSignatures = /* @__PURE__ */ new Map())).set(file.resolvedPath, info.signature || false); info.signature = signature; } else { info.signature = signature; - (_e = state.oldExportedModulesMap) == null ? void 0 : _e.clear(); + (_c = state.oldExportedModulesMap) == null ? void 0 : _c.clear(); } } } } if (state.compilerOptions.composite) { const filePath = sourceFiles[0].resolvedPath; - emitSignature = handleNewSignature((_f = state.emitSignatures) == null ? void 0 : _f.get(filePath), emitSignature); + emitSignature = handleNewSignature((_d = state.emitSignatures) == null ? void 0 : _d.get(filePath), emitSignature); if (!emitSignature) return; - ((_g = state.emitSignatures) != null ? _g : state.emitSignatures = /* @__PURE__ */ new Map()).set(filePath, emitSignature); + (state.emitSignatures ?? (state.emitSignatures = /* @__PURE__ */ new Map())).set(filePath, emitSignature); } } else if (state.compilerOptions.composite) { const newSignature = handleNewSignature( @@ -120728,7 +121593,7 @@ ${lanes.join("\n")} state.program.writeFile(fileName, text, writeByteOrderMark, onError, sourceFiles, data); function handleNewSignature(oldSignatureFormat, newSignature) { const oldSignature = !oldSignatureFormat || isString(oldSignatureFormat) ? oldSignatureFormat : oldSignatureFormat[0]; - newSignature != null ? newSignature : newSignature = computeSignature(text, host, data); + newSignature ?? (newSignature = computeSignature(text, host, data)); if (newSignature === oldSignature) { if (oldSignatureFormat === oldSignature) return void 0; @@ -120800,7 +121665,7 @@ ${lanes.join("\n")} continue; } else { result = state.program.getSemanticDiagnostics( - /*targetSourceFile*/ + /*sourceFile*/ void 0, cancellationToken ); @@ -120830,9 +121695,9 @@ ${lanes.join("\n")} } } function addToAffectedFilesPendingEmit(state, affectedFilePendingEmit, kind) { - var _a2, _b; - const existingKind = ((_a2 = state.affectedFilesPendingEmit) == null ? void 0 : _a2.get(affectedFilePendingEmit)) || 0 /* None */; - ((_b = state.affectedFilesPendingEmit) != null ? _b : state.affectedFilesPendingEmit = /* @__PURE__ */ new Map()).set(affectedFilePendingEmit, existingKind | kind); + var _a; + const existingKind = ((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.get(affectedFilePendingEmit)) || 0 /* None */; + (state.affectedFilesPendingEmit ?? (state.affectedFilesPendingEmit = /* @__PURE__ */ new Map())).set(affectedFilePendingEmit, existingKind | kind); } function toBuilderStateFileInfoForMultiEmit(fileInfo) { return isString(fileInfo) ? { version: fileInfo, signature: fileInfo, affectsGlobalScope: void 0, impliedFormat: void 0 } : isString(fileInfo.signature) ? fileInfo : { version: fileInfo.version, signature: fileInfo.signature === false ? void 0 : fileInfo.version, affectsGlobalScope: fileInfo.affectsGlobalScope, impliedFormat: fileInfo.impliedFormat }; @@ -120844,12 +121709,12 @@ ${lanes.join("\n")} return !value ? getBuilderFileEmit(options || {}) : value; } function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, host) { - var _a2, _b, _c, _d; + var _a, _b, _c, _d; const program = buildInfo.program; const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory())); const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames()); let state; - const filePaths = (_a2 = program.fileNames) == null ? void 0 : _a2.map(toPath3); + const filePaths = (_a = program.fileNames) == null ? void 0 : _a.map(toPathInBuildInfoDirectory); let filePathsSetList; const latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : void 0; if (isProgramBundleEmitBuildInfo(program)) { @@ -120930,7 +121795,7 @@ ${lanes.join("\n")} close: noop, hasChangedEmitSignature: returnFalse }; - function toPath3(path) { + function toPathInBuildInfoDirectory(path) { return toPath(path, buildInfoDirectory, getCanonicalFileName); } function toAbsolutePath(path) { @@ -121012,7 +121877,6 @@ ${lanes.join("\n")} "src/compiler/builder.ts"() { "use strict"; init_ts2(); - init_ts2(); BuilderFileEmit = /* @__PURE__ */ ((BuilderFileEmit2) => { BuilderFileEmit2[BuilderFileEmit2["None"] = 0] = "None"; BuilderFileEmit2[BuilderFileEmit2["Js"] = 1] = "Js"; @@ -121058,36 +121922,124 @@ ${lanes.join("\n")} } return some(ignoredPaths, (searchPath) => stringContains(path, searchPath)) ? void 0 : path; } - function canWatchDirectoryOrFile(dirPath) { - const rootLength = getRootLength(dirPath); - if (dirPath.length === rootLength) { + function perceivedOsRootLengthForWatching(pathComponents2, length2) { + if (length2 <= 1) + return 1; + let userCheckIndex = 1; + let isDosStyle = pathComponents2[0].search(/[a-zA-Z]:/) === 0; + if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths + pathComponents2[1].search(/[a-zA-Z]\$$/) === 0) { + if (length2 === 2) + return 2; + userCheckIndex = 2; + isDosStyle = true; + } + if (isDosStyle && !pathComponents2[userCheckIndex].match(/^users$/i)) { + return userCheckIndex; + } + return userCheckIndex + 2; + } + function canWatchDirectoryOrFile(pathComponents2, length2) { + if (length2 === void 0) + length2 = pathComponents2.length; + if (length2 <= 2) return false; - } - let nextDirectorySeparator = dirPath.indexOf(directorySeparator, rootLength); - if (nextDirectorySeparator === -1) { + const perceivedOsRootLength = perceivedOsRootLengthForWatching(pathComponents2, length2); + return length2 > perceivedOsRootLength + 1; + } + function canWatchAtTypes(atTypes) { + return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(getDirectoryPath(atTypes)); + } + function isInDirectoryPath(dirComponents, fileOrDirComponents) { + if (fileOrDirComponents.length < fileOrDirComponents.length) return false; - } - let pathPartForUserCheck = dirPath.substring(rootLength, nextDirectorySeparator + 1); - const isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* slash */; - if (isNonDirectorySeparatorRoot && dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths - pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { - nextDirectorySeparator = dirPath.indexOf(directorySeparator, nextDirectorySeparator + 1); - if (nextDirectorySeparator === -1) { + for (let i = 0; i < dirComponents.length; i++) { + if (fileOrDirComponents[i] !== dirComponents[i]) return false; - } - pathPartForUserCheck = dirPath.substring(rootLength + pathPartForUserCheck.length, nextDirectorySeparator + 1); - } - if (isNonDirectorySeparatorRoot && pathPartForUserCheck.search(/users\//i) !== 0) { - return true; - } - for (let searchIndex = nextDirectorySeparator + 1, searchLevels = 2; searchLevels > 0; searchLevels--) { - searchIndex = dirPath.indexOf(directorySeparator, searchIndex) + 1; - if (searchIndex === 0) { - return false; - } } return true; } + function canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(fileOrDirPath) { + return canWatchDirectoryOrFile(getPathComponents(fileOrDirPath)); + } + function canWatchAffectingLocation(filePath) { + return canWatchAffectedPackageJsonOrNodeModulesOfAtTypes(filePath); + } + function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath, rootDir, rootPath, rootPathComponents, getCurrentDirectory) { + const failedLookupPathComponents = getPathComponents(failedLookupLocationPath); + failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory()); + const failedLookupComponents = getPathComponents(failedLookupLocation); + const perceivedOsRootLength = perceivedOsRootLengthForWatching(failedLookupPathComponents, failedLookupPathComponents.length); + if (failedLookupPathComponents.length <= perceivedOsRootLength + 1) + return void 0; + const nodeModulesIndex = failedLookupPathComponents.indexOf("node_modules"); + if (nodeModulesIndex !== -1 && nodeModulesIndex + 1 <= perceivedOsRootLength + 1) + return void 0; + if (isInDirectoryPath(rootPathComponents, failedLookupPathComponents)) { + if (failedLookupPathComponents.length > rootPathComponents.length + 1) { + return getDirectoryOfFailedLookupWatch(failedLookupComponents, failedLookupPathComponents, Math.max(rootPathComponents.length + 1, perceivedOsRootLength + 1)); + } else { + return { + dir: rootDir, + dirPath: rootPath, + nonRecursive: true + }; + } + } + return getDirectoryToWatchFromFailedLookupLocationDirectory( + failedLookupComponents, + failedLookupPathComponents, + failedLookupPathComponents.length - 1, + perceivedOsRootLength, + nodeModulesIndex, + rootPathComponents + ); + } + function getDirectoryToWatchFromFailedLookupLocationDirectory(dirComponents, dirPathComponents, dirPathComponentsLength, perceivedOsRootLength, nodeModulesIndex, rootPathComponents) { + if (nodeModulesIndex !== -1) { + return getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, nodeModulesIndex + 1); + } + let nonRecursive = true; + let length2 = dirPathComponentsLength; + for (let i = 0; i < dirPathComponentsLength; i++) { + if (dirPathComponents[i] !== rootPathComponents[i]) { + nonRecursive = false; + length2 = Math.max(i + 1, perceivedOsRootLength + 1); + break; + } + } + return getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, length2, nonRecursive); + } + function getDirectoryOfFailedLookupWatch(dirComponents, dirPathComponents, length2, nonRecursive) { + return { + dir: getPathFromPathComponents(dirComponents, length2), + dirPath: getPathFromPathComponents(dirPathComponents, length2), + nonRecursive + }; + } + function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath, rootPath, rootPathComponents, getCurrentDirectory, filterCustomPath) { + const typeRootPathComponents = getPathComponents(typeRootPath); + if (isInDirectoryPath(rootPathComponents, typeRootPathComponents)) { + return rootPath; + } + typeRoot = isRootedDiskPath(typeRoot) ? normalizePath(typeRoot) : getNormalizedAbsolutePath(typeRoot, getCurrentDirectory()); + const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory( + getPathComponents(typeRoot), + typeRootPathComponents, + typeRootPathComponents.length, + perceivedOsRootLengthForWatching(typeRootPathComponents, typeRootPathComponents.length), + typeRootPathComponents.indexOf("node_modules"), + rootPathComponents + ); + return toWatch && filterCustomPath(toWatch.dirPath) ? toWatch.dirPath : void 0; + } + function getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory) { + const normalized = getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory()); + return !isDiskPathRoot(normalized) ? removeTrailingDirectorySeparator(normalized) : normalized; + } + function getRootPathSplitLength(rootPath) { + return rootPath.split(directorySeparator).length - (hasTrailingDirectorySeparator(rootPath) ? 1 : 0); + } function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) { let filesWithChangedSetOfUnresolvedImports; let filesWithInvalidatedResolutions; @@ -121103,6 +122055,7 @@ ${lanes.join("\n")} let failedLookupChecks; let startsWithPathChecks; let isInDirectoryChecks; + let allModuleAndTypeResolutionsAreInvalidated = false; const getCurrentDirectory = memoize(() => resolutionHost.getCurrentDirectory()); const cachedDirectoryStructureHost = resolutionHost.getCachedDirectoryStructureHost(); const resolvedModuleNames = /* @__PURE__ */ new Map(); @@ -121118,13 +122071,18 @@ ${lanes.join("\n")} resolutionHost.getCompilationSettings(), moduleResolutionCache.getPackageJsonInfoCache() ); - const failedLookupDefaultExtensions = [".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */, ".json" /* Json */]; - const customFailedLookupPaths = /* @__PURE__ */ new Map(); + const resolvedLibraries = /* @__PURE__ */ new Map(); + const libraryResolutionCache = createModuleResolutionCache( + getCurrentDirectory(), + resolutionHost.getCanonicalFileName, + getOptionsForLibraryResolution(resolutionHost.getCompilationSettings()), + moduleResolutionCache.getPackageJsonInfoCache() + ); const directoryWatchesOfFailedLookups = /* @__PURE__ */ new Map(); const fileWatchesOfAffectingLocations = /* @__PURE__ */ new Map(); - const rootDir = rootDirForResolution && removeTrailingDirectorySeparator(getNormalizedAbsolutePath(rootDirForResolution, getCurrentDirectory())); - const rootPath = rootDir && resolutionHost.toPath(rootDir); - const rootSplitLength = rootPath !== void 0 ? rootPath.split(directorySeparator).length : 0; + const rootDir = getRootDirectoryOfResolutionCache(rootDirForResolution, getCurrentDirectory); + const rootPath = resolutionHost.toPath(rootDir); + const rootPathComponents = getPathComponents(rootPath); const typeRootsWatches = /* @__PURE__ */ new Map(); return { getModuleResolutionCache: () => moduleResolutionCache, @@ -121136,6 +122094,7 @@ ${lanes.join("\n")} finishCachingPerDirectoryResolution, resolveModuleNameLiterals, resolveTypeReferenceDirectiveReferences, + resolveLibrary: resolveLibrary2, resolveSingleModuleNameWithoutWatching, removeResolutionsFromProjectReferenceRedirects, removeResolutionsOfFile, @@ -121147,7 +122106,8 @@ ${lanes.join("\n")} isFileWithInvalidatedNonRelativeUnresolvedImports, updateTypeRootsWatch, closeTypeRootsWatch, - clear: clear2 + clear: clear2, + onChangesAffectModuleResolution }; function getResolvedModule2(resolution) { return resolution.resolvedModule; @@ -121155,16 +122115,9 @@ ${lanes.join("\n")} function getResolvedTypeReferenceDirective2(resolution) { return resolution.resolvedTypeReferenceDirective; } - function isInDirectoryPath(dir, file) { - if (dir === void 0 || file.length <= dir.length) { - return false; - } - return startsWith(file, dir) && file[dir.length] === directorySeparator; - } function clear2() { clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf); clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf); - customFailedLookupPaths.clear(); nonRelativeExternalModuleResolutions.clear(); closeTypeRootsWatch(); resolvedModuleNames.clear(); @@ -121177,13 +122130,23 @@ ${lanes.join("\n")} isInDirectoryChecks = void 0; affectingPathChecks = void 0; affectingPathChecksForFile = void 0; + allModuleAndTypeResolutionsAreInvalidated = false; moduleResolutionCache.clear(); typeReferenceDirectiveResolutionCache.clear(); moduleResolutionCache.update(resolutionHost.getCompilationSettings()); typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings()); + libraryResolutionCache.clear(); impliedFormatPackageJsons.clear(); + resolvedLibraries.clear(); hasChangedAutomaticTypeDirectiveNames = false; } + function onChangesAffectModuleResolution() { + allModuleAndTypeResolutionsAreInvalidated = true; + moduleResolutionCache.clearAllExceptPackageJsonInfoCache(); + typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache(); + moduleResolutionCache.update(resolutionHost.getCompilationSettings()); + typeReferenceDirectiveResolutionCache.update(resolutionHost.getCompilationSettings()); + } function startRecordingFilesWithChangedResolutions() { filesWithChangedSetOfUnresolvedImports = []; } @@ -121199,27 +122162,49 @@ ${lanes.join("\n")} const value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); return !!value && !!value.length; } - function createHasInvalidatedResolutions(customHasInvalidatedResolutions) { + function createHasInvalidatedResolutions(customHasInvalidatedResolutions, customHasInvalidatedLibResolutions) { invalidateResolutionsOfFailedLookupLocations(); const collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = void 0; - return (path) => customHasInvalidatedResolutions(path) || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); + return { + hasInvalidatedResolutions: (path) => customHasInvalidatedResolutions(path) || allModuleAndTypeResolutionsAreInvalidated || !!(collected == null ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path), + hasInvalidatedLibResolutions: (libFileName) => { + var _a; + return customHasInvalidatedLibResolutions(libFileName) || !!((_a = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName)) == null ? void 0 : _a.isInvalidated); + } + }; } function startCachingPerDirectoryResolution() { moduleResolutionCache.clearAllExceptPackageJsonInfoCache(); typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache(); + libraryResolutionCache.clearAllExceptPackageJsonInfoCache(); nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions); nonRelativeExternalModuleResolutions.clear(); } + function cleanupLibResolutionWatching(newProgram) { + resolvedLibraries.forEach((resolution, libFileName) => { + var _a; + if (!((_a = newProgram == null ? void 0 : newProgram.resolvedLibReferences) == null ? void 0 : _a.has(libFileName))) { + stopWatchFailedLookupLocationOfResolution( + resolution, + resolutionHost.toPath(getInferredLibraryNameResolveFrom(newProgram.getCompilerOptions(), getCurrentDirectory(), libFileName)), + getResolvedModule2 + ); + resolvedLibraries.delete(libFileName); + } + }); + } function finishCachingPerDirectoryResolution(newProgram, oldProgram) { filesWithInvalidatedNonRelativeUnresolvedImports = void 0; + allModuleAndTypeResolutionsAreInvalidated = false; nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions); nonRelativeExternalModuleResolutions.clear(); if (newProgram !== oldProgram) { + cleanupLibResolutionWatching(newProgram); newProgram == null ? void 0 : newProgram.getSourceFiles().forEach((newFile) => { - var _a2, _b, _c; - const expected = isExternalOrCommonJsModule(newFile) ? (_b = (_a2 = newFile.packageJsonLocations) == null ? void 0 : _a2.length) != null ? _b : 0 : 0; - const existing = (_c = impliedFormatPackageJsons.get(newFile.path)) != null ? _c : emptyArray; + var _a; + const expected = isExternalOrCommonJsModule(newFile) ? ((_a = newFile.packageJsonLocations) == null ? void 0 : _a.length) ?? 0 : 0; + const existing = impliedFormatPackageJsons.get(newFile.path) ?? emptyArray; for (let i = existing.length; i < expected; i++) { createFileWatcherOfAffectingLocation( newFile.packageJsonLocations[i], @@ -121259,8 +122244,8 @@ ${lanes.join("\n")} hasChangedAutomaticTypeDirectiveNames = false; } function resolveModuleName2(moduleName, containingFile, compilerOptions, redirectedReference, mode) { - var _a2; - const host = ((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost; + var _a; + const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost; const primaryResult = resolveModuleName(moduleName, containingFile, compilerOptions, host, moduleResolutionCache, redirectedReference, mode); if (!resolutionHost.getGlobalCache) { return primaryResult; @@ -121307,10 +122292,11 @@ ${lanes.join("\n")} reusedNames, loader, getResolutionWithResolvedFileName, + deferWatchingNonRelativeResolution, shouldRetryResolution, logChanges }) { - var _a2; + var _a; const path = resolutionHost.toPath(containingFile); const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path); const resolvedModules = []; @@ -121323,15 +122309,15 @@ ${lanes.join("\n")} const name = loader.nameAndMode.getName(entry); const mode = loader.nameAndMode.getMode(entry, containingSourceFile); let resolution = resolutionsInFile.get(name, mode); - if (!seenNamesInFile.has(name, mode) && unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate - hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution)) { + if (!seenNamesInFile.has(name, mode) && (allModuleAndTypeResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate + hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) { const existingResolution = resolution; resolution = loader.resolve(name, mode); if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) { resolutionHost.onDiscoveredSymlink(); } resolutionsInFile.set(name, mode, resolution); - watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName); + watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution); if (existingResolution) { stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName); } @@ -121340,7 +122326,7 @@ ${lanes.join("\n")} logChanges = false; } } else { - const host = ((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost; + const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost; if (isTraceEnabled(options, host) && !seenNamesInFile.has(name, mode)) { const resolved = getResolutionWithResolvedFileName(resolution); trace( @@ -121390,7 +122376,7 @@ ${lanes.join("\n")} } } function resolveTypeReferenceDirectiveReferences(typeDirectiveReferences, containingFile, redirectedReference, options, containingSourceFile, reusedNames) { - var _a2; + var _a; return resolveNamesWithLocalCache({ entries: typeDirectiveReferences, containingFile, @@ -121403,11 +122389,12 @@ ${lanes.join("\n")} containingFile, redirectedReference, options, - ((_a2 = resolutionHost.getCompilerHost) == null ? void 0 : _a2.call(resolutionHost)) || resolutionHost, + ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost, typeReferenceDirectiveResolutionCache ), getResolutionWithResolvedFileName: getResolvedTypeReferenceDirective2, - shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0 + shouldRetryResolution: (resolution) => resolution.resolvedTypeReferenceDirective === void 0, + deferWatchingNonRelativeResolution: false }); } function resolveModuleNameLiterals(moduleLiterals, containingFile, redirectedReference, options, containingSourceFile, reusedNames) { @@ -121426,9 +122413,46 @@ ${lanes.join("\n")} ), getResolutionWithResolvedFileName: getResolvedModule2, shouldRetryResolution: (resolution) => !resolution.resolvedModule || !resolutionExtensionIsTSOrJson(resolution.resolvedModule.extension), - logChanges: logChangesWhenResolvingModule + logChanges: logChangesWhenResolvingModule, + deferWatchingNonRelativeResolution: true + // Defer non relative resolution watch because we could be using ambient modules }); } + function resolveLibrary2(libraryName, resolveFrom, options, libFileName) { + var _a; + const host = ((_a = resolutionHost.getCompilerHost) == null ? void 0 : _a.call(resolutionHost)) || resolutionHost; + let resolution = resolvedLibraries == null ? void 0 : resolvedLibraries.get(libFileName); + if (!resolution || resolution.isInvalidated) { + const existingResolution = resolution; + resolution = resolveLibrary(libraryName, resolveFrom, options, host, libraryResolutionCache); + const path = resolutionHost.toPath(resolveFrom); + watchFailedLookupLocationsOfExternalModuleResolutions( + libraryName, + resolution, + path, + getResolvedModule2, + /*deferWatchingNonRelativeResolution*/ + false + ); + resolvedLibraries.set(libFileName, resolution); + if (existingResolution) { + stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolvedModule2); + } + } else { + if (isTraceEnabled(options, host)) { + const resolved = getResolvedModule2(resolution); + trace( + host, + (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved, + libraryName, + resolveFrom, + resolved == null ? void 0 : resolved.resolvedFileName, + (resolved == null ? void 0 : resolved.packageId) && packageIdToString(resolved.packageId) + ); + } + } + return resolution; + } function resolveSingleModuleNameWithoutWatching(moduleName, containingFile) { const path = resolutionHost.toPath(containingFile); const resolutionsInFile = resolvedModuleNames.get(path); @@ -121444,67 +122468,15 @@ ${lanes.join("\n")} function isNodeModulesAtTypesDirectory(dirPath) { return endsWith(dirPath, "/node_modules/@types"); } - function getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath) { - if (isInDirectoryPath(rootPath, failedLookupLocationPath)) { - failedLookupLocation = isRootedDiskPath(failedLookupLocation) ? normalizePath(failedLookupLocation) : getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory()); - const failedLookupPathSplit = failedLookupLocationPath.split(directorySeparator); - const failedLookupSplit = failedLookupLocation.split(directorySeparator); - Debug.assert(failedLookupSplit.length === failedLookupPathSplit.length, `FailedLookup: ${failedLookupLocation} failedLookupLocationPath: ${failedLookupLocationPath}`); - if (failedLookupPathSplit.length > rootSplitLength + 1) { - return { - dir: failedLookupSplit.slice(0, rootSplitLength + 1).join(directorySeparator), - dirPath: failedLookupPathSplit.slice(0, rootSplitLength + 1).join(directorySeparator) - }; - } else { - return { - dir: rootDir, - dirPath: rootPath, - nonRecursive: false - }; - } - } - return getDirectoryToWatchFromFailedLookupLocationDirectory( - getDirectoryPath(getNormalizedAbsolutePath(failedLookupLocation, getCurrentDirectory())), - getDirectoryPath(failedLookupLocationPath) - ); - } - function getDirectoryToWatchFromFailedLookupLocationDirectory(dir, dirPath) { - while (pathContainsNodeModules(dirPath)) { - dir = getDirectoryPath(dir); - dirPath = getDirectoryPath(dirPath); - } - if (isNodeModulesDirectory(dirPath)) { - return canWatchDirectoryOrFile(getDirectoryPath(dirPath)) ? { dir, dirPath } : void 0; - } - let nonRecursive = true; - let subDirectoryPath, subDirectory; - if (rootPath !== void 0) { - while (!isInDirectoryPath(dirPath, rootPath)) { - const parentPath = getDirectoryPath(dirPath); - if (parentPath === dirPath) { - break; - } - nonRecursive = false; - subDirectoryPath = dirPath; - subDirectory = dir; - dirPath = parentPath; - dir = getDirectoryPath(dir); - } - } - return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive } : void 0; - } - function isPathWithDefaultFailedLookupExtension(path) { - return fileExtensionIsOneOf(path, failedLookupDefaultExtensions); - } - function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) { - var _a2, _b; + function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution) { + var _a; if (resolution.refCount) { resolution.refCount++; Debug.assertIsDefined(resolution.files); } else { resolution.refCount = 1; - Debug.assert(!((_a2 = resolution.files) == null ? void 0 : _a2.size)); - if (isExternalModuleNameRelative(name)) { + Debug.assert(!((_a = resolution.files) == null ? void 0 : _a.size)); + if (!deferWatchingNonRelativeResolution || isExternalModuleNameRelative(name)) { watchFailedLookupLocationOfResolution(resolution); } else { nonRelativeExternalModuleResolutions.add(name, resolution); @@ -121518,44 +122490,53 @@ ${lanes.join("\n")} resolutions.add(resolution); } } - ((_b = resolution.files) != null ? _b : resolution.files = /* @__PURE__ */ new Set()).add(filePath); + (resolution.files ?? (resolution.files = /* @__PURE__ */ new Set())).add(filePath); + } + function watchFailedLookupLocation(failedLookupLocation, setAtRoot) { + const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation); + const toWatch = getDirectoryToWatchFailedLookupLocation( + failedLookupLocation, + failedLookupLocationPath, + rootDir, + rootPath, + rootPathComponents, + getCurrentDirectory + ); + if (toWatch) { + const { dir, dirPath, nonRecursive } = toWatch; + if (dirPath === rootPath) { + Debug.assert(nonRecursive); + setAtRoot = true; + } else { + setDirectoryWatcher(dir, dirPath, nonRecursive); + } + } + return setAtRoot; } function watchFailedLookupLocationOfResolution(resolution) { Debug.assert(!!resolution.refCount); - const { failedLookupLocations, affectingLocations } = resolution; - if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length)) + const { failedLookupLocations, affectingLocations, node10Result } = resolution; + if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !node10Result) return; - if (failedLookupLocations == null ? void 0 : failedLookupLocations.length) + if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || node10Result) resolutionsWithFailedLookups.add(resolution); let setAtRoot = false; if (failedLookupLocations) { for (const failedLookupLocation of failedLookupLocations) { - const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation); - const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath); - if (toWatch) { - const { dir, dirPath, nonRecursive } = toWatch; - if (!isPathWithDefaultFailedLookupExtension(failedLookupLocationPath)) { - const refCount = customFailedLookupPaths.get(failedLookupLocationPath) || 0; - customFailedLookupPaths.set(failedLookupLocationPath, refCount + 1); - } - if (dirPath === rootPath) { - Debug.assert(!nonRecursive); - setAtRoot = true; - } else { - setDirectoryWatcher(dir, dirPath, nonRecursive); - } - } - } - if (setAtRoot) { - setDirectoryWatcher( - rootDir, - rootPath, - /*nonRecursive*/ - true - ); + setAtRoot = watchFailedLookupLocation(failedLookupLocation, setAtRoot); } } - watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length)); + if (node10Result) + setAtRoot = watchFailedLookupLocation(node10Result, setAtRoot); + if (setAtRoot) { + setDirectoryWatcher( + rootDir, + rootPath, + /*nonRecursive*/ + true + ); + } + watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !node10Result); } function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) { Debug.assert(!!resolution.refCount); @@ -121599,14 +122580,14 @@ ${lanes.join("\n")} } const paths = /* @__PURE__ */ new Set(); paths.add(locationToWatch); - let actualWatcher = canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => { + let actualWatcher = canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => { cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind); const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap(); paths.forEach((path) => { if (watcher.resolutions) - (affectingPathChecks != null ? affectingPathChecks : affectingPathChecks = /* @__PURE__ */ new Set()).add(path); + (affectingPathChecks ?? (affectingPathChecks = /* @__PURE__ */ new Set())).add(path); if (watcher.files) - (affectingPathChecksForFile != null ? affectingPathChecksForFile : affectingPathChecksForFile = /* @__PURE__ */ new Set()).add(path); + (affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path); packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path)); }); resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations(); @@ -121635,7 +122616,7 @@ ${lanes.join("\n")} } else { resolutions.forEach((resolution) => watchAffectingLocationsOfResolution( resolution, - /*addToResolutionWithOnlyAffectingLocations*/ + /*addToResolutionsWithOnlyAffectingLocations*/ true )); } @@ -121649,6 +122630,26 @@ ${lanes.join("\n")} directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive }); } } + function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot) { + const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation); + const toWatch = getDirectoryToWatchFailedLookupLocation( + failedLookupLocation, + failedLookupLocationPath, + rootDir, + rootPath, + rootPathComponents, + getCurrentDirectory + ); + if (toWatch) { + const { dirPath } = toWatch; + if (dirPath === rootPath) { + removeAtRoot = true; + } else { + removeDirectoryWatcher(dirPath); + } + } + return removeAtRoot; + } function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) { Debug.checkDefined(resolution.files).delete(filePath); resolution.refCount--; @@ -121662,33 +122663,18 @@ ${lanes.join("\n")} if ((resolutions == null ? void 0 : resolutions.delete(resolution)) && !resolutions.size) resolvedFileToResolution.delete(key); } - const { failedLookupLocations, affectingLocations } = resolution; + const { failedLookupLocations, affectingLocations, node10Result } = resolution; if (resolutionsWithFailedLookups.delete(resolution)) { let removeAtRoot = false; - for (const failedLookupLocation of failedLookupLocations) { - const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation); - const toWatch = getDirectoryToWatchFailedLookupLocation(failedLookupLocation, failedLookupLocationPath); - if (toWatch) { - const { dirPath } = toWatch; - const refCount = customFailedLookupPaths.get(failedLookupLocationPath); - if (refCount) { - if (refCount === 1) { - customFailedLookupPaths.delete(failedLookupLocationPath); - } else { - Debug.assert(refCount > 1); - customFailedLookupPaths.set(failedLookupLocationPath, refCount - 1); - } - } - if (dirPath === rootPath) { - removeAtRoot = true; - } else { - removeDirectoryWatcher(dirPath); - } + if (failedLookupLocations) { + for (const failedLookupLocation of failedLookupLocations) { + removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot); } } - if (removeAtRoot) { + if (node10Result) + removeAtRoot = stopWatchFailedLookupLocation(node10Result, removeAtRoot); + if (removeAtRoot) removeDirectoryWatcher(rootPath); - } } else if (affectingLocations == null ? void 0 : affectingLocations.length) { resolutionsWithOnlyAffectingLocations.delete(resolution); } @@ -121743,7 +122729,7 @@ ${lanes.join("\n")} return; resolution.isInvalidated = invalidated = true; for (const containingFilePath of Debug.checkDefined(resolution.files)) { - (filesWithInvalidatedResolutions != null ? filesWithInvalidatedResolutions : filesWithInvalidatedResolutions = /* @__PURE__ */ new Set()).add(containingFilePath); + (filesWithInvalidatedResolutions ?? (filesWithInvalidatedResolutions = /* @__PURE__ */ new Set())).add(containingFilePath); hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || endsWith(containingFilePath, inferredTypesContainingFile); } }); @@ -121776,27 +122762,49 @@ ${lanes.join("\n")} (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath); (startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath); } else { - if (!isPathWithDefaultFailedLookupExtension(fileOrDirectoryPath) && !customFailedLookupPaths.has(fileOrDirectoryPath)) { - return false; - } if (isEmittedFileOfProgram(resolutionHost.getCurrentProgram(), fileOrDirectoryPath)) { return false; } + if (fileExtensionIs(fileOrDirectoryPath, ".map")) { + return false; + } (failedLookupChecks || (failedLookupChecks = /* @__PURE__ */ new Set())).add(fileOrDirectoryPath); - const packagePath = parseNodeModuleFromPath(fileOrDirectoryPath); + const packagePath = parseNodeModuleFromPath( + fileOrDirectoryPath, + /*isFolder*/ + true + ); if (packagePath) (startsWithPathChecks || (startsWithPathChecks = /* @__PURE__ */ new Set())).add(packagePath); } } resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations(); } + function invalidatePackageJsonMap() { + const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap(); + if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) { + packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0); + } + } function invalidateResolutionsOfFailedLookupLocations() { - var _a2; + var _a; + if (allModuleAndTypeResolutionsAreInvalidated) { + affectingPathChecksForFile = void 0; + invalidatePackageJsonMap(); + if (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks || affectingPathChecks) { + invalidateResolutions(resolvedLibraries, canInvalidateFailedLookupResolution); + } + failedLookupChecks = void 0; + startsWithPathChecks = void 0; + isInDirectoryChecks = void 0; + affectingPathChecks = void 0; + return true; + } let invalidated = false; if (affectingPathChecksForFile) { - (_a2 = resolutionHost.getCurrentProgram()) == null ? void 0 : _a2.getSourceFiles().forEach((f) => { + (_a = resolutionHost.getCurrentProgram()) == null ? void 0 : _a.getSourceFiles().forEach((f) => { if (some(f.packageJsonLocations, (location) => affectingPathChecksForFile.has(location))) { - (filesWithInvalidatedResolutions != null ? filesWithInvalidatedResolutions : filesWithInvalidatedResolutions = /* @__PURE__ */ new Set()).add(f.path); + (filesWithInvalidatedResolutions ?? (filesWithInvalidatedResolutions = /* @__PURE__ */ new Set())).add(f.path); invalidated = true; } }); @@ -121806,10 +122814,7 @@ ${lanes.join("\n")} return invalidated; } invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated; - const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap(); - if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) { - packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0); - } + invalidatePackageJsonMap(); failedLookupChecks = void 0; startsWithPathChecks = void 0; isInDirectoryChecks = void 0; @@ -121818,43 +122823,43 @@ ${lanes.join("\n")} return invalidated; } function canInvalidateFailedLookupResolution(resolution) { - var _a2; + var _a; if (canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution)) return true; if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks) return false; - return (_a2 = resolution.failedLookupLocations) == null ? void 0 : _a2.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location))); + return ((_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)))) || !!resolution.node10Result && isInvalidatedFailedLookup(resolutionHost.toPath(resolution.node10Result)); } function isInvalidatedFailedLookup(locationPath) { - return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (fileOrDirectoryPath) => isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : void 0); + return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (dirPath) => locationPath.length > dirPath.length && startsWith(locationPath, dirPath) && (isDiskPathRoot(dirPath) || locationPath[dirPath.length] === directorySeparator) ? true : void 0); } function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) { - var _a2; - return !!affectingPathChecks && ((_a2 = resolution.affectingLocations) == null ? void 0 : _a2.some((location) => affectingPathChecks.has(location))); + var _a; + return !!affectingPathChecks && ((_a = resolution.affectingLocations) == null ? void 0 : _a.some((location) => affectingPathChecks.has(location))); } function closeTypeRootsWatch() { clearMap(typeRootsWatches, closeFileWatcher); } - function getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath) { - if (isInDirectoryPath(rootPath, typeRootPath)) { - return rootPath; - } - const toWatch = getDirectoryToWatchFromFailedLookupLocationDirectory(typeRoot, typeRootPath); - return toWatch && directoryWatchesOfFailedLookups.has(toWatch.dirPath) ? toWatch.dirPath : void 0; - } function createTypeRootsWatch(typeRootPath, typeRoot) { - return resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => { + return canWatchTypeRootPath(typeRootPath) ? resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => { const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory); if (cachedDirectoryStructureHost) { cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath); } hasChangedAutomaticTypeDirectiveNames = true; resolutionHost.onChangedAutomaticTypeDirectiveNames(); - const dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot(typeRoot, typeRootPath); + const dirPath = getDirectoryToWatchFailedLookupLocationFromTypeRoot( + typeRoot, + typeRootPath, + rootPath, + rootPathComponents, + getCurrentDirectory, + (dirPath2) => directoryWatchesOfFailedLookups.has(dirPath2) + ); if (dirPath) { scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath); } - }, 1 /* Recursive */); + }, 1 /* Recursive */) : noopFileWatcher; } function updateTypeRootsWatch() { const options = resolutionHost.getCompilationSettings(); @@ -121862,7 +122867,7 @@ ${lanes.join("\n")} closeTypeRootsWatch(); return; } - const typeRoots = getEffectiveTypeRoots(options, { directoryExists: directoryExistsForTypeRootWatch, getCurrentDirectory }); + const typeRoots = getEffectiveTypeRoots(options, { getCurrentDirectory }); if (typeRoots) { mutateMap( typeRootsWatches, @@ -121876,21 +122881,20 @@ ${lanes.join("\n")} closeTypeRootsWatch(); } } - function directoryExistsForTypeRootWatch(nodeTypesDirectory) { - const dir = getDirectoryPath(getDirectoryPath(nodeTypesDirectory)); - const dirPath = resolutionHost.toPath(dir); - return dirPath === rootPath || canWatchDirectoryOrFile(dirPath); + function canWatchTypeRootPath(typeRoot) { + if (resolutionHost.getCompilationSettings().typeRoots) + return true; + return canWatchAtTypes(resolutionHost.toPath(typeRoot)); } } function resolutionIsSymlink(resolution) { - var _a2, _b; - return !!(((_a2 = resolution.resolvedModule) == null ? void 0 : _a2.originalPath) || ((_b = resolution.resolvedTypeReferenceDirective) == null ? void 0 : _b.originalPath)); + var _a, _b; + return !!(((_a = resolution.resolvedModule) == null ? void 0 : _a.originalPath) || ((_b = resolution.resolvedTypeReferenceDirective) == null ? void 0 : _b.originalPath)); } var init_resolutionCache = __esm({ "src/compiler/resolutionCache.ts"() { "use strict"; init_ts2(); - init_ts2(); } }); @@ -121991,7 +122995,7 @@ ${lanes.join("\n")} return getRelativePathFromDirectory( cwd, error.fileName, - /* ignoreCase */ + /*ignoreCase*/ false ) + line; } @@ -122003,15 +123007,13 @@ ${lanes.join("\n")} const nonNilFiles = filesInError.filter((fileInError) => fileInError !== void 0); const distinctFileNamesWithLines = nonNilFiles.map((fileInError) => `${fileInError.fileName}:${fileInError.line}`).filter((value, index, self) => self.indexOf(value) === index); const firstFileReference = nonNilFiles[0] && prettyPathForFileError(nonNilFiles[0], host.getCurrentDirectory()); - const d = errorCount === 1 ? createCompilerDiagnostic( - filesInError[0] !== void 0 ? Diagnostics.Found_1_error_in_1 : Diagnostics.Found_1_error, - errorCount, - firstFileReference - ) : createCompilerDiagnostic( - distinctFileNamesWithLines.length === 0 ? Diagnostics.Found_0_errors : distinctFileNamesWithLines.length === 1 ? Diagnostics.Found_0_errors_in_the_same_file_starting_at_Colon_1 : Diagnostics.Found_0_errors_in_1_files, - errorCount, - distinctFileNamesWithLines.length === 1 ? firstFileReference : distinctFileNamesWithLines.length - ); + let messageAndArgs; + if (errorCount === 1) { + messageAndArgs = filesInError[0] !== void 0 ? [Diagnostics.Found_1_error_in_0, firstFileReference] : [Diagnostics.Found_1_error]; + } else { + messageAndArgs = distinctFileNamesWithLines.length === 0 ? [Diagnostics.Found_0_errors, errorCount] : distinctFileNamesWithLines.length === 1 ? [Diagnostics.Found_0_errors_in_the_same_file_starting_at_Colon_1, errorCount, firstFileReference] : [Diagnostics.Found_0_errors_in_1_files, errorCount, distinctFileNamesWithLines.length]; + } + const d = createCompilerDiagnostic(...messageAndArgs); const suffix = distinctFileNamesWithLines.length > 1 ? createTabularErrorsDisplay(nonNilFiles, host) : ""; return `${newLine}${flattenDiagnosticMessageText(d.messageText, newLine)}${newLine}${newLine}${suffix}`; } @@ -122052,20 +123054,20 @@ ${lanes.join("\n")} } } function explainFiles(program, write) { - var _a2, _b; + var _a, _b; const reasons = program.getFileIncludeReasons(); const relativeFileName = (fileName) => convertToRelativePath(fileName, program.getCurrentDirectory(), program.getCanonicalFileName); for (const file of program.getSourceFiles()) { write(`${toFileName(file, relativeFileName)}`); - (_a2 = reasons.get(file.path)) == null ? void 0 : _a2.forEach((reason) => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`)); + (_a = reasons.get(file.path)) == null ? void 0 : _a.forEach((reason) => write(` ${fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText}`)); (_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) == null ? void 0 : _b.forEach((d) => write(` ${d.messageText}`)); } } function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) { - var _a2; + var _a; let result; if (file.path !== file.resolvedPath) { - (result != null ? result : result = []).push(chainDiagnosticMessages( + (result ?? (result = [])).push(chainDiagnosticMessages( /*details*/ void 0, Diagnostics.File_is_output_of_project_reference_source_0, @@ -122073,7 +123075,7 @@ ${lanes.join("\n")} )); } if (file.redirectInfo) { - (result != null ? result : result = []).push(chainDiagnosticMessages( + (result ?? (result = [])).push(chainDiagnosticMessages( /*details*/ void 0, Diagnostics.File_redirects_to_file_0, @@ -122084,7 +123086,7 @@ ${lanes.join("\n")} switch (file.impliedNodeFormat) { case 99 /* ESNext */: if (file.packageJsonScope) { - (result != null ? result : result = []).push(chainDiagnosticMessages( + (result ?? (result = [])).push(chainDiagnosticMessages( /*details*/ void 0, Diagnostics.File_is_ECMAScript_module_because_0_has_field_type_with_value_module, @@ -122094,14 +123096,14 @@ ${lanes.join("\n")} break; case 1 /* CommonJS */: if (file.packageJsonScope) { - (result != null ? result : result = []).push(chainDiagnosticMessages( + (result ?? (result = [])).push(chainDiagnosticMessages( /*details*/ void 0, file.packageJsonScope.contents.packageJsonContent.type ? Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module : Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(last(file.packageJsonLocations), fileNameConvertor) )); - } else if ((_a2 = file.packageJsonLocations) == null ? void 0 : _a2.length) { - (result != null ? result : result = []).push(chainDiagnosticMessages( + } else if ((_a = file.packageJsonLocations) == null ? void 0 : _a.length) { + (result ?? (result = [])).push(chainDiagnosticMessages( /*details*/ void 0, Diagnostics.File_is_CommonJS_module_because_package_json_was_not_found @@ -122113,18 +123115,18 @@ ${lanes.join("\n")} return result; } function getMatchedFileSpec(program, fileName) { - var _a2; + var _a; const configFile = program.getCompilerOptions().configFile; - if (!((_a2 = configFile == null ? void 0 : configFile.configFileSpecs) == null ? void 0 : _a2.validatedFilesSpec)) + if (!((_a = configFile == null ? void 0 : configFile.configFileSpecs) == null ? void 0 : _a.validatedFilesSpec)) return void 0; const filePath = program.getCanonicalFileName(fileName); const basePath = getDirectoryPath(getNormalizedAbsolutePath(configFile.fileName, program.getCurrentDirectory())); return find(configFile.configFileSpecs.validatedFilesSpec, (fileSpec) => program.getCanonicalFileName(getNormalizedAbsolutePath(fileSpec, basePath)) === filePath); } function getMatchedIncludeSpec(program, fileName) { - var _a2, _b; + var _a, _b; const configFile = program.getCompilerOptions().configFile; - if (!((_a2 = configFile == null ? void 0 : configFile.configFileSpecs) == null ? void 0 : _a2.validatedIncludeSpecs)) + if (!((_a = configFile == null ? void 0 : configFile.configFileSpecs) == null ? void 0 : _a.validatedIncludeSpecs)) return void 0; if (configFile.configFileSpecs.isDefaultIncludeSpec) return true; @@ -122139,7 +123141,7 @@ ${lanes.join("\n")} }); } function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) { - var _a2, _b; + var _a, _b; const options = program.getCompilerOptions(); if (isReferencedFile(reason)) { const referenceLocation = getReferencedFileLocation((path) => program.getSourceFileByPath(path), reason); @@ -122181,7 +123183,7 @@ ${lanes.join("\n")} } switch (reason.kind) { case 0 /* RootFile */: - if (!((_a2 = options.configFile) == null ? void 0 : _a2.configFileSpecs)) + if (!((_a = options.configFile) == null ? void 0 : _a.configFileSpecs)) return chainDiagnosticMessages( /*details*/ void 0, @@ -122221,15 +123223,15 @@ ${lanes.join("\n")} toFileName(referencedResolvedRef.sourceFile.fileName, fileNameConvertor), options.outFile ? "--outFile" : "--out" ); - case 8 /* AutomaticTypeDirectiveFile */: + case 8 /* AutomaticTypeDirectiveFile */: { + const messageAndArgs = options.types ? reason.packageId ? [Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1, reason.typeReference, packageIdToString(reason.packageId)] : [Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions, reason.typeReference] : reason.packageId ? [Diagnostics.Entry_point_for_implicit_type_library_0_with_packageId_1, reason.typeReference, packageIdToString(reason.packageId)] : [Diagnostics.Entry_point_for_implicit_type_library_0, reason.typeReference]; return chainDiagnosticMessages( /*details*/ void 0, - options.types ? reason.packageId ? Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1 : Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions : reason.packageId ? Diagnostics.Entry_point_for_implicit_type_library_0_with_packageId_1 : Diagnostics.Entry_point_for_implicit_type_library_0, - reason.typeReference, - reason.packageId && packageIdToString(reason.packageId) + ...messageAndArgs ); - case 6 /* LibFile */: + } + case 6 /* LibFile */: { if (reason.index !== void 0) return chainDiagnosticMessages( /*details*/ @@ -122238,12 +123240,13 @@ ${lanes.join("\n")} options.lib[reason.index] ); const target = forEachEntry(targetOptionDeclaration.type, (value, key) => value === getEmitScriptTarget(options) ? key : void 0); + const messageAndArgs = target ? [Diagnostics.Default_library_for_target_0, target] : [Diagnostics.Default_library]; return chainDiagnosticMessages( /*details*/ void 0, - target ? Diagnostics.Default_library_for_target_0 : Diagnostics.Default_library, - target + ...messageAndArgs ); + } default: Debug.assertNever(reason); } @@ -122546,7 +123549,9 @@ ${lanes.join("\n")} MissingSourceMapFile: "Missing source map file", NoopConfigFileForInferredRoot: "Noop Config file for the inferred project root", MissingGeneratedFile: "Missing generated file", - NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation" + NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation", + TypingInstallerLocationFile: "File location for typing installer", + TypingInstallerLocationDirectory: "Directory location for typing installer" }; } }); @@ -122705,9 +123710,11 @@ ${lanes.join("\n")} if (!compilerHost.resolveTypeReferenceDirectiveReferences && !compilerHost.resolveTypeReferenceDirectives) { compilerHost.resolveTypeReferenceDirectiveReferences = resolutionCache.resolveTypeReferenceDirectiveReferences.bind(resolutionCache); } + compilerHost.resolveLibrary = !host.resolveLibrary ? resolutionCache.resolveLibrary.bind(resolutionCache) : host.resolveLibrary.bind(host); compilerHost.getModuleResolutionCache = host.resolveModuleNameLiterals || host.resolveModuleNames ? maybeBind(host, host.getModuleResolutionCache) : () => resolutionCache.getModuleResolutionCache(); const userProvidedResolution = !!host.resolveModuleNameLiterals || !!host.resolveTypeReferenceDirectiveReferences || !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; const customHasInvalidatedResolutions = userProvidedResolution ? maybeBind(host, host.hasInvalidatedResolutions) || returnTrue : returnFalse; + const customHasInvalidLibResolutions = host.resolveLibrary ? maybeBind(host, host.hasInvalidatedLibResolutions) || returnTrue : returnFalse; builderProgram = readBuilderProgram(compilerOptions, compilerHost); synchronizeProgram(); watchConfigFileWildCardDirectories(); @@ -122743,8 +123750,8 @@ ${lanes.join("\n")} } if (parsedConfigs) { clearMap(parsedConfigs, (config) => { - var _a2; - (_a2 = config.watcher) == null ? void 0 : _a2.close(); + var _a; + (_a = config.watcher) == null ? void 0 : _a.close(); config.watcher = void 0; if (config.watchedDirectories) clearMap(config.watchedDirectories, closeFileWatcherOf); @@ -122768,10 +123775,11 @@ ${lanes.join("\n")} if (hasChangedCompilerOptions) { newLine = updateNewLine(); if (program && changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) { - resolutionCache.clear(); + debugger; + resolutionCache.onChangesAffectModuleResolution(); } } - const hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); + const { hasInvalidatedResolutions, hasInvalidatedLibResolutions } = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions, customHasInvalidLibResolutions); const { originalReadFile, originalFileExists, @@ -122780,7 +123788,7 @@ ${lanes.join("\n")} originalWriteFile, readFileWithCache } = changeCompilerHostLikeToUseCache(compilerHost, toPath3); - if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, (path) => getSourceVersion(path, readFileWithCache), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -122801,7 +123809,7 @@ ${lanes.join("\n")} if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(Diagnostics.File_change_detected_Starting_incremental_compilation); } - createNewProgram(hasInvalidatedResolutions); + createNewProgram(hasInvalidatedResolutions, hasInvalidatedLibResolutions); } reportFileChangeDetectedOnCreateProgram = false; if (host.afterProgramCreate && program !== builderProgram) { @@ -122814,7 +123822,7 @@ ${lanes.join("\n")} compilerHost.writeFile = originalWriteFile; return builderProgram; } - function createNewProgram(hasInvalidatedResolutions) { + function createNewProgram(hasInvalidatedResolutions, hasInvalidatedLibResolutions) { writeLog("CreatingProgramWith::"); writeLog(` roots: ${JSON.stringify(rootFileNames)}`); writeLog(` options: ${JSON.stringify(compilerOptions)}`); @@ -122825,6 +123833,7 @@ ${lanes.join("\n")} hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; + compilerHost.hasInvalidatedLibResolutions = hasInvalidatedLibResolutions; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; const oldProgram = getCurrentProgram(); builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); @@ -122954,7 +123963,7 @@ ${lanes.join("\n")} } const pending = clearInvalidateResolutionsOfFailedLookupLocations(); writeLog(`Scheduling invalidateFailedLookup${pending ? ", Cancelled earlier one" : ""}`); - timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250); + timerToInvalidateFailedLookupResolutions = host.setTimeout(invalidateResolutionsOfFailedLookup, 250, "timerToInvalidateFailedLookupResolutions"); } function invalidateResolutionsOfFailedLookup() { timerToInvalidateFailedLookupResolutions = void 0; @@ -122970,7 +123979,7 @@ ${lanes.join("\n")} host.clearTimeout(timerToUpdateProgram); } writeLog("Scheduling update"); - timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250); + timerToUpdateProgram = host.setTimeout(updateProgramWithWatchStatus, 250, "timerToUpdateProgram"); } function scheduleProgramReload() { Debug.assert(!!configFileName); @@ -122983,21 +123992,22 @@ ${lanes.join("\n")} updateProgram(); } function updateProgram() { + var _a, _b, _c, _d; switch (reloadLevel) { case 1 /* Partial */: - perfLogger.logStartUpdateProgram("PartialConfigReload"); + (_a = perfLogger) == null ? void 0 : _a.logStartUpdateProgram("PartialConfigReload"); reloadFileNamesFromConfigFile(); break; case 2 /* Full */: - perfLogger.logStartUpdateProgram("FullConfigReload"); + (_b = perfLogger) == null ? void 0 : _b.logStartUpdateProgram("FullConfigReload"); reloadConfigFile(); break; default: - perfLogger.logStartUpdateProgram("SynchronizeProgram"); + (_c = perfLogger) == null ? void 0 : _c.logStartUpdateProgram("SynchronizeProgram"); synchronizeProgram(); break; } - perfLogger.logStopUpdateProgram("Done"); + (_d = perfLogger) == null ? void 0 : _d.logStopUpdateProgram("Done"); return getCurrentBuilderProgram(); } function reloadFileNamesFromConfigFile() { @@ -123091,7 +124101,7 @@ ${lanes.join("\n")} return parsedCommandLine; } function onReleaseParsedCommandLine(fileName) { - var _a2; + var _a; const path = toPath3(fileName); const config = parsedConfigs == null ? void 0 : parsedConfigs.get(path); if (!config) @@ -123099,7 +124109,7 @@ ${lanes.join("\n")} parsedConfigs.delete(path); if (config.watchedDirectories) clearMap(config.watchedDirectories, closeFileWatcherOf); - (_a2 = config.watcher) == null ? void 0 : _a2.close(); + (_a = config.watcher) == null ? void 0 : _a.close(); clearSharedExtendedConfigFileWatcher(path, sharedExtendedConfigFileWatchers); } function watchFilePath(path, file, callback, pollingInterval, options, watchType) { @@ -123184,11 +124194,11 @@ ${lanes.join("\n")} (extendedConfigFileName, extendedConfigFilePath) => watchFile2( extendedConfigFileName, (_fileName, eventKind) => { - var _a2; + var _a; updateCachedSystemWithFile(extendedConfigFileName, extendedConfigFilePath, eventKind); if (extendedConfigCache) cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, toPath3); - const projects = (_a2 = sharedExtendedConfigFileWatchers.get(extendedConfigFilePath)) == null ? void 0 : _a2.projects; + const projects = (_a = sharedExtendedConfigFileWatchers.get(extendedConfigFilePath)) == null ? void 0 : _a.projects; if (!(projects == null ? void 0 : projects.size)) return; projects.forEach((projectPath) => { @@ -123211,7 +124221,7 @@ ${lanes.join("\n")} ); } function watchReferencedProject(configFileName2, configPath, commandLine) { - var _a2, _b, _c, _d, _e; + var _a, _b, _c, _d, _e; commandLine.watcher || (commandLine.watcher = watchFile2( configFileName2, (_fileName, eventKind) => { @@ -123223,7 +124233,7 @@ ${lanes.join("\n")} scheduleProgramUpdate(); }, 2e3 /* High */, - ((_a2 = commandLine.parsedCommandLine) == null ? void 0 : _a2.watchOptions) || watchOptions, + ((_a = commandLine.parsedCommandLine) == null ? void 0 : _a.watchOptions) || watchOptions, WatchType.ConfigFileOfReferencedProject )); if ((_b = commandLine.parsedCommandLine) == null ? void 0 : _b.wildcardDirectories) { @@ -123231,7 +124241,7 @@ ${lanes.join("\n")} commandLine.watchedDirectories || (commandLine.watchedDirectories = /* @__PURE__ */ new Map()), new Map(Object.entries((_c = commandLine.parsedCommandLine) == null ? void 0 : _c.wildcardDirectories)), (directory, flags) => { - var _a3; + var _a2; return watchDirectory( directory, (fileOrDirectory) => { @@ -123262,7 +124272,7 @@ ${lanes.join("\n")} } }, flags, - ((_a3 = commandLine.parsedCommandLine) == null ? void 0 : _a3.watchOptions) || watchOptions, + ((_a2 = commandLine.parsedCommandLine) == null ? void 0 : _a2.watchOptions) || watchOptions, WatchType.WildcardDirectoryOfReferencedProject ); } @@ -123283,7 +124293,6 @@ ${lanes.join("\n")} "src/compiler/watchPublic.ts"() { "use strict"; init_ts2(); - init_ts2(); } }); @@ -123409,6 +124418,7 @@ ${lanes.join("\n")} compilerHost.getParsedCommandLine = (fileName) => parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName)); compilerHost.resolveModuleNameLiterals = maybeBind(host, host.resolveModuleNameLiterals); compilerHost.resolveTypeReferenceDirectiveReferences = maybeBind(host, host.resolveTypeReferenceDirectiveReferences); + compilerHost.resolveLibrary = maybeBind(host, host.resolveLibrary); compilerHost.resolveModuleNames = maybeBind(host, host.resolveModuleNames); compilerHost.resolveTypeReferenceDirectives = maybeBind(host, host.resolveTypeReferenceDirectives); compilerHost.getModuleResolutionCache = maybeBind(host, host.getModuleResolutionCache); @@ -123446,6 +124456,23 @@ ${lanes.join("\n")} createTypeReferenceResolutionLoader ); } + let libraryResolutionCache; + if (!compilerHost.resolveLibrary) { + libraryResolutionCache = createModuleResolutionCache( + compilerHost.getCurrentDirectory(), + compilerHost.getCanonicalFileName, + /*options*/ + void 0, + moduleResolutionCache == null ? void 0 : moduleResolutionCache.getPackageJsonInfoCache() + ); + compilerHost.resolveLibrary = (libraryName, resolveFrom, options2) => resolveLibrary( + libraryName, + resolveFrom, + options2, + host, + libraryResolutionCache + ); + } compilerHost.getBuildInfo = (fileName, configFilePath) => getBuildInfo3( state, fileName, @@ -123477,6 +124504,7 @@ ${lanes.join("\n")} compilerHost, moduleResolutionCache, typeReferenceDirectiveResolutionCache, + libraryResolutionCache, // Mutable state buildOrder: void 0, readFileWithCache: (f) => host.readFile(f), @@ -123694,7 +124722,7 @@ ${lanes.join("\n")} function disableCache(state) { if (!state.cache) return; - const { cache, host, compilerHost, extendedConfigCache, moduleResolutionCache, typeReferenceDirectiveResolutionCache } = state; + const { cache, host, compilerHost, extendedConfigCache, moduleResolutionCache, typeReferenceDirectiveResolutionCache, libraryResolutionCache } = state; host.readFile = cache.originalReadFile; host.fileExists = cache.originalFileExists; host.directoryExists = cache.originalDirectoryExists; @@ -123705,6 +124733,7 @@ ${lanes.join("\n")} extendedConfigCache.clear(); moduleResolutionCache == null ? void 0 : moduleResolutionCache.clear(); typeReferenceDirectiveResolutionCache == null ? void 0 : typeReferenceDirectiveResolutionCache.clear(); + libraryResolutionCache == null ? void 0 : libraryResolutionCache.clear(); state.cache = void 0; } function clearProjectStatus(state, resolved) { @@ -123810,8 +124839,8 @@ ${lanes.join("\n")} if (targetSourceFile || emitOnlyDtsFiles) { return withProgramOrUndefined( (program2) => { - var _a2, _b; - return program2.emit(targetSourceFile, writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers || ((_b = (_a2 = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a2, project))); + var _a, _b; + return program2.emit(targetSourceFile, writeFile2, cancellationToken, emitOnlyDtsFiles, customTransformers || ((_b = (_a = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a, project))); } ); } @@ -123854,7 +124883,7 @@ ${lanes.join("\n")} return withProgramOrUndefined(action) || emptyArray; } function createProgram2() { - var _a2, _b; + var _a, _b; Debug.assert(program === void 0); if (state.options.dry) { reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project); @@ -123872,7 +124901,7 @@ ${lanes.join("\n")} } const { host, compilerHost } = state; state.projectCompilerOptions = config.options; - (_a2 = state.moduleResolutionCache) == null ? void 0 : _a2.update(config.options); + (_a = state.moduleResolutionCache) == null ? void 0 : _a.update(config.options); (_b = state.typeReferenceDirectiveResolutionCache) == null ? void 0 : _b.update(config.options); program = host.createProgram( config.fileNames, @@ -123935,7 +124964,7 @@ ${lanes.join("\n")} ); } function emit(writeFileCallback, cancellationToken, customTransformers) { - var _a2, _b, _c; + var _a, _b, _c; Debug.assertIsDefined(program); Debug.assert(step === 3 /* Emit */); const saved = program.saveEmitState(); @@ -123951,9 +124980,9 @@ ${lanes.join("\n")} void 0, (name, text, writeByteOrderMark, _onError, _sourceFiles, data) => outputFiles.push({ name, text, writeByteOrderMark, data }), cancellationToken, - /*emitOnlyDts*/ + /*emitOnlyDtsFiles*/ false, - customTransformers || ((_b = (_a2 = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a2, project)) + customTransformers || ((_b = (_a = state.host).getCustomTransformers) == null ? void 0 : _b.call(_a, project)) ); if (declDiagnostics) { program.restoreEmitState(saved); @@ -124052,7 +125081,7 @@ ${lanes.join("\n")} return emitDiagnostics; } function emitBundle(writeFileCallback, customTransformers) { - var _a2, _b, _c, _d; + var _a, _b, _c, _d; Debug.assert(kind === 1 /* UpdateBundle */); if (state.options.dry) { reportStatus(state, Diagnostics.A_non_dry_build_would_update_output_of_project_0, project); @@ -124064,7 +125093,7 @@ ${lanes.join("\n")} reportStatus(state, Diagnostics.Updating_output_of_project_0, project); const { compilerHost } = state; state.projectCompilerOptions = config.options; - (_b = (_a2 = state.host).beforeEmitBundle) == null ? void 0 : _b.call(_a2, config); + (_b = (_a = state.host).beforeEmitBundle) == null ? void 0 : _b.call(_a, config); const outputFiles = emitUsingBuildInfo( config, compilerHost, @@ -124093,10 +125122,10 @@ ${lanes.join("\n")} let resultFlags = 2 /* DeclarationOutputUnchanged */; const existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || void 0; outputFiles.forEach(({ name, text, writeByteOrderMark, data }) => { - var _a3, _b2; + var _a2, _b2; emittedOutputs.set(toPath2(state, name), name); if (data == null ? void 0 : data.buildInfo) { - if (((_a3 = data.buildInfo.program) == null ? void 0 : _a3.outSignature) !== ((_b2 = existingBuildInfo == null ? void 0 : existingBuildInfo.program) == null ? void 0 : _b2.outSignature)) { + if (((_a2 = data.buildInfo.program) == null ? void 0 : _a2.outSignature) !== ((_b2 = existingBuildInfo == null ? void 0 : existingBuildInfo.program) == null ? void 0 : _b2.outSignature)) { resultFlags &= ~2 /* DeclarationOutputUnchanged */; } setBuildInfo(state, data.buildInfo, projectPath, config.options, resultFlags); @@ -124409,7 +125438,7 @@ ${lanes.join("\n")} } } function getUpToDateStatusWorker(state, project, resolvedPath) { - var _a2, _b; + var _a, _b; if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) { return { type: 16 /* ContainerOnly */ @@ -124483,7 +125512,7 @@ ${lanes.join("\n")} }; } if (buildInfo.program) { - if (((_a2 = buildInfo.program.changeFileSet) == null ? void 0 : _a2.length) || (!project.options.noEmit ? (_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length : some(buildInfo.program.semanticDiagnosticsPerFile, isArray))) { + if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? (_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length : some(buildInfo.program.semanticDiagnosticsPerFile, isArray))) { return { type: 8 /* OutOfDateBuildInfo */, buildInfoFile: buildInfoPath @@ -124880,9 +125909,9 @@ ${lanes.join("\n")} if (state.timerToBuildInvalidatedProject) { hostWithWatch.clearTimeout(state.timerToBuildInvalidatedProject); } - state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected); + state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, "timerToBuildInvalidatedProject", state, changeDetected); } - function buildNextInvalidatedProject(state, changeDetected) { + function buildNextInvalidatedProject(_timeoutType, state, changeDetected) { mark("SolutionBuilder::beforeBuild"); const buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected); mark("SolutionBuilder::afterBuild"); @@ -124959,8 +125988,8 @@ ${lanes.join("\n")} state, extendedConfigFileName, () => { - var _a2; - return (_a2 = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) == null ? void 0 : _a2.projects.forEach((projectConfigFilePath) => invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, 2 /* Full */)); + var _a; + return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) == null ? void 0 : _a.projects.forEach((projectConfigFilePath) => invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, 2 /* Full */)); }, 2e3 /* High */, parsed == null ? void 0 : parsed.watchOptions, @@ -124978,7 +126007,7 @@ ${lanes.join("\n")} (dir, flags) => state.watchDirectory( dir, (fileOrDirectory) => { - var _a2; + var _a; if (isIgnoredFileFromWildCardWatching({ watchedDirPath: toPath2(state, dir), fileOrDirectory, @@ -124986,7 +126015,7 @@ ${lanes.join("\n")} configFileName: resolved, currentDirectory: state.compilerHost.getCurrentDirectory(), options: parsed.options, - program: state.builderPrograms.get(resolvedPath) || ((_a2 = getCachedParsedConfigFile(state, resolvedPath)) == null ? void 0 : _a2.fileNames), + program: state.builderPrograms.get(resolvedPath) || ((_a = getCachedParsedConfigFile(state, resolvedPath)) == null ? void 0 : _a.fileNames), useCaseSensitiveFileNames: state.parseConfigFileHost.useCaseSensitiveFileNames, writeLog: (s) => state.writeLog(s), toPath: (fileName) => toPath2(state, fileName) @@ -125113,8 +126142,8 @@ ${lanes.join("\n")} state.host.reportSolutionBuilderStatus(createCompilerDiagnostic(message, ...args)); } function reportWatchStatus(state, message, ...args) { - var _a2, _b; - (_b = (_a2 = state.hostWithWatch).onWatchStatusChange) == null ? void 0 : _b.call(_a2, createCompilerDiagnostic(message, ...args), state.host.getNewLine(), state.baseCompilerOptions); + var _a, _b; + (_b = (_a = state.hostWithWatch).onWatchStatusChange) == null ? void 0 : _b.call(_a, createCompilerDiagnostic(message, ...args), state.host.getNewLine(), state.baseCompilerOptions); } function reportErrors({ host }, errors) { errors.forEach((err) => host.reportDiagnostic(err)); @@ -125303,7 +126332,6 @@ ${lanes.join("\n")} "src/compiler/tsbuildPublic.ts"() { "use strict"; init_ts2(); - init_ts2(); init_ts_performance(); minimumDate = /* @__PURE__ */ new Date(-864e13); maximumDate = /* @__PURE__ */ new Date(864e13); @@ -125408,9 +126436,9 @@ ${lanes.join("\n")} return new Map(Object.entries(result.config)); } function loadTypesMap(host, typesMapPath) { - var _a2; + var _a; const result = readConfigFile(typesMapPath, (path) => host.readFile(path)); - if ((_a2 = result.config) == null ? void 0 : _a2.simpleMap) { + if ((_a = result.config) == null ? void 0 : _a.simpleMap) { return new Map(Object.entries(result.config.simpleMap)); } return void 0; @@ -125634,7 +126662,7 @@ ${lanes.join("\n")} case 0 /* Ok */: return Debug.fail(); default: - throw Debug.assertNever(result); + Debug.assertNever(result); } } var unprefixedNodeCoreModuleList, prefixedNodeCoreModuleList, nodeCoreModuleList, nodeCoreModules, NameValidationResult, maxPackageNameLength; @@ -125741,7 +126769,7 @@ ${lanes.join("\n")} const d = /* @__PURE__ */ new Date(); return `${padLeft(d.getHours().toString(), 2, "0")}:${padLeft(d.getMinutes().toString(), 2, "0")}:${padLeft(d.getSeconds().toString(), 2, "0")}.${padLeft(d.getMilliseconds().toString(), 3, "0")}`; } - var ActionSet, ActionInvalidate, ActionPackageInstalled, EventTypesRegistry, EventBeginInstallTypes, EventEndInstallTypes, EventInitializationFailed, Arguments; + var ActionSet, ActionInvalidate, ActionPackageInstalled, EventTypesRegistry, EventBeginInstallTypes, EventEndInstallTypes, EventInitializationFailed, ActionWatchTypingLocations, Arguments; var init_shared = __esm({ "src/jsTyping/shared.ts"() { "use strict"; @@ -125753,6 +126781,7 @@ ${lanes.join("\n")} EventBeginInstallTypes = "event::beginInstallTypes"; EventEndInstallTypes = "event::endInstallTypes"; EventInitializationFailed = "event::initializationFailed"; + ActionWatchTypingLocations = "action::watchTypingLocations"; ((Arguments2) => { Arguments2.GlobalCacheLocation = "--globalTypingsCacheLocation"; Arguments2.LogFile = "--logFile"; @@ -125778,6 +126807,7 @@ ${lanes.join("\n")} ActionInvalidate: () => ActionInvalidate, ActionPackageInstalled: () => ActionPackageInstalled, ActionSet: () => ActionSet, + ActionWatchTypingLocations: () => ActionWatchTypingLocations, Arguments: () => Arguments, EventBeginInstallTypes: () => EventBeginInstallTypes, EventEndInstallTypes: () => EventEndInstallTypes, @@ -125828,7 +126858,8 @@ ${lanes.join("\n")} placeOpenBraceOnNewLineForFunctions: false, placeOpenBraceOnNewLineForControlBlocks: false, semicolons: "ignore" /* Ignore */, - trimTrailingWhitespace: true + trimTrailingWhitespace: true, + indentSwitchCase: true }; } var ScriptSnapshot, PackageJsonDependencyGroup, PackageJsonAutoImportPreference, LanguageServiceMode, emptyOptions, SemanticClassificationFormat, OrganizeImportsMode, CompletionTriggerKind, InlayHintKind, HighlightSpanKind, IndentStyle, SemicolonPreference, testFormatSettings, SymbolDisplayPartKind, CompletionInfoFlags, OutliningSpanKind, OutputFileType, EndOfLineState, TokenClass, ScriptElementKind, ScriptElementKindModifier, ClassificationTypeNames, ClassificationType; @@ -126120,36 +127151,36 @@ ${lanes.join("\n")} // src/services/utilities.ts function getMeaningFromDeclaration(node) { switch (node.kind) { - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: return isInJSFile(node) && getJSDocEnumTag(node) ? 7 /* All */ : 1 /* Value */; - case 166 /* Parameter */: - case 205 /* BindingElement */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 299 /* PropertyAssignment */: - case 300 /* ShorthandPropertyAssignment */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 295 /* CatchClause */: - case 288 /* JsxAttribute */: + case 168 /* Parameter */: + case 207 /* BindingElement */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 302 /* PropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 298 /* CatchClause */: + case 290 /* JsxAttribute */: return 1 /* Value */; - case 165 /* TypeParameter */: - case 261 /* InterfaceDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 184 /* TypeLiteral */: + case 167 /* TypeParameter */: + case 263 /* InterfaceDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 186 /* TypeLiteral */: return 2 /* Type */; - case 349 /* JSDocTypedefTag */: + case 352 /* JSDocTypedefTag */: return node.name === void 0 ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */; - case 302 /* EnumMember */: - case 260 /* ClassDeclaration */: + case 305 /* EnumMember */: + case 262 /* ClassDeclaration */: return 1 /* Value */ | 2 /* Type */; - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: if (isAmbientModule(node)) { return 4 /* Namespace */ | 1 /* Value */; } else if (getModuleInstanceState(node) === 1 /* Instantiated */) { @@ -126157,15 +127188,15 @@ ${lanes.join("\n")} } else { return 4 /* Namespace */; } - case 263 /* EnumDeclaration */: - case 272 /* NamedImports */: - case 273 /* ImportSpecifier */: - case 268 /* ImportEqualsDeclaration */: - case 269 /* ImportDeclaration */: - case 274 /* ExportAssignment */: - case 275 /* ExportDeclaration */: + case 265 /* EnumDeclaration */: + case 274 /* NamedImports */: + case 275 /* ImportSpecifier */: + case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportDeclaration */: + case 276 /* ExportAssignment */: + case 277 /* ExportDeclaration */: return 7 /* All */; - case 308 /* SourceFile */: + case 311 /* SourceFile */: return 4 /* Namespace */ | 1 /* Value */; } return 7 /* All */; @@ -126173,7 +127204,7 @@ ${lanes.join("\n")} function getMeaningFromLocation(node) { node = getAdjustedReferenceLocation(node); const parent2 = node.parent; - if (node.kind === 308 /* SourceFile */) { + if (node.kind === 311 /* SourceFile */) { return 1 /* Value */; } else if (isExportAssignment(parent2) || isExportSpecifier(parent2) || isExternalModuleReference(parent2) || isImportSpecifier(parent2) || isImportClause(parent2) || isImportEqualsDeclaration(parent2) && node === parent2.name) { return 7 /* All */; @@ -126197,11 +127228,11 @@ ${lanes.join("\n")} } } function getMeaningFromRightHandSideOfImportEquals(node) { - const name = node.kind === 163 /* QualifiedName */ ? node : isQualifiedName(node.parent) && node.parent.right === node ? node.parent : void 0; - return name && name.parent.kind === 268 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */; + const name = node.kind === 165 /* QualifiedName */ ? node : isQualifiedName(node.parent) && node.parent.right === node ? node.parent : void 0; + return name && name.parent.kind === 270 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */; } function isInRightSideOfInternalImportEqualsDeclaration(node) { - while (node.parent.kind === 163 /* QualifiedName */) { + while (node.parent.kind === 165 /* QualifiedName */) { node = node.parent; } return isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -126212,26 +127243,26 @@ ${lanes.join("\n")} function isQualifiedNameNamespaceReference(node) { let root = node; let isLastClause = true; - if (root.parent.kind === 163 /* QualifiedName */) { - while (root.parent && root.parent.kind === 163 /* QualifiedName */) { + if (root.parent.kind === 165 /* QualifiedName */) { + while (root.parent && root.parent.kind === 165 /* QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 180 /* TypeReference */ && !isLastClause; + return root.parent.kind === 182 /* TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { let root = node; let isLastClause = true; - if (root.parent.kind === 208 /* PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 208 /* PropertyAccessExpression */) { + if (root.parent.kind === 210 /* PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 210 /* PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 230 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 294 /* HeritageClause */) { + if (!isLastClause && root.parent.kind === 232 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 297 /* HeritageClause */) { const decl = root.parent.parent.parent; - return decl.kind === 260 /* ClassDeclaration */ && root.parent.parent.token === 117 /* ImplementsKeyword */ || decl.kind === 261 /* InterfaceDeclaration */ && root.parent.parent.token === 94 /* ExtendsKeyword */; + return decl.kind === 262 /* ClassDeclaration */ && root.parent.parent.token === 119 /* ImplementsKeyword */ || decl.kind === 263 /* InterfaceDeclaration */ && root.parent.parent.token === 96 /* ExtendsKeyword */; } return false; } @@ -126240,17 +127271,17 @@ ${lanes.join("\n")} node = node.parent; } switch (node.kind) { - case 108 /* ThisKeyword */: + case 110 /* ThisKeyword */: return !isExpressionNode(node); - case 194 /* ThisType */: + case 196 /* ThisType */: return true; } switch (node.parent.kind) { - case 180 /* TypeReference */: + case 182 /* TypeReference */: return true; - case 202 /* ImportType */: + case 204 /* ImportType */: return !node.parent.isTypeOf; - case 230 /* ExpressionWithTypeArguments */: + case 232 /* ExpressionWithTypeArguments */: return isPartOfTypeNode(node.parent); } return false; @@ -126297,7 +127328,7 @@ ${lanes.join("\n")} } function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 253 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 255 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -126311,58 +127342,58 @@ ${lanes.join("\n")} return node.expression.name.text === funcName; } function isJumpStatementTarget(node) { - var _a2; - return isIdentifier(node) && ((_a2 = tryCast(node.parent, isBreakOrContinueStatement)) == null ? void 0 : _a2.label) === node; + var _a; + return isIdentifier(node) && ((_a = tryCast(node.parent, isBreakOrContinueStatement)) == null ? void 0 : _a.label) === node; } function isLabelOfLabeledStatement(node) { - var _a2; - return isIdentifier(node) && ((_a2 = tryCast(node.parent, isLabeledStatement)) == null ? void 0 : _a2.label) === node; + var _a; + return isIdentifier(node) && ((_a = tryCast(node.parent, isLabeledStatement)) == null ? void 0 : _a.label) === node; } function isLabelName(node) { return isLabelOfLabeledStatement(node) || isJumpStatementTarget(node); } function isTagName(node) { - var _a2; - return ((_a2 = tryCast(node.parent, isJSDocTag)) == null ? void 0 : _a2.tagName) === node; + var _a; + return ((_a = tryCast(node.parent, isJSDocTag)) == null ? void 0 : _a.tagName) === node; } function isRightSideOfQualifiedName(node) { - var _a2; - return ((_a2 = tryCast(node.parent, isQualifiedName)) == null ? void 0 : _a2.right) === node; + var _a; + return ((_a = tryCast(node.parent, isQualifiedName)) == null ? void 0 : _a.right) === node; } function isRightSideOfPropertyAccess(node) { - var _a2; - return ((_a2 = tryCast(node.parent, isPropertyAccessExpression)) == null ? void 0 : _a2.name) === node; + var _a; + return ((_a = tryCast(node.parent, isPropertyAccessExpression)) == null ? void 0 : _a.name) === node; } function isArgumentExpressionOfElementAccess(node) { - var _a2; - return ((_a2 = tryCast(node.parent, isElementAccessExpression)) == null ? void 0 : _a2.argumentExpression) === node; + var _a; + return ((_a = tryCast(node.parent, isElementAccessExpression)) == null ? void 0 : _a.argumentExpression) === node; } function isNameOfModuleDeclaration(node) { - var _a2; - return ((_a2 = tryCast(node.parent, isModuleDeclaration)) == null ? void 0 : _a2.name) === node; + var _a; + return ((_a = tryCast(node.parent, isModuleDeclaration)) == null ? void 0 : _a.name) === node; } function isNameOfFunctionDeclaration(node) { - var _a2; - return isIdentifier(node) && ((_a2 = tryCast(node.parent, isFunctionLike)) == null ? void 0 : _a2.name) === node; + var _a; + return isIdentifier(node) && ((_a = tryCast(node.parent, isFunctionLike)) == null ? void 0 : _a.name) === node; } function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { switch (node.parent.kind) { - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 299 /* PropertyAssignment */: - case 302 /* EnumMember */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 264 /* ModuleDeclaration */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 302 /* PropertyAssignment */: + case 305 /* EnumMember */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 266 /* ModuleDeclaration */: return getNameOfDeclaration(node.parent) === node; - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: return node.parent.argumentExpression === node; - case 164 /* ComputedPropertyName */: + case 166 /* ComputedPropertyName */: return true; - case 198 /* LiteralType */: - return node.parent.parent.kind === 196 /* IndexedAccessType */; + case 200 /* LiteralType */: + return node.parent.parent.kind === 198 /* IndexedAccessType */; default: return false; } @@ -126380,83 +127411,83 @@ ${lanes.join("\n")} return void 0; } switch (node.kind) { - case 308 /* SourceFile */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: - case 263 /* EnumDeclaration */: - case 264 /* ModuleDeclaration */: + case 311 /* SourceFile */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: + case 265 /* EnumDeclaration */: + case 266 /* ModuleDeclaration */: return node; } } } function getNodeKind(node) { switch (node.kind) { - case 308 /* SourceFile */: + case 311 /* SourceFile */: return isExternalModule(node) ? "module" /* moduleElement */ : "script" /* scriptElement */; - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: return "module" /* moduleElement */; - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: return "class" /* classElement */; - case 261 /* InterfaceDeclaration */: + case 263 /* InterfaceDeclaration */: return "interface" /* interfaceElement */; - case 262 /* TypeAliasDeclaration */: - case 341 /* JSDocCallbackTag */: - case 349 /* JSDocTypedefTag */: + case 264 /* TypeAliasDeclaration */: + case 344 /* JSDocCallbackTag */: + case 352 /* JSDocTypedefTag */: return "type" /* typeElement */; - case 263 /* EnumDeclaration */: + case 265 /* EnumDeclaration */: return "enum" /* enumElement */; - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 205 /* BindingElement */: + case 207 /* BindingElement */: return getKindOfVariableDeclaration(getRootDeclaration(node)); - case 216 /* ArrowFunction */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: return "function" /* functionElement */; - case 174 /* GetAccessor */: + case 176 /* GetAccessor */: return "getter" /* memberGetAccessorElement */; - case 175 /* SetAccessor */: + case 177 /* SetAccessor */: return "setter" /* memberSetAccessorElement */; - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: return "method" /* memberFunctionElement */; - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: const { initializer } = node; return isFunctionLike(initializer) ? "method" /* memberFunctionElement */ : "property" /* memberVariableElement */; - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 300 /* ShorthandPropertyAssignment */: - case 301 /* SpreadAssignment */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 303 /* ShorthandPropertyAssignment */: + case 304 /* SpreadAssignment */: return "property" /* memberVariableElement */; - case 178 /* IndexSignature */: + case 180 /* IndexSignature */: return "index" /* indexSignatureElement */; - case 177 /* ConstructSignature */: + case 179 /* ConstructSignature */: return "construct" /* constructSignatureElement */; - case 176 /* CallSignature */: + case 178 /* CallSignature */: return "call" /* callSignatureElement */; - case 173 /* Constructor */: - case 172 /* ClassStaticBlockDeclaration */: + case 175 /* Constructor */: + case 174 /* ClassStaticBlockDeclaration */: return "constructor" /* constructorImplementationElement */; - case 165 /* TypeParameter */: + case 167 /* TypeParameter */: return "type parameter" /* typeParameterElement */; - case 302 /* EnumMember */: + case 305 /* EnumMember */: return "enum member" /* enumMemberElement */; - case 166 /* Parameter */: + case 168 /* Parameter */: return hasSyntacticModifier(node, 16476 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */; - case 268 /* ImportEqualsDeclaration */: - case 273 /* ImportSpecifier */: - case 278 /* ExportSpecifier */: - case 271 /* NamespaceImport */: - case 277 /* NamespaceExport */: + case 270 /* ImportEqualsDeclaration */: + case 275 /* ImportSpecifier */: + case 280 /* ExportSpecifier */: + case 273 /* NamespaceImport */: + case 279 /* NamespaceExport */: return "alias" /* alias */; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: const kind = getAssignmentDeclarationKind(node); const { right } = node; switch (kind) { @@ -126482,9 +127513,9 @@ ${lanes.join("\n")} return "" /* unknown */; } } - case 79 /* Identifier */: + case 80 /* Identifier */: return isImportClause(node.parent) ? "alias" /* alias */ : "" /* unknown */; - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: const scriptKind = getNodeKind(node.expression); return scriptKind === "" /* unknown */ ? "const" /* constElement */ : scriptKind; default: @@ -126496,10 +127527,10 @@ ${lanes.join("\n")} } function isThis(node) { switch (node.kind) { - case 108 /* ThisKeyword */: + case 110 /* ThisKeyword */: return true; - case 79 /* Identifier */: - return identifierIsThisKeyword(node) && node.parent.kind === 166 /* Parameter */; + case 80 /* Identifier */: + return identifierIsThisKeyword(node) && node.parent.kind === 168 /* Parameter */; default: return false; } @@ -126547,102 +127578,102 @@ ${lanes.join("\n")} return false; } switch (n.kind) { - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: - case 263 /* EnumDeclaration */: - case 207 /* ObjectLiteralExpression */: - case 203 /* ObjectBindingPattern */: - case 184 /* TypeLiteral */: - case 238 /* Block */: - case 265 /* ModuleBlock */: - case 266 /* CaseBlock */: - case 272 /* NamedImports */: - case 276 /* NamedExports */: - return nodeEndsWith(n, 19 /* CloseBraceToken */, sourceFile); - case 295 /* CatchClause */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: + case 265 /* EnumDeclaration */: + case 209 /* ObjectLiteralExpression */: + case 205 /* ObjectBindingPattern */: + case 186 /* TypeLiteral */: + case 240 /* Block */: + case 267 /* ModuleBlock */: + case 268 /* CaseBlock */: + case 274 /* NamedImports */: + case 278 /* NamedExports */: + return nodeEndsWith(n, 20 /* CloseBraceToken */, sourceFile); + case 298 /* CatchClause */: return isCompletedNode(n.block, sourceFile); - case 211 /* NewExpression */: + case 213 /* NewExpression */: if (!n.arguments) { return true; } - case 210 /* CallExpression */: - case 214 /* ParenthesizedExpression */: - case 193 /* ParenthesizedType */: - return nodeEndsWith(n, 21 /* CloseParenToken */, sourceFile); - case 181 /* FunctionType */: - case 182 /* ConstructorType */: + case 212 /* CallExpression */: + case 216 /* ParenthesizedExpression */: + case 195 /* ParenthesizedType */: + return nodeEndsWith(n, 22 /* CloseParenToken */, sourceFile); + case 183 /* FunctionType */: + case 184 /* ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 177 /* ConstructSignature */: - case 176 /* CallSignature */: - case 216 /* ArrowFunction */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 179 /* ConstructSignature */: + case 178 /* CallSignature */: + case 218 /* ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } if (n.type) { return isCompletedNode(n.type, sourceFile); } - return hasChildOfKind(n, 21 /* CloseParenToken */, sourceFile); - case 264 /* ModuleDeclaration */: + return hasChildOfKind(n, 22 /* CloseParenToken */, sourceFile); + case 266 /* ModuleDeclaration */: return !!n.body && isCompletedNode(n.body, sourceFile); - case 242 /* IfStatement */: + case 244 /* IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 241 /* ExpressionStatement */: - return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 26 /* SemicolonToken */, sourceFile); - case 206 /* ArrayLiteralExpression */: - case 204 /* ArrayBindingPattern */: - case 209 /* ElementAccessExpression */: - case 164 /* ComputedPropertyName */: - case 186 /* TupleType */: - return nodeEndsWith(n, 23 /* CloseBracketToken */, sourceFile); - case 178 /* IndexSignature */: + case 243 /* ExpressionStatement */: + return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 27 /* SemicolonToken */, sourceFile); + case 208 /* ArrayLiteralExpression */: + case 206 /* ArrayBindingPattern */: + case 211 /* ElementAccessExpression */: + case 166 /* ComputedPropertyName */: + case 188 /* TupleType */: + return nodeEndsWith(n, 24 /* CloseBracketToken */, sourceFile); + case 180 /* IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } - return hasChildOfKind(n, 23 /* CloseBracketToken */, sourceFile); - case 292 /* CaseClause */: - case 293 /* DefaultClause */: + return hasChildOfKind(n, 24 /* CloseBracketToken */, sourceFile); + case 295 /* CaseClause */: + case 296 /* DefaultClause */: return false; - case 245 /* ForStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: - case 244 /* WhileStatement */: + case 247 /* ForStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 246 /* WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 243 /* DoStatement */: - return hasChildOfKind(n, 115 /* WhileKeyword */, sourceFile) ? nodeEndsWith(n, 21 /* CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); - case 183 /* TypeQuery */: + case 245 /* DoStatement */: + return hasChildOfKind(n, 117 /* WhileKeyword */, sourceFile) ? nodeEndsWith(n, 22 /* CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); + case 185 /* TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 218 /* TypeOfExpression */: - case 217 /* DeleteExpression */: - case 219 /* VoidExpression */: - case 226 /* YieldExpression */: - case 227 /* SpreadElement */: + case 220 /* TypeOfExpression */: + case 219 /* DeleteExpression */: + case 221 /* VoidExpression */: + case 228 /* YieldExpression */: + case 229 /* SpreadElement */: const unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 212 /* TaggedTemplateExpression */: + case 214 /* TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 225 /* TemplateExpression */: + case 227 /* TemplateExpression */: const lastSpan = lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 236 /* TemplateSpan */: + case 238 /* TemplateSpan */: return nodeIsPresent(n.literal); - case 275 /* ExportDeclaration */: - case 269 /* ImportDeclaration */: + case 277 /* ExportDeclaration */: + case 271 /* ImportDeclaration */: return nodeIsPresent(n.moduleSpecifier); - case 221 /* PrefixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 224 /* ConditionalExpression */: + case 226 /* ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -126654,7 +127685,7 @@ ${lanes.join("\n")} const lastChild = last(children); if (lastChild.kind === expectedLastToken) { return true; - } else if (lastChild.kind === 26 /* SemicolonToken */ && children.length !== 1) { + } else if (lastChild.kind === 27 /* SemicolonToken */ && children.length !== 1) { return children[children.length - 2].kind === expectedLastToken; } } @@ -126684,13 +127715,13 @@ ${lanes.join("\n")} return syntaxList; } function isDefaultModifier2(node) { - return node.kind === 88 /* DefaultKeyword */; + return node.kind === 90 /* DefaultKeyword */; } function isClassKeyword(node) { - return node.kind === 84 /* ClassKeyword */; + return node.kind === 86 /* ClassKeyword */; } function isFunctionKeyword(node) { - return node.kind === 98 /* FunctionKeyword */; + return node.kind === 100 /* FunctionKeyword */; } function getAdjustedLocationForClass(node) { if (isNamedDeclaration(node)) { @@ -126744,13 +127775,13 @@ ${lanes.join("\n")} function getAdjustedLocationForDeclaration(node, forRename) { if (!forRename) { switch (node.kind) { - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: return getAdjustedLocationForClass(node); - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: return getAdjustedLocationForFunction(node); - case 173 /* Constructor */: + case 175 /* Constructor */: return node; } } @@ -126805,19 +127836,19 @@ ${lanes.join("\n")} } function getAdjustedLocation(node, forRename) { const { parent: parent2 } = node; - if (isModifier(node) && (forRename || node.kind !== 88 /* DefaultKeyword */) ? canHaveModifiers(parent2) && contains(parent2.modifiers, node) : node.kind === 84 /* ClassKeyword */ ? isClassDeclaration(parent2) || isClassExpression(node) : node.kind === 98 /* FunctionKeyword */ ? isFunctionDeclaration(parent2) || isFunctionExpression(node) : node.kind === 118 /* InterfaceKeyword */ ? isInterfaceDeclaration(parent2) : node.kind === 92 /* EnumKeyword */ ? isEnumDeclaration(parent2) : node.kind === 154 /* TypeKeyword */ ? isTypeAliasDeclaration(parent2) : node.kind === 143 /* NamespaceKeyword */ || node.kind === 142 /* ModuleKeyword */ ? isModuleDeclaration(parent2) : node.kind === 100 /* ImportKeyword */ ? isImportEqualsDeclaration(parent2) : node.kind === 137 /* GetKeyword */ ? isGetAccessorDeclaration(parent2) : node.kind === 151 /* SetKeyword */ && isSetAccessorDeclaration(parent2)) { + if (isModifier(node) && (forRename || node.kind !== 90 /* DefaultKeyword */) ? canHaveModifiers(parent2) && contains(parent2.modifiers, node) : node.kind === 86 /* ClassKeyword */ ? isClassDeclaration(parent2) || isClassExpression(node) : node.kind === 100 /* FunctionKeyword */ ? isFunctionDeclaration(parent2) || isFunctionExpression(node) : node.kind === 120 /* InterfaceKeyword */ ? isInterfaceDeclaration(parent2) : node.kind === 94 /* EnumKeyword */ ? isEnumDeclaration(parent2) : node.kind === 156 /* TypeKeyword */ ? isTypeAliasDeclaration(parent2) : node.kind === 145 /* NamespaceKeyword */ || node.kind === 144 /* ModuleKeyword */ ? isModuleDeclaration(parent2) : node.kind === 102 /* ImportKeyword */ ? isImportEqualsDeclaration(parent2) : node.kind === 139 /* GetKeyword */ ? isGetAccessorDeclaration(parent2) : node.kind === 153 /* SetKeyword */ && isSetAccessorDeclaration(parent2)) { const location = getAdjustedLocationForDeclaration(parent2, forRename); if (location) { return location; } } - if ((node.kind === 113 /* VarKeyword */ || node.kind === 85 /* ConstKeyword */ || node.kind === 119 /* LetKeyword */) && isVariableDeclarationList(parent2) && parent2.declarations.length === 1) { + if ((node.kind === 115 /* VarKeyword */ || node.kind === 87 /* ConstKeyword */ || node.kind === 121 /* LetKeyword */) && isVariableDeclarationList(parent2) && parent2.declarations.length === 1) { const decl = parent2.declarations[0]; if (isIdentifier(decl.name)) { return decl.name; } } - if (node.kind === 154 /* TypeKeyword */) { + if (node.kind === 156 /* TypeKeyword */) { if (isImportClause(parent2) && parent2.isTypeOnly) { const location = getAdjustedLocationForImportDeclaration(parent2.parent, forRename); if (location) { @@ -126831,7 +127862,7 @@ ${lanes.join("\n")} } } } - if (node.kind === 128 /* AsKeyword */) { + if (node.kind === 130 /* AsKeyword */) { if (isImportSpecifier(parent2) && parent2.propertyName || isExportSpecifier(parent2) && parent2.propertyName || isNamespaceImport(parent2) || isNamespaceExport(parent2)) { return parent2.name; } @@ -126839,13 +127870,13 @@ ${lanes.join("\n")} return parent2.exportClause.name; } } - if (node.kind === 100 /* ImportKeyword */ && isImportDeclaration(parent2)) { + if (node.kind === 102 /* ImportKeyword */ && isImportDeclaration(parent2)) { const location = getAdjustedLocationForImportDeclaration(parent2, forRename); if (location) { return location; } } - if (node.kind === 93 /* ExportKeyword */) { + if (node.kind === 95 /* ExportKeyword */) { if (isExportDeclaration(parent2)) { const location = getAdjustedLocationForExportDeclaration(parent2, forRename); if (location) { @@ -126856,19 +127887,19 @@ ${lanes.join("\n")} return skipOuterExpressions(parent2.expression); } } - if (node.kind === 147 /* RequireKeyword */ && isExternalModuleReference(parent2)) { + if (node.kind === 149 /* RequireKeyword */ && isExternalModuleReference(parent2)) { return parent2.expression; } - if (node.kind === 158 /* FromKeyword */ && (isImportDeclaration(parent2) || isExportDeclaration(parent2)) && parent2.moduleSpecifier) { + if (node.kind === 160 /* FromKeyword */ && (isImportDeclaration(parent2) || isExportDeclaration(parent2)) && parent2.moduleSpecifier) { return parent2.moduleSpecifier; } - if ((node.kind === 94 /* ExtendsKeyword */ || node.kind === 117 /* ImplementsKeyword */) && isHeritageClause(parent2) && parent2.token === node.kind) { + if ((node.kind === 96 /* ExtendsKeyword */ || node.kind === 119 /* ImplementsKeyword */) && isHeritageClause(parent2) && parent2.token === node.kind) { const location = getAdjustedLocationForHeritageClause(parent2); if (location) { return location; } } - if (node.kind === 94 /* ExtendsKeyword */) { + if (node.kind === 96 /* ExtendsKeyword */) { if (isTypeParameterDeclaration(parent2) && parent2.constraint && isTypeReferenceNode(parent2.constraint)) { return parent2.constraint.typeName; } @@ -126876,31 +127907,31 @@ ${lanes.join("\n")} return parent2.extendsType.typeName; } } - if (node.kind === 138 /* InferKeyword */ && isInferTypeNode(parent2)) { + if (node.kind === 140 /* InferKeyword */ && isInferTypeNode(parent2)) { return parent2.typeParameter.name; } - if (node.kind === 101 /* InKeyword */ && isTypeParameterDeclaration(parent2) && isMappedTypeNode(parent2.parent)) { + if (node.kind === 103 /* InKeyword */ && isTypeParameterDeclaration(parent2) && isMappedTypeNode(parent2.parent)) { return parent2.name; } - if (node.kind === 141 /* KeyOfKeyword */ && isTypeOperatorNode(parent2) && parent2.operator === 141 /* KeyOfKeyword */ && isTypeReferenceNode(parent2.type)) { + if (node.kind === 143 /* KeyOfKeyword */ && isTypeOperatorNode(parent2) && parent2.operator === 143 /* KeyOfKeyword */ && isTypeReferenceNode(parent2.type)) { return parent2.type.typeName; } - if (node.kind === 146 /* ReadonlyKeyword */ && isTypeOperatorNode(parent2) && parent2.operator === 146 /* ReadonlyKeyword */ && isArrayTypeNode(parent2.type) && isTypeReferenceNode(parent2.type.elementType)) { + if (node.kind === 148 /* ReadonlyKeyword */ && isTypeOperatorNode(parent2) && parent2.operator === 148 /* ReadonlyKeyword */ && isArrayTypeNode(parent2.type) && isTypeReferenceNode(parent2.type.elementType)) { return parent2.type.elementType.typeName; } if (!forRename) { - if (node.kind === 103 /* NewKeyword */ && isNewExpression(parent2) || node.kind === 114 /* VoidKeyword */ && isVoidExpression(parent2) || node.kind === 112 /* TypeOfKeyword */ && isTypeOfExpression(parent2) || node.kind === 133 /* AwaitKeyword */ && isAwaitExpression(parent2) || node.kind === 125 /* YieldKeyword */ && isYieldExpression(parent2) || node.kind === 89 /* DeleteKeyword */ && isDeleteExpression(parent2)) { + if (node.kind === 105 /* NewKeyword */ && isNewExpression(parent2) || node.kind === 116 /* VoidKeyword */ && isVoidExpression(parent2) || node.kind === 114 /* TypeOfKeyword */ && isTypeOfExpression(parent2) || node.kind === 135 /* AwaitKeyword */ && isAwaitExpression(parent2) || node.kind === 127 /* YieldKeyword */ && isYieldExpression(parent2) || node.kind === 91 /* DeleteKeyword */ && isDeleteExpression(parent2)) { if (parent2.expression) { return skipOuterExpressions(parent2.expression); } } - if ((node.kind === 101 /* InKeyword */ || node.kind === 102 /* InstanceOfKeyword */) && isBinaryExpression(parent2) && parent2.operatorToken === node) { + if ((node.kind === 103 /* InKeyword */ || node.kind === 104 /* InstanceOfKeyword */) && isBinaryExpression(parent2) && parent2.operatorToken === node) { return skipOuterExpressions(parent2.right); } - if (node.kind === 128 /* AsKeyword */ && isAsExpression(parent2) && isTypeReferenceNode(parent2.type)) { + if (node.kind === 130 /* AsKeyword */ && isAsExpression(parent2) && isTypeReferenceNode(parent2.type)) { return parent2.type.typeName; } - if (node.kind === 101 /* InKeyword */ && isForInStatement(parent2) || node.kind === 162 /* OfKeyword */ && isForOfStatement(parent2)) { + if (node.kind === 103 /* InKeyword */ && isForInStatement(parent2) || node.kind === 164 /* OfKeyword */ && isForOfStatement(parent2)) { return skipOuterExpressions(parent2.expression); } } @@ -126959,7 +127990,7 @@ ${lanes.join("\n")} } const start = allowPositionInLeadingTrivia ? children[middle].getFullStart() : children[middle].getStart( sourceFile, - /*includeJsDoc*/ + /*includeJsDocComment*/ true ); if (start > position) { @@ -126988,15 +128019,15 @@ ${lanes.join("\n")} return current; } function nodeContainsPosition(node, start, end) { - end != null ? end : end = node.getEnd(); + end ?? (end = node.getEnd()); if (end < position) { return false; } - start != null ? start : start = allowPositionInLeadingTrivia ? node.getFullStart() : node.getStart( + start ?? (start = allowPositionInLeadingTrivia ? node.getFullStart() : node.getStart( sourceFile, - /*includeJsDoc*/ + /*includeJsDocComment*/ true - ); + )); if (start > position) { return false; } @@ -127081,13 +128112,19 @@ ${lanes.join("\n")} sourceFile, n.kind ); - return candidate2 && findRightmostToken(candidate2, sourceFile); + if (candidate2) { + if (!excludeJsdoc && isJSDocCommentContainingNode(candidate2) && candidate2.getChildren(sourceFile).length) { + return find2(candidate2); + } + return findRightmostToken(candidate2, sourceFile); + } + return void 0; } else { return find2(child); } } } - Debug.assert(startNode2 !== void 0 || n.kind === 308 /* SourceFile */ || n.kind === 1 /* EndOfFileToken */ || isJSDocCommentContainingNode(n)); + Debug.assert(startNode2 !== void 0 || n.kind === 311 /* SourceFile */ || n.kind === 1 /* EndOfFileToken */ || isJSDocCommentContainingNode(n)); const candidate = findRightmostChildNodeWithTokens( children, /*exclusiveStartPosition*/ @@ -127122,7 +128159,7 @@ ${lanes.join("\n")} for (let i = exclusiveStartPosition - 1; i >= 0; i--) { const child = children[i]; if (isWhiteSpaceOnlyJsxText(child)) { - if (i === 0 && (parentKind === 11 /* JsxText */ || parentKind === 282 /* JsxSelfClosingElement */)) { + if (i === 0 && (parentKind === 12 /* JsxText */ || parentKind === 284 /* JsxSelfClosingElement */)) { Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`"); } } else if (nodeHasTokens(children[i], sourceFile)) { @@ -127148,19 +128185,19 @@ ${lanes.join("\n")} if (!token) { return false; } - if (token.kind === 11 /* JsxText */) { + if (token.kind === 12 /* JsxText */) { return true; } - if (token.kind === 29 /* LessThanToken */ && token.parent.kind === 11 /* JsxText */) { + if (token.kind === 30 /* LessThanToken */ && token.parent.kind === 12 /* JsxText */) { return true; } - if (token.kind === 29 /* LessThanToken */ && token.parent.kind === 291 /* JsxExpression */) { + if (token.kind === 30 /* LessThanToken */ && token.parent.kind === 293 /* JsxExpression */) { return true; } - if (token && token.kind === 19 /* CloseBraceToken */ && token.parent.kind === 291 /* JsxExpression */) { + if (token && token.kind === 20 /* CloseBraceToken */ && token.parent.kind === 293 /* JsxExpression */) { return true; } - if (token.kind === 29 /* LessThanToken */ && token.parent.kind === 284 /* JsxClosingElement */) { + if (token.kind === 30 /* LessThanToken */ && token.parent.kind === 286 /* JsxClosingElement */) { return true; } return false; @@ -127177,10 +128214,10 @@ ${lanes.join("\n")} if (isJsxText(token)) { return true; } - if (token.kind === 18 /* OpenBraceToken */ && isJsxExpression(token.parent) && isJsxElement(token.parent.parent)) { + if (token.kind === 19 /* OpenBraceToken */ && isJsxExpression(token.parent) && isJsxElement(token.parent.parent)) { return true; } - if (token.kind === 29 /* LessThanToken */ && isJsxOpeningLikeElement(token.parent) && isJsxElement(token.parent.parent)) { + if (token.kind === 30 /* LessThanToken */ && isJsxOpeningLikeElement(token.parent) && isJsxElement(token.parent.parent)) { return true; } return false; @@ -127188,9 +128225,9 @@ ${lanes.join("\n")} function isInsideJsxElement(sourceFile, position) { function isInsideJsxElementTraversal(node) { while (node) { - if (node.kind >= 282 /* JsxSelfClosingElement */ && node.kind <= 291 /* JsxExpression */ || node.kind === 11 /* JsxText */ || node.kind === 29 /* LessThanToken */ || node.kind === 31 /* GreaterThanToken */ || node.kind === 79 /* Identifier */ || node.kind === 19 /* CloseBraceToken */ || node.kind === 18 /* OpenBraceToken */ || node.kind === 43 /* SlashToken */) { + if (node.kind >= 284 /* JsxSelfClosingElement */ && node.kind <= 293 /* JsxExpression */ || node.kind === 12 /* JsxText */ || node.kind === 30 /* LessThanToken */ || node.kind === 32 /* GreaterThanToken */ || node.kind === 80 /* Identifier */ || node.kind === 20 /* CloseBraceToken */ || node.kind === 19 /* OpenBraceToken */ || node.kind === 44 /* SlashToken */) { node = node.parent; - } else if (node.kind === 281 /* JsxElement */) { + } else if (node.kind === 283 /* JsxElement */) { if (position > node.getStart(sourceFile)) return true; node = node.parent; @@ -127263,9 +128300,9 @@ ${lanes.join("\n")} let nTypeArguments = 0; while (token) { switch (token.kind) { - case 29 /* LessThanToken */: + case 30 /* LessThanToken */: token = findPrecedingToken(token.getFullStart(), sourceFile); - if (token && token.kind === 28 /* QuestionDotToken */) { + if (token && token.kind === 29 /* QuestionDotToken */) { token = findPrecedingToken(token.getFullStart(), sourceFile); } if (!token || !isIdentifier(token)) @@ -127275,47 +128312,47 @@ ${lanes.join("\n")} } remainingLessThanTokens--; break; - case 49 /* GreaterThanGreaterThanGreaterThanToken */: + case 50 /* GreaterThanGreaterThanGreaterThanToken */: remainingLessThanTokens = 3; break; - case 48 /* GreaterThanGreaterThanToken */: + case 49 /* GreaterThanGreaterThanToken */: remainingLessThanTokens = 2; break; - case 31 /* GreaterThanToken */: + case 32 /* GreaterThanToken */: remainingLessThanTokens++; break; - case 19 /* CloseBraceToken */: - token = findPrecedingMatchingToken(token, 18 /* OpenBraceToken */, sourceFile); + case 20 /* CloseBraceToken */: + token = findPrecedingMatchingToken(token, 19 /* OpenBraceToken */, sourceFile); if (!token) return void 0; break; - case 21 /* CloseParenToken */: - token = findPrecedingMatchingToken(token, 20 /* OpenParenToken */, sourceFile); + case 22 /* CloseParenToken */: + token = findPrecedingMatchingToken(token, 21 /* OpenParenToken */, sourceFile); if (!token) return void 0; break; - case 23 /* CloseBracketToken */: - token = findPrecedingMatchingToken(token, 22 /* OpenBracketToken */, sourceFile); + case 24 /* CloseBracketToken */: + token = findPrecedingMatchingToken(token, 23 /* OpenBracketToken */, sourceFile); if (!token) return void 0; break; - case 27 /* CommaToken */: + case 28 /* CommaToken */: nTypeArguments++; break; - case 38 /* EqualsGreaterThanToken */: - case 79 /* Identifier */: - case 10 /* StringLiteral */: - case 8 /* NumericLiteral */: - case 9 /* BigIntLiteral */: - case 110 /* TrueKeyword */: - case 95 /* FalseKeyword */: - case 112 /* TypeOfKeyword */: - case 94 /* ExtendsKeyword */: - case 141 /* KeyOfKeyword */: - case 24 /* DotToken */: - case 51 /* BarToken */: - case 57 /* QuestionToken */: - case 58 /* ColonToken */: + case 39 /* EqualsGreaterThanToken */: + case 80 /* Identifier */: + case 11 /* StringLiteral */: + case 9 /* NumericLiteral */: + case 10 /* BigIntLiteral */: + case 112 /* TrueKeyword */: + case 97 /* FalseKeyword */: + case 114 /* TypeOfKeyword */: + case 96 /* ExtendsKeyword */: + case 143 /* KeyOfKeyword */: + case 25 /* DotToken */: + case 52 /* BarToken */: + case 58 /* QuestionToken */: + case 59 /* ColonToken */: break; default: if (isTypeNode(token)) { @@ -127362,15 +128399,15 @@ ${lanes.join("\n")} result.push("deprecated" /* deprecatedModifier */); if (node.flags & 16777216 /* Ambient */) result.push("declare" /* ambientModifier */); - if (node.kind === 274 /* ExportAssignment */) + if (node.kind === 276 /* ExportAssignment */) result.push("export" /* exportedModifier */); return result.length > 0 ? result.join(",") : "" /* none */; } function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 180 /* TypeReference */ || node.kind === 210 /* CallExpression */) { + if (node.kind === 182 /* TypeReference */ || node.kind === 212 /* CallExpression */) { return node.typeArguments; } - if (isFunctionLike(node) || node.kind === 260 /* ClassDeclaration */ || node.kind === 261 /* InterfaceDeclaration */) { + if (isFunctionLike(node) || node.kind === 262 /* ClassDeclaration */ || node.kind === 263 /* InterfaceDeclaration */) { return node.typeParameters; } return void 0; @@ -127379,29 +128416,29 @@ ${lanes.join("\n")} return kind === 2 /* SingleLineCommentTrivia */ || kind === 3 /* MultiLineCommentTrivia */; } function isStringOrRegularExpressionOrTemplateLiteral(kind) { - if (kind === 10 /* StringLiteral */ || kind === 13 /* RegularExpressionLiteral */ || isTemplateLiteralKind(kind)) { + if (kind === 11 /* StringLiteral */ || kind === 14 /* RegularExpressionLiteral */ || isTemplateLiteralKind(kind)) { return true; } return false; } + function areIntersectedTypesAvoidingStringReduction(checker, t1, t2) { + return !!(t1.flags & 4 /* String */) && checker.isEmptyAnonymousObjectType(t2); + } function isStringAndEmptyAnonymousObjectIntersection(type) { if (!type.isIntersection()) { return false; } const { types, checker } = type; - return types.length === 2 && types[0].flags & 4 /* String */ && checker.isEmptyAnonymousObjectType(types[1]); - } - function isPunctuation(kind) { - return 18 /* FirstPunctuation */ <= kind && kind <= 78 /* LastPunctuation */; + return types.length === 2 && (areIntersectedTypesAvoidingStringReduction(checker, types[0], types[1]) || areIntersectedTypesAvoidingStringReduction(checker, types[1], types[0])); } function isInsideTemplateLiteral(node, position, sourceFile) { return isTemplateLiteralKind(node.kind) && (node.getStart(sourceFile) < position && position < node.end) || !!node.isUnterminated && position === node.end; } function isAccessibilityModifier(kind) { switch (kind) { - case 123 /* PublicKeyword */: - case 121 /* PrivateKeyword */: - case 122 /* ProtectedKeyword */: + case 125 /* PublicKeyword */: + case 123 /* PrivateKeyword */: + case 124 /* ProtectedKeyword */: return true; } return false; @@ -127412,14 +128449,14 @@ ${lanes.join("\n")} return result; } function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 206 /* ArrayLiteralExpression */ || node.kind === 207 /* ObjectLiteralExpression */) { - if (node.parent.kind === 223 /* BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 63 /* EqualsToken */) { + if (node.kind === 208 /* ArrayLiteralExpression */ || node.kind === 209 /* ObjectLiteralExpression */) { + if (node.parent.kind === 225 /* BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 64 /* EqualsToken */) { return true; } - if (node.parent.kind === 247 /* ForOfStatement */ && node.parent.initializer === node) { + if (node.parent.kind === 249 /* ForOfStatement */ && node.parent.initializer === node) { return true; } - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 299 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 302 /* PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -127454,8 +128491,8 @@ ${lanes.join("\n")} if (!contextToken) return void 0; switch (contextToken.kind) { - case 10 /* StringLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: + case 11 /* StringLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: return createTextSpanFromStringLiteralLikeContent(contextToken); default: return createTextSpanFromNode(contextToken); @@ -127488,7 +128525,7 @@ ${lanes.join("\n")} return contains(typeKeywords, kind); } function isTypeKeywordToken(node) { - return node.kind === 154 /* TypeKeyword */; + return node.kind === 156 /* TypeKeyword */; } function isTypeKeywordTokenOrIdentifier(node) { return isTypeKeywordToken(node) || isIdentifier(node) && node.text === "type"; @@ -127517,7 +128554,7 @@ ${lanes.join("\n")} return type.isTypeParameter() ? type.getConstraint() || type : type; } function getNameFromPropertyName(name) { - return name.kind === 164 /* ComputedPropertyName */ ? isStringOrNumericLiteralLike(name.expression) ? name.expression.text : void 0 : isPrivateIdentifier(name) ? idText(name) : getTextOfIdentifierOrLiteral(name); + return name.kind === 166 /* ComputedPropertyName */ ? isStringOrNumericLiteralLike(name.expression) ? name.expression.text : void 0 : isPrivateIdentifier(name) ? idText(name) : getTextOfIdentifierOrLiteral(name); } function programContainsModules(program) { return program.getSourceFiles().some((s) => !s.isDeclarationFile && !program.isSourceFileFromExternalLibrary(s) && !!(s.externalModuleIndicator || s.commonJsModuleIndicator)); @@ -127537,8 +128574,8 @@ ${lanes.join("\n")} getSymlinkCache: maybeBind(host, host.getSymlinkCache) || program.getSymlinkCache, getModuleSpecifierCache: maybeBind(host, host.getModuleSpecifierCache), getPackageJsonInfoCache: () => { - var _a2; - return (_a2 = program.getModuleResolutionCache()) == null ? void 0 : _a2.getPackageJsonInfoCache(); + var _a; + return (_a = program.getModuleResolutionCache()) == null ? void 0 : _a.getPackageJsonInfoCache(); }, getGlobalTypingsCacheLocation: maybeBind(host, host.getGlobalTypingsCacheLocation), redirectTargetsMap: program.redirectTargetsMap, @@ -127604,7 +128641,7 @@ ${lanes.join("\n")} } return firstDefined(symbol.declarations, (decl) => { const name = getNameOfDeclaration(decl); - return name && name.kind === 79 /* Identifier */ ? name.escapedText : void 0; + return name && name.kind === 80 /* Identifier */ ? name.escapedText : void 0; }); } function isModuleSpecifierLike(node) { @@ -127639,7 +128676,7 @@ ${lanes.join("\n")} } function insertImports(changes, sourceFile, imports, blankLineBetween, preferences) { const decl = isArray(imports) ? imports[0] : imports; - const importKindPredicate = decl.kind === 240 /* VariableStatement */ ? isRequireVariableStatement : isAnyImportSyntax; + const importKindPredicate = decl.kind === 242 /* VariableStatement */ ? isRequireVariableStatement : isAnyImportSyntax; const existingImportStatements = filter(sourceFile.statements, importKindPredicate); let sortKind = isArray(imports) ? ts_OrganizeImports_exports.detectImportDeclarationSorting(imports, preferences) : 3 /* Both */; const comparer = ts_OrganizeImports_exports.getOrganizeImportsComparer(preferences, sortKind === 2 /* CaseInsensitive */); @@ -127921,7 +128958,7 @@ ${lanes.join("\n")} return displayPart(text, 22 /* link */); } function buildLinkParts(link, checker) { - var _a2; + var _a; const prefix = isJSDocLink(link) ? "link" : isJSDocLinkCode(link) ? "linkcode" : "linkplain"; const parts = [linkPart(`{@${prefix} `)]; if (!link.name) { @@ -127933,7 +128970,7 @@ ${lanes.join("\n")} const suffix = findLinkNameEnd(link.text); const name = getTextOfNode(link.name) + link.text.slice(0, suffix); const text = skipSeparatorFromLinkText(link.text.slice(suffix)); - const decl = (symbol == null ? void 0 : symbol.valueDeclaration) || ((_a2 = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _a2[0]); + const decl = (symbol == null ? void 0 : symbol.valueDeclaration) || ((_a = symbol == null ? void 0 : symbol.declarations) == null ? void 0 : _a[0]); if (decl) { parts.push(linkNamePart(name, decl)); if (text) @@ -127979,8 +129016,8 @@ ${lanes.join("\n")} return 0; } function getNewLineOrDefaultFromHost(host, formatSettings) { - var _a2; - return (formatSettings == null ? void 0 : formatSettings.newLineCharacter) || ((_a2 = host.getNewLine) == null ? void 0 : _a2.call(host)) || lineFeed2; + var _a; + return (formatSettings == null ? void 0 : formatSettings.newLineCharacter) || ((_a = host.getNewLine) == null ? void 0 : _a.call(host)) || lineFeed2; } function lineBreakPart() { return displayPart("\n", 6 /* lineBreak */); @@ -128010,7 +129047,7 @@ ${lanes.join("\n")} signature, enclosingDeclaration, flags, - /*signatureKind*/ + /*kind*/ void 0, writer ); @@ -128097,7 +129134,12 @@ ${lanes.join("\n")} return visited; } function getSynthesizedDeepClones(nodes, includeTrivia = true) { - return nodes && factory.createNodeArray(nodes.map((n) => getSynthesizedDeepClone(n, includeTrivia)), nodes.hasTrailingComma); + if (nodes) { + const cloned = factory.createNodeArray(nodes.map((n) => getSynthesizedDeepClone(n, includeTrivia)), nodes.hasTrailingComma); + setTextRange(cloned, nodes); + return cloned; + } + return nodes; } function getSynthesizedDeepClonesWithReplacements(nodes, includeTrivia, replaceNode) { return factory.createNodeArray(nodes.map((n) => getSynthesizedDeepCloneWithReplacements(n, includeTrivia, replaceNode)), nodes.hasTrailingComma); @@ -128199,18 +129241,18 @@ ${lanes.join("\n")} return idx === -1 ? -1 : idx + 1; } function needsParentheses(expression) { - return isBinaryExpression(expression) && expression.operatorToken.kind === 27 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression); + return isBinaryExpression(expression) && expression.operatorToken.kind === 28 /* CommaToken */ || isObjectLiteralExpression(expression) || isAsExpression(expression) && isObjectLiteralExpression(expression.expression); } function getContextualTypeFromParent(node, checker, contextFlags) { const parent2 = walkUpParenthesizedExpressions(node.parent); switch (parent2.kind) { - case 211 /* NewExpression */: + case 213 /* NewExpression */: return checker.getContextualType(parent2, contextFlags); - case 223 /* BinaryExpression */: { + case 225 /* BinaryExpression */: { const { left, operatorToken, right } = parent2; return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node, contextFlags); } - case 292 /* CaseClause */: + case 295 /* CaseClause */: return getSwitchedType(parent2, checker); default: return checker.getContextualType(node, contextFlags); @@ -128223,10 +129265,10 @@ ${lanes.join("\n")} } function isEqualityOperatorKind(kind) { switch (kind) { - case 36 /* EqualsEqualsEqualsToken */: - case 34 /* EqualsEqualsToken */: - case 37 /* ExclamationEqualsEqualsToken */: - case 35 /* ExclamationEqualsToken */: + case 37 /* EqualsEqualsEqualsToken */: + case 35 /* EqualsEqualsToken */: + case 38 /* ExclamationEqualsEqualsToken */: + case 36 /* ExclamationEqualsToken */: return true; default: return false; @@ -128234,10 +129276,10 @@ ${lanes.join("\n")} } function isStringLiteralOrTemplate(node) { switch (node.kind) { - case 10 /* StringLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 225 /* TemplateExpression */: - case 212 /* TaggedTemplateExpression */: + case 11 /* StringLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 227 /* TemplateExpression */: + case 214 /* TaggedTemplateExpression */: return true; default: return false; @@ -128272,24 +129314,24 @@ ${lanes.join("\n")} return typeIsAccessible ? res : void 0; } function syntaxRequiresTrailingCommaOrSemicolonOrASI(kind) { - return kind === 176 /* CallSignature */ || kind === 177 /* ConstructSignature */ || kind === 178 /* IndexSignature */ || kind === 168 /* PropertySignature */ || kind === 170 /* MethodSignature */; + return kind === 178 /* CallSignature */ || kind === 179 /* ConstructSignature */ || kind === 180 /* IndexSignature */ || kind === 170 /* PropertySignature */ || kind === 172 /* MethodSignature */; } function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) { - return kind === 259 /* FunctionDeclaration */ || kind === 173 /* Constructor */ || kind === 171 /* MethodDeclaration */ || kind === 174 /* GetAccessor */ || kind === 175 /* SetAccessor */; + return kind === 261 /* FunctionDeclaration */ || kind === 175 /* Constructor */ || kind === 173 /* MethodDeclaration */ || kind === 176 /* GetAccessor */ || kind === 177 /* SetAccessor */; } function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) { - return kind === 264 /* ModuleDeclaration */; + return kind === 266 /* ModuleDeclaration */; } function syntaxRequiresTrailingSemicolonOrASI(kind) { - return kind === 240 /* VariableStatement */ || kind === 241 /* ExpressionStatement */ || kind === 243 /* DoStatement */ || kind === 248 /* ContinueStatement */ || kind === 249 /* BreakStatement */ || kind === 250 /* ReturnStatement */ || kind === 254 /* ThrowStatement */ || kind === 256 /* DebuggerStatement */ || kind === 169 /* PropertyDeclaration */ || kind === 262 /* TypeAliasDeclaration */ || kind === 269 /* ImportDeclaration */ || kind === 268 /* ImportEqualsDeclaration */ || kind === 275 /* ExportDeclaration */ || kind === 267 /* NamespaceExportDeclaration */ || kind === 274 /* ExportAssignment */; + return kind === 242 /* VariableStatement */ || kind === 243 /* ExpressionStatement */ || kind === 245 /* DoStatement */ || kind === 250 /* ContinueStatement */ || kind === 251 /* BreakStatement */ || kind === 252 /* ReturnStatement */ || kind === 256 /* ThrowStatement */ || kind === 258 /* DebuggerStatement */ || kind === 171 /* PropertyDeclaration */ || kind === 264 /* TypeAliasDeclaration */ || kind === 271 /* ImportDeclaration */ || kind === 270 /* ImportEqualsDeclaration */ || kind === 277 /* ExportDeclaration */ || kind === 269 /* NamespaceExportDeclaration */ || kind === 276 /* ExportAssignment */; } function nodeIsASICandidate(node, sourceFile) { const lastToken = node.getLastToken(sourceFile); - if (lastToken && lastToken.kind === 26 /* SemicolonToken */) { + if (lastToken && lastToken.kind === 27 /* SemicolonToken */) { return false; } if (syntaxRequiresTrailingCommaOrSemicolonOrASI(node.kind)) { - if (lastToken && lastToken.kind === 27 /* CommaToken */) { + if (lastToken && lastToken.kind === 28 /* CommaToken */) { return false; } } else if (syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(node.kind)) { @@ -128305,12 +129347,12 @@ ${lanes.join("\n")} } else if (!syntaxRequiresTrailingSemicolonOrASI(node.kind)) { return false; } - if (node.kind === 243 /* DoStatement */) { + if (node.kind === 245 /* DoStatement */) { return true; } const topNode = findAncestor(node, (ancestor) => !ancestor.parent); const nextToken = findNextToken(node, topNode, sourceFile); - if (!nextToken || nextToken.kind === 19 /* CloseBraceToken */) { + if (!nextToken || nextToken.kind === 20 /* CloseBraceToken */) { return true; } const startLine = sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line; @@ -128333,16 +129375,16 @@ ${lanes.join("\n")} forEachChild(sourceFile, function visit(node) { if (syntaxRequiresTrailingSemicolonOrASI(node.kind)) { const lastToken = node.getLastToken(sourceFile); - if ((lastToken == null ? void 0 : lastToken.kind) === 26 /* SemicolonToken */) { + if ((lastToken == null ? void 0 : lastToken.kind) === 27 /* SemicolonToken */) { withSemicolon++; } else { withoutSemicolon++; } } else if (syntaxRequiresTrailingCommaOrSemicolonOrASI(node.kind)) { const lastToken = node.getLastToken(sourceFile); - if ((lastToken == null ? void 0 : lastToken.kind) === 26 /* SemicolonToken */) { + if ((lastToken == null ? void 0 : lastToken.kind) === 27 /* SemicolonToken */) { withSemicolon++; - } else if (lastToken && lastToken.kind !== 27 /* CommaToken */) { + } else if (lastToken && lastToken.kind !== 28 /* CommaToken */) { const lastTokenLine = getLineAndCharacterOfPosition(sourceFile, lastToken.getStart(sourceFile)).line; const nextTokenLine = getLineAndCharacterOfPosition(sourceFile, getSpanOfTokenAtPosition(sourceFile, lastToken.end).start).line; if (lastTokenLine !== nextTokenLine) { @@ -128375,7 +129417,7 @@ ${lanes.join("\n")} function tryAndIgnoreErrors(cb) { try { return cb(); - } catch (e) { + } catch { return void 0; } } @@ -128586,7 +129628,7 @@ ${lanes.join("\n")} function tryParseJson(text) { try { return JSON.parse(text); - } catch (e) { + } catch { return void 0; } } @@ -128609,12 +129651,12 @@ ${lanes.join("\n")} } } function getDiagnosticsWithinSpan(span, sortedFileDiagnostics) { - var _a2; + var _a; let index = binarySearchKey(sortedFileDiagnostics, span.start, (diag2) => diag2.start, compareValues); if (index < 0) { index = ~index; } - while (((_a2 = sortedFileDiagnostics[index - 1]) == null ? void 0 : _a2.start) === span.start) { + while (((_a = sortedFileDiagnostics[index - 1]) == null ? void 0 : _a.start) === span.start) { index--; } const result = []; @@ -128658,13 +129700,13 @@ ${lanes.join("\n")} const fileNameCase = ts_codefix_exports.moduleSymbolToValidIdentifier( getSymbolParentOrFail(symbol), scriptTarget, - /*preferCapitalized*/ + /*forceCapitalize*/ false ); const capitalized = ts_codefix_exports.moduleSymbolToValidIdentifier( getSymbolParentOrFail(symbol), scriptTarget, - /*preferCapitalized*/ + /*forceCapitalize*/ true ); if (fileNameCase === capitalized) @@ -128686,16 +129728,16 @@ ${lanes.join("\n")} return firstDefined( symbol.declarations, (d) => { - var _a2, _b; - return isExportAssignment(d) ? (_a2 = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a2.text : (_b = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _b.text; + var _a, _b; + return isExportAssignment(d) ? (_a = tryCast(skipOuterExpressions(d.expression), isIdentifier)) == null ? void 0 : _a.text : (_b = tryCast(getNameOfDeclaration(d), isIdentifier)) == null ? void 0 : _b.text; } ); } function getSymbolParentOrFail(symbol) { - var _a2; + var _a; return Debug.checkDefined( symbol.parent, - `Symbol parent was undefined. Flags: ${Debug.formatSymbolFlags(symbol.flags)}. Declarations: ${(_a2 = symbol.declarations) == null ? void 0 : _a2.map((d) => { + `Symbol parent was undefined. Flags: ${Debug.formatSymbolFlags(symbol.flags)}. Declarations: ${(_a = symbol.declarations) == null ? void 0 : _a.map((d) => { const kind = Debug.formatSyntaxKind(d.kind); const inJS = isInJSFile(d); const { expression } = d; @@ -128736,7 +129778,7 @@ ${lanes.join("\n")} return startsWith(node.text, "node:"); } }); - return decisionFromFile != null ? decisionFromFile : program.usesUriStyleNodeCoreModules; + return decisionFromFile ?? program.usesUriStyleNodeCoreModules; } function getNewLineKind(newLineCharacter) { return newLineCharacter === "\n" ? 1 /* LineFeed */ : 0 /* CarriageReturnLineFeed */; @@ -128767,14 +129809,14 @@ ${lanes.join("\n")} const expression = skipParentheses(clause.expression); if (isLiteralExpression(expression)) { switch (expression.kind) { - case 14 /* NoSubstitutionTemplateLiteral */: - case 10 /* StringLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 11 /* StringLiteral */: existingStrings.add(expression.text); break; - case 8 /* NumericLiteral */: + case 9 /* NumericLiteral */: existingNumbers.add(parseInt(expression.text)); break; - case 9 /* BigIntLiteral */: + case 10 /* BigIntLiteral */: const parsedBigInt = parseBigInt(endsWith(expression.text, "n") ? expression.text.slice(0, -1) : expression.text); if (parsedBigInt) { existingBigInts.add(pseudoBigIntToString(parsedBigInt)); @@ -128816,6 +129858,37 @@ ${lanes.join("\n")} } } } + function fileShouldUseJavaScriptRequire(file, program, host, preferRequire) { + var _a; + const fileName = typeof file === "string" ? file : file.fileName; + if (!hasJSFileExtension(fileName)) { + return false; + } + const compilerOptions = program.getCompilerOptions(); + const moduleKind = getEmitModuleKind(compilerOptions); + const impliedNodeFormat = typeof file === "string" ? getImpliedNodeFormatForFile(toPath(file, host.getCurrentDirectory(), hostGetCanonicalFileName(host)), (_a = program.getPackageJsonInfoCache) == null ? void 0 : _a.call(program), host, compilerOptions) : file.impliedNodeFormat; + if (impliedNodeFormat === 99 /* ESNext */) { + return false; + } + if (impliedNodeFormat === 1 /* CommonJS */) { + return true; + } + if (compilerOptions.verbatimModuleSyntax && moduleKind === 1 /* CommonJS */) { + return true; + } + if (compilerOptions.verbatimModuleSyntax && emitModuleKindIsNonNodeESM(moduleKind)) { + return false; + } + if (typeof file === "object") { + if (file.commonJsModuleIndicator) { + return true; + } + if (file.externalModuleIndicator) { + return false; + } + } + return preferRequire; + } var scanner, SemanticMeaning, tripleSlashDirectivePrefixRegex, typeKeywords, QuotePreference, displayPartWriter, lineFeed2, ANONYMOUS, syntaxMayBeASICandidate; var init_utilities4 = __esm({ "src/services/utilities.ts"() { @@ -128836,30 +129909,31 @@ ${lanes.join("\n")} })(SemanticMeaning || {}); tripleSlashDirectivePrefixRegex = /^\/\/\/\s* { - QuotePreference5[QuotePreference5["Single"] = 0] = "Single"; - QuotePreference5[QuotePreference5["Double"] = 1] = "Double"; - return QuotePreference5; + QuotePreference = /* @__PURE__ */ ((QuotePreference7) => { + QuotePreference7[QuotePreference7["Single"] = 0] = "Single"; + QuotePreference7[QuotePreference7["Double"] = 1] = "Double"; + return QuotePreference7; })(QuotePreference || {}); displayPartWriter = getDisplayPartWriter(); lineFeed2 = "\n"; @@ -129063,7 +130137,7 @@ ${lanes.join("\n")} } } function isImportableFile(program, from, to, preferences, packageJsonFilter, moduleSpecifierResolutionHost, moduleSpecifierCache) { - var _a2; + var _a; if (from === to) return false; const cachedResult = moduleSpecifierCache == null ? void 0 : moduleSpecifierCache.get(from.path, to.path, preferences, {}); @@ -129071,7 +130145,7 @@ ${lanes.join("\n")} return !cachedResult.isBlockedByPackageJsonDependencies; } const getCanonicalFileName = hostGetCanonicalFileName(moduleSpecifierResolutionHost); - const globalTypingsCache = (_a2 = moduleSpecifierResolutionHost.getGlobalTypingsCacheLocation) == null ? void 0 : _a2.call(moduleSpecifierResolutionHost); + const globalTypingsCache = (_a = moduleSpecifierResolutionHost.getGlobalTypingsCacheLocation) == null ? void 0 : _a.call(moduleSpecifierResolutionHost); const hasImportablePath = !!ts_moduleSpecifiers_exports.forEachFileNameOfModule( from.fileName, to.fileName, @@ -129096,7 +130170,7 @@ ${lanes.join("\n")} return toNodeModulesParent === void 0 || startsWith(getCanonicalFileName(fromPath), toNodeModulesParent) || !!globalCachePath && startsWith(getCanonicalFileName(globalCachePath), toNodeModulesParent); } function forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, cb) { - var _a2, _b; + var _a, _b; const useCaseSensitiveFileNames = hostUsesCaseSensitiveFileNames(host); const excludePatterns = preferences.autoImportFileExcludePatterns && mapDefined(preferences.autoImportFileExcludePatterns, (spec) => { const pattern = getPatternFromSpec(spec, "", "exclude"); @@ -129109,7 +130183,7 @@ ${lanes.join("\n")} /*isFromPackageJson*/ false )); - const autoImportProvider = useAutoImportProvider && ((_a2 = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a2.call(host)); + const autoImportProvider = useAutoImportProvider && ((_a = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a.call(host)); if (autoImportProvider) { const start = timestamp(); const checker = program.getTypeChecker(); @@ -129135,10 +130209,10 @@ ${lanes.join("\n")} } } function forEachExternalModule(checker, allSourceFiles, excludePatterns, cb) { - var _a2; + var _a; const isExcluded = excludePatterns && ((fileName) => excludePatterns.some((p) => p.test(fileName))); for (const ambient of checker.getAmbientModules()) { - if (!stringContains(ambient.name, "*") && !(excludePatterns && ((_a2 = ambient.declarations) == null ? void 0 : _a2.every((d) => isExcluded(d.getSourceFile().fileName))))) { + if (!stringContains(ambient.name, "*") && !(excludePatterns && ((_a = ambient.declarations) == null ? void 0 : _a.every((d) => isExcluded(d.getSourceFile().fileName))))) { cb( ambient, /*sourceFile*/ @@ -129153,18 +130227,18 @@ ${lanes.join("\n")} } } function getExportInfoMap(importingFile, host, program, preferences, cancellationToken) { - var _a2, _b, _c, _d, _e; + var _a, _b, _c, _d, _e; const start = timestamp(); - (_a2 = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a2.call(host); + (_a = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a.call(host); const cache = ((_b = host.getCachedExportInfoMap) == null ? void 0 : _b.call(host)) || createCacheableExportInfoMap({ getCurrentProgram: () => program, getPackageJsonAutoImportProvider: () => { - var _a3; - return (_a3 = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a3.call(host); + var _a2; + return (_a2 = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a2.call(host); }, getGlobalTypingsCacheLocation: () => { - var _a3; - return (_a3 = host.getGlobalTypingsCacheLocation) == null ? void 0 : _a3.call(host); + var _a2; + return (_a2 = host.getGlobalTypingsCacheLocation) == null ? void 0 : _a2.call(host); } }); if (cache.isUsableByFile(importingFile.path)) { @@ -129261,9 +130335,9 @@ ${lanes.join("\n")} } function getNameForExportDefault(symbol) { return symbol.declarations && firstDefined(symbol.declarations, (declaration) => { - var _a2; + var _a; if (isExportAssignment(declaration)) { - return (_a2 = tryCast(skipOuterExpressions(declaration.expression), isIdentifier)) == null ? void 0 : _a2.text; + return (_a = tryCast(skipOuterExpressions(declaration.expression), isIdentifier)) == null ? void 0 : _a.text; } else if (isExportSpecifier(declaration)) { Debug.assert(declaration.name.text === "default" /* Default */, "Expected the specifier to be a default export"); return declaration.propertyName && declaration.propertyName.text; @@ -129310,7 +130384,7 @@ ${lanes.join("\n")} text = prefix + text; const offset = prefix.length; if (pushTemplate) { - templateStack.push(15 /* TemplateHead */); + templateStack.push(16 /* TemplateHead */); } scanner2.setText(text); let endOfLineState = 0 /* None */; @@ -129322,8 +130396,8 @@ ${lanes.join("\n")} handleToken(); lastNonTriviaToken = token; } - const end = scanner2.getTextPos(); - pushEncodedClassification(scanner2.getTokenPos(), end, offset, classFromKind(token), spans); + const end = scanner2.getTokenEnd(); + pushEncodedClassification(scanner2.getTokenStart(), end, offset, classFromKind(token), spans); if (end >= text.length) { const end2 = getNewEndOfLineState(scanner2, token, lastOrUndefined(templateStack)); if (end2 !== void 0) { @@ -129333,54 +130407,54 @@ ${lanes.join("\n")} } while (token !== 1 /* EndOfFileToken */); function handleToken() { switch (token) { - case 43 /* SlashToken */: - case 68 /* SlashEqualsToken */: - if (!noRegexTable[lastNonTriviaToken] && scanner2.reScanSlashToken() === 13 /* RegularExpressionLiteral */) { - token = 13 /* RegularExpressionLiteral */; + case 44 /* SlashToken */: + case 69 /* SlashEqualsToken */: + if (!noRegexTable[lastNonTriviaToken] && scanner2.reScanSlashToken() === 14 /* RegularExpressionLiteral */) { + token = 14 /* RegularExpressionLiteral */; } break; - case 29 /* LessThanToken */: - if (lastNonTriviaToken === 79 /* Identifier */) { + case 30 /* LessThanToken */: + if (lastNonTriviaToken === 80 /* Identifier */) { angleBracketStack++; } break; - case 31 /* GreaterThanToken */: + case 32 /* GreaterThanToken */: if (angleBracketStack > 0) { angleBracketStack--; } break; - case 131 /* AnyKeyword */: - case 152 /* StringKeyword */: - case 148 /* NumberKeyword */: - case 134 /* BooleanKeyword */: - case 153 /* SymbolKeyword */: + case 133 /* AnyKeyword */: + case 154 /* StringKeyword */: + case 150 /* NumberKeyword */: + case 136 /* BooleanKeyword */: + case 155 /* SymbolKeyword */: if (angleBracketStack > 0 && !syntacticClassifierAbsent) { - token = 79 /* Identifier */; + token = 80 /* Identifier */; } break; - case 15 /* TemplateHead */: + case 16 /* TemplateHead */: templateStack.push(token); break; - case 18 /* OpenBraceToken */: + case 19 /* OpenBraceToken */: if (templateStack.length > 0) { templateStack.push(token); } break; - case 19 /* CloseBraceToken */: + case 20 /* CloseBraceToken */: if (templateStack.length > 0) { const lastTemplateStackToken = lastOrUndefined(templateStack); - if (lastTemplateStackToken === 15 /* TemplateHead */) { + if (lastTemplateStackToken === 16 /* TemplateHead */) { token = scanner2.reScanTemplateToken( - /* isTaggedTemplate */ + /*isTaggedTemplate*/ false ); - if (token === 17 /* TemplateTail */) { + if (token === 18 /* TemplateTail */) { templateStack.pop(); } else { - Debug.assertEqual(token, 16 /* TemplateMiddle */, "Should have been a template middle."); + Debug.assertEqual(token, 17 /* TemplateMiddle */, "Should have been a template middle."); } } else { - Debug.assertEqual(lastTemplateStackToken, 18 /* OpenBraceToken */, "Should have been an open brace"); + Debug.assertEqual(lastTemplateStackToken, 19 /* OpenBraceToken */, "Should have been an open brace"); templateStack.pop(); } } @@ -129389,10 +130463,10 @@ ${lanes.join("\n")} if (!isKeyword(token)) { break; } - if (lastNonTriviaToken === 24 /* DotToken */) { - token = 79 /* Identifier */; + if (lastNonTriviaToken === 25 /* DotToken */) { + token = 80 /* Identifier */; } else if (isKeyword(lastNonTriviaToken) && isKeyword(token) && !canFollow(lastNonTriviaToken, token)) { - token = 79 /* Identifier */; + token = 80 /* Identifier */; } } } @@ -129402,7 +130476,7 @@ ${lanes.join("\n")} } function getNewEndOfLineState(scanner2, token, lastOnTemplateStack) { switch (token) { - case 10 /* StringLiteral */: { + case 11 /* StringLiteral */: { if (!scanner2.isUnterminated()) return void 0; const tokenText = scanner2.getTokenText(); @@ -129423,15 +130497,15 @@ ${lanes.join("\n")} return void 0; } switch (token) { - case 17 /* TemplateTail */: + case 18 /* TemplateTail */: return 5 /* InTemplateMiddleOrTail */; - case 14 /* NoSubstitutionTemplateLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: return 4 /* InTemplateHeadOrNoSubstitutionTemplate */; default: return Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token); } } - return lastOnTemplateStack === 15 /* TemplateHead */ ? 6 /* InTemplateSubstitutionPosition */ : void 0; + return lastOnTemplateStack === 16 /* TemplateHead */ ? 6 /* InTemplateSubstitutionPosition */ : void 0; } } function pushEncodedClassification(start, end, offset, classification, result) { @@ -129506,11 +130580,11 @@ ${lanes.join("\n")} return true; } switch (keyword2) { - case 137 /* GetKeyword */: - case 151 /* SetKeyword */: - case 135 /* ConstructorKeyword */: - case 124 /* StaticKeyword */: - case 127 /* AccessorKeyword */: + case 139 /* GetKeyword */: + case 153 /* SetKeyword */: + case 137 /* ConstructorKeyword */: + case 126 /* StaticKeyword */: + case 129 /* AccessorKeyword */: return true; default: return false; @@ -129538,48 +130612,48 @@ ${lanes.join("\n")} } function isBinaryExpressionOperatorToken(token) { switch (token) { - case 41 /* AsteriskToken */: - case 43 /* SlashToken */: - case 44 /* PercentToken */: - case 39 /* PlusToken */: - case 40 /* MinusToken */: - case 47 /* LessThanLessThanToken */: - case 48 /* GreaterThanGreaterThanToken */: - case 49 /* GreaterThanGreaterThanGreaterThanToken */: - case 29 /* LessThanToken */: - case 31 /* GreaterThanToken */: - case 32 /* LessThanEqualsToken */: - case 33 /* GreaterThanEqualsToken */: - case 102 /* InstanceOfKeyword */: - case 101 /* InKeyword */: - case 128 /* AsKeyword */: - case 150 /* SatisfiesKeyword */: - case 34 /* EqualsEqualsToken */: - case 35 /* ExclamationEqualsToken */: - case 36 /* EqualsEqualsEqualsToken */: - case 37 /* ExclamationEqualsEqualsToken */: - case 50 /* AmpersandToken */: - case 52 /* CaretToken */: - case 51 /* BarToken */: - case 55 /* AmpersandAmpersandToken */: - case 56 /* BarBarToken */: - case 74 /* BarEqualsToken */: - case 73 /* AmpersandEqualsToken */: - case 78 /* CaretEqualsToken */: - case 70 /* LessThanLessThanEqualsToken */: - case 71 /* GreaterThanGreaterThanEqualsToken */: - case 72 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 64 /* PlusEqualsToken */: - case 65 /* MinusEqualsToken */: - case 66 /* AsteriskEqualsToken */: - case 68 /* SlashEqualsToken */: - case 69 /* PercentEqualsToken */: - case 63 /* EqualsToken */: - case 27 /* CommaToken */: - case 60 /* QuestionQuestionToken */: - case 75 /* BarBarEqualsToken */: - case 76 /* AmpersandAmpersandEqualsToken */: - case 77 /* QuestionQuestionEqualsToken */: + case 42 /* AsteriskToken */: + case 44 /* SlashToken */: + case 45 /* PercentToken */: + case 40 /* PlusToken */: + case 41 /* MinusToken */: + case 48 /* LessThanLessThanToken */: + case 49 /* GreaterThanGreaterThanToken */: + case 50 /* GreaterThanGreaterThanGreaterThanToken */: + case 30 /* LessThanToken */: + case 32 /* GreaterThanToken */: + case 33 /* LessThanEqualsToken */: + case 34 /* GreaterThanEqualsToken */: + case 104 /* InstanceOfKeyword */: + case 103 /* InKeyword */: + case 130 /* AsKeyword */: + case 152 /* SatisfiesKeyword */: + case 35 /* EqualsEqualsToken */: + case 36 /* ExclamationEqualsToken */: + case 37 /* EqualsEqualsEqualsToken */: + case 38 /* ExclamationEqualsEqualsToken */: + case 51 /* AmpersandToken */: + case 53 /* CaretToken */: + case 52 /* BarToken */: + case 56 /* AmpersandAmpersandToken */: + case 57 /* BarBarToken */: + case 75 /* BarEqualsToken */: + case 74 /* AmpersandEqualsToken */: + case 79 /* CaretEqualsToken */: + case 71 /* LessThanLessThanEqualsToken */: + case 72 /* GreaterThanGreaterThanEqualsToken */: + case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 65 /* PlusEqualsToken */: + case 66 /* MinusEqualsToken */: + case 67 /* AsteriskEqualsToken */: + case 69 /* SlashEqualsToken */: + case 70 /* PercentEqualsToken */: + case 64 /* EqualsToken */: + case 28 /* CommaToken */: + case 61 /* QuestionQuestionToken */: + case 76 /* BarBarEqualsToken */: + case 77 /* AmpersandAmpersandEqualsToken */: + case 78 /* QuestionQuestionEqualsToken */: return true; default: return false; @@ -129587,12 +130661,12 @@ ${lanes.join("\n")} } function isPrefixUnaryExpressionOperatorToken(token) { switch (token) { - case 39 /* PlusToken */: - case 40 /* MinusToken */: - case 54 /* TildeToken */: - case 53 /* ExclamationToken */: - case 45 /* PlusPlusToken */: - case 46 /* MinusMinusToken */: + case 40 /* PlusToken */: + case 41 /* MinusToken */: + case 55 /* TildeToken */: + case 54 /* ExclamationToken */: + case 46 /* PlusPlusToken */: + case 47 /* MinusMinusToken */: return true; default: return false; @@ -129603,17 +130677,17 @@ ${lanes.join("\n")} return 3 /* keyword */; } else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) { return 5 /* operator */; - } else if (token >= 18 /* FirstPunctuation */ && token <= 78 /* LastPunctuation */) { + } else if (token >= 19 /* FirstPunctuation */ && token <= 79 /* LastPunctuation */) { return 10 /* punctuation */; } switch (token) { - case 8 /* NumericLiteral */: + case 9 /* NumericLiteral */: return 4 /* numericLiteral */; - case 9 /* BigIntLiteral */: + case 10 /* BigIntLiteral */: return 25 /* bigintLiteral */; - case 10 /* StringLiteral */: + case 11 /* StringLiteral */: return 6 /* stringLiteral */; - case 13 /* RegularExpressionLiteral */: + case 14 /* RegularExpressionLiteral */: return 7 /* regularExpressionLiteral */; case 7 /* ConflictMarkerTrivia */: case 3 /* MultiLineCommentTrivia */: @@ -129622,7 +130696,7 @@ ${lanes.join("\n")} case 5 /* WhitespaceTrivia */: case 4 /* NewLineTrivia */: return 8 /* whiteSpace */; - case 79 /* Identifier */: + case 80 /* Identifier */: default: if (isTemplateLiteralKind(token)) { return 6 /* stringLiteral */; @@ -129635,13 +130709,13 @@ ${lanes.join("\n")} } function checkForClassificationCancellation(cancellationToken, kind) { switch (kind) { - case 264 /* ModuleDeclaration */: - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: - case 259 /* FunctionDeclaration */: - case 228 /* ClassExpression */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 266 /* ModuleDeclaration */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: + case 261 /* FunctionDeclaration */: + case 230 /* ClassExpression */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -129788,14 +130862,14 @@ ${lanes.join("\n")} result.push(type); } function classifyLeadingTriviaAndGetTokenStart(token) { - triviaScanner.setTextPos(token.pos); + triviaScanner.resetTokenState(token.pos); while (true) { - const start = triviaScanner.getTextPos(); + const start = triviaScanner.getTokenEnd(); if (!couldStartTrivia(sourceFile.text, start)) { return start; } const kind = triviaScanner.scan(); - const end = triviaScanner.getTextPos(); + const end = triviaScanner.getTokenEnd(); const width = end - start; if (!isTrivia(kind)) { return start; @@ -129807,7 +130881,7 @@ ${lanes.join("\n")} case 2 /* SingleLineCommentTrivia */: case 3 /* MultiLineCommentTrivia */: classifyComment(token, kind, start, width); - triviaScanner.setTextPos(end); + triviaScanner.resetTokenState(end); continue; case 7 /* ConflictMarkerTrivia */: const text = sourceFile.text; @@ -129845,7 +130919,7 @@ ${lanes.join("\n")} pushClassification(start, width, 1 /* comment */); } function classifyJSDocComment(docComment) { - var _a2, _b, _c, _d, _e, _f, _g, _h; + var _a, _b, _c, _d, _e, _f, _g, _h; let pos = docComment.pos; if (docComment.tags) { for (const tag of docComment.tags) { @@ -129857,49 +130931,49 @@ ${lanes.join("\n")} pos = tag.tagName.end; let commentStart = tag.tagName.end; switch (tag.kind) { - case 344 /* JSDocParameterTag */: + case 347 /* JSDocParameterTag */: const param = tag; processJSDocParameterTag(param); - commentStart = param.isNameFirst && ((_a2 = param.typeExpression) == null ? void 0 : _a2.end) || param.name.end; + commentStart = param.isNameFirst && ((_a = param.typeExpression) == null ? void 0 : _a.end) || param.name.end; break; - case 351 /* JSDocPropertyTag */: + case 354 /* JSDocPropertyTag */: const prop = tag; commentStart = prop.isNameFirst && ((_b = prop.typeExpression) == null ? void 0 : _b.end) || prop.name.end; break; - case 348 /* JSDocTemplateTag */: + case 351 /* JSDocTemplateTag */: processJSDocTemplateTag(tag); pos = tag.end; commentStart = tag.typeParameters.end; break; - case 349 /* JSDocTypedefTag */: + case 352 /* JSDocTypedefTag */: const type = tag; - commentStart = ((_c = type.typeExpression) == null ? void 0 : _c.kind) === 312 /* JSDocTypeExpression */ && ((_d = type.fullName) == null ? void 0 : _d.end) || ((_e = type.typeExpression) == null ? void 0 : _e.end) || commentStart; + commentStart = ((_c = type.typeExpression) == null ? void 0 : _c.kind) === 315 /* JSDocTypeExpression */ && ((_d = type.fullName) == null ? void 0 : _d.end) || ((_e = type.typeExpression) == null ? void 0 : _e.end) || commentStart; break; - case 341 /* JSDocCallbackTag */: + case 344 /* JSDocCallbackTag */: commentStart = tag.typeExpression.end; break; - case 347 /* JSDocTypeTag */: + case 350 /* JSDocTypeTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = tag.typeExpression.end; break; - case 346 /* JSDocThisTag */: - case 343 /* JSDocEnumTag */: + case 349 /* JSDocThisTag */: + case 346 /* JSDocEnumTag */: commentStart = tag.typeExpression.end; break; - case 345 /* JSDocReturnTag */: + case 348 /* JSDocReturnTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = ((_f = tag.typeExpression) == null ? void 0 : _f.end) || commentStart; break; - case 350 /* JSDocSeeTag */: + case 353 /* JSDocSeeTag */: commentStart = ((_g = tag.name) == null ? void 0 : _g.end) || commentStart; break; - case 331 /* JSDocAugmentsTag */: - case 332 /* JSDocImplementsTag */: + case 334 /* JSDocAugmentsTag */: + case 335 /* JSDocImplementsTag */: commentStart = tag.class.end; break; - case 352 /* JSDocThrowsTag */: + case 355 /* JSDocThrowsTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = ((_h = tag.typeExpression) == null ? void 0 : _h.end) || commentStart; @@ -130006,15 +131080,15 @@ ${lanes.join("\n")} } } pushClassification(start, i - start, 1 /* comment */); - mergeConflictScanner.setTextPos(i); - while (mergeConflictScanner.getTextPos() < end) { + mergeConflictScanner.resetTokenState(i); + while (mergeConflictScanner.getTokenEnd() < end) { classifyDisabledCodeToken(); } } function classifyDisabledCodeToken() { - const start = mergeConflictScanner.getTextPos(); + const start = mergeConflictScanner.getTokenEnd(); const tokenKind = mergeConflictScanner.scan(); - const end = mergeConflictScanner.getTextPos(); + const end = mergeConflictScanner.getTokenEnd(); const type = classifyTokenType(tokenKind); if (type) { pushClassification(start, end - start, type); @@ -130028,10 +131102,10 @@ ${lanes.join("\n")} return true; } const classifiedElementName = tryClassifyJsxElementName(node); - if (!isToken(node) && node.kind !== 11 /* JsxText */ && classifiedElementName === void 0) { + if (!isToken(node) && node.kind !== 12 /* JsxText */ && classifiedElementName === void 0) { return false; } - const tokenStart = node.kind === 11 /* JsxText */ ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); + const tokenStart = node.kind === 12 /* JsxText */ ? node.pos : classifyLeadingTriviaAndGetTokenStart(node); const tokenWidth = node.end - tokenStart; Debug.assert(tokenWidth >= 0); if (tokenWidth > 0) { @@ -130044,22 +131118,22 @@ ${lanes.join("\n")} } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 283 /* JsxOpeningElement */: + case 285 /* JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* jsxOpenTagName */; } break; - case 284 /* JsxClosingElement */: + case 286 /* JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* jsxCloseTagName */; } break; - case 282 /* JsxSelfClosingElement */: + case 284 /* JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* jsxSelfClosingTagName */; } break; - case 288 /* JsxAttribute */: + case 290 /* JsxAttribute */: if (token.parent.name === token) { return 22 /* jsxAttribute */; } @@ -130071,7 +131145,7 @@ ${lanes.join("\n")} if (isKeyword(tokenKind)) { return 3 /* keyword */; } - if (tokenKind === 29 /* LessThanToken */ || tokenKind === 31 /* GreaterThanToken */) { + if (tokenKind === 30 /* LessThanToken */ || tokenKind === 32 /* GreaterThanToken */) { if (token && getTypeArgumentOrTypeParameterList(token.parent)) { return 10 /* punctuation */; } @@ -130079,57 +131153,57 @@ ${lanes.join("\n")} if (isPunctuation(tokenKind)) { if (token) { const parent2 = token.parent; - if (tokenKind === 63 /* EqualsToken */) { - if (parent2.kind === 257 /* VariableDeclaration */ || parent2.kind === 169 /* PropertyDeclaration */ || parent2.kind === 166 /* Parameter */ || parent2.kind === 288 /* JsxAttribute */) { + if (tokenKind === 64 /* EqualsToken */) { + if (parent2.kind === 259 /* VariableDeclaration */ || parent2.kind === 171 /* PropertyDeclaration */ || parent2.kind === 168 /* Parameter */ || parent2.kind === 290 /* JsxAttribute */) { return 5 /* operator */; } } - if (parent2.kind === 223 /* BinaryExpression */ || parent2.kind === 221 /* PrefixUnaryExpression */ || parent2.kind === 222 /* PostfixUnaryExpression */ || parent2.kind === 224 /* ConditionalExpression */) { + if (parent2.kind === 225 /* BinaryExpression */ || parent2.kind === 223 /* PrefixUnaryExpression */ || parent2.kind === 224 /* PostfixUnaryExpression */ || parent2.kind === 226 /* ConditionalExpression */) { return 5 /* operator */; } } return 10 /* punctuation */; - } else if (tokenKind === 8 /* NumericLiteral */) { + } else if (tokenKind === 9 /* NumericLiteral */) { return 4 /* numericLiteral */; - } else if (tokenKind === 9 /* BigIntLiteral */) { + } else if (tokenKind === 10 /* BigIntLiteral */) { return 25 /* bigintLiteral */; - } else if (tokenKind === 10 /* StringLiteral */) { - return token && token.parent.kind === 288 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; - } else if (tokenKind === 13 /* RegularExpressionLiteral */) { + } else if (tokenKind === 11 /* StringLiteral */) { + return token && token.parent.kind === 290 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */; + } else if (tokenKind === 14 /* RegularExpressionLiteral */) { return 6 /* stringLiteral */; } else if (isTemplateLiteralKind(tokenKind)) { return 6 /* stringLiteral */; - } else if (tokenKind === 11 /* JsxText */) { + } else if (tokenKind === 12 /* JsxText */) { return 23 /* jsxText */; - } else if (tokenKind === 79 /* Identifier */) { + } else if (tokenKind === 80 /* Identifier */) { if (token) { switch (token.parent.kind) { - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: if (token.parent.name === token) { return 11 /* className */; } return; - case 165 /* TypeParameter */: + case 167 /* TypeParameter */: if (token.parent.name === token) { return 15 /* typeParameterName */; } return; - case 261 /* InterfaceDeclaration */: + case 263 /* InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* interfaceName */; } return; - case 263 /* EnumDeclaration */: + case 265 /* EnumDeclaration */: if (token.parent.name === token) { return 12 /* enumName */; } return; - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: if (token.parent.name === token) { return 14 /* moduleName */; } return; - case 166 /* Parameter */: + case 168 /* Parameter */: if (token.parent.name === token) { return isThisIdentifier(token) ? 3 /* keyword */ : 17 /* parameterName */; } @@ -130162,19 +131236,19 @@ ${lanes.join("\n")} "use strict"; init_ts4(); noRegexTable = arrayToNumericMap([ - 79 /* Identifier */, - 10 /* StringLiteral */, - 8 /* NumericLiteral */, - 9 /* BigIntLiteral */, - 13 /* RegularExpressionLiteral */, - 108 /* ThisKeyword */, - 45 /* PlusPlusToken */, - 46 /* MinusMinusToken */, - 21 /* CloseParenToken */, - 23 /* CloseBracketToken */, - 19 /* CloseBraceToken */, - 110 /* TrueKeyword */, - 95 /* FalseKeyword */ + 80 /* Identifier */, + 11 /* StringLiteral */, + 9 /* NumericLiteral */, + 10 /* BigIntLiteral */, + 14 /* RegularExpressionLiteral */, + 110 /* ThisKeyword */, + 46 /* PlusPlusToken */, + 47 /* MinusMinusToken */, + 22 /* CloseParenToken */, + 24 /* CloseBracketToken */, + 20 /* CloseBraceToken */, + 112 /* TrueKeyword */, + 97 /* FalseKeyword */ ], (token) => token, () => true); } }); @@ -130238,58 +131312,58 @@ ${lanes.join("\n")} } function getHighlightSpans(node, sourceFile) { switch (node.kind) { - case 99 /* IfKeyword */: - case 91 /* ElseKeyword */: + case 101 /* IfKeyword */: + case 93 /* ElseKeyword */: return isIfStatement(node.parent) ? getIfElseOccurrences(node.parent, sourceFile) : void 0; - case 105 /* ReturnKeyword */: + case 107 /* ReturnKeyword */: return useParent(node.parent, isReturnStatement, getReturnOccurrences); - case 109 /* ThrowKeyword */: + case 111 /* ThrowKeyword */: return useParent(node.parent, isThrowStatement, getThrowOccurrences); - case 111 /* TryKeyword */: - case 83 /* CatchKeyword */: - case 96 /* FinallyKeyword */: - const tryStatement = node.kind === 83 /* CatchKeyword */ ? node.parent.parent : node.parent; + case 113 /* TryKeyword */: + case 85 /* CatchKeyword */: + case 98 /* FinallyKeyword */: + const tryStatement = node.kind === 85 /* CatchKeyword */ ? node.parent.parent : node.parent; return useParent(tryStatement, isTryStatement, getTryCatchFinallyOccurrences); - case 107 /* SwitchKeyword */: + case 109 /* SwitchKeyword */: return useParent(node.parent, isSwitchStatement, getSwitchCaseDefaultOccurrences); - case 82 /* CaseKeyword */: - case 88 /* DefaultKeyword */: { + case 84 /* CaseKeyword */: + case 90 /* DefaultKeyword */: { if (isDefaultClause(node.parent) || isCaseClause(node.parent)) { return useParent(node.parent.parent.parent, isSwitchStatement, getSwitchCaseDefaultOccurrences); } return void 0; } - case 81 /* BreakKeyword */: - case 86 /* ContinueKeyword */: + case 83 /* BreakKeyword */: + case 88 /* ContinueKeyword */: return useParent(node.parent, isBreakOrContinueStatement, getBreakOrContinueStatementOccurrences); - case 97 /* ForKeyword */: - case 115 /* WhileKeyword */: - case 90 /* DoKeyword */: + case 99 /* ForKeyword */: + case 117 /* WhileKeyword */: + case 92 /* DoKeyword */: return useParent(node.parent, (n) => isIterationStatement( n, /*lookInLabeledStatements*/ true ), getLoopBreakContinueOccurrences); - case 135 /* ConstructorKeyword */: - return getFromAllDeclarations(isConstructorDeclaration, [135 /* ConstructorKeyword */]); - case 137 /* GetKeyword */: - case 151 /* SetKeyword */: - return getFromAllDeclarations(isAccessor, [137 /* GetKeyword */, 151 /* SetKeyword */]); - case 133 /* AwaitKeyword */: + case 137 /* ConstructorKeyword */: + return getFromAllDeclarations(isConstructorDeclaration, [137 /* ConstructorKeyword */]); + case 139 /* GetKeyword */: + case 153 /* SetKeyword */: + return getFromAllDeclarations(isAccessor, [139 /* GetKeyword */, 153 /* SetKeyword */]); + case 135 /* AwaitKeyword */: return useParent(node.parent, isAwaitExpression, getAsyncAndAwaitOccurrences); - case 132 /* AsyncKeyword */: + case 134 /* AsyncKeyword */: return highlightSpans(getAsyncAndAwaitOccurrences(node)); - case 125 /* YieldKeyword */: + case 127 /* YieldKeyword */: return highlightSpans(getYieldOccurrences(node)); - case 101 /* InKeyword */: + case 103 /* InKeyword */: return void 0; default: return isModifierKind(node.kind) && (isDeclaration(node.parent) || isVariableStatement(node.parent)) ? highlightSpans(getModifierOccurrences(node.kind, node.parent)) : void 0; } function getFromAllDeclarations(nodeTest, keywords) { return useParent(node.parent, nodeTest, (decl) => { - var _a2; - return mapDefined((_a2 = tryCast(decl, canHaveSymbol)) == null ? void 0 : _a2.symbol.declarations, (d) => nodeTest(d) ? find(d.getChildren(sourceFile), (c) => contains(keywords, c.kind)) : void 0); + var _a; + return mapDefined((_a = tryCast(decl, canHaveSymbol)) == null ? void 0 : _a.symbol.declarations, (d) => nodeTest(d) ? find(d.getChildren(sourceFile), (c) => contains(keywords, c.kind)) : void 0); }); } function useParent(node2, nodeTest, getNodes4) { @@ -130314,7 +131388,7 @@ ${lanes.join("\n")} let child = throwStatement; while (child.parent) { const parent2 = child.parent; - if (isFunctionBlock(parent2) || parent2.kind === 308 /* SourceFile */) { + if (isFunctionBlock(parent2) || parent2.kind === 311 /* SourceFile */) { return parent2; } if (isTryStatement(parent2) && parent2.tryBlock === child && parent2.catchClause) { @@ -130344,15 +131418,15 @@ ${lanes.join("\n")} function getBreakOrContinueOwner(statement) { return findAncestor(statement, (node) => { switch (node.kind) { - case 252 /* SwitchStatement */: - if (statement.kind === 248 /* ContinueStatement */) { + case 254 /* SwitchStatement */: + if (statement.kind === 250 /* ContinueStatement */) { return false; } - case 245 /* ForStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: - case 244 /* WhileStatement */: - case 243 /* DoStatement */: + case 247 /* ForStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 246 /* WhileStatement */: + case 245 /* DoStatement */: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: return isFunctionLike(node) && "quit"; @@ -130365,24 +131439,24 @@ ${lanes.join("\n")} function getNodesToSearchForModifier(declaration, modifierFlag) { const container = declaration.parent; switch (container.kind) { - case 265 /* ModuleBlock */: - case 308 /* SourceFile */: - case 238 /* Block */: - case 292 /* CaseClause */: - case 293 /* DefaultClause */: + case 267 /* ModuleBlock */: + case 311 /* SourceFile */: + case 240 /* Block */: + case 295 /* CaseClause */: + case 296 /* DefaultClause */: if (modifierFlag & 256 /* Abstract */ && isClassDeclaration(declaration)) { return [...declaration.members, declaration]; } else { return container.statements; } - case 173 /* Constructor */: - case 171 /* MethodDeclaration */: - case 259 /* FunctionDeclaration */: + case 175 /* Constructor */: + case 173 /* MethodDeclaration */: + case 261 /* FunctionDeclaration */: return [...container.parameters, ...isClassLike(container.parent) ? container.parent.members : []]; - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 261 /* InterfaceDeclaration */: - case 184 /* TypeLiteral */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 263 /* InterfaceDeclaration */: + case 186 /* TypeLiteral */: const nodes = container.members; if (modifierFlag & (28 /* AccessibilityModifier */ | 64 /* Readonly */)) { const constructor = find(container.members, isConstructorDeclaration); @@ -130393,7 +131467,7 @@ ${lanes.join("\n")} return [...nodes, container]; } return nodes; - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return void 0; default: Debug.assertNever(container, "Invalid container kind."); @@ -130408,11 +131482,11 @@ ${lanes.join("\n")} } function getLoopBreakContinueOccurrences(loopNode) { const keywords = []; - if (pushKeywordIf(keywords, loopNode.getFirstToken(), 97 /* ForKeyword */, 115 /* WhileKeyword */, 90 /* DoKeyword */)) { - if (loopNode.kind === 243 /* DoStatement */) { + if (pushKeywordIf(keywords, loopNode.getFirstToken(), 99 /* ForKeyword */, 117 /* WhileKeyword */, 92 /* DoKeyword */)) { + if (loopNode.kind === 245 /* DoStatement */) { const loopTokens = loopNode.getChildren(); for (let i = loopTokens.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, loopTokens[i], 115 /* WhileKeyword */)) { + if (pushKeywordIf(keywords, loopTokens[i], 117 /* WhileKeyword */)) { break; } } @@ -130420,7 +131494,7 @@ ${lanes.join("\n")} } forEach(aggregateAllBreakAndContinueStatements(loopNode.statement), (statement) => { if (ownsBreakOrContinueStatement(loopNode, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 81 /* BreakKeyword */, 86 /* ContinueKeyword */); + pushKeywordIf(keywords, statement.getFirstToken(), 83 /* BreakKeyword */, 88 /* ContinueKeyword */); } }); return keywords; @@ -130429,13 +131503,13 @@ ${lanes.join("\n")} const owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 245 /* ForStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: - case 243 /* DoStatement */: - case 244 /* WhileStatement */: + case 247 /* ForStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 245 /* DoStatement */: + case 246 /* WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 252 /* SwitchStatement */: + case 254 /* SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -130443,12 +131517,12 @@ ${lanes.join("\n")} } function getSwitchCaseDefaultOccurrences(switchStatement) { const keywords = []; - pushKeywordIf(keywords, switchStatement.getFirstToken(), 107 /* SwitchKeyword */); + pushKeywordIf(keywords, switchStatement.getFirstToken(), 109 /* SwitchKeyword */); forEach(switchStatement.caseBlock.clauses, (clause) => { - pushKeywordIf(keywords, clause.getFirstToken(), 82 /* CaseKeyword */, 88 /* DefaultKeyword */); + pushKeywordIf(keywords, clause.getFirstToken(), 84 /* CaseKeyword */, 90 /* DefaultKeyword */); forEach(aggregateAllBreakAndContinueStatements(clause), (statement) => { if (ownsBreakOrContinueStatement(switchStatement, statement)) { - pushKeywordIf(keywords, statement.getFirstToken(), 81 /* BreakKeyword */); + pushKeywordIf(keywords, statement.getFirstToken(), 83 /* BreakKeyword */); } }); }); @@ -130456,13 +131530,13 @@ ${lanes.join("\n")} } function getTryCatchFinallyOccurrences(tryStatement, sourceFile) { const keywords = []; - pushKeywordIf(keywords, tryStatement.getFirstToken(), 111 /* TryKeyword */); + pushKeywordIf(keywords, tryStatement.getFirstToken(), 113 /* TryKeyword */); if (tryStatement.catchClause) { - pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 83 /* CatchKeyword */); + pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 85 /* CatchKeyword */); } if (tryStatement.finallyBlock) { - const finallyKeyword = findChildOfKind(tryStatement, 96 /* FinallyKeyword */, sourceFile); - pushKeywordIf(keywords, finallyKeyword, 96 /* FinallyKeyword */); + const finallyKeyword = findChildOfKind(tryStatement, 98 /* FinallyKeyword */, sourceFile); + pushKeywordIf(keywords, finallyKeyword, 98 /* FinallyKeyword */); } return keywords; } @@ -130473,11 +131547,11 @@ ${lanes.join("\n")} } const keywords = []; forEach(aggregateOwnedThrowStatements(owner), (throwStatement2) => { - keywords.push(findChildOfKind(throwStatement2, 109 /* ThrowKeyword */, sourceFile)); + keywords.push(findChildOfKind(throwStatement2, 111 /* ThrowKeyword */, sourceFile)); }); if (isFunctionBlock(owner)) { forEachReturnStatement(owner, (returnStatement) => { - keywords.push(findChildOfKind(returnStatement, 105 /* ReturnKeyword */, sourceFile)); + keywords.push(findChildOfKind(returnStatement, 107 /* ReturnKeyword */, sourceFile)); }); } return keywords; @@ -130489,10 +131563,10 @@ ${lanes.join("\n")} } const keywords = []; forEachReturnStatement(cast(func.body, isBlock), (returnStatement2) => { - keywords.push(findChildOfKind(returnStatement2, 105 /* ReturnKeyword */, sourceFile)); + keywords.push(findChildOfKind(returnStatement2, 107 /* ReturnKeyword */, sourceFile)); }); forEach(aggregateOwnedThrowStatements(func.body), (throwStatement) => { - keywords.push(findChildOfKind(throwStatement, 109 /* ThrowKeyword */, sourceFile)); + keywords.push(findChildOfKind(throwStatement, 111 /* ThrowKeyword */, sourceFile)); }); return keywords; } @@ -130504,13 +131578,13 @@ ${lanes.join("\n")} const keywords = []; if (func.modifiers) { func.modifiers.forEach((modifier) => { - pushKeywordIf(keywords, modifier, 132 /* AsyncKeyword */); + pushKeywordIf(keywords, modifier, 134 /* AsyncKeyword */); }); } forEachChild(func, (child) => { traverseWithoutCrossingFunction(child, (node2) => { if (isAwaitExpression(node2)) { - pushKeywordIf(keywords, node2.getFirstToken(), 133 /* AwaitKeyword */); + pushKeywordIf(keywords, node2.getFirstToken(), 135 /* AwaitKeyword */); } }); }); @@ -130525,7 +131599,7 @@ ${lanes.join("\n")} forEachChild(func, (child) => { traverseWithoutCrossingFunction(child, (node2) => { if (isYieldExpression(node2)) { - pushKeywordIf(keywords, node2.getFirstToken(), 125 /* YieldKeyword */); + pushKeywordIf(keywords, node2.getFirstToken(), 127 /* YieldKeyword */); } }); }); @@ -130541,7 +131615,7 @@ ${lanes.join("\n")} const keywords = getIfElseKeywords(ifStatement, sourceFile); const result = []; for (let i = 0; i < keywords.length; i++) { - if (keywords[i].kind === 91 /* ElseKeyword */ && i < keywords.length - 1) { + if (keywords[i].kind === 93 /* ElseKeyword */ && i < keywords.length - 1) { const elseKeyword = keywords[i]; const ifKeyword = keywords[i + 1]; let shouldCombineElseAndIf = true; @@ -130572,9 +131646,9 @@ ${lanes.join("\n")} } while (true) { const children = ifStatement.getChildren(sourceFile); - pushKeywordIf(keywords, children[0], 99 /* IfKeyword */); + pushKeywordIf(keywords, children[0], 101 /* IfKeyword */); for (let i = children.length - 1; i >= 0; i--) { - if (pushKeywordIf(keywords, children[i], 91 /* ElseKeyword */)) { + if (pushKeywordIf(keywords, children[i], 93 /* ElseKeyword */)) { break; } } @@ -130675,14 +131749,14 @@ ${lanes.join("\n")} return entry; } function acquireOrUpdateDocument(fileName, path, compilationSettingsOrHost, key, scriptSnapshot, version2, acquiring, scriptKind, languageVersionOrOptions) { - var _a2, _b, _c, _d; + var _a, _b, _c, _d; scriptKind = ensureScriptKind(fileName, scriptKind); const compilationSettings = getCompilationSettings(compilationSettingsOrHost); const host = compilationSettingsOrHost === compilationSettings ? void 0 : compilationSettingsOrHost; const scriptTarget = scriptKind === 6 /* JSON */ ? 100 /* JSON */ : getEmitScriptTarget(compilationSettings); const sourceFileOptions = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions : { languageVersion: scriptTarget, - impliedNodeFormat: host && getImpliedNodeFormatForFile(path, (_d = (_c = (_b = (_a2 = host.getCompilerHost) == null ? void 0 : _a2.call(host)) == null ? void 0 : _b.getModuleResolutionCache) == null ? void 0 : _c.call(_b)) == null ? void 0 : _d.getPackageJsonInfoCache(), host, compilationSettings), + impliedNodeFormat: host && getImpliedNodeFormatForFile(path, (_d = (_c = (_b = (_a = host.getCompilerHost) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getModuleResolutionCache) == null ? void 0 : _c.call(_b)) == null ? void 0 : _d.getPackageJsonInfoCache(), host, compilationSettings), setExternalModuleIndicator: getSetExternalModuleIndicator(compilationSettings) }; sourceFileOptions.languageVersion = scriptTarget; @@ -130926,7 +132000,7 @@ ${lanes.join("\n")} const allFiles = program.getSourceFiles(); for (const sourceFile of allFiles) { const newFromOld = oldToNew(sourceFile.fileName); - const newImportFromPath = newFromOld != null ? newFromOld : sourceFile.fileName; + const newImportFromPath = newFromOld ?? sourceFile.fileName; const newImportFromDirectory = getDirectoryPath(newImportFromPath); const oldFromNew = newToOld(sourceFile.fileName); const oldImportFromPath = oldFromNew || sourceFile.fileName; @@ -130964,14 +132038,14 @@ ${lanes.join("\n")} return ensurePathIsNonModuleName(combineNormal(pathA, pathB)); } function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSourceFile, program, host, oldToNew) { - var _a2; + var _a; if (importedModuleSymbol) { const oldFileName = find(importedModuleSymbol.declarations, isSourceFile).fileName; const newFileName = oldToNew(oldFileName); return newFileName === void 0 ? { newFileName: oldFileName, updated: false } : { newFileName, updated: true }; } else { const mode = getModeForUsageLocation(importingSourceFile, importLiteral); - const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? (_a2 = importingSourceFile.resolvedModules) == null ? void 0 : _a2.get(importLiteral.text, mode) : host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode); + const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? (_a = importingSourceFile.resolvedModules) == null ? void 0 : _a.get(importLiteral.text, mode) : host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode); return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles()); } } @@ -131087,7 +132161,7 @@ ${lanes.join("\n")} candidate, span, chunk.text, - /*ignoreCase:*/ + /*ignoreCase*/ true )) { return createPatternMatch( @@ -131097,7 +132171,7 @@ ${lanes.join("\n")} candidate, span, chunk.text, - /*ignoreCase:*/ + /*ignoreCase*/ false ) ); @@ -131106,7 +132180,7 @@ ${lanes.join("\n")} if (chunk.text.length < candidate.length && isUpperCaseLetter(candidate.charCodeAt(index))) { return createPatternMatch( 2 /* substring */, - /*isCaseSensitive:*/ + /*isCaseSensitive*/ false ); } @@ -131114,7 +132188,7 @@ ${lanes.join("\n")} if (candidate.indexOf(chunk.text) > 0) { return createPatternMatch( 2 /* substring */, - /*isCaseSensitive:*/ + /*isCaseSensitive*/ true ); } @@ -131124,13 +132198,13 @@ ${lanes.join("\n")} candidate, candidateParts, chunk, - /*ignoreCase:*/ + /*ignoreCase*/ false ) ? true : tryCamelCaseMatch( candidate, candidateParts, chunk, - /*ignoreCase:*/ + /*ignoreCase*/ true ) ? false : void 0; if (isCaseSensitive !== void 0) { @@ -131284,14 +132358,14 @@ ${lanes.join("\n")} function breakIntoCharacterSpans(identifier) { return breakIntoSpans( identifier, - /*word:*/ + /*word*/ false ); } function breakIntoWordSpans(identifier) { return breakIntoSpans( identifier, - /*word:*/ + /*word*/ true ); } @@ -131404,16 +132478,16 @@ ${lanes.join("\n")} function nextToken() { lastToken = currentToken; currentToken = scanner.scan(); - if (currentToken === 18 /* OpenBraceToken */) { + if (currentToken === 19 /* OpenBraceToken */) { braceNesting++; - } else if (currentToken === 19 /* CloseBraceToken */) { + } else if (currentToken === 20 /* CloseBraceToken */) { braceNesting--; } return currentToken; } function getFileReference() { const fileName = scanner.getTokenValue(); - const pos = scanner.getTokenPos(); + const pos = scanner.getTokenStart(); return { fileName, pos, end: pos + fileName.length }; } function recordAmbientExternalModule() { @@ -131433,11 +132507,11 @@ ${lanes.join("\n")} } function tryConsumeDeclare() { let token = scanner.getToken(); - if (token === 136 /* DeclareKeyword */) { + if (token === 138 /* DeclareKeyword */) { token = nextToken(); - if (token === 142 /* ModuleKeyword */) { + if (token === 144 /* ModuleKeyword */) { token = nextToken(); - if (token === 10 /* StringLiteral */) { + if (token === 11 /* StringLiteral */) { recordAmbientExternalModule(); } } @@ -131446,75 +132520,75 @@ ${lanes.join("\n")} return false; } function tryConsumeImport() { - if (lastToken === 24 /* DotToken */) { + if (lastToken === 25 /* DotToken */) { return false; } let token = scanner.getToken(); - if (token === 100 /* ImportKeyword */) { + if (token === 102 /* ImportKeyword */) { token = nextToken(); - if (token === 20 /* OpenParenToken */) { + if (token === 21 /* OpenParenToken */) { token = nextToken(); - if (token === 10 /* StringLiteral */ || token === 14 /* NoSubstitutionTemplateLiteral */) { + if (token === 11 /* StringLiteral */ || token === 15 /* NoSubstitutionTemplateLiteral */) { recordModuleName(); return true; } - } else if (token === 10 /* StringLiteral */) { + } else if (token === 11 /* StringLiteral */) { recordModuleName(); return true; } else { - if (token === 154 /* TypeKeyword */) { + if (token === 156 /* TypeKeyword */) { const skipTypeKeyword = scanner.lookAhead(() => { const token2 = scanner.scan(); - return token2 !== 158 /* FromKeyword */ && (token2 === 41 /* AsteriskToken */ || token2 === 18 /* OpenBraceToken */ || token2 === 79 /* Identifier */ || isKeyword(token2)); + return token2 !== 160 /* FromKeyword */ && (token2 === 42 /* AsteriskToken */ || token2 === 19 /* OpenBraceToken */ || token2 === 80 /* Identifier */ || isKeyword(token2)); }); if (skipTypeKeyword) { token = nextToken(); } } - if (token === 79 /* Identifier */ || isKeyword(token)) { + if (token === 80 /* Identifier */ || isKeyword(token)) { token = nextToken(); - if (token === 158 /* FromKeyword */) { + if (token === 160 /* FromKeyword */) { token = nextToken(); - if (token === 10 /* StringLiteral */) { + if (token === 11 /* StringLiteral */) { recordModuleName(); return true; } - } else if (token === 63 /* EqualsToken */) { + } else if (token === 64 /* EqualsToken */) { if (tryConsumeRequireCall( /*skipCurrentToken*/ true )) { return true; } - } else if (token === 27 /* CommaToken */) { + } else if (token === 28 /* CommaToken */) { token = nextToken(); } else { return true; } } - if (token === 18 /* OpenBraceToken */) { + if (token === 19 /* OpenBraceToken */) { token = nextToken(); - while (token !== 19 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { + while (token !== 20 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { token = nextToken(); } - if (token === 19 /* CloseBraceToken */) { + if (token === 20 /* CloseBraceToken */) { token = nextToken(); - if (token === 158 /* FromKeyword */) { + if (token === 160 /* FromKeyword */) { token = nextToken(); - if (token === 10 /* StringLiteral */) { + if (token === 11 /* StringLiteral */) { recordModuleName(); } } } - } else if (token === 41 /* AsteriskToken */) { + } else if (token === 42 /* AsteriskToken */) { token = nextToken(); - if (token === 128 /* AsKeyword */) { + if (token === 130 /* AsKeyword */) { token = nextToken(); - if (token === 79 /* Identifier */ || isKeyword(token)) { + if (token === 80 /* Identifier */ || isKeyword(token)) { token = nextToken(); - if (token === 158 /* FromKeyword */) { + if (token === 160 /* FromKeyword */) { token = nextToken(); - if (token === 10 /* StringLiteral */) { + if (token === 11 /* StringLiteral */) { recordModuleName(); } } @@ -131528,54 +132602,54 @@ ${lanes.join("\n")} } function tryConsumeExport() { let token = scanner.getToken(); - if (token === 93 /* ExportKeyword */) { + if (token === 95 /* ExportKeyword */) { markAsExternalModuleIfTopLevel(); token = nextToken(); - if (token === 154 /* TypeKeyword */) { + if (token === 156 /* TypeKeyword */) { const skipTypeKeyword = scanner.lookAhead(() => { const token2 = scanner.scan(); - return token2 === 41 /* AsteriskToken */ || token2 === 18 /* OpenBraceToken */; + return token2 === 42 /* AsteriskToken */ || token2 === 19 /* OpenBraceToken */; }); if (skipTypeKeyword) { token = nextToken(); } } - if (token === 18 /* OpenBraceToken */) { + if (token === 19 /* OpenBraceToken */) { token = nextToken(); - while (token !== 19 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { + while (token !== 20 /* CloseBraceToken */ && token !== 1 /* EndOfFileToken */) { token = nextToken(); } - if (token === 19 /* CloseBraceToken */) { + if (token === 20 /* CloseBraceToken */) { token = nextToken(); - if (token === 158 /* FromKeyword */) { + if (token === 160 /* FromKeyword */) { token = nextToken(); - if (token === 10 /* StringLiteral */) { + if (token === 11 /* StringLiteral */) { recordModuleName(); } } } - } else if (token === 41 /* AsteriskToken */) { + } else if (token === 42 /* AsteriskToken */) { token = nextToken(); - if (token === 158 /* FromKeyword */) { + if (token === 160 /* FromKeyword */) { token = nextToken(); - if (token === 10 /* StringLiteral */) { + if (token === 11 /* StringLiteral */) { recordModuleName(); } } - } else if (token === 100 /* ImportKeyword */) { + } else if (token === 102 /* ImportKeyword */) { token = nextToken(); - if (token === 154 /* TypeKeyword */) { + if (token === 156 /* TypeKeyword */) { const skipTypeKeyword = scanner.lookAhead(() => { const token2 = scanner.scan(); - return token2 === 79 /* Identifier */ || isKeyword(token2); + return token2 === 80 /* Identifier */ || isKeyword(token2); }); if (skipTypeKeyword) { token = nextToken(); } } - if (token === 79 /* Identifier */ || isKeyword(token)) { + if (token === 80 /* Identifier */ || isKeyword(token)) { token = nextToken(); - if (token === 63 /* EqualsToken */) { + if (token === 64 /* EqualsToken */) { if (tryConsumeRequireCall( /*skipCurrentToken*/ true @@ -131591,11 +132665,11 @@ ${lanes.join("\n")} } function tryConsumeRequireCall(skipCurrentToken, allowTemplateLiterals = false) { let token = skipCurrentToken ? nextToken() : scanner.getToken(); - if (token === 147 /* RequireKeyword */) { + if (token === 149 /* RequireKeyword */) { token = nextToken(); - if (token === 20 /* OpenParenToken */) { + if (token === 21 /* OpenParenToken */) { token = nextToken(); - if (token === 10 /* StringLiteral */ || allowTemplateLiterals && token === 14 /* NoSubstitutionTemplateLiteral */) { + if (token === 11 /* StringLiteral */ || allowTemplateLiterals && token === 15 /* NoSubstitutionTemplateLiteral */) { recordModuleName(); } } @@ -131605,26 +132679,26 @@ ${lanes.join("\n")} } function tryConsumeDefine() { let token = scanner.getToken(); - if (token === 79 /* Identifier */ && scanner.getTokenValue() === "define") { + if (token === 80 /* Identifier */ && scanner.getTokenValue() === "define") { token = nextToken(); - if (token !== 20 /* OpenParenToken */) { + if (token !== 21 /* OpenParenToken */) { return true; } token = nextToken(); - if (token === 10 /* StringLiteral */ || token === 14 /* NoSubstitutionTemplateLiteral */) { + if (token === 11 /* StringLiteral */ || token === 15 /* NoSubstitutionTemplateLiteral */) { token = nextToken(); - if (token === 27 /* CommaToken */) { + if (token === 28 /* CommaToken */) { token = nextToken(); } else { return true; } } - if (token !== 22 /* OpenBracketToken */) { + if (token !== 23 /* OpenBracketToken */) { return true; } token = nextToken(); - while (token !== 23 /* CloseBracketToken */ && token !== 1 /* EndOfFileToken */) { - if (token === 10 /* StringLiteral */ || token === 14 /* NoSubstitutionTemplateLiteral */) { + while (token !== 24 /* CloseBracketToken */ && token !== 1 /* EndOfFileToken */) { + if (token === 11 /* StringLiteral */ || token === 15 /* NoSubstitutionTemplateLiteral */) { recordModuleName(); } token = nextToken(); @@ -131640,7 +132714,7 @@ ${lanes.join("\n")} if (scanner.getToken() === 1 /* EndOfFileToken */) { break; } - if (scanner.getToken() === 15 /* TemplateHead */) { + if (scanner.getToken() === 16 /* TemplateHead */) { const stack = [scanner.getToken()]; loop: while (length(stack)) { @@ -131648,24 +132722,24 @@ ${lanes.join("\n")} switch (token) { case 1 /* EndOfFileToken */: break loop; - case 100 /* ImportKeyword */: + case 102 /* ImportKeyword */: tryConsumeImport(); break; - case 15 /* TemplateHead */: + case 16 /* TemplateHead */: stack.push(token); break; - case 18 /* OpenBraceToken */: + case 19 /* OpenBraceToken */: if (length(stack)) { stack.push(token); } break; - case 19 /* CloseBraceToken */: + case 20 /* CloseBraceToken */: if (length(stack)) { - if (lastOrUndefined(stack) === 15 /* TemplateHead */) { + if (lastOrUndefined(stack) === 16 /* TemplateHead */) { if (scanner.reScanTemplateToken( - /* isTaggedTemplate */ + /*isTaggedTemplate*/ false - ) === 17 /* TemplateTail */) { + ) === 18 /* TemplateTail */) { stack.pop(); } } else { @@ -131870,7 +132944,6 @@ ${lanes.join("\n")} "src/services/sourcemaps.ts"() { "use strict"; init_ts4(); - init_ts4(); base64UrlRegExp = /^data:(?:application\/json(?:;charset=[uU][tT][fF]-8);base64,([A-Za-z0-9+\/=]+)$)?/; } }); @@ -131913,12 +132986,16 @@ ${lanes.join("\n")} const init = node.declarationList.declarations[0].initializer; if (init && isRequireCall( init, - /*checkArgumentIsStringLiteralLike*/ + /*requireStringLiteralLikeArgument*/ true )) { diags.push(createDiagnosticForNode(init, Diagnostics.require_call_may_be_converted_to_an_import)); } } + const jsdocTypedefNode = ts_codefix_exports.getJSDocTypedefNode(node); + if (jsdocTypedefNode) { + diags.push(createDiagnosticForNode(jsdocTypedefNode, Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type)); + } if (ts_codefix_exports.parameterShouldGetTypeFromJSDoc(node)) { diags.push(createDiagnosticForNode(node.name || node, Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types)); } @@ -131932,18 +133009,18 @@ ${lanes.join("\n")} function containsTopLevelCommonjs(sourceFile) { return sourceFile.statements.some((statement) => { switch (statement.kind) { - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: return statement.declarationList.declarations.some((decl) => !!decl.initializer && isRequireCall( propertyAccessLeftHandSide(decl.initializer), - /*checkArgumentIsStringLiteralLike*/ + /*requireStringLiteralLikeArgument*/ true )); - case 241 /* ExpressionStatement */: { + case 243 /* ExpressionStatement */: { const { expression } = statement; if (!isBinaryExpression(expression)) return isRequireCall( expression, - /*checkArgumentIsStringLiteralLike*/ + /*requireStringLiteralLikeArgument*/ true ); const kind = getAssignmentDeclarationKind(expression); @@ -131959,10 +133036,10 @@ ${lanes.join("\n")} } function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 269 /* ImportDeclaration */: + case 271 /* ImportDeclaration */: const { importClause, moduleSpecifier } = node; - return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 271 /* NamespaceImport */ && isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : void 0; - case 268 /* ImportEqualsDeclaration */: + return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 273 /* NamespaceImport */ && isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : void 0; + case 270 /* ImportEqualsDeclaration */: return node.name; default: return void 0; @@ -132021,23 +133098,23 @@ ${lanes.join("\n")} if (node.arguments.length < maxArguments) return true; return maxArguments === 1 || some(node.arguments, (arg) => { - return arg.kind === 104 /* NullKeyword */ || isIdentifier(arg) && arg.text === "undefined"; + return arg.kind === 106 /* NullKeyword */ || isIdentifier(arg) && arg.text === "undefined"; }); } function isFixablePromiseArgument(arg, checker) { switch (arg.kind) { - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: const functionFlags = getFunctionFlags(arg); if (functionFlags & 1 /* Generator */) { return false; } - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true); - case 104 /* NullKeyword */: + case 106 /* NullKeyword */: return true; - case 79 /* Identifier */: - case 208 /* PropertyAccessExpression */: { + case 80 /* Identifier */: + case 210 /* PropertyAccessExpression */: { const symbol = checker.getSymbolAtLocation(arg); if (!symbol) { return false; @@ -132052,9 +133129,9 @@ ${lanes.join("\n")} return `${exp.pos.toString()}:${exp.end.toString()}`; } function canBeConvertedToClass(node, checker) { - var _a2, _b, _c, _d; + var _a, _b, _c, _d; if (isFunctionExpression(node)) { - if (isVariableDeclaration(node.parent) && ((_a2 = node.symbol.members) == null ? void 0 : _a2.size)) { + if (isVariableDeclaration(node.parent) && ((_a = node.symbol.members) == null ? void 0 : _a.size)) { return true; } const symbol = checker.getSymbolOfExpando( @@ -132071,10 +133148,10 @@ ${lanes.join("\n")} } function canBeConvertedToAsync(node) { switch (node.kind) { - case 259 /* FunctionDeclaration */: - case 171 /* MethodDeclaration */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 261 /* FunctionDeclaration */: + case 173 /* MethodDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: return true; default: return false; @@ -132137,7 +133214,7 @@ ${lanes.join("\n")} languageVersion: getEmitScriptTarget(options), impliedNodeFormat: getImpliedNodeFormatForFile( toPath(inputFileName, "", compilerHost.getCanonicalFileName), - /*cache*/ + /*packageJsonInfoCache*/ void 0, compilerHost, options @@ -132257,9 +133334,9 @@ ${lanes.join("\n")} } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 270 /* ImportClause */: - case 273 /* ImportSpecifier */: - case 268 /* ImportEqualsDeclaration */: + case 272 /* ImportClause */: + case 275 /* ImportSpecifier */: + case 270 /* ImportEqualsDeclaration */: const importer = checker.getSymbolAtLocation(declaration.name); const imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -132269,7 +133346,7 @@ ${lanes.join("\n")} } function tryAddSingleDeclarationName(declaration, containers) { const name = getNameOfDeclaration(declaration); - return !!name && (pushLiteral(name, containers) || name.kind === 164 /* ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); + return !!name && (pushLiteral(name, containers) || name.kind === 166 /* ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); } function tryAddComputedPropertyName(expression, containers) { return pushLiteral(expression, containers) || isPropertyAccessExpression(expression) && (containers.push(expression.name.text), true) && tryAddComputedPropertyName(expression.expression, containers); @@ -132280,7 +133357,7 @@ ${lanes.join("\n")} function getContainers(declaration) { const containers = []; const name = getNameOfDeclaration(declaration); - if (name && name.kind === 164 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { + if (name && name.kind === 166 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { return emptyArray; } containers.shift(); @@ -132453,7 +133530,7 @@ ${lanes.join("\n")} } } function hasNavigationBarName(node) { - return !hasDynamicName(node) || node.kind !== 223 /* BinaryExpression */ && isPropertyAccessExpression(node.name.expression) && isIdentifier(node.name.expression.expression) && idText(node.name.expression.expression) === "Symbol"; + return !hasDynamicName(node) || node.kind !== 225 /* BinaryExpression */ && isPropertyAccessExpression(node.name.expression) && isIdentifier(node.name.expression.expression) && idText(node.name.expression.expression) === "Symbol"; } function addChildrenRecursively(node) { curCancellationToken.throwIfCancellationRequested(); @@ -132461,7 +133538,7 @@ ${lanes.join("\n")} return; } switch (node.kind) { - case 173 /* Constructor */: + case 175 /* Constructor */: const ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); for (const param of ctr.parameters) { @@ -132470,32 +133547,32 @@ ${lanes.join("\n")} } } break; - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 170 /* MethodSignature */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 172 /* MethodSignature */: if (hasNavigationBarName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: if (hasNavigationBarName(node)) { addNodeWithRecursiveInitializer(node); } break; - case 168 /* PropertySignature */: + case 170 /* PropertySignature */: if (hasNavigationBarName(node)) { addLeafNode(node); } break; - case 270 /* ImportClause */: + case 272 /* ImportClause */: const importClause = node; if (importClause.name) { addLeafNode(importClause.name); } const { namedBindings } = importClause; if (namedBindings) { - if (namedBindings.kind === 271 /* NamespaceImport */) { + if (namedBindings.kind === 273 /* NamespaceImport */) { addLeafNode(namedBindings); } else { for (const element of namedBindings.elements) { @@ -132504,16 +133581,16 @@ ${lanes.join("\n")} } } break; - case 300 /* ShorthandPropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: addNodeWithRecursiveChild(node, node.name); break; - case 301 /* SpreadAssignment */: + case 304 /* SpreadAssignment */: const { expression } = node; isIdentifier(expression) ? addLeafNode(node, expression) : addLeafNode(node); break; - case 205 /* BindingElement */: - case 299 /* PropertyAssignment */: - case 257 /* VariableDeclaration */: { + case 207 /* BindingElement */: + case 302 /* PropertyAssignment */: + case 259 /* VariableDeclaration */: { const child = node; if (isBindingPattern(child.name)) { addChildrenRecursively(child.name); @@ -132522,18 +133599,18 @@ ${lanes.join("\n")} } break; } - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: const nameNode = node.name; if (nameNode && isIdentifier(nameNode)) { addTrackedEs5Class(nameNode.text); } addNodeWithRecursiveChild(node, node.body); break; - case 216 /* ArrowFunction */: - case 215 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 217 /* FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 263 /* EnumDeclaration */: + case 265 /* EnumDeclaration */: startNode(node); for (const member of node.members) { if (!isComputedProperty(member)) { @@ -132542,19 +133619,19 @@ ${lanes.join("\n")} } endNode(); break; - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 261 /* InterfaceDeclaration */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 263 /* InterfaceDeclaration */: startNode(node); for (const member of node.members) { addChildrenRecursively(member); } endNode(); break; - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 274 /* ExportAssignment */: { + case 276 /* ExportAssignment */: { const expression2 = node.expression; const child = isObjectLiteralExpression(expression2) || isCallExpression(expression2) ? expression2 : isArrowFunction(expression2) || isFunctionExpression(expression2) ? expression2.body : void 0; if (child) { @@ -132566,16 +133643,16 @@ ${lanes.join("\n")} } break; } - case 278 /* ExportSpecifier */: - case 268 /* ImportEqualsDeclaration */: - case 178 /* IndexSignature */: - case 176 /* CallSignature */: - case 177 /* ConstructSignature */: - case 262 /* TypeAliasDeclaration */: + case 280 /* ExportSpecifier */: + case 270 /* ImportEqualsDeclaration */: + case 180 /* IndexSignature */: + case 178 /* CallSignature */: + case 179 /* ConstructSignature */: + case 264 /* TypeAliasDeclaration */: addLeafNode(node); break; - case 210 /* CallExpression */: - case 223 /* BinaryExpression */: { + case 212 /* CallExpression */: + case 225 /* BinaryExpression */: { const special = getAssignmentDeclarationKind(node); switch (special) { case 1 /* ExportsProperty */: @@ -132712,10 +133789,10 @@ ${lanes.join("\n")} if (ctorFunction !== void 0) { const ctorNode = setTextRange( factory.createConstructorDeclaration( - /* modifiers */ + /*modifiers*/ void 0, [], - /* body */ + /*body*/ void 0 ), ctorFunction @@ -132734,12 +133811,12 @@ ${lanes.join("\n")} } } lastANode = a.node = setTextRange(factory.createClassDeclaration( - /* modifiers */ + /*modifiers*/ void 0, a.name || factory.createIdentifier("__class__"), - /* typeParameters */ + /*typeParameters*/ void 0, - /* heritageClauses */ + /*heritageClauses*/ void 0, [] ), a.node); @@ -132756,12 +133833,12 @@ ${lanes.join("\n")} if (!a.additionalNodes) a.additionalNodes = []; a.additionalNodes.push(setTextRange(factory.createClassDeclaration( - /* modifiers */ + /*modifiers*/ void 0, a.name || factory.createIdentifier("__class__"), - /* typeParameters */ + /*typeParameters*/ void 0, - /* heritageClauses */ + /*heritageClauses*/ void 0, [] ), b.node)); @@ -132785,12 +133862,12 @@ ${lanes.join("\n")} return false; } switch (a.kind) { - case 169 /* PropertyDeclaration */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 171 /* PropertyDeclaration */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return isStatic(a) === isStatic(b); - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: return areSameModule(a, b) && getFullyQualifiedModuleName(a) === getFullyQualifiedModuleName(b); default: return true; @@ -132807,7 +133884,7 @@ ${lanes.join("\n")} if (!a.body || !b.body) { return a.body === b.body; } - return a.body.kind === b.body.kind && (a.body.kind !== 264 /* ModuleDeclaration */ || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 266 /* ModuleDeclaration */ || areSameModule(a.body, b.body)); } function merge(target, source) { target.additionalNodes = target.additionalNodes || []; @@ -132828,7 +133905,7 @@ ${lanes.join("\n")} return compareStringsCaseSensitiveUI(tryGetName(child1.node), tryGetName(child2.node)) || compareValues(navigationBarNodeKind(child1), navigationBarNodeKind(child2)); } function tryGetName(node) { - if (node.kind === 264 /* ModuleDeclaration */) { + if (node.kind === 266 /* ModuleDeclaration */) { return getModuleName(node); } const declName = getNameOfDeclaration(node); @@ -132837,16 +133914,16 @@ ${lanes.join("\n")} return propertyName && unescapeLeadingUnderscores(propertyName); } switch (node.kind) { - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 228 /* ClassExpression */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 230 /* ClassExpression */: return getFunctionOrClassName(node); default: return void 0; } } function getItemName(node, name) { - if (node.kind === 264 /* ModuleDeclaration */) { + if (node.kind === 266 /* ModuleDeclaration */) { return cleanText(getModuleName(node)); } if (name) { @@ -132856,27 +133933,27 @@ ${lanes.join("\n")} } } switch (node.kind) { - case 308 /* SourceFile */: + case 311 /* SourceFile */: const sourceFile = node; return isExternalModule(sourceFile) ? `"${escapeString(getBaseFileName(removeFileExtension(normalizePath(sourceFile.fileName))))}"` : ""; - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: return isExportAssignment(node) && node.isExportEquals ? "export=" /* ExportEquals */ : "default" /* Default */; - case 216 /* ArrowFunction */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: + case 218 /* ArrowFunction */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: if (getSyntacticModifierFlags(node) & 1024 /* Default */) { return "default"; } return getFunctionOrClassName(node); - case 173 /* Constructor */: + case 175 /* Constructor */: return "constructor"; - case 177 /* ConstructSignature */: + case 179 /* ConstructSignature */: return "new()"; - case 176 /* CallSignature */: + case 178 /* CallSignature */: return "()"; - case 178 /* IndexSignature */: + case 180 /* IndexSignature */: return "[]"; default: return ""; @@ -132901,19 +133978,19 @@ ${lanes.join("\n")} return true; } switch (navigationBarNodeKind(item)) { - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 263 /* EnumDeclaration */: - case 261 /* InterfaceDeclaration */: - case 264 /* ModuleDeclaration */: - case 308 /* SourceFile */: - case 262 /* TypeAliasDeclaration */: - case 349 /* JSDocTypedefTag */: - case 341 /* JSDocCallbackTag */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 265 /* EnumDeclaration */: + case 263 /* InterfaceDeclaration */: + case 266 /* ModuleDeclaration */: + case 311 /* SourceFile */: + case 264 /* TypeAliasDeclaration */: + case 352 /* JSDocTypedefTag */: + case 344 /* JSDocCallbackTag */: return true; - case 216 /* ArrowFunction */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -132923,10 +134000,10 @@ ${lanes.join("\n")} return false; } switch (navigationBarNodeKind(item2.parent)) { - case 265 /* ModuleBlock */: - case 308 /* SourceFile */: - case 171 /* MethodDeclaration */: - case 173 /* Constructor */: + case 267 /* ModuleBlock */: + case 311 /* SourceFile */: + case 173 /* MethodDeclaration */: + case 175 /* Constructor */: return true; default: return false; @@ -132985,7 +134062,7 @@ ${lanes.join("\n")} } function getFullyQualifiedModuleName(moduleDeclaration) { const result = [getTextOfIdentifierOrLiteral(moduleDeclaration.name)]; - while (moduleDeclaration.body && moduleDeclaration.body.kind === 264 /* ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 266 /* ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } @@ -132995,13 +134072,13 @@ ${lanes.join("\n")} return decl.body && isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 164 /* ComputedPropertyName */; + return !member.name || member.name.kind === 166 /* ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 308 /* SourceFile */ ? createTextSpanFromRange(node) : createTextSpanFromNode(node, curSourceFile); + return node.kind === 311 /* SourceFile */ ? createTextSpanFromRange(node) : createTextSpanFromNode(node, curSourceFile); } function getModifiers2(node) { - if (node.parent && node.parent.kind === 257 /* VariableDeclaration */) { + if (node.parent && node.parent.kind === 259 /* VariableDeclaration */) { node = node.parent; } return getNodeModifiers(node); @@ -133012,7 +134089,7 @@ ${lanes.join("\n")} return cleanText(declarationNameToString(node.name)); } else if (isVariableDeclaration(parent2)) { return cleanText(declarationNameToString(parent2.name)); - } else if (isBinaryExpression(parent2) && parent2.operatorToken.kind === 63 /* EqualsToken */) { + } else if (isBinaryExpression(parent2) && parent2.operatorToken.kind === 64 /* EqualsToken */) { return nodeText(parent2.left).replace(whiteSpaceRegex, ""); } else if (isPropertyAssignment(parent2)) { return nodeText(parent2.name); @@ -133046,9 +134123,9 @@ ${lanes.join("\n")} } function isFunctionOrClassExpression(node) { switch (node.kind) { - case 216 /* ArrowFunction */: - case 215 /* FunctionExpression */: - case 228 /* ClassExpression */: + case 218 /* ArrowFunction */: + case 217 /* FunctionExpression */: + case 230 /* ClassExpression */: return true; default: return false; @@ -133096,9 +134173,5541 @@ ${lanes.join("\n")} } }); + // src/services/refactorProvider.ts + function registerRefactor(name, refactor) { + refactors.set(name, refactor); + } + function getApplicableRefactors(context, includeInteractiveActions) { + return arrayFrom(flatMapIterator(refactors.values(), (refactor) => { + var _a; + return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a = refactor.kinds) == null ? void 0 : _a.some((kind) => refactorKindBeginsWith(kind, context.kind))) ? void 0 : refactor.getAvailableActions(context, includeInteractiveActions); + })); + } + function getEditsForRefactor(context, refactorName13, actionName2, interactiveRefactorArguments) { + const refactor = refactors.get(refactorName13); + return refactor && refactor.getEditsForAction(context, actionName2, interactiveRefactorArguments); + } + var refactors; + var init_refactorProvider = __esm({ + "src/services/refactorProvider.ts"() { + "use strict"; + init_ts4(); + init_ts_refactor(); + refactors = /* @__PURE__ */ new Map(); + } + }); + + // src/services/refactors/convertExport.ts + function getInfo2(context, considerPartialSpans = true) { + const { file, program } = context; + const span = getRefactorContextSpan(context); + const token = getTokenAtPosition(file, span.start); + const exportNode = !!(token.parent && getSyntacticModifierFlags(token.parent) & 1 /* Export */) && considerPartialSpans ? token.parent : getParentNodeInSpan(token, file, span); + if (!exportNode || !isSourceFile(exportNode.parent) && !(isModuleBlock(exportNode.parent) && isAmbientModule(exportNode.parent.parent))) { + return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_export_statement) }; + } + const checker = program.getTypeChecker(); + const exportingModuleSymbol = getExportingModuleSymbol(exportNode.parent, checker); + const flags = getSyntacticModifierFlags(exportNode) || (isExportAssignment(exportNode) && !exportNode.isExportEquals ? 1025 /* ExportDefault */ : 0 /* None */); + const wasDefault = !!(flags & 1024 /* Default */); + if (!(flags & 1 /* Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* Default */)) { + return { error: getLocaleSpecificMessage(Diagnostics.This_file_already_has_a_default_export) }; + } + const noSymbolError = (id) => isIdentifier(id) && checker.getSymbolAtLocation(id) ? void 0 : { error: getLocaleSpecificMessage(Diagnostics.Can_only_convert_named_export) }; + switch (exportNode.kind) { + case 261 /* FunctionDeclaration */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: + case 265 /* EnumDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 266 /* ModuleDeclaration */: { + const node = exportNode; + if (!node.name) + return void 0; + return noSymbolError(node.name) || { exportNode: node, exportName: node.name, wasDefault, exportingModuleSymbol }; + } + case 242 /* VariableStatement */: { + const vs = exportNode; + if (!(vs.declarationList.flags & 2 /* Const */) || vs.declarationList.declarations.length !== 1) { + return void 0; + } + const decl = first(vs.declarationList.declarations); + if (!decl.initializer) + return void 0; + Debug.assert(!wasDefault, "Can't have a default flag here"); + return noSymbolError(decl.name) || { exportNode: vs, exportName: decl.name, wasDefault, exportingModuleSymbol }; + } + case 276 /* ExportAssignment */: { + const node = exportNode; + if (node.isExportEquals) + return void 0; + return noSymbolError(node.expression) || { exportNode: node, exportName: node.expression, wasDefault, exportingModuleSymbol }; + } + default: + return void 0; + } + } + function doChange(exportingSourceFile, program, info, changes, cancellationToken) { + changeExport(exportingSourceFile, info, changes, program.getTypeChecker()); + changeImports(program, info, changes, cancellationToken); + } + function changeExport(exportingSourceFile, { wasDefault, exportNode, exportName }, changes, checker) { + if (wasDefault) { + if (isExportAssignment(exportNode) && !exportNode.isExportEquals) { + const exp = exportNode.expression; + const spec = makeExportSpecifier(exp.text, exp.text); + changes.replaceNode(exportingSourceFile, exportNode, factory.createExportDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + factory.createNamedExports([spec]) + )); + } else { + changes.delete(exportingSourceFile, Debug.checkDefined(findModifier(exportNode, 90 /* DefaultKeyword */), "Should find a default keyword in modifier list")); + } + } else { + const exportKeyword = Debug.checkDefined(findModifier(exportNode, 95 /* ExportKeyword */), "Should find an export keyword in modifier list"); + switch (exportNode.kind) { + case 261 /* FunctionDeclaration */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: + changes.insertNodeAfter(exportingSourceFile, exportKeyword, factory.createToken(90 /* DefaultKeyword */)); + break; + case 242 /* VariableStatement */: + const decl = first(exportNode.declarationList.declarations); + if (!ts_FindAllReferences_exports.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile) && !decl.type) { + changes.replaceNode(exportingSourceFile, exportNode, factory.createExportDefault(Debug.checkDefined(decl.initializer, "Initializer was previously known to be present"))); + break; + } + case 265 /* EnumDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 266 /* ModuleDeclaration */: + changes.deleteModifier(exportingSourceFile, exportKeyword); + changes.insertNodeAfter(exportingSourceFile, exportNode, factory.createExportDefault(factory.createIdentifier(exportName.text))); + break; + default: + Debug.fail(`Unexpected exportNode kind ${exportNode.kind}`); + } + } + } + function changeImports(program, { wasDefault, exportName, exportingModuleSymbol }, changes, cancellationToken) { + const checker = program.getTypeChecker(); + const exportSymbol = Debug.checkDefined(checker.getSymbolAtLocation(exportName), "Export name should resolve to a symbol"); + ts_FindAllReferences_exports.Core.eachExportReference(program.getSourceFiles(), checker, cancellationToken, exportSymbol, exportingModuleSymbol, exportName.text, wasDefault, (ref) => { + if (exportName === ref) + return; + const importingSourceFile = ref.getSourceFile(); + if (wasDefault) { + changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName.text); + } else { + changeNamedToDefaultImport(importingSourceFile, ref, changes); + } + }); + } + function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) { + const { parent: parent2 } = ref; + switch (parent2.kind) { + case 210 /* PropertyAccessExpression */: + changes.replaceNode(importingSourceFile, ref, factory.createIdentifier(exportName)); + break; + case 275 /* ImportSpecifier */: + case 280 /* ExportSpecifier */: { + const spec = parent2; + changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text)); + break; + } + case 272 /* ImportClause */: { + const clause = parent2; + Debug.assert(clause.name === ref, "Import clause name should match provided ref"); + const spec = makeImportSpecifier(exportName, ref.text); + const { namedBindings } = clause; + if (!namedBindings) { + changes.replaceNode(importingSourceFile, ref, factory.createNamedImports([spec])); + } else if (namedBindings.kind === 273 /* NamespaceImport */) { + changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) }); + const quotePreference = isStringLiteral(clause.parent.moduleSpecifier) ? quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* Double */; + const newImport = makeImport( + /*defaultImport*/ + void 0, + [makeImportSpecifier(exportName, ref.text)], + clause.parent.moduleSpecifier, + quotePreference + ); + changes.insertNodeAfter(importingSourceFile, clause.parent, newImport); + } else { + changes.delete(importingSourceFile, ref); + changes.insertNodeAtEndOfList(importingSourceFile, namedBindings.elements, spec); + } + break; + } + case 204 /* ImportType */: + const importTypeNode = parent2; + changes.replaceNode(importingSourceFile, parent2, factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); + break; + default: + Debug.failBadSyntaxKind(parent2); + } + } + function changeNamedToDefaultImport(importingSourceFile, ref, changes) { + const parent2 = ref.parent; + switch (parent2.kind) { + case 210 /* PropertyAccessExpression */: + changes.replaceNode(importingSourceFile, ref, factory.createIdentifier("default")); + break; + case 275 /* ImportSpecifier */: { + const defaultImport = factory.createIdentifier(parent2.name.text); + if (parent2.parent.elements.length === 1) { + changes.replaceNode(importingSourceFile, parent2.parent, defaultImport); + } else { + changes.delete(importingSourceFile, parent2); + changes.insertNodeBefore(importingSourceFile, parent2.parent, defaultImport); + } + break; + } + case 280 /* ExportSpecifier */: { + changes.replaceNode(importingSourceFile, parent2, makeExportSpecifier("default", parent2.name.text)); + break; + } + default: + Debug.assertNever(parent2, `Unexpected parent kind ${parent2.kind}`); + } + } + function makeImportSpecifier(propertyName, name) { + return factory.createImportSpecifier( + /*isTypeOnly*/ + false, + propertyName === name ? void 0 : factory.createIdentifier(propertyName), + factory.createIdentifier(name) + ); + } + function makeExportSpecifier(propertyName, name) { + return factory.createExportSpecifier( + /*isTypeOnly*/ + false, + propertyName === name ? void 0 : factory.createIdentifier(propertyName), + factory.createIdentifier(name) + ); + } + function getExportingModuleSymbol(parent2, checker) { + if (isSourceFile(parent2)) { + return parent2.symbol; + } + const symbol = parent2.parent.symbol; + if (symbol.valueDeclaration && isExternalModuleAugmentation(symbol.valueDeclaration)) { + return checker.getMergedSymbol(symbol); + } + return symbol; + } + var refactorName, defaultToNamedAction, namedToDefaultAction; + var init_convertExport = __esm({ + "src/services/refactors/convertExport.ts"() { + "use strict"; + init_ts4(); + init_ts_refactor(); + refactorName = "Convert export"; + defaultToNamedAction = { + name: "Convert default export to named export", + description: Diagnostics.Convert_default_export_to_named_export.message, + kind: "refactor.rewrite.export.named" + }; + namedToDefaultAction = { + name: "Convert named export to default export", + description: Diagnostics.Convert_named_export_to_default_export.message, + kind: "refactor.rewrite.export.default" + }; + registerRefactor(refactorName, { + kinds: [ + defaultToNamedAction.kind, + namedToDefaultAction.kind + ], + getAvailableActions: function getRefactorActionsToConvertBetweenNamedAndDefaultExports(context) { + const info = getInfo2(context, context.triggerReason === "invoked"); + if (!info) + return emptyArray; + if (!isRefactorErrorInfo(info)) { + const action = info.wasDefault ? defaultToNamedAction : namedToDefaultAction; + return [{ name: refactorName, description: action.description, actions: [action] }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return [ + { name: refactorName, description: Diagnostics.Convert_default_export_to_named_export.message, actions: [ + { ...defaultToNamedAction, notApplicableReason: info.error }, + { ...namedToDefaultAction, notApplicableReason: info.error } + ] } + ]; + } + return emptyArray; + }, + getEditsForAction: function getRefactorEditsToConvertBetweenNamedAndDefaultExports(context, actionName2) { + Debug.assert(actionName2 === defaultToNamedAction.name || actionName2 === namedToDefaultAction.name, "Unexpected action name"); + const info = getInfo2(context); + Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange(context.file, context.program, info, t, context.cancellationToken)); + return { edits, renameFilename: void 0, renameLocation: void 0 }; + } + }); + } + }); + + // src/services/refactors/convertImport.ts + function getImportConversionInfo(context, considerPartialSpans = true) { + const { file } = context; + const span = getRefactorContextSpan(context); + const token = getTokenAtPosition(file, span.start); + const importDecl = considerPartialSpans ? findAncestor(token, isImportDeclaration) : getParentNodeInSpan(token, file, span); + if (!importDecl || !isImportDeclaration(importDecl)) + return { error: "Selection is not an import declaration." }; + const end = span.start + span.length; + const nextToken = findNextToken(importDecl, importDecl.parent, file); + if (nextToken && end > nextToken.getStart()) + return void 0; + const { importClause } = importDecl; + if (!importClause) { + return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_import_clause) }; + } + if (!importClause.namedBindings) { + return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_namespace_import_or_named_imports) }; + } + if (importClause.namedBindings.kind === 273 /* NamespaceImport */) { + return { convertTo: 0 /* Named */, import: importClause.namedBindings }; + } + const shouldUseDefault = getShouldUseDefault(context.program, importClause); + return shouldUseDefault ? { convertTo: 1 /* Default */, import: importClause.namedBindings } : { convertTo: 2 /* Namespace */, import: importClause.namedBindings }; + } + function getShouldUseDefault(program, importClause) { + return getAllowSyntheticDefaultImports(program.getCompilerOptions()) && isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker()); + } + function doChange2(sourceFile, program, changes, info) { + const checker = program.getTypeChecker(); + if (info.convertTo === 0 /* Named */) { + doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, getAllowSyntheticDefaultImports(program.getCompilerOptions())); + } else { + doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, info.import, info.convertTo === 1 /* Default */); + } + } + function doChangeNamespaceToNamed(sourceFile, checker, changes, toConvert, allowSyntheticDefaultImports) { + let usedAsNamespaceOrDefault = false; + const nodesToReplace = []; + const conflictingNames = /* @__PURE__ */ new Map(); + ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(toConvert.name, checker, sourceFile, (id) => { + if (!isPropertyAccessOrQualifiedName(id.parent)) { + usedAsNamespaceOrDefault = true; + } else { + const exportName = getRightOfPropertyAccessOrQualifiedName(id.parent).text; + if (checker.resolveName( + exportName, + id, + 67108863 /* All */, + /*excludeGlobals*/ + true + )) { + conflictingNames.set(exportName, true); + } + Debug.assert(getLeftOfPropertyAccessOrQualifiedName(id.parent) === id, "Parent expression should match id"); + nodesToReplace.push(id.parent); + } + }); + const exportNameToImportName = /* @__PURE__ */ new Map(); + for (const propertyAccessOrQualifiedName of nodesToReplace) { + const exportName = getRightOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName).text; + let importName = exportNameToImportName.get(exportName); + if (importName === void 0) { + exportNameToImportName.set(exportName, importName = conflictingNames.has(exportName) ? getUniqueName(exportName, sourceFile) : exportName); + } + changes.replaceNode(sourceFile, propertyAccessOrQualifiedName, factory.createIdentifier(importName)); + } + const importSpecifiers = []; + exportNameToImportName.forEach((name, propertyName) => { + importSpecifiers.push(factory.createImportSpecifier( + /*isTypeOnly*/ + false, + name === propertyName ? void 0 : factory.createIdentifier(propertyName), + factory.createIdentifier(name) + )); + }); + const importDecl = toConvert.parent.parent; + if (usedAsNamespaceOrDefault && !allowSyntheticDefaultImports) { + changes.insertNodeAfter(sourceFile, importDecl, updateImport( + importDecl, + /*defaultImportName*/ + void 0, + importSpecifiers + )); + } else { + changes.replaceNode(sourceFile, importDecl, updateImport(importDecl, usedAsNamespaceOrDefault ? factory.createIdentifier(toConvert.name.text) : void 0, importSpecifiers)); + } + } + function getRightOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) { + return isPropertyAccessExpression(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.name : propertyAccessOrQualifiedName.right; + } + function getLeftOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) { + return isPropertyAccessExpression(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.expression : propertyAccessOrQualifiedName.left; + } + function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConvert, shouldUseDefault = getShouldUseDefault(program, toConvert.parent)) { + const checker = program.getTypeChecker(); + const importDecl = toConvert.parent.parent; + const { moduleSpecifier } = importDecl; + const toConvertSymbols = /* @__PURE__ */ new Set(); + toConvert.elements.forEach((namedImport) => { + const symbol = checker.getSymbolAtLocation(namedImport.name); + if (symbol) { + toConvertSymbols.add(symbol); + } + }); + const preferredName = moduleSpecifier && isStringLiteral(moduleSpecifier) ? ts_codefix_exports.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 99 /* ESNext */) : "module"; + function hasNamespaceNameConflict(namedImport) { + return !!ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(namedImport.name, checker, sourceFile, (id) => { + const symbol = checker.resolveName( + preferredName, + id, + 67108863 /* All */, + /*excludeGlobals*/ + true + ); + if (symbol) { + if (toConvertSymbols.has(symbol)) { + return isExportSpecifier(id.parent); + } + return true; + } + return false; + }); + } + const namespaceNameConflicts = toConvert.elements.some(hasNamespaceNameConflict); + const namespaceImportName = namespaceNameConflicts ? getUniqueName(preferredName, sourceFile) : preferredName; + const neededNamedImports = /* @__PURE__ */ new Set(); + for (const element of toConvert.elements) { + const propertyName = (element.propertyName || element.name).text; + ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, (id) => { + const access = factory.createPropertyAccessExpression(factory.createIdentifier(namespaceImportName), propertyName); + if (isShorthandPropertyAssignment(id.parent)) { + changes.replaceNode(sourceFile, id.parent, factory.createPropertyAssignment(id.text, access)); + } else if (isExportSpecifier(id.parent)) { + neededNamedImports.add(element); + } else { + changes.replaceNode(sourceFile, id, access); + } + }); + } + changes.replaceNode(sourceFile, toConvert, shouldUseDefault ? factory.createIdentifier(namespaceImportName) : factory.createNamespaceImport(factory.createIdentifier(namespaceImportName))); + if (neededNamedImports.size) { + const newNamedImports = arrayFrom(neededNamedImports.values(), (element) => factory.createImportSpecifier(element.isTypeOnly, element.propertyName && factory.createIdentifier(element.propertyName.text), factory.createIdentifier(element.name.text))); + changes.insertNodeAfter(sourceFile, toConvert.parent.parent, updateImport( + importDecl, + /*defaultImportName*/ + void 0, + newNamedImports + )); + } + } + function isExportEqualsModule(moduleSpecifier, checker) { + const externalModule = checker.resolveExternalModuleName(moduleSpecifier); + if (!externalModule) + return false; + const exportEquals = checker.resolveExternalModuleSymbol(externalModule); + return externalModule !== exportEquals; + } + function updateImport(old, defaultImportName, elements) { + return factory.createImportDeclaration( + /*modifiers*/ + void 0, + factory.createImportClause( + /*isTypeOnly*/ + false, + defaultImportName, + elements && elements.length ? factory.createNamedImports(elements) : void 0 + ), + old.moduleSpecifier, + /*assertClause*/ + void 0 + ); + } + var refactorName2, actions; + var init_convertImport = __esm({ + "src/services/refactors/convertImport.ts"() { + "use strict"; + init_ts4(); + init_ts_refactor(); + refactorName2 = "Convert import"; + actions = { + [0 /* Named */]: { + name: "Convert namespace import to named imports", + description: Diagnostics.Convert_namespace_import_to_named_imports.message, + kind: "refactor.rewrite.import.named" + }, + [2 /* Namespace */]: { + name: "Convert named imports to namespace import", + description: Diagnostics.Convert_named_imports_to_namespace_import.message, + kind: "refactor.rewrite.import.namespace" + }, + [1 /* Default */]: { + name: "Convert named imports to default import", + description: Diagnostics.Convert_named_imports_to_default_import.message, + kind: "refactor.rewrite.import.default" + } + }; + registerRefactor(refactorName2, { + kinds: getOwnValues(actions).map((a) => a.kind), + getAvailableActions: function getRefactorActionsToConvertBetweenNamedAndNamespacedImports(context) { + const info = getImportConversionInfo(context, context.triggerReason === "invoked"); + if (!info) + return emptyArray; + if (!isRefactorErrorInfo(info)) { + const action = actions[info.convertTo]; + return [{ name: refactorName2, description: action.description, actions: [action] }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return getOwnValues(actions).map((action) => ({ + name: refactorName2, + description: action.description, + actions: [{ ...action, notApplicableReason: info.error }] + })); + } + return emptyArray; + }, + getEditsForAction: function getRefactorEditsToConvertBetweenNamedAndNamespacedImports(context, actionName2) { + Debug.assert(some(getOwnValues(actions), (action) => action.name === actionName2), "Unexpected action name"); + const info = getImportConversionInfo(context); + Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange2(context.file, context.program, t, info)); + return { edits, renameFilename: void 0, renameLocation: void 0 }; + } + }); + } + }); + + // src/services/refactors/extractType.ts + function getRangeToExtract(context, considerEmptySpans = true) { + const { file, startPosition } = context; + const isJS = isSourceFileJS(file); + const current = getTokenAtPosition(file, startPosition); + const range = createTextRangeFromSpan(getRefactorContextSpan(context)); + const cursorRequest = range.pos === range.end && considerEmptySpans; + const selection = findAncestor(current, (node) => node.parent && isTypeNode(node) && !rangeContainsSkipTrivia(range, node.parent, file) && (cursorRequest || nodeOverlapsWithStartEnd(current, file, range.pos, range.end))); + if (!selection || !isTypeNode(selection)) + return { error: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_type_node) }; + const checker = context.program.getTypeChecker(); + const enclosingNode = getEnclosingNode(selection, isJS); + if (enclosingNode === void 0) + return { error: getLocaleSpecificMessage(Diagnostics.No_type_could_be_extracted_from_this_type_node) }; + const typeParameters = collectTypeParameters(checker, selection, enclosingNode, file); + if (!typeParameters) + return { error: getLocaleSpecificMessage(Diagnostics.No_type_could_be_extracted_from_this_type_node) }; + const typeElements = flattenTypeLiteralNodeReference(checker, selection); + return { isJS, selection, enclosingNode, typeParameters, typeElements }; + } + function flattenTypeLiteralNodeReference(checker, node) { + if (!node) + return void 0; + if (isIntersectionTypeNode(node)) { + const result = []; + const seen = /* @__PURE__ */ new Map(); + for (const type of node.types) { + const flattenedTypeMembers = flattenTypeLiteralNodeReference(checker, type); + if (!flattenedTypeMembers || !flattenedTypeMembers.every((type2) => type2.name && addToSeen(seen, getNameFromPropertyName(type2.name)))) { + return void 0; + } + addRange(result, flattenedTypeMembers); + } + return result; + } else if (isParenthesizedTypeNode(node)) { + return flattenTypeLiteralNodeReference(checker, node.type); + } else if (isTypeLiteralNode(node)) { + return node.members; + } + return void 0; + } + function rangeContainsSkipTrivia(r1, node, file) { + return rangeContainsStartEnd(r1, skipTrivia(file.text, node.pos), node.end); + } + function collectTypeParameters(checker, selection, enclosingNode, file) { + const result = []; + return visitor(selection) ? void 0 : result; + function visitor(node) { + if (isTypeReferenceNode(node)) { + if (isIdentifier(node.typeName)) { + const typeName = node.typeName; + const symbol = checker.resolveName( + typeName.text, + typeName, + 262144 /* TypeParameter */, + /*excludeGlobals*/ + true + ); + for (const decl of (symbol == null ? void 0 : symbol.declarations) || emptyArray) { + if (isTypeParameterDeclaration(decl) && decl.getSourceFile() === file) { + if (decl.name.escapedText === typeName.escapedText && rangeContainsSkipTrivia(decl, selection, file)) { + return true; + } + if (rangeContainsSkipTrivia(enclosingNode, decl, file) && !rangeContainsSkipTrivia(selection, decl, file)) { + pushIfUnique(result, decl); + break; + } + } + } + } + } else if (isInferTypeNode(node)) { + const conditionalTypeNode = findAncestor(node, (n) => isConditionalTypeNode(n) && rangeContainsSkipTrivia(n.extendsType, node, file)); + if (!conditionalTypeNode || !rangeContainsSkipTrivia(selection, conditionalTypeNode, file)) { + return true; + } + } else if (isTypePredicateNode(node) || isThisTypeNode(node)) { + const functionLikeNode = findAncestor(node.parent, isFunctionLike); + if (functionLikeNode && functionLikeNode.type && rangeContainsSkipTrivia(functionLikeNode.type, node, file) && !rangeContainsSkipTrivia(selection, functionLikeNode, file)) { + return true; + } + } else if (isTypeQueryNode(node)) { + if (isIdentifier(node.exprName)) { + const symbol = checker.resolveName( + node.exprName.text, + node.exprName, + 111551 /* Value */, + /*excludeGlobals*/ + false + ); + if ((symbol == null ? void 0 : symbol.valueDeclaration) && rangeContainsSkipTrivia(enclosingNode, symbol.valueDeclaration, file) && !rangeContainsSkipTrivia(selection, symbol.valueDeclaration, file)) { + return true; + } + } else { + if (isThisIdentifier(node.exprName.left) && !rangeContainsSkipTrivia(selection, node.parent, file)) { + return true; + } + } + } + if (file && isTupleTypeNode(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) { + setEmitFlags(node, 1 /* SingleLine */); + } + return forEachChild(node, visitor); + } + } + function doTypeAliasChange(changes, file, name, info) { + const { enclosingNode, selection, typeParameters } = info; + const newTypeNode = factory.createTypeAliasDeclaration( + /*modifiers*/ + void 0, + name, + typeParameters.map((id) => factory.updateTypeParameterDeclaration( + id, + id.modifiers, + id.name, + id.constraint, + /*defaultType*/ + void 0 + )), + selection + ); + changes.insertNodeBefore( + file, + enclosingNode, + ignoreSourceNewlines(newTypeNode), + /*blankLineBetween*/ + true + ); + changes.replaceNode(file, selection, factory.createTypeReferenceNode(name, typeParameters.map((id) => factory.createTypeReferenceNode( + id.name, + /*typeArguments*/ + void 0 + ))), { leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.Exclude, trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.ExcludeWhitespace }); + } + function doInterfaceChange(changes, file, name, info) { + var _a; + const { enclosingNode, selection, typeParameters, typeElements } = info; + const newTypeNode = factory.createInterfaceDeclaration( + /*modifiers*/ + void 0, + name, + typeParameters, + /*heritageClauses*/ + void 0, + typeElements + ); + setTextRange(newTypeNode, (_a = typeElements[0]) == null ? void 0 : _a.parent); + changes.insertNodeBefore( + file, + enclosingNode, + ignoreSourceNewlines(newTypeNode), + /*blankLineBetween*/ + true + ); + changes.replaceNode(file, selection, factory.createTypeReferenceNode(name, typeParameters.map((id) => factory.createTypeReferenceNode( + id.name, + /*typeArguments*/ + void 0 + ))), { leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.Exclude, trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.ExcludeWhitespace }); + } + function doTypedefChange(changes, context, file, name, info) { + var _a; + const { enclosingNode, selection, typeParameters } = info; + setEmitFlags(selection, 3072 /* NoComments */ | 4096 /* NoNestedComments */); + const node = factory.createJSDocTypedefTag( + factory.createIdentifier("typedef"), + factory.createJSDocTypeExpression(selection), + factory.createIdentifier(name) + ); + const templates = []; + forEach(typeParameters, (typeParameter) => { + const constraint = getEffectiveConstraintOfTypeParameter(typeParameter); + const parameter = factory.createTypeParameterDeclaration( + /*modifiers*/ + void 0, + typeParameter.name + ); + const template = factory.createJSDocTemplateTag( + factory.createIdentifier("template"), + constraint && cast(constraint, isJSDocTypeExpression), + [parameter] + ); + templates.push(template); + }); + const jsDoc = factory.createJSDocComment( + /*comment*/ + void 0, + factory.createNodeArray(concatenate(templates, [node])) + ); + if (isJSDoc(enclosingNode)) { + const pos = enclosingNode.getStart(file); + const newLineCharacter = getNewLineOrDefaultFromHost(context.host, (_a = context.formatContext) == null ? void 0 : _a.options); + changes.insertNodeAt(file, enclosingNode.getStart(file), jsDoc, { + suffix: newLineCharacter + newLineCharacter + file.text.slice(getPrecedingNonSpaceCharacterPosition(file.text, pos - 1), pos) + }); + } else { + changes.insertNodeBefore( + file, + enclosingNode, + jsDoc, + /*blankLineBetween*/ + true + ); + } + changes.replaceNode(file, selection, factory.createTypeReferenceNode(name, typeParameters.map((id) => factory.createTypeReferenceNode( + id.name, + /*typeArguments*/ + void 0 + )))); + } + function getEnclosingNode(node, isJS) { + return findAncestor(node, isStatement) || (isJS ? findAncestor(node, isJSDoc) : void 0); + } + var refactorName3, extractToTypeAliasAction, extractToInterfaceAction, extractToTypeDefAction; + var init_extractType = __esm({ + "src/services/refactors/extractType.ts"() { + "use strict"; + init_ts4(); + init_ts_refactor(); + refactorName3 = "Extract type"; + extractToTypeAliasAction = { + name: "Extract to type alias", + description: getLocaleSpecificMessage(Diagnostics.Extract_to_type_alias), + kind: "refactor.extract.type" + }; + extractToInterfaceAction = { + name: "Extract to interface", + description: getLocaleSpecificMessage(Diagnostics.Extract_to_interface), + kind: "refactor.extract.interface" + }; + extractToTypeDefAction = { + name: "Extract to typedef", + description: getLocaleSpecificMessage(Diagnostics.Extract_to_typedef), + kind: "refactor.extract.typedef" + }; + registerRefactor(refactorName3, { + kinds: [ + extractToTypeAliasAction.kind, + extractToInterfaceAction.kind, + extractToTypeDefAction.kind + ], + getAvailableActions: function getRefactorActionsToExtractType(context) { + const info = getRangeToExtract(context, context.triggerReason === "invoked"); + if (!info) + return emptyArray; + if (!isRefactorErrorInfo(info)) { + return [{ + name: refactorName3, + description: getLocaleSpecificMessage(Diagnostics.Extract_type), + actions: info.isJS ? [extractToTypeDefAction] : append([extractToTypeAliasAction], info.typeElements && extractToInterfaceAction) + }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return [{ + name: refactorName3, + description: getLocaleSpecificMessage(Diagnostics.Extract_type), + actions: [ + { ...extractToTypeDefAction, notApplicableReason: info.error }, + { ...extractToTypeAliasAction, notApplicableReason: info.error }, + { ...extractToInterfaceAction, notApplicableReason: info.error } + ] + }]; + } + return emptyArray; + }, + getEditsForAction: function getRefactorEditsToExtractType(context, actionName2) { + const { file } = context; + const info = getRangeToExtract(context); + Debug.assert(info && !isRefactorErrorInfo(info), "Expected to find a range to extract"); + const name = getUniqueName("NewType", file); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (changes) => { + switch (actionName2) { + case extractToTypeAliasAction.name: + Debug.assert(!info.isJS, "Invalid actionName/JS combo"); + return doTypeAliasChange(changes, file, name, info); + case extractToTypeDefAction.name: + Debug.assert(info.isJS, "Invalid actionName/JS combo"); + return doTypedefChange(changes, context, file, name, info); + case extractToInterfaceAction.name: + Debug.assert(!info.isJS && !!info.typeElements, "Invalid actionName/JS combo"); + return doInterfaceChange(changes, file, name, info); + default: + Debug.fail("Unexpected action name"); + } + }); + const renameFilename = file.fileName; + const renameLocation = getRenameLocation( + edits, + renameFilename, + name, + /*preferLastLocation*/ + false + ); + return { edits, renameFilename, renameLocation }; + } + }); + } + }); + + // src/services/refactors/helpers.ts + function isRefactorErrorInfo(info) { + return info.error !== void 0; + } + function refactorKindBeginsWith(known, requested) { + if (!requested) + return true; + return known.substr(0, requested.length) === requested; + } + var init_helpers = __esm({ + "src/services/refactors/helpers.ts"() { + "use strict"; + } + }); + + // src/services/refactors/moveToNewFile.ts + function doChange3(oldFile, program, toMove, changes, host, preferences, context) { + const checker = program.getTypeChecker(); + const usage = getUsageInfo(oldFile, toMove.all, checker); + const newFilename = createNewFileName(oldFile, program, context, host); + changes.createNewFile(oldFile, newFilename, getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, host, newFilename, preferences)); + addNewFileToTsconfig(program, changes, oldFile.fileName, newFilename, hostGetCanonicalFileName(host)); + } + function getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, host, newFilename, preferences) { + const checker = program.getTypeChecker(); + const prologueDirectives = takeWhile(oldFile.statements, isPrologueDirective); + if (oldFile.externalModuleIndicator === void 0 && oldFile.commonJsModuleIndicator === void 0 && usage.oldImportsNeededByTargetFile.size === 0) { + deleteMovedStatements(oldFile, toMove.ranges, changes); + return [...prologueDirectives, ...toMove.all]; + } + const useEsModuleSyntax = !fileShouldUseJavaScriptRequire(newFilename, program, host, !!oldFile.commonJsModuleIndicator); + const quotePreference = getQuotePreference(oldFile, preferences); + const importsFromNewFile = createOldFileImportsFromTargetFile(oldFile, usage.oldFileImportsFromTargetFile, newFilename, program, host, useEsModuleSyntax, quotePreference); + if (importsFromNewFile) { + insertImports( + changes, + oldFile, + importsFromNewFile, + /*blankLineBetween*/ + true, + preferences + ); + } + deleteUnusedOldImports(oldFile, toMove.all, changes, usage.unusedImportsFromOldFile, checker); + deleteMovedStatements(oldFile, toMove.ranges, changes); + updateImportsInOtherFiles(changes, program, host, oldFile, usage.movedSymbols, newFilename, quotePreference); + const imports = getNewFileImportsAndAddExportInOldFile(oldFile, usage.oldImportsNeededByTargetFile, usage.targetFileImportsFromOldFile, changes, checker, program, host, useEsModuleSyntax, quotePreference); + const body = addExports(oldFile, toMove.all, usage.oldFileImportsFromTargetFile, useEsModuleSyntax); + if (imports.length && body.length) { + return [ + ...prologueDirectives, + ...imports, + 4 /* NewLineTrivia */, + ...body + ]; + } + return [ + ...prologueDirectives, + ...imports, + ...body + ]; + } + function getNewFileImportsAndAddExportInOldFile(oldFile, importsToCopy, newFileImportsFromOldFile, changes, checker, program, host, useEsModuleSyntax, quotePreference) { + const copiedOldImports = []; + for (const oldStatement of oldFile.statements) { + forEachImportInStatement(oldStatement, (i) => { + append(copiedOldImports, filterImport(i, moduleSpecifierFromImport(i), (name) => importsToCopy.has(checker.getSymbolAtLocation(name)))); + }); + } + let oldFileDefault; + const oldFileNamedImports = []; + const markSeenTop = nodeSeenTracker(); + newFileImportsFromOldFile.forEach((symbol) => { + if (!symbol.declarations) { + return; + } + for (const decl of symbol.declarations) { + if (!isTopLevelDeclaration(decl)) + continue; + const name = nameOfTopLevelDeclaration(decl); + if (!name) + continue; + const top = getTopLevelDeclarationStatement(decl); + if (markSeenTop(top)) { + addExportToChanges(oldFile, top, name, changes, useEsModuleSyntax); + } + if (hasSyntacticModifier(decl, 1024 /* Default */)) { + oldFileDefault = name; + } else { + oldFileNamedImports.push(name.text); + } + } + }); + append(copiedOldImports, makeImportOrRequire(oldFile, oldFileDefault, oldFileNamedImports, getBaseFileName(oldFile.fileName), program, host, useEsModuleSyntax, quotePreference)); + return copiedOldImports; + } + var refactorName4, description, moveToNewFileAction; + var init_moveToNewFile = __esm({ + "src/services/refactors/moveToNewFile.ts"() { + "use strict"; + init_ts4(); + init_ts_refactor(); + refactorName4 = "Move to a new file"; + description = getLocaleSpecificMessage(Diagnostics.Move_to_a_new_file); + moveToNewFileAction = { + name: refactorName4, + description, + kind: "refactor.move.newFile" + }; + registerRefactor(refactorName4, { + kinds: [moveToNewFileAction.kind], + getAvailableActions: function getRefactorActionsToMoveToNewFile(context) { + const statements = getStatementsToMove(context); + if (context.preferences.allowTextChangesInNewFiles && statements) { + return [{ name: refactorName4, description, actions: [moveToNewFileAction] }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return [{ + name: refactorName4, + description, + actions: [{ ...moveToNewFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }] + }]; + } + return emptyArray; + }, + getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) { + Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked"); + const statements = Debug.checkDefined(getStatementsToMove(context)); + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange3(context.file, context.program, statements, t, context.host, context.preferences, context)); + return { edits, renameFilename: void 0, renameLocation: void 0 }; + } + }); + } + }); + + // src/services/refactors/moveToFile.ts + function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) { + const checker = program.getTypeChecker(); + const usage = getUsageInfo(oldFile, toMove.all, checker); + if (!host.fileExists(targetFile)) { + changes.createNewFile(oldFile, targetFile, getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences)); + addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host)); + } else { + const targetSourceFile = Debug.checkDefined(program.getSourceFile(targetFile)); + const importAdder = ts_codefix_exports.createImportAdder(targetSourceFile, context.program, context.preferences, context.host); + getNewStatementsAndRemoveFromOldFile2(oldFile, targetSourceFile, usage, changes, toMove, program, host, preferences, importAdder); + } + } + function getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences, importAdder) { + const checker = program.getTypeChecker(); + const prologueDirectives = takeWhile(oldFile.statements, isPrologueDirective); + if (oldFile.externalModuleIndicator === void 0 && oldFile.commonJsModuleIndicator === void 0 && usage.oldImportsNeededByTargetFile.size === 0 && usage.targetFileImportsFromOldFile.size === 0 && typeof targetFile === "string") { + deleteMovedStatements(oldFile, toMove.ranges, changes); + return [...prologueDirectives, ...toMove.all]; + } + const targetFileName = typeof targetFile === "string" ? targetFile : targetFile.fileName; + const useEsModuleSyntax = !fileShouldUseJavaScriptRequire(targetFileName, program, host, !!oldFile.commonJsModuleIndicator); + const quotePreference = getQuotePreference(oldFile, preferences); + const importsFromTargetFile = createOldFileImportsFromTargetFile(oldFile, usage.oldFileImportsFromTargetFile, targetFileName, program, host, useEsModuleSyntax, quotePreference); + if (importsFromTargetFile) { + insertImports( + changes, + oldFile, + importsFromTargetFile, + /*blankLineBetween*/ + true, + preferences + ); + } + deleteUnusedOldImports(oldFile, toMove.all, changes, usage.unusedImportsFromOldFile, checker); + deleteMovedStatements(oldFile, toMove.ranges, changes); + updateImportsInOtherFiles(changes, program, host, oldFile, usage.movedSymbols, targetFileName, quotePreference); + const imports = getTargetFileImportsAndAddExportInOldFile(oldFile, targetFileName, usage.oldImportsNeededByTargetFile, usage.targetFileImportsFromOldFile, changes, checker, program, host, useEsModuleSyntax, quotePreference, importAdder); + const body = addExports(oldFile, toMove.all, usage.oldFileImportsFromTargetFile, useEsModuleSyntax); + if (typeof targetFile !== "string") { + if (targetFile.statements.length > 0) { + changes.insertNodesAfter(targetFile, targetFile.statements[targetFile.statements.length - 1], body); + } else { + changes.insertNodesAtEndOfFile( + targetFile, + body, + /*blankLineBetween*/ + false + ); + } + if (imports.length > 0) { + insertImports( + changes, + targetFile, + imports, + /*blankLineBetween*/ + true, + preferences + ); + } + } + if (importAdder) { + importAdder.writeFixes(changes); + } + if (imports.length && body.length) { + return [ + ...prologueDirectives, + ...imports, + 4 /* NewLineTrivia */, + ...body + ]; + } + return [ + ...prologueDirectives, + ...imports, + ...body + ]; + } + function getTargetFileImportsAndAddExportInOldFile(oldFile, targetFile, importsToCopy, targetFileImportsFromOldFile, changes, checker, program, host, useEsModuleSyntax, quotePreference, importAdder) { + const copiedOldImports = []; + if (importAdder) { + importsToCopy.forEach((isValidTypeOnlyUseSite, symbol) => { + try { + importAdder.addImportFromExportedSymbol(skipAlias(symbol, checker), isValidTypeOnlyUseSite); + } catch { + for (const oldStatement of oldFile.statements) { + forEachImportInStatement(oldStatement, (i) => { + append(copiedOldImports, filterImport(i, factory.createStringLiteral(moduleSpecifierFromImport(i).text), (name) => importsToCopy.has(checker.getSymbolAtLocation(name)))); + }); + } + } + }); + } else { + const targetSourceFile = program.getSourceFile(targetFile); + for (const oldStatement of oldFile.statements) { + forEachImportInStatement(oldStatement, (i) => { + var _a, _b; + const moduleSpecifier = moduleSpecifierFromImport(i); + const resolved = (_a = oldFile.resolvedModules) == null ? void 0 : _a.get(moduleSpecifier.text, getModeForUsageLocation(oldFile, moduleSpecifier)); + const fileName = (_b = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _b.resolvedFileName; + if (fileName && targetSourceFile) { + const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), targetSourceFile, targetSourceFile.path, fileName, createModuleSpecifierResolutionHost(program, host)); + append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name)))); + } else { + append(copiedOldImports, filterImport(i, factory.createStringLiteral(moduleSpecifierFromImport(i).text), (name) => importsToCopy.has(checker.getSymbolAtLocation(name)))); + } + }); + } + } + const targetFileSourceFile = program.getSourceFile(targetFile); + let oldFileDefault; + const oldFileNamedImports = []; + const markSeenTop = nodeSeenTracker(); + targetFileImportsFromOldFile.forEach((symbol) => { + if (!symbol.declarations) { + return; + } + for (const decl of symbol.declarations) { + if (!isTopLevelDeclaration(decl)) + continue; + const name = nameOfTopLevelDeclaration(decl); + if (!name) + continue; + const top = getTopLevelDeclarationStatement(decl); + if (markSeenTop(top)) { + addExportToChanges(oldFile, top, name, changes, useEsModuleSyntax); + } + if (importAdder && checker.isUnknownSymbol(symbol)) { + importAdder.addImportFromExportedSymbol(skipAlias(symbol, checker)); + } else { + if (hasSyntacticModifier(decl, 1024 /* Default */)) { + oldFileDefault = name; + } else { + oldFileNamedImports.push(name.text); + } + } + } + }); + return targetFileSourceFile ? append(copiedOldImports, makeImportOrRequire(targetFileSourceFile, oldFileDefault, oldFileNamedImports, oldFile.fileName, program, host, useEsModuleSyntax, quotePreference)) : append(copiedOldImports, makeImportOrRequire(oldFile, oldFileDefault, oldFileNamedImports, oldFile.fileName, program, host, useEsModuleSyntax, quotePreference)); + } + function addNewFileToTsconfig(program, changes, oldFileName, newFileNameWithExtension, getCanonicalFileName) { + const cfg = program.getCompilerOptions().configFile; + if (!cfg) + return; + const newFileAbsolutePath = normalizePath(combinePaths(oldFileName, "..", newFileNameWithExtension)); + const newFilePath = getRelativePathFromFile(cfg.fileName, newFileAbsolutePath, getCanonicalFileName); + const cfgObject = cfg.statements[0] && tryCast(cfg.statements[0].expression, isObjectLiteralExpression); + const filesProp = cfgObject && find(cfgObject.properties, (prop) => isPropertyAssignment(prop) && isStringLiteral(prop.name) && prop.name.text === "files"); + if (filesProp && isArrayLiteralExpression(filesProp.initializer)) { + changes.insertNodeInListAfter(cfg, last(filesProp.initializer.elements), factory.createStringLiteral(newFilePath), filesProp.initializer.elements); + } + } + function deleteMovedStatements(sourceFile, moved, changes) { + for (const { first: first2, afterLast } of moved) { + changes.deleteNodeRangeExcludingEnd(sourceFile, first2, afterLast); + } + } + function deleteUnusedOldImports(oldFile, toMove, changes, toDelete, checker) { + for (const statement of oldFile.statements) { + if (contains(toMove, statement)) + continue; + forEachImportInStatement(statement, (i) => deleteUnusedImports(oldFile, i, changes, (name) => toDelete.has(checker.getSymbolAtLocation(name)))); + } + } + function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols, targetFileName, quotePreference) { + const checker = program.getTypeChecker(); + for (const sourceFile of program.getSourceFiles()) { + if (sourceFile === oldFile) + continue; + for (const statement of sourceFile.statements) { + forEachImportInStatement(statement, (importNode) => { + if (checker.getSymbolAtLocation(moduleSpecifierFromImport(importNode)) !== oldFile.symbol) + return; + const shouldMove = (name) => { + const symbol = isBindingElement(name.parent) ? getPropertySymbolFromBindingElement(checker, name.parent) : skipAlias(checker.getSymbolAtLocation(name), checker); + return !!symbol && movedSymbols.has(symbol); + }; + deleteUnusedImports(sourceFile, importNode, changes, shouldMove); + const pathToTargetFileWithExtension = resolvePath(getDirectoryPath(oldFile.path), targetFileName); + const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.path, pathToTargetFileWithExtension, createModuleSpecifierResolutionHost(program, host)); + const newImportDeclaration = filterImport(importNode, makeStringLiteral(newModuleSpecifier, quotePreference), shouldMove); + if (newImportDeclaration) + changes.insertNodeAfter(sourceFile, statement, newImportDeclaration); + const ns = getNamespaceLikeImport(importNode); + if (ns) + updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleSpecifier, ns, importNode, quotePreference); + }); + } + } + } + function getNamespaceLikeImport(node) { + switch (node.kind) { + case 271 /* ImportDeclaration */: + return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 273 /* NamespaceImport */ ? node.importClause.namedBindings.name : void 0; + case 270 /* ImportEqualsDeclaration */: + return node.name; + case 259 /* VariableDeclaration */: + return tryCast(node.name, isIdentifier); + default: + return Debug.assertNever(node, `Unexpected node kind ${node.kind}`); + } + } + function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleSpecifier, oldImportId, oldImportNode, quotePreference) { + const preferredNewNamespaceName = ts_codefix_exports.moduleSpecifierToValidIdentifier(newModuleSpecifier, 99 /* ESNext */); + let needUniqueName = false; + const toChange = []; + ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, (ref) => { + if (!isPropertyAccessExpression(ref.parent)) + return; + needUniqueName = needUniqueName || !!checker.resolveName( + preferredNewNamespaceName, + ref, + 67108863 /* All */, + /*excludeGlobals*/ + true + ); + if (movedSymbols.has(checker.getSymbolAtLocation(ref.parent.name))) { + toChange.push(ref); + } + }); + if (toChange.length) { + const newNamespaceName = needUniqueName ? getUniqueName(preferredNewNamespaceName, sourceFile) : preferredNewNamespaceName; + for (const ref of toChange) { + changes.replaceNode(sourceFile, ref, factory.createIdentifier(newNamespaceName)); + } + changes.insertNodeAfter(sourceFile, oldImportNode, updateNamespaceLikeImportNode(oldImportNode, preferredNewNamespaceName, newModuleSpecifier, quotePreference)); + } + } + function updateNamespaceLikeImportNode(node, newNamespaceName, newModuleSpecifier, quotePreference) { + const newNamespaceId = factory.createIdentifier(newNamespaceName); + const newModuleString = makeStringLiteral(newModuleSpecifier, quotePreference); + switch (node.kind) { + case 271 /* ImportDeclaration */: + return factory.createImportDeclaration( + /*modifiers*/ + void 0, + factory.createImportClause( + /*isTypeOnly*/ + false, + /*name*/ + void 0, + factory.createNamespaceImport(newNamespaceId) + ), + newModuleString, + /*assertClause*/ + void 0 + ); + case 270 /* ImportEqualsDeclaration */: + return factory.createImportEqualsDeclaration( + /*modifiers*/ + void 0, + /*isTypeOnly*/ + false, + newNamespaceId, + factory.createExternalModuleReference(newModuleString) + ); + case 259 /* VariableDeclaration */: + return factory.createVariableDeclaration( + newNamespaceId, + /*exclamationToken*/ + void 0, + /*type*/ + void 0, + createRequireCall(newModuleString) + ); + default: + return Debug.assertNever(node, `Unexpected node kind ${node.kind}`); + } + } + function createRequireCall(moduleSpecifier) { + return factory.createCallExpression( + factory.createIdentifier("require"), + /*typeArguments*/ + void 0, + [moduleSpecifier] + ); + } + function moduleSpecifierFromImport(i) { + return i.kind === 271 /* ImportDeclaration */ ? i.moduleSpecifier : i.kind === 270 /* ImportEqualsDeclaration */ ? i.moduleReference.expression : i.initializer.arguments[0]; + } + function forEachImportInStatement(statement, cb) { + if (isImportDeclaration(statement)) { + if (isStringLiteral(statement.moduleSpecifier)) + cb(statement); + } else if (isImportEqualsDeclaration(statement)) { + if (isExternalModuleReference(statement.moduleReference) && isStringLiteralLike(statement.moduleReference.expression)) { + cb(statement); + } + } else if (isVariableStatement(statement)) { + for (const decl of statement.declarationList.declarations) { + if (decl.initializer && isRequireCall( + decl.initializer, + /*requireStringLiteralLikeArgument*/ + true + )) { + cb(decl); + } + } + } + } + function createOldFileImportsFromTargetFile(sourceFile, targetFileNeedExport, targetFileNameWithExtension, program, host, useEs6Imports, quotePreference) { + let defaultImport; + const imports = []; + targetFileNeedExport.forEach((symbol) => { + if (symbol.escapedName === "default" /* Default */) { + defaultImport = factory.createIdentifier(symbolNameNoDefault(symbol)); + } else { + imports.push(symbol.name); + } + }); + return makeImportOrRequire(sourceFile, defaultImport, imports, targetFileNameWithExtension, program, host, useEs6Imports, quotePreference); + } + function makeImportOrRequire(sourceFile, defaultImport, imports, targetFileNameWithExtension, program, host, useEs6Imports, quotePreference) { + const pathToTargetFile = resolvePath(getDirectoryPath(sourceFile.path), targetFileNameWithExtension); + const pathToTargetFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.path, pathToTargetFile, createModuleSpecifierResolutionHost(program, host)); + if (useEs6Imports) { + const specifiers = imports.map((i) => factory.createImportSpecifier( + /*isTypeOnly*/ + false, + /*propertyName*/ + void 0, + factory.createIdentifier(i) + )); + return makeImportIfNecessary(defaultImport, specifiers, pathToTargetFileWithCorrectExtension, quotePreference); + } else { + Debug.assert(!defaultImport, "No default import should exist"); + const bindingElements = imports.map((i) => factory.createBindingElement( + /*dotDotDotToken*/ + void 0, + /*propertyName*/ + void 0, + i + )); + return bindingElements.length ? makeVariableStatement( + factory.createObjectBindingPattern(bindingElements), + /*type*/ + void 0, + createRequireCall(makeStringLiteral(pathToTargetFileWithCorrectExtension, quotePreference)) + ) : void 0; + } + } + function makeVariableStatement(name, type, initializer, flags = 2 /* Const */) { + return factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList([factory.createVariableDeclaration( + name, + /*exclamationToken*/ + void 0, + type, + initializer + )], flags) + ); + } + function addExports(sourceFile, toMove, needExport, useEs6Exports) { + return flatMap(toMove, (statement) => { + if (isTopLevelDeclarationStatement(statement) && !isExported(sourceFile, statement, useEs6Exports) && forEachTopLevelDeclaration(statement, (d) => { + var _a; + return needExport.has(Debug.checkDefined((_a = tryCast(d, canHaveSymbol)) == null ? void 0 : _a.symbol)); + })) { + const exports = addExport(getSynthesizedDeepClone(statement), useEs6Exports); + if (exports) + return exports; + } + return getSynthesizedDeepClone(statement); + }); + } + function isExported(sourceFile, decl, useEs6Exports, name) { + var _a; + if (useEs6Exports) { + return !isExpressionStatement(decl) && hasSyntacticModifier(decl, 1 /* Export */) || !!(name && sourceFile.symbol && ((_a = sourceFile.symbol.exports) == null ? void 0 : _a.has(name.escapedText))); + } + return !!sourceFile.symbol && !!sourceFile.symbol.exports && getNamesToExportInCommonJS(decl).some((name2) => sourceFile.symbol.exports.has(escapeLeadingUnderscores(name2))); + } + function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) { + switch (importDecl.kind) { + case 271 /* ImportDeclaration */: + deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); + break; + case 270 /* ImportEqualsDeclaration */: + if (isUnused(importDecl.name)) { + changes.delete(sourceFile, importDecl); + } + break; + case 259 /* VariableDeclaration */: + deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); + break; + default: + Debug.assertNever(importDecl, `Unexpected import decl kind ${importDecl.kind}`); + } + } + function deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused) { + if (!importDecl.importClause) + return; + const { name, namedBindings } = importDecl.importClause; + const defaultUnused = !name || isUnused(name); + const namedBindingsUnused = !namedBindings || (namedBindings.kind === 273 /* NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every((e) => isUnused(e.name))); + if (defaultUnused && namedBindingsUnused) { + changes.delete(sourceFile, importDecl); + } else { + if (name && defaultUnused) { + changes.delete(sourceFile, name); + } + if (namedBindings) { + if (namedBindingsUnused) { + changes.replaceNode( + sourceFile, + importDecl.importClause, + factory.updateImportClause( + importDecl.importClause, + importDecl.importClause.isTypeOnly, + name, + /*namedBindings*/ + void 0 + ) + ); + } else if (namedBindings.kind === 274 /* NamedImports */) { + for (const element of namedBindings.elements) { + if (isUnused(element.name)) + changes.delete(sourceFile, element); + } + } + } + } + } + function deleteUnusedImportsInVariableDeclaration(sourceFile, varDecl, changes, isUnused) { + const { name } = varDecl; + switch (name.kind) { + case 80 /* Identifier */: + if (isUnused(name)) { + if (varDecl.initializer && isRequireCall( + varDecl.initializer, + /*requireStringLiteralLikeArgument*/ + true + )) { + changes.delete( + sourceFile, + isVariableDeclarationList(varDecl.parent) && length(varDecl.parent.declarations) === 1 ? varDecl.parent.parent : varDecl + ); + } else { + changes.delete(sourceFile, name); + } + } + break; + case 206 /* ArrayBindingPattern */: + break; + case 205 /* ObjectBindingPattern */: + if (name.elements.every((e) => isIdentifier(e.name) && isUnused(e.name))) { + changes.delete( + sourceFile, + isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl + ); + } else { + for (const element of name.elements) { + if (isIdentifier(element.name) && isUnused(element.name)) { + changes.delete(sourceFile, element.name); + } + } + } + break; + } + } + function isTopLevelDeclarationStatement(node) { + Debug.assert(isSourceFile(node.parent), "Node parent should be a SourceFile"); + return isNonVariableTopLevelDeclaration(node) || isVariableStatement(node); + } + function addExport(decl, useEs6Exports) { + return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl); + } + function addEs6Export(d) { + const modifiers = canHaveModifiers(d) ? concatenate([factory.createModifier(95 /* ExportKeyword */)], getModifiers(d)) : void 0; + switch (d.kind) { + case 261 /* FunctionDeclaration */: + return factory.updateFunctionDeclaration(d, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); + case 262 /* ClassDeclaration */: + const decorators = canHaveDecorators(d) ? getDecorators(d) : void 0; + return factory.updateClassDeclaration(d, concatenate(decorators, modifiers), d.name, d.typeParameters, d.heritageClauses, d.members); + case 242 /* VariableStatement */: + return factory.updateVariableStatement(d, modifiers, d.declarationList); + case 266 /* ModuleDeclaration */: + return factory.updateModuleDeclaration(d, modifiers, d.name, d.body); + case 265 /* EnumDeclaration */: + return factory.updateEnumDeclaration(d, modifiers, d.name, d.members); + case 264 /* TypeAliasDeclaration */: + return factory.updateTypeAliasDeclaration(d, modifiers, d.name, d.typeParameters, d.type); + case 263 /* InterfaceDeclaration */: + return factory.updateInterfaceDeclaration(d, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); + case 270 /* ImportEqualsDeclaration */: + return factory.updateImportEqualsDeclaration(d, modifiers, d.isTypeOnly, d.name, d.moduleReference); + case 243 /* ExpressionStatement */: + return Debug.fail(); + default: + return Debug.assertNever(d, `Unexpected declaration kind ${d.kind}`); + } + } + function addCommonjsExport(decl) { + return [decl, ...getNamesToExportInCommonJS(decl).map(createExportAssignment)]; + } + function createExportAssignment(name) { + return factory.createExpressionStatement( + factory.createBinaryExpression( + factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.createIdentifier(name)), + 64 /* EqualsToken */, + factory.createIdentifier(name) + ) + ); + } + function getNamesToExportInCommonJS(decl) { + switch (decl.kind) { + case 261 /* FunctionDeclaration */: + case 262 /* ClassDeclaration */: + return [decl.name.text]; + case 242 /* VariableStatement */: + return mapDefined(decl.declarationList.declarations, (d) => isIdentifier(d.name) ? d.name.text : void 0); + case 266 /* ModuleDeclaration */: + case 265 /* EnumDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 263 /* InterfaceDeclaration */: + case 270 /* ImportEqualsDeclaration */: + return emptyArray; + case 243 /* ExpressionStatement */: + return Debug.fail("Can't export an ExpressionStatement"); + default: + return Debug.assertNever(decl, `Unexpected decl kind ${decl.kind}`); + } + } + function filterImport(i, moduleSpecifier, keep) { + switch (i.kind) { + case 271 /* ImportDeclaration */: { + const clause = i.importClause; + if (!clause) + return void 0; + const defaultImport = clause.name && keep(clause.name) ? clause.name : void 0; + const namedBindings = clause.namedBindings && filterNamedBindings(clause.namedBindings, keep); + return defaultImport || namedBindings ? factory.createImportDeclaration( + /*modifiers*/ + void 0, + factory.createImportClause(clause.isTypeOnly, defaultImport, namedBindings), + getSynthesizedDeepClone(moduleSpecifier), + /*assertClause*/ + void 0 + ) : void 0; + } + case 270 /* ImportEqualsDeclaration */: + return keep(i.name) ? i : void 0; + case 259 /* VariableDeclaration */: { + const name = filterBindingName(i.name, keep); + return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : void 0; + } + default: + return Debug.assertNever(i, `Unexpected import kind ${i.kind}`); + } + } + function filterNamedBindings(namedBindings, keep) { + if (namedBindings.kind === 273 /* NamespaceImport */) { + return keep(namedBindings.name) ? namedBindings : void 0; + } else { + const newElements = namedBindings.elements.filter((e) => keep(e.name)); + return newElements.length ? factory.createNamedImports(newElements) : void 0; + } + } + function filterBindingName(name, keep) { + switch (name.kind) { + case 80 /* Identifier */: + return keep(name) ? name : void 0; + case 206 /* ArrayBindingPattern */: + return name; + case 205 /* ObjectBindingPattern */: { + const newElements = name.elements.filter((prop) => prop.propertyName || !isIdentifier(prop.name) || keep(prop.name)); + return newElements.length ? factory.createObjectBindingPattern(newElements) : void 0; + } + } + } + function nameOfTopLevelDeclaration(d) { + return isExpressionStatement(d) ? tryCast(d.expression.left.name, isIdentifier) : tryCast(d.name, isIdentifier); + } + function getTopLevelDeclarationStatement(d) { + switch (d.kind) { + case 259 /* VariableDeclaration */: + return d.parent.parent; + case 207 /* BindingElement */: + return getTopLevelDeclarationStatement( + cast(d.parent.parent, (p) => isVariableDeclaration(p) || isBindingElement(p)) + ); + default: + return d; + } + } + function addExportToChanges(sourceFile, decl, name, changes, useEs6Exports) { + if (isExported(sourceFile, decl, useEs6Exports, name)) + return; + if (useEs6Exports) { + if (!isExpressionStatement(decl)) + changes.insertExportModifier(sourceFile, decl); + } else { + const names = getNamesToExportInCommonJS(decl); + if (names.length !== 0) + changes.insertNodesAfter(sourceFile, decl, names.map(createExportAssignment)); + } + } + function createNewFileName(oldFile, program, context, host) { + const checker = program.getTypeChecker(); + const toMove = getStatementsToMove(context); + let usage; + if (toMove) { + usage = getUsageInfo(oldFile, toMove.all, checker); + const currentDirectory = getDirectoryPath(oldFile.fileName); + const extension = extensionFromPath(oldFile.fileName); + const newFileName = combinePaths( + // new file is always placed in the same directory as the old file + currentDirectory, + // ensures the filename computed below isn't already taken + makeUniqueFilename( + // infers a name for the new file from the symbols being moved + inferNewFileName(usage.oldFileImportsFromTargetFile, usage.movedSymbols), + extension, + currentDirectory, + host + ) + ) + extension; + return newFileName; + } + return ""; + } + function getRangeToMove(context) { + const { file } = context; + const range = createTextRangeFromSpan(getRefactorContextSpan(context)); + const { statements } = file; + const startNodeIndex = findIndex(statements, (s) => s.end > range.pos); + if (startNodeIndex === -1) + return void 0; + const startStatement = statements[startNodeIndex]; + if (isNamedDeclaration(startStatement) && startStatement.name && rangeContainsRange(startStatement.name, range)) { + return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] }; + } + if (range.pos > startStatement.getStart(file)) + return void 0; + const afterEndNodeIndex = findIndex(statements, (s) => s.end > range.end, startNodeIndex); + if (afterEndNodeIndex !== -1 && (afterEndNodeIndex === 0 || statements[afterEndNodeIndex].getStart(file) < range.end)) + return void 0; + return { + toMove: statements.slice(startNodeIndex, afterEndNodeIndex === -1 ? statements.length : afterEndNodeIndex), + afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex] + }; + } + function getStatementsToMove(context) { + const rangeToMove = getRangeToMove(context); + if (rangeToMove === void 0) + return void 0; + const all = []; + const ranges = []; + const { toMove, afterLast } = rangeToMove; + getRangesWhere(toMove, isAllowedStatementToMove, (start, afterEndIndex) => { + for (let i = start; i < afterEndIndex; i++) + all.push(toMove[i]); + ranges.push({ first: toMove[start], afterLast }); + }); + return all.length === 0 ? void 0 : { all, ranges }; + } + function isAllowedStatementToMove(statement) { + return !isPureImport(statement) && !isPrologueDirective(statement); + } + function isPureImport(node) { + switch (node.kind) { + case 271 /* ImportDeclaration */: + return true; + case 270 /* ImportEqualsDeclaration */: + return !hasSyntacticModifier(node, 1 /* Export */); + case 242 /* VariableStatement */: + return node.declarationList.declarations.every((d) => !!d.initializer && isRequireCall( + d.initializer, + /*requireStringLiteralLikeArgument*/ + true + )); + default: + return false; + } + } + function getUsageInfo(oldFile, toMove, checker) { + const movedSymbols = /* @__PURE__ */ new Set(); + const oldImportsNeededByTargetFile = /* @__PURE__ */ new Map(); + const targetFileImportsFromOldFile = /* @__PURE__ */ new Set(); + const containsJsx = find(toMove, (statement) => !!(statement.transformFlags & 2 /* ContainsJsx */)); + const jsxNamespaceSymbol = getJsxNamespaceSymbol(containsJsx); + if (jsxNamespaceSymbol) { + oldImportsNeededByTargetFile.set(jsxNamespaceSymbol, false); + } + for (const statement of toMove) { + forEachTopLevelDeclaration(statement, (decl) => { + movedSymbols.add(Debug.checkDefined(isExpressionStatement(decl) ? checker.getSymbolAtLocation(decl.expression.left) : decl.symbol, "Need a symbol here")); + }); + } + for (const statement of toMove) { + forEachReference(statement, checker, (symbol, isValidTypeOnlyUseSite) => { + if (!symbol.declarations) + return; + for (const decl of symbol.declarations) { + if (isInImport(decl)) { + const prevIsTypeOnly = oldImportsNeededByTargetFile.get(symbol); + oldImportsNeededByTargetFile.set(symbol, prevIsTypeOnly === void 0 ? isValidTypeOnlyUseSite : prevIsTypeOnly && isValidTypeOnlyUseSite); + } else if (isTopLevelDeclaration(decl) && sourceFileOfTopLevelDeclaration(decl) === oldFile && !movedSymbols.has(symbol)) { + targetFileImportsFromOldFile.add(symbol); + } + } + }); + } + const unusedImportsFromOldFile = new Set(oldImportsNeededByTargetFile.keys()); + const oldFileImportsFromTargetFile = /* @__PURE__ */ new Set(); + for (const statement of oldFile.statements) { + if (contains(toMove, statement)) + continue; + if (jsxNamespaceSymbol && !!(statement.transformFlags & 2 /* ContainsJsx */)) { + unusedImportsFromOldFile.delete(jsxNamespaceSymbol); + } + forEachReference(statement, checker, (symbol) => { + if (movedSymbols.has(symbol)) + oldFileImportsFromTargetFile.add(symbol); + unusedImportsFromOldFile.delete(symbol); + }); + } + return { movedSymbols, targetFileImportsFromOldFile, oldFileImportsFromTargetFile, oldImportsNeededByTargetFile, unusedImportsFromOldFile }; + function getJsxNamespaceSymbol(containsJsx2) { + if (containsJsx2 === void 0) { + return void 0; + } + const jsxNamespace = checker.getJsxNamespace(containsJsx2); + const jsxNamespaceSymbol2 = checker.resolveName( + jsxNamespace, + containsJsx2, + 1920 /* Namespace */, + /*excludeGlobals*/ + true + ); + return !!jsxNamespaceSymbol2 && some(jsxNamespaceSymbol2.declarations, isInImport) ? jsxNamespaceSymbol2 : void 0; + } + } + function makeUniqueFilename(proposedFilename, extension, inDirectory, host) { + let newFilename = proposedFilename; + for (let i = 1; ; i++) { + const name = combinePaths(inDirectory, newFilename + extension); + if (!host.fileExists(name)) + return newFilename; + newFilename = `${proposedFilename}.${i}`; + } + } + function inferNewFileName(importsFromNewFile, movedSymbols) { + return forEachKey(importsFromNewFile, symbolNameNoDefault) || forEachKey(movedSymbols, symbolNameNoDefault) || "newFile"; + } + function forEachReference(node, checker, onReference) { + node.forEachChild(function cb(node2) { + if (isIdentifier(node2) && !isDeclarationName(node2)) { + const sym = checker.getSymbolAtLocation(node2); + if (sym) + onReference(sym, isValidTypeOnlyAliasUseSite(node2)); + } else { + node2.forEachChild(cb); + } + }); + } + function forEachTopLevelDeclaration(statement, cb) { + switch (statement.kind) { + case 261 /* FunctionDeclaration */: + case 262 /* ClassDeclaration */: + case 266 /* ModuleDeclaration */: + case 265 /* EnumDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 263 /* InterfaceDeclaration */: + case 270 /* ImportEqualsDeclaration */: + return cb(statement); + case 242 /* VariableStatement */: + return firstDefined(statement.declarationList.declarations, (decl) => forEachTopLevelDeclarationInBindingName(decl.name, cb)); + case 243 /* ExpressionStatement */: { + const { expression } = statement; + return isBinaryExpression(expression) && getAssignmentDeclarationKind(expression) === 1 /* ExportsProperty */ ? cb(statement) : void 0; + } + } + } + function isInImport(decl) { + switch (decl.kind) { + case 270 /* ImportEqualsDeclaration */: + case 275 /* ImportSpecifier */: + case 272 /* ImportClause */: + case 273 /* NamespaceImport */: + return true; + case 259 /* VariableDeclaration */: + return isVariableDeclarationInImport(decl); + case 207 /* BindingElement */: + return isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); + default: + return false; + } + } + function isVariableDeclarationInImport(decl) { + return isSourceFile(decl.parent.parent.parent) && !!decl.initializer && isRequireCall( + decl.initializer, + /*requireStringLiteralLikeArgument*/ + true + ); + } + function isTopLevelDeclaration(node) { + return isNonVariableTopLevelDeclaration(node) && isSourceFile(node.parent) || isVariableDeclaration(node) && isSourceFile(node.parent.parent.parent); + } + function sourceFileOfTopLevelDeclaration(node) { + return isVariableDeclaration(node) ? node.parent.parent.parent : node.parent; + } + function forEachTopLevelDeclarationInBindingName(name, cb) { + switch (name.kind) { + case 80 /* Identifier */: + return cb(cast(name.parent, (x) => isVariableDeclaration(x) || isBindingElement(x))); + case 206 /* ArrayBindingPattern */: + case 205 /* ObjectBindingPattern */: + return firstDefined(name.elements, (em) => isOmittedExpression(em) ? void 0 : forEachTopLevelDeclarationInBindingName(em.name, cb)); + default: + return Debug.assertNever(name, `Unexpected name kind ${name.kind}`); + } + } + function isNonVariableTopLevelDeclaration(node) { + switch (node.kind) { + case 261 /* FunctionDeclaration */: + case 262 /* ClassDeclaration */: + case 266 /* ModuleDeclaration */: + case 265 /* EnumDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 263 /* InterfaceDeclaration */: + case 270 /* ImportEqualsDeclaration */: + return true; + default: + return false; + } + } + var refactorNameForMoveToFile, description2, moveToFileAction; + var init_moveToFile = __esm({ + "src/services/refactors/moveToFile.ts"() { + "use strict"; + init_moduleSpecifiers(); + init_ts4(); + init_refactorProvider(); + refactorNameForMoveToFile = "Move to file"; + description2 = getLocaleSpecificMessage(Diagnostics.Move_to_file); + moveToFileAction = { + name: "Move to file", + description: description2, + kind: "refactor.move.file" + }; + registerRefactor(refactorNameForMoveToFile, { + kinds: [moveToFileAction.kind], + getAvailableActions: function getRefactorActionsToMoveToFile(context, interactiveRefactorArguments) { + const statements = getStatementsToMove(context); + if (!interactiveRefactorArguments) { + return emptyArray; + } + if (context.preferences.allowTextChangesInNewFiles && statements) { + return [{ name: refactorNameForMoveToFile, description: description2, actions: [moveToFileAction] }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return [{ + name: refactorNameForMoveToFile, + description: description2, + actions: [{ ...moveToFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }] + }]; + } + return emptyArray; + }, + getEditsForAction: function getRefactorEditsToMoveToFile(context, actionName2, interactiveRefactorArguments) { + Debug.assert(actionName2 === refactorNameForMoveToFile, "Wrong refactor invoked"); + const statements = Debug.checkDefined(getStatementsToMove(context)); + Debug.assert(interactiveRefactorArguments, "No interactive refactor arguments available"); + const targetFile = interactiveRefactorArguments.targetFile; + if (hasJSFileExtension(targetFile) || hasTSFileExtension(targetFile)) { + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(context, context.file, interactiveRefactorArguments.targetFile, context.program, statements, t, context.host, context.preferences)); + return { edits, renameFilename: void 0, renameLocation: void 0 }; + } + return { edits: [], renameFilename: void 0, renameLocation: void 0, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Cannot_move_to_file_selected_file_is_invalid) }; + } + }); + } + }); + + // src/services/refactors/convertOverloadListToSingleSignature.ts + function getRefactorActionsToConvertOverloadsToOneSignature(context) { + const { file, startPosition, program } = context; + const info = getConvertableOverloadListAtPosition(file, startPosition, program); + if (!info) + return emptyArray; + return [{ + name: refactorName5, + description: refactorDescription, + actions: [functionOverloadAction] + }]; + } + function getRefactorEditsToConvertOverloadsToOneSignature(context) { + const { file, startPosition, program } = context; + const signatureDecls = getConvertableOverloadListAtPosition(file, startPosition, program); + if (!signatureDecls) + return void 0; + const checker = program.getTypeChecker(); + const lastDeclaration = signatureDecls[signatureDecls.length - 1]; + let updated = lastDeclaration; + switch (lastDeclaration.kind) { + case 172 /* MethodSignature */: { + updated = factory.updateMethodSignature( + lastDeclaration, + lastDeclaration.modifiers, + lastDeclaration.name, + lastDeclaration.questionToken, + lastDeclaration.typeParameters, + getNewParametersForCombinedSignature(signatureDecls), + lastDeclaration.type + ); + break; + } + case 173 /* MethodDeclaration */: { + updated = factory.updateMethodDeclaration( + lastDeclaration, + lastDeclaration.modifiers, + lastDeclaration.asteriskToken, + lastDeclaration.name, + lastDeclaration.questionToken, + lastDeclaration.typeParameters, + getNewParametersForCombinedSignature(signatureDecls), + lastDeclaration.type, + lastDeclaration.body + ); + break; + } + case 178 /* CallSignature */: { + updated = factory.updateCallSignature( + lastDeclaration, + lastDeclaration.typeParameters, + getNewParametersForCombinedSignature(signatureDecls), + lastDeclaration.type + ); + break; + } + case 175 /* Constructor */: { + updated = factory.updateConstructorDeclaration( + lastDeclaration, + lastDeclaration.modifiers, + getNewParametersForCombinedSignature(signatureDecls), + lastDeclaration.body + ); + break; + } + case 179 /* ConstructSignature */: { + updated = factory.updateConstructSignature( + lastDeclaration, + lastDeclaration.typeParameters, + getNewParametersForCombinedSignature(signatureDecls), + lastDeclaration.type + ); + break; + } + case 261 /* FunctionDeclaration */: { + updated = factory.updateFunctionDeclaration( + lastDeclaration, + lastDeclaration.modifiers, + lastDeclaration.asteriskToken, + lastDeclaration.name, + lastDeclaration.typeParameters, + getNewParametersForCombinedSignature(signatureDecls), + lastDeclaration.type, + lastDeclaration.body + ); + break; + } + default: + return Debug.failBadSyntaxKind(lastDeclaration, "Unhandled signature kind in overload list conversion refactoring"); + } + if (updated === lastDeclaration) { + return; + } + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => { + t.replaceNodeRange(file, signatureDecls[0], signatureDecls[signatureDecls.length - 1], updated); + }); + return { renameFilename: void 0, renameLocation: void 0, edits }; + function getNewParametersForCombinedSignature(signatureDeclarations) { + const lastSig = signatureDeclarations[signatureDeclarations.length - 1]; + if (isFunctionLikeDeclaration(lastSig) && lastSig.body) { + signatureDeclarations = signatureDeclarations.slice(0, signatureDeclarations.length - 1); + } + return factory.createNodeArray([ + factory.createParameterDeclaration( + /*modifiers*/ + void 0, + factory.createToken(26 /* DotDotDotToken */), + "args", + /*questionToken*/ + void 0, + factory.createUnionTypeNode(map(signatureDeclarations, convertSignatureParametersToTuple)) + ) + ]); + } + function convertSignatureParametersToTuple(decl) { + const members = map(decl.parameters, convertParameterToNamedTupleMember); + return setEmitFlags(factory.createTupleTypeNode(members), some(members, (m) => !!length(getSyntheticLeadingComments(m))) ? 0 /* None */ : 1 /* SingleLine */); + } + function convertParameterToNamedTupleMember(p) { + Debug.assert(isIdentifier(p.name)); + const result = setTextRange(factory.createNamedTupleMember( + p.dotDotDotToken, + p.name, + p.questionToken, + p.type || factory.createKeywordTypeNode(133 /* AnyKeyword */) + ), p); + const parameterDocComment = p.symbol && p.symbol.getDocumentationComment(checker); + if (parameterDocComment) { + const newComment = displayPartsToString(parameterDocComment); + if (newComment.length) { + setSyntheticLeadingComments(result, [{ + text: `* +${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} + `, + kind: 3 /* MultiLineCommentTrivia */, + pos: -1, + end: -1, + hasTrailingNewLine: true, + hasLeadingNewline: true + }]); + } + } + return result; + } + } + function isConvertableSignatureDeclaration(d) { + switch (d.kind) { + case 172 /* MethodSignature */: + case 173 /* MethodDeclaration */: + case 178 /* CallSignature */: + case 175 /* Constructor */: + case 179 /* ConstructSignature */: + case 261 /* FunctionDeclaration */: + return true; + } + return false; + } + function getConvertableOverloadListAtPosition(file, startPosition, program) { + const node = getTokenAtPosition(file, startPosition); + const containingDecl = findAncestor(node, isConvertableSignatureDeclaration); + if (!containingDecl) { + return; + } + if (isFunctionLikeDeclaration(containingDecl) && containingDecl.body && rangeContainsPosition(containingDecl.body, startPosition)) { + return; + } + const checker = program.getTypeChecker(); + const signatureSymbol = containingDecl.symbol; + if (!signatureSymbol) { + return; + } + const decls = signatureSymbol.declarations; + if (length(decls) <= 1) { + return; + } + if (!every(decls, (d) => getSourceFileOfNode(d) === file)) { + return; + } + if (!isConvertableSignatureDeclaration(decls[0])) { + return; + } + const kindOne = decls[0].kind; + if (!every(decls, (d) => d.kind === kindOne)) { + return; + } + const signatureDecls = decls; + if (some(signatureDecls, (d) => !!d.typeParameters || some(d.parameters, (p) => !!p.modifiers || !isIdentifier(p.name)))) { + return; + } + const signatures = mapDefined(signatureDecls, (d) => checker.getSignatureFromDeclaration(d)); + if (length(signatures) !== length(decls)) { + return; + } + const returnOne = checker.getReturnTypeOfSignature(signatures[0]); + if (!every(signatures, (s) => checker.getReturnTypeOfSignature(s) === returnOne)) { + return; + } + return signatureDecls; + } + var refactorName5, refactorDescription, functionOverloadAction; + var init_convertOverloadListToSingleSignature = __esm({ + "src/services/refactors/convertOverloadListToSingleSignature.ts"() { + "use strict"; + init_ts4(); + init_ts_refactor(); + refactorName5 = "Convert overload list to single signature"; + refactorDescription = Diagnostics.Convert_overload_list_to_single_signature.message; + functionOverloadAction = { + name: refactorName5, + description: refactorDescription, + kind: "refactor.rewrite.function.overloadList" + }; + registerRefactor(refactorName5, { + kinds: [functionOverloadAction.kind], + getEditsForAction: getRefactorEditsToConvertOverloadsToOneSignature, + getAvailableActions: getRefactorActionsToConvertOverloadsToOneSignature + }); + } + }); + + // src/services/refactors/addOrRemoveBracesToArrowFunction.ts + function getRefactorActionsToRemoveFunctionBraces(context) { + const { file, startPosition, triggerReason } = context; + const info = getConvertibleArrowFunctionAtPosition(file, startPosition, triggerReason === "invoked"); + if (!info) + return emptyArray; + if (!isRefactorErrorInfo(info)) { + return [{ + name: refactorName6, + description: refactorDescription2, + actions: [ + info.addBraces ? addBracesAction : removeBracesAction + ] + }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return [{ + name: refactorName6, + description: refactorDescription2, + actions: [ + { ...addBracesAction, notApplicableReason: info.error }, + { ...removeBracesAction, notApplicableReason: info.error } + ] + }]; + } + return emptyArray; + } + function getRefactorEditsToRemoveFunctionBraces(context, actionName2) { + const { file, startPosition } = context; + const info = getConvertibleArrowFunctionAtPosition(file, startPosition); + Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); + const { expression, returnStatement, func } = info; + let body; + if (actionName2 === addBracesAction.name) { + const returnStatement2 = factory.createReturnStatement(expression); + body = factory.createBlock( + [returnStatement2], + /*multiLine*/ + true + ); + copyLeadingComments( + expression, + returnStatement2, + file, + 3 /* MultiLineCommentTrivia */, + /*hasTrailingNewLine*/ + true + ); + } else if (actionName2 === removeBracesAction.name && returnStatement) { + const actualExpression = expression || factory.createVoidZero(); + body = needsParentheses(actualExpression) ? factory.createParenthesizedExpression(actualExpression) : actualExpression; + copyTrailingAsLeadingComments( + returnStatement, + body, + file, + 3 /* MultiLineCommentTrivia */, + /*hasTrailingNewLine*/ + false + ); + copyLeadingComments( + returnStatement, + body, + file, + 3 /* MultiLineCommentTrivia */, + /*hasTrailingNewLine*/ + false + ); + copyTrailingComments( + returnStatement, + body, + file, + 3 /* MultiLineCommentTrivia */, + /*hasTrailingNewLine*/ + false + ); + } else { + Debug.fail("invalid action"); + } + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => { + t.replaceNode(file, func.body, body); + }); + return { renameFilename: void 0, renameLocation: void 0, edits }; + } + function getConvertibleArrowFunctionAtPosition(file, startPosition, considerFunctionBodies = true, kind) { + const node = getTokenAtPosition(file, startPosition); + const func = getContainingFunction(node); + if (!func) { + return { + error: getLocaleSpecificMessage(Diagnostics.Could_not_find_a_containing_arrow_function) + }; + } + if (!isArrowFunction(func)) { + return { + error: getLocaleSpecificMessage(Diagnostics.Containing_function_is_not_an_arrow_function) + }; + } + if (!rangeContainsRange(func, node) || rangeContainsRange(func.body, node) && !considerFunctionBodies) { + return void 0; + } + if (refactorKindBeginsWith(addBracesAction.kind, kind) && isExpression(func.body)) { + return { func, addBraces: true, expression: func.body }; + } else if (refactorKindBeginsWith(removeBracesAction.kind, kind) && isBlock(func.body) && func.body.statements.length === 1) { + const firstStatement = first(func.body.statements); + if (isReturnStatement(firstStatement)) { + return { func, addBraces: false, expression: firstStatement.expression, returnStatement: firstStatement }; + } + } + return void 0; + } + var refactorName6, refactorDescription2, addBracesAction, removeBracesAction; + var init_addOrRemoveBracesToArrowFunction = __esm({ + "src/services/refactors/addOrRemoveBracesToArrowFunction.ts"() { + "use strict"; + init_ts4(); + init_ts_refactor(); + refactorName6 = "Add or remove braces in an arrow function"; + refactorDescription2 = Diagnostics.Add_or_remove_braces_in_an_arrow_function.message; + addBracesAction = { + name: "Add braces to arrow function", + description: Diagnostics.Add_braces_to_arrow_function.message, + kind: "refactor.rewrite.arrow.braces.add" + }; + removeBracesAction = { + name: "Remove braces from arrow function", + description: Diagnostics.Remove_braces_from_arrow_function.message, + kind: "refactor.rewrite.arrow.braces.remove" + }; + registerRefactor(refactorName6, { + kinds: [removeBracesAction.kind], + getEditsForAction: getRefactorEditsToRemoveFunctionBraces, + getAvailableActions: getRefactorActionsToRemoveFunctionBraces + }); + } + }); + + // src/services/_namespaces/ts.refactor.addOrRemoveBracesToArrowFunction.ts + var ts_refactor_addOrRemoveBracesToArrowFunction_exports = {}; + var init_ts_refactor_addOrRemoveBracesToArrowFunction = __esm({ + "src/services/_namespaces/ts.refactor.addOrRemoveBracesToArrowFunction.ts"() { + "use strict"; + init_convertOverloadListToSingleSignature(); + init_addOrRemoveBracesToArrowFunction(); + } + }); + + // src/services/refactors/convertArrowFunctionOrFunctionExpression.ts + function getRefactorActionsToConvertFunctionExpressions(context) { + const { file, startPosition, program, kind } = context; + const info = getFunctionInfo(file, startPosition, program); + if (!info) + return emptyArray; + const { selectedVariableDeclaration, func } = info; + const possibleActions = []; + const errors = []; + if (refactorKindBeginsWith(toNamedFunctionAction.kind, kind)) { + const error = selectedVariableDeclaration || isArrowFunction(func) && isVariableDeclaration(func.parent) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_named_function); + if (error) { + errors.push({ ...toNamedFunctionAction, notApplicableReason: error }); + } else { + possibleActions.push(toNamedFunctionAction); + } + } + if (refactorKindBeginsWith(toAnonymousFunctionAction.kind, kind)) { + const error = !selectedVariableDeclaration && isArrowFunction(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_anonymous_function); + if (error) { + errors.push({ ...toAnonymousFunctionAction, notApplicableReason: error }); + } else { + possibleActions.push(toAnonymousFunctionAction); + } + } + if (refactorKindBeginsWith(toArrowFunctionAction.kind, kind)) { + const error = isFunctionExpression(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_arrow_function); + if (error) { + errors.push({ ...toArrowFunctionAction, notApplicableReason: error }); + } else { + possibleActions.push(toArrowFunctionAction); + } + } + return [{ + name: refactorName7, + description: refactorDescription3, + actions: possibleActions.length === 0 && context.preferences.provideRefactorNotApplicableReason ? errors : possibleActions + }]; + } + function getRefactorEditsToConvertFunctionExpressions(context, actionName2) { + const { file, startPosition, program } = context; + const info = getFunctionInfo(file, startPosition, program); + if (!info) + return void 0; + const { func } = info; + const edits = []; + switch (actionName2) { + case toAnonymousFunctionAction.name: + edits.push(...getEditInfoForConvertToAnonymousFunction(context, func)); + break; + case toNamedFunctionAction.name: + const variableInfo = getVariableInfo(func); + if (!variableInfo) + return void 0; + edits.push(...getEditInfoForConvertToNamedFunction(context, func, variableInfo)); + break; + case toArrowFunctionAction.name: + if (!isFunctionExpression(func)) + return void 0; + edits.push(...getEditInfoForConvertToArrowFunction(context, func)); + break; + default: + return Debug.fail("invalid action"); + } + return { renameFilename: void 0, renameLocation: void 0, edits }; + } + function containingThis(node) { + let containsThis = false; + node.forEachChild(function checkThis(child) { + if (isThis(child)) { + containsThis = true; + return; + } + if (!isClassLike(child) && !isFunctionDeclaration(child) && !isFunctionExpression(child)) { + forEachChild(child, checkThis); + } + }); + return containsThis; + } + function getFunctionInfo(file, startPosition, program) { + const token = getTokenAtPosition(file, startPosition); + const typeChecker = program.getTypeChecker(); + const func = tryGetFunctionFromVariableDeclaration(file, typeChecker, token.parent); + if (func && !containingThis(func.body) && !typeChecker.containsArgumentsReference(func)) { + return { selectedVariableDeclaration: true, func }; + } + const maybeFunc = getContainingFunction(token); + if (maybeFunc && (isFunctionExpression(maybeFunc) || isArrowFunction(maybeFunc)) && !rangeContainsRange(maybeFunc.body, token) && !containingThis(maybeFunc.body) && !typeChecker.containsArgumentsReference(maybeFunc)) { + if (isFunctionExpression(maybeFunc) && isFunctionReferencedInFile(file, typeChecker, maybeFunc)) + return void 0; + return { selectedVariableDeclaration: false, func: maybeFunc }; + } + return void 0; + } + function isSingleVariableDeclaration(parent2) { + return isVariableDeclaration(parent2) || isVariableDeclarationList(parent2) && parent2.declarations.length === 1; + } + function tryGetFunctionFromVariableDeclaration(sourceFile, typeChecker, parent2) { + if (!isSingleVariableDeclaration(parent2)) { + return void 0; + } + const variableDeclaration = isVariableDeclaration(parent2) ? parent2 : first(parent2.declarations); + const initializer = variableDeclaration.initializer; + if (initializer && (isArrowFunction(initializer) || isFunctionExpression(initializer) && !isFunctionReferencedInFile(sourceFile, typeChecker, initializer))) { + return initializer; + } + return void 0; + } + function convertToBlock(body) { + if (isExpression(body)) { + const returnStatement = factory.createReturnStatement(body); + const file = body.getSourceFile(); + setTextRange(returnStatement, body); + suppressLeadingAndTrailingTrivia(returnStatement); + copyTrailingAsLeadingComments( + body, + returnStatement, + file, + /*commentKind*/ + void 0, + /*hasTrailingNewLine*/ + true + ); + return factory.createBlock( + [returnStatement], + /*multiLine*/ + true + ); + } else { + return body; + } + } + function getVariableInfo(func) { + const variableDeclaration = func.parent; + if (!isVariableDeclaration(variableDeclaration) || !isVariableDeclarationInVariableStatement(variableDeclaration)) + return void 0; + const variableDeclarationList = variableDeclaration.parent; + const statement = variableDeclarationList.parent; + if (!isVariableDeclarationList(variableDeclarationList) || !isVariableStatement(statement) || !isIdentifier(variableDeclaration.name)) + return void 0; + return { variableDeclaration, variableDeclarationList, statement, name: variableDeclaration.name }; + } + function getEditInfoForConvertToAnonymousFunction(context, func) { + const { file } = context; + const body = convertToBlock(func.body); + const newNode = factory.createFunctionExpression( + func.modifiers, + func.asteriskToken, + /*name*/ + void 0, + func.typeParameters, + func.parameters, + func.type, + body + ); + return ts_textChanges_exports.ChangeTracker.with(context, (t) => t.replaceNode(file, func, newNode)); + } + function getEditInfoForConvertToNamedFunction(context, func, variableInfo) { + const { file } = context; + const body = convertToBlock(func.body); + const { variableDeclaration, variableDeclarationList, statement, name } = variableInfo; + suppressLeadingTrivia(statement); + const modifiersFlags = getCombinedModifierFlags(variableDeclaration) & 1 /* Export */ | getEffectiveModifierFlags(func); + const modifiers = factory.createModifiersFromModifierFlags(modifiersFlags); + const newNode = factory.createFunctionDeclaration(length(modifiers) ? modifiers : void 0, func.asteriskToken, name, func.typeParameters, func.parameters, func.type, body); + if (variableDeclarationList.declarations.length === 1) { + return ts_textChanges_exports.ChangeTracker.with(context, (t) => t.replaceNode(file, statement, newNode)); + } else { + return ts_textChanges_exports.ChangeTracker.with(context, (t) => { + t.delete(file, variableDeclaration); + t.insertNodeAfter(file, statement, newNode); + }); + } + } + function getEditInfoForConvertToArrowFunction(context, func) { + const { file } = context; + const statements = func.body.statements; + const head = statements[0]; + let body; + if (canBeConvertedToExpression(func.body, head)) { + body = head.expression; + suppressLeadingAndTrailingTrivia(body); + copyComments(head, body); + } else { + body = func.body; + } + const newNode = factory.createArrowFunction(func.modifiers, func.typeParameters, func.parameters, func.type, factory.createToken(39 /* EqualsGreaterThanToken */), body); + return ts_textChanges_exports.ChangeTracker.with(context, (t) => t.replaceNode(file, func, newNode)); + } + function canBeConvertedToExpression(body, head) { + return body.statements.length === 1 && (isReturnStatement(head) && !!head.expression); + } + function isFunctionReferencedInFile(sourceFile, typeChecker, node) { + return !!node.name && ts_FindAllReferences_exports.Core.isSymbolReferencedInFile(node.name, typeChecker, sourceFile); + } + var refactorName7, refactorDescription3, toAnonymousFunctionAction, toNamedFunctionAction, toArrowFunctionAction; + var init_convertArrowFunctionOrFunctionExpression = __esm({ + "src/services/refactors/convertArrowFunctionOrFunctionExpression.ts"() { + "use strict"; + init_ts4(); + init_ts_refactor(); + refactorName7 = "Convert arrow function or function expression"; + refactorDescription3 = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression); + toAnonymousFunctionAction = { + name: "Convert to anonymous function", + description: getLocaleSpecificMessage(Diagnostics.Convert_to_anonymous_function), + kind: "refactor.rewrite.function.anonymous" + }; + toNamedFunctionAction = { + name: "Convert to named function", + description: getLocaleSpecificMessage(Diagnostics.Convert_to_named_function), + kind: "refactor.rewrite.function.named" + }; + toArrowFunctionAction = { + name: "Convert to arrow function", + description: getLocaleSpecificMessage(Diagnostics.Convert_to_arrow_function), + kind: "refactor.rewrite.function.arrow" + }; + registerRefactor(refactorName7, { + kinds: [ + toAnonymousFunctionAction.kind, + toNamedFunctionAction.kind, + toArrowFunctionAction.kind + ], + getEditsForAction: getRefactorEditsToConvertFunctionExpressions, + getAvailableActions: getRefactorActionsToConvertFunctionExpressions + }); + } + }); + + // src/services/_namespaces/ts.refactor.convertArrowFunctionOrFunctionExpression.ts + var ts_refactor_convertArrowFunctionOrFunctionExpression_exports = {}; + var init_ts_refactor_convertArrowFunctionOrFunctionExpression = __esm({ + "src/services/_namespaces/ts.refactor.convertArrowFunctionOrFunctionExpression.ts"() { + "use strict"; + init_convertArrowFunctionOrFunctionExpression(); + } + }); + + // src/services/refactors/convertParamsToDestructuredObject.ts + function getRefactorActionsToConvertParametersToDestructuredObject(context) { + const { file, startPosition } = context; + const isJSFile = isSourceFileJS(file); + if (isJSFile) + return emptyArray; + const functionDeclaration = getFunctionDeclarationAtPosition(file, startPosition, context.program.getTypeChecker()); + if (!functionDeclaration) + return emptyArray; + return [{ + name: refactorName8, + description: refactorDescription4, + actions: [toDestructuredAction] + }]; + } + function getRefactorEditsToConvertParametersToDestructuredObject(context, actionName2) { + Debug.assert(actionName2 === refactorName8, "Unexpected action name"); + const { file, startPosition, program, cancellationToken, host } = context; + const functionDeclaration = getFunctionDeclarationAtPosition(file, startPosition, program.getTypeChecker()); + if (!functionDeclaration || !cancellationToken) + return void 0; + const groupedReferences = getGroupedReferences(functionDeclaration, program, cancellationToken); + if (groupedReferences.valid) { + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(file, program, host, t, functionDeclaration, groupedReferences)); + return { renameFilename: void 0, renameLocation: void 0, edits }; + } + return { edits: [] }; + } + function doChange5(sourceFile, program, host, changes, functionDeclaration, groupedReferences) { + const signature = groupedReferences.signature; + const newFunctionDeclarationParams = map(createNewParameters(functionDeclaration, program, host), (param) => getSynthesizedDeepClone(param)); + if (signature) { + const newSignatureParams = map(createNewParameters(signature, program, host), (param) => getSynthesizedDeepClone(param)); + replaceParameters(signature, newSignatureParams); + } + replaceParameters(functionDeclaration, newFunctionDeclarationParams); + const functionCalls = sortAndDeduplicate( + groupedReferences.functionCalls, + /*comparer*/ + (a, b) => compareValues(a.pos, b.pos) + ); + for (const call of functionCalls) { + if (call.arguments && call.arguments.length) { + const newArgument = getSynthesizedDeepClone( + createNewArgument(functionDeclaration, call.arguments), + /*includeTrivia*/ + true + ); + changes.replaceNodeRange( + getSourceFileOfNode(call), + first(call.arguments), + last(call.arguments), + newArgument, + { leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.IncludeAll, trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.Include } + ); + } + } + function replaceParameters(declarationOrSignature, parameterDeclarations) { + changes.replaceNodeRangeWithNodes( + sourceFile, + first(declarationOrSignature.parameters), + last(declarationOrSignature.parameters), + parameterDeclarations, + { + joiner: ", ", + // indentation is set to 0 because otherwise the object parameter will be indented if there is a `this` parameter + indentation: 0, + leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.IncludeAll, + trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.Include + } + ); + } + } + function getGroupedReferences(functionDeclaration, program, cancellationToken) { + const functionNames = getFunctionNames(functionDeclaration); + const classNames = isConstructorDeclaration(functionDeclaration) ? getClassNames(functionDeclaration) : []; + const names = deduplicate([...functionNames, ...classNames], equateValues); + const checker = program.getTypeChecker(); + const references = flatMap( + names, + /*mapfn*/ + (name) => ts_FindAllReferences_exports.getReferenceEntriesForNode(-1, name, program, program.getSourceFiles(), cancellationToken) + ); + const groupedReferences = groupReferences(references); + if (!every( + groupedReferences.declarations, + /*callback*/ + (decl) => contains(names, decl) + )) { + groupedReferences.valid = false; + } + return groupedReferences; + function groupReferences(referenceEntries) { + const classReferences = { accessExpressions: [], typeUsages: [] }; + const groupedReferences2 = { functionCalls: [], declarations: [], classReferences, valid: true }; + const functionSymbols = map(functionNames, getSymbolTargetAtLocation); + const classSymbols = map(classNames, getSymbolTargetAtLocation); + const isConstructor = isConstructorDeclaration(functionDeclaration); + const contextualSymbols = map(functionNames, (name) => getSymbolForContextualType(name, checker)); + for (const entry of referenceEntries) { + if (entry.kind === ts_FindAllReferences_exports.EntryKind.Span) { + groupedReferences2.valid = false; + continue; + } + if (contains(contextualSymbols, getSymbolTargetAtLocation(entry.node))) { + if (isValidMethodSignature(entry.node.parent)) { + groupedReferences2.signature = entry.node.parent; + continue; + } + const call = entryToFunctionCall(entry); + if (call) { + groupedReferences2.functionCalls.push(call); + continue; + } + } + const contextualSymbol = getSymbolForContextualType(entry.node, checker); + if (contextualSymbol && contains(contextualSymbols, contextualSymbol)) { + const decl = entryToDeclaration(entry); + if (decl) { + groupedReferences2.declarations.push(decl); + continue; + } + } + if (contains(functionSymbols, getSymbolTargetAtLocation(entry.node)) || isNewExpressionTarget(entry.node)) { + const importOrExportReference = entryToImportOrExport(entry); + if (importOrExportReference) { + continue; + } + const decl = entryToDeclaration(entry); + if (decl) { + groupedReferences2.declarations.push(decl); + continue; + } + const call = entryToFunctionCall(entry); + if (call) { + groupedReferences2.functionCalls.push(call); + continue; + } + } + if (isConstructor && contains(classSymbols, getSymbolTargetAtLocation(entry.node))) { + const importOrExportReference = entryToImportOrExport(entry); + if (importOrExportReference) { + continue; + } + const decl = entryToDeclaration(entry); + if (decl) { + groupedReferences2.declarations.push(decl); + continue; + } + const accessExpression = entryToAccessExpression(entry); + if (accessExpression) { + classReferences.accessExpressions.push(accessExpression); + continue; + } + if (isClassDeclaration(functionDeclaration.parent)) { + const type = entryToType(entry); + if (type) { + classReferences.typeUsages.push(type); + continue; + } + } + } + groupedReferences2.valid = false; + } + return groupedReferences2; + } + function getSymbolTargetAtLocation(node) { + const symbol = checker.getSymbolAtLocation(node); + return symbol && getSymbolTarget(symbol, checker); + } + } + function getSymbolForContextualType(node, checker) { + const element = getContainingObjectLiteralElement(node); + if (element) { + const contextualType = checker.getContextualTypeForObjectLiteralElement(element); + const symbol = contextualType == null ? void 0 : contextualType.getSymbol(); + if (symbol && !(getCheckFlags(symbol) & 6 /* Synthetic */)) { + return symbol; + } + } + } + function entryToImportOrExport(entry) { + const node = entry.node; + if (isImportSpecifier(node.parent) || isImportClause(node.parent) || isImportEqualsDeclaration(node.parent) || isNamespaceImport(node.parent)) { + return node; + } + if (isExportSpecifier(node.parent) || isExportAssignment(node.parent)) { + return node; + } + return void 0; + } + function entryToDeclaration(entry) { + if (isDeclaration(entry.node.parent)) { + return entry.node; + } + return void 0; + } + function entryToFunctionCall(entry) { + if (entry.node.parent) { + const functionReference = entry.node; + const parent2 = functionReference.parent; + switch (parent2.kind) { + case 212 /* CallExpression */: + case 213 /* NewExpression */: + const callOrNewExpression = tryCast(parent2, isCallOrNewExpression); + if (callOrNewExpression && callOrNewExpression.expression === functionReference) { + return callOrNewExpression; + } + break; + case 210 /* PropertyAccessExpression */: + const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression); + if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { + const callOrNewExpression2 = tryCast(propertyAccessExpression.parent, isCallOrNewExpression); + if (callOrNewExpression2 && callOrNewExpression2.expression === propertyAccessExpression) { + return callOrNewExpression2; + } + } + break; + case 211 /* ElementAccessExpression */: + const elementAccessExpression = tryCast(parent2, isElementAccessExpression); + if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) { + const callOrNewExpression2 = tryCast(elementAccessExpression.parent, isCallOrNewExpression); + if (callOrNewExpression2 && callOrNewExpression2.expression === elementAccessExpression) { + return callOrNewExpression2; + } + } + break; + } + } + return void 0; + } + function entryToAccessExpression(entry) { + if (entry.node.parent) { + const reference = entry.node; + const parent2 = reference.parent; + switch (parent2.kind) { + case 210 /* PropertyAccessExpression */: + const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression); + if (propertyAccessExpression && propertyAccessExpression.expression === reference) { + return propertyAccessExpression; + } + break; + case 211 /* ElementAccessExpression */: + const elementAccessExpression = tryCast(parent2, isElementAccessExpression); + if (elementAccessExpression && elementAccessExpression.expression === reference) { + return elementAccessExpression; + } + break; + } + } + return void 0; + } + function entryToType(entry) { + const reference = entry.node; + if (getMeaningFromLocation(reference) === 2 /* Type */ || isExpressionWithTypeArgumentsInClassExtendsClause(reference.parent)) { + return reference; + } + return void 0; + } + function getFunctionDeclarationAtPosition(file, startPosition, checker) { + const node = getTouchingToken(file, startPosition); + const functionDeclaration = getContainingFunctionDeclaration(node); + if (isTopLevelJSDoc(node)) + return void 0; + if (functionDeclaration && isValidFunctionDeclaration(functionDeclaration, checker) && rangeContainsRange(functionDeclaration, node) && !(functionDeclaration.body && rangeContainsRange(functionDeclaration.body, node))) + return functionDeclaration; + return void 0; + } + function isTopLevelJSDoc(node) { + const containingJSDoc = findAncestor(node, isJSDocNode); + if (containingJSDoc) { + const containingNonJSDoc = findAncestor(containingJSDoc, (n) => !isJSDocNode(n)); + return !!containingNonJSDoc && isFunctionLikeDeclaration(containingNonJSDoc); + } + return false; + } + function isValidMethodSignature(node) { + return isMethodSignature(node) && (isInterfaceDeclaration(node.parent) || isTypeLiteralNode(node.parent)); + } + function isValidFunctionDeclaration(functionDeclaration, checker) { + var _a; + if (!isValidParameterNodeArray(functionDeclaration.parameters, checker)) + return false; + switch (functionDeclaration.kind) { + case 261 /* FunctionDeclaration */: + return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker); + case 173 /* MethodDeclaration */: + if (isObjectLiteralExpression(functionDeclaration.parent)) { + const contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker); + return ((_a = contextualSymbol == null ? void 0 : contextualSymbol.declarations) == null ? void 0 : _a.length) === 1 && isSingleImplementation(functionDeclaration, checker); + } + return isSingleImplementation(functionDeclaration, checker); + case 175 /* Constructor */: + if (isClassDeclaration(functionDeclaration.parent)) { + return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker); + } else { + return isValidVariableDeclaration(functionDeclaration.parent.parent) && isSingleImplementation(functionDeclaration, checker); + } + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + return isValidVariableDeclaration(functionDeclaration.parent); + } + return false; + } + function isSingleImplementation(functionDeclaration, checker) { + return !!functionDeclaration.body && !checker.isImplementationOfOverload(functionDeclaration); + } + function hasNameOrDefault(functionOrClassDeclaration) { + if (!functionOrClassDeclaration.name) { + const defaultKeyword = findModifier(functionOrClassDeclaration, 90 /* DefaultKeyword */); + return !!defaultKeyword; + } + return true; + } + function isValidParameterNodeArray(parameters, checker) { + return getRefactorableParametersLength(parameters) >= minimumParameterLength && every( + parameters, + /*callback*/ + (paramDecl) => isValidParameterDeclaration(paramDecl, checker) + ); + } + function isValidParameterDeclaration(parameterDeclaration, checker) { + if (isRestParameter(parameterDeclaration)) { + const type = checker.getTypeAtLocation(parameterDeclaration); + if (!checker.isArrayType(type) && !checker.isTupleType(type)) + return false; + } + return !parameterDeclaration.modifiers && isIdentifier(parameterDeclaration.name); + } + function isValidVariableDeclaration(node) { + return isVariableDeclaration(node) && isVarConst(node) && isIdentifier(node.name) && !node.type; + } + function hasThisParameter(parameters) { + return parameters.length > 0 && isThis(parameters[0].name); + } + function getRefactorableParametersLength(parameters) { + if (hasThisParameter(parameters)) { + return parameters.length - 1; + } + return parameters.length; + } + function getRefactorableParameters(parameters) { + if (hasThisParameter(parameters)) { + parameters = factory.createNodeArray(parameters.slice(1), parameters.hasTrailingComma); + } + return parameters; + } + function createPropertyOrShorthandAssignment(name, initializer) { + if (isIdentifier(initializer) && getTextOfIdentifierOrLiteral(initializer) === name) { + return factory.createShorthandPropertyAssignment(name); + } + return factory.createPropertyAssignment(name, initializer); + } + function createNewArgument(functionDeclaration, functionArguments) { + const parameters = getRefactorableParameters(functionDeclaration.parameters); + const hasRestParameter2 = isRestParameter(last(parameters)); + const nonRestArguments = hasRestParameter2 ? functionArguments.slice(0, parameters.length - 1) : functionArguments; + const properties = map(nonRestArguments, (arg, i) => { + const parameterName = getParameterName(parameters[i]); + const property = createPropertyOrShorthandAssignment(parameterName, arg); + suppressLeadingAndTrailingTrivia(property.name); + if (isPropertyAssignment(property)) + suppressLeadingAndTrailingTrivia(property.initializer); + copyComments(arg, property); + return property; + }); + if (hasRestParameter2 && functionArguments.length >= parameters.length) { + const restArguments = functionArguments.slice(parameters.length - 1); + const restProperty = factory.createPropertyAssignment(getParameterName(last(parameters)), factory.createArrayLiteralExpression(restArguments)); + properties.push(restProperty); + } + const objectLiteral = factory.createObjectLiteralExpression( + properties, + /*multiLine*/ + false + ); + return objectLiteral; + } + function createNewParameters(functionDeclaration, program, host) { + const checker = program.getTypeChecker(); + const refactorableParameters = getRefactorableParameters(functionDeclaration.parameters); + const bindingElements = map(refactorableParameters, createBindingElementFromParameterDeclaration); + const objectParameterName = factory.createObjectBindingPattern(bindingElements); + const objectParameterType = createParameterTypeNode(refactorableParameters); + let objectInitializer; + if (every(refactorableParameters, isOptionalParameter)) { + objectInitializer = factory.createObjectLiteralExpression(); + } + const objectParameter = factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + objectParameterName, + /*questionToken*/ + void 0, + objectParameterType, + objectInitializer + ); + if (hasThisParameter(functionDeclaration.parameters)) { + const thisParameter = functionDeclaration.parameters[0]; + const newThisParameter = factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + thisParameter.name, + /*questionToken*/ + void 0, + thisParameter.type + ); + suppressLeadingAndTrailingTrivia(newThisParameter.name); + copyComments(thisParameter.name, newThisParameter.name); + if (thisParameter.type) { + suppressLeadingAndTrailingTrivia(newThisParameter.type); + copyComments(thisParameter.type, newThisParameter.type); + } + return factory.createNodeArray([newThisParameter, objectParameter]); + } + return factory.createNodeArray([objectParameter]); + function createBindingElementFromParameterDeclaration(parameterDeclaration) { + const element = factory.createBindingElement( + /*dotDotDotToken*/ + void 0, + /*propertyName*/ + void 0, + getParameterName(parameterDeclaration), + isRestParameter(parameterDeclaration) && isOptionalParameter(parameterDeclaration) ? factory.createArrayLiteralExpression() : parameterDeclaration.initializer + ); + suppressLeadingAndTrailingTrivia(element); + if (parameterDeclaration.initializer && element.initializer) { + copyComments(parameterDeclaration.initializer, element.initializer); + } + return element; + } + function createParameterTypeNode(parameters) { + const members = map(parameters, createPropertySignatureFromParameterDeclaration); + const typeNode = addEmitFlags(factory.createTypeLiteralNode(members), 1 /* SingleLine */); + return typeNode; + } + function createPropertySignatureFromParameterDeclaration(parameterDeclaration) { + let parameterType = parameterDeclaration.type; + if (!parameterType && (parameterDeclaration.initializer || isRestParameter(parameterDeclaration))) { + parameterType = getTypeNode3(parameterDeclaration); + } + const propertySignature = factory.createPropertySignature( + /*modifiers*/ + void 0, + getParameterName(parameterDeclaration), + isOptionalParameter(parameterDeclaration) ? factory.createToken(58 /* QuestionToken */) : parameterDeclaration.questionToken, + parameterType + ); + suppressLeadingAndTrailingTrivia(propertySignature); + copyComments(parameterDeclaration.name, propertySignature.name); + if (parameterDeclaration.type && propertySignature.type) { + copyComments(parameterDeclaration.type, propertySignature.type); + } + return propertySignature; + } + function getTypeNode3(node) { + const type = checker.getTypeAtLocation(node); + return getTypeNodeIfAccessible(type, node, program, host); + } + function isOptionalParameter(parameterDeclaration) { + if (isRestParameter(parameterDeclaration)) { + const type = checker.getTypeAtLocation(parameterDeclaration); + return !checker.isTupleType(type); + } + return checker.isOptionalParameter(parameterDeclaration); + } + } + function getParameterName(paramDeclaration) { + return getTextOfIdentifierOrLiteral(paramDeclaration.name); + } + function getClassNames(constructorDeclaration) { + switch (constructorDeclaration.parent.kind) { + case 262 /* ClassDeclaration */: + const classDeclaration = constructorDeclaration.parent; + if (classDeclaration.name) + return [classDeclaration.name]; + const defaultModifier = Debug.checkDefined( + findModifier(classDeclaration, 90 /* DefaultKeyword */), + "Nameless class declaration should be a default export" + ); + return [defaultModifier]; + case 230 /* ClassExpression */: + const classExpression = constructorDeclaration.parent; + const variableDeclaration = constructorDeclaration.parent.parent; + const className = classExpression.name; + if (className) + return [className, variableDeclaration.name]; + return [variableDeclaration.name]; + } + } + function getFunctionNames(functionDeclaration) { + switch (functionDeclaration.kind) { + case 261 /* FunctionDeclaration */: + if (functionDeclaration.name) + return [functionDeclaration.name]; + const defaultModifier = Debug.checkDefined( + findModifier(functionDeclaration, 90 /* DefaultKeyword */), + "Nameless function declaration should be a default export" + ); + return [defaultModifier]; + case 173 /* MethodDeclaration */: + return [functionDeclaration.name]; + case 175 /* Constructor */: + const ctrKeyword = Debug.checkDefined( + findChildOfKind(functionDeclaration, 137 /* ConstructorKeyword */, functionDeclaration.getSourceFile()), + "Constructor declaration should have constructor keyword" + ); + if (functionDeclaration.parent.kind === 230 /* ClassExpression */) { + const variableDeclaration = functionDeclaration.parent.parent; + return [variableDeclaration.name, ctrKeyword]; + } + return [ctrKeyword]; + case 218 /* ArrowFunction */: + return [functionDeclaration.parent.name]; + case 217 /* FunctionExpression */: + if (functionDeclaration.name) + return [functionDeclaration.name, functionDeclaration.parent.name]; + return [functionDeclaration.parent.name]; + default: + return Debug.assertNever(functionDeclaration, `Unexpected function declaration kind ${functionDeclaration.kind}`); + } + } + var refactorName8, minimumParameterLength, refactorDescription4, toDestructuredAction; + var init_convertParamsToDestructuredObject = __esm({ + "src/services/refactors/convertParamsToDestructuredObject.ts"() { + "use strict"; + init_ts4(); + init_ts_refactor(); + refactorName8 = "Convert parameters to destructured object"; + minimumParameterLength = 1; + refactorDescription4 = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object); + toDestructuredAction = { + name: refactorName8, + description: refactorDescription4, + kind: "refactor.rewrite.parameters.toDestructured" + }; + registerRefactor(refactorName8, { + kinds: [toDestructuredAction.kind], + getEditsForAction: getRefactorEditsToConvertParametersToDestructuredObject, + getAvailableActions: getRefactorActionsToConvertParametersToDestructuredObject + }); + } + }); + + // src/services/_namespaces/ts.refactor.convertParamsToDestructuredObject.ts + var ts_refactor_convertParamsToDestructuredObject_exports = {}; + var init_ts_refactor_convertParamsToDestructuredObject = __esm({ + "src/services/_namespaces/ts.refactor.convertParamsToDestructuredObject.ts"() { + "use strict"; + init_convertParamsToDestructuredObject(); + } + }); + + // src/services/refactors/convertStringOrTemplateLiteral.ts + function getRefactorActionsToConvertToTemplateString(context) { + const { file, startPosition } = context; + const node = getNodeOrParentOfParentheses(file, startPosition); + const maybeBinary = getParentBinaryExpression(node); + const refactorInfo = { name: refactorName9, description: refactorDescription5, actions: [] }; + if (isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) { + refactorInfo.actions.push(convertStringAction); + return [refactorInfo]; + } else if (context.preferences.provideRefactorNotApplicableReason) { + refactorInfo.actions.push({ + ...convertStringAction, + notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenation) + }); + return [refactorInfo]; + } + return emptyArray; + } + function getNodeOrParentOfParentheses(file, startPosition) { + const node = getTokenAtPosition(file, startPosition); + const nestedBinary = getParentBinaryExpression(node); + const isNonStringBinary = !treeToArray(nestedBinary).isValidConcatenation; + if (isNonStringBinary && isParenthesizedExpression(nestedBinary.parent) && isBinaryExpression(nestedBinary.parent.parent)) { + return nestedBinary.parent.parent; + } + return node; + } + function getRefactorEditsToConvertToTemplateString(context, actionName2) { + const { file, startPosition } = context; + const node = getNodeOrParentOfParentheses(file, startPosition); + switch (actionName2) { + case refactorDescription5: + return { edits: getEditsForToTemplateLiteral(context, node) }; + default: + return Debug.fail("invalid action"); + } + } + function getEditsForToTemplateLiteral(context, node) { + const maybeBinary = getParentBinaryExpression(node); + const file = context.file; + const templateLiteral = nodesToTemplate(treeToArray(maybeBinary), file); + const trailingCommentRanges = getTrailingCommentRanges(file.text, maybeBinary.end); + if (trailingCommentRanges) { + const lastComment = trailingCommentRanges[trailingCommentRanges.length - 1]; + const trailingRange = { pos: trailingCommentRanges[0].pos, end: lastComment.end }; + return ts_textChanges_exports.ChangeTracker.with(context, (t) => { + t.deleteRange(file, trailingRange); + t.replaceNode(file, maybeBinary, templateLiteral); + }); + } else { + return ts_textChanges_exports.ChangeTracker.with(context, (t) => t.replaceNode(file, maybeBinary, templateLiteral)); + } + } + function isNotEqualsOperator(node) { + return node.operatorToken.kind !== 64 /* EqualsToken */; + } + function getParentBinaryExpression(expr) { + const container = findAncestor(expr.parent, (n) => { + switch (n.kind) { + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: + return false; + case 227 /* TemplateExpression */: + case 225 /* BinaryExpression */: + return !(isBinaryExpression(n.parent) && isNotEqualsOperator(n.parent)); + default: + return "quit"; + } + }); + return container || expr; + } + function treeToArray(current) { + const loop = (current2) => { + if (!isBinaryExpression(current2)) { + return { + nodes: [current2], + operators: [], + validOperators: true, + hasString: isStringLiteral(current2) || isNoSubstitutionTemplateLiteral(current2) + }; + } + const { nodes: nodes2, operators: operators2, hasString: leftHasString, validOperators: leftOperatorValid } = loop(current2.left); + if (!(leftHasString || isStringLiteral(current2.right) || isTemplateExpression(current2.right))) { + return { nodes: [current2], operators: [], hasString: false, validOperators: true }; + } + const currentOperatorValid = current2.operatorToken.kind === 40 /* PlusToken */; + const validOperators2 = leftOperatorValid && currentOperatorValid; + nodes2.push(current2.right); + operators2.push(current2.operatorToken); + return { nodes: nodes2, operators: operators2, hasString: true, validOperators: validOperators2 }; + }; + const { nodes, operators, validOperators, hasString } = loop(current); + return { nodes, operators, isValidConcatenation: validOperators && hasString }; + } + function escapeRawStringForTemplate(s) { + return s.replace(/\\.|[$`]/g, (m) => m[0] === "\\" ? m : "\\" + m); + } + function getRawTextOfTemplate(node) { + const rightShaving = isTemplateHead(node) || isTemplateMiddle(node) ? -2 : -1; + return getTextOfNode(node).slice(1, rightShaving); + } + function concatConsecutiveString(index, nodes) { + const indexes = []; + let text = "", rawText = ""; + while (index < nodes.length) { + const node = nodes[index]; + if (isStringLiteralLike(node)) { + text += node.text; + rawText += escapeRawStringForTemplate(getTextOfNode(node).slice(1, -1)); + indexes.push(index); + index++; + } else if (isTemplateExpression(node)) { + text += node.head.text; + rawText += getRawTextOfTemplate(node.head); + break; + } else { + break; + } + } + return [index, text, rawText, indexes]; + } + function nodesToTemplate({ nodes, operators }, file) { + const copyOperatorComments = copyTrailingOperatorComments(operators, file); + const copyCommentFromStringLiterals = copyCommentFromMultiNode(nodes, file, copyOperatorComments); + const [begin, headText, rawHeadText, headIndexes] = concatConsecutiveString(0, nodes); + if (begin === nodes.length) { + const noSubstitutionTemplateLiteral = factory.createNoSubstitutionTemplateLiteral(headText, rawHeadText); + copyCommentFromStringLiterals(headIndexes, noSubstitutionTemplateLiteral); + return noSubstitutionTemplateLiteral; + } + const templateSpans = []; + const templateHead = factory.createTemplateHead(headText, rawHeadText); + copyCommentFromStringLiterals(headIndexes, templateHead); + for (let i = begin; i < nodes.length; i++) { + const currentNode = getExpressionFromParenthesesOrExpression(nodes[i]); + copyOperatorComments(i, currentNode); + const [newIndex, subsequentText, rawSubsequentText, stringIndexes] = concatConsecutiveString(i + 1, nodes); + i = newIndex - 1; + const isLast = i === nodes.length - 1; + if (isTemplateExpression(currentNode)) { + const spans = map(currentNode.templateSpans, (span, index) => { + copyExpressionComments(span); + const isLastSpan = index === currentNode.templateSpans.length - 1; + const text = span.literal.text + (isLastSpan ? subsequentText : ""); + const rawText = getRawTextOfTemplate(span.literal) + (isLastSpan ? rawSubsequentText : ""); + return factory.createTemplateSpan(span.expression, isLast && isLastSpan ? factory.createTemplateTail(text, rawText) : factory.createTemplateMiddle(text, rawText)); + }); + templateSpans.push(...spans); + } else { + const templatePart = isLast ? factory.createTemplateTail(subsequentText, rawSubsequentText) : factory.createTemplateMiddle(subsequentText, rawSubsequentText); + copyCommentFromStringLiterals(stringIndexes, templatePart); + templateSpans.push(factory.createTemplateSpan(currentNode, templatePart)); + } + } + return factory.createTemplateExpression(templateHead, templateSpans); + } + function copyExpressionComments(node) { + const file = node.getSourceFile(); + copyTrailingComments( + node, + node.expression, + file, + 3 /* MultiLineCommentTrivia */, + /*hasTrailingNewLine*/ + false + ); + copyTrailingAsLeadingComments( + node.expression, + node.expression, + file, + 3 /* MultiLineCommentTrivia */, + /*hasTrailingNewLine*/ + false + ); + } + function getExpressionFromParenthesesOrExpression(node) { + if (isParenthesizedExpression(node)) { + copyExpressionComments(node); + node = node.expression; + } + return node; + } + var refactorName9, refactorDescription5, convertStringAction, copyTrailingOperatorComments, copyCommentFromMultiNode; + var init_convertStringOrTemplateLiteral = __esm({ + "src/services/refactors/convertStringOrTemplateLiteral.ts"() { + "use strict"; + init_ts4(); + init_ts_refactor(); + refactorName9 = "Convert to template string"; + refactorDescription5 = getLocaleSpecificMessage(Diagnostics.Convert_to_template_string); + convertStringAction = { + name: refactorName9, + description: refactorDescription5, + kind: "refactor.rewrite.string" + }; + registerRefactor(refactorName9, { + kinds: [convertStringAction.kind], + getEditsForAction: getRefactorEditsToConvertToTemplateString, + getAvailableActions: getRefactorActionsToConvertToTemplateString + }); + copyTrailingOperatorComments = (operators, file) => (index, targetNode) => { + if (index < operators.length) { + copyTrailingComments( + operators[index], + targetNode, + file, + 3 /* MultiLineCommentTrivia */, + /*hasTrailingNewLine*/ + false + ); + } + }; + copyCommentFromMultiNode = (nodes, file, copyOperatorComments) => (indexes, targetNode) => { + while (indexes.length > 0) { + const index = indexes.shift(); + copyTrailingComments( + nodes[index], + targetNode, + file, + 3 /* MultiLineCommentTrivia */, + /*hasTrailingNewLine*/ + false + ); + copyOperatorComments(index, targetNode); + } + }; + } + }); + + // src/services/_namespaces/ts.refactor.convertStringOrTemplateLiteral.ts + var ts_refactor_convertStringOrTemplateLiteral_exports = {}; + var init_ts_refactor_convertStringOrTemplateLiteral = __esm({ + "src/services/_namespaces/ts.refactor.convertStringOrTemplateLiteral.ts"() { + "use strict"; + init_convertStringOrTemplateLiteral(); + } + }); + + // src/services/refactors/convertToOptionalChainExpression.ts + function getRefactorActionsToConvertToOptionalChain(context) { + const info = getInfo3(context, context.triggerReason === "invoked"); + if (!info) + return emptyArray; + if (!isRefactorErrorInfo(info)) { + return [{ + name: refactorName10, + description: convertToOptionalChainExpressionMessage, + actions: [toOptionalChainAction] + }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return [{ + name: refactorName10, + description: convertToOptionalChainExpressionMessage, + actions: [{ ...toOptionalChainAction, notApplicableReason: info.error }] + }]; + } + return emptyArray; + } + function getRefactorEditsToConvertToOptionalChain(context, actionName2) { + const info = getInfo3(context); + Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); + const edits = ts_textChanges_exports.ChangeTracker.with( + context, + (t) => doChange6(context.file, context.program.getTypeChecker(), t, info, actionName2) + ); + return { edits, renameFilename: void 0, renameLocation: void 0 }; + } + function isValidExpression(node) { + return isBinaryExpression(node) || isConditionalExpression(node); + } + function isValidStatement(node) { + return isExpressionStatement(node) || isReturnStatement(node) || isVariableStatement(node); + } + function isValidExpressionOrStatement(node) { + return isValidExpression(node) || isValidStatement(node); + } + function getInfo3(context, considerEmptySpans = true) { + const { file, program } = context; + const span = getRefactorContextSpan(context); + const forEmptySpan = span.length === 0; + if (forEmptySpan && !considerEmptySpans) + return void 0; + const startToken = getTokenAtPosition(file, span.start); + const endToken = findTokenOnLeftOfPosition(file, span.start + span.length); + const adjustedSpan = createTextSpanFromBounds(startToken.pos, endToken && endToken.end >= startToken.pos ? endToken.getEnd() : startToken.getEnd()); + const parent2 = forEmptySpan ? getValidParentNodeOfEmptySpan(startToken) : getValidParentNodeContainingSpan(startToken, adjustedSpan); + const expression = parent2 && isValidExpressionOrStatement(parent2) ? getExpression(parent2) : void 0; + if (!expression) + return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_convertible_access_expression) }; + const checker = program.getTypeChecker(); + return isConditionalExpression(expression) ? getConditionalInfo(expression, checker) : getBinaryInfo(expression); + } + function getConditionalInfo(expression, checker) { + const condition = expression.condition; + const finalExpression = getFinalExpressionInChain(expression.whenTrue); + if (!finalExpression || checker.isNullableType(checker.getTypeAtLocation(finalExpression))) { + return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_convertible_access_expression) }; + } + if ((isPropertyAccessExpression(condition) || isIdentifier(condition)) && getMatchingStart(condition, finalExpression.expression)) { + return { finalExpression, occurrences: [condition], expression }; + } else if (isBinaryExpression(condition)) { + const occurrences = getOccurrencesInExpression(finalExpression.expression, condition); + return occurrences ? { finalExpression, occurrences, expression } : { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_matching_access_expressions) }; + } + } + function getBinaryInfo(expression) { + if (expression.operatorToken.kind !== 56 /* AmpersandAmpersandToken */) { + return { error: getLocaleSpecificMessage(Diagnostics.Can_only_convert_logical_AND_access_chains) }; + } + const finalExpression = getFinalExpressionInChain(expression.right); + if (!finalExpression) + return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_convertible_access_expression) }; + const occurrences = getOccurrencesInExpression(finalExpression.expression, expression.left); + return occurrences ? { finalExpression, occurrences, expression } : { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_matching_access_expressions) }; + } + function getOccurrencesInExpression(matchTo, expression) { + const occurrences = []; + while (isBinaryExpression(expression) && expression.operatorToken.kind === 56 /* AmpersandAmpersandToken */) { + const match = getMatchingStart(skipParentheses(matchTo), skipParentheses(expression.right)); + if (!match) { + break; + } + occurrences.push(match); + matchTo = match; + expression = expression.left; + } + const finalMatch = getMatchingStart(matchTo, expression); + if (finalMatch) { + occurrences.push(finalMatch); + } + return occurrences.length > 0 ? occurrences : void 0; + } + function getMatchingStart(chain, subchain) { + if (!isIdentifier(subchain) && !isPropertyAccessExpression(subchain) && !isElementAccessExpression(subchain)) { + return void 0; + } + return chainStartsWith(chain, subchain) ? subchain : void 0; + } + function chainStartsWith(chain, subchain) { + while (isCallExpression(chain) || isPropertyAccessExpression(chain) || isElementAccessExpression(chain)) { + if (getTextOfChainNode(chain) === getTextOfChainNode(subchain)) + break; + chain = chain.expression; + } + while (isPropertyAccessExpression(chain) && isPropertyAccessExpression(subchain) || isElementAccessExpression(chain) && isElementAccessExpression(subchain)) { + if (getTextOfChainNode(chain) !== getTextOfChainNode(subchain)) + return false; + chain = chain.expression; + subchain = subchain.expression; + } + return isIdentifier(chain) && isIdentifier(subchain) && chain.getText() === subchain.getText(); + } + function getTextOfChainNode(node) { + if (isIdentifier(node) || isStringOrNumericLiteralLike(node)) { + return node.getText(); + } + if (isPropertyAccessExpression(node)) { + return getTextOfChainNode(node.name); + } + if (isElementAccessExpression(node)) { + return getTextOfChainNode(node.argumentExpression); + } + return void 0; + } + function getValidParentNodeContainingSpan(node, span) { + while (node.parent) { + if (isValidExpressionOrStatement(node) && span.length !== 0 && node.end >= span.start + span.length) { + return node; + } + node = node.parent; + } + return void 0; + } + function getValidParentNodeOfEmptySpan(node) { + while (node.parent) { + if (isValidExpressionOrStatement(node) && !isValidExpressionOrStatement(node.parent)) { + return node; + } + node = node.parent; + } + return void 0; + } + function getExpression(node) { + if (isValidExpression(node)) { + return node; + } + if (isVariableStatement(node)) { + const variable = getSingleVariableOfVariableStatement(node); + const initializer = variable == null ? void 0 : variable.initializer; + return initializer && isValidExpression(initializer) ? initializer : void 0; + } + return node.expression && isValidExpression(node.expression) ? node.expression : void 0; + } + function getFinalExpressionInChain(node) { + node = skipParentheses(node); + if (isBinaryExpression(node)) { + return getFinalExpressionInChain(node.left); + } else if ((isPropertyAccessExpression(node) || isElementAccessExpression(node) || isCallExpression(node)) && !isOptionalChain(node)) { + return node; + } + return void 0; + } + function convertOccurrences(checker, toConvert, occurrences) { + if (isPropertyAccessExpression(toConvert) || isElementAccessExpression(toConvert) || isCallExpression(toConvert)) { + const chain = convertOccurrences(checker, toConvert.expression, occurrences); + const lastOccurrence = occurrences.length > 0 ? occurrences[occurrences.length - 1] : void 0; + const isOccurrence = (lastOccurrence == null ? void 0 : lastOccurrence.getText()) === toConvert.expression.getText(); + if (isOccurrence) + occurrences.pop(); + if (isCallExpression(toConvert)) { + return isOccurrence ? factory.createCallChain(chain, factory.createToken(29 /* QuestionDotToken */), toConvert.typeArguments, toConvert.arguments) : factory.createCallChain(chain, toConvert.questionDotToken, toConvert.typeArguments, toConvert.arguments); + } else if (isPropertyAccessExpression(toConvert)) { + return isOccurrence ? factory.createPropertyAccessChain(chain, factory.createToken(29 /* QuestionDotToken */), toConvert.name) : factory.createPropertyAccessChain(chain, toConvert.questionDotToken, toConvert.name); + } else if (isElementAccessExpression(toConvert)) { + return isOccurrence ? factory.createElementAccessChain(chain, factory.createToken(29 /* QuestionDotToken */), toConvert.argumentExpression) : factory.createElementAccessChain(chain, toConvert.questionDotToken, toConvert.argumentExpression); + } + } + return toConvert; + } + function doChange6(sourceFile, checker, changes, info, _actionName) { + const { finalExpression, occurrences, expression } = info; + const firstOccurrence = occurrences[occurrences.length - 1]; + const convertedChain = convertOccurrences(checker, finalExpression, occurrences); + if (convertedChain && (isPropertyAccessExpression(convertedChain) || isElementAccessExpression(convertedChain) || isCallExpression(convertedChain))) { + if (isBinaryExpression(expression)) { + changes.replaceNodeRange(sourceFile, firstOccurrence, finalExpression, convertedChain); + } else if (isConditionalExpression(expression)) { + changes.replaceNode( + sourceFile, + expression, + factory.createBinaryExpression(convertedChain, factory.createToken(61 /* QuestionQuestionToken */), expression.whenFalse) + ); + } + } + } + var refactorName10, convertToOptionalChainExpressionMessage, toOptionalChainAction; + var init_convertToOptionalChainExpression = __esm({ + "src/services/refactors/convertToOptionalChainExpression.ts"() { + "use strict"; + init_ts4(); + init_ts_refactor(); + refactorName10 = "Convert to optional chain expression"; + convertToOptionalChainExpressionMessage = getLocaleSpecificMessage(Diagnostics.Convert_to_optional_chain_expression); + toOptionalChainAction = { + name: refactorName10, + description: convertToOptionalChainExpressionMessage, + kind: "refactor.rewrite.expression.optionalChain" + }; + registerRefactor(refactorName10, { + kinds: [toOptionalChainAction.kind], + getEditsForAction: getRefactorEditsToConvertToOptionalChain, + getAvailableActions: getRefactorActionsToConvertToOptionalChain + }); + } + }); + + // src/services/_namespaces/ts.refactor.convertToOptionalChainExpression.ts + var ts_refactor_convertToOptionalChainExpression_exports = {}; + var init_ts_refactor_convertToOptionalChainExpression = __esm({ + "src/services/_namespaces/ts.refactor.convertToOptionalChainExpression.ts"() { + "use strict"; + init_convertToOptionalChainExpression(); + } + }); + + // src/services/refactors/extractSymbol.ts + function getRefactorActionsToExtractSymbol(context) { + const requestedRefactor = context.kind; + const rangeToExtract = getRangeToExtract2(context.file, getRefactorContextSpan(context), context.triggerReason === "invoked"); + const targetRange = rangeToExtract.targetRange; + if (targetRange === void 0) { + if (!rangeToExtract.errors || rangeToExtract.errors.length === 0 || !context.preferences.provideRefactorNotApplicableReason) { + return emptyArray; + } + const errors = []; + if (refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) { + errors.push({ + name: refactorName11, + description: extractFunctionAction.description, + actions: [{ ...extractFunctionAction, notApplicableReason: getStringError(rangeToExtract.errors) }] + }); + } + if (refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) { + errors.push({ + name: refactorName11, + description: extractConstantAction.description, + actions: [{ ...extractConstantAction, notApplicableReason: getStringError(rangeToExtract.errors) }] + }); + } + return errors; + } + const extractions = getPossibleExtractions(targetRange, context); + if (extractions === void 0) { + return emptyArray; + } + const functionActions = []; + const usedFunctionNames = /* @__PURE__ */ new Map(); + let innermostErrorFunctionAction; + const constantActions = []; + const usedConstantNames = /* @__PURE__ */ new Map(); + let innermostErrorConstantAction; + let i = 0; + for (const { functionExtraction, constantExtraction } of extractions) { + if (refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) { + const description3 = functionExtraction.description; + if (functionExtraction.errors.length === 0) { + if (!usedFunctionNames.has(description3)) { + usedFunctionNames.set(description3, true); + functionActions.push({ + description: description3, + name: `function_scope_${i}`, + kind: extractFunctionAction.kind + }); + } + } else if (!innermostErrorFunctionAction) { + innermostErrorFunctionAction = { + description: description3, + name: `function_scope_${i}`, + notApplicableReason: getStringError(functionExtraction.errors), + kind: extractFunctionAction.kind + }; + } + } + if (refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) { + const description3 = constantExtraction.description; + if (constantExtraction.errors.length === 0) { + if (!usedConstantNames.has(description3)) { + usedConstantNames.set(description3, true); + constantActions.push({ + description: description3, + name: `constant_scope_${i}`, + kind: extractConstantAction.kind + }); + } + } else if (!innermostErrorConstantAction) { + innermostErrorConstantAction = { + description: description3, + name: `constant_scope_${i}`, + notApplicableReason: getStringError(constantExtraction.errors), + kind: extractConstantAction.kind + }; + } + } + i++; + } + const infos = []; + if (functionActions.length) { + infos.push({ + name: refactorName11, + description: getLocaleSpecificMessage(Diagnostics.Extract_function), + actions: functionActions + }); + } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorFunctionAction) { + infos.push({ + name: refactorName11, + description: getLocaleSpecificMessage(Diagnostics.Extract_function), + actions: [innermostErrorFunctionAction] + }); + } + if (constantActions.length) { + infos.push({ + name: refactorName11, + description: getLocaleSpecificMessage(Diagnostics.Extract_constant), + actions: constantActions + }); + } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorConstantAction) { + infos.push({ + name: refactorName11, + description: getLocaleSpecificMessage(Diagnostics.Extract_constant), + actions: [innermostErrorConstantAction] + }); + } + return infos.length ? infos : emptyArray; + function getStringError(errors) { + let error = errors[0].messageText; + if (typeof error !== "string") { + error = error.messageText; + } + return error; + } + } + function getRefactorEditsToExtractSymbol(context, actionName2) { + const rangeToExtract = getRangeToExtract2(context.file, getRefactorContextSpan(context)); + const targetRange = rangeToExtract.targetRange; + const parsedFunctionIndexMatch = /^function_scope_(\d+)$/.exec(actionName2); + if (parsedFunctionIndexMatch) { + const index = +parsedFunctionIndexMatch[1]; + Debug.assert(isFinite(index), "Expected to parse a finite number from the function scope index"); + return getFunctionExtractionAtIndex(targetRange, context, index); + } + const parsedConstantIndexMatch = /^constant_scope_(\d+)$/.exec(actionName2); + if (parsedConstantIndexMatch) { + const index = +parsedConstantIndexMatch[1]; + Debug.assert(isFinite(index), "Expected to parse a finite number from the constant scope index"); + return getConstantExtractionAtIndex(targetRange, context, index); + } + Debug.fail("Unrecognized action name"); + } + function getRangeToExtract2(sourceFile, span, invoked = true) { + const { length: length2 } = span; + if (length2 === 0 && !invoked) { + return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractEmpty)] }; + } + const cursorRequest = length2 === 0 && invoked; + const startToken = findFirstNonJsxWhitespaceToken(sourceFile, span.start); + const endToken = findTokenOnLeftOfPosition(sourceFile, textSpanEnd(span)); + const adjustedSpan = startToken && endToken && invoked ? getAdjustedSpanFromNodes(startToken, endToken, sourceFile) : span; + const start = cursorRequest ? getExtractableParent(startToken) : getParentNodeInSpan(startToken, sourceFile, adjustedSpan); + const end = cursorRequest ? start : getParentNodeInSpan(endToken, sourceFile, adjustedSpan); + let rangeFacts = 0 /* None */; + let thisNode; + if (!start || !end) { + return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractRange)] }; + } + if (start.flags & 8388608 /* JSDoc */) { + return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractJSDoc)] }; + } + if (start.parent !== end.parent) { + return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractRange)] }; + } + if (start !== end) { + if (!isBlockLike(start.parent)) { + return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractRange)] }; + } + const statements = []; + for (const statement of start.parent.statements) { + if (statement === start || statements.length) { + const errors2 = checkNode(statement); + if (errors2) { + return { errors: errors2 }; + } + statements.push(statement); + } + if (statement === end) { + break; + } + } + if (!statements.length) { + return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractRange)] }; + } + return { targetRange: { range: statements, facts: rangeFacts, thisNode } }; + } + if (isReturnStatement(start) && !start.expression) { + return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractRange)] }; + } + const node = refineNode(start); + const errors = checkRootNode(node) || checkNode(node); + if (errors) { + return { errors }; + } + return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, thisNode } }; + function refineNode(node2) { + if (isReturnStatement(node2)) { + if (node2.expression) { + return node2.expression; + } + } else if (isVariableStatement(node2) || isVariableDeclarationList(node2)) { + const declarations = isVariableStatement(node2) ? node2.declarationList.declarations : node2.declarations; + let numInitializers = 0; + let lastInitializer; + for (const declaration of declarations) { + if (declaration.initializer) { + numInitializers++; + lastInitializer = declaration.initializer; + } + } + if (numInitializers === 1) { + return lastInitializer; + } + } else if (isVariableDeclaration(node2)) { + if (node2.initializer) { + return node2.initializer; + } + } + return node2; + } + function checkRootNode(node2) { + if (isIdentifier(isExpressionStatement(node2) ? node2.expression : node2)) { + return [createDiagnosticForNode(node2, Messages.cannotExtractIdentifier)]; + } + return void 0; + } + function checkForStaticContext(nodeToCheck, containingClass) { + let current = nodeToCheck; + while (current !== containingClass) { + if (current.kind === 171 /* PropertyDeclaration */) { + if (isStatic(current)) { + rangeFacts |= 32 /* InStaticRegion */; + } + break; + } else if (current.kind === 168 /* Parameter */) { + const ctorOrMethod = getContainingFunction(current); + if (ctorOrMethod.kind === 175 /* Constructor */) { + rangeFacts |= 32 /* InStaticRegion */; + } + break; + } else if (current.kind === 173 /* MethodDeclaration */) { + if (isStatic(current)) { + rangeFacts |= 32 /* InStaticRegion */; + } + } + current = current.parent; + } + } + function checkNode(nodeToCheck) { + let PermittedJumps; + ((PermittedJumps2) => { + PermittedJumps2[PermittedJumps2["None"] = 0] = "None"; + PermittedJumps2[PermittedJumps2["Break"] = 1] = "Break"; + PermittedJumps2[PermittedJumps2["Continue"] = 2] = "Continue"; + PermittedJumps2[PermittedJumps2["Return"] = 4] = "Return"; + })(PermittedJumps || (PermittedJumps = {})); + Debug.assert(nodeToCheck.pos <= nodeToCheck.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (1)"); + Debug.assert(!positionIsSynthesized(nodeToCheck.pos), "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (2)"); + if (!isStatement(nodeToCheck) && !(isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck)) && !isStringLiteralJsxAttribute(nodeToCheck)) { + return [createDiagnosticForNode(nodeToCheck, Messages.statementOrExpressionExpected)]; + } + if (nodeToCheck.flags & 16777216 /* Ambient */) { + return [createDiagnosticForNode(nodeToCheck, Messages.cannotExtractAmbientBlock)]; + } + const containingClass = getContainingClass(nodeToCheck); + if (containingClass) { + checkForStaticContext(nodeToCheck, containingClass); + } + let errors2; + let permittedJumps = 4 /* Return */; + let seenLabels; + visit(nodeToCheck); + if (rangeFacts & 8 /* UsesThis */) { + const container = getThisContainer( + nodeToCheck, + /*includeArrowFunctions*/ + false, + /*includeClassComputedPropertyName*/ + false + ); + if (container.kind === 261 /* FunctionDeclaration */ || container.kind === 173 /* MethodDeclaration */ && container.parent.kind === 209 /* ObjectLiteralExpression */ || container.kind === 217 /* FunctionExpression */) { + rangeFacts |= 16 /* UsesThisInFunction */; + } + } + return errors2; + function visit(node2) { + if (errors2) { + return true; + } + if (isDeclaration(node2)) { + const declaringNode = node2.kind === 259 /* VariableDeclaration */ ? node2.parent.parent : node2; + if (hasSyntacticModifier(declaringNode, 1 /* Export */)) { + (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractExportedEntity)); + return true; + } + } + switch (node2.kind) { + case 271 /* ImportDeclaration */: + (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractImport)); + return true; + case 276 /* ExportAssignment */: + (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractExportedEntity)); + return true; + case 108 /* SuperKeyword */: + if (node2.parent.kind === 212 /* CallExpression */) { + const containingClass2 = getContainingClass(node2); + if (containingClass2 === void 0 || containingClass2.pos < span.start || containingClass2.end >= span.start + span.length) { + (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractSuper)); + return true; + } + } else { + rangeFacts |= 8 /* UsesThis */; + thisNode = node2; + } + break; + case 218 /* ArrowFunction */: + forEachChild(node2, function check(n) { + if (isThis(n)) { + rangeFacts |= 8 /* UsesThis */; + thisNode = node2; + } else if (isClassLike(n) || isFunctionLike(n) && !isArrowFunction(n)) { + return false; + } else { + forEachChild(n, check); + } + }); + case 262 /* ClassDeclaration */: + case 261 /* FunctionDeclaration */: + if (isSourceFile(node2.parent) && node2.parent.externalModuleIndicator === void 0) { + (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.functionWillNotBeVisibleInTheNewScope)); + } + case 230 /* ClassExpression */: + case 217 /* FunctionExpression */: + case 173 /* MethodDeclaration */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + return false; + } + const savedPermittedJumps = permittedJumps; + switch (node2.kind) { + case 244 /* IfStatement */: + permittedJumps &= ~4 /* Return */; + break; + case 257 /* TryStatement */: + permittedJumps = 0 /* None */; + break; + case 240 /* Block */: + if (node2.parent && node2.parent.kind === 257 /* TryStatement */ && node2.parent.finallyBlock === node2) { + permittedJumps = 4 /* Return */; + } + break; + case 296 /* DefaultClause */: + case 295 /* CaseClause */: + permittedJumps |= 1 /* Break */; + break; + default: + if (isIterationStatement( + node2, + /*lookInLabeledStatements*/ + false + )) { + permittedJumps |= 1 /* Break */ | 2 /* Continue */; + } + break; + } + switch (node2.kind) { + case 196 /* ThisType */: + case 110 /* ThisKeyword */: + rangeFacts |= 8 /* UsesThis */; + thisNode = node2; + break; + case 255 /* LabeledStatement */: { + const label = node2.label; + (seenLabels || (seenLabels = [])).push(label.escapedText); + forEachChild(node2, visit); + seenLabels.pop(); + break; + } + case 251 /* BreakStatement */: + case 250 /* ContinueStatement */: { + const label = node2.label; + if (label) { + if (!contains(seenLabels, label.escapedText)) { + (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractRangeContainingLabeledBreakOrContinueStatementWithTargetOutsideOfTheRange)); + } + } else { + if (!(permittedJumps & (node2.kind === 251 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) { + (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); + } + } + break; + } + case 222 /* AwaitExpression */: + rangeFacts |= 4 /* IsAsyncFunction */; + break; + case 228 /* YieldExpression */: + rangeFacts |= 2 /* IsGenerator */; + break; + case 252 /* ReturnStatement */: + if (permittedJumps & 4 /* Return */) { + rangeFacts |= 1 /* HasReturn */; + } else { + (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractRangeContainingConditionalReturnStatement)); + } + break; + default: + forEachChild(node2, visit); + break; + } + permittedJumps = savedPermittedJumps; + } + } + } + function getAdjustedSpanFromNodes(startNode2, endNode2, sourceFile) { + const start = startNode2.getStart(sourceFile); + let end = endNode2.getEnd(); + if (sourceFile.text.charCodeAt(end) === 59 /* semicolon */) { + end++; + } + return { start, length: end - start }; + } + function getStatementOrExpressionRange(node) { + if (isStatement(node)) { + return [node]; + } + if (isExpressionNode(node)) { + return isExpressionStatement(node.parent) ? [node.parent] : node; + } + if (isStringLiteralJsxAttribute(node)) { + return node; + } + return void 0; + } + function isScope(node) { + return isArrowFunction(node) ? isFunctionBody(node.body) : isFunctionLikeDeclaration(node) || isSourceFile(node) || isModuleBlock(node) || isClassLike(node); + } + function collectEnclosingScopes(range) { + let current = isReadonlyArray(range.range) ? first(range.range) : range.range; + if (range.facts & 8 /* UsesThis */ && !(range.facts & 16 /* UsesThisInFunction */)) { + const containingClass = getContainingClass(current); + if (containingClass) { + const containingFunction = findAncestor(current, isFunctionLikeDeclaration); + return containingFunction ? [containingFunction, containingClass] : [containingClass]; + } + } + const scopes = []; + while (true) { + current = current.parent; + if (current.kind === 168 /* Parameter */) { + current = findAncestor(current, (parent2) => isFunctionLikeDeclaration(parent2)).parent; + } + if (isScope(current)) { + scopes.push(current); + if (current.kind === 311 /* SourceFile */) { + return scopes; + } + } + } + } + function getFunctionExtractionAtIndex(targetRange, context, requestedChangesIndex) { + const { scopes, readsAndWrites: { target, usagesPerScope, functionErrorsPerScope, exposedVariableDeclarations } } = getPossibleExtractionsWorker(targetRange, context); + Debug.assert(!functionErrorsPerScope[requestedChangesIndex].length, "The extraction went missing? How?"); + context.cancellationToken.throwIfCancellationRequested(); + return extractFunctionInScope(target, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], exposedVariableDeclarations, targetRange, context); + } + function getConstantExtractionAtIndex(targetRange, context, requestedChangesIndex) { + const { scopes, readsAndWrites: { target, usagesPerScope, constantErrorsPerScope, exposedVariableDeclarations } } = getPossibleExtractionsWorker(targetRange, context); + Debug.assert(!constantErrorsPerScope[requestedChangesIndex].length, "The extraction went missing? How?"); + Debug.assert(exposedVariableDeclarations.length === 0, "Extract constant accepted a range containing a variable declaration?"); + context.cancellationToken.throwIfCancellationRequested(); + const expression = isExpression(target) ? target : target.statements[0].expression; + return extractConstantInScope(expression, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], targetRange.facts, context); + } + function getPossibleExtractions(targetRange, context) { + const { scopes, readsAndWrites: { functionErrorsPerScope, constantErrorsPerScope } } = getPossibleExtractionsWorker(targetRange, context); + const extractions = scopes.map((scope, i) => { + const functionDescriptionPart = getDescriptionForFunctionInScope(scope); + const constantDescriptionPart = getDescriptionForConstantInScope(scope); + const scopeDescription = isFunctionLikeDeclaration(scope) ? getDescriptionForFunctionLikeDeclaration(scope) : isClassLike(scope) ? getDescriptionForClassLikeDeclaration(scope) : getDescriptionForModuleLikeDeclaration(scope); + let functionDescription; + let constantDescription; + if (scopeDescription === 1 /* Global */) { + functionDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [functionDescriptionPart, "global"]); + constantDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [constantDescriptionPart, "global"]); + } else if (scopeDescription === 0 /* Module */) { + functionDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [functionDescriptionPart, "module"]); + constantDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [constantDescriptionPart, "module"]); + } else { + functionDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1), [functionDescriptionPart, scopeDescription]); + constantDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1), [constantDescriptionPart, scopeDescription]); + } + if (i === 0 && !isClassLike(scope)) { + constantDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_enclosing_scope), [constantDescriptionPart]); + } + return { + functionExtraction: { + description: functionDescription, + errors: functionErrorsPerScope[i] + }, + constantExtraction: { + description: constantDescription, + errors: constantErrorsPerScope[i] + } + }; + }); + return extractions; + } + function getPossibleExtractionsWorker(targetRange, context) { + const { file: sourceFile } = context; + const scopes = collectEnclosingScopes(targetRange); + const enclosingTextRange = getEnclosingTextRange(targetRange, sourceFile); + const readsAndWrites = collectReadsAndWrites( + targetRange, + scopes, + enclosingTextRange, + sourceFile, + context.program.getTypeChecker(), + context.cancellationToken + ); + return { scopes, readsAndWrites }; + } + function getDescriptionForFunctionInScope(scope) { + return isFunctionLikeDeclaration(scope) ? "inner function" : isClassLike(scope) ? "method" : "function"; + } + function getDescriptionForConstantInScope(scope) { + return isClassLike(scope) ? "readonly field" : "constant"; + } + function getDescriptionForFunctionLikeDeclaration(scope) { + switch (scope.kind) { + case 175 /* Constructor */: + return "constructor"; + case 217 /* FunctionExpression */: + case 261 /* FunctionDeclaration */: + return scope.name ? `function '${scope.name.text}'` : ANONYMOUS; + case 218 /* ArrowFunction */: + return "arrow function"; + case 173 /* MethodDeclaration */: + return `method '${scope.name.getText()}'`; + case 176 /* GetAccessor */: + return `'get ${scope.name.getText()}'`; + case 177 /* SetAccessor */: + return `'set ${scope.name.getText()}'`; + default: + Debug.assertNever(scope, `Unexpected scope kind ${scope.kind}`); + } + } + function getDescriptionForClassLikeDeclaration(scope) { + return scope.kind === 262 /* ClassDeclaration */ ? scope.name ? `class '${scope.name.text}'` : "anonymous class declaration" : scope.name ? `class expression '${scope.name.text}'` : "anonymous class expression"; + } + function getDescriptionForModuleLikeDeclaration(scope) { + return scope.kind === 267 /* ModuleBlock */ ? `namespace '${scope.parent.name.getText()}'` : scope.externalModuleIndicator ? 0 /* Module */ : 1 /* Global */; + } + function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParameterUsages, substitutions }, exposedVariableDeclarations, range, context) { + const checker = context.program.getTypeChecker(); + const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions()); + const importAdder = ts_codefix_exports.createImportAdder(context.file, context.program, context.preferences, context.host); + const file = scope.getSourceFile(); + const functionNameText = getUniqueName(isClassLike(scope) ? "newMethod" : "newFunction", file); + const isJS = isInJSFile(scope); + const functionName = factory.createIdentifier(functionNameText); + let returnType; + const parameters = []; + const callArguments = []; + let writes; + usagesInScope.forEach((usage, name) => { + let typeNode; + if (!isJS) { + let type = checker.getTypeOfSymbolAtLocation(usage.symbol, usage.node); + type = checker.getBaseTypeOfLiteralType(type); + typeNode = ts_codefix_exports.typeToAutoImportableTypeNode(checker, importAdder, type, scope, scriptTarget, 1 /* NoTruncation */); + } + const paramDecl = factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + /*name*/ + name, + /*questionToken*/ + void 0, + typeNode + ); + parameters.push(paramDecl); + if (usage.usage === 2 /* Write */) { + (writes || (writes = [])).push(usage); + } + callArguments.push(factory.createIdentifier(name)); + }); + const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclarationBeforePosition(type, context.startPosition) })); + const sortedTypeParametersAndDeclarations = typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder); + const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : mapDefined(sortedTypeParametersAndDeclarations, ({ declaration }) => declaration); + const callTypeArguments = typeParameters !== void 0 ? typeParameters.map((decl) => factory.createTypeReferenceNode( + decl.name, + /*typeArguments*/ + void 0 + )) : void 0; + if (isExpression(node) && !isJS) { + const contextualType = checker.getContextualType(node); + returnType = checker.typeToTypeNode(contextualType, scope, 1 /* NoTruncation */); + } + const { body, returnValueProperty } = transformFunctionBody(node, exposedVariableDeclarations, writes, substitutions, !!(range.facts & 1 /* HasReturn */)); + suppressLeadingAndTrailingTrivia(body); + let newFunction; + const callThis = !!(range.facts & 16 /* UsesThisInFunction */); + if (isClassLike(scope)) { + const modifiers = isJS ? [] : [factory.createModifier(123 /* PrivateKeyword */)]; + if (range.facts & 32 /* InStaticRegion */) { + modifiers.push(factory.createModifier(126 /* StaticKeyword */)); + } + if (range.facts & 4 /* IsAsyncFunction */) { + modifiers.push(factory.createModifier(134 /* AsyncKeyword */)); + } + newFunction = factory.createMethodDeclaration( + modifiers.length ? modifiers : void 0, + range.facts & 2 /* IsGenerator */ ? factory.createToken(42 /* AsteriskToken */) : void 0, + functionName, + /*questionToken*/ + void 0, + typeParameters, + parameters, + returnType, + body + ); + } else { + if (callThis) { + parameters.unshift( + factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + /*name*/ + "this", + /*questionToken*/ + void 0, + checker.typeToTypeNode( + checker.getTypeAtLocation(range.thisNode), + scope, + 1 /* NoTruncation */ + ), + /*initializer*/ + void 0 + ) + ); + } + newFunction = factory.createFunctionDeclaration( + range.facts & 4 /* IsAsyncFunction */ ? [factory.createToken(134 /* AsyncKeyword */)] : void 0, + range.facts & 2 /* IsGenerator */ ? factory.createToken(42 /* AsteriskToken */) : void 0, + functionName, + typeParameters, + parameters, + returnType, + body + ); + } + const changeTracker = ts_textChanges_exports.ChangeTracker.fromContext(context); + const minInsertionPos = (isReadonlyArray(range.range) ? last(range.range) : range.range).end; + const nodeToInsertBefore = getNodeToInsertFunctionBefore(minInsertionPos, scope); + if (nodeToInsertBefore) { + changeTracker.insertNodeBefore( + context.file, + nodeToInsertBefore, + newFunction, + /*blankLineBetween*/ + true + ); + } else { + changeTracker.insertNodeAtEndOfScope(context.file, scope, newFunction); + } + importAdder.writeFixes(changeTracker); + const newNodes = []; + const called = getCalledExpression(scope, range, functionNameText); + if (callThis) { + callArguments.unshift(factory.createIdentifier("this")); + } + let call = factory.createCallExpression( + callThis ? factory.createPropertyAccessExpression( + called, + "call" + ) : called, + callTypeArguments, + // Note that no attempt is made to take advantage of type argument inference + callArguments + ); + if (range.facts & 2 /* IsGenerator */) { + call = factory.createYieldExpression(factory.createToken(42 /* AsteriskToken */), call); + } + if (range.facts & 4 /* IsAsyncFunction */) { + call = factory.createAwaitExpression(call); + } + if (isInJSXContent(node)) { + call = factory.createJsxExpression( + /*dotDotDotToken*/ + void 0, + call + ); + } + if (exposedVariableDeclarations.length && !writes) { + Debug.assert(!returnValueProperty, "Expected no returnValueProperty"); + Debug.assert(!(range.facts & 1 /* HasReturn */), "Expected RangeFacts.HasReturn flag to be unset"); + if (exposedVariableDeclarations.length === 1) { + const variableDeclaration = exposedVariableDeclarations[0]; + newNodes.push(factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList( + [factory.createVariableDeclaration( + getSynthesizedDeepClone(variableDeclaration.name), + /*exclamationToken*/ + void 0, + /*type*/ + getSynthesizedDeepClone(variableDeclaration.type), + /*initializer*/ + call + )], + variableDeclaration.parent.flags + ) + )); + } else { + const bindingElements = []; + const typeElements = []; + let commonNodeFlags = exposedVariableDeclarations[0].parent.flags; + let sawExplicitType = false; + for (const variableDeclaration of exposedVariableDeclarations) { + bindingElements.push(factory.createBindingElement( + /*dotDotDotToken*/ + void 0, + /*propertyName*/ + void 0, + /*name*/ + getSynthesizedDeepClone(variableDeclaration.name) + )); + const variableType = checker.typeToTypeNode( + checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(variableDeclaration)), + scope, + 1 /* NoTruncation */ + ); + typeElements.push(factory.createPropertySignature( + /*modifiers*/ + void 0, + /*name*/ + variableDeclaration.symbol.name, + /*questionToken*/ + void 0, + /*type*/ + variableType + )); + sawExplicitType = sawExplicitType || variableDeclaration.type !== void 0; + commonNodeFlags = commonNodeFlags & variableDeclaration.parent.flags; + } + const typeLiteral = sawExplicitType ? factory.createTypeLiteralNode(typeElements) : void 0; + if (typeLiteral) { + setEmitFlags(typeLiteral, 1 /* SingleLine */); + } + newNodes.push(factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList( + [factory.createVariableDeclaration( + factory.createObjectBindingPattern(bindingElements), + /*exclamationToken*/ + void 0, + /*type*/ + typeLiteral, + /*initializer*/ + call + )], + commonNodeFlags + ) + )); + } + } else if (exposedVariableDeclarations.length || writes) { + if (exposedVariableDeclarations.length) { + for (const variableDeclaration of exposedVariableDeclarations) { + let flags = variableDeclaration.parent.flags; + if (flags & 2 /* Const */) { + flags = flags & ~2 /* Const */ | 1 /* Let */; + } + newNodes.push(factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList( + [factory.createVariableDeclaration( + variableDeclaration.symbol.name, + /*exclamationToken*/ + void 0, + getTypeDeepCloneUnionUndefined(variableDeclaration.type) + )], + flags + ) + )); + } + } + if (returnValueProperty) { + newNodes.push(factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList( + [factory.createVariableDeclaration( + returnValueProperty, + /*exclamationToken*/ + void 0, + getTypeDeepCloneUnionUndefined(returnType) + )], + 1 /* Let */ + ) + )); + } + const assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); + if (returnValueProperty) { + assignments.unshift(factory.createShorthandPropertyAssignment(returnValueProperty)); + } + if (assignments.length === 1) { + Debug.assert(!returnValueProperty, "Shouldn't have returnValueProperty here"); + newNodes.push(factory.createExpressionStatement(factory.createAssignment(assignments[0].name, call))); + if (range.facts & 1 /* HasReturn */) { + newNodes.push(factory.createReturnStatement()); + } + } else { + newNodes.push(factory.createExpressionStatement(factory.createAssignment(factory.createObjectLiteralExpression(assignments), call))); + if (returnValueProperty) { + newNodes.push(factory.createReturnStatement(factory.createIdentifier(returnValueProperty))); + } + } + } else { + if (range.facts & 1 /* HasReturn */) { + newNodes.push(factory.createReturnStatement(call)); + } else if (isReadonlyArray(range.range)) { + newNodes.push(factory.createExpressionStatement(call)); + } else { + newNodes.push(call); + } + } + if (isReadonlyArray(range.range)) { + changeTracker.replaceNodeRangeWithNodes(context.file, first(range.range), last(range.range), newNodes); + } else { + changeTracker.replaceNodeWithNodes(context.file, range.range, newNodes); + } + const edits = changeTracker.getChanges(); + const renameRange = isReadonlyArray(range.range) ? first(range.range) : range.range; + const renameFilename = renameRange.getSourceFile().fileName; + const renameLocation = getRenameLocation( + edits, + renameFilename, + functionNameText, + /*preferLastLocation*/ + false + ); + return { renameFilename, renameLocation, edits }; + function getTypeDeepCloneUnionUndefined(typeNode) { + if (typeNode === void 0) { + return void 0; + } + const clone2 = getSynthesizedDeepClone(typeNode); + let withoutParens = clone2; + while (isParenthesizedTypeNode(withoutParens)) { + withoutParens = withoutParens.type; + } + return isUnionTypeNode(withoutParens) && find(withoutParens.types, (t) => t.kind === 157 /* UndefinedKeyword */) ? clone2 : factory.createUnionTypeNode([clone2, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]); + } + } + function extractConstantInScope(node, scope, { substitutions }, rangeFacts, context) { + const checker = context.program.getTypeChecker(); + const file = scope.getSourceFile(); + const localNameText = isPropertyAccessExpression(node) && !isClassLike(scope) && !checker.resolveName( + node.name.text, + node, + 111551 /* Value */, + /*excludeGlobals*/ + false + ) && !isPrivateIdentifier(node.name) && !identifierToKeywordKind(node.name) ? node.name.text : getUniqueName(isClassLike(scope) ? "newProperty" : "newLocal", file); + const isJS = isInJSFile(scope); + let variableType = isJS || !checker.isContextSensitive(node) ? void 0 : checker.typeToTypeNode(checker.getContextualType(node), scope, 1 /* NoTruncation */); + let initializer = transformConstantInitializer(skipParentheses(node), substitutions); + ({ variableType, initializer } = transformFunctionInitializerAndType(variableType, initializer)); + suppressLeadingAndTrailingTrivia(initializer); + const changeTracker = ts_textChanges_exports.ChangeTracker.fromContext(context); + if (isClassLike(scope)) { + Debug.assert(!isJS, "Cannot extract to a JS class"); + const modifiers = []; + modifiers.push(factory.createModifier(123 /* PrivateKeyword */)); + if (rangeFacts & 32 /* InStaticRegion */) { + modifiers.push(factory.createModifier(126 /* StaticKeyword */)); + } + modifiers.push(factory.createModifier(148 /* ReadonlyKeyword */)); + const newVariable = factory.createPropertyDeclaration( + modifiers, + localNameText, + /*questionOrExclamationToken*/ + void 0, + variableType, + initializer + ); + let localReference = factory.createPropertyAccessExpression( + rangeFacts & 32 /* InStaticRegion */ ? factory.createIdentifier(scope.name.getText()) : factory.createThis(), + factory.createIdentifier(localNameText) + ); + if (isInJSXContent(node)) { + localReference = factory.createJsxExpression( + /*dotDotDotToken*/ + void 0, + localReference + ); + } + const maxInsertionPos = node.pos; + const nodeToInsertBefore = getNodeToInsertPropertyBefore(maxInsertionPos, scope); + changeTracker.insertNodeBefore( + context.file, + nodeToInsertBefore, + newVariable, + /*blankLineBetween*/ + true + ); + changeTracker.replaceNode(context.file, node, localReference); + } else { + const newVariableDeclaration = factory.createVariableDeclaration( + localNameText, + /*exclamationToken*/ + void 0, + variableType, + initializer + ); + const oldVariableDeclaration = getContainingVariableDeclarationIfInList(node, scope); + if (oldVariableDeclaration) { + changeTracker.insertNodeBefore(context.file, oldVariableDeclaration, newVariableDeclaration); + const localReference = factory.createIdentifier(localNameText); + changeTracker.replaceNode(context.file, node, localReference); + } else if (node.parent.kind === 243 /* ExpressionStatement */ && scope === findAncestor(node, isScope)) { + const newVariableStatement = factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList([newVariableDeclaration], 2 /* Const */) + ); + changeTracker.replaceNode(context.file, node.parent, newVariableStatement); + } else { + const newVariableStatement = factory.createVariableStatement( + /*modifiers*/ + void 0, + factory.createVariableDeclarationList([newVariableDeclaration], 2 /* Const */) + ); + const nodeToInsertBefore = getNodeToInsertConstantBefore(node, scope); + if (nodeToInsertBefore.pos === 0) { + changeTracker.insertNodeAtTopOfFile( + context.file, + newVariableStatement, + /*blankLineBetween*/ + false + ); + } else { + changeTracker.insertNodeBefore( + context.file, + nodeToInsertBefore, + newVariableStatement, + /*blankLineBetween*/ + false + ); + } + if (node.parent.kind === 243 /* ExpressionStatement */) { + changeTracker.delete(context.file, node.parent); + } else { + let localReference = factory.createIdentifier(localNameText); + if (isInJSXContent(node)) { + localReference = factory.createJsxExpression( + /*dotDotDotToken*/ + void 0, + localReference + ); + } + changeTracker.replaceNode(context.file, node, localReference); + } + } + } + const edits = changeTracker.getChanges(); + const renameFilename = node.getSourceFile().fileName; + const renameLocation = getRenameLocation( + edits, + renameFilename, + localNameText, + /*preferLastLocation*/ + true + ); + return { renameFilename, renameLocation, edits }; + function transformFunctionInitializerAndType(variableType2, initializer2) { + if (variableType2 === void 0) + return { variableType: variableType2, initializer: initializer2 }; + if (!isFunctionExpression(initializer2) && !isArrowFunction(initializer2) || !!initializer2.typeParameters) + return { variableType: variableType2, initializer: initializer2 }; + const functionType = checker.getTypeAtLocation(node); + const functionSignature = singleOrUndefined(checker.getSignaturesOfType(functionType, 0 /* Call */)); + if (!functionSignature) + return { variableType: variableType2, initializer: initializer2 }; + if (!!functionSignature.getTypeParameters()) + return { variableType: variableType2, initializer: initializer2 }; + const parameters = []; + let hasAny = false; + for (const p of initializer2.parameters) { + if (p.type) { + parameters.push(p); + } else { + const paramType = checker.getTypeAtLocation(p); + if (paramType === checker.getAnyType()) + hasAny = true; + parameters.push(factory.updateParameterDeclaration( + p, + p.modifiers, + p.dotDotDotToken, + p.name, + p.questionToken, + p.type || checker.typeToTypeNode(paramType, scope, 1 /* NoTruncation */), + p.initializer + )); + } + } + if (hasAny) + return { variableType: variableType2, initializer: initializer2 }; + variableType2 = void 0; + if (isArrowFunction(initializer2)) { + initializer2 = factory.updateArrowFunction( + initializer2, + canHaveModifiers(node) ? getModifiers(node) : void 0, + initializer2.typeParameters, + parameters, + initializer2.type || checker.typeToTypeNode(functionSignature.getReturnType(), scope, 1 /* NoTruncation */), + initializer2.equalsGreaterThanToken, + initializer2.body + ); + } else { + if (functionSignature && !!functionSignature.thisParameter) { + const firstParameter = firstOrUndefined(parameters); + if (!firstParameter || isIdentifier(firstParameter.name) && firstParameter.name.escapedText !== "this") { + const thisType = checker.getTypeOfSymbolAtLocation(functionSignature.thisParameter, node); + parameters.splice(0, 0, factory.createParameterDeclaration( + /*modifiers*/ + void 0, + /*dotDotDotToken*/ + void 0, + "this", + /*questionToken*/ + void 0, + checker.typeToTypeNode(thisType, scope, 1 /* NoTruncation */) + )); + } + } + initializer2 = factory.updateFunctionExpression( + initializer2, + canHaveModifiers(node) ? getModifiers(node) : void 0, + initializer2.asteriskToken, + initializer2.name, + initializer2.typeParameters, + parameters, + initializer2.type || checker.typeToTypeNode(functionSignature.getReturnType(), scope, 1 /* NoTruncation */), + initializer2.body + ); + } + return { variableType: variableType2, initializer: initializer2 }; + } + } + function getContainingVariableDeclarationIfInList(node, scope) { + let prevNode; + while (node !== void 0 && node !== scope) { + if (isVariableDeclaration(node) && node.initializer === prevNode && isVariableDeclarationList(node.parent) && node.parent.declarations.length > 1) { + return node; + } + prevNode = node; + node = node.parent; + } + } + function getFirstDeclarationBeforePosition(type, position) { + let firstDeclaration; + const symbol = type.symbol; + if (symbol && symbol.declarations) { + for (const declaration of symbol.declarations) { + if ((firstDeclaration === void 0 || declaration.pos < firstDeclaration.pos) && declaration.pos < position) { + firstDeclaration = declaration; + } + } + } + return firstDeclaration; + } + function compareTypesByDeclarationOrder({ type: type1, declaration: declaration1 }, { type: type2, declaration: declaration2 }) { + return compareProperties(declaration1, declaration2, "pos", compareValues) || compareStringsCaseSensitive( + type1.symbol ? type1.symbol.getName() : "", + type2.symbol ? type2.symbol.getName() : "" + ) || compareValues(type1.id, type2.id); + } + function getCalledExpression(scope, range, functionNameText) { + const functionReference = factory.createIdentifier(functionNameText); + if (isClassLike(scope)) { + const lhs = range.facts & 32 /* InStaticRegion */ ? factory.createIdentifier(scope.name.text) : factory.createThis(); + return factory.createPropertyAccessExpression(lhs, functionReference); + } else { + return functionReference; + } + } + function transformFunctionBody(body, exposedVariableDeclarations, writes, substitutions, hasReturn2) { + const hasWritesOrVariableDeclarations = writes !== void 0 || exposedVariableDeclarations.length > 0; + if (isBlock(body) && !hasWritesOrVariableDeclarations && substitutions.size === 0) { + return { body: factory.createBlock( + body.statements, + /*multiLine*/ + true + ), returnValueProperty: void 0 }; + } + let returnValueProperty; + let ignoreReturns = false; + const statements = factory.createNodeArray(isBlock(body) ? body.statements.slice(0) : [isStatement(body) ? body : factory.createReturnStatement(skipParentheses(body))]); + if (hasWritesOrVariableDeclarations || substitutions.size) { + const rewrittenStatements = visitNodes2(statements, visitor, isStatement).slice(); + if (hasWritesOrVariableDeclarations && !hasReturn2 && isStatement(body)) { + const assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); + if (assignments.length === 1) { + rewrittenStatements.push(factory.createReturnStatement(assignments[0].name)); + } else { + rewrittenStatements.push(factory.createReturnStatement(factory.createObjectLiteralExpression(assignments))); + } + } + return { body: factory.createBlock( + rewrittenStatements, + /*multiLine*/ + true + ), returnValueProperty }; + } else { + return { body: factory.createBlock( + statements, + /*multiLine*/ + true + ), returnValueProperty: void 0 }; + } + function visitor(node) { + if (!ignoreReturns && isReturnStatement(node) && hasWritesOrVariableDeclarations) { + const assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); + if (node.expression) { + if (!returnValueProperty) { + returnValueProperty = "__return"; + } + assignments.unshift(factory.createPropertyAssignment(returnValueProperty, visitNode(node.expression, visitor, isExpression))); + } + if (assignments.length === 1) { + return factory.createReturnStatement(assignments[0].name); + } else { + return factory.createReturnStatement(factory.createObjectLiteralExpression(assignments)); + } + } else { + const oldIgnoreReturns = ignoreReturns; + ignoreReturns = ignoreReturns || isFunctionLikeDeclaration(node) || isClassLike(node); + const substitution = substitutions.get(getNodeId(node).toString()); + const result = substitution ? getSynthesizedDeepClone(substitution) : visitEachChild(node, visitor, nullTransformationContext); + ignoreReturns = oldIgnoreReturns; + return result; + } + } + } + function transformConstantInitializer(initializer, substitutions) { + return substitutions.size ? visitor(initializer) : initializer; + function visitor(node) { + const substitution = substitutions.get(getNodeId(node).toString()); + return substitution ? getSynthesizedDeepClone(substitution) : visitEachChild(node, visitor, nullTransformationContext); + } + } + function getStatementsOrClassElements(scope) { + if (isFunctionLikeDeclaration(scope)) { + const body = scope.body; + if (isBlock(body)) { + return body.statements; + } + } else if (isModuleBlock(scope) || isSourceFile(scope)) { + return scope.statements; + } else if (isClassLike(scope)) { + return scope.members; + } else { + assertType(scope); + } + return emptyArray; + } + function getNodeToInsertFunctionBefore(minPos, scope) { + return find(getStatementsOrClassElements(scope), (child) => child.pos >= minPos && isFunctionLikeDeclaration(child) && !isConstructorDeclaration(child)); + } + function getNodeToInsertPropertyBefore(maxPos, scope) { + const members = scope.members; + Debug.assert(members.length > 0, "Found no members"); + let prevMember; + let allProperties = true; + for (const member of members) { + if (member.pos > maxPos) { + return prevMember || members[0]; + } + if (allProperties && !isPropertyDeclaration(member)) { + if (prevMember !== void 0) { + return member; + } + allProperties = false; + } + prevMember = member; + } + if (prevMember === void 0) + return Debug.fail(); + return prevMember; + } + function getNodeToInsertConstantBefore(node, scope) { + Debug.assert(!isClassLike(scope)); + let prevScope; + for (let curr = node; curr !== scope; curr = curr.parent) { + if (isScope(curr)) { + prevScope = curr; + } + } + for (let curr = (prevScope || node).parent; ; curr = curr.parent) { + if (isBlockLike(curr)) { + let prevStatement; + for (const statement of curr.statements) { + if (statement.pos > node.pos) { + break; + } + prevStatement = statement; + } + if (!prevStatement && isCaseClause(curr)) { + Debug.assert(isSwitchStatement(curr.parent.parent), "Grandparent isn't a switch statement"); + return curr.parent.parent; + } + return Debug.checkDefined(prevStatement, "prevStatement failed to get set"); + } + Debug.assert(curr !== scope, "Didn't encounter a block-like before encountering scope"); + } + } + function getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes) { + const variableAssignments = map(exposedVariableDeclarations, (v) => factory.createShorthandPropertyAssignment(v.symbol.name)); + const writeAssignments = map(writes, (w) => factory.createShorthandPropertyAssignment(w.symbol.name)); + return variableAssignments === void 0 ? writeAssignments : writeAssignments === void 0 ? variableAssignments : variableAssignments.concat(writeAssignments); + } + function isReadonlyArray(v) { + return isArray(v); + } + function getEnclosingTextRange(targetRange, sourceFile) { + return isReadonlyArray(targetRange.range) ? { pos: first(targetRange.range).getStart(sourceFile), end: last(targetRange.range).getEnd() } : targetRange.range; + } + function collectReadsAndWrites(targetRange, scopes, enclosingTextRange, sourceFile, checker, cancellationToken) { + const allTypeParameterUsages = /* @__PURE__ */ new Map(); + const usagesPerScope = []; + const substitutionsPerScope = []; + const functionErrorsPerScope = []; + const constantErrorsPerScope = []; + const visibleDeclarationsInExtractedRange = []; + const exposedVariableSymbolSet = /* @__PURE__ */ new Map(); + const exposedVariableDeclarations = []; + let firstExposedNonVariableDeclaration; + const expression = !isReadonlyArray(targetRange.range) ? targetRange.range : targetRange.range.length === 1 && isExpressionStatement(targetRange.range[0]) ? targetRange.range[0].expression : void 0; + let expressionDiagnostic; + if (expression === void 0) { + const statements = targetRange.range; + const start = first(statements).getStart(); + const end = last(statements).end; + expressionDiagnostic = createFileDiagnostic(sourceFile, start, end - start, Messages.expressionExpected); + } else if (checker.getTypeAtLocation(expression).flags & (16384 /* Void */ | 131072 /* Never */)) { + expressionDiagnostic = createDiagnosticForNode(expression, Messages.uselessConstantType); + } + for (const scope of scopes) { + usagesPerScope.push({ usages: /* @__PURE__ */ new Map(), typeParameterUsages: /* @__PURE__ */ new Map(), substitutions: /* @__PURE__ */ new Map() }); + substitutionsPerScope.push(/* @__PURE__ */ new Map()); + functionErrorsPerScope.push([]); + const constantErrors = []; + if (expressionDiagnostic) { + constantErrors.push(expressionDiagnostic); + } + if (isClassLike(scope) && isInJSFile(scope)) { + constantErrors.push(createDiagnosticForNode(scope, Messages.cannotExtractToJSClass)); + } + if (isArrowFunction(scope) && !isBlock(scope.body)) { + constantErrors.push(createDiagnosticForNode(scope, Messages.cannotExtractToExpressionArrowFunction)); + } + constantErrorsPerScope.push(constantErrors); + } + const seenUsages = /* @__PURE__ */ new Map(); + const target = isReadonlyArray(targetRange.range) ? factory.createBlock(targetRange.range) : targetRange.range; + const unmodifiedNode = isReadonlyArray(targetRange.range) ? first(targetRange.range) : targetRange.range; + const inGenericContext = isInGenericContext(unmodifiedNode); + collectUsages(target); + if (inGenericContext && !isReadonlyArray(targetRange.range) && !isJsxAttribute(targetRange.range)) { + const contextualType = checker.getContextualType(targetRange.range); + recordTypeParameterUsages(contextualType); + } + if (allTypeParameterUsages.size > 0) { + const seenTypeParameterUsages = /* @__PURE__ */ new Map(); + let i = 0; + for (let curr = unmodifiedNode; curr !== void 0 && i < scopes.length; curr = curr.parent) { + if (curr === scopes[i]) { + seenTypeParameterUsages.forEach((typeParameter, id) => { + usagesPerScope[i].typeParameterUsages.set(id, typeParameter); + }); + i++; + } + if (isDeclarationWithTypeParameters(curr)) { + for (const typeParameterDecl of getEffectiveTypeParameterDeclarations(curr)) { + const typeParameter = checker.getTypeAtLocation(typeParameterDecl); + if (allTypeParameterUsages.has(typeParameter.id.toString())) { + seenTypeParameterUsages.set(typeParameter.id.toString(), typeParameter); + } + } + } + } + Debug.assert(i === scopes.length, "Should have iterated all scopes"); + } + if (visibleDeclarationsInExtractedRange.length) { + const containingLexicalScopeOfExtraction = isBlockScope(scopes[0], scopes[0].parent) ? scopes[0] : getEnclosingBlockScopeContainer(scopes[0]); + forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations); + } + for (let i = 0; i < scopes.length; i++) { + const scopeUsages = usagesPerScope[i]; + if (i > 0 && (scopeUsages.usages.size > 0 || scopeUsages.typeParameterUsages.size > 0)) { + const errorNode = isReadonlyArray(targetRange.range) ? targetRange.range[0] : targetRange.range; + constantErrorsPerScope[i].push(createDiagnosticForNode(errorNode, Messages.cannotAccessVariablesFromNestedScopes)); + } + if (targetRange.facts & 16 /* UsesThisInFunction */ && isClassLike(scopes[i])) { + functionErrorsPerScope[i].push(createDiagnosticForNode(targetRange.thisNode, Messages.cannotExtractFunctionsContainingThisToMethod)); + } + let hasWrite = false; + let readonlyClassPropertyWrite; + usagesPerScope[i].usages.forEach((value) => { + if (value.usage === 2 /* Write */) { + hasWrite = true; + if (value.symbol.flags & 106500 /* ClassMember */ && value.symbol.valueDeclaration && hasEffectiveModifier(value.symbol.valueDeclaration, 64 /* Readonly */)) { + readonlyClassPropertyWrite = value.symbol.valueDeclaration; + } + } + }); + Debug.assert(isReadonlyArray(targetRange.range) || exposedVariableDeclarations.length === 0, "No variable declarations expected if something was extracted"); + if (hasWrite && !isReadonlyArray(targetRange.range)) { + const diag2 = createDiagnosticForNode(targetRange.range, Messages.cannotWriteInExpression); + functionErrorsPerScope[i].push(diag2); + constantErrorsPerScope[i].push(diag2); + } else if (readonlyClassPropertyWrite && i > 0) { + const diag2 = createDiagnosticForNode(readonlyClassPropertyWrite, Messages.cannotExtractReadonlyPropertyInitializerOutsideConstructor); + functionErrorsPerScope[i].push(diag2); + constantErrorsPerScope[i].push(diag2); + } else if (firstExposedNonVariableDeclaration) { + const diag2 = createDiagnosticForNode(firstExposedNonVariableDeclaration, Messages.cannotExtractExportedEntity); + functionErrorsPerScope[i].push(diag2); + constantErrorsPerScope[i].push(diag2); + } + } + return { target, usagesPerScope, functionErrorsPerScope, constantErrorsPerScope, exposedVariableDeclarations }; + function isInGenericContext(node) { + return !!findAncestor(node, (n) => isDeclarationWithTypeParameters(n) && getEffectiveTypeParameterDeclarations(n).length !== 0); + } + function recordTypeParameterUsages(type) { + const symbolWalker = checker.getSymbolWalker(() => (cancellationToken.throwIfCancellationRequested(), true)); + const { visitedTypes } = symbolWalker.walkType(type); + for (const visitedType of visitedTypes) { + if (visitedType.isTypeParameter()) { + allTypeParameterUsages.set(visitedType.id.toString(), visitedType); + } + } + } + function collectUsages(node, valueUsage = 1 /* Read */) { + if (inGenericContext) { + const type = checker.getTypeAtLocation(node); + recordTypeParameterUsages(type); + } + if (isDeclaration(node) && node.symbol) { + visibleDeclarationsInExtractedRange.push(node); + } + if (isAssignmentExpression(node)) { + collectUsages(node.left, 2 /* Write */); + collectUsages(node.right); + } else if (isUnaryExpressionWithWrite(node)) { + collectUsages(node.operand, 2 /* Write */); + } else if (isPropertyAccessExpression(node) || isElementAccessExpression(node)) { + forEachChild(node, collectUsages); + } else if (isIdentifier(node)) { + if (!node.parent) { + return; + } + if (isQualifiedName(node.parent) && node !== node.parent.left) { + return; + } + if (isPropertyAccessExpression(node.parent) && node !== node.parent.expression) { + return; + } + recordUsage( + node, + valueUsage, + /*isTypeNode*/ + isPartOfTypeNode(node) + ); + } else { + forEachChild(node, collectUsages); + } + } + function recordUsage(n, usage, isTypeNode2) { + const symbolId = recordUsagebySymbol(n, usage, isTypeNode2); + if (symbolId) { + for (let i = 0; i < scopes.length; i++) { + const substitution = substitutionsPerScope[i].get(symbolId); + if (substitution) { + usagesPerScope[i].substitutions.set(getNodeId(n).toString(), substitution); + } + } + } + } + function recordUsagebySymbol(identifier, usage, isTypeName) { + const symbol = getSymbolReferencedByIdentifier(identifier); + if (!symbol) { + return void 0; + } + const symbolId = getSymbolId(symbol).toString(); + const lastUsage = seenUsages.get(symbolId); + if (lastUsage && lastUsage >= usage) { + return symbolId; + } + seenUsages.set(symbolId, usage); + if (lastUsage) { + for (const perScope of usagesPerScope) { + const prevEntry = perScope.usages.get(identifier.text); + if (prevEntry) { + perScope.usages.set(identifier.text, { usage, symbol, node: identifier }); + } + } + return symbolId; + } + const decls = symbol.getDeclarations(); + const declInFile = decls && find(decls, (d) => d.getSourceFile() === sourceFile); + if (!declInFile) { + return void 0; + } + if (rangeContainsStartEnd(enclosingTextRange, declInFile.getStart(), declInFile.end)) { + return void 0; + } + if (targetRange.facts & 2 /* IsGenerator */ && usage === 2 /* Write */) { + const diag2 = createDiagnosticForNode(identifier, Messages.cannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators); + for (const errors of functionErrorsPerScope) { + errors.push(diag2); + } + for (const errors of constantErrorsPerScope) { + errors.push(diag2); + } + } + for (let i = 0; i < scopes.length; i++) { + const scope = scopes[i]; + const resolvedSymbol = checker.resolveName( + symbol.name, + scope, + symbol.flags, + /*excludeGlobals*/ + false + ); + if (resolvedSymbol === symbol) { + continue; + } + if (!substitutionsPerScope[i].has(symbolId)) { + const substitution = tryReplaceWithQualifiedNameOrPropertyAccess(symbol.exportSymbol || symbol, scope, isTypeName); + if (substitution) { + substitutionsPerScope[i].set(symbolId, substitution); + } else if (isTypeName) { + if (!(symbol.flags & 262144 /* TypeParameter */)) { + const diag2 = createDiagnosticForNode(identifier, Messages.typeWillNotBeVisibleInTheNewScope); + functionErrorsPerScope[i].push(diag2); + constantErrorsPerScope[i].push(diag2); + } + } else { + usagesPerScope[i].usages.set(identifier.text, { usage, symbol, node: identifier }); + } + } + } + return symbolId; + } + function checkForUsedDeclarations(node) { + if (node === targetRange.range || isReadonlyArray(targetRange.range) && targetRange.range.indexOf(node) >= 0) { + return; + } + const sym = isIdentifier(node) ? getSymbolReferencedByIdentifier(node) : checker.getSymbolAtLocation(node); + if (sym) { + const decl = find(visibleDeclarationsInExtractedRange, (d) => d.symbol === sym); + if (decl) { + if (isVariableDeclaration(decl)) { + const idString = decl.symbol.id.toString(); + if (!exposedVariableSymbolSet.has(idString)) { + exposedVariableDeclarations.push(decl); + exposedVariableSymbolSet.set(idString, true); + } + } else { + firstExposedNonVariableDeclaration = firstExposedNonVariableDeclaration || decl; + } + } + } + forEachChild(node, checkForUsedDeclarations); + } + function getSymbolReferencedByIdentifier(identifier) { + return identifier.parent && isShorthandPropertyAssignment(identifier.parent) && identifier.parent.name === identifier ? checker.getShorthandAssignmentValueSymbol(identifier.parent) : checker.getSymbolAtLocation(identifier); + } + function tryReplaceWithQualifiedNameOrPropertyAccess(symbol, scopeDecl, isTypeNode2) { + if (!symbol) { + return void 0; + } + const decls = symbol.getDeclarations(); + if (decls && decls.some((d) => d.parent === scopeDecl)) { + return factory.createIdentifier(symbol.name); + } + const prefix = tryReplaceWithQualifiedNameOrPropertyAccess(symbol.parent, scopeDecl, isTypeNode2); + if (prefix === void 0) { + return void 0; + } + return isTypeNode2 ? factory.createQualifiedName(prefix, factory.createIdentifier(symbol.name)) : factory.createPropertyAccessExpression(prefix, symbol.name); + } + } + function getExtractableParent(node) { + return findAncestor(node, (node2) => node2.parent && isExtractableExpression(node2) && !isBinaryExpression(node2.parent)); + } + function isExtractableExpression(node) { + const { parent: parent2 } = node; + switch (parent2.kind) { + case 305 /* EnumMember */: + return false; + } + switch (node.kind) { + case 11 /* StringLiteral */: + return parent2.kind !== 271 /* ImportDeclaration */ && parent2.kind !== 275 /* ImportSpecifier */; + case 229 /* SpreadElement */: + case 205 /* ObjectBindingPattern */: + case 207 /* BindingElement */: + return false; + case 80 /* Identifier */: + return parent2.kind !== 207 /* BindingElement */ && parent2.kind !== 275 /* ImportSpecifier */ && parent2.kind !== 280 /* ExportSpecifier */; + } + return true; + } + function isBlockLike(node) { + switch (node.kind) { + case 240 /* Block */: + case 311 /* SourceFile */: + case 267 /* ModuleBlock */: + case 295 /* CaseClause */: + return true; + default: + return false; + } + } + function isInJSXContent(node) { + return isStringLiteralJsxAttribute(node) || (isJsxElement(node) || isJsxSelfClosingElement(node) || isJsxFragment(node)) && (isJsxElement(node.parent) || isJsxFragment(node.parent)); + } + function isStringLiteralJsxAttribute(node) { + return isStringLiteral(node) && node.parent && isJsxAttribute(node.parent); + } + var refactorName11, extractConstantAction, extractFunctionAction, Messages, RangeFacts; + var init_extractSymbol = __esm({ + "src/services/refactors/extractSymbol.ts"() { + "use strict"; + init_ts4(); + init_ts_refactor(); + refactorName11 = "Extract Symbol"; + extractConstantAction = { + name: "Extract Constant", + description: getLocaleSpecificMessage(Diagnostics.Extract_constant), + kind: "refactor.extract.constant" + }; + extractFunctionAction = { + name: "Extract Function", + description: getLocaleSpecificMessage(Diagnostics.Extract_function), + kind: "refactor.extract.function" + }; + registerRefactor(refactorName11, { + kinds: [ + extractConstantAction.kind, + extractFunctionAction.kind + ], + getEditsForAction: getRefactorEditsToExtractSymbol, + getAvailableActions: getRefactorActionsToExtractSymbol + }); + ((Messages2) => { + function createMessage(message) { + return { message, code: 0, category: 3 /* Message */, key: message }; + } + Messages2.cannotExtractRange = createMessage("Cannot extract range."); + Messages2.cannotExtractImport = createMessage("Cannot extract import statement."); + Messages2.cannotExtractSuper = createMessage("Cannot extract super call."); + Messages2.cannotExtractJSDoc = createMessage("Cannot extract JSDoc."); + Messages2.cannotExtractEmpty = createMessage("Cannot extract empty range."); + Messages2.expressionExpected = createMessage("expression expected."); + Messages2.uselessConstantType = createMessage("No reason to extract constant of type."); + Messages2.statementOrExpressionExpected = createMessage("Statement or expression expected."); + Messages2.cannotExtractRangeContainingConditionalBreakOrContinueStatements = createMessage("Cannot extract range containing conditional break or continue statements."); + Messages2.cannotExtractRangeContainingConditionalReturnStatement = createMessage("Cannot extract range containing conditional return statement."); + Messages2.cannotExtractRangeContainingLabeledBreakOrContinueStatementWithTargetOutsideOfTheRange = createMessage("Cannot extract range containing labeled break or continue with target outside of the range."); + Messages2.cannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators = createMessage("Cannot extract range containing writes to references located outside of the target range in generators."); + Messages2.typeWillNotBeVisibleInTheNewScope = createMessage("Type will not visible in the new scope."); + Messages2.functionWillNotBeVisibleInTheNewScope = createMessage("Function will not visible in the new scope."); + Messages2.cannotExtractIdentifier = createMessage("Select more than a single identifier."); + Messages2.cannotExtractExportedEntity = createMessage("Cannot extract exported declaration"); + Messages2.cannotWriteInExpression = createMessage("Cannot write back side-effects when extracting an expression"); + Messages2.cannotExtractReadonlyPropertyInitializerOutsideConstructor = createMessage("Cannot move initialization of read-only class property outside of the constructor"); + Messages2.cannotExtractAmbientBlock = createMessage("Cannot extract code from ambient contexts"); + Messages2.cannotAccessVariablesFromNestedScopes = createMessage("Cannot access variables from nested scopes"); + Messages2.cannotExtractToJSClass = createMessage("Cannot extract constant to a class scope in JS"); + Messages2.cannotExtractToExpressionArrowFunction = createMessage("Cannot extract constant to an arrow function without a block"); + Messages2.cannotExtractFunctionsContainingThisToMethod = createMessage("Cannot extract functions containing this to method"); + })(Messages || (Messages = {})); + RangeFacts = /* @__PURE__ */ ((RangeFacts2) => { + RangeFacts2[RangeFacts2["None"] = 0] = "None"; + RangeFacts2[RangeFacts2["HasReturn"] = 1] = "HasReturn"; + RangeFacts2[RangeFacts2["IsGenerator"] = 2] = "IsGenerator"; + RangeFacts2[RangeFacts2["IsAsyncFunction"] = 4] = "IsAsyncFunction"; + RangeFacts2[RangeFacts2["UsesThis"] = 8] = "UsesThis"; + RangeFacts2[RangeFacts2["UsesThisInFunction"] = 16] = "UsesThisInFunction"; + RangeFacts2[RangeFacts2["InStaticRegion"] = 32] = "InStaticRegion"; + return RangeFacts2; + })(RangeFacts || {}); + } + }); + + // src/services/_namespaces/ts.refactor.extractSymbol.ts + var ts_refactor_extractSymbol_exports = {}; + __export(ts_refactor_extractSymbol_exports, { + Messages: () => Messages, + RangeFacts: () => RangeFacts, + getRangeToExtract: () => getRangeToExtract2, + getRefactorActionsToExtractSymbol: () => getRefactorActionsToExtractSymbol, + getRefactorEditsToExtractSymbol: () => getRefactorEditsToExtractSymbol + }); + var init_ts_refactor_extractSymbol = __esm({ + "src/services/_namespaces/ts.refactor.extractSymbol.ts"() { + "use strict"; + init_extractSymbol(); + } + }); + + // src/services/refactors/generateGetAccessorAndSetAccessor.ts + var actionName, actionDescription, generateGetSetAction; + var init_generateGetAccessorAndSetAccessor = __esm({ + "src/services/refactors/generateGetAccessorAndSetAccessor.ts"() { + "use strict"; + init_ts4(); + init_ts_refactor(); + actionName = "Generate 'get' and 'set' accessors"; + actionDescription = Diagnostics.Generate_get_and_set_accessors.message; + generateGetSetAction = { + name: actionName, + description: actionDescription, + kind: "refactor.rewrite.property.generateAccessors" + }; + registerRefactor(actionName, { + kinds: [generateGetSetAction.kind], + getEditsForAction: function getRefactorActionsToGenerateGetAndSetAccessors(context, actionName2) { + if (!context.endPosition) + return void 0; + const info = ts_codefix_exports.getAccessorConvertiblePropertyAtPosition(context.file, context.program, context.startPosition, context.endPosition); + Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); + const edits = ts_codefix_exports.generateAccessorFromProperty(context.file, context.program, context.startPosition, context.endPosition, context, actionName2); + if (!edits) + return void 0; + const renameFilename = context.file.fileName; + const nameNeedRename = info.renameAccessor ? info.accessorName : info.fieldName; + const renameLocationOffset = isIdentifier(nameNeedRename) ? 0 : -1; + const renameLocation = renameLocationOffset + getRenameLocation( + edits, + renameFilename, + nameNeedRename.text, + /*preferLastLocation*/ + isParameter(info.declaration) + ); + return { renameFilename, renameLocation, edits }; + }, + getAvailableActions(context) { + if (!context.endPosition) + return emptyArray; + const info = ts_codefix_exports.getAccessorConvertiblePropertyAtPosition(context.file, context.program, context.startPosition, context.endPosition, context.triggerReason === "invoked"); + if (!info) + return emptyArray; + if (!isRefactorErrorInfo(info)) { + return [{ + name: actionName, + description: actionDescription, + actions: [generateGetSetAction] + }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return [{ + name: actionName, + description: actionDescription, + actions: [{ ...generateGetSetAction, notApplicableReason: info.error }] + }]; + } + return emptyArray; + } + }); + } + }); + + // src/services/_namespaces/ts.refactor.generateGetAccessorAndSetAccessor.ts + var ts_refactor_generateGetAccessorAndSetAccessor_exports = {}; + var init_ts_refactor_generateGetAccessorAndSetAccessor = __esm({ + "src/services/_namespaces/ts.refactor.generateGetAccessorAndSetAccessor.ts"() { + "use strict"; + init_generateGetAccessorAndSetAccessor(); + } + }); + + // src/services/refactors/inferFunctionReturnType.ts + function getRefactorEditsToInferReturnType(context) { + const info = getInfo4(context); + if (info && !isRefactorErrorInfo(info)) { + const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange7(context.file, t, info.declaration, info.returnTypeNode)); + return { renameFilename: void 0, renameLocation: void 0, edits }; + } + return void 0; + } + function getRefactorActionsToInferReturnType(context) { + const info = getInfo4(context); + if (!info) + return emptyArray; + if (!isRefactorErrorInfo(info)) { + return [{ + name: refactorName12, + description: refactorDescription6, + actions: [inferReturnTypeAction] + }]; + } + if (context.preferences.provideRefactorNotApplicableReason) { + return [{ + name: refactorName12, + description: refactorDescription6, + actions: [{ ...inferReturnTypeAction, notApplicableReason: info.error }] + }]; + } + return emptyArray; + } + function doChange7(sourceFile, changes, declaration, typeNode) { + const closeParen = findChildOfKind(declaration, 22 /* CloseParenToken */, sourceFile); + const needParens = isArrowFunction(declaration) && closeParen === void 0; + const endNode2 = needParens ? first(declaration.parameters) : closeParen; + if (endNode2) { + if (needParens) { + changes.insertNodeBefore(sourceFile, endNode2, factory.createToken(21 /* OpenParenToken */)); + changes.insertNodeAfter(sourceFile, endNode2, factory.createToken(22 /* CloseParenToken */)); + } + changes.insertNodeAt(sourceFile, endNode2.end, typeNode, { prefix: ": " }); + } + } + function getInfo4(context) { + if (isInJSFile(context.file) || !refactorKindBeginsWith(inferReturnTypeAction.kind, context.kind)) + return; + const token = getTokenAtPosition(context.file, context.startPosition); + const declaration = findAncestor(token, (n) => isBlock(n) || n.parent && isArrowFunction(n.parent) && (n.kind === 39 /* EqualsGreaterThanToken */ || n.parent.body === n) ? "quit" : isConvertibleDeclaration(n)); + if (!declaration || !declaration.body || declaration.type) { + return { error: getLocaleSpecificMessage(Diagnostics.Return_type_must_be_inferred_from_a_function) }; + } + const typeChecker = context.program.getTypeChecker(); + const returnType = tryGetReturnType(typeChecker, declaration); + if (!returnType) { + return { error: getLocaleSpecificMessage(Diagnostics.Could_not_determine_function_return_type) }; + } + const returnTypeNode = typeChecker.typeToTypeNode(returnType, declaration, 1 /* NoTruncation */); + if (returnTypeNode) { + return { declaration, returnTypeNode }; + } + } + function isConvertibleDeclaration(node) { + switch (node.kind) { + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 173 /* MethodDeclaration */: + return true; + default: + return false; + } + } + function tryGetReturnType(typeChecker, node) { + if (typeChecker.isImplementationOfOverload(node)) { + const signatures = typeChecker.getTypeAtLocation(node).getCallSignatures(); + if (signatures.length > 1) { + return typeChecker.getUnionType(mapDefined(signatures, (s) => s.getReturnType())); + } + } + const signature = typeChecker.getSignatureFromDeclaration(node); + if (signature) { + return typeChecker.getReturnTypeOfSignature(signature); + } + } + var refactorName12, refactorDescription6, inferReturnTypeAction; + var init_inferFunctionReturnType = __esm({ + "src/services/refactors/inferFunctionReturnType.ts"() { + "use strict"; + init_ts4(); + init_ts_refactor(); + refactorName12 = "Infer function return type"; + refactorDescription6 = Diagnostics.Infer_function_return_type.message; + inferReturnTypeAction = { + name: refactorName12, + description: refactorDescription6, + kind: "refactor.rewrite.function.returnType" + }; + registerRefactor(refactorName12, { + kinds: [inferReturnTypeAction.kind], + getEditsForAction: getRefactorEditsToInferReturnType, + getAvailableActions: getRefactorActionsToInferReturnType + }); + } + }); + + // src/services/_namespaces/ts.refactor.inferFunctionReturnType.ts + var ts_refactor_inferFunctionReturnType_exports = {}; + var init_ts_refactor_inferFunctionReturnType = __esm({ + "src/services/_namespaces/ts.refactor.inferFunctionReturnType.ts"() { + "use strict"; + init_inferFunctionReturnType(); + } + }); + + // src/services/_namespaces/ts.refactor.ts + var ts_refactor_exports = {}; + __export(ts_refactor_exports, { + addExportToChanges: () => addExportToChanges, + addExports: () => addExports, + addNewFileToTsconfig: () => addNewFileToTsconfig, + addOrRemoveBracesToArrowFunction: () => ts_refactor_addOrRemoveBracesToArrowFunction_exports, + convertArrowFunctionOrFunctionExpression: () => ts_refactor_convertArrowFunctionOrFunctionExpression_exports, + convertParamsToDestructuredObject: () => ts_refactor_convertParamsToDestructuredObject_exports, + convertStringOrTemplateLiteral: () => ts_refactor_convertStringOrTemplateLiteral_exports, + convertToOptionalChainExpression: () => ts_refactor_convertToOptionalChainExpression_exports, + createNewFileName: () => createNewFileName, + createOldFileImportsFromTargetFile: () => createOldFileImportsFromTargetFile, + deleteMovedStatements: () => deleteMovedStatements, + deleteUnusedImports: () => deleteUnusedImports, + deleteUnusedOldImports: () => deleteUnusedOldImports, + doChangeNamedToNamespaceOrDefault: () => doChangeNamedToNamespaceOrDefault, + extractSymbol: () => ts_refactor_extractSymbol_exports, + filterImport: () => filterImport, + forEachImportInStatement: () => forEachImportInStatement, + generateGetAccessorAndSetAccessor: () => ts_refactor_generateGetAccessorAndSetAccessor_exports, + getApplicableRefactors: () => getApplicableRefactors, + getEditsForRefactor: () => getEditsForRefactor, + getStatementsToMove: () => getStatementsToMove, + getTopLevelDeclarationStatement: () => getTopLevelDeclarationStatement, + getUsageInfo: () => getUsageInfo, + inferFunctionReturnType: () => ts_refactor_inferFunctionReturnType_exports, + isRefactorErrorInfo: () => isRefactorErrorInfo, + isTopLevelDeclaration: () => isTopLevelDeclaration, + makeImportOrRequire: () => makeImportOrRequire, + moduleSpecifierFromImport: () => moduleSpecifierFromImport, + nameOfTopLevelDeclaration: () => nameOfTopLevelDeclaration, + refactorKindBeginsWith: () => refactorKindBeginsWith, + registerRefactor: () => registerRefactor, + updateImportsInOtherFiles: () => updateImportsInOtherFiles + }); + var init_ts_refactor = __esm({ + "src/services/_namespaces/ts.refactor.ts"() { + "use strict"; + init_refactorProvider(); + init_convertExport(); + init_convertImport(); + init_extractType(); + init_helpers(); + init_moveToNewFile(); + init_moveToFile(); + init_ts_refactor_addOrRemoveBracesToArrowFunction(); + init_ts_refactor_convertArrowFunctionOrFunctionExpression(); + init_ts_refactor_convertParamsToDestructuredObject(); + init_ts_refactor_convertStringOrTemplateLiteral(); + init_ts_refactor_convertToOptionalChainExpression(); + init_ts_refactor_extractSymbol(); + init_ts_refactor_generateGetAccessorAndSetAccessor(); + init_ts_refactor_inferFunctionReturnType(); + } + }); + + // src/services/classifier2020.ts + function getSemanticClassifications2(program, cancellationToken, sourceFile, span) { + const classifications = getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span); + Debug.assert(classifications.spans.length % 3 === 0); + const dense = classifications.spans; + const result = []; + for (let i = 0; i < dense.length; i += 3) { + result.push({ + textSpan: createTextSpan(dense[i], dense[i + 1]), + classificationType: dense[i + 2] + }); + } + return result; + } + function getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span) { + return { + spans: getSemanticTokens(program, sourceFile, span, cancellationToken), + endOfLineState: 0 /* None */ + }; + } + function getSemanticTokens(program, sourceFile, span, cancellationToken) { + const resultTokens = []; + const collector = (node, typeIdx, modifierSet) => { + resultTokens.push(node.getStart(sourceFile), node.getWidth(sourceFile), (typeIdx + 1 << 8 /* typeOffset */) + modifierSet); + }; + if (program && sourceFile) { + collectTokens(program, sourceFile, span, collector, cancellationToken); + } + return resultTokens; + } + function collectTokens(program, sourceFile, span, collector, cancellationToken) { + const typeChecker = program.getTypeChecker(); + let inJSXElement = false; + function visit(node) { + switch (node.kind) { + case 266 /* ModuleDeclaration */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: + case 261 /* FunctionDeclaration */: + case 230 /* ClassExpression */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + cancellationToken.throwIfCancellationRequested(); + } + if (!node || !textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) { + return; + } + const prevInJSXElement = inJSXElement; + if (isJsxElement(node) || isJsxSelfClosingElement(node)) { + inJSXElement = true; + } + if (isJsxExpression(node)) { + inJSXElement = false; + } + if (isIdentifier(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) { + let symbol = typeChecker.getSymbolAtLocation(node); + if (symbol) { + if (symbol.flags & 2097152 /* Alias */) { + symbol = typeChecker.getAliasedSymbol(symbol); + } + let typeIdx = classifySymbol2(symbol, getMeaningFromLocation(node)); + if (typeIdx !== void 0) { + let modifierSet = 0; + if (node.parent) { + const parentIsDeclaration = isBindingElement(node.parent) || tokenFromDeclarationMapping.get(node.parent.kind) === typeIdx; + if (parentIsDeclaration && node.parent.name === node) { + modifierSet = 1 << 0 /* declaration */; + } + } + if (typeIdx === 6 /* parameter */ && isRightSideOfQualifiedNameOrPropertyAccess2(node)) { + typeIdx = 9 /* property */; + } + typeIdx = reclassifyByType(typeChecker, node, typeIdx); + const decl = symbol.valueDeclaration; + if (decl) { + const modifiers = getCombinedModifierFlags(decl); + const nodeFlags = getCombinedNodeFlags(decl); + if (modifiers & 32 /* Static */) { + modifierSet |= 1 << 1 /* static */; + } + if (modifiers & 512 /* Async */) { + modifierSet |= 1 << 2 /* async */; + } + if (typeIdx !== 0 /* class */ && typeIdx !== 2 /* interface */) { + if (modifiers & 64 /* Readonly */ || nodeFlags & 2 /* Const */ || symbol.getFlags() & 8 /* EnumMember */) { + modifierSet |= 1 << 3 /* readonly */; + } + } + if ((typeIdx === 7 /* variable */ || typeIdx === 10 /* function */) && isLocalDeclaration(decl, sourceFile)) { + modifierSet |= 1 << 5 /* local */; + } + if (program.isSourceFileDefaultLibrary(decl.getSourceFile())) { + modifierSet |= 1 << 4 /* defaultLibrary */; + } + } else if (symbol.declarations && symbol.declarations.some((d) => program.isSourceFileDefaultLibrary(d.getSourceFile()))) { + modifierSet |= 1 << 4 /* defaultLibrary */; + } + collector(node, typeIdx, modifierSet); + } + } + } + forEachChild(node, visit); + inJSXElement = prevInJSXElement; + } + visit(sourceFile); + } + function classifySymbol2(symbol, meaning) { + const flags = symbol.getFlags(); + if (flags & 32 /* Class */) { + return 0 /* class */; + } else if (flags & 384 /* Enum */) { + return 1 /* enum */; + } else if (flags & 524288 /* TypeAlias */) { + return 5 /* type */; + } else if (flags & 64 /* Interface */) { + if (meaning & 2 /* Type */) { + return 2 /* interface */; + } + } else if (flags & 262144 /* TypeParameter */) { + return 4 /* typeParameter */; + } + let decl = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0]; + if (decl && isBindingElement(decl)) { + decl = getDeclarationForBindingElement(decl); + } + return decl && tokenFromDeclarationMapping.get(decl.kind); + } + function reclassifyByType(typeChecker, node, typeIdx) { + if (typeIdx === 7 /* variable */ || typeIdx === 9 /* property */ || typeIdx === 6 /* parameter */) { + const type = typeChecker.getTypeAtLocation(node); + if (type) { + const test = (condition) => { + return condition(type) || type.isUnion() && type.types.some(condition); + }; + if (typeIdx !== 6 /* parameter */ && test((t) => t.getConstructSignatures().length > 0)) { + return 0 /* class */; + } + if (test((t) => t.getCallSignatures().length > 0) && !test((t) => t.getProperties().length > 0) || isExpressionInCallExpression(node)) { + return typeIdx === 9 /* property */ ? 11 /* member */ : 10 /* function */; + } + } + } + return typeIdx; + } + function isLocalDeclaration(decl, sourceFile) { + if (isBindingElement(decl)) { + decl = getDeclarationForBindingElement(decl); + } + if (isVariableDeclaration(decl)) { + return (!isSourceFile(decl.parent.parent.parent) || isCatchClause(decl.parent)) && decl.getSourceFile() === sourceFile; + } else if (isFunctionDeclaration(decl)) { + return !isSourceFile(decl.parent) && decl.getSourceFile() === sourceFile; + } + return false; + } + function getDeclarationForBindingElement(element) { + while (true) { + if (isBindingElement(element.parent.parent)) { + element = element.parent.parent; + } else { + return element.parent.parent; + } + } + } + function inImportClause(node) { + const parent2 = node.parent; + return parent2 && (isImportClause(parent2) || isImportSpecifier(parent2) || isNamespaceImport(parent2)); + } + function isExpressionInCallExpression(node) { + while (isRightSideOfQualifiedNameOrPropertyAccess2(node)) { + node = node.parent; + } + return isCallExpression(node.parent) && node.parent.expression === node; + } + function isRightSideOfQualifiedNameOrPropertyAccess2(node) { + return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node; + } + var TokenEncodingConsts, TokenType, TokenModifier, tokenFromDeclarationMapping; + var init_classifier2020 = __esm({ + "src/services/classifier2020.ts"() { + "use strict"; + init_ts4(); + TokenEncodingConsts = /* @__PURE__ */ ((TokenEncodingConsts2) => { + TokenEncodingConsts2[TokenEncodingConsts2["typeOffset"] = 8] = "typeOffset"; + TokenEncodingConsts2[TokenEncodingConsts2["modifierMask"] = 255] = "modifierMask"; + return TokenEncodingConsts2; + })(TokenEncodingConsts || {}); + TokenType = /* @__PURE__ */ ((TokenType2) => { + TokenType2[TokenType2["class"] = 0] = "class"; + TokenType2[TokenType2["enum"] = 1] = "enum"; + TokenType2[TokenType2["interface"] = 2] = "interface"; + TokenType2[TokenType2["namespace"] = 3] = "namespace"; + TokenType2[TokenType2["typeParameter"] = 4] = "typeParameter"; + TokenType2[TokenType2["type"] = 5] = "type"; + TokenType2[TokenType2["parameter"] = 6] = "parameter"; + TokenType2[TokenType2["variable"] = 7] = "variable"; + TokenType2[TokenType2["enumMember"] = 8] = "enumMember"; + TokenType2[TokenType2["property"] = 9] = "property"; + TokenType2[TokenType2["function"] = 10] = "function"; + TokenType2[TokenType2["member"] = 11] = "member"; + return TokenType2; + })(TokenType || {}); + TokenModifier = /* @__PURE__ */ ((TokenModifier2) => { + TokenModifier2[TokenModifier2["declaration"] = 0] = "declaration"; + TokenModifier2[TokenModifier2["static"] = 1] = "static"; + TokenModifier2[TokenModifier2["async"] = 2] = "async"; + TokenModifier2[TokenModifier2["readonly"] = 3] = "readonly"; + TokenModifier2[TokenModifier2["defaultLibrary"] = 4] = "defaultLibrary"; + TokenModifier2[TokenModifier2["local"] = 5] = "local"; + return TokenModifier2; + })(TokenModifier || {}); + tokenFromDeclarationMapping = /* @__PURE__ */ new Map([ + [259 /* VariableDeclaration */, 7 /* variable */], + [168 /* Parameter */, 6 /* parameter */], + [171 /* PropertyDeclaration */, 9 /* property */], + [266 /* ModuleDeclaration */, 3 /* namespace */], + [265 /* EnumDeclaration */, 1 /* enum */], + [305 /* EnumMember */, 8 /* enumMember */], + [262 /* ClassDeclaration */, 0 /* class */], + [173 /* MethodDeclaration */, 11 /* member */], + [261 /* FunctionDeclaration */, 10 /* function */], + [217 /* FunctionExpression */, 10 /* function */], + [172 /* MethodSignature */, 11 /* member */], + [176 /* GetAccessor */, 9 /* property */], + [177 /* SetAccessor */, 9 /* property */], + [170 /* PropertySignature */, 9 /* property */], + [263 /* InterfaceDeclaration */, 2 /* interface */], + [264 /* TypeAliasDeclaration */, 5 /* type */], + [167 /* TypeParameter */, 4 /* typeParameter */], + [302 /* PropertyAssignment */, 9 /* property */], + [303 /* ShorthandPropertyAssignment */, 9 /* property */] + ]); + } + }); + // src/services/services.ts function createNode(kind, pos, end, parent2) { - const node = isNodeKind(kind) ? new NodeObject(kind, pos, end) : kind === 79 /* Identifier */ ? new IdentifierObject(79 /* Identifier */, pos, end) : kind === 80 /* PrivateIdentifier */ ? new PrivateIdentifierObject(80 /* PrivateIdentifier */, pos, end) : new TokenObject(kind, pos, end); + const node = isNodeKind(kind) ? new NodeObject(kind, pos, end) : kind === 80 /* Identifier */ ? new IdentifierObject(80 /* Identifier */, pos, end) : kind === 81 /* PrivateIdentifier */ ? new PrivateIdentifierObject(81 /* PrivateIdentifier */, pos, end) : new TokenObject(kind, pos, end); node.parent = parent2; node.flags = parent2.flags & 50720768 /* ContextFlags */; return node; @@ -133134,12 +139743,12 @@ ${lanes.join("\n")} return children; } function addSyntheticNodes(nodes, pos, end, parent2) { - scanner.setTextPos(pos); + scanner.resetTokenState(pos); while (pos < end) { const token = scanner.scan(); - const textPos = scanner.getTextPos(); + const textPos = scanner.getTokenEnd(); if (textPos <= end) { - if (token === 79 /* Identifier */) { + if (token === 80 /* Identifier */) { if (hasTabstop(parent2)) { continue; } @@ -133154,7 +139763,7 @@ ${lanes.join("\n")} } } function createSyntaxList(nodes, parent2) { - const list = createNode(354 /* SyntaxList */, nodes.pos, nodes.end, parent2); + const list = createNode(357 /* SyntaxList */, nodes.pos, nodes.end, parent2); list._children = []; let pos = nodes.pos; for (const node of nodes) { @@ -133176,13 +139785,13 @@ ${lanes.join("\n")} const seenSymbols = /* @__PURE__ */ new Set(); for (const declaration of declarations) { const inheritedTags = findBaseOfDeclaration(checker, declaration, (symbol) => { - var _a2; + var _a; if (!seenSymbols.has(symbol)) { seenSymbols.add(symbol); - if (declaration.kind === 174 /* GetAccessor */ || declaration.kind === 175 /* SetAccessor */) { + if (declaration.kind === 176 /* GetAccessor */ || declaration.kind === 177 /* SetAccessor */) { return symbol.getContextualJsDocTags(declaration, checker); } - return ((_a2 = symbol.declarations) == null ? void 0 : _a2.length) === 1 ? symbol.getJsDocTags() : void 0; + return ((_a = symbol.declarations) == null ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : void 0; } }); if (inheritedTags) { @@ -133202,7 +139811,7 @@ ${lanes.join("\n")} const inheritedDocs = findBaseOfDeclaration(checker, declaration, (symbol) => { if (!seenSymbols.has(symbol)) { seenSymbols.add(symbol); - if (declaration.kind === 174 /* GetAccessor */ || declaration.kind === 175 /* SetAccessor */) { + if (declaration.kind === 176 /* GetAccessor */ || declaration.kind === 177 /* SetAccessor */) { return symbol.getContextualDocumentationComment(declaration, checker); } return symbol.getDocumentationComment(checker); @@ -133215,8 +139824,8 @@ ${lanes.join("\n")} return doc; } function findBaseOfDeclaration(checker, declaration, cb) { - var _a2; - const classOrInterfaceDeclaration = ((_a2 = declaration.parent) == null ? void 0 : _a2.kind) === 173 /* Constructor */ ? declaration.parent.parent : declaration.parent; + var _a; + const classOrInterfaceDeclaration = ((_a = declaration.parent) == null ? void 0 : _a.kind) === 175 /* Constructor */ ? declaration.parent.parent : declaration.parent; if (!classOrInterfaceDeclaration) return; const isStaticMember = hasStaticModifier(declaration); @@ -133327,7 +139936,7 @@ ${lanes.join("\n")} ); } function createLanguageService(host, documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()), syntaxOnlyOrLanguageServiceMode) { - var _a2; + var _a; let languageServiceMode; if (syntaxOnlyOrLanguageServiceMode === void 0) { languageServiceMode = 0 /* Semantic */; @@ -133342,7 +139951,7 @@ ${lanes.join("\n")} let lastTypesRootVersion = 0; const cancellationToken = host.getCancellationToken ? new CancellationTokenObject(host.getCancellationToken()) : NoopCancellationToken; const currentDirectory = host.getCurrentDirectory(); - maybeSetLocalizedDiagnosticMessages((_a2 = host.getLocalizedDiagnosticMessages) == null ? void 0 : _a2.bind(host)); + maybeSetLocalizedDiagnosticMessages((_a = host.getLocalizedDiagnosticMessages) == null ? void 0 : _a.bind(host)); function log(message) { if (host.log) { host.log(message); @@ -133370,12 +139979,12 @@ ${lanes.join("\n")} return sourceFile; } function synchronizeHostData() { - var _a3, _b, _c; + var _a2, _b, _c; Debug.assert(languageServiceMode !== 2 /* Syntactic */); if (host.getProjectVersion) { const hostProjectVersion = host.getProjectVersion(); if (hostProjectVersion) { - if (lastProjectVersion === hostProjectVersion && !((_a3 = host.hasChangedAutomaticTypeDirectiveNames) == null ? void 0 : _a3.call(host))) { + if (lastProjectVersion === hostProjectVersion && !((_a2 = host.hasChangedAutomaticTypeDirectiveNames) == null ? void 0 : _a2.call(host))) { return; } lastProjectVersion = hostProjectVersion; @@ -133390,6 +139999,7 @@ ${lanes.join("\n")} const rootFileNames = host.getScriptFileNames().slice(); const newSettings = host.getCompilationSettings() || getDefaultCompilerOptions2(); const hasInvalidatedResolutions = host.hasInvalidatedResolutions || returnFalse; + const hasInvalidatedLibResolutions = maybeBind(host, host.hasInvalidatedLibResolutions) || returnFalse; const hasChangedAutomaticTypeDirectiveNames = maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames); const projectReferences = (_b = host.getProjectReferences) == null ? void 0 : _b.call(host); let parsedCommandLines; @@ -133420,6 +140030,7 @@ ${lanes.join("\n")} onReleaseOldSourceFile, onReleaseParsedCommandLine, hasInvalidatedResolutions, + hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, trace: maybeBind(host, host.trace), resolveModuleNames: maybeBind(host, host.resolveModuleNames), @@ -133428,6 +140039,7 @@ ${lanes.join("\n")} resolveTypeReferenceDirectives: maybeBind(host, host.resolveTypeReferenceDirectives), resolveModuleNameLiterals: maybeBind(host, host.resolveModuleNameLiterals), resolveTypeReferenceDirectiveReferences: maybeBind(host, host.resolveTypeReferenceDirectiveReferences), + resolveLibrary: maybeBind(host, host.resolveLibrary), useSourceOfProjectReferenceRedirect: maybeBind(host, host.useSourceOfProjectReferenceRedirect), getParsedCommandLine }; @@ -133449,7 +140061,11 @@ ${lanes.join("\n")} onUnRecoverableConfigFileDiagnostic: noop }; const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); - if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + let releasedScriptKinds = /* @__PURE__ */ new Set(); + if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + compilerHost = void 0; + parsedCommandLines = void 0; + releasedScriptKinds = void 0; return; } const options = { @@ -133462,6 +140078,7 @@ ${lanes.join("\n")} program = createProgram(options); compilerHost = void 0; parsedCommandLines = void 0; + releasedScriptKinds = void 0; sourceMapper.clearCache(); program.getTypeChecker(); return; @@ -133485,15 +140102,15 @@ ${lanes.join("\n")} result, parseConfigHost, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), - /*optionsToExtend*/ + /*existingOptions*/ void 0, getNormalizedAbsolutePath(configFileName, currentDirectory) ); } function onReleaseParsedCommandLine(configFileName, oldResolvedRef, oldOptions) { - var _a4; + var _a3; if (host.getParsedCommandLine) { - (_a4 = host.onReleaseParsedCommandLine) == null ? void 0 : _a4.call(host, configFileName, oldResolvedRef, oldOptions); + (_a3 = host.onReleaseParsedCommandLine) == null ? void 0 : _a3.call(host, configFileName, oldResolvedRef, oldOptions); } else if (oldResolvedRef) { onReleaseOldSourceFile(oldResolvedRef.sourceFile, oldOptions); } @@ -133516,10 +140133,11 @@ ${lanes.join("\n")} if (!shouldCreateNewSourceFile) { const oldSourceFile = program && program.getSourceFileByPath(path); if (oldSourceFile) { - if (scriptKind === oldSourceFile.scriptKind) { + if (scriptKind === oldSourceFile.scriptKind || releasedScriptKinds.has(oldSourceFile.resolvedPath)) { return documentRegistry.updateDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind, languageVersionOrOptions); } else { documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions()), oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat); + releasedScriptKinds.add(oldSourceFile.resolvedPath); } } } @@ -133535,8 +140153,8 @@ ${lanes.join("\n")} return program; } function getAutoImportProvider() { - var _a3; - return (_a3 = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a3.call(host); + var _a2; + return (_a2 = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a2.call(host); } function updateIsDefinitionOfReferencedSymbols(referencedSymbols, knownSymbolSpans) { const checker = program.getTypeChecker(); @@ -133706,21 +140324,24 @@ ${lanes.join("\n")} if (isImportMeta(node.parent) && node.parent.name === node) { return node.parent; } + if (isJsxNamespacedName(node.parent)) { + return node.parent; + } return node; } function shouldGetType(sourceFile, node, position) { switch (node.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return !isLabelName(node) && !isTagName(node) && !isConstTypeReference(node.parent); - case 208 /* PropertyAccessExpression */: - case 163 /* QualifiedName */: + case 210 /* PropertyAccessExpression */: + case 165 /* QualifiedName */: return !isInComment(sourceFile, position); - case 108 /* ThisKeyword */: - case 194 /* ThisType */: - case 106 /* SuperKeyword */: - case 199 /* NamedTupleMember */: + case 110 /* ThisKeyword */: + case 196 /* ThisType */: + case 108 /* SuperKeyword */: + case 201 /* NamedTupleMember */: return true; - case 233 /* MetaProperty */: + case 235 /* MetaProperty */: return isImportMeta(node); default: return false; @@ -133742,18 +140363,6 @@ ${lanes.join("\n")} synchronizeHostData(); return ts_FindAllReferences_exports.getImplementationsAtPosition(program, cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position); } - function getOccurrencesAtPosition(fileName, position) { - return flatMap( - getDocumentHighlights(fileName, position, [fileName]), - (entry) => entry.highlightSpans.map((highlightSpan) => ({ - fileName: entry.fileName, - textSpan: highlightSpan.textSpan, - isWriteAccess: highlightSpan.kind === "writtenReference" /* writtenReference */, - ...highlightSpan.isInString && { isInString: true }, - ...highlightSpan.contextSpan && { contextSpan: highlightSpan.contextSpan } - })) - ); - } function getDocumentHighlights(fileName, position, filesToSearch) { const normalizedFileName = normalizePath(fileName); Debug.assert(filesToSearch.some((f) => normalizePath(f) === normalizedFileName)); @@ -133762,7 +140371,7 @@ ${lanes.join("\n")} const sourceFile = getValidSourceFile(fileName); return DocumentHighlights.getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch); } - function findRenameLocations(fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename) { + function findRenameLocations(fileName, position, findInStrings, findInComments, preferences) { synchronizeHostData(); const sourceFile = getValidSourceFile(fileName); const node = getAdjustedRenameLocation(getTouchingPropertyName(sourceFile, position)); @@ -133779,11 +140388,13 @@ ${lanes.join("\n")} }; }); } else { + const quotePreference = getQuotePreference(sourceFile, preferences ?? emptyOptions); + const providePrefixAndSuffixTextForRename = typeof preferences === "boolean" ? preferences : preferences == null ? void 0 : preferences.providePrefixAndSuffixTextForRename; return getReferencesWorker( node, position, { findInStrings, findInComments, providePrefixAndSuffixTextForRename, use: ts_FindAllReferences_exports.FindReferencesUse.Rename }, - (entry, originalNode, checker) => ts_FindAllReferences_exports.toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixTextForRename || false) + (entry, originalNode, checker) => ts_FindAllReferences_exports.toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixTextForRename || false, quotePreference) ); } } @@ -133830,16 +140441,16 @@ ${lanes.join("\n")} return void 0; } switch (node.kind) { - case 208 /* PropertyAccessExpression */: - case 163 /* QualifiedName */: - case 10 /* StringLiteral */: - case 95 /* FalseKeyword */: - case 110 /* TrueKeyword */: - case 104 /* NullKeyword */: - case 106 /* SuperKeyword */: - case 108 /* ThisKeyword */: - case 194 /* ThisType */: - case 79 /* Identifier */: + case 210 /* PropertyAccessExpression */: + case 165 /* QualifiedName */: + case 11 /* StringLiteral */: + case 97 /* FalseKeyword */: + case 112 /* TrueKeyword */: + case 106 /* NullKeyword */: + case 108 /* SuperKeyword */: + case 110 /* ThisKeyword */: + case 196 /* ThisType */: + case 80 /* Identifier */: break; default: return void 0; @@ -133849,7 +140460,7 @@ ${lanes.join("\n")} if (isRightSideOfPropertyAccess(nodeForStartPos) || isRightSideOfQualifiedName(nodeForStartPos)) { nodeForStartPos = nodeForStartPos.parent; } else if (isNameOfModuleDeclaration(nodeForStartPos)) { - if (nodeForStartPos.parent.parent.kind === 264 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { + if (nodeForStartPos.parent.parent.kind === 266 /* ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { nodeForStartPos = nodeForStartPos.parent.parent.name; } else { break; @@ -133874,7 +140485,7 @@ ${lanes.join("\n")} synchronizeHostData(); const responseFormat = format || "original" /* Original */; if (responseFormat === "2020" /* TwentyTwenty */) { - return ts_classifier_exports.v2020.getSemanticClassifications(program, cancellationToken, getValidSourceFile(fileName), span); + return getSemanticClassifications2(program, cancellationToken, getValidSourceFile(fileName), span); } else { return getSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span); } @@ -133885,7 +140496,7 @@ ${lanes.join("\n")} if (responseFormat === "original" /* Original */) { return getEncodedSemanticClassifications(program.getTypeChecker(), cancellationToken, getValidSourceFile(fileName), program.getClassifiableNames(), span); } else { - return ts_classifier_exports.v2020.getEncodedSemanticClassifications(program, cancellationToken, getValidSourceFile(fileName), span); + return getEncodedSemanticClassifications2(program, cancellationToken, getValidSourceFile(fileName), span); } } function getSyntacticClassifications2(fileName, span) { @@ -133899,10 +140510,10 @@ ${lanes.join("\n")} return ts_OutliningElementsCollector_exports.collectElements(sourceFile, cancellationToken); } const braceMatching = new Map(Object.entries({ - [18 /* OpenBraceToken */]: 19 /* CloseBraceToken */, - [20 /* OpenParenToken */]: 21 /* CloseParenToken */, - [22 /* OpenBracketToken */]: 23 /* CloseBracketToken */, - [31 /* GreaterThanToken */]: 29 /* LessThanToken */ + [19 /* OpenBraceToken */]: 20 /* CloseBraceToken */, + [21 /* OpenParenToken */]: 22 /* CloseParenToken */, + [23 /* OpenBracketToken */]: 24 /* CloseBracketToken */, + [32 /* GreaterThanToken */]: 30 /* LessThanToken */ })); braceMatching.forEach((value, key) => braceMatching.set(value.toString(), Number(key))); function getBraceMatchingAtPosition(fileName, position) { @@ -133946,30 +140557,29 @@ ${lanes.join("\n")} } return []; } - function getCodeFixesAtPosition(fileName, start, end, errorCodes63, formatOptions, preferences = emptyOptions) { + function getCodeFixesAtPosition(fileName, start, end, errorCodes64, formatOptions, preferences = emptyOptions) { synchronizeHostData(); const sourceFile = getValidSourceFile(fileName); const span = createTextSpanFromBounds(start, end); const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host); - return flatMap(deduplicate(errorCodes63, equateValues, compareValues), (errorCode) => { + return flatMap(deduplicate(errorCodes64, equateValues, compareValues), (errorCode) => { cancellationToken.throwIfCancellationRequested(); return ts_codefix_exports.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext, preferences }); }); } - function getCombinedCodeFix(scope, fixId51, formatOptions, preferences = emptyOptions) { + function getCombinedCodeFix(scope, fixId52, formatOptions, preferences = emptyOptions) { synchronizeHostData(); Debug.assert(scope.type === "file"); const sourceFile = getValidSourceFile(scope.fileName); const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host); - return ts_codefix_exports.getAllFixes({ fixId: fixId51, sourceFile, program, host, cancellationToken, formatContext, preferences }); + return ts_codefix_exports.getAllFixes({ fixId: fixId52, sourceFile, program, host, cancellationToken, formatContext, preferences }); } function organizeImports2(args, formatOptions, preferences = emptyOptions) { - var _a3; synchronizeHostData(); Debug.assert(args.type === "file"); const sourceFile = getValidSourceFile(args.fileName); const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host); - const mode = (_a3 = args.mode) != null ? _a3 : args.skipDestructiveCodeActions ? "SortAndCombine" /* SortAndCombine */ : "All" /* All */; + const mode = args.mode ?? (args.skipDestructiveCodeActions ? "SortAndCombine" /* SortAndCombine */ : "All" /* All */); return ts_OrganizeImports_exports.organizeImports(sourceFile, formatContext, host, program, preferences, mode); } function getEditsForFileRename2(oldFilePath, newFilePath, formatOptions, preferences = emptyOptions) { @@ -134015,15 +140625,64 @@ ${lanes.join("\n")} const token = findPrecedingToken(position, sourceFile); if (!token) return void 0; - const element = token.kind === 31 /* GreaterThanToken */ && isJsxOpeningElement(token.parent) ? token.parent.parent : isJsxText(token) && isJsxElement(token.parent) ? token.parent : void 0; + const element = token.kind === 32 /* GreaterThanToken */ && isJsxOpeningElement(token.parent) ? token.parent.parent : isJsxText(token) && isJsxElement(token.parent) ? token.parent : void 0; if (element && isUnclosedTag(element)) { return { newText: `` }; } - const fragment = token.kind === 31 /* GreaterThanToken */ && isJsxOpeningFragment(token.parent) ? token.parent.parent : isJsxText(token) && isJsxFragment(token.parent) ? token.parent : void 0; + const fragment = token.kind === 32 /* GreaterThanToken */ && isJsxOpeningFragment(token.parent) ? token.parent.parent : isJsxText(token) && isJsxFragment(token.parent) ? token.parent : void 0; if (fragment && isUnclosedFragment(fragment)) { return { newText: "" }; } } + function getLinkedEditingRangeAtPosition(fileName, position) { + const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); + const token = findPrecedingToken(position, sourceFile); + if (!token || token.parent.kind === 311 /* SourceFile */) + return void 0; + const jsxTagWordPattern = "[a-zA-Z0-9:\\-\\._$]*"; + if (isJsxFragment(token.parent.parent)) { + const openFragment = token.parent.parent.openingFragment; + const closeFragment = token.parent.parent.closingFragment; + if (containsParseError(openFragment) || containsParseError(closeFragment)) + return void 0; + const openPos = openFragment.getStart(sourceFile) + 1; + const closePos = closeFragment.getStart(sourceFile) + 2; + if (position !== openPos && position !== closePos) + return void 0; + return { + ranges: [{ start: openPos, length: 0 }, { start: closePos, length: 0 }], + wordPattern: jsxTagWordPattern + }; + } else { + const tag = findAncestor( + token.parent, + (n) => { + if (isJsxOpeningElement(n) || isJsxClosingElement(n)) { + return true; + } + return false; + } + ); + if (!tag) + return void 0; + Debug.assert(isJsxOpeningElement(tag) || isJsxClosingElement(tag), "tag should be opening or closing element"); + const openTag = tag.parent.openingElement; + const closeTag = tag.parent.closingElement; + const openTagStart = openTag.tagName.getStart(sourceFile); + const openTagEnd = openTag.tagName.end; + const closeTagStart = closeTag.tagName.getStart(sourceFile); + const closeTagEnd = closeTag.tagName.end; + if (!(openTagStart <= position && position <= openTagEnd || closeTagStart <= position && position <= closeTagEnd)) + return void 0; + const openingTagText = openTag.tagName.getText(sourceFile); + if (openingTagText !== closeTag.tagName.getText(sourceFile)) + return void 0; + return { + ranges: [{ start: openTagStart, length: openTagEnd - openTagStart }, { start: closeTagStart, length: closeTagEnd - closeTagStart }], + wordPattern: jsxTagWordPattern + }; + } + } function getLinesForRange(sourceFile, textRange) { return { lineStarts: sourceFile.getLineStarts(), @@ -134082,7 +140741,7 @@ ${lanes.join("\n")} return textChanges2; } function toggleMultilineComment(fileName, textRange, insertComment, isInsideJsx) { - var _a3; + var _a2; const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); const textChanges2 = []; const { text } = sourceFile; @@ -134116,7 +140775,7 @@ ${lanes.join("\n")} } } if (isCommenting || !hasComment) { - if (((_a3 = isInComment(sourceFile, textRange.pos)) == null ? void 0 : _a3.kind) !== 2 /* SingleLineCommentTrivia */) { + if (((_a2 = isInComment(sourceFile, textRange.pos)) == null ? void 0 : _a2.kind) !== 2 /* SingleLineCommentTrivia */) { insertSorted(positions, textRange.pos, compareValues); } insertSorted(positions, textRange.end, compareValues); @@ -134322,15 +140981,24 @@ ${lanes.join("\n")} function getSmartSelectionRange2(fileName, position) { return ts_SmartSelectionRange_exports.getSmartSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName)); } - function getApplicableRefactors2(fileName, positionOrRange, preferences = emptyOptions, triggerReason, kind) { + function getApplicableRefactors2(fileName, positionOrRange, preferences = emptyOptions, triggerReason, kind, includeInteractiveActions) { synchronizeHostData(); const file = getValidSourceFile(fileName); - return ts_refactor_exports.getApplicableRefactors(getRefactorContext(file, positionOrRange, preferences, emptyOptions, triggerReason, kind)); + return ts_refactor_exports.getApplicableRefactors(getRefactorContext(file, positionOrRange, preferences, emptyOptions, triggerReason, kind), includeInteractiveActions); } - function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName13, actionName2, preferences = emptyOptions) { + function getMoveToRefactoringFileSuggestions(fileName, positionOrRange, preferences = emptyOptions) { + synchronizeHostData(); + const sourceFile = getValidSourceFile(fileName); + const allFiles = Debug.checkDefined(program.getSourceFiles()); + const extension = extensionFromPath(fileName); + const files = mapDefined(allFiles, (file) => !(program == null ? void 0 : program.isSourceFileFromExternalLibrary(sourceFile)) && !(sourceFile === getValidSourceFile(file.fileName) || extension === ".ts" /* Ts */ && extensionFromPath(file.fileName) === ".d.ts" /* Dts */ || extension === ".d.ts" /* Dts */ && startsWith(getBaseFileName(file.fileName), "lib.") && extensionFromPath(file.fileName) === ".d.ts" /* Dts */) && extension === extensionFromPath(file.fileName) ? file.fileName : void 0); + const newFileName = createNewFileName(sourceFile, program, getRefactorContext(sourceFile, positionOrRange, preferences, emptyOptions), host); + return { newFileName, files }; + } + function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName13, actionName2, preferences = emptyOptions, interactiveRefactorArguments) { synchronizeHostData(); const file = getValidSourceFile(fileName); - return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName13, actionName2); + return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName13, actionName2, interactiveRefactorArguments); } function toLineColumnOffset(fileName, position) { if (position === 0) { @@ -134383,7 +141051,6 @@ ${lanes.join("\n")} getReferencesAtPosition, findReferences, getFileReferences, - getOccurrencesAtPosition, getDocumentHighlights, getNameOrDottedNameSpan, getBreakpointStatementAtPosition, @@ -134403,6 +141070,7 @@ ${lanes.join("\n")} getDocCommentTemplateAtPosition: getDocCommentTemplateAtPosition2, isValidBraceCompletionAtPosition, getJsxClosingTagAtPosition, + getLinkedEditingRangeAtPosition, getSpanOfEnclosingComment, getCodeFixesAtPosition, getCombinedCodeFix, @@ -134417,6 +141085,7 @@ ${lanes.join("\n")} updateIsDefinitionOfReferencedSymbols, getApplicableRefactors: getApplicableRefactors2, getEditsForRefactor: getEditsForRefactor2, + getMoveToRefactoringFileSuggestions, toLineColumnOffset, getSourceMapper: () => sourceMapper, clearSourceMapperCache: () => sourceMapper.clearCache(), @@ -134477,7 +141146,7 @@ ${lanes.join("\n")} }); } function literalIsName(node) { - return isDeclarationName(node) || node.parent.kind === 280 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || isLiteralComputedPropertyDeclarationName(node); + return isDeclarationName(node) || node.parent.kind === 282 /* ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || isLiteralComputedPropertyDeclarationName(node); } function getContainingObjectLiteralElement(node) { const element = getContainingObjectLiteralElementWorker(node); @@ -134485,14 +141154,14 @@ ${lanes.join("\n")} } function getContainingObjectLiteralElementWorker(node) { switch (node.kind) { - case 10 /* StringLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 8 /* NumericLiteral */: - if (node.parent.kind === 164 /* ComputedPropertyName */) { + case 11 /* StringLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 9 /* NumericLiteral */: + if (node.parent.kind === 166 /* ComputedPropertyName */) { return isObjectLiteralElement(node.parent.parent) ? node.parent.parent : void 0; } - case 79 /* Identifier */: - return isObjectLiteralElement(node.parent) && (node.parent.parent.kind === 207 /* ObjectLiteralExpression */ || node.parent.parent.kind === 289 /* JsxAttributes */) && node.parent.name === node ? node.parent : void 0; + case 80 /* Identifier */: + return isObjectLiteralElement(node.parent) && (node.parent.parent.kind === 209 /* ObjectLiteralExpression */ || node.parent.parent.kind === 291 /* JsxAttributes */) && node.parent.name === node ? node.parent : void 0; } return void 0; } @@ -134533,7 +141202,7 @@ ${lanes.join("\n")} return discriminatedPropertySymbols; } function isArgumentOfElementAccessExpression(node) { - return node && node.parent && node.parent.kind === 209 /* ElementAccessExpression */ && node.parent.argumentExpression === node; + return node && node.parent && node.parent.kind === 211 /* ElementAccessExpression */ && node.parent.argumentExpression === node; } function getDefaultLibFilePath(options) { if (sys) { @@ -134546,9 +141215,11 @@ ${lanes.join("\n")} "src/services/services.ts"() { "use strict"; init_ts4(); - init_ts4(); init_ts_NavigateTo(); init_ts_NavigationBar(); + init_ts_refactor(); + init_classifier(); + init_classifier2020(); servicesVersion = "0.8"; NodeObject = class { constructor(kind, pos, end) { @@ -134617,8 +141288,8 @@ ${lanes.join("\n")} if (!children.length) { return void 0; } - const child = find(children, (kid) => kid.kind < 312 /* FirstJSDocNode */ || kid.kind > 353 /* LastJSDocNode */); - return child.kind < 163 /* FirstNode */ ? child : child.getFirstToken(sourceFile); + const child = find(children, (kid) => kid.kind < 315 /* FirstJSDocNode */ || kid.kind > 356 /* LastJSDocNode */); + return child.kind < 165 /* FirstNode */ ? child : child.getFirstToken(sourceFile); } getLastToken(sourceFile) { this.assertHasRealPosition(); @@ -134627,7 +141298,7 @@ ${lanes.join("\n")} if (!child) { return void 0; } - return child.kind < 163 /* FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 165 /* FirstNode */ ? child : child.getLastToken(sourceFile); } forEachChild(cbNode, cbNodeArray) { return forEachChild(this, cbNode, cbNodeArray); @@ -134783,23 +141454,23 @@ ${lanes.join("\n")} IdentifierObject = class extends TokenOrIdentifierObject { constructor(_kind, pos, end) { super(pos, end); - this.kind = 79 /* Identifier */; + this.kind = 80 /* Identifier */; } get text() { return idText(this); } }; - IdentifierObject.prototype.kind = 79 /* Identifier */; + IdentifierObject.prototype.kind = 80 /* Identifier */; PrivateIdentifierObject = class extends TokenOrIdentifierObject { constructor(_kind, pos, end) { super(pos, end); - this.kind = 80 /* PrivateIdentifier */; + this.kind = 81 /* PrivateIdentifier */; } get text() { return idText(this); } }; - PrivateIdentifierObject.prototype.kind = 80 /* PrivateIdentifier */; + PrivateIdentifierObject.prototype.kind = 81 /* PrivateIdentifier */; TypeObject = class { constructor(checker, flags) { this.checker = checker; @@ -134928,7 +141599,7 @@ ${lanes.join("\n")} SourceFileObject = class extends NodeObject { constructor(kind, pos, end) { super(kind, pos, end); - this.kind = 308 /* SourceFile */; + this.kind = 311 /* SourceFile */; } update(newText, textChangeRange) { return updateSourceFile(this, newText, textChangeRange); @@ -134984,10 +141655,10 @@ ${lanes.join("\n")} } function visit(node) { switch (node.kind) { - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: const functionDeclaration = node; const declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -135003,29 +141674,29 @@ ${lanes.join("\n")} } forEachChild(node, visit); break; - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 261 /* InterfaceDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 263 /* EnumDeclaration */: - case 264 /* ModuleDeclaration */: - case 268 /* ImportEqualsDeclaration */: - case 278 /* ExportSpecifier */: - case 273 /* ImportSpecifier */: - case 270 /* ImportClause */: - case 271 /* NamespaceImport */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 184 /* TypeLiteral */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 263 /* InterfaceDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 265 /* EnumDeclaration */: + case 266 /* ModuleDeclaration */: + case 270 /* ImportEqualsDeclaration */: + case 280 /* ExportSpecifier */: + case 275 /* ImportSpecifier */: + case 272 /* ImportClause */: + case 273 /* NamespaceImport */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 186 /* TypeLiteral */: addDeclaration(node); forEachChild(node, visit); break; - case 166 /* Parameter */: + case 168 /* Parameter */: if (!hasSyntacticModifier(node, 16476 /* ParameterPropertyModifier */)) { break; } - case 257 /* VariableDeclaration */: - case 205 /* BindingElement */: { + case 259 /* VariableDeclaration */: + case 207 /* BindingElement */: { const decl = node; if (isBindingPattern(decl.name)) { forEachChild(decl.name, visit); @@ -135035,12 +141706,12 @@ ${lanes.join("\n")} visit(decl.initializer); } } - case 302 /* EnumMember */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: + case 305 /* EnumMember */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: addDeclaration(node); break; - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: const exportDeclaration = node; if (exportDeclaration.exportClause) { if (isNamedExports(exportDeclaration.exportClause)) { @@ -135050,14 +141721,14 @@ ${lanes.join("\n")} } } break; - case 269 /* ImportDeclaration */: + case 271 /* ImportDeclaration */: const importClause = node.importClause; if (importClause) { if (importClause.name) { addDeclaration(importClause.name); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 271 /* NamespaceImport */) { + if (importClause.namedBindings.kind === 273 /* NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { forEach(importClause.namedBindings.elements, visit); @@ -135065,7 +141736,7 @@ ${lanes.join("\n")} } } break; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: if (getAssignmentDeclarationKind(node) !== 0 /* None */) { addDeclaration(node); } @@ -135090,7 +141761,7 @@ ${lanes.join("\n")} this.host = host; } getCurrentSourceFile(fileName) { - var _a2, _b, _c, _d, _e, _f, _g, _h; + var _a, _b, _c, _d, _e, _f, _g, _h; const scriptSnapshot = this.host.getScriptSnapshot(fileName); if (!scriptSnapshot) { throw new Error("Could not find file: '" + fileName + "'."); @@ -135102,7 +141773,7 @@ ${lanes.join("\n")} const options = { languageVersion: 99 /* Latest */, impliedNodeFormat: getImpliedNodeFormatForFile( - toPath(fileName, this.host.getCurrentDirectory(), ((_c = (_b = (_a2 = this.host).getCompilerHost) == null ? void 0 : _b.call(_a2)) == null ? void 0 : _c.getCanonicalFileName) || hostGetCanonicalFileName(this.host)), + toPath(fileName, this.host.getCurrentDirectory(), ((_c = (_b = (_a = this.host).getCompilerHost) == null ? void 0 : _b.call(_a)) == null ? void 0 : _c.getCanonicalFileName) || hostGetCanonicalFileName(this.host)), (_h = (_g = (_f = (_e = (_d = this.host).getCompilerHost) == null ? void 0 : _e.call(_d)) == null ? void 0 : _f.getModuleResolutionCache) == null ? void 0 : _g.call(_f)) == null ? void 0 : _h.getPackageJsonInfoCache(), this.host, this.host.getCompilationSettings() @@ -135143,9 +141814,9 @@ ${lanes.join("\n")} return this.cancellationToken.isCancellationRequested(); } throwIfCancellationRequested() { - var _a2; + var _a; if (this.isCancellationRequested()) { - (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.Session, "cancellationThrown", { kind: "CancellationTokenObject" }); + (_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.Session, "cancellationThrown", { kind: "CancellationTokenObject" }); throw new OperationCanceledException(); } } @@ -135169,9 +141840,9 @@ ${lanes.join("\n")} return false; } throwIfCancellationRequested() { - var _a2; + var _a; if (this.isCancellationRequested()) { - (_a2 = tracing) == null ? void 0 : _a2.instant(tracing.Phase.Session, "cancellationThrown", { kind: "ThrottledCancellationToken" }); + (_a = tracing) == null ? void 0 : _a.instant(tracing.Phase.Session, "cancellationThrown", { kind: "ThrottledCancellationToken" }); throw new OperationCanceledException(); } } @@ -135209,7 +141880,6 @@ ${lanes.join("\n")} "getTypeDefinitionAtPosition", "getReferencesAtPosition", "findReferences", - "getOccurrencesAtPosition", "getDocumentHighlights", "getNavigateToItems", "getRenameInfo", @@ -135228,7 +141898,7 @@ ${lanes.join("\n")} const result = transformNodes( /*resolver*/ void 0, - /*emitHost*/ + /*host*/ void 0, factory, compilerOptions, @@ -135739,10 +142409,10 @@ ${lanes.join("\n")} () => this.languageService.getSmartSelectionRange(fileName, position) ); } - findRenameLocations(fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename) { + findRenameLocations(fileName, position, findInStrings, findInComments, preferences) { return this.forwardJSONCall( - `findRenameLocations('${fileName}', ${position}, ${findInStrings}, ${findInComments}, ${providePrefixAndSuffixTextForRename})`, - () => this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename) + `findRenameLocations('${fileName}', ${position}, ${findInStrings}, ${findInComments})`, + () => this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments, preferences) ); } /// GET BRACE MATCHING @@ -135793,12 +142463,6 @@ ${lanes.join("\n")} () => this.languageService.getFileReferences(fileName) ); } - getOccurrencesAtPosition(fileName, position) { - return this.forwardJSONCall( - `getOccurrencesAtPosition('${fileName}', ${position})`, - () => this.languageService.getOccurrencesAtPosition(fileName, position) - ); - } getDocumentHighlights(fileName, position, filesToSearch) { return this.forwardJSONCall( `getDocumentHighlights('${fileName}', ${position})`, @@ -136035,9 +142699,9 @@ ${lanes.join("\n")} () => { const result = preProcessFile( getSnapshotText(sourceTextSnapshot), - /* readImportFiles */ + /*readImportFiles*/ true, - /* detectJavaScriptImports */ + /*detectJavaScriptImports*/ true ); return { @@ -136106,7 +142770,7 @@ ${lanes.join("\n")} } discoverTypings(discoverTypingsJson) { const getCanonicalFileName = createGetCanonicalFileName( - /*useCaseSensitivefileNames:*/ + /*useCaseSensitiveFileNames*/ false ); return this.forwardJSONCall("discoverTypings()", () => { @@ -136148,7 +142812,7 @@ ${lanes.join("\n")} const languageService = createLanguageService( hostAdapter, this.documentRegistry, - /*syntaxOnly*/ + /*syntaxOnlyOrLanguageServiceMode*/ false ); return new LanguageServiceShimObject(this, host, languageService); @@ -136251,154 +142915,154 @@ ${lanes.join("\n")} if (node) { const { parent: parent2 } = node; switch (node.kind) { - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 257 /* VariableDeclaration */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: + case 259 /* VariableDeclaration */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: return spanInVariableDeclaration(node); - case 166 /* Parameter */: + case 168 /* Parameter */: return spanInParameterDeclaration(node); - case 259 /* FunctionDeclaration */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 173 /* Constructor */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 261 /* FunctionDeclaration */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 175 /* Constructor */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: return spanInFunctionDeclaration(node); - case 238 /* Block */: + case 240 /* Block */: if (isFunctionBlock(node)) { return spanInFunctionBlock(node); } - case 265 /* ModuleBlock */: + case 267 /* ModuleBlock */: return spanInBlock(node); - case 295 /* CatchClause */: + case 298 /* CatchClause */: return spanInBlock(node.block); - case 241 /* ExpressionStatement */: + case 243 /* ExpressionStatement */: return textSpan(node.expression); - case 250 /* ReturnStatement */: + case 252 /* ReturnStatement */: return textSpan(node.getChildAt(0), node.expression); - case 244 /* WhileStatement */: + case 246 /* WhileStatement */: return textSpanEndingAtNextToken(node, node.expression); - case 243 /* DoStatement */: + case 245 /* DoStatement */: return spanInNode(node.statement); - case 256 /* DebuggerStatement */: + case 258 /* DebuggerStatement */: return textSpan(node.getChildAt(0)); - case 242 /* IfStatement */: + case 244 /* IfStatement */: return textSpanEndingAtNextToken(node, node.expression); - case 253 /* LabeledStatement */: + case 255 /* LabeledStatement */: return spanInNode(node.statement); - case 249 /* BreakStatement */: - case 248 /* ContinueStatement */: + case 251 /* BreakStatement */: + case 250 /* ContinueStatement */: return textSpan(node.getChildAt(0), node.label); - case 245 /* ForStatement */: + case 247 /* ForStatement */: return spanInForStatement(node); - case 246 /* ForInStatement */: + case 248 /* ForInStatement */: return textSpanEndingAtNextToken(node, node.expression); - case 247 /* ForOfStatement */: + case 249 /* ForOfStatement */: return spanInInitializerOfForLike(node); - case 252 /* SwitchStatement */: + case 254 /* SwitchStatement */: return textSpanEndingAtNextToken(node, node.expression); - case 292 /* CaseClause */: - case 293 /* DefaultClause */: + case 295 /* CaseClause */: + case 296 /* DefaultClause */: return spanInNode(node.statements[0]); - case 255 /* TryStatement */: + case 257 /* TryStatement */: return spanInBlock(node.tryBlock); - case 254 /* ThrowStatement */: + case 256 /* ThrowStatement */: return textSpan(node, node.expression); - case 274 /* ExportAssignment */: + case 276 /* ExportAssignment */: return textSpan(node, node.expression); - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: return textSpan(node, node.moduleReference); - case 269 /* ImportDeclaration */: + case 271 /* ImportDeclaration */: return textSpan(node, node.moduleSpecifier); - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: return textSpan(node, node.moduleSpecifier); - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: if (getModuleInstanceState(node) !== 1 /* Instantiated */) { return void 0; } - case 260 /* ClassDeclaration */: - case 263 /* EnumDeclaration */: - case 302 /* EnumMember */: - case 205 /* BindingElement */: + case 262 /* ClassDeclaration */: + case 265 /* EnumDeclaration */: + case 305 /* EnumMember */: + case 207 /* BindingElement */: return textSpan(node); - case 251 /* WithStatement */: + case 253 /* WithStatement */: return spanInNode(node.statement); - case 167 /* Decorator */: + case 169 /* Decorator */: return spanInNodeArray(parent2.modifiers, node, isDecorator); - case 203 /* ObjectBindingPattern */: - case 204 /* ArrayBindingPattern */: + case 205 /* ObjectBindingPattern */: + case 206 /* ArrayBindingPattern */: return spanInBindingPattern(node); - case 261 /* InterfaceDeclaration */: - case 262 /* TypeAliasDeclaration */: + case 263 /* InterfaceDeclaration */: + case 264 /* TypeAliasDeclaration */: return void 0; - case 26 /* SemicolonToken */: + case 27 /* SemicolonToken */: case 1 /* EndOfFileToken */: return spanInNodeIfStartsOnSameLine(findPrecedingToken(node.pos, sourceFile)); - case 27 /* CommaToken */: + case 28 /* CommaToken */: return spanInPreviousNode(node); - case 18 /* OpenBraceToken */: + case 19 /* OpenBraceToken */: return spanInOpenBraceToken(node); - case 19 /* CloseBraceToken */: + case 20 /* CloseBraceToken */: return spanInCloseBraceToken(node); - case 23 /* CloseBracketToken */: + case 24 /* CloseBracketToken */: return spanInCloseBracketToken(node); - case 20 /* OpenParenToken */: + case 21 /* OpenParenToken */: return spanInOpenParenToken(node); - case 21 /* CloseParenToken */: + case 22 /* CloseParenToken */: return spanInCloseParenToken(node); - case 58 /* ColonToken */: + case 59 /* ColonToken */: return spanInColonToken(node); - case 31 /* GreaterThanToken */: - case 29 /* LessThanToken */: + case 32 /* GreaterThanToken */: + case 30 /* LessThanToken */: return spanInGreaterThanOrLessThanToken(node); - case 115 /* WhileKeyword */: + case 117 /* WhileKeyword */: return spanInWhileKeyword(node); - case 91 /* ElseKeyword */: - case 83 /* CatchKeyword */: - case 96 /* FinallyKeyword */: + case 93 /* ElseKeyword */: + case 85 /* CatchKeyword */: + case 98 /* FinallyKeyword */: return spanInNextNode(node); - case 162 /* OfKeyword */: + case 164 /* OfKeyword */: return spanInOfKeyword(node); default: if (isArrayLiteralOrObjectLiteralDestructuringPattern(node)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern(node); } - if ((node.kind === 79 /* Identifier */ || node.kind === 227 /* SpreadElement */ || node.kind === 299 /* PropertyAssignment */ || node.kind === 300 /* ShorthandPropertyAssignment */) && isArrayLiteralOrObjectLiteralDestructuringPattern(parent2)) { + if ((node.kind === 80 /* Identifier */ || node.kind === 229 /* SpreadElement */ || node.kind === 302 /* PropertyAssignment */ || node.kind === 303 /* ShorthandPropertyAssignment */) && isArrayLiteralOrObjectLiteralDestructuringPattern(parent2)) { return textSpan(node); } - if (node.kind === 223 /* BinaryExpression */) { + if (node.kind === 225 /* BinaryExpression */) { const { left, operatorToken } = node; if (isArrayLiteralOrObjectLiteralDestructuringPattern(left)) { return spanInArrayLiteralOrObjectLiteralDestructuringPattern( left ); } - if (operatorToken.kind === 63 /* EqualsToken */ && isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { + if (operatorToken.kind === 64 /* EqualsToken */ && isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) { return textSpan(node); } - if (operatorToken.kind === 27 /* CommaToken */) { + if (operatorToken.kind === 28 /* CommaToken */) { return spanInNode(left); } } if (isExpressionNode(node)) { switch (parent2.kind) { - case 243 /* DoStatement */: + case 245 /* DoStatement */: return spanInPreviousNode(node); - case 167 /* Decorator */: + case 169 /* Decorator */: return spanInNode(node.parent); - case 245 /* ForStatement */: - case 247 /* ForOfStatement */: + case 247 /* ForStatement */: + case 249 /* ForOfStatement */: return textSpan(node); - case 223 /* BinaryExpression */: - if (node.parent.operatorToken.kind === 27 /* CommaToken */) { + case 225 /* BinaryExpression */: + if (node.parent.operatorToken.kind === 28 /* CommaToken */) { return textSpan(node); } break; - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: if (node.parent.body === node) { return textSpan(node); } @@ -136406,25 +143070,25 @@ ${lanes.join("\n")} } } switch (node.parent.kind) { - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: if (node.parent.name === node && !isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } break; - case 213 /* TypeAssertionExpression */: + case 215 /* TypeAssertionExpression */: if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 257 /* VariableDeclaration */: - case 166 /* Parameter */: { + case 259 /* VariableDeclaration */: + case 168 /* Parameter */: { const { initializer, type } = node.parent; if (initializer === node || type === node || isAssignmentOperator(node.kind)) { return spanInPreviousNode(node); } break; } - case 223 /* BinaryExpression */: { + case 225 /* BinaryExpression */: { const { left } = node.parent; if (isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { return spanInPreviousNode(node); @@ -136447,14 +143111,14 @@ ${lanes.join("\n")} } } function spanInVariableDeclaration(variableDeclaration) { - if (variableDeclaration.parent.parent.kind === 246 /* ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 248 /* ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } const parent2 = variableDeclaration.parent; if (isBindingPattern(variableDeclaration.name)) { return spanInBindingPattern(variableDeclaration.name); } - if (hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer || hasSyntacticModifier(variableDeclaration, 1 /* Export */) || parent2.parent.kind === 247 /* ForOfStatement */) { + if (hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer || hasSyntacticModifier(variableDeclaration, 1 /* Export */) || parent2.parent.kind === 249 /* ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } if (isVariableDeclarationList(variableDeclaration.parent) && variableDeclaration.parent.declarations[0] !== variableDeclaration) { @@ -136481,7 +143145,7 @@ ${lanes.join("\n")} } } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { - return hasSyntacticModifier(functionDeclaration, 1 /* Export */) || functionDeclaration.parent.kind === 260 /* ClassDeclaration */ && functionDeclaration.kind !== 173 /* Constructor */; + return hasSyntacticModifier(functionDeclaration, 1 /* Export */) || functionDeclaration.parent.kind === 262 /* ClassDeclaration */ && functionDeclaration.kind !== 175 /* Constructor */; } function spanInFunctionDeclaration(functionDeclaration) { if (!functionDeclaration.body) { @@ -136501,22 +143165,22 @@ ${lanes.join("\n")} } function spanInBlock(block) { switch (block.parent.kind) { - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: if (getModuleInstanceState(block.parent) !== 1 /* Instantiated */) { return void 0; } - case 244 /* WhileStatement */: - case 242 /* IfStatement */: - case 246 /* ForInStatement */: + case 246 /* WhileStatement */: + case 244 /* IfStatement */: + case 248 /* ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); - case 245 /* ForStatement */: - case 247 /* ForOfStatement */: + case 247 /* ForStatement */: + case 249 /* ForOfStatement */: return spanInNodeIfStartsOnSameLine(findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 258 /* VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 260 /* VariableDeclarationList */) { const variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { return spanInNode(variableDeclarationList.declarations[0]); @@ -136539,64 +143203,64 @@ ${lanes.join("\n")} function spanInBindingPattern(bindingPattern) { const firstBindingElement = forEach( bindingPattern.elements, - (element) => element.kind !== 229 /* OmittedExpression */ ? element : void 0 + (element) => element.kind !== 231 /* OmittedExpression */ ? element : void 0 ); if (firstBindingElement) { return spanInNode(firstBindingElement); } - if (bindingPattern.parent.kind === 205 /* BindingElement */) { + if (bindingPattern.parent.kind === 207 /* BindingElement */) { return textSpan(bindingPattern.parent); } return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node2) { - Debug.assert(node2.kind !== 204 /* ArrayBindingPattern */ && node2.kind !== 203 /* ObjectBindingPattern */); - const elements = node2.kind === 206 /* ArrayLiteralExpression */ ? node2.elements : node2.properties; + Debug.assert(node2.kind !== 206 /* ArrayBindingPattern */ && node2.kind !== 205 /* ObjectBindingPattern */); + const elements = node2.kind === 208 /* ArrayLiteralExpression */ ? node2.elements : node2.properties; const firstBindingElement = forEach( elements, - (element) => element.kind !== 229 /* OmittedExpression */ ? element : void 0 + (element) => element.kind !== 231 /* OmittedExpression */ ? element : void 0 ); if (firstBindingElement) { return spanInNode(firstBindingElement); } - return textSpan(node2.parent.kind === 223 /* BinaryExpression */ ? node2.parent : node2); + return textSpan(node2.parent.kind === 225 /* BinaryExpression */ ? node2.parent : node2); } function spanInOpenBraceToken(node2) { switch (node2.parent.kind) { - case 263 /* EnumDeclaration */: + case 265 /* EnumDeclaration */: const enumDeclaration = node2.parent; return spanInNodeIfStartsOnSameLine(findPrecedingToken(node2.pos, sourceFile, node2.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 260 /* ClassDeclaration */: + case 262 /* ClassDeclaration */: const classDeclaration = node2.parent; return spanInNodeIfStartsOnSameLine(findPrecedingToken(node2.pos, sourceFile, node2.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 266 /* CaseBlock */: + case 268 /* CaseBlock */: return spanInNodeIfStartsOnSameLine(node2.parent.parent, node2.parent.clauses[0]); } return spanInNode(node2.parent); } function spanInCloseBraceToken(node2) { switch (node2.parent.kind) { - case 265 /* ModuleBlock */: + case 267 /* ModuleBlock */: if (getModuleInstanceState(node2.parent.parent) !== 1 /* Instantiated */) { return void 0; } - case 263 /* EnumDeclaration */: - case 260 /* ClassDeclaration */: + case 265 /* EnumDeclaration */: + case 262 /* ClassDeclaration */: return textSpan(node2); - case 238 /* Block */: + case 240 /* Block */: if (isFunctionBlock(node2.parent)) { return textSpan(node2); } - case 295 /* CatchClause */: + case 298 /* CatchClause */: return spanInNode(lastOrUndefined(node2.parent.statements)); - case 266 /* CaseBlock */: + case 268 /* CaseBlock */: const caseBlock = node2.parent; const lastClause = lastOrUndefined(caseBlock.clauses); if (lastClause) { return spanInNode(lastOrUndefined(lastClause.statements)); } return void 0; - case 203 /* ObjectBindingPattern */: + case 205 /* ObjectBindingPattern */: const bindingPattern = node2.parent; return spanInNode(lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -136609,7 +143273,7 @@ ${lanes.join("\n")} } function spanInCloseBracketToken(node2) { switch (node2.parent.kind) { - case 204 /* ArrayBindingPattern */: + case 206 /* ArrayBindingPattern */: const bindingPattern = node2.parent; return textSpan(lastOrUndefined(bindingPattern.elements) || bindingPattern); default: @@ -136621,57 +143285,57 @@ ${lanes.join("\n")} } } function spanInOpenParenToken(node2) { - if (node2.parent.kind === 243 /* DoStatement */ || // Go to while keyword and do action instead - node2.parent.kind === 210 /* CallExpression */ || node2.parent.kind === 211 /* NewExpression */) { + if (node2.parent.kind === 245 /* DoStatement */ || // Go to while keyword and do action instead + node2.parent.kind === 212 /* CallExpression */ || node2.parent.kind === 213 /* NewExpression */) { return spanInPreviousNode(node2); } - if (node2.parent.kind === 214 /* ParenthesizedExpression */) { + if (node2.parent.kind === 216 /* ParenthesizedExpression */) { return spanInNextNode(node2); } return spanInNode(node2.parent); } function spanInCloseParenToken(node2) { switch (node2.parent.kind) { - case 215 /* FunctionExpression */: - case 259 /* FunctionDeclaration */: - case 216 /* ArrowFunction */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 173 /* Constructor */: - case 244 /* WhileStatement */: - case 243 /* DoStatement */: - case 245 /* ForStatement */: - case 247 /* ForOfStatement */: - case 210 /* CallExpression */: - case 211 /* NewExpression */: - case 214 /* ParenthesizedExpression */: + case 217 /* FunctionExpression */: + case 261 /* FunctionDeclaration */: + case 218 /* ArrowFunction */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 175 /* Constructor */: + case 246 /* WhileStatement */: + case 245 /* DoStatement */: + case 247 /* ForStatement */: + case 249 /* ForOfStatement */: + case 212 /* CallExpression */: + case 213 /* NewExpression */: + case 216 /* ParenthesizedExpression */: return spanInPreviousNode(node2); default: return spanInNode(node2.parent); } } function spanInColonToken(node2) { - if (isFunctionLike(node2.parent) || node2.parent.kind === 299 /* PropertyAssignment */ || node2.parent.kind === 166 /* Parameter */) { + if (isFunctionLike(node2.parent) || node2.parent.kind === 302 /* PropertyAssignment */ || node2.parent.kind === 168 /* Parameter */) { return spanInPreviousNode(node2); } return spanInNode(node2.parent); } function spanInGreaterThanOrLessThanToken(node2) { - if (node2.parent.kind === 213 /* TypeAssertionExpression */) { + if (node2.parent.kind === 215 /* TypeAssertionExpression */) { return spanInNextNode(node2); } return spanInNode(node2.parent); } function spanInWhileKeyword(node2) { - if (node2.parent.kind === 243 /* DoStatement */) { + if (node2.parent.kind === 245 /* DoStatement */) { return textSpanEndingAtNextToken(node2, node2.parent.expression); } return spanInNode(node2.parent); } function spanInOfKeyword(node2) { - if (node2.parent.kind === 247 /* ForOfStatement */) { + if (node2.parent.kind === 249 /* ForOfStatement */) { return spanInNextNode(node2); } return spanInNode(node2.parent); @@ -136720,7 +143384,7 @@ ${lanes.join("\n")} return Debug.checkDefined(node.modifiers && find(node.modifiers, isDefaultModifier3)); } function isDefaultModifier3(node) { - return node.kind === 88 /* DefaultKeyword */; + return node.kind === 90 /* DefaultKeyword */; } function getSymbolOfCallHierarchyDeclaration(typeChecker, node) { const location = getCallHierarchyDeclarationReferenceNode(node); @@ -136761,7 +143425,7 @@ ${lanes.join("\n")} return { text, pos: declName.getStart(), end: declName.getEnd() }; } function getCallHierarchItemContainerName(node) { - var _a2, _b; + var _a, _b; if (isConstNamedExpression(node)) { if (isModuleBlock(node.parent.parent.parent.parent) && isIdentifier(node.parent.parent.parent.parent.parent.name)) { return node.parent.parent.parent.parent.parent.name.getText(); @@ -136769,16 +143433,16 @@ ${lanes.join("\n")} return; } switch (node.kind) { - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 171 /* MethodDeclaration */: - if (node.parent.kind === 207 /* ObjectLiteralExpression */) { - return (_a2 = getAssignedName(node.parent)) == null ? void 0 : _a2.getText(); + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 173 /* MethodDeclaration */: + if (node.parent.kind === 209 /* ObjectLiteralExpression */) { + return (_a = getAssignedName(node.parent)) == null ? void 0 : _a.getText(); } return (_b = getNameOfDeclaration(node.parent)) == null ? void 0 : _b.getText(); - case 259 /* FunctionDeclaration */: - case 260 /* ClassDeclaration */: - case 264 /* ModuleDeclaration */: + case 261 /* FunctionDeclaration */: + case 262 /* ClassDeclaration */: + case 266 /* ModuleDeclaration */: if (isModuleBlock(node.parent) && isIdentifier(node.parent.parent.name)) { return node.parent.parent.name.getText(); } @@ -136821,14 +143485,13 @@ ${lanes.join("\n")} return declarations; } function findImplementationOrAllInitialDeclarations(typeChecker, node) { - var _a2, _b, _c; if (isClassStaticBlockDeclaration(node)) { return node; } if (isFunctionLikeDeclaration(node)) { - return (_b = (_a2 = findImplementation(typeChecker, node)) != null ? _a2 : findAllInitialDeclarations(typeChecker, node)) != null ? _b : node; + return findImplementation(typeChecker, node) ?? findAllInitialDeclarations(typeChecker, node) ?? node; } - return (_c = findAllInitialDeclarations(typeChecker, node)) != null ? _c : node; + return findAllInitialDeclarations(typeChecker, node) ?? node; } function resolveCallHierarchyDeclaration(program, location) { const typeChecker = program.getTypeChecker(); @@ -136860,7 +143523,7 @@ ${lanes.join("\n")} } return void 0; } - if (location.kind === 124 /* StaticKeyword */ && isClassStaticBlockDeclaration(location.parent)) { + if (location.kind === 126 /* StaticKeyword */ && isClassStaticBlockDeclaration(location.parent)) { location = location.parent; continue; } @@ -136995,56 +143658,56 @@ ${lanes.join("\n")} return; } switch (node.kind) { - case 79 /* Identifier */: - case 268 /* ImportEqualsDeclaration */: - case 269 /* ImportDeclaration */: - case 275 /* ExportDeclaration */: - case 261 /* InterfaceDeclaration */: - case 262 /* TypeAliasDeclaration */: + case 80 /* Identifier */: + case 270 /* ImportEqualsDeclaration */: + case 271 /* ImportDeclaration */: + case 277 /* ExportDeclaration */: + case 263 /* InterfaceDeclaration */: + case 264 /* TypeAliasDeclaration */: return; - case 172 /* ClassStaticBlockDeclaration */: + case 174 /* ClassStaticBlockDeclaration */: recordCallSite(node); return; - case 213 /* TypeAssertionExpression */: - case 231 /* AsExpression */: + case 215 /* TypeAssertionExpression */: + case 233 /* AsExpression */: collect(node.expression); return; - case 257 /* VariableDeclaration */: - case 166 /* Parameter */: + case 259 /* VariableDeclaration */: + case 168 /* Parameter */: collect(node.name); collect(node.initializer); return; - case 210 /* CallExpression */: + case 212 /* CallExpression */: recordCallSite(node); collect(node.expression); forEach(node.arguments, collect); return; - case 211 /* NewExpression */: + case 213 /* NewExpression */: recordCallSite(node); collect(node.expression); forEach(node.arguments, collect); return; - case 212 /* TaggedTemplateExpression */: + case 214 /* TaggedTemplateExpression */: recordCallSite(node); collect(node.tag); collect(node.template); return; - case 283 /* JsxOpeningElement */: - case 282 /* JsxSelfClosingElement */: + case 285 /* JsxOpeningElement */: + case 284 /* JsxSelfClosingElement */: recordCallSite(node); collect(node.tagName); collect(node.attributes); return; - case 167 /* Decorator */: + case 169 /* Decorator */: recordCallSite(node); collect(node.expression); return; - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: + case 210 /* PropertyAccessExpression */: + case 211 /* ElementAccessExpression */: recordCallSite(node); forEachChild(node, collect); break; - case 235 /* SatisfiesExpression */: + case 237 /* SatisfiesExpression */: collect(node.expression); return; } @@ -137097,25 +143760,25 @@ ${lanes.join("\n")} const callSites = []; const collect = createCallSiteCollector(program, callSites); switch (node.kind) { - case 308 /* SourceFile */: + case 311 /* SourceFile */: collectCallSitesOfSourceFile(node, collect); break; - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: collectCallSitesOfModuleDeclaration(node, collect); break; - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: collectCallSitesOfFunctionLikeDeclaration(program.getTypeChecker(), node, collect); break; - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: collectCallSitesOfClassLikeDeclaration(node, collect); break; - case 172 /* ClassStaticBlockDeclaration */: + case 174 /* ClassStaticBlockDeclaration */: collectCallSitesOfClassStaticBlockDeclaration(node, collect); break; default: @@ -137157,241 +143820,6 @@ ${lanes.join("\n")} } }); - // src/services/classifier2020.ts - function getSemanticClassifications2(program, cancellationToken, sourceFile, span) { - const classifications = getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span); - Debug.assert(classifications.spans.length % 3 === 0); - const dense = classifications.spans; - const result = []; - for (let i = 0; i < dense.length; i += 3) { - result.push({ - textSpan: createTextSpan(dense[i], dense[i + 1]), - classificationType: dense[i + 2] - }); - } - return result; - } - function getEncodedSemanticClassifications2(program, cancellationToken, sourceFile, span) { - return { - spans: getSemanticTokens(program, sourceFile, span, cancellationToken), - endOfLineState: 0 /* None */ - }; - } - function getSemanticTokens(program, sourceFile, span, cancellationToken) { - const resultTokens = []; - const collector = (node, typeIdx, modifierSet) => { - resultTokens.push(node.getStart(sourceFile), node.getWidth(sourceFile), (typeIdx + 1 << 8 /* typeOffset */) + modifierSet); - }; - if (program && sourceFile) { - collectTokens(program, sourceFile, span, collector, cancellationToken); - } - return resultTokens; - } - function collectTokens(program, sourceFile, span, collector, cancellationToken) { - const typeChecker = program.getTypeChecker(); - let inJSXElement = false; - function visit(node) { - switch (node.kind) { - case 264 /* ModuleDeclaration */: - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: - case 259 /* FunctionDeclaration */: - case 228 /* ClassExpression */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - cancellationToken.throwIfCancellationRequested(); - } - if (!node || !textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) { - return; - } - const prevInJSXElement = inJSXElement; - if (isJsxElement(node) || isJsxSelfClosingElement(node)) { - inJSXElement = true; - } - if (isJsxExpression(node)) { - inJSXElement = false; - } - if (isIdentifier(node) && !inJSXElement && !inImportClause(node) && !isInfinityOrNaNString(node.escapedText)) { - let symbol = typeChecker.getSymbolAtLocation(node); - if (symbol) { - if (symbol.flags & 2097152 /* Alias */) { - symbol = typeChecker.getAliasedSymbol(symbol); - } - let typeIdx = classifySymbol2(symbol, getMeaningFromLocation(node)); - if (typeIdx !== void 0) { - let modifierSet = 0; - if (node.parent) { - const parentIsDeclaration = isBindingElement(node.parent) || tokenFromDeclarationMapping.get(node.parent.kind) === typeIdx; - if (parentIsDeclaration && node.parent.name === node) { - modifierSet = 1 << 0 /* declaration */; - } - } - if (typeIdx === 6 /* parameter */ && isRightSideOfQualifiedNameOrPropertyAccess2(node)) { - typeIdx = 9 /* property */; - } - typeIdx = reclassifyByType(typeChecker, node, typeIdx); - const decl = symbol.valueDeclaration; - if (decl) { - const modifiers = getCombinedModifierFlags(decl); - const nodeFlags = getCombinedNodeFlags(decl); - if (modifiers & 32 /* Static */) { - modifierSet |= 1 << 1 /* static */; - } - if (modifiers & 512 /* Async */) { - modifierSet |= 1 << 2 /* async */; - } - if (typeIdx !== 0 /* class */ && typeIdx !== 2 /* interface */) { - if (modifiers & 64 /* Readonly */ || nodeFlags & 2 /* Const */ || symbol.getFlags() & 8 /* EnumMember */) { - modifierSet |= 1 << 3 /* readonly */; - } - } - if ((typeIdx === 7 /* variable */ || typeIdx === 10 /* function */) && isLocalDeclaration(decl, sourceFile)) { - modifierSet |= 1 << 5 /* local */; - } - if (program.isSourceFileDefaultLibrary(decl.getSourceFile())) { - modifierSet |= 1 << 4 /* defaultLibrary */; - } - } else if (symbol.declarations && symbol.declarations.some((d) => program.isSourceFileDefaultLibrary(d.getSourceFile()))) { - modifierSet |= 1 << 4 /* defaultLibrary */; - } - collector(node, typeIdx, modifierSet); - } - } - } - forEachChild(node, visit); - inJSXElement = prevInJSXElement; - } - visit(sourceFile); - } - function classifySymbol2(symbol, meaning) { - const flags = symbol.getFlags(); - if (flags & 32 /* Class */) { - return 0 /* class */; - } else if (flags & 384 /* Enum */) { - return 1 /* enum */; - } else if (flags & 524288 /* TypeAlias */) { - return 5 /* type */; - } else if (flags & 64 /* Interface */) { - if (meaning & 2 /* Type */) { - return 2 /* interface */; - } - } else if (flags & 262144 /* TypeParameter */) { - return 4 /* typeParameter */; - } - let decl = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0]; - if (decl && isBindingElement(decl)) { - decl = getDeclarationForBindingElement(decl); - } - return decl && tokenFromDeclarationMapping.get(decl.kind); - } - function reclassifyByType(typeChecker, node, typeIdx) { - if (typeIdx === 7 /* variable */ || typeIdx === 9 /* property */ || typeIdx === 6 /* parameter */) { - const type = typeChecker.getTypeAtLocation(node); - if (type) { - const test = (condition) => { - return condition(type) || type.isUnion() && type.types.some(condition); - }; - if (typeIdx !== 6 /* parameter */ && test((t) => t.getConstructSignatures().length > 0)) { - return 0 /* class */; - } - if (test((t) => t.getCallSignatures().length > 0) && !test((t) => t.getProperties().length > 0) || isExpressionInCallExpression(node)) { - return typeIdx === 9 /* property */ ? 11 /* member */ : 10 /* function */; - } - } - } - return typeIdx; - } - function isLocalDeclaration(decl, sourceFile) { - if (isBindingElement(decl)) { - decl = getDeclarationForBindingElement(decl); - } - if (isVariableDeclaration(decl)) { - return (!isSourceFile(decl.parent.parent.parent) || isCatchClause(decl.parent)) && decl.getSourceFile() === sourceFile; - } else if (isFunctionDeclaration(decl)) { - return !isSourceFile(decl.parent) && decl.getSourceFile() === sourceFile; - } - return false; - } - function getDeclarationForBindingElement(element) { - while (true) { - if (isBindingElement(element.parent.parent)) { - element = element.parent.parent; - } else { - return element.parent.parent; - } - } - } - function inImportClause(node) { - const parent2 = node.parent; - return parent2 && (isImportClause(parent2) || isImportSpecifier(parent2) || isNamespaceImport(parent2)); - } - function isExpressionInCallExpression(node) { - while (isRightSideOfQualifiedNameOrPropertyAccess2(node)) { - node = node.parent; - } - return isCallExpression(node.parent) && node.parent.expression === node; - } - function isRightSideOfQualifiedNameOrPropertyAccess2(node) { - return isQualifiedName(node.parent) && node.parent.right === node || isPropertyAccessExpression(node.parent) && node.parent.name === node; - } - var TokenEncodingConsts, TokenType, TokenModifier, tokenFromDeclarationMapping; - var init_classifier2020 = __esm({ - "src/services/classifier2020.ts"() { - "use strict"; - init_ts4(); - TokenEncodingConsts = /* @__PURE__ */ ((TokenEncodingConsts2) => { - TokenEncodingConsts2[TokenEncodingConsts2["typeOffset"] = 8] = "typeOffset"; - TokenEncodingConsts2[TokenEncodingConsts2["modifierMask"] = 255] = "modifierMask"; - return TokenEncodingConsts2; - })(TokenEncodingConsts || {}); - TokenType = /* @__PURE__ */ ((TokenType2) => { - TokenType2[TokenType2["class"] = 0] = "class"; - TokenType2[TokenType2["enum"] = 1] = "enum"; - TokenType2[TokenType2["interface"] = 2] = "interface"; - TokenType2[TokenType2["namespace"] = 3] = "namespace"; - TokenType2[TokenType2["typeParameter"] = 4] = "typeParameter"; - TokenType2[TokenType2["type"] = 5] = "type"; - TokenType2[TokenType2["parameter"] = 6] = "parameter"; - TokenType2[TokenType2["variable"] = 7] = "variable"; - TokenType2[TokenType2["enumMember"] = 8] = "enumMember"; - TokenType2[TokenType2["property"] = 9] = "property"; - TokenType2[TokenType2["function"] = 10] = "function"; - TokenType2[TokenType2["member"] = 11] = "member"; - return TokenType2; - })(TokenType || {}); - TokenModifier = /* @__PURE__ */ ((TokenModifier2) => { - TokenModifier2[TokenModifier2["declaration"] = 0] = "declaration"; - TokenModifier2[TokenModifier2["static"] = 1] = "static"; - TokenModifier2[TokenModifier2["async"] = 2] = "async"; - TokenModifier2[TokenModifier2["readonly"] = 3] = "readonly"; - TokenModifier2[TokenModifier2["defaultLibrary"] = 4] = "defaultLibrary"; - TokenModifier2[TokenModifier2["local"] = 5] = "local"; - return TokenModifier2; - })(TokenModifier || {}); - tokenFromDeclarationMapping = /* @__PURE__ */ new Map([ - [257 /* VariableDeclaration */, 7 /* variable */], - [166 /* Parameter */, 6 /* parameter */], - [169 /* PropertyDeclaration */, 9 /* property */], - [264 /* ModuleDeclaration */, 3 /* namespace */], - [263 /* EnumDeclaration */, 1 /* enum */], - [302 /* EnumMember */, 8 /* enumMember */], - [260 /* ClassDeclaration */, 0 /* class */], - [171 /* MethodDeclaration */, 11 /* member */], - [259 /* FunctionDeclaration */, 10 /* function */], - [215 /* FunctionExpression */, 10 /* function */], - [170 /* MethodSignature */, 11 /* member */], - [174 /* GetAccessor */, 9 /* property */], - [175 /* SetAccessor */, 9 /* property */], - [168 /* PropertySignature */, 9 /* property */], - [261 /* InterfaceDeclaration */, 2 /* interface */], - [262 /* TypeAliasDeclaration */, 5 /* type */], - [165 /* TypeParameter */, 4 /* typeParameter */], - [299 /* PropertyAssignment */, 9 /* property */], - [300 /* ShorthandPropertyAssignment */, 9 /* property */] - ]); - } - }); - // src/services/_namespaces/ts.classifier.v2020.ts var ts_classifier_v2020_exports = {}; __export(ts_classifier_v2020_exports, { @@ -137421,10 +143849,10 @@ ${lanes.join("\n")} }); // src/services/codeFixProvider.ts - function createCodeFixActionWithoutFixAll(fixName8, changes, description2) { + function createCodeFixActionWithoutFixAll(fixName8, changes, description3) { return createCodeFixActionWorker( fixName8, - diagnosticToString(description2), + diagnosticToString(description3), changes, /*fixId*/ void 0, @@ -137432,41 +143860,42 @@ ${lanes.join("\n")} void 0 ); } - function createCodeFixAction(fixName8, changes, description2, fixId51, fixAllDescription, command) { - return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes, fixId51, diagnosticToString(fixAllDescription), command); + function createCodeFixAction(fixName8, changes, description3, fixId52, fixAllDescription, command) { + return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId52, diagnosticToString(fixAllDescription), command); } - function createCodeFixActionMaybeFixAll(fixName8, changes, description2, fixId51, fixAllDescription, command) { - return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes, fixId51, fixAllDescription && diagnosticToString(fixAllDescription), command); + function createCodeFixActionMaybeFixAll(fixName8, changes, description3, fixId52, fixAllDescription, command) { + return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId52, fixAllDescription && diagnosticToString(fixAllDescription), command); } - function createCodeFixActionWorker(fixName8, description2, changes, fixId51, fixAllDescription, command) { - return { fixName: fixName8, description: description2, changes, fixId: fixId51, fixAllDescription, commands: command ? [command] : void 0 }; + function createCodeFixActionWorker(fixName8, description3, changes, fixId52, fixAllDescription, command) { + return { fixName: fixName8, description: description3, changes, fixId: fixId52, fixAllDescription, commands: command ? [command] : void 0 }; } function registerCodeFix(reg) { for (const error of reg.errorCodes) { + errorCodeToFixesArray = void 0; errorCodeToFixes.add(String(error), reg); } if (reg.fixIds) { - for (const fixId51 of reg.fixIds) { - Debug.assert(!fixIdToRegistration.has(fixId51)); - fixIdToRegistration.set(fixId51, reg); + for (const fixId52 of reg.fixIds) { + Debug.assert(!fixIdToRegistration.has(fixId52)); + fixIdToRegistration.set(fixId52, reg); } } } function getSupportedErrorCodes() { - return arrayFrom(errorCodeToFixes.keys()); + return errorCodeToFixesArray ?? (errorCodeToFixesArray = arrayFrom(errorCodeToFixes.keys())); } function removeFixIdIfFixAllUnavailable(registration, diagnostics) { - const { errorCodes: errorCodes63 } = registration; + const { errorCodes: errorCodes64 } = registration; let maybeFixableDiagnostics = 0; for (const diag2 of diagnostics) { - if (contains(errorCodes63, diag2.code)) + if (contains(errorCodes64, diag2.code)) maybeFixableDiagnostics++; if (maybeFixableDiagnostics > 1) break; } const fixAllUnavailable = maybeFixableDiagnostics < 2; - return ({ fixId: fixId51, fixAllDescription, ...action }) => { - return fixAllUnavailable ? action : { ...action, fixId: fixId51, fixAllDescription }; + return ({ fixId: fixId52, fixAllDescription, ...action }) => { + return fixAllUnavailable ? action : { ...action, fixId: fixId52, fixAllDescription }; }; } function getFixes(context) { @@ -137483,14 +143912,14 @@ ${lanes.join("\n")} function createFileTextChanges(fileName, textChanges2) { return { fileName, textChanges: textChanges2 }; } - function codeFixAll(context, errorCodes63, use) { + function codeFixAll(context, errorCodes64, use) { const commands = []; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context, errorCodes63, (diag2) => use(t, diag2, commands))); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context, errorCodes64, (diag2) => use(t, diag2, commands))); return createCombinedCodeActions(changes, commands.length === 0 ? void 0 : commands); } - function eachDiagnostic(context, errorCodes63, cb) { + function eachDiagnostic(context, errorCodes64, cb) { for (const diag2 of getDiagnostics(context)) { - if (contains(errorCodes63, diag2.code)) { + if (contains(errorCodes64, diag2.code)) { cb(diag2); } } @@ -137502,7 +143931,7 @@ ${lanes.join("\n")} ...computeSuggestionDiagnostics(sourceFile, program, cancellationToken) ]; } - var errorCodeToFixes, fixIdToRegistration; + var errorCodeToFixes, fixIdToRegistration, errorCodeToFixesArray; var init_codeFixProvider = __esm({ "src/services/codeFixProvider.ts"() { "use strict"; @@ -137514,7 +143943,7 @@ ${lanes.join("\n")} // src/services/codefixes/addConvertToUnknownForNonOverlappingTypes.ts function makeChange(changeTracker, sourceFile, assertion) { - const replacement = isAsExpression(assertion) ? factory.createAsExpression(assertion.expression, factory.createKeywordTypeNode(157 /* UnknownKeyword */)) : factory.createTypeAssertion(factory.createKeywordTypeNode(157 /* UnknownKeyword */), assertion.expression); + const replacement = isAsExpression(assertion) ? factory.createAsExpression(assertion.expression, factory.createKeywordTypeNode(159 /* UnknownKeyword */)) : factory.createTypeAssertion(factory.createKeywordTypeNode(159 /* UnknownKeyword */), assertion.expression); changeTracker.replaceNode(sourceFile, assertion.expression, replacement); } function getAssertion(sourceFile, pos) { @@ -137710,7 +144139,7 @@ ${lanes.join("\n")} } const declaration = tryCast(symbol.valueDeclaration, isVariableDeclaration); const variableName = declaration && tryCast(declaration.name, isIdentifier); - const variableStatement = getAncestor(declaration, 240 /* VariableStatement */); + const variableStatement = getAncestor(declaration, 242 /* VariableStatement */); if (!declaration || !variableStatement || declaration.type || !declaration.initializer || variableStatement.getSourceFile() !== sourceFile || hasSyntacticModifier(variableStatement, 1 /* Export */) || !variableName || !isInsideAwaitableBody(declaration.initializer)) { isCompleteFix = false; continue; @@ -137769,7 +144198,7 @@ ${lanes.join("\n")} checker.getTypeAtLocation(errorNode).flags & 1 /* Any */; } function isInsideAwaitableBody(node) { - return node.kind & 32768 /* AwaitContext */ || !!findAncestor(node, (ancestor) => ancestor.parent && isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || isBlock(ancestor) && (ancestor.parent.kind === 259 /* FunctionDeclaration */ || ancestor.parent.kind === 215 /* FunctionExpression */ || ancestor.parent.kind === 216 /* ArrowFunction */ || ancestor.parent.kind === 171 /* MethodDeclaration */)); + return node.kind & 32768 /* AwaitContext */ || !!findAncestor(node, (ancestor) => ancestor.parent && isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || isBlock(ancestor) && (ancestor.parent.kind === 261 /* FunctionDeclaration */ || ancestor.parent.kind === 217 /* FunctionExpression */ || ancestor.parent.kind === 218 /* ArrowFunction */ || ancestor.parent.kind === 173 /* MethodDeclaration */)); } function makeChange3(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) { if (isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) { @@ -137777,7 +144206,7 @@ ${lanes.join("\n")} const asyncIter = checker.getAsyncIterableType(); if (asyncIter && checker.isTypeAssignableTo(exprType, asyncIter)) { const forOf = insertionSite.parent; - changeTracker.replaceNode(sourceFile, forOf, factory.updateForOfStatement(forOf, factory.createToken(133 /* AwaitKeyword */), forOf.initializer, forOf.expression, forOf.statement)); + changeTracker.replaceNode(sourceFile, forOf, factory.updateForOfStatement(forOf, factory.createToken(135 /* AwaitKeyword */), forOf.initializer, forOf.expression, forOf.statement)); return; } } @@ -137905,7 +144334,7 @@ ${lanes.join("\n")} if (forInitializer) return applyChange(changeTracker, forInitializer, sourceFile, fixedNodes); const parent2 = token.parent; - if (isBinaryExpression(parent2) && parent2.operatorToken.kind === 63 /* EqualsToken */ && isExpressionStatement(parent2.parent)) { + if (isBinaryExpression(parent2) && parent2.operatorToken.kind === 64 /* EqualsToken */ && isExpressionStatement(parent2.parent)) { return applyChange(changeTracker, token, sourceFile, fixedNodes); } if (isArrayLiteralExpression(parent2)) { @@ -137929,16 +144358,16 @@ ${lanes.join("\n")} } function applyChange(changeTracker, initializer, sourceFile, fixedNodes) { if (!fixedNodes || tryAddToSet(fixedNodes, initializer)) { - changeTracker.insertModifierBefore(sourceFile, 85 /* ConstKeyword */, initializer); + changeTracker.insertModifierBefore(sourceFile, 87 /* ConstKeyword */, initializer); } } function isPossiblyPartOfDestructuring(node) { switch (node.kind) { - case 79 /* Identifier */: - case 206 /* ArrayLiteralExpression */: - case 207 /* ObjectLiteralExpression */: - case 299 /* PropertyAssignment */: - case 300 /* ShorthandPropertyAssignment */: + case 80 /* Identifier */: + case 208 /* ArrayLiteralExpression */: + case 209 /* ObjectLiteralExpression */: + case 302 /* PropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: return true; default: return false; @@ -137954,9 +144383,9 @@ ${lanes.join("\n")} } function isPossiblyPartOfCommaSeperatedInitializer(node) { switch (node.kind) { - case 79 /* Identifier */: - case 223 /* BinaryExpression */: - case 27 /* CommaToken */: + case 80 /* Identifier */: + case 225 /* BinaryExpression */: + case 28 /* CommaToken */: return true; default: return false; @@ -137966,10 +144395,10 @@ ${lanes.join("\n")} if (!isBinaryExpression(expression)) { return false; } - if (expression.operatorToken.kind === 27 /* CommaToken */) { + if (expression.operatorToken.kind === 28 /* CommaToken */) { return every([expression.left, expression.right], (expression2) => expressionCouldBeVariableDeclaration(expression2, checker)); } - return expression.operatorToken.kind === 63 /* EqualsToken */ && isIdentifier(expression.left) && !checker.getSymbolAtLocation(expression.left); + return expression.operatorToken.kind === 64 /* EqualsToken */ && isIdentifier(expression.left) && !checker.getSymbolAtLocation(expression.left); } var fixId4, errorCodes4; var init_addMissingConst = __esm({ @@ -138006,8 +144435,8 @@ ${lanes.join("\n")} return; } const declaration = token.parent; - if (declaration.kind === 169 /* PropertyDeclaration */ && (!fixedNodes || tryAddToSet(fixedNodes, declaration))) { - changeTracker.insertModifierBefore(sourceFile, 136 /* DeclareKeyword */, declaration); + if (declaration.kind === 171 /* PropertyDeclaration */ && (!fixedNodes || tryAddToSet(fixedNodes, declaration))) { + changeTracker.insertModifierBefore(sourceFile, 138 /* DeclareKeyword */, declaration); } } var fixId5, errorCodes5; @@ -138118,14 +144547,14 @@ ${lanes.join("\n")} // src/services/codefixes/addOptionalPropertyUndefined.ts function getPropertiesToAdd(file, span, checker) { - var _a2, _b; + var _a, _b; const sourceTarget = getSourceTarget(getFixableErrorSpanExpression(file, span), checker); if (!sourceTarget) { return emptyArray; } const { source: sourceNode, target: targetNode } = sourceTarget; const target = shouldUseParentTypeOfProperty(sourceNode, targetNode, checker) ? checker.getTypeAtLocation(targetNode.expression) : checker.getTypeAtLocation(targetNode); - if ((_b = (_a2 = target.symbol) == null ? void 0 : _a2.declarations) == null ? void 0 : _b.some((d) => getSourceFileOfNode(d).fileName.match(/\.d\.ts$/))) { + if ((_b = (_a = target.symbol) == null ? void 0 : _a.declarations) == null ? void 0 : _b.some((d) => getSourceFileOfNode(d).fileName.match(/\.d\.ts$/))) { return emptyArray; } return checker.getExactOptionalProperties(target); @@ -138134,10 +144563,10 @@ ${lanes.join("\n")} return isPropertyAccessExpression(targetNode) && !!checker.getExactOptionalProperties(checker.getTypeAtLocation(targetNode.expression)).length && checker.getTypeAtLocation(sourceNode) === checker.getUndefinedType(); } function getSourceTarget(errorNode, checker) { - var _a2; + var _a; if (!errorNode) { return void 0; - } else if (isBinaryExpression(errorNode.parent) && errorNode.parent.operatorToken.kind === 63 /* EqualsToken */) { + } else if (isBinaryExpression(errorNode.parent) && errorNode.parent.operatorToken.kind === 64 /* EqualsToken */) { return { source: errorNode.parent.right, target: errorNode.parent.left }; } else if (isVariableDeclaration(errorNode.parent) && errorNode.parent.initializer) { return { source: errorNode.parent.initializer, target: errorNode.parent.name }; @@ -138158,7 +144587,7 @@ ${lanes.join("\n")} if (!parentTarget) return void 0; const prop = checker.getPropertyOfType(checker.getTypeAtLocation(parentTarget.target), errorNode.parent.name.text); - const declaration = (_a2 = prop == null ? void 0 : prop.declarations) == null ? void 0 : _a2[0]; + const declaration = (_a = prop == null ? void 0 : prop.declarations) == null ? void 0 : _a[0]; if (!declaration) return void 0; return { @@ -138173,7 +144602,7 @@ ${lanes.join("\n")} const d = add.valueDeclaration; if (d && (isPropertySignature(d) || isPropertyDeclaration(d)) && d.type) { const t = factory.createUnionTypeNode([ - ...d.type.kind === 189 /* UnionType */ ? d.type.types : [d.type], + ...d.type.kind === 191 /* UnionType */ ? d.type.types : [d.type], factory.createTypeReferenceNode("undefined") ]); changes.replaceNode(d.getSourceFile(), d.type, t); @@ -138219,16 +144648,16 @@ ${lanes.join("\n")} function hasUsableJSDoc(decl) { return isFunctionLikeDeclaration(decl) ? decl.parameters.some(hasUsableJSDoc) || !decl.type && !!getJSDocReturnType(decl) : !decl.type && !!getJSDocType(decl); } - function doChange(changes, sourceFile, decl) { + function doChange8(changes, sourceFile, decl) { if (isFunctionLikeDeclaration(decl) && (getJSDocReturnType(decl) || decl.parameters.some((p) => !!getJSDocType(p)))) { if (!decl.typeParameters) { const typeParameters = getJSDocTypeParameterDeclarations(decl); if (typeParameters.length) changes.insertTypeParameters(sourceFile, decl, typeParameters); } - const needParens = isArrowFunction(decl) && !findChildOfKind(decl, 20 /* OpenParenToken */, sourceFile); + const needParens = isArrowFunction(decl) && !findChildOfKind(decl, 21 /* OpenParenToken */, sourceFile); if (needParens) - changes.insertNodeBefore(sourceFile, first(decl.parameters), factory.createToken(20 /* OpenParenToken */)); + changes.insertNodeBefore(sourceFile, first(decl.parameters), factory.createToken(21 /* OpenParenToken */)); for (const param of decl.parameters) { if (!param.type) { const paramType = getJSDocType(param); @@ -138237,7 +144666,7 @@ ${lanes.join("\n")} } } if (needParens) - changes.insertNodeAfter(sourceFile, last(decl.parameters), factory.createToken(21 /* CloseParenToken */)); + changes.insertNodeAfter(sourceFile, last(decl.parameters), factory.createToken(22 /* CloseParenToken */)); if (!decl.type) { const returnType = getJSDocReturnType(decl); if (returnType) @@ -138250,26 +144679,26 @@ ${lanes.join("\n")} } } function isDeclarationWithType(node) { - return isFunctionLikeDeclaration(node) || node.kind === 257 /* VariableDeclaration */ || node.kind === 168 /* PropertySignature */ || node.kind === 169 /* PropertyDeclaration */; + return isFunctionLikeDeclaration(node) || node.kind === 259 /* VariableDeclaration */ || node.kind === 170 /* PropertySignature */ || node.kind === 171 /* PropertyDeclaration */; } function transformJSDocType(node) { switch (node.kind) { - case 315 /* JSDocAllType */: - case 316 /* JSDocUnknownType */: + case 318 /* JSDocAllType */: + case 319 /* JSDocUnknownType */: return factory.createTypeReferenceNode("any", emptyArray); - case 319 /* JSDocOptionalType */: + case 322 /* JSDocOptionalType */: return transformJSDocOptionalType(node); - case 318 /* JSDocNonNullableType */: + case 321 /* JSDocNonNullableType */: return transformJSDocType(node.type); - case 317 /* JSDocNullableType */: + case 320 /* JSDocNullableType */: return transformJSDocNullableType(node); - case 321 /* JSDocVariadicType */: + case 324 /* JSDocVariadicType */: return transformJSDocVariadicType(node); - case 320 /* JSDocFunctionType */: + case 323 /* JSDocFunctionType */: return transformJSDocFunctionType(node); - case 180 /* TypeReference */: + case 182 /* TypeReference */: return transformJSDocTypeReference(node); - case 325 /* JSDocTypeLiteral */: + case 328 /* JSDocTypeLiteral */: return transformJSDocTypeLiteral(node); default: const visited = visitEachChild(node, transformJSDocType, nullTransformationContext); @@ -138282,8 +144711,8 @@ ${lanes.join("\n")} /*modifiers*/ void 0, isIdentifier(tag.name) ? tag.name : tag.name.right, - isOptionalJSDocPropertyLikeTag(tag) ? factory.createToken(57 /* QuestionToken */) : void 0, - tag.typeExpression && visitNode(tag.typeExpression.type, transformJSDocType, isTypeNode) || factory.createKeywordTypeNode(131 /* AnyKeyword */) + isOptionalJSDocPropertyLikeTag(tag) ? factory.createToken(58 /* QuestionToken */) : void 0, + tag.typeExpression && visitNode(tag.typeExpression.type, transformJSDocType, isTypeNode) || factory.createKeywordTypeNode(133 /* AnyKeyword */) ))); setEmitFlags(typeNode, 1 /* SingleLine */); return typeNode; @@ -138298,14 +144727,13 @@ ${lanes.join("\n")} return factory.createArrayTypeNode(visitNode(node.type, transformJSDocType, isTypeNode)); } function transformJSDocFunctionType(node) { - var _a2; - return factory.createFunctionTypeNode(emptyArray, node.parameters.map(transformJSDocParameter), (_a2 = node.type) != null ? _a2 : factory.createKeywordTypeNode(131 /* AnyKeyword */)); + return factory.createFunctionTypeNode(emptyArray, node.parameters.map(transformJSDocParameter), node.type ?? factory.createKeywordTypeNode(133 /* AnyKeyword */)); } function transformJSDocParameter(node) { const index = node.parent.parameters.indexOf(node); - const isRest = node.type.kind === 321 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; + const isRest = node.type.kind === 324 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; const name = node.name || (isRest ? "rest" : "arg" + index); - const dotdotdot = isRest ? factory.createToken(25 /* DotDotDotToken */) : node.dotDotDotToken; + const dotdotdot = isRest ? factory.createToken(26 /* DotDotDotToken */) : node.dotDotDotToken; return factory.createParameterDeclaration(node.modifiers, dotdotdot, name, node.questionToken, visitNode(node.type, transformJSDocType, isTypeNode), node.initializer); } function transformJSDocTypeReference(node) { @@ -138344,10 +144772,10 @@ ${lanes.join("\n")} void 0, /*dotDotDotToken*/ void 0, - node.typeArguments[0].kind === 148 /* NumberKeyword */ ? "n" : "s", + node.typeArguments[0].kind === 150 /* NumberKeyword */ ? "n" : "s", /*questionToken*/ void 0, - factory.createTypeReferenceNode(node.typeArguments[0].kind === 148 /* NumberKeyword */ ? "number" : "string", []), + factory.createTypeReferenceNode(node.typeArguments[0].kind === 150 /* NumberKeyword */ ? "number" : "string", []), /*initializer*/ void 0 ); @@ -138374,21 +144802,21 @@ ${lanes.join("\n")} const decl = getDeclaration(context.sourceFile, context.span.start); if (!decl) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange(t, context.sourceFile, decl)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange8(t, context.sourceFile, decl)); return [createCodeFixAction(fixId8, changes, Diagnostics.Annotate_with_type_from_JSDoc, fixId8, Diagnostics.Annotate_everything_with_types_from_JSDoc)]; }, fixIds: [fixId8], getAllCodeActions: (context) => codeFixAll(context, errorCodes9, (changes, diag2) => { const decl = getDeclaration(diag2.file, diag2.start); if (decl) - doChange(changes, diag2.file, decl); + doChange8(changes, diag2.file, decl); }) }); } }); // src/services/codefixes/convertFunctionToEs6Class.ts - function doChange2(changes, sourceFile, position, checker, preferences, compilerOptions) { + function doChange9(changes, sourceFile, position, checker, preferences, compilerOptions) { const ctorSymbol = checker.getSymbolAtLocation(getTokenAtPosition(sourceFile, position)); if (!ctorSymbol || !ctorSymbol.valueDeclaration || !(ctorSymbol.flags & (16 /* Function */ | 3 /* Variable */))) { return void 0; @@ -138415,25 +144843,25 @@ ${lanes.join("\n")} symbol.exports.forEach((member) => { if (member.name === "prototype" && member.declarations) { const firstDeclaration = member.declarations[0]; - if (member.declarations.length === 1 && isPropertyAccessExpression(firstDeclaration) && isBinaryExpression(firstDeclaration.parent) && firstDeclaration.parent.operatorToken.kind === 63 /* EqualsToken */ && isObjectLiteralExpression(firstDeclaration.parent.right)) { + if (member.declarations.length === 1 && isPropertyAccessExpression(firstDeclaration) && isBinaryExpression(firstDeclaration.parent) && firstDeclaration.parent.operatorToken.kind === 64 /* EqualsToken */ && isObjectLiteralExpression(firstDeclaration.parent.right)) { const prototypes = firstDeclaration.parent.right; createClassElement( prototypes.symbol, - /** modifiers */ + /*modifiers*/ void 0, memberElements ); } } else { - createClassElement(member, [factory.createToken(124 /* StaticKeyword */)], memberElements); + createClassElement(member, [factory.createToken(126 /* StaticKeyword */)], memberElements); } }); } if (symbol.members) { symbol.members.forEach((member, key) => { - var _a2, _b, _c, _d; + var _a, _b, _c, _d; if (key === "constructor" && member.valueDeclaration) { - const prototypeAssignment = (_d = (_c = (_b = (_a2 = symbol.exports) == null ? void 0 : _a2.get("prototype")) == null ? void 0 : _b.declarations) == null ? void 0 : _c[0]) == null ? void 0 : _d.parent; + const prototypeAssignment = (_d = (_c = (_b = (_a = symbol.exports) == null ? void 0 : _a.get("prototype")) == null ? void 0 : _b.declarations) == null ? void 0 : _c[0]) == null ? void 0 : _d.parent; if (prototypeAssignment && isBinaryExpression(prototypeAssignment) && isObjectLiteralExpression(prototypeAssignment.right) && some(prototypeAssignment.right.properties, isConstructorAssignment)) { } else { changes.delete(sourceFile, member.valueDeclaration.parent); @@ -138485,13 +144913,13 @@ ${lanes.join("\n")} })) { return; } - const nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 241 /* ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; + const nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 243 /* ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; changes.delete(sourceFile, nodeToDelete); if (!assignmentExpr) { members.push(factory.createPropertyDeclaration( modifiers, symbol2.name, - /*questionToken*/ + /*questionOrExclamationToken*/ void 0, /*type*/ void 0, @@ -138531,7 +144959,7 @@ ${lanes.join("\n")} const prop = factory.createPropertyDeclaration( modifiers, memberDeclaration.name, - /*questionToken*/ + /*questionOrExclamationToken*/ void 0, /*type*/ void 0, @@ -138548,7 +144976,7 @@ ${lanes.join("\n")} return createArrowFunctionExpressionMember(members2, expression, name); } function createFunctionExpressionMember(members2, functionExpression, name) { - const fullModifiers = concatenate(modifiers, getModifierKindFromSource(functionExpression, 132 /* AsyncKeyword */)); + const fullModifiers = concatenate(modifiers, getModifierKindFromSource(functionExpression, 134 /* AsyncKeyword */)); const method = factory.createMethodDeclaration( fullModifiers, /*asteriskToken*/ @@ -138570,12 +144998,12 @@ ${lanes.join("\n")} function createArrowFunctionExpressionMember(members2, arrowFunction, name) { const arrowFunctionBody = arrowFunction.body; let bodyBlock; - if (arrowFunctionBody.kind === 238 /* Block */) { + if (arrowFunctionBody.kind === 240 /* Block */) { bodyBlock = arrowFunctionBody; } else { bodyBlock = factory.createBlock([factory.createReturnStatement(arrowFunctionBody)]); } - const fullModifiers = concatenate(modifiers, getModifierKindFromSource(arrowFunction, 132 /* AsyncKeyword */)); + const fullModifiers = concatenate(modifiers, getModifierKindFromSource(arrowFunction, 134 /* AsyncKeyword */)); const method = factory.createMethodDeclaration( fullModifiers, /*asteriskToken*/ @@ -138609,7 +145037,7 @@ ${lanes.join("\n")} initializer.body )); } - const modifiers = getModifierKindFromSource(node.parent.parent, 93 /* ExportKeyword */); + const modifiers = getModifierKindFromSource(node.parent.parent, 95 /* ExportKeyword */); const cls = factory.createClassDeclaration( modifiers, node.name, @@ -138631,7 +145059,7 @@ ${lanes.join("\n")} node.body )); } - const modifiers = getModifierKindFromSource(node, 93 /* ExportKeyword */); + const modifiers = getModifierKindFromSource(node, 95 /* ExportKeyword */); const cls = factory.createClassDeclaration( modifiers, node.name, @@ -138678,11 +145106,11 @@ ${lanes.join("\n")} registerCodeFix({ errorCodes: errorCodes10, getCodeActions(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange2(t, context.sourceFile, context.span.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions())); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, context.sourceFile, context.span.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions())); return [createCodeFixAction(fixId9, changes, Diagnostics.Convert_function_to_an_ES2015_class, fixId9, Diagnostics.Convert_all_constructor_functions_to_classes)]; }, fixIds: [fixId9], - getAllCodeActions: (context) => codeFixAll(context, errorCodes10, (changes, err) => doChange2(changes, err.file, err.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions())) + getAllCodeActions: (context) => codeFixAll(context, errorCodes10, (changes, err) => doChange9(changes, err.file, err.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions())) }); } }); @@ -138712,7 +145140,7 @@ ${lanes.join("\n")} return; } const pos = skipTrivia(sourceFile.text, moveRangePastModifiers(functionToConvert).pos); - changes.insertModifierAt(sourceFile, pos, 132 /* AsyncKeyword */, { suffix: " " }); + changes.insertModifierAt(sourceFile, pos, 134 /* AsyncKeyword */, { suffix: " " }); for (const returnStatement of returnStatements) { forEachChild(returnStatement, function visit(node) { if (isCallExpression(node)) { @@ -138893,7 +145321,7 @@ ${lanes.join("\n")} return silentFail(); } function isNullOrUndefined2({ checker }, node) { - if (node.kind === 104 /* NullKeyword */) + if (node.kind === 106 /* NullKeyword */) return true; if (isIdentifier(node) && !isGeneratedIdentifier(node) && idText(node) === "undefined") { const symbol = checker.getSymbolAtLocation(node); @@ -139000,7 +145428,7 @@ ${lanes.join("\n")} hasContinuation, /*continuationArgName*/ void 0, - /*argName*/ + /*inputArgName*/ void 0, node, transformer @@ -139129,12 +145557,12 @@ ${lanes.join("\n")} return [factory.createReturnStatement(expressionToReturn)]; } function transformCallbackArgument(func, hasContinuation, continuationArgName, inputArgName, parent2, transformer) { - var _a2; + var _a; switch (func.kind) { - case 104 /* NullKeyword */: + case 106 /* NullKeyword */: break; - case 208 /* PropertyAccessExpression */: - case 79 /* Identifier */: + case 210 /* PropertyAccessExpression */: + case 80 /* Identifier */: if (!inputArgName) { break; } @@ -139158,10 +145586,10 @@ ${lanes.join("\n")} continuationArgName.types.push(transformer.checker.getAwaitedType(returnType) || returnType); } return varDeclOrAssignment; - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: { + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: { const funcBody = func.body; - const returnType2 = (_a2 = getLastCallSignature(transformer.checker.getTypeAtLocation(func), transformer.checker)) == null ? void 0 : _a2.getReturnType(); + const returnType2 = (_a = getLastCallSignature(transformer.checker.getTypeAtLocation(func), transformer.checker)) == null ? void 0 : _a.getReturnType(); if (isBlock(funcBody)) { let refactoredStmts = []; let seenReturnStatement = false; @@ -139322,8 +145750,8 @@ ${lanes.join("\n")} return mapEntry || createSynthIdentifier(identifier, types); } function getSymbol2(node) { - var _a2, _b; - return (_b = (_a2 = tryCast(node, canHaveSymbol)) == null ? void 0 : _a2.symbol) != null ? _b : transformer.checker.getSymbolAtLocation(node); + var _a; + return ((_a = tryCast(node, canHaveSymbol)) == null ? void 0 : _a.symbol) ?? transformer.checker.getSymbolAtLocation(node); } function getOriginalNode2(node) { return node.original ? node.original : node; @@ -139401,7 +145829,7 @@ ${lanes.join("\n")} } const importNode = importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: changes.replaceNode(importingFile, importNode, makeImport( importNode.name, /*namedImports*/ @@ -139410,10 +145838,10 @@ ${lanes.join("\n")} quotePreference )); break; - case 210 /* CallExpression */: + case 212 /* CallExpression */: if (isRequireCall( importNode, - /*checkArgumentIsStringLiteralLike*/ + /*requireStringLiteralLikeArgument*/ false )) { changes.replaceNode(importingFile, importNode, factory.createPropertyAccessExpression(getSynthesizedDeepClone(importNode), "default")); @@ -139431,7 +145859,7 @@ ${lanes.join("\n")} for (const statement of filter(sourceFile.statements, isVariableStatement)) { const newUseSites = convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); if (newUseSites) { - copyEntries(newUseSites, useSitesToUnqualify != null ? useSitesToUnqualify : useSitesToUnqualify = /* @__PURE__ */ new Map()); + copyEntries(newUseSites, useSitesToUnqualify ?? (useSitesToUnqualify = /* @__PURE__ */ new Map())); } } for (const statement of filter(sourceFile.statements, (s) => !isVariableStatement(s))) { @@ -139472,27 +145900,27 @@ ${lanes.join("\n")} sourceFile.forEachChild(function recur(node) { if (isPropertyAccessExpression(node) && isExportsOrModuleExportsOrAlias(sourceFile, node.expression) && isIdentifier(node.name)) { const { parent: parent2 } = node; - cb(node, isBinaryExpression(parent2) && parent2.left === node && parent2.operatorToken.kind === 63 /* EqualsToken */); + cb(node, isBinaryExpression(parent2) && parent2.left === node && parent2.operatorToken.kind === 64 /* EqualsToken */); } node.forEachChild(recur); }); } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, useSitesToUnqualify, quotePreference) { switch (statement.kind) { - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); return false; - case 241 /* ExpressionStatement */: { + case 243 /* ExpressionStatement */: { const { expression } = statement; switch (expression.kind) { - case 210 /* CallExpression */: { + case 212 /* CallExpression */: { if (isRequireCall( expression, - /*checkArgumentIsStringLiteralLike*/ + /*requireStringLiteralLikeArgument*/ true )) { changes.replaceNode(sourceFile, statement, makeImport( - /*name*/ + /*defaultImport*/ void 0, /*namedImports*/ void 0, @@ -139502,9 +145930,9 @@ ${lanes.join("\n")} } return false; } - case 223 /* BinaryExpression */: { + case 225 /* BinaryExpression */: { const { operatorToken } = expression; - return operatorToken.kind === 63 /* EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports, useSitesToUnqualify); + return operatorToken.kind === 64 /* EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports, useSitesToUnqualify); } } } @@ -139523,14 +145951,14 @@ ${lanes.join("\n")} return convertedImports([]); } else if (isRequireCall( initializer, - /*checkArgumentIsStringLiteralLike*/ + /*requireStringLiteralLikeArgument*/ true )) { foundImport = true; return convertSingleImport(name, initializer.arguments[0], checker, identifiers, target, quotePreference); } else if (isPropertyAccessExpression(initializer) && isRequireCall( initializer.expression, - /*checkArgumentIsStringLiteralLike*/ + /*requireStringLiteralLikeArgument*/ true )) { foundImport = true; @@ -139548,7 +145976,7 @@ ${lanes.join("\n")} let combinedUseSites; forEach(converted, (c) => { if (c.useSitesToUnqualify) { - copyEntries(c.useSitesToUnqualify, combinedUseSites != null ? combinedUseSites : combinedUseSites = /* @__PURE__ */ new Map()); + copyEntries(c.useSitesToUnqualify, combinedUseSites ?? (combinedUseSites = /* @__PURE__ */ new Map())); } }); return combinedUseSites; @@ -139556,8 +145984,8 @@ ${lanes.join("\n")} } function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) { switch (name.kind) { - case 203 /* ObjectBindingPattern */: - case 204 /* ArrayBindingPattern */: { + case 205 /* ObjectBindingPattern */: + case 206 /* ArrayBindingPattern */: { const tmp = makeUniqueName(propertyName, identifiers); return convertedImports([ makeSingleImport(tmp, propertyName, moduleSpecifier, quotePreference), @@ -139569,7 +145997,7 @@ ${lanes.join("\n")} ) ]); } - case 79 /* Identifier */: + case 80 /* Identifier */: return convertedImports([makeSingleImport(name.text, propertyName, moduleSpecifier, quotePreference)]); default: return Debug.assertNever(name, `Convert to ES module got invalid syntax form ${name.kind}`); @@ -139586,7 +146014,7 @@ ${lanes.join("\n")} } else { const replacement = isObjectLiteralExpression(right) ? tryChangeModuleExportsObject(right, useSitesToUnqualify) : isRequireCall( right, - /*checkArgumentIsStringLiteralLike*/ + /*requireStringLiteralLikeArgument*/ true ) ? convertReExportAll(right.arguments[0], checker) : void 0; if (replacement) { @@ -139605,15 +146033,15 @@ ${lanes.join("\n")} function tryChangeModuleExportsObject(object, useSitesToUnqualify) { const statements = mapAllOrFail(object.properties, (prop) => { switch (prop.kind) { - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 300 /* ShorthandPropertyAssignment */: - case 301 /* SpreadAssignment */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 303 /* ShorthandPropertyAssignment */: + case 304 /* SpreadAssignment */: return void 0; - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: return !isIdentifier(prop.name) ? void 0 : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); - case 171 /* MethodDeclaration */: - return !isIdentifier(prop.name) ? void 0 : functionExpressionToDeclaration(prop.name.text, [factory.createToken(93 /* ExportKeyword */)], prop, useSitesToUnqualify); + case 173 /* MethodDeclaration */: + return !isIdentifier(prop.name) ? void 0 : functionExpressionToDeclaration(prop.name.text, [factory.createToken(95 /* ExportKeyword */)], prop, useSitesToUnqualify); default: Debug.assertNever(prop, `Convert to ES6 got invalid prop kind ${prop.kind}`); } @@ -139654,7 +146082,7 @@ ${lanes.join("\n")} } function reExportStar(moduleSpecifier) { return makeExportDeclaration( - /*exportClause*/ + /*exportSpecifiers*/ void 0, moduleSpecifier ); @@ -139671,34 +146099,34 @@ ${lanes.join("\n")} function convertExportsPropertyAssignment({ left, right, parent: parent2 }, sourceFile, changes) { const name = left.name.text; if ((isFunctionExpression(right) || isArrowFunction(right) || isClassExpression(right)) && (!right.name || right.name.text === name)) { - changes.replaceRange(sourceFile, { pos: left.getStart(sourceFile), end: right.getStart(sourceFile) }, factory.createToken(93 /* ExportKeyword */), { suffix: " " }); + changes.replaceRange(sourceFile, { pos: left.getStart(sourceFile), end: right.getStart(sourceFile) }, factory.createToken(95 /* ExportKeyword */), { suffix: " " }); if (!right.name) changes.insertName(sourceFile, right, name); - const semi = findChildOfKind(parent2, 26 /* SemicolonToken */, sourceFile); + const semi = findChildOfKind(parent2, 27 /* SemicolonToken */, sourceFile); if (semi) changes.delete(sourceFile, semi); } else { changes.replaceNodeRangeWithNodes( sourceFile, left.expression, - findChildOfKind(left, 24 /* DotToken */, sourceFile), - [factory.createToken(93 /* ExportKeyword */), factory.createToken(85 /* ConstKeyword */)], + findChildOfKind(left, 25 /* DotToken */, sourceFile), + [factory.createToken(95 /* ExportKeyword */), factory.createToken(87 /* ConstKeyword */)], { joiner: " ", suffix: " " } ); } } function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualify) { - const modifiers = [factory.createToken(93 /* ExportKeyword */)]; + const modifiers = [factory.createToken(95 /* ExportKeyword */)]; switch (exported.kind) { - case 215 /* FunctionExpression */: { + case 217 /* FunctionExpression */: { const { name: expressionName } = exported; if (expressionName && expressionName.text !== name) { return exportConst(); } } - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: return classExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); default: return exportConst(); @@ -139723,7 +146151,7 @@ ${lanes.join("\n")} replaceNode ); function replaceNode(original) { - if (original.kind === 208 /* PropertyAccessExpression */) { + if (original.kind === 210 /* PropertyAccessExpression */) { const replacement = useSitesToUnqualify.get(original); useSitesToUnqualify.delete(original); return replacement; @@ -139732,11 +146160,11 @@ ${lanes.join("\n")} } function convertSingleImport(name, moduleSpecifier, checker, identifiers, target, quotePreference) { switch (name.kind) { - case 203 /* ObjectBindingPattern */: { - const importSpecifiers = mapAllOrFail(name.elements, (e) => e.dotDotDotToken || e.initializer || e.propertyName && !isIdentifier(e.propertyName) || !isIdentifier(e.name) ? void 0 : makeImportSpecifier(e.propertyName && e.propertyName.text, e.name.text)); + case 205 /* ObjectBindingPattern */: { + const importSpecifiers = mapAllOrFail(name.elements, (e) => e.dotDotDotToken || e.initializer || e.propertyName && !isIdentifier(e.propertyName) || !isIdentifier(e.name) ? void 0 : makeImportSpecifier2(e.propertyName && e.propertyName.text, e.name.text)); if (importSpecifiers) { return convertedImports([makeImport( - /*name*/ + /*defaultImport*/ void 0, importSpecifiers, moduleSpecifier, @@ -139744,7 +146172,7 @@ ${lanes.join("\n")} )]); } } - case 204 /* ArrayBindingPattern */: { + case 206 /* ArrayBindingPattern */: { const tmp = makeUniqueName(moduleSpecifierToValidIdentifier(moduleSpecifier.text, target), identifiers); return convertedImports([ makeImport( @@ -139762,7 +146190,7 @@ ${lanes.join("\n")} ) ]); } - case 79 /* Identifier */: + case 80 /* Identifier */: return convertSingleIdentifierImport(name, moduleSpecifier, checker, identifiers, quotePreference); default: return Debug.assertNever(name, `Convert to ES module got invalid name kind ${name.kind}`); @@ -139783,7 +146211,7 @@ ${lanes.join("\n")} if (propertyName === "default") { needDefaultImport = true; const importDefaultName = use.getText(); - (useSitesToUnqualify != null ? useSitesToUnqualify : useSitesToUnqualify = /* @__PURE__ */ new Map()).set(parent2, factory.createIdentifier(importDefaultName)); + (useSitesToUnqualify ?? (useSitesToUnqualify = /* @__PURE__ */ new Map())).set(parent2, factory.createIdentifier(importDefaultName)); } else { Debug.assert(parent2.expression === use, "Didn't expect expression === use"); let idName = namedBindingsNames.get(propertyName); @@ -139791,7 +146219,7 @@ ${lanes.join("\n")} idName = makeUniqueName(propertyName, identifiers); namedBindingsNames.set(propertyName, idName); } - (useSitesToUnqualify != null ? useSitesToUnqualify : useSitesToUnqualify = /* @__PURE__ */ new Map()).set(parent2, factory.createIdentifier(idName)); + (useSitesToUnqualify ?? (useSitesToUnqualify = /* @__PURE__ */ new Map())).set(parent2, factory.createIdentifier(idName)); } } else { needDefaultImport = true; @@ -139831,11 +146259,11 @@ ${lanes.join("\n")} function isFreeIdentifier(node) { const { parent: parent2 } = node; switch (parent2.kind) { - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: return parent2.name !== node; - case 205 /* BindingElement */: + case 207 /* BindingElement */: return parent2.propertyName !== node; - case 273 /* ImportSpecifier */: + case 275 /* ImportSpecifier */: return parent2.propertyName !== node; default: return true; @@ -139869,14 +146297,14 @@ ${lanes.join("\n")} moduleSpecifier, quotePreference ) : makeImport( - /*name*/ + /*defaultImport*/ void 0, - [makeImportSpecifier(propertyName, localName)], + [makeImportSpecifier2(propertyName, localName)], moduleSpecifier, quotePreference ); } - function makeImportSpecifier(propertyName, name) { + function makeImportSpecifier2(propertyName, name) { return factory.createImportSpecifier( /*isTypeOnly*/ false, @@ -139945,7 +146373,7 @@ ${lanes.join("\n")} Debug.assert(!!qualifiedName, "Expected position to be owned by a qualified name."); return isIdentifier(qualifiedName.left) ? qualifiedName : void 0; } - function doChange3(changeTracker, sourceFile, qualifiedName) { + function doChange10(changeTracker, sourceFile, qualifiedName) { const rightText = qualifiedName.right.text; const replacement = factory.createIndexedAccessTypeNode( factory.createTypeReferenceNode( @@ -139971,7 +146399,7 @@ ${lanes.join("\n")} const qualifiedName = getQualifiedName(context.sourceFile, context.span.start); if (!qualifiedName) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange3(t, context.sourceFile, qualifiedName)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, context.sourceFile, qualifiedName)); const newText = `${qualifiedName.left.text}["${qualifiedName.right.text}"]`; return [createCodeFixAction(fixId11, changes, [Diagnostics.Rewrite_as_the_indexed_access_type_0, newText], fixId11, Diagnostics.Rewrite_all_as_indexed_access_types)]; }, @@ -139979,7 +146407,7 @@ ${lanes.join("\n")} getAllCodeActions: (context) => codeFixAll(context, errorCodes12, (changes, diag2) => { const q = getQualifiedName(diag2.file, diag2.start); if (q) { - doChange3(changes, diag2.file, q); + doChange10(changes, diag2.file, q); } }) }); @@ -139998,7 +146426,7 @@ ${lanes.join("\n")} const exportDeclaration = exportClause.parent; const typeExportSpecifiers = getTypeExportSpecifiers(exportSpecifier, context); if (typeExportSpecifiers.length === exportClause.elements.length) { - changes.insertModifierBefore(context.sourceFile, 154 /* TypeKeyword */, exportClause); + changes.insertModifierBefore(context.sourceFile, 156 /* TypeKeyword */, exportClause); } else { const valueExportDeclaration = factory.updateExportDeclaration( exportDeclaration, @@ -140037,8 +146465,8 @@ ${lanes.join("\n")} context.program.getSemanticDiagnostics(context.sourceFile, context.cancellationToken) ); return filter(exportClause.elements, (element) => { - var _a2; - return element === originExportSpecifier || ((_a2 = findDiagnosticForNode(element, diagnostics)) == null ? void 0 : _a2.code) === errorCodes13[0]; + var _a; + return element === originExportSpecifier || ((_a = findDiagnosticForNode(element, diagnostics)) == null ? void 0 : _a.code) === errorCodes13[0]; }); } var errorCodes13, fixId12; @@ -140076,7 +146504,7 @@ ${lanes.join("\n")} const { parent: parent2 } = getTokenAtPosition(sourceFile, pos); return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0; } - function doChange4(changes, sourceFile, declaration) { + function doChange11(changes, sourceFile, declaration) { if (isImportSpecifier(declaration)) { changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier( declaration, @@ -140180,7 +146608,7 @@ ${lanes.join("\n")} getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) { const declaration = getDeclaration2(context.sourceFile, context.span.start); if (declaration) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(t, context.sourceFile, declaration)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, context.sourceFile, declaration)); return [createCodeFixAction(fixId13, changes, Diagnostics.Convert_to_type_only_import, fixId13, Diagnostics.Convert_all_imports_not_used_as_a_value_to_type_only_imports)]; } return void 0; @@ -140190,7 +146618,7 @@ ${lanes.join("\n")} return codeFixAll(context, errorCodes14, (changes, diag2) => { const declaration = getDeclaration2(diag2.file, diag2.start); if (declaration) { - doChange4(changes, diag2.file, declaration); + doChange11(changes, diag2.file, declaration); } }); } @@ -140198,8 +146626,155 @@ ${lanes.join("\n")} } }); + // src/services/codefixes/convertTypedefToType.ts + function doChange12(changes, node, sourceFile) { + if (isJSDocTypedefTag(node)) { + fixSingleTypeDef(changes, node, sourceFile); + } + } + function fixSingleTypeDef(changes, typeDefNode, sourceFile) { + if (!typeDefNode) + return; + const declaration = createDeclaration(typeDefNode); + if (!declaration) + return; + const comment = typeDefNode.parent; + changes.replaceNode( + sourceFile, + comment, + declaration + ); + } + function createDeclaration(tag) { + var _a; + const { typeExpression } = tag; + if (!typeExpression) + return; + const typeName = (_a = tag.name) == null ? void 0 : _a.getText(); + if (!typeName) + return; + if (typeExpression.kind === 328 /* JSDocTypeLiteral */) { + return createInterfaceForTypeLiteral(typeName, typeExpression); + } + if (typeExpression.kind === 315 /* JSDocTypeExpression */) { + return createTypeAliasForTypeExpression(typeName, typeExpression); + } + } + function createInterfaceForTypeLiteral(typeName, typeLiteral) { + const propertySignatures = createSignatureFromTypeLiteral(typeLiteral); + if (!some(propertySignatures)) + return; + const interfaceDeclaration = factory.createInterfaceDeclaration( + /*modifiers*/ + void 0, + typeName, + /*typeParameters*/ + void 0, + /*heritageClauses*/ + void 0, + propertySignatures + ); + return interfaceDeclaration; + } + function createTypeAliasForTypeExpression(typeName, typeExpression) { + const typeReference = getSynthesizedDeepClone(typeExpression.type); + if (!typeReference) + return; + const declaration = factory.createTypeAliasDeclaration( + /*modifiers*/ + void 0, + factory.createIdentifier(typeName), + /*typeParameters*/ + void 0, + typeReference + ); + return declaration; + } + function createSignatureFromTypeLiteral(typeLiteral) { + const propertyTags = typeLiteral.jsDocPropertyTags; + if (!some(propertyTags)) + return; + const getSignature = (tag) => { + var _a; + const name = getPropertyName(tag); + const type = (_a = tag.typeExpression) == null ? void 0 : _a.type; + const isOptional = tag.isBracketed; + let typeReference; + if (type && isJSDocTypeLiteral(type)) { + const signatures = createSignatureFromTypeLiteral(type); + typeReference = factory.createTypeLiteralNode(signatures); + } else if (type) { + typeReference = getSynthesizedDeepClone(type); + } + if (typeReference && name) { + const questionToken = isOptional ? factory.createToken(58 /* QuestionToken */) : void 0; + const prop = factory.createPropertySignature( + /*modifiers*/ + void 0, + name, + questionToken, + typeReference + ); + return prop; + } + }; + const props = mapDefined(propertyTags, getSignature); + return props; + } + function getPropertyName(tag) { + return tag.name.kind === 80 /* Identifier */ ? tag.name.text : tag.name.right.text; + } + function getJSDocTypedefNode(node) { + if (hasJSDocNodes(node)) { + return forEach(node.jsDoc, (node2) => { + var _a; + return (_a = node2.tags) == null ? void 0 : _a.find(isJSDocTypedefTag); + }); + } + return void 0; + } + var fixId14, errorCodes15; + var init_convertTypedefToType = __esm({ + "src/services/codefixes/convertTypedefToType.ts"() { + "use strict"; + init_ts4(); + init_ts_codefix(); + fixId14 = "convertTypedefToType"; + errorCodes15 = [Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type.code]; + registerCodeFix({ + fixIds: [fixId14], + errorCodes: errorCodes15, + getCodeActions(context) { + const node = getTokenAtPosition( + context.sourceFile, + context.span.start + ); + if (!node) + return; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, node, context.sourceFile)); + if (changes.length > 0) { + return [ + createCodeFixAction( + fixId14, + changes, + Diagnostics.Convert_typedef_to_TypeScript_type, + fixId14, + Diagnostics.Convert_all_typedef_to_TypeScript_types + ) + ]; + } + }, + getAllCodeActions: (context) => codeFixAll(context, errorCodes15, (changes, diag2) => { + const node = getTokenAtPosition(diag2.file, diag2.start); + if (node) + doChange12(changes, node, diag2.file); + }) + }); + } + }); + // src/services/codefixes/convertLiteralTypeToMappedType.ts - function getInfo2(sourceFile, pos) { + function getInfo5(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); if (isIdentifier(token)) { const propertySignature = cast(token.parent.parent, isPropertySignature); @@ -140213,7 +146788,7 @@ ${lanes.join("\n")} } return void 0; } - function doChange5(changes, sourceFile, { container, typeNode, constraint, name }) { + function doChange13(changes, sourceFile, { container, typeNode, constraint, name }) { changes.replaceNode(sourceFile, container, factory.createMappedTypeNode( /*readonlyToken*/ void 0, @@ -140232,31 +146807,31 @@ ${lanes.join("\n")} void 0 )); } - var fixId14, errorCodes15; + var fixId15, errorCodes16; var init_convertLiteralTypeToMappedType = __esm({ "src/services/codefixes/convertLiteralTypeToMappedType.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId14 = "convertLiteralTypeToMappedType"; - errorCodes15 = [Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0.code]; + fixId15 = "convertLiteralTypeToMappedType"; + errorCodes16 = [Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0.code]; registerCodeFix({ - errorCodes: errorCodes15, + errorCodes: errorCodes16, getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context) { const { sourceFile, span } = context; - const info = getInfo2(sourceFile, span.start); + const info = getInfo5(sourceFile, span.start); if (!info) { return void 0; } const { name, constraint } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(t, sourceFile, info)); - return [createCodeFixAction(fixId14, changes, [Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId14, Diagnostics.Convert_all_type_literals_to_mapped_type)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange13(t, sourceFile, info)); + return [createCodeFixAction(fixId15, changes, [Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId15, Diagnostics.Convert_all_type_literals_to_mapped_type)]; }, - fixIds: [fixId14], - getAllCodeActions: (context) => codeFixAll(context, errorCodes15, (changes, diag2) => { - const info = getInfo2(diag2.file, diag2.start); + fixIds: [fixId15], + getAllCodeActions: (context) => codeFixAll(context, errorCodes16, (changes, diag2) => { + const info = getInfo5(diag2.file, diag2.start); if (info) { - doChange5(changes, diag2.file, info); + doChange13(changes, diag2.file, info); } }) }); @@ -140315,31 +146890,31 @@ ${lanes.join("\n")} const heritageClauseTypeSymbols = checker.getPropertiesOfType(heritageClauseType); return createSymbolTable(heritageClauseTypeSymbols.filter(symbolPointsToNonPrivateMember)); } - var errorCodes16, fixId15; + var errorCodes17, fixId16; var init_fixClassIncorrectlyImplementsInterface = __esm({ "src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - errorCodes16 = [ + errorCodes17 = [ Diagnostics.Class_0_incorrectly_implements_interface_1.code, Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code ]; - fixId15 = "fixClassIncorrectlyImplementsInterface"; + fixId16 = "fixClassIncorrectlyImplementsInterface"; registerCodeFix({ - errorCodes: errorCodes16, + errorCodes: errorCodes17, getCodeActions(context) { const { sourceFile, span } = context; const classDeclaration = getClass(sourceFile, span.start); return mapDefined(getEffectiveImplementsTypeNodes(classDeclaration), (implementedTypeNode) => { const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingDeclarations(context, implementedTypeNode, sourceFile, classDeclaration, t, context.preferences)); - return changes.length === 0 ? void 0 : createCodeFixAction(fixId15, changes, [Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId15, Diagnostics.Implement_all_unimplemented_interfaces); + return changes.length === 0 ? void 0 : createCodeFixAction(fixId16, changes, [Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId16, Diagnostics.Implement_all_unimplemented_interfaces); }); }, - fixIds: [fixId15], + fixIds: [fixId16], getAllCodeActions(context) { const seenClassDeclarations = /* @__PURE__ */ new Map(); - return codeFixAll(context, errorCodes16, (changes, diag2) => { + return codeFixAll(context, errorCodes17, (changes, diag2) => { const classDeclaration = getClass(diag2.file, diag2.start); if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) { for (const implementedTypeNode of getEffectiveImplementsTypeNodes(classDeclaration)) { @@ -140387,7 +146962,7 @@ ${lanes.join("\n")} symbol, symbolName2, moduleSymbol, - /*isJsxTagName*/ + /*preferCapitalized*/ false, program, host, @@ -140411,7 +146986,7 @@ ${lanes.join("\n")} } } function addImport(info) { - var _a2, _b; + var _a, _b; const { fix, symbolName: symbolName2 } = info; switch (fix.kind) { case 0 /* UseNamespace */: @@ -140434,7 +147009,7 @@ ${lanes.join("\n")} Debug.assert(entry.defaultImport === void 0 || entry.defaultImport.name === symbolName2, "(Add to Existing) Default import should be missing or match symbolName"); entry.defaultImport = { name: symbolName2, - addAsTypeOnly: reduceAddAsTypeOnlyValues((_a2 = entry.defaultImport) == null ? void 0 : _a2.addAsTypeOnly, addAsTypeOnly) + addAsTypeOnly: reduceAddAsTypeOnlyValues((_a = entry.defaultImport) == null ? void 0 : _a.addAsTypeOnly, addAsTypeOnly) }; } break; @@ -140466,7 +147041,7 @@ ${lanes.join("\n")} Debug.assertNever(fix, `fix wasn't never - got kind ${fix.kind}`); } function reduceAddAsTypeOnlyValues(prevValue, newValue) { - return Math.max(prevValue != null ? prevValue : 0, newValue); + return Math.max(prevValue ?? 0, newValue); } function getNewImportEntry(moduleSpecifier, importKind, useRequire, addAsTypeOnly) { const typeOnlyKey = newImportsKey( @@ -140521,7 +147096,6 @@ ${lanes.join("\n")} importClauseOrBindingPattern, defaultImport, arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })), - compilerOptions, preferences ); }); @@ -140614,8 +147188,8 @@ ${lanes.join("\n")} const packageJsonImportFilter = createPackageJsonImportFilter(sourceFile, preferences, host); return getBestFix(getImportFixes(exportInfos, position, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes, sourceFile, program, packageJsonImportFilter, host); } - function codeFixActionToCodeAction({ description: description2, changes, commands }) { - return { description: description2, changes, commands }; + function codeFixActionToCodeAction({ description: description3, changes, commands }) { + return { description: description3, changes, commands }; } function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, moduleSymbol, preferCapitalized, program, host, preferences, cancellationToken) { const getChecker = createGetChecker(program, host); @@ -140626,7 +147200,7 @@ ${lanes.join("\n")} }); } function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program, host) { - var _a2, _b; + var _a, _b; const compilerOptions = program.getCompilerOptions(); const mainProgramInfo = getInfoWithChecker( program.getTypeChecker(), @@ -140636,7 +147210,7 @@ ${lanes.join("\n")} if (mainProgramInfo) { return mainProgramInfo; } - const autoImportProvider = (_b = (_a2 = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a2.call(host)) == null ? void 0 : _b.getTypeChecker(); + const autoImportProvider = (_b = (_a = host.getPackageJsonAutoImportProvider) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getTypeChecker(); return Debug.checkDefined(autoImportProvider && getInfoWithChecker( autoImportProvider, /*isFromPackageJson*/ @@ -140683,24 +147257,24 @@ ${lanes.join("\n")} } function tryUseExistingNamespaceImport(existingImports, position) { return firstDefined(existingImports, ({ declaration, importKind }) => { - var _a2; + var _a; if (importKind !== 0 /* Named */) return void 0; const namespacePrefix = getNamespaceLikeImportText(declaration); - const moduleSpecifier = namespacePrefix && ((_a2 = tryGetModuleSpecifierFromDeclaration(declaration)) == null ? void 0 : _a2.text); + const moduleSpecifier = namespacePrefix && ((_a = tryGetModuleSpecifierFromDeclaration(declaration)) == null ? void 0 : _a.text); if (moduleSpecifier) { return { kind: 0 /* UseNamespace */, namespacePrefix, usagePosition: position, moduleSpecifier }; } }); } function getNamespaceLikeImportText(declaration) { - var _a2, _b, _c; + var _a, _b, _c; switch (declaration.kind) { - case 257 /* VariableDeclaration */: - return (_a2 = tryCast(declaration.name, isIdentifier)) == null ? void 0 : _a2.text; - case 268 /* ImportEqualsDeclaration */: + case 259 /* VariableDeclaration */: + return (_a = tryCast(declaration.name, isIdentifier)) == null ? void 0 : _a.text; + case 270 /* ImportEqualsDeclaration */: return declaration.name.text; - case 269 /* ImportDeclaration */: + case 271 /* ImportDeclaration */: return (_c = tryCast((_b = declaration.importClause) == null ? void 0 : _b.namedBindings, isNamespaceImport)) == null ? void 0 : _c.name.text; default: return Debug.assertNever(declaration); @@ -140719,19 +147293,33 @@ ${lanes.join("\n")} return 1 /* Allowed */; } function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) { - return firstDefined(existingImports, ({ declaration, importKind, symbol, targetFlags }) => { - if (importKind === 3 /* CommonJS */ || importKind === 2 /* Namespace */ || declaration.kind === 268 /* ImportEqualsDeclaration */) { + let best; + for (const existingImport of existingImports) { + const fix = getAddToExistingImportFix(existingImport); + if (!fix) + continue; + const isTypeOnly = isTypeOnlyImportDeclaration(fix.importClauseOrBindingPattern); + if (fix.addAsTypeOnly !== 4 /* NotAllowed */ && isTypeOnly || fix.addAsTypeOnly === 4 /* NotAllowed */ && !isTypeOnly) { + return fix; + } + best ?? (best = fix); + } + return best; + function getAddToExistingImportFix({ declaration, importKind, symbol, targetFlags }) { + if (importKind === 3 /* CommonJS */ || importKind === 2 /* Namespace */ || declaration.kind === 270 /* ImportEqualsDeclaration */) { return void 0; } - if (declaration.kind === 257 /* VariableDeclaration */) { - return (importKind === 0 /* Named */ || importKind === 1 /* Default */) && declaration.name.kind === 203 /* ObjectBindingPattern */ ? { kind: 2 /* AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* NotAllowed */ } : void 0; + if (declaration.kind === 259 /* VariableDeclaration */) { + return (importKind === 0 /* Named */ || importKind === 1 /* Default */) && declaration.name.kind === 205 /* ObjectBindingPattern */ ? { kind: 2 /* AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* NotAllowed */ } : void 0; } const { importClause } = declaration; - if (!importClause || !isStringLiteralLike(declaration.moduleSpecifier)) + if (!importClause || !isStringLiteralLike(declaration.moduleSpecifier)) { return void 0; + } const { name, namedBindings } = importClause; - if (importClause.isTypeOnly && !(importKind === 0 /* Named */ && namedBindings)) + if (importClause.isTypeOnly && !(importKind === 0 /* Named */ && namedBindings)) { return void 0; + } const addAsTypeOnly = getAddAsTypeOnly( isValidTypeOnlyUseSite, /*isForNewImportDeclaration*/ @@ -140742,10 +147330,12 @@ ${lanes.join("\n")} compilerOptions ); if (importKind === 1 /* Default */ && (name || // Cannot add a default import to a declaration that already has one - addAsTypeOnly === 2 /* Required */ && namedBindings)) + addAsTypeOnly === 2 /* Required */ && namedBindings)) { return void 0; - if (importKind === 0 /* Named */ && (namedBindings == null ? void 0 : namedBindings.kind) === 271 /* NamespaceImport */) + } + if (importKind === 0 /* Named */ && (namedBindings == null ? void 0 : namedBindings.kind) === 273 /* NamespaceImport */) { return void 0; + } return { kind: 2 /* AddToExisting */, importClauseOrBindingPattern: importClause, @@ -140753,7 +147343,7 @@ ${lanes.join("\n")} moduleSpecifier: declaration.moduleSpecifier.text, addAsTypeOnly }; - }); + } } function createExistingImportMap(checker, importingFile, compilerOptions) { let importMap; @@ -140764,7 +147354,7 @@ ${lanes.join("\n")} if (moduleSymbol) { (importMap || (importMap = createMultiMap())).add(getSymbolId(moduleSymbol), i.parent); } - } else if (i.kind === 269 /* ImportDeclaration */ || i.kind === 268 /* ImportEqualsDeclaration */) { + } else if (i.kind === 271 /* ImportDeclaration */ || i.kind === 270 /* ImportEqualsDeclaration */) { const moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); if (moduleSymbol) { (importMap || (importMap = createMultiMap())).add(getSymbolId(moduleSymbol), i); @@ -140832,7 +147422,7 @@ ${lanes.join("\n")} ); computedWithoutCacheCount += computedWithoutCache ? 1 : 0; return mapDefined(moduleSpecifiers, (moduleSpecifier) => { - var _a2; + var _a; if (rejectNodeModulesRelativePaths && pathContainsNodeModules(moduleSpecifier)) { return void 0; } @@ -140845,7 +147435,7 @@ ${lanes.join("\n")} const exportEquals = checker.resolveExternalModuleSymbol(exportInfo2.moduleSymbol); let namespacePrefix; if (exportEquals !== exportInfo2.moduleSymbol) { - namespacePrefix = (_a2 = getDefaultExportInfoWorker(exportEquals, checker, compilerOptions)) == null ? void 0 : _a2.name; + namespacePrefix = (_a = getDefaultExportInfoWorker(exportEquals, checker, compilerOptions)) == null ? void 0 : _a.name; } namespacePrefix || (namespacePrefix = moduleSymbolToValidIdentifier( exportInfo2.moduleSymbol, @@ -140874,8 +147464,8 @@ ${lanes.join("\n")} return existingDeclaration ? { fixes: [existingDeclaration] } : getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUseSite, useRequire, exportInfos, host, preferences, fromCacheOnly); } function newImportInfoFromExistingSpecifier({ declaration, importKind, symbol, targetFlags }, isValidTypeOnlyUseSite, useRequire, checker, compilerOptions) { - var _a2; - const moduleSpecifier = (_a2 = tryGetModuleSpecifierFromDeclaration(declaration)) == null ? void 0 : _a2.text; + var _a; + const moduleSpecifier = (_a = tryGetModuleSpecifierFromDeclaration(declaration)) == null ? void 0 : _a.text; if (moduleSpecifier) { const addAsTypeOnly = useRequire ? 4 /* NotAllowed */ : getAddAsTypeOnly( isValidTypeOnlyUseSite, @@ -140940,8 +147530,8 @@ ${lanes.join("\n")} return 0 /* EqualTo */; } function isFixPossiblyReExportingImportingFile(fix, importingFile, compilerOptions, toPath3) { - var _a2; - if (fix.isReExport && ((_a2 = fix.exportInfo) == null ? void 0 : _a2.moduleFileName) && getEmitModuleResolutionKind(compilerOptions) === 2 /* Node10 */ && isIndexFileName(fix.exportInfo.moduleFileName)) { + var _a; + if (fix.isReExport && ((_a = fix.exportInfo) == null ? void 0 : _a.moduleFileName) && getEmitModuleResolutionKind(compilerOptions) === 2 /* Node10 */ && isIndexFileName(fix.exportInfo.moduleFileName)) { const reExportDir = toPath3(getDirectoryPath(fix.exportInfo.moduleFileName)); return startsWith(importingFile.path, reExportDir); } @@ -140984,8 +147574,8 @@ ${lanes.join("\n")} preferences ).fixes; return fixes.map((fix) => { - var _a2; - return { fix, symbolName: symbolName2, errorIdentifierText: (_a2 = tryCast(token, isIdentifier)) == null ? void 0 : _a2.text }; + var _a; + return { fix, symbolName: symbolName2, errorIdentifierText: (_a = tryCast(token, isIdentifier)) == null ? void 0 : _a.text }; }); } function getUmdSymbol(token, checker) { @@ -141113,10 +147703,10 @@ ${lanes.join("\n")} return !namespaceSymbol || some(namespaceSymbol.declarations, isTypeOnlyImportOrExportDeclaration) && !(namespaceSymbol.flags & 111551 /* Value */); } function getExportInfos(symbolName2, isJsxTagName, currentTokenMeaning, cancellationToken, fromFile, program, useAutoImportProvider, host, preferences) { - var _a2; + var _a; const originalSymbolToExportInfos = createMultiMap(); const packageJsonFilter = createPackageJsonImportFilter(fromFile, preferences, host); - const moduleSpecifierCache = (_a2 = host.getModuleSpecifierCache) == null ? void 0 : _a2.call(host); + const moduleSpecifierCache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host); const getModuleSpecifierResolutionHost = memoizeOne((isFromPackageJson) => { return createModuleSpecifierResolutionHost(isFromPackageJson ? host.getPackageJsonAutoImportProvider() : program, host); }); @@ -141182,7 +147772,6 @@ ${lanes.join("\n")} importClauseOrBindingPattern, importKind === 1 /* Default */ ? { name: symbolName2, addAsTypeOnly } : void 0, importKind === 0 /* Named */ ? [{ name: symbolName2, addAsTypeOnly }] : emptyArray, - compilerOptions, preferences ); const moduleSpecifierWithoutQuotes = stripQuotes(moduleSpecifier); @@ -141217,20 +147806,20 @@ ${lanes.join("\n")} case 4 /* PromoteTypeOnly */: { const { typeOnlyAliasDeclaration } = fix; const promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile, preferences); - return promotedDeclaration.kind === 273 /* ImportSpecifier */ ? [Diagnostics.Remove_type_from_import_of_0_from_1, symbolName2, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)]; + return promotedDeclaration.kind === 275 /* ImportSpecifier */ ? [Diagnostics.Remove_type_from_import_of_0_from_1, symbolName2, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)]; } default: return Debug.assertNever(fix, `Unexpected fix kind ${fix.kind}`); } } function getModuleSpecifierText(promotedDeclaration) { - var _a2, _b; - return promotedDeclaration.kind === 268 /* ImportEqualsDeclaration */ ? ((_b = tryCast((_a2 = tryCast(promotedDeclaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a2.expression, isStringLiteralLike)) == null ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : cast(promotedDeclaration.parent.moduleSpecifier, isStringLiteral).text; + var _a, _b; + return promotedDeclaration.kind === 270 /* ImportEqualsDeclaration */ ? ((_b = tryCast((_a = tryCast(promotedDeclaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a.expression, isStringLiteralLike)) == null ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : cast(promotedDeclaration.parent.moduleSpecifier, isStringLiteral).text; } function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile, preferences) { const convertExistingToTypeOnly = importNameElisionDisabled(compilerOptions); switch (aliasDeclaration.kind) { - case 273 /* ImportSpecifier */: + case 275 /* ImportSpecifier */: if (aliasDeclaration.isTypeOnly) { const sortKind = ts_OrganizeImports_exports.detectImportSpecifierSorting(aliasDeclaration.parent.elements, preferences); if (aliasDeclaration.parent.elements.length > 1 && sortKind) { @@ -141254,13 +147843,13 @@ ${lanes.join("\n")} promoteImportClause(aliasDeclaration.parent.parent); return aliasDeclaration.parent.parent; } - case 270 /* ImportClause */: + case 272 /* ImportClause */: promoteImportClause(aliasDeclaration); return aliasDeclaration; - case 271 /* NamespaceImport */: + case 273 /* NamespaceImport */: promoteImportClause(aliasDeclaration.parent); return aliasDeclaration.parent; - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1)); return aliasDeclaration; default: @@ -141271,22 +147860,22 @@ ${lanes.join("\n")} if (convertExistingToTypeOnly) { const namedImports = tryCast(importClause.namedBindings, isNamedImports); if (namedImports && namedImports.elements.length > 1) { - if (ts_OrganizeImports_exports.detectImportSpecifierSorting(namedImports.elements, preferences) && aliasDeclaration.kind === 273 /* ImportSpecifier */ && namedImports.elements.indexOf(aliasDeclaration) !== 0) { + if (ts_OrganizeImports_exports.detectImportSpecifierSorting(namedImports.elements, preferences) && aliasDeclaration.kind === 275 /* ImportSpecifier */ && namedImports.elements.indexOf(aliasDeclaration) !== 0) { changes.delete(sourceFile, aliasDeclaration); changes.insertImportSpecifierAtIndex(sourceFile, aliasDeclaration, namedImports, 0); } for (const element of namedImports.elements) { if (element !== aliasDeclaration && !element.isTypeOnly) { - changes.insertModifierBefore(sourceFile, 154 /* TypeKeyword */, element); + changes.insertModifierBefore(sourceFile, 156 /* TypeKeyword */, element); } } } } } } - function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions, preferences) { - var _a2; - if (clause.kind === 203 /* ObjectBindingPattern */) { + function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, preferences) { + var _a; + if (clause.kind === 205 /* ObjectBindingPattern */) { if (defaultImport) { addElementToBindingPattern(clause, defaultImport.name, "default"); } @@ -141301,8 +147890,7 @@ ${lanes.join("\n")} return; } const promoteFromTypeOnly2 = clause.isTypeOnly && some([defaultImport, ...namedImports], (i) => (i == null ? void 0 : i.addAsTypeOnly) === 4 /* NotAllowed */); - const existingSpecifiers = clause.namedBindings && ((_a2 = tryCast(clause.namedBindings, isNamedImports)) == null ? void 0 : _a2.elements); - const convertExistingToTypeOnly = promoteFromTypeOnly2 && importNameElisionDisabled(compilerOptions); + const existingSpecifiers = clause.namedBindings && ((_a = tryCast(clause.namedBindings, isNamedImports)) == null ? void 0 : _a.elements); if (defaultImport) { Debug.assert(!clause.name, "Cannot add a default import to an import clause that already has one"); changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), factory.createIdentifier(defaultImport.name), { suffix: ", " }); @@ -141333,7 +147921,7 @@ ${lanes.join("\n")} const specifierSort = (existingSpecifiers == null ? void 0 : existingSpecifiers.length) && ts_OrganizeImports_exports.detectImportSpecifierSorting(existingSpecifiers, preferences); if (specifierSort && !(ignoreCaseForSorting && specifierSort === 1 /* CaseSensitive */)) { for (const spec of newSpecifiers) { - const insertionIndex = convertExistingToTypeOnly && !spec.isTypeOnly ? 0 : ts_OrganizeImports_exports.getImportSpecifierInsertionIndex(existingSpecifiers, spec, comparer); + const insertionIndex = promoteFromTypeOnly2 && !spec.isTypeOnly ? 0 : ts_OrganizeImports_exports.getImportSpecifierInsertionIndex(existingSpecifiers, spec, comparer); changes.insertImportSpecifierAtIndex(sourceFile, spec, clause.namedBindings, insertionIndex); } } else if (existingSpecifiers == null ? void 0 : existingSpecifiers.length) { @@ -141353,9 +147941,9 @@ ${lanes.join("\n")} } if (promoteFromTypeOnly2) { changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(clause, sourceFile)); - if (convertExistingToTypeOnly && existingSpecifiers) { + if (existingSpecifiers) { for (const specifier of existingSpecifiers) { - changes.insertModifierBefore(sourceFile, 154 /* TypeKeyword */, specifier); + changes.insertModifierBefore(sourceFile, 156 /* TypeKeyword */, specifier); } } } @@ -141513,7 +148101,7 @@ ${lanes.join("\n")} } return !isStringANonContextualKeyword(res) ? res || "_" : `_${res}`; } - var importFixName, importFixId, errorCodes17; + var importFixName, importFixId, errorCodes18; var init_importFixes = __esm({ "src/services/codefixes/importFixes.ts"() { "use strict"; @@ -141521,7 +148109,7 @@ ${lanes.join("\n")} init_ts_codefix(); importFixName = "import"; importFixId = "fixMissingImport"; - errorCodes17 = [ + errorCodes18 = [ Diagnostics.Cannot_find_name_0.code, Diagnostics.Cannot_find_name_0_Did_you_mean_1.code, Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code, @@ -141533,7 +148121,7 @@ ${lanes.join("\n")} Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code ]; registerCodeFix({ - errorCodes: errorCodes17, + errorCodes: errorCodes18, getCodeActions(context) { const { errorCode, preferences, sourceFile, span, program } = context; const info = getFixInfos( @@ -141568,7 +148156,7 @@ ${lanes.join("\n")} host, cancellationToken ); - eachDiagnostic(context, errorCodes17, (diag2) => importAdder.addImportFromDiagnostic(diag2, context)); + eachDiagnostic(context, errorCodes18, (diag2) => importAdder.addImportFromDiagnostic(diag2, context)); return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, importAdder.writeFixes)); } }); @@ -141576,7 +148164,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixAddMissingConstraint.ts - function getInfo3(program, sourceFile, span) { + function getInfo6(program, sourceFile, span) { const diag2 = find(program.getSemanticDiagnostics(sourceFile), (diag3) => diag3.start === span.start && diag3.length === span.length); if (diag2 === void 0 || diag2.relatedInformation === void 0) return; @@ -141643,14 +148231,14 @@ ${lanes.join("\n")} const contextualType = isExpression(node) ? checker.getContextualType(node) : void 0; return contextualType || checker.getTypeAtLocation(node); } - var fixId16, errorCodes18; + var fixId17, errorCodes19; var init_fixAddMissingConstraint = __esm({ "src/services/codefixes/fixAddMissingConstraint.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId16 = "addMissingConstraint"; - errorCodes18 = [ + fixId17 = "addMissingConstraint"; + errorCodes19 = [ // We want errors this could be attached to: // Diagnostics.This_type_parameter_probably_needs_an_extends_0_constraint Diagnostics.Type_0_is_not_comparable_to_type_1.code, @@ -141663,22 +148251,22 @@ ${lanes.join("\n")} Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code ]; registerCodeFix({ - errorCodes: errorCodes18, + errorCodes: errorCodes19, getCodeActions(context) { const { sourceFile, span, program, preferences, host } = context; - const info = getInfo3(program, sourceFile, span); + const info = getInfo6(program, sourceFile, span); if (info === void 0) return; const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingConstraint(t, program, preferences, host, sourceFile, info)); - return [createCodeFixAction(fixId16, changes, Diagnostics.Add_extends_constraint, fixId16, Diagnostics.Add_extends_constraint_to_all_type_parameters)]; + return [createCodeFixAction(fixId17, changes, Diagnostics.Add_extends_constraint, fixId17, Diagnostics.Add_extends_constraint_to_all_type_parameters)]; }, - fixIds: [fixId16], + fixIds: [fixId17], getAllCodeActions: (context) => { const { program, preferences, host } = context; const seen = /* @__PURE__ */ new Map(); return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => { - eachDiagnostic(context, errorCodes18, (diag2) => { - const info = getInfo3(program, diag2.file, createTextSpan(diag2.start, diag2.length)); + eachDiagnostic(context, errorCodes19, (diag2) => { + const info = getInfo6(program, diag2.file, createTextSpan(diag2.start, diag2.length)); if (info) { if (addToSeen(seen, getNodeId(info.declaration))) { return addMissingConstraint(changes, program, preferences, host, diag2.file, info); @@ -141723,7 +148311,7 @@ ${lanes.join("\n")} const lastDecorator = findLast(modifiers, isDecorator); const modifierPos = abstractModifier ? abstractModifier.end : staticModifier ? staticModifier.end : accessibilityModifier ? accessibilityModifier.end : lastDecorator ? skipTrivia(sourceFile.text, lastDecorator.end) : classElement.getStart(sourceFile); const options = accessibilityModifier || staticModifier || abstractModifier ? { prefix: " " } : { suffix: " " }; - changeTracker.insertModifierAt(sourceFile, modifierPos, 161 /* OverrideKeyword */, options); + changeTracker.insertModifierAt(sourceFile, modifierPos, 163 /* OverrideKeyword */, options); } function doRemoveOverrideModifierChange(changeTracker, sourceFile, pos) { const classElement = findContainerClassElementLike(sourceFile, pos); @@ -141737,13 +148325,13 @@ ${lanes.join("\n")} } function isClassElementLikeHasJSDoc(node) { switch (node.kind) { - case 173 /* Constructor */: - case 169 /* PropertyDeclaration */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 175 /* Constructor */: + case 171 /* PropertyDeclaration */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return true; - case 166 /* Parameter */: + case 168 /* Parameter */: return isParameterPropertyDeclaration(node, node.parent); default: return false; @@ -141759,7 +148347,7 @@ ${lanes.join("\n")} Debug.assert(classElement && isClassElementLikeHasJSDoc(classElement)); return classElement; } - var fixName, fixAddOverrideId, fixRemoveOverrideId, errorCodes19, errorCodeFixIdMap; + var fixName, fixAddOverrideId, fixRemoveOverrideId, errorCodes20, errorCodeFixIdMap; var init_fixOverrideModifier = __esm({ "src/services/codefixes/fixOverrideModifier.ts"() { "use strict"; @@ -141768,7 +148356,7 @@ ${lanes.join("\n")} fixName = "fixOverrideModifier"; fixAddOverrideId = "fixAddOverrideModifier"; fixRemoveOverrideId = "fixRemoveOverrideModifier"; - errorCodes19 = [ + errorCodes20 = [ Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code, Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code, Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code, @@ -141832,20 +148420,20 @@ ${lanes.join("\n")} } }; registerCodeFix({ - errorCodes: errorCodes19, + errorCodes: errorCodes20, getCodeActions: function getCodeActionsToFixOverrideModifierIssues(context) { const { errorCode, span } = context; const info = errorCodeFixIdMap[errorCode]; if (!info) return emptyArray; - const { descriptions, fixId: fixId51, fixAllDescriptions } = info; + const { descriptions, fixId: fixId52, fixAllDescriptions } = info; const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => dispatchChanges(changes2, context, errorCode, span.start)); return [ - createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId51, fixAllDescriptions) + createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId52, fixAllDescriptions) ]; }, fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId], - getAllCodeActions: (context) => codeFixAll(context, errorCodes19, (changes, diag2) => { + getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => { const { code, start } = diag2; const info = errorCodeFixIdMap[code]; if (!info || info.fixId !== context.fixId) { @@ -141858,7 +148446,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts - function doChange6(changes, sourceFile, node, preferences) { + function doChange14(changes, sourceFile, node, preferences) { const quotePreference = getQuotePreference(sourceFile, preferences); const argumentsExpression = factory.createStringLiteral(node.name.text, quotePreference === 0 /* Single */); changes.replaceNode( @@ -141870,32 +148458,32 @@ ${lanes.join("\n")} function getPropertyAccessExpression(sourceFile, pos) { return cast(getTokenAtPosition(sourceFile, pos).parent, isPropertyAccessExpression); } - var fixId17, errorCodes20; + var fixId18, errorCodes21; var init_fixNoPropertyAccessFromIndexSignature = __esm({ "src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId17 = "fixNoPropertyAccessFromIndexSignature"; - errorCodes20 = [ + fixId18 = "fixNoPropertyAccessFromIndexSignature"; + errorCodes21 = [ Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0.code ]; registerCodeFix({ - errorCodes: errorCodes20, - fixIds: [fixId17], + errorCodes: errorCodes21, + fixIds: [fixId18], getCodeActions(context) { const { sourceFile, span, preferences } = context; const property = getPropertyAccessExpression(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange6(t, context.sourceFile, property, preferences)); - return [createCodeFixAction(fixId17, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId17, Diagnostics.Use_element_access_for_all_undeclared_properties)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange14(t, context.sourceFile, property, preferences)); + return [createCodeFixAction(fixId18, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId18, Diagnostics.Use_element_access_for_all_undeclared_properties)]; }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => doChange6(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences)) + getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => doChange14(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences)) }); } }); // src/services/codefixes/fixImplicitThis.ts - function doChange7(changes, sourceFile, pos, checker) { + function doChange15(changes, sourceFile, pos, checker) { const token = getTokenAtPosition(sourceFile, pos); if (!isThis(token)) return void 0; @@ -141915,7 +148503,7 @@ ${lanes.join("\n")} /*includeClassComputedPropertyName*/ false ))) { - const fnKeyword = Debug.checkDefined(findChildOfKind(fn, 98 /* FunctionKeyword */, sourceFile)); + const fnKeyword = Debug.checkDefined(findChildOfKind(fn, 100 /* FunctionKeyword */, sourceFile)); const { name } = fn; const body = Debug.checkDefined(fn.body); if (isFunctionExpression(fn)) { @@ -141929,42 +148517,42 @@ ${lanes.join("\n")} changes.insertText(sourceFile, body.pos, " =>"); return [Diagnostics.Convert_function_expression_0_to_arrow_function, name ? name.text : ANONYMOUS]; } else { - changes.replaceNode(sourceFile, fnKeyword, factory.createToken(85 /* ConstKeyword */)); + changes.replaceNode(sourceFile, fnKeyword, factory.createToken(87 /* ConstKeyword */)); changes.insertText(sourceFile, name.end, " = "); changes.insertText(sourceFile, body.pos, " =>"); return [Diagnostics.Convert_function_declaration_0_to_arrow_function, name.text]; } } } - var fixId18, errorCodes21; + var fixId19, errorCodes22; var init_fixImplicitThis = __esm({ "src/services/codefixes/fixImplicitThis.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId18 = "fixImplicitThis"; - errorCodes21 = [Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code]; + fixId19 = "fixImplicitThis"; + errorCodes22 = [Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code]; registerCodeFix({ - errorCodes: errorCodes21, + errorCodes: errorCodes22, getCodeActions: function getCodeActionsToFixImplicitThis(context) { const { sourceFile, program, span } = context; let diagnostic; const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => { - diagnostic = doChange7(t, sourceFile, span.start, program.getTypeChecker()); + diagnostic = doChange15(t, sourceFile, span.start, program.getTypeChecker()); }); - return diagnostic ? [createCodeFixAction(fixId18, changes, diagnostic, fixId18, Diagnostics.Fix_all_implicit_this_errors)] : emptyArray; + return diagnostic ? [createCodeFixAction(fixId19, changes, diagnostic, fixId19, Diagnostics.Fix_all_implicit_this_errors)] : emptyArray; }, - fixIds: [fixId18], - getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => { - doChange7(changes, diag2.file, diag2.start, context.program.getTypeChecker()); + fixIds: [fixId19], + getAllCodeActions: (context) => codeFixAll(context, errorCodes22, (changes, diag2) => { + doChange15(changes, diag2.file, diag2.start, context.program.getTypeChecker()); }) }); } }); // src/services/codefixes/fixImportNonExportedMember.ts - function getInfo4(sourceFile, pos, program) { - var _a2; + function getInfo7(sourceFile, pos, program) { + var _a; const token = getTokenAtPosition(sourceFile, pos); if (isIdentifier(token)) { const importDeclaration = findAncestor(token, isImportDeclaration); @@ -141985,7 +148573,7 @@ ${lanes.join("\n")} if (moduleSourceFile === void 0 || isSourceFileFromLibrary(program, moduleSourceFile)) return void 0; const moduleSymbol = moduleSourceFile.symbol; - const locals = (_a2 = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a2.locals; + const locals = (_a = tryCast(moduleSymbol.valueDeclaration, canHaveLocals)) == null ? void 0 : _a.locals; if (locals === void 0) return void 0; const localSymbol = locals.get(token.escapedText); @@ -141999,7 +148587,7 @@ ${lanes.join("\n")} } return void 0; } - function doChange8(changes, program, { exportName, node, moduleSourceFile }) { + function doChange16(changes, program, { exportName, node, moduleSourceFile }) { const exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly); if (exportDeclaration) { updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]); @@ -142081,33 +148669,33 @@ ${lanes.join("\n")} const variableStatement = isVariableDeclaration(declaration) ? tryCast(declaration.parent.parent, isVariableStatement) : void 0; return variableStatement && length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration; } - var fixId19, errorCodes22; + var fixId20, errorCodes23; var init_fixImportNonExportedMember = __esm({ "src/services/codefixes/fixImportNonExportedMember.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId19 = "fixImportNonExportedMember"; - errorCodes22 = [ + fixId20 = "fixImportNonExportedMember"; + errorCodes23 = [ Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code ]; registerCodeFix({ - errorCodes: errorCodes22, - fixIds: [fixId19], + errorCodes: errorCodes23, + fixIds: [fixId20], getCodeActions(context) { const { sourceFile, span, program } = context; - const info = getInfo4(sourceFile, span.start, program); + const info = getInfo7(sourceFile, span.start, program); if (info === void 0) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange8(t, program, info)); - return [createCodeFixAction(fixId19, changes, [Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId19, Diagnostics.Export_all_referenced_locals)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(t, program, info)); + return [createCodeFixAction(fixId20, changes, [Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId20, Diagnostics.Export_all_referenced_locals)]; }, getAllCodeActions(context) { const { program } = context; return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => { const exports = /* @__PURE__ */ new Map(); - eachDiagnostic(context, errorCodes22, (diag2) => { - const info = getInfo4(diag2.file, diag2.start, program); + eachDiagnostic(context, errorCodes23, (diag2) => { + const info = getInfo7(diag2.file, diag2.start, program); if (info === void 0) return void 0; const { exportName, node, moduleSourceFile } = info; @@ -142149,28 +148737,28 @@ ${lanes.join("\n")} // src/services/codefixes/fixIncorrectNamedTupleSyntax.ts function getNamedTupleMember(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); - return findAncestor(token, (t) => t.kind === 199 /* NamedTupleMember */); + return findAncestor(token, (t) => t.kind === 201 /* NamedTupleMember */); } - function doChange9(changes, sourceFile, namedTupleMember) { + function doChange17(changes, sourceFile, namedTupleMember) { if (!namedTupleMember) { return; } let unwrappedType = namedTupleMember.type; let sawOptional = false; let sawRest = false; - while (unwrappedType.kind === 187 /* OptionalType */ || unwrappedType.kind === 188 /* RestType */ || unwrappedType.kind === 193 /* ParenthesizedType */) { - if (unwrappedType.kind === 187 /* OptionalType */) { + while (unwrappedType.kind === 189 /* OptionalType */ || unwrappedType.kind === 190 /* RestType */ || unwrappedType.kind === 195 /* ParenthesizedType */) { + if (unwrappedType.kind === 189 /* OptionalType */) { sawOptional = true; - } else if (unwrappedType.kind === 188 /* RestType */) { + } else if (unwrappedType.kind === 190 /* RestType */) { sawRest = true; } unwrappedType = unwrappedType.type; } const updated = factory.updateNamedTupleMember( namedTupleMember, - namedTupleMember.dotDotDotToken || (sawRest ? factory.createToken(25 /* DotDotDotToken */) : void 0), + namedTupleMember.dotDotDotToken || (sawRest ? factory.createToken(26 /* DotDotDotToken */) : void 0), namedTupleMember.name, - namedTupleMember.questionToken || (sawOptional ? factory.createToken(57 /* QuestionToken */) : void 0), + namedTupleMember.questionToken || (sawOptional ? factory.createToken(58 /* QuestionToken */) : void 0), unwrappedType ); if (updated === namedTupleMember) { @@ -142178,32 +148766,32 @@ ${lanes.join("\n")} } changes.replaceNode(sourceFile, namedTupleMember, updated); } - var fixId20, errorCodes23; + var fixId21, errorCodes24; var init_fixIncorrectNamedTupleSyntax = __esm({ "src/services/codefixes/fixIncorrectNamedTupleSyntax.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId20 = "fixIncorrectNamedTupleSyntax"; - errorCodes23 = [ + fixId21 = "fixIncorrectNamedTupleSyntax"; + errorCodes24 = [ 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.code, Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type.code ]; registerCodeFix({ - errorCodes: errorCodes23, + errorCodes: errorCodes24, getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) { const { sourceFile, span } = context; const namedTupleMember = getNamedTupleMember(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, sourceFile, namedTupleMember)); - return [createCodeFixAction(fixId20, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId20, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(t, sourceFile, namedTupleMember)); + return [createCodeFixAction(fixId21, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId21, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)]; }, - fixIds: [fixId20] + fixIds: [fixId21] }); } }); // src/services/codefixes/fixSpelling.ts - function getInfo5(sourceFile, pos, context, errorCode) { + function getInfo8(sourceFile, pos, context, errorCode) { const node = getTokenAtPosition(sourceFile, pos); const parent2 = node.parent; if ((errorCode === Diagnostics.No_overload_matches_this_call.code || errorCode === Diagnostics.Type_0_is_not_assignable_to_type_1.code) && !isJsxAttribute(parent2)) @@ -142217,7 +148805,7 @@ ${lanes.join("\n")} containingType = checker.getNonNullableType(containingType); } suggestedSymbol = checker.getSuggestedSymbolForNonexistentProperty(node, containingType); - } else if (isBinaryExpression(parent2) && parent2.operatorToken.kind === 101 /* InKeyword */ && parent2.left === node && isPrivateIdentifier(node)) { + } else if (isBinaryExpression(parent2) && parent2.operatorToken.kind === 103 /* InKeyword */ && parent2.left === node && isPrivateIdentifier(node)) { const receiverType = checker.getTypeAtLocation(parent2.right); suggestedSymbol = checker.getSuggestedSymbolForNonexistentProperty(node, receiverType); } else if (isQualifiedName(parent2) && parent2.right === node) { @@ -142252,7 +148840,7 @@ ${lanes.join("\n")} } return suggestedSymbol === void 0 ? void 0 : { node, suggestedSymbol }; } - function doChange10(changes, sourceFile, node, suggestedSymbol, target) { + function doChange18(changes, sourceFile, node, suggestedSymbol, target) { const suggestion = symbolName(suggestedSymbol); if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression(node.parent)) { const valDecl = suggestedSymbol.valueDeclaration; @@ -142286,14 +148874,14 @@ ${lanes.join("\n")} return void 0; return context.program.getSourceFile(resolvedModule.resolvedFileName); } - var fixId21, errorCodes24; + var fixId22, errorCodes25; var init_fixSpelling = __esm({ "src/services/codefixes/fixSpelling.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId21 = "fixSpelling"; - errorCodes24 = [ + fixId22 = "fixSpelling"; + errorCodes25 = [ Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code, Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, Diagnostics.Cannot_find_name_0_Did_you_mean_1.code, @@ -142310,23 +148898,23 @@ ${lanes.join("\n")} Diagnostics.Type_0_is_not_assignable_to_type_1.code ]; registerCodeFix({ - errorCodes: errorCodes24, + errorCodes: errorCodes25, getCodeActions(context) { const { sourceFile, errorCode } = context; - const info = getInfo5(sourceFile, context.span.start, context, errorCode); + const info = getInfo8(sourceFile, context.span.start, context, errorCode); if (!info) return void 0; const { node, suggestedSymbol } = info; const target = getEmitScriptTarget(context.host.getCompilationSettings()); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, sourceFile, node, suggestedSymbol, target)); - return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId21, Diagnostics.Fix_all_detected_spelling_errors)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(t, sourceFile, node, suggestedSymbol, target)); + return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId22, Diagnostics.Fix_all_detected_spelling_errors)]; }, - fixIds: [fixId21], - getAllCodeActions: (context) => codeFixAll(context, errorCodes24, (changes, diag2) => { - const info = getInfo5(diag2.file, diag2.start, context, diag2.code); + fixIds: [fixId22], + getAllCodeActions: (context) => codeFixAll(context, errorCodes25, (changes, diag2) => { + const info = getInfo8(diag2.file, diag2.start, context, diag2.code); const target = getEmitScriptTarget(context.host.getCompilationSettings()); if (info) - doChange10(changes, context.sourceFile, info.node, info.suggestedSymbol, target); + doChange18(changes, context.sourceFile, info.node, info.suggestedSymbol, target); }) }); } @@ -142426,20 +149014,20 @@ ${lanes.join("\n")} } return checker.isTypeAssignableTo(exprType, type); } - function getInfo6(checker, sourceFile, position, errorCode) { + function getInfo9(checker, sourceFile, position, errorCode) { const node = getTokenAtPosition(sourceFile, position); if (!node.parent) return void 0; const declaration = findAncestor(node.parent, isFunctionLikeDeclaration); switch (errorCode) { - case Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code: + case Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value.code: if (!declaration || !declaration.body || !declaration.type || !rangeContainsRange(declaration.type, node)) return void 0; return getFixInfo( checker, declaration, checker.getTypeFromTypeNode(declaration.type), - /* isFunctionType */ + /*isFunctionType*/ false ); case Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code: @@ -142453,7 +149041,7 @@ ${lanes.join("\n")} checker, declaration, type, - /* isFunctionType */ + /*isFunctionType*/ true ); case Diagnostics.Type_0_is_not_assignable_to_type_1.code: @@ -142466,7 +149054,7 @@ ${lanes.join("\n")} checker, initializer, checker.getTypeAtLocation(node.parent), - /* isFunctionType */ + /*isFunctionType*/ true ); } @@ -142474,19 +149062,19 @@ ${lanes.join("\n")} } function getVariableLikeInitializer(declaration) { switch (declaration.kind) { - case 257 /* VariableDeclaration */: - case 166 /* Parameter */: - case 205 /* BindingElement */: - case 169 /* PropertyDeclaration */: - case 299 /* PropertyAssignment */: + case 259 /* VariableDeclaration */: + case 168 /* Parameter */: + case 207 /* BindingElement */: + case 171 /* PropertyDeclaration */: + case 302 /* PropertyAssignment */: return declaration.initializer; - case 288 /* JsxAttribute */: + case 290 /* JsxAttribute */: return declaration.initializer && (isJsxExpression(declaration.initializer) ? declaration.initializer.expression : void 0); - case 300 /* ShorthandPropertyAssignment */: - case 168 /* PropertySignature */: - case 302 /* EnumMember */: - case 351 /* JSDocPropertyTag */: - case 344 /* JSDocParameterTag */: + case 303 /* ShorthandPropertyAssignment */: + case 170 /* PropertySignature */: + case 305 /* EnumMember */: + case 354 /* JSDocPropertyTag */: + case 347 /* JSDocParameterTag */: return void 0; } } @@ -142510,7 +149098,7 @@ ${lanes.join("\n")} } function getActionForfixAddReturnStatement(context, expression, statement) { const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addReturnStatement(t, context.sourceFile, expression, statement)); - return createCodeFixAction(fixId22, changes, Diagnostics.Add_a_return_statement, fixIdAddReturnStatement, Diagnostics.Add_all_missing_return_statement); + return createCodeFixAction(fixId23, changes, Diagnostics.Add_a_return_statement, fixIdAddReturnStatement, Diagnostics.Add_all_missing_return_statement); } function getActionForFixRemoveBracesFromArrowFunctionBody(context, declaration, expression, commentSource) { const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => removeBlockBodyBrace( @@ -142519,36 +149107,36 @@ ${lanes.join("\n")} declaration, expression, commentSource, - /* withParen */ + /*withParen*/ false )); - return createCodeFixAction(fixId22, changes, Diagnostics.Remove_braces_from_arrow_function_body, fixRemoveBracesFromArrowFunctionBody, Diagnostics.Remove_braces_from_all_arrow_function_bodies_with_relevant_issues); + return createCodeFixAction(fixId23, changes, Diagnostics.Remove_braces_from_arrow_function_body, fixRemoveBracesFromArrowFunctionBody, Diagnostics.Remove_braces_from_all_arrow_function_bodies_with_relevant_issues); } function getActionForfixWrapTheBlockWithParen(context, declaration, expression) { const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => wrapBlockWithParen(t, context.sourceFile, declaration, expression)); - return createCodeFixAction(fixId22, changes, Diagnostics.Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal, fixIdWrapTheBlockWithParen, Diagnostics.Wrap_all_object_literal_with_parentheses); + return createCodeFixAction(fixId23, changes, Diagnostics.Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal, fixIdWrapTheBlockWithParen, Diagnostics.Wrap_all_object_literal_with_parentheses); } - var fixId22, fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen, errorCodes25; + var fixId23, fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen, errorCodes26; var init_returnValueCorrect = __esm({ "src/services/codefixes/returnValueCorrect.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId22 = "returnValueCorrect"; + fixId23 = "returnValueCorrect"; fixIdAddReturnStatement = "fixAddReturnStatement"; fixRemoveBracesFromArrowFunctionBody = "fixRemoveBracesFromArrowFunctionBody"; fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen"; - errorCodes25 = [ - Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code, + errorCodes26 = [ + Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value.code, Diagnostics.Type_0_is_not_assignable_to_type_1.code, Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code ]; registerCodeFix({ - errorCodes: errorCodes25, + errorCodes: errorCodes26, fixIds: [fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen], getCodeActions: function getCodeActionsToCorrectReturnValue(context) { const { program, sourceFile, span: { start }, errorCode } = context; - const info = getInfo6(program.getTypeChecker(), sourceFile, start, errorCode); + const info = getInfo9(program.getTypeChecker(), sourceFile, start, errorCode); if (!info) return void 0; if (info.kind === 0 /* MissingReturnStatement */) { @@ -142560,8 +149148,8 @@ ${lanes.join("\n")} return [getActionForfixWrapTheBlockWithParen(context, info.declaration, info.expression)]; } }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes25, (changes, diag2) => { - const info = getInfo6(context.program.getTypeChecker(), diag2.file, diag2.start, diag2.code); + getAllCodeActions: (context) => codeFixAll(context, errorCodes26, (changes, diag2) => { + const info = getInfo9(context.program.getTypeChecker(), diag2.file, diag2.start, diag2.code); if (!info) return void 0; switch (context.fixId) { @@ -142577,7 +149165,7 @@ ${lanes.join("\n")} info.declaration, info.expression, info.commentSource, - /* withParen */ + /*withParen*/ false ); break; @@ -142595,12 +149183,12 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixAddMissingMember.ts - function getInfo7(sourceFile, tokenPos, errorCode, checker, program) { - var _a2; + function getInfo10(sourceFile, tokenPos, errorCode, checker, program) { + var _a; const token = getTokenAtPosition(sourceFile, tokenPos); const parent2 = token.parent; if (errorCode === Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code) { - if (!(token.kind === 18 /* OpenBraceToken */ && isObjectLiteralExpression(parent2) && isCallExpression(parent2.parent))) + if (!(token.kind === 19 /* OpenBraceToken */ && isObjectLiteralExpression(parent2) && isCallExpression(parent2.parent))) return void 0; const argIndex = findIndex(parent2.parent.arguments, (arg) => arg === parent2); if (argIndex < 0) @@ -142614,9 +149202,9 @@ ${lanes.join("\n")} const properties = arrayFrom(checker.getUnmatchedProperties( checker.getTypeAtLocation(parent2), checker.getParameterType(signature, argIndex), - /* requireOptionalProperties */ + /*requireOptionalProperties*/ false, - /* matchDiscriminantProperties */ + /*matchDiscriminantProperties*/ false )); if (!length(properties)) @@ -142626,12 +149214,13 @@ ${lanes.join("\n")} if (!isMemberName(token)) return void 0; if (isIdentifier(token) && hasInitializer(parent2) && parent2.initializer && isObjectLiteralExpression(parent2.initializer)) { + const targetType = checker.getContextualType(token) || checker.getTypeAtLocation(token); const properties = arrayFrom(checker.getUnmatchedProperties( checker.getTypeAtLocation(parent2.initializer), - checker.getTypeAtLocation(token), - /* requireOptionalProperties */ + targetType, + /*requireOptionalProperties*/ false, - /* matchDiscriminantProperties */ + /*matchDiscriminantProperties*/ false )); if (!length(properties)) @@ -142646,7 +149235,7 @@ ${lanes.join("\n")} return { kind: 4 /* JsxAttributes */, token, attributes, parentDeclaration: token.parent }; } if (isIdentifier(token)) { - const type = (_a2 = checker.getContextualType(token)) == null ? void 0 : _a2.getNonNullableType(); + const type = (_a = checker.getContextualType(token)) == null ? void 0 : _a.getNonNullableType(); if (type && getObjectFlags(type) & 16 /* Anonymous */) { const signature = firstOrUndefined(checker.getSignaturesOfType(type, 0 /* Call */)); if (signature === void 0) @@ -142713,7 +149302,7 @@ ${lanes.join("\n")} function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) { const tokenName = token.text; if (makeStatic) { - if (classDeclaration.kind === 228 /* ClassExpression */) { + if (classDeclaration.kind === 230 /* ClassExpression */) { return; } const className = classDeclaration.name.getText(); @@ -142724,7 +149313,7 @@ ${lanes.join("\n")} /*modifiers*/ void 0, tokenName, - /*questionToken*/ + /*questionOrExclamationToken*/ void 0, /*type*/ void 0, @@ -142766,7 +149355,7 @@ ${lanes.join("\n")} } function getTypeNode2(checker, node, token) { let typeNode; - if (token.parent.parent.kind === 223 /* BinaryExpression */) { + if (token.parent.parent.kind === 225 /* BinaryExpression */) { const binaryExpression = token.parent.parent; const otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left; const widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression))); @@ -142780,14 +149369,14 @@ ${lanes.join("\n")} 1 /* NoTruncation */ ) : void 0; } - return typeNode || factory.createKeywordTypeNode(131 /* AnyKeyword */); + return typeNode || factory.createKeywordTypeNode(133 /* AnyKeyword */); } function addPropertyDeclaration(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags) { const modifiers = modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : void 0; const property = isClassLike(node) ? factory.createPropertyDeclaration( modifiers, tokenName, - /*questionToken*/ + /*questionOrExclamationToken*/ void 0, typeNode, /*initializer*/ @@ -142817,7 +149406,7 @@ ${lanes.join("\n")} return res; } function createAddIndexSignatureAction(context, sourceFile, node, tokenName, typeNode) { - const stringTypeNode = factory.createKeywordTypeNode(152 /* StringKeyword */); + const stringTypeNode = factory.createKeywordTypeNode(154 /* StringKeyword */); const indexingParameter = factory.createParameterDeclaration( /*modifiers*/ void 0, @@ -142857,7 +149446,7 @@ ${lanes.join("\n")} } function addMethodDeclaration(context, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) { const importAdder = createImportAdder(sourceFile, context.program, context.preferences, context.host); - const kind = isClassLike(parentDeclaration) ? 171 /* MethodDeclaration */ : 170 /* MethodSignature */; + const kind = isClassLike(parentDeclaration) ? 173 /* MethodDeclaration */ : 172 /* MethodSignature */; const signatureDeclaration = createSignatureDeclarationFromCallExpression(kind, context, importAdder, callExpression, name, modifierFlags, parentDeclaration); const containingMethodDeclaration = tryGetContainingMethodDeclaration(parentDeclaration, callExpression); if (containingMethodDeclaration) { @@ -142886,8 +149475,8 @@ ${lanes.join("\n")} function addFunctionDeclaration(changes, context, info) { const quotePreference = getQuotePreference(context.sourceFile, context.preferences); const importAdder = createImportAdder(context.sourceFile, context.program, context.preferences, context.host); - const functionDeclaration = info.kind === 2 /* Function */ ? createSignatureDeclarationFromCallExpression(259 /* FunctionDeclaration */, context, importAdder, info.call, idText(info.token), info.modifierFlags, info.parentDeclaration) : createSignatureDeclarationFromSignature( - 259 /* FunctionDeclaration */, + const functionDeclaration = info.kind === 2 /* Function */ ? createSignatureDeclarationFromCallExpression(261 /* FunctionDeclaration */, context, importAdder, info.call, idText(info.token), info.modifierFlags, info.parentDeclaration) : createSignatureDeclarationFromSignature( + 261 /* FunctionDeclaration */, context, quotePreference, info.signature, @@ -143012,7 +149601,7 @@ ${lanes.join("\n")} } if (type.flags & 1048576 /* Union */) { const expression = firstDefined(type.types, (t) => tryGetValueFromType(context, checker, importAdder, quotePreference, t, enclosingDeclaration)); - return expression != null ? expression : createUndefined(); + return expression ?? createUndefined(); } if (checker.isArrayLikeType(type)) { return factory.createArrayLiteralExpression(); @@ -143036,7 +149625,7 @@ ${lanes.join("\n")} if (signature === void 0) return createUndefined(); const func = createSignatureDeclarationFromSignature( - 215 /* FunctionExpression */, + 217 /* FunctionExpression */, context, quotePreference, signature[0], @@ -143051,7 +149640,7 @@ ${lanes.join("\n")} enclosingDeclaration, importAdder ); - return func != null ? func : createUndefined(); + return func ?? createUndefined(); } if (getObjectFlags(type) & 1 /* Class */) { const classDeclaration = getClassLikeDeclarationOfSymbol(type.symbol); @@ -143086,7 +149675,7 @@ ${lanes.join("\n")} const seenNames = /* @__PURE__ */ new Set(); for (const sourceProp of source.attributes.properties) { if (isJsxAttribute(sourceProp)) { - seenNames.add(sourceProp.name.escapedText); + seenNames.add(getEscapedTextOfJsxAttributeName(sourceProp.name)); } if (isJsxSpreadAttribute(sourceProp)) { const type = checker.getTypeAtLocation(sourceProp.expression); @@ -143126,7 +149715,7 @@ ${lanes.join("\n")} } return getSourceFileOfNode(node); } - var fixMissingMember, fixMissingProperties, fixMissingAttributes, fixMissingFunctionDeclaration, errorCodes26; + var fixMissingMember, fixMissingProperties, fixMissingAttributes, fixMissingFunctionDeclaration, errorCodes27; var init_fixAddMissingMember = __esm({ "src/services/codefixes/fixAddMissingMember.ts"() { "use strict"; @@ -143136,7 +149725,7 @@ ${lanes.join("\n")} fixMissingProperties = "fixMissingProperties"; fixMissingAttributes = "fixMissingAttributes"; fixMissingFunctionDeclaration = "fixMissingFunctionDeclaration"; - errorCodes26 = [ + errorCodes27 = [ Diagnostics.Property_0_does_not_exist_on_type_1.code, Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code, Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2.code, @@ -143146,10 +149735,10 @@ ${lanes.join("\n")} Diagnostics.Cannot_find_name_0.code ]; registerCodeFix({ - errorCodes: errorCodes26, + errorCodes: errorCodes27, getCodeActions(context) { const typeChecker = context.program.getTypeChecker(); - const info = getInfo7(context.sourceFile, context.span.start, context.errorCode, typeChecker, context.program); + const info = getInfo10(context.sourceFile, context.span.start, context.errorCode, typeChecker, context.program); if (!info) { return void 0; } @@ -143173,21 +149762,21 @@ ${lanes.join("\n")} }, fixIds: [fixMissingMember, fixMissingFunctionDeclaration, fixMissingProperties, fixMissingAttributes], getAllCodeActions: (context) => { - const { program, fixId: fixId51 } = context; + const { program, fixId: fixId52 } = context; const checker = program.getTypeChecker(); const seen = /* @__PURE__ */ new Map(); const typeDeclToMembers = /* @__PURE__ */ new Map(); return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => { - eachDiagnostic(context, errorCodes26, (diag2) => { - const info = getInfo7(diag2.file, diag2.start, diag2.code, checker, context.program); + eachDiagnostic(context, errorCodes27, (diag2) => { + const info = getInfo10(diag2.file, diag2.start, diag2.code, checker, context.program); if (!info || !addToSeen(seen, getNodeId(info.parentDeclaration) + "#" + info.token.text)) { return; } - if (fixId51 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) { + if (fixId52 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) { addFunctionDeclaration(changes, context, info); - } else if (fixId51 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) { + } else if (fixId52 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) { addObjectLiteralProperties(changes, context, info); - } else if (fixId51 === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) { + } else if (fixId52 === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) { addJsxAttributes(changes, context, info); } else { if (info.kind === 1 /* Enum */) { @@ -143243,23 +149832,23 @@ ${lanes.join("\n")} } return token; } - var fixId23, errorCodes27; + var fixId24, errorCodes28; var init_fixAddMissingNewOperator = __esm({ "src/services/codefixes/fixAddMissingNewOperator.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId23 = "addMissingNewOperator"; - errorCodes27 = [Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code]; + fixId24 = "addMissingNewOperator"; + errorCodes28 = [Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code]; registerCodeFix({ - errorCodes: errorCodes27, + errorCodes: errorCodes28, getCodeActions(context) { const { sourceFile, span } = context; const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingNewOperator(t, sourceFile, span)); - return [createCodeFixAction(fixId23, changes, Diagnostics.Add_missing_new_operator_to_call, fixId23, Diagnostics.Add_missing_new_operator_to_all_calls)]; + return [createCodeFixAction(fixId24, changes, Diagnostics.Add_missing_new_operator_to_call, fixId24, Diagnostics.Add_missing_new_operator_to_all_calls)]; }, - fixIds: [fixId23], - getAllCodeActions: (context) => codeFixAll(context, errorCodes27, (changes, diag2) => addMissingNewOperator(changes, context.sourceFile, diag2)) + fixIds: [fixId24], + getAllCodeActions: (context) => codeFixAll(context, errorCodes28, (changes, diag2) => addMissingNewOperator(changes, context.sourceFile, diag2)) }); } }); @@ -143277,10 +149866,10 @@ ${lanes.join("\n")} return isExternalModuleNameRelative(packageName) ? void 0 : packageName; } function getTypesPackageNameToInstall(packageName, host, diagCode) { - var _a2; - return diagCode === errorCodeCannotFindModule ? ts_JsTyping_exports.nodeCoreModules.has(packageName) ? "@types/node" : void 0 : ((_a2 = host.isKnownTypesPackageName) == null ? void 0 : _a2.call(host, packageName)) ? getTypesPackageName(packageName) : void 0; + var _a; + return diagCode === errorCodeCannotFindModule ? ts_JsTyping_exports.nodeCoreModules.has(packageName) ? "@types/node" : void 0 : ((_a = host.isKnownTypesPackageName) == null ? void 0 : _a.call(host, packageName)) ? getTypesPackageName(packageName) : void 0; } - var fixName2, fixIdInstallTypesPackage, errorCodeCannotFindModule, errorCodes28; + var fixName2, fixIdInstallTypesPackage, errorCodeCannotFindModule, errorCodes29; var init_fixCannotFindModule = __esm({ "src/services/codefixes/fixCannotFindModule.ts"() { "use strict"; @@ -143289,12 +149878,12 @@ ${lanes.join("\n")} fixName2 = "fixCannotFindModule"; fixIdInstallTypesPackage = "installTypesPackage"; errorCodeCannotFindModule = Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code; - errorCodes28 = [ + errorCodes29 = [ errorCodeCannotFindModule, Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code ]; registerCodeFix({ - errorCodes: errorCodes28, + errorCodes: errorCodes29, getCodeActions: function getCodeActionsToFixNotFoundModule(context) { const { host, sourceFile, span: { start } } = context; const packageName = tryGetImportedPackageName(sourceFile, start); @@ -143313,7 +149902,7 @@ ${lanes.join("\n")} }, fixIds: [fixIdInstallTypesPackage], getAllCodeActions: (context) => { - return codeFixAll(context, errorCodes28, (_changes, diag2, commands) => { + return codeFixAll(context, errorCodes29, (_changes, diag2, commands) => { const packageName = tryGetImportedPackageName(diag2.file, diag2.start); if (packageName === void 0) return void 0; @@ -143352,28 +149941,27 @@ ${lanes.join("\n")} const flags = getSyntacticModifierFlags(first(symbol.getDeclarations())); return !(flags & 8 /* Private */) && !!(flags & 256 /* Abstract */); } - var errorCodes29, fixId24; + var errorCodes30, fixId25; var init_fixClassDoesntImplementInheritedAbstractMember = __esm({ "src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - errorCodes29 = [ - Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code, - Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code + errorCodes30 = [ + Diagnostics.Non_abstract_class_0_does_not_implement_all_abstract_members_of_1.code ]; - fixId24 = "fixClassDoesntImplementInheritedAbstractMember"; + fixId25 = "fixClassDoesntImplementInheritedAbstractMember"; registerCodeFix({ - errorCodes: errorCodes29, + errorCodes: errorCodes30, getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) { const { sourceFile, span } = context; const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingMembers(getClass2(sourceFile, span.start), sourceFile, context, t, context.preferences)); - return changes.length === 0 ? void 0 : [createCodeFixAction(fixId24, changes, Diagnostics.Implement_inherited_abstract_class, fixId24, Diagnostics.Implement_all_inherited_abstract_classes)]; + return changes.length === 0 ? void 0 : [createCodeFixAction(fixId25, changes, Diagnostics.Implement_inherited_abstract_class, fixId25, Diagnostics.Implement_all_inherited_abstract_classes)]; }, - fixIds: [fixId24], + fixIds: [fixId25], getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) { const seenClassDeclarations = /* @__PURE__ */ new Map(); - return codeFixAll(context, errorCodes29, (changes, diag2) => { + return codeFixAll(context, errorCodes30, (changes, diag2) => { const classDeclaration = getClass2(diag2.file, diag2.start); if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) { addMissingMembers(classDeclaration, context.sourceFile, context, changes, context.preferences); @@ -143385,13 +149973,13 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts - function doChange11(changes, sourceFile, constructor, superCall) { + function doChange19(changes, sourceFile, constructor, superCall) { changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall); changes.delete(sourceFile, superCall); } function getNodes(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); - if (token.kind !== 108 /* ThisKeyword */) + if (token.kind !== 110 /* ThisKeyword */) return void 0; const constructor = getContainingFunction(token); const superCall = findSuperCall(constructor.body); @@ -143400,36 +149988,36 @@ ${lanes.join("\n")} function findSuperCall(n) { return isExpressionStatement(n) && isSuperCall(n.expression) ? n : isFunctionLike(n) ? void 0 : forEachChild(n, findSuperCall); } - var fixId25, errorCodes30; + var fixId26, errorCodes31; var init_fixClassSuperMustPrecedeThisAccess = __esm({ "src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId25 = "classSuperMustPrecedeThisAccess"; - errorCodes30 = [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code]; + fixId26 = "classSuperMustPrecedeThisAccess"; + errorCodes31 = [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code]; registerCodeFix({ - errorCodes: errorCodes30, + errorCodes: errorCodes31, getCodeActions(context) { const { sourceFile, span } = context; const nodes = getNodes(sourceFile, span.start); if (!nodes) return void 0; const { constructor, superCall } = nodes; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, sourceFile, constructor, superCall)); - return [createCodeFixAction(fixId25, changes, Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId25, Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, sourceFile, constructor, superCall)); + return [createCodeFixAction(fixId26, changes, Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId26, Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)]; }, - fixIds: [fixId25], + fixIds: [fixId26], getAllCodeActions(context) { const { sourceFile } = context; const seenClasses = /* @__PURE__ */ new Map(); - return codeFixAll(context, errorCodes30, (changes, diag2) => { + return codeFixAll(context, errorCodes31, (changes, diag2) => { const nodes = getNodes(diag2.file, diag2.start); if (!nodes) return; const { constructor, superCall } = nodes; if (addToSeen(seenClasses, getNodeId(constructor.parent))) { - doChange11(changes, sourceFile, constructor, superCall); + doChange19(changes, sourceFile, constructor, superCall); } }); } @@ -143443,7 +150031,7 @@ ${lanes.join("\n")} Debug.assert(isConstructorDeclaration(token.parent), "token should be at the constructor declaration"); return token.parent; } - function doChange12(changes, sourceFile, ctr) { + function doChange20(changes, sourceFile, ctr) { const superCall = factory.createExpressionStatement(factory.createCallExpression( factory.createSuper(), /*typeArguments*/ @@ -143453,42 +150041,42 @@ ${lanes.join("\n")} )); changes.insertNodeAtConstructorStart(sourceFile, ctr, superCall); } - var fixId26, errorCodes31; + var fixId27, errorCodes32; var init_fixConstructorForDerivedNeedSuperCall = __esm({ "src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId26 = "constructorForDerivedNeedSuperCall"; - errorCodes31 = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code]; + fixId27 = "constructorForDerivedNeedSuperCall"; + errorCodes32 = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code]; registerCodeFix({ - errorCodes: errorCodes31, + errorCodes: errorCodes32, getCodeActions(context) { const { sourceFile, span } = context; const ctr = getNode(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, sourceFile, ctr)); - return [createCodeFixAction(fixId26, changes, Diagnostics.Add_missing_super_call, fixId26, Diagnostics.Add_all_missing_super_calls)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, sourceFile, ctr)); + return [createCodeFixAction(fixId27, changes, Diagnostics.Add_missing_super_call, fixId27, Diagnostics.Add_all_missing_super_calls)]; }, - fixIds: [fixId26], - getAllCodeActions: (context) => codeFixAll(context, errorCodes31, (changes, diag2) => doChange12(changes, context.sourceFile, getNode(diag2.file, diag2.start))) + fixIds: [fixId27], + getAllCodeActions: (context) => codeFixAll(context, errorCodes32, (changes, diag2) => doChange20(changes, context.sourceFile, getNode(diag2.file, diag2.start))) }); } }); // src/services/codefixes/fixEnableJsxFlag.ts - function doChange13(changeTracker, configFile) { + function doChange21(changeTracker, configFile) { setJsonCompilerOptionValue(changeTracker, configFile, "jsx", factory.createStringLiteral("react")); } - var fixID, errorCodes32; + var fixID, errorCodes33; var init_fixEnableJsxFlag = __esm({ "src/services/codefixes/fixEnableJsxFlag.ts"() { "use strict"; init_ts4(); init_ts_codefix(); fixID = "fixEnableJsxFlag"; - errorCodes32 = [Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code]; + errorCodes33 = [Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code]; registerCodeFix({ - errorCodes: errorCodes32, + errorCodes: errorCodes33, getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) { const { configFile } = context.program.getCompilerOptions(); if (configFile === void 0) { @@ -143496,26 +150084,26 @@ ${lanes.join("\n")} } const changes = ts_textChanges_exports.ChangeTracker.with( context, - (changeTracker) => doChange13(changeTracker, configFile) + (changeTracker) => doChange21(changeTracker, configFile) ); return [ createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file) ]; }, fixIds: [fixID], - getAllCodeActions: (context) => codeFixAll(context, errorCodes32, (changes) => { + getAllCodeActions: (context) => codeFixAll(context, errorCodes33, (changes) => { const { configFile } = context.program.getCompilerOptions(); if (configFile === void 0) { return void 0; } - doChange13(changes, configFile); + doChange21(changes, configFile); }) }); } }); // src/services/codefixes/fixNaNEquality.ts - function getInfo8(program, sourceFile, span) { + function getInfo11(program, sourceFile, span) { const diag2 = find(program.getSemanticDiagnostics(sourceFile), (diag3) => diag3.start === span.start && diag3.length === span.length); if (diag2 === void 0 || diag2.relatedInformation === void 0) return; @@ -143530,7 +150118,7 @@ ${lanes.join("\n")} } return void 0; } - function doChange14(changes, sourceFile, arg, expression) { + function doChange22(changes, sourceFile, arg, expression) { const callExpression = factory.createCallExpression( factory.createPropertyAccessExpression(factory.createIdentifier("Number"), factory.createIdentifier("isNaN")), /*typeArguments*/ @@ -143541,40 +150129,40 @@ ${lanes.join("\n")} changes.replaceNode( sourceFile, expression, - operator === 37 /* ExclamationEqualsEqualsToken */ || operator === 35 /* ExclamationEqualsToken */ ? factory.createPrefixUnaryExpression(53 /* ExclamationToken */, callExpression) : callExpression + operator === 38 /* ExclamationEqualsEqualsToken */ || operator === 36 /* ExclamationEqualsToken */ ? factory.createPrefixUnaryExpression(54 /* ExclamationToken */, callExpression) : callExpression ); } function getSuggestion(messageText) { const [_, suggestion] = flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || []; return suggestion; } - var fixId27, errorCodes33; + var fixId28, errorCodes34; var init_fixNaNEquality = __esm({ "src/services/codefixes/fixNaNEquality.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId27 = "fixNaNEquality"; - errorCodes33 = [ + fixId28 = "fixNaNEquality"; + errorCodes34 = [ Diagnostics.This_condition_will_always_return_0.code ]; registerCodeFix({ - errorCodes: errorCodes33, + errorCodes: errorCodes34, getCodeActions(context) { const { sourceFile, span, program } = context; - const info = getInfo8(program, sourceFile, span); + const info = getInfo11(program, sourceFile, span); if (info === void 0) return; const { suggestion, expression, arg } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange14(t, sourceFile, arg, expression)); - return [createCodeFixAction(fixId27, changes, [Diagnostics.Use_0, suggestion], fixId27, Diagnostics.Use_Number_isNaN_in_all_conditions)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange22(t, sourceFile, arg, expression)); + return [createCodeFixAction(fixId28, changes, [Diagnostics.Use_0, suggestion], fixId28, Diagnostics.Use_Number_isNaN_in_all_conditions)]; }, - fixIds: [fixId27], + fixIds: [fixId28], getAllCodeActions: (context) => { - return codeFixAll(context, errorCodes33, (changes, diag2) => { - const info = getInfo8(context.program, diag2.file, createTextSpan(diag2.start, diag2.length)); + return codeFixAll(context, errorCodes34, (changes, diag2) => { + const info = getInfo11(context.program, diag2.file, createTextSpan(diag2.start, diag2.length)); if (info) { - doChange14(changes, diag2.file, info.arg, info.expression); + doChange22(changes, diag2.file, info.arg, info.expression); } }); } @@ -143630,32 +150218,32 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixPropertyAssignment.ts - function doChange15(changes, sourceFile, node) { + function doChange23(changes, sourceFile, node) { changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer)); } function getProperty2(sourceFile, pos) { return cast(getTokenAtPosition(sourceFile, pos).parent, isShorthandPropertyAssignment); } - var fixId28, errorCodes34; + var fixId29, errorCodes35; var init_fixPropertyAssignment = __esm({ "src/services/codefixes/fixPropertyAssignment.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId28 = "fixPropertyAssignment"; - errorCodes34 = [ + fixId29 = "fixPropertyAssignment"; + errorCodes35 = [ 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.code ]; registerCodeFix({ - errorCodes: errorCodes34, - fixIds: [fixId28], + errorCodes: errorCodes35, + fixIds: [fixId29], getCodeActions(context) { const { sourceFile, span } = context; const property = getProperty2(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange15(t, context.sourceFile, property)); - return [createCodeFixAction(fixId28, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId28, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange23(t, context.sourceFile, property)); + return [createCodeFixAction(fixId29, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId29, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])]; }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes, diag2) => doChange15(changes, diag2.file, getProperty2(diag2.file, diag2.start))) + getAllCodeActions: (context) => codeFixAll(context, errorCodes35, (changes, diag2) => doChange23(changes, diag2.file, getProperty2(diag2.file, diag2.start))) }); } }); @@ -143665,14 +150253,14 @@ ${lanes.join("\n")} const token = getTokenAtPosition(sourceFile, pos); const heritageClauses = getContainingClass(token).heritageClauses; const extendsToken = heritageClauses[0].getFirstToken(); - return extendsToken.kind === 94 /* ExtendsKeyword */ ? { extendsToken, heritageClauses } : void 0; + return extendsToken.kind === 96 /* ExtendsKeyword */ ? { extendsToken, heritageClauses } : void 0; } function doChanges2(changes, sourceFile, extendsToken, heritageClauses) { - changes.replaceNode(sourceFile, extendsToken, factory.createToken(117 /* ImplementsKeyword */)); - if (heritageClauses.length === 2 && heritageClauses[0].token === 94 /* ExtendsKeyword */ && heritageClauses[1].token === 117 /* ImplementsKeyword */) { + changes.replaceNode(sourceFile, extendsToken, factory.createToken(119 /* ImplementsKeyword */)); + if (heritageClauses.length === 2 && heritageClauses[0].token === 96 /* ExtendsKeyword */ && heritageClauses[1].token === 119 /* ImplementsKeyword */) { const implementsToken = heritageClauses[1].getFirstToken(); const implementsFullStart = implementsToken.getFullStart(); - changes.replaceRange(sourceFile, { pos: implementsFullStart, end: implementsFullStart }, factory.createToken(27 /* CommaToken */)); + changes.replaceRange(sourceFile, { pos: implementsFullStart, end: implementsFullStart }, factory.createToken(28 /* CommaToken */)); const text = sourceFile.text; let end = implementsToken.end; while (end < text.length && isWhiteSpaceSingleLine(text.charCodeAt(end))) { @@ -143681,16 +150269,16 @@ ${lanes.join("\n")} changes.deleteRange(sourceFile, { pos: implementsToken.getStart(), end }); } } - var fixId29, errorCodes35; + var fixId30, errorCodes36; var init_fixExtendsInterfaceBecomesImplements = __esm({ "src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId29 = "extendsInterfaceBecomesImplements"; - errorCodes35 = [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code]; + fixId30 = "extendsInterfaceBecomesImplements"; + errorCodes36 = [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code]; registerCodeFix({ - errorCodes: errorCodes35, + errorCodes: errorCodes36, getCodeActions(context) { const { sourceFile } = context; const nodes = getNodes2(sourceFile, context.span.start); @@ -143698,10 +150286,10 @@ ${lanes.join("\n")} return void 0; const { extendsToken, heritageClauses } = nodes; const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChanges2(t, sourceFile, extendsToken, heritageClauses)); - return [createCodeFixAction(fixId29, changes, Diagnostics.Change_extends_to_implements, fixId29, Diagnostics.Change_all_extended_interfaces_to_implements)]; + return [createCodeFixAction(fixId30, changes, Diagnostics.Change_extends_to_implements, fixId30, Diagnostics.Change_all_extended_interfaces_to_implements)]; }, - fixIds: [fixId29], - getAllCodeActions: (context) => codeFixAll(context, errorCodes35, (changes, diag2) => { + fixIds: [fixId30], + getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => { const nodes = getNodes2(diag2.file, diag2.start); if (nodes) doChanges2(changes, diag2.file, nodes.extendsToken, nodes.heritageClauses); @@ -143711,45 +150299,45 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixForgottenThisPropertyAccess.ts - function getInfo9(sourceFile, pos, diagCode) { + function getInfo12(sourceFile, pos, diagCode) { const node = getTokenAtPosition(sourceFile, pos); if (isIdentifier(node) || isPrivateIdentifier(node)) { return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 }; } } - function doChange16(changes, sourceFile, { node, className }) { + function doChange24(changes, sourceFile, { node, className }) { suppressLeadingAndTrailingTrivia(node); changes.replaceNode(sourceFile, node, factory.createPropertyAccessExpression(className ? factory.createIdentifier(className) : factory.createThis(), node)); } - var fixId30, didYouMeanStaticMemberCode, errorCodes36; + var fixId31, didYouMeanStaticMemberCode, errorCodes37; var init_fixForgottenThisPropertyAccess = __esm({ "src/services/codefixes/fixForgottenThisPropertyAccess.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId30 = "forgottenThisPropertyAccess"; + fixId31 = "forgottenThisPropertyAccess"; didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code; - errorCodes36 = [ + errorCodes37 = [ Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code, Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.code, didYouMeanStaticMemberCode ]; registerCodeFix({ - errorCodes: errorCodes36, + errorCodes: errorCodes37, getCodeActions(context) { const { sourceFile } = context; - const info = getInfo9(sourceFile, context.span.start, context.errorCode); + const info = getInfo12(sourceFile, context.span.start, context.errorCode); if (!info) { return void 0; } - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(t, sourceFile, info)); - return [createCodeFixAction(fixId30, changes, [Diagnostics.Add_0_to_unresolved_variable, info.className || "this"], fixId30, Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange24(t, sourceFile, info)); + return [createCodeFixAction(fixId31, changes, [Diagnostics.Add_0_to_unresolved_variable, info.className || "this"], fixId31, Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)]; }, - fixIds: [fixId30], - getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => { - const info = getInfo9(diag2.file, diag2.start, diag2.code); + fixIds: [fixId31], + getAllCodeActions: (context) => codeFixAll(context, errorCodes37, (changes, diag2) => { + const info = getInfo12(diag2.file, diag2.start, diag2.code); if (info) - doChange16(changes, context.sourceFile, info); + doChange24(changes, context.sourceFile, info); }) }); } @@ -143759,7 +150347,7 @@ ${lanes.join("\n")} function isValidCharacter(character) { return hasProperty(htmlEntity, character); } - function doChange17(changes, preferences, sourceFile, start, useHtmlEntity) { + function doChange25(changes, preferences, sourceFile, start, useHtmlEntity) { const character = sourceFile.getText()[start]; if (!isValidCharacter(character)) { return; @@ -143767,7 +150355,7 @@ ${lanes.join("\n")} const replacement = useHtmlEntity ? htmlEntity[character] : `{${quote(sourceFile, preferences, character)}}`; changes.replaceRangeWithText(sourceFile, { pos: start, end: start + 1 }, replacement); } - var fixIdExpression, fixIdHtmlEntity, errorCodes37, htmlEntity; + var fixIdExpression, fixIdHtmlEntity, errorCodes38, htmlEntity; var init_fixInvalidJsxCharacters = __esm({ "src/services/codefixes/fixInvalidJsxCharacters.ts"() { "use strict"; @@ -143775,29 +150363,29 @@ ${lanes.join("\n")} init_ts_codefix(); fixIdExpression = "fixInvalidJsxCharacters_expression"; fixIdHtmlEntity = "fixInvalidJsxCharacters_htmlEntity"; - errorCodes37 = [ + errorCodes38 = [ Diagnostics.Unexpected_token_Did_you_mean_or_gt.code, Diagnostics.Unexpected_token_Did_you_mean_or_rbrace.code ]; registerCodeFix({ - errorCodes: errorCodes37, + errorCodes: errorCodes38, fixIds: [fixIdExpression, fixIdHtmlEntity], getCodeActions(context) { const { sourceFile, preferences, span } = context; - const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17( + const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25( t, preferences, sourceFile, span.start, - /* useHtmlEntity */ + /*useHtmlEntity*/ false )); - const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17( + const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25( t, preferences, sourceFile, span.start, - /* useHtmlEntity */ + /*useHtmlEntity*/ true )); return [ @@ -143806,7 +150394,7 @@ ${lanes.join("\n")} ]; }, getAllCodeActions(context) { - return codeFixAll(context, errorCodes37, (changes, diagnostic) => doChange17(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity)); + return codeFixAll(context, errorCodes38, (changes, diagnostic) => doChange25(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity)); } }); htmlEntity = { @@ -143853,7 +150441,7 @@ ${lanes.join("\n")} const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, jsDocHost, map(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t))); return createCodeFixActionWithoutFixAll(renameUnmatchedParameter, changes, [Diagnostics.Rename_param_tag_name_0_to_1, name.getText(sourceFile), parameterName]); } - function getInfo10(sourceFile, pos) { + function getInfo13(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); if (token.parent && isJSDocParameterTag(token.parent) && isIdentifier(token.parent.name)) { const jsDocParameterTag = token.parent; @@ -143865,7 +150453,7 @@ ${lanes.join("\n")} } return void 0; } - var deleteUnmatchedParameter, renameUnmatchedParameter, errorCodes38; + var deleteUnmatchedParameter, renameUnmatchedParameter, errorCodes39; var init_fixUnmatchedParameter = __esm({ "src/services/codefixes/fixUnmatchedParameter.ts"() { "use strict"; @@ -143873,16 +150461,16 @@ ${lanes.join("\n")} init_ts_codefix(); deleteUnmatchedParameter = "deleteUnmatchedParameter"; renameUnmatchedParameter = "renameUnmatchedParameter"; - errorCodes38 = [ + errorCodes39 = [ Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name.code ]; registerCodeFix({ fixIds: [deleteUnmatchedParameter, renameUnmatchedParameter], - errorCodes: errorCodes38, + errorCodes: errorCodes39, getCodeActions: function getCodeActionsToFixUnmatchedParameter(context) { const { sourceFile, span } = context; const actions2 = []; - const info = getInfo10(sourceFile, span.start); + const info = getInfo13(sourceFile, span.start); if (info) { append(actions2, getDeleteAction(context, info)); append(actions2, getRenameAction(context, info)); @@ -143893,8 +150481,8 @@ ${lanes.join("\n")} getAllCodeActions: function getAllCodeActionsToFixUnmatchedParameter(context) { const tagsToSignature = /* @__PURE__ */ new Map(); return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => { - eachDiagnostic(context, errorCodes38, ({ file, start }) => { - const info = getInfo10(file, start); + eachDiagnostic(context, errorCodes39, ({ file, start }) => { + const info = getInfo13(file, start); if (info) { tagsToSignature.set(info.signature, append(tagsToSignature.get(info.signature), info.jsDocParameterTag)); } @@ -143914,18 +150502,18 @@ ${lanes.join("\n")} // src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts function getImportDeclaration(sourceFile, program, start) { const identifier = tryCast(getTokenAtPosition(sourceFile, start), isIdentifier); - if (!identifier || identifier.parent.kind !== 180 /* TypeReference */) + if (!identifier || identifier.parent.kind !== 182 /* TypeReference */) return; const checker = program.getTypeChecker(); const symbol = checker.getSymbolAtLocation(identifier); return find((symbol == null ? void 0 : symbol.declarations) || emptyArray, or(isImportClause, isImportSpecifier, isImportEqualsDeclaration)); } function doTypeOnlyImportChange(changes, sourceFile, importDeclaration, program) { - if (importDeclaration.kind === 268 /* ImportEqualsDeclaration */) { - changes.insertModifierBefore(sourceFile, 154 /* TypeKeyword */, importDeclaration.name); + if (importDeclaration.kind === 270 /* ImportEqualsDeclaration */) { + changes.insertModifierBefore(sourceFile, 156 /* TypeKeyword */, importDeclaration.name); return; } - const importClause = importDeclaration.kind === 270 /* ImportClause */ ? importDeclaration : importDeclaration.parent.parent; + const importClause = importDeclaration.kind === 272 /* ImportClause */ ? importDeclaration : importDeclaration.parent.parent; if (importClause.name && importClause.namedBindings) { return; } @@ -143937,44 +150525,44 @@ ${lanes.join("\n")} if (importsValue) { return; } - changes.insertModifierBefore(sourceFile, 154 /* TypeKeyword */, importClause); + changes.insertModifierBefore(sourceFile, 156 /* TypeKeyword */, importClause); } function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) { ts_refactor_exports.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent); } - var fixId31, errorCodes39; + var fixId32, errorCodes40; var init_fixUnreferenceableDecoratorMetadata = __esm({ "src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId31 = "fixUnreferenceableDecoratorMetadata"; - errorCodes39 = [Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled.code]; + fixId32 = "fixUnreferenceableDecoratorMetadata"; + errorCodes40 = [Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled.code]; registerCodeFix({ - errorCodes: errorCodes39, + errorCodes: errorCodes40, getCodeActions: (context) => { const importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start); if (!importDeclaration) return; - const namespaceChanges = ts_textChanges_exports.ChangeTracker.with(context, (t) => importDeclaration.kind === 273 /* ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program)); + const namespaceChanges = ts_textChanges_exports.ChangeTracker.with(context, (t) => importDeclaration.kind === 275 /* ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program)); const typeOnlyChanges = ts_textChanges_exports.ChangeTracker.with(context, (t) => doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program)); let actions2; if (namespaceChanges.length) { - actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId31, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import)); + actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import)); } if (typeOnlyChanges.length) { - actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId31, typeOnlyChanges, Diagnostics.Convert_to_type_only_import)); + actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Convert_to_type_only_import)); } return actions2; }, - fixIds: [fixId31] + fixIds: [fixId32] }); } }); // src/services/codefixes/fixUnusedIdentifier.ts function changeInferToUnknown(changes, sourceFile, token) { - changes.replaceNode(sourceFile, token.parent, factory.createKeywordTypeNode(157 /* UnknownKeyword */)); + changes.replaceNode(sourceFile, token.parent, factory.createKeywordTypeNode(159 /* UnknownKeyword */)); } function createDeleteFix(changes, diag2) { return createCodeFixAction(fixName3, changes, diag2, fixIdDelete, Diagnostics.Delete_all_unused_declarations); @@ -143983,24 +150571,42 @@ ${lanes.join("\n")} changes.delete(sourceFile, Debug.checkDefined(cast(token.parent, isDeclarationWithTypeParameterChildren).typeParameters, "The type parameter to delete should exist")); } function isImport(token) { - return token.kind === 100 /* ImportKeyword */ || token.kind === 79 /* Identifier */ && (token.parent.kind === 273 /* ImportSpecifier */ || token.parent.kind === 270 /* ImportClause */); + return token.kind === 102 /* ImportKeyword */ || token.kind === 80 /* Identifier */ && (token.parent.kind === 275 /* ImportSpecifier */ || token.parent.kind === 272 /* ImportClause */); } function tryGetFullImport(token) { - return token.kind === 100 /* ImportKeyword */ ? tryCast(token.parent, isImportDeclaration) : void 0; + return token.kind === 102 /* ImportKeyword */ ? tryCast(token.parent, isImportDeclaration) : void 0; } function canDeleteEntireVariableStatement(sourceFile, token) { return isVariableDeclarationList(token.parent) && first(token.parent.getChildren(sourceFile)) === token; } function deleteEntireVariableStatement(changes, sourceFile, node) { - changes.delete(sourceFile, node.parent.kind === 240 /* VariableStatement */ ? node.parent : node); + changes.delete(sourceFile, node.parent.kind === 242 /* VariableStatement */ ? node.parent : node); } function deleteDestructuringElements(changes, sourceFile, node) { forEach(node.elements, (n) => changes.delete(sourceFile, n)); } + function deleteDestructuring(context, changes, sourceFile, { parent: parent2 }) { + if (isVariableDeclaration(parent2) && parent2.initializer && isCallLikeExpression(parent2.initializer)) { + if (isVariableDeclarationList(parent2.parent) && length(parent2.parent.declarations) > 1) { + const varStatement = parent2.parent.parent; + const pos = varStatement.getStart(sourceFile); + const end = varStatement.end; + changes.delete(sourceFile, parent2); + changes.insertNodeAt(sourceFile, end, parent2.initializer, { + prefix: getNewLineOrDefaultFromHost(context.host, context.formatContext.options) + sourceFile.text.slice(getPrecedingNonSpaceCharacterPosition(sourceFile.text, pos - 1), pos), + suffix: probablyUsesSemicolons(sourceFile) ? ";" : "" + }); + } else { + changes.replaceNode(sourceFile, parent2.parent, parent2.initializer); + } + } else { + changes.delete(sourceFile, parent2); + } + } function tryPrefixDeclaration(changes, errorCode, sourceFile, token) { if (errorCode === Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code) return; - if (token.kind === 138 /* InferKeyword */) { + if (token.kind === 140 /* InferKeyword */) { token = cast(token.parent, isInferTypeNode).typeParameter.name; } if (isIdentifier(token) && canPrefix(token)) { @@ -144016,14 +150622,14 @@ ${lanes.join("\n")} } function canPrefix(token) { switch (token.parent.kind) { - case 166 /* Parameter */: - case 165 /* TypeParameter */: + case 168 /* Parameter */: + case 167 /* TypeParameter */: return true; - case 257 /* VariableDeclaration */: { + case 259 /* VariableDeclaration */: { const varDecl = token.parent; switch (varDecl.parent.parent.kind) { - case 247 /* ForOfStatement */: - case 246 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 248 /* ForInStatement */: return true; } } @@ -144072,8 +150678,8 @@ ${lanes.join("\n")} function mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll) { const { parent: parent2 } = parameter; switch (parent2.kind) { - case 171 /* MethodDeclaration */: - case 173 /* Constructor */: + case 173 /* MethodDeclaration */: + case 175 /* Constructor */: const index = parent2.parameters.indexOf(parameter); const referent = isMethodDeclaration(parent2) ? parent2.name : parent2; const entries = ts_FindAllReferences_exports.Core.getReferencedSymbolsForNode(parent2.pos, referent, program, sourceFiles, cancellationToken); @@ -144091,18 +150697,18 @@ ${lanes.join("\n")} } } return true; - case 259 /* FunctionDeclaration */: { + case 261 /* FunctionDeclaration */: { if (parent2.name && isCallbackLike(checker, sourceFile, parent2.name)) { return isLastParameter(parent2, parameter, isFixAll); } return true; } - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: return isLastParameter(parent2, parameter, isFixAll); - case 175 /* SetAccessor */: + case 177 /* SetAccessor */: return false; - case 174 /* GetAccessor */: + case 176 /* GetAccessor */: return true; default: return Debug.failBadSyntaxKind(parent2); @@ -144120,7 +150726,7 @@ ${lanes.join("\n")} function mayDeleteExpression(node) { return (isBinaryExpression(node.parent) && node.parent.left === node || (isPostfixUnaryExpression(node.parent) || isPrefixUnaryExpression(node.parent)) && node.parent.operand === node) && isExpressionStatement(node.parent.parent); } - var fixName3, fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer, errorCodes40; + var fixName3, fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer, errorCodes41; var init_fixUnusedIdentifier = __esm({ "src/services/codefixes/fixUnusedIdentifier.ts"() { "use strict"; @@ -144131,7 +150737,7 @@ ${lanes.join("\n")} fixIdDelete = "unusedIdentifier_delete"; fixIdDeleteImports = "unusedIdentifier_deleteImports"; fixIdInfer = "unusedIdentifier_infer"; - errorCodes40 = [ + errorCodes41 = [ Diagnostics._0_is_declared_but_its_value_is_never_read.code, Diagnostics._0_is_declared_but_never_used.code, Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code, @@ -144141,7 +150747,7 @@ ${lanes.join("\n")} Diagnostics.All_type_parameters_are_unused.code ]; registerCodeFix({ - errorCodes: errorCodes40, + errorCodes: errorCodes41, getCodeActions(context) { const { errorCode, sourceFile, program, cancellationToken } = context; const checker = program.getTypeChecker(); @@ -144150,7 +150756,7 @@ ${lanes.join("\n")} if (isJSDocTemplateTag(token)) { return [createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context, (t) => t.delete(sourceFile, token)), Diagnostics.Remove_template_tag)]; } - if (token.kind === 29 /* LessThanToken */) { + if (token.kind === 30 /* LessThanToken */) { const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => deleteTypeParameters(t, sourceFile, token)); return [createDeleteFix(changes, Diagnostics.Remove_type_parameters)]; } @@ -144186,7 +150792,7 @@ ${lanes.join("\n")} ]; } return [ - createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context, (t) => t.delete(sourceFile, token.parent.parent)), Diagnostics.Remove_unused_destructuring_declaration) + createDeleteFix(ts_textChanges_exports.ChangeTracker.with(context, (t) => deleteDestructuring(context, t, sourceFile, token.parent)), Diagnostics.Remove_unused_destructuring_declaration) ]; } if (canDeleteEntireVariableStatement(sourceFile, token)) { @@ -144195,7 +150801,7 @@ ${lanes.join("\n")} ]; } const result = []; - if (token.kind === 138 /* InferKeyword */) { + if (token.kind === 140 /* InferKeyword */) { const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => changeInferToUnknown(t, sourceFile, token)); const name = cast(token.parent, isInferTypeNode).typeParameter.name.text; result.push(createCodeFixAction(fixName3, changes, [Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, Diagnostics.Replace_all_unused_infer_with_unknown)); @@ -144227,7 +150833,7 @@ ${lanes.join("\n")} const { sourceFile, program, cancellationToken } = context; const checker = program.getTypeChecker(); const sourceFiles = program.getSourceFiles(); - return codeFixAll(context, errorCodes40, (changes, diag2) => { + return codeFixAll(context, errorCodes41, (changes, diag2) => { const token = getTokenAtPosition(sourceFile, diag2.start); switch (context.fixId) { case fixIdPrefix: @@ -144253,11 +150859,11 @@ ${lanes.join("\n")} break; } case fixIdDelete: { - if (token.kind === 138 /* InferKeyword */ || isImport(token)) { + if (token.kind === 140 /* InferKeyword */ || isImport(token)) { break; } else if (isJSDocTemplateTag(token)) { changes.delete(sourceFile, token); - } else if (token.kind === 29 /* LessThanToken */) { + } else if (token.kind === 30 /* LessThanToken */) { deleteTypeParameters(changes, sourceFile, token); } else if (isObjectBindingPattern(token.parent)) { if (token.parent.parent.initializer) { @@ -144285,7 +150891,7 @@ ${lanes.join("\n")} break; } case fixIdInfer: - if (token.kind === 138 /* InferKeyword */) { + if (token.kind === 140 /* InferKeyword */) { changeInferToUnknown(changes, sourceFile, token); } break; @@ -144299,7 +150905,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixUnreachableCode.ts - function doChange18(changes, sourceFile, start, length2, errorCode) { + function doChange26(changes, sourceFile, start, length2, errorCode) { const token = getTokenAtPosition(sourceFile, start); const statement = findAncestor(token, isStatement); if (statement.getStart(sourceFile) !== token.getStart(sourceFile)) { @@ -144315,7 +150921,7 @@ ${lanes.join("\n")} const container = (isBlock(statement.parent) ? statement.parent : statement).parent; if (!isBlock(statement.parent) || statement === first(statement.parent.statements)) { switch (container.kind) { - case 242 /* IfStatement */: + case 244 /* IfStatement */: if (container.elseStatement) { if (isBlock(statement.parent)) { break; @@ -144324,8 +150930,8 @@ ${lanes.join("\n")} } return; } - case 244 /* WhileStatement */: - case 245 /* ForStatement */: + case 246 /* WhileStatement */: + case 247 /* ForStatement */: changes.delete(sourceFile, container); return; } @@ -144347,65 +150953,65 @@ ${lanes.join("\n")} } return last2; } - var fixId32, errorCodes41; + var fixId33, errorCodes42; var init_fixUnreachableCode = __esm({ "src/services/codefixes/fixUnreachableCode.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId32 = "fixUnreachableCode"; - errorCodes41 = [Diagnostics.Unreachable_code_detected.code]; + fixId33 = "fixUnreachableCode"; + errorCodes42 = [Diagnostics.Unreachable_code_detected.code]; registerCodeFix({ - errorCodes: errorCodes41, + errorCodes: errorCodes42, getCodeActions(context) { const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken); if (syntacticDiagnostics.length) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(t, context.sourceFile, context.span.start, context.span.length, context.errorCode)); - return [createCodeFixAction(fixId32, changes, Diagnostics.Remove_unreachable_code, fixId32, Diagnostics.Remove_all_unreachable_code)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, context.sourceFile, context.span.start, context.span.length, context.errorCode)); + return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unreachable_code, fixId33, Diagnostics.Remove_all_unreachable_code)]; }, - fixIds: [fixId32], - getAllCodeActions: (context) => codeFixAll(context, errorCodes41, (changes, diag2) => doChange18(changes, diag2.file, diag2.start, diag2.length, diag2.code)) + fixIds: [fixId33], + getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange26(changes, diag2.file, diag2.start, diag2.length, diag2.code)) }); } }); // src/services/codefixes/fixUnusedLabel.ts - function doChange19(changes, sourceFile, start) { + function doChange27(changes, sourceFile, start) { const token = getTokenAtPosition(sourceFile, start); const labeledStatement = cast(token.parent, isLabeledStatement); const pos = token.getStart(sourceFile); const statementPos = labeledStatement.statement.getStart(sourceFile); const end = positionsAreOnSameLine(pos, statementPos, sourceFile) ? statementPos : skipTrivia( sourceFile.text, - findChildOfKind(labeledStatement, 58 /* ColonToken */, sourceFile).end, + findChildOfKind(labeledStatement, 59 /* ColonToken */, sourceFile).end, /*stopAfterLineBreak*/ true ); changes.deleteRange(sourceFile, { pos, end }); } - var fixId33, errorCodes42; + var fixId34, errorCodes43; var init_fixUnusedLabel = __esm({ "src/services/codefixes/fixUnusedLabel.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId33 = "fixUnusedLabel"; - errorCodes42 = [Diagnostics.Unused_label.code]; + fixId34 = "fixUnusedLabel"; + errorCodes43 = [Diagnostics.Unused_label.code]; registerCodeFix({ - errorCodes: errorCodes42, + errorCodes: errorCodes43, getCodeActions(context) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, context.span.start)); - return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unused_label, fixId33, Diagnostics.Remove_all_unused_labels)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, context.sourceFile, context.span.start)); + return [createCodeFixAction(fixId34, changes, Diagnostics.Remove_unused_label, fixId34, Diagnostics.Remove_all_unused_labels)]; }, - fixIds: [fixId33], - getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange19(changes, diag2.file, diag2.start)) + fixIds: [fixId34], + getAllCodeActions: (context) => codeFixAll(context, errorCodes43, (changes, diag2) => doChange27(changes, diag2.file, diag2.start)) }); } }); // src/services/codefixes/fixJSDocTypes.ts - function doChange20(changes, sourceFile, oldTypeNode, newType, checker) { + function doChange28(changes, sourceFile, oldTypeNode, newType, checker) { changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode( newType, /*enclosingDeclaration*/ @@ -144414,29 +151020,29 @@ ${lanes.join("\n")} void 0 )); } - function getInfo11(sourceFile, pos, checker) { + function getInfo14(sourceFile, pos, checker) { const decl = findAncestor(getTokenAtPosition(sourceFile, pos), isTypeContainer); const typeNode = decl && decl.type; return typeNode && { typeNode, type: getType(checker, typeNode) }; } function isTypeContainer(node) { switch (node.kind) { - case 231 /* AsExpression */: - case 176 /* CallSignature */: - case 177 /* ConstructSignature */: - case 259 /* FunctionDeclaration */: - case 174 /* GetAccessor */: - case 178 /* IndexSignature */: - case 197 /* MappedType */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 166 /* Parameter */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 175 /* SetAccessor */: - case 262 /* TypeAliasDeclaration */: - case 213 /* TypeAssertionExpression */: - case 257 /* VariableDeclaration */: + case 233 /* AsExpression */: + case 178 /* CallSignature */: + case 179 /* ConstructSignature */: + case 261 /* FunctionDeclaration */: + case 176 /* GetAccessor */: + case 180 /* IndexSignature */: + case 199 /* MappedType */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 168 /* Parameter */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 177 /* SetAccessor */: + case 264 /* TypeAliasDeclaration */: + case 215 /* TypeAssertionExpression */: + case 259 /* VariableDeclaration */: return true; default: return false; @@ -144454,7 +151060,7 @@ ${lanes.join("\n")} } return checker.getTypeFromTypeNode(node); } - var fixIdPlain, fixIdNullable, errorCodes43; + var fixIdPlain, fixIdNullable, errorCodes44; var init_fixJSDocTypes = __esm({ "src/services/codefixes/fixJSDocTypes.ts"() { "use strict"; @@ -144462,42 +151068,42 @@ ${lanes.join("\n")} init_ts_codefix(); fixIdPlain = "fixJSDocTypes_plain"; fixIdNullable = "fixJSDocTypes_nullable"; - errorCodes43 = [ + errorCodes44 = [ Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code, Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code, Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code ]; registerCodeFix({ - errorCodes: errorCodes43, + errorCodes: errorCodes44, getCodeActions(context) { const { sourceFile } = context; const checker = context.program.getTypeChecker(); - const info = getInfo11(sourceFile, context.span.start, checker); + const info = getInfo14(sourceFile, context.span.start, checker); if (!info) return void 0; const { typeNode, type } = info; const original = typeNode.getText(sourceFile); const actions2 = [fix(type, fixIdPlain, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)]; - if (typeNode.kind === 317 /* JSDocNullableType */) { + if (typeNode.kind === 320 /* JSDocNullableType */) { actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); } return actions2; - function fix(type2, fixId51, fixAllDescription) { - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, sourceFile, typeNode, type2, checker)); - return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId51, fixAllDescription); + function fix(type2, fixId52, fixAllDescription) { + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, typeNode, type2, checker)); + return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId52, fixAllDescription); } }, fixIds: [fixIdPlain, fixIdNullable], getAllCodeActions(context) { - const { fixId: fixId51, program, sourceFile } = context; + const { fixId: fixId52, program, sourceFile } = context; const checker = program.getTypeChecker(); - return codeFixAll(context, errorCodes43, (changes, err) => { - const info = getInfo11(err.file, err.start, checker); + return codeFixAll(context, errorCodes44, (changes, err) => { + const info = getInfo14(err.file, err.start, checker); if (!info) return; const { typeNode, type } = info; - const fixedType = typeNode.kind === 317 /* JSDocNullableType */ && fixId51 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type; - doChange20(changes, sourceFile, typeNode, fixedType, checker); + const fixedType = typeNode.kind === 320 /* JSDocNullableType */ && fixId52 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type; + doChange28(changes, sourceFile, typeNode, fixedType, checker); }); } }); @@ -144505,7 +151111,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixMissingCallParentheses.ts - function doChange21(changes, sourceFile, name) { + function doChange29(changes, sourceFile, name) { changes.replaceNodeWithText(sourceFile, name, `${name.text}()`); } function getCallName(sourceFile, start) { @@ -144522,31 +151128,31 @@ ${lanes.join("\n")} } return void 0; } - var fixId34, errorCodes44; + var fixId35, errorCodes45; var init_fixMissingCallParentheses = __esm({ "src/services/codefixes/fixMissingCallParentheses.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId34 = "fixMissingCallParentheses"; - errorCodes44 = [ + fixId35 = "fixMissingCallParentheses"; + errorCodes45 = [ Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead.code ]; registerCodeFix({ - errorCodes: errorCodes44, - fixIds: [fixId34], + errorCodes: errorCodes45, + fixIds: [fixId35], getCodeActions(context) { const { sourceFile, span } = context; const callName = getCallName(sourceFile, span.start); if (!callName) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, context.sourceFile, callName)); - return [createCodeFixAction(fixId34, changes, Diagnostics.Add_missing_call_parentheses, fixId34, Diagnostics.Add_all_missing_call_parentheses)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, context.sourceFile, callName)); + return [createCodeFixAction(fixId35, changes, Diagnostics.Add_missing_call_parentheses, fixId35, Diagnostics.Add_all_missing_call_parentheses)]; }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes44, (changes, diag2) => { + getAllCodeActions: (context) => codeFixAll(context, errorCodes45, (changes, diag2) => { const callName = getCallName(diag2.file, diag2.start); if (callName) - doChange21(changes, diag2.file, callName); + doChange29(changes, diag2.file, callName); }) }); } @@ -144569,15 +151175,15 @@ ${lanes.join("\n")} } let insertBefore; switch (containingFunction.kind) { - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: insertBefore = containingFunction.name; break; - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - insertBefore = findChildOfKind(containingFunction, 98 /* FunctionKeyword */, sourceFile); + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + insertBefore = findChildOfKind(containingFunction, 100 /* FunctionKeyword */, sourceFile); break; - case 216 /* ArrowFunction */: - const kind = containingFunction.typeParameters ? 29 /* LessThanToken */ : 20 /* OpenParenToken */; + case 218 /* ArrowFunction */: + const kind = containingFunction.typeParameters ? 30 /* LessThanToken */ : 21 /* OpenParenToken */; insertBefore = findChildOfKind(containingFunction, kind, sourceFile) || first(containingFunction.parameters); break; default: @@ -144588,45 +151194,45 @@ ${lanes.join("\n")} returnType: getReturnType(containingFunction) }; } - function doChange22(changes, sourceFile, { insertBefore, returnType }) { + function doChange30(changes, sourceFile, { insertBefore, returnType }) { if (returnType) { const entityName = getEntityNameFromTypeNode(returnType); - if (!entityName || entityName.kind !== 79 /* Identifier */ || entityName.text !== "Promise") { + if (!entityName || entityName.kind !== 80 /* Identifier */ || entityName.text !== "Promise") { changes.replaceNode(sourceFile, returnType, factory.createTypeReferenceNode("Promise", factory.createNodeArray([returnType]))); } } - changes.insertModifierBefore(sourceFile, 132 /* AsyncKeyword */, insertBefore); + changes.insertModifierBefore(sourceFile, 134 /* AsyncKeyword */, insertBefore); } - var fixId35, errorCodes45; + var fixId36, errorCodes46; var init_fixAwaitInSyncFunction = __esm({ "src/services/codefixes/fixAwaitInSyncFunction.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId35 = "fixAwaitInSyncFunction"; - errorCodes45 = [ + fixId36 = "fixAwaitInSyncFunction"; + errorCodes46 = [ Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code, Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code, Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code ]; registerCodeFix({ - errorCodes: errorCodes45, + errorCodes: errorCodes46, getCodeActions(context) { const { sourceFile, span } = context; const nodes = getNodes3(sourceFile, span.start); if (!nodes) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange22(t, sourceFile, nodes)); - return [createCodeFixAction(fixId35, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId35, Diagnostics.Add_all_missing_async_modifiers)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, nodes)); + return [createCodeFixAction(fixId36, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId36, Diagnostics.Add_all_missing_async_modifiers)]; }, - fixIds: [fixId35], + fixIds: [fixId36], getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) { const seen = /* @__PURE__ */ new Map(); - return codeFixAll(context, errorCodes45, (changes, diag2) => { + return codeFixAll(context, errorCodes46, (changes, diag2) => { const nodes = getNodes3(diag2.file, diag2.start); if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore))) return; - doChange22(changes, context.sourceFile, nodes); + doChange30(changes, context.sourceFile, nodes); }); } }); @@ -144634,7 +151240,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixPropertyOverrideAccessor.ts - function doChange23(file, start, length2, code, context) { + function doChange31(file, start, length2, code, context) { let startPosition; let endPosition; if (code === Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code) { @@ -144661,28 +151267,28 @@ ${lanes.join("\n")} } return generateAccessorFromProperty(file, context.program, startPosition, endPosition, context, Diagnostics.Generate_get_and_set_accessors.message); } - var errorCodes46, fixId36; + var errorCodes47, fixId37; var init_fixPropertyOverrideAccessor = __esm({ "src/services/codefixes/fixPropertyOverrideAccessor.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - errorCodes46 = [ + errorCodes47 = [ Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code, Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code ]; - fixId36 = "fixPropertyOverrideAccessor"; + fixId37 = "fixPropertyOverrideAccessor"; registerCodeFix({ - errorCodes: errorCodes46, + errorCodes: errorCodes47, getCodeActions(context) { - const edits = doChange23(context.sourceFile, context.span.start, context.span.length, context.errorCode, context); + const edits = doChange31(context.sourceFile, context.span.start, context.span.length, context.errorCode, context); if (edits) { - return [createCodeFixAction(fixId36, edits, Diagnostics.Generate_get_and_set_accessors, fixId36, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)]; + return [createCodeFixAction(fixId37, edits, Diagnostics.Generate_get_and_set_accessors, fixId37, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)]; } }, - fixIds: [fixId36], - getAllCodeActions: (context) => codeFixAll(context, errorCodes46, (changes, diag2) => { - const edits = doChange23(diag2.file, diag2.start, diag2.length, diag2.code, context); + fixIds: [fixId37], + getAllCodeActions: (context) => codeFixAll(context, errorCodes47, (changes, diag2) => { + const edits = doChange31(diag2.file, diag2.start, diag2.length, diag2.code, context); if (edits) { for (const edit of edits) { changes.pushRaw(context.sourceFile, edit); @@ -144729,8 +151335,8 @@ ${lanes.join("\n")} } return errorCode; } - function doChange24(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) { - if (!isParameterPropertyModifier(token.kind) && token.kind !== 79 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 108 /* ThisKeyword */) { + function doChange32(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) { + if (!isParameterPropertyModifier(token.kind) && token.kind !== 80 /* Identifier */ && token.kind !== 26 /* DotDotDotToken */ && token.kind !== 110 /* ThisKeyword */) { return void 0; } const { parent: parent2 } = token; @@ -144829,16 +151435,16 @@ ${lanes.join("\n")} if (isInJSFile(containingFunction)) { annotateJSDocParameters(changes, sourceFile, parameterInferences, program, host); } else { - const needParens = isArrowFunction(containingFunction) && !findChildOfKind(containingFunction, 20 /* OpenParenToken */, sourceFile); + const needParens = isArrowFunction(containingFunction) && !findChildOfKind(containingFunction, 21 /* OpenParenToken */, sourceFile); if (needParens) - changes.insertNodeBefore(sourceFile, first(containingFunction.parameters), factory.createToken(20 /* OpenParenToken */)); + changes.insertNodeBefore(sourceFile, first(containingFunction.parameters), factory.createToken(21 /* OpenParenToken */)); for (const { declaration, type } of parameterInferences) { if (declaration && !declaration.type && !declaration.initializer) { annotate(changes, importAdder, sourceFile, declaration, type, program, host); } } if (needParens) - changes.insertNodeAfter(sourceFile, last(containingFunction.parameters), factory.createToken(21 /* CloseParenToken */)); + changes.insertNodeAfter(sourceFile, last(containingFunction.parameters), factory.createToken(22 /* CloseParenToken */)); } } function annotateThis(changes, sourceFile, containingFunction, program, host, cancellationToken) { @@ -144883,7 +151489,7 @@ ${lanes.join("\n")} function annotate(changes, importAdder, sourceFile, declaration, type, program, host) { const typeNode = getTypeNodeIfAccessible(type, declaration, program, host); if (typeNode) { - if (isInJSFile(sourceFile) && declaration.kind !== 168 /* PropertySignature */) { + if (isInJSFile(sourceFile) && declaration.kind !== 170 /* PropertySignature */) { const parent2 = isVariableDeclaration(declaration) ? tryCast(declaration.parent.parent, isVariableStatement) : declaration; if (!parent2) { return; @@ -144913,7 +151519,7 @@ ${lanes.join("\n")} if (importableReference && changes.tryInsertTypeAnnotation(sourceFile, declaration, importableReference.typeNode)) { forEach(importableReference.symbols, (s) => importAdder.addImportFromExportedSymbol( s, - /*usageIsTypeOnly*/ + /*isValidTypeOnlyUseSite*/ true )); return true; @@ -144941,9 +151547,9 @@ ${lanes.join("\n")} return; } if (isArrowFunction(signature) || isFunctionExpression(signature)) { - const needParens = isArrowFunction(signature) && !findChildOfKind(signature, 20 /* OpenParenToken */, sourceFile); + const needParens = isArrowFunction(signature) && !findChildOfKind(signature, 21 /* OpenParenToken */, sourceFile); if (needParens) { - changes.insertNodeBefore(sourceFile, first(signature.parameters), factory.createToken(20 /* OpenParenToken */)); + changes.insertNodeBefore(sourceFile, first(signature.parameters), factory.createToken(21 /* OpenParenToken */)); } forEach(inferences, ({ typeNode, param }) => { const typeTag = factory.createJSDocTypeTag( @@ -144959,7 +151565,7 @@ ${lanes.join("\n")} changes.insertNodeAt(sourceFile, param.getStart(sourceFile), jsDoc, { suffix: " " }); }); if (needParens) { - changes.insertNodeAfter(sourceFile, last(signature.parameters), factory.createToken(21 /* CloseParenToken */)); + changes.insertNodeAfter(sourceFile, last(signature.parameters), factory.createToken(22 /* CloseParenToken */)); } } else { const paramTags = map(inferences, ({ name, typeNode, isOptional }) => factory.createJSDocParameterTag( @@ -144969,7 +151575,7 @@ ${lanes.join("\n")} /*isBracketed*/ !!isOptional, factory.createJSDocTypeExpression(typeNode), - /* isNameFirst */ + /*isNameFirst*/ false, /*comment*/ void 0 @@ -144994,17 +151600,17 @@ ${lanes.join("\n")} function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { let searchToken; switch (containingFunction.kind) { - case 173 /* Constructor */: - searchToken = findChildOfKind(containingFunction, 135 /* ConstructorKeyword */, sourceFile); + case 175 /* Constructor */: + searchToken = findChildOfKind(containingFunction, 137 /* ConstructorKeyword */, sourceFile); break; - case 216 /* ArrowFunction */: - case 215 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 217 /* FunctionExpression */: const parent2 = containingFunction.parent; searchToken = (isVariableDeclaration(parent2) || isPropertyDeclaration(parent2)) && isIdentifier(parent2.name) ? parent2.name : containingFunction.name; break; - case 259 /* FunctionDeclaration */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: + case 261 /* FunctionDeclaration */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: searchToken = containingFunction.name; break; } @@ -145140,44 +151746,44 @@ ${lanes.join("\n")} node = node.parent; } switch (node.parent.kind) { - case 241 /* ExpressionStatement */: + case 243 /* ExpressionStatement */: inferTypeFromExpressionStatement(node, usage); break; - case 222 /* PostfixUnaryExpression */: + case 224 /* PostfixUnaryExpression */: usage.isNumber = true; break; - case 221 /* PrefixUnaryExpression */: + case 223 /* PrefixUnaryExpression */: inferTypeFromPrefixUnaryExpression(node.parent, usage); break; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: inferTypeFromBinaryExpression(node, node.parent, usage); break; - case 292 /* CaseClause */: - case 293 /* DefaultClause */: + case 295 /* CaseClause */: + case 296 /* DefaultClause */: inferTypeFromSwitchStatementLabel(node.parent, usage); break; - case 210 /* CallExpression */: - case 211 /* NewExpression */: + case 212 /* CallExpression */: + case 213 /* NewExpression */: if (node.parent.expression === node) { inferTypeFromCallExpression(node.parent, usage); } else { inferTypeFromContextualType(node, usage); } break; - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: inferTypeFromPropertyAccessExpression(node.parent, usage); break; - case 209 /* ElementAccessExpression */: + case 211 /* ElementAccessExpression */: inferTypeFromPropertyElementExpression(node.parent, node, usage); break; - case 299 /* PropertyAssignment */: - case 300 /* ShorthandPropertyAssignment */: + case 302 /* PropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: inferTypeFromPropertyAssignment(node.parent, usage); break; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: inferTypeFromPropertyDeclaration(node.parent, usage); break; - case 257 /* VariableDeclaration */: { + case 259 /* VariableDeclaration */: { const { name, initializer } = node.parent; if (node === name) { if (initializer) { @@ -145200,45 +151806,45 @@ ${lanes.join("\n")} } function inferTypeFromPrefixUnaryExpression(node, usage) { switch (node.operator) { - case 45 /* PlusPlusToken */: - case 46 /* MinusMinusToken */: - case 40 /* MinusToken */: - case 54 /* TildeToken */: + case 46 /* PlusPlusToken */: + case 47 /* MinusMinusToken */: + case 41 /* MinusToken */: + case 55 /* TildeToken */: usage.isNumber = true; break; - case 39 /* PlusToken */: + case 40 /* PlusToken */: usage.isNumberOrString = true; break; } } function inferTypeFromBinaryExpression(node, parent2, usage) { switch (parent2.operatorToken.kind) { - case 42 /* AsteriskAsteriskToken */: - case 41 /* AsteriskToken */: - case 43 /* SlashToken */: - case 44 /* PercentToken */: - case 47 /* LessThanLessThanToken */: - case 48 /* GreaterThanGreaterThanToken */: - case 49 /* GreaterThanGreaterThanGreaterThanToken */: - case 50 /* AmpersandToken */: - case 51 /* BarToken */: - case 52 /* CaretToken */: - case 65 /* MinusEqualsToken */: - case 67 /* AsteriskAsteriskEqualsToken */: - case 66 /* AsteriskEqualsToken */: - case 68 /* SlashEqualsToken */: - case 69 /* PercentEqualsToken */: - case 73 /* AmpersandEqualsToken */: - case 74 /* BarEqualsToken */: - case 78 /* CaretEqualsToken */: - case 70 /* LessThanLessThanEqualsToken */: - case 72 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 71 /* GreaterThanGreaterThanEqualsToken */: - case 40 /* MinusToken */: - case 29 /* LessThanToken */: - case 32 /* LessThanEqualsToken */: - case 31 /* GreaterThanToken */: - case 33 /* GreaterThanEqualsToken */: + case 43 /* AsteriskAsteriskToken */: + case 42 /* AsteriskToken */: + case 44 /* SlashToken */: + case 45 /* PercentToken */: + case 48 /* LessThanLessThanToken */: + case 49 /* GreaterThanGreaterThanToken */: + case 50 /* GreaterThanGreaterThanGreaterThanToken */: + case 51 /* AmpersandToken */: + case 52 /* BarToken */: + case 53 /* CaretToken */: + case 66 /* MinusEqualsToken */: + case 68 /* AsteriskAsteriskEqualsToken */: + case 67 /* AsteriskEqualsToken */: + case 69 /* SlashEqualsToken */: + case 70 /* PercentEqualsToken */: + case 74 /* AmpersandEqualsToken */: + case 75 /* BarEqualsToken */: + case 79 /* CaretEqualsToken */: + case 71 /* LessThanLessThanEqualsToken */: + case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 72 /* GreaterThanGreaterThanEqualsToken */: + case 41 /* MinusToken */: + case 30 /* LessThanToken */: + case 33 /* LessThanEqualsToken */: + case 32 /* GreaterThanToken */: + case 34 /* GreaterThanEqualsToken */: const operandType = checker.getTypeAtLocation(parent2.left === node ? parent2.right : parent2.left); if (operandType.flags & 1056 /* EnumLike */) { addCandidateType(usage, operandType); @@ -145246,8 +151852,8 @@ ${lanes.join("\n")} usage.isNumber = true; } break; - case 64 /* PlusEqualsToken */: - case 39 /* PlusToken */: + case 65 /* PlusEqualsToken */: + case 40 /* PlusToken */: const otherOperandType = checker.getTypeAtLocation(parent2.left === node ? parent2.right : parent2.left); if (otherOperandType.flags & 1056 /* EnumLike */) { addCandidateType(usage, otherOperandType); @@ -145260,21 +151866,24 @@ ${lanes.join("\n")} usage.isNumberOrString = true; } break; - case 63 /* EqualsToken */: - case 34 /* EqualsEqualsToken */: - case 36 /* EqualsEqualsEqualsToken */: - case 37 /* ExclamationEqualsEqualsToken */: - case 35 /* ExclamationEqualsToken */: + case 64 /* EqualsToken */: + case 35 /* EqualsEqualsToken */: + case 37 /* EqualsEqualsEqualsToken */: + case 38 /* ExclamationEqualsEqualsToken */: + case 36 /* ExclamationEqualsToken */: + case 77 /* AmpersandAmpersandEqualsToken */: + case 78 /* QuestionQuestionEqualsToken */: + case 76 /* BarBarEqualsToken */: addCandidateType(usage, checker.getTypeAtLocation(parent2.left === node ? parent2.right : parent2.left)); break; - case 101 /* InKeyword */: + case 103 /* InKeyword */: if (node === parent2.left) { usage.isString = true; } break; - case 56 /* BarBarToken */: - case 60 /* QuestionQuestionToken */: - if (node === parent2.left && (node.parent.parent.kind === 257 /* VariableDeclaration */ || isAssignmentExpression( + case 57 /* BarBarToken */: + case 61 /* QuestionQuestionToken */: + if (node === parent2.left && (node.parent.parent.kind === 259 /* VariableDeclaration */ || isAssignmentExpression( node.parent.parent, /*excludeCompoundAssignment*/ true @@ -145282,9 +151891,9 @@ ${lanes.join("\n")} addCandidateType(usage, checker.getTypeAtLocation(parent2.right)); } break; - case 55 /* AmpersandAmpersandToken */: - case 27 /* CommaToken */: - case 102 /* InstanceOfKeyword */: + case 56 /* AmpersandAmpersandToken */: + case 28 /* CommaToken */: + case 104 /* InstanceOfKeyword */: break; } } @@ -145302,7 +151911,7 @@ ${lanes.join("\n")} } } calculateUsageOfNode(parent2, call.return_); - if (parent2.kind === 210 /* CallExpression */) { + if (parent2.kind === 212 /* CallExpression */) { (usage.calls || (usage.calls = [])).push(call); } else { (usage.constructs || (usage.constructs = [])).push(call); @@ -145393,7 +152002,7 @@ ${lanes.join("\n")} const props = createMultiMap(); for (const anon2 of anons) { for (const p of checker.getPropertiesOfType(anon2)) { - props.add(p.name, p.valueDeclaration ? checker.getTypeOfSymbolAtLocation(p, p.valueDeclaration) : checker.getAnyType()); + props.add(p.escapedName, p.valueDeclaration ? checker.getTypeOfSymbolAtLocation(p, p.valueDeclaration) : checker.getAnyType()); } calls.push(...checker.getSignaturesOfType(anon2, 0 /* Call */)); constructs.push(...checker.getSignaturesOfType(anon2, 1 /* Construct */)); @@ -145428,7 +152037,7 @@ ${lanes.join("\n")} ); } function inferTypes(usage) { - var _a2, _b, _c; + var _a, _b, _c; const types = []; if (usage.isNumber) { types.push(checker.getNumberType()); @@ -145442,7 +152051,7 @@ ${lanes.join("\n")} if (usage.numberIndex) { types.push(checker.createArrayType(combineFromUsage(usage.numberIndex))); } - if (((_a2 = usage.properties) == null ? void 0 : _a2.size) || ((_b = usage.constructs) == null ? void 0 : _b.length) || usage.stringIndex) { + if (((_a = usage.properties) == null ? void 0 : _a.size) || ((_b = usage.constructs) == null ? void 0 : _b.length) || usage.stringIndex) { types.push(inferStructuralType(usage)); } const candidateTypes = (usage.candidateTypes || []).map((t) => checker.getBaseTypeOfLiteralType(t)); @@ -145553,7 +152162,7 @@ ${lanes.join("\n")} return []; } function inferFromSignatures(genericSig, usageSig, typeParameter) { - var _a2; + var _a; const types = []; for (let i = 0; i < genericSig.parameters.length; i++) { const genericParam = genericSig.parameters[i]; @@ -145567,7 +152176,7 @@ ${lanes.join("\n")} if (elementType) { genericParamType = elementType; } - const targetType = ((_a2 = tryCast(usageParam, isTransientSymbol)) == null ? void 0 : _a2.links.type) || (usageParam.valueDeclaration ? checker.getTypeOfSymbolAtLocation(usageParam, usageParam.valueDeclaration) : checker.getAnyType()); + const targetType = ((_a = tryCast(usageParam, isTransientSymbol)) == null ? void 0 : _a.links.type) || (usageParam.valueDeclaration ? checker.getTypeOfSymbolAtLocation(usageParam, usageParam.valueDeclaration) : checker.getAnyType()); types.push(...inferTypeParameters(genericParamType, targetType, typeParameter)); } const genericReturn = checker.getReturnTypeOfSignature(genericSig); @@ -145623,14 +152232,14 @@ ${lanes.join("\n")} } } } - var fixId37, errorCodes47; + var fixId38, errorCodes48; var init_inferFromUsage = __esm({ "src/services/codefixes/inferFromUsage.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId37 = "inferFromUsage"; - errorCodes47 = [ + fixId38 = "inferFromUsage"; + errorCodes48 = [ // Variable declarations Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code, // Variable uses @@ -145664,13 +152273,13 @@ ${lanes.join("\n")} Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code ]; registerCodeFix({ - errorCodes: errorCodes47, + errorCodes: errorCodes48, getCodeActions(context) { const { sourceFile, program, span: { start }, errorCode, cancellationToken, host, preferences } = context; const token = getTokenAtPosition(sourceFile, start); let declaration; const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => { - declaration = doChange24( + declaration = doChange32( changes2, sourceFile, token, @@ -145684,14 +152293,14 @@ ${lanes.join("\n")} ); }); const name = declaration && getNameOfDeclaration(declaration); - return !name || changes.length === 0 ? void 0 : [createCodeFixAction(fixId37, changes, [getDiagnostic(errorCode, token), getTextOfNode(name)], fixId37, Diagnostics.Infer_all_types_from_usage)]; + return !name || changes.length === 0 ? void 0 : [createCodeFixAction(fixId38, changes, [getDiagnostic(errorCode, token), getTextOfNode(name)], fixId38, Diagnostics.Infer_all_types_from_usage)]; }, - fixIds: [fixId37], + fixIds: [fixId38], getAllCodeActions(context) { const { sourceFile, program, cancellationToken, host, preferences } = context; const markSeen = nodeSeenTracker(); - return codeFixAll(context, errorCodes47, (changes, err) => { - doChange24(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences); + return codeFixAll(context, errorCodes48, (changes, err) => { + doChange32(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences); }); } }); @@ -145699,7 +152308,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixReturnTypeInAsyncFunction.ts - function getInfo12(sourceFile, checker, pos) { + function getInfo15(sourceFile, checker, pos) { if (isInJSFile(sourceFile)) { return void 0; } @@ -145722,47 +152331,47 @@ ${lanes.join("\n")} return { returnTypeNode, returnType, promisedTypeNode, promisedType }; } } - function doChange25(changes, sourceFile, returnTypeNode, promisedTypeNode) { + function doChange33(changes, sourceFile, returnTypeNode, promisedTypeNode) { changes.replaceNode(sourceFile, returnTypeNode, factory.createTypeReferenceNode("Promise", [promisedTypeNode])); } - var fixId38, errorCodes48; + var fixId39, errorCodes49; var init_fixReturnTypeInAsyncFunction = __esm({ "src/services/codefixes/fixReturnTypeInAsyncFunction.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId38 = "fixReturnTypeInAsyncFunction"; - errorCodes48 = [ + fixId39 = "fixReturnTypeInAsyncFunction"; + errorCodes49 = [ Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0.code ]; registerCodeFix({ - errorCodes: errorCodes48, - fixIds: [fixId38], + errorCodes: errorCodes49, + fixIds: [fixId39], getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) { const { sourceFile, program, span } = context; const checker = program.getTypeChecker(); - const info = getInfo12(sourceFile, program.getTypeChecker(), span.start); + const info = getInfo15(sourceFile, program.getTypeChecker(), span.start); if (!info) { return void 0; } const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25(t, sourceFile, returnTypeNode, promisedTypeNode)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(t, sourceFile, returnTypeNode, promisedTypeNode)); return [createCodeFixAction( - fixId38, + fixId39, changes, [ Diagnostics.Replace_0_with_Promise_1, checker.typeToString(returnType), checker.typeToString(promisedType) ], - fixId38, + fixId39, Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions )]; }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes48, (changes, diag2) => { - const info = getInfo12(diag2.file, context.program.getTypeChecker(), diag2.start); + getAllCodeActions: (context) => codeFixAll(context, errorCodes49, (changes, diag2) => { + const info = getInfo15(diag2.file, context.program.getTypeChecker(), diag2.start); if (info) { - doChange25(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode); + doChange33(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode); } }) }); @@ -145776,20 +152385,20 @@ ${lanes.join("\n")} changes.insertCommentBeforeLine(sourceFile, lineNumber, position, " @ts-ignore"); } } - var fixName4, fixId39, errorCodes49; + var fixName4, fixId40, errorCodes50; var init_disableJsDiagnostics = __esm({ "src/services/codefixes/disableJsDiagnostics.ts"() { "use strict"; init_ts4(); init_ts_codefix(); fixName4 = "disableJsDiagnostics"; - fixId39 = "disableJsDiagnostics"; - errorCodes49 = mapDefined(Object.keys(Diagnostics), (key) => { + fixId40 = "disableJsDiagnostics"; + errorCodes50 = mapDefined(Object.keys(Diagnostics), (key) => { const diag2 = Diagnostics[key]; return diag2.category === 1 /* Error */ ? diag2.code : void 0; }); registerCodeFix({ - errorCodes: errorCodes49, + errorCodes: errorCodes50, getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) { const { sourceFile, program, span, host, formatContext } = context; if (!isInJSFile(sourceFile) || !isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) { @@ -145807,14 +152416,14 @@ ${lanes.join("\n")} ) ]; if (ts_textChanges_exports.isValidLocationToAddComment(sourceFile, span.start)) { - fixes.unshift(createCodeFixAction(fixName4, ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange8(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message, fixId39, Diagnostics.Add_ts_ignore_to_all_error_messages)); + fixes.unshift(createCodeFixAction(fixName4, ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange8(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message, fixId40, Diagnostics.Add_ts_ignore_to_all_error_messages)); } return fixes; }, - fixIds: [fixId39], + fixIds: [fixId40], getAllCodeActions: (context) => { const seenLines = /* @__PURE__ */ new Set(); - return codeFixAll(context, errorCodes49, (changes, diag2) => { + return codeFixAll(context, errorCodes50, (changes, diag2) => { if (ts_textChanges_exports.isValidLocationToAddComment(diag2.file, diag2.start)) { makeChange8(changes, diag2.file, diag2.start, seenLines); } @@ -145837,7 +152446,7 @@ ${lanes.join("\n")} preferences, importAdder, addClassElement, - /* body */ + /*body*/ void 0 ); } @@ -145850,12 +152459,11 @@ ${lanes.join("\n")} }; } function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional = 3 /* All */, isAmbient = false) { - var _a2; const declarations = symbol.getDeclarations(); const declaration = declarations == null ? void 0 : declarations[0]; const checker = context.program.getTypeChecker(); const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions()); - const kind = (_a2 = declaration == null ? void 0 : declaration.kind) != null ? _a2 : 168 /* PropertySignature */; + const kind = (declaration == null ? void 0 : declaration.kind) ?? 170 /* PropertySignature */; const declarationName = getSynthesizedDeepClone( getNameOfDeclaration(declaration), /*includeTrivia*/ @@ -145872,8 +152480,8 @@ ${lanes.join("\n")} const ambient = !!(enclosingDeclaration.flags & 16777216 /* Ambient */) || isAmbient; const quotePreference = getQuotePreference(sourceFile, preferences); switch (kind) { - case 168 /* PropertySignature */: - case 169 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 171 /* PropertyDeclaration */: const flags = quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : void 0; let typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context)); if (importAdder) { @@ -145886,14 +152494,14 @@ ${lanes.join("\n")} addClassElement(factory.createPropertyDeclaration( modifiers, declaration ? createName(declarationName) : symbol.getName(), - optional && preserveOptional & 2 /* Property */ ? factory.createToken(57 /* QuestionToken */) : void 0, + optional && preserveOptional & 2 /* Property */ ? factory.createToken(58 /* QuestionToken */) : void 0, typeNode, /*initializer*/ void 0 )); break; - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: { + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: { Debug.assertIsDefined(declarations); let typeNode2 = checker.typeToTypeNode( type, @@ -145941,8 +152549,8 @@ ${lanes.join("\n")} } break; } - case 170 /* MethodSignature */: - case 171 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 173 /* MethodDeclaration */: Debug.assertIsDefined(declarations); const signatures = type.isUnion() ? flatMap(type.types, (t) => t.getCallSignatures()) : type.getCallSignatures(); if (!some(signatures)) { @@ -145969,7 +152577,7 @@ ${lanes.join("\n")} break; } function outputMethod(quotePreference2, signature, modifiers2, name, body2) { - const method = createSignatureDeclarationFromSignature(171 /* MethodDeclaration */, context, quotePreference2, signature, body2, name, modifiers2, optional && !!(preserveOptional & 1 /* Method */), enclosingDeclaration, importAdder); + const method = createSignatureDeclarationFromSignature(173 /* MethodDeclaration */, context, quotePreference2, signature, body2, name, modifiers2, optional && !!(preserveOptional & 1 /* Method */), enclosingDeclaration, importAdder); if (method) addClassElement(method); } @@ -145979,7 +152587,7 @@ ${lanes.join("\n")} modifiers2 = combine(modifiers2, factory.createModifiersFromModifierFlags(modifierFlags)); } if (shouldAddOverrideKeyword()) { - modifiers2 = append(modifiers2, factory.createToken(161 /* OverrideKeyword */)); + modifiers2 = append(modifiers2, factory.createToken(163 /* OverrideKeyword */)); } return modifiers2 && factory.createNodeArray(modifiers2); } @@ -146085,19 +152693,19 @@ ${lanes.join("\n")} } } } - const questionToken = optional ? factory.createToken(57 /* QuestionToken */) : void 0; + const questionToken = optional ? factory.createToken(58 /* QuestionToken */) : void 0; const asteriskToken = signatureDeclaration.asteriskToken; if (isFunctionExpression(signatureDeclaration)) { - return factory.updateFunctionExpression(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, tryCast(name, isIdentifier), typeParameters, parameters, type, body != null ? body : signatureDeclaration.body); + return factory.updateFunctionExpression(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, tryCast(name, isIdentifier), typeParameters, parameters, type, body ?? signatureDeclaration.body); } if (isArrowFunction(signatureDeclaration)) { - return factory.updateArrowFunction(signatureDeclaration, modifiers, typeParameters, parameters, type, signatureDeclaration.equalsGreaterThanToken, body != null ? body : signatureDeclaration.body); + return factory.updateArrowFunction(signatureDeclaration, modifiers, typeParameters, parameters, type, signatureDeclaration.equalsGreaterThanToken, body ?? signatureDeclaration.body); } if (isMethodDeclaration(signatureDeclaration)) { - return factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name != null ? name : factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body); + return factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name ?? factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body); } if (isFunctionDeclaration(signatureDeclaration)) { - return factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, tryCast(name, isIdentifier), typeParameters, parameters, type, body != null ? body : signatureDeclaration.body); + return factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, tryCast(name, isIdentifier), typeParameters, parameters, type, body ?? signatureDeclaration.body); } return void 0; } @@ -146122,7 +152730,7 @@ ${lanes.join("\n")} tracker ); const modifiers = modifierFlags ? factory.createNodeArray(factory.createModifiersFromModifierFlags(modifierFlags)) : void 0; - const asteriskToken = isYieldExpression(parent2) ? factory.createToken(41 /* AsteriskToken */) : void 0; + const asteriskToken = isYieldExpression(parent2) ? factory.createToken(42 /* AsteriskToken */) : void 0; const typeParameters = isJs ? void 0 : createTypeParametersForArguments(checker, argumentTypeParameters, typeArguments); const parameters = createDummyParameters( args.length, @@ -146140,7 +152748,7 @@ ${lanes.join("\n")} tracker ); switch (kind) { - case 171 /* MethodDeclaration */: + case 173 /* MethodDeclaration */: return factory.createMethodDeclaration( modifiers, asteriskToken, @@ -146152,7 +152760,7 @@ ${lanes.join("\n")} type, createStubbedMethodBody(quotePreference) ); - case 170 /* MethodSignature */: + case 172 /* MethodSignature */: return factory.createMethodSignature( modifiers, name, @@ -146160,9 +152768,9 @@ ${lanes.join("\n")} void 0, typeParameters, parameters, - type === void 0 ? factory.createKeywordTypeNode(157 /* UnknownKeyword */) : type + type === void 0 ? factory.createKeywordTypeNode(159 /* UnknownKeyword */) : type ); - case 259 /* FunctionDeclaration */: + case 261 /* FunctionDeclaration */: return factory.createFunctionDeclaration( modifiers, asteriskToken, @@ -146181,8 +152789,8 @@ ${lanes.join("\n")} const constraintsByName = new Map(argumentTypeParameters); if (typeArguments) { const typeArgumentsWithNewTypes = typeArguments.filter((typeArgument) => !argumentTypeParameters.some((pair) => { - var _a2; - return checker.getTypeAtLocation(typeArgument) === ((_a2 = pair[1]) == null ? void 0 : _a2.argumentType); + var _a; + return checker.getTypeAtLocation(typeArgument) === ((_a = pair[1]) == null ? void 0 : _a.argumentType); })); const targetSize = usedNames.size + typeArgumentsWithNewTypes.length; for (let i = 0; usedNames.size < targetSize; i += 1) { @@ -146192,12 +152800,12 @@ ${lanes.join("\n")} return arrayFrom( usedNames.values(), (usedName) => { - var _a2; + var _a; return factory.createTypeParameterDeclaration( /*modifiers*/ void 0, usedName, - (_a2 = constraintsByName.get(usedName)) == null ? void 0 : _a2.constraint + (_a = constraintsByName.get(usedName)) == null ? void 0 : _a.constraint ); } ); @@ -146251,7 +152859,7 @@ ${lanes.join("\n")} return type.flags & 524288 /* Object */ && type.objectFlags === 16 /* Anonymous */; } function getFirstTypeParameterName(type) { - var _a2; + var _a; if (type.flags & (1048576 /* Union */ | 2097152 /* Intersection */)) { for (const subType of type.types) { const subTypeName = getFirstTypeParameterName(subType); @@ -146260,7 +152868,7 @@ ${lanes.join("\n")} } } } - return type.flags & 262144 /* TypeParameter */ ? (_a2 = type.getSymbol()) == null ? void 0 : _a2.getName() : void 0; + return type.flags & 262144 /* TypeParameter */ ? (_a = type.getSymbol()) == null ? void 0 : _a.getName() : void 0; } function createDummyParameters(argCount, names, types, minArgumentCount, inJs) { const parameters = []; @@ -146277,9 +152885,9 @@ ${lanes.join("\n")} /*name*/ parameterName + (parameterNameCount || ""), /*questionToken*/ - minArgumentCount !== void 0 && i >= minArgumentCount ? factory.createToken(57 /* QuestionToken */) : void 0, + minArgumentCount !== void 0 && i >= minArgumentCount ? factory.createToken(58 /* QuestionToken */) : void 0, /*type*/ - inJs ? void 0 : (types == null ? void 0 : types[i]) || factory.createKeywordTypeNode(157 /* UnknownKeyword */), + inJs ? void 0 : (types == null ? void 0 : types[i]) || factory.createKeywordTypeNode(159 /* UnknownKeyword */), /*initializer*/ void 0 ); @@ -146305,7 +152913,7 @@ ${lanes.join("\n")} const parameters = createDummyParameters( maxNonRestArgs, maxArgsParameterSymbolNames, - /* types */ + /*types*/ void 0, minArgumentCount, /*inJs*/ @@ -146315,11 +152923,11 @@ ${lanes.join("\n")} const restParameter = factory.createParameterDeclaration( /*modifiers*/ void 0, - factory.createToken(25 /* DotDotDotToken */), + factory.createToken(26 /* DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", /*questionToken*/ - maxNonRestArgs >= minArgumentCount ? factory.createToken(57 /* QuestionToken */) : void 0, - factory.createArrayTypeNode(factory.createKeywordTypeNode(157 /* UnknownKeyword */)), + maxNonRestArgs >= minArgumentCount ? factory.createToken(58 /* QuestionToken */) : void 0, + factory.createArrayTypeNode(factory.createKeywordTypeNode(159 /* UnknownKeyword */)), /*initializer*/ void 0 ); @@ -146349,7 +152957,7 @@ ${lanes.join("\n")} /*asteriskToken*/ void 0, name, - optional ? factory.createToken(57 /* QuestionToken */) : void 0, + optional ? factory.createToken(58 /* QuestionToken */) : void 0, typeParameters, parameters, returnType, @@ -146374,7 +152982,7 @@ ${lanes.join("\n")} )] ) )], - /*multiline*/ + /*multiLine*/ true ); } @@ -146435,7 +153043,7 @@ ${lanes.join("\n")} } } function replaceFirstIdentifierOfEntityName(name, newIdentifier) { - if (name.kind === 79 /* Identifier */) { + if (name.kind === 80 /* Identifier */) { return newIdentifier; } return factory.createQualifiedName(replaceFirstIdentifierOfEntityName(name.left, newIdentifier), name.right); @@ -146456,7 +153064,7 @@ ${lanes.join("\n")} return token; } var PreserveOptionalFlags; - var init_helpers = __esm({ + var init_helpers2 = __esm({ "src/services/codefixes/helpers.ts"() { "use strict"; init_ts4(); @@ -146567,7 +153175,7 @@ ${lanes.join("\n")} isStatic: hasStaticModifier(declaration), isReadonly: hasEffectiveReadonlyModifier(declaration), type: getDeclarationType(declaration, program), - container: declaration.kind === 166 /* Parameter */ ? declaration.parent.parent : declaration.parent, + container: declaration.kind === 168 /* Parameter */ ? declaration.parent.parent : declaration.parent, originalName: declaration.name.text, declaration, fieldName, @@ -146662,10 +153270,10 @@ ${lanes.join("\n")} if (!constructor.body) return; constructor.body.forEachChild(function recur(node) { - if (isElementAccessExpression(node) && node.expression.kind === 108 /* ThisKeyword */ && isStringLiteral(node.argumentExpression) && node.argumentExpression.text === originalName && isWriteAccess(node)) { + if (isElementAccessExpression(node) && node.expression.kind === 110 /* ThisKeyword */ && isStringLiteral(node.argumentExpression) && node.argumentExpression.text === originalName && isWriteAccess(node)) { changeTracker.replaceNode(file, node.argumentExpression, factory.createStringLiteral(fieldName)); } - if (isPropertyAccessExpression(node) && node.expression.kind === 108 /* ThisKeyword */ && node.name.text === originalName && isWriteAccess(node)) { + if (isPropertyAccessExpression(node) && node.expression.kind === 110 /* ThisKeyword */ && node.name.text === originalName && isWriteAccess(node)) { changeTracker.replaceNode(file, node.name, factory.createIdentifier(fieldName)); } if (!isFunctionLike(node) && !isClassLike(node)) { @@ -146680,7 +153288,7 @@ ${lanes.join("\n")} const type = typeChecker.getTypeFromTypeNode(typeNode); if (!typeChecker.isTypeAssignableTo(typeChecker.getUndefinedType(), type)) { const types = isUnionTypeNode(typeNode) ? typeNode.types : [typeNode]; - return factory.createUnionTypeNode([...types, factory.createKeywordTypeNode(155 /* UndefinedKeyword */)]); + return factory.createUnionTypeNode([...types, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]); } } return typeNode; @@ -146739,7 +153347,7 @@ ${lanes.join("\n")} } function getActionsForUsageOfInvalidImport(context) { const sourceFile = context.sourceFile; - const targetKind = Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 210 /* CallExpression */ : 211 /* NewExpression */; + const targetKind = Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 212 /* CallExpression */ : 213 /* NewExpression */; const node = findAncestor(getTokenAtPosition(sourceFile, context.span.start), (a) => a.kind === targetKind); if (!node) { return []; @@ -146807,7 +153415,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/fixStrictClassInitialization.ts - function getInfo13(sourceFile, pos) { + function getInfo16(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); if (isIdentifier(token) && isPropertyDeclaration(token.parent)) { const type = getEffectiveTypeAnnotationNode(token.parent); @@ -146829,7 +153437,7 @@ ${lanes.join("\n")} propertyDeclaration, propertyDeclaration.modifiers, propertyDeclaration.name, - factory.createToken(53 /* ExclamationToken */), + factory.createToken(54 /* ExclamationToken */), propertyDeclaration.type, propertyDeclaration.initializer ); @@ -146840,7 +153448,7 @@ ${lanes.join("\n")} return createCodeFixAction(fixName6, changes, [Diagnostics.Add_undefined_type_to_property_0, info.prop.name.getText()], fixIdAddUndefinedType, Diagnostics.Add_undefined_type_to_all_uninitialized_properties); } function addUndefinedType(changeTracker, sourceFile, info) { - const undefinedTypeNode = factory.createKeywordTypeNode(155 /* UndefinedKeyword */); + const undefinedTypeNode = factory.createKeywordTypeNode(157 /* UndefinedKeyword */); const types = isUnionTypeNode(info.type) ? info.type.types.concat(undefinedTypeNode) : [info.type, undefinedTypeNode]; const unionTypeNode = factory.createUnionTypeNode(types); if (info.isJs) { @@ -146911,7 +153519,7 @@ ${lanes.join("\n")} } return void 0; } - var fixName6, fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer, errorCodes50; + var fixName6, fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer, errorCodes51; var init_fixStrictClassInitialization = __esm({ "src/services/codefixes/fixStrictClassInitialization.ts"() { "use strict"; @@ -146921,11 +153529,11 @@ ${lanes.join("\n")} fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions"; fixIdAddUndefinedType = "addMissingPropertyUndefinedType"; fixIdAddInitializer = "addMissingPropertyInitializer"; - errorCodes50 = [Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code]; + errorCodes51 = [Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code]; registerCodeFix({ - errorCodes: errorCodes50, + errorCodes: errorCodes51, getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) { - const info = getInfo13(context.sourceFile, context.span.start); + const info = getInfo16(context.sourceFile, context.span.start); if (!info) return; const result = []; @@ -146936,8 +153544,8 @@ ${lanes.join("\n")} }, fixIds: [fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer], getAllCodeActions: (context) => { - return codeFixAll(context, errorCodes50, (changes, diag2) => { - const info = getInfo13(diag2.file, diag2.start); + return codeFixAll(context, errorCodes51, (changes, diag2) => { + const info = getInfo16(diag2.file, diag2.start); if (!info) return; switch (context.fixId) { @@ -146964,7 +153572,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/requireInTs.ts - function doChange26(changes, sourceFile, info) { + function doChange34(changes, sourceFile, info) { const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info; changes.replaceNode(sourceFile, statement, defaultImportName && !allowSyntheticDefaults ? factory.createImportEqualsDeclaration( /*modifiers*/ @@ -146987,14 +153595,14 @@ ${lanes.join("\n")} void 0 )); } - function getInfo14(sourceFile, program, pos) { + function getInfo17(sourceFile, program, pos) { const { parent: parent2 } = getTokenAtPosition(sourceFile, pos); if (!isRequireCall( parent2, - /*checkArgumentIsStringLiteralLike*/ + /*requireStringLiteralLikeArgument*/ true )) { - throw Debug.failBadSyntaxKind(parent2); + Debug.failBadSyntaxKind(parent2); } const decl = cast(parent2.parent, isVariableDeclaration); const defaultImportName = tryCast(decl.name, isIdentifier); @@ -147026,29 +153634,29 @@ ${lanes.join("\n")} return factory.createNamedImports(importSpecifiers); } } - var fixId40, errorCodes51; + var fixId41, errorCodes52; var init_requireInTs = __esm({ "src/services/codefixes/requireInTs.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId40 = "requireInTs"; - errorCodes51 = [Diagnostics.require_call_may_be_converted_to_an_import.code]; + fixId41 = "requireInTs"; + errorCodes52 = [Diagnostics.require_call_may_be_converted_to_an_import.code]; registerCodeFix({ - errorCodes: errorCodes51, + errorCodes: errorCodes52, getCodeActions(context) { - const info = getInfo14(context.sourceFile, context.program, context.span.start); + const info = getInfo17(context.sourceFile, context.program, context.span.start); if (!info) { return void 0; } - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, context.sourceFile, info)); - return [createCodeFixAction(fixId40, changes, Diagnostics.Convert_require_to_import, fixId40, Diagnostics.Convert_all_require_to_import)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(t, context.sourceFile, info)); + return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_require_to_import, fixId41, Diagnostics.Convert_all_require_to_import)]; }, - fixIds: [fixId40], - getAllCodeActions: (context) => codeFixAll(context, errorCodes51, (changes, diag2) => { - const info = getInfo14(diag2.file, context.program, diag2.start); + fixIds: [fixId41], + getAllCodeActions: (context) => codeFixAll(context, errorCodes52, (changes, diag2) => { + const info = getInfo17(diag2.file, context.program, diag2.start); if (info) { - doChange26(changes, context.sourceFile, info); + doChange34(changes, context.sourceFile, info); } }) }); @@ -147056,7 +153664,7 @@ ${lanes.join("\n")} }); // src/services/codefixes/useDefaultImport.ts - function getInfo15(sourceFile, pos) { + function getInfo18(sourceFile, pos) { const name = getTokenAtPosition(sourceFile, pos); if (!isIdentifier(name)) return void 0; @@ -147068,7 +153676,7 @@ ${lanes.join("\n")} return { importNode, name, moduleSpecifier: importNode.moduleSpecifier }; } } - function doChange27(changes, sourceFile, info, preferences) { + function doChange35(changes, sourceFile, info, preferences) { changes.replaceNode(sourceFile, info.importNode, makeImport( info.name, /*namedImports*/ @@ -147077,29 +153685,29 @@ ${lanes.join("\n")} getQuotePreference(sourceFile, preferences) )); } - var fixId41, errorCodes52; + var fixId42, errorCodes53; var init_useDefaultImport = __esm({ "src/services/codefixes/useDefaultImport.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId41 = "useDefaultImport"; - errorCodes52 = [Diagnostics.Import_may_be_converted_to_a_default_import.code]; + fixId42 = "useDefaultImport"; + errorCodes53 = [Diagnostics.Import_may_be_converted_to_a_default_import.code]; registerCodeFix({ - errorCodes: errorCodes52, + errorCodes: errorCodes53, getCodeActions(context) { const { sourceFile, span: { start } } = context; - const info = getInfo15(sourceFile, start); + const info = getInfo18(sourceFile, start); if (!info) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, sourceFile, info, context.preferences)); - return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_to_default_import, fixId41, Diagnostics.Convert_all_to_default_imports)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(t, sourceFile, info, context.preferences)); + return [createCodeFixAction(fixId42, changes, Diagnostics.Convert_to_default_import, fixId42, Diagnostics.Convert_all_to_default_imports)]; }, - fixIds: [fixId41], - getAllCodeActions: (context) => codeFixAll(context, errorCodes52, (changes, diag2) => { - const info = getInfo15(diag2.file, diag2.start); + fixIds: [fixId42], + getAllCodeActions: (context) => codeFixAll(context, errorCodes53, (changes, diag2) => { + const info = getInfo18(diag2.file, diag2.start); if (info) - doChange27(changes, diag2.file, info, context.preferences); + doChange35(changes, diag2.file, info, context.preferences); }) }); } @@ -147114,27 +153722,27 @@ ${lanes.join("\n")} const newText = numericLiteral.getText(sourceFile) + "n"; changeTracker.replaceNode(sourceFile, numericLiteral, factory.createBigIntLiteral(newText)); } - var fixId42, errorCodes53; + var fixId43, errorCodes54; var init_useBigintLiteral = __esm({ "src/services/codefixes/useBigintLiteral.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId42 = "useBigintLiteral"; - errorCodes53 = [ + fixId43 = "useBigintLiteral"; + errorCodes54 = [ Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers.code ]; registerCodeFix({ - errorCodes: errorCodes53, + errorCodes: errorCodes54, getCodeActions: function getCodeActionsToUseBigintLiteral(context) { const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange9(t, context.sourceFile, context.span)); if (changes.length > 0) { - return [createCodeFixAction(fixId42, changes, Diagnostics.Convert_to_a_bigint_numeric_literal, fixId42, Diagnostics.Convert_all_to_bigint_numeric_literals)]; + return [createCodeFixAction(fixId43, changes, Diagnostics.Convert_to_a_bigint_numeric_literal, fixId43, Diagnostics.Convert_all_to_bigint_numeric_literals)]; } }, - fixIds: [fixId42], + fixIds: [fixId43], getAllCodeActions: (context) => { - return codeFixAll(context, errorCodes53, (changes, diag2) => makeChange9(changes, diag2.file, diag2)); + return codeFixAll(context, errorCodes54, (changes, diag2) => makeChange9(changes, diag2.file, diag2)); } }); } @@ -147143,41 +153751,41 @@ ${lanes.join("\n")} // src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts function getImportTypeNode(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); - Debug.assert(token.kind === 100 /* ImportKeyword */, "This token should be an ImportKeyword"); - Debug.assert(token.parent.kind === 202 /* ImportType */, "Token parent should be an ImportType"); + Debug.assert(token.kind === 102 /* ImportKeyword */, "This token should be an ImportKeyword"); + Debug.assert(token.parent.kind === 204 /* ImportType */, "Token parent should be an ImportType"); return token.parent; } - function doChange28(changes, sourceFile, importType) { + function doChange36(changes, sourceFile, importType) { const newTypeNode = factory.updateImportTypeNode( importType, importType.argument, importType.assertions, importType.qualifier, importType.typeArguments, - /* isTypeOf */ + /*isTypeOf*/ true ); changes.replaceNode(sourceFile, importType, newTypeNode); } - var fixIdAddMissingTypeof, fixId43, errorCodes54; + var fixIdAddMissingTypeof, fixId44, errorCodes55; var init_fixAddModuleReferTypeMissingTypeof = __esm({ "src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts"() { "use strict"; init_ts4(); init_ts_codefix(); fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof"; - fixId43 = fixIdAddMissingTypeof; - errorCodes54 = [Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code]; + fixId44 = fixIdAddMissingTypeof; + errorCodes55 = [Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code]; registerCodeFix({ - errorCodes: errorCodes54, + errorCodes: errorCodes55, getCodeActions: function getCodeActionsToAddMissingTypeof(context) { const { sourceFile, span } = context; const importType = getImportTypeNode(sourceFile, span.start); - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, importType)); - return [createCodeFixAction(fixId43, changes, Diagnostics.Add_missing_typeof, fixId43, Diagnostics.Add_missing_typeof)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(t, sourceFile, importType)); + return [createCodeFixAction(fixId44, changes, Diagnostics.Add_missing_typeof, fixId44, Diagnostics.Add_missing_typeof)]; }, - fixIds: [fixId43], - getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => doChange28(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start))) + fixIds: [fixId44], + getAllCodeActions: (context) => codeFixAll(context, errorCodes55, (changes, diag2) => doChange36(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start))) }); } }); @@ -147196,7 +153804,7 @@ ${lanes.join("\n")} return void 0; return binaryExpr; } - function doChange29(changeTracker, sf, node) { + function doChange37(changeTracker, sf, node) { const jsx = flattenInvalidBinaryExpr(node); if (jsx) changeTracker.replaceNode(sf, node, factory.createJsxFragment(factory.createJsxOpeningFragment(), jsx, factory.createJsxJsxClosingFragment())); @@ -147205,7 +153813,7 @@ ${lanes.join("\n")} const children = []; let current = node; while (true) { - if (isBinaryExpression(current) && nodeIsMissing(current.operatorToken) && current.operatorToken.kind === 27 /* CommaToken */) { + if (isBinaryExpression(current) && nodeIsMissing(current.operatorToken) && current.operatorToken.kind === 28 /* CommaToken */) { children.push(current.left); if (isJsxChild(current.right)) { children.push(current.right); @@ -147219,37 +153827,37 @@ ${lanes.join("\n")} return void 0; } } - var fixID2, errorCodes55; + var fixID2, errorCodes56; var init_wrapJsxInFragment = __esm({ "src/services/codefixes/wrapJsxInFragment.ts"() { "use strict"; init_ts4(); init_ts_codefix(); fixID2 = "wrapJsxInFragment"; - errorCodes55 = [Diagnostics.JSX_expressions_must_have_one_parent_element.code]; + errorCodes56 = [Diagnostics.JSX_expressions_must_have_one_parent_element.code]; registerCodeFix({ - errorCodes: errorCodes55, + errorCodes: errorCodes56, getCodeActions: function getCodeActionsToWrapJsxInFragment(context) { const { sourceFile, span } = context; const node = findNodeToFix(sourceFile, span.start); if (!node) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, node)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(t, sourceFile, node)); return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)]; }, fixIds: [fixID2], - getAllCodeActions: (context) => codeFixAll(context, errorCodes55, (changes, diag2) => { + getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => { const node = findNodeToFix(context.sourceFile, diag2.start); if (!node) return void 0; - doChange29(changes, context.sourceFile, node); + doChange37(changes, context.sourceFile, node); }) }); } }); // src/services/codefixes/convertToMappedObjectType.ts - function getInfo16(sourceFile, pos) { + function getInfo19(sourceFile, pos) { const token = getTokenAtPosition(sourceFile, pos); const indexSignature = tryCast(token.parent.parent, isIndexSignatureDeclaration); if (!indexSignature) @@ -147262,7 +153870,7 @@ ${lanes.join("\n")} function createTypeAliasFromInterface(declaration, type) { return factory.createTypeAliasDeclaration(declaration.modifiers, declaration.name, declaration.typeParameters, type); } - function doChange30(changes, sourceFile, { indexSignature, container }) { + function doChange38(changes, sourceFile, { indexSignature, container }) { const members = isInterfaceDeclaration(container) ? container.members : container.type.members; const otherMembers = members.filter((member) => !isIndexSignatureDeclaration(member)); const parameter = first(indexSignature.parameters); @@ -147273,7 +153881,7 @@ ${lanes.join("\n")} parameter.type ); const mappedIntersectionType = factory.createMappedTypeNode( - hasEffectiveReadonlyModifier(indexSignature) ? factory.createModifier(146 /* ReadonlyKeyword */) : void 0, + hasEffectiveReadonlyModifier(indexSignature) ? factory.createModifier(148 /* ReadonlyKeyword */) : void 0, mappedTypeParameter, /*nameType*/ void 0, @@ -147289,48 +153897,48 @@ ${lanes.join("\n")} ]); changes.replaceNode(sourceFile, container, createTypeAliasFromInterface(container, intersectionType)); } - var fixId44, errorCodes56; + var fixId45, errorCodes57; var init_convertToMappedObjectType = __esm({ "src/services/codefixes/convertToMappedObjectType.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId44 = "fixConvertToMappedObjectType"; - errorCodes56 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code]; + fixId45 = "fixConvertToMappedObjectType"; + errorCodes57 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code]; registerCodeFix({ - errorCodes: errorCodes56, + errorCodes: errorCodes57, getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) { const { sourceFile, span } = context; - const info = getInfo16(sourceFile, span.start); + const info = getInfo19(sourceFile, span.start); if (!info) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange38(t, sourceFile, info)); const name = idText(info.container.name); - return [createCodeFixAction(fixId44, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId44, [Diagnostics.Convert_0_to_mapped_object_type, name])]; + return [createCodeFixAction(fixId45, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId45, [Diagnostics.Convert_0_to_mapped_object_type, name])]; }, - fixIds: [fixId44], - getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => { - const info = getInfo16(diag2.file, diag2.start); + fixIds: [fixId45], + getAllCodeActions: (context) => codeFixAll(context, errorCodes57, (changes, diag2) => { + const info = getInfo19(diag2.file, diag2.start); if (info) - doChange30(changes, diag2.file, info); + doChange38(changes, diag2.file, info); }) }); } }); // src/services/codefixes/removeAccidentalCallParentheses.ts - var fixId45, errorCodes57; + var fixId46, errorCodes58; var init_removeAccidentalCallParentheses = __esm({ "src/services/codefixes/removeAccidentalCallParentheses.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId45 = "removeAccidentalCallParentheses"; - errorCodes57 = [ + fixId46 = "removeAccidentalCallParentheses"; + errorCodes58 = [ Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without.code ]; registerCodeFix({ - errorCodes: errorCodes57, + errorCodes: errorCodes58, getCodeActions(context) { const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression); if (!callExpression) { @@ -147339,16 +153947,16 @@ ${lanes.join("\n")} const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => { t.deleteRange(context.sourceFile, { pos: callExpression.expression.end, end: callExpression.end }); }); - return [createCodeFixActionWithoutFixAll(fixId45, changes, Diagnostics.Remove_parentheses)]; + return [createCodeFixActionWithoutFixAll(fixId46, changes, Diagnostics.Remove_parentheses)]; }, - fixIds: [fixId45] + fixIds: [fixId46] }); } }); // src/services/codefixes/removeUnnecessaryAwait.ts function makeChange10(changeTracker, sourceFile, span) { - const awaitKeyword = tryCast(getTokenAtPosition(sourceFile, span.start), (node) => node.kind === 133 /* AwaitKeyword */); + const awaitKeyword = tryCast(getTokenAtPosition(sourceFile, span.start), (node) => node.kind === 135 /* AwaitKeyword */); const awaitExpression = awaitKeyword && tryCast(awaitKeyword.parent, isAwaitExpression); if (!awaitExpression) { return; @@ -147363,34 +153971,34 @@ ${lanes.join("\n")} ); if (isIdentifier(leftMostExpression)) { const precedingToken = findPrecedingToken(awaitExpression.parent.pos, sourceFile); - if (precedingToken && precedingToken.kind !== 103 /* NewKeyword */) { + if (precedingToken && precedingToken.kind !== 105 /* NewKeyword */) { expressionToReplace = awaitExpression.parent; } } } changeTracker.replaceNode(sourceFile, expressionToReplace, awaitExpression.expression); } - var fixId46, errorCodes58; + var fixId47, errorCodes59; var init_removeUnnecessaryAwait = __esm({ "src/services/codefixes/removeUnnecessaryAwait.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId46 = "removeUnnecessaryAwait"; - errorCodes58 = [ + fixId47 = "removeUnnecessaryAwait"; + errorCodes59 = [ Diagnostics.await_has_no_effect_on_the_type_of_this_expression.code ]; registerCodeFix({ - errorCodes: errorCodes58, + errorCodes: errorCodes59, getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) { const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange10(t, context.sourceFile, context.span)); if (changes.length > 0) { - return [createCodeFixAction(fixId46, changes, Diagnostics.Remove_unnecessary_await, fixId46, Diagnostics.Remove_all_unnecessary_uses_of_await)]; + return [createCodeFixAction(fixId47, changes, Diagnostics.Remove_unnecessary_await, fixId47, Diagnostics.Remove_all_unnecessary_uses_of_await)]; } }, - fixIds: [fixId46], + fixIds: [fixId47], getAllCodeActions: (context) => { - return codeFixAll(context, errorCodes58, (changes, diag2) => makeChange10(changes, diag2.file, diag2)); + return codeFixAll(context, errorCodes59, (changes, diag2) => makeChange10(changes, diag2.file, diag2)); } }); } @@ -147432,26 +154040,26 @@ ${lanes.join("\n")} importDeclaration.assertClause )); } - var errorCodes59, fixId47; + var errorCodes60, fixId48; var init_splitTypeOnlyImport = __esm({ "src/services/codefixes/splitTypeOnlyImport.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - errorCodes59 = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code]; - fixId47 = "splitTypeOnlyImport"; + errorCodes60 = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code]; + fixId48 = "splitTypeOnlyImport"; registerCodeFix({ - errorCodes: errorCodes59, - fixIds: [fixId47], + errorCodes: errorCodes60, + fixIds: [fixId48], getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) { const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => { return splitTypeOnlyImport(t, getImportDeclaration2(context.sourceFile, context.span), context); }); if (changes.length) { - return [createCodeFixAction(fixId47, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId47, Diagnostics.Split_all_invalid_type_only_imports)]; + return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)]; } }, - getAllCodeActions: (context) => codeFixAll(context, errorCodes59, (changes, error) => { + getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, error) => { splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error), context); }) }); @@ -147459,100 +154067,100 @@ ${lanes.join("\n")} }); // src/services/codefixes/convertConstToLet.ts - function getInfo17(sourceFile, pos, program) { - var _a2; + function getInfo20(sourceFile, pos, program) { + var _a; const checker = program.getTypeChecker(); const symbol = checker.getSymbolAtLocation(getTokenAtPosition(sourceFile, pos)); if (symbol === void 0) return; - const declaration = tryCast((_a2 = symbol == null ? void 0 : symbol.valueDeclaration) == null ? void 0 : _a2.parent, isVariableDeclarationList); + const declaration = tryCast((_a = symbol == null ? void 0 : symbol.valueDeclaration) == null ? void 0 : _a.parent, isVariableDeclarationList); if (declaration === void 0) return; - const constToken = findChildOfKind(declaration, 85 /* ConstKeyword */, sourceFile); + const constToken = findChildOfKind(declaration, 87 /* ConstKeyword */, sourceFile); if (constToken === void 0) return; return { symbol, token: constToken }; } - function doChange31(changes, sourceFile, token) { - changes.replaceNode(sourceFile, token, factory.createToken(119 /* LetKeyword */)); + function doChange39(changes, sourceFile, token) { + changes.replaceNode(sourceFile, token, factory.createToken(121 /* LetKeyword */)); } - var fixId48, errorCodes60; + var fixId49, errorCodes61; var init_convertConstToLet = __esm({ "src/services/codefixes/convertConstToLet.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId48 = "fixConvertConstToLet"; - errorCodes60 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code]; + fixId49 = "fixConvertConstToLet"; + errorCodes61 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code]; registerCodeFix({ - errorCodes: errorCodes60, + errorCodes: errorCodes61, getCodeActions: function getCodeActionsToConvertConstToLet(context) { const { sourceFile, span, program } = context; - const info = getInfo17(sourceFile, span.start, program); + const info = getInfo20(sourceFile, span.start, program); if (info === void 0) return; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, info.token)); - return [createCodeFixActionMaybeFixAll(fixId48, changes, Diagnostics.Convert_const_to_let, fixId48, Diagnostics.Convert_all_const_to_let)]; + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange39(t, sourceFile, info.token)); + return [createCodeFixActionMaybeFixAll(fixId49, changes, Diagnostics.Convert_const_to_let, fixId49, Diagnostics.Convert_all_const_to_let)]; }, getAllCodeActions: (context) => { const { program } = context; const seen = /* @__PURE__ */ new Map(); return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => { - eachDiagnostic(context, errorCodes60, (diag2) => { - const info = getInfo17(diag2.file, diag2.start, program); + eachDiagnostic(context, errorCodes61, (diag2) => { + const info = getInfo20(diag2.file, diag2.start, program); if (info) { if (addToSeen(seen, getSymbolId(info.symbol))) { - return doChange31(changes, diag2.file, info.token); + return doChange39(changes, diag2.file, info.token); } } return void 0; }); })); }, - fixIds: [fixId48] + fixIds: [fixId49] }); } }); // src/services/codefixes/fixExpectedComma.ts - function getInfo18(sourceFile, pos, _) { + function getInfo21(sourceFile, pos, _) { const node = getTokenAtPosition(sourceFile, pos); - return node.kind === 26 /* SemicolonToken */ && node.parent && (isObjectLiteralExpression(node.parent) || isArrayLiteralExpression(node.parent)) ? { node } : void 0; + return node.kind === 27 /* SemicolonToken */ && node.parent && (isObjectLiteralExpression(node.parent) || isArrayLiteralExpression(node.parent)) ? { node } : void 0; } - function doChange32(changes, sourceFile, { node }) { - const newNode = factory.createToken(27 /* CommaToken */); + function doChange40(changes, sourceFile, { node }) { + const newNode = factory.createToken(28 /* CommaToken */); changes.replaceNode(sourceFile, node, newNode); } - var fixId49, expectedErrorCode, errorCodes61; + var fixId50, expectedErrorCode, errorCodes62; var init_fixExpectedComma = __esm({ "src/services/codefixes/fixExpectedComma.ts"() { "use strict"; init_ts4(); init_ts_codefix(); - fixId49 = "fixExpectedComma"; + fixId50 = "fixExpectedComma"; expectedErrorCode = Diagnostics._0_expected.code; - errorCodes61 = [expectedErrorCode]; + errorCodes62 = [expectedErrorCode]; registerCodeFix({ - errorCodes: errorCodes61, + errorCodes: errorCodes62, getCodeActions(context) { const { sourceFile } = context; - const info = getInfo18(sourceFile, context.span.start, context.errorCode); + const info = getInfo21(sourceFile, context.span.start, context.errorCode); if (!info) return void 0; - const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange32(t, sourceFile, info)); + const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange40(t, sourceFile, info)); return [createCodeFixAction( - fixId49, + fixId50, changes, [Diagnostics.Change_0_to_1, ";", ","], - fixId49, + fixId50, [Diagnostics.Change_0_to_1, ";", ","] )]; }, - fixIds: [fixId49], - getAllCodeActions: (context) => codeFixAll(context, errorCodes61, (changes, diag2) => { - const info = getInfo18(diag2.file, diag2.start, diag2.code); + fixIds: [fixId50], + getAllCodeActions: (context) => codeFixAll(context, errorCodes62, (changes, diag2) => { + const info = getInfo21(diag2.file, diag2.start, diag2.code); if (info) - doChange32(changes, context.sourceFile, info); + doChange40(changes, context.sourceFile, info); }) }); } @@ -147574,7 +154182,7 @@ ${lanes.join("\n")} const typeArguments = getEffectiveTypeArguments(decl.parent.parent); if (some(typeArguments)) { const typeArgument = typeArguments[0]; - const needsParens = !isUnionTypeNode(typeArgument) && !isParenthesizedTypeNode(typeArgument) && isParenthesizedTypeNode(factory.createUnionTypeNode([typeArgument, factory.createKeywordTypeNode(114 /* VoidKeyword */)]).types[0]); + const needsParens = !isUnionTypeNode(typeArgument) && !isParenthesizedTypeNode(typeArgument) && isParenthesizedTypeNode(factory.createUnionTypeNode([typeArgument, factory.createKeywordTypeNode(116 /* VoidKeyword */)]).types[0]); if (needsParens) { changes.insertText(sourceFile, typeArgument.pos, "("); } @@ -147596,10 +154204,10 @@ ${lanes.join("\n")} } } function getEffectiveTypeArguments(node) { - var _a2; + var _a; if (isInJSFile(node)) { if (isParenthesizedExpression(node.parent)) { - const jsDocType = (_a2 = getJSDocTypeTag(node.parent)) == null ? void 0 : _a2.typeExpression.type; + const jsDocType = (_a = getJSDocTypeTag(node.parent)) == null ? void 0 : _a.typeExpression.type; if (jsDocType && isTypeReferenceNode(jsDocType) && isIdentifier(jsDocType.typeName) && idText(jsDocType.typeName) === "Promise") { return jsDocType.typeArguments; } @@ -147608,29 +154216,29 @@ ${lanes.join("\n")} return node.typeArguments; } } - var fixName7, fixId50, errorCodes62; + var fixName7, fixId51, errorCodes63; var init_fixAddVoidToPromise = __esm({ "src/services/codefixes/fixAddVoidToPromise.ts"() { "use strict"; init_ts4(); init_ts_codefix(); fixName7 = "addVoidToPromise"; - fixId50 = "addVoidToPromise"; - errorCodes62 = [ + fixId51 = "addVoidToPromise"; + errorCodes63 = [ Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code, Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code ]; registerCodeFix({ - errorCodes: errorCodes62, - fixIds: [fixId50], + errorCodes: errorCodes63, + fixIds: [fixId51], getCodeActions(context) { const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange11(t, context.sourceFile, context.span, context.program)); if (changes.length > 0) { - return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value, fixId50, Diagnostics.Add_void_to_all_Promises_resolved_without_a_value)]; + return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value, fixId51, Diagnostics.Add_void_to_all_Promises_resolved_without_a_value)]; } }, getAllCodeActions(context) { - return codeFixAll(context, errorCodes62, (changes, diag2) => makeChange11(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set())); + return codeFixAll(context, errorCodes63, (changes, diag2) => makeChange11(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set())); } }); } @@ -147665,6 +154273,7 @@ ${lanes.join("\n")} getFixes: () => getFixes, getImportCompletionAction: () => getImportCompletionAction, getImportKind: () => getImportKind, + getJSDocTypedefNode: () => getJSDocTypedefNode, getNoopSymbolTrackerWithResolver: () => getNoopSymbolTrackerWithResolver, getPromoteTypeOnlyCompletionAction: () => getPromoteTypeOnlyCompletionAction, getSupportedErrorCodes: () => getSupportedErrorCodes, @@ -147699,6 +154308,7 @@ ${lanes.join("\n")} init_correctQualifiedNameToIndexedAccessType(); init_convertToTypeOnlyExport(); init_convertToTypeOnlyImport(); + init_convertTypedefToType(); init_convertLiteralTypeToMappedType(); init_fixClassIncorrectlyImplementsInterface(); init_importFixes(); @@ -147735,7 +154345,7 @@ ${lanes.join("\n")} init_inferFromUsage(); init_fixReturnTypeInAsyncFunction(); init_disableJsDiagnostics(); - init_helpers(); + init_helpers2(); init_generateAccessors(); init_fixInvalidImportSyntax(); init_fixStrictClassInitialization(); @@ -147792,7 +154402,7 @@ ${lanes.join("\n")} return !!(origin && origin.kind & 512 /* ComputedPropertyName */); } function resolvingModuleSpecifiers(logPrefix, host, resolver, program, position, preferences, isForImportStatementCompletion, isValidTypeOnlyUseSite, cb) { - var _a2, _b, _c; + var _a, _b, _c; const start = timestamp(); const needsFullResolution = isForImportStatementCompletion || moduleResolutionSupportsPackageJsonExportsAndImports(getEmitModuleResolutionKind(program.getCompilerOptions())); let skippedAny = false; @@ -147807,7 +154417,7 @@ ${lanes.join("\n")} resolvedBeyondLimit: () => resolvedCount > moduleSpecifierResolutionLimit }); const hitRateMessage = cacheAttemptCount ? ` (${(resolvedFromCacheCount / cacheAttemptCount * 100).toFixed(1)}% hit rate)` : ""; - (_a2 = host.log) == null ? void 0 : _a2.call(host, `${logPrefix}: resolved ${resolvedCount} module specifiers, plus ${ambientCount} ambient and ${resolvedFromCacheCount} from cache${hitRateMessage}`); + (_a = host.log) == null ? void 0 : _a.call(host, `${logPrefix}: resolved ${resolvedCount} module specifiers, plus ${ambientCount} ambient and ${resolvedFromCacheCount} from cache${hitRateMessage}`); (_b = host.log) == null ? void 0 : _b.call(host, `${logPrefix}: response is ${skippedAny ? "incomplete" : "complete"}`); (_c = host.log) == null ? void 0 : _c.call(host, `${logPrefix}: ${timestamp() - start}`); return result; @@ -147834,7 +154444,7 @@ ${lanes.join("\n")} } } function getCompletionsAtPosition(host, program, log, sourceFile, position, preferences, triggerCharacter, completionKind, cancellationToken, formatContext, includeSymbol = false) { - var _a2; + var _a; const { previousToken } = getRelevantTokens(position, sourceFile); if (triggerCharacter && !isInString(sourceFile, position, previousToken) && !isValidTrigger(sourceFile, triggerCharacter, previousToken, position)) { return void 0; @@ -147846,7 +154456,8 @@ ${lanes.join("\n")} return void 0; } const compilerOptions = program.getCompilerOptions(); - const incompleteCompletionsCache = preferences.allowIncompleteCompletions ? (_a2 = host.getIncompleteCompletionsCache) == null ? void 0 : _a2.call(host) : void 0; + const checker = program.getTypeChecker(); + const incompleteCompletionsCache = preferences.allowIncompleteCompletions ? (_a = host.getIncompleteCompletionsCache) == null ? void 0 : _a.call(host) : void 0; if (incompleteCompletionsCache && completionKind === 3 /* TriggerForIncompleteCompletions */ && previousToken && isIdentifier(previousToken)) { const incompleteContinuation = continuePreviousIncompleteResponse(incompleteCompletionsCache, sourceFile, previousToken, program, host, preferences, cancellationToken, position); if (incompleteContinuation) { @@ -147859,7 +154470,7 @@ ${lanes.join("\n")} if (stringCompletions) { return stringCompletions; } - if (previousToken && isBreakOrContinueStatement(previousToken.parent) && (previousToken.kind === 81 /* BreakKeyword */ || previousToken.kind === 86 /* ContinueKeyword */ || previousToken.kind === 79 /* Identifier */)) { + if (previousToken && isBreakOrContinueStatement(previousToken.parent) && (previousToken.kind === 83 /* BreakKeyword */ || previousToken.kind === 88 /* ContinueKeyword */ || previousToken.kind === 80 /* Identifier */)) { return getLabelCompletionAtPosition(previousToken.parent); } const completionData = getCompletionData( @@ -147886,9 +154497,31 @@ ${lanes.join("\n")} } return response; case 1 /* JsDocTagName */: - return jsdocCompletionInfo(ts_JsDoc_exports.getJSDocTagNameCompletions()); + return jsdocCompletionInfo([ + ...ts_JsDoc_exports.getJSDocTagNameCompletions(), + ...getJSDocParameterCompletions( + sourceFile, + position, + checker, + compilerOptions, + preferences, + /*tagNameOnly*/ + true + ) + ]); case 2 /* JsDocTag */: - return jsdocCompletionInfo(ts_JsDoc_exports.getJSDocTagCompletions()); + return jsdocCompletionInfo([ + ...ts_JsDoc_exports.getJSDocTagCompletions(), + ...getJSDocParameterCompletions( + sourceFile, + position, + checker, + compilerOptions, + preferences, + /*tagNameOnly*/ + false + ) + ]); case 3 /* JsDocParameterName */: return jsdocCompletionInfo(ts_JsDoc_exports.getJSDocParameterNameCompletions(completionData.tag)); case 4 /* Keywords */: @@ -147898,12 +154531,12 @@ ${lanes.join("\n")} } } function compareCompletionEntries(entryInArray, entryToInsert) { - var _a2, _b; + var _a, _b; let result = compareStringsCaseSensitiveUI(entryInArray.sortText, entryToInsert.sortText); if (result === 0 /* EqualTo */) { result = compareStringsCaseSensitiveUI(entryInArray.name, entryToInsert.name); } - if (result === 0 /* EqualTo */ && ((_a2 = entryInArray.data) == null ? void 0 : _a2.moduleSpecifier) && ((_b = entryToInsert.data) == null ? void 0 : _b.moduleSpecifier)) { + if (result === 0 /* EqualTo */ && ((_a = entryInArray.data) == null ? void 0 : _a.moduleSpecifier) && ((_b = entryToInsert.data) == null ? void 0 : _b.moduleSpecifier)) { result = compareNumberOfDirectorySeparators( entryInArray.data.moduleSpecifier, entryToInsert.data.moduleSpecifier @@ -147936,7 +154569,7 @@ ${lanes.join("\n")} isValidTypeOnlyAliasUseSite(location), (context) => { const entries = mapDefined(previousResponse.entries, (entry) => { - var _a2; + var _a; if (!entry.hasAction || !entry.source || !entry.data || completionEntryDataIsResolved(entry.data)) { return entry; } @@ -147949,7 +154582,7 @@ ${lanes.join("\n")} if (result === "skipped") return entry; if (!result || result === "failed") { - (_a2 = host.log) == null ? void 0 : _a2.call(host, `Unexpected failure resolving auto import for '${entry.name}' from '${entry.source}'`); + (_a = host.log) == null ? void 0 : _a.call(host, `Unexpected failure resolving auto import for '${entry.name}' from '${entry.source}'`); return void 0; } const newOrigin = { @@ -147976,6 +154609,264 @@ ${lanes.join("\n")} function jsdocCompletionInfo(entries) { return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries }; } + function getJSDocParameterCompletions(sourceFile, position, checker, options, preferences, tagNameOnly) { + const currentToken = getTokenAtPosition(sourceFile, position); + if (!isJSDocTag(currentToken) && !isJSDoc(currentToken)) { + return []; + } + const jsDoc = isJSDoc(currentToken) ? currentToken : currentToken.parent; + if (!isJSDoc(jsDoc)) { + return []; + } + const func = jsDoc.parent; + if (!isFunctionLike(func)) { + return []; + } + const isJs = isSourceFileJS(sourceFile); + const isSnippet = preferences.includeCompletionsWithSnippetText || void 0; + const paramTagCount = countWhere(jsDoc.tags, (tag) => isJSDocParameterTag(tag) && tag.getEnd() <= position); + return mapDefined(func.parameters, (param) => { + if (getJSDocParameterTags(param).length) { + return void 0; + } + if (isIdentifier(param.name)) { + const tabstopCounter = { tabstop: 1 }; + const paramName = param.name.text; + let displayText = getJSDocParamAnnotation( + paramName, + param.initializer, + param.dotDotDotToken, + isJs, + /*isObject*/ + false, + /*isSnippet*/ + false, + checker, + options, + preferences + ); + let snippetText = isSnippet ? getJSDocParamAnnotation( + paramName, + param.initializer, + param.dotDotDotToken, + isJs, + /*isObject*/ + false, + /*isSnippet*/ + true, + checker, + options, + preferences, + tabstopCounter + ) : void 0; + if (tagNameOnly) { + displayText = displayText.slice(1); + if (snippetText) + snippetText = snippetText.slice(1); + } + return { + name: displayText, + kind: "parameter" /* parameterElement */, + sortText: SortText.LocationPriority, + insertText: isSnippet ? snippetText : void 0, + isSnippet + }; + } else if (param.parent.parameters.indexOf(param) === paramTagCount) { + const paramPath = `param${paramTagCount}`; + const displayTextResult = generateJSDocParamTagsForDestructuring( + paramPath, + param.name, + param.initializer, + param.dotDotDotToken, + isJs, + /*isSnippet*/ + false, + checker, + options, + preferences + ); + const snippetTextResult = isSnippet ? generateJSDocParamTagsForDestructuring( + paramPath, + param.name, + param.initializer, + param.dotDotDotToken, + isJs, + /*isSnippet*/ + true, + checker, + options, + preferences + ) : void 0; + let displayText = displayTextResult.join(getNewLineCharacter(options) + "* "); + let snippetText = snippetTextResult == null ? void 0 : snippetTextResult.join(getNewLineCharacter(options) + "* "); + if (tagNameOnly) { + displayText = displayText.slice(1); + if (snippetText) + snippetText = snippetText.slice(1); + } + return { + name: displayText, + kind: "parameter" /* parameterElement */, + sortText: SortText.LocationPriority, + insertText: isSnippet ? snippetText : void 0, + isSnippet + }; + } + }); + } + function generateJSDocParamTagsForDestructuring(path, pattern, initializer, dotDotDotToken, isJs, isSnippet, checker, options, preferences) { + if (!isJs) { + return [ + getJSDocParamAnnotation( + path, + initializer, + dotDotDotToken, + isJs, + /*isObject*/ + false, + isSnippet, + checker, + options, + preferences, + { tabstop: 1 } + ) + ]; + } + return patternWorker(path, pattern, initializer, dotDotDotToken, { tabstop: 1 }); + function patternWorker(path2, pattern2, initializer2, dotDotDotToken2, counter) { + if (isObjectBindingPattern(pattern2) && !dotDotDotToken2) { + const oldTabstop = counter.tabstop; + const childCounter = { tabstop: oldTabstop }; + const rootParam = getJSDocParamAnnotation( + path2, + initializer2, + dotDotDotToken2, + isJs, + /*isObject*/ + true, + isSnippet, + checker, + options, + preferences, + childCounter + ); + let childTags = []; + for (const element of pattern2.elements) { + const elementTags = elementWorker(path2, element, childCounter); + if (!elementTags) { + childTags = void 0; + break; + } else { + childTags.push(...elementTags); + } + } + if (childTags) { + counter.tabstop = childCounter.tabstop; + return [rootParam, ...childTags]; + } + } + return [ + getJSDocParamAnnotation( + path2, + initializer2, + dotDotDotToken2, + isJs, + /*isObject*/ + false, + isSnippet, + checker, + options, + preferences, + counter + ) + ]; + } + function elementWorker(path2, element, counter) { + if (!element.propertyName && isIdentifier(element.name) || isIdentifier(element.name)) { + const propertyName = element.propertyName ? tryGetTextOfPropertyName(element.propertyName) : element.name.text; + if (!propertyName) { + return void 0; + } + const paramName = `${path2}.${propertyName}`; + return [ + getJSDocParamAnnotation( + paramName, + element.initializer, + element.dotDotDotToken, + isJs, + /*isObject*/ + false, + isSnippet, + checker, + options, + preferences, + counter + ) + ]; + } else if (element.propertyName) { + const propertyName = tryGetTextOfPropertyName(element.propertyName); + return propertyName && patternWorker(`${path2}.${propertyName}`, element.name, element.initializer, element.dotDotDotToken, counter); + } + return void 0; + } + } + function getJSDocParamAnnotation(paramName, initializer, dotDotDotToken, isJs, isObject, isSnippet, checker, options, preferences, tabstopCounter) { + if (isSnippet) { + Debug.assertIsDefined(tabstopCounter); + } + if (initializer) { + paramName = getJSDocParamNameWithInitializer(paramName, initializer); + } + if (isSnippet) { + paramName = escapeSnippetText(paramName); + } + if (isJs) { + let type = "*"; + if (isObject) { + Debug.assert(!dotDotDotToken, `Cannot annotate a rest parameter with type 'Object'.`); + type = "Object"; + } else { + if (initializer) { + const inferredType = checker.getTypeAtLocation(initializer.parent); + if (!(inferredType.flags & (1 /* Any */ | 16384 /* Void */))) { + const sourceFile = initializer.getSourceFile(); + const quotePreference = getQuotePreference(sourceFile, preferences); + const builderFlags = quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */; + const typeNode = checker.typeToTypeNode(inferredType, findAncestor(initializer, isFunctionLike), builderFlags); + if (typeNode) { + const printer = isSnippet ? createSnippetPrinter({ + removeComments: true, + module: options.module, + target: options.target + }) : createPrinter({ + removeComments: true, + module: options.module, + target: options.target + }); + setEmitFlags(typeNode, 1 /* SingleLine */); + type = printer.printNode(4 /* Unspecified */, typeNode, sourceFile); + } + } + } + if (isSnippet && type === "*") { + type = `\${${tabstopCounter.tabstop++}:${type}}`; + } + } + const dotDotDot = !isObject && dotDotDotToken ? "..." : ""; + const description3 = isSnippet ? `\${${tabstopCounter.tabstop++}}` : ""; + return `@param {${dotDotDot}${type}} ${paramName} ${description3}`; + } else { + const description3 = isSnippet ? `\${${tabstopCounter.tabstop++}}` : ""; + return `@param ${paramName} ${description3}`; + } + } + function getJSDocParamNameWithInitializer(paramName, initializer) { + const initializerText = initializer.getText().trim(); + if (initializerText.includes("\n") || initializerText.length > 80) { + return `[${paramName}]`; + } + return `[${paramName}=${initializerText}]`; + } function keywordToCompletionEntry(keyword) { return { name: tokenToString(keyword), @@ -148001,14 +154892,14 @@ ${lanes.join("\n")} } function keywordFiltersFromSyntaxKind(keywordCompletion) { switch (keywordCompletion) { - case 154 /* TypeKeyword */: + case 156 /* TypeKeyword */: return 8 /* TypeKeyword */; default: Debug.fail("Unknown mapping from SyntaxKind to KeywordCompletionFilters"); } } function getOptionalReplacementSpan(location) { - return (location == null ? void 0 : location.kind) === 79 /* Identifier */ ? createTextSpanFromNode(location) : void 0; + return (location == null ? void 0 : location.kind) === 80 /* Identifier */ ? createTextSpanFromNode(location) : void 0; } function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position, includeSymbol) { const { @@ -148180,10 +155071,10 @@ ${lanes.join("\n")} } else if (!tracker.hasValue(type.value)) { switch (typeof type.value) { case "object": - elements.push(type.value.negative ? factory.createPrefixUnaryExpression(40 /* MinusToken */, factory.createBigIntLiteral({ negative: false, base10Value: type.value.base10Value })) : factory.createBigIntLiteral(type.value)); + elements.push(type.value.negative ? factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createBigIntLiteral({ negative: false, base10Value: type.value.base10Value })) : factory.createBigIntLiteral(type.value)); break; case "number": - elements.push(type.value < 0 ? factory.createPrefixUnaryExpression(40 /* MinusToken */, factory.createNumericLiteral(-type.value)) : factory.createNumericLiteral(type.value)); + elements.push(type.value < 0 ? factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(-type.value)) : factory.createNumericLiteral(type.value)); break; case "string": elements.push(factory.createStringLiteral(type.value, quotePreference === 0 /* Single */)); @@ -148227,28 +155118,28 @@ ${lanes.join("\n")} } function typeNodeToExpression(typeNode, languageVersion, quotePreference) { switch (typeNode.kind) { - case 180 /* TypeReference */: + case 182 /* TypeReference */: const typeName = typeNode.typeName; return entityNameToExpression(typeName, languageVersion, quotePreference); - case 196 /* IndexedAccessType */: + case 198 /* IndexedAccessType */: const objectExpression = typeNodeToExpression(typeNode.objectType, languageVersion, quotePreference); const indexExpression = typeNodeToExpression(typeNode.indexType, languageVersion, quotePreference); return objectExpression && indexExpression && factory.createElementAccessExpression(objectExpression, indexExpression); - case 198 /* LiteralType */: + case 200 /* LiteralType */: const literal = typeNode.literal; switch (literal.kind) { - case 10 /* StringLiteral */: + case 11 /* StringLiteral */: return factory.createStringLiteral(literal.text, quotePreference === 0 /* Single */); - case 8 /* NumericLiteral */: + case 9 /* NumericLiteral */: return factory.createNumericLiteral(literal.text, literal.numericLiteralFlags); } return void 0; - case 193 /* ParenthesizedType */: + case 195 /* ParenthesizedType */: const exp = typeNodeToExpression(typeNode.type, languageVersion, quotePreference); return exp && (isIdentifier(exp) ? exp : factory.createParenthesizedExpression(exp)); - case 183 /* TypeQuery */: + case 185 /* TypeQuery */: return entityNameToExpression(typeNode.exprName, languageVersion, quotePreference); - case 202 /* ImportType */: + case 204 /* ImportType */: Debug.fail(`We should not get an import type after calling 'codefix.typeToAutoImportableTypeNode'.`); } return void 0; @@ -148283,19 +155174,19 @@ ${lanes.join("\n")} function getJsxClosingTagCompletion(location, sourceFile) { const jsxClosingElement = findAncestor(location, (node) => { switch (node.kind) { - case 284 /* JsxClosingElement */: + case 286 /* JsxClosingElement */: return true; - case 43 /* SlashToken */: - case 31 /* GreaterThanToken */: - case 79 /* Identifier */: - case 208 /* PropertyAccessExpression */: + case 44 /* SlashToken */: + case 32 /* GreaterThanToken */: + case 80 /* Identifier */: + case 210 /* PropertyAccessExpression */: return false; default: return "quit"; } }); if (jsxClosingElement) { - const hasClosingAngleBracket = !!findChildOfKind(jsxClosingElement, 31 /* GreaterThanToken */, sourceFile); + const hasClosingAngleBracket = !!findChildOfKind(jsxClosingElement, 32 /* GreaterThanToken */, sourceFile); const tagName = jsxClosingElement.parent.openingElement.tagName; const closingTag = tagName.getText(sourceFile); const fullClosingTag = closingTag + (hasClosingAngleBracket ? "" : ">"); @@ -148353,7 +155244,7 @@ ${lanes.join("\n")} if (insertQuestionDot || propertyAccessToConvert.questionDotToken) { insertText = `?.${insertText}`; } - const dot = findChildOfKind(propertyAccessToConvert, 24 /* DotToken */, sourceFile) || findChildOfKind(propertyAccessToConvert, 28 /* QuestionDotToken */, sourceFile); + const dot = findChildOfKind(propertyAccessToConvert, 25 /* DotToken */, sourceFile) || findChildOfKind(propertyAccessToConvert, 29 /* QuestionDotToken */, sourceFile); if (!dot) { return void 0; } @@ -148483,14 +155374,14 @@ ${lanes.join("\n")} const emptyStmt = factory.createEmptyStatement(); body = factory.createBlock( [emptyStmt], - /* multiline */ + /*multiLine*/ true ); setSnippetElement(emptyStmt, { kind: 0 /* TabStop */, order: 0 }); } else { body = factory.createBlock( [], - /* multiline */ + /*multiLine*/ true ); } @@ -148642,10 +155533,10 @@ ${lanes.join("\n")} const quotePreference = getQuotePreference(sourceFile, preferences); const builderFlags = 33554432 /* OmitThisParameter */ | (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */); switch (declaration.kind) { - case 168 /* PropertySignature */: - case 169 /* PropertyDeclaration */: - case 170 /* MethodSignature */: - case 171 /* MethodDeclaration */: { + case 170 /* PropertySignature */: + case 171 /* PropertyDeclaration */: + case 172 /* MethodSignature */: + case 173 /* MethodDeclaration */: { let effectiveType = type.flags & 1048576 /* Union */ && type.types.length < 10 ? checker.getUnionType(type.types, 2 /* Subtype */) : type; if (effectiveType.flags & 1048576 /* Union */) { const functionTypes = filter(effectiveType.types, (type2) => checker.getSignaturesOfType(type2, 0 /* Call */).length > 0); @@ -148668,14 +155559,14 @@ ${lanes.join("\n")} const emptyStmt = factory.createEmptyStatement(); body = factory.createBlock( [emptyStmt], - /* multiline */ + /*multiLine*/ true ); setSnippetElement(emptyStmt, { kind: 0 /* TabStop */, order: 0 }); } else { body = factory.createBlock( [], - /* multiline */ + /*multiLine*/ true ); } @@ -148871,7 +155762,7 @@ ${lanes.join("\n")} } function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) { const replacementSpan = importStatementCompletion.replacementSpan; - const quotedModuleSpecifier = quote(sourceFile, preferences, escapeSnippetText(origin.moduleSpecifier)); + const quotedModuleSpecifier = escapeSnippetText(quote(sourceFile, preferences, origin.moduleSpecifier)); const exportKind = origin.isDefaultExport ? 1 /* Default */ : origin.exportName === "export=" /* ExportEquals */ ? 2 /* ExportEquals */ : 0 /* Named */; const tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : ""; const importKind = ts_codefix_exports.getImportKind( @@ -148882,8 +155773,8 @@ ${lanes.join("\n")} true ); const isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier; - const topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? ` ${tokenToString(154 /* TypeKeyword */)} ` : " "; - const importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? `${tokenToString(154 /* TypeKeyword */)} ` : ""; + const topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? ` ${tokenToString(156 /* TypeKeyword */)} ` : " "; + const importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? `${tokenToString(156 /* TypeKeyword */)} ` : ""; const suffix = useSemicolons ? ";" : ""; switch (importKind) { case 3 /* CommonJS */: @@ -148920,9 +155811,8 @@ ${lanes.join("\n")} } } function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) { - var _a2; const start = timestamp(); - const variableDeclaration = getVariableDeclaration(location); + const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location); const useSemicolons = probablyUsesSemicolons(sourceFile); const typeChecker = program.getTypeChecker(); const uniques = /* @__PURE__ */ new Map(); @@ -148934,7 +155824,7 @@ ${lanes.join("\n")} continue; } const { name, needsConvertPropertyAccess } = info; - const originalSortText = (_a2 = symbolToSortTextMap == null ? void 0 : symbolToSortTextMap[getSymbolId(symbol)]) != null ? _a2 : SortText.LocationPriority; + const originalSortText = (symbolToSortTextMap == null ? void 0 : symbolToSortTextMap[getSymbolId(symbol)]) ?? SortText.LocationPriority; const sortText = isDeprecated(symbol, typeChecker) ? SortText.Deprecated(originalSortText) : originalSortText; const entry = createCompletionEntry( symbol, @@ -148981,14 +155871,23 @@ ${lanes.join("\n")} add: (name) => uniques.set(name, true) }; function shouldIncludeSymbol(symbol, symbolToSortTextMap2) { + var _a; let allFlags = symbol.flags; if (!isSourceFile(location)) { if (isExportAssignment(location.parent)) { return true; } - if (variableDeclaration && symbol.valueDeclaration === variableDeclaration) { + if (tryCast(variableOrParameterDeclaration, isVariableDeclaration) && symbol.valueDeclaration === variableOrParameterDeclaration) { return false; } + const symbolDeclaration = symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]); + if (variableOrParameterDeclaration && symbolDeclaration && (isTypeParameterDeclaration(variableOrParameterDeclaration) && isTypeParameterDeclaration(symbolDeclaration) || isParameter(variableOrParameterDeclaration) && isParameter(symbolDeclaration))) { + const symbolDeclarationPos = symbolDeclaration.pos; + const parameters = isParameter(variableOrParameterDeclaration) ? variableOrParameterDeclaration.parent.parameters : isInferTypeNode(variableOrParameterDeclaration.parent) ? void 0 : variableOrParameterDeclaration.parent.typeParameters; + if (symbolDeclarationPos >= variableOrParameterDeclaration.pos && parameters && symbolDeclarationPos < parameters.end) { + return false; + } + } const symbolOrigin = skipAlias(symbol, typeChecker); if (!!sourceFile.externalModuleIndicator && !compilerOptions.allowUmdGlobalAccess && symbolToSortTextMap2[getSymbolId(symbol)] === SortText.GlobalsOrKeywords && (symbolToSortTextMap2[getSymbolId(symbolOrigin)] === SortText.AutoImportSuggestions || symbolToSortTextMap2[getSymbolId(symbolOrigin)] === SortText.LocationPriority)) { return false; @@ -149224,7 +156123,7 @@ ${lanes.join("\n")} const checker = origin.isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); const { moduleSymbol } = origin; const targetSymbol = checker.getMergedSymbol(skipAlias(symbol.exportSymbol || symbol, checker)); - const isJsxOpeningTagName = (contextToken == null ? void 0 : contextToken.kind) === 29 /* LessThanToken */ && isJsxOpeningLikeElement(contextToken.parent); + const isJsxOpeningTagName = (contextToken == null ? void 0 : contextToken.kind) === 30 /* LessThanToken */ && isJsxOpeningLikeElement(contextToken.parent); const { moduleSpecifier, codeAction } = ts_codefix_exports.getImportCompletionAction( targetSymbol, moduleSymbol, @@ -149255,35 +156154,35 @@ ${lanes.join("\n")} function getContextualType(previousToken, position, sourceFile, checker) { const { parent: parent2 } = previousToken; switch (previousToken.kind) { - case 79 /* Identifier */: + case 80 /* Identifier */: return getContextualTypeFromParent(previousToken, checker); - case 63 /* EqualsToken */: + case 64 /* EqualsToken */: switch (parent2.kind) { - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: return checker.getContextualType(parent2.initializer); - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return checker.getTypeAtLocation(parent2.left); - case 288 /* JsxAttribute */: + case 290 /* JsxAttribute */: return checker.getContextualTypeForJsxAttribute(parent2); default: return void 0; } - case 103 /* NewKeyword */: + case 105 /* NewKeyword */: return checker.getContextualType(parent2); - case 82 /* CaseKeyword */: + case 84 /* CaseKeyword */: const caseClause = tryCast(parent2, isCaseClause); return caseClause ? getSwitchedType(caseClause, checker) : void 0; - case 18 /* OpenBraceToken */: + case 19 /* OpenBraceToken */: return isJsxExpression(parent2) && !isJsxElement(parent2.parent) && !isJsxFragment(parent2.parent) ? checker.getContextualTypeForJsxAttribute(parent2.parent) : void 0; default: const argInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(previousToken, position, sourceFile); return argInfo ? ( // At `,`, treat this as the next argument after the comma. - checker.getContextualTypeForArgumentAtIndex(argInfo.invocation, argInfo.argumentIndex + (previousToken.kind === 27 /* CommaToken */ ? 1 : 0)) + checker.getContextualTypeForArgumentAtIndex(argInfo.invocation, argInfo.argumentIndex + (previousToken.kind === 28 /* CommaToken */ ? 1 : 0)) ) : isEqualityOperatorKind(previousToken.kind) && isBinaryExpression(parent2) && isEqualityOperatorKind(parent2.operatorToken.kind) ? ( // completion at `x ===/**/` should be for the right side checker.getTypeAtLocation(parent2.left) - ) : checker.getContextualType(previousToken); + ) : checker.getContextualType(previousToken, 4 /* Completions */) || checker.getContextualType(previousToken); } } function getFirstSymbolInChain(symbol, enclosingDeclaration, checker) { @@ -149300,8 +156199,8 @@ ${lanes.join("\n")} return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker)); } function isModuleSymbol(symbol) { - var _a2; - return !!((_a2 = symbol.declarations) == null ? void 0 : _a2.some((d) => d.kind === 308 /* SourceFile */)); + var _a; + return !!((_a = symbol.declarations) == null ? void 0 : _a.some((d) => d.kind === 311 /* SourceFile */)); } function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) { const typeChecker = program.getTypeChecker(); @@ -149333,7 +156232,7 @@ ${lanes.join("\n")} const typeExpression = tryGetTypeExpressionFromTag(tag); if (typeExpression) { currentToken = getTokenAtPosition(sourceFile, position); - if (!currentToken || !isDeclarationName(currentToken) && (currentToken.parent.kind !== 351 /* JSDocPropertyTag */ || currentToken.parent.name !== currentToken)) { + if (!currentToken || !isDeclarationName(currentToken) && (currentToken.parent.kind !== 354 /* JSDocPropertyTag */ || currentToken.parent.name !== currentToken)) { insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression); } } @@ -149387,91 +156286,91 @@ ${lanes.join("\n")} return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation()) : void 0; } let parent2 = contextToken.parent; - if (contextToken.kind === 24 /* DotToken */ || contextToken.kind === 28 /* QuestionDotToken */) { - isRightOfDot = contextToken.kind === 24 /* DotToken */; - isRightOfQuestionDot = contextToken.kind === 28 /* QuestionDotToken */; + if (contextToken.kind === 25 /* DotToken */ || contextToken.kind === 29 /* QuestionDotToken */) { + isRightOfDot = contextToken.kind === 25 /* DotToken */; + isRightOfQuestionDot = contextToken.kind === 29 /* QuestionDotToken */; switch (parent2.kind) { - case 208 /* PropertyAccessExpression */: + case 210 /* PropertyAccessExpression */: propertyAccessToConvert = parent2; node = propertyAccessToConvert.expression; const leftmostAccessExpression = getLeftmostAccessExpression(propertyAccessToConvert); - if (nodeIsMissing(leftmostAccessExpression) || (isCallExpression(node) || isFunctionLike(node)) && node.end === contextToken.pos && node.getChildCount(sourceFile) && last(node.getChildren(sourceFile)).kind !== 21 /* CloseParenToken */) { + if (nodeIsMissing(leftmostAccessExpression) || (isCallExpression(node) || isFunctionLike(node)) && node.end === contextToken.pos && node.getChildCount(sourceFile) && last(node.getChildren(sourceFile)).kind !== 22 /* CloseParenToken */) { return void 0; } break; - case 163 /* QualifiedName */: + case 165 /* QualifiedName */: node = parent2.left; break; - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: node = parent2.name; break; - case 202 /* ImportType */: + case 204 /* ImportType */: node = parent2; break; - case 233 /* MetaProperty */: + case 235 /* MetaProperty */: node = parent2.getFirstToken(sourceFile); - Debug.assert(node.kind === 100 /* ImportKeyword */ || node.kind === 103 /* NewKeyword */); + Debug.assert(node.kind === 102 /* ImportKeyword */ || node.kind === 105 /* NewKeyword */); break; default: return void 0; } } else if (!importStatementCompletion) { - if (parent2 && parent2.kind === 208 /* PropertyAccessExpression */) { + if (parent2 && parent2.kind === 210 /* PropertyAccessExpression */) { contextToken = parent2; parent2 = parent2.parent; } if (currentToken.parent === location) { switch (currentToken.kind) { - case 31 /* GreaterThanToken */: - if (currentToken.parent.kind === 281 /* JsxElement */ || currentToken.parent.kind === 283 /* JsxOpeningElement */) { + case 32 /* GreaterThanToken */: + if (currentToken.parent.kind === 283 /* JsxElement */ || currentToken.parent.kind === 285 /* JsxOpeningElement */) { location = currentToken; } break; - case 43 /* SlashToken */: - if (currentToken.parent.kind === 282 /* JsxSelfClosingElement */) { + case 44 /* SlashToken */: + if (currentToken.parent.kind === 284 /* JsxSelfClosingElement */) { location = currentToken; } break; } } switch (parent2.kind) { - case 284 /* JsxClosingElement */: - if (contextToken.kind === 43 /* SlashToken */) { + case 286 /* JsxClosingElement */: + if (contextToken.kind === 44 /* SlashToken */) { isStartingCloseTag = true; location = contextToken; } break; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: if (!binaryExpressionMayBeOpenTag(parent2)) { break; } - case 282 /* JsxSelfClosingElement */: - case 281 /* JsxElement */: - case 283 /* JsxOpeningElement */: + case 284 /* JsxSelfClosingElement */: + case 283 /* JsxElement */: + case 285 /* JsxOpeningElement */: isJsxIdentifierExpected = true; - if (contextToken.kind === 29 /* LessThanToken */) { + if (contextToken.kind === 30 /* LessThanToken */) { isRightOfOpenTag = true; location = contextToken; } break; - case 291 /* JsxExpression */: - case 290 /* JsxSpreadAttribute */: - if (previousToken.kind === 19 /* CloseBraceToken */ || previousToken.kind === 79 /* Identifier */ && previousToken.parent.kind === 288 /* JsxAttribute */) { + case 293 /* JsxExpression */: + case 292 /* JsxSpreadAttribute */: + if (previousToken.kind === 20 /* CloseBraceToken */ || previousToken.kind === 80 /* Identifier */ && previousToken.parent.kind === 290 /* JsxAttribute */) { isJsxIdentifierExpected = true; } break; - case 288 /* JsxAttribute */: + case 290 /* JsxAttribute */: if (parent2.initializer === previousToken && previousToken.end < position) { isJsxIdentifierExpected = true; break; } switch (previousToken.kind) { - case 63 /* EqualsToken */: + case 64 /* EqualsToken */: isJsxInitializer = true; break; - case 79 /* Identifier */: + case 80 /* Identifier */: isJsxIdentifierExpected = true; - if (parent2 !== previousToken.parent && !parent2.initializer && findChildOfKind(parent2, 63 /* EqualsToken */, sourceFile)) { + if (parent2 !== previousToken.parent && !parent2.initializer && findChildOfKind(parent2, 64 /* EqualsToken */, sourceFile)) { isJsxInitializer = previousToken; } } @@ -149515,7 +156414,8 @@ ${lanes.join("\n")} } log("getCompletionData: Semantic work: " + (timestamp() - semanticStart)); const contextualType = previousToken && getContextualType(previousToken, position, sourceFile, typeChecker); - const literals = mapDefined( + const isLiteralExpected = !tryCast(previousToken, isStringLiteralLike) && !isJsxIdentifierExpected; + const literals = !isLiteralExpected ? [] : mapDefined( contextualType && (contextualType.isUnion() ? contextualType.types : [contextualType]), (t) => t.isLiteral() && !(t.flags & 1024 /* EnumLiteral */) ? t.value : void 0 ); @@ -149547,15 +156447,15 @@ ${lanes.join("\n")} }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 344 /* JSDocParameterTag */: - case 351 /* JSDocPropertyTag */: - case 345 /* JSDocReturnTag */: - case 347 /* JSDocTypeTag */: - case 349 /* JSDocTypedefTag */: - case 352 /* JSDocThrowsTag */: - case 353 /* JSDocSatisfiesTag */: + case 347 /* JSDocParameterTag */: + case 354 /* JSDocPropertyTag */: + case 348 /* JSDocReturnTag */: + case 350 /* JSDocTypeTag */: + case 352 /* JSDocTypedefTag */: + case 355 /* JSDocThrowsTag */: + case 356 /* JSDocSatisfiesTag */: return true; - case 348 /* JSDocTemplateTag */: + case 351 /* JSDocTemplateTag */: return !!tag.constraint; default: return false; @@ -149564,7 +156464,7 @@ ${lanes.join("\n")} function tryGetTypeExpressionFromTag(tag) { if (isTagWithTypeExpression(tag)) { const typeExpression = isJSDocTemplateTag(tag) ? tag.constraint : tag.typeExpression; - return typeExpression && typeExpression.kind === 312 /* JSDocTypeExpression */ ? typeExpression : void 0; + return typeExpression && typeExpression.kind === 315 /* JSDocTypeExpression */ ? typeExpression : void 0; } if (isJSDocAugmentsTag(tag) || isJSDocImplementsTag(tag)) { return tag.class; @@ -149574,7 +156474,7 @@ ${lanes.join("\n")} function getTypeScriptMemberSymbols() { completionKind = 2 /* PropertyAccess */; const isImportType = isLiteralImportTypeNode(node); - const isTypeLocation = insideJsDocTagTypeExpression || isImportType && !node.isTypeOf || isPartOfTypeNode(node.parent) || isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker); + const isTypeLocation = isImportType && !node.isTypeOf || isPartOfTypeNode(node.parent) || isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker); const isRhsOfImportDeclaration = isInRightSideOfInternalImportEqualsDeclaration(node); if (isEntityName(node) || isImportType || isPropertyAccessExpression(node)) { const isNamespaceName = isModuleDeclaration(node.parent); @@ -149589,18 +156489,18 @@ ${lanes.join("\n")} const isValidValueAccess = (symbol2) => typeChecker.isValidPropertyAccess(isImportType ? node : node.parent, symbol2.name); const isValidTypeAccess = (symbol2) => symbolCanBeReferencedAtTypeLocation(symbol2, typeChecker); const isValidAccess = isNamespaceName ? (symbol2) => { - var _a2; - return !!(symbol2.flags & 1920 /* Namespace */) && !((_a2 = symbol2.declarations) == null ? void 0 : _a2.every((d) => d.parent === node.parent)); + var _a; + return !!(symbol2.flags & 1920 /* Namespace */) && !((_a = symbol2.declarations) == null ? void 0 : _a.every((d) => d.parent === node.parent)); } : isRhsOfImportDeclaration ? ( // Any kind is allowed when dotting off namespace in internal import equals declaration (symbol2) => isValidTypeAccess(symbol2) || isValidValueAccess(symbol2) - ) : isTypeLocation ? isValidTypeAccess : isValidValueAccess; + ) : isTypeLocation || insideJsDocTagTypeExpression ? isValidTypeAccess : isValidValueAccess; for (const exportedSymbol of exportedSymbols) { if (isValidAccess(exportedSymbol)) { symbols.push(exportedSymbol); } } - if (!isTypeLocation && symbol.declarations && symbol.declarations.some((d) => d.kind !== 308 /* SourceFile */ && d.kind !== 264 /* ModuleDeclaration */ && d.kind !== 263 /* EnumDeclaration */)) { + if (!isTypeLocation && !insideJsDocTagTypeExpression && symbol.declarations && symbol.declarations.some((d) => d.kind !== 311 /* SourceFile */ && d.kind !== 266 /* ModuleDeclaration */ && d.kind !== 265 /* EnumDeclaration */)) { let type = typeChecker.getTypeOfSymbolAtLocation(symbol, node).getNonOptionalType(); let insertQuestionDot = false; if (type.isNullableType()) { @@ -149643,13 +156543,13 @@ ${lanes.join("\n")} if (isRightOfQuestionDot && some(type.getCallSignatures())) { isNewIdentifierLocation = true; } - const propertyAccess = node.kind === 202 /* ImportType */ ? node : node.parent; + const propertyAccess = node.kind === 204 /* ImportType */ ? node : node.parent; if (inCheckedFile) { for (const symbol of type.getApparentProperties()) { if (typeChecker.isValidPropertyAccessForCompletions(propertyAccess, type, symbol)) { addPropertySymbol( symbol, - /* insertAwait */ + /*insertAwait*/ false, insertQuestionDot ); @@ -149665,7 +156565,7 @@ ${lanes.join("\n")} if (typeChecker.isValidPropertyAccessForCompletions(propertyAccess, promiseType, symbol)) { addPropertySymbol( symbol, - /* insertAwait */ + /*insertAwait*/ true, insertQuestionDot ); @@ -149675,7 +156575,7 @@ ${lanes.join("\n")} } } function addPropertySymbol(symbol, insertAwait, insertQuestionDot) { - var _a2; + var _a; const computedPropertyName = firstDefined(symbol.declarations, (decl) => tryCast(getNameOfDeclaration(decl), isComputedPropertyName)); if (computedPropertyName) { const leftMostName = getLeftMostName(computedPropertyName.expression); @@ -149688,7 +156588,7 @@ ${lanes.join("\n")} if (!moduleSymbol || !isExternalModuleSymbol(moduleSymbol) || typeChecker.tryGetMemberInModuleExportsAndProperties(firstAccessibleSymbol.name, moduleSymbol) !== firstAccessibleSymbol) { symbolToOriginInfoMap[index] = { kind: getNullableSymbolOriginInfoKind(2 /* SymbolMemberNoExport */) }; } else { - const fileName = isExternalModuleNameRelative(stripQuotes(moduleSymbol.name)) ? (_a2 = getSourceFileOfModule(moduleSymbol)) == null ? void 0 : _a2.fileName : void 0; + const fileName = isExternalModuleNameRelative(stripQuotes(moduleSymbol.name)) ? (_a = getSourceFileOfModule(moduleSymbol)) == null ? void 0 : _a.fileName : void 0; const { moduleSpecifier } = (importSpecifierResolver || (importSpecifierResolver = ts_codefix_exports.createImportSpecifierResolver(sourceFile, program, host, preferences))).getModuleSpecifierForBestExportInfo([{ exportKind: 0 /* Named */, moduleFileName: fileName, @@ -149799,7 +156699,7 @@ ${lanes.join("\n")} } } } - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 308 /* SourceFile */) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 311 /* SourceFile */) { const thisType = typeChecker.tryGetThisTypeAt( scopeNode, /*includeGlobalThis*/ @@ -149834,10 +156734,10 @@ ${lanes.join("\n")} } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 308 /* SourceFile */: - case 225 /* TemplateExpression */: - case 291 /* JsxExpression */: - case 238 /* Block */: + case 311 /* SourceFile */: + case 227 /* TemplateExpression */: + case 293 /* JsxExpression */: + case 240 /* Block */: return true; default: return isStatement(scopeNode); @@ -149847,30 +156747,30 @@ ${lanes.join("\n")} return insideJsDocTagTypeExpression || !!importStatementCompletion && isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken)); } function isContextTokenValueLocation(contextToken2) { - return contextToken2 && (contextToken2.kind === 112 /* TypeOfKeyword */ && (contextToken2.parent.kind === 183 /* TypeQuery */ || isTypeOfExpression(contextToken2.parent)) || contextToken2.kind === 129 /* AssertsKeyword */ && contextToken2.parent.kind === 179 /* TypePredicate */); + return contextToken2 && (contextToken2.kind === 114 /* TypeOfKeyword */ && (contextToken2.parent.kind === 185 /* TypeQuery */ || isTypeOfExpression(contextToken2.parent)) || contextToken2.kind === 131 /* AssertsKeyword */ && contextToken2.parent.kind === 181 /* TypePredicate */); } function isContextTokenTypeLocation(contextToken2) { if (contextToken2) { const parentKind = contextToken2.parent.kind; switch (contextToken2.kind) { - case 58 /* ColonToken */: - return parentKind === 169 /* PropertyDeclaration */ || parentKind === 168 /* PropertySignature */ || parentKind === 166 /* Parameter */ || parentKind === 257 /* VariableDeclaration */ || isFunctionLikeKind(parentKind); - case 63 /* EqualsToken */: - return parentKind === 262 /* TypeAliasDeclaration */; - case 128 /* AsKeyword */: - return parentKind === 231 /* AsExpression */; - case 29 /* LessThanToken */: - return parentKind === 180 /* TypeReference */ || parentKind === 213 /* TypeAssertionExpression */; - case 94 /* ExtendsKeyword */: - return parentKind === 165 /* TypeParameter */; - case 150 /* SatisfiesKeyword */: - return parentKind === 235 /* SatisfiesExpression */; + case 59 /* ColonToken */: + return parentKind === 171 /* PropertyDeclaration */ || parentKind === 170 /* PropertySignature */ || parentKind === 168 /* Parameter */ || parentKind === 259 /* VariableDeclaration */ || isFunctionLikeKind(parentKind); + case 64 /* EqualsToken */: + return parentKind === 264 /* TypeAliasDeclaration */; + case 130 /* AsKeyword */: + return parentKind === 233 /* AsExpression */; + case 30 /* LessThanToken */: + return parentKind === 182 /* TypeReference */ || parentKind === 215 /* TypeAssertionExpression */; + case 96 /* ExtendsKeyword */: + return parentKind === 167 /* TypeParameter */; + case 152 /* SatisfiesKeyword */: + return parentKind === 237 /* SatisfiesExpression */; } } return false; } function collectAutoImports() { - var _a2, _b; + var _a, _b; if (!shouldOfferImportCompletions()) return; Debug.assert(!(detailsEntryId == null ? void 0 : detailsEntryId.data), "Should not run 'collectAutoImports' when faster path is available via `data`"); @@ -149880,7 +156780,7 @@ ${lanes.join("\n")} flags |= 1 /* MayIncludeAutoImports */; const isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken && importStatementCompletion; const lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" : previousToken && isIdentifier(previousToken) ? previousToken.text.toLowerCase() : ""; - const moduleSpecifierCache = (_a2 = host.getModuleSpecifierCache) == null ? void 0 : _a2.call(host); + const moduleSpecifierCache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host); const exportInfo = getExportInfoMap(sourceFile, host, program, preferences, cancellationToken); const packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) == null ? void 0 : _b.call(host); const packageJsonFilter = detailsEntryId ? void 0 : createPackageJsonImportFilter(sourceFile, preferences, host); @@ -150038,18 +156938,18 @@ ${lanes.join("\n")} return result; } function isInJsxText(contextToken2) { - if (contextToken2.kind === 11 /* JsxText */) { + if (contextToken2.kind === 12 /* JsxText */) { return true; } - if (contextToken2.kind === 31 /* GreaterThanToken */ && contextToken2.parent) { - if (location === contextToken2.parent && (location.kind === 283 /* JsxOpeningElement */ || location.kind === 282 /* JsxSelfClosingElement */)) { + if (contextToken2.kind === 32 /* GreaterThanToken */ && contextToken2.parent) { + if (location === contextToken2.parent && (location.kind === 285 /* JsxOpeningElement */ || location.kind === 284 /* JsxSelfClosingElement */)) { return false; } - if (contextToken2.parent.kind === 283 /* JsxOpeningElement */) { - return location.parent.kind !== 283 /* JsxOpeningElement */; + if (contextToken2.parent.kind === 285 /* JsxOpeningElement */) { + return location.parent.kind !== 285 /* JsxOpeningElement */; } - if (contextToken2.parent.kind === 284 /* JsxClosingElement */ || contextToken2.parent.kind === 282 /* JsxSelfClosingElement */) { - return !!contextToken2.parent.parent && contextToken2.parent.parent.kind === 281 /* JsxElement */; + if (contextToken2.parent.kind === 286 /* JsxClosingElement */ || contextToken2.parent.kind === 284 /* JsxSelfClosingElement */) { + return !!contextToken2.parent.parent && contextToken2.parent.parent.kind === 283 /* JsxElement */; } } return false; @@ -150059,30 +156959,30 @@ ${lanes.join("\n")} const containingNodeKind = contextToken.parent.kind; const tokenKind = keywordForNode(contextToken); switch (tokenKind) { - case 27 /* CommaToken */: - return containingNodeKind === 210 /* CallExpression */ || containingNodeKind === 173 /* Constructor */ || containingNodeKind === 211 /* NewExpression */ || containingNodeKind === 206 /* ArrayLiteralExpression */ || containingNodeKind === 223 /* BinaryExpression */ || containingNodeKind === 181 /* FunctionType */ || containingNodeKind === 207 /* ObjectLiteralExpression */; - case 20 /* OpenParenToken */: - return containingNodeKind === 210 /* CallExpression */ || containingNodeKind === 173 /* Constructor */ || containingNodeKind === 211 /* NewExpression */ || containingNodeKind === 214 /* ParenthesizedExpression */ || containingNodeKind === 193 /* ParenthesizedType */; - case 22 /* OpenBracketToken */: - return containingNodeKind === 206 /* ArrayLiteralExpression */ || containingNodeKind === 178 /* IndexSignature */ || containingNodeKind === 164 /* ComputedPropertyName */; - case 142 /* ModuleKeyword */: - case 143 /* NamespaceKeyword */: - case 100 /* ImportKeyword */: + case 28 /* CommaToken */: + return containingNodeKind === 212 /* CallExpression */ || containingNodeKind === 175 /* Constructor */ || containingNodeKind === 213 /* NewExpression */ || containingNodeKind === 208 /* ArrayLiteralExpression */ || containingNodeKind === 225 /* BinaryExpression */ || containingNodeKind === 183 /* FunctionType */ || containingNodeKind === 209 /* ObjectLiteralExpression */; + case 21 /* OpenParenToken */: + return containingNodeKind === 212 /* CallExpression */ || containingNodeKind === 175 /* Constructor */ || containingNodeKind === 213 /* NewExpression */ || containingNodeKind === 216 /* ParenthesizedExpression */ || containingNodeKind === 195 /* ParenthesizedType */; + case 23 /* OpenBracketToken */: + return containingNodeKind === 208 /* ArrayLiteralExpression */ || containingNodeKind === 180 /* IndexSignature */ || containingNodeKind === 166 /* ComputedPropertyName */; + case 144 /* ModuleKeyword */: + case 145 /* NamespaceKeyword */: + case 102 /* ImportKeyword */: return true; - case 24 /* DotToken */: - return containingNodeKind === 264 /* ModuleDeclaration */; - case 18 /* OpenBraceToken */: - return containingNodeKind === 260 /* ClassDeclaration */ || containingNodeKind === 207 /* ObjectLiteralExpression */; - case 63 /* EqualsToken */: - return containingNodeKind === 257 /* VariableDeclaration */ || containingNodeKind === 223 /* BinaryExpression */; - case 15 /* TemplateHead */: - return containingNodeKind === 225 /* TemplateExpression */; - case 16 /* TemplateMiddle */: - return containingNodeKind === 236 /* TemplateSpan */; - case 132 /* AsyncKeyword */: - return containingNodeKind === 171 /* MethodDeclaration */ || containingNodeKind === 300 /* ShorthandPropertyAssignment */; - case 41 /* AsteriskToken */: - return containingNodeKind === 171 /* MethodDeclaration */; + case 25 /* DotToken */: + return containingNodeKind === 266 /* ModuleDeclaration */; + case 19 /* OpenBraceToken */: + return containingNodeKind === 262 /* ClassDeclaration */ || containingNodeKind === 209 /* ObjectLiteralExpression */; + case 64 /* EqualsToken */: + return containingNodeKind === 259 /* VariableDeclaration */ || containingNodeKind === 225 /* BinaryExpression */; + case 16 /* TemplateHead */: + return containingNodeKind === 227 /* TemplateExpression */; + case 17 /* TemplateMiddle */: + return containingNodeKind === 238 /* TemplateSpan */; + case 134 /* AsyncKeyword */: + return containingNodeKind === 173 /* MethodDeclaration */ || containingNodeKind === 303 /* ShorthandPropertyAssignment */; + case 42 /* AsteriskToken */: + return containingNodeKind === 173 /* MethodDeclaration */; } if (isClassMemberCompletionKeyword(tokenKind)) { return true; @@ -150120,7 +157020,7 @@ ${lanes.join("\n")} completionKind = 0 /* ObjectPropertyDeclaration */; let typeMembers; let existingMembers; - if (objectLikeContainer.kind === 207 /* ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 209 /* ObjectLiteralExpression */) { const instantiatedType = tryGetObjectLiteralContextualType(objectLikeContainer, typeChecker); if (instantiatedType === void 0) { if (objectLikeContainer.flags & 33554432 /* InWithStatement */) { @@ -150142,16 +157042,16 @@ ${lanes.join("\n")} } } } else { - Debug.assert(objectLikeContainer.kind === 203 /* ObjectBindingPattern */); + Debug.assert(objectLikeContainer.kind === 205 /* ObjectBindingPattern */); isNewIdentifierLocation = false; const rootDeclaration = getRootDeclaration(objectLikeContainer.parent); if (!isVariableLike(rootDeclaration)) return Debug.fail("Root declaration is not variable-like."); - let canGetType = hasInitializer(rootDeclaration) || !!getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 247 /* ForOfStatement */; - if (!canGetType && rootDeclaration.kind === 166 /* Parameter */) { + let canGetType = hasInitializer(rootDeclaration) || !!getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 249 /* ForOfStatement */; + if (!canGetType && rootDeclaration.kind === 168 /* Parameter */) { if (isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); - } else if (rootDeclaration.parent.kind === 171 /* MethodDeclaration */ || rootDeclaration.parent.kind === 175 /* SetAccessor */) { + } else if (rootDeclaration.parent.kind === 173 /* MethodDeclaration */ || rootDeclaration.parent.kind === 177 /* SetAccessor */) { canGetType = isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -150164,7 +157064,7 @@ ${lanes.join("\n")} objectLikeContainer, /*isSuper*/ false, - /*writing*/ + /*isWrite*/ false, typeForObject, propertySymbol @@ -150177,7 +157077,7 @@ ${lanes.join("\n")} const filteredMembers = filterObjectMembersList(typeMembers, Debug.checkDefined(existingMembers)); symbols = concatenate(symbols, filteredMembers); setSortTextToOptionalMember(); - if (objectLikeContainer.kind === 207 /* ObjectLiteralExpression */ && preferences.includeCompletionsWithObjectLiteralMethodSnippets && preferences.includeCompletionsWithInsertText) { + if (objectLikeContainer.kind === 209 /* ObjectLiteralExpression */ && preferences.includeCompletionsWithObjectLiteralMethodSnippets && preferences.includeCompletionsWithInsertText) { transformObjectLiteralMembersSortText(symbolsStartIndex); collectObjectLiteralMethodSymbols(filteredMembers, objectLikeContainer); } @@ -150187,16 +157087,16 @@ ${lanes.join("\n")} function tryGetImportOrExportClauseCompletionSymbols() { if (!contextToken) return 0 /* Continue */; - const namedImportsOrExports = contextToken.kind === 18 /* OpenBraceToken */ || contextToken.kind === 27 /* CommaToken */ ? tryCast(contextToken.parent, isNamedImportsOrExports) : isTypeKeywordTokenOrIdentifier(contextToken) ? tryCast(contextToken.parent.parent, isNamedImportsOrExports) : void 0; + const namedImportsOrExports = contextToken.kind === 19 /* OpenBraceToken */ || contextToken.kind === 28 /* CommaToken */ ? tryCast(contextToken.parent, isNamedImportsOrExports) : isTypeKeywordTokenOrIdentifier(contextToken) ? tryCast(contextToken.parent.parent, isNamedImportsOrExports) : void 0; if (!namedImportsOrExports) return 0 /* Continue */; if (!isTypeKeywordTokenOrIdentifier(contextToken)) { keywordFilters = 8 /* TypeKeyword */; } - const { moduleSpecifier } = namedImportsOrExports.kind === 272 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent; + const { moduleSpecifier } = namedImportsOrExports.kind === 274 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent; if (!moduleSpecifier) { isNewIdentifierLocation = true; - return namedImportsOrExports.kind === 272 /* NamedImports */ ? 2 /* Fail */ : 0 /* Continue */; + return namedImportsOrExports.kind === 274 /* NamedImports */ ? 2 /* Fail */ : 0 /* Continue */; } const moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); if (!moduleSpecifierSymbol) { @@ -150215,18 +157115,18 @@ ${lanes.join("\n")} return 1 /* Success */; } function tryGetLocalNamedExportCompletionSymbols() { - var _a2; - const namedExports = contextToken && (contextToken.kind === 18 /* OpenBraceToken */ || contextToken.kind === 27 /* CommaToken */) ? tryCast(contextToken.parent, isNamedExports) : void 0; + var _a; + const namedExports = contextToken && (contextToken.kind === 19 /* OpenBraceToken */ || contextToken.kind === 28 /* CommaToken */) ? tryCast(contextToken.parent, isNamedExports) : void 0; if (!namedExports) { return 0 /* Continue */; } const localsContainer = findAncestor(namedExports, or(isSourceFile, isModuleDeclaration)); completionKind = 5 /* None */; isNewIdentifierLocation = false; - (_a2 = localsContainer.locals) == null ? void 0 : _a2.forEach((symbol, name) => { - var _a3, _b; + (_a = localsContainer.locals) == null ? void 0 : _a.forEach((symbol, name) => { + var _a2, _b; symbols.push(symbol); - if ((_b = (_a3 = localsContainer.symbol) == null ? void 0 : _a3.exports) == null ? void 0 : _b.has(name)) { + if ((_b = (_a2 = localsContainer.symbol) == null ? void 0 : _a2.exports) == null ? void 0 : _b.has(name)) { symbolToSortTextMap[getSymbolId(symbol)] = SortText.OptionalMember; } }); @@ -150238,12 +157138,12 @@ ${lanes.join("\n")} return 0 /* Continue */; completionKind = 3 /* MemberLike */; isNewIdentifierLocation = true; - keywordFilters = contextToken.kind === 41 /* AsteriskToken */ ? 0 /* None */ : isClassLike(decl) ? 2 /* ClassElementKeywords */ : 3 /* InterfaceElementKeywords */; + keywordFilters = contextToken.kind === 42 /* AsteriskToken */ ? 0 /* None */ : isClassLike(decl) ? 2 /* ClassElementKeywords */ : 3 /* InterfaceElementKeywords */; if (!isClassLike(decl)) return 1 /* Success */; - const classElement = contextToken.kind === 26 /* SemicolonToken */ ? contextToken.parent.parent : contextToken.parent; + const classElement = contextToken.kind === 27 /* SemicolonToken */ ? contextToken.parent.parent : contextToken.parent; let classElementModifierFlags = isClassElement(classElement) ? getEffectiveModifierFlags(classElement) : 0 /* None */; - if (contextToken.kind === 79 /* Identifier */ && !isCurrentlyEditingNode(contextToken)) { + if (contextToken.kind === 80 /* Identifier */ && !isCurrentlyEditingNode(contextToken)) { switch (contextToken.getText()) { case "private": classElementModifierFlags = classElementModifierFlags | 8 /* Private */; @@ -150286,8 +157186,8 @@ ${lanes.join("\n")} if (contextToken2) { const parent2 = contextToken2.parent; switch (contextToken2.kind) { - case 20 /* OpenParenToken */: - case 27 /* CommaToken */: + case 21 /* OpenParenToken */: + case 28 /* CommaToken */: return isConstructorDeclaration(contextToken2.parent) ? contextToken2.parent : void 0; default: if (isConstructorParameterCompletion(contextToken2)) { @@ -150317,40 +157217,40 @@ ${lanes.join("\n")} if (contextToken2) { const parent2 = contextToken2.parent; switch (contextToken2.kind) { - case 31 /* GreaterThanToken */: - case 30 /* LessThanSlashToken */: - case 43 /* SlashToken */: - case 79 /* Identifier */: - case 208 /* PropertyAccessExpression */: - case 289 /* JsxAttributes */: - case 288 /* JsxAttribute */: - case 290 /* JsxSpreadAttribute */: - if (parent2 && (parent2.kind === 282 /* JsxSelfClosingElement */ || parent2.kind === 283 /* JsxOpeningElement */)) { - if (contextToken2.kind === 31 /* GreaterThanToken */) { + case 32 /* GreaterThanToken */: + case 31 /* LessThanSlashToken */: + case 44 /* SlashToken */: + case 80 /* Identifier */: + case 210 /* PropertyAccessExpression */: + case 291 /* JsxAttributes */: + case 290 /* JsxAttribute */: + case 292 /* JsxSpreadAttribute */: + if (parent2 && (parent2.kind === 284 /* JsxSelfClosingElement */ || parent2.kind === 285 /* JsxOpeningElement */)) { + if (contextToken2.kind === 32 /* GreaterThanToken */) { const precedingToken = findPrecedingToken( contextToken2.pos, sourceFile, /*startNode*/ void 0 ); - if (!parent2.typeArguments || precedingToken && precedingToken.kind === 43 /* SlashToken */) + if (!parent2.typeArguments || precedingToken && precedingToken.kind === 44 /* SlashToken */) break; } return parent2; - } else if (parent2.kind === 288 /* JsxAttribute */) { + } else if (parent2.kind === 290 /* JsxAttribute */) { return parent2.parent.parent; } break; - case 10 /* StringLiteral */: - if (parent2 && (parent2.kind === 288 /* JsxAttribute */ || parent2.kind === 290 /* JsxSpreadAttribute */)) { + case 11 /* StringLiteral */: + if (parent2 && (parent2.kind === 290 /* JsxAttribute */ || parent2.kind === 292 /* JsxSpreadAttribute */)) { return parent2.parent.parent; } break; - case 19 /* CloseBraceToken */: - if (parent2 && parent2.kind === 291 /* JsxExpression */ && parent2.parent && parent2.parent.kind === 288 /* JsxAttribute */) { + case 20 /* CloseBraceToken */: + if (parent2 && parent2.kind === 293 /* JsxExpression */ && parent2.parent && parent2.parent.kind === 290 /* JsxAttribute */) { return parent2.parent.parent.parent; } - if (parent2 && parent2.kind === 290 /* JsxSpreadAttribute */) { + if (parent2 && parent2.kind === 292 /* JsxSpreadAttribute */) { return parent2.parent.parent; } break; @@ -150362,61 +157262,61 @@ ${lanes.join("\n")} const parent2 = contextToken2.parent; const containingNodeKind = parent2.kind; switch (contextToken2.kind) { - case 27 /* CommaToken */: - return containingNodeKind === 257 /* VariableDeclaration */ || isVariableDeclarationListButNotTypeArgument(contextToken2) || containingNodeKind === 240 /* VariableStatement */ || containingNodeKind === 263 /* EnumDeclaration */ || // enum a { foo, | - isFunctionLikeButNotConstructor(containingNodeKind) || containingNodeKind === 261 /* InterfaceDeclaration */ || // interface A= contextToken2.pos; - case 24 /* DotToken */: - return containingNodeKind === 204 /* ArrayBindingPattern */; - case 58 /* ColonToken */: - return containingNodeKind === 205 /* BindingElement */; - case 22 /* OpenBracketToken */: - return containingNodeKind === 204 /* ArrayBindingPattern */; - case 20 /* OpenParenToken */: - return containingNodeKind === 295 /* CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); - case 18 /* OpenBraceToken */: - return containingNodeKind === 263 /* EnumDeclaration */; - case 29 /* LessThanToken */: - return containingNodeKind === 260 /* ClassDeclaration */ || // class A< | - containingNodeKind === 228 /* ClassExpression */ || // var C = class D< | - containingNodeKind === 261 /* InterfaceDeclaration */ || // interface A< | - containingNodeKind === 262 /* TypeAliasDeclaration */ || // type List< | + case 25 /* DotToken */: + return containingNodeKind === 206 /* ArrayBindingPattern */; + case 59 /* ColonToken */: + return containingNodeKind === 207 /* BindingElement */; + case 23 /* OpenBracketToken */: + return containingNodeKind === 206 /* ArrayBindingPattern */; + case 21 /* OpenParenToken */: + return containingNodeKind === 298 /* CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); + case 19 /* OpenBraceToken */: + return containingNodeKind === 265 /* EnumDeclaration */; + case 30 /* LessThanToken */: + return containingNodeKind === 262 /* ClassDeclaration */ || // class A< | + containingNodeKind === 230 /* ClassExpression */ || // var C = class D< | + containingNodeKind === 263 /* InterfaceDeclaration */ || // interface A< | + containingNodeKind === 264 /* TypeAliasDeclaration */ || // type List< | isFunctionLikeKind(containingNodeKind); - case 124 /* StaticKeyword */: - return containingNodeKind === 169 /* PropertyDeclaration */ && !isClassLike(parent2.parent); - case 25 /* DotDotDotToken */: - return containingNodeKind === 166 /* Parameter */ || !!parent2.parent && parent2.parent.kind === 204 /* ArrayBindingPattern */; - case 123 /* PublicKeyword */: - case 121 /* PrivateKeyword */: - case 122 /* ProtectedKeyword */: - return containingNodeKind === 166 /* Parameter */ && !isConstructorDeclaration(parent2.parent); - case 128 /* AsKeyword */: - return containingNodeKind === 273 /* ImportSpecifier */ || containingNodeKind === 278 /* ExportSpecifier */ || containingNodeKind === 271 /* NamespaceImport */; - case 137 /* GetKeyword */: - case 151 /* SetKeyword */: + case 126 /* StaticKeyword */: + return containingNodeKind === 171 /* PropertyDeclaration */ && !isClassLike(parent2.parent); + case 26 /* DotDotDotToken */: + return containingNodeKind === 168 /* Parameter */ || !!parent2.parent && parent2.parent.kind === 206 /* ArrayBindingPattern */; + case 125 /* PublicKeyword */: + case 123 /* PrivateKeyword */: + case 124 /* ProtectedKeyword */: + return containingNodeKind === 168 /* Parameter */ && !isConstructorDeclaration(parent2.parent); + case 130 /* AsKeyword */: + return containingNodeKind === 275 /* ImportSpecifier */ || containingNodeKind === 280 /* ExportSpecifier */ || containingNodeKind === 273 /* NamespaceImport */; + case 139 /* GetKeyword */: + case 153 /* SetKeyword */: return !isFromObjectTypeDeclaration(contextToken2); - case 79 /* Identifier */: - if (containingNodeKind === 273 /* ImportSpecifier */ && contextToken2 === parent2.name && contextToken2.text === "type") { + case 80 /* Identifier */: + if (containingNodeKind === 275 /* ImportSpecifier */ && contextToken2 === parent2.name && contextToken2.text === "type") { return false; } break; - case 84 /* ClassKeyword */: - case 92 /* EnumKeyword */: - case 118 /* InterfaceKeyword */: - case 98 /* FunctionKeyword */: - case 113 /* VarKeyword */: - case 100 /* ImportKeyword */: - case 119 /* LetKeyword */: - case 85 /* ConstKeyword */: - case 138 /* InferKeyword */: + case 86 /* ClassKeyword */: + case 94 /* EnumKeyword */: + case 120 /* InterfaceKeyword */: + case 100 /* FunctionKeyword */: + case 115 /* VarKeyword */: + case 102 /* ImportKeyword */: + case 121 /* LetKeyword */: + case 87 /* ConstKeyword */: + case 140 /* InferKeyword */: return true; - case 154 /* TypeKeyword */: - return containingNodeKind !== 273 /* ImportSpecifier */; - case 41 /* AsteriskToken */: + case 156 /* TypeKeyword */: + return containingNodeKind !== 275 /* ImportSpecifier */; + case 42 /* AsteriskToken */: return isFunctionLike(contextToken2.parent) && !isMethodDeclaration(contextToken2.parent); } if (isClassMemberCompletionKeyword(keywordForNode(contextToken2)) && isFromObjectTypeDeclaration(contextToken2)) { @@ -150428,52 +157328,52 @@ ${lanes.join("\n")} } } switch (keywordForNode(contextToken2)) { - case 126 /* AbstractKeyword */: - case 84 /* ClassKeyword */: - case 85 /* ConstKeyword */: - case 136 /* DeclareKeyword */: - case 92 /* EnumKeyword */: - case 98 /* FunctionKeyword */: - case 118 /* InterfaceKeyword */: - case 119 /* LetKeyword */: - case 121 /* PrivateKeyword */: - case 122 /* ProtectedKeyword */: - case 123 /* PublicKeyword */: - case 124 /* StaticKeyword */: - case 113 /* VarKeyword */: + case 128 /* AbstractKeyword */: + case 86 /* ClassKeyword */: + case 87 /* ConstKeyword */: + case 138 /* DeclareKeyword */: + case 94 /* EnumKeyword */: + case 100 /* FunctionKeyword */: + case 120 /* InterfaceKeyword */: + case 121 /* LetKeyword */: + case 123 /* PrivateKeyword */: + case 124 /* ProtectedKeyword */: + case 125 /* PublicKeyword */: + case 126 /* StaticKeyword */: + case 115 /* VarKeyword */: return true; - case 132 /* AsyncKeyword */: + case 134 /* AsyncKeyword */: return isPropertyDeclaration(contextToken2.parent); } const ancestorClassLike = findAncestor(contextToken2.parent, isClassLike); if (ancestorClassLike && contextToken2 === previousToken && isPreviousPropertyDeclarationTerminated(contextToken2, position)) { return false; } - const ancestorPropertyDeclaraion = getAncestor(contextToken2.parent, 169 /* PropertyDeclaration */); + const ancestorPropertyDeclaraion = getAncestor(contextToken2.parent, 171 /* PropertyDeclaration */); if (ancestorPropertyDeclaraion && contextToken2 !== previousToken && isClassLike(previousToken.parent.parent) && position <= previousToken.end) { if (isPreviousPropertyDeclarationTerminated(contextToken2, previousToken.end)) { return false; - } else if (contextToken2.kind !== 63 /* EqualsToken */ && (isInitializedProperty(ancestorPropertyDeclaraion) || hasType(ancestorPropertyDeclaraion))) { + } else if (contextToken2.kind !== 64 /* EqualsToken */ && (isInitializedProperty(ancestorPropertyDeclaraion) || hasType(ancestorPropertyDeclaraion))) { return true; } } - return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !(isClassLike(contextToken2.parent) && (contextToken2 !== previousToken || position > previousToken.end)); + return isDeclarationName(contextToken2) && !isShorthandPropertyAssignment(contextToken2.parent) && !isJsxAttribute(contextToken2.parent) && !((isClassLike(contextToken2.parent) || isInterfaceDeclaration(contextToken2.parent) || isTypeParameterDeclaration(contextToken2.parent)) && (contextToken2 !== previousToken || position > previousToken.end)); } function isPreviousPropertyDeclarationTerminated(contextToken2, position2) { - return contextToken2.kind !== 63 /* EqualsToken */ && (contextToken2.kind === 26 /* SemicolonToken */ || !positionsAreOnSameLine(contextToken2.end, position2, sourceFile)); + return contextToken2.kind !== 64 /* EqualsToken */ && (contextToken2.kind === 27 /* SemicolonToken */ || !positionsAreOnSameLine(contextToken2.end, position2, sourceFile)); } function isFunctionLikeButNotConstructor(kind) { - return isFunctionLikeKind(kind) && kind !== 173 /* Constructor */; + return isFunctionLikeKind(kind) && kind !== 175 /* Constructor */; } function isDotOfNumericLiteral(contextToken2) { - if (contextToken2.kind === 8 /* NumericLiteral */) { + if (contextToken2.kind === 9 /* NumericLiteral */) { const text = contextToken2.getFullText(); return text.charAt(text.length - 1) === "."; } return false; } function isVariableDeclarationListButNotTypeArgument(node2) { - return node2.parent.kind === 258 /* VariableDeclarationList */ && !isPossiblyTypeArgumentPosition(node2, sourceFile, typeChecker); + return node2.parent.kind === 260 /* VariableDeclarationList */ && !isPossiblyTypeArgumentPosition(node2, sourceFile, typeChecker); } function filterObjectMembersList(contextualMemberSymbols, existingMembers) { if (existingMembers.length === 0) { @@ -150482,7 +157382,7 @@ ${lanes.join("\n")} const membersDeclaredBySpreadAssignment = /* @__PURE__ */ new Set(); const existingMemberNames = /* @__PURE__ */ new Set(); for (const m of existingMembers) { - if (m.kind !== 299 /* PropertyAssignment */ && m.kind !== 300 /* ShorthandPropertyAssignment */ && m.kind !== 205 /* BindingElement */ && m.kind !== 171 /* MethodDeclaration */ && m.kind !== 174 /* GetAccessor */ && m.kind !== 175 /* SetAccessor */ && m.kind !== 301 /* SpreadAssignment */) { + if (m.kind !== 302 /* PropertyAssignment */ && m.kind !== 303 /* ShorthandPropertyAssignment */ && m.kind !== 207 /* BindingElement */ && m.kind !== 173 /* MethodDeclaration */ && m.kind !== 176 /* GetAccessor */ && m.kind !== 177 /* SetAccessor */ && m.kind !== 304 /* SpreadAssignment */) { continue; } if (isCurrentlyEditingNode(m)) { @@ -150492,7 +157392,7 @@ ${lanes.join("\n")} if (isSpreadAssignment(m)) { setMembersDeclaredBySpreadAssignment(m, membersDeclaredBySpreadAssignment); } else if (isBindingElement(m) && m.propertyName) { - if (m.propertyName.kind === 79 /* Identifier */) { + if (m.propertyName.kind === 80 /* Identifier */) { existingName = m.propertyName.escapedText; } } else { @@ -150520,10 +157420,9 @@ ${lanes.join("\n")} } function setSortTextToOptionalMember() { symbols.forEach((m) => { - var _a2; if (m.flags & 16777216 /* Optional */) { const symbolId = getSymbolId(m); - symbolToSortTextMap[symbolId] = (_a2 = symbolToSortTextMap[symbolId]) != null ? _a2 : SortText.OptionalMember; + symbolToSortTextMap[symbolId] = symbolToSortTextMap[symbolId] ?? SortText.OptionalMember; } }); } @@ -150538,7 +157437,6 @@ ${lanes.join("\n")} } } function transformObjectLiteralMembersSortText(start2) { - var _a2; for (let i = start2; i < symbols.length; i++) { const symbol = symbols[i]; const symbolId = getSymbolId(symbol); @@ -150553,7 +157451,7 @@ ${lanes.join("\n")} false ); if (displayName) { - const originalSortText = (_a2 = symbolToSortTextMap[symbolId]) != null ? _a2 : SortText.LocationPriority; + const originalSortText = symbolToSortTextMap[symbolId] ?? SortText.LocationPriority; const { name } = displayName; symbolToSortTextMap[symbolId] = SortText.ObjectLiteralProperty(originalSortText, name); } @@ -150562,7 +157460,7 @@ ${lanes.join("\n")} function filterClassMembersList(baseSymbols, existingMembers, currentClassElementModifierFlags) { const existingMemberNames = /* @__PURE__ */ new Set(); for (const m of existingMembers) { - if (m.kind !== 169 /* PropertyDeclaration */ && m.kind !== 171 /* MethodDeclaration */ && m.kind !== 174 /* GetAccessor */ && m.kind !== 175 /* SetAccessor */) { + if (m.kind !== 171 /* PropertyDeclaration */ && m.kind !== 173 /* MethodDeclaration */ && m.kind !== 176 /* GetAccessor */ && m.kind !== 177 /* SetAccessor */) { continue; } if (isCurrentlyEditingNode(m)) { @@ -150588,8 +157486,8 @@ ${lanes.join("\n")} if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 288 /* JsxAttribute */) { - seenNames.add(attr.name.escapedText); + if (attr.kind === 290 /* JsxAttribute */) { + seenNames.add(getEscapedTextOfJsxAttributeName(attr.name)); } else if (isJsxSpreadAttribute(attr)) { setMembersDeclaredBySpreadAssignment(attr, membersDeclaredBySpreadAssignment); } @@ -150606,15 +157504,17 @@ ${lanes.join("\n")} if (contextToken) { const { parent: parent2 } = contextToken; switch (contextToken.kind) { - case 18 /* OpenBraceToken */: - case 27 /* CommaToken */: + case 19 /* OpenBraceToken */: + case 28 /* CommaToken */: if (isObjectLiteralExpression(parent2) || isObjectBindingPattern(parent2)) { return parent2; } break; - case 41 /* AsteriskToken */: + case 42 /* AsteriskToken */: return isMethodDeclaration(parent2) ? tryCast(parent2.parent, isObjectLiteralExpression) : void 0; - case 79 /* Identifier */: + case 134 /* AsyncKeyword */: + return tryCast(parent2.parent, isObjectLiteralExpression); + case 80 /* Identifier */: return contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : void 0; } } @@ -150686,7 +157586,7 @@ ${lanes.join("\n")} case 0 /* None */: return false; case 1 /* All */: - return isFunctionLikeBodyKeyword(kind) || kind === 136 /* DeclareKeyword */ || kind === 142 /* ModuleKeyword */ || kind === 154 /* TypeKeyword */ || kind === 143 /* NamespaceKeyword */ || kind === 126 /* AbstractKeyword */ || isTypeKeyword(kind) && kind !== 155 /* UndefinedKeyword */; + return isFunctionLikeBodyKeyword(kind) || kind === 138 /* DeclareKeyword */ || kind === 144 /* ModuleKeyword */ || kind === 156 /* TypeKeyword */ || kind === 145 /* NamespaceKeyword */ || kind === 128 /* AbstractKeyword */ || isTypeKeyword(kind) && kind !== 157 /* UndefinedKeyword */; case 5 /* FunctionLikeBodyKeywords */: return isFunctionLikeBodyKeyword(kind); case 2 /* ClassElementKeywords */: @@ -150696,11 +157596,11 @@ ${lanes.join("\n")} case 4 /* ConstructorParameterKeywords */: return isParameterPropertyModifier(kind); case 6 /* TypeAssertionKeywords */: - return isTypeKeyword(kind) || kind === 85 /* ConstKeyword */; + return isTypeKeyword(kind) || kind === 87 /* ConstKeyword */; case 7 /* TypeKeywords */: return isTypeKeyword(kind); case 8 /* TypeKeyword */: - return kind === 154 /* TypeKeyword */; + return kind === 156 /* TypeKeyword */; default: return Debug.assertNever(keywordFilter); } @@ -150708,62 +157608,61 @@ ${lanes.join("\n")} } function isTypeScriptOnlyKeyword(kind) { switch (kind) { - case 126 /* AbstractKeyword */: - case 131 /* AnyKeyword */: - case 160 /* BigIntKeyword */: - case 134 /* BooleanKeyword */: - case 136 /* DeclareKeyword */: - case 92 /* EnumKeyword */: - case 159 /* GlobalKeyword */: - case 117 /* ImplementsKeyword */: - case 138 /* InferKeyword */: - case 118 /* InterfaceKeyword */: - case 140 /* IsKeyword */: - case 141 /* KeyOfKeyword */: - case 142 /* ModuleKeyword */: - case 143 /* NamespaceKeyword */: - case 144 /* NeverKeyword */: - case 148 /* NumberKeyword */: - case 149 /* ObjectKeyword */: - case 161 /* OverrideKeyword */: - case 121 /* PrivateKeyword */: - case 122 /* ProtectedKeyword */: - case 123 /* PublicKeyword */: - case 146 /* ReadonlyKeyword */: - case 152 /* StringKeyword */: - case 153 /* SymbolKeyword */: - case 154 /* TypeKeyword */: - case 156 /* UniqueKeyword */: - case 157 /* UnknownKeyword */: + case 128 /* AbstractKeyword */: + case 133 /* AnyKeyword */: + case 162 /* BigIntKeyword */: + case 136 /* BooleanKeyword */: + case 138 /* DeclareKeyword */: + case 94 /* EnumKeyword */: + case 161 /* GlobalKeyword */: + case 119 /* ImplementsKeyword */: + case 140 /* InferKeyword */: + case 120 /* InterfaceKeyword */: + case 142 /* IsKeyword */: + case 143 /* KeyOfKeyword */: + case 144 /* ModuleKeyword */: + case 145 /* NamespaceKeyword */: + case 146 /* NeverKeyword */: + case 150 /* NumberKeyword */: + case 151 /* ObjectKeyword */: + case 163 /* OverrideKeyword */: + case 123 /* PrivateKeyword */: + case 124 /* ProtectedKeyword */: + case 125 /* PublicKeyword */: + case 148 /* ReadonlyKeyword */: + case 154 /* StringKeyword */: + case 155 /* SymbolKeyword */: + case 156 /* TypeKeyword */: + case 158 /* UniqueKeyword */: + case 159 /* UnknownKeyword */: return true; default: return false; } } function isInterfaceOrTypeLiteralCompletionKeyword(kind) { - return kind === 146 /* ReadonlyKeyword */; + return kind === 148 /* ReadonlyKeyword */; } function isClassMemberCompletionKeyword(kind) { switch (kind) { - case 126 /* AbstractKeyword */: - case 127 /* AccessorKeyword */: - case 135 /* ConstructorKeyword */: - case 137 /* GetKeyword */: - case 151 /* SetKeyword */: - case 132 /* AsyncKeyword */: - case 136 /* DeclareKeyword */: - case 161 /* OverrideKeyword */: + case 128 /* AbstractKeyword */: + case 129 /* AccessorKeyword */: + case 137 /* ConstructorKeyword */: + case 139 /* GetKeyword */: + case 153 /* SetKeyword */: + case 134 /* AsyncKeyword */: + case 138 /* DeclareKeyword */: + case 163 /* OverrideKeyword */: return true; default: return isClassMemberModifier(kind); } } function isFunctionLikeBodyKeyword(kind) { - return kind === 132 /* AsyncKeyword */ || kind === 133 /* AwaitKeyword */ || kind === 128 /* AsKeyword */ || kind === 150 /* SatisfiesKeyword */ || kind === 154 /* TypeKeyword */ || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); + return kind === 134 /* AsyncKeyword */ || kind === 135 /* AwaitKeyword */ || kind === 130 /* AsKeyword */ || kind === 152 /* SatisfiesKeyword */ || kind === 156 /* TypeKeyword */ || !isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } function keywordForNode(node) { - var _a2; - return isIdentifier(node) ? (_a2 = identifierToKeywordKind(node)) != null ? _a2 : 0 /* Unknown */ : node.kind; + return isIdentifier(node) ? identifierToKeywordKind(node) ?? 0 /* Unknown */ : node.kind; } function getContextualKeywords(contextToken, position) { const entries = []; @@ -150774,7 +157673,7 @@ ${lanes.join("\n")} const currentLine = file.getLineAndCharacterOfPosition(position).line; if ((isImportDeclaration(parent2) || isExportDeclaration(parent2) && parent2.moduleSpecifier) && contextToken === parent2.moduleSpecifier && tokenLine === currentLine) { entries.push({ - name: tokenToString(130 /* AssertKeyword */), + name: tokenToString(132 /* AssertKeyword */), kind: "keyword" /* keyword */, kindModifiers: "" /* none */, sortText: SortText.GlobalsOrKeywords @@ -150800,7 +157699,7 @@ ${lanes.join("\n")} function getApparentProperties(type, node, checker) { if (!type.isUnion()) return type.getApparentProperties(); - return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties())))); + return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 402784252 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties())))); } function containsNonPublicProperties(props) { return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 24 /* NonPublicAccessibilityModifier */)); @@ -150809,17 +157708,16 @@ ${lanes.join("\n")} return type.isUnion() ? Debug.checkEachDefined(checker.getAllPossiblePropertiesOfTypes(type.types), "getAllPossiblePropertiesOfTypes() should all be defined") : Debug.checkEachDefined(type.getApparentProperties(), "getApparentProperties() should all be defined"); } function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) { - var _a2; switch (location.kind) { - case 354 /* SyntaxList */: + case 357 /* SyntaxList */: return tryCast(location.parent, isObjectTypeDeclaration); case 1 /* EndOfFileToken */: const cls = tryCast(lastOrUndefined(cast(location.parent, isSourceFile).statements), isObjectTypeDeclaration); - if (cls && !findChildOfKind(cls, 19 /* CloseBraceToken */, sourceFile)) { + if (cls && !findChildOfKind(cls, 20 /* CloseBraceToken */, sourceFile)) { return cls; } break; - case 79 /* Identifier */: { + case 80 /* Identifier */: { const originalKeywordKind = identifierToKeywordKind(location); if (originalKeywordKind) { return void 0; @@ -150834,17 +157732,17 @@ ${lanes.join("\n")} } if (!contextToken) return void 0; - if (location.kind === 135 /* ConstructorKeyword */ || isIdentifier(contextToken) && isPropertyDeclaration(contextToken.parent) && isClassLike(location)) { + if (location.kind === 137 /* ConstructorKeyword */ || isIdentifier(contextToken) && isPropertyDeclaration(contextToken.parent) && isClassLike(location)) { return findAncestor(contextToken, isClassLike); } switch (contextToken.kind) { - case 63 /* EqualsToken */: + case 64 /* EqualsToken */: return void 0; - case 26 /* SemicolonToken */: - case 19 /* CloseBraceToken */: + case 27 /* SemicolonToken */: + case 20 /* CloseBraceToken */: return isFromObjectTypeDeclaration(location) && location.parent.name === location ? location.parent.parent : tryCast(location, isObjectTypeDeclaration); - case 18 /* OpenBraceToken */: - case 27 /* CommaToken */: + case 19 /* OpenBraceToken */: + case 28 /* CommaToken */: return tryCast(contextToken.parent, isObjectTypeDeclaration); default: if (isObjectTypeDeclaration(location)) { @@ -150852,7 +157750,7 @@ ${lanes.join("\n")} return location; } const isValidKeyword = isClassLike(contextToken.parent.parent) ? isClassMemberCompletionKeyword : isInterfaceOrTypeLiteralCompletionKeyword; - return isValidKeyword(contextToken.kind) || contextToken.kind === 41 /* AsteriskToken */ || isIdentifier(contextToken) && isValidKeyword((_a2 = identifierToKeywordKind(contextToken)) != null ? _a2 : 0 /* Unknown */) ? contextToken.parent.parent : void 0; + return isValidKeyword(contextToken.kind) || contextToken.kind === 42 /* AsteriskToken */ || isIdentifier(contextToken) && isValidKeyword(identifierToKeywordKind(contextToken) ?? 0 /* Unknown */) ? contextToken.parent.parent : void 0; } return void 0; } @@ -150862,15 +157760,15 @@ ${lanes.join("\n")} return void 0; const parent2 = node.parent; switch (node.kind) { - case 18 /* OpenBraceToken */: + case 19 /* OpenBraceToken */: if (isTypeLiteralNode(parent2)) { return parent2; } break; - case 26 /* SemicolonToken */: - case 27 /* CommaToken */: - case 79 /* Identifier */: - if (parent2.kind === 168 /* PropertySignature */ && isTypeLiteralNode(parent2.parent)) { + case 27 /* SemicolonToken */: + case 28 /* CommaToken */: + case 80 /* Identifier */: + if (parent2.kind === 170 /* PropertySignature */ && isTypeLiteralNode(parent2.parent)) { return parent2.parent; } break; @@ -150887,11 +157785,11 @@ ${lanes.join("\n")} if (!t) return void 0; switch (node.kind) { - case 168 /* PropertySignature */: + case 170 /* PropertySignature */: return checker.getTypeOfPropertyOfContextualType(t, node.symbol.escapedName); - case 190 /* IntersectionType */: - case 184 /* TypeLiteral */: - case 189 /* UnionType */: + case 192 /* IntersectionType */: + case 186 /* TypeLiteral */: + case 191 /* UnionType */: return t; } } @@ -150910,11 +157808,11 @@ ${lanes.join("\n")} case "#": return !!contextToken && isPrivateIdentifier(contextToken) && !!getContainingClass(contextToken); case "<": - return !!contextToken && contextToken.kind === 29 /* LessThanToken */ && (!isBinaryExpression(contextToken.parent) || binaryExpressionMayBeOpenTag(contextToken.parent)); + return !!contextToken && contextToken.kind === 30 /* LessThanToken */ && (!isBinaryExpression(contextToken.parent) || binaryExpressionMayBeOpenTag(contextToken.parent)); case "/": - return !!contextToken && (isStringLiteralLike(contextToken) ? !!tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 43 /* SlashToken */ && isJsxClosingElement(contextToken.parent)); + return !!contextToken && (isStringLiteralLike(contextToken) ? !!tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 44 /* SlashToken */ && isJsxClosingElement(contextToken.parent)); case " ": - return !!contextToken && isImportKeyword(contextToken) && contextToken.parent.kind === 308 /* SourceFile */; + return !!contextToken && isImportKeyword(contextToken) && contextToken.parent.kind === 311 /* SourceFile */; default: return Debug.assertNever(triggerCharacter); } @@ -150967,7 +157865,7 @@ ${lanes.join("\n")} return type; } const parent2 = walkUpParenthesizedExpressions(node.parent); - if (isBinaryExpression(parent2) && parent2.operatorToken.kind === 63 /* EqualsToken */ && node === parent2.left) { + if (isBinaryExpression(parent2) && parent2.operatorToken.kind === 64 /* EqualsToken */ && node === parent2.left) { return typeChecker.getTypeAtLocation(parent2); } if (isExpression(parent2)) { @@ -150976,35 +157874,35 @@ ${lanes.join("\n")} return void 0; } function getImportStatementCompletionInfo(contextToken) { - var _a2, _b, _c; + var _a, _b, _c; let keywordCompletion; let isKeywordOnlyCompletion = false; const candidate = getCandidate(); return { isKeywordOnlyCompletion, keywordCompletion, - isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* TypeKeyword */), - isTopLevelTypeOnly: !!((_b = (_a2 = tryCast(candidate, isImportDeclaration)) == null ? void 0 : _a2.importClause) == null ? void 0 : _b.isTypeOnly) || !!((_c = tryCast(candidate, isImportEqualsDeclaration)) == null ? void 0 : _c.isTypeOnly), + isNewIdentifierLocation: !!(candidate || keywordCompletion === 156 /* TypeKeyword */), + isTopLevelTypeOnly: !!((_b = (_a = tryCast(candidate, isImportDeclaration)) == null ? void 0 : _a.importClause) == null ? void 0 : _b.isTypeOnly) || !!((_c = tryCast(candidate, isImportEqualsDeclaration)) == null ? void 0 : _c.isTypeOnly), couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken), replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate) }; function getCandidate() { const parent2 = contextToken.parent; if (isImportEqualsDeclaration(parent2)) { - keywordCompletion = contextToken.kind === 154 /* TypeKeyword */ ? void 0 : 154 /* TypeKeyword */; + keywordCompletion = contextToken.kind === 156 /* TypeKeyword */ ? void 0 : 156 /* TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent2.moduleReference) ? parent2 : void 0; } if (couldBeTypeOnlyImportSpecifier(parent2, contextToken) && canCompleteFromNamedBindings(parent2.parent)) { return parent2; } if (isNamedImports(parent2) || isNamespaceImport(parent2)) { - if (!parent2.parent.isTypeOnly && (contextToken.kind === 18 /* OpenBraceToken */ || contextToken.kind === 100 /* ImportKeyword */ || contextToken.kind === 27 /* CommaToken */)) { - keywordCompletion = 154 /* TypeKeyword */; + if (!parent2.parent.isTypeOnly && (contextToken.kind === 19 /* OpenBraceToken */ || contextToken.kind === 102 /* ImportKeyword */ || contextToken.kind === 28 /* CommaToken */)) { + keywordCompletion = 156 /* TypeKeyword */; } if (canCompleteFromNamedBindings(parent2)) { - if (contextToken.kind === 19 /* CloseBraceToken */ || contextToken.kind === 79 /* Identifier */) { + if (contextToken.kind === 20 /* CloseBraceToken */ || contextToken.kind === 80 /* Identifier */) { isKeywordOnlyCompletion = true; - keywordCompletion = 158 /* FromKeyword */; + keywordCompletion = 160 /* FromKeyword */; } else { return parent2.parent.parent; } @@ -151012,27 +157910,27 @@ ${lanes.join("\n")} return void 0; } if (isImportKeyword(contextToken) && isSourceFile(parent2)) { - keywordCompletion = 154 /* TypeKeyword */; + keywordCompletion = 156 /* TypeKeyword */; return contextToken; } if (isImportKeyword(contextToken) && isImportDeclaration(parent2)) { - keywordCompletion = 154 /* TypeKeyword */; + keywordCompletion = 156 /* TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent2.moduleSpecifier) ? parent2 : void 0; } return void 0; } } function getSingleLineReplacementSpanForImportCompletionNode(node) { - var _a2, _b, _c; + var _a; if (!node) return void 0; - const top = (_a2 = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration))) != null ? _a2 : node; + const top = findAncestor(node, or(isImportDeclaration, isImportEqualsDeclaration)) ?? node; const sourceFile = top.getSourceFile(); if (rangeIsOnSingleLine(top, sourceFile)) { return createTextSpanFromNode(top, sourceFile); } - Debug.assert(top.kind !== 100 /* ImportKeyword */ && top.kind !== 273 /* ImportSpecifier */); - const potentialSplitPoint = top.kind === 269 /* ImportDeclaration */ ? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) == null ? void 0 : _b.namedBindings)) != null ? _c : top.moduleSpecifier : top.moduleReference; + Debug.assert(top.kind !== 102 /* ImportKeyword */ && top.kind !== 275 /* ImportSpecifier */); + const potentialSplitPoint = top.kind === 271 /* ImportDeclaration */ ? getPotentiallyInvalidImportSpecifier((_a = top.importClause) == null ? void 0 : _a.namedBindings) ?? top.moduleSpecifier : top.moduleReference; const withoutModuleSpecifier = { pos: top.getFirstToken().getStart(), end: potentialSplitPoint.pos @@ -151042,12 +157940,12 @@ ${lanes.join("\n")} } } function getPotentiallyInvalidImportSpecifier(namedBindings) { - var _a2; + var _a; return find( - (_a2 = tryCast(namedBindings, isNamedImports)) == null ? void 0 : _a2.elements, + (_a = tryCast(namedBindings, isNamedImports)) == null ? void 0 : _a.elements, (e) => { - var _a3; - return !e.propertyName && isStringANonContextualKeyword(e.name.text) && ((_a3 = findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) == null ? void 0 : _a3.kind) !== 27 /* CommaToken */; + var _a2; + return !e.propertyName && isStringANonContextualKeyword(e.name.text) && ((_a2 = findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) == null ? void 0 : _a2.kind) !== 28 /* CommaToken */; } ); } @@ -151066,17 +157964,21 @@ ${lanes.join("\n")} return true; } function isModuleSpecifierMissingOrEmpty(specifier) { - var _a2; + var _a; if (nodeIsMissing(specifier)) return true; - return !((_a2 = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a2.text); + return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text); } - function getVariableDeclaration(property) { - const variableDeclaration = findAncestor(property, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node)); - return variableDeclaration; + function getVariableOrParameterDeclaration(contextToken, location) { + if (!contextToken) + return; + const possiblyParameterDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent)); + const possiblyVariableDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node)); + return possiblyParameterDeclaration || possiblyVariableDeclaration; } function isArrowFunctionBody(node) { - return node.parent && isArrowFunction(node.parent) && node.parent.body === node; + return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/; + node.kind === 39 /* EqualsGreaterThanToken */); } function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules = /* @__PURE__ */ new Map()) { return nonAliasCanBeReferencedAtTypeLocation(symbol) || nonAliasCanBeReferencedAtTypeLocation(skipAlias(symbol.exportSymbol || symbol, checker)); @@ -151185,7 +158087,7 @@ ${lanes.join("\n")} _keywordCompletions = []; allKeywordsCompletions = memoize(() => { const res = []; - for (let i = 81 /* FirstKeyword */; i <= 162 /* LastKeyword */; i++) { + for (let i = 83 /* FirstKeyword */; i <= 164 /* LastKeyword */; i++) { res.push({ name: tokenToString(i), kind: "keyword" /* keyword */, @@ -151252,7 +158154,7 @@ ${lanes.join("\n")} options, /*formatContext*/ void 0, - /*isTypeOnlyLocation */ + /*isTypeOnlyLocation*/ void 0, /*propertyAccessToConvert*/ void 0, @@ -151355,61 +158257,37 @@ ${lanes.join("\n")} function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host, preferences) { const parent2 = walkUpParentheses(node.parent); switch (parent2.kind) { - case 198 /* LiteralType */: { + case 200 /* LiteralType */: { const grandParent = walkUpParentheses(parent2.parent); - switch (grandParent.kind) { - case 230 /* ExpressionWithTypeArguments */: - case 180 /* TypeReference */: { - const typeArgument = findAncestor(parent2, (n) => n.parent === grandParent); - if (typeArgument) { - return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false }; - } - return void 0; - } - case 196 /* IndexedAccessType */: - const { indexType, objectType } = grandParent; - if (!rangeContainsPosition(indexType, position)) { - return void 0; - } - return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType)); - case 202 /* ImportType */: - return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; - case 189 /* UnionType */: { - if (!isTypeReferenceNode(grandParent.parent)) { - return void 0; - } - const alreadyUsedTypes = getAlreadyUsedTypesInStringLiteralUnion(grandParent, parent2); - const types = getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(grandParent)).filter((t) => !contains(alreadyUsedTypes, t.value)); - return { kind: 2 /* Types */, types, isNewIdentifier: false }; - } - default: - return void 0; + if (grandParent.kind === 204 /* ImportType */) { + return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; } + return fromUnionableLiteralType(grandParent); } - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: if (isObjectLiteralExpression(parent2.parent) && parent2.name === node) { return stringLiteralCompletionsForObjectLiteral(typeChecker, parent2.parent); } return fromContextualType() || fromContextualType(0 /* None */); - case 209 /* ElementAccessExpression */: { + case 211 /* ElementAccessExpression */: { const { expression, argumentExpression } = parent2; if (node === skipParentheses(argumentExpression)) { return stringLiteralCompletionsFromProperties(typeChecker.getTypeAtLocation(expression)); } return void 0; } - case 210 /* CallExpression */: - case 211 /* NewExpression */: - case 288 /* JsxAttribute */: + case 212 /* CallExpression */: + case 213 /* NewExpression */: + case 290 /* JsxAttribute */: if (!isRequireCallArgument(node) && !isImportCall(parent2)) { - const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 288 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile); - return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); + const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile); + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */); } - case 269 /* ImportDeclaration */: - case 275 /* ExportDeclaration */: - case 280 /* ExternalModuleReference */: + case 271 /* ImportDeclaration */: + case 277 /* ExportDeclaration */: + case 282 /* ExternalModuleReference */: return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; - case 292 /* CaseClause */: + case 295 /* CaseClause */: const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses); const contextualTypes = fromContextualType(); if (!contextualTypes) { @@ -151420,6 +158298,37 @@ ${lanes.join("\n")} default: return fromContextualType() || fromContextualType(0 /* None */); } + function fromUnionableLiteralType(grandParent) { + switch (grandParent.kind) { + case 232 /* ExpressionWithTypeArguments */: + case 182 /* TypeReference */: { + const typeArgument = findAncestor(parent2, (n) => n.parent === grandParent); + if (typeArgument) { + return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false }; + } + return void 0; + } + case 198 /* IndexedAccessType */: + const { indexType, objectType } = grandParent; + if (!rangeContainsPosition(indexType, position)) { + return void 0; + } + return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType)); + case 191 /* UnionType */: { + const result = fromUnionableLiteralType(walkUpParentheses(grandParent.parent)); + if (!result) { + return void 0; + } + const alreadyUsedTypes = getAlreadyUsedTypesInStringLiteralUnion(grandParent, parent2); + if (result.kind === 1 /* Properties */) { + return { kind: 1 /* Properties */, symbols: result.symbols.filter((sym) => !contains(alreadyUsedTypes, sym.name)), hasIndexSignature: result.hasIndexSignature }; + } + return { kind: 2 /* Types */, types: result.types.filter((t) => !contains(alreadyUsedTypes, t.value)), isNewIdentifier: false }; + } + default: + return void 0; + } + } function fromContextualType(contextFlags = 4 /* Completions */) { const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags)); if (!types.length) { @@ -151430,9 +158339,9 @@ ${lanes.join("\n")} } function walkUpParentheses(node) { switch (node.kind) { - case 193 /* ParenthesizedType */: + case 195 /* ParenthesizedType */: return walkUpParenthesizedTypes(node); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return walkUpParenthesizedExpressions(node); default: return node; @@ -151452,7 +158361,7 @@ ${lanes.join("\n")} return; let type = candidate.getTypeParameterAtPosition(argumentInfo.argumentIndex); if (isJsxOpeningLikeElement(call)) { - const propType = checker.getTypeOfPropertyOfType(type, editingArgument.name.text); + const propType = checker.getTypeOfPropertyOfType(type, getTextOfJsxAttributeName(editingArgument.name)); if (propType) { type = propType; } @@ -151517,7 +158426,7 @@ ${lanes.join("\n")} const scriptPath = sourceFile.path; const scriptDirectory = getDirectoryPath(scriptPath); const extensionOptions = getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile, typeChecker, preferences, mode); - return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker); + return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && !compilerOptions.paths && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker); } function getExtensionOptions(compilerOptions, referenceKind, importingSourceFile, typeChecker, preferences, resolutionMode) { return { @@ -151589,7 +158498,7 @@ ${lanes.join("\n")} ).values())); } function getCompletionEntriesForDirectoryFragment(fragment, scriptDirectory, extensionOptions, host, moduleSpecifierIsRelative, exclude, result = createNameAndKindSet()) { - var _a2; + var _a; if (fragment === void 0) { fragment = ""; } @@ -151609,7 +158518,7 @@ ${lanes.join("\n")} const packageJson = readJson(packageJsonPath, host); const typesVersions = packageJson.typesVersions; if (typeof typesVersions === "object") { - const versionPaths = (_a2 = getPackageJsonTypesVersionsPaths(typesVersions)) == null ? void 0 : _a2.paths; + const versionPaths = (_a = getPackageJsonTypesVersionsPaths(typesVersions)) == null ? void 0 : _a.paths; if (versionPaths) { const packageDirectory = getDirectoryPath(packageJsonPath); const pathInPackage = absolutePath.slice(ensureTrailingDirectorySeparator(packageDirectory).length); @@ -151720,8 +158629,7 @@ ${lanes.join("\n")} const result = createNameAndKindSet(); const moduleResolution = getEmitModuleResolutionKind(compilerOptions); if (baseUrl) { - const projectDir = compilerOptions.project || host.getCurrentDirectory(); - const absolute = normalizePath(combinePaths(projectDir, baseUrl)); + const absolute = normalizePath(combinePaths(host.getCurrentDirectory(), baseUrl)); getCompletionEntriesForDirectoryFragment( fragment, absolute, @@ -151733,9 +158641,10 @@ ${lanes.join("\n")} void 0, result ); - if (paths) { - addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, host, paths); - } + } + if (paths) { + const absolute = getPathsBasePath(compilerOptions, host); + addCompletionEntriesFromPaths(result, fragment, absolute, extensionOptions, host, paths); } const fragmentDirectory = getFragmentDirectory(fragment); for (const ambientName of getAmbientModuleCompletions(fragment, fragmentDirectory, typeChecker)) { @@ -151854,8 +158763,8 @@ ${lanes.join("\n")} if (remainingFragment === void 0) { const starIsFullPathComponent = path[path.length - 2] === "/"; return starIsFullPathComponent ? justPathMappingName(pathPrefix, "directory" /* directory */) : flatMap(patterns, (pattern) => { - var _a2; - return (_a2 = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, host)) == null ? void 0 : _a2.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest })); + var _a; + return (_a = getModulesForPathsPattern("", packageDirectory, pattern, extensionOptions, host)) == null ? void 0 : _a.map(({ name, ...rest }) => ({ name: pathPrefix + name, ...rest })); }); } return flatMap(patterns, (pattern) => getModulesForPathsPattern(remainingFragment, packageDirectory, pattern, extensionOptions, host)); @@ -152126,25 +159035,25 @@ ${lanes.join("\n")} if (cancellationToken) cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 210 /* CallExpression */: + case 212 /* CallExpression */: if (isImportCall(direct)) { handleImportCall(direct); break; } if (!isAvailableThroughGlobal) { const parent2 = direct.parent; - if (exportKind === 2 /* ExportEquals */ && parent2.kind === 257 /* VariableDeclaration */) { + if (exportKind === 2 /* ExportEquals */ && parent2.kind === 259 /* VariableDeclaration */) { const { name } = parent2; - if (name.kind === 79 /* Identifier */) { + if (name.kind === 80 /* Identifier */) { directImports.push(name); break; } } } break; - case 79 /* Identifier */: + case 80 /* Identifier */: break; - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: handleNamespaceImport( direct, direct.name, @@ -152153,10 +159062,10 @@ ${lanes.join("\n")} false ); break; - case 269 /* ImportDeclaration */: + case 271 /* ImportDeclaration */: directImports.push(direct); const namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 271 /* NamespaceImport */) { + if (namedBindings && namedBindings.kind === 273 /* NamespaceImport */) { handleNamespaceImport( direct, namedBindings.name, @@ -152169,24 +159078,24 @@ ${lanes.join("\n")} addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); } break; - case 275 /* ExportDeclaration */: + case 277 /* ExportDeclaration */: if (!direct.exportClause) { handleDirectImports(getContainingModuleSymbol(direct, checker)); - } else if (direct.exportClause.kind === 277 /* NamespaceExport */) { + } else if (direct.exportClause.kind === 279 /* NamespaceExport */) { addIndirectUser( getSourceFileLikeForImportDeclaration(direct), - /** addTransitiveDependencies */ + /*addTransitiveDependencies*/ true ); } else { directImports.push(direct); } break; - case 202 /* ImportType */: + case 204 /* ImportType */: if (!isAvailableThroughGlobal && direct.isTypeOf && !direct.qualifier && isExported2(direct)) { addIndirectUser( direct.getSourceFile(), - /** addTransitiveDependencies */ + /*addTransitiveDependencies*/ true ); } @@ -152205,7 +159114,7 @@ ${lanes.join("\n")} /** addTransitiveDependencies */ !!isExported2( importCall, - /** stopAtAmbientModule */ + /*stopAtAmbientModule*/ true ) ); @@ -152223,11 +159132,11 @@ ${lanes.join("\n")} directImports.push(importDeclaration); } else if (!isAvailableThroughGlobal) { const sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - Debug.assert(sourceFileLike.kind === 308 /* SourceFile */ || sourceFileLike.kind === 264 /* ModuleDeclaration */); + Debug.assert(sourceFileLike.kind === 311 /* SourceFile */ || sourceFileLike.kind === 266 /* ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUser( sourceFileLike, - /** addTransitiveDependencies */ + /*addTransitiveDependencies*/ true ); } else { @@ -152253,7 +159162,7 @@ ${lanes.join("\n")} if (!isImportTypeNode(directImport)) { addIndirectUser( getSourceFileLikeForImportDeclaration(directImport), - /** addTransitiveDependencies */ + /*addTransitiveDependencies*/ true ); } @@ -152277,17 +159186,17 @@ ${lanes.join("\n")} } return { importSearches, singleReferences }; function handleImport(decl) { - if (decl.kind === 268 /* ImportEqualsDeclaration */) { + if (decl.kind === 270 /* ImportEqualsDeclaration */) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } return; } - if (decl.kind === 79 /* Identifier */) { + if (decl.kind === 80 /* Identifier */) { handleNamespaceImportLike(decl); return; } - if (decl.kind === 202 /* ImportType */) { + if (decl.kind === 204 /* ImportType */) { if (decl.qualifier) { const firstIdentifier = getFirstIdentifier(decl.qualifier); if (firstIdentifier.escapedText === symbolName(exportSymbol)) { @@ -152298,10 +159207,10 @@ ${lanes.join("\n")} } return; } - if (decl.moduleSpecifier.kind !== 10 /* StringLiteral */) { + if (decl.moduleSpecifier.kind !== 11 /* StringLiteral */) { return; } - if (decl.kind === 275 /* ExportDeclaration */) { + if (decl.kind === 277 /* ExportDeclaration */) { if (decl.exportClause && isNamedExports(decl.exportClause)) { searchForNamedImport(decl.exportClause); } @@ -152310,10 +159219,10 @@ ${lanes.join("\n")} const { name, namedBindings } = decl.importClause || { name: void 0, namedBindings: void 0 }; if (namedBindings) { switch (namedBindings.kind) { - case 271 /* NamespaceImport */: + case 273 /* NamespaceImport */: handleNamespaceImportLike(namedBindings.name); break; - case 272 /* NamedImports */: + case 274 /* NamedImports */: if (exportKind === 0 /* Named */ || exportKind === 1 /* Default */) { searchForNamedImport(namedBindings); } @@ -152347,7 +159256,7 @@ ${lanes.join("\n")} addSearch(name, checker.getSymbolAtLocation(name)); } } else { - const localSymbol = element.kind === 278 /* ExportSpecifier */ && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) : checker.getSymbolAtLocation(name); + const localSymbol = element.kind === 280 /* ExportSpecifier */ && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) : checker.getSymbolAtLocation(name); addSearch(name, localSymbol); } } @@ -152366,28 +159275,28 @@ ${lanes.join("\n")} }); } function findModuleReferences(program, sourceFiles, searchModuleSymbol) { - var _a2; + var _a; const refs = []; const checker = program.getTypeChecker(); for (const referencingFile of sourceFiles) { const searchSourceFile = searchModuleSymbol.valueDeclaration; - if ((searchSourceFile == null ? void 0 : searchSourceFile.kind) === 308 /* SourceFile */) { + if ((searchSourceFile == null ? void 0 : searchSourceFile.kind) === 311 /* SourceFile */) { for (const ref of referencingFile.referencedFiles) { if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { refs.push({ kind: "reference", referencingFile, ref }); } } for (const ref of referencingFile.typeReferenceDirectives) { - const referenced = (_a2 = program.getResolvedTypeReferenceDirectives().get(ref.fileName, ref.resolutionMode || referencingFile.impliedNodeFormat)) == null ? void 0 : _a2.resolvedTypeReferenceDirective; + const referenced = (_a = program.getResolvedTypeReferenceDirectives().get(ref.fileName, ref.resolutionMode || referencingFile.impliedNodeFormat)) == null ? void 0 : _a.resolvedTypeReferenceDirective; if (referenced !== void 0 && referenced.resolvedFileName === searchSourceFile.fileName) { refs.push({ kind: "reference", referencingFile, ref }); } } } - forEachImport(referencingFile, (_importDecl, moduleSpecifier) => { + forEachImport(referencingFile, (importDecl, moduleSpecifier) => { const moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); if (moduleSymbol === searchModuleSymbol) { - refs.push({ kind: "import", literal: moduleSpecifier }); + refs.push(nodeIsSynthesized(importDecl) ? { kind: "implicit", literal: moduleSpecifier, referencingFile } : { kind: "import", literal: moduleSpecifier }); } }); } @@ -152413,7 +159322,7 @@ ${lanes.join("\n")} return map2; } function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return forEach(sourceFileLike.kind === 308 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, (statement) => ( + return forEach(sourceFileLike.kind === 311 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, (statement) => ( // TODO: GH#18217 action(statement) || isAmbientModuleDeclaration(statement) && forEach(statement.body && statement.body.statements, action) )); @@ -152426,15 +159335,15 @@ ${lanes.join("\n")} } else { forEachPossibleImportOrExportStatement(sourceFile, (statement) => { switch (statement.kind) { - case 275 /* ExportDeclaration */: - case 269 /* ImportDeclaration */: { + case 277 /* ExportDeclaration */: + case 271 /* ImportDeclaration */: { const decl = statement; if (decl.moduleSpecifier && isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 268 /* ImportEqualsDeclaration */: { + case 270 /* ImportEqualsDeclaration */: { const decl = statement; if (isExternalModuleImportEquals(decl)) { action(decl, decl.moduleReference.expression); @@ -152448,12 +159357,12 @@ ${lanes.join("\n")} function getImportOrExportSymbol(node, symbol, checker, comingFromExport) { return comingFromExport ? getExport() : getExport() || getImport(); function getExport() { - var _a2; + var _a; const { parent: parent2 } = node; const grandparent = parent2.parent; if (symbol.exportSymbol) { - if (parent2.kind === 208 /* PropertyAccessExpression */) { - return ((_a2 = symbol.declarations) == null ? void 0 : _a2.some((d) => d === parent2)) && isBinaryExpression(grandparent) ? getSpecialPropertyExport( + if (parent2.kind === 210 /* PropertyAccessExpression */) { + return ((_a = symbol.declarations) == null ? void 0 : _a.some((d) => d === parent2)) && isBinaryExpression(grandparent) ? getSpecialPropertyExport( grandparent, /*useLhsSymbol*/ false @@ -152544,13 +159453,13 @@ ${lanes.join("\n")} } } function getExportEqualsLocalSymbol(importedSymbol, checker) { - var _a2, _b; + var _a, _b; if (importedSymbol.flags & 2097152 /* Alias */) { return checker.getImmediateAliasedSymbol(importedSymbol); } const decl = Debug.checkDefined(importedSymbol.valueDeclaration); if (isExportAssignment(decl)) { - return (_a2 = tryCast(decl.expression, canHaveSymbol)) == null ? void 0 : _a2.symbol; + return (_a = tryCast(decl.expression, canHaveSymbol)) == null ? void 0 : _a.symbol; } else if (isBinaryExpression(decl)) { return (_b = tryCast(decl.right, canHaveSymbol)) == null ? void 0 : _b.symbol; } else if (isSourceFile(decl)) { @@ -152569,15 +159478,15 @@ ${lanes.join("\n")} function isNodeImport(node) { const { parent: parent2 } = node; switch (parent2.kind) { - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: return parent2.name === node && isExternalModuleImportEquals(parent2); - case 273 /* ImportSpecifier */: + case 275 /* ImportSpecifier */: return !parent2.propertyName; - case 270 /* ImportClause */: - case 271 /* NamespaceImport */: + case 272 /* ImportClause */: + case 273 /* NamespaceImport */: Debug.assert(parent2.name === node); return true; - case 205 /* BindingElement */: + case 207 /* BindingElement */: return isInJSFile(node) && isVariableDeclarationInitializedToBareOrAccessedRequire(parent2.parent.parent); default: return false; @@ -152608,21 +159517,21 @@ ${lanes.join("\n")} return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 210 /* CallExpression */) { + if (node.kind === 212 /* CallExpression */) { return node.getSourceFile(); } const { parent: parent2 } = node; - if (parent2.kind === 308 /* SourceFile */) { + if (parent2.kind === 311 /* SourceFile */) { return parent2; } - Debug.assert(parent2.kind === 265 /* ModuleBlock */); + Debug.assert(parent2.kind === 267 /* ModuleBlock */); return cast(parent2.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 264 /* ModuleDeclaration */ && node.name.kind === 10 /* StringLiteral */; + return node.kind === 266 /* ModuleDeclaration */ && node.name.kind === 11 /* StringLiteral */; } function isExternalModuleImportEquals(eq) { - return eq.moduleReference.kind === 280 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* StringLiteral */; + return eq.moduleReference.kind === 282 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 11 /* StringLiteral */; } var ExportKind2, ImportExport; var init_importTracker = __esm({ @@ -152687,7 +159596,7 @@ ${lanes.join("\n")} if (node.parent.name === node || // node is name of declaration, use parent isConstructorDeclaration(node.parent) || isExportAssignment(node.parent) || // Property name of the import export specifier or binding pattern, use parent (isImportOrExportSpecifier(node.parent) || isBindingElement(node.parent)) && node.parent.propertyName === node || // Is default export - node.kind === 88 /* DefaultKeyword */ && hasSyntacticModifier(node.parent, 1025 /* ExportDefault */)) { + node.kind === 90 /* DefaultKeyword */ && hasSyntacticModifier(node.parent, 1025 /* ExportDefault */)) { return getContextNode(node.parent); } return void 0; @@ -152696,28 +159605,28 @@ ${lanes.join("\n")} if (!node) return void 0; switch (node.kind) { - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: return !isVariableDeclarationList(node.parent) || node.parent.declarations.length !== 1 ? node : isVariableStatement(node.parent.parent) ? node.parent.parent : isForInOrOfStatement(node.parent.parent) ? getContextNode(node.parent.parent) : node.parent; - case 205 /* BindingElement */: + case 207 /* BindingElement */: return getContextNode(node.parent.parent); - case 273 /* ImportSpecifier */: + case 275 /* ImportSpecifier */: return node.parent.parent.parent; - case 278 /* ExportSpecifier */: - case 271 /* NamespaceImport */: + case 280 /* ExportSpecifier */: + case 273 /* NamespaceImport */: return node.parent.parent; - case 270 /* ImportClause */: - case 277 /* NamespaceExport */: + case 272 /* ImportClause */: + case 279 /* NamespaceExport */: return node.parent; - case 223 /* BinaryExpression */: + case 225 /* BinaryExpression */: return isExpressionStatement(node.parent) ? node.parent : node; - case 247 /* ForOfStatement */: - case 246 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 248 /* ForInStatement */: return { start: node.initializer, end: node.expression }; - case 299 /* PropertyAssignment */: - case 300 /* ShorthandPropertyAssignment */: + case 302 /* PropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: return isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent) ? getContextNode( findAncestor( node.parent, @@ -152750,13 +159659,13 @@ ${lanes.join("\n")} )); } function isDefinitionForReference(node) { - return node.kind === 88 /* DefaultKeyword */ || !!getDeclarationFromName(node) || isLiteralComputedPropertyDeclarationName(node) || node.kind === 135 /* ConstructorKeyword */ && isConstructorDeclaration(node.parent); + return node.kind === 90 /* DefaultKeyword */ || !!getDeclarationFromName(node) || isLiteralComputedPropertyDeclarationName(node) || node.kind === 137 /* ConstructorKeyword */ && isConstructorDeclaration(node.parent); } function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) { const node = getTouchingPropertyName(sourceFile, position); let referenceEntries; const entries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position); - if (node.parent.kind === 208 /* PropertyAccessExpression */ || node.parent.kind === 205 /* BindingElement */ || node.parent.kind === 209 /* ElementAccessExpression */ || node.kind === 106 /* SuperKeyword */) { + if (node.parent.kind === 210 /* PropertyAccessExpression */ || node.parent.kind === 207 /* BindingElement */ || node.parent.kind === 211 /* ElementAccessExpression */ || node.kind === 108 /* SuperKeyword */) { referenceEntries = entries && [...entries]; } else if (entries) { const queue = createQueue(entries); @@ -152777,15 +159686,15 @@ ${lanes.join("\n")} return map(referenceEntries, (entry) => toImplementationLocation(entry, checker)); } function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 308 /* SourceFile */) { + if (node.kind === 311 /* SourceFile */) { return void 0; } const checker = program.getTypeChecker(); - if (node.parent.kind === 300 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 303 /* ShorthandPropertyAssignment */) { const result = []; Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, (node2) => result.push(nodeEntry(node2))); return result; - } else if (node.kind === 106 /* SuperKeyword */ || isSuperProperty(node.parent)) { + } else if (node.kind === 108 /* SuperKeyword */ || isSuperProperty(node.parent)) { const symbol = checker.getSymbolAtLocation(node); return symbol.valueDeclaration && [nodeEntry(symbol.valueDeclaration)]; } else { @@ -152886,8 +159795,8 @@ ${lanes.join("\n")} const { displayParts, symbolKind } = ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, enclosingDeclaration.getSourceFile(), enclosingDeclaration, enclosingDeclaration, meaning); return { displayParts, kind: symbolKind }; } - function toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixText) { - return { ...entryToDocumentSpan(entry), ...providePrefixAndSuffixText && getPrefixAndSuffixText(entry, originalNode, checker) }; + function toRenameLocation(entry, originalNode, checker, providePrefixAndSuffixText, quotePreference) { + return { ...entryToDocumentSpan(entry), ...providePrefixAndSuffixText && getPrefixAndSuffixText(entry, originalNode, checker, quotePreference) }; } function toReferencedSymbolEntry(entry, symbol) { const referenceEntry = toReferenceEntry(entry); @@ -152923,7 +159832,7 @@ ${lanes.join("\n")} }; } } - function getPrefixAndSuffixText(entry, originalNode, checker) { + function getPrefixAndSuffixText(entry, originalNode, checker, quotePreference) { if (entry.kind !== 0 /* Span */ && isIdentifier(originalNode)) { const { node, kind } = entry; const parent2 = node.parent; @@ -152954,6 +159863,10 @@ ${lanes.join("\n")} return originalNode === entry.node || checker.getSymbolAtLocation(originalNode) === checker.getSymbolAtLocation(entry.node) ? { prefixText: name + " as " } : { suffixText: " as " + name }; } } + if (entry.kind !== 0 /* Span */ && isNumericLiteral(entry.node) && isAccessExpression(entry.node.parent)) { + const quote2 = getQuoteFromPreference(quotePreference); + return { prefixText: quote2, suffixText: quote2 }; + } return emptyOptions; } function toImplementationLocation(entry, checker) { @@ -152972,15 +159885,15 @@ ${lanes.join("\n")} const symbol = checker.getSymbolAtLocation(isDeclaration(node) && node.name ? node.name : node); if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); - } else if (node.kind === 207 /* ObjectLiteralExpression */) { + } else if (node.kind === 209 /* ObjectLiteralExpression */) { return { kind: "interface" /* interfaceElement */, - displayParts: [punctuationPart(20 /* OpenParenToken */), textPart("object literal"), punctuationPart(21 /* CloseParenToken */)] + displayParts: [punctuationPart(21 /* OpenParenToken */), textPart("object literal"), punctuationPart(22 /* CloseParenToken */)] }; - } else if (node.kind === 228 /* ClassExpression */) { + } else if (node.kind === 230 /* ClassExpression */) { return { kind: "local class" /* localClassElement */, - displayParts: [punctuationPart(20 /* OpenParenToken */), textPart("anonymous local class"), punctuationPart(21 /* CloseParenToken */)] + displayParts: [punctuationPart(21 /* OpenParenToken */), textPart("anonymous local class"), punctuationPart(22 /* CloseParenToken */)] }; } else { return { kind: getNodeKind(node), displayParts: [] }; @@ -153021,60 +159934,60 @@ ${lanes.join("\n")} } function isWriteAccessForReference(node) { const decl = getDeclarationFromName(node); - return !!decl && declarationIsWriteAccess(decl) || node.kind === 88 /* DefaultKeyword */ || isWriteAccess(node); + return !!decl && declarationIsWriteAccess(decl) || node.kind === 90 /* DefaultKeyword */ || isWriteAccess(node); } function isDeclarationOfSymbol(node, target) { - var _a2; + var _a; if (!target) return false; - const source = getDeclarationFromName(node) || (node.kind === 88 /* DefaultKeyword */ ? node.parent : isLiteralComputedPropertyDeclarationName(node) ? node.parent.parent : node.kind === 135 /* ConstructorKeyword */ && isConstructorDeclaration(node.parent) ? node.parent.parent : void 0); + const source = getDeclarationFromName(node) || (node.kind === 90 /* DefaultKeyword */ ? node.parent : isLiteralComputedPropertyDeclarationName(node) ? node.parent.parent : node.kind === 137 /* ConstructorKeyword */ && isConstructorDeclaration(node.parent) ? node.parent.parent : void 0); const commonjsSource = source && isBinaryExpression(source) ? source.left : void 0; - return !!(source && ((_a2 = target.declarations) == null ? void 0 : _a2.some((d) => d === source || d === commonjsSource))); + return !!(source && ((_a = target.declarations) == null ? void 0 : _a.some((d) => d === source || d === commonjsSource))); } function declarationIsWriteAccess(decl) { if (!!(decl.flags & 16777216 /* Ambient */)) return true; switch (decl.kind) { - case 223 /* BinaryExpression */: - case 205 /* BindingElement */: - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 88 /* DefaultKeyword */: - case 263 /* EnumDeclaration */: - case 302 /* EnumMember */: - case 278 /* ExportSpecifier */: - case 270 /* ImportClause */: - case 268 /* ImportEqualsDeclaration */: - case 273 /* ImportSpecifier */: - case 261 /* InterfaceDeclaration */: - case 341 /* JSDocCallbackTag */: - case 349 /* JSDocTypedefTag */: - case 288 /* JsxAttribute */: - case 264 /* ModuleDeclaration */: - case 267 /* NamespaceExportDeclaration */: - case 271 /* NamespaceImport */: - case 277 /* NamespaceExport */: - case 166 /* Parameter */: - case 300 /* ShorthandPropertyAssignment */: - case 262 /* TypeAliasDeclaration */: - case 165 /* TypeParameter */: + case 225 /* BinaryExpression */: + case 207 /* BindingElement */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 90 /* DefaultKeyword */: + case 265 /* EnumDeclaration */: + case 305 /* EnumMember */: + case 280 /* ExportSpecifier */: + case 272 /* ImportClause */: + case 270 /* ImportEqualsDeclaration */: + case 275 /* ImportSpecifier */: + case 263 /* InterfaceDeclaration */: + case 344 /* JSDocCallbackTag */: + case 352 /* JSDocTypedefTag */: + case 290 /* JsxAttribute */: + case 266 /* ModuleDeclaration */: + case 269 /* NamespaceExportDeclaration */: + case 273 /* NamespaceImport */: + case 279 /* NamespaceExport */: + case 168 /* Parameter */: + case 303 /* ShorthandPropertyAssignment */: + case 264 /* TypeAliasDeclaration */: + case 167 /* TypeParameter */: return true; - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: return !isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent); - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 173 /* Constructor */: - case 171 /* MethodDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 175 /* Constructor */: + case 173 /* MethodDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: return !!decl.body; - case 257 /* VariableDeclaration */: - case 169 /* PropertyDeclaration */: + case 259 /* VariableDeclaration */: + case 171 /* PropertyDeclaration */: return !!decl.initializer || isCatchClause(decl.parent); - case 170 /* MethodSignature */: - case 168 /* PropertySignature */: - case 351 /* JSDocPropertyTag */: - case 344 /* JSDocParameterTag */: + case 172 /* MethodSignature */: + case 170 /* PropertySignature */: + case 354 /* JSDocPropertyTag */: + case 347 /* JSDocParameterTag */: return false; default: return Debug.failBadSyntaxKind(decl); @@ -153111,8 +160024,8 @@ ${lanes.join("\n")} })(FindReferencesUse || {}); ((Core2) => { function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options = {}, sourceFilesSet = new Set(sourceFiles.map((f) => f.fileName))) { - var _a2, _b, _c; - node = getAdjustedNode(node, options); + var _a, _b, _c; + node = getAdjustedNode2(node, options); if (isSourceFile(node)) { const resolvedRef = ts_GoToDefinition_exports.getReferenceAtPosition(node, position, program); if (!(resolvedRef == null ? void 0 : resolvedRef.file)) { @@ -153150,7 +160063,7 @@ ${lanes.join("\n")} if (!options.implementations && isStringLiteralLike(node)) { if (isModuleSpecifierLike(node)) { const fileIncludeReasons = program.getFileIncludeReasons(); - const referencedFileName = (_c = (_b = (_a2 = node.getSourceFile().resolvedModules) == null ? void 0 : _a2.get(node.text, getModeForUsageLocation(node.getSourceFile(), node))) == null ? void 0 : _b.resolvedModule) == null ? void 0 : _c.resolvedFileName; + const referencedFileName = (_c = (_b = (_a = node.getSourceFile().resolvedModules) == null ? void 0 : _a.get(node.text, getModeForUsageLocation(node.getSourceFile(), node))) == null ? void 0 : _b.resolvedModule) == null ? void 0 : _c.resolvedFileName; const referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : void 0; if (referencedFile) { return [{ definition: { type: 4 /* String */, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || emptyArray }]; @@ -153180,7 +160093,7 @@ ${lanes.join("\n")} return mergeReferences(program, moduleReferences, references, moduleReferencesOfExportTarget); } Core2.getReferencedSymbolsForNode = getReferencedSymbolsForNode; - function getAdjustedNode(node, options) { + function getAdjustedNode2(node, options) { if (options.use === 1 /* References */) { node = getAdjustedReferenceLocation(node); } else if (options.use === 2 /* Rename */) { @@ -153188,10 +160101,10 @@ ${lanes.join("\n")} } return node; } - Core2.getAdjustedNode = getAdjustedNode; + Core2.getAdjustedNode = getAdjustedNode2; function getReferencesForFileName(fileName, program, sourceFiles, sourceFilesSet = new Set(sourceFiles.map((f) => f.fileName))) { - var _a2, _b; - const moduleSymbol = (_a2 = program.getSourceFile(fileName)) == null ? void 0 : _a2.symbol; + var _a, _b; + const moduleSymbol = (_a = program.getSourceFile(fileName)) == null ? void 0 : _a.symbol; if (moduleSymbol) { return ((_b = getReferencedSymbolsForModule( program, @@ -153310,6 +160223,12 @@ ${lanes.join("\n")} } } return nodeEntry(reference.literal); + } else if (reference.kind === "implicit") { + const range = reference.literal.text !== externalHelpersModuleNameText && forEachChildRecursively( + reference.referencingFile, + (n) => !(n.transformFlags & 2 /* ContainsJsx */) ? "skip" : isJsxElement(n) || isJsxSelfClosingElement(n) || isJsxFragment(n) ? n : void 0 + ) || reference.referencingFile.statements[0] || reference.referencingFile; + return nodeEntry(range); } else { return { kind: 0 /* Span */, @@ -153321,9 +160240,9 @@ ${lanes.join("\n")} if (symbol.declarations) { for (const decl of symbol.declarations) { switch (decl.kind) { - case 308 /* SourceFile */: + case 311 /* SourceFile */: break; - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: if (sourceFilesSet.has(decl.getSourceFile().fileName)) { references.push(nodeEntry(decl.name)); } @@ -153338,7 +160257,7 @@ ${lanes.join("\n")} for (const decl of exported.declarations) { const sourceFile = decl.getSourceFile(); if (sourceFilesSet.has(sourceFile.fileName)) { - const node = isBinaryExpression(decl) && isPropertyAccessExpression(decl.left) ? decl.left.expression : isExportAssignment(decl) ? Debug.checkDefined(findChildOfKind(decl, 93 /* ExportKeyword */, sourceFile)) : getNameOfDeclaration(decl) || decl; + const node = isBinaryExpression(decl) && isPropertyAccessExpression(decl.left) ? decl.left.expression : isExportAssignment(decl) ? Debug.checkDefined(findChildOfKind(decl, 95 /* ExportKeyword */, sourceFile)) : getNameOfDeclaration(decl) || decl; references.push(nodeEntry(node)); } } @@ -153346,21 +160265,21 @@ ${lanes.join("\n")} return references.length ? [{ definition: { type: 0 /* Symbol */, symbol }, references }] : emptyArray; } function isReadonlyTypeOperator(node) { - return node.kind === 146 /* ReadonlyKeyword */ && isTypeOperatorNode(node.parent) && node.parent.operator === 146 /* ReadonlyKeyword */; + return node.kind === 148 /* ReadonlyKeyword */ && isTypeOperatorNode(node.parent) && node.parent.operator === 148 /* ReadonlyKeyword */; } function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { if (isTypeKeyword(node.kind)) { - if (node.kind === 114 /* VoidKeyword */ && isVoidExpression(node.parent)) { + if (node.kind === 116 /* VoidKeyword */ && isVoidExpression(node.parent)) { return void 0; } - if (node.kind === 146 /* ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { + if (node.kind === 148 /* ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { return void 0; } return getAllReferencesForKeyword( sourceFiles, node.kind, cancellationToken, - node.kind === 146 /* ReadonlyKeyword */ ? isReadonlyTypeOperator : void 0 + node.kind === 148 /* ReadonlyKeyword */ ? isReadonlyTypeOperator : void 0 ); } if (isImportMeta(node.parent) && node.parent.name === node) { @@ -153378,7 +160297,7 @@ ${lanes.join("\n")} if (isThis(node)) { return getReferencesForThisKeyword(node, sourceFiles, cancellationToken); } - if (node.kind === 106 /* SuperKeyword */) { + if (node.kind === 108 /* SuperKeyword */) { return getReferencesForSuperKeyword(node); } return void 0; @@ -153412,7 +160331,7 @@ ${lanes.join("\n")} /*alwaysGetReferences*/ true ); - } else if (node && node.kind === 88 /* DefaultKeyword */ && symbol.escapedName === "default" /* Default */ && symbol.parent) { + } else if (node && node.kind === 90 /* DefaultKeyword */ && symbol.escapedName === "default" /* Default */ && symbol.parent) { addReference(node, symbol, state); searchForImportsOfExport(node, symbol, { exportingModuleSymbol: symbol.parent, exportKind: 1 /* Default */ }, state); } else { @@ -153447,10 +160366,10 @@ ${lanes.join("\n")} } function getSpecialSearchKind(node) { switch (node.kind) { - case 173 /* Constructor */: - case 135 /* ConstructorKeyword */: + case 175 /* Constructor */: + case 137 /* ConstructorKeyword */: return 1 /* Constructor */; - case 79 /* Identifier */: + case 80 /* Identifier */: if (isClassLike(node.parent)) { Debug.assert(node.parent.name === node); return 2 /* Class */; @@ -153656,7 +160575,7 @@ ${lanes.join("\n")} } function getSymbolScope(symbol) { const { declarations, flags, parent: parent2, valueDeclaration } = symbol; - if (valueDeclaration && (valueDeclaration.kind === 215 /* FunctionExpression */ || valueDeclaration.kind === 228 /* ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 217 /* FunctionExpression */ || valueDeclaration.kind === 230 /* ClassExpression */)) { return valueDeclaration; } if (!declarations) { @@ -153665,7 +160584,7 @@ ${lanes.join("\n")} if (flags & (4 /* Property */ | 8192 /* Method */)) { const privateDeclaration = find(declarations, (d) => hasEffectiveModifier(d, 8 /* Private */) || isPrivateIdentifierClassElementDeclaration(d)); if (privateDeclaration) { - return getAncestor(privateDeclaration, 260 /* ClassDeclaration */); + return getAncestor(privateDeclaration, 262 /* ClassDeclaration */); } return void 0; } @@ -153682,7 +160601,7 @@ ${lanes.join("\n")} if (scope && scope !== container) { return void 0; } - if (!container || container.kind === 308 /* SourceFile */ && !isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 311 /* SourceFile */ && !isExternalOrCommonJsModule(container)) { return void 0; } scope = container; @@ -153793,20 +160712,20 @@ ${lanes.join("\n")} } function isValidReferencePosition(node, searchSymbolName) { switch (node.kind) { - case 80 /* PrivateIdentifier */: + case 81 /* PrivateIdentifier */: if (isJSDocMemberName(node.parent)) { return true; } - case 79 /* Identifier */: + case 80 /* Identifier */: return node.text.length === searchSymbolName.length; - case 14 /* NoSubstitutionTemplateLiteral */: - case 10 /* StringLiteral */: { + case 15 /* NoSubstitutionTemplateLiteral */: + case 11 /* StringLiteral */: { const str = node; return (isLiteralNameOfPropertyDeclarationOrIndexAccess(str) || isNameOfModuleDeclaration(node) || isExpressionOfExternalModuleImportEqualsDeclaration(node) || isCallExpression(node.parent) && isBindableObjectDefinePropertyCall(node.parent) && node.parent.arguments[1] === node) && str.text.length === searchSymbolName.length; } - case 8 /* NumericLiteral */: + case 9 /* NumericLiteral */: return isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.text.length === searchSymbolName.length; - case 88 /* DefaultKeyword */: + case 90 /* DefaultKeyword */: return "default".length === searchSymbolName.length; default: return false; @@ -153869,7 +160788,7 @@ ${lanes.join("\n")} return; } if (isExportSpecifier(parent2)) { - Debug.assert(referenceLocation.kind === 79 /* Identifier */); + Debug.assert(referenceLocation.kind === 80 /* Identifier */); getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent2, search, state, addReferencesHere); return; } @@ -153976,7 +160895,7 @@ ${lanes.join("\n")} } function addReference(referenceLocation, relatedSymbol, state) { const { kind, symbol } = "kind" in relatedSymbol ? relatedSymbol : { kind: void 0, symbol: relatedSymbol }; - if (state.options.use === 2 /* Rename */ && referenceLocation.kind === 88 /* DefaultKeyword */) { + if (state.options.use === 2 /* Rename */ && referenceLocation.kind === 90 /* DefaultKeyword */) { return; } const addRef = state.referenceAdder(symbol); @@ -153992,7 +160911,7 @@ ${lanes.join("\n")} } const pusher = () => state.referenceAdder(search.symbol); if (isClassLike(referenceLocation.parent)) { - Debug.assert(referenceLocation.kind === 88 /* DefaultKeyword */ || referenceLocation.parent.name === referenceLocation); + Debug.assert(referenceLocation.kind === 90 /* DefaultKeyword */ || referenceLocation.parent.name === referenceLocation); findOwnConstructorReferences(search.symbol, sourceFile, pusher()); } else { const classExtending = tryGetClassByExtendingIdentifier(referenceLocation); @@ -154015,7 +160934,7 @@ ${lanes.join("\n")} } if (member.body) { member.body.forEachChild(function cb(node) { - if (node.kind === 108 /* ThisKeyword */) { + if (node.kind === 110 /* ThisKeyword */) { addRef(node); } else if (!isFunctionLike(node) && !isClassLike(node)) { node.forEachChild(cb); @@ -154028,18 +160947,18 @@ ${lanes.join("\n")} const constructorSymbol = getClassConstructorSymbol(classSymbol); if (constructorSymbol && constructorSymbol.declarations) { for (const decl of constructorSymbol.declarations) { - const ctrKeyword = findChildOfKind(decl, 135 /* ConstructorKeyword */, sourceFile); - Debug.assert(decl.kind === 173 /* Constructor */ && !!ctrKeyword); + const ctrKeyword = findChildOfKind(decl, 137 /* ConstructorKeyword */, sourceFile); + Debug.assert(decl.kind === 175 /* Constructor */ && !!ctrKeyword); addNode(ctrKeyword); } } if (classSymbol.exports) { classSymbol.exports.forEach((member) => { const decl = member.valueDeclaration; - if (decl && decl.kind === 171 /* MethodDeclaration */) { + if (decl && decl.kind === 173 /* MethodDeclaration */) { const body = decl.body; if (body) { - forEachDescendantOfKind(body, 108 /* ThisKeyword */, (thisKeyword) => { + forEachDescendantOfKind(body, 110 /* ThisKeyword */, (thisKeyword) => { if (isNewExpressionTarget(thisKeyword)) { addNode(thisKeyword); } @@ -154058,10 +160977,10 @@ ${lanes.join("\n")} return; } for (const decl of constructor.declarations) { - Debug.assert(decl.kind === 173 /* Constructor */); + Debug.assert(decl.kind === 175 /* Constructor */); const body = decl.body; if (body) { - forEachDescendantOfKind(body, 106 /* SuperKeyword */, (node) => { + forEachDescendantOfKind(body, 108 /* SuperKeyword */, (node) => { if (isCallExpressionTarget(node)) { addNode(node); } @@ -154090,10 +161009,10 @@ ${lanes.join("\n")} addReference2(refNode); return; } - if (refNode.kind !== 79 /* Identifier */) { + if (refNode.kind !== 80 /* Identifier */) { return; } - if (refNode.parent.kind === 300 /* ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 303 /* ShorthandPropertyAssignment */) { getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference2); } const containingClass = getContainingClassIfInHeritageClause(refNode); @@ -154108,7 +161027,7 @@ ${lanes.join("\n")} addIfImplementation(typeHavingNode.initializer); } else if (isFunctionLike(typeHavingNode) && typeHavingNode.body) { const body = typeHavingNode.body; - if (body.kind === 238 /* Block */) { + if (body.kind === 240 /* Block */) { forEachReturnStatement(body, (returnStatement) => { if (returnStatement.expression) addIfImplementation(returnStatement.expression); @@ -154130,13 +161049,13 @@ ${lanes.join("\n")} } function isImplementationExpression(node) { switch (node.kind) { - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return isImplementationExpression(node.expression); - case 216 /* ArrowFunction */: - case 215 /* FunctionExpression */: - case 207 /* ObjectLiteralExpression */: - case 228 /* ClassExpression */: - case 206 /* ArrayLiteralExpression */: + case 218 /* ArrowFunction */: + case 217 /* FunctionExpression */: + case 209 /* ObjectLiteralExpression */: + case 230 /* ClassExpression */: + case 208 /* ArrayLiteralExpression */: return true; default: return false; @@ -154170,13 +161089,13 @@ ${lanes.join("\n")} } let staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: staticFlag &= getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; break; @@ -154185,7 +161104,7 @@ ${lanes.join("\n")} } const sourceFile = searchSpaceNode.getSourceFile(); const references = mapDefined(getPossibleSymbolReferenceNodes(sourceFile, "super", searchSpaceNode), (node) => { - if (node.kind !== 106 /* SuperKeyword */) { + if (node.kind !== 108 /* SuperKeyword */) { return; } const container = getSuperContainer( @@ -154198,44 +161117,44 @@ ${lanes.join("\n")} return [{ definition: { type: 0 /* Symbol */, symbol: searchSpaceNode.symbol }, references }]; } function isParameterName(node) { - return node.kind === 79 /* Identifier */ && node.parent.kind === 166 /* Parameter */ && node.parent.name === node; + return node.kind === 80 /* Identifier */ && node.parent.kind === 168 /* Parameter */ && node.parent.name === node; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { let searchSpaceNode = getThisContainer( thisOrSuperKeyword, - /* includeArrowFunctions */ + /*includeArrowFunctions*/ false, /*includeClassComputedPropertyName*/ false ); let staticFlag = 32 /* Static */; switch (searchSpaceNode.kind) { - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: if (isObjectLiteralMethod(searchSpaceNode)) { staticFlag &= getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; break; } - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: staticFlag &= getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; break; - case 308 /* SourceFile */: + case 311 /* SourceFile */: if (isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) { return void 0; } - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: break; default: return void 0; } - const references = flatMap(searchSpaceNode.kind === 308 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], (sourceFile) => { + const references = flatMap(searchSpaceNode.kind === 311 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], (sourceFile) => { cancellationToken.throwIfCancellationRequested(); return getPossibleSymbolReferenceNodes(sourceFile, "this", isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter((node) => { if (!isThis(node)) { @@ -154243,7 +161162,7 @@ ${lanes.join("\n")} } const container = getThisContainer( node, - /* includeArrowFunctions */ + /*includeArrowFunctions*/ false, /*includeClassComputedPropertyName*/ false @@ -154251,18 +161170,18 @@ ${lanes.join("\n")} if (!canHaveSymbol(container)) return false; switch (searchSpaceNode.kind) { - case 215 /* FunctionExpression */: - case 259 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 261 /* FunctionDeclaration */: return searchSpaceNode.symbol === container.symbol; - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: return isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol; - case 228 /* ClassExpression */: - case 260 /* ClassDeclaration */: - case 207 /* ObjectLiteralExpression */: + case 230 /* ClassExpression */: + case 262 /* ClassDeclaration */: + case 209 /* ObjectLiteralExpression */: return container.parent && canHaveSymbol(container.parent) && searchSpaceNode.symbol === container.parent.symbol && isStatic(container) === !!staticFlag; - case 308 /* SourceFile */: - return container.kind === 308 /* SourceFile */ && !isExternalModule(container) && !isParameterName(node); + case 311 /* SourceFile */: + return container.kind === 311 /* SourceFile */ && !isExternalModule(container) && !isParameterName(node); } }); }).map((n) => nodeEntry(n)); @@ -154386,7 +161305,7 @@ ${lanes.join("\n")} Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & 1 /* FunctionScopedVariable */) && !!(paramProps[1].flags & 4 /* Property */)); return fromRoot(symbol.flags & 1 /* FunctionScopedVariable */ ? paramProps[1] : paramProps[0]); } - const exportSpecifier = getDeclarationOfKind(symbol, 278 /* ExportSpecifier */); + const exportSpecifier = getDeclarationOfKind(symbol, 280 /* ExportSpecifier */); if (!isForRenamePopulateSearchSymbolSet || exportSpecifier && !exportSpecifier.propertyName) { const localSymbol = exportSpecifier && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier); if (localSymbol) { @@ -154427,7 +161346,7 @@ ${lanes.join("\n")} ) || (rootSymbol.parent && rootSymbol.parent.flags & (32 /* Class */ | 64 /* Interface */) && allowBaseTypes(rootSymbol) ? getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, checker, (base) => cbSymbol(sym, rootSymbol, base, kind)) : void 0)); } function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol2, checker2) { - const bindingElement = getDeclarationOfKind(symbol2, 205 /* BindingElement */); + const bindingElement = getDeclarationOfKind(symbol2, 207 /* BindingElement */); if (bindingElement && isObjectBindingElementWithoutPropertyName(bindingElement)) { return getPropertySymbolFromBindingElement(checker2, bindingElement); } @@ -154568,7 +161487,7 @@ ${lanes.join("\n")} // src/services/goToDefinition.ts function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) { - var _a2, _b; + var _a, _b; const resolvedRef = getReferenceAtPosition(sourceFile, position, program); const fileReferenceDefinition = resolvedRef && [getDefinitionInfoForFileReference(resolvedRef.reference.fileName, resolvedRef.fileName, resolvedRef.unverified)] || emptyArray; if (resolvedRef == null ? void 0 : resolvedRef.file) { @@ -154580,7 +161499,7 @@ ${lanes.join("\n")} } const { parent: parent2 } = node; const typeChecker = program.getTypeChecker(); - if (node.kind === 161 /* OverrideKeyword */ || isIdentifier(node) && isJSDocOverrideTag(parent2) && parent2.tagName === node) { + if (node.kind === 163 /* OverrideKeyword */ || isIdentifier(node) && isJSDocOverrideTag(parent2) && parent2.tagName === node) { return getDefinitionFromOverriddenMember(typeChecker, node) || emptyArray; } if (isJumpStatementTarget(node)) { @@ -154594,16 +161513,16 @@ ${lanes.join("\n")} void 0 )] : void 0; } - if (node.kind === 105 /* ReturnKeyword */) { + if (node.kind === 107 /* ReturnKeyword */) { const functionDeclaration = findAncestor(node.parent, (n) => isClassStaticBlockDeclaration(n) ? "quit" : isFunctionLikeDeclaration(n)); return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0; } - if (node.kind === 133 /* AwaitKeyword */) { + if (node.kind === 135 /* AwaitKeyword */) { const functionDeclaration = findAncestor(node, (n) => isFunctionLikeDeclaration(n)); - const isAsyncFunction2 = functionDeclaration && some(functionDeclaration.modifiers, (node2) => node2.kind === 132 /* AsyncKeyword */); + const isAsyncFunction2 = functionDeclaration && some(functionDeclaration.modifiers, (node2) => node2.kind === 134 /* AsyncKeyword */); return isAsyncFunction2 ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0; } - if (node.kind === 125 /* YieldKeyword */) { + if (node.kind === 127 /* YieldKeyword */) { const functionDeclaration = findAncestor(node, (n) => isFunctionLikeDeclaration(n)); const isGeneratorFunction = functionDeclaration && functionDeclaration.asteriskToken; return isGeneratorFunction ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0; @@ -154641,7 +161560,7 @@ ${lanes.join("\n")} } } if (!symbol && isModuleSpecifierLike(fallbackNode)) { - const ref = (_b = (_a2 = sourceFile.resolvedModules) == null ? void 0 : _a2.get(fallbackNode.text, getModeForUsageLocation(sourceFile, fallbackNode))) == null ? void 0 : _b.resolvedModule; + const ref = (_b = (_a = sourceFile.resolvedModules) == null ? void 0 : _a.get(fallbackNode.text, getModeForUsageLocation(sourceFile, fallbackNode))) == null ? void 0 : _b.resolvedModule; if (ref) { return [{ name: fallbackNode.text, @@ -154668,10 +161587,10 @@ ${lanes.join("\n")} return [sigInfo]; } else { const defs = getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution, calledDeclaration) || emptyArray; - return node.kind === 106 /* SuperKeyword */ ? [sigInfo, ...defs] : [...defs, sigInfo]; + return node.kind === 108 /* SuperKeyword */ ? [sigInfo, ...defs] : [...defs, sigInfo]; } } - if (node.parent.kind === 300 /* ShorthandPropertyAssignment */) { + if (node.parent.kind === 303 /* ShorthandPropertyAssignment */) { const shorthandSymbol = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); const definitions = (shorthandSymbol == null ? void 0 : shorthandSymbol.declarations) ? shorthandSymbol.declarations.map((decl) => createDefinitionInfo( decl, @@ -154682,7 +161601,7 @@ ${lanes.join("\n")} false, failedAliasResolution )) : emptyArray; - return concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || emptyArray); + return concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node)); } if (isPropertyName(node) && isBindingElement(parent2) && isObjectBindingPattern(parent2.parent) && node === (parent2.propertyName || parent2.name)) { const name = getNameFromPropertyName(node); @@ -154692,11 +161611,12 @@ ${lanes.join("\n")} return prop && getDefinitionFromSymbol(typeChecker, prop, node); }); } - return concatenate(fileReferenceDefinition, getDefinitionFromObjectLiteralElement(typeChecker, node) || getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution)); + const objectLiteralElementDefinition = getDefinitionFromObjectLiteralElement(typeChecker, node); + return concatenate(fileReferenceDefinition, objectLiteralElementDefinition.length ? objectLiteralElementDefinition : getDefinitionFromSymbol(typeChecker, symbol, node, failedAliasResolution)); } function symbolMatchesSignature(s, calledDeclaration) { - var _a2; - return s === calledDeclaration.symbol || s === calledDeclaration.symbol.parent || isAssignmentExpression(calledDeclaration.parent) || !isCallLikeExpression(calledDeclaration.parent) && s === ((_a2 = tryCast(calledDeclaration.parent, canHaveSymbol)) == null ? void 0 : _a2.symbol); + var _a; + return s === calledDeclaration.symbol || s === calledDeclaration.symbol.parent || isAssignmentExpression(calledDeclaration.parent) || !isCallLikeExpression(calledDeclaration.parent) && s === ((_a = tryCast(calledDeclaration.parent, canHaveSymbol)) == null ? void 0 : _a.symbol); } function getDefinitionFromObjectLiteralElement(typeChecker, node) { const element = getContainingObjectLiteralElement(node); @@ -154712,6 +161632,7 @@ ${lanes.join("\n")} ), (propertySymbol) => getDefinitionFromSymbol(typeChecker, propertySymbol, node)); } } + return emptyArray; } function getDefinitionFromOverriddenMember(typeChecker, node) { const classElement = findAncestor(node, isClassElement); @@ -154734,7 +161655,7 @@ ${lanes.join("\n")} return getDefinitionFromSymbol(typeChecker, symbol, node); } function getReferenceAtPosition(sourceFile, position, program) { - var _a2, _b, _c, _d; + var _a, _b, _c, _d; const referencePath = findReferenceInPosition(sourceFile.referencedFiles, position); if (referencePath) { const file = program.getSourceFileFromReference(sourceFile, referencePath); @@ -154742,7 +161663,7 @@ ${lanes.join("\n")} } const typeReferenceDirective = findReferenceInPosition(sourceFile.typeReferenceDirectives, position); if (typeReferenceDirective) { - const reference = (_a2 = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName, typeReferenceDirective.resolutionMode || sourceFile.impliedNodeFormat)) == null ? void 0 : _a2.resolvedTypeReferenceDirective; + const reference = (_a = program.getResolvedTypeReferenceDirectives().get(typeReferenceDirective.fileName, typeReferenceDirective.resolutionMode || sourceFile.impliedNodeFormat)) == null ? void 0 : _a.resolvedTypeReferenceDirective; const file = reference && program.getSourceFile(reference.resolvedFileName); return file && { reference: typeReferenceDirective, fileName: file.fileName, file, unverified: false }; } @@ -154840,13 +161761,13 @@ ${lanes.join("\n")} return { symbol, failedAliasResolution }; } function shouldSkipAlias(node, declaration) { - if (node.kind !== 79 /* Identifier */) { + if (node.kind !== 80 /* Identifier */) { return false; } if (node.parent === declaration) { return true; } - if (declaration.kind === 271 /* NamespaceImport */) { + if (declaration.kind === 273 /* NamespaceImport */) { return false; } return true; @@ -154877,7 +161798,7 @@ ${lanes.join("\n")} failedAliasResolution )); function getConstructSignatureDefinition() { - if (symbol.flags & 32 /* Class */ && !(symbol.flags & (16 /* Function */ | 3 /* Variable */)) && (isNewExpressionTarget(node) || node.kind === 135 /* ConstructorKeyword */)) { + if (symbol.flags & 32 /* Class */ && !(symbol.flags & (16 /* Function */ | 3 /* Variable */)) && (isNewExpressionTarget(node) || node.kind === 137 /* ConstructorKeyword */)) { const cls = find(filteredDeclarations, isClassLike) || Debug.fail("Expected declaration to have at least one class-like declaration"); return getSignatureDefinition( cls.members, @@ -154949,19 +161870,19 @@ ${lanes.join("\n")} if (hasInitializer(declaration.parent) && declaration.parent.initializer === declaration) return isDefinitionVisible(checker, declaration.parent); switch (declaration.kind) { - case 169 /* PropertyDeclaration */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 171 /* MethodDeclaration */: + case 171 /* PropertyDeclaration */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 173 /* MethodDeclaration */: if (hasEffectiveModifier(declaration, 8 /* Private */)) return false; - case 173 /* Constructor */: - case 299 /* PropertyAssignment */: - case 300 /* ShorthandPropertyAssignment */: - case 207 /* ObjectLiteralExpression */: - case 228 /* ClassExpression */: - case 216 /* ArrowFunction */: - case 215 /* FunctionExpression */: + case 175 /* Constructor */: + case 302 /* PropertyAssignment */: + case 303 /* ShorthandPropertyAssignment */: + case 209 /* ObjectLiteralExpression */: + case 230 /* ClassExpression */: + case 218 /* ArrowFunction */: + case 217 /* FunctionExpression */: return isDefinitionVisible(checker, declaration.parent); default: return false; @@ -155005,9 +161926,9 @@ ${lanes.join("\n")} } function isConstructorLike(node) { switch (node.kind) { - case 173 /* Constructor */: - case 182 /* ConstructorType */: - case 177 /* ConstructSignature */: + case 175 /* Constructor */: + case 184 /* ConstructorType */: + case 179 /* ConstructSignature */: return true; default: return false; @@ -155057,14 +161978,14 @@ ${lanes.join("\n")} return; } switch (node.kind) { - case 264 /* ModuleDeclaration */: - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: - case 259 /* FunctionDeclaration */: - case 228 /* ClassExpression */: - case 215 /* FunctionExpression */: - case 171 /* MethodDeclaration */: - case 216 /* ArrowFunction */: + case 266 /* ModuleDeclaration */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: + case 261 /* FunctionDeclaration */: + case 230 /* ClassExpression */: + case 217 /* FunctionExpression */: + case 173 /* MethodDeclaration */: + case 218 /* ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!textSpanIntersectsWith(span, node.pos, node.getFullWidth())) { @@ -155204,17 +162125,17 @@ ${lanes.join("\n")} } function isHintableLiteral(node) { switch (node.kind) { - case 221 /* PrefixUnaryExpression */: { + case 223 /* PrefixUnaryExpression */: { const operand = node.operand; return isLiteralExpression(operand) || isIdentifier(operand) && isInfinityOrNaNString(operand.escapedText); } - case 110 /* TrueKeyword */: - case 95 /* FalseKeyword */: - case 104 /* NullKeyword */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 225 /* TemplateExpression */: + case 112 /* TrueKeyword */: + case 97 /* FalseKeyword */: + case 106 /* NullKeyword */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 227 /* TemplateExpression */: return true; - case 79 /* Identifier */: { + case 80 /* Identifier */: { const name = node.escapedText; return isUndefined(name) || isInfinityOrNaNString(name); } @@ -155223,7 +162144,7 @@ ${lanes.join("\n")} } function visitFunctionDeclarationLikeForReturnType(decl) { if (isArrowFunction(decl)) { - if (!findChildOfKind(decl, 20 /* OpenParenToken */, file)) { + if (!findChildOfKind(decl, 21 /* OpenParenToken */, file)) { return; } } @@ -155246,7 +162167,7 @@ ${lanes.join("\n")} addTypeHints(typeDisplayString, getTypeAnnotationPosition(decl)); } function getTypeAnnotationPosition(decl) { - const closeParenToken = findChildOfKind(decl, 21 /* CloseParenToken */, file); + const closeParenToken = findChildOfKind(decl, 22 /* CloseParenToken */, file); if (closeParenToken) { return closeParenToken.end; } @@ -155350,8 +162271,8 @@ ${lanes.join("\n")} const parts = []; forEachUnique(declarations, (declaration) => { for (const jsdoc of getCommentHavingNodes(declaration)) { - const inheritDoc = isJSDoc(jsdoc) && jsdoc.tags && find(jsdoc.tags, (t) => t.kind === 330 /* JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc")); - if (jsdoc.comment === void 0 && !inheritDoc || isJSDoc(jsdoc) && declaration.kind !== 349 /* JSDocTypedefTag */ && declaration.kind !== 341 /* JSDocCallbackTag */ && jsdoc.tags && jsdoc.tags.some((t) => t.kind === 349 /* JSDocTypedefTag */ || t.kind === 341 /* JSDocCallbackTag */) && !jsdoc.tags.some((t) => t.kind === 344 /* JSDocParameterTag */ || t.kind === 345 /* JSDocReturnTag */)) { + const inheritDoc = isJSDoc(jsdoc) && jsdoc.tags && find(jsdoc.tags, (t) => t.kind === 333 /* JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc")); + if (jsdoc.comment === void 0 && !inheritDoc || isJSDoc(jsdoc) && declaration.kind !== 352 /* JSDocTypedefTag */ && declaration.kind !== 344 /* JSDocCallbackTag */ && jsdoc.tags && jsdoc.tags.some((t) => t.kind === 352 /* JSDocTypedefTag */ || t.kind === 344 /* JSDocCallbackTag */) && !jsdoc.tags.some((t) => t.kind === 347 /* JSDocParameterTag */ || t.kind === 348 /* JSDocReturnTag */)) { continue; } let newparts = jsdoc.comment ? getDisplayPartsFromComment(jsdoc.comment, checker) : []; @@ -155370,11 +162291,11 @@ ${lanes.join("\n")} } function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 344 /* JSDocParameterTag */: - case 351 /* JSDocPropertyTag */: + case 347 /* JSDocParameterTag */: + case 354 /* JSDocPropertyTag */: return [declaration]; - case 341 /* JSDocCallbackTag */: - case 349 /* JSDocTypedefTag */: + case 344 /* JSDocCallbackTag */: + case 352 /* JSDocTypedefTag */: return [declaration, declaration.parent]; default: return getJSDocCommentsAndTags(declaration); @@ -155384,7 +162305,7 @@ ${lanes.join("\n")} const infos = []; forEachUnique(declarations, (declaration) => { const tags = getJSDocTags(declaration); - if (tags.some((t) => t.kind === 349 /* JSDocTypedefTag */ || t.kind === 341 /* JSDocCallbackTag */) && !tags.some((t) => t.kind === 344 /* JSDocParameterTag */ || t.kind === 345 /* JSDocReturnTag */)) { + if (tags.some((t) => t.kind === 352 /* JSDocTypedefTag */ || t.kind === 344 /* JSDocCallbackTag */) && !tags.some((t) => t.kind === 347 /* JSDocParameterTag */ || t.kind === 348 /* JSDocReturnTag */)) { return; } for (const tag of tags) { @@ -155399,21 +162320,21 @@ ${lanes.join("\n")} } return flatMap( comment, - (node) => node.kind === 324 /* JSDocText */ ? [textPart(node.text)] : buildLinkParts(node, checker) + (node) => node.kind === 327 /* JSDocText */ ? [textPart(node.text)] : buildLinkParts(node, checker) ); } function getCommentDisplayParts(tag, checker) { const { comment, kind } = tag; const namePart = getTagNameDisplayPart(kind); switch (kind) { - case 352 /* JSDocThrowsTag */: + case 355 /* JSDocThrowsTag */: const typeExpression = tag.typeExpression; return typeExpression ? withNode(typeExpression) : comment === void 0 ? void 0 : getDisplayPartsFromComment(comment, checker); - case 332 /* JSDocImplementsTag */: + case 335 /* JSDocImplementsTag */: return withNode(tag.class); - case 331 /* JSDocAugmentsTag */: + case 334 /* JSDocAugmentsTag */: return withNode(tag.class); - case 348 /* JSDocTemplateTag */: + case 351 /* JSDocTemplateTag */: const templateTag = tag; const displayParts = []; if (templateTag.constraint) { @@ -155427,7 +162348,7 @@ ${lanes.join("\n")} forEach(templateTag.typeParameters, (tp) => { displayParts.push(namePart(tp.getText())); if (lastTypeParameter !== tp) { - displayParts.push(...[punctuationPart(27 /* CommaToken */), spacePart()]); + displayParts.push(...[punctuationPart(28 /* CommaToken */), spacePart()]); } }); } @@ -155435,14 +162356,14 @@ ${lanes.join("\n")} displayParts.push(...[spacePart(), ...getDisplayPartsFromComment(comment, checker)]); } return displayParts; - case 347 /* JSDocTypeTag */: - case 353 /* JSDocSatisfiesTag */: + case 350 /* JSDocTypeTag */: + case 356 /* JSDocSatisfiesTag */: return withNode(tag.typeExpression); - case 349 /* JSDocTypedefTag */: - case 341 /* JSDocCallbackTag */: - case 351 /* JSDocPropertyTag */: - case 344 /* JSDocParameterTag */: - case 350 /* JSDocSeeTag */: + case 352 /* JSDocTypedefTag */: + case 344 /* JSDocCallbackTag */: + case 354 /* JSDocPropertyTag */: + case 347 /* JSDocParameterTag */: + case 353 /* JSDocSeeTag */: const { name } = tag; return name ? withNode(name) : comment === void 0 ? void 0 : getDisplayPartsFromComment(comment, checker); default: @@ -155465,14 +162386,14 @@ ${lanes.join("\n")} } function getTagNameDisplayPart(kind) { switch (kind) { - case 344 /* JSDocParameterTag */: + case 347 /* JSDocParameterTag */: return parameterNamePart; - case 351 /* JSDocPropertyTag */: + case 354 /* JSDocPropertyTag */: return propertyNamePart; - case 348 /* JSDocTemplateTag */: + case 351 /* JSDocTemplateTag */: return typeParameterNamePart; - case 349 /* JSDocTypedefTag */: - case 341 /* JSDocCallbackTag */: + case 352 /* JSDocTypedefTag */: + case 344 /* JSDocCallbackTag */: return typeAliasNamePart; default: return textPart; @@ -155584,7 +162505,7 @@ ${lanes.join("\n")} } function parameterDocComments(parameters, isJavaScriptFile, indentationStr, newLine) { return parameters.map(({ name, dotDotDotToken }, i) => { - const paramName = name.kind === 79 /* Identifier */ ? name.text : "param" + i; + const paramName = name.kind === 80 /* Identifier */ ? name.text : "param" + i; const type = isJavaScriptFile ? dotDotDotToken ? "{...any} " : "{any} " : ""; return `${indentationStr} * @param ${type}${paramName}${newLine}`; }).join(""); @@ -155597,46 +162518,46 @@ ${lanes.join("\n")} } function getCommentOwnerInfoWorker(commentOwner, options) { switch (commentOwner.kind) { - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 171 /* MethodDeclaration */: - case 173 /* Constructor */: - case 170 /* MethodSignature */: - case 216 /* ArrowFunction */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 173 /* MethodDeclaration */: + case 175 /* Constructor */: + case 172 /* MethodSignature */: + case 218 /* ArrowFunction */: const host = commentOwner; return { commentOwner, parameters: host.parameters, hasReturn: hasReturn(host, options) }; - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: return getCommentOwnerInfoWorker(commentOwner.initializer, options); - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: - case 263 /* EnumDeclaration */: - case 302 /* EnumMember */: - case 262 /* TypeAliasDeclaration */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: + case 265 /* EnumDeclaration */: + case 305 /* EnumMember */: + case 264 /* TypeAliasDeclaration */: return { commentOwner }; - case 168 /* PropertySignature */: { + case 170 /* PropertySignature */: { const host2 = commentOwner; return host2.type && isFunctionTypeNode(host2.type) ? { commentOwner, parameters: host2.type.parameters, hasReturn: hasReturn(host2.type, options) } : { commentOwner }; } - case 240 /* VariableStatement */: { + case 242 /* VariableStatement */: { const varStatement = commentOwner; const varDeclarations = varStatement.declarationList.declarations; const host2 = varDeclarations.length === 1 && varDeclarations[0].initializer ? getRightHandSideOfAssignment(varDeclarations[0].initializer) : void 0; return host2 ? { commentOwner, parameters: host2.parameters, hasReturn: hasReturn(host2, options) } : { commentOwner }; } - case 308 /* SourceFile */: + case 311 /* SourceFile */: return "quit"; - case 264 /* ModuleDeclaration */: - return commentOwner.parent.kind === 264 /* ModuleDeclaration */ ? void 0 : { commentOwner }; - case 241 /* ExpressionStatement */: + case 266 /* ModuleDeclaration */: + return commentOwner.parent.kind === 266 /* ModuleDeclaration */ ? void 0 : { commentOwner }; + case 243 /* ExpressionStatement */: return getCommentOwnerInfoWorker(commentOwner.expression, options); - case 223 /* BinaryExpression */: { + case 225 /* BinaryExpression */: { const be = commentOwner; if (getAssignmentDeclarationKind(be) === 0 /* None */) { return "quit"; } return isFunctionLike(be.right) ? { commentOwner, parameters: be.right.parameters, hasReturn: hasReturn(be.right, options) } : { commentOwner }; } - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: const init = commentOwner.initializer; if (init && (isFunctionExpression(init) || isArrowFunction(init))) { return { commentOwner, parameters: init.parameters, hasReturn: hasReturn(init, options) }; @@ -155647,14 +162568,14 @@ ${lanes.join("\n")} return !!(options == null ? void 0 : options.generateReturnInDocTemplate) && (isFunctionTypeNode(node) || isArrowFunction(node) && isExpression(node.body) || isFunctionLikeDeclaration(node) && node.body && isBlock(node.body) && !!forEachReturnStatement(node.body, (n) => n)); } function getRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 214 /* ParenthesizedExpression */) { + while (rightHandSide.kind === 216 /* ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: return rightHandSide; - case 228 /* ClassExpression */: + case 230 /* ClassExpression */: return find(rightHandSide.members, isConstructorDeclaration); } } @@ -155778,7 +162699,7 @@ ${lanes.join("\n")} const shouldSort = mode === "SortAndCombine" /* SortAndCombine */ || mode === "All" /* All */; const shouldCombine = shouldSort; const shouldRemove = mode === "RemoveUnused" /* RemoveUnused */ || mode === "All" /* All */; - const topLevelImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration)); + const topLevelImportGroupDecls = groupByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration)); const comparer = getOrganizeImportsComparerWithDetection(preferences, shouldSort ? () => detectSortingWorker(topLevelImportGroupDecls, preferences) === 2 /* CaseInsensitive */ : void 0); const processImportsOfSameModuleSpecifier = (importGroup) => { if (shouldRemove) @@ -155791,13 +162712,12 @@ ${lanes.join("\n")} }; topLevelImportGroupDecls.forEach((importGroupDecl) => organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier)); if (mode !== "RemoveUnused" /* RemoveUnused */) { - const topLevelExportDecls = sourceFile.statements.filter(isExportDeclaration); - organizeImportsWorker(topLevelExportDecls, (group2) => coalesceExportsWorker(group2, comparer)); + getTopLevelExportGroups(sourceFile).forEach((exportGroupDecl) => organizeImportsWorker(exportGroupDecl, (group2) => coalesceExportsWorker(group2, comparer))); } for (const ambientModule of sourceFile.statements.filter(isAmbientModule)) { if (!ambientModule.body) continue; - const ambientModuleImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(isImportDeclaration)); + const ambientModuleImportGroupDecls = groupByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(isImportDeclaration)); ambientModuleImportGroupDecls.forEach((importGroupDecl) => organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier)); if (mode !== "RemoveUnused" /* RemoveUnused */) { const ambientModuleExportDecls = ambientModule.body.statements.filter(isExportDeclaration); @@ -155812,7 +162732,7 @@ ${lanes.join("\n")} suppressLeadingTrivia(oldImportDecls[0]); const oldImportGroups = shouldCombine ? group(oldImportDecls, (importDecl) => getExternalModuleName2(importDecl.moduleSpecifier)) : [oldImportDecls]; const sortedImportGroups = shouldSort ? stableSort(oldImportGroups, (group1, group2) => compareModuleSpecifiersWorker(group1[0].moduleSpecifier, group2[0].moduleSpecifier, comparer)) : oldImportGroups; - const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) ? coalesce(importGroup) : importGroup); + const newImportDecls = flatMap(sortedImportGroups, (importGroup) => getExternalModuleName2(importGroup[0].moduleSpecifier) || importGroup[0].moduleSpecifier === void 0 ? coalesce(importGroup) : importGroup); if (newImportDecls.length === 0) { changeTracker.deleteNodes( sourceFile, @@ -155839,32 +162759,32 @@ ${lanes.join("\n")} } } } - function groupImportsByNewlineContiguous(sourceFile, importDecls) { + function groupByNewlineContiguous(sourceFile, decls) { const scanner2 = createScanner( sourceFile.languageVersion, /*skipTrivia*/ false, sourceFile.languageVariant ); - const groupImports = []; + const group2 = []; let groupIndex = 0; - for (const topLevelImportDecl of importDecls) { - if (groupImports[groupIndex] && isNewGroup(sourceFile, topLevelImportDecl, scanner2)) { + for (const decl of decls) { + if (group2[groupIndex] && isNewGroup(sourceFile, decl, scanner2)) { groupIndex++; } - if (!groupImports[groupIndex]) { - groupImports[groupIndex] = []; + if (!group2[groupIndex]) { + group2[groupIndex] = []; } - groupImports[groupIndex].push(topLevelImportDecl); + group2[groupIndex].push(decl); } - return groupImports; + return group2; } - function isNewGroup(sourceFile, topLevelImportDecl, scanner2) { - const startPos = topLevelImportDecl.getFullStart(); - const endPos = topLevelImportDecl.getStart(); + function isNewGroup(sourceFile, decl, scanner2) { + const startPos = decl.getFullStart(); + const endPos = decl.getStart(); scanner2.setText(sourceFile.text, startPos, endPos - startPos); let numberOfNewLines = 0; - while (scanner2.getTokenPos() < endPos) { + while (scanner2.getTokenStart() < endPos) { const tokenKind = scanner2.scan(); if (tokenKind === 4 /* NewLineTrivia */) { numberOfNewLines++; @@ -155969,7 +162889,7 @@ ${lanes.join("\n")} } const firstDefaultImport = firstOrUndefined(defaultImports); const firstNamedImport = firstOrUndefined(namedImports); - const importDecl = firstDefaultImport != null ? firstDefaultImport : firstNamedImport; + const importDecl = firstDefaultImport ?? firstNamedImport; if (!importDecl) { continue; } @@ -156009,7 +162929,7 @@ ${lanes.join("\n")} ); coalescedImports.push( updateImportDeclarationAndClause( - firstNamedImport != null ? firstNamedImport : importDecl, + firstNamedImport ?? importDecl, /*name*/ void 0, newNamedImports @@ -156127,23 +163047,22 @@ ${lanes.join("\n")} function compareModuleSpecifiersWorker(m1, m2, comparer) { const name1 = m1 === void 0 ? void 0 : getExternalModuleName2(m1); const name2 = m2 === void 0 ? void 0 : getExternalModuleName2(m2); - return compareBooleans(name1 === void 0, name2 === void 0) || compareBooleans(isExternalModuleNameRelative(name1), isExternalModuleNameRelative(name2)) || // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion - comparer(name1, name2); + return compareBooleans(name1 === void 0, name2 === void 0) || compareBooleans(isExternalModuleNameRelative(name1), isExternalModuleNameRelative(name2)) || comparer(name1, name2); } function getModuleSpecifierExpression(declaration) { - var _a2; + var _a; switch (declaration.kind) { - case 268 /* ImportEqualsDeclaration */: - return (_a2 = tryCast(declaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a2.expression; - case 269 /* ImportDeclaration */: + case 270 /* ImportEqualsDeclaration */: + return (_a = tryCast(declaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a.expression; + case 271 /* ImportDeclaration */: return declaration.moduleSpecifier; - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: return declaration.declarationList.declarations[0].initializer.arguments[0]; } } function detectSorting(sourceFile, preferences) { return detectSortingWorker( - groupImportsByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration)), + groupByNewlineContiguous(sourceFile, sourceFile.statements.filter(isImportDeclaration)), preferences ); } @@ -156165,8 +163084,8 @@ ${lanes.join("\n")} const moduleSpecifierSort = detectSortCaseSensitivity( importGroup, (i) => { - var _a2, _b; - return (_b = (_a2 = tryCast(i.moduleSpecifier, isStringLiteral)) == null ? void 0 : _a2.text) != null ? _b : ""; + var _a; + return ((_a = tryCast(i.moduleSpecifier, isStringLiteral)) == null ? void 0 : _a.text) ?? ""; }, collateCaseSensitive, collateCaseInsensitive @@ -156182,8 +163101,8 @@ ${lanes.join("\n")} const declarationWithNamedImports = find( importGroup, (i) => { - var _a2, _b; - return ((_b = tryCast((_a2 = i.importClause) == null ? void 0 : _a2.namedBindings, isNamedImports)) == null ? void 0 : _b.elements.length) > 1; + var _a, _b; + return ((_b = tryCast((_a = i.importClause) == null ? void 0 : _a.namedBindings, isNamedImports)) == null ? void 0 : _b.elements.length) > 1; } ); if (declarationWithNamedImports) { @@ -156235,21 +163154,21 @@ ${lanes.join("\n")} return compareValues(getImportKindOrder(s1), getImportKindOrder(s2)); } function getImportKindOrder(s1) { - var _a2; + var _a; switch (s1.kind) { - case 269 /* ImportDeclaration */: + case 271 /* ImportDeclaration */: if (!s1.importClause) return 0; if (s1.importClause.isTypeOnly) return 1; - if (((_a2 = s1.importClause.namedBindings) == null ? void 0 : _a2.kind) === 271 /* NamespaceImport */) + if (((_a = s1.importClause.namedBindings) == null ? void 0 : _a.kind) === 273 /* NamespaceImport */) return 2; if (s1.importClause.name) return 3; return 4; - case 268 /* ImportEqualsDeclaration */: + case 270 /* ImportEqualsDeclaration */: return 5; - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: return 6; } } @@ -156269,18 +163188,17 @@ ${lanes.join("\n")} ); } function tryGetNamedBindingElements(namedImport) { - var _a2; - return ((_a2 = namedImport.importClause) == null ? void 0 : _a2.namedBindings) && isNamedImports(namedImport.importClause.namedBindings) ? namedImport.importClause.namedBindings.elements : void 0; + var _a; + return ((_a = namedImport.importClause) == null ? void 0 : _a.namedBindings) && isNamedImports(namedImport.importClause.namedBindings) ? namedImport.importClause.namedBindings.elements : void 0; } function getOrganizeImportsOrdinalStringComparer(ignoreCase) { return ignoreCase ? compareStringsCaseInsensitiveEslintCompatible : compareStringsCaseSensitive; } function getOrganizeImportsUnicodeStringComparer(ignoreCase, preferences) { - var _a2, _b, _c; const resolvedLocale = getOrganizeImportsLocale(preferences); - const caseFirst = (_a2 = preferences.organizeImportsCaseFirst) != null ? _a2 : false; - const numeric = (_b = preferences.organizeImportsNumericCollation) != null ? _b : false; - const accents = (_c = preferences.organizeImportsAccentCollation) != null ? _c : true; + const caseFirst = preferences.organizeImportsCaseFirst ?? false; + const numeric = preferences.organizeImportsNumericCollation ?? false; + const accents = preferences.organizeImportsAccentCollation ?? true; const sensitivity = ignoreCase ? accents ? "accent" : "base" : accents ? "variant" : "case"; const collator = new Intl.Collator(resolvedLocale, { usage: "sort", @@ -156301,15 +163219,40 @@ ${lanes.join("\n")} return resolvedLocale; } function getOrganizeImportsComparer(preferences, ignoreCase) { - var _a2; - const collation = (_a2 = preferences.organizeImportsCollation) != null ? _a2 : "ordinal"; + const collation = preferences.organizeImportsCollation ?? "ordinal"; return collation === "unicode" ? getOrganizeImportsUnicodeStringComparer(ignoreCase, preferences) : getOrganizeImportsOrdinalStringComparer(ignoreCase); } function getOrganizeImportsComparerWithDetection(preferences, detectIgnoreCase) { - var _a2; - const ignoreCase = typeof preferences.organizeImportsIgnoreCase === "boolean" ? preferences.organizeImportsIgnoreCase : (_a2 = detectIgnoreCase == null ? void 0 : detectIgnoreCase()) != null ? _a2 : false; + const ignoreCase = typeof preferences.organizeImportsIgnoreCase === "boolean" ? preferences.organizeImportsIgnoreCase : (detectIgnoreCase == null ? void 0 : detectIgnoreCase()) ?? false; return getOrganizeImportsComparer(preferences, ignoreCase); } + function getTopLevelExportGroups(sourceFile) { + const topLevelExportGroups = []; + const statements = sourceFile.statements; + const len = length(statements); + let i = 0; + let groupIndex = 0; + while (i < len) { + if (isExportDeclaration(statements[i])) { + if (topLevelExportGroups[groupIndex] === void 0) { + topLevelExportGroups[groupIndex] = []; + } + const exportDecl = statements[i]; + if (exportDecl.moduleSpecifier) { + topLevelExportGroups[groupIndex].push(exportDecl); + i++; + } else { + while (i < len && isExportDeclaration(statements[i])) { + topLevelExportGroups[groupIndex].push(statements[i++]); + } + groupIndex++; + } + } else { + i++; + } + } + return flatMap(topLevelExportGroups, (exportGroupDecls) => groupByNewlineContiguous(sourceFile, exportGroupDecls)); + } var ImportSpecifierSortingCache, detectImportSpecifierSorting; var init_organizeImports = __esm({ "src/services/organizeImports.ts"() { @@ -156327,12 +163270,11 @@ ${lanes.join("\n")} return this._cache.get(specifiers); } set([specifiers, preferences], value) { - var _a2; if (this._lastPreferences !== preferences) { this._lastPreferences = preferences; this._cache = void 0; } - (_a2 = this._cache) != null ? _a2 : this._cache = /* @__PURE__ */ new WeakMap(); + this._cache ?? (this._cache = /* @__PURE__ */ new WeakMap()); this._cache.set(specifiers, value); } }; @@ -156404,11 +163346,11 @@ ${lanes.join("\n")} } const lastImport = current - 1; if (lastImport !== firstImport) { - out.push(createOutliningSpanFromBounds(findChildOfKind(statements[firstImport], 100 /* ImportKeyword */, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports" /* Imports */)); + out.push(createOutliningSpanFromBounds(findChildOfKind(statements[firstImport], 102 /* ImportKeyword */, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports" /* Imports */)); } } function visitNode3(n2) { - var _a2; + var _a; if (depthRemaining === 0) return; cancellationToken.throwIfCancellationRequested(); @@ -156433,7 +163375,7 @@ ${lanes.join("\n")} visitNode3(n2.expression); depthRemaining--; n2.arguments.forEach(visitNode3); - (_a2 = n2.typeArguments) == null ? void 0 : _a2.forEach(visitNode3); + (_a = n2.typeArguments) == null ? void 0 : _a.forEach(visitNode3); } else if (isIfStatement(n2) && n2.elseStatement && isIfStatement(n2.elseStatement)) { visitNode3(n2.expression); visitNode3(n2.thenStatement); @@ -156534,94 +163476,94 @@ ${lanes.join("\n")} } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 238 /* Block */: + case 240 /* Block */: if (isFunctionLike(n.parent)) { return functionSpan(n.parent, n, sourceFile); } switch (n.parent.kind) { - case 243 /* DoStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: - case 245 /* ForStatement */: - case 242 /* IfStatement */: - case 244 /* WhileStatement */: - case 251 /* WithStatement */: - case 295 /* CatchClause */: + case 245 /* DoStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 247 /* ForStatement */: + case 244 /* IfStatement */: + case 246 /* WhileStatement */: + case 253 /* WithStatement */: + case 298 /* CatchClause */: return spanForNode(n.parent); - case 255 /* TryStatement */: + case 257 /* TryStatement */: const tryStatement = n.parent; if (tryStatement.tryBlock === n) { return spanForNode(n.parent); } else if (tryStatement.finallyBlock === n) { - const node = findChildOfKind(tryStatement, 96 /* FinallyKeyword */, sourceFile); + const node = findChildOfKind(tryStatement, 98 /* FinallyKeyword */, sourceFile); if (node) return spanForNode(node); } default: return createOutliningSpan(createTextSpanFromNode(n, sourceFile), "code" /* Code */); } - case 265 /* ModuleBlock */: + case 267 /* ModuleBlock */: return spanForNode(n.parent); - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 261 /* InterfaceDeclaration */: - case 263 /* EnumDeclaration */: - case 266 /* CaseBlock */: - case 184 /* TypeLiteral */: - case 203 /* ObjectBindingPattern */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 263 /* InterfaceDeclaration */: + case 265 /* EnumDeclaration */: + case 268 /* CaseBlock */: + case 186 /* TypeLiteral */: + case 205 /* ObjectBindingPattern */: return spanForNode(n); - case 186 /* TupleType */: + case 188 /* TupleType */: return spanForNode( n, /*autoCollapse*/ false, /*useFullStart*/ !isTupleTypeNode(n.parent), - 22 /* OpenBracketToken */ + 23 /* OpenBracketToken */ ); - case 292 /* CaseClause */: - case 293 /* DefaultClause */: + case 295 /* CaseClause */: + case 296 /* DefaultClause */: return spanForNodeArray(n.statements); - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return spanForObjectOrArrayLiteral(n); - case 206 /* ArrayLiteralExpression */: - return spanForObjectOrArrayLiteral(n, 22 /* OpenBracketToken */); - case 281 /* JsxElement */: + case 208 /* ArrayLiteralExpression */: + return spanForObjectOrArrayLiteral(n, 23 /* OpenBracketToken */); + case 283 /* JsxElement */: return spanForJSXElement(n); - case 285 /* JsxFragment */: + case 287 /* JsxFragment */: return spanForJSXFragment(n); - case 282 /* JsxSelfClosingElement */: - case 283 /* JsxOpeningElement */: + case 284 /* JsxSelfClosingElement */: + case 285 /* JsxOpeningElement */: return spanForJSXAttributes(n.attributes); - case 225 /* TemplateExpression */: - case 14 /* NoSubstitutionTemplateLiteral */: + case 227 /* TemplateExpression */: + case 15 /* NoSubstitutionTemplateLiteral */: return spanForTemplateLiteral(n); - case 204 /* ArrayBindingPattern */: + case 206 /* ArrayBindingPattern */: return spanForNode( n, /*autoCollapse*/ false, /*useFullStart*/ !isBindingElement(n.parent), - 22 /* OpenBracketToken */ + 23 /* OpenBracketToken */ ); - case 216 /* ArrowFunction */: + case 218 /* ArrowFunction */: return spanForArrowFunction(n); - case 210 /* CallExpression */: + case 212 /* CallExpression */: return spanForCallExpression(n); - case 214 /* ParenthesizedExpression */: + case 216 /* ParenthesizedExpression */: return spanForParenthesizedExpression(n); - case 272 /* NamedImports */: - case 276 /* NamedExports */: - case 296 /* AssertClause */: + case 274 /* NamedImports */: + case 278 /* NamedExports */: + case 299 /* AssertClause */: return spanForNamedImportsOrExportsOrAssertClause(n); } function spanForNamedImportsOrExportsOrAssertClause(node) { if (!node.elements.length) { return void 0; } - const openToken = findChildOfKind(node, 18 /* OpenBraceToken */, sourceFile); - const closeToken = findChildOfKind(node, 19 /* CloseBraceToken */, sourceFile); + const openToken = findChildOfKind(node, 19 /* OpenBraceToken */, sourceFile); + const closeToken = findChildOfKind(node, 20 /* CloseBraceToken */, sourceFile); if (!openToken || !closeToken || positionsAreOnSameLine(openToken.pos, closeToken.pos, sourceFile)) { return void 0; } @@ -156640,8 +163582,8 @@ ${lanes.join("\n")} if (!node.arguments.length) { return void 0; } - const openToken = findChildOfKind(node, 20 /* OpenParenToken */, sourceFile); - const closeToken = findChildOfKind(node, 21 /* CloseParenToken */, sourceFile); + const openToken = findChildOfKind(node, 21 /* OpenParenToken */, sourceFile); + const closeToken = findChildOfKind(node, 22 /* CloseParenToken */, sourceFile); if (!openToken || !closeToken || positionsAreOnSameLine(openToken.pos, closeToken.pos, sourceFile)) { return void 0; } @@ -156695,12 +163637,12 @@ ${lanes.join("\n")} return createOutliningSpanFromBounds(node.getStart(sourceFile), node.getEnd(), "code" /* Code */); } function spanForTemplateLiteral(node) { - if (node.kind === 14 /* NoSubstitutionTemplateLiteral */ && node.text.length === 0) { + if (node.kind === 15 /* NoSubstitutionTemplateLiteral */ && node.text.length === 0) { return void 0; } return createOutliningSpanFromBounds(node.getStart(sourceFile), node.getEnd(), "code" /* Code */); } - function spanForObjectOrArrayLiteral(node, open = 18 /* OpenBraceToken */) { + function spanForObjectOrArrayLiteral(node, open = 19 /* OpenBraceToken */) { return spanForNode( node, /*autoCollapse*/ @@ -156710,7 +163652,7 @@ ${lanes.join("\n")} open ); } - function spanForNode(hintSpanNode, autoCollapse = false, useFullStart = true, open = 18 /* OpenBraceToken */, close = open === 18 /* OpenBraceToken */ ? 19 /* CloseBraceToken */ : 23 /* CloseBracketToken */) { + function spanForNode(hintSpanNode, autoCollapse = false, useFullStart = true, open = 19 /* OpenBraceToken */, close = open === 19 /* OpenBraceToken */ ? 20 /* CloseBraceToken */ : 24 /* CloseBracketToken */) { const openToken = findChildOfKind(n, open, sourceFile); const closeToken = findChildOfKind(n, close, sourceFile); return openToken && closeToken && spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart); @@ -156727,14 +163669,14 @@ ${lanes.join("\n")} } function functionSpan(node, body, sourceFile) { const openToken = tryGetFunctionOpenToken(node, body, sourceFile); - const closeToken = findChildOfKind(body, 19 /* CloseBraceToken */, sourceFile); + const closeToken = findChildOfKind(body, 20 /* CloseBraceToken */, sourceFile); return openToken && closeToken && spanBetweenTokens( openToken, closeToken, node, sourceFile, /*autoCollapse*/ - node.kind !== 216 /* ArrowFunction */ + node.kind !== 218 /* ArrowFunction */ ); } function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse = false, useFullStart = true) { @@ -156746,12 +163688,12 @@ ${lanes.join("\n")} } function tryGetFunctionOpenToken(node, body, sourceFile) { if (isNodeArrayMultiLine(node.parameters, sourceFile)) { - const openParenToken = findChildOfKind(node, 20 /* OpenParenToken */, sourceFile); + const openParenToken = findChildOfKind(node, 21 /* OpenParenToken */, sourceFile); if (openParenToken) { return openParenToken; } } - return findChildOfKind(body, 18 /* OpenBraceToken */, sourceFile); + return findChildOfKind(body, 19 /* OpenBraceToken */, sourceFile); } var regionDelimiterRegExp; var init_outliningElementsCollector = __esm({ @@ -156774,5113 +163716,6 @@ ${lanes.join("\n")} } }); - // src/services/refactorProvider.ts - function registerRefactor(name, refactor) { - refactors.set(name, refactor); - } - function getApplicableRefactors(context) { - return arrayFrom(flatMapIterator(refactors.values(), (refactor) => { - var _a2; - return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a2 = refactor.kinds) == null ? void 0 : _a2.some((kind) => refactorKindBeginsWith(kind, context.kind))) ? void 0 : refactor.getAvailableActions(context); - })); - } - function getEditsForRefactor(context, refactorName13, actionName2) { - const refactor = refactors.get(refactorName13); - return refactor && refactor.getEditsForAction(context, actionName2); - } - var refactors; - var init_refactorProvider = __esm({ - "src/services/refactorProvider.ts"() { - "use strict"; - init_ts4(); - init_ts_refactor(); - refactors = /* @__PURE__ */ new Map(); - } - }); - - // src/services/refactors/convertExport.ts - function getInfo19(context, considerPartialSpans = true) { - const { file, program } = context; - const span = getRefactorContextSpan(context); - const token = getTokenAtPosition(file, span.start); - const exportNode = !!(token.parent && getSyntacticModifierFlags(token.parent) & 1 /* Export */) && considerPartialSpans ? token.parent : getParentNodeInSpan(token, file, span); - if (!exportNode || !isSourceFile(exportNode.parent) && !(isModuleBlock(exportNode.parent) && isAmbientModule(exportNode.parent.parent))) { - return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_export_statement) }; - } - const checker = program.getTypeChecker(); - const exportingModuleSymbol = getExportingModuleSymbol(exportNode.parent, checker); - const flags = getSyntacticModifierFlags(exportNode) || (isExportAssignment(exportNode) && !exportNode.isExportEquals ? 1025 /* ExportDefault */ : 0 /* None */); - const wasDefault = !!(flags & 1024 /* Default */); - if (!(flags & 1 /* Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* Default */)) { - return { error: getLocaleSpecificMessage(Diagnostics.This_file_already_has_a_default_export) }; - } - const noSymbolError = (id) => isIdentifier(id) && checker.getSymbolAtLocation(id) ? void 0 : { error: getLocaleSpecificMessage(Diagnostics.Can_only_convert_named_export) }; - switch (exportNode.kind) { - case 259 /* FunctionDeclaration */: - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: - case 263 /* EnumDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 264 /* ModuleDeclaration */: { - const node = exportNode; - if (!node.name) - return void 0; - return noSymbolError(node.name) || { exportNode: node, exportName: node.name, wasDefault, exportingModuleSymbol }; - } - case 240 /* VariableStatement */: { - const vs = exportNode; - if (!(vs.declarationList.flags & 2 /* Const */) || vs.declarationList.declarations.length !== 1) { - return void 0; - } - const decl = first(vs.declarationList.declarations); - if (!decl.initializer) - return void 0; - Debug.assert(!wasDefault, "Can't have a default flag here"); - return noSymbolError(decl.name) || { exportNode: vs, exportName: decl.name, wasDefault, exportingModuleSymbol }; - } - case 274 /* ExportAssignment */: { - const node = exportNode; - if (node.isExportEquals) - return void 0; - return noSymbolError(node.expression) || { exportNode: node, exportName: node.expression, wasDefault, exportingModuleSymbol }; - } - default: - return void 0; - } - } - function doChange33(exportingSourceFile, program, info, changes, cancellationToken) { - changeExport(exportingSourceFile, info, changes, program.getTypeChecker()); - changeImports(program, info, changes, cancellationToken); - } - function changeExport(exportingSourceFile, { wasDefault, exportNode, exportName }, changes, checker) { - if (wasDefault) { - if (isExportAssignment(exportNode) && !exportNode.isExportEquals) { - const exp = exportNode.expression; - const spec = makeExportSpecifier(exp.text, exp.text); - changes.replaceNode(exportingSourceFile, exportNode, factory.createExportDeclaration( - /*modifiers*/ - void 0, - /*isTypeOnly*/ - false, - factory.createNamedExports([spec]) - )); - } else { - changes.delete(exportingSourceFile, Debug.checkDefined(findModifier(exportNode, 88 /* DefaultKeyword */), "Should find a default keyword in modifier list")); - } - } else { - const exportKeyword = Debug.checkDefined(findModifier(exportNode, 93 /* ExportKeyword */), "Should find an export keyword in modifier list"); - switch (exportNode.kind) { - case 259 /* FunctionDeclaration */: - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: - changes.insertNodeAfter(exportingSourceFile, exportKeyword, factory.createToken(88 /* DefaultKeyword */)); - break; - case 240 /* VariableStatement */: - const decl = first(exportNode.declarationList.declarations); - if (!ts_FindAllReferences_exports.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile) && !decl.type) { - changes.replaceNode(exportingSourceFile, exportNode, factory.createExportDefault(Debug.checkDefined(decl.initializer, "Initializer was previously known to be present"))); - break; - } - case 263 /* EnumDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 264 /* ModuleDeclaration */: - changes.deleteModifier(exportingSourceFile, exportKeyword); - changes.insertNodeAfter(exportingSourceFile, exportNode, factory.createExportDefault(factory.createIdentifier(exportName.text))); - break; - default: - Debug.fail(`Unexpected exportNode kind ${exportNode.kind}`); - } - } - } - function changeImports(program, { wasDefault, exportName, exportingModuleSymbol }, changes, cancellationToken) { - const checker = program.getTypeChecker(); - const exportSymbol = Debug.checkDefined(checker.getSymbolAtLocation(exportName), "Export name should resolve to a symbol"); - ts_FindAllReferences_exports.Core.eachExportReference(program.getSourceFiles(), checker, cancellationToken, exportSymbol, exportingModuleSymbol, exportName.text, wasDefault, (ref) => { - if (exportName === ref) - return; - const importingSourceFile = ref.getSourceFile(); - if (wasDefault) { - changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName.text); - } else { - changeNamedToDefaultImport(importingSourceFile, ref, changes); - } - }); - } - function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) { - const { parent: parent2 } = ref; - switch (parent2.kind) { - case 208 /* PropertyAccessExpression */: - changes.replaceNode(importingSourceFile, ref, factory.createIdentifier(exportName)); - break; - case 273 /* ImportSpecifier */: - case 278 /* ExportSpecifier */: { - const spec = parent2; - changes.replaceNode(importingSourceFile, spec, makeImportSpecifier2(exportName, spec.name.text)); - break; - } - case 270 /* ImportClause */: { - const clause = parent2; - Debug.assert(clause.name === ref, "Import clause name should match provided ref"); - const spec = makeImportSpecifier2(exportName, ref.text); - const { namedBindings } = clause; - if (!namedBindings) { - changes.replaceNode(importingSourceFile, ref, factory.createNamedImports([spec])); - } else if (namedBindings.kind === 271 /* NamespaceImport */) { - changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) }); - const quotePreference = isStringLiteral(clause.parent.moduleSpecifier) ? quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* Double */; - const newImport = makeImport( - /*default*/ - void 0, - [makeImportSpecifier2(exportName, ref.text)], - clause.parent.moduleSpecifier, - quotePreference - ); - changes.insertNodeAfter(importingSourceFile, clause.parent, newImport); - } else { - changes.delete(importingSourceFile, ref); - changes.insertNodeAtEndOfList(importingSourceFile, namedBindings.elements, spec); - } - break; - } - case 202 /* ImportType */: - const importTypeNode = parent2; - changes.replaceNode(importingSourceFile, parent2, factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); - break; - default: - Debug.failBadSyntaxKind(parent2); - } - } - function changeNamedToDefaultImport(importingSourceFile, ref, changes) { - const parent2 = ref.parent; - switch (parent2.kind) { - case 208 /* PropertyAccessExpression */: - changes.replaceNode(importingSourceFile, ref, factory.createIdentifier("default")); - break; - case 273 /* ImportSpecifier */: { - const defaultImport = factory.createIdentifier(parent2.name.text); - if (parent2.parent.elements.length === 1) { - changes.replaceNode(importingSourceFile, parent2.parent, defaultImport); - } else { - changes.delete(importingSourceFile, parent2); - changes.insertNodeBefore(importingSourceFile, parent2.parent, defaultImport); - } - break; - } - case 278 /* ExportSpecifier */: { - changes.replaceNode(importingSourceFile, parent2, makeExportSpecifier("default", parent2.name.text)); - break; - } - default: - Debug.assertNever(parent2, `Unexpected parent kind ${parent2.kind}`); - } - } - function makeImportSpecifier2(propertyName, name) { - return factory.createImportSpecifier( - /*isTypeOnly*/ - false, - propertyName === name ? void 0 : factory.createIdentifier(propertyName), - factory.createIdentifier(name) - ); - } - function makeExportSpecifier(propertyName, name) { - return factory.createExportSpecifier( - /*isTypeOnly*/ - false, - propertyName === name ? void 0 : factory.createIdentifier(propertyName), - factory.createIdentifier(name) - ); - } - function getExportingModuleSymbol(parent2, checker) { - if (isSourceFile(parent2)) { - return parent2.symbol; - } - const symbol = parent2.parent.symbol; - if (symbol.valueDeclaration && isExternalModuleAugmentation(symbol.valueDeclaration)) { - return checker.getMergedSymbol(symbol); - } - return symbol; - } - var refactorName, defaultToNamedAction, namedToDefaultAction; - var init_convertExport = __esm({ - "src/services/refactors/convertExport.ts"() { - "use strict"; - init_ts4(); - init_ts_refactor(); - refactorName = "Convert export"; - defaultToNamedAction = { - name: "Convert default export to named export", - description: Diagnostics.Convert_default_export_to_named_export.message, - kind: "refactor.rewrite.export.named" - }; - namedToDefaultAction = { - name: "Convert named export to default export", - description: Diagnostics.Convert_named_export_to_default_export.message, - kind: "refactor.rewrite.export.default" - }; - registerRefactor(refactorName, { - kinds: [ - defaultToNamedAction.kind, - namedToDefaultAction.kind - ], - getAvailableActions: function getRefactorActionsToConvertBetweenNamedAndDefaultExports(context) { - const info = getInfo19(context, context.triggerReason === "invoked"); - if (!info) - return emptyArray; - if (!isRefactorErrorInfo(info)) { - const action = info.wasDefault ? defaultToNamedAction : namedToDefaultAction; - return [{ name: refactorName, description: action.description, actions: [action] }]; - } - if (context.preferences.provideRefactorNotApplicableReason) { - return [ - { name: refactorName, description: Diagnostics.Convert_default_export_to_named_export.message, actions: [ - { ...defaultToNamedAction, notApplicableReason: info.error }, - { ...namedToDefaultAction, notApplicableReason: info.error } - ] } - ]; - } - return emptyArray; - }, - getEditsForAction: function getRefactorEditsToConvertBetweenNamedAndDefaultExports(context, actionName2) { - Debug.assert(actionName2 === defaultToNamedAction.name || actionName2 === namedToDefaultAction.name, "Unexpected action name"); - const info = getInfo19(context); - Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(context.file, context.program, info, t, context.cancellationToken)); - return { edits, renameFilename: void 0, renameLocation: void 0 }; - } - }); - } - }); - - // src/services/refactors/convertImport.ts - function getImportConversionInfo(context, considerPartialSpans = true) { - const { file } = context; - const span = getRefactorContextSpan(context); - const token = getTokenAtPosition(file, span.start); - const importDecl = considerPartialSpans ? findAncestor(token, isImportDeclaration) : getParentNodeInSpan(token, file, span); - if (!importDecl || !isImportDeclaration(importDecl)) - return { error: "Selection is not an import declaration." }; - const end = span.start + span.length; - const nextToken = findNextToken(importDecl, importDecl.parent, file); - if (nextToken && end > nextToken.getStart()) - return void 0; - const { importClause } = importDecl; - if (!importClause) { - return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_import_clause) }; - } - if (!importClause.namedBindings) { - return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_namespace_import_or_named_imports) }; - } - if (importClause.namedBindings.kind === 271 /* NamespaceImport */) { - return { convertTo: 0 /* Named */, import: importClause.namedBindings }; - } - const shouldUseDefault = getShouldUseDefault(context.program, importClause); - return shouldUseDefault ? { convertTo: 1 /* Default */, import: importClause.namedBindings } : { convertTo: 2 /* Namespace */, import: importClause.namedBindings }; - } - function getShouldUseDefault(program, importClause) { - return getAllowSyntheticDefaultImports(program.getCompilerOptions()) && isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker()); - } - function doChange34(sourceFile, program, changes, info) { - const checker = program.getTypeChecker(); - if (info.convertTo === 0 /* Named */) { - doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, getAllowSyntheticDefaultImports(program.getCompilerOptions())); - } else { - doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, info.import, info.convertTo === 1 /* Default */); - } - } - function doChangeNamespaceToNamed(sourceFile, checker, changes, toConvert, allowSyntheticDefaultImports) { - let usedAsNamespaceOrDefault = false; - const nodesToReplace = []; - const conflictingNames = /* @__PURE__ */ new Map(); - ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(toConvert.name, checker, sourceFile, (id) => { - if (!isPropertyAccessOrQualifiedName(id.parent)) { - usedAsNamespaceOrDefault = true; - } else { - const exportName = getRightOfPropertyAccessOrQualifiedName(id.parent).text; - if (checker.resolveName( - exportName, - id, - 67108863 /* All */, - /*excludeGlobals*/ - true - )) { - conflictingNames.set(exportName, true); - } - Debug.assert(getLeftOfPropertyAccessOrQualifiedName(id.parent) === id, "Parent expression should match id"); - nodesToReplace.push(id.parent); - } - }); - const exportNameToImportName = /* @__PURE__ */ new Map(); - for (const propertyAccessOrQualifiedName of nodesToReplace) { - const exportName = getRightOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName).text; - let importName = exportNameToImportName.get(exportName); - if (importName === void 0) { - exportNameToImportName.set(exportName, importName = conflictingNames.has(exportName) ? getUniqueName(exportName, sourceFile) : exportName); - } - changes.replaceNode(sourceFile, propertyAccessOrQualifiedName, factory.createIdentifier(importName)); - } - const importSpecifiers = []; - exportNameToImportName.forEach((name, propertyName) => { - importSpecifiers.push(factory.createImportSpecifier( - /*isTypeOnly*/ - false, - name === propertyName ? void 0 : factory.createIdentifier(propertyName), - factory.createIdentifier(name) - )); - }); - const importDecl = toConvert.parent.parent; - if (usedAsNamespaceOrDefault && !allowSyntheticDefaultImports) { - changes.insertNodeAfter(sourceFile, importDecl, updateImport( - importDecl, - /*defaultImportName*/ - void 0, - importSpecifiers - )); - } else { - changes.replaceNode(sourceFile, importDecl, updateImport(importDecl, usedAsNamespaceOrDefault ? factory.createIdentifier(toConvert.name.text) : void 0, importSpecifiers)); - } - } - function getRightOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) { - return isPropertyAccessExpression(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.name : propertyAccessOrQualifiedName.right; - } - function getLeftOfPropertyAccessOrQualifiedName(propertyAccessOrQualifiedName) { - return isPropertyAccessExpression(propertyAccessOrQualifiedName) ? propertyAccessOrQualifiedName.expression : propertyAccessOrQualifiedName.left; - } - function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConvert, shouldUseDefault = getShouldUseDefault(program, toConvert.parent)) { - const checker = program.getTypeChecker(); - const importDecl = toConvert.parent.parent; - const { moduleSpecifier } = importDecl; - const toConvertSymbols = /* @__PURE__ */ new Set(); - toConvert.elements.forEach((namedImport) => { - const symbol = checker.getSymbolAtLocation(namedImport.name); - if (symbol) { - toConvertSymbols.add(symbol); - } - }); - const preferredName = moduleSpecifier && isStringLiteral(moduleSpecifier) ? ts_codefix_exports.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 99 /* ESNext */) : "module"; - function hasNamespaceNameConflict(namedImport) { - return !!ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(namedImport.name, checker, sourceFile, (id) => { - const symbol = checker.resolveName( - preferredName, - id, - 67108863 /* All */, - /*excludeGlobals*/ - true - ); - if (symbol) { - if (toConvertSymbols.has(symbol)) { - return isExportSpecifier(id.parent); - } - return true; - } - return false; - }); - } - const namespaceNameConflicts = toConvert.elements.some(hasNamespaceNameConflict); - const namespaceImportName = namespaceNameConflicts ? getUniqueName(preferredName, sourceFile) : preferredName; - const neededNamedImports = /* @__PURE__ */ new Set(); - for (const element of toConvert.elements) { - const propertyName = (element.propertyName || element.name).text; - ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, (id) => { - const access = factory.createPropertyAccessExpression(factory.createIdentifier(namespaceImportName), propertyName); - if (isShorthandPropertyAssignment(id.parent)) { - changes.replaceNode(sourceFile, id.parent, factory.createPropertyAssignment(id.text, access)); - } else if (isExportSpecifier(id.parent)) { - neededNamedImports.add(element); - } else { - changes.replaceNode(sourceFile, id, access); - } - }); - } - changes.replaceNode(sourceFile, toConvert, shouldUseDefault ? factory.createIdentifier(namespaceImportName) : factory.createNamespaceImport(factory.createIdentifier(namespaceImportName))); - if (neededNamedImports.size) { - const newNamedImports = arrayFrom(neededNamedImports.values(), (element) => factory.createImportSpecifier(element.isTypeOnly, element.propertyName && factory.createIdentifier(element.propertyName.text), factory.createIdentifier(element.name.text))); - changes.insertNodeAfter(sourceFile, toConvert.parent.parent, updateImport( - importDecl, - /*defaultImportName*/ - void 0, - newNamedImports - )); - } - } - function isExportEqualsModule(moduleSpecifier, checker) { - const externalModule = checker.resolveExternalModuleName(moduleSpecifier); - if (!externalModule) - return false; - const exportEquals = checker.resolveExternalModuleSymbol(externalModule); - return externalModule !== exportEquals; - } - function updateImport(old, defaultImportName, elements) { - return factory.createImportDeclaration( - /*modifiers*/ - void 0, - factory.createImportClause( - /*isTypeOnly*/ - false, - defaultImportName, - elements && elements.length ? factory.createNamedImports(elements) : void 0 - ), - old.moduleSpecifier, - /*assertClause*/ - void 0 - ); - } - var refactorName2, actions; - var init_convertImport = __esm({ - "src/services/refactors/convertImport.ts"() { - "use strict"; - init_ts4(); - init_ts_refactor(); - refactorName2 = "Convert import"; - actions = { - [0 /* Named */]: { - name: "Convert namespace import to named imports", - description: Diagnostics.Convert_namespace_import_to_named_imports.message, - kind: "refactor.rewrite.import.named" - }, - [2 /* Namespace */]: { - name: "Convert named imports to namespace import", - description: Diagnostics.Convert_named_imports_to_namespace_import.message, - kind: "refactor.rewrite.import.namespace" - }, - [1 /* Default */]: { - name: "Convert named imports to default import", - description: Diagnostics.Convert_named_imports_to_default_import.message, - kind: "refactor.rewrite.import.default" - } - }; - registerRefactor(refactorName2, { - kinds: getOwnValues(actions).map((a) => a.kind), - getAvailableActions: function getRefactorActionsToConvertBetweenNamedAndNamespacedImports(context) { - const info = getImportConversionInfo(context, context.triggerReason === "invoked"); - if (!info) - return emptyArray; - if (!isRefactorErrorInfo(info)) { - const action = actions[info.convertTo]; - return [{ name: refactorName2, description: action.description, actions: [action] }]; - } - if (context.preferences.provideRefactorNotApplicableReason) { - return getOwnValues(actions).map((action) => ({ - name: refactorName2, - description: action.description, - actions: [{ ...action, notApplicableReason: info.error }] - })); - } - return emptyArray; - }, - getEditsForAction: function getRefactorEditsToConvertBetweenNamedAndNamespacedImports(context, actionName2) { - Debug.assert(some(getOwnValues(actions), (action) => action.name === actionName2), "Unexpected action name"); - const info = getImportConversionInfo(context); - Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(context.file, context.program, t, info)); - return { edits, renameFilename: void 0, renameLocation: void 0 }; - } - }); - } - }); - - // src/services/refactors/extractType.ts - function getRangeToExtract(context, considerEmptySpans = true) { - const { file, startPosition } = context; - const isJS = isSourceFileJS(file); - const current = getTokenAtPosition(file, startPosition); - const range = createTextRangeFromSpan(getRefactorContextSpan(context)); - const cursorRequest = range.pos === range.end && considerEmptySpans; - const selection = findAncestor(current, (node) => node.parent && isTypeNode(node) && !rangeContainsSkipTrivia(range, node.parent, file) && (cursorRequest || nodeOverlapsWithStartEnd(current, file, range.pos, range.end))); - if (!selection || !isTypeNode(selection)) - return { error: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_type_node) }; - const checker = context.program.getTypeChecker(); - const enclosingNode = getEnclosingNode(selection, isJS); - if (enclosingNode === void 0) - return { error: getLocaleSpecificMessage(Diagnostics.No_type_could_be_extracted_from_this_type_node) }; - const typeParameters = collectTypeParameters(checker, selection, enclosingNode, file); - if (!typeParameters) - return { error: getLocaleSpecificMessage(Diagnostics.No_type_could_be_extracted_from_this_type_node) }; - const typeElements = flattenTypeLiteralNodeReference(checker, selection); - return { isJS, selection, enclosingNode, typeParameters, typeElements }; - } - function flattenTypeLiteralNodeReference(checker, node) { - if (!node) - return void 0; - if (isIntersectionTypeNode(node)) { - const result = []; - const seen = /* @__PURE__ */ new Map(); - for (const type of node.types) { - const flattenedTypeMembers = flattenTypeLiteralNodeReference(checker, type); - if (!flattenedTypeMembers || !flattenedTypeMembers.every((type2) => type2.name && addToSeen(seen, getNameFromPropertyName(type2.name)))) { - return void 0; - } - addRange(result, flattenedTypeMembers); - } - return result; - } else if (isParenthesizedTypeNode(node)) { - return flattenTypeLiteralNodeReference(checker, node.type); - } else if (isTypeLiteralNode(node)) { - return node.members; - } - return void 0; - } - function rangeContainsSkipTrivia(r1, node, file) { - return rangeContainsStartEnd(r1, skipTrivia(file.text, node.pos), node.end); - } - function collectTypeParameters(checker, selection, enclosingNode, file) { - const result = []; - return visitor(selection) ? void 0 : result; - function visitor(node) { - if (isTypeReferenceNode(node)) { - if (isIdentifier(node.typeName)) { - const typeName = node.typeName; - const symbol = checker.resolveName( - typeName.text, - typeName, - 262144 /* TypeParameter */, - /* excludeGlobals */ - true - ); - for (const decl of (symbol == null ? void 0 : symbol.declarations) || emptyArray) { - if (isTypeParameterDeclaration(decl) && decl.getSourceFile() === file) { - if (decl.name.escapedText === typeName.escapedText && rangeContainsSkipTrivia(decl, selection, file)) { - return true; - } - if (rangeContainsSkipTrivia(enclosingNode, decl, file) && !rangeContainsSkipTrivia(selection, decl, file)) { - pushIfUnique(result, decl); - break; - } - } - } - } - } else if (isInferTypeNode(node)) { - const conditionalTypeNode = findAncestor(node, (n) => isConditionalTypeNode(n) && rangeContainsSkipTrivia(n.extendsType, node, file)); - if (!conditionalTypeNode || !rangeContainsSkipTrivia(selection, conditionalTypeNode, file)) { - return true; - } - } else if (isTypePredicateNode(node) || isThisTypeNode(node)) { - const functionLikeNode = findAncestor(node.parent, isFunctionLike); - if (functionLikeNode && functionLikeNode.type && rangeContainsSkipTrivia(functionLikeNode.type, node, file) && !rangeContainsSkipTrivia(selection, functionLikeNode, file)) { - return true; - } - } else if (isTypeQueryNode(node)) { - if (isIdentifier(node.exprName)) { - const symbol = checker.resolveName( - node.exprName.text, - node.exprName, - 111551 /* Value */, - /* excludeGlobals */ - false - ); - if ((symbol == null ? void 0 : symbol.valueDeclaration) && rangeContainsSkipTrivia(enclosingNode, symbol.valueDeclaration, file) && !rangeContainsSkipTrivia(selection, symbol.valueDeclaration, file)) { - return true; - } - } else { - if (isThisIdentifier(node.exprName.left) && !rangeContainsSkipTrivia(selection, node.parent, file)) { - return true; - } - } - } - if (file && isTupleTypeNode(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) { - setEmitFlags(node, 1 /* SingleLine */); - } - return forEachChild(node, visitor); - } - } - function doTypeAliasChange(changes, file, name, info) { - const { enclosingNode, selection, typeParameters } = info; - const newTypeNode = factory.createTypeAliasDeclaration( - /* modifiers */ - void 0, - name, - typeParameters.map((id) => factory.updateTypeParameterDeclaration( - id, - id.modifiers, - id.name, - id.constraint, - /* defaultType */ - void 0 - )), - selection - ); - changes.insertNodeBefore( - file, - enclosingNode, - ignoreSourceNewlines(newTypeNode), - /* blankLineBetween */ - true - ); - changes.replaceNode(file, selection, factory.createTypeReferenceNode(name, typeParameters.map((id) => factory.createTypeReferenceNode( - id.name, - /* typeArguments */ - void 0 - ))), { leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.Exclude, trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.ExcludeWhitespace }); - } - function doInterfaceChange(changes, file, name, info) { - var _a2; - const { enclosingNode, selection, typeParameters, typeElements } = info; - const newTypeNode = factory.createInterfaceDeclaration( - /* modifiers */ - void 0, - name, - typeParameters, - /* heritageClauses */ - void 0, - typeElements - ); - setTextRange(newTypeNode, (_a2 = typeElements[0]) == null ? void 0 : _a2.parent); - changes.insertNodeBefore( - file, - enclosingNode, - ignoreSourceNewlines(newTypeNode), - /* blankLineBetween */ - true - ); - changes.replaceNode(file, selection, factory.createTypeReferenceNode(name, typeParameters.map((id) => factory.createTypeReferenceNode( - id.name, - /* typeArguments */ - void 0 - ))), { leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.Exclude, trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.ExcludeWhitespace }); - } - function doTypedefChange(changes, context, file, name, info) { - var _a2; - const { enclosingNode, selection, typeParameters } = info; - setEmitFlags(selection, 3072 /* NoComments */ | 4096 /* NoNestedComments */); - const node = factory.createJSDocTypedefTag( - factory.createIdentifier("typedef"), - factory.createJSDocTypeExpression(selection), - factory.createIdentifier(name) - ); - const templates = []; - forEach(typeParameters, (typeParameter) => { - const constraint = getEffectiveConstraintOfTypeParameter(typeParameter); - const parameter = factory.createTypeParameterDeclaration( - /*modifiers*/ - void 0, - typeParameter.name - ); - const template = factory.createJSDocTemplateTag( - factory.createIdentifier("template"), - constraint && cast(constraint, isJSDocTypeExpression), - [parameter] - ); - templates.push(template); - }); - const jsDoc = factory.createJSDocComment( - /* comment */ - void 0, - factory.createNodeArray(concatenate(templates, [node])) - ); - if (isJSDoc(enclosingNode)) { - const pos = enclosingNode.getStart(file); - const newLineCharacter = getNewLineOrDefaultFromHost(context.host, (_a2 = context.formatContext) == null ? void 0 : _a2.options); - changes.insertNodeAt(file, enclosingNode.getStart(file), jsDoc, { - suffix: newLineCharacter + newLineCharacter + file.text.slice(getPrecedingNonSpaceCharacterPosition(file.text, pos - 1), pos) - }); - } else { - changes.insertNodeBefore( - file, - enclosingNode, - jsDoc, - /* blankLineBetween */ - true - ); - } - changes.replaceNode(file, selection, factory.createTypeReferenceNode(name, typeParameters.map((id) => factory.createTypeReferenceNode( - id.name, - /* typeArguments */ - void 0 - )))); - } - function getEnclosingNode(node, isJS) { - return findAncestor(node, isStatement) || (isJS ? findAncestor(node, isJSDoc) : void 0); - } - var refactorName3, extractToTypeAliasAction, extractToInterfaceAction, extractToTypeDefAction; - var init_extractType = __esm({ - "src/services/refactors/extractType.ts"() { - "use strict"; - init_ts4(); - init_ts_refactor(); - refactorName3 = "Extract type"; - extractToTypeAliasAction = { - name: "Extract to type alias", - description: getLocaleSpecificMessage(Diagnostics.Extract_to_type_alias), - kind: "refactor.extract.type" - }; - extractToInterfaceAction = { - name: "Extract to interface", - description: getLocaleSpecificMessage(Diagnostics.Extract_to_interface), - kind: "refactor.extract.interface" - }; - extractToTypeDefAction = { - name: "Extract to typedef", - description: getLocaleSpecificMessage(Diagnostics.Extract_to_typedef), - kind: "refactor.extract.typedef" - }; - registerRefactor(refactorName3, { - kinds: [ - extractToTypeAliasAction.kind, - extractToInterfaceAction.kind, - extractToTypeDefAction.kind - ], - getAvailableActions: function getRefactorActionsToExtractType(context) { - const info = getRangeToExtract(context, context.triggerReason === "invoked"); - if (!info) - return emptyArray; - if (!isRefactorErrorInfo(info)) { - return [{ - name: refactorName3, - description: getLocaleSpecificMessage(Diagnostics.Extract_type), - actions: info.isJS ? [extractToTypeDefAction] : append([extractToTypeAliasAction], info.typeElements && extractToInterfaceAction) - }]; - } - if (context.preferences.provideRefactorNotApplicableReason) { - return [{ - name: refactorName3, - description: getLocaleSpecificMessage(Diagnostics.Extract_type), - actions: [ - { ...extractToTypeDefAction, notApplicableReason: info.error }, - { ...extractToTypeAliasAction, notApplicableReason: info.error }, - { ...extractToInterfaceAction, notApplicableReason: info.error } - ] - }]; - } - return emptyArray; - }, - getEditsForAction: function getRefactorEditsToExtractType(context, actionName2) { - const { file } = context; - const info = getRangeToExtract(context); - Debug.assert(info && !isRefactorErrorInfo(info), "Expected to find a range to extract"); - const name = getUniqueName("NewType", file); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (changes) => { - switch (actionName2) { - case extractToTypeAliasAction.name: - Debug.assert(!info.isJS, "Invalid actionName/JS combo"); - return doTypeAliasChange(changes, file, name, info); - case extractToTypeDefAction.name: - Debug.assert(info.isJS, "Invalid actionName/JS combo"); - return doTypedefChange(changes, context, file, name, info); - case extractToInterfaceAction.name: - Debug.assert(!info.isJS && !!info.typeElements, "Invalid actionName/JS combo"); - return doInterfaceChange(changes, file, name, info); - default: - Debug.fail("Unexpected action name"); - } - }); - const renameFilename = file.fileName; - const renameLocation = getRenameLocation( - edits, - renameFilename, - name, - /*preferLastLocation*/ - false - ); - return { edits, renameFilename, renameLocation }; - } - }); - } - }); - - // src/services/refactors/helpers.ts - function isRefactorErrorInfo(info) { - return info.error !== void 0; - } - function refactorKindBeginsWith(known, requested) { - if (!requested) - return true; - return known.substr(0, requested.length) === requested; - } - var init_helpers2 = __esm({ - "src/services/refactors/helpers.ts"() { - "use strict"; - } - }); - - // src/services/refactors/moveToNewFile.ts - function getRangeToMove(context) { - const { file } = context; - const range = createTextRangeFromSpan(getRefactorContextSpan(context)); - const { statements } = file; - const startNodeIndex = findIndex(statements, (s) => s.end > range.pos); - if (startNodeIndex === -1) - return void 0; - const startStatement = statements[startNodeIndex]; - if (isNamedDeclaration(startStatement) && startStatement.name && rangeContainsRange(startStatement.name, range)) { - return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] }; - } - if (range.pos > startStatement.getStart(file)) - return void 0; - const afterEndNodeIndex = findIndex(statements, (s) => s.end > range.end, startNodeIndex); - if (afterEndNodeIndex !== -1 && (afterEndNodeIndex === 0 || statements[afterEndNodeIndex].getStart(file) < range.end)) - return void 0; - return { - toMove: statements.slice(startNodeIndex, afterEndNodeIndex === -1 ? statements.length : afterEndNodeIndex), - afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex] - }; - } - function doChange35(oldFile, program, toMove, changes, host, preferences) { - const checker = program.getTypeChecker(); - const usage = getUsageInfo(oldFile, toMove.all, checker); - const currentDirectory = getDirectoryPath(oldFile.fileName); - const extension = extensionFromPath(oldFile.fileName); - const newFilename = combinePaths( - // new file is always placed in the same directory as the old file - currentDirectory, - // ensures the filename computed below isn't already taken - makeUniqueFilename( - // infers a name for the new file from the symbols being moved - inferNewFilename(usage.oldFileImportsFromNewFile, usage.movedSymbols), - extension, - currentDirectory, - host - ) - ) + extension; - changes.createNewFile(oldFile, newFilename, getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, host, newFilename, preferences)); - addNewFileToTsconfig(program, changes, oldFile.fileName, newFilename, hostGetCanonicalFileName(host)); - } - function getStatementsToMove(context) { - const rangeToMove = getRangeToMove(context); - if (rangeToMove === void 0) - return void 0; - const all = []; - const ranges = []; - const { toMove, afterLast } = rangeToMove; - getRangesWhere(toMove, isAllowedStatementToMove, (start, afterEndIndex) => { - for (let i = start; i < afterEndIndex; i++) - all.push(toMove[i]); - ranges.push({ first: toMove[start], afterLast }); - }); - return all.length === 0 ? void 0 : { all, ranges }; - } - function isAllowedStatementToMove(statement) { - return !isPureImport(statement) && !isPrologueDirective(statement); - } - function isPureImport(node) { - switch (node.kind) { - case 269 /* ImportDeclaration */: - return true; - case 268 /* ImportEqualsDeclaration */: - return !hasSyntacticModifier(node, 1 /* Export */); - case 240 /* VariableStatement */: - return node.declarationList.declarations.every((d) => !!d.initializer && isRequireCall( - d.initializer, - /*checkArgumentIsStringLiteralLike*/ - true - )); - default: - return false; - } - } - function addNewFileToTsconfig(program, changes, oldFileName, newFileNameWithExtension, getCanonicalFileName) { - const cfg = program.getCompilerOptions().configFile; - if (!cfg) - return; - const newFileAbsolutePath = normalizePath(combinePaths(oldFileName, "..", newFileNameWithExtension)); - const newFilePath = getRelativePathFromFile(cfg.fileName, newFileAbsolutePath, getCanonicalFileName); - const cfgObject = cfg.statements[0] && tryCast(cfg.statements[0].expression, isObjectLiteralExpression); - const filesProp = cfgObject && find(cfgObject.properties, (prop) => isPropertyAssignment(prop) && isStringLiteral(prop.name) && prop.name.text === "files"); - if (filesProp && isArrayLiteralExpression(filesProp.initializer)) { - changes.insertNodeInListAfter(cfg, last(filesProp.initializer.elements), factory.createStringLiteral(newFilePath), filesProp.initializer.elements); - } - } - function getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, host, newFilename, preferences) { - const checker = program.getTypeChecker(); - const prologueDirectives = takeWhile(oldFile.statements, isPrologueDirective); - if (oldFile.externalModuleIndicator === void 0 && oldFile.commonJsModuleIndicator === void 0 && usage.oldImportsNeededByNewFile.size() === 0) { - deleteMovedStatements(oldFile, toMove.ranges, changes); - return [...prologueDirectives, ...toMove.all]; - } - const useEsModuleSyntax = !!oldFile.externalModuleIndicator; - const quotePreference = getQuotePreference(oldFile, preferences); - const importsFromNewFile = createOldFileImportsFromNewFile(oldFile, usage.oldFileImportsFromNewFile, newFilename, program, host, useEsModuleSyntax, quotePreference); - if (importsFromNewFile) { - insertImports( - changes, - oldFile, - importsFromNewFile, - /*blankLineBetween*/ - true, - preferences - ); - } - deleteUnusedOldImports(oldFile, toMove.all, changes, usage.unusedImportsFromOldFile, checker); - deleteMovedStatements(oldFile, toMove.ranges, changes); - updateImportsInOtherFiles(changes, program, host, oldFile, usage.movedSymbols, newFilename); - const imports = getNewFileImportsAndAddExportInOldFile(oldFile, usage.oldImportsNeededByNewFile, usage.newFileImportsFromOldFile, changes, checker, program, host, useEsModuleSyntax, quotePreference); - const body = addExports(oldFile, toMove.all, usage.oldFileImportsFromNewFile, useEsModuleSyntax); - if (imports.length && body.length) { - return [ - ...prologueDirectives, - ...imports, - 4 /* NewLineTrivia */, - ...body - ]; - } - return [ - ...prologueDirectives, - ...imports, - ...body - ]; - } - function deleteMovedStatements(sourceFile, moved, changes) { - for (const { first: first2, afterLast } of moved) { - changes.deleteNodeRangeExcludingEnd(sourceFile, first2, afterLast); - } - } - function deleteUnusedOldImports(oldFile, toMove, changes, toDelete, checker) { - for (const statement of oldFile.statements) { - if (contains(toMove, statement)) - continue; - forEachImportInStatement(statement, (i) => deleteUnusedImports(oldFile, i, changes, (name) => toDelete.has(checker.getSymbolAtLocation(name)))); - } - } - function updateImportsInOtherFiles(changes, program, host, oldFile, movedSymbols, newFilename) { - const checker = program.getTypeChecker(); - for (const sourceFile of program.getSourceFiles()) { - if (sourceFile === oldFile) - continue; - for (const statement of sourceFile.statements) { - forEachImportInStatement(statement, (importNode) => { - if (checker.getSymbolAtLocation(moduleSpecifierFromImport(importNode)) !== oldFile.symbol) - return; - const shouldMove = (name) => { - const symbol = isBindingElement(name.parent) ? getPropertySymbolFromBindingElement(checker, name.parent) : skipAlias(checker.getSymbolAtLocation(name), checker); - return !!symbol && movedSymbols.has(symbol); - }; - deleteUnusedImports(sourceFile, importNode, changes, shouldMove); - const pathToNewFileWithExtension = resolvePath(getDirectoryPath(oldFile.path), newFilename); - const newModuleSpecifier = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.path, pathToNewFileWithExtension, createModuleSpecifierResolutionHost(program, host)); - const newImportDeclaration = filterImport(importNode, factory.createStringLiteral(newModuleSpecifier), shouldMove); - if (newImportDeclaration) - changes.insertNodeAfter(sourceFile, statement, newImportDeclaration); - const ns = getNamespaceLikeImport(importNode); - if (ns) - updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleSpecifier, ns, importNode); - }); - } - } - } - function getNamespaceLikeImport(node) { - switch (node.kind) { - case 269 /* ImportDeclaration */: - return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 271 /* NamespaceImport */ ? node.importClause.namedBindings.name : void 0; - case 268 /* ImportEqualsDeclaration */: - return node.name; - case 257 /* VariableDeclaration */: - return tryCast(node.name, isIdentifier); - default: - return Debug.assertNever(node, `Unexpected node kind ${node.kind}`); - } - } - function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleSpecifier, oldImportId, oldImportNode) { - const preferredNewNamespaceName = ts_codefix_exports.moduleSpecifierToValidIdentifier(newModuleSpecifier, 99 /* ESNext */); - let needUniqueName = false; - const toChange = []; - ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, (ref) => { - if (!isPropertyAccessExpression(ref.parent)) - return; - needUniqueName = needUniqueName || !!checker.resolveName( - preferredNewNamespaceName, - ref, - 67108863 /* All */, - /*excludeGlobals*/ - true - ); - if (movedSymbols.has(checker.getSymbolAtLocation(ref.parent.name))) { - toChange.push(ref); - } - }); - if (toChange.length) { - const newNamespaceName = needUniqueName ? getUniqueName(preferredNewNamespaceName, sourceFile) : preferredNewNamespaceName; - for (const ref of toChange) { - changes.replaceNode(sourceFile, ref, factory.createIdentifier(newNamespaceName)); - } - changes.insertNodeAfter(sourceFile, oldImportNode, updateNamespaceLikeImportNode(oldImportNode, preferredNewNamespaceName, newModuleSpecifier)); - } - } - function updateNamespaceLikeImportNode(node, newNamespaceName, newModuleSpecifier) { - const newNamespaceId = factory.createIdentifier(newNamespaceName); - const newModuleString = factory.createStringLiteral(newModuleSpecifier); - switch (node.kind) { - case 269 /* ImportDeclaration */: - return factory.createImportDeclaration( - /*modifiers*/ - void 0, - factory.createImportClause( - /*isTypeOnly*/ - false, - /*name*/ - void 0, - factory.createNamespaceImport(newNamespaceId) - ), - newModuleString, - /*assertClause*/ - void 0 - ); - case 268 /* ImportEqualsDeclaration */: - return factory.createImportEqualsDeclaration( - /*modifiers*/ - void 0, - /*isTypeOnly*/ - false, - newNamespaceId, - factory.createExternalModuleReference(newModuleString) - ); - case 257 /* VariableDeclaration */: - return factory.createVariableDeclaration( - newNamespaceId, - /*exclamationToken*/ - void 0, - /*type*/ - void 0, - createRequireCall(newModuleString) - ); - default: - return Debug.assertNever(node, `Unexpected node kind ${node.kind}`); - } - } - function moduleSpecifierFromImport(i) { - return i.kind === 269 /* ImportDeclaration */ ? i.moduleSpecifier : i.kind === 268 /* ImportEqualsDeclaration */ ? i.moduleReference.expression : i.initializer.arguments[0]; - } - function forEachImportInStatement(statement, cb) { - if (isImportDeclaration(statement)) { - if (isStringLiteral(statement.moduleSpecifier)) - cb(statement); - } else if (isImportEqualsDeclaration(statement)) { - if (isExternalModuleReference(statement.moduleReference) && isStringLiteralLike(statement.moduleReference.expression)) { - cb(statement); - } - } else if (isVariableStatement(statement)) { - for (const decl of statement.declarationList.declarations) { - if (decl.initializer && isRequireCall( - decl.initializer, - /*checkArgumentIsStringLiteralLike*/ - true - )) { - cb(decl); - } - } - } - } - function createOldFileImportsFromNewFile(sourceFile, newFileNeedExport, newFileNameWithExtension, program, host, useEs6Imports, quotePreference) { - let defaultImport; - const imports = []; - newFileNeedExport.forEach((symbol) => { - if (symbol.escapedName === "default" /* Default */) { - defaultImport = factory.createIdentifier(symbolNameNoDefault(symbol)); - } else { - imports.push(symbol.name); - } - }); - return makeImportOrRequire(sourceFile, defaultImport, imports, newFileNameWithExtension, program, host, useEs6Imports, quotePreference); - } - function makeImportOrRequire(sourceFile, defaultImport, imports, newFileNameWithExtension, program, host, useEs6Imports, quotePreference) { - const pathToNewFile = resolvePath(getDirectoryPath(sourceFile.path), newFileNameWithExtension); - const pathToNewFileWithCorrectExtension = getModuleSpecifier(program.getCompilerOptions(), sourceFile, sourceFile.path, pathToNewFile, createModuleSpecifierResolutionHost(program, host)); - if (useEs6Imports) { - const specifiers = imports.map((i) => factory.createImportSpecifier( - /*isTypeOnly*/ - false, - /*propertyName*/ - void 0, - factory.createIdentifier(i) - )); - return makeImportIfNecessary(defaultImport, specifiers, pathToNewFileWithCorrectExtension, quotePreference); - } else { - Debug.assert(!defaultImport, "No default import should exist"); - const bindingElements = imports.map((i) => factory.createBindingElement( - /*dotDotDotToken*/ - void 0, - /*propertyName*/ - void 0, - i - )); - return bindingElements.length ? makeVariableStatement( - factory.createObjectBindingPattern(bindingElements), - /*type*/ - void 0, - createRequireCall(factory.createStringLiteral(pathToNewFileWithCorrectExtension)) - ) : void 0; - } - } - function makeVariableStatement(name, type, initializer, flags = 2 /* Const */) { - return factory.createVariableStatement( - /*modifiers*/ - void 0, - factory.createVariableDeclarationList([factory.createVariableDeclaration( - name, - /*exclamationToken*/ - void 0, - type, - initializer - )], flags) - ); - } - function createRequireCall(moduleSpecifier) { - return factory.createCallExpression( - factory.createIdentifier("require"), - /*typeArguments*/ - void 0, - [moduleSpecifier] - ); - } - function addExports(sourceFile, toMove, needExport, useEs6Exports) { - return flatMap(toMove, (statement) => { - if (isTopLevelDeclarationStatement(statement) && !isExported(sourceFile, statement, useEs6Exports) && forEachTopLevelDeclaration(statement, (d) => { - var _a2; - return needExport.has(Debug.checkDefined((_a2 = tryCast(d, canHaveSymbol)) == null ? void 0 : _a2.symbol)); - })) { - const exports = addExport(statement, useEs6Exports); - if (exports) - return exports; - } - return statement; - }); - } - function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) { - switch (importDecl.kind) { - case 269 /* ImportDeclaration */: - deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); - break; - case 268 /* ImportEqualsDeclaration */: - if (isUnused(importDecl.name)) { - changes.delete(sourceFile, importDecl); - } - break; - case 257 /* VariableDeclaration */: - deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); - break; - default: - Debug.assertNever(importDecl, `Unexpected import decl kind ${importDecl.kind}`); - } - } - function deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused) { - if (!importDecl.importClause) - return; - const { name, namedBindings } = importDecl.importClause; - const defaultUnused = !name || isUnused(name); - const namedBindingsUnused = !namedBindings || (namedBindings.kind === 271 /* NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every((e) => isUnused(e.name))); - if (defaultUnused && namedBindingsUnused) { - changes.delete(sourceFile, importDecl); - } else { - if (name && defaultUnused) { - changes.delete(sourceFile, name); - } - if (namedBindings) { - if (namedBindingsUnused) { - changes.replaceNode( - sourceFile, - importDecl.importClause, - factory.updateImportClause( - importDecl.importClause, - importDecl.importClause.isTypeOnly, - name, - /*namedBindings*/ - void 0 - ) - ); - } else if (namedBindings.kind === 272 /* NamedImports */) { - for (const element of namedBindings.elements) { - if (isUnused(element.name)) - changes.delete(sourceFile, element); - } - } - } - } - } - function deleteUnusedImportsInVariableDeclaration(sourceFile, varDecl, changes, isUnused) { - const { name } = varDecl; - switch (name.kind) { - case 79 /* Identifier */: - if (isUnused(name)) { - if (varDecl.initializer && isRequireCall( - varDecl.initializer, - /*requireStringLiteralLikeArgument*/ - true - )) { - changes.delete( - sourceFile, - isVariableDeclarationList(varDecl.parent) && length(varDecl.parent.declarations) === 1 ? varDecl.parent.parent : varDecl - ); - } else { - changes.delete(sourceFile, name); - } - } - break; - case 204 /* ArrayBindingPattern */: - break; - case 203 /* ObjectBindingPattern */: - if (name.elements.every((e) => isIdentifier(e.name) && isUnused(e.name))) { - changes.delete( - sourceFile, - isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl - ); - } else { - for (const element of name.elements) { - if (isIdentifier(element.name) && isUnused(element.name)) { - changes.delete(sourceFile, element.name); - } - } - } - break; - } - } - function getNewFileImportsAndAddExportInOldFile(oldFile, importsToCopy, newFileImportsFromOldFile, changes, checker, program, host, useEsModuleSyntax, quotePreference) { - const copiedOldImports = []; - for (const oldStatement of oldFile.statements) { - forEachImportInStatement(oldStatement, (i) => { - append(copiedOldImports, filterImport(i, moduleSpecifierFromImport(i), (name) => importsToCopy.has(checker.getSymbolAtLocation(name)))); - }); - } - let oldFileDefault; - const oldFileNamedImports = []; - const markSeenTop = nodeSeenTracker(); - newFileImportsFromOldFile.forEach((symbol) => { - if (!symbol.declarations) { - return; - } - for (const decl of symbol.declarations) { - if (!isTopLevelDeclaration(decl)) - continue; - const name = nameOfTopLevelDeclaration(decl); - if (!name) - continue; - const top = getTopLevelDeclarationStatement(decl); - if (markSeenTop(top)) { - addExportToChanges(oldFile, top, name, changes, useEsModuleSyntax); - } - if (hasSyntacticModifier(decl, 1024 /* Default */)) { - oldFileDefault = name; - } else { - oldFileNamedImports.push(name.text); - } - } - }); - append(copiedOldImports, makeImportOrRequire(oldFile, oldFileDefault, oldFileNamedImports, getBaseFileName(oldFile.fileName), program, host, useEsModuleSyntax, quotePreference)); - return copiedOldImports; - } - function makeUniqueFilename(proposedFilename, extension, inDirectory, host) { - let newFilename = proposedFilename; - for (let i = 1; ; i++) { - const name = combinePaths(inDirectory, newFilename + extension); - if (!host.fileExists(name)) - return newFilename; - newFilename = `${proposedFilename}.${i}`; - } - } - function inferNewFilename(importsFromNewFile, movedSymbols) { - return importsFromNewFile.forEachEntry(symbolNameNoDefault) || movedSymbols.forEachEntry(symbolNameNoDefault) || "newFile"; - } - function getUsageInfo(oldFile, toMove, checker) { - const movedSymbols = new SymbolSet(); - const oldImportsNeededByNewFile = new SymbolSet(); - const newFileImportsFromOldFile = new SymbolSet(); - const containsJsx = find(toMove, (statement) => !!(statement.transformFlags & 2 /* ContainsJsx */)); - const jsxNamespaceSymbol = getJsxNamespaceSymbol(containsJsx); - if (jsxNamespaceSymbol) { - oldImportsNeededByNewFile.add(jsxNamespaceSymbol); - } - for (const statement of toMove) { - forEachTopLevelDeclaration(statement, (decl) => { - movedSymbols.add(Debug.checkDefined(isExpressionStatement(decl) ? checker.getSymbolAtLocation(decl.expression.left) : decl.symbol, "Need a symbol here")); - }); - } - for (const statement of toMove) { - forEachReference(statement, checker, (symbol) => { - if (!symbol.declarations) - return; - for (const decl of symbol.declarations) { - if (isInImport(decl)) { - oldImportsNeededByNewFile.add(symbol); - } else if (isTopLevelDeclaration(decl) && sourceFileOfTopLevelDeclaration(decl) === oldFile && !movedSymbols.has(symbol)) { - newFileImportsFromOldFile.add(symbol); - } - } - }); - } - const unusedImportsFromOldFile = oldImportsNeededByNewFile.clone(); - const oldFileImportsFromNewFile = new SymbolSet(); - for (const statement of oldFile.statements) { - if (contains(toMove, statement)) - continue; - if (jsxNamespaceSymbol && !!(statement.transformFlags & 2 /* ContainsJsx */)) { - unusedImportsFromOldFile.delete(jsxNamespaceSymbol); - } - forEachReference(statement, checker, (symbol) => { - if (movedSymbols.has(symbol)) - oldFileImportsFromNewFile.add(symbol); - unusedImportsFromOldFile.delete(symbol); - }); - } - return { movedSymbols, newFileImportsFromOldFile, oldFileImportsFromNewFile, oldImportsNeededByNewFile, unusedImportsFromOldFile }; - function getJsxNamespaceSymbol(containsJsx2) { - if (containsJsx2 === void 0) { - return void 0; - } - const jsxNamespace = checker.getJsxNamespace(containsJsx2); - const jsxNamespaceSymbol2 = checker.resolveName( - jsxNamespace, - containsJsx2, - 1920 /* Namespace */, - /*excludeGlobals*/ - true - ); - return !!jsxNamespaceSymbol2 && some(jsxNamespaceSymbol2.declarations, isInImport) ? jsxNamespaceSymbol2 : void 0; - } - } - function isInImport(decl) { - switch (decl.kind) { - case 268 /* ImportEqualsDeclaration */: - case 273 /* ImportSpecifier */: - case 270 /* ImportClause */: - case 271 /* NamespaceImport */: - return true; - case 257 /* VariableDeclaration */: - return isVariableDeclarationInImport(decl); - case 205 /* BindingElement */: - return isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); - default: - return false; - } - } - function isVariableDeclarationInImport(decl) { - return isSourceFile(decl.parent.parent.parent) && !!decl.initializer && isRequireCall( - decl.initializer, - /*checkArgumentIsStringLiteralLike*/ - true - ); - } - function filterImport(i, moduleSpecifier, keep) { - switch (i.kind) { - case 269 /* ImportDeclaration */: { - const clause = i.importClause; - if (!clause) - return void 0; - const defaultImport = clause.name && keep(clause.name) ? clause.name : void 0; - const namedBindings = clause.namedBindings && filterNamedBindings(clause.namedBindings, keep); - return defaultImport || namedBindings ? factory.createImportDeclaration( - /*modifiers*/ - void 0, - factory.createImportClause(clause.isTypeOnly, defaultImport, namedBindings), - moduleSpecifier, - /*assertClause*/ - void 0 - ) : void 0; - } - case 268 /* ImportEqualsDeclaration */: - return keep(i.name) ? i : void 0; - case 257 /* VariableDeclaration */: { - const name = filterBindingName(i.name, keep); - return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : void 0; - } - default: - return Debug.assertNever(i, `Unexpected import kind ${i.kind}`); - } - } - function filterNamedBindings(namedBindings, keep) { - if (namedBindings.kind === 271 /* NamespaceImport */) { - return keep(namedBindings.name) ? namedBindings : void 0; - } else { - const newElements = namedBindings.elements.filter((e) => keep(e.name)); - return newElements.length ? factory.createNamedImports(newElements) : void 0; - } - } - function filterBindingName(name, keep) { - switch (name.kind) { - case 79 /* Identifier */: - return keep(name) ? name : void 0; - case 204 /* ArrayBindingPattern */: - return name; - case 203 /* ObjectBindingPattern */: { - const newElements = name.elements.filter((prop) => prop.propertyName || !isIdentifier(prop.name) || keep(prop.name)); - return newElements.length ? factory.createObjectBindingPattern(newElements) : void 0; - } - } - } - function forEachReference(node, checker, onReference) { - node.forEachChild(function cb(node2) { - if (isIdentifier(node2) && !isDeclarationName(node2)) { - const sym = checker.getSymbolAtLocation(node2); - if (sym) - onReference(sym); - } else { - node2.forEachChild(cb); - } - }); - } - function isTopLevelDeclaration(node) { - return isNonVariableTopLevelDeclaration(node) && isSourceFile(node.parent) || isVariableDeclaration(node) && isSourceFile(node.parent.parent.parent); - } - function sourceFileOfTopLevelDeclaration(node) { - return isVariableDeclaration(node) ? node.parent.parent.parent : node.parent; - } - function isTopLevelDeclarationStatement(node) { - Debug.assert(isSourceFile(node.parent), "Node parent should be a SourceFile"); - return isNonVariableTopLevelDeclaration(node) || isVariableStatement(node); - } - function isNonVariableTopLevelDeclaration(node) { - switch (node.kind) { - case 259 /* FunctionDeclaration */: - case 260 /* ClassDeclaration */: - case 264 /* ModuleDeclaration */: - case 263 /* EnumDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 261 /* InterfaceDeclaration */: - case 268 /* ImportEqualsDeclaration */: - return true; - default: - return false; - } - } - function forEachTopLevelDeclaration(statement, cb) { - switch (statement.kind) { - case 259 /* FunctionDeclaration */: - case 260 /* ClassDeclaration */: - case 264 /* ModuleDeclaration */: - case 263 /* EnumDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 261 /* InterfaceDeclaration */: - case 268 /* ImportEqualsDeclaration */: - return cb(statement); - case 240 /* VariableStatement */: - return firstDefined(statement.declarationList.declarations, (decl) => forEachTopLevelDeclarationInBindingName(decl.name, cb)); - case 241 /* ExpressionStatement */: { - const { expression } = statement; - return isBinaryExpression(expression) && getAssignmentDeclarationKind(expression) === 1 /* ExportsProperty */ ? cb(statement) : void 0; - } - } - } - function forEachTopLevelDeclarationInBindingName(name, cb) { - switch (name.kind) { - case 79 /* Identifier */: - return cb(cast(name.parent, (x) => isVariableDeclaration(x) || isBindingElement(x))); - case 204 /* ArrayBindingPattern */: - case 203 /* ObjectBindingPattern */: - return firstDefined(name.elements, (em) => isOmittedExpression(em) ? void 0 : forEachTopLevelDeclarationInBindingName(em.name, cb)); - default: - return Debug.assertNever(name, `Unexpected name kind ${name.kind}`); - } - } - function nameOfTopLevelDeclaration(d) { - return isExpressionStatement(d) ? tryCast(d.expression.left.name, isIdentifier) : tryCast(d.name, isIdentifier); - } - function getTopLevelDeclarationStatement(d) { - switch (d.kind) { - case 257 /* VariableDeclaration */: - return d.parent.parent; - case 205 /* BindingElement */: - return getTopLevelDeclarationStatement( - cast(d.parent.parent, (p) => isVariableDeclaration(p) || isBindingElement(p)) - ); - default: - return d; - } - } - function addExportToChanges(sourceFile, decl, name, changes, useEs6Exports) { - if (isExported(sourceFile, decl, useEs6Exports, name)) - return; - if (useEs6Exports) { - if (!isExpressionStatement(decl)) - changes.insertExportModifier(sourceFile, decl); - } else { - const names = getNamesToExportInCommonJS(decl); - if (names.length !== 0) - changes.insertNodesAfter(sourceFile, decl, names.map(createExportAssignment)); - } - } - function isExported(sourceFile, decl, useEs6Exports, name) { - var _a2; - if (useEs6Exports) { - return !isExpressionStatement(decl) && hasSyntacticModifier(decl, 1 /* Export */) || !!(name && ((_a2 = sourceFile.symbol.exports) == null ? void 0 : _a2.has(name.escapedText))); - } - return !!sourceFile.symbol && !!sourceFile.symbol.exports && getNamesToExportInCommonJS(decl).some((name2) => sourceFile.symbol.exports.has(escapeLeadingUnderscores(name2))); - } - function addExport(decl, useEs6Exports) { - return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl); - } - function addEs6Export(d) { - const modifiers = canHaveModifiers(d) ? concatenate([factory.createModifier(93 /* ExportKeyword */)], getModifiers(d)) : void 0; - switch (d.kind) { - case 259 /* FunctionDeclaration */: - return factory.updateFunctionDeclaration(d, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); - case 260 /* ClassDeclaration */: - const decorators = canHaveDecorators(d) ? getDecorators(d) : void 0; - return factory.updateClassDeclaration(d, concatenate(decorators, modifiers), d.name, d.typeParameters, d.heritageClauses, d.members); - case 240 /* VariableStatement */: - return factory.updateVariableStatement(d, modifiers, d.declarationList); - case 264 /* ModuleDeclaration */: - return factory.updateModuleDeclaration(d, modifiers, d.name, d.body); - case 263 /* EnumDeclaration */: - return factory.updateEnumDeclaration(d, modifiers, d.name, d.members); - case 262 /* TypeAliasDeclaration */: - return factory.updateTypeAliasDeclaration(d, modifiers, d.name, d.typeParameters, d.type); - case 261 /* InterfaceDeclaration */: - return factory.updateInterfaceDeclaration(d, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); - case 268 /* ImportEqualsDeclaration */: - return factory.updateImportEqualsDeclaration(d, modifiers, d.isTypeOnly, d.name, d.moduleReference); - case 241 /* ExpressionStatement */: - return Debug.fail(); - default: - return Debug.assertNever(d, `Unexpected declaration kind ${d.kind}`); - } - } - function addCommonjsExport(decl) { - return [decl, ...getNamesToExportInCommonJS(decl).map(createExportAssignment)]; - } - function getNamesToExportInCommonJS(decl) { - switch (decl.kind) { - case 259 /* FunctionDeclaration */: - case 260 /* ClassDeclaration */: - return [decl.name.text]; - case 240 /* VariableStatement */: - return mapDefined(decl.declarationList.declarations, (d) => isIdentifier(d.name) ? d.name.text : void 0); - case 264 /* ModuleDeclaration */: - case 263 /* EnumDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 261 /* InterfaceDeclaration */: - case 268 /* ImportEqualsDeclaration */: - return emptyArray; - case 241 /* ExpressionStatement */: - return Debug.fail("Can't export an ExpressionStatement"); - default: - return Debug.assertNever(decl, `Unexpected decl kind ${decl.kind}`); - } - } - function createExportAssignment(name) { - return factory.createExpressionStatement( - factory.createBinaryExpression( - factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.createIdentifier(name)), - 63 /* EqualsToken */, - factory.createIdentifier(name) - ) - ); - } - var refactorName4, description, moveToNewFileAction, SymbolSet; - var init_moveToNewFile = __esm({ - "src/services/refactors/moveToNewFile.ts"() { - "use strict"; - init_moduleSpecifiers(); - init_ts4(); - init_ts_refactor(); - refactorName4 = "Move to a new file"; - description = getLocaleSpecificMessage(Diagnostics.Move_to_a_new_file); - moveToNewFileAction = { - name: refactorName4, - description, - kind: "refactor.move.newFile" - }; - registerRefactor(refactorName4, { - kinds: [moveToNewFileAction.kind], - getAvailableActions: function getRefactorActionsToMoveToNewFile(context) { - const statements = getStatementsToMove(context); - if (context.preferences.allowTextChangesInNewFiles && statements) { - return [{ name: refactorName4, description, actions: [moveToNewFileAction] }]; - } - if (context.preferences.provideRefactorNotApplicableReason) { - return [{ - name: refactorName4, - description, - actions: [{ ...moveToNewFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }] - }]; - } - return emptyArray; - }, - getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) { - Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked"); - const statements = Debug.checkDefined(getStatementsToMove(context)); - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(context.file, context.program, statements, t, context.host, context.preferences)); - return { edits, renameFilename: void 0, renameLocation: void 0 }; - } - }); - SymbolSet = class { - constructor() { - this.map = /* @__PURE__ */ new Map(); - } - add(symbol) { - this.map.set(String(getSymbolId(symbol)), symbol); - } - has(symbol) { - return this.map.has(String(getSymbolId(symbol))); - } - delete(symbol) { - this.map.delete(String(getSymbolId(symbol))); - } - forEach(cb) { - this.map.forEach(cb); - } - forEachEntry(cb) { - return forEachEntry(this.map, cb); - } - clone() { - const clone2 = new SymbolSet(); - copyEntries(this.map, clone2.map); - return clone2; - } - size() { - return this.map.size; - } - }; - } - }); - - // src/services/refactors/convertOverloadListToSingleSignature.ts - function getRefactorActionsToConvertOverloadsToOneSignature(context) { - const { file, startPosition, program } = context; - const info = getConvertableOverloadListAtPosition(file, startPosition, program); - if (!info) - return emptyArray; - return [{ - name: refactorName5, - description: refactorDescription, - actions: [functionOverloadAction] - }]; - } - function getRefactorEditsToConvertOverloadsToOneSignature(context) { - const { file, startPosition, program } = context; - const signatureDecls = getConvertableOverloadListAtPosition(file, startPosition, program); - if (!signatureDecls) - return void 0; - const checker = program.getTypeChecker(); - const lastDeclaration = signatureDecls[signatureDecls.length - 1]; - let updated = lastDeclaration; - switch (lastDeclaration.kind) { - case 170 /* MethodSignature */: { - updated = factory.updateMethodSignature( - lastDeclaration, - lastDeclaration.modifiers, - lastDeclaration.name, - lastDeclaration.questionToken, - lastDeclaration.typeParameters, - getNewParametersForCombinedSignature(signatureDecls), - lastDeclaration.type - ); - break; - } - case 171 /* MethodDeclaration */: { - updated = factory.updateMethodDeclaration( - lastDeclaration, - lastDeclaration.modifiers, - lastDeclaration.asteriskToken, - lastDeclaration.name, - lastDeclaration.questionToken, - lastDeclaration.typeParameters, - getNewParametersForCombinedSignature(signatureDecls), - lastDeclaration.type, - lastDeclaration.body - ); - break; - } - case 176 /* CallSignature */: { - updated = factory.updateCallSignature( - lastDeclaration, - lastDeclaration.typeParameters, - getNewParametersForCombinedSignature(signatureDecls), - lastDeclaration.type - ); - break; - } - case 173 /* Constructor */: { - updated = factory.updateConstructorDeclaration( - lastDeclaration, - lastDeclaration.modifiers, - getNewParametersForCombinedSignature(signatureDecls), - lastDeclaration.body - ); - break; - } - case 177 /* ConstructSignature */: { - updated = factory.updateConstructSignature( - lastDeclaration, - lastDeclaration.typeParameters, - getNewParametersForCombinedSignature(signatureDecls), - lastDeclaration.type - ); - break; - } - case 259 /* FunctionDeclaration */: { - updated = factory.updateFunctionDeclaration( - lastDeclaration, - lastDeclaration.modifiers, - lastDeclaration.asteriskToken, - lastDeclaration.name, - lastDeclaration.typeParameters, - getNewParametersForCombinedSignature(signatureDecls), - lastDeclaration.type, - lastDeclaration.body - ); - break; - } - default: - return Debug.failBadSyntaxKind(lastDeclaration, "Unhandled signature kind in overload list conversion refactoring"); - } - if (updated === lastDeclaration) { - return; - } - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => { - t.replaceNodeRange(file, signatureDecls[0], signatureDecls[signatureDecls.length - 1], updated); - }); - return { renameFilename: void 0, renameLocation: void 0, edits }; - function getNewParametersForCombinedSignature(signatureDeclarations) { - const lastSig = signatureDeclarations[signatureDeclarations.length - 1]; - if (isFunctionLikeDeclaration(lastSig) && lastSig.body) { - signatureDeclarations = signatureDeclarations.slice(0, signatureDeclarations.length - 1); - } - return factory.createNodeArray([ - factory.createParameterDeclaration( - /*modifiers*/ - void 0, - factory.createToken(25 /* DotDotDotToken */), - "args", - /*questionToken*/ - void 0, - factory.createUnionTypeNode(map(signatureDeclarations, convertSignatureParametersToTuple)) - ) - ]); - } - function convertSignatureParametersToTuple(decl) { - const members = map(decl.parameters, convertParameterToNamedTupleMember); - return setEmitFlags(factory.createTupleTypeNode(members), some(members, (m) => !!length(getSyntheticLeadingComments(m))) ? 0 /* None */ : 1 /* SingleLine */); - } - function convertParameterToNamedTupleMember(p) { - Debug.assert(isIdentifier(p.name)); - const result = setTextRange(factory.createNamedTupleMember( - p.dotDotDotToken, - p.name, - p.questionToken, - p.type || factory.createKeywordTypeNode(131 /* AnyKeyword */) - ), p); - const parameterDocComment = p.symbol && p.symbol.getDocumentationComment(checker); - if (parameterDocComment) { - const newComment = displayPartsToString(parameterDocComment); - if (newComment.length) { - setSyntheticLeadingComments(result, [{ - text: `* -${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} - `, - kind: 3 /* MultiLineCommentTrivia */, - pos: -1, - end: -1, - hasTrailingNewLine: true, - hasLeadingNewline: true - }]); - } - } - return result; - } - } - function isConvertableSignatureDeclaration(d) { - switch (d.kind) { - case 170 /* MethodSignature */: - case 171 /* MethodDeclaration */: - case 176 /* CallSignature */: - case 173 /* Constructor */: - case 177 /* ConstructSignature */: - case 259 /* FunctionDeclaration */: - return true; - } - return false; - } - function getConvertableOverloadListAtPosition(file, startPosition, program) { - const node = getTokenAtPosition(file, startPosition); - const containingDecl = findAncestor(node, isConvertableSignatureDeclaration); - if (!containingDecl) { - return; - } - if (isFunctionLikeDeclaration(containingDecl) && containingDecl.body && rangeContainsPosition(containingDecl.body, startPosition)) { - return; - } - const checker = program.getTypeChecker(); - const signatureSymbol = containingDecl.symbol; - if (!signatureSymbol) { - return; - } - const decls = signatureSymbol.declarations; - if (length(decls) <= 1) { - return; - } - if (!every(decls, (d) => getSourceFileOfNode(d) === file)) { - return; - } - if (!isConvertableSignatureDeclaration(decls[0])) { - return; - } - const kindOne = decls[0].kind; - if (!every(decls, (d) => d.kind === kindOne)) { - return; - } - const signatureDecls = decls; - if (some(signatureDecls, (d) => !!d.typeParameters || some(d.parameters, (p) => !!p.modifiers || !isIdentifier(p.name)))) { - return; - } - const signatures = mapDefined(signatureDecls, (d) => checker.getSignatureFromDeclaration(d)); - if (length(signatures) !== length(decls)) { - return; - } - const returnOne = checker.getReturnTypeOfSignature(signatures[0]); - if (!every(signatures, (s) => checker.getReturnTypeOfSignature(s) === returnOne)) { - return; - } - return signatureDecls; - } - var refactorName5, refactorDescription, functionOverloadAction; - var init_convertOverloadListToSingleSignature = __esm({ - "src/services/refactors/convertOverloadListToSingleSignature.ts"() { - "use strict"; - init_ts4(); - init_ts_refactor(); - refactorName5 = "Convert overload list to single signature"; - refactorDescription = Diagnostics.Convert_overload_list_to_single_signature.message; - functionOverloadAction = { - name: refactorName5, - description: refactorDescription, - kind: "refactor.rewrite.function.overloadList" - }; - registerRefactor(refactorName5, { - kinds: [functionOverloadAction.kind], - getEditsForAction: getRefactorEditsToConvertOverloadsToOneSignature, - getAvailableActions: getRefactorActionsToConvertOverloadsToOneSignature - }); - } - }); - - // src/services/refactors/addOrRemoveBracesToArrowFunction.ts - function getRefactorActionsToRemoveFunctionBraces(context) { - const { file, startPosition, triggerReason } = context; - const info = getConvertibleArrowFunctionAtPosition(file, startPosition, triggerReason === "invoked"); - if (!info) - return emptyArray; - if (!isRefactorErrorInfo(info)) { - return [{ - name: refactorName6, - description: refactorDescription2, - actions: [ - info.addBraces ? addBracesAction : removeBracesAction - ] - }]; - } - if (context.preferences.provideRefactorNotApplicableReason) { - return [{ - name: refactorName6, - description: refactorDescription2, - actions: [ - { ...addBracesAction, notApplicableReason: info.error }, - { ...removeBracesAction, notApplicableReason: info.error } - ] - }]; - } - return emptyArray; - } - function getRefactorEditsToRemoveFunctionBraces(context, actionName2) { - const { file, startPosition } = context; - const info = getConvertibleArrowFunctionAtPosition(file, startPosition); - Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); - const { expression, returnStatement, func } = info; - let body; - if (actionName2 === addBracesAction.name) { - const returnStatement2 = factory.createReturnStatement(expression); - body = factory.createBlock( - [returnStatement2], - /* multiLine */ - true - ); - copyLeadingComments( - expression, - returnStatement2, - file, - 3 /* MultiLineCommentTrivia */, - /* hasTrailingNewLine */ - true - ); - } else if (actionName2 === removeBracesAction.name && returnStatement) { - const actualExpression = expression || factory.createVoidZero(); - body = needsParentheses(actualExpression) ? factory.createParenthesizedExpression(actualExpression) : actualExpression; - copyTrailingAsLeadingComments( - returnStatement, - body, - file, - 3 /* MultiLineCommentTrivia */, - /* hasTrailingNewLine */ - false - ); - copyLeadingComments( - returnStatement, - body, - file, - 3 /* MultiLineCommentTrivia */, - /* hasTrailingNewLine */ - false - ); - copyTrailingComments( - returnStatement, - body, - file, - 3 /* MultiLineCommentTrivia */, - /* hasTrailingNewLine */ - false - ); - } else { - Debug.fail("invalid action"); - } - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => { - t.replaceNode(file, func.body, body); - }); - return { renameFilename: void 0, renameLocation: void 0, edits }; - } - function getConvertibleArrowFunctionAtPosition(file, startPosition, considerFunctionBodies = true, kind) { - const node = getTokenAtPosition(file, startPosition); - const func = getContainingFunction(node); - if (!func) { - return { - error: getLocaleSpecificMessage(Diagnostics.Could_not_find_a_containing_arrow_function) - }; - } - if (!isArrowFunction(func)) { - return { - error: getLocaleSpecificMessage(Diagnostics.Containing_function_is_not_an_arrow_function) - }; - } - if (!rangeContainsRange(func, node) || rangeContainsRange(func.body, node) && !considerFunctionBodies) { - return void 0; - } - if (refactorKindBeginsWith(addBracesAction.kind, kind) && isExpression(func.body)) { - return { func, addBraces: true, expression: func.body }; - } else if (refactorKindBeginsWith(removeBracesAction.kind, kind) && isBlock(func.body) && func.body.statements.length === 1) { - const firstStatement = first(func.body.statements); - if (isReturnStatement(firstStatement)) { - return { func, addBraces: false, expression: firstStatement.expression, returnStatement: firstStatement }; - } - } - return void 0; - } - var refactorName6, refactorDescription2, addBracesAction, removeBracesAction; - var init_addOrRemoveBracesToArrowFunction = __esm({ - "src/services/refactors/addOrRemoveBracesToArrowFunction.ts"() { - "use strict"; - init_ts4(); - init_ts_refactor(); - refactorName6 = "Add or remove braces in an arrow function"; - refactorDescription2 = Diagnostics.Add_or_remove_braces_in_an_arrow_function.message; - addBracesAction = { - name: "Add braces to arrow function", - description: Diagnostics.Add_braces_to_arrow_function.message, - kind: "refactor.rewrite.arrow.braces.add" - }; - removeBracesAction = { - name: "Remove braces from arrow function", - description: Diagnostics.Remove_braces_from_arrow_function.message, - kind: "refactor.rewrite.arrow.braces.remove" - }; - registerRefactor(refactorName6, { - kinds: [removeBracesAction.kind], - getEditsForAction: getRefactorEditsToRemoveFunctionBraces, - getAvailableActions: getRefactorActionsToRemoveFunctionBraces - }); - } - }); - - // src/services/_namespaces/ts.refactor.addOrRemoveBracesToArrowFunction.ts - var ts_refactor_addOrRemoveBracesToArrowFunction_exports = {}; - var init_ts_refactor_addOrRemoveBracesToArrowFunction = __esm({ - "src/services/_namespaces/ts.refactor.addOrRemoveBracesToArrowFunction.ts"() { - "use strict"; - init_convertOverloadListToSingleSignature(); - init_addOrRemoveBracesToArrowFunction(); - } - }); - - // src/services/refactors/convertArrowFunctionOrFunctionExpression.ts - function getRefactorActionsToConvertFunctionExpressions(context) { - const { file, startPosition, program, kind } = context; - const info = getFunctionInfo(file, startPosition, program); - if (!info) - return emptyArray; - const { selectedVariableDeclaration, func } = info; - const possibleActions = []; - const errors = []; - if (refactorKindBeginsWith(toNamedFunctionAction.kind, kind)) { - const error = selectedVariableDeclaration || isArrowFunction(func) && isVariableDeclaration(func.parent) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_named_function); - if (error) { - errors.push({ ...toNamedFunctionAction, notApplicableReason: error }); - } else { - possibleActions.push(toNamedFunctionAction); - } - } - if (refactorKindBeginsWith(toAnonymousFunctionAction.kind, kind)) { - const error = !selectedVariableDeclaration && isArrowFunction(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_anonymous_function); - if (error) { - errors.push({ ...toAnonymousFunctionAction, notApplicableReason: error }); - } else { - possibleActions.push(toAnonymousFunctionAction); - } - } - if (refactorKindBeginsWith(toArrowFunctionAction.kind, kind)) { - const error = isFunctionExpression(func) ? void 0 : getLocaleSpecificMessage(Diagnostics.Could_not_convert_to_arrow_function); - if (error) { - errors.push({ ...toArrowFunctionAction, notApplicableReason: error }); - } else { - possibleActions.push(toArrowFunctionAction); - } - } - return [{ - name: refactorName7, - description: refactorDescription3, - actions: possibleActions.length === 0 && context.preferences.provideRefactorNotApplicableReason ? errors : possibleActions - }]; - } - function getRefactorEditsToConvertFunctionExpressions(context, actionName2) { - const { file, startPosition, program } = context; - const info = getFunctionInfo(file, startPosition, program); - if (!info) - return void 0; - const { func } = info; - const edits = []; - switch (actionName2) { - case toAnonymousFunctionAction.name: - edits.push(...getEditInfoForConvertToAnonymousFunction(context, func)); - break; - case toNamedFunctionAction.name: - const variableInfo = getVariableInfo(func); - if (!variableInfo) - return void 0; - edits.push(...getEditInfoForConvertToNamedFunction(context, func, variableInfo)); - break; - case toArrowFunctionAction.name: - if (!isFunctionExpression(func)) - return void 0; - edits.push(...getEditInfoForConvertToArrowFunction(context, func)); - break; - default: - return Debug.fail("invalid action"); - } - return { renameFilename: void 0, renameLocation: void 0, edits }; - } - function containingThis(node) { - let containsThis = false; - node.forEachChild(function checkThis(child) { - if (isThis(child)) { - containsThis = true; - return; - } - if (!isClassLike(child) && !isFunctionDeclaration(child) && !isFunctionExpression(child)) { - forEachChild(child, checkThis); - } - }); - return containsThis; - } - function getFunctionInfo(file, startPosition, program) { - const token = getTokenAtPosition(file, startPosition); - const typeChecker = program.getTypeChecker(); - const func = tryGetFunctionFromVariableDeclaration(file, typeChecker, token.parent); - if (func && !containingThis(func.body) && !typeChecker.containsArgumentsReference(func)) { - return { selectedVariableDeclaration: true, func }; - } - const maybeFunc = getContainingFunction(token); - if (maybeFunc && (isFunctionExpression(maybeFunc) || isArrowFunction(maybeFunc)) && !rangeContainsRange(maybeFunc.body, token) && !containingThis(maybeFunc.body) && !typeChecker.containsArgumentsReference(maybeFunc)) { - if (isFunctionExpression(maybeFunc) && isFunctionReferencedInFile(file, typeChecker, maybeFunc)) - return void 0; - return { selectedVariableDeclaration: false, func: maybeFunc }; - } - return void 0; - } - function isSingleVariableDeclaration(parent2) { - return isVariableDeclaration(parent2) || isVariableDeclarationList(parent2) && parent2.declarations.length === 1; - } - function tryGetFunctionFromVariableDeclaration(sourceFile, typeChecker, parent2) { - if (!isSingleVariableDeclaration(parent2)) { - return void 0; - } - const variableDeclaration = isVariableDeclaration(parent2) ? parent2 : first(parent2.declarations); - const initializer = variableDeclaration.initializer; - if (initializer && (isArrowFunction(initializer) || isFunctionExpression(initializer) && !isFunctionReferencedInFile(sourceFile, typeChecker, initializer))) { - return initializer; - } - return void 0; - } - function convertToBlock(body) { - if (isExpression(body)) { - const returnStatement = factory.createReturnStatement(body); - const file = body.getSourceFile(); - setTextRange(returnStatement, body); - suppressLeadingAndTrailingTrivia(returnStatement); - copyTrailingAsLeadingComments( - body, - returnStatement, - file, - /* commentKind */ - void 0, - /* hasTrailingNewLine */ - true - ); - return factory.createBlock( - [returnStatement], - /* multiLine */ - true - ); - } else { - return body; - } - } - function getVariableInfo(func) { - const variableDeclaration = func.parent; - if (!isVariableDeclaration(variableDeclaration) || !isVariableDeclarationInVariableStatement(variableDeclaration)) - return void 0; - const variableDeclarationList = variableDeclaration.parent; - const statement = variableDeclarationList.parent; - if (!isVariableDeclarationList(variableDeclarationList) || !isVariableStatement(statement) || !isIdentifier(variableDeclaration.name)) - return void 0; - return { variableDeclaration, variableDeclarationList, statement, name: variableDeclaration.name }; - } - function getEditInfoForConvertToAnonymousFunction(context, func) { - const { file } = context; - const body = convertToBlock(func.body); - const newNode = factory.createFunctionExpression( - func.modifiers, - func.asteriskToken, - /* name */ - void 0, - func.typeParameters, - func.parameters, - func.type, - body - ); - return ts_textChanges_exports.ChangeTracker.with(context, (t) => t.replaceNode(file, func, newNode)); - } - function getEditInfoForConvertToNamedFunction(context, func, variableInfo) { - const { file } = context; - const body = convertToBlock(func.body); - const { variableDeclaration, variableDeclarationList, statement, name } = variableInfo; - suppressLeadingTrivia(statement); - const modifiersFlags = getCombinedModifierFlags(variableDeclaration) & 1 /* Export */ | getEffectiveModifierFlags(func); - const modifiers = factory.createModifiersFromModifierFlags(modifiersFlags); - const newNode = factory.createFunctionDeclaration(length(modifiers) ? modifiers : void 0, func.asteriskToken, name, func.typeParameters, func.parameters, func.type, body); - if (variableDeclarationList.declarations.length === 1) { - return ts_textChanges_exports.ChangeTracker.with(context, (t) => t.replaceNode(file, statement, newNode)); - } else { - return ts_textChanges_exports.ChangeTracker.with(context, (t) => { - t.delete(file, variableDeclaration); - t.insertNodeAfter(file, statement, newNode); - }); - } - } - function getEditInfoForConvertToArrowFunction(context, func) { - const { file } = context; - const statements = func.body.statements; - const head = statements[0]; - let body; - if (canBeConvertedToExpression(func.body, head)) { - body = head.expression; - suppressLeadingAndTrailingTrivia(body); - copyComments(head, body); - } else { - body = func.body; - } - const newNode = factory.createArrowFunction(func.modifiers, func.typeParameters, func.parameters, func.type, factory.createToken(38 /* EqualsGreaterThanToken */), body); - return ts_textChanges_exports.ChangeTracker.with(context, (t) => t.replaceNode(file, func, newNode)); - } - function canBeConvertedToExpression(body, head) { - return body.statements.length === 1 && (isReturnStatement(head) && !!head.expression); - } - function isFunctionReferencedInFile(sourceFile, typeChecker, node) { - return !!node.name && ts_FindAllReferences_exports.Core.isSymbolReferencedInFile(node.name, typeChecker, sourceFile); - } - var refactorName7, refactorDescription3, toAnonymousFunctionAction, toNamedFunctionAction, toArrowFunctionAction; - var init_convertArrowFunctionOrFunctionExpression = __esm({ - "src/services/refactors/convertArrowFunctionOrFunctionExpression.ts"() { - "use strict"; - init_ts4(); - init_ts_refactor(); - refactorName7 = "Convert arrow function or function expression"; - refactorDescription3 = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression); - toAnonymousFunctionAction = { - name: "Convert to anonymous function", - description: getLocaleSpecificMessage(Diagnostics.Convert_to_anonymous_function), - kind: "refactor.rewrite.function.anonymous" - }; - toNamedFunctionAction = { - name: "Convert to named function", - description: getLocaleSpecificMessage(Diagnostics.Convert_to_named_function), - kind: "refactor.rewrite.function.named" - }; - toArrowFunctionAction = { - name: "Convert to arrow function", - description: getLocaleSpecificMessage(Diagnostics.Convert_to_arrow_function), - kind: "refactor.rewrite.function.arrow" - }; - registerRefactor(refactorName7, { - kinds: [ - toAnonymousFunctionAction.kind, - toNamedFunctionAction.kind, - toArrowFunctionAction.kind - ], - getEditsForAction: getRefactorEditsToConvertFunctionExpressions, - getAvailableActions: getRefactorActionsToConvertFunctionExpressions - }); - } - }); - - // src/services/_namespaces/ts.refactor.convertArrowFunctionOrFunctionExpression.ts - var ts_refactor_convertArrowFunctionOrFunctionExpression_exports = {}; - var init_ts_refactor_convertArrowFunctionOrFunctionExpression = __esm({ - "src/services/_namespaces/ts.refactor.convertArrowFunctionOrFunctionExpression.ts"() { - "use strict"; - init_convertArrowFunctionOrFunctionExpression(); - } - }); - - // src/services/refactors/convertParamsToDestructuredObject.ts - function getRefactorActionsToConvertParametersToDestructuredObject(context) { - const { file, startPosition } = context; - const isJSFile = isSourceFileJS(file); - if (isJSFile) - return emptyArray; - const functionDeclaration = getFunctionDeclarationAtPosition(file, startPosition, context.program.getTypeChecker()); - if (!functionDeclaration) - return emptyArray; - return [{ - name: refactorName8, - description: refactorDescription4, - actions: [toDestructuredAction] - }]; - } - function getRefactorEditsToConvertParametersToDestructuredObject(context, actionName2) { - Debug.assert(actionName2 === refactorName8, "Unexpected action name"); - const { file, startPosition, program, cancellationToken, host } = context; - const functionDeclaration = getFunctionDeclarationAtPosition(file, startPosition, program.getTypeChecker()); - if (!functionDeclaration || !cancellationToken) - return void 0; - const groupedReferences = getGroupedReferences(functionDeclaration, program, cancellationToken); - if (groupedReferences.valid) { - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(file, program, host, t, functionDeclaration, groupedReferences)); - return { renameFilename: void 0, renameLocation: void 0, edits }; - } - return { edits: [] }; - } - function doChange36(sourceFile, program, host, changes, functionDeclaration, groupedReferences) { - const signature = groupedReferences.signature; - const newFunctionDeclarationParams = map(createNewParameters(functionDeclaration, program, host), (param) => getSynthesizedDeepClone(param)); - if (signature) { - const newSignatureParams = map(createNewParameters(signature, program, host), (param) => getSynthesizedDeepClone(param)); - replaceParameters(signature, newSignatureParams); - } - replaceParameters(functionDeclaration, newFunctionDeclarationParams); - const functionCalls = sortAndDeduplicate( - groupedReferences.functionCalls, - /*comparer*/ - (a, b) => compareValues(a.pos, b.pos) - ); - for (const call of functionCalls) { - if (call.arguments && call.arguments.length) { - const newArgument = getSynthesizedDeepClone( - createNewArgument(functionDeclaration, call.arguments), - /*includeTrivia*/ - true - ); - changes.replaceNodeRange( - getSourceFileOfNode(call), - first(call.arguments), - last(call.arguments), - newArgument, - { leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.IncludeAll, trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.Include } - ); - } - } - function replaceParameters(declarationOrSignature, parameterDeclarations) { - changes.replaceNodeRangeWithNodes( - sourceFile, - first(declarationOrSignature.parameters), - last(declarationOrSignature.parameters), - parameterDeclarations, - { - joiner: ", ", - // indentation is set to 0 because otherwise the object parameter will be indented if there is a `this` parameter - indentation: 0, - leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.IncludeAll, - trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.Include - } - ); - } - } - function getGroupedReferences(functionDeclaration, program, cancellationToken) { - const functionNames = getFunctionNames(functionDeclaration); - const classNames = isConstructorDeclaration(functionDeclaration) ? getClassNames(functionDeclaration) : []; - const names = deduplicate([...functionNames, ...classNames], equateValues); - const checker = program.getTypeChecker(); - const references = flatMap( - names, - /*mapfn*/ - (name) => ts_FindAllReferences_exports.getReferenceEntriesForNode(-1, name, program, program.getSourceFiles(), cancellationToken) - ); - const groupedReferences = groupReferences(references); - if (!every( - groupedReferences.declarations, - /*callback*/ - (decl) => contains(names, decl) - )) { - groupedReferences.valid = false; - } - return groupedReferences; - function groupReferences(referenceEntries) { - const classReferences = { accessExpressions: [], typeUsages: [] }; - const groupedReferences2 = { functionCalls: [], declarations: [], classReferences, valid: true }; - const functionSymbols = map(functionNames, getSymbolTargetAtLocation); - const classSymbols = map(classNames, getSymbolTargetAtLocation); - const isConstructor = isConstructorDeclaration(functionDeclaration); - const contextualSymbols = map(functionNames, (name) => getSymbolForContextualType(name, checker)); - for (const entry of referenceEntries) { - if (entry.kind === ts_FindAllReferences_exports.EntryKind.Span) { - groupedReferences2.valid = false; - continue; - } - if (contains(contextualSymbols, getSymbolTargetAtLocation(entry.node))) { - if (isValidMethodSignature(entry.node.parent)) { - groupedReferences2.signature = entry.node.parent; - continue; - } - const call = entryToFunctionCall(entry); - if (call) { - groupedReferences2.functionCalls.push(call); - continue; - } - } - const contextualSymbol = getSymbolForContextualType(entry.node, checker); - if (contextualSymbol && contains(contextualSymbols, contextualSymbol)) { - const decl = entryToDeclaration(entry); - if (decl) { - groupedReferences2.declarations.push(decl); - continue; - } - } - if (contains(functionSymbols, getSymbolTargetAtLocation(entry.node)) || isNewExpressionTarget(entry.node)) { - const importOrExportReference = entryToImportOrExport(entry); - if (importOrExportReference) { - continue; - } - const decl = entryToDeclaration(entry); - if (decl) { - groupedReferences2.declarations.push(decl); - continue; - } - const call = entryToFunctionCall(entry); - if (call) { - groupedReferences2.functionCalls.push(call); - continue; - } - } - if (isConstructor && contains(classSymbols, getSymbolTargetAtLocation(entry.node))) { - const importOrExportReference = entryToImportOrExport(entry); - if (importOrExportReference) { - continue; - } - const decl = entryToDeclaration(entry); - if (decl) { - groupedReferences2.declarations.push(decl); - continue; - } - const accessExpression = entryToAccessExpression(entry); - if (accessExpression) { - classReferences.accessExpressions.push(accessExpression); - continue; - } - if (isClassDeclaration(functionDeclaration.parent)) { - const type = entryToType(entry); - if (type) { - classReferences.typeUsages.push(type); - continue; - } - } - } - groupedReferences2.valid = false; - } - return groupedReferences2; - } - function getSymbolTargetAtLocation(node) { - const symbol = checker.getSymbolAtLocation(node); - return symbol && getSymbolTarget(symbol, checker); - } - } - function getSymbolForContextualType(node, checker) { - const element = getContainingObjectLiteralElement(node); - if (element) { - const contextualType = checker.getContextualTypeForObjectLiteralElement(element); - const symbol = contextualType == null ? void 0 : contextualType.getSymbol(); - if (symbol && !(getCheckFlags(symbol) & 6 /* Synthetic */)) { - return symbol; - } - } - } - function entryToImportOrExport(entry) { - const node = entry.node; - if (isImportSpecifier(node.parent) || isImportClause(node.parent) || isImportEqualsDeclaration(node.parent) || isNamespaceImport(node.parent)) { - return node; - } - if (isExportSpecifier(node.parent) || isExportAssignment(node.parent)) { - return node; - } - return void 0; - } - function entryToDeclaration(entry) { - if (isDeclaration(entry.node.parent)) { - return entry.node; - } - return void 0; - } - function entryToFunctionCall(entry) { - if (entry.node.parent) { - const functionReference = entry.node; - const parent2 = functionReference.parent; - switch (parent2.kind) { - case 210 /* CallExpression */: - case 211 /* NewExpression */: - const callOrNewExpression = tryCast(parent2, isCallOrNewExpression); - if (callOrNewExpression && callOrNewExpression.expression === functionReference) { - return callOrNewExpression; - } - break; - case 208 /* PropertyAccessExpression */: - const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression); - if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { - const callOrNewExpression2 = tryCast(propertyAccessExpression.parent, isCallOrNewExpression); - if (callOrNewExpression2 && callOrNewExpression2.expression === propertyAccessExpression) { - return callOrNewExpression2; - } - } - break; - case 209 /* ElementAccessExpression */: - const elementAccessExpression = tryCast(parent2, isElementAccessExpression); - if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) { - const callOrNewExpression2 = tryCast(elementAccessExpression.parent, isCallOrNewExpression); - if (callOrNewExpression2 && callOrNewExpression2.expression === elementAccessExpression) { - return callOrNewExpression2; - } - } - break; - } - } - return void 0; - } - function entryToAccessExpression(entry) { - if (entry.node.parent) { - const reference = entry.node; - const parent2 = reference.parent; - switch (parent2.kind) { - case 208 /* PropertyAccessExpression */: - const propertyAccessExpression = tryCast(parent2, isPropertyAccessExpression); - if (propertyAccessExpression && propertyAccessExpression.expression === reference) { - return propertyAccessExpression; - } - break; - case 209 /* ElementAccessExpression */: - const elementAccessExpression = tryCast(parent2, isElementAccessExpression); - if (elementAccessExpression && elementAccessExpression.expression === reference) { - return elementAccessExpression; - } - break; - } - } - return void 0; - } - function entryToType(entry) { - const reference = entry.node; - if (getMeaningFromLocation(reference) === 2 /* Type */ || isExpressionWithTypeArgumentsInClassExtendsClause(reference.parent)) { - return reference; - } - return void 0; - } - function getFunctionDeclarationAtPosition(file, startPosition, checker) { - const node = getTouchingToken(file, startPosition); - const functionDeclaration = getContainingFunctionDeclaration(node); - if (isTopLevelJSDoc(node)) - return void 0; - if (functionDeclaration && isValidFunctionDeclaration(functionDeclaration, checker) && rangeContainsRange(functionDeclaration, node) && !(functionDeclaration.body && rangeContainsRange(functionDeclaration.body, node))) - return functionDeclaration; - return void 0; - } - function isTopLevelJSDoc(node) { - const containingJSDoc = findAncestor(node, isJSDocNode); - if (containingJSDoc) { - const containingNonJSDoc = findAncestor(containingJSDoc, (n) => !isJSDocNode(n)); - return !!containingNonJSDoc && isFunctionLikeDeclaration(containingNonJSDoc); - } - return false; - } - function isValidMethodSignature(node) { - return isMethodSignature(node) && (isInterfaceDeclaration(node.parent) || isTypeLiteralNode(node.parent)); - } - function isValidFunctionDeclaration(functionDeclaration, checker) { - var _a2; - if (!isValidParameterNodeArray(functionDeclaration.parameters, checker)) - return false; - switch (functionDeclaration.kind) { - case 259 /* FunctionDeclaration */: - return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker); - case 171 /* MethodDeclaration */: - if (isObjectLiteralExpression(functionDeclaration.parent)) { - const contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker); - return ((_a2 = contextualSymbol == null ? void 0 : contextualSymbol.declarations) == null ? void 0 : _a2.length) === 1 && isSingleImplementation(functionDeclaration, checker); - } - return isSingleImplementation(functionDeclaration, checker); - case 173 /* Constructor */: - if (isClassDeclaration(functionDeclaration.parent)) { - return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker); - } else { - return isValidVariableDeclaration(functionDeclaration.parent.parent) && isSingleImplementation(functionDeclaration, checker); - } - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - return isValidVariableDeclaration(functionDeclaration.parent); - } - return false; - } - function isSingleImplementation(functionDeclaration, checker) { - return !!functionDeclaration.body && !checker.isImplementationOfOverload(functionDeclaration); - } - function hasNameOrDefault(functionOrClassDeclaration) { - if (!functionOrClassDeclaration.name) { - const defaultKeyword = findModifier(functionOrClassDeclaration, 88 /* DefaultKeyword */); - return !!defaultKeyword; - } - return true; - } - function isValidParameterNodeArray(parameters, checker) { - return getRefactorableParametersLength(parameters) >= minimumParameterLength && every( - parameters, - /*callback*/ - (paramDecl) => isValidParameterDeclaration(paramDecl, checker) - ); - } - function isValidParameterDeclaration(parameterDeclaration, checker) { - if (isRestParameter(parameterDeclaration)) { - const type = checker.getTypeAtLocation(parameterDeclaration); - if (!checker.isArrayType(type) && !checker.isTupleType(type)) - return false; - } - return !parameterDeclaration.modifiers && isIdentifier(parameterDeclaration.name); - } - function isValidVariableDeclaration(node) { - return isVariableDeclaration(node) && isVarConst(node) && isIdentifier(node.name) && !node.type; - } - function hasThisParameter(parameters) { - return parameters.length > 0 && isThis(parameters[0].name); - } - function getRefactorableParametersLength(parameters) { - if (hasThisParameter(parameters)) { - return parameters.length - 1; - } - return parameters.length; - } - function getRefactorableParameters(parameters) { - if (hasThisParameter(parameters)) { - parameters = factory.createNodeArray(parameters.slice(1), parameters.hasTrailingComma); - } - return parameters; - } - function createPropertyOrShorthandAssignment(name, initializer) { - if (isIdentifier(initializer) && getTextOfIdentifierOrLiteral(initializer) === name) { - return factory.createShorthandPropertyAssignment(name); - } - return factory.createPropertyAssignment(name, initializer); - } - function createNewArgument(functionDeclaration, functionArguments) { - const parameters = getRefactorableParameters(functionDeclaration.parameters); - const hasRestParameter2 = isRestParameter(last(parameters)); - const nonRestArguments = hasRestParameter2 ? functionArguments.slice(0, parameters.length - 1) : functionArguments; - const properties = map(nonRestArguments, (arg, i) => { - const parameterName = getParameterName(parameters[i]); - const property = createPropertyOrShorthandAssignment(parameterName, arg); - suppressLeadingAndTrailingTrivia(property.name); - if (isPropertyAssignment(property)) - suppressLeadingAndTrailingTrivia(property.initializer); - copyComments(arg, property); - return property; - }); - if (hasRestParameter2 && functionArguments.length >= parameters.length) { - const restArguments = functionArguments.slice(parameters.length - 1); - const restProperty = factory.createPropertyAssignment(getParameterName(last(parameters)), factory.createArrayLiteralExpression(restArguments)); - properties.push(restProperty); - } - const objectLiteral = factory.createObjectLiteralExpression( - properties, - /*multiLine*/ - false - ); - return objectLiteral; - } - function createNewParameters(functionDeclaration, program, host) { - const checker = program.getTypeChecker(); - const refactorableParameters = getRefactorableParameters(functionDeclaration.parameters); - const bindingElements = map(refactorableParameters, createBindingElementFromParameterDeclaration); - const objectParameterName = factory.createObjectBindingPattern(bindingElements); - const objectParameterType = createParameterTypeNode(refactorableParameters); - let objectInitializer; - if (every(refactorableParameters, isOptionalParameter)) { - objectInitializer = factory.createObjectLiteralExpression(); - } - const objectParameter = factory.createParameterDeclaration( - /*modifiers*/ - void 0, - /*dotDotDotToken*/ - void 0, - objectParameterName, - /*questionToken*/ - void 0, - objectParameterType, - objectInitializer - ); - if (hasThisParameter(functionDeclaration.parameters)) { - const thisParameter = functionDeclaration.parameters[0]; - const newThisParameter = factory.createParameterDeclaration( - /*modifiers*/ - void 0, - /*dotDotDotToken*/ - void 0, - thisParameter.name, - /*questionToken*/ - void 0, - thisParameter.type - ); - suppressLeadingAndTrailingTrivia(newThisParameter.name); - copyComments(thisParameter.name, newThisParameter.name); - if (thisParameter.type) { - suppressLeadingAndTrailingTrivia(newThisParameter.type); - copyComments(thisParameter.type, newThisParameter.type); - } - return factory.createNodeArray([newThisParameter, objectParameter]); - } - return factory.createNodeArray([objectParameter]); - function createBindingElementFromParameterDeclaration(parameterDeclaration) { - const element = factory.createBindingElement( - /*dotDotDotToken*/ - void 0, - /*propertyName*/ - void 0, - getParameterName(parameterDeclaration), - isRestParameter(parameterDeclaration) && isOptionalParameter(parameterDeclaration) ? factory.createArrayLiteralExpression() : parameterDeclaration.initializer - ); - suppressLeadingAndTrailingTrivia(element); - if (parameterDeclaration.initializer && element.initializer) { - copyComments(parameterDeclaration.initializer, element.initializer); - } - return element; - } - function createParameterTypeNode(parameters) { - const members = map(parameters, createPropertySignatureFromParameterDeclaration); - const typeNode = addEmitFlags(factory.createTypeLiteralNode(members), 1 /* SingleLine */); - return typeNode; - } - function createPropertySignatureFromParameterDeclaration(parameterDeclaration) { - let parameterType = parameterDeclaration.type; - if (!parameterType && (parameterDeclaration.initializer || isRestParameter(parameterDeclaration))) { - parameterType = getTypeNode3(parameterDeclaration); - } - const propertySignature = factory.createPropertySignature( - /*modifiers*/ - void 0, - getParameterName(parameterDeclaration), - isOptionalParameter(parameterDeclaration) ? factory.createToken(57 /* QuestionToken */) : parameterDeclaration.questionToken, - parameterType - ); - suppressLeadingAndTrailingTrivia(propertySignature); - copyComments(parameterDeclaration.name, propertySignature.name); - if (parameterDeclaration.type && propertySignature.type) { - copyComments(parameterDeclaration.type, propertySignature.type); - } - return propertySignature; - } - function getTypeNode3(node) { - const type = checker.getTypeAtLocation(node); - return getTypeNodeIfAccessible(type, node, program, host); - } - function isOptionalParameter(parameterDeclaration) { - if (isRestParameter(parameterDeclaration)) { - const type = checker.getTypeAtLocation(parameterDeclaration); - return !checker.isTupleType(type); - } - return checker.isOptionalParameter(parameterDeclaration); - } - } - function getParameterName(paramDeclaration) { - return getTextOfIdentifierOrLiteral(paramDeclaration.name); - } - function getClassNames(constructorDeclaration) { - switch (constructorDeclaration.parent.kind) { - case 260 /* ClassDeclaration */: - const classDeclaration = constructorDeclaration.parent; - if (classDeclaration.name) - return [classDeclaration.name]; - const defaultModifier = Debug.checkDefined( - findModifier(classDeclaration, 88 /* DefaultKeyword */), - "Nameless class declaration should be a default export" - ); - return [defaultModifier]; - case 228 /* ClassExpression */: - const classExpression = constructorDeclaration.parent; - const variableDeclaration = constructorDeclaration.parent.parent; - const className = classExpression.name; - if (className) - return [className, variableDeclaration.name]; - return [variableDeclaration.name]; - } - } - function getFunctionNames(functionDeclaration) { - switch (functionDeclaration.kind) { - case 259 /* FunctionDeclaration */: - if (functionDeclaration.name) - return [functionDeclaration.name]; - const defaultModifier = Debug.checkDefined( - findModifier(functionDeclaration, 88 /* DefaultKeyword */), - "Nameless function declaration should be a default export" - ); - return [defaultModifier]; - case 171 /* MethodDeclaration */: - return [functionDeclaration.name]; - case 173 /* Constructor */: - const ctrKeyword = Debug.checkDefined( - findChildOfKind(functionDeclaration, 135 /* ConstructorKeyword */, functionDeclaration.getSourceFile()), - "Constructor declaration should have constructor keyword" - ); - if (functionDeclaration.parent.kind === 228 /* ClassExpression */) { - const variableDeclaration = functionDeclaration.parent.parent; - return [variableDeclaration.name, ctrKeyword]; - } - return [ctrKeyword]; - case 216 /* ArrowFunction */: - return [functionDeclaration.parent.name]; - case 215 /* FunctionExpression */: - if (functionDeclaration.name) - return [functionDeclaration.name, functionDeclaration.parent.name]; - return [functionDeclaration.parent.name]; - default: - return Debug.assertNever(functionDeclaration, `Unexpected function declaration kind ${functionDeclaration.kind}`); - } - } - var refactorName8, minimumParameterLength, refactorDescription4, toDestructuredAction; - var init_convertParamsToDestructuredObject = __esm({ - "src/services/refactors/convertParamsToDestructuredObject.ts"() { - "use strict"; - init_ts4(); - init_ts_refactor(); - refactorName8 = "Convert parameters to destructured object"; - minimumParameterLength = 1; - refactorDescription4 = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object); - toDestructuredAction = { - name: refactorName8, - description: refactorDescription4, - kind: "refactor.rewrite.parameters.toDestructured" - }; - registerRefactor(refactorName8, { - kinds: [toDestructuredAction.kind], - getEditsForAction: getRefactorEditsToConvertParametersToDestructuredObject, - getAvailableActions: getRefactorActionsToConvertParametersToDestructuredObject - }); - } - }); - - // src/services/_namespaces/ts.refactor.convertParamsToDestructuredObject.ts - var ts_refactor_convertParamsToDestructuredObject_exports = {}; - var init_ts_refactor_convertParamsToDestructuredObject = __esm({ - "src/services/_namespaces/ts.refactor.convertParamsToDestructuredObject.ts"() { - "use strict"; - init_convertParamsToDestructuredObject(); - } - }); - - // src/services/refactors/convertStringOrTemplateLiteral.ts - function getRefactorActionsToConvertToTemplateString(context) { - const { file, startPosition } = context; - const node = getNodeOrParentOfParentheses(file, startPosition); - const maybeBinary = getParentBinaryExpression(node); - const refactorInfo = { name: refactorName9, description: refactorDescription5, actions: [] }; - if (isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) { - refactorInfo.actions.push(convertStringAction); - return [refactorInfo]; - } else if (context.preferences.provideRefactorNotApplicableReason) { - refactorInfo.actions.push({ - ...convertStringAction, - notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenation) - }); - return [refactorInfo]; - } - return emptyArray; - } - function getNodeOrParentOfParentheses(file, startPosition) { - const node = getTokenAtPosition(file, startPosition); - const nestedBinary = getParentBinaryExpression(node); - const isNonStringBinary = !treeToArray(nestedBinary).isValidConcatenation; - if (isNonStringBinary && isParenthesizedExpression(nestedBinary.parent) && isBinaryExpression(nestedBinary.parent.parent)) { - return nestedBinary.parent.parent; - } - return node; - } - function getRefactorEditsToConvertToTemplateString(context, actionName2) { - const { file, startPosition } = context; - const node = getNodeOrParentOfParentheses(file, startPosition); - switch (actionName2) { - case refactorDescription5: - return { edits: getEditsForToTemplateLiteral(context, node) }; - default: - return Debug.fail("invalid action"); - } - } - function getEditsForToTemplateLiteral(context, node) { - const maybeBinary = getParentBinaryExpression(node); - const file = context.file; - const templateLiteral = nodesToTemplate(treeToArray(maybeBinary), file); - const trailingCommentRanges = getTrailingCommentRanges(file.text, maybeBinary.end); - if (trailingCommentRanges) { - const lastComment = trailingCommentRanges[trailingCommentRanges.length - 1]; - const trailingRange = { pos: trailingCommentRanges[0].pos, end: lastComment.end }; - return ts_textChanges_exports.ChangeTracker.with(context, (t) => { - t.deleteRange(file, trailingRange); - t.replaceNode(file, maybeBinary, templateLiteral); - }); - } else { - return ts_textChanges_exports.ChangeTracker.with(context, (t) => t.replaceNode(file, maybeBinary, templateLiteral)); - } - } - function isNotEqualsOperator(node) { - return node.operatorToken.kind !== 63 /* EqualsToken */; - } - function getParentBinaryExpression(expr) { - const container = findAncestor(expr.parent, (n) => { - switch (n.kind) { - case 208 /* PropertyAccessExpression */: - case 209 /* ElementAccessExpression */: - return false; - case 225 /* TemplateExpression */: - case 223 /* BinaryExpression */: - return !(isBinaryExpression(n.parent) && isNotEqualsOperator(n.parent)); - default: - return "quit"; - } - }); - return container || expr; - } - function treeToArray(current) { - const loop = (current2) => { - if (!isBinaryExpression(current2)) { - return { - nodes: [current2], - operators: [], - validOperators: true, - hasString: isStringLiteral(current2) || isNoSubstitutionTemplateLiteral(current2) - }; - } - const { nodes: nodes2, operators: operators2, hasString: leftHasString, validOperators: leftOperatorValid } = loop(current2.left); - if (!(leftHasString || isStringLiteral(current2.right) || isTemplateExpression(current2.right))) { - return { nodes: [current2], operators: [], hasString: false, validOperators: true }; - } - const currentOperatorValid = current2.operatorToken.kind === 39 /* PlusToken */; - const validOperators2 = leftOperatorValid && currentOperatorValid; - nodes2.push(current2.right); - operators2.push(current2.operatorToken); - return { nodes: nodes2, operators: operators2, hasString: true, validOperators: validOperators2 }; - }; - const { nodes, operators, validOperators, hasString } = loop(current); - return { nodes, operators, isValidConcatenation: validOperators && hasString }; - } - function escapeRawStringForTemplate(s) { - return s.replace(/\\.|[$`]/g, (m) => m[0] === "\\" ? m : "\\" + m); - } - function getRawTextOfTemplate(node) { - const rightShaving = isTemplateHead(node) || isTemplateMiddle(node) ? -2 : -1; - return getTextOfNode(node).slice(1, rightShaving); - } - function concatConsecutiveString(index, nodes) { - const indexes = []; - let text = "", rawText = ""; - while (index < nodes.length) { - const node = nodes[index]; - if (isStringLiteralLike(node)) { - text += node.text; - rawText += escapeRawStringForTemplate(getTextOfNode(node).slice(1, -1)); - indexes.push(index); - index++; - } else if (isTemplateExpression(node)) { - text += node.head.text; - rawText += getRawTextOfTemplate(node.head); - break; - } else { - break; - } - } - return [index, text, rawText, indexes]; - } - function nodesToTemplate({ nodes, operators }, file) { - const copyOperatorComments = copyTrailingOperatorComments(operators, file); - const copyCommentFromStringLiterals = copyCommentFromMultiNode(nodes, file, copyOperatorComments); - const [begin, headText, rawHeadText, headIndexes] = concatConsecutiveString(0, nodes); - if (begin === nodes.length) { - const noSubstitutionTemplateLiteral = factory.createNoSubstitutionTemplateLiteral(headText, rawHeadText); - copyCommentFromStringLiterals(headIndexes, noSubstitutionTemplateLiteral); - return noSubstitutionTemplateLiteral; - } - const templateSpans = []; - const templateHead = factory.createTemplateHead(headText, rawHeadText); - copyCommentFromStringLiterals(headIndexes, templateHead); - for (let i = begin; i < nodes.length; i++) { - const currentNode = getExpressionFromParenthesesOrExpression(nodes[i]); - copyOperatorComments(i, currentNode); - const [newIndex, subsequentText, rawSubsequentText, stringIndexes] = concatConsecutiveString(i + 1, nodes); - i = newIndex - 1; - const isLast = i === nodes.length - 1; - if (isTemplateExpression(currentNode)) { - const spans = map(currentNode.templateSpans, (span, index) => { - copyExpressionComments(span); - const isLastSpan = index === currentNode.templateSpans.length - 1; - const text = span.literal.text + (isLastSpan ? subsequentText : ""); - const rawText = getRawTextOfTemplate(span.literal) + (isLastSpan ? rawSubsequentText : ""); - return factory.createTemplateSpan(span.expression, isLast && isLastSpan ? factory.createTemplateTail(text, rawText) : factory.createTemplateMiddle(text, rawText)); - }); - templateSpans.push(...spans); - } else { - const templatePart = isLast ? factory.createTemplateTail(subsequentText, rawSubsequentText) : factory.createTemplateMiddle(subsequentText, rawSubsequentText); - copyCommentFromStringLiterals(stringIndexes, templatePart); - templateSpans.push(factory.createTemplateSpan(currentNode, templatePart)); - } - } - return factory.createTemplateExpression(templateHead, templateSpans); - } - function copyExpressionComments(node) { - const file = node.getSourceFile(); - copyTrailingComments( - node, - node.expression, - file, - 3 /* MultiLineCommentTrivia */, - /* hasTrailingNewLine */ - false - ); - copyTrailingAsLeadingComments( - node.expression, - node.expression, - file, - 3 /* MultiLineCommentTrivia */, - /* hasTrailingNewLine */ - false - ); - } - function getExpressionFromParenthesesOrExpression(node) { - if (isParenthesizedExpression(node)) { - copyExpressionComments(node); - node = node.expression; - } - return node; - } - var refactorName9, refactorDescription5, convertStringAction, copyTrailingOperatorComments, copyCommentFromMultiNode; - var init_convertStringOrTemplateLiteral = __esm({ - "src/services/refactors/convertStringOrTemplateLiteral.ts"() { - "use strict"; - init_ts4(); - init_ts_refactor(); - refactorName9 = "Convert to template string"; - refactorDescription5 = getLocaleSpecificMessage(Diagnostics.Convert_to_template_string); - convertStringAction = { - name: refactorName9, - description: refactorDescription5, - kind: "refactor.rewrite.string" - }; - registerRefactor(refactorName9, { - kinds: [convertStringAction.kind], - getEditsForAction: getRefactorEditsToConvertToTemplateString, - getAvailableActions: getRefactorActionsToConvertToTemplateString - }); - copyTrailingOperatorComments = (operators, file) => (index, targetNode) => { - if (index < operators.length) { - copyTrailingComments( - operators[index], - targetNode, - file, - 3 /* MultiLineCommentTrivia */, - /* hasTrailingNewLine */ - false - ); - } - }; - copyCommentFromMultiNode = (nodes, file, copyOperatorComments) => (indexes, targetNode) => { - while (indexes.length > 0) { - const index = indexes.shift(); - copyTrailingComments( - nodes[index], - targetNode, - file, - 3 /* MultiLineCommentTrivia */, - /* hasTrailingNewLine */ - false - ); - copyOperatorComments(index, targetNode); - } - }; - } - }); - - // src/services/_namespaces/ts.refactor.convertStringOrTemplateLiteral.ts - var ts_refactor_convertStringOrTemplateLiteral_exports = {}; - var init_ts_refactor_convertStringOrTemplateLiteral = __esm({ - "src/services/_namespaces/ts.refactor.convertStringOrTemplateLiteral.ts"() { - "use strict"; - init_convertStringOrTemplateLiteral(); - } - }); - - // src/services/refactors/convertToOptionalChainExpression.ts - function getRefactorActionsToConvertToOptionalChain(context) { - const info = getInfo20(context, context.triggerReason === "invoked"); - if (!info) - return emptyArray; - if (!isRefactorErrorInfo(info)) { - return [{ - name: refactorName10, - description: convertToOptionalChainExpressionMessage, - actions: [toOptionalChainAction] - }]; - } - if (context.preferences.provideRefactorNotApplicableReason) { - return [{ - name: refactorName10, - description: convertToOptionalChainExpressionMessage, - actions: [{ ...toOptionalChainAction, notApplicableReason: info.error }] - }]; - } - return emptyArray; - } - function getRefactorEditsToConvertToOptionalChain(context, actionName2) { - const info = getInfo20(context); - Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); - const edits = ts_textChanges_exports.ChangeTracker.with( - context, - (t) => doChange37(context.file, context.program.getTypeChecker(), t, info, actionName2) - ); - return { edits, renameFilename: void 0, renameLocation: void 0 }; - } - function isValidExpression(node) { - return isBinaryExpression(node) || isConditionalExpression(node); - } - function isValidStatement(node) { - return isExpressionStatement(node) || isReturnStatement(node) || isVariableStatement(node); - } - function isValidExpressionOrStatement(node) { - return isValidExpression(node) || isValidStatement(node); - } - function getInfo20(context, considerEmptySpans = true) { - const { file, program } = context; - const span = getRefactorContextSpan(context); - const forEmptySpan = span.length === 0; - if (forEmptySpan && !considerEmptySpans) - return void 0; - const startToken = getTokenAtPosition(file, span.start); - const endToken = findTokenOnLeftOfPosition(file, span.start + span.length); - const adjustedSpan = createTextSpanFromBounds(startToken.pos, endToken && endToken.end >= startToken.pos ? endToken.getEnd() : startToken.getEnd()); - const parent2 = forEmptySpan ? getValidParentNodeOfEmptySpan(startToken) : getValidParentNodeContainingSpan(startToken, adjustedSpan); - const expression = parent2 && isValidExpressionOrStatement(parent2) ? getExpression(parent2) : void 0; - if (!expression) - return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_convertible_access_expression) }; - const checker = program.getTypeChecker(); - return isConditionalExpression(expression) ? getConditionalInfo(expression, checker) : getBinaryInfo(expression); - } - function getConditionalInfo(expression, checker) { - const condition = expression.condition; - const finalExpression = getFinalExpressionInChain(expression.whenTrue); - if (!finalExpression || checker.isNullableType(checker.getTypeAtLocation(finalExpression))) { - return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_convertible_access_expression) }; - } - if ((isPropertyAccessExpression(condition) || isIdentifier(condition)) && getMatchingStart(condition, finalExpression.expression)) { - return { finalExpression, occurrences: [condition], expression }; - } else if (isBinaryExpression(condition)) { - const occurrences = getOccurrencesInExpression(finalExpression.expression, condition); - return occurrences ? { finalExpression, occurrences, expression } : { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_matching_access_expressions) }; - } - } - function getBinaryInfo(expression) { - if (expression.operatorToken.kind !== 55 /* AmpersandAmpersandToken */) { - return { error: getLocaleSpecificMessage(Diagnostics.Can_only_convert_logical_AND_access_chains) }; - } - const finalExpression = getFinalExpressionInChain(expression.right); - if (!finalExpression) - return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_convertible_access_expression) }; - const occurrences = getOccurrencesInExpression(finalExpression.expression, expression.left); - return occurrences ? { finalExpression, occurrences, expression } : { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_matching_access_expressions) }; - } - function getOccurrencesInExpression(matchTo, expression) { - const occurrences = []; - while (isBinaryExpression(expression) && expression.operatorToken.kind === 55 /* AmpersandAmpersandToken */) { - const match = getMatchingStart(skipParentheses(matchTo), skipParentheses(expression.right)); - if (!match) { - break; - } - occurrences.push(match); - matchTo = match; - expression = expression.left; - } - const finalMatch = getMatchingStart(matchTo, expression); - if (finalMatch) { - occurrences.push(finalMatch); - } - return occurrences.length > 0 ? occurrences : void 0; - } - function getMatchingStart(chain, subchain) { - if (!isIdentifier(subchain) && !isPropertyAccessExpression(subchain) && !isElementAccessExpression(subchain)) { - return void 0; - } - return chainStartsWith(chain, subchain) ? subchain : void 0; - } - function chainStartsWith(chain, subchain) { - while (isCallExpression(chain) || isPropertyAccessExpression(chain) || isElementAccessExpression(chain)) { - if (getTextOfChainNode(chain) === getTextOfChainNode(subchain)) - break; - chain = chain.expression; - } - while (isPropertyAccessExpression(chain) && isPropertyAccessExpression(subchain) || isElementAccessExpression(chain) && isElementAccessExpression(subchain)) { - if (getTextOfChainNode(chain) !== getTextOfChainNode(subchain)) - return false; - chain = chain.expression; - subchain = subchain.expression; - } - return isIdentifier(chain) && isIdentifier(subchain) && chain.getText() === subchain.getText(); - } - function getTextOfChainNode(node) { - if (isIdentifier(node) || isStringOrNumericLiteralLike(node)) { - return node.getText(); - } - if (isPropertyAccessExpression(node)) { - return getTextOfChainNode(node.name); - } - if (isElementAccessExpression(node)) { - return getTextOfChainNode(node.argumentExpression); - } - return void 0; - } - function getValidParentNodeContainingSpan(node, span) { - while (node.parent) { - if (isValidExpressionOrStatement(node) && span.length !== 0 && node.end >= span.start + span.length) { - return node; - } - node = node.parent; - } - return void 0; - } - function getValidParentNodeOfEmptySpan(node) { - while (node.parent) { - if (isValidExpressionOrStatement(node) && !isValidExpressionOrStatement(node.parent)) { - return node; - } - node = node.parent; - } - return void 0; - } - function getExpression(node) { - if (isValidExpression(node)) { - return node; - } - if (isVariableStatement(node)) { - const variable = getSingleVariableOfVariableStatement(node); - const initializer = variable == null ? void 0 : variable.initializer; - return initializer && isValidExpression(initializer) ? initializer : void 0; - } - return node.expression && isValidExpression(node.expression) ? node.expression : void 0; - } - function getFinalExpressionInChain(node) { - node = skipParentheses(node); - if (isBinaryExpression(node)) { - return getFinalExpressionInChain(node.left); - } else if ((isPropertyAccessExpression(node) || isElementAccessExpression(node) || isCallExpression(node)) && !isOptionalChain(node)) { - return node; - } - return void 0; - } - function convertOccurrences(checker, toConvert, occurrences) { - if (isPropertyAccessExpression(toConvert) || isElementAccessExpression(toConvert) || isCallExpression(toConvert)) { - const chain = convertOccurrences(checker, toConvert.expression, occurrences); - const lastOccurrence = occurrences.length > 0 ? occurrences[occurrences.length - 1] : void 0; - const isOccurrence = (lastOccurrence == null ? void 0 : lastOccurrence.getText()) === toConvert.expression.getText(); - if (isOccurrence) - occurrences.pop(); - if (isCallExpression(toConvert)) { - return isOccurrence ? factory.createCallChain(chain, factory.createToken(28 /* QuestionDotToken */), toConvert.typeArguments, toConvert.arguments) : factory.createCallChain(chain, toConvert.questionDotToken, toConvert.typeArguments, toConvert.arguments); - } else if (isPropertyAccessExpression(toConvert)) { - return isOccurrence ? factory.createPropertyAccessChain(chain, factory.createToken(28 /* QuestionDotToken */), toConvert.name) : factory.createPropertyAccessChain(chain, toConvert.questionDotToken, toConvert.name); - } else if (isElementAccessExpression(toConvert)) { - return isOccurrence ? factory.createElementAccessChain(chain, factory.createToken(28 /* QuestionDotToken */), toConvert.argumentExpression) : factory.createElementAccessChain(chain, toConvert.questionDotToken, toConvert.argumentExpression); - } - } - return toConvert; - } - function doChange37(sourceFile, checker, changes, info, _actionName) { - const { finalExpression, occurrences, expression } = info; - const firstOccurrence = occurrences[occurrences.length - 1]; - const convertedChain = convertOccurrences(checker, finalExpression, occurrences); - if (convertedChain && (isPropertyAccessExpression(convertedChain) || isElementAccessExpression(convertedChain) || isCallExpression(convertedChain))) { - if (isBinaryExpression(expression)) { - changes.replaceNodeRange(sourceFile, firstOccurrence, finalExpression, convertedChain); - } else if (isConditionalExpression(expression)) { - changes.replaceNode( - sourceFile, - expression, - factory.createBinaryExpression(convertedChain, factory.createToken(60 /* QuestionQuestionToken */), expression.whenFalse) - ); - } - } - } - var refactorName10, convertToOptionalChainExpressionMessage, toOptionalChainAction; - var init_convertToOptionalChainExpression = __esm({ - "src/services/refactors/convertToOptionalChainExpression.ts"() { - "use strict"; - init_ts4(); - init_ts_refactor(); - refactorName10 = "Convert to optional chain expression"; - convertToOptionalChainExpressionMessage = getLocaleSpecificMessage(Diagnostics.Convert_to_optional_chain_expression); - toOptionalChainAction = { - name: refactorName10, - description: convertToOptionalChainExpressionMessage, - kind: "refactor.rewrite.expression.optionalChain" - }; - registerRefactor(refactorName10, { - kinds: [toOptionalChainAction.kind], - getEditsForAction: getRefactorEditsToConvertToOptionalChain, - getAvailableActions: getRefactorActionsToConvertToOptionalChain - }); - } - }); - - // src/services/_namespaces/ts.refactor.convertToOptionalChainExpression.ts - var ts_refactor_convertToOptionalChainExpression_exports = {}; - var init_ts_refactor_convertToOptionalChainExpression = __esm({ - "src/services/_namespaces/ts.refactor.convertToOptionalChainExpression.ts"() { - "use strict"; - init_convertToOptionalChainExpression(); - } - }); - - // src/services/refactors/extractSymbol.ts - function getRefactorActionsToExtractSymbol(context) { - const requestedRefactor = context.kind; - const rangeToExtract = getRangeToExtract2(context.file, getRefactorContextSpan(context), context.triggerReason === "invoked"); - const targetRange = rangeToExtract.targetRange; - if (targetRange === void 0) { - if (!rangeToExtract.errors || rangeToExtract.errors.length === 0 || !context.preferences.provideRefactorNotApplicableReason) { - return emptyArray; - } - const errors = []; - if (refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) { - errors.push({ - name: refactorName11, - description: extractFunctionAction.description, - actions: [{ ...extractFunctionAction, notApplicableReason: getStringError(rangeToExtract.errors) }] - }); - } - if (refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) { - errors.push({ - name: refactorName11, - description: extractConstantAction.description, - actions: [{ ...extractConstantAction, notApplicableReason: getStringError(rangeToExtract.errors) }] - }); - } - return errors; - } - const extractions = getPossibleExtractions(targetRange, context); - if (extractions === void 0) { - return emptyArray; - } - const functionActions = []; - const usedFunctionNames = /* @__PURE__ */ new Map(); - let innermostErrorFunctionAction; - const constantActions = []; - const usedConstantNames = /* @__PURE__ */ new Map(); - let innermostErrorConstantAction; - let i = 0; - for (const { functionExtraction, constantExtraction } of extractions) { - if (refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) { - const description2 = functionExtraction.description; - if (functionExtraction.errors.length === 0) { - if (!usedFunctionNames.has(description2)) { - usedFunctionNames.set(description2, true); - functionActions.push({ - description: description2, - name: `function_scope_${i}`, - kind: extractFunctionAction.kind - }); - } - } else if (!innermostErrorFunctionAction) { - innermostErrorFunctionAction = { - description: description2, - name: `function_scope_${i}`, - notApplicableReason: getStringError(functionExtraction.errors), - kind: extractFunctionAction.kind - }; - } - } - if (refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) { - const description2 = constantExtraction.description; - if (constantExtraction.errors.length === 0) { - if (!usedConstantNames.has(description2)) { - usedConstantNames.set(description2, true); - constantActions.push({ - description: description2, - name: `constant_scope_${i}`, - kind: extractConstantAction.kind - }); - } - } else if (!innermostErrorConstantAction) { - innermostErrorConstantAction = { - description: description2, - name: `constant_scope_${i}`, - notApplicableReason: getStringError(constantExtraction.errors), - kind: extractConstantAction.kind - }; - } - } - i++; - } - const infos = []; - if (functionActions.length) { - infos.push({ - name: refactorName11, - description: getLocaleSpecificMessage(Diagnostics.Extract_function), - actions: functionActions - }); - } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorFunctionAction) { - infos.push({ - name: refactorName11, - description: getLocaleSpecificMessage(Diagnostics.Extract_function), - actions: [innermostErrorFunctionAction] - }); - } - if (constantActions.length) { - infos.push({ - name: refactorName11, - description: getLocaleSpecificMessage(Diagnostics.Extract_constant), - actions: constantActions - }); - } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorConstantAction) { - infos.push({ - name: refactorName11, - description: getLocaleSpecificMessage(Diagnostics.Extract_constant), - actions: [innermostErrorConstantAction] - }); - } - return infos.length ? infos : emptyArray; - function getStringError(errors) { - let error = errors[0].messageText; - if (typeof error !== "string") { - error = error.messageText; - } - return error; - } - } - function getRefactorEditsToExtractSymbol(context, actionName2) { - const rangeToExtract = getRangeToExtract2(context.file, getRefactorContextSpan(context)); - const targetRange = rangeToExtract.targetRange; - const parsedFunctionIndexMatch = /^function_scope_(\d+)$/.exec(actionName2); - if (parsedFunctionIndexMatch) { - const index = +parsedFunctionIndexMatch[1]; - Debug.assert(isFinite(index), "Expected to parse a finite number from the function scope index"); - return getFunctionExtractionAtIndex(targetRange, context, index); - } - const parsedConstantIndexMatch = /^constant_scope_(\d+)$/.exec(actionName2); - if (parsedConstantIndexMatch) { - const index = +parsedConstantIndexMatch[1]; - Debug.assert(isFinite(index), "Expected to parse a finite number from the constant scope index"); - return getConstantExtractionAtIndex(targetRange, context, index); - } - Debug.fail("Unrecognized action name"); - } - function getRangeToExtract2(sourceFile, span, invoked = true) { - const { length: length2 } = span; - if (length2 === 0 && !invoked) { - return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractEmpty)] }; - } - const cursorRequest = length2 === 0 && invoked; - const startToken = findFirstNonJsxWhitespaceToken(sourceFile, span.start); - const endToken = findTokenOnLeftOfPosition(sourceFile, textSpanEnd(span)); - const adjustedSpan = startToken && endToken && invoked ? getAdjustedSpanFromNodes(startToken, endToken, sourceFile) : span; - const start = cursorRequest ? getExtractableParent(startToken) : getParentNodeInSpan(startToken, sourceFile, adjustedSpan); - const end = cursorRequest ? start : getParentNodeInSpan(endToken, sourceFile, adjustedSpan); - let rangeFacts = 0 /* None */; - let thisNode; - if (!start || !end) { - return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractRange)] }; - } - if (start.flags & 8388608 /* JSDoc */) { - return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractJSDoc)] }; - } - if (start.parent !== end.parent) { - return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractRange)] }; - } - if (start !== end) { - if (!isBlockLike(start.parent)) { - return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractRange)] }; - } - const statements = []; - for (const statement of start.parent.statements) { - if (statement === start || statements.length) { - const errors2 = checkNode(statement); - if (errors2) { - return { errors: errors2 }; - } - statements.push(statement); - } - if (statement === end) { - break; - } - } - if (!statements.length) { - return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractRange)] }; - } - return { targetRange: { range: statements, facts: rangeFacts, thisNode } }; - } - if (isReturnStatement(start) && !start.expression) { - return { errors: [createFileDiagnostic(sourceFile, span.start, length2, Messages.cannotExtractRange)] }; - } - const node = refineNode(start); - const errors = checkRootNode(node) || checkNode(node); - if (errors) { - return { errors }; - } - return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, thisNode } }; - function refineNode(node2) { - if (isReturnStatement(node2)) { - if (node2.expression) { - return node2.expression; - } - } else if (isVariableStatement(node2) || isVariableDeclarationList(node2)) { - const declarations = isVariableStatement(node2) ? node2.declarationList.declarations : node2.declarations; - let numInitializers = 0; - let lastInitializer; - for (const declaration of declarations) { - if (declaration.initializer) { - numInitializers++; - lastInitializer = declaration.initializer; - } - } - if (numInitializers === 1) { - return lastInitializer; - } - } else if (isVariableDeclaration(node2)) { - if (node2.initializer) { - return node2.initializer; - } - } - return node2; - } - function checkRootNode(node2) { - if (isIdentifier(isExpressionStatement(node2) ? node2.expression : node2)) { - return [createDiagnosticForNode(node2, Messages.cannotExtractIdentifier)]; - } - return void 0; - } - function checkForStaticContext(nodeToCheck, containingClass) { - let current = nodeToCheck; - while (current !== containingClass) { - if (current.kind === 169 /* PropertyDeclaration */) { - if (isStatic(current)) { - rangeFacts |= 32 /* InStaticRegion */; - } - break; - } else if (current.kind === 166 /* Parameter */) { - const ctorOrMethod = getContainingFunction(current); - if (ctorOrMethod.kind === 173 /* Constructor */) { - rangeFacts |= 32 /* InStaticRegion */; - } - break; - } else if (current.kind === 171 /* MethodDeclaration */) { - if (isStatic(current)) { - rangeFacts |= 32 /* InStaticRegion */; - } - } - current = current.parent; - } - } - function checkNode(nodeToCheck) { - let PermittedJumps; - ((PermittedJumps2) => { - PermittedJumps2[PermittedJumps2["None"] = 0] = "None"; - PermittedJumps2[PermittedJumps2["Break"] = 1] = "Break"; - PermittedJumps2[PermittedJumps2["Continue"] = 2] = "Continue"; - PermittedJumps2[PermittedJumps2["Return"] = 4] = "Return"; - })(PermittedJumps || (PermittedJumps = {})); - Debug.assert(nodeToCheck.pos <= nodeToCheck.end, "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (1)"); - Debug.assert(!positionIsSynthesized(nodeToCheck.pos), "This failure could trigger https://github.com/Microsoft/TypeScript/issues/20809 (2)"); - if (!isStatement(nodeToCheck) && !(isExpressionNode(nodeToCheck) && isExtractableExpression(nodeToCheck)) && !isStringLiteralJsxAttribute(nodeToCheck)) { - return [createDiagnosticForNode(nodeToCheck, Messages.statementOrExpressionExpected)]; - } - if (nodeToCheck.flags & 16777216 /* Ambient */) { - return [createDiagnosticForNode(nodeToCheck, Messages.cannotExtractAmbientBlock)]; - } - const containingClass = getContainingClass(nodeToCheck); - if (containingClass) { - checkForStaticContext(nodeToCheck, containingClass); - } - let errors2; - let permittedJumps = 4 /* Return */; - let seenLabels; - visit(nodeToCheck); - if (rangeFacts & 8 /* UsesThis */) { - const container = getThisContainer( - nodeToCheck, - /** includeArrowFunctions */ - false, - /*includeClassComputedPropertyName*/ - false - ); - if (container.kind === 259 /* FunctionDeclaration */ || container.kind === 171 /* MethodDeclaration */ && container.parent.kind === 207 /* ObjectLiteralExpression */ || container.kind === 215 /* FunctionExpression */) { - rangeFacts |= 16 /* UsesThisInFunction */; - } - } - return errors2; - function visit(node2) { - if (errors2) { - return true; - } - if (isDeclaration(node2)) { - const declaringNode = node2.kind === 257 /* VariableDeclaration */ ? node2.parent.parent : node2; - if (hasSyntacticModifier(declaringNode, 1 /* Export */)) { - (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractExportedEntity)); - return true; - } - } - switch (node2.kind) { - case 269 /* ImportDeclaration */: - (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractImport)); - return true; - case 274 /* ExportAssignment */: - (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractExportedEntity)); - return true; - case 106 /* SuperKeyword */: - if (node2.parent.kind === 210 /* CallExpression */) { - const containingClass2 = getContainingClass(node2); - if (containingClass2 === void 0 || containingClass2.pos < span.start || containingClass2.end >= span.start + span.length) { - (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractSuper)); - return true; - } - } else { - rangeFacts |= 8 /* UsesThis */; - thisNode = node2; - } - break; - case 216 /* ArrowFunction */: - forEachChild(node2, function check(n) { - if (isThis(n)) { - rangeFacts |= 8 /* UsesThis */; - thisNode = node2; - } else if (isClassLike(n) || isFunctionLike(n) && !isArrowFunction(n)) { - return false; - } else { - forEachChild(n, check); - } - }); - case 260 /* ClassDeclaration */: - case 259 /* FunctionDeclaration */: - if (isSourceFile(node2.parent) && node2.parent.externalModuleIndicator === void 0) { - (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.functionWillNotBeVisibleInTheNewScope)); - } - case 228 /* ClassExpression */: - case 215 /* FunctionExpression */: - case 171 /* MethodDeclaration */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - return false; - } - const savedPermittedJumps = permittedJumps; - switch (node2.kind) { - case 242 /* IfStatement */: - permittedJumps &= ~4 /* Return */; - break; - case 255 /* TryStatement */: - permittedJumps = 0 /* None */; - break; - case 238 /* Block */: - if (node2.parent && node2.parent.kind === 255 /* TryStatement */ && node2.parent.finallyBlock === node2) { - permittedJumps = 4 /* Return */; - } - break; - case 293 /* DefaultClause */: - case 292 /* CaseClause */: - permittedJumps |= 1 /* Break */; - break; - default: - if (isIterationStatement( - node2, - /*lookInLabeledStatements*/ - false - )) { - permittedJumps |= 1 /* Break */ | 2 /* Continue */; - } - break; - } - switch (node2.kind) { - case 194 /* ThisType */: - case 108 /* ThisKeyword */: - rangeFacts |= 8 /* UsesThis */; - thisNode = node2; - break; - case 253 /* LabeledStatement */: { - const label = node2.label; - (seenLabels || (seenLabels = [])).push(label.escapedText); - forEachChild(node2, visit); - seenLabels.pop(); - break; - } - case 249 /* BreakStatement */: - case 248 /* ContinueStatement */: { - const label = node2.label; - if (label) { - if (!contains(seenLabels, label.escapedText)) { - (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractRangeContainingLabeledBreakOrContinueStatementWithTargetOutsideOfTheRange)); - } - } else { - if (!(permittedJumps & (node2.kind === 249 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) { - (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); - } - } - break; - } - case 220 /* AwaitExpression */: - rangeFacts |= 4 /* IsAsyncFunction */; - break; - case 226 /* YieldExpression */: - rangeFacts |= 2 /* IsGenerator */; - break; - case 250 /* ReturnStatement */: - if (permittedJumps & 4 /* Return */) { - rangeFacts |= 1 /* HasReturn */; - } else { - (errors2 || (errors2 = [])).push(createDiagnosticForNode(node2, Messages.cannotExtractRangeContainingConditionalReturnStatement)); - } - break; - default: - forEachChild(node2, visit); - break; - } - permittedJumps = savedPermittedJumps; - } - } - } - function getAdjustedSpanFromNodes(startNode2, endNode2, sourceFile) { - const start = startNode2.getStart(sourceFile); - let end = endNode2.getEnd(); - if (sourceFile.text.charCodeAt(end) === 59 /* semicolon */) { - end++; - } - return { start, length: end - start }; - } - function getStatementOrExpressionRange(node) { - if (isStatement(node)) { - return [node]; - } - if (isExpressionNode(node)) { - return isExpressionStatement(node.parent) ? [node.parent] : node; - } - if (isStringLiteralJsxAttribute(node)) { - return node; - } - return void 0; - } - function isScope(node) { - return isArrowFunction(node) ? isFunctionBody(node.body) : isFunctionLikeDeclaration(node) || isSourceFile(node) || isModuleBlock(node) || isClassLike(node); - } - function collectEnclosingScopes(range) { - let current = isReadonlyArray(range.range) ? first(range.range) : range.range; - if (range.facts & 8 /* UsesThis */ && !(range.facts & 16 /* UsesThisInFunction */)) { - const containingClass = getContainingClass(current); - if (containingClass) { - const containingFunction = findAncestor(current, isFunctionLikeDeclaration); - return containingFunction ? [containingFunction, containingClass] : [containingClass]; - } - } - const scopes = []; - while (true) { - current = current.parent; - if (current.kind === 166 /* Parameter */) { - current = findAncestor(current, (parent2) => isFunctionLikeDeclaration(parent2)).parent; - } - if (isScope(current)) { - scopes.push(current); - if (current.kind === 308 /* SourceFile */) { - return scopes; - } - } - } - } - function getFunctionExtractionAtIndex(targetRange, context, requestedChangesIndex) { - const { scopes, readsAndWrites: { target, usagesPerScope, functionErrorsPerScope, exposedVariableDeclarations } } = getPossibleExtractionsWorker(targetRange, context); - Debug.assert(!functionErrorsPerScope[requestedChangesIndex].length, "The extraction went missing? How?"); - context.cancellationToken.throwIfCancellationRequested(); - return extractFunctionInScope(target, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], exposedVariableDeclarations, targetRange, context); - } - function getConstantExtractionAtIndex(targetRange, context, requestedChangesIndex) { - const { scopes, readsAndWrites: { target, usagesPerScope, constantErrorsPerScope, exposedVariableDeclarations } } = getPossibleExtractionsWorker(targetRange, context); - Debug.assert(!constantErrorsPerScope[requestedChangesIndex].length, "The extraction went missing? How?"); - Debug.assert(exposedVariableDeclarations.length === 0, "Extract constant accepted a range containing a variable declaration?"); - context.cancellationToken.throwIfCancellationRequested(); - const expression = isExpression(target) ? target : target.statements[0].expression; - return extractConstantInScope(expression, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], targetRange.facts, context); - } - function getPossibleExtractions(targetRange, context) { - const { scopes, readsAndWrites: { functionErrorsPerScope, constantErrorsPerScope } } = getPossibleExtractionsWorker(targetRange, context); - const extractions = scopes.map((scope, i) => { - const functionDescriptionPart = getDescriptionForFunctionInScope(scope); - const constantDescriptionPart = getDescriptionForConstantInScope(scope); - const scopeDescription = isFunctionLikeDeclaration(scope) ? getDescriptionForFunctionLikeDeclaration(scope) : isClassLike(scope) ? getDescriptionForClassLikeDeclaration(scope) : getDescriptionForModuleLikeDeclaration(scope); - let functionDescription; - let constantDescription; - if (scopeDescription === 1 /* Global */) { - functionDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [functionDescriptionPart, "global"]); - constantDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [constantDescriptionPart, "global"]); - } else if (scopeDescription === 0 /* Module */) { - functionDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [functionDescriptionPart, "module"]); - constantDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1_scope), [constantDescriptionPart, "module"]); - } else { - functionDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1), [functionDescriptionPart, scopeDescription]); - constantDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_1), [constantDescriptionPart, scopeDescription]); - } - if (i === 0 && !isClassLike(scope)) { - constantDescription = formatStringFromArgs(getLocaleSpecificMessage(Diagnostics.Extract_to_0_in_enclosing_scope), [constantDescriptionPart]); - } - return { - functionExtraction: { - description: functionDescription, - errors: functionErrorsPerScope[i] - }, - constantExtraction: { - description: constantDescription, - errors: constantErrorsPerScope[i] - } - }; - }); - return extractions; - } - function getPossibleExtractionsWorker(targetRange, context) { - const { file: sourceFile } = context; - const scopes = collectEnclosingScopes(targetRange); - const enclosingTextRange = getEnclosingTextRange(targetRange, sourceFile); - const readsAndWrites = collectReadsAndWrites( - targetRange, - scopes, - enclosingTextRange, - sourceFile, - context.program.getTypeChecker(), - context.cancellationToken - ); - return { scopes, readsAndWrites }; - } - function getDescriptionForFunctionInScope(scope) { - return isFunctionLikeDeclaration(scope) ? "inner function" : isClassLike(scope) ? "method" : "function"; - } - function getDescriptionForConstantInScope(scope) { - return isClassLike(scope) ? "readonly field" : "constant"; - } - function getDescriptionForFunctionLikeDeclaration(scope) { - switch (scope.kind) { - case 173 /* Constructor */: - return "constructor"; - case 215 /* FunctionExpression */: - case 259 /* FunctionDeclaration */: - return scope.name ? `function '${scope.name.text}'` : ANONYMOUS; - case 216 /* ArrowFunction */: - return "arrow function"; - case 171 /* MethodDeclaration */: - return `method '${scope.name.getText()}'`; - case 174 /* GetAccessor */: - return `'get ${scope.name.getText()}'`; - case 175 /* SetAccessor */: - return `'set ${scope.name.getText()}'`; - default: - throw Debug.assertNever(scope, `Unexpected scope kind ${scope.kind}`); - } - } - function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 260 /* ClassDeclaration */ ? scope.name ? `class '${scope.name.text}'` : "anonymous class declaration" : scope.name ? `class expression '${scope.name.text}'` : "anonymous class expression"; - } - function getDescriptionForModuleLikeDeclaration(scope) { - return scope.kind === 265 /* ModuleBlock */ ? `namespace '${scope.parent.name.getText()}'` : scope.externalModuleIndicator ? 0 /* Module */ : 1 /* Global */; - } - function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParameterUsages, substitutions }, exposedVariableDeclarations, range, context) { - const checker = context.program.getTypeChecker(); - const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions()); - const importAdder = ts_codefix_exports.createImportAdder(context.file, context.program, context.preferences, context.host); - const file = scope.getSourceFile(); - const functionNameText = getUniqueName(isClassLike(scope) ? "newMethod" : "newFunction", file); - const isJS = isInJSFile(scope); - const functionName = factory.createIdentifier(functionNameText); - let returnType; - const parameters = []; - const callArguments = []; - let writes; - usagesInScope.forEach((usage, name) => { - let typeNode; - if (!isJS) { - let type = checker.getTypeOfSymbolAtLocation(usage.symbol, usage.node); - type = checker.getBaseTypeOfLiteralType(type); - typeNode = ts_codefix_exports.typeToAutoImportableTypeNode(checker, importAdder, type, scope, scriptTarget, 1 /* NoTruncation */); - } - const paramDecl = factory.createParameterDeclaration( - /*modifiers*/ - void 0, - /*dotDotDotToken*/ - void 0, - /*name*/ - name, - /*questionToken*/ - void 0, - typeNode - ); - parameters.push(paramDecl); - if (usage.usage === 2 /* Write */) { - (writes || (writes = [])).push(usage); - } - callArguments.push(factory.createIdentifier(name)); - }); - const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclaration(type) })); - const sortedTypeParametersAndDeclarations = typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder); - const typeParameters = sortedTypeParametersAndDeclarations.length === 0 ? void 0 : sortedTypeParametersAndDeclarations.map((t) => t.declaration); - const callTypeArguments = typeParameters !== void 0 ? typeParameters.map((decl) => factory.createTypeReferenceNode( - decl.name, - /*typeArguments*/ - void 0 - )) : void 0; - if (isExpression(node) && !isJS) { - const contextualType = checker.getContextualType(node); - returnType = checker.typeToTypeNode(contextualType, scope, 1 /* NoTruncation */); - } - const { body, returnValueProperty } = transformFunctionBody(node, exposedVariableDeclarations, writes, substitutions, !!(range.facts & 1 /* HasReturn */)); - suppressLeadingAndTrailingTrivia(body); - let newFunction; - const callThis = !!(range.facts & 16 /* UsesThisInFunction */); - if (isClassLike(scope)) { - const modifiers = isJS ? [] : [factory.createModifier(121 /* PrivateKeyword */)]; - if (range.facts & 32 /* InStaticRegion */) { - modifiers.push(factory.createModifier(124 /* StaticKeyword */)); - } - if (range.facts & 4 /* IsAsyncFunction */) { - modifiers.push(factory.createModifier(132 /* AsyncKeyword */)); - } - newFunction = factory.createMethodDeclaration( - modifiers.length ? modifiers : void 0, - range.facts & 2 /* IsGenerator */ ? factory.createToken(41 /* AsteriskToken */) : void 0, - functionName, - /*questionToken*/ - void 0, - typeParameters, - parameters, - returnType, - body - ); - } else { - if (callThis) { - parameters.unshift( - factory.createParameterDeclaration( - /*modifiers*/ - void 0, - /*dotDotDotToken*/ - void 0, - /*name*/ - "this", - /*questionToken*/ - void 0, - checker.typeToTypeNode( - checker.getTypeAtLocation(range.thisNode), - scope, - 1 /* NoTruncation */ - ), - /*initializer*/ - void 0 - ) - ); - } - newFunction = factory.createFunctionDeclaration( - range.facts & 4 /* IsAsyncFunction */ ? [factory.createToken(132 /* AsyncKeyword */)] : void 0, - range.facts & 2 /* IsGenerator */ ? factory.createToken(41 /* AsteriskToken */) : void 0, - functionName, - typeParameters, - parameters, - returnType, - body - ); - } - const changeTracker = ts_textChanges_exports.ChangeTracker.fromContext(context); - const minInsertionPos = (isReadonlyArray(range.range) ? last(range.range) : range.range).end; - const nodeToInsertBefore = getNodeToInsertFunctionBefore(minInsertionPos, scope); - if (nodeToInsertBefore) { - changeTracker.insertNodeBefore( - context.file, - nodeToInsertBefore, - newFunction, - /*blankLineBetween*/ - true - ); - } else { - changeTracker.insertNodeAtEndOfScope(context.file, scope, newFunction); - } - importAdder.writeFixes(changeTracker); - const newNodes = []; - const called = getCalledExpression(scope, range, functionNameText); - if (callThis) { - callArguments.unshift(factory.createIdentifier("this")); - } - let call = factory.createCallExpression( - callThis ? factory.createPropertyAccessExpression( - called, - "call" - ) : called, - callTypeArguments, - // Note that no attempt is made to take advantage of type argument inference - callArguments - ); - if (range.facts & 2 /* IsGenerator */) { - call = factory.createYieldExpression(factory.createToken(41 /* AsteriskToken */), call); - } - if (range.facts & 4 /* IsAsyncFunction */) { - call = factory.createAwaitExpression(call); - } - if (isInJSXContent(node)) { - call = factory.createJsxExpression( - /*dotDotDotToken*/ - void 0, - call - ); - } - if (exposedVariableDeclarations.length && !writes) { - Debug.assert(!returnValueProperty, "Expected no returnValueProperty"); - Debug.assert(!(range.facts & 1 /* HasReturn */), "Expected RangeFacts.HasReturn flag to be unset"); - if (exposedVariableDeclarations.length === 1) { - const variableDeclaration = exposedVariableDeclarations[0]; - newNodes.push(factory.createVariableStatement( - /*modifiers*/ - void 0, - factory.createVariableDeclarationList( - [factory.createVariableDeclaration( - getSynthesizedDeepClone(variableDeclaration.name), - /*exclamationToken*/ - void 0, - /*type*/ - getSynthesizedDeepClone(variableDeclaration.type), - /*initializer*/ - call - )], - variableDeclaration.parent.flags - ) - )); - } else { - const bindingElements = []; - const typeElements = []; - let commonNodeFlags = exposedVariableDeclarations[0].parent.flags; - let sawExplicitType = false; - for (const variableDeclaration of exposedVariableDeclarations) { - bindingElements.push(factory.createBindingElement( - /*dotDotDotToken*/ - void 0, - /*propertyName*/ - void 0, - /*name*/ - getSynthesizedDeepClone(variableDeclaration.name) - )); - const variableType = checker.typeToTypeNode( - checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(variableDeclaration)), - scope, - 1 /* NoTruncation */ - ); - typeElements.push(factory.createPropertySignature( - /*modifiers*/ - void 0, - /*name*/ - variableDeclaration.symbol.name, - /*questionToken*/ - void 0, - /*type*/ - variableType - )); - sawExplicitType = sawExplicitType || variableDeclaration.type !== void 0; - commonNodeFlags = commonNodeFlags & variableDeclaration.parent.flags; - } - const typeLiteral = sawExplicitType ? factory.createTypeLiteralNode(typeElements) : void 0; - if (typeLiteral) { - setEmitFlags(typeLiteral, 1 /* SingleLine */); - } - newNodes.push(factory.createVariableStatement( - /*modifiers*/ - void 0, - factory.createVariableDeclarationList( - [factory.createVariableDeclaration( - factory.createObjectBindingPattern(bindingElements), - /*exclamationToken*/ - void 0, - /*type*/ - typeLiteral, - /*initializer*/ - call - )], - commonNodeFlags - ) - )); - } - } else if (exposedVariableDeclarations.length || writes) { - if (exposedVariableDeclarations.length) { - for (const variableDeclaration of exposedVariableDeclarations) { - let flags = variableDeclaration.parent.flags; - if (flags & 2 /* Const */) { - flags = flags & ~2 /* Const */ | 1 /* Let */; - } - newNodes.push(factory.createVariableStatement( - /*modifiers*/ - void 0, - factory.createVariableDeclarationList( - [factory.createVariableDeclaration( - variableDeclaration.symbol.name, - /*exclamationToken*/ - void 0, - getTypeDeepCloneUnionUndefined(variableDeclaration.type) - )], - flags - ) - )); - } - } - if (returnValueProperty) { - newNodes.push(factory.createVariableStatement( - /*modifiers*/ - void 0, - factory.createVariableDeclarationList( - [factory.createVariableDeclaration( - returnValueProperty, - /*exclamationToken*/ - void 0, - getTypeDeepCloneUnionUndefined(returnType) - )], - 1 /* Let */ - ) - )); - } - const assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); - if (returnValueProperty) { - assignments.unshift(factory.createShorthandPropertyAssignment(returnValueProperty)); - } - if (assignments.length === 1) { - Debug.assert(!returnValueProperty, "Shouldn't have returnValueProperty here"); - newNodes.push(factory.createExpressionStatement(factory.createAssignment(assignments[0].name, call))); - if (range.facts & 1 /* HasReturn */) { - newNodes.push(factory.createReturnStatement()); - } - } else { - newNodes.push(factory.createExpressionStatement(factory.createAssignment(factory.createObjectLiteralExpression(assignments), call))); - if (returnValueProperty) { - newNodes.push(factory.createReturnStatement(factory.createIdentifier(returnValueProperty))); - } - } - } else { - if (range.facts & 1 /* HasReturn */) { - newNodes.push(factory.createReturnStatement(call)); - } else if (isReadonlyArray(range.range)) { - newNodes.push(factory.createExpressionStatement(call)); - } else { - newNodes.push(call); - } - } - if (isReadonlyArray(range.range)) { - changeTracker.replaceNodeRangeWithNodes(context.file, first(range.range), last(range.range), newNodes); - } else { - changeTracker.replaceNodeWithNodes(context.file, range.range, newNodes); - } - const edits = changeTracker.getChanges(); - const renameRange = isReadonlyArray(range.range) ? first(range.range) : range.range; - const renameFilename = renameRange.getSourceFile().fileName; - const renameLocation = getRenameLocation( - edits, - renameFilename, - functionNameText, - /*isDeclaredBeforeUse*/ - false - ); - return { renameFilename, renameLocation, edits }; - function getTypeDeepCloneUnionUndefined(typeNode) { - if (typeNode === void 0) { - return void 0; - } - const clone2 = getSynthesizedDeepClone(typeNode); - let withoutParens = clone2; - while (isParenthesizedTypeNode(withoutParens)) { - withoutParens = withoutParens.type; - } - return isUnionTypeNode(withoutParens) && find(withoutParens.types, (t) => t.kind === 155 /* UndefinedKeyword */) ? clone2 : factory.createUnionTypeNode([clone2, factory.createKeywordTypeNode(155 /* UndefinedKeyword */)]); - } - } - function extractConstantInScope(node, scope, { substitutions }, rangeFacts, context) { - const checker = context.program.getTypeChecker(); - const file = scope.getSourceFile(); - const localNameText = isPropertyAccessExpression(node) && !isClassLike(scope) && !checker.resolveName( - node.name.text, - node, - 111551 /* Value */, - /*excludeGlobals*/ - false - ) && !isPrivateIdentifier(node.name) && !identifierToKeywordKind(node.name) ? node.name.text : getUniqueName(isClassLike(scope) ? "newProperty" : "newLocal", file); - const isJS = isInJSFile(scope); - let variableType = isJS || !checker.isContextSensitive(node) ? void 0 : checker.typeToTypeNode(checker.getContextualType(node), scope, 1 /* NoTruncation */); - let initializer = transformConstantInitializer(skipParentheses(node), substitutions); - ({ variableType, initializer } = transformFunctionInitializerAndType(variableType, initializer)); - suppressLeadingAndTrailingTrivia(initializer); - const changeTracker = ts_textChanges_exports.ChangeTracker.fromContext(context); - if (isClassLike(scope)) { - Debug.assert(!isJS, "Cannot extract to a JS class"); - const modifiers = []; - modifiers.push(factory.createModifier(121 /* PrivateKeyword */)); - if (rangeFacts & 32 /* InStaticRegion */) { - modifiers.push(factory.createModifier(124 /* StaticKeyword */)); - } - modifiers.push(factory.createModifier(146 /* ReadonlyKeyword */)); - const newVariable = factory.createPropertyDeclaration( - modifiers, - localNameText, - /*questionToken*/ - void 0, - variableType, - initializer - ); - let localReference = factory.createPropertyAccessExpression( - rangeFacts & 32 /* InStaticRegion */ ? factory.createIdentifier(scope.name.getText()) : factory.createThis(), - factory.createIdentifier(localNameText) - ); - if (isInJSXContent(node)) { - localReference = factory.createJsxExpression( - /*dotDotDotToken*/ - void 0, - localReference - ); - } - const maxInsertionPos = node.pos; - const nodeToInsertBefore = getNodeToInsertPropertyBefore(maxInsertionPos, scope); - changeTracker.insertNodeBefore( - context.file, - nodeToInsertBefore, - newVariable, - /*blankLineBetween*/ - true - ); - changeTracker.replaceNode(context.file, node, localReference); - } else { - const newVariableDeclaration = factory.createVariableDeclaration( - localNameText, - /*exclamationToken*/ - void 0, - variableType, - initializer - ); - const oldVariableDeclaration = getContainingVariableDeclarationIfInList(node, scope); - if (oldVariableDeclaration) { - changeTracker.insertNodeBefore(context.file, oldVariableDeclaration, newVariableDeclaration); - const localReference = factory.createIdentifier(localNameText); - changeTracker.replaceNode(context.file, node, localReference); - } else if (node.parent.kind === 241 /* ExpressionStatement */ && scope === findAncestor(node, isScope)) { - const newVariableStatement = factory.createVariableStatement( - /*modifiers*/ - void 0, - factory.createVariableDeclarationList([newVariableDeclaration], 2 /* Const */) - ); - changeTracker.replaceNode(context.file, node.parent, newVariableStatement); - } else { - const newVariableStatement = factory.createVariableStatement( - /*modifiers*/ - void 0, - factory.createVariableDeclarationList([newVariableDeclaration], 2 /* Const */) - ); - const nodeToInsertBefore = getNodeToInsertConstantBefore(node, scope); - if (nodeToInsertBefore.pos === 0) { - changeTracker.insertNodeAtTopOfFile( - context.file, - newVariableStatement, - /*blankLineBetween*/ - false - ); - } else { - changeTracker.insertNodeBefore( - context.file, - nodeToInsertBefore, - newVariableStatement, - /*blankLineBetween*/ - false - ); - } - if (node.parent.kind === 241 /* ExpressionStatement */) { - changeTracker.delete(context.file, node.parent); - } else { - let localReference = factory.createIdentifier(localNameText); - if (isInJSXContent(node)) { - localReference = factory.createJsxExpression( - /*dotDotDotToken*/ - void 0, - localReference - ); - } - changeTracker.replaceNode(context.file, node, localReference); - } - } - } - const edits = changeTracker.getChanges(); - const renameFilename = node.getSourceFile().fileName; - const renameLocation = getRenameLocation( - edits, - renameFilename, - localNameText, - /*isDeclaredBeforeUse*/ - true - ); - return { renameFilename, renameLocation, edits }; - function transformFunctionInitializerAndType(variableType2, initializer2) { - if (variableType2 === void 0) - return { variableType: variableType2, initializer: initializer2 }; - if (!isFunctionExpression(initializer2) && !isArrowFunction(initializer2) || !!initializer2.typeParameters) - return { variableType: variableType2, initializer: initializer2 }; - const functionType = checker.getTypeAtLocation(node); - const functionSignature = singleOrUndefined(checker.getSignaturesOfType(functionType, 0 /* Call */)); - if (!functionSignature) - return { variableType: variableType2, initializer: initializer2 }; - if (!!functionSignature.getTypeParameters()) - return { variableType: variableType2, initializer: initializer2 }; - const parameters = []; - let hasAny = false; - for (const p of initializer2.parameters) { - if (p.type) { - parameters.push(p); - } else { - const paramType = checker.getTypeAtLocation(p); - if (paramType === checker.getAnyType()) - hasAny = true; - parameters.push(factory.updateParameterDeclaration( - p, - p.modifiers, - p.dotDotDotToken, - p.name, - p.questionToken, - p.type || checker.typeToTypeNode(paramType, scope, 1 /* NoTruncation */), - p.initializer - )); - } - } - if (hasAny) - return { variableType: variableType2, initializer: initializer2 }; - variableType2 = void 0; - if (isArrowFunction(initializer2)) { - initializer2 = factory.updateArrowFunction( - initializer2, - canHaveModifiers(node) ? getModifiers(node) : void 0, - initializer2.typeParameters, - parameters, - initializer2.type || checker.typeToTypeNode(functionSignature.getReturnType(), scope, 1 /* NoTruncation */), - initializer2.equalsGreaterThanToken, - initializer2.body - ); - } else { - if (functionSignature && !!functionSignature.thisParameter) { - const firstParameter = firstOrUndefined(parameters); - if (!firstParameter || isIdentifier(firstParameter.name) && firstParameter.name.escapedText !== "this") { - const thisType = checker.getTypeOfSymbolAtLocation(functionSignature.thisParameter, node); - parameters.splice(0, 0, factory.createParameterDeclaration( - /* modifiers */ - void 0, - /* dotDotDotToken */ - void 0, - "this", - /* questionToken */ - void 0, - checker.typeToTypeNode(thisType, scope, 1 /* NoTruncation */) - )); - } - } - initializer2 = factory.updateFunctionExpression( - initializer2, - canHaveModifiers(node) ? getModifiers(node) : void 0, - initializer2.asteriskToken, - initializer2.name, - initializer2.typeParameters, - parameters, - initializer2.type || checker.typeToTypeNode(functionSignature.getReturnType(), scope, 1 /* NoTruncation */), - initializer2.body - ); - } - return { variableType: variableType2, initializer: initializer2 }; - } - } - function getContainingVariableDeclarationIfInList(node, scope) { - let prevNode; - while (node !== void 0 && node !== scope) { - if (isVariableDeclaration(node) && node.initializer === prevNode && isVariableDeclarationList(node.parent) && node.parent.declarations.length > 1) { - return node; - } - prevNode = node; - node = node.parent; - } - } - function getFirstDeclaration(type) { - let firstDeclaration; - const symbol = type.symbol; - if (symbol && symbol.declarations) { - for (const declaration of symbol.declarations) { - if (firstDeclaration === void 0 || declaration.pos < firstDeclaration.pos) { - firstDeclaration = declaration; - } - } - } - return firstDeclaration; - } - function compareTypesByDeclarationOrder({ type: type1, declaration: declaration1 }, { type: type2, declaration: declaration2 }) { - return compareProperties(declaration1, declaration2, "pos", compareValues) || compareStringsCaseSensitive( - type1.symbol ? type1.symbol.getName() : "", - type2.symbol ? type2.symbol.getName() : "" - ) || compareValues(type1.id, type2.id); - } - function getCalledExpression(scope, range, functionNameText) { - const functionReference = factory.createIdentifier(functionNameText); - if (isClassLike(scope)) { - const lhs = range.facts & 32 /* InStaticRegion */ ? factory.createIdentifier(scope.name.text) : factory.createThis(); - return factory.createPropertyAccessExpression(lhs, functionReference); - } else { - return functionReference; - } - } - function transformFunctionBody(body, exposedVariableDeclarations, writes, substitutions, hasReturn2) { - const hasWritesOrVariableDeclarations = writes !== void 0 || exposedVariableDeclarations.length > 0; - if (isBlock(body) && !hasWritesOrVariableDeclarations && substitutions.size === 0) { - return { body: factory.createBlock( - body.statements, - /*multLine*/ - true - ), returnValueProperty: void 0 }; - } - let returnValueProperty; - let ignoreReturns = false; - const statements = factory.createNodeArray(isBlock(body) ? body.statements.slice(0) : [isStatement(body) ? body : factory.createReturnStatement(skipParentheses(body))]); - if (hasWritesOrVariableDeclarations || substitutions.size) { - const rewrittenStatements = visitNodes2(statements, visitor, isStatement).slice(); - if (hasWritesOrVariableDeclarations && !hasReturn2 && isStatement(body)) { - const assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); - if (assignments.length === 1) { - rewrittenStatements.push(factory.createReturnStatement(assignments[0].name)); - } else { - rewrittenStatements.push(factory.createReturnStatement(factory.createObjectLiteralExpression(assignments))); - } - } - return { body: factory.createBlock( - rewrittenStatements, - /*multiLine*/ - true - ), returnValueProperty }; - } else { - return { body: factory.createBlock( - statements, - /*multiLine*/ - true - ), returnValueProperty: void 0 }; - } - function visitor(node) { - if (!ignoreReturns && isReturnStatement(node) && hasWritesOrVariableDeclarations) { - const assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes); - if (node.expression) { - if (!returnValueProperty) { - returnValueProperty = "__return"; - } - assignments.unshift(factory.createPropertyAssignment(returnValueProperty, visitNode(node.expression, visitor, isExpression))); - } - if (assignments.length === 1) { - return factory.createReturnStatement(assignments[0].name); - } else { - return factory.createReturnStatement(factory.createObjectLiteralExpression(assignments)); - } - } else { - const oldIgnoreReturns = ignoreReturns; - ignoreReturns = ignoreReturns || isFunctionLikeDeclaration(node) || isClassLike(node); - const substitution = substitutions.get(getNodeId(node).toString()); - const result = substitution ? getSynthesizedDeepClone(substitution) : visitEachChild(node, visitor, nullTransformationContext); - ignoreReturns = oldIgnoreReturns; - return result; - } - } - } - function transformConstantInitializer(initializer, substitutions) { - return substitutions.size ? visitor(initializer) : initializer; - function visitor(node) { - const substitution = substitutions.get(getNodeId(node).toString()); - return substitution ? getSynthesizedDeepClone(substitution) : visitEachChild(node, visitor, nullTransformationContext); - } - } - function getStatementsOrClassElements(scope) { - if (isFunctionLikeDeclaration(scope)) { - const body = scope.body; - if (isBlock(body)) { - return body.statements; - } - } else if (isModuleBlock(scope) || isSourceFile(scope)) { - return scope.statements; - } else if (isClassLike(scope)) { - return scope.members; - } else { - assertType(scope); - } - return emptyArray; - } - function getNodeToInsertFunctionBefore(minPos, scope) { - return find(getStatementsOrClassElements(scope), (child) => child.pos >= minPos && isFunctionLikeDeclaration(child) && !isConstructorDeclaration(child)); - } - function getNodeToInsertPropertyBefore(maxPos, scope) { - const members = scope.members; - Debug.assert(members.length > 0, "Found no members"); - let prevMember; - let allProperties = true; - for (const member of members) { - if (member.pos > maxPos) { - return prevMember || members[0]; - } - if (allProperties && !isPropertyDeclaration(member)) { - if (prevMember !== void 0) { - return member; - } - allProperties = false; - } - prevMember = member; - } - if (prevMember === void 0) - return Debug.fail(); - return prevMember; - } - function getNodeToInsertConstantBefore(node, scope) { - Debug.assert(!isClassLike(scope)); - let prevScope; - for (let curr = node; curr !== scope; curr = curr.parent) { - if (isScope(curr)) { - prevScope = curr; - } - } - for (let curr = (prevScope || node).parent; ; curr = curr.parent) { - if (isBlockLike(curr)) { - let prevStatement; - for (const statement of curr.statements) { - if (statement.pos > node.pos) { - break; - } - prevStatement = statement; - } - if (!prevStatement && isCaseClause(curr)) { - Debug.assert(isSwitchStatement(curr.parent.parent), "Grandparent isn't a switch statement"); - return curr.parent.parent; - } - return Debug.checkDefined(prevStatement, "prevStatement failed to get set"); - } - Debug.assert(curr !== scope, "Didn't encounter a block-like before encountering scope"); - } - } - function getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes) { - const variableAssignments = map(exposedVariableDeclarations, (v) => factory.createShorthandPropertyAssignment(v.symbol.name)); - const writeAssignments = map(writes, (w) => factory.createShorthandPropertyAssignment(w.symbol.name)); - return variableAssignments === void 0 ? writeAssignments : writeAssignments === void 0 ? variableAssignments : variableAssignments.concat(writeAssignments); - } - function isReadonlyArray(v) { - return isArray(v); - } - function getEnclosingTextRange(targetRange, sourceFile) { - return isReadonlyArray(targetRange.range) ? { pos: first(targetRange.range).getStart(sourceFile), end: last(targetRange.range).getEnd() } : targetRange.range; - } - function collectReadsAndWrites(targetRange, scopes, enclosingTextRange, sourceFile, checker, cancellationToken) { - const allTypeParameterUsages = /* @__PURE__ */ new Map(); - const usagesPerScope = []; - const substitutionsPerScope = []; - const functionErrorsPerScope = []; - const constantErrorsPerScope = []; - const visibleDeclarationsInExtractedRange = []; - const exposedVariableSymbolSet = /* @__PURE__ */ new Map(); - const exposedVariableDeclarations = []; - let firstExposedNonVariableDeclaration; - const expression = !isReadonlyArray(targetRange.range) ? targetRange.range : targetRange.range.length === 1 && isExpressionStatement(targetRange.range[0]) ? targetRange.range[0].expression : void 0; - let expressionDiagnostic; - if (expression === void 0) { - const statements = targetRange.range; - const start = first(statements).getStart(); - const end = last(statements).end; - expressionDiagnostic = createFileDiagnostic(sourceFile, start, end - start, Messages.expressionExpected); - } else if (checker.getTypeAtLocation(expression).flags & (16384 /* Void */ | 131072 /* Never */)) { - expressionDiagnostic = createDiagnosticForNode(expression, Messages.uselessConstantType); - } - for (const scope of scopes) { - usagesPerScope.push({ usages: /* @__PURE__ */ new Map(), typeParameterUsages: /* @__PURE__ */ new Map(), substitutions: /* @__PURE__ */ new Map() }); - substitutionsPerScope.push(/* @__PURE__ */ new Map()); - functionErrorsPerScope.push([]); - const constantErrors = []; - if (expressionDiagnostic) { - constantErrors.push(expressionDiagnostic); - } - if (isClassLike(scope) && isInJSFile(scope)) { - constantErrors.push(createDiagnosticForNode(scope, Messages.cannotExtractToJSClass)); - } - if (isArrowFunction(scope) && !isBlock(scope.body)) { - constantErrors.push(createDiagnosticForNode(scope, Messages.cannotExtractToExpressionArrowFunction)); - } - constantErrorsPerScope.push(constantErrors); - } - const seenUsages = /* @__PURE__ */ new Map(); - const target = isReadonlyArray(targetRange.range) ? factory.createBlock(targetRange.range) : targetRange.range; - const unmodifiedNode = isReadonlyArray(targetRange.range) ? first(targetRange.range) : targetRange.range; - const inGenericContext = isInGenericContext(unmodifiedNode); - collectUsages(target); - if (inGenericContext && !isReadonlyArray(targetRange.range) && !isJsxAttribute(targetRange.range)) { - const contextualType = checker.getContextualType(targetRange.range); - recordTypeParameterUsages(contextualType); - } - if (allTypeParameterUsages.size > 0) { - const seenTypeParameterUsages = /* @__PURE__ */ new Map(); - let i = 0; - for (let curr = unmodifiedNode; curr !== void 0 && i < scopes.length; curr = curr.parent) { - if (curr === scopes[i]) { - seenTypeParameterUsages.forEach((typeParameter, id) => { - usagesPerScope[i].typeParameterUsages.set(id, typeParameter); - }); - i++; - } - if (isDeclarationWithTypeParameters(curr)) { - for (const typeParameterDecl of getEffectiveTypeParameterDeclarations(curr)) { - const typeParameter = checker.getTypeAtLocation(typeParameterDecl); - if (allTypeParameterUsages.has(typeParameter.id.toString())) { - seenTypeParameterUsages.set(typeParameter.id.toString(), typeParameter); - } - } - } - } - Debug.assert(i === scopes.length, "Should have iterated all scopes"); - } - if (visibleDeclarationsInExtractedRange.length) { - const containingLexicalScopeOfExtraction = isBlockScope(scopes[0], scopes[0].parent) ? scopes[0] : getEnclosingBlockScopeContainer(scopes[0]); - forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations); - } - for (let i = 0; i < scopes.length; i++) { - const scopeUsages = usagesPerScope[i]; - if (i > 0 && (scopeUsages.usages.size > 0 || scopeUsages.typeParameterUsages.size > 0)) { - const errorNode = isReadonlyArray(targetRange.range) ? targetRange.range[0] : targetRange.range; - constantErrorsPerScope[i].push(createDiagnosticForNode(errorNode, Messages.cannotAccessVariablesFromNestedScopes)); - } - if (targetRange.facts & 16 /* UsesThisInFunction */ && isClassLike(scopes[i])) { - functionErrorsPerScope[i].push(createDiagnosticForNode(targetRange.thisNode, Messages.cannotExtractFunctionsContainingThisToMethod)); - } - let hasWrite = false; - let readonlyClassPropertyWrite; - usagesPerScope[i].usages.forEach((value) => { - if (value.usage === 2 /* Write */) { - hasWrite = true; - if (value.symbol.flags & 106500 /* ClassMember */ && value.symbol.valueDeclaration && hasEffectiveModifier(value.symbol.valueDeclaration, 64 /* Readonly */)) { - readonlyClassPropertyWrite = value.symbol.valueDeclaration; - } - } - }); - Debug.assert(isReadonlyArray(targetRange.range) || exposedVariableDeclarations.length === 0, "No variable declarations expected if something was extracted"); - if (hasWrite && !isReadonlyArray(targetRange.range)) { - const diag2 = createDiagnosticForNode(targetRange.range, Messages.cannotWriteInExpression); - functionErrorsPerScope[i].push(diag2); - constantErrorsPerScope[i].push(diag2); - } else if (readonlyClassPropertyWrite && i > 0) { - const diag2 = createDiagnosticForNode(readonlyClassPropertyWrite, Messages.cannotExtractReadonlyPropertyInitializerOutsideConstructor); - functionErrorsPerScope[i].push(diag2); - constantErrorsPerScope[i].push(diag2); - } else if (firstExposedNonVariableDeclaration) { - const diag2 = createDiagnosticForNode(firstExposedNonVariableDeclaration, Messages.cannotExtractExportedEntity); - functionErrorsPerScope[i].push(diag2); - constantErrorsPerScope[i].push(diag2); - } - } - return { target, usagesPerScope, functionErrorsPerScope, constantErrorsPerScope, exposedVariableDeclarations }; - function isInGenericContext(node) { - return !!findAncestor(node, (n) => isDeclarationWithTypeParameters(n) && getEffectiveTypeParameterDeclarations(n).length !== 0); - } - function recordTypeParameterUsages(type) { - const symbolWalker = checker.getSymbolWalker(() => (cancellationToken.throwIfCancellationRequested(), true)); - const { visitedTypes } = symbolWalker.walkType(type); - for (const visitedType of visitedTypes) { - if (visitedType.isTypeParameter()) { - allTypeParameterUsages.set(visitedType.id.toString(), visitedType); - } - } - } - function collectUsages(node, valueUsage = 1 /* Read */) { - if (inGenericContext) { - const type = checker.getTypeAtLocation(node); - recordTypeParameterUsages(type); - } - if (isDeclaration(node) && node.symbol) { - visibleDeclarationsInExtractedRange.push(node); - } - if (isAssignmentExpression(node)) { - collectUsages(node.left, 2 /* Write */); - collectUsages(node.right); - } else if (isUnaryExpressionWithWrite(node)) { - collectUsages(node.operand, 2 /* Write */); - } else if (isPropertyAccessExpression(node) || isElementAccessExpression(node)) { - forEachChild(node, collectUsages); - } else if (isIdentifier(node)) { - if (!node.parent) { - return; - } - if (isQualifiedName(node.parent) && node !== node.parent.left) { - return; - } - if (isPropertyAccessExpression(node.parent) && node !== node.parent.expression) { - return; - } - recordUsage( - node, - valueUsage, - /*isTypeNode*/ - isPartOfTypeNode(node) - ); - } else { - forEachChild(node, collectUsages); - } - } - function recordUsage(n, usage, isTypeNode2) { - const symbolId = recordUsagebySymbol(n, usage, isTypeNode2); - if (symbolId) { - for (let i = 0; i < scopes.length; i++) { - const substitution = substitutionsPerScope[i].get(symbolId); - if (substitution) { - usagesPerScope[i].substitutions.set(getNodeId(n).toString(), substitution); - } - } - } - } - function recordUsagebySymbol(identifier, usage, isTypeName) { - const symbol = getSymbolReferencedByIdentifier(identifier); - if (!symbol) { - return void 0; - } - const symbolId = getSymbolId(symbol).toString(); - const lastUsage = seenUsages.get(symbolId); - if (lastUsage && lastUsage >= usage) { - return symbolId; - } - seenUsages.set(symbolId, usage); - if (lastUsage) { - for (const perScope of usagesPerScope) { - const prevEntry = perScope.usages.get(identifier.text); - if (prevEntry) { - perScope.usages.set(identifier.text, { usage, symbol, node: identifier }); - } - } - return symbolId; - } - const decls = symbol.getDeclarations(); - const declInFile = decls && find(decls, (d) => d.getSourceFile() === sourceFile); - if (!declInFile) { - return void 0; - } - if (rangeContainsStartEnd(enclosingTextRange, declInFile.getStart(), declInFile.end)) { - return void 0; - } - if (targetRange.facts & 2 /* IsGenerator */ && usage === 2 /* Write */) { - const diag2 = createDiagnosticForNode(identifier, Messages.cannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators); - for (const errors of functionErrorsPerScope) { - errors.push(diag2); - } - for (const errors of constantErrorsPerScope) { - errors.push(diag2); - } - } - for (let i = 0; i < scopes.length; i++) { - const scope = scopes[i]; - const resolvedSymbol = checker.resolveName( - symbol.name, - scope, - symbol.flags, - /*excludeGlobals*/ - false - ); - if (resolvedSymbol === symbol) { - continue; - } - if (!substitutionsPerScope[i].has(symbolId)) { - const substitution = tryReplaceWithQualifiedNameOrPropertyAccess(symbol.exportSymbol || symbol, scope, isTypeName); - if (substitution) { - substitutionsPerScope[i].set(symbolId, substitution); - } else if (isTypeName) { - if (!(symbol.flags & 262144 /* TypeParameter */)) { - const diag2 = createDiagnosticForNode(identifier, Messages.typeWillNotBeVisibleInTheNewScope); - functionErrorsPerScope[i].push(diag2); - constantErrorsPerScope[i].push(diag2); - } - } else { - usagesPerScope[i].usages.set(identifier.text, { usage, symbol, node: identifier }); - } - } - } - return symbolId; - } - function checkForUsedDeclarations(node) { - if (node === targetRange.range || isReadonlyArray(targetRange.range) && targetRange.range.indexOf(node) >= 0) { - return; - } - const sym = isIdentifier(node) ? getSymbolReferencedByIdentifier(node) : checker.getSymbolAtLocation(node); - if (sym) { - const decl = find(visibleDeclarationsInExtractedRange, (d) => d.symbol === sym); - if (decl) { - if (isVariableDeclaration(decl)) { - const idString = decl.symbol.id.toString(); - if (!exposedVariableSymbolSet.has(idString)) { - exposedVariableDeclarations.push(decl); - exposedVariableSymbolSet.set(idString, true); - } - } else { - firstExposedNonVariableDeclaration = firstExposedNonVariableDeclaration || decl; - } - } - } - forEachChild(node, checkForUsedDeclarations); - } - function getSymbolReferencedByIdentifier(identifier) { - return identifier.parent && isShorthandPropertyAssignment(identifier.parent) && identifier.parent.name === identifier ? checker.getShorthandAssignmentValueSymbol(identifier.parent) : checker.getSymbolAtLocation(identifier); - } - function tryReplaceWithQualifiedNameOrPropertyAccess(symbol, scopeDecl, isTypeNode2) { - if (!symbol) { - return void 0; - } - const decls = symbol.getDeclarations(); - if (decls && decls.some((d) => d.parent === scopeDecl)) { - return factory.createIdentifier(symbol.name); - } - const prefix = tryReplaceWithQualifiedNameOrPropertyAccess(symbol.parent, scopeDecl, isTypeNode2); - if (prefix === void 0) { - return void 0; - } - return isTypeNode2 ? factory.createQualifiedName(prefix, factory.createIdentifier(symbol.name)) : factory.createPropertyAccessExpression(prefix, symbol.name); - } - } - function getExtractableParent(node) { - return findAncestor(node, (node2) => node2.parent && isExtractableExpression(node2) && !isBinaryExpression(node2.parent)); - } - function isExtractableExpression(node) { - const { parent: parent2 } = node; - switch (parent2.kind) { - case 302 /* EnumMember */: - return false; - } - switch (node.kind) { - case 10 /* StringLiteral */: - return parent2.kind !== 269 /* ImportDeclaration */ && parent2.kind !== 273 /* ImportSpecifier */; - case 227 /* SpreadElement */: - case 203 /* ObjectBindingPattern */: - case 205 /* BindingElement */: - return false; - case 79 /* Identifier */: - return parent2.kind !== 205 /* BindingElement */ && parent2.kind !== 273 /* ImportSpecifier */ && parent2.kind !== 278 /* ExportSpecifier */; - } - return true; - } - function isBlockLike(node) { - switch (node.kind) { - case 238 /* Block */: - case 308 /* SourceFile */: - case 265 /* ModuleBlock */: - case 292 /* CaseClause */: - return true; - default: - return false; - } - } - function isInJSXContent(node) { - return isStringLiteralJsxAttribute(node) || (isJsxElement(node) || isJsxSelfClosingElement(node) || isJsxFragment(node)) && (isJsxElement(node.parent) || isJsxFragment(node.parent)); - } - function isStringLiteralJsxAttribute(node) { - return isStringLiteral(node) && node.parent && isJsxAttribute(node.parent); - } - var refactorName11, extractConstantAction, extractFunctionAction, Messages, RangeFacts; - var init_extractSymbol = __esm({ - "src/services/refactors/extractSymbol.ts"() { - "use strict"; - init_ts4(); - init_ts_refactor(); - refactorName11 = "Extract Symbol"; - extractConstantAction = { - name: "Extract Constant", - description: getLocaleSpecificMessage(Diagnostics.Extract_constant), - kind: "refactor.extract.constant" - }; - extractFunctionAction = { - name: "Extract Function", - description: getLocaleSpecificMessage(Diagnostics.Extract_function), - kind: "refactor.extract.function" - }; - registerRefactor(refactorName11, { - kinds: [ - extractConstantAction.kind, - extractFunctionAction.kind - ], - getEditsForAction: getRefactorEditsToExtractSymbol, - getAvailableActions: getRefactorActionsToExtractSymbol - }); - ((Messages2) => { - function createMessage(message) { - return { message, code: 0, category: 3 /* Message */, key: message }; - } - Messages2.cannotExtractRange = createMessage("Cannot extract range."); - Messages2.cannotExtractImport = createMessage("Cannot extract import statement."); - Messages2.cannotExtractSuper = createMessage("Cannot extract super call."); - Messages2.cannotExtractJSDoc = createMessage("Cannot extract JSDoc."); - Messages2.cannotExtractEmpty = createMessage("Cannot extract empty range."); - Messages2.expressionExpected = createMessage("expression expected."); - Messages2.uselessConstantType = createMessage("No reason to extract constant of type."); - Messages2.statementOrExpressionExpected = createMessage("Statement or expression expected."); - Messages2.cannotExtractRangeContainingConditionalBreakOrContinueStatements = createMessage("Cannot extract range containing conditional break or continue statements."); - Messages2.cannotExtractRangeContainingConditionalReturnStatement = createMessage("Cannot extract range containing conditional return statement."); - Messages2.cannotExtractRangeContainingLabeledBreakOrContinueStatementWithTargetOutsideOfTheRange = createMessage("Cannot extract range containing labeled break or continue with target outside of the range."); - Messages2.cannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators = createMessage("Cannot extract range containing writes to references located outside of the target range in generators."); - Messages2.typeWillNotBeVisibleInTheNewScope = createMessage("Type will not visible in the new scope."); - Messages2.functionWillNotBeVisibleInTheNewScope = createMessage("Function will not visible in the new scope."); - Messages2.cannotExtractIdentifier = createMessage("Select more than a single identifier."); - Messages2.cannotExtractExportedEntity = createMessage("Cannot extract exported declaration"); - Messages2.cannotWriteInExpression = createMessage("Cannot write back side-effects when extracting an expression"); - Messages2.cannotExtractReadonlyPropertyInitializerOutsideConstructor = createMessage("Cannot move initialization of read-only class property outside of the constructor"); - Messages2.cannotExtractAmbientBlock = createMessage("Cannot extract code from ambient contexts"); - Messages2.cannotAccessVariablesFromNestedScopes = createMessage("Cannot access variables from nested scopes"); - Messages2.cannotExtractToJSClass = createMessage("Cannot extract constant to a class scope in JS"); - Messages2.cannotExtractToExpressionArrowFunction = createMessage("Cannot extract constant to an arrow function without a block"); - Messages2.cannotExtractFunctionsContainingThisToMethod = createMessage("Cannot extract functions containing this to method"); - })(Messages || (Messages = {})); - RangeFacts = /* @__PURE__ */ ((RangeFacts2) => { - RangeFacts2[RangeFacts2["None"] = 0] = "None"; - RangeFacts2[RangeFacts2["HasReturn"] = 1] = "HasReturn"; - RangeFacts2[RangeFacts2["IsGenerator"] = 2] = "IsGenerator"; - RangeFacts2[RangeFacts2["IsAsyncFunction"] = 4] = "IsAsyncFunction"; - RangeFacts2[RangeFacts2["UsesThis"] = 8] = "UsesThis"; - RangeFacts2[RangeFacts2["UsesThisInFunction"] = 16] = "UsesThisInFunction"; - RangeFacts2[RangeFacts2["InStaticRegion"] = 32] = "InStaticRegion"; - return RangeFacts2; - })(RangeFacts || {}); - } - }); - - // src/services/_namespaces/ts.refactor.extractSymbol.ts - var ts_refactor_extractSymbol_exports = {}; - __export(ts_refactor_extractSymbol_exports, { - Messages: () => Messages, - RangeFacts: () => RangeFacts, - getRangeToExtract: () => getRangeToExtract2, - getRefactorActionsToExtractSymbol: () => getRefactorActionsToExtractSymbol, - getRefactorEditsToExtractSymbol: () => getRefactorEditsToExtractSymbol - }); - var init_ts_refactor_extractSymbol = __esm({ - "src/services/_namespaces/ts.refactor.extractSymbol.ts"() { - "use strict"; - init_extractSymbol(); - } - }); - - // src/services/refactors/generateGetAccessorAndSetAccessor.ts - var actionName, actionDescription, generateGetSetAction; - var init_generateGetAccessorAndSetAccessor = __esm({ - "src/services/refactors/generateGetAccessorAndSetAccessor.ts"() { - "use strict"; - init_ts4(); - init_ts_refactor(); - actionName = "Generate 'get' and 'set' accessors"; - actionDescription = Diagnostics.Generate_get_and_set_accessors.message; - generateGetSetAction = { - name: actionName, - description: actionDescription, - kind: "refactor.rewrite.property.generateAccessors" - }; - registerRefactor(actionName, { - kinds: [generateGetSetAction.kind], - getEditsForAction: function getRefactorActionsToGenerateGetAndSetAccessors(context, actionName2) { - if (!context.endPosition) - return void 0; - const info = ts_codefix_exports.getAccessorConvertiblePropertyAtPosition(context.file, context.program, context.startPosition, context.endPosition); - Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info"); - const edits = ts_codefix_exports.generateAccessorFromProperty(context.file, context.program, context.startPosition, context.endPosition, context, actionName2); - if (!edits) - return void 0; - const renameFilename = context.file.fileName; - const nameNeedRename = info.renameAccessor ? info.accessorName : info.fieldName; - const renameLocationOffset = isIdentifier(nameNeedRename) ? 0 : -1; - const renameLocation = renameLocationOffset + getRenameLocation( - edits, - renameFilename, - nameNeedRename.text, - /*preferLastLocation*/ - isParameter(info.declaration) - ); - return { renameFilename, renameLocation, edits }; - }, - getAvailableActions(context) { - if (!context.endPosition) - return emptyArray; - const info = ts_codefix_exports.getAccessorConvertiblePropertyAtPosition(context.file, context.program, context.startPosition, context.endPosition, context.triggerReason === "invoked"); - if (!info) - return emptyArray; - if (!isRefactorErrorInfo(info)) { - return [{ - name: actionName, - description: actionDescription, - actions: [generateGetSetAction] - }]; - } - if (context.preferences.provideRefactorNotApplicableReason) { - return [{ - name: actionName, - description: actionDescription, - actions: [{ ...generateGetSetAction, notApplicableReason: info.error }] - }]; - } - return emptyArray; - } - }); - } - }); - - // src/services/_namespaces/ts.refactor.generateGetAccessorAndSetAccessor.ts - var ts_refactor_generateGetAccessorAndSetAccessor_exports = {}; - var init_ts_refactor_generateGetAccessorAndSetAccessor = __esm({ - "src/services/_namespaces/ts.refactor.generateGetAccessorAndSetAccessor.ts"() { - "use strict"; - init_generateGetAccessorAndSetAccessor(); - } - }); - - // src/services/refactors/inferFunctionReturnType.ts - function getRefactorEditsToInferReturnType(context) { - const info = getInfo21(context); - if (info && !isRefactorErrorInfo(info)) { - const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange38(context.file, t, info.declaration, info.returnTypeNode)); - return { renameFilename: void 0, renameLocation: void 0, edits }; - } - return void 0; - } - function getRefactorActionsToInferReturnType(context) { - const info = getInfo21(context); - if (!info) - return emptyArray; - if (!isRefactorErrorInfo(info)) { - return [{ - name: refactorName12, - description: refactorDescription6, - actions: [inferReturnTypeAction] - }]; - } - if (context.preferences.provideRefactorNotApplicableReason) { - return [{ - name: refactorName12, - description: refactorDescription6, - actions: [{ ...inferReturnTypeAction, notApplicableReason: info.error }] - }]; - } - return emptyArray; - } - function doChange38(sourceFile, changes, declaration, typeNode) { - const closeParen = findChildOfKind(declaration, 21 /* CloseParenToken */, sourceFile); - const needParens = isArrowFunction(declaration) && closeParen === void 0; - const endNode2 = needParens ? first(declaration.parameters) : closeParen; - if (endNode2) { - if (needParens) { - changes.insertNodeBefore(sourceFile, endNode2, factory.createToken(20 /* OpenParenToken */)); - changes.insertNodeAfter(sourceFile, endNode2, factory.createToken(21 /* CloseParenToken */)); - } - changes.insertNodeAt(sourceFile, endNode2.end, typeNode, { prefix: ": " }); - } - } - function getInfo21(context) { - if (isInJSFile(context.file) || !refactorKindBeginsWith(inferReturnTypeAction.kind, context.kind)) - return; - const token = getTokenAtPosition(context.file, context.startPosition); - const declaration = findAncestor(token, (n) => isBlock(n) || n.parent && isArrowFunction(n.parent) && (n.kind === 38 /* EqualsGreaterThanToken */ || n.parent.body === n) ? "quit" : isConvertibleDeclaration(n)); - if (!declaration || !declaration.body || declaration.type) { - return { error: getLocaleSpecificMessage(Diagnostics.Return_type_must_be_inferred_from_a_function) }; - } - const typeChecker = context.program.getTypeChecker(); - const returnType = tryGetReturnType(typeChecker, declaration); - if (!returnType) { - return { error: getLocaleSpecificMessage(Diagnostics.Could_not_determine_function_return_type) }; - } - const returnTypeNode = typeChecker.typeToTypeNode(returnType, declaration, 1 /* NoTruncation */); - if (returnTypeNode) { - return { declaration, returnTypeNode }; - } - } - function isConvertibleDeclaration(node) { - switch (node.kind) { - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 171 /* MethodDeclaration */: - return true; - default: - return false; - } - } - function tryGetReturnType(typeChecker, node) { - if (typeChecker.isImplementationOfOverload(node)) { - const signatures = typeChecker.getTypeAtLocation(node).getCallSignatures(); - if (signatures.length > 1) { - return typeChecker.getUnionType(mapDefined(signatures, (s) => s.getReturnType())); - } - } - const signature = typeChecker.getSignatureFromDeclaration(node); - if (signature) { - return typeChecker.getReturnTypeOfSignature(signature); - } - } - var refactorName12, refactorDescription6, inferReturnTypeAction; - var init_inferFunctionReturnType = __esm({ - "src/services/refactors/inferFunctionReturnType.ts"() { - "use strict"; - init_ts4(); - init_ts_refactor(); - refactorName12 = "Infer function return type"; - refactorDescription6 = Diagnostics.Infer_function_return_type.message; - inferReturnTypeAction = { - name: refactorName12, - description: refactorDescription6, - kind: "refactor.rewrite.function.returnType" - }; - registerRefactor(refactorName12, { - kinds: [inferReturnTypeAction.kind], - getEditsForAction: getRefactorEditsToInferReturnType, - getAvailableActions: getRefactorActionsToInferReturnType - }); - } - }); - - // src/services/_namespaces/ts.refactor.inferFunctionReturnType.ts - var ts_refactor_inferFunctionReturnType_exports = {}; - var init_ts_refactor_inferFunctionReturnType = __esm({ - "src/services/_namespaces/ts.refactor.inferFunctionReturnType.ts"() { - "use strict"; - init_inferFunctionReturnType(); - } - }); - - // src/services/_namespaces/ts.refactor.ts - var ts_refactor_exports = {}; - __export(ts_refactor_exports, { - addOrRemoveBracesToArrowFunction: () => ts_refactor_addOrRemoveBracesToArrowFunction_exports, - convertArrowFunctionOrFunctionExpression: () => ts_refactor_convertArrowFunctionOrFunctionExpression_exports, - convertParamsToDestructuredObject: () => ts_refactor_convertParamsToDestructuredObject_exports, - convertStringOrTemplateLiteral: () => ts_refactor_convertStringOrTemplateLiteral_exports, - convertToOptionalChainExpression: () => ts_refactor_convertToOptionalChainExpression_exports, - doChangeNamedToNamespaceOrDefault: () => doChangeNamedToNamespaceOrDefault, - extractSymbol: () => ts_refactor_extractSymbol_exports, - generateGetAccessorAndSetAccessor: () => ts_refactor_generateGetAccessorAndSetAccessor_exports, - getApplicableRefactors: () => getApplicableRefactors, - getEditsForRefactor: () => getEditsForRefactor, - inferFunctionReturnType: () => ts_refactor_inferFunctionReturnType_exports, - isRefactorErrorInfo: () => isRefactorErrorInfo, - refactorKindBeginsWith: () => refactorKindBeginsWith, - registerRefactor: () => registerRefactor - }); - var init_ts_refactor = __esm({ - "src/services/_namespaces/ts.refactor.ts"() { - "use strict"; - init_refactorProvider(); - init_convertExport(); - init_convertImport(); - init_extractType(); - init_helpers2(); - init_moveToNewFile(); - init_ts_refactor_addOrRemoveBracesToArrowFunction(); - init_ts_refactor_convertArrowFunctionOrFunctionExpression(); - init_ts_refactor_convertParamsToDestructuredObject(); - init_ts_refactor_convertStringOrTemplateLiteral(); - init_ts_refactor_convertToOptionalChainExpression(); - init_ts_refactor_extractSymbol(); - init_ts_refactor_generateGetAccessorAndSetAccessor(); - init_ts_refactor_inferFunctionReturnType(); - } - }); - // src/services/rename.ts function getRenameInfo(program, sourceFile, position, preferences) { const node = getAdjustedRenameLocation(getTouchingPropertyName(sourceFile, position)); @@ -161923,7 +163758,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return getRenameInfoError(wouldRenameNodeModules); } const kind = ts_SymbolDisplay_exports.getSymbolKind(typeChecker, symbol, node); - const specifierName = isImportOrExportSpecifierName(node) || isStringOrNumericLiteralLike(node) && node.parent.kind === 164 /* ComputedPropertyName */ ? stripQuotes(getTextOfIdentifierOrLiteral(node)) : void 0; + const specifierName = isImportOrExportSpecifierName(node) || isStringOrNumericLiteralLike(node) && node.parent.kind === 166 /* ComputedPropertyName */ ? stripQuotes(getTextOfIdentifierOrLiteral(node)) : void 0; const displayName = specifierName || typeChecker.symbolToString(symbol); const fullDisplayName = specifierName || typeChecker.getFullyQualifiedName(symbol); return getRenameInfoSuccess(displayName, fullDisplayName, kind, ts_SymbolDisplay_exports.getSymbolModifiers(typeChecker, symbol), node, sourceFile); @@ -162019,13 +163854,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function nodeIsEligibleForRename(node) { switch (node.kind) { - case 79 /* Identifier */: - case 80 /* PrivateIdentifier */: - case 10 /* StringLiteral */: - case 14 /* NoSubstitutionTemplateLiteral */: - case 108 /* ThisKeyword */: + case 80 /* Identifier */: + case 81 /* PrivateIdentifier */: + case 11 /* StringLiteral */: + case 15 /* NoSubstitutionTemplateLiteral */: + case 110 /* ThisKeyword */: return true; - case 8 /* NumericLiteral */: + case 9 /* NumericLiteral */: return isLiteralNameOfPropertyDeclarationOrIndexAccess(node); default: return false; @@ -162106,13 +163941,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return false; const invocationChildren = node.getChildren(sourceFile); switch (startingToken.kind) { - case 20 /* OpenParenToken */: + case 21 /* OpenParenToken */: return contains(invocationChildren, startingToken); - case 27 /* CommaToken */: { + case 28 /* CommaToken */: { const containingList = findContainingList(startingToken); return !!containingList && contains(invocationChildren, containingList); } - case 29 /* LessThanToken */: + case 30 /* LessThanToken */: return containsPrecedingToken(startingToken, sourceFile, node.expression); default: return false; @@ -162182,7 +164017,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return { list, argumentIndex, argumentCount, argumentsSpan }; } function getArgumentOrParameterListAndIndex(node, sourceFile) { - if (node.kind === 29 /* LessThanToken */ || node.kind === 20 /* OpenParenToken */) { + if (node.kind === 30 /* LessThanToken */ || node.kind === 21 /* OpenParenToken */) { return { list: getChildListThatStartsWithOpenerToken(node.parent, node, sourceFile), argumentIndex: 0 }; } else { const list = findContainingList(node); @@ -162209,10 +164044,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} ); } return void 0; - } else if (isTemplateHead(node) && parent2.parent.kind === 212 /* TaggedTemplateExpression */) { + } else if (isTemplateHead(node) && parent2.parent.kind === 214 /* TaggedTemplateExpression */) { const templateExpression = parent2; const tagExpression = templateExpression.parent; - Debug.assert(templateExpression.kind === 225 /* TemplateExpression */); + Debug.assert(templateExpression.kind === 227 /* TemplateExpression */); const argumentIndex = isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } else if (isTemplateSpan(parent2) && isTaggedTemplateExpression(parent2.parent.parent)) { @@ -162260,8 +164095,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return isBinaryExpression(b.left) ? countBinaryExpressionParameters(b.left) + 1 : 2; } function tryGetParameterInfo(startingToken, position, sourceFile, checker) { - const info = getContextualSignatureLocationInfo(startingToken, sourceFile, position, checker); - if (!info) + const node = getAdjustedNode(startingToken); + if (node === void 0) + return void 0; + const info = getContextualSignatureLocationInfo(node, sourceFile, position, checker); + if (info === void 0) return void 0; const { contextualType, argumentIndex, argumentCount, argumentsSpan } = info; const nonNullableContextualType = contextualType.getNonNullableType(); @@ -162274,25 +164112,32 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const invocation = { kind: 2 /* Contextual */, signature, node: startingToken, symbol: chooseBetterSymbol(symbol) }; return { isTypeParameterList: false, invocation, argumentsSpan, argumentIndex, argumentCount }; } - function getContextualSignatureLocationInfo(startingToken, sourceFile, position, checker) { - if (startingToken.kind !== 20 /* OpenParenToken */ && startingToken.kind !== 27 /* CommaToken */) - return void 0; - const { parent: parent2 } = startingToken; + function getAdjustedNode(node) { + switch (node.kind) { + case 21 /* OpenParenToken */: + case 28 /* CommaToken */: + return node; + default: + return findAncestor(node.parent, (n) => isParameter(n) ? true : isBindingElement(n) || isObjectBindingPattern(n) || isArrayBindingPattern(n) ? false : "quit"); + } + } + function getContextualSignatureLocationInfo(node, sourceFile, position, checker) { + const { parent: parent2 } = node; switch (parent2.kind) { - case 214 /* ParenthesizedExpression */: - case 171 /* MethodDeclaration */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - const info = getArgumentOrParameterListInfo(startingToken, position, sourceFile); + case 216 /* ParenthesizedExpression */: + case 173 /* MethodDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + const info = getArgumentOrParameterListInfo(node, position, sourceFile); if (!info) return void 0; const { argumentIndex, argumentCount, argumentsSpan } = info; const contextualType = isMethodDeclaration(parent2) ? checker.getContextualTypeForObjectLiteralElement(parent2) : checker.getContextualType(parent2); return contextualType && { contextualType, argumentIndex, argumentCount, argumentsSpan }; - case 223 /* BinaryExpression */: { + case 225 /* BinaryExpression */: { const highestBinary = getHighestBinary(parent2); const contextualType2 = checker.getContextualType(highestBinary); - const argumentIndex2 = startingToken.kind === 20 /* OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent2) - 1; + const argumentIndex2 = node.kind === 21 /* OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent2) - 1; const argumentCount2 = countBinaryExpressionParameters(highestBinary); return contextualType2 && { contextualType: contextualType2, argumentIndex: argumentIndex2, argumentCount: argumentCount2, argumentsSpan: createTextSpanFromNode(parent2) }; } @@ -162302,8 +164147,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function chooseBetterSymbol(s) { return s.name === "__type" /* Type */ ? firstDefined(s.declarations, (d) => { - var _a2; - return isFunctionTypeNode(d) ? (_a2 = tryCast(d.parent, canHaveSymbol)) == null ? void 0 : _a2.symbol : void 0; + var _a; + return isFunctionTypeNode(d) ? (_a = tryCast(d.parent, canHaveSymbol)) == null ? void 0 : _a.symbol : void 0; }) || s : s; } function getArgumentIndex(argumentsList, node) { @@ -162312,7 +164157,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (child === node) { break; } - if (child.kind !== 27 /* CommaToken */) { + if (child.kind !== 28 /* CommaToken */) { argumentIndex++; } } @@ -162320,8 +164165,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function getArgumentCount(argumentsList, ignoreTrailingComma) { const listChildren = argumentsList.getChildren(); - let argumentCount = countWhere(listChildren, (arg) => arg.kind !== 27 /* CommaToken */); - if (!ignoreTrailingComma && listChildren.length > 0 && last(listChildren).kind === 27 /* CommaToken */) { + let argumentCount = countWhere(listChildren, (arg) => arg.kind !== 28 /* CommaToken */); + if (!ignoreTrailingComma && listChildren.length > 0 && last(listChildren).kind === 28 /* CommaToken */) { argumentCount++; } return argumentCount; @@ -162363,7 +164208,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const template = taggedTemplate.template; const applicableSpanStart = template.getStart(); let applicableSpanEnd = template.getEnd(); - if (template.kind === 225 /* TemplateExpression */) { + if (template.kind === 227 /* TemplateExpression */) { const lastSpan = last(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = skipTrivia( @@ -162399,9 +164244,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return invocation.kind === 0 /* Call */ ? invocation.node : invocation.kind === 1 /* TypeArgs */ ? invocation.called : invocation.node; } function createSignatureHelpItems(candidates, resolvedSignature, { isTypeParameterList, argumentCount, argumentsSpan: applicableSpan, invocation, argumentIndex }, sourceFile, typeChecker, useFullPrefix) { - var _a2; + var _a; const enclosingDeclaration = getEnclosingDeclarationFromInvocation(invocation); - const callTargetSymbol = invocation.kind === 2 /* Contextual */ ? invocation.symbol : typeChecker.getSymbolAtLocation(getExpressionFromInvocation(invocation)) || useFullPrefix && ((_a2 = resolvedSignature.declaration) == null ? void 0 : _a2.symbol); + const callTargetSymbol = invocation.kind === 2 /* Contextual */ ? invocation.symbol : typeChecker.getSymbolAtLocation(getExpressionFromInvocation(invocation)) || useFullPrefix && ((_a = resolvedSignature.declaration) == null ? void 0 : _a.symbol); const callTargetDisplayParts = callTargetSymbol ? symbolToDisplayParts( typeChecker, callTargetSymbol, @@ -162458,8 +164303,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const parameters = typeParameters.map((t) => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer)); const documentation = symbol.getDocumentationComment(checker); const tags = symbol.getJsDocTags(checker); - const prefixDisplayParts = [...typeSymbolDisplay, punctuationPart(29 /* LessThanToken */)]; - return { isVariadic: false, prefixDisplayParts, suffixDisplayParts: [punctuationPart(31 /* GreaterThanToken */)], separatorDisplayParts, parameters, documentation, tags }; + const prefixDisplayParts = [...typeSymbolDisplay, punctuationPart(30 /* LessThanToken */)]; + return { isVariadic: false, prefixDisplayParts, suffixDisplayParts: [punctuationPart(32 /* GreaterThanToken */)], separatorDisplayParts, parameters, documentation, tags }; } function getSignatureHelpItem(candidateSignature, callTargetDisplayParts, isTypeParameterList, checker, enclosingDeclaration, sourceFile) { const infos = (isTypeParameterList ? itemInfoForTypeParameters : itemInfoForParameters)(candidateSignature, checker, enclosingDeclaration, sourceFile); @@ -162505,7 +164350,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const parameterParts = mapToDisplayParts((writer) => { printer.writeList(2576 /* CallExpressionArguments */, params, sourceFile, writer); }); - return { isVariadic: false, parameters, prefix: [punctuationPart(29 /* LessThanToken */)], suffix: [punctuationPart(31 /* GreaterThanToken */), ...parameterParts] }; + return { isVariadic: false, parameters, prefix: [punctuationPart(30 /* LessThanToken */)], suffix: [punctuationPart(32 /* GreaterThanToken */), ...parameterParts] }; }); } function itemInfoForParameters(candidateSignature, checker, enclosingDeclaration, sourceFile) { @@ -162518,14 +164363,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} }); const lists = checker.getExpandedParameters(candidateSignature); const isVariadic = !checker.hasEffectiveRestParameter(candidateSignature) ? (_) => false : lists.length === 1 ? (_) => true : (pList) => { - var _a2; - return !!(pList.length && ((_a2 = tryCast(pList[pList.length - 1], isTransientSymbol)) == null ? void 0 : _a2.links.checkFlags) & 32768 /* RestParameter */); + var _a; + return !!(pList.length && ((_a = tryCast(pList[pList.length - 1], isTransientSymbol)) == null ? void 0 : _a.links.checkFlags) & 32768 /* RestParameter */); }; return lists.map((parameterList) => ({ isVariadic: isVariadic(parameterList), parameters: parameterList.map((p) => createSignatureHelpParameterForParameter(p, checker, enclosingDeclaration, sourceFile, printer)), - prefix: [...typeParameterParts, punctuationPart(20 /* OpenParenToken */)], - suffix: [punctuationPart(21 /* CloseParenToken */)] + prefix: [...typeParameterParts, punctuationPart(21 /* OpenParenToken */)], + suffix: [punctuationPart(22 /* CloseParenToken */)] })); } function createSignatureHelpParameterForParameter(parameter, checker, enclosingDeclaration, sourceFile, printer) { @@ -162550,7 +164395,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} "use strict"; init_ts4(); signatureHelpNodeBuilderFlags = 8192 /* OmitParameterModifiers */ | 70221824 /* IgnoreErrors */ | 16384 /* UseAliasDefinedOutsideCurrentScope */; - separatorDisplayParts = [punctuationPart(27 /* CommaToken */), spacePart()]; + separatorDisplayParts = [punctuationPart(28 /* CommaToken */), spacePart()]; } }); @@ -162569,7 +164414,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} // src/services/smartSelection.ts function getSmartSelectionRange(pos, sourceFile) { - var _a2, _b; + var _a, _b; let selectionRange = { textSpan: createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd()) }; @@ -162611,7 +164456,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const isBetweenMultiLineBookends = isSyntaxList(node) && isListOpener(prevNode) && isListCloser(nextNode) && !positionsAreOnSameLine(prevNode.getStart(), nextNode.getStart(), sourceFile); let start = isBetweenMultiLineBookends ? prevNode.getEnd() : node.getStart(); const end = isBetweenMultiLineBookends ? nextNode.getStart() : getEndPos(sourceFile, node); - if (hasJSDocNodes(node) && ((_a2 = node.jsDoc) == null ? void 0 : _a2.length)) { + if (hasJSDocNodes(node) && ((_a = node.jsDoc) == null ? void 0 : _a.length)) { pushSelectionRange(first(node.jsDoc).getStart(), end); } if (isSyntaxList(node)) { @@ -162664,41 +164509,41 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return false; } function getSelectionChildren(node) { - var _a2; + var _a; if (isSourceFile(node)) { return groupChildren(node.getChildAt(0).getChildren(), isImport2); } if (isMappedTypeNode(node)) { const [openBraceToken, ...children] = node.getChildren(); const closeBraceToken = Debug.checkDefined(children.pop()); - Debug.assertEqual(openBraceToken.kind, 18 /* OpenBraceToken */); - Debug.assertEqual(closeBraceToken.kind, 19 /* CloseBraceToken */); - const groupedWithPlusMinusTokens = groupChildren(children, (child) => child === node.readonlyToken || child.kind === 146 /* ReadonlyKeyword */ || child === node.questionToken || child.kind === 57 /* QuestionToken */); + Debug.assertEqual(openBraceToken.kind, 19 /* OpenBraceToken */); + Debug.assertEqual(closeBraceToken.kind, 20 /* CloseBraceToken */); + const groupedWithPlusMinusTokens = groupChildren(children, (child) => child === node.readonlyToken || child.kind === 148 /* ReadonlyKeyword */ || child === node.questionToken || child.kind === 58 /* QuestionToken */); const groupedWithBrackets = groupChildren( groupedWithPlusMinusTokens, - ({ kind }) => kind === 22 /* OpenBracketToken */ || kind === 165 /* TypeParameter */ || kind === 23 /* CloseBracketToken */ + ({ kind }) => kind === 23 /* OpenBracketToken */ || kind === 167 /* TypeParameter */ || kind === 24 /* CloseBracketToken */ ); return [ openBraceToken, // Pivot on `:` - createSyntaxList2(splitChildren(groupedWithBrackets, ({ kind }) => kind === 58 /* ColonToken */)), + createSyntaxList2(splitChildren(groupedWithBrackets, ({ kind }) => kind === 59 /* ColonToken */)), closeBraceToken ]; } if (isPropertySignature(node)) { const children = groupChildren(node.getChildren(), (child) => child === node.name || contains(node.modifiers, child)); - const firstJSDocChild = ((_a2 = children[0]) == null ? void 0 : _a2.kind) === 323 /* JSDoc */ ? children[0] : void 0; + const firstJSDocChild = ((_a = children[0]) == null ? void 0 : _a.kind) === 326 /* JSDoc */ ? children[0] : void 0; const withJSDocSeparated = firstJSDocChild ? children.slice(1) : children; - const splittedChildren = splitChildren(withJSDocSeparated, ({ kind }) => kind === 58 /* ColonToken */); + const splittedChildren = splitChildren(withJSDocSeparated, ({ kind }) => kind === 59 /* ColonToken */); return firstJSDocChild ? [firstJSDocChild, createSyntaxList2(splittedChildren)] : splittedChildren; } if (isParameter(node)) { const groupedDotDotDotAndName = groupChildren(node.getChildren(), (child) => child === node.dotDotDotToken || child === node.name); const groupedWithQuestionToken = groupChildren(groupedDotDotDotAndName, (child) => child === groupedDotDotDotAndName[0] || child === node.questionToken); - return splitChildren(groupedWithQuestionToken, ({ kind }) => kind === 63 /* EqualsToken */); + return splitChildren(groupedWithQuestionToken, ({ kind }) => kind === 64 /* EqualsToken */); } if (isBindingElement(node)) { - return splitChildren(node.getChildren(), ({ kind }) => kind === 63 /* EqualsToken */); + return splitChildren(node.getChildren(), ({ kind }) => kind === 64 /* EqualsToken */); } return node.getChildren(); } @@ -162733,7 +164578,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const leftChildren = children.slice(0, splitTokenIndex); const splitToken = children[splitTokenIndex]; const lastToken = last(children); - const separateLastToken = separateTrailingSemicolon && lastToken.kind === 26 /* SemicolonToken */; + const separateLastToken = separateTrailingSemicolon && lastToken.kind === 27 /* SemicolonToken */; const rightChildren = children.slice(splitTokenIndex + 1, separateLastToken ? children.length - 1 : void 0); const result = compact([ leftChildren.length ? createSyntaxList2(leftChildren) : void 0, @@ -162748,19 +164593,19 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function isListOpener(token) { const kind = token && token.kind; - return kind === 18 /* OpenBraceToken */ || kind === 22 /* OpenBracketToken */ || kind === 20 /* OpenParenToken */ || kind === 283 /* JsxOpeningElement */; + return kind === 19 /* OpenBraceToken */ || kind === 23 /* OpenBracketToken */ || kind === 21 /* OpenParenToken */ || kind === 285 /* JsxOpeningElement */; } function isListCloser(token) { const kind = token && token.kind; - return kind === 19 /* CloseBraceToken */ || kind === 23 /* CloseBracketToken */ || kind === 21 /* CloseParenToken */ || kind === 284 /* JsxClosingElement */; + return kind === 20 /* CloseBraceToken */ || kind === 24 /* CloseBracketToken */ || kind === 22 /* CloseParenToken */ || kind === 286 /* JsxClosingElement */; } function getEndPos(sourceFile, node) { switch (node.kind) { - case 344 /* JSDocParameterTag */: - case 341 /* JSDocCallbackTag */: - case 351 /* JSDocPropertyTag */: - case 349 /* JSDocTypedefTag */: - case 346 /* JSDocThisTag */: + case 347 /* JSDocParameterTag */: + case 344 /* JSDocCallbackTag */: + case 354 /* JSDocPropertyTag */: + case 352 /* JSDocTypedefTag */: + case 349 /* JSDocThisTag */: return sourceFile.getLineEndOfPosition(node.getStart()); default: return node.getEnd(); @@ -162795,7 +164640,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } const flags = getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* Class */) { - return getDeclarationOfKind(symbol, 228 /* ClassExpression */) ? "local class" /* localClassElement */ : "class" /* classElement */; + return getDeclarationOfKind(symbol, 230 /* ClassExpression */) ? "local class" /* localClassElement */ : "class" /* classElement */; } if (flags & 384 /* Enum */) return "enum" /* enumElement */; @@ -162824,7 +164669,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (typeChecker.isArgumentsSymbol(symbol)) { return "local var" /* localVariableElement */; } - if (location.kind === 108 /* ThisKeyword */ && isExpression(location) || isThisInTypeQuery(location)) { + if (location.kind === 110 /* ThisKeyword */ && isExpression(location) || isThisInTypeQuery(location)) { return "parameter" /* parameterElement */; } const flags = getCombinedLocalAndExportSymbolFlags(symbol); @@ -162901,33 +164746,33 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return modifiers.size > 0 ? arrayFrom(modifiers.values()).join(",") : "" /* none */; } function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias) { - var _a2; + var _a; const displayParts = []; let documentation = []; let tags = []; const symbolFlags = getCombinedLocalAndExportSymbolFlags(symbol); let symbolKind = semanticMeaning & 1 /* Value */ ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : "" /* unknown */; let hasAddedSymbolInfo = false; - const isThisExpression = location.kind === 108 /* ThisKeyword */ && isInExpressionContext(location) || isThisInTypeQuery(location); + const isThisExpression = location.kind === 110 /* ThisKeyword */ && isInExpressionContext(location) || isThisInTypeQuery(location); let type; let documentationFromAlias; let tagsFromAlias; let hasMultipleSignatures = false; - if (location.kind === 108 /* ThisKeyword */ && !isThisExpression) { - return { displayParts: [keywordPart(108 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: void 0 }; + if (location.kind === 110 /* ThisKeyword */ && !isThisExpression) { + return { displayParts: [keywordPart(110 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: void 0 }; } if (symbolKind !== "" /* unknown */ || symbolFlags & 32 /* Class */ || symbolFlags & 2097152 /* Alias */) { if (symbolKind === "getter" /* memberGetAccessorElement */ || symbolKind === "setter" /* memberSetAccessorElement */) { const declaration = find(symbol.declarations, (declaration2) => declaration2.name === location); if (declaration) { switch (declaration.kind) { - case 174 /* GetAccessor */: + case 176 /* GetAccessor */: symbolKind = "getter" /* memberGetAccessorElement */; break; - case 175 /* SetAccessor */: + case 177 /* SetAccessor */: symbolKind = "setter" /* memberSetAccessorElement */; break; - case 169 /* PropertyDeclaration */: + case 171 /* PropertyDeclaration */: symbolKind = "accessor" /* memberAccessorVariableElement */; break; default: @@ -162939,7 +164784,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } let signature; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); - if (location.parent && location.parent.kind === 208 /* PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 210 /* PropertyAccessExpression */) { const right = location.parent.name; if (right === location || right && right.getFullWidth() === 0) { location = location.parent; @@ -162955,7 +164800,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (callExpressionLike) { signature = typeChecker.getResolvedSignature(callExpressionLike); - const useConstructSignatures = callExpressionLike.kind === 211 /* NewExpression */ || isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SuperKeyword */; + const useConstructSignatures = callExpressionLike.kind === 213 /* NewExpression */ || isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 108 /* SuperKeyword */; const allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (signature && !contains(allSignatures, signature.target) && !contains(allSignatures, signature)) { signature = allSignatures.length ? allSignatures[0] : void 0; @@ -162970,10 +164815,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} displayParts.push(spacePart()); if (useConstructSignatures) { if (signature.flags & 4 /* Abstract */) { - displayParts.push(keywordPart(126 /* AbstractKeyword */)); + displayParts.push(keywordPart(128 /* AbstractKeyword */)); displayParts.push(spacePart()); } - displayParts.push(keywordPart(103 /* NewKeyword */)); + displayParts.push(keywordPart(105 /* NewKeyword */)); displayParts.push(spacePart()); } addFullSymbolName(symbol); @@ -162988,7 +164833,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} case "let" /* letElement */: case "parameter" /* parameterElement */: case "local var" /* localVariableElement */: - displayParts.push(punctuationPart(58 /* ColonToken */)); + displayParts.push(punctuationPart(59 /* ColonToken */)); displayParts.push(spacePart()); if (!(getObjectFlags(type) & 16 /* Anonymous */) && type.symbol) { addRange(displayParts, symbolToDisplayParts( @@ -163003,10 +164848,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (useConstructSignatures) { if (signature.flags & 4 /* Abstract */) { - displayParts.push(keywordPart(126 /* AbstractKeyword */)); + displayParts.push(keywordPart(128 /* AbstractKeyword */)); displayParts.push(spacePart()); } - displayParts.push(keywordPart(103 /* NewKeyword */)); + displayParts.push(keywordPart(105 /* NewKeyword */)); displayParts.push(spacePart()); } addSignatureDisplayParts(signature, allSignatures, 262144 /* WriteArrowStyleSignature */); @@ -163018,21 +164863,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} hasMultipleSignatures = allSignatures.length > 1; } } else if (isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* Accessor */) || // name of function declaration - location.kind === 135 /* ConstructorKeyword */ && location.parent.kind === 173 /* Constructor */) { + location.kind === 137 /* ConstructorKeyword */ && location.parent.kind === 175 /* Constructor */) { const functionDeclaration = location.parent; - const locationIsSymbolDeclaration = symbol.declarations && find(symbol.declarations, (declaration) => declaration === (location.kind === 135 /* ConstructorKeyword */ ? functionDeclaration.parent : functionDeclaration)); + const locationIsSymbolDeclaration = symbol.declarations && find(symbol.declarations, (declaration) => declaration === (location.kind === 137 /* ConstructorKeyword */ ? functionDeclaration.parent : functionDeclaration)); if (locationIsSymbolDeclaration) { - const allSignatures = functionDeclaration.kind === 173 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + const allSignatures = functionDeclaration.kind === 175 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration); } else { signature = allSignatures[0]; } - if (functionDeclaration.kind === 173 /* Constructor */) { + if (functionDeclaration.kind === 175 /* Constructor */) { symbolKind = "constructor" /* constructorImplementationElement */; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { - addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 176 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); + addPrefixForAnyFunctionOrVar(functionDeclaration.kind === 178 /* CallSignature */ && !(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind); } if (signature) { addSignatureDisplayParts(signature, allSignatures); @@ -163044,10 +164889,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (getDeclarationOfKind(symbol, 228 /* ClassExpression */)) { + if (getDeclarationOfKind(symbol, 230 /* ClassExpression */)) { pushSymbolKind("local class" /* localClassElement */); } else { - displayParts.push(keywordPart(84 /* ClassKeyword */)); + displayParts.push(keywordPart(86 /* ClassKeyword */)); } displayParts.push(spacePart()); addFullSymbolName(symbol); @@ -163055,45 +164900,45 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (symbolFlags & 64 /* Interface */ && semanticMeaning & 2 /* Type */) { prefixNextMeaning(); - displayParts.push(keywordPart(118 /* InterfaceKeyword */)); + displayParts.push(keywordPart(120 /* InterfaceKeyword */)); displayParts.push(spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); } if (symbolFlags & 524288 /* TypeAlias */ && semanticMeaning & 2 /* Type */) { prefixNextMeaning(); - displayParts.push(keywordPart(154 /* TypeKeyword */)); + displayParts.push(keywordPart(156 /* TypeKeyword */)); displayParts.push(spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); displayParts.push(spacePart()); - displayParts.push(operatorPart(63 /* EqualsToken */)); + displayParts.push(operatorPart(64 /* EqualsToken */)); displayParts.push(spacePart()); - addRange(displayParts, typeToDisplayParts(typeChecker, isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */)); + addRange(displayParts, typeToDisplayParts(typeChecker, location.parent && isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */)); } if (symbolFlags & 384 /* Enum */) { prefixNextMeaning(); if (some(symbol.declarations, (d) => isEnumDeclaration(d) && isEnumConst(d))) { - displayParts.push(keywordPart(85 /* ConstKeyword */)); + displayParts.push(keywordPart(87 /* ConstKeyword */)); displayParts.push(spacePart()); } - displayParts.push(keywordPart(92 /* EnumKeyword */)); + displayParts.push(keywordPart(94 /* EnumKeyword */)); displayParts.push(spacePart()); addFullSymbolName(symbol); } if (symbolFlags & 1536 /* Module */ && !isThisExpression) { prefixNextMeaning(); - const declaration = getDeclarationOfKind(symbol, 264 /* ModuleDeclaration */); - const isNamespace = declaration && declaration.name && declaration.name.kind === 79 /* Identifier */; - displayParts.push(keywordPart(isNamespace ? 143 /* NamespaceKeyword */ : 142 /* ModuleKeyword */)); + const declaration = getDeclarationOfKind(symbol, 266 /* ModuleDeclaration */); + const isNamespace = declaration && declaration.name && declaration.name.kind === 80 /* Identifier */; + displayParts.push(keywordPart(isNamespace ? 145 /* NamespaceKeyword */ : 144 /* ModuleKeyword */)); displayParts.push(spacePart()); addFullSymbolName(symbol); } if (symbolFlags & 262144 /* TypeParameter */ && semanticMeaning & 2 /* Type */) { prefixNextMeaning(); - displayParts.push(punctuationPart(20 /* OpenParenToken */)); + displayParts.push(punctuationPart(21 /* OpenParenToken */)); displayParts.push(textPart("type parameter")); - displayParts.push(punctuationPart(21 /* CloseParenToken */)); + displayParts.push(punctuationPart(22 /* CloseParenToken */)); displayParts.push(spacePart()); addFullSymbolName(symbol); if (symbol.parent) { @@ -163101,7 +164946,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} addFullSymbolName(symbol.parent, enclosingDeclaration); writeTypeParametersOfSymbol(symbol.parent, enclosingDeclaration); } else { - const decl = getDeclarationOfKind(symbol, 165 /* TypeParameter */); + const decl = getDeclarationOfKind(symbol, 167 /* TypeParameter */); if (decl === void 0) return Debug.fail(); const declaration = decl.parent; @@ -163109,16 +164954,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (isFunctionLike(declaration)) { addInPrefix(); const signature = typeChecker.getSignatureFromDeclaration(declaration); - if (declaration.kind === 177 /* ConstructSignature */) { - displayParts.push(keywordPart(103 /* NewKeyword */)); + if (declaration.kind === 179 /* ConstructSignature */) { + displayParts.push(keywordPart(105 /* NewKeyword */)); displayParts.push(spacePart()); - } else if (declaration.kind !== 176 /* CallSignature */ && declaration.name) { + } else if (declaration.kind !== 178 /* CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } addRange(displayParts, signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */)); } else if (isTypeAliasDeclaration(declaration)) { addInPrefix(); - displayParts.push(keywordPart(154 /* TypeKeyword */)); + displayParts.push(keywordPart(156 /* TypeKeyword */)); displayParts.push(spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -163129,12 +164974,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (symbolFlags & 8 /* EnumMember */) { symbolKind = "enum member" /* enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); - const declaration = (_a2 = symbol.declarations) == null ? void 0 : _a2[0]; - if ((declaration == null ? void 0 : declaration.kind) === 302 /* EnumMember */) { + const declaration = (_a = symbol.declarations) == null ? void 0 : _a[0]; + if ((declaration == null ? void 0 : declaration.kind) === 305 /* EnumMember */) { const constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== void 0) { displayParts.push(spacePart()); - displayParts.push(operatorPart(63 /* EqualsToken */)); + displayParts.push(operatorPart(64 /* EqualsToken */)); displayParts.push(spacePart()); displayParts.push(displayPart( getTextOfConstantValue(constantValue), @@ -163145,12 +164990,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (symbol.flags & 2097152 /* Alias */) { prefixNextMeaning(); - if (!hasAddedSymbolInfo) { + if (!hasAddedSymbolInfo || documentation.length === 0 && tags.length === 0) { const resolvedSymbol = typeChecker.getAliasedSymbol(symbol); if (resolvedSymbol !== symbol && resolvedSymbol.declarations && resolvedSymbol.declarations.length > 0) { const resolvedNode = resolvedSymbol.declarations[0]; const declarationName = getNameOfDeclaration(resolvedNode); - if (declarationName) { + if (declarationName && !hasAddedSymbolInfo) { const isExternalModuleDeclaration = isModuleWithStringLiteralName(resolvedNode) && hasSyntacticModifier(resolvedNode, 2 /* Ambient */); const shouldUseAliasName = symbol.name !== "default" && !isExternalModuleDeclaration; const resolvedInfo = getSymbolDisplayPartsDocumentationAndSymbolKind( @@ -163174,41 +165019,41 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (symbol.declarations) { switch (symbol.declarations[0].kind) { - case 267 /* NamespaceExportDeclaration */: - displayParts.push(keywordPart(93 /* ExportKeyword */)); + case 269 /* NamespaceExportDeclaration */: + displayParts.push(keywordPart(95 /* ExportKeyword */)); displayParts.push(spacePart()); - displayParts.push(keywordPart(143 /* NamespaceKeyword */)); + displayParts.push(keywordPart(145 /* NamespaceKeyword */)); break; - case 274 /* ExportAssignment */: - displayParts.push(keywordPart(93 /* ExportKeyword */)); + case 276 /* ExportAssignment */: + displayParts.push(keywordPart(95 /* ExportKeyword */)); displayParts.push(spacePart()); - displayParts.push(keywordPart(symbol.declarations[0].isExportEquals ? 63 /* EqualsToken */ : 88 /* DefaultKeyword */)); + displayParts.push(keywordPart(symbol.declarations[0].isExportEquals ? 64 /* EqualsToken */ : 90 /* DefaultKeyword */)); break; - case 278 /* ExportSpecifier */: - displayParts.push(keywordPart(93 /* ExportKeyword */)); + case 280 /* ExportSpecifier */: + displayParts.push(keywordPart(95 /* ExportKeyword */)); break; default: - displayParts.push(keywordPart(100 /* ImportKeyword */)); + displayParts.push(keywordPart(102 /* ImportKeyword */)); } } displayParts.push(spacePart()); addFullSymbolName(symbol); forEach(symbol.declarations, (declaration) => { - if (declaration.kind === 268 /* ImportEqualsDeclaration */) { + if (declaration.kind === 270 /* ImportEqualsDeclaration */) { const importEqualsDeclaration = declaration; if (isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(spacePart()); - displayParts.push(operatorPart(63 /* EqualsToken */)); + displayParts.push(operatorPart(64 /* EqualsToken */)); displayParts.push(spacePart()); - displayParts.push(keywordPart(147 /* RequireKeyword */)); - displayParts.push(punctuationPart(20 /* OpenParenToken */)); + displayParts.push(keywordPart(149 /* RequireKeyword */)); + displayParts.push(punctuationPart(21 /* OpenParenToken */)); displayParts.push(displayPart(getTextOfNode(getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), 8 /* stringLiteral */)); - displayParts.push(punctuationPart(21 /* CloseParenToken */)); + displayParts.push(punctuationPart(22 /* CloseParenToken */)); } else { const internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference); if (internalAliasSymbol) { displayParts.push(spacePart()); - displayParts.push(operatorPart(63 /* EqualsToken */)); + displayParts.push(operatorPart(64 /* EqualsToken */)); displayParts.push(spacePart()); addFullSymbolName(internalAliasSymbol, enclosingDeclaration); } @@ -163222,12 +165067,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (type) { if (isThisExpression) { prefixNextMeaning(); - displayParts.push(keywordPart(108 /* ThisKeyword */)); + displayParts.push(keywordPart(110 /* ThisKeyword */)); } else { addPrefixForAnyFunctionOrVar(symbol, symbolKind); } if (symbolKind === "property" /* memberVariableElement */ || symbolKind === "accessor" /* memberAccessorVariableElement */ || symbolKind === "getter" /* memberGetAccessorElement */ || symbolKind === "setter" /* memberSetAccessorElement */ || symbolKind === "JSX attribute" /* jsxAttribute */ || symbolFlags & 3 /* Variable */ || symbolKind === "local var" /* localVariableElement */ || symbolKind === "index" /* indexSignatureElement */ || isThisExpression) { - displayParts.push(punctuationPart(58 /* ColonToken */)); + displayParts.push(punctuationPart(59 /* ColonToken */)); displayParts.push(spacePart()); if (type.symbol && type.symbol.flags & 262144 /* TypeParameter */ && symbolKind !== "index" /* indexSignatureElement */) { const typeParameterParts = mapToDisplayParts((writer) => { @@ -163242,9 +165087,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} const labelDecl = symbol.links.target.links.tupleLabelDeclaration; Debug.assertNode(labelDecl.name, isIdentifier); displayParts.push(spacePart()); - displayParts.push(punctuationPart(20 /* OpenParenToken */)); + displayParts.push(punctuationPart(21 /* OpenParenToken */)); displayParts.push(textPart(idText(labelDecl.name))); - displayParts.push(punctuationPart(21 /* CloseParenToken */)); + displayParts.push(punctuationPart(22 /* CloseParenToken */)); } } else if (symbolFlags & 16 /* Function */ || symbolFlags & 8192 /* Method */ || symbolFlags & 16384 /* Constructor */ || symbolFlags & 131072 /* Signature */ || symbolFlags & 98304 /* Accessor */ || symbolKind === "method" /* memberFunctionElement */) { const allSignatures = type.getNonNullableType().getCallSignatures(); @@ -163262,9 +165107,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} documentation = symbol.getContextualDocumentationComment(enclosingDeclaration, typeChecker); } if (documentation.length === 0 && symbolFlags & 4 /* Property */) { - if (symbol.parent && symbol.declarations && forEach(symbol.parent.declarations, (declaration) => declaration.kind === 308 /* SourceFile */)) { + if (symbol.parent && symbol.declarations && forEach(symbol.parent.declarations, (declaration) => declaration.kind === 311 /* SourceFile */)) { for (const declaration of symbol.declarations) { - if (!declaration.parent || declaration.parent.kind !== 223 /* BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 225 /* BinaryExpression */) { continue; } const rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -163318,7 +165163,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } function addInPrefix() { displayParts.push(spacePart()); - displayParts.push(keywordPart(101 /* InKeyword */)); + displayParts.push(keywordPart(103 /* InKeyword */)); displayParts.push(spacePart()); } function addFullSymbolName(symbolToDisplay, enclosingDeclaration2) { @@ -163334,16 +165179,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} if (symbolToDisplay.parent) { fullSymbolDisplayParts = symbolToDisplayParts(typeChecker, symbolToDisplay.parent); } - fullSymbolDisplayParts.push(punctuationPart(22 /* OpenBracketToken */)); + fullSymbolDisplayParts.push(punctuationPart(23 /* OpenBracketToken */)); indexInfos.forEach((info, i) => { fullSymbolDisplayParts.push(...typeToDisplayParts(typeChecker, info.keyType)); if (i !== indexInfos.length - 1) { fullSymbolDisplayParts.push(spacePart()); - fullSymbolDisplayParts.push(punctuationPart(51 /* BarToken */)); + fullSymbolDisplayParts.push(punctuationPart(52 /* BarToken */)); fullSymbolDisplayParts.push(spacePart()); } }); - fullSymbolDisplayParts.push(punctuationPart(23 /* CloseBracketToken */)); + fullSymbolDisplayParts.push(punctuationPart(24 /* CloseBracketToken */)); } else { fullSymbolDisplayParts = symbolToDisplayParts( typeChecker, @@ -163356,7 +165201,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } addRange(displayParts, fullSymbolDisplayParts); if (symbol.flags & 16777216 /* Optional */) { - displayParts.push(punctuationPart(57 /* QuestionToken */)); + displayParts.push(punctuationPart(58 /* QuestionToken */)); } } function addPrefixForAnyFunctionOrVar(symbol2, symbolKind2) { @@ -163379,9 +165224,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} displayParts.push(textOrKeywordPart(symbolKind2)); return; default: - displayParts.push(punctuationPart(20 /* OpenParenToken */)); + displayParts.push(punctuationPart(21 /* OpenParenToken */)); displayParts.push(textOrKeywordPart(symbolKind2)); - displayParts.push(punctuationPart(21 /* CloseParenToken */)); + displayParts.push(punctuationPart(22 /* CloseParenToken */)); return; } } @@ -163389,12 +165234,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} addRange(displayParts, signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | 32 /* WriteTypeArgumentsOfSignature */)); if (allSignatures.length > 1) { displayParts.push(spacePart()); - displayParts.push(punctuationPart(20 /* OpenParenToken */)); - displayParts.push(operatorPart(39 /* PlusToken */)); + displayParts.push(punctuationPart(21 /* OpenParenToken */)); + displayParts.push(operatorPart(40 /* PlusToken */)); displayParts.push(displayPart((allSignatures.length - 1).toString(), 7 /* numericLiteral */)); displayParts.push(spacePart()); displayParts.push(textPart(allSignatures.length === 2 ? "overload" : "overloads")); - displayParts.push(punctuationPart(21 /* CloseParenToken */)); + displayParts.push(punctuationPart(22 /* CloseParenToken */)); } documentation = signature.getDocumentationComment(typeChecker); tags = signature.getJsDocTags(); @@ -163416,14 +165261,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return false; } return forEach(symbol.declarations, (declaration) => { - if (declaration.kind === 215 /* FunctionExpression */) { + if (declaration.kind === 217 /* FunctionExpression */) { return true; } - if (declaration.kind !== 257 /* VariableDeclaration */ && declaration.kind !== 259 /* FunctionDeclaration */) { + if (declaration.kind !== 259 /* VariableDeclaration */ && declaration.kind !== 261 /* FunctionDeclaration */) { return false; } for (let parent2 = declaration.parent; !isFunctionBlock(parent2); parent2 = parent2.parent) { - if (parent2.kind === 308 /* SourceFile */ || parent2.kind === 265 /* ModuleBlock */) { + if (parent2.kind === 311 /* SourceFile */ || parent2.kind === 267 /* ModuleBlock */) { return false; } } @@ -163498,7 +165343,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return { pos: getAdjustedStartPosition(sourceFile, startNode2, options), end: getAdjustedEndPosition(sourceFile, endNode2, options) }; } function getAdjustedStartPosition(sourceFile, node, options, hasTrailingComment = false) { - var _a2, _b; + var _a, _b; const { leadingTriviaOption } = options; if (leadingTriviaOption === 0 /* Exclude */) { return node.getStart(sourceFile); @@ -163525,7 +165370,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return leadingTriviaOption === 1 /* IncludeAll */ ? fullStart : start; } if (hasTrailingComment) { - const comment = ((_a2 = getLeadingCommentRanges(sourceFile.text, fullStart)) == null ? void 0 : _a2[0]) || ((_b = getTrailingCommentRanges(sourceFile.text, fullStart)) == null ? void 0 : _b[0]); + const comment = ((_a = getLeadingCommentRanges(sourceFile.text, fullStart)) == null ? void 0 : _a[0]) || ((_b = getTrailingCommentRanges(sourceFile.text, fullStart)) == null ? void 0 : _b[0]); if (comment) { return skipTrivia( sourceFile.text, @@ -163570,7 +165415,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; } function getAdjustedEndPosition(sourceFile, node, options) { - var _a2; + var _a; const { end } = node; const { trailingTriviaOption } = options; if (trailingTriviaOption === 0 /* Exclude */) { @@ -163578,7 +165423,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } if (trailingTriviaOption === 1 /* ExcludeWhitespace */) { const comments = concatenate(getTrailingCommentRanges(sourceFile.text, end), getLeadingCommentRanges(sourceFile.text, end)); - const realEnd = (_a2 = comments == null ? void 0 : comments[comments.length - 1]) == null ? void 0 : _a2.end; + const realEnd = (_a = comments == null ? void 0 : comments[comments.length - 1]) == null ? void 0 : _a.end; if (realEnd) { return realEnd; } @@ -163597,16 +165442,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return newEnd !== end && (trailingTriviaOption === 2 /* Include */ || isLineBreak(sourceFile.text.charCodeAt(newEnd - 1))) ? newEnd : end; } function isSeparator(node, candidate) { - return !!candidate && !!node.parent && (candidate.kind === 27 /* CommaToken */ || candidate.kind === 26 /* SemicolonToken */ && node.parent.kind === 207 /* ObjectLiteralExpression */); + return !!candidate && !!node.parent && (candidate.kind === 28 /* CommaToken */ || candidate.kind === 27 /* SemicolonToken */ && node.parent.kind === 209 /* ObjectLiteralExpression */); } function isThisTypeAnnotatable(containingFunction) { return isFunctionExpression(containingFunction) || isFunctionDeclaration(containingFunction); } function updateJSDocHost(parent2) { - if (parent2.kind !== 216 /* ArrowFunction */) { + if (parent2.kind !== 218 /* ArrowFunction */) { return parent2; } - const jsDocNode = parent2.parent.kind === 169 /* PropertyDeclaration */ ? parent2.parent : parent2.parent.parent; + const jsDocNode = parent2.parent.kind === 171 /* PropertyDeclaration */ ? parent2.parent : parent2.parent.parent; jsDocNode.jsDoc = parent2.jsDoc; return jsDocNode; } @@ -163615,7 +165460,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return void 0; } switch (oldTag.kind) { - case 344 /* JSDocParameterTag */: { + case 347 /* JSDocParameterTag */: { const oldParam = oldTag; const newParam = newTag; return isIdentifier(oldParam.name) && isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? factory.createJSDocParameterTag( @@ -163629,14 +165474,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} oldParam.comment ) : void 0; } - case 345 /* JSDocReturnTag */: + case 348 /* JSDocReturnTag */: return factory.createJSDocReturnTag( /*tagName*/ void 0, newTag.typeExpression, oldTag.comment ); - case 347 /* JSDocTypeTag */: + case 350 /* JSDocTypeTag */: return factory.createJSDocTypeTag( /*tagName*/ void 0, @@ -163683,23 +165528,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return end; } function getClassOrObjectBraceEnds(cls, sourceFile) { - const open = findChildOfKind(cls, 18 /* OpenBraceToken */, sourceFile); - const close = findChildOfKind(cls, 19 /* CloseBraceToken */, sourceFile); + const open = findChildOfKind(cls, 19 /* OpenBraceToken */, sourceFile); + const close = findChildOfKind(cls, 20 /* CloseBraceToken */, sourceFile); return [open == null ? void 0 : open.end, close == null ? void 0 : close.end]; } function getMembersOrProperties(node) { return isObjectLiteralExpression(node) ? node.properties : node.members; } - function getNewFileText(statements, scriptKind, newLineCharacter, formatContext) { - return changesToText.newFileChangesWorker( - /*oldFile*/ - void 0, - scriptKind, - statements, - newLineCharacter, - formatContext - ); - } function applyChanges(text, changes) { for (let i = changes.length - 1; i >= 0; i--) { const { span, newText } = changes[i]; @@ -164007,7 +165842,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return !isInComment(sourceFile, position) && !isInString(sourceFile, position) && !isInTemplateString(sourceFile, position) && !isInJSXText(sourceFile, position); } function needSemicolonBetween(a, b) { - return (isPropertySignature(a) || isPropertyDeclaration(a)) && isClassOrTypeElement(b) && b.name.kind === 164 /* ComputedPropertyName */ || isStatementButNotDeclaration(a) && isStatementButNotDeclaration(b); + return (isPropertySignature(a) || isPropertyDeclaration(a)) && isClassOrTypeElement(b) && b.name.kind === 166 /* ComputedPropertyName */ || isStatementButNotDeclaration(a) && isStatementButNotDeclaration(b); } function deleteNode(changes, sourceFile, node, options = { leadingTriviaOption: 1 /* IncludeAll */ }) { const startPosition = getAdjustedStartPosition(sourceFile, node, options); @@ -164057,7 +165892,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} this.newLineCharacter = newLineCharacter; this.formatContext = formatContext; this.changes = []; - this.newFiles = []; this.classesWithNodesInsertedAtStart = /* @__PURE__ */ new Map(); // Set implemented as Map this.deletedNodes = []; @@ -164143,7 +165977,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } nextCommaToken(sourceFile, node) { const next = findNextToken(node, node.parent, sourceFile); - return next && next.kind === 27 /* CommaToken */ ? next : void 0; + return next && next.kind === 28 /* CommaToken */ ? next : void 0; } replacePropertyAssignment(sourceFile, oldNode, newNode) { const suffix = this.nextCommaToken(sourceFile, oldNode) ? "" : "," + this.newLineCharacter; @@ -164173,6 +166007,23 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} this.insertNodeAt(sourceFile, pos, insert, options); } } + insertNodesAtEndOfFile(sourceFile, newNodes, blankLineBetween) { + this.insertAtEndOfFile(sourceFile, newNodes, blankLineBetween); + } + insertAtEndOfFile(sourceFile, insert, blankLineBetween) { + const pos = sourceFile.end + 1; + const options = { + prefix: this.newLineCharacter, + suffix: this.newLineCharacter + (blankLineBetween ? this.newLineCharacter : "") + }; + this.insertNodesAt(sourceFile, pos, insert, options); + } + insertStatementsInNewFile(fileName, statements, oldFile) { + if (!this.newFileChanges) { + this.newFileChanges = createMultiMap(); + } + this.newFileChanges.add(fileName, { oldFile, statements }); + } insertFirstParameter(sourceFile, parameters, newParam) { const p0 = firstOrUndefined(parameters); if (p0) { @@ -164247,28 +166098,27 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} } /** Prefer this over replacing a node with another that has a type annotation, as it avoids reformatting the other parts of the node. */ tryInsertTypeAnnotation(sourceFile, node, type) { - var _a2; let endNode2; if (isFunctionLike(node)) { - endNode2 = findChildOfKind(node, 21 /* CloseParenToken */, sourceFile); + endNode2 = findChildOfKind(node, 22 /* CloseParenToken */, sourceFile); if (!endNode2) { if (!isArrowFunction(node)) return false; endNode2 = first(node.parameters); } } else { - endNode2 = (_a2 = node.kind === 257 /* VariableDeclaration */ ? node.exclamationToken : node.questionToken) != null ? _a2 : node.name; + endNode2 = (node.kind === 259 /* VariableDeclaration */ ? node.exclamationToken : node.questionToken) ?? node.name; } this.insertNodeAt(sourceFile, endNode2.end, type, { prefix: ": " }); return true; } tryInsertThisTypeAnnotation(sourceFile, node, type) { - const start = findChildOfKind(node, 20 /* OpenParenToken */, sourceFile).getStart(sourceFile) + 1; + const start = findChildOfKind(node, 21 /* OpenParenToken */, sourceFile).getStart(sourceFile) + 1; const suffix = node.parameters.length ? ", " : ""; this.insertNodeAt(sourceFile, start, type, { prefix: "this: ", suffix }); } insertTypeParameters(sourceFile, node, typeParameters) { - const start = (findChildOfKind(node, 20 /* OpenParenToken */, sourceFile) || first(node.parameters)).getStart(sourceFile); + const start = (findChildOfKind(node, 21 /* OpenParenToken */, sourceFile) || first(node.parameters)).getStart(sourceFile); this.insertNodesAt(sourceFile, start, typeParameters, { prefix: "<", suffix: ">", joiner: ", " }); } getOptionsForInsertNodeBefore(before, inserted, blankLineBetween) { @@ -164330,8 +166180,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} this.insertNodeAtStartWorker(sourceFile, obj, newElement); } insertNodeAtStartWorker(sourceFile, node, newElement) { - var _a2; - const indentation = (_a2 = this.guessIndentationFromExistingMembers(sourceFile, node)) != null ? _a2 : this.computeIndentationForNewMember(sourceFile, node); + const indentation = this.guessIndentationFromExistingMembers(sourceFile, node) ?? this.computeIndentationForNewMember(sourceFile, node); this.insertNodeAt(sourceFile, getMembersOrProperties(node).pos, newElement, this.getInsertNodeAtStartInsertOptions(sourceFile, node, indentation)); } /** @@ -164357,9 +166206,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} return indentation; } computeIndentationForNewMember(sourceFile, node) { - var _a2; const nodeStart = node.getStart(sourceFile); - return ts_formatting_exports.SmartIndenter.findFirstNonWhitespaceColumn(getLineStartPositionForPosition(nodeStart, sourceFile), nodeStart, sourceFile, this.formatContext.options) + ((_a2 = this.formatContext.options.indentSize) != null ? _a2 : 4); + return ts_formatting_exports.SmartIndenter.findFirstNonWhitespaceColumn(getLineStartPositionForPosition(nodeStart, sourceFile), nodeStart, sourceFile, this.formatContext.options) + (this.formatContext.options.indentSize ?? 4); } getInsertNodeAtStartInsertOptions(sourceFile, node, indentation) { const members = getMembersOrProperties(node); @@ -164391,7 +166239,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")} insertNodeAfterWorker(sourceFile, after, newNode) { if (needSemicolonBetween(after, newNode)) { if (sourceFile.text.charCodeAt(after.end - 1) !== 59 /* semicolon */) { - this.replaceRange(sourceFile, createRange(after.end), factory.createToken(26 /* SemicolonToken */)); + this.replaceRange(sourceFile, createRange(after.end), factory.createToken(27 /* SemicolonToken */)); } } const endPosition = getAdjustedEndPosition(sourceFile, after, {}); @@ -164407,18 +166255,18 @@ ${options.prefix}` : "\n" : options.prefix } getInsertNodeAfterOptionsWorker(node) { switch (node.kind) { - case 260 /* ClassDeclaration */: - case 264 /* ModuleDeclaration */: + case 262 /* ClassDeclaration */: + case 266 /* ModuleDeclaration */: return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; - case 257 /* VariableDeclaration */: - case 10 /* StringLiteral */: - case 79 /* Identifier */: + case 259 /* VariableDeclaration */: + case 11 /* StringLiteral */: + case 80 /* Identifier */: return { prefix: ", " }; - case 299 /* PropertyAssignment */: + case 302 /* PropertyAssignment */: return { suffix: "," + this.newLineCharacter }; - case 93 /* ExportKeyword */: + case 95 /* ExportKeyword */: return { prefix: " " }; - case 166 /* Parameter */: + case 168 /* Parameter */: return {}; default: Debug.assert(isStatement(node) || isClassOrTypeElement(node)); @@ -164427,22 +166275,22 @@ ${options.prefix}` : "\n" : options.prefix } insertName(sourceFile, node, name) { Debug.assert(!node.name); - if (node.kind === 216 /* ArrowFunction */) { - const arrow = findChildOfKind(node, 38 /* EqualsGreaterThanToken */, sourceFile); - const lparen = findChildOfKind(node, 20 /* OpenParenToken */, sourceFile); + if (node.kind === 218 /* ArrowFunction */) { + const arrow = findChildOfKind(node, 39 /* EqualsGreaterThanToken */, sourceFile); + const lparen = findChildOfKind(node, 21 /* OpenParenToken */, sourceFile); if (lparen) { - this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [factory.createToken(98 /* FunctionKeyword */), factory.createIdentifier(name)], { joiner: " " }); + this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [factory.createToken(100 /* FunctionKeyword */), factory.createIdentifier(name)], { joiner: " " }); deleteNode(this, sourceFile, arrow); } else { this.insertText(sourceFile, first(node.parameters).getStart(sourceFile), `function ${name}(`); - this.replaceRange(sourceFile, arrow, factory.createToken(21 /* CloseParenToken */)); + this.replaceRange(sourceFile, arrow, factory.createToken(22 /* CloseParenToken */)); } - if (node.body.kind !== 238 /* Block */) { - this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [factory.createToken(18 /* OpenBraceToken */), factory.createToken(105 /* ReturnKeyword */)], { joiner: " ", suffix: " " }); - this.insertNodesAt(sourceFile, node.body.end, [factory.createToken(26 /* SemicolonToken */), factory.createToken(19 /* CloseBraceToken */)], { joiner: " " }); + if (node.body.kind !== 240 /* Block */) { + this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [factory.createToken(19 /* OpenBraceToken */), factory.createToken(107 /* ReturnKeyword */)], { joiner: " ", suffix: " " }); + this.insertNodesAt(sourceFile, node.body.end, [factory.createToken(27 /* SemicolonToken */), factory.createToken(20 /* CloseBraceToken */)], { joiner: " " }); } } else { - const pos = findChildOfKind(node, node.kind === 215 /* FunctionExpression */ ? 98 /* FunctionKeyword */ : 84 /* ClassKeyword */, sourceFile).end; + const pos = findChildOfKind(node, node.kind === 217 /* FunctionExpression */ ? 100 /* FunctionKeyword */ : 86 /* ClassKeyword */, sourceFile).end; this.insertNodeAt(sourceFile, pos, factory.createIdentifier(name), { prefix: " " }); } } @@ -164491,10 +166339,10 @@ ${options.prefix}` : "\n" : options.prefix let separator; let multilineList = false; if (containingList.length === 1) { - separator = 27 /* CommaToken */; + separator = 28 /* CommaToken */; } else { const tokenBeforeInsertPosition = findPrecedingToken(after.pos, sourceFile); - separator = isSeparator(after, tokenBeforeInsertPosition) ? tokenBeforeInsertPosition.kind : 27 /* CommaToken */; + separator = isSeparator(after, tokenBeforeInsertPosition) ? tokenBeforeInsertPosition.kind : 28 /* CommaToken */; const afterMinusOneStartLinePosition = getLineStartPositionForPosition(containingList[index - 1].getStart(sourceFile), sourceFile); multilineList = afterMinusOneStartLinePosition !== afterStartLinePosition; } @@ -164571,13 +166419,15 @@ ${options.prefix}` : "\n" : options.prefix this.finishDeleteDeclarations(); this.finishClassesWithNodesInsertedAtStart(); const changes = changesToText.getTextChangesFromChanges(this.changes, this.newLineCharacter, this.formatContext, validate); - for (const { oldFile, fileName, statements } of this.newFiles) { - changes.push(changesToText.newFileChanges(oldFile, fileName, statements, this.newLineCharacter, this.formatContext)); + if (this.newFileChanges) { + this.newFileChanges.forEach((insertions, fileName) => { + changes.push(changesToText.newFileChanges(fileName, insertions, this.newLineCharacter, this.formatContext)); + }); } return changes; } createNewFile(oldFile, fileName, statements) { - this.newFiles.push({ oldFile, fileName, statements }); + this.insertStatementsInNewFile(fileName, statements, oldFile); } }; ((changesToText2) => { @@ -164590,8 +166440,9 @@ ${options.prefix}` : "\n" : options.prefix } const textChanges2 = mapDefined(normalized, (c) => { const span = createTextSpanFromRange(c.range); - const newText = computeNewText(c, sourceFile, newLineCharacter, formatContext, validate); - if (span.length === newText.length && stringContainsAt(sourceFile.text, newText, span.start)) { + const targetSourceFile = c.kind === 1 /* ReplaceWithSingleNode */ ? getSourceFileOfNode(getOriginalNode(c.node)) ?? c.sourceFile : c.kind === 2 /* ReplaceWithMultipleNodes */ ? getSourceFileOfNode(getOriginalNode(c.nodes[0])) ?? c.sourceFile : c.sourceFile; + const newText = computeNewText(c, targetSourceFile, sourceFile, newLineCharacter, formatContext, validate); + if (span.length === newText.length && stringContainsAt(targetSourceFile.text, newText, span.start)) { return void 0; } return createTextChange(span, newText); @@ -164600,13 +166451,13 @@ ${options.prefix}` : "\n" : options.prefix }); } changesToText2.getTextChangesFromChanges = getTextChangesFromChanges; - function newFileChanges(oldFile, fileName, statements, newLineCharacter, formatContext) { - const text = newFileChangesWorker(oldFile, getScriptKindFromFileName(fileName), statements, newLineCharacter, formatContext); + function newFileChanges(fileName, insertions, newLineCharacter, formatContext) { + const text = newFileChangesWorker(getScriptKindFromFileName(fileName), insertions, newLineCharacter, formatContext); return { fileName, textChanges: [createTextChange(createTextSpan(0, 0), text)], isNewFile: true }; } changesToText2.newFileChanges = newFileChanges; - function newFileChangesWorker(oldFile, scriptKind, statements, newLineCharacter, formatContext) { - const nonFormattedText = statements.map((s) => s === 4 /* NewLineTrivia */ ? "" : getNonformattedText(s, oldFile, newLineCharacter).text).join(newLineCharacter); + function newFileChangesWorker(scriptKind, insertions, newLineCharacter, formatContext) { + const nonFormattedText = flatMap(insertions, (insertion) => insertion.statements.map((s) => s === 4 /* NewLineTrivia */ ? "" : getNonformattedText(s, insertion.oldFile, newLineCharacter).text)).join(newLineCharacter); const sourceFile = createSourceFile( "any file name", nonFormattedText, @@ -164619,8 +166470,8 @@ ${options.prefix}` : "\n" : options.prefix return applyChanges(nonFormattedText, changes) + newLineCharacter; } changesToText2.newFileChangesWorker = newFileChangesWorker; - function computeNewText(change, sourceFile, newLineCharacter, formatContext, validate) { - var _a2; + function computeNewText(change, targetSourceFile, sourceFile, newLineCharacter, formatContext, validate) { + var _a; if (change.kind === 0 /* Remove */) { return ""; } @@ -164628,17 +166479,17 @@ ${options.prefix}` : "\n" : options.prefix return change.text; } const { options = {}, range: { pos } } = change; - const format = (n) => getFormattedTextOfNode(n, sourceFile, pos, options, newLineCharacter, formatContext, validate); - const text = change.kind === 2 /* ReplaceWithMultipleNodes */ ? change.nodes.map((n) => removeSuffix(format(n), newLineCharacter)).join(((_a2 = change.options) == null ? void 0 : _a2.joiner) || newLineCharacter) : format(change.node); - const noIndent = options.indentation !== void 0 || getLineStartPositionForPosition(pos, sourceFile) === pos ? text : text.replace(/^\s+/, ""); + const format = (n) => getFormattedTextOfNode(n, targetSourceFile, sourceFile, pos, options, newLineCharacter, formatContext, validate); + const text = change.kind === 2 /* ReplaceWithMultipleNodes */ ? change.nodes.map((n) => removeSuffix(format(n), newLineCharacter)).join(((_a = change.options) == null ? void 0 : _a.joiner) || newLineCharacter) : format(change.node); + const noIndent = options.indentation !== void 0 || getLineStartPositionForPosition(pos, targetSourceFile) === pos ? text : text.replace(/^\s+/, ""); return (options.prefix || "") + noIndent + (!options.suffix || endsWith(noIndent, options.suffix) ? "" : options.suffix); } - function getFormattedTextOfNode(nodeIn, sourceFile, pos, { indentation, prefix, delta }, newLineCharacter, formatContext, validate) { - const { node, text } = getNonformattedText(nodeIn, sourceFile, newLineCharacter); + function getFormattedTextOfNode(nodeIn, targetSourceFile, sourceFile, pos, { indentation, prefix, delta }, newLineCharacter, formatContext, validate) { + const { node, text } = getNonformattedText(nodeIn, targetSourceFile, newLineCharacter); if (validate) validate(node, text); - const formatOptions = getFormatCodeSettingsForWriting(formatContext, sourceFile); - const initialIndentation = indentation !== void 0 ? indentation : ts_formatting_exports.SmartIndenter.getIndentation(pos, sourceFile, formatOptions, prefix === newLineCharacter || getLineStartPositionForPosition(pos, sourceFile) === pos); + const formatOptions = getFormatCodeSettingsForWriting(formatContext, targetSourceFile); + const initialIndentation = indentation !== void 0 ? indentation : ts_formatting_exports.SmartIndenter.getIndentation(pos, sourceFile, formatOptions, prefix === newLineCharacter || getLineStartPositionForPosition(pos, targetSourceFile) === pos); if (delta === void 0) { delta = ts_formatting_exports.SmartIndenter.shouldIndentChildNode(formatOptions, nodeIn) ? formatOptions.indentSize || 0 : 0; } @@ -164648,7 +166499,7 @@ ${options.prefix}` : "\n" : options.prefix return getLineAndCharacterOfPosition(this, pos2); } }; - const changes = ts_formatting_exports.formatNodeGivenIndentation(node, file, sourceFile.languageVariant, initialIndentation, delta, { ...formatContext, options: formatOptions }); + const changes = ts_formatting_exports.formatNodeGivenIndentation(node, file, targetSourceFile.languageVariant, initialIndentation, delta, { ...formatContext, options: formatOptions }); return applyChanges(text, changes); } function getNonformattedText(node, sourceFile, newLineCharacter) { @@ -164674,38 +166525,38 @@ ${options.prefix}` : "\n" : options.prefix ((_deleteDeclaration) => { function deleteDeclaration2(changes, deletedNodesInLists, sourceFile, node) { switch (node.kind) { - case 166 /* Parameter */: { + case 168 /* Parameter */: { const oldFunction = node.parent; - if (isArrowFunction(oldFunction) && oldFunction.parameters.length === 1 && !findChildOfKind(oldFunction, 20 /* OpenParenToken */, sourceFile)) { + if (isArrowFunction(oldFunction) && oldFunction.parameters.length === 1 && !findChildOfKind(oldFunction, 21 /* OpenParenToken */, sourceFile)) { changes.replaceNodeWithText(sourceFile, node, "()"); } else { deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; } - case 269 /* ImportDeclaration */: - case 268 /* ImportEqualsDeclaration */: + case 271 /* ImportDeclaration */: + case 270 /* ImportEqualsDeclaration */: const isFirstImport = sourceFile.imports.length && node === first(sourceFile.imports).parent || node === find(sourceFile.statements, isAnyImportSyntax); deleteNode(changes, sourceFile, node, { leadingTriviaOption: isFirstImport ? 0 /* Exclude */ : hasJSDocNodes(node) ? 2 /* JSDoc */ : 3 /* StartLine */ }); break; - case 205 /* BindingElement */: + case 207 /* BindingElement */: const pattern = node.parent; - const preserveComma = pattern.kind === 204 /* ArrayBindingPattern */ && node !== last(pattern.elements); + const preserveComma = pattern.kind === 206 /* ArrayBindingPattern */ && node !== last(pattern.elements); if (preserveComma) { deleteNode(changes, sourceFile, node); } else { deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 257 /* VariableDeclaration */: + case 259 /* VariableDeclaration */: deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node); break; - case 165 /* TypeParameter */: + case 167 /* TypeParameter */: deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); break; - case 273 /* ImportSpecifier */: + case 275 /* ImportSpecifier */: const namedImports = node.parent; if (namedImports.elements.length === 1) { deleteImportBinding(changes, sourceFile, namedImports); @@ -164713,17 +166564,17 @@ ${options.prefix}` : "\n" : options.prefix deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 271 /* NamespaceImport */: + case 273 /* NamespaceImport */: deleteImportBinding(changes, sourceFile, node); break; - case 26 /* SemicolonToken */: + case 27 /* SemicolonToken */: deleteNode(changes, sourceFile, node, { trailingTriviaOption: 0 /* Exclude */ }); break; - case 98 /* FunctionKeyword */: + case 100 /* FunctionKeyword */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: 0 /* Exclude */ }); break; - case 260 /* ClassDeclaration */: - case 259 /* FunctionDeclaration */: + case 262 /* ClassDeclaration */: + case 261 /* FunctionDeclaration */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: hasJSDocNodes(node) ? 2 /* JSDoc */ : 3 /* StartLine */ }); break; default: @@ -164745,11 +166596,11 @@ ${options.prefix}` : "\n" : options.prefix } else { const start = importClause.name.getStart(sourceFile); const nextToken = getTokenAtPosition(sourceFile, importClause.name.end); - if (nextToken && nextToken.kind === 27 /* CommaToken */) { + if (nextToken && nextToken.kind === 28 /* CommaToken */) { const end = skipTrivia( sourceFile.text, nextToken.end, - /*stopAfterLineBreaks*/ + /*stopAfterLineBreak*/ false, /*stopAtComments*/ true @@ -164765,14 +166616,14 @@ ${options.prefix}` : "\n" : options.prefix const previousToken = Debug.checkDefined(getTokenAtPosition(sourceFile, node.pos - 1)); changes.deleteRange(sourceFile, { pos: previousToken.getStart(sourceFile), end: node.end }); } else { - const importDecl = getAncestor(node, 269 /* ImportDeclaration */); + const importDecl = getAncestor(node, 271 /* ImportDeclaration */); deleteNode(changes, sourceFile, importDecl); } } function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) { const { parent: parent2 } = node; - if (parent2.kind === 295 /* CatchClause */) { - changes.deleteNodeRange(sourceFile, findChildOfKind(parent2, 20 /* OpenParenToken */, sourceFile), findChildOfKind(parent2, 21 /* CloseParenToken */, sourceFile)); + if (parent2.kind === 298 /* CatchClause */) { + changes.deleteNodeRange(sourceFile, findChildOfKind(parent2, 21 /* OpenParenToken */, sourceFile), findChildOfKind(parent2, 22 /* CloseParenToken */, sourceFile)); return; } if (parent2.declarations.length !== 1) { @@ -164781,14 +166632,14 @@ ${options.prefix}` : "\n" : options.prefix } const gp = parent2.parent; switch (gp.kind) { - case 247 /* ForOfStatement */: - case 246 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 248 /* ForInStatement */: changes.replaceNode(sourceFile, node, factory.createObjectLiteralExpression()); break; - case 245 /* ForStatement */: + case 247 /* ForStatement */: deleteNode(changes, sourceFile, parent2); break; - case 240 /* VariableStatement */: + case 242 /* VariableStatement */: deleteNode(changes, sourceFile, gp, { leadingTriviaOption: hasJSDocNodes(gp) ? 2 /* JSDoc */ : 3 /* StartLine */ }); break; default: @@ -164809,7 +166660,6 @@ ${options.prefix}` : "\n" : options.prefix assignPositionsToNode: () => assignPositionsToNode, createWriter: () => createWriter, deleteNode: () => deleteNode, - getNewFileText: () => getNewFileText, isThisTypeAnnotatable: () => isThisTypeAnnotatable, isValidLocationToAddComment: () => isValidLocationToAddComment }); @@ -164891,8 +166741,8 @@ ${options.prefix}` : "\n" : options.prefix return startLine === endLine; } BlockIsOnOneLine(node) { - const openBrace = findChildOfKind(node, 18 /* OpenBraceToken */, this.sourceFile); - const closeBrace = findChildOfKind(node, 19 /* CloseBraceToken */, this.sourceFile); + const openBrace = findChildOfKind(node, 19 /* OpenBraceToken */, this.sourceFile); + const closeBrace = findChildOfKind(node, 20 /* CloseBraceToken */, this.sourceFile); if (openBrace && closeBrace) { const startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; const endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; @@ -164908,7 +166758,7 @@ ${options.prefix}` : "\n" : options.prefix function getFormattingScanner(text, languageVariant, startPos, endPos, cb) { const scanner2 = languageVariant === 1 /* JSX */ ? jsxScanner : standardScanner; scanner2.setText(text); - scanner2.setTextPos(startPos); + scanner2.resetTokenState(startPos); let wasNewLine = true; let leadingTrivia; let trailingTrivia; @@ -164925,17 +166775,15 @@ ${options.prefix}` : "\n" : options.prefix lastTrailingTriviaWasNewLine: () => wasNewLine, skipToEndOf, skipToStartOf, - getStartPos: () => { - var _a2; - return (_a2 = lastTokenInfo == null ? void 0 : lastTokenInfo.token.pos) != null ? _a2 : scanner2.getTokenPos(); - } + getTokenFullStart: () => (lastTokenInfo == null ? void 0 : lastTokenInfo.token.pos) ?? scanner2.getTokenStart(), + getStartPos: () => (lastTokenInfo == null ? void 0 : lastTokenInfo.token.pos) ?? scanner2.getTokenStart() }); lastTokenInfo = void 0; scanner2.setText(void 0); return res; function advance() { lastTokenInfo = void 0; - const isStarted = scanner2.getStartPos() !== startPos; + const isStarted = scanner2.getTokenFullStart() !== startPos; if (isStarted) { wasNewLine = !!trailingTrivia && last(trailingTrivia).kind === 4 /* NewLineTrivia */; } else { @@ -164943,7 +166791,7 @@ ${options.prefix}` : "\n" : options.prefix } leadingTrivia = void 0; trailingTrivia = void 0; - let pos = scanner2.getStartPos(); + let pos = scanner2.getTokenFullStart(); while (pos < endPos) { const t = scanner2.getToken(); if (!isTrivia(t)) { @@ -164952,21 +166800,21 @@ ${options.prefix}` : "\n" : options.prefix scanner2.scan(); const item = { pos, - end: scanner2.getStartPos(), + end: scanner2.getTokenFullStart(), kind: t }; - pos = scanner2.getStartPos(); + pos = scanner2.getTokenFullStart(); leadingTrivia = append(leadingTrivia, item); } - savedPos = scanner2.getStartPos(); + savedPos = scanner2.getTokenFullStart(); } function shouldRescanGreaterThanToken(node) { switch (node.kind) { - case 33 /* GreaterThanEqualsToken */: - case 71 /* GreaterThanGreaterThanEqualsToken */: - case 72 /* GreaterThanGreaterThanGreaterThanEqualsToken */: - case 49 /* GreaterThanGreaterThanGreaterThanToken */: - case 48 /* GreaterThanGreaterThanToken */: + case 34 /* GreaterThanEqualsToken */: + case 72 /* GreaterThanGreaterThanEqualsToken */: + case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */: + case 50 /* GreaterThanGreaterThanGreaterThanToken */: + case 49 /* GreaterThanGreaterThanToken */: return true; } return false; @@ -164974,29 +166822,29 @@ ${options.prefix}` : "\n" : options.prefix function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 288 /* JsxAttribute */: - case 283 /* JsxOpeningElement */: - case 284 /* JsxClosingElement */: - case 282 /* JsxSelfClosingElement */: - return isKeyword(node.kind) || node.kind === 79 /* Identifier */; + case 290 /* JsxAttribute */: + case 285 /* JsxOpeningElement */: + case 286 /* JsxClosingElement */: + case 284 /* JsxSelfClosingElement */: + return isKeyword(node.kind) || node.kind === 80 /* Identifier */; } } return false; } function shouldRescanJsxText(node) { - return isJsxText(node) || isJsxElement(node) && (lastTokenInfo == null ? void 0 : lastTokenInfo.token.kind) === 11 /* JsxText */; + return isJsxText(node) || isJsxElement(node) && (lastTokenInfo == null ? void 0 : lastTokenInfo.token.kind) === 12 /* JsxText */; } function shouldRescanSlashToken(container) { - return container.kind === 13 /* RegularExpressionLiteral */; + return container.kind === 14 /* RegularExpressionLiteral */; } function shouldRescanTemplateToken(container) { - return container.kind === 16 /* TemplateMiddle */ || container.kind === 17 /* TemplateTail */; + return container.kind === 17 /* TemplateMiddle */ || container.kind === 18 /* TemplateTail */; } function shouldRescanJsxAttributeValue(node) { return node.parent && isJsxAttribute(node.parent) && node.parent.initializer === node; } function startsWithSlashToken(t) { - return t === 43 /* SlashToken */ || t === 68 /* SlashEqualsToken */; + return t === 44 /* SlashToken */ || t === 69 /* SlashEqualsToken */; } function readTokenInfo(n) { Debug.assert(isOnToken()); @@ -165004,28 +166852,28 @@ ${options.prefix}` : "\n" : options.prefix if (lastTokenInfo && expectedScanAction === lastScanAction) { return fixTokenKind(lastTokenInfo, n); } - if (scanner2.getStartPos() !== savedPos) { + if (scanner2.getTokenFullStart() !== savedPos) { Debug.assert(lastTokenInfo !== void 0); - scanner2.setTextPos(savedPos); + scanner2.resetTokenState(savedPos); scanner2.scan(); } let currentToken = getNextToken(n, expectedScanAction); const token = createTextRangeWithKind( - scanner2.getStartPos(), - scanner2.getTextPos(), + scanner2.getTokenFullStart(), + scanner2.getTokenEnd(), currentToken ); if (trailingTrivia) { trailingTrivia = void 0; } - while (scanner2.getStartPos() < endPos) { + while (scanner2.getTokenFullStart() < endPos) { currentToken = scanner2.scan(); if (!isTrivia(currentToken)) { break; } const trivia = createTextRangeWithKind( - scanner2.getStartPos(), - scanner2.getTextPos(), + scanner2.getTokenFullStart(), + scanner2.getTokenEnd(), currentToken ); if (!trailingTrivia) { @@ -165045,7 +166893,7 @@ ${options.prefix}` : "\n" : options.prefix lastScanAction = 0 /* Scan */; switch (expectedScanAction) { case 1 /* RescanGreaterThanToken */: - if (token === 31 /* GreaterThanToken */) { + if (token === 32 /* GreaterThanToken */) { lastScanAction = 1 /* RescanGreaterThanToken */; const newToken = scanner2.reScanGreaterToken(); Debug.assert(n.kind === newToken); @@ -165061,10 +166909,10 @@ ${options.prefix}` : "\n" : options.prefix } break; case 3 /* RescanTemplateToken */: - if (token === 19 /* CloseBraceToken */) { + if (token === 20 /* CloseBraceToken */) { lastScanAction = 3 /* RescanTemplateToken */; return scanner2.reScanTemplateToken( - /* isTaggedTemplate */ + /*isTaggedTemplate*/ false ); } @@ -165075,7 +166923,7 @@ ${options.prefix}` : "\n" : options.prefix case 5 /* RescanJsxText */: lastScanAction = 5 /* RescanJsxText */; return scanner2.reScanJsxToken( - /* allowMultilineJsxText */ + /*allowMultilineJsxText*/ false ); case 6 /* RescanJsxAttributeValue */: @@ -165090,7 +166938,7 @@ ${options.prefix}` : "\n" : options.prefix } function readEOFTokenRange() { Debug.assert(isOnEOF()); - return createTextRangeWithKind(scanner2.getStartPos(), scanner2.getTextPos(), 1 /* EndOfFileToken */); + return createTextRangeWithKind(scanner2.getTokenFullStart(), scanner2.getTokenEnd(), 1 /* EndOfFileToken */); } function isOnToken() { const current = lastTokenInfo ? lastTokenInfo.token.kind : scanner2.getToken(); @@ -165107,8 +166955,8 @@ ${options.prefix}` : "\n" : options.prefix return tokenInfo; } function skipToEndOf(node) { - scanner2.setTextPos(node.end); - savedPos = scanner2.getStartPos(); + scanner2.resetTokenState(node.end); + savedPos = scanner2.getTokenFullStart(); lastScanAction = void 0; lastTokenInfo = void 0; wasNewLine = false; @@ -165116,8 +166964,8 @@ ${options.prefix}` : "\n" : options.prefix trailingTrivia = void 0; } function skipToStartOf(node) { - scanner2.setTextPos(node.pos); - savedPos = scanner2.getStartPos(); + scanner2.resetTokenState(node.pos); + savedPos = scanner2.getTokenFullStart(); lastScanAction = void 0; lastTokenInfo = void 0; wasNewLine = false; @@ -165178,7 +167026,7 @@ ${options.prefix}` : "\n" : options.prefix // src/services/formatting/rules.ts function getAllRules() { const allTokens = []; - for (let token = 0 /* FirstToken */; token <= 162 /* LastToken */; token++) { + for (let token = 0 /* FirstToken */; token <= 164 /* LastToken */; token++) { if (token !== 1 /* EndOfFileToken */) { allTokens.push(token); } @@ -165189,143 +167037,143 @@ ${options.prefix}` : "\n" : options.prefix const anyToken = { tokens: allTokens, isSpecific: false }; const anyTokenIncludingMultilineComments = tokenRangeFrom([...allTokens, 3 /* MultiLineCommentTrivia */]); const anyTokenIncludingEOF = tokenRangeFrom([...allTokens, 1 /* EndOfFileToken */]); - const keywords = tokenRangeFromRange(81 /* FirstKeyword */, 162 /* LastKeyword */); - const binaryOperators = tokenRangeFromRange(29 /* FirstBinaryOperator */, 78 /* LastBinaryOperator */); + const keywords = tokenRangeFromRange(83 /* FirstKeyword */, 164 /* LastKeyword */); + const binaryOperators = tokenRangeFromRange(30 /* FirstBinaryOperator */, 79 /* LastBinaryOperator */); const binaryKeywordOperators = [ - 101 /* InKeyword */, - 102 /* InstanceOfKeyword */, - 162 /* OfKeyword */, - 128 /* AsKeyword */, - 140 /* IsKeyword */, - 150 /* SatisfiesKeyword */ + 103 /* InKeyword */, + 104 /* InstanceOfKeyword */, + 164 /* OfKeyword */, + 130 /* AsKeyword */, + 142 /* IsKeyword */, + 152 /* SatisfiesKeyword */ ]; - const unaryPrefixOperators = [45 /* PlusPlusToken */, 46 /* MinusMinusToken */, 54 /* TildeToken */, 53 /* ExclamationToken */]; + const unaryPrefixOperators = [46 /* PlusPlusToken */, 47 /* MinusMinusToken */, 55 /* TildeToken */, 54 /* ExclamationToken */]; const unaryPrefixExpressions = [ - 8 /* NumericLiteral */, - 9 /* BigIntLiteral */, - 79 /* Identifier */, - 20 /* OpenParenToken */, - 22 /* OpenBracketToken */, - 18 /* OpenBraceToken */, - 108 /* ThisKeyword */, - 103 /* NewKeyword */ + 9 /* NumericLiteral */, + 10 /* BigIntLiteral */, + 80 /* Identifier */, + 21 /* OpenParenToken */, + 23 /* OpenBracketToken */, + 19 /* OpenBraceToken */, + 110 /* ThisKeyword */, + 105 /* NewKeyword */ ]; - const unaryPreincrementExpressions = [79 /* Identifier */, 20 /* OpenParenToken */, 108 /* ThisKeyword */, 103 /* NewKeyword */]; - const unaryPostincrementExpressions = [79 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 103 /* NewKeyword */]; - const unaryPredecrementExpressions = [79 /* Identifier */, 20 /* OpenParenToken */, 108 /* ThisKeyword */, 103 /* NewKeyword */]; - const unaryPostdecrementExpressions = [79 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 103 /* NewKeyword */]; + const unaryPreincrementExpressions = [80 /* Identifier */, 21 /* OpenParenToken */, 110 /* ThisKeyword */, 105 /* NewKeyword */]; + const unaryPostincrementExpressions = [80 /* Identifier */, 22 /* CloseParenToken */, 24 /* CloseBracketToken */, 105 /* NewKeyword */]; + const unaryPredecrementExpressions = [80 /* Identifier */, 21 /* OpenParenToken */, 110 /* ThisKeyword */, 105 /* NewKeyword */]; + const unaryPostdecrementExpressions = [80 /* Identifier */, 22 /* CloseParenToken */, 24 /* CloseBracketToken */, 105 /* NewKeyword */]; const comments = [2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */]; - const typeNames = [79 /* Identifier */, ...typeKeywords]; + const typeNames = [80 /* Identifier */, ...typeKeywords]; const functionOpenBraceLeftTokenRange = anyTokenIncludingMultilineComments; - const typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([79 /* Identifier */, 3 /* MultiLineCommentTrivia */, 84 /* ClassKeyword */, 93 /* ExportKeyword */, 100 /* ImportKeyword */]); - const controlOpenBraceLeftTokenRange = tokenRangeFrom([21 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 90 /* DoKeyword */, 111 /* TryKeyword */, 96 /* FinallyKeyword */, 91 /* ElseKeyword */]); + const typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([80 /* Identifier */, 3 /* MultiLineCommentTrivia */, 86 /* ClassKeyword */, 95 /* ExportKeyword */, 102 /* ImportKeyword */]); + const controlOpenBraceLeftTokenRange = tokenRangeFrom([22 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 92 /* DoKeyword */, 113 /* TryKeyword */, 98 /* FinallyKeyword */, 93 /* ElseKeyword */]); const highPriorityCommonRules = [ // Leave comments alone rule("IgnoreBeforeComment", anyToken, comments, anyContext, 1 /* StopProcessingSpaceActions */), rule("IgnoreAfterLineComment", 2 /* SingleLineCommentTrivia */, anyToken, anyContext, 1 /* StopProcessingSpaceActions */), - rule("NotSpaceBeforeColon", anyToken, 58 /* ColonToken */, [isNonJsxSameLineTokenContext, isNotBinaryOpContext, isNotTypeAnnotationContext], 16 /* DeleteSpace */), - rule("SpaceAfterColon", 58 /* ColonToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBinaryOpContext], 4 /* InsertSpace */), - rule("NoSpaceBeforeQuestionMark", anyToken, 57 /* QuestionToken */, [isNonJsxSameLineTokenContext, isNotBinaryOpContext, isNotTypeAnnotationContext], 16 /* DeleteSpace */), + rule("NotSpaceBeforeColon", anyToken, 59 /* ColonToken */, [isNonJsxSameLineTokenContext, isNotBinaryOpContext, isNotTypeAnnotationContext], 16 /* DeleteSpace */), + rule("SpaceAfterColon", 59 /* ColonToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBinaryOpContext], 4 /* InsertSpace */), + rule("NoSpaceBeforeQuestionMark", anyToken, 58 /* QuestionToken */, [isNonJsxSameLineTokenContext, isNotBinaryOpContext, isNotTypeAnnotationContext], 16 /* DeleteSpace */), // insert space after '?' only when it is used in conditional operator - rule("SpaceAfterQuestionMarkInConditionalOperator", 57 /* QuestionToken */, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 4 /* InsertSpace */), + rule("SpaceAfterQuestionMarkInConditionalOperator", 58 /* QuestionToken */, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 4 /* InsertSpace */), // in other cases there should be no space between '?' and next token - rule("NoSpaceAfterQuestionMark", 57 /* QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("NoSpaceBeforeDot", anyToken, [24 /* DotToken */, 28 /* QuestionDotToken */], [isNonJsxSameLineTokenContext, isNotPropertyAccessOnIntegerLiteral], 16 /* DeleteSpace */), - rule("NoSpaceAfterDot", [24 /* DotToken */, 28 /* QuestionDotToken */], anyToken, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("NoSpaceBetweenImportParenInImportType", 100 /* ImportKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 16 /* DeleteSpace */), + rule("NoSpaceAfterQuestionMark", 58 /* QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceBeforeDot", anyToken, [25 /* DotToken */, 29 /* QuestionDotToken */], [isNonJsxSameLineTokenContext, isNotPropertyAccessOnIntegerLiteral], 16 /* DeleteSpace */), + rule("NoSpaceAfterDot", [25 /* DotToken */, 29 /* QuestionDotToken */], anyToken, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceBetweenImportParenInImportType", 102 /* ImportKeyword */, 21 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 16 /* DeleteSpace */), // Special handling of unary operators. // Prefix operators generally shouldn't have a space between // them and their target unary expression. rule("NoSpaceAfterUnaryPrefixOperator", unaryPrefixOperators, unaryPrefixExpressions, [isNonJsxSameLineTokenContext, isNotBinaryOpContext], 16 /* DeleteSpace */), - rule("NoSpaceAfterUnaryPreincrementOperator", 45 /* PlusPlusToken */, unaryPreincrementExpressions, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("NoSpaceAfterUnaryPredecrementOperator", 46 /* MinusMinusToken */, unaryPredecrementExpressions, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("NoSpaceBeforeUnaryPostincrementOperator", unaryPostincrementExpressions, 45 /* PlusPlusToken */, [isNonJsxSameLineTokenContext, isNotStatementConditionContext], 16 /* DeleteSpace */), - rule("NoSpaceBeforeUnaryPostdecrementOperator", unaryPostdecrementExpressions, 46 /* MinusMinusToken */, [isNonJsxSameLineTokenContext, isNotStatementConditionContext], 16 /* DeleteSpace */), + rule("NoSpaceAfterUnaryPreincrementOperator", 46 /* PlusPlusToken */, unaryPreincrementExpressions, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceAfterUnaryPredecrementOperator", 47 /* MinusMinusToken */, unaryPredecrementExpressions, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceBeforeUnaryPostincrementOperator", unaryPostincrementExpressions, 46 /* PlusPlusToken */, [isNonJsxSameLineTokenContext, isNotStatementConditionContext], 16 /* DeleteSpace */), + rule("NoSpaceBeforeUnaryPostdecrementOperator", unaryPostdecrementExpressions, 47 /* MinusMinusToken */, [isNonJsxSameLineTokenContext, isNotStatementConditionContext], 16 /* DeleteSpace */), // More unary operator special-casing. // DevDiv 181814: Be careful when removing leading whitespace // around unary operators. Examples: // 1 - -2 --X--> 1--2 // a + ++b --X--> a+++b - rule("SpaceAfterPostincrementWhenFollowedByAdd", 45 /* PlusPlusToken */, 39 /* PlusToken */, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), - rule("SpaceAfterAddWhenFollowedByUnaryPlus", 39 /* PlusToken */, 39 /* PlusToken */, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), - rule("SpaceAfterAddWhenFollowedByPreincrement", 39 /* PlusToken */, 45 /* PlusPlusToken */, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), - rule("SpaceAfterPostdecrementWhenFollowedBySubtract", 46 /* MinusMinusToken */, 40 /* MinusToken */, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), - rule("SpaceAfterSubtractWhenFollowedByUnaryMinus", 40 /* MinusToken */, 40 /* MinusToken */, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), - rule("SpaceAfterSubtractWhenFollowedByPredecrement", 40 /* MinusToken */, 46 /* MinusMinusToken */, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), - rule("NoSpaceAfterCloseBrace", 19 /* CloseBraceToken */, [27 /* CommaToken */, 26 /* SemicolonToken */], [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("SpaceAfterPostincrementWhenFollowedByAdd", 46 /* PlusPlusToken */, 40 /* PlusToken */, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), + rule("SpaceAfterAddWhenFollowedByUnaryPlus", 40 /* PlusToken */, 40 /* PlusToken */, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), + rule("SpaceAfterAddWhenFollowedByPreincrement", 40 /* PlusToken */, 46 /* PlusPlusToken */, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), + rule("SpaceAfterPostdecrementWhenFollowedBySubtract", 47 /* MinusMinusToken */, 41 /* MinusToken */, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), + rule("SpaceAfterSubtractWhenFollowedByUnaryMinus", 41 /* MinusToken */, 41 /* MinusToken */, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), + rule("SpaceAfterSubtractWhenFollowedByPredecrement", 41 /* MinusToken */, 47 /* MinusMinusToken */, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), + rule("NoSpaceAfterCloseBrace", 20 /* CloseBraceToken */, [28 /* CommaToken */, 27 /* SemicolonToken */], [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), // For functions and control block place } on a new line [multi-line rule] - rule("NewLineBeforeCloseBraceInBlockContext", anyTokenIncludingMultilineComments, 19 /* CloseBraceToken */, [isMultilineBlockContext], 8 /* InsertNewLine */), + rule("NewLineBeforeCloseBraceInBlockContext", anyTokenIncludingMultilineComments, 20 /* CloseBraceToken */, [isMultilineBlockContext], 8 /* InsertNewLine */), // Space/new line after }. - rule("SpaceAfterCloseBrace", 19 /* CloseBraceToken */, anyTokenExcept(21 /* CloseParenToken */), [isNonJsxSameLineTokenContext, isAfterCodeBlockContext], 4 /* InsertSpace */), + rule("SpaceAfterCloseBrace", 20 /* CloseBraceToken */, anyTokenExcept(22 /* CloseParenToken */), [isNonJsxSameLineTokenContext, isAfterCodeBlockContext], 4 /* InsertSpace */), // Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied // Also should not apply to }) - rule("SpaceBetweenCloseBraceAndElse", 19 /* CloseBraceToken */, 91 /* ElseKeyword */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), - rule("SpaceBetweenCloseBraceAndWhile", 19 /* CloseBraceToken */, 115 /* WhileKeyword */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), - rule("NoSpaceBetweenEmptyBraceBrackets", 18 /* OpenBraceToken */, 19 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectContext], 16 /* DeleteSpace */), + rule("SpaceBetweenCloseBraceAndElse", 20 /* CloseBraceToken */, 93 /* ElseKeyword */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("SpaceBetweenCloseBraceAndWhile", 20 /* CloseBraceToken */, 117 /* WhileKeyword */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("NoSpaceBetweenEmptyBraceBrackets", 19 /* OpenBraceToken */, 20 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectContext], 16 /* DeleteSpace */), // Add a space after control dec context if the next character is an open bracket ex: 'if (false)[a, b] = [1, 2];' -> 'if (false) [a, b] = [1, 2];' - rule("SpaceAfterConditionalClosingParen", 21 /* CloseParenToken */, 22 /* OpenBracketToken */, [isControlDeclContext], 4 /* InsertSpace */), - rule("NoSpaceBetweenFunctionKeywordAndStar", 98 /* FunctionKeyword */, 41 /* AsteriskToken */, [isFunctionDeclarationOrFunctionExpressionContext], 16 /* DeleteSpace */), - rule("SpaceAfterStarInGeneratorDeclaration", 41 /* AsteriskToken */, 79 /* Identifier */, [isFunctionDeclarationOrFunctionExpressionContext], 4 /* InsertSpace */), - rule("SpaceAfterFunctionInFuncDecl", 98 /* FunctionKeyword */, anyToken, [isFunctionDeclContext], 4 /* InsertSpace */), + rule("SpaceAfterConditionalClosingParen", 22 /* CloseParenToken */, 23 /* OpenBracketToken */, [isControlDeclContext], 4 /* InsertSpace */), + rule("NoSpaceBetweenFunctionKeywordAndStar", 100 /* FunctionKeyword */, 42 /* AsteriskToken */, [isFunctionDeclarationOrFunctionExpressionContext], 16 /* DeleteSpace */), + rule("SpaceAfterStarInGeneratorDeclaration", 42 /* AsteriskToken */, 80 /* Identifier */, [isFunctionDeclarationOrFunctionExpressionContext], 4 /* InsertSpace */), + rule("SpaceAfterFunctionInFuncDecl", 100 /* FunctionKeyword */, anyToken, [isFunctionDeclContext], 4 /* InsertSpace */), // Insert new line after { and before } in multi-line contexts. - rule("NewLineAfterOpenBraceInBlockContext", 18 /* OpenBraceToken */, anyToken, [isMultilineBlockContext], 8 /* InsertNewLine */), + rule("NewLineAfterOpenBraceInBlockContext", 19 /* OpenBraceToken */, anyToken, [isMultilineBlockContext], 8 /* InsertNewLine */), // For get/set members, we check for (identifier,identifier) since get/set don't have tokens and they are represented as just an identifier token. // 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", [137 /* GetKeyword */, 151 /* SetKeyword */], 79 /* Identifier */, [isFunctionDeclContext], 4 /* InsertSpace */), - rule("NoSpaceBetweenYieldKeywordAndStar", 125 /* YieldKeyword */, 41 /* AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 16 /* DeleteSpace */), - rule("SpaceBetweenYieldOrYieldStarAndOperand", [125 /* YieldKeyword */, 41 /* AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 4 /* InsertSpace */), - rule("NoSpaceBetweenReturnAndSemicolon", 105 /* ReturnKeyword */, 26 /* SemicolonToken */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("SpaceAfterCertainKeywords", [113 /* VarKeyword */, 109 /* ThrowKeyword */, 103 /* NewKeyword */, 89 /* DeleteKeyword */, 105 /* ReturnKeyword */, 112 /* TypeOfKeyword */, 133 /* AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), - rule("SpaceAfterLetConstInVariableDeclaration", [119 /* LetKeyword */, 85 /* ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 4 /* InsertSpace */), - rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 16 /* DeleteSpace */), + rule("SpaceAfterGetSetInMember", [139 /* GetKeyword */, 153 /* SetKeyword */], 80 /* Identifier */, [isFunctionDeclContext], 4 /* InsertSpace */), + rule("NoSpaceBetweenYieldKeywordAndStar", 127 /* YieldKeyword */, 42 /* AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 16 /* DeleteSpace */), + rule("SpaceBetweenYieldOrYieldStarAndOperand", [127 /* YieldKeyword */, 42 /* AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 4 /* InsertSpace */), + rule("NoSpaceBetweenReturnAndSemicolon", 107 /* ReturnKeyword */, 27 /* SemicolonToken */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("SpaceAfterCertainKeywords", [115 /* VarKeyword */, 111 /* ThrowKeyword */, 105 /* NewKeyword */, 91 /* DeleteKeyword */, 107 /* ReturnKeyword */, 114 /* TypeOfKeyword */, 135 /* AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("SpaceAfterLetConstInVariableDeclaration", [121 /* LetKeyword */, 87 /* ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 4 /* InsertSpace */), + rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 21 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 16 /* DeleteSpace */), // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. rule("SpaceBeforeBinaryKeywordOperator", anyToken, binaryKeywordOperators, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), - rule("SpaceAfterVoidOperator", 114 /* VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 4 /* InsertSpace */), + rule("SpaceAfterVoidOperator", 116 /* VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 4 /* InsertSpace */), // Async-await - rule("SpaceBetweenAsyncAndOpenParen", 132 /* AsyncKeyword */, 20 /* OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* InsertSpace */), - rule("SpaceBetweenAsyncAndFunctionKeyword", 132 /* AsyncKeyword */, [98 /* FunctionKeyword */, 79 /* Identifier */], [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("SpaceBetweenAsyncAndOpenParen", 134 /* AsyncKeyword */, 21 /* OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("SpaceBetweenAsyncAndFunctionKeyword", 134 /* AsyncKeyword */, [100 /* FunctionKeyword */, 80 /* Identifier */], [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), // Template string - rule("NoSpaceBetweenTagAndTemplateString", [79 /* Identifier */, 21 /* CloseParenToken */], [14 /* NoSubstitutionTemplateLiteral */, 15 /* TemplateHead */], [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceBetweenTagAndTemplateString", [80 /* Identifier */, 22 /* CloseParenToken */], [15 /* NoSubstitutionTemplateLiteral */, 16 /* TemplateHead */], [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), // JSX opening elements - rule("SpaceBeforeJsxAttribute", anyToken, 79 /* Identifier */, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], 4 /* InsertSpace */), - rule("SpaceBeforeSlashInJsxOpeningElement", anyToken, 43 /* SlashToken */, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 4 /* InsertSpace */), - rule("NoSpaceBeforeGreaterThanTokenInJsxOpeningElement", 43 /* SlashToken */, 31 /* GreaterThanToken */, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("NoSpaceBeforeEqualInJsxAttribute", anyToken, 63 /* EqualsToken */, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("NoSpaceAfterEqualInJsxAttribute", 63 /* EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("SpaceBeforeJsxAttribute", anyToken, 80 /* Identifier */, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("SpaceBeforeSlashInJsxOpeningElement", anyToken, 44 /* SlashToken */, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("NoSpaceBeforeGreaterThanTokenInJsxOpeningElement", 44 /* SlashToken */, 32 /* GreaterThanToken */, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceBeforeEqualInJsxAttribute", anyToken, 64 /* EqualsToken */, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceAfterEqualInJsxAttribute", 64 /* EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), // TypeScript-specific rules // Use of module as a function call. e.g.: import m2 = module("m2"); - rule("NoSpaceAfterModuleImport", [142 /* ModuleKeyword */, 147 /* RequireKeyword */], 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceAfterModuleImport", [144 /* ModuleKeyword */, 149 /* RequireKeyword */], 21 /* OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), // Add a space around certain TypeScript keywords rule( "SpaceAfterCertainTypeScriptKeywords", [ - 126 /* AbstractKeyword */, - 127 /* AccessorKeyword */, - 84 /* ClassKeyword */, - 136 /* DeclareKeyword */, - 88 /* DefaultKeyword */, - 92 /* EnumKeyword */, - 93 /* ExportKeyword */, - 94 /* ExtendsKeyword */, - 137 /* GetKeyword */, - 117 /* ImplementsKeyword */, - 100 /* ImportKeyword */, - 118 /* InterfaceKeyword */, - 142 /* ModuleKeyword */, - 143 /* NamespaceKeyword */, - 121 /* PrivateKeyword */, - 123 /* PublicKeyword */, - 122 /* ProtectedKeyword */, - 146 /* ReadonlyKeyword */, - 151 /* SetKeyword */, - 124 /* StaticKeyword */, - 154 /* TypeKeyword */, - 158 /* FromKeyword */, - 141 /* KeyOfKeyword */, - 138 /* InferKeyword */ + 128 /* AbstractKeyword */, + 129 /* AccessorKeyword */, + 86 /* ClassKeyword */, + 138 /* DeclareKeyword */, + 90 /* DefaultKeyword */, + 94 /* EnumKeyword */, + 95 /* ExportKeyword */, + 96 /* ExtendsKeyword */, + 139 /* GetKeyword */, + 119 /* ImplementsKeyword */, + 102 /* ImportKeyword */, + 120 /* InterfaceKeyword */, + 144 /* ModuleKeyword */, + 145 /* NamespaceKeyword */, + 123 /* PrivateKeyword */, + 125 /* PublicKeyword */, + 124 /* ProtectedKeyword */, + 148 /* ReadonlyKeyword */, + 153 /* SetKeyword */, + 126 /* StaticKeyword */, + 156 /* TypeKeyword */, + 160 /* FromKeyword */, + 143 /* KeyOfKeyword */, + 140 /* InferKeyword */ ], anyToken, [isNonJsxSameLineTokenContext], @@ -165334,152 +167182,152 @@ ${options.prefix}` : "\n" : options.prefix rule( "SpaceBeforeCertainTypeScriptKeywords", anyToken, - [94 /* ExtendsKeyword */, 117 /* ImplementsKeyword */, 158 /* FromKeyword */], + [96 /* ExtendsKeyword */, 119 /* ImplementsKeyword */, 160 /* FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* 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 /* StringLiteral */, 18 /* OpenBraceToken */, [isModuleDeclContext], 4 /* InsertSpace */), + rule("SpaceAfterModuleName", 11 /* StringLiteral */, 19 /* OpenBraceToken */, [isModuleDeclContext], 4 /* InsertSpace */), // Lambda expressions - rule("SpaceBeforeArrow", anyToken, 38 /* EqualsGreaterThanToken */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), - rule("SpaceAfterArrow", 38 /* EqualsGreaterThanToken */, anyToken, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("SpaceBeforeArrow", anyToken, 39 /* EqualsGreaterThanToken */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("SpaceAfterArrow", 39 /* EqualsGreaterThanToken */, anyToken, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), // Optional parameters and let args - rule("NoSpaceAfterEllipsis", 25 /* DotDotDotToken */, 79 /* Identifier */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("NoSpaceAfterOptionalParameters", 57 /* QuestionToken */, [21 /* CloseParenToken */, 27 /* CommaToken */], [isNonJsxSameLineTokenContext, isNotBinaryOpContext], 16 /* DeleteSpace */), + rule("NoSpaceAfterEllipsis", 26 /* DotDotDotToken */, 80 /* Identifier */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceAfterOptionalParameters", 58 /* QuestionToken */, [22 /* CloseParenToken */, 28 /* CommaToken */], [isNonJsxSameLineTokenContext, isNotBinaryOpContext], 16 /* DeleteSpace */), // Remove spaces in empty interface literals. e.g.: x: {} - rule("NoSpaceBetweenEmptyInterfaceBraceBrackets", 18 /* OpenBraceToken */, 19 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectTypeContext], 16 /* DeleteSpace */), + rule("NoSpaceBetweenEmptyInterfaceBraceBrackets", 19 /* OpenBraceToken */, 20 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectTypeContext], 16 /* DeleteSpace */), // generics and type assertions - rule("NoSpaceBeforeOpenAngularBracket", typeNames, 29 /* LessThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */), - rule("NoSpaceBetweenCloseParenAndAngularBracket", 21 /* CloseParenToken */, 29 /* LessThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */), - rule("NoSpaceAfterOpenAngularBracket", 29 /* LessThanToken */, anyToken, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */), - rule("NoSpaceBeforeCloseAngularBracket", anyToken, 31 /* GreaterThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */), - rule("NoSpaceAfterCloseAngularBracket", 31 /* GreaterThanToken */, [20 /* OpenParenToken */, 22 /* OpenBracketToken */, 31 /* GreaterThanToken */, 27 /* CommaToken */], [ + rule("NoSpaceBeforeOpenAngularBracket", typeNames, 30 /* LessThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */), + rule("NoSpaceBetweenCloseParenAndAngularBracket", 22 /* CloseParenToken */, 30 /* LessThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */), + rule("NoSpaceAfterOpenAngularBracket", 30 /* LessThanToken */, anyToken, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */), + rule("NoSpaceBeforeCloseAngularBracket", anyToken, 32 /* GreaterThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 16 /* DeleteSpace */), + rule("NoSpaceAfterCloseAngularBracket", 32 /* GreaterThanToken */, [21 /* OpenParenToken */, 23 /* OpenBracketToken */, 32 /* GreaterThanToken */, 28 /* CommaToken */], [ isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext, isNotFunctionDeclContext, isNonTypeAssertionContext ], 16 /* DeleteSpace */), // decorators - rule("SpaceBeforeAt", [21 /* CloseParenToken */, 79 /* Identifier */], 59 /* AtToken */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), - rule("NoSpaceAfterAt", 59 /* AtToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("SpaceBeforeAt", [22 /* CloseParenToken */, 80 /* Identifier */], 60 /* AtToken */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("NoSpaceAfterAt", 60 /* AtToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), // Insert space after @ in decorator rule( "SpaceAfterDecorator", anyToken, [ - 126 /* AbstractKeyword */, - 79 /* Identifier */, - 93 /* ExportKeyword */, - 88 /* DefaultKeyword */, - 84 /* ClassKeyword */, - 124 /* StaticKeyword */, - 123 /* PublicKeyword */, - 121 /* PrivateKeyword */, - 122 /* ProtectedKeyword */, - 137 /* GetKeyword */, - 151 /* SetKeyword */, - 22 /* OpenBracketToken */, - 41 /* AsteriskToken */ + 128 /* AbstractKeyword */, + 80 /* Identifier */, + 95 /* ExportKeyword */, + 90 /* DefaultKeyword */, + 86 /* ClassKeyword */, + 126 /* StaticKeyword */, + 125 /* PublicKeyword */, + 123 /* PrivateKeyword */, + 124 /* ProtectedKeyword */, + 139 /* GetKeyword */, + 153 /* SetKeyword */, + 23 /* OpenBracketToken */, + 42 /* AsteriskToken */ ], [isEndOfDecoratorContextOnSameLine], 4 /* InsertSpace */ ), - rule("NoSpaceBeforeNonNullAssertionOperator", anyToken, 53 /* ExclamationToken */, [isNonJsxSameLineTokenContext, isNonNullAssertionContext], 16 /* DeleteSpace */), - rule("NoSpaceAfterNewKeywordOnConstructorSignature", 103 /* NewKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isConstructorSignatureContext], 16 /* DeleteSpace */), - rule("SpaceLessThanAndNonJSXTypeAnnotation", 29 /* LessThanToken */, 29 /* LessThanToken */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */) + rule("NoSpaceBeforeNonNullAssertionOperator", anyToken, 54 /* ExclamationToken */, [isNonJsxSameLineTokenContext, isNonNullAssertionContext], 16 /* DeleteSpace */), + rule("NoSpaceAfterNewKeywordOnConstructorSignature", 105 /* NewKeyword */, 21 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isConstructorSignatureContext], 16 /* DeleteSpace */), + rule("SpaceLessThanAndNonJSXTypeAnnotation", 30 /* LessThanToken */, 30 /* LessThanToken */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */) ]; const userConfigurableRules = [ // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - rule("SpaceAfterConstructor", 135 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* InsertSpace */), - rule("NoSpaceAfterConstructor", 135 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("SpaceAfterComma", 27 /* CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket, isNextTokenNotCloseParen], 4 /* InsertSpace */), - rule("NoSpaceAfterComma", 27 /* CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 16 /* DeleteSpace */), + rule("SpaceAfterConstructor", 137 /* ConstructorKeyword */, 21 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("NoSpaceAfterConstructor", 137 /* ConstructorKeyword */, 21 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("SpaceAfterComma", 28 /* CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket, isNextTokenNotCloseParen], 4 /* InsertSpace */), + rule("NoSpaceAfterComma", 28 /* CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 16 /* DeleteSpace */), // Insert space after function keyword for anonymous functions - rule("SpaceAfterAnonymousFunctionKeyword", [98 /* FunctionKeyword */, 41 /* AsteriskToken */], 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 4 /* InsertSpace */), - rule("NoSpaceAfterAnonymousFunctionKeyword", [98 /* FunctionKeyword */, 41 /* AsteriskToken */], 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 16 /* DeleteSpace */), + rule("SpaceAfterAnonymousFunctionKeyword", [100 /* FunctionKeyword */, 42 /* AsteriskToken */], 21 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 4 /* InsertSpace */), + rule("NoSpaceAfterAnonymousFunctionKeyword", [100 /* FunctionKeyword */, 42 /* AsteriskToken */], 21 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 16 /* DeleteSpace */), // Insert space after keywords in control flow statements - rule("SpaceAfterKeywordInControl", keywords, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 4 /* InsertSpace */), - rule("NoSpaceAfterKeywordInControl", keywords, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 16 /* DeleteSpace */), + rule("SpaceAfterKeywordInControl", keywords, 21 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 4 /* InsertSpace */), + rule("NoSpaceAfterKeywordInControl", keywords, 21 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 16 /* DeleteSpace */), // Insert space after opening and before closing nonempty parenthesis - rule("SpaceAfterOpenParen", 20 /* OpenParenToken */, anyToken, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], 4 /* InsertSpace */), - rule("SpaceBeforeCloseParen", anyToken, 21 /* CloseParenToken */, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], 4 /* InsertSpace */), - rule("SpaceBetweenOpenParens", 20 /* OpenParenToken */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], 4 /* InsertSpace */), - rule("NoSpaceBetweenParens", 20 /* OpenParenToken */, 21 /* CloseParenToken */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("NoSpaceAfterOpenParen", 20 /* OpenParenToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("NoSpaceBeforeCloseParen", anyToken, 21 /* CloseParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("SpaceAfterOpenParen", 21 /* OpenParenToken */, anyToken, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("SpaceBeforeCloseParen", anyToken, 22 /* CloseParenToken */, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("SpaceBetweenOpenParens", 21 /* OpenParenToken */, 21 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("NoSpaceBetweenParens", 21 /* OpenParenToken */, 22 /* CloseParenToken */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceAfterOpenParen", 21 /* OpenParenToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceBeforeCloseParen", anyToken, 22 /* CloseParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), // Insert space after opening and before closing nonempty brackets - rule("SpaceAfterOpenBracket", 22 /* OpenBracketToken */, anyToken, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], 4 /* InsertSpace */), - rule("SpaceBeforeCloseBracket", anyToken, 23 /* CloseBracketToken */, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], 4 /* InsertSpace */), - rule("NoSpaceBetweenBrackets", 22 /* OpenBracketToken */, 23 /* CloseBracketToken */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("NoSpaceAfterOpenBracket", 22 /* OpenBracketToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("NoSpaceBeforeCloseBracket", anyToken, 23 /* CloseBracketToken */, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("SpaceAfterOpenBracket", 23 /* OpenBracketToken */, anyToken, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("SpaceBeforeCloseBracket", anyToken, 24 /* CloseBracketToken */, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("NoSpaceBetweenBrackets", 23 /* OpenBracketToken */, 24 /* CloseBracketToken */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceAfterOpenBracket", 23 /* OpenBracketToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceBeforeCloseBracket", anyToken, 24 /* CloseBracketToken */, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), // Insert a space after { and before } in single-line contexts, but remove space from empty object literals {}. - rule("SpaceAfterOpenBrace", 18 /* OpenBraceToken */, anyToken, [isOptionEnabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isBraceWrappedContext], 4 /* InsertSpace */), - rule("SpaceBeforeCloseBrace", anyToken, 19 /* CloseBraceToken */, [isOptionEnabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isBraceWrappedContext], 4 /* InsertSpace */), - rule("NoSpaceBetweenEmptyBraceBrackets", 18 /* OpenBraceToken */, 19 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectContext], 16 /* DeleteSpace */), - rule("NoSpaceAfterOpenBrace", 18 /* OpenBraceToken */, anyToken, [isOptionDisabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("NoSpaceBeforeCloseBrace", anyToken, 19 /* CloseBraceToken */, [isOptionDisabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("SpaceAfterOpenBrace", 19 /* OpenBraceToken */, anyToken, [isOptionEnabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isBraceWrappedContext], 4 /* InsertSpace */), + rule("SpaceBeforeCloseBrace", anyToken, 20 /* CloseBraceToken */, [isOptionEnabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isBraceWrappedContext], 4 /* InsertSpace */), + rule("NoSpaceBetweenEmptyBraceBrackets", 19 /* OpenBraceToken */, 20 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectContext], 16 /* DeleteSpace */), + rule("NoSpaceAfterOpenBrace", 19 /* OpenBraceToken */, anyToken, [isOptionDisabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceBeforeCloseBrace", anyToken, 20 /* CloseBraceToken */, [isOptionDisabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), // Insert a space after opening and before closing empty brace brackets - rule("SpaceBetweenEmptyBraceBrackets", 18 /* OpenBraceToken */, 19 /* CloseBraceToken */, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingEmptyBraces")], 4 /* InsertSpace */), - rule("NoSpaceBetweenEmptyBraceBrackets", 18 /* OpenBraceToken */, 19 /* CloseBraceToken */, [isOptionDisabled("insertSpaceAfterOpeningAndBeforeClosingEmptyBraces"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("SpaceBetweenEmptyBraceBrackets", 19 /* OpenBraceToken */, 20 /* CloseBraceToken */, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingEmptyBraces")], 4 /* InsertSpace */), + rule("NoSpaceBetweenEmptyBraceBrackets", 19 /* OpenBraceToken */, 20 /* CloseBraceToken */, [isOptionDisabled("insertSpaceAfterOpeningAndBeforeClosingEmptyBraces"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), // Insert space after opening and before closing template string braces - rule("SpaceAfterTemplateHeadAndMiddle", [15 /* TemplateHead */, 16 /* TemplateMiddle */], anyToken, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxTextContext], 4 /* InsertSpace */, 1 /* CanDeleteNewLines */), - rule("SpaceBeforeTemplateMiddleAndTail", anyToken, [16 /* TemplateMiddle */, 17 /* TemplateTail */], [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxSameLineTokenContext], 4 /* InsertSpace */), - rule("NoSpaceAfterTemplateHeadAndMiddle", [15 /* TemplateHead */, 16 /* TemplateMiddle */], anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxTextContext], 16 /* DeleteSpace */, 1 /* CanDeleteNewLines */), - rule("NoSpaceBeforeTemplateMiddleAndTail", anyToken, [16 /* TemplateMiddle */, 17 /* TemplateTail */], [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("SpaceAfterTemplateHeadAndMiddle", [16 /* TemplateHead */, 17 /* TemplateMiddle */], anyToken, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxTextContext], 4 /* InsertSpace */, 1 /* CanDeleteNewLines */), + rule("SpaceBeforeTemplateMiddleAndTail", anyToken, [17 /* TemplateMiddle */, 18 /* TemplateTail */], [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("NoSpaceAfterTemplateHeadAndMiddle", [16 /* TemplateHead */, 17 /* TemplateMiddle */], anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxTextContext], 16 /* DeleteSpace */, 1 /* CanDeleteNewLines */), + rule("NoSpaceBeforeTemplateMiddleAndTail", anyToken, [17 /* TemplateMiddle */, 18 /* TemplateTail */], [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces"), isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), // No space after { and before } in JSX expression - rule("SpaceAfterOpenBraceInJsxExpression", 18 /* OpenBraceToken */, anyToken, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], 4 /* InsertSpace */), - rule("SpaceBeforeCloseBraceInJsxExpression", anyToken, 19 /* CloseBraceToken */, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], 4 /* InsertSpace */), - rule("NoSpaceAfterOpenBraceInJsxExpression", 18 /* OpenBraceToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], 16 /* DeleteSpace */), - rule("NoSpaceBeforeCloseBraceInJsxExpression", anyToken, 19 /* CloseBraceToken */, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], 16 /* DeleteSpace */), + rule("SpaceAfterOpenBraceInJsxExpression", 19 /* OpenBraceToken */, anyToken, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], 4 /* InsertSpace */), + rule("SpaceBeforeCloseBraceInJsxExpression", anyToken, 20 /* CloseBraceToken */, [isOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], 4 /* InsertSpace */), + rule("NoSpaceAfterOpenBraceInJsxExpression", 19 /* OpenBraceToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], 16 /* DeleteSpace */), + rule("NoSpaceBeforeCloseBraceInJsxExpression", anyToken, 20 /* CloseBraceToken */, [isOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces"), isNonJsxSameLineTokenContext, isJsxExpressionContext], 16 /* DeleteSpace */), // Insert space after semicolon in for statement - rule("SpaceAfterSemicolonInFor", 26 /* SemicolonToken */, anyToken, [isOptionEnabled("insertSpaceAfterSemicolonInForStatements"), isNonJsxSameLineTokenContext, isForContext], 4 /* InsertSpace */), - rule("NoSpaceAfterSemicolonInFor", 26 /* SemicolonToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterSemicolonInForStatements"), isNonJsxSameLineTokenContext, isForContext], 16 /* DeleteSpace */), + rule("SpaceAfterSemicolonInFor", 27 /* SemicolonToken */, anyToken, [isOptionEnabled("insertSpaceAfterSemicolonInForStatements"), isNonJsxSameLineTokenContext, isForContext], 4 /* InsertSpace */), + rule("NoSpaceAfterSemicolonInFor", 27 /* SemicolonToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterSemicolonInForStatements"), isNonJsxSameLineTokenContext, isForContext], 16 /* DeleteSpace */), // Insert space before and after binary operators rule("SpaceBeforeBinaryOperator", anyToken, binaryOperators, [isOptionEnabled("insertSpaceBeforeAndAfterBinaryOperators"), isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), rule("SpaceAfterBinaryOperator", binaryOperators, anyToken, [isOptionEnabled("insertSpaceBeforeAndAfterBinaryOperators"), isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* InsertSpace */), rule("NoSpaceBeforeBinaryOperator", anyToken, binaryOperators, [isOptionDisabledOrUndefined("insertSpaceBeforeAndAfterBinaryOperators"), isNonJsxSameLineTokenContext, isBinaryOpContext], 16 /* DeleteSpace */), rule("NoSpaceAfterBinaryOperator", binaryOperators, anyToken, [isOptionDisabledOrUndefined("insertSpaceBeforeAndAfterBinaryOperators"), isNonJsxSameLineTokenContext, isBinaryOpContext], 16 /* DeleteSpace */), - rule("SpaceBeforeOpenParenInFuncDecl", anyToken, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceBeforeFunctionParenthesis"), isNonJsxSameLineTokenContext, isFunctionDeclContext], 4 /* InsertSpace */), - rule("NoSpaceBeforeOpenParenInFuncDecl", anyToken, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceBeforeFunctionParenthesis"), isNonJsxSameLineTokenContext, isFunctionDeclContext], 16 /* DeleteSpace */), + rule("SpaceBeforeOpenParenInFuncDecl", anyToken, 21 /* OpenParenToken */, [isOptionEnabled("insertSpaceBeforeFunctionParenthesis"), isNonJsxSameLineTokenContext, isFunctionDeclContext], 4 /* InsertSpace */), + rule("NoSpaceBeforeOpenParenInFuncDecl", anyToken, 21 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceBeforeFunctionParenthesis"), isNonJsxSameLineTokenContext, isFunctionDeclContext], 16 /* DeleteSpace */), // Open Brace braces after control block - rule("NewLineBeforeOpenBraceInControl", controlOpenBraceLeftTokenRange, 18 /* OpenBraceToken */, [isOptionEnabled("placeOpenBraceOnNewLineForControlBlocks"), isControlDeclContext, isBeforeMultilineBlockContext], 8 /* InsertNewLine */, 1 /* CanDeleteNewLines */), + rule("NewLineBeforeOpenBraceInControl", controlOpenBraceLeftTokenRange, 19 /* OpenBraceToken */, [isOptionEnabled("placeOpenBraceOnNewLineForControlBlocks"), isControlDeclContext, isBeforeMultilineBlockContext], 8 /* InsertNewLine */, 1 /* CanDeleteNewLines */), // Open Brace braces after function // TypeScript: Function can have return types, which can be made of tons of different token kinds - rule("NewLineBeforeOpenBraceInFunction", functionOpenBraceLeftTokenRange, 18 /* OpenBraceToken */, [isOptionEnabled("placeOpenBraceOnNewLineForFunctions"), isFunctionDeclContext, isBeforeMultilineBlockContext], 8 /* InsertNewLine */, 1 /* CanDeleteNewLines */), + rule("NewLineBeforeOpenBraceInFunction", functionOpenBraceLeftTokenRange, 19 /* OpenBraceToken */, [isOptionEnabled("placeOpenBraceOnNewLineForFunctions"), isFunctionDeclContext, isBeforeMultilineBlockContext], 8 /* InsertNewLine */, 1 /* CanDeleteNewLines */), // Open Brace braces after TypeScript module/class/interface - rule("NewLineBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* OpenBraceToken */, [isOptionEnabled("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isBeforeMultilineBlockContext], 8 /* InsertNewLine */, 1 /* CanDeleteNewLines */), - rule("SpaceAfterTypeAssertion", 31 /* GreaterThanToken */, anyToken, [isOptionEnabled("insertSpaceAfterTypeAssertion"), isNonJsxSameLineTokenContext, isTypeAssertionContext], 4 /* InsertSpace */), - rule("NoSpaceAfterTypeAssertion", 31 /* GreaterThanToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterTypeAssertion"), isNonJsxSameLineTokenContext, isTypeAssertionContext], 16 /* DeleteSpace */), - rule("SpaceBeforeTypeAnnotation", anyToken, [57 /* QuestionToken */, 58 /* ColonToken */], [isOptionEnabled("insertSpaceBeforeTypeAnnotation"), isNonJsxSameLineTokenContext, isTypeAnnotationContext], 4 /* InsertSpace */), - rule("NoSpaceBeforeTypeAnnotation", anyToken, [57 /* QuestionToken */, 58 /* ColonToken */], [isOptionDisabledOrUndefined("insertSpaceBeforeTypeAnnotation"), isNonJsxSameLineTokenContext, isTypeAnnotationContext], 16 /* DeleteSpace */), - rule("NoOptionalSemicolon", 26 /* SemicolonToken */, anyTokenIncludingEOF, [optionEquals("semicolons", "remove" /* Remove */), isSemicolonDeletionContext], 32 /* DeleteToken */), + rule("NewLineBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 19 /* OpenBraceToken */, [isOptionEnabled("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isBeforeMultilineBlockContext], 8 /* InsertNewLine */, 1 /* CanDeleteNewLines */), + rule("SpaceAfterTypeAssertion", 32 /* GreaterThanToken */, anyToken, [isOptionEnabled("insertSpaceAfterTypeAssertion"), isNonJsxSameLineTokenContext, isTypeAssertionContext], 4 /* InsertSpace */), + rule("NoSpaceAfterTypeAssertion", 32 /* GreaterThanToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterTypeAssertion"), isNonJsxSameLineTokenContext, isTypeAssertionContext], 16 /* DeleteSpace */), + rule("SpaceBeforeTypeAnnotation", anyToken, [58 /* QuestionToken */, 59 /* ColonToken */], [isOptionEnabled("insertSpaceBeforeTypeAnnotation"), isNonJsxSameLineTokenContext, isTypeAnnotationContext], 4 /* InsertSpace */), + rule("NoSpaceBeforeTypeAnnotation", anyToken, [58 /* QuestionToken */, 59 /* ColonToken */], [isOptionDisabledOrUndefined("insertSpaceBeforeTypeAnnotation"), isNonJsxSameLineTokenContext, isTypeAnnotationContext], 16 /* DeleteSpace */), + rule("NoOptionalSemicolon", 27 /* SemicolonToken */, anyTokenIncludingEOF, [optionEquals("semicolons", "remove" /* Remove */), isSemicolonDeletionContext], 32 /* DeleteToken */), rule("OptionalSemicolon", anyToken, anyTokenIncludingEOF, [optionEquals("semicolons", "insert" /* Insert */), isSemicolonInsertionContext], 64 /* InsertTrailingSemicolon */) ]; const lowPriorityCommonRules = [ // Space after keyword but not before ; or : or ? - rule("NoSpaceBeforeSemicolon", anyToken, 26 /* SemicolonToken */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("SpaceBeforeOpenBraceInControl", controlOpenBraceLeftTokenRange, 18 /* OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForControlBlocks"), isControlDeclContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 4 /* InsertSpace */, 1 /* CanDeleteNewLines */), - rule("SpaceBeforeOpenBraceInFunction", functionOpenBraceLeftTokenRange, 18 /* OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isFunctionDeclContext, isBeforeBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 4 /* InsertSpace */, 1 /* CanDeleteNewLines */), - rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 4 /* InsertSpace */, 1 /* CanDeleteNewLines */), - rule("NoSpaceBeforeComma", anyToken, 27 /* CommaToken */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceBeforeSemicolon", anyToken, 27 /* SemicolonToken */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("SpaceBeforeOpenBraceInControl", controlOpenBraceLeftTokenRange, 19 /* OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForControlBlocks"), isControlDeclContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 4 /* InsertSpace */, 1 /* CanDeleteNewLines */), + rule("SpaceBeforeOpenBraceInFunction", functionOpenBraceLeftTokenRange, 19 /* OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isFunctionDeclContext, isBeforeBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 4 /* InsertSpace */, 1 /* CanDeleteNewLines */), + rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 19 /* OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 4 /* InsertSpace */, 1 /* CanDeleteNewLines */), + rule("NoSpaceBeforeComma", anyToken, 28 /* CommaToken */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), // No space before and after indexer `x[]` - rule("NoSpaceBeforeOpenBracket", anyTokenExcept(132 /* AsyncKeyword */, 82 /* CaseKeyword */), 22 /* OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), - rule("NoSpaceAfterCloseBracket", 23 /* CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 16 /* DeleteSpace */), - rule("SpaceAfterSemicolon", 26 /* SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("NoSpaceBeforeOpenBracket", anyTokenExcept(134 /* AsyncKeyword */, 84 /* CaseKeyword */), 23 /* OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* DeleteSpace */), + rule("NoSpaceAfterCloseBracket", 24 /* CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 16 /* DeleteSpace */), + rule("SpaceAfterSemicolon", 27 /* SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), // Remove extra space between for and await - rule("SpaceBetweenForAndAwaitKeyword", 97 /* ForKeyword */, 133 /* AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */), + rule("SpaceBetweenForAndAwaitKeyword", 99 /* ForKeyword */, 135 /* AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* 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 /* CloseParenToken */, 90 /* DoKeyword */, 91 /* ElseKeyword */, 82 /* CaseKeyword */], + [22 /* CloseParenToken */, 92 /* DoKeyword */, 93 /* ElseKeyword */, 84 /* CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 4 /* InsertSpace */ ), // This low-pri rule takes care of "try {", "catch {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter. - rule("SpaceAfterTryCatchFinally", [111 /* TryKeyword */, 83 /* CatchKeyword */, 96 /* FinallyKeyword */], 18 /* OpenBraceToken */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */) + rule("SpaceAfterTryCatchFinally", [113 /* TryKeyword */, 85 /* CatchKeyword */, 98 /* FinallyKeyword */], 19 /* OpenBraceToken */, [isNonJsxSameLineTokenContext], 4 /* InsertSpace */) ]; return [ ...highPriorityCommonRules, @@ -165524,40 +167372,40 @@ ${options.prefix}` : "\n" : options.prefix return (context) => !context.options || !hasProperty(context.options, optionName) || !!context.options[optionName]; } function isForContext(context) { - return context.contextNode.kind === 245 /* ForStatement */; + return context.contextNode.kind === 247 /* ForStatement */; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 223 /* BinaryExpression */: - return context.contextNode.operatorToken.kind !== 27 /* CommaToken */; - case 224 /* ConditionalExpression */: - case 191 /* ConditionalType */: - case 231 /* AsExpression */: - case 278 /* ExportSpecifier */: - case 273 /* ImportSpecifier */: - case 179 /* TypePredicate */: - case 189 /* UnionType */: - case 190 /* IntersectionType */: - case 235 /* SatisfiesExpression */: + case 225 /* BinaryExpression */: + return context.contextNode.operatorToken.kind !== 28 /* CommaToken */; + case 226 /* ConditionalExpression */: + case 193 /* ConditionalType */: + case 233 /* AsExpression */: + case 280 /* ExportSpecifier */: + case 275 /* ImportSpecifier */: + case 181 /* TypePredicate */: + case 191 /* UnionType */: + case 192 /* IntersectionType */: + case 237 /* SatisfiesExpression */: return true; - case 205 /* BindingElement */: - case 262 /* TypeAliasDeclaration */: - case 268 /* ImportEqualsDeclaration */: - case 274 /* ExportAssignment */: - case 257 /* VariableDeclaration */: - case 166 /* Parameter */: - case 302 /* EnumMember */: - case 169 /* PropertyDeclaration */: - case 168 /* PropertySignature */: - return context.currentTokenSpan.kind === 63 /* EqualsToken */ || context.nextTokenSpan.kind === 63 /* EqualsToken */; - case 246 /* ForInStatement */: - case 165 /* TypeParameter */: - return context.currentTokenSpan.kind === 101 /* InKeyword */ || context.nextTokenSpan.kind === 101 /* InKeyword */ || context.currentTokenSpan.kind === 63 /* EqualsToken */ || context.nextTokenSpan.kind === 63 /* EqualsToken */; - case 247 /* ForOfStatement */: - return context.currentTokenSpan.kind === 162 /* OfKeyword */ || context.nextTokenSpan.kind === 162 /* OfKeyword */; + case 207 /* BindingElement */: + case 264 /* TypeAliasDeclaration */: + case 270 /* ImportEqualsDeclaration */: + case 276 /* ExportAssignment */: + case 259 /* VariableDeclaration */: + case 168 /* Parameter */: + case 305 /* EnumMember */: + case 171 /* PropertyDeclaration */: + case 170 /* PropertySignature */: + return context.currentTokenSpan.kind === 64 /* EqualsToken */ || context.nextTokenSpan.kind === 64 /* EqualsToken */; + case 248 /* ForInStatement */: + case 167 /* TypeParameter */: + return context.currentTokenSpan.kind === 103 /* InKeyword */ || context.nextTokenSpan.kind === 103 /* InKeyword */ || context.currentTokenSpan.kind === 64 /* EqualsToken */ || context.nextTokenSpan.kind === 64 /* EqualsToken */; + case 249 /* ForOfStatement */: + return context.currentTokenSpan.kind === 164 /* OfKeyword */ || context.nextTokenSpan.kind === 164 /* OfKeyword */; } return false; } @@ -165569,16 +167417,16 @@ ${options.prefix}` : "\n" : options.prefix } function isTypeAnnotationContext(context) { const contextKind = context.contextNode.kind; - return contextKind === 169 /* PropertyDeclaration */ || contextKind === 168 /* PropertySignature */ || contextKind === 166 /* Parameter */ || contextKind === 257 /* VariableDeclaration */ || isFunctionLikeKind(contextKind); + return contextKind === 171 /* PropertyDeclaration */ || contextKind === 170 /* PropertySignature */ || contextKind === 168 /* Parameter */ || contextKind === 259 /* VariableDeclaration */ || isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 224 /* ConditionalExpression */ || context.contextNode.kind === 191 /* ConditionalType */; + return context.contextNode.kind === 226 /* ConditionalExpression */ || context.contextNode.kind === 193 /* ConditionalType */; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 203 /* ObjectBindingPattern */ || context.contextNode.kind === 197 /* MappedType */ || isSingleLineBlockContext(context); + return context.contextNode.kind === 205 /* ObjectBindingPattern */ || context.contextNode.kind === 199 /* MappedType */ || isSingleLineBlockContext(context); } function isBeforeMultilineBlockContext(context) { return isBeforeBlockContext(context) && !(context.NextNodeAllOnSameLine() || context.NextNodeBlockIsOnOneLine()); @@ -165600,26 +167448,26 @@ ${options.prefix}` : "\n" : options.prefix return true; } switch (node.kind) { - case 238 /* Block */: - case 266 /* CaseBlock */: - case 207 /* ObjectLiteralExpression */: - case 265 /* ModuleBlock */: + case 240 /* Block */: + case 268 /* CaseBlock */: + case 209 /* ObjectLiteralExpression */: + case 267 /* ModuleBlock */: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 259 /* FunctionDeclaration */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - case 176 /* CallSignature */: - case 215 /* FunctionExpression */: - case 173 /* Constructor */: - case 216 /* ArrowFunction */: - case 261 /* InterfaceDeclaration */: + case 261 /* FunctionDeclaration */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + case 178 /* CallSignature */: + case 217 /* FunctionExpression */: + case 175 /* Constructor */: + case 218 /* ArrowFunction */: + case 263 /* InterfaceDeclaration */: return true; } return false; @@ -165628,39 +167476,39 @@ ${options.prefix}` : "\n" : options.prefix return !isFunctionDeclContext(context); } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 259 /* FunctionDeclaration */ || context.contextNode.kind === 215 /* FunctionExpression */; + return context.contextNode.kind === 261 /* FunctionDeclaration */ || context.contextNode.kind === 217 /* FunctionExpression */; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 261 /* InterfaceDeclaration */: - case 263 /* EnumDeclaration */: - case 184 /* TypeLiteral */: - case 264 /* ModuleDeclaration */: - case 275 /* ExportDeclaration */: - case 276 /* NamedExports */: - case 269 /* ImportDeclaration */: - case 272 /* NamedImports */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 263 /* InterfaceDeclaration */: + case 265 /* EnumDeclaration */: + case 186 /* TypeLiteral */: + case 266 /* ModuleDeclaration */: + case 277 /* ExportDeclaration */: + case 278 /* NamedExports */: + case 271 /* ImportDeclaration */: + case 274 /* NamedImports */: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 260 /* ClassDeclaration */: - case 264 /* ModuleDeclaration */: - case 263 /* EnumDeclaration */: - case 295 /* CatchClause */: - case 265 /* ModuleBlock */: - case 252 /* SwitchStatement */: + case 262 /* ClassDeclaration */: + case 266 /* ModuleDeclaration */: + case 265 /* EnumDeclaration */: + case 298 /* CatchClause */: + case 267 /* ModuleBlock */: + case 254 /* SwitchStatement */: return true; - case 238 /* Block */: { + case 240 /* Block */: { const blockParent = context.currentTokenParent.parent; - if (!blockParent || blockParent.kind !== 216 /* ArrowFunction */ && blockParent.kind !== 215 /* FunctionExpression */) { + if (!blockParent || blockParent.kind !== 218 /* ArrowFunction */ && blockParent.kind !== 217 /* FunctionExpression */) { return true; } } @@ -165669,68 +167517,68 @@ ${options.prefix}` : "\n" : options.prefix } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 242 /* IfStatement */: - case 252 /* SwitchStatement */: - case 245 /* ForStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: - case 244 /* WhileStatement */: - case 255 /* TryStatement */: - case 243 /* DoStatement */: - case 251 /* WithStatement */: - case 295 /* CatchClause */: + case 244 /* IfStatement */: + case 254 /* SwitchStatement */: + case 247 /* ForStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 246 /* WhileStatement */: + case 257 /* TryStatement */: + case 245 /* DoStatement */: + case 253 /* WithStatement */: + case 298 /* CatchClause */: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 207 /* ObjectLiteralExpression */; + return context.contextNode.kind === 209 /* ObjectLiteralExpression */; } function isFunctionCallContext(context) { - return context.contextNode.kind === 210 /* CallExpression */; + return context.contextNode.kind === 212 /* CallExpression */; } function isNewContext(context) { - return context.contextNode.kind === 211 /* NewExpression */; + return context.contextNode.kind === 213 /* NewExpression */; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); } function isPreviousTokenNotComma(context) { - return context.currentTokenSpan.kind !== 27 /* CommaToken */; + return context.currentTokenSpan.kind !== 28 /* CommaToken */; } function isNextTokenNotCloseBracket(context) { - return context.nextTokenSpan.kind !== 23 /* CloseBracketToken */; + return context.nextTokenSpan.kind !== 24 /* CloseBracketToken */; } function isNextTokenNotCloseParen(context) { - return context.nextTokenSpan.kind !== 21 /* CloseParenToken */; + return context.nextTokenSpan.kind !== 22 /* CloseParenToken */; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 216 /* ArrowFunction */; + return context.contextNode.kind === 218 /* ArrowFunction */; } function isImportTypeContext(context) { - return context.contextNode.kind === 202 /* ImportType */; + return context.contextNode.kind === 204 /* ImportType */; } function isNonJsxSameLineTokenContext(context) { - return context.TokensAreOnSameLine() && context.contextNode.kind !== 11 /* JsxText */; + return context.TokensAreOnSameLine() && context.contextNode.kind !== 12 /* JsxText */; } function isNonJsxTextContext(context) { - return context.contextNode.kind !== 11 /* JsxText */; + return context.contextNode.kind !== 12 /* JsxText */; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 281 /* JsxElement */ && context.contextNode.kind !== 285 /* JsxFragment */; + return context.contextNode.kind !== 283 /* JsxElement */ && context.contextNode.kind !== 287 /* JsxFragment */; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 291 /* JsxExpression */ || context.contextNode.kind === 290 /* JsxSpreadAttribute */; + return context.contextNode.kind === 293 /* JsxExpression */ || context.contextNode.kind === 292 /* JsxSpreadAttribute */; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 288 /* JsxAttribute */; + return context.nextTokenParent.kind === 290 /* JsxAttribute */; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 288 /* JsxAttribute */; + return context.contextNode.kind === 290 /* JsxAttribute */; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 282 /* JsxSelfClosingElement */; + return context.contextNode.kind === 284 /* JsxSelfClosingElement */; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -165742,44 +167590,44 @@ ${options.prefix}` : "\n" : options.prefix while (node && isExpression(node)) { node = node.parent; } - return node && node.kind === 167 /* Decorator */; + return node && node.kind === 169 /* Decorator */; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 258 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; + return context.currentTokenParent.kind === 260 /* VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2 /* FormatOnEnter */; } function isModuleDeclContext(context) { - return context.contextNode.kind === 264 /* ModuleDeclaration */; + return context.contextNode.kind === 266 /* ModuleDeclaration */; } function isObjectTypeContext(context) { - return context.contextNode.kind === 184 /* TypeLiteral */; + return context.contextNode.kind === 186 /* TypeLiteral */; } function isConstructorSignatureContext(context) { - return context.contextNode.kind === 177 /* ConstructSignature */; + return context.contextNode.kind === 179 /* ConstructSignature */; } function isTypeArgumentOrParameterOrAssertion(token, parent2) { - if (token.kind !== 29 /* LessThanToken */ && token.kind !== 31 /* GreaterThanToken */) { + if (token.kind !== 30 /* LessThanToken */ && token.kind !== 32 /* GreaterThanToken */) { return false; } switch (parent2.kind) { - case 180 /* TypeReference */: - case 213 /* TypeAssertionExpression */: - case 262 /* TypeAliasDeclaration */: - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 261 /* InterfaceDeclaration */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 176 /* CallSignature */: - case 177 /* ConstructSignature */: - case 210 /* CallExpression */: - case 211 /* NewExpression */: - case 230 /* ExpressionWithTypeArguments */: + case 182 /* TypeReference */: + case 215 /* TypeAssertionExpression */: + case 264 /* TypeAliasDeclaration */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 263 /* InterfaceDeclaration */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 178 /* CallSignature */: + case 179 /* ConstructSignature */: + case 212 /* CallExpression */: + case 213 /* NewExpression */: + case 232 /* ExpressionWithTypeArguments */: return true; default: return false; @@ -165789,31 +167637,31 @@ ${options.prefix}` : "\n" : options.prefix return isTypeArgumentOrParameterOrAssertion(context.currentTokenSpan, context.currentTokenParent) || isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 213 /* TypeAssertionExpression */; + return context.contextNode.kind === 215 /* TypeAssertionExpression */; } function isNonTypeAssertionContext(context) { return !isTypeAssertionContext(context); } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 114 /* VoidKeyword */ && context.currentTokenParent.kind === 219 /* VoidExpression */; + return context.currentTokenSpan.kind === 116 /* VoidKeyword */ && context.currentTokenParent.kind === 221 /* VoidExpression */; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 226 /* YieldExpression */ && context.contextNode.expression !== void 0; + return context.contextNode.kind === 228 /* YieldExpression */ && context.contextNode.expression !== void 0; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 232 /* NonNullExpression */; + return context.contextNode.kind === 234 /* NonNullExpression */; } function isNotStatementConditionContext(context) { return !isStatementConditionContext(context); } function isStatementConditionContext(context) { switch (context.contextNode.kind) { - case 242 /* IfStatement */: - case 245 /* ForStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: - case 243 /* DoStatement */: - case 244 /* WhileStatement */: + case 244 /* IfStatement */: + case 247 /* ForStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 245 /* DoStatement */: + case 246 /* WhileStatement */: return true; default: return false; @@ -165837,18 +167685,18 @@ ${options.prefix}` : "\n" : options.prefix const startLine = context.sourceFile.getLineAndCharacterOfPosition(context.currentTokenSpan.pos).line; const endLine = context.sourceFile.getLineAndCharacterOfPosition(nextTokenStart).line; if (startLine === endLine) { - return nextTokenKind === 19 /* CloseBraceToken */ || nextTokenKind === 1 /* EndOfFileToken */; + return nextTokenKind === 20 /* CloseBraceToken */ || nextTokenKind === 1 /* EndOfFileToken */; } - if (nextTokenKind === 237 /* SemicolonClassElement */ || nextTokenKind === 26 /* SemicolonToken */) { + if (nextTokenKind === 239 /* SemicolonClassElement */ || nextTokenKind === 27 /* SemicolonToken */) { return false; } - if (context.contextNode.kind === 261 /* InterfaceDeclaration */ || context.contextNode.kind === 262 /* TypeAliasDeclaration */) { - return !isPropertySignature(context.currentTokenParent) || !!context.currentTokenParent.type || nextTokenKind !== 20 /* OpenParenToken */; + if (context.contextNode.kind === 263 /* InterfaceDeclaration */ || context.contextNode.kind === 264 /* TypeAliasDeclaration */) { + return !isPropertySignature(context.currentTokenParent) || !!context.currentTokenParent.type || nextTokenKind !== 21 /* OpenParenToken */; } if (isPropertyDeclaration(context.currentTokenParent)) { return !context.currentTokenParent.initializer; } - return context.currentTokenParent.kind !== 245 /* ForStatement */ && context.currentTokenParent.kind !== 239 /* EmptyStatement */ && context.currentTokenParent.kind !== 237 /* SemicolonClassElement */ && nextTokenKind !== 22 /* OpenBracketToken */ && nextTokenKind !== 20 /* OpenParenToken */ && nextTokenKind !== 39 /* PlusToken */ && nextTokenKind !== 40 /* MinusToken */ && nextTokenKind !== 43 /* SlashToken */ && nextTokenKind !== 13 /* RegularExpressionLiteral */ && nextTokenKind !== 27 /* CommaToken */ && nextTokenKind !== 225 /* TemplateExpression */ && nextTokenKind !== 15 /* TemplateHead */ && nextTokenKind !== 14 /* NoSubstitutionTemplateLiteral */ && nextTokenKind !== 24 /* DotToken */; + return context.currentTokenParent.kind !== 247 /* ForStatement */ && context.currentTokenParent.kind !== 241 /* EmptyStatement */ && context.currentTokenParent.kind !== 239 /* SemicolonClassElement */ && nextTokenKind !== 23 /* OpenBracketToken */ && nextTokenKind !== 21 /* OpenParenToken */ && nextTokenKind !== 40 /* PlusToken */ && nextTokenKind !== 41 /* MinusToken */ && nextTokenKind !== 44 /* SlashToken */ && nextTokenKind !== 14 /* RegularExpressionLiteral */ && nextTokenKind !== 28 /* CommaToken */ && nextTokenKind !== 227 /* TemplateExpression */ && nextTokenKind !== 16 /* TemplateHead */ && nextTokenKind !== 15 /* NoSubstitutionTemplateLiteral */ && nextTokenKind !== 25 /* DotToken */; } function isSemicolonInsertionContext(context) { return positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile); @@ -165929,7 +167777,7 @@ ${options.prefix}` : "\n" : options.prefix return map2; } function getRuleBucketIndex(row, column) { - Debug.assert(row <= 162 /* LastKeyword */ && column <= 162 /* LastKeyword */, "Must compute formatting context from tokens"); + Debug.assert(row <= 164 /* LastKeyword */ && column <= 164 /* LastKeyword */, "Must compute formatting context from tokens"); return row * mapRowLength + column; } function addRule(rules, rule2, specificTokens, constructionState, rulesBucketIndex) { @@ -165959,7 +167807,7 @@ ${options.prefix}` : "\n" : options.prefix init_ts_formatting(); maskBitSize = 5; mask = 31; - mapRowLength = 162 /* LastToken */ + 1; + mapRowLength = 164 /* LastToken */ + 1; RulesPosition = ((RulesPosition2) => { RulesPosition2[RulesPosition2["StopRulesSpecific"] = 0] = "StopRulesSpecific"; RulesPosition2[RulesPosition2["StopRulesAny"] = maskBitSize * 1] = "StopRulesAny"; @@ -166003,11 +167851,11 @@ ${options.prefix}` : "\n" : options.prefix return formatSpan(span, sourceFile, formatContext, 2 /* FormatOnEnter */); } function formatOnSemicolon(position, sourceFile, formatContext) { - const semicolon = findImmediatelyPrecedingTokenOfKind(position, 26 /* SemicolonToken */, sourceFile); + const semicolon = findImmediatelyPrecedingTokenOfKind(position, 27 /* SemicolonToken */, sourceFile); return formatNodeLines(findOutermostNodeWithinListLevel(semicolon), sourceFile, formatContext, 3 /* FormatOnSemicolon */); } function formatOnOpeningCurly(position, sourceFile, formatContext) { - const openingCurly = findImmediatelyPrecedingTokenOfKind(position, 18 /* OpenBraceToken */, sourceFile); + const openingCurly = findImmediatelyPrecedingTokenOfKind(position, 19 /* OpenBraceToken */, sourceFile); if (!openingCurly) { return []; } @@ -166021,7 +167869,7 @@ ${options.prefix}` : "\n" : options.prefix return formatSpan(textRange, sourceFile, formatContext, 4 /* FormatOnOpeningCurlyBrace */); } function formatOnClosingCurly(position, sourceFile, formatContext) { - const precedingToken = findImmediatelyPrecedingTokenOfKind(position, 19 /* CloseBraceToken */, sourceFile); + const precedingToken = findImmediatelyPrecedingTokenOfKind(position, 20 /* CloseBraceToken */, sourceFile); return formatNodeLines(findOutermostNodeWithinListLevel(precedingToken), sourceFile, formatContext, 5 /* FormatOnClosingCurlyBrace */); } function formatDocument(sourceFile, formatContext) { @@ -166051,17 +167899,17 @@ ${options.prefix}` : "\n" : options.prefix } function isListElement(parent2, node) { switch (parent2.kind) { - case 260 /* ClassDeclaration */: - case 261 /* InterfaceDeclaration */: + case 262 /* ClassDeclaration */: + case 263 /* InterfaceDeclaration */: return rangeContainsRange(parent2.members, node); - case 264 /* ModuleDeclaration */: + case 266 /* ModuleDeclaration */: const body = parent2.body; - return !!body && body.kind === 265 /* ModuleBlock */ && rangeContainsRange(body.statements, node); - case 308 /* SourceFile */: - case 238 /* Block */: - case 265 /* ModuleBlock */: + return !!body && body.kind === 267 /* ModuleBlock */ && rangeContainsRange(body.statements, node); + case 311 /* SourceFile */: + case 240 /* Block */: + case 267 /* ModuleBlock */: return rangeContainsRange(parent2.statements, node); - case 295 /* CatchClause */: + case 298 /* CatchClause */: return rangeContainsRange(parent2.block.statements, node); } return false; @@ -166184,7 +168032,7 @@ ${options.prefix}` : "\n" : options.prefix ); } function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delta, formattingScanner, { options, getRules, host }, requestKind, rangeContainsError, sourceFile) { - var _a2; + var _a; const formattingContext = new FormattingContext(sourceFile, requestKind, options); let previousRangeTriviaEnd; let previousRange; @@ -166233,10 +168081,10 @@ ${options.prefix}` : "\n" : options.prefix } } } - if (previousRange && formattingScanner.getStartPos() >= originalRange.end) { + if (previousRange && formattingScanner.getTokenFullStart() >= originalRange.end) { const tokenInfo = formattingScanner.isOnEOF() ? formattingScanner.readEOFTokenRange() : formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(enclosingNode).token : void 0; if (tokenInfo && tokenInfo.pos === previousRangeTriviaEnd) { - const parent2 = ((_a2 = findPrecedingToken(tokenInfo.end, sourceFile, enclosingNode)) == null ? void 0 : _a2.parent) || previousParent; + const parent2 = ((_a = findPrecedingToken(tokenInfo.end, sourceFile, enclosingNode)) == null ? void 0 : _a.parent) || previousParent; processPair( tokenInfo, sourceFile.getLineAndCharacterOfPosition(tokenInfo.pos).line, @@ -166275,7 +168123,7 @@ ${options.prefix}` : "\n" : options.prefix delta: Math.min(options.indentSize, parentDynamicIndentation.getDelta(node) + delta2) }; } else if (inheritedIndentation === -1 /* Unknown */) { - if (node.kind === 20 /* OpenParenToken */ && startLine === lastIndentedLine) { + if (node.kind === 21 /* OpenParenToken */ && startLine === lastIndentedLine) { return { indentation: indentationOnLastIndentedLine, delta: parentDynamicIndentation.getDelta(node) }; } else if (SmartIndenter.childStartsOnTheSameLineWithElseInIfStatement(parent2, node, startLine, sourceFile) || SmartIndenter.childIsUnindentedBranchOfConditionalExpression(parent2, node, startLine, sourceFile) || SmartIndenter.argumentStartsOnSameLineAsPreviousArgument(parent2, node, startLine, sourceFile)) { return { indentation: parentDynamicIndentation.getIndentation(), delta: delta2 }; @@ -166293,24 +168141,24 @@ ${options.prefix}` : "\n" : options.prefix return modifier.kind; } switch (node.kind) { - case 260 /* ClassDeclaration */: - return 84 /* ClassKeyword */; - case 261 /* InterfaceDeclaration */: - return 118 /* InterfaceKeyword */; - case 259 /* FunctionDeclaration */: - return 98 /* FunctionKeyword */; - case 263 /* EnumDeclaration */: - return 263 /* EnumDeclaration */; - case 174 /* GetAccessor */: - return 137 /* GetKeyword */; - case 175 /* SetAccessor */: - return 151 /* SetKeyword */; - case 171 /* MethodDeclaration */: + case 262 /* ClassDeclaration */: + return 86 /* ClassKeyword */; + case 263 /* InterfaceDeclaration */: + return 120 /* InterfaceKeyword */; + case 261 /* FunctionDeclaration */: + return 100 /* FunctionKeyword */; + case 265 /* EnumDeclaration */: + return 265 /* EnumDeclaration */; + case 176 /* GetAccessor */: + return 139 /* GetKeyword */; + case 177 /* SetAccessor */: + return 153 /* SetKeyword */; + case 173 /* MethodDeclaration */: if (node.asteriskToken) { - return 41 /* AsteriskToken */; + return 42 /* AsteriskToken */; } - case 169 /* PropertyDeclaration */: - case 166 /* Parameter */: + case 171 /* PropertyDeclaration */: + case 168 /* Parameter */: const name = getNameOfDeclaration(node); if (name) { return name.kind; @@ -166321,9 +168169,9 @@ ${options.prefix}` : "\n" : options.prefix return { getIndentationForComment: (kind, tokenIndentation, container) => { switch (kind) { - case 19 /* CloseBraceToken */: - case 23 /* CloseBracketToken */: - case 21 /* CloseParenToken */: + case 20 /* CloseBraceToken */: + case 24 /* CloseBracketToken */: + case 22 /* CloseParenToken */: return indentation + getDelta(container); } return tokenIndentation !== -1 /* Unknown */ ? tokenIndentation : indentation; @@ -166350,25 +168198,25 @@ ${options.prefix}` : "\n" : options.prefix }; function shouldAddDelta(line, kind, container) { switch (kind) { - case 18 /* OpenBraceToken */: - case 19 /* CloseBraceToken */: - case 21 /* CloseParenToken */: - case 91 /* ElseKeyword */: - case 115 /* WhileKeyword */: - case 59 /* AtToken */: + case 19 /* OpenBraceToken */: + case 20 /* CloseBraceToken */: + case 22 /* CloseParenToken */: + case 93 /* ElseKeyword */: + case 117 /* WhileKeyword */: + case 60 /* AtToken */: return false; - case 43 /* SlashToken */: - case 31 /* GreaterThanToken */: + case 44 /* SlashToken */: + case 32 /* GreaterThanToken */: switch (container.kind) { - case 283 /* JsxOpeningElement */: - case 284 /* JsxClosingElement */: - case 282 /* JsxSelfClosingElement */: + case 285 /* JsxOpeningElement */: + case 286 /* JsxClosingElement */: + case 284 /* JsxSelfClosingElement */: return false; } break; - case 22 /* OpenBracketToken */: - case 23 /* CloseBracketToken */: - if (container.kind !== 197 /* MappedType */) { + case 23 /* OpenBracketToken */: + case 24 /* CloseBracketToken */: + if (container.kind !== 199 /* MappedType */) { return false; } break; @@ -166411,7 +168259,7 @@ ${options.prefix}` : "\n" : options.prefix processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation); } ); - while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) { + while (formattingScanner.isOnToken() && formattingScanner.getTokenFullStart() < originalRange.end) { const tokenInfo = formattingScanner.readTokenInfo(node); if (tokenInfo.token.end > Math.min(node.end, originalRange.end)) { break; @@ -166445,7 +168293,7 @@ ${options.prefix}` : "\n" : options.prefix if (child.getFullWidth() === 0) { return inheritedIndentation; } - while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) { + while (formattingScanner.isOnToken() && formattingScanner.getTokenFullStart() < originalRange.end) { const tokenInfo = formattingScanner.readTokenInfo(node); if (tokenInfo.token.end > originalRange.end) { return inheritedIndentation; @@ -166458,22 +168306,22 @@ ${options.prefix}` : "\n" : options.prefix } consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node); } - if (!formattingScanner.isOnToken() || formattingScanner.getStartPos() >= originalRange.end) { + if (!formattingScanner.isOnToken() || formattingScanner.getTokenFullStart() >= originalRange.end) { return inheritedIndentation; } if (isToken(child)) { const tokenInfo = formattingScanner.readTokenInfo(child); - if (child.kind !== 11 /* JsxText */) { + if (child.kind !== 12 /* JsxText */) { Debug.assert(tokenInfo.token.end === child.end, "Token end is child end"); consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child); return inheritedIndentation; } } - const effectiveParentStartLine = child.kind === 167 /* Decorator */ ? childStartLine : undecoratedParentStartLine; + const effectiveParentStartLine = child.kind === 169 /* Decorator */ ? childStartLine : undecoratedParentStartLine; const childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent2.kind === 206 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { + if (isFirstListItem && parent2.kind === 208 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -166491,7 +168339,7 @@ ${options.prefix}` : "\n" : options.prefix return; } if (listStartToken !== 0 /* Unknown */) { - while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) { + while (formattingScanner.isOnToken() && formattingScanner.getTokenFullStart() < originalRange.end) { const tokenInfo = formattingScanner.readTokenInfo(parent2); if (tokenInfo.token.end > nodes.pos) { break; @@ -166528,9 +168376,9 @@ ${options.prefix}` : "\n" : options.prefix ); } const listEndToken = getCloseTokenForOpenToken(listStartToken); - if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) { + if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getTokenFullStart() < originalRange.end) { let tokenInfo = formattingScanner.readTokenInfo(parent2); - if (tokenInfo.token.kind === 27 /* CommaToken */) { + if (tokenInfo.token.kind === 28 /* CommaToken */) { consumeTokenAndAdvanceScanner(tokenInfo, parent2, listDynamicIndentation, parent2); tokenInfo = formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(parent2) : void 0; } @@ -166894,62 +168742,62 @@ ${options.prefix}` : "\n" : options.prefix } function getOpenTokenForList(node, list) { switch (node.kind) { - case 173 /* Constructor */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 216 /* ArrowFunction */: - case 176 /* CallSignature */: - case 177 /* ConstructSignature */: - case 181 /* FunctionType */: - case 182 /* ConstructorType */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: + case 175 /* Constructor */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 218 /* ArrowFunction */: + case 178 /* CallSignature */: + case 179 /* ConstructSignature */: + case 183 /* FunctionType */: + case 184 /* ConstructorType */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: if (node.typeParameters === list) { - return 29 /* LessThanToken */; + return 30 /* LessThanToken */; } else if (node.parameters === list) { - return 20 /* OpenParenToken */; + return 21 /* OpenParenToken */; } break; - case 210 /* CallExpression */: - case 211 /* NewExpression */: + case 212 /* CallExpression */: + case 213 /* NewExpression */: if (node.typeArguments === list) { - return 29 /* LessThanToken */; + return 30 /* LessThanToken */; } else if (node.arguments === list) { - return 20 /* OpenParenToken */; + return 21 /* OpenParenToken */; } break; - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 261 /* InterfaceDeclaration */: - case 262 /* TypeAliasDeclaration */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 263 /* InterfaceDeclaration */: + case 264 /* TypeAliasDeclaration */: if (node.typeParameters === list) { - return 29 /* LessThanToken */; + return 30 /* LessThanToken */; } break; - case 180 /* TypeReference */: - case 212 /* TaggedTemplateExpression */: - case 183 /* TypeQuery */: - case 230 /* ExpressionWithTypeArguments */: - case 202 /* ImportType */: + case 182 /* TypeReference */: + case 214 /* TaggedTemplateExpression */: + case 185 /* TypeQuery */: + case 232 /* ExpressionWithTypeArguments */: + case 204 /* ImportType */: if (node.typeArguments === list) { - return 29 /* LessThanToken */; + return 30 /* LessThanToken */; } break; - case 184 /* TypeLiteral */: - return 18 /* OpenBraceToken */; + case 186 /* TypeLiteral */: + return 19 /* OpenBraceToken */; } return 0 /* Unknown */; } function getCloseTokenForOpenToken(kind) { switch (kind) { - case 20 /* OpenParenToken */: - return 21 /* CloseParenToken */; - case 29 /* LessThanToken */: - return 31 /* GreaterThanToken */; - case 18 /* OpenBraceToken */: - return 19 /* CloseBraceToken */; + case 21 /* OpenParenToken */: + return 22 /* CloseParenToken */; + case 30 /* LessThanToken */: + return 32 /* GreaterThanToken */; + case 19 /* OpenBraceToken */: + return 20 /* CloseBraceToken */; } return 0 /* Unknown */; } @@ -167037,11 +168885,11 @@ ${options.prefix}` : "\n" : options.prefix } const lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; const currentToken = getTokenAtPosition(sourceFile, position); - const isObjectLiteral = currentToken.kind === 18 /* OpenBraceToken */ && currentToken.parent.kind === 207 /* ObjectLiteralExpression */; + const isObjectLiteral = currentToken.kind === 19 /* OpenBraceToken */ && currentToken.parent.kind === 209 /* ObjectLiteralExpression */; if (options.indentStyle === 1 /* Block */ || isObjectLiteral) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 27 /* CommaToken */ && precedingToken.parent.kind !== 223 /* BinaryExpression */) { + if (precedingToken.kind === 28 /* CommaToken */ && precedingToken.parent.kind !== 225 /* BinaryExpression */) { const actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Unknown */) { return actualIndentation; @@ -167049,7 +168897,7 @@ ${options.prefix}` : "\n" : options.prefix } const containerList = getListByPosition(position, precedingToken.parent, sourceFile); if (containerList && !rangeContainsRange(containerList, precedingToken)) { - const useTheSameBaseIndentation = [215 /* FunctionExpression */, 216 /* ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; + const useTheSameBaseIndentation = [217 /* FunctionExpression */, 218 /* ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; const indentSize = useTheSameBaseIndentation ? 0 : options.indentSize; return getActualIndentationForListStartLine(containerList, sourceFile, options) + indentSize; } @@ -167145,7 +168993,7 @@ ${options.prefix}` : "\n" : options.prefix } SmartIndenter2.getBaseIndentation = getBaseIndentation; function getIndentationForNodeWorker(current, currentStart, ignoreActualIndentationRange, indentationDelta, sourceFile, isNextChild, options) { - var _a2; + var _a; let parent2 = current.parent; while (parent2) { let useActualIndentation = true; @@ -167156,7 +169004,7 @@ ${options.prefix}` : "\n" : options.prefix const containingListOrParentStart = getContainingListOrParentStart(parent2, current, sourceFile); const parentAndChildShareLine = containingListOrParentStart.line === currentStart.line || childStartsOnTheSameLineWithElseInIfStatement(parent2, current, currentStart.line, sourceFile); if (useActualIndentation) { - const firstListChild = (_a2 = getContainingList(current, sourceFile)) == null ? void 0 : _a2[0]; + const firstListChild = (_a = getContainingList(current, sourceFile)) == null ? void 0 : _a[0]; const listIndentsChild = !!firstListChild && getStartLineAndCharacterForNode(firstListChild, sourceFile).line > containingListOrParentStart.line; let actualIndentation = getActualIndentationForListItem(current, sourceFile, options, listIndentsChild); if (actualIndentation !== -1 /* Unknown */) { @@ -167191,7 +169039,7 @@ ${options.prefix}` : "\n" : options.prefix } } function getActualIndentationForNode(current, parent2, currentLineAndChar, parentAndChildShareLine, sourceFile, options) { - const useActualIndentation = (isDeclaration(current) || isStatementButNotDeclaration(current)) && (parent2.kind === 308 /* SourceFile */ || !parentAndChildShareLine); + const useActualIndentation = (isDeclaration(current) || isStatementButNotDeclaration(current)) && (parent2.kind === 311 /* SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Unknown */; } @@ -167208,9 +169056,9 @@ ${options.prefix}` : "\n" : options.prefix if (!nextToken) { return 0 /* Unknown */; } - if (nextToken.kind === 18 /* OpenBraceToken */) { + if (nextToken.kind === 19 /* OpenBraceToken */) { return 1 /* OpenBrace */; - } else if (nextToken.kind === 19 /* CloseBraceToken */) { + } else if (nextToken.kind === 20 /* CloseBraceToken */) { const nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; return lineAtPosition === nextTokenStartLine ? 2 /* CloseBrace */ : 0 /* Unknown */; } @@ -167229,8 +169077,8 @@ ${options.prefix}` : "\n" : options.prefix } SmartIndenter2.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent2, child, childStartLine, sourceFile) { - if (parent2.kind === 242 /* IfStatement */ && parent2.elseStatement === child) { - const elseKeyword = findChildOfKind(parent2, 91 /* ElseKeyword */, sourceFile); + if (parent2.kind === 244 /* IfStatement */ && parent2.elseStatement === child) { + const elseKeyword = findChildOfKind(parent2, 93 /* ElseKeyword */, sourceFile); Debug.assert(elseKeyword !== void 0); const elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; @@ -167280,42 +169128,42 @@ ${options.prefix}` : "\n" : options.prefix } function getListByRange(start, end, node, sourceFile) { switch (node.kind) { - case 180 /* TypeReference */: + case 182 /* TypeReference */: return getList(node.typeArguments); - case 207 /* ObjectLiteralExpression */: + case 209 /* ObjectLiteralExpression */: return getList(node.properties); - case 206 /* ArrayLiteralExpression */: + case 208 /* ArrayLiteralExpression */: return getList(node.elements); - case 184 /* TypeLiteral */: + case 186 /* TypeLiteral */: return getList(node.members); - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 216 /* ArrowFunction */: - case 171 /* MethodDeclaration */: - case 170 /* MethodSignature */: - case 176 /* CallSignature */: - case 173 /* Constructor */: - case 182 /* ConstructorType */: - case 177 /* ConstructSignature */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 218 /* ArrowFunction */: + case 173 /* MethodDeclaration */: + case 172 /* MethodSignature */: + case 178 /* CallSignature */: + case 175 /* Constructor */: + case 184 /* ConstructorType */: + case 179 /* ConstructSignature */: return getList(node.typeParameters) || getList(node.parameters); - case 174 /* GetAccessor */: + case 176 /* GetAccessor */: return getList(node.parameters); - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 261 /* InterfaceDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 348 /* JSDocTemplateTag */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 263 /* InterfaceDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 351 /* JSDocTemplateTag */: return getList(node.typeParameters); - case 211 /* NewExpression */: - case 210 /* CallExpression */: + case 213 /* NewExpression */: + case 212 /* CallExpression */: return getList(node.typeArguments) || getList(node.arguments); - case 258 /* VariableDeclarationList */: + case 260 /* VariableDeclarationList */: return getList(node.declarations); - case 272 /* NamedImports */: - case 276 /* NamedExports */: + case 274 /* NamedImports */: + case 278 /* NamedExports */: return getList(node.elements); - case 203 /* ObjectBindingPattern */: - case 204 /* ArrayBindingPattern */: + case 205 /* ObjectBindingPattern */: + case 206 /* ArrayBindingPattern */: return getList(node.elements); } function getList(list) { @@ -167338,7 +169186,7 @@ ${options.prefix}` : "\n" : options.prefix return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options); } function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) { - if (node.parent && node.parent.kind === 258 /* VariableDeclarationList */) { + if (node.parent && node.parent.kind === 260 /* VariableDeclarationList */) { return -1 /* Unknown */; } const containingList = getContainingList(node, sourceFile); @@ -167359,7 +169207,7 @@ ${options.prefix}` : "\n" : options.prefix const node = list[index]; let lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); for (let i = index - 1; i >= 0; i--) { - if (list[i].kind === 27 /* CommaToken */) { + if (list[i].kind === 28 /* CommaToken */) { continue; } const prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line; @@ -167399,95 +169247,96 @@ ${options.prefix}` : "\n" : options.prefix function nodeWillIndentChild(settings, parent2, child, sourceFile, indentByDefault) { const childKind = child ? child.kind : 0 /* Unknown */; switch (parent2.kind) { - case 241 /* ExpressionStatement */: - case 260 /* ClassDeclaration */: - case 228 /* ClassExpression */: - case 261 /* InterfaceDeclaration */: - case 263 /* EnumDeclaration */: - case 262 /* TypeAliasDeclaration */: - case 206 /* ArrayLiteralExpression */: - case 238 /* Block */: - case 265 /* ModuleBlock */: - case 207 /* ObjectLiteralExpression */: - case 184 /* TypeLiteral */: - case 197 /* MappedType */: - case 186 /* TupleType */: - case 266 /* CaseBlock */: - case 293 /* DefaultClause */: - case 292 /* CaseClause */: - case 214 /* ParenthesizedExpression */: - case 208 /* PropertyAccessExpression */: - case 210 /* CallExpression */: - case 211 /* NewExpression */: - case 240 /* VariableStatement */: - case 274 /* ExportAssignment */: - case 250 /* ReturnStatement */: - case 224 /* ConditionalExpression */: - case 204 /* ArrayBindingPattern */: - case 203 /* ObjectBindingPattern */: - case 283 /* JsxOpeningElement */: - case 286 /* JsxOpeningFragment */: - case 282 /* JsxSelfClosingElement */: - case 291 /* JsxExpression */: - case 170 /* MethodSignature */: - case 176 /* CallSignature */: - case 177 /* ConstructSignature */: - case 166 /* Parameter */: - case 181 /* FunctionType */: - case 182 /* ConstructorType */: - case 193 /* ParenthesizedType */: - case 212 /* TaggedTemplateExpression */: - case 220 /* AwaitExpression */: - case 276 /* NamedExports */: - case 272 /* NamedImports */: - case 278 /* ExportSpecifier */: - case 273 /* ImportSpecifier */: - case 169 /* PropertyDeclaration */: + case 243 /* ExpressionStatement */: + case 262 /* ClassDeclaration */: + case 230 /* ClassExpression */: + case 263 /* InterfaceDeclaration */: + case 265 /* EnumDeclaration */: + case 264 /* TypeAliasDeclaration */: + case 208 /* ArrayLiteralExpression */: + case 240 /* Block */: + case 267 /* ModuleBlock */: + case 209 /* ObjectLiteralExpression */: + case 186 /* TypeLiteral */: + case 199 /* MappedType */: + case 188 /* TupleType */: + case 216 /* ParenthesizedExpression */: + case 210 /* PropertyAccessExpression */: + case 212 /* CallExpression */: + case 213 /* NewExpression */: + case 242 /* VariableStatement */: + case 276 /* ExportAssignment */: + case 252 /* ReturnStatement */: + case 226 /* ConditionalExpression */: + case 206 /* ArrayBindingPattern */: + case 205 /* ObjectBindingPattern */: + case 285 /* JsxOpeningElement */: + case 288 /* JsxOpeningFragment */: + case 284 /* JsxSelfClosingElement */: + case 293 /* JsxExpression */: + case 172 /* MethodSignature */: + case 178 /* CallSignature */: + case 179 /* ConstructSignature */: + case 168 /* Parameter */: + case 183 /* FunctionType */: + case 184 /* ConstructorType */: + case 195 /* ParenthesizedType */: + case 214 /* TaggedTemplateExpression */: + case 222 /* AwaitExpression */: + case 278 /* NamedExports */: + case 274 /* NamedImports */: + case 280 /* ExportSpecifier */: + case 275 /* ImportSpecifier */: + case 171 /* PropertyDeclaration */: + case 295 /* CaseClause */: + case 296 /* DefaultClause */: return true; - case 257 /* VariableDeclaration */: - case 299 /* PropertyAssignment */: - case 223 /* BinaryExpression */: - if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 207 /* ObjectLiteralExpression */) { + case 268 /* CaseBlock */: + return settings.indentSwitchCase ?? true; + case 259 /* VariableDeclaration */: + case 302 /* PropertyAssignment */: + case 225 /* BinaryExpression */: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 209 /* ObjectLiteralExpression */) { return rangeIsOnOneLine(sourceFile, child); } - if (parent2.kind === 223 /* BinaryExpression */ && sourceFile && child && childKind === 281 /* JsxElement */) { + if (parent2.kind === 225 /* BinaryExpression */ && sourceFile && child && childKind === 283 /* JsxElement */) { const parentStartLine = sourceFile.getLineAndCharacterOfPosition(skipTrivia(sourceFile.text, parent2.pos)).line; const childStartLine = sourceFile.getLineAndCharacterOfPosition(skipTrivia(sourceFile.text, child.pos)).line; return parentStartLine !== childStartLine; } - if (parent2.kind !== 223 /* BinaryExpression */) { + if (parent2.kind !== 225 /* BinaryExpression */) { return true; } break; - case 243 /* DoStatement */: - case 244 /* WhileStatement */: - case 246 /* ForInStatement */: - case 247 /* ForOfStatement */: - case 245 /* ForStatement */: - case 242 /* IfStatement */: - case 259 /* FunctionDeclaration */: - case 215 /* FunctionExpression */: - case 171 /* MethodDeclaration */: - case 173 /* Constructor */: - case 174 /* GetAccessor */: - case 175 /* SetAccessor */: - return childKind !== 238 /* Block */; - case 216 /* ArrowFunction */: - if (sourceFile && childKind === 214 /* ParenthesizedExpression */) { + case 245 /* DoStatement */: + case 246 /* WhileStatement */: + case 248 /* ForInStatement */: + case 249 /* ForOfStatement */: + case 247 /* ForStatement */: + case 244 /* IfStatement */: + case 261 /* FunctionDeclaration */: + case 217 /* FunctionExpression */: + case 173 /* MethodDeclaration */: + case 175 /* Constructor */: + case 176 /* GetAccessor */: + case 177 /* SetAccessor */: + return childKind !== 240 /* Block */; + case 218 /* ArrowFunction */: + if (sourceFile && childKind === 216 /* ParenthesizedExpression */) { return rangeIsOnOneLine(sourceFile, child); } - return childKind !== 238 /* Block */; - case 275 /* ExportDeclaration */: - return childKind !== 276 /* NamedExports */; - case 269 /* ImportDeclaration */: - return childKind !== 270 /* ImportClause */ || !!child.namedBindings && child.namedBindings.kind !== 272 /* NamedImports */; - case 281 /* JsxElement */: - return childKind !== 284 /* JsxClosingElement */; - case 285 /* JsxFragment */: - return childKind !== 287 /* JsxClosingFragment */; - case 190 /* IntersectionType */: - case 189 /* UnionType */: - if (childKind === 184 /* TypeLiteral */ || childKind === 186 /* TupleType */) { + return childKind !== 240 /* Block */; + case 277 /* ExportDeclaration */: + return childKind !== 278 /* NamedExports */; + case 271 /* ImportDeclaration */: + return childKind !== 272 /* ImportClause */ || !!child.namedBindings && child.namedBindings.kind !== 274 /* NamedImports */; + case 283 /* JsxElement */: + return childKind !== 286 /* JsxClosingElement */; + case 287 /* JsxFragment */: + return childKind !== 289 /* JsxClosingFragment */; + case 192 /* IntersectionType */: + case 191 /* UnionType */: + if (childKind === 186 /* TypeLiteral */ || childKind === 188 /* TupleType */) { return false; } break; @@ -167497,11 +169346,11 @@ ${options.prefix}` : "\n" : options.prefix SmartIndenter2.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent2) { switch (kind) { - case 250 /* ReturnStatement */: - case 254 /* ThrowStatement */: - case 248 /* ContinueStatement */: - case 249 /* BreakStatement */: - return parent2.kind !== 238 /* Block */; + case 252 /* ReturnStatement */: + case 256 /* ThrowStatement */: + case 250 /* ContinueStatement */: + case 251 /* BreakStatement */: + return parent2.kind !== 240 /* Block */; default: return false; } @@ -167609,7 +169458,7 @@ ${options.prefix}` : "\n" : options.prefix // src/deprecatedCompat/deprecate.ts function getTypeScriptVersion() { - return typeScriptVersion2 != null ? typeScriptVersion2 : typeScriptVersion2 = new Version(version); + return typeScriptVersion2 ?? (typeScriptVersion2 = new Version(version)); } function formatDeprecationMessage(name, error, errorAfter, since, message) { let deprecationMessage = error ? "DeprecationError: " : "DeprecationWarning: "; @@ -167649,11 +169498,10 @@ ${options.prefix}` : "\n" : options.prefix }; } function createDeprecation(name, options = {}) { - var _a2, _b; - const version2 = typeof options.typeScriptVersion === "string" ? new Version(options.typeScriptVersion) : (_a2 = options.typeScriptVersion) != null ? _a2 : getTypeScriptVersion(); + const version2 = typeof options.typeScriptVersion === "string" ? new Version(options.typeScriptVersion) : options.typeScriptVersion ?? getTypeScriptVersion(); const errorAfter = typeof options.errorAfter === "string" ? new Version(options.errorAfter) : options.errorAfter; const warnAfter = typeof options.warnAfter === "string" ? new Version(options.warnAfter) : options.warnAfter; - const since = typeof options.since === "string" ? new Version(options.since) : (_b = options.since) != null ? _b : warnAfter; + const since = typeof options.since === "string" ? new Version(options.since) : options.since ?? warnAfter; const error = options.error || errorAfter && version2.compareTo(errorAfter) >= 0; const warn = !warnAfter || version2.compareTo(warnAfter) >= 0; return error ? createErrorDeprecation(name, errorAfter, since, options.message) : warn ? createWarningDeprecation(name, errorAfter, since, options.message) : noop; @@ -167665,8 +169513,7 @@ ${options.prefix}` : "\n" : options.prefix }; } function deprecate(func, options) { - var _a2; - const deprecation = createDeprecation((_a2 = options == null ? void 0 : options.name) != null ? _a2 : Debug.getFunctionName(func), options); + const deprecation = createDeprecation((options == null ? void 0 : options.name) ?? Debug.getFunctionName(func), options); return wrapFunction(deprecation, func); } var enableDeprecationWarnings, typeScriptVersion2; @@ -167737,9 +169584,9 @@ ${options.prefix}` : "\n" : options.prefix init_ts5(); init_deprecate(); addObjectAllocatorPatcher((objectAllocator2) => { - const Identifier73 = objectAllocator2.getIdentifierConstructor(); - if (!hasProperty(Identifier73.prototype, "originalKeywordKind")) { - Object.defineProperty(Identifier73.prototype, "originalKeywordKind", { + const Identifier74 = objectAllocator2.getIdentifierConstructor(); + if (!hasProperty(Identifier74.prototype, "originalKeywordKind")) { + Object.defineProperty(Identifier74.prototype, "originalKeywordKind", { get: deprecate(function() { return identifierToKeywordKind(this); }, { @@ -167751,8 +169598,8 @@ ${options.prefix}` : "\n" : options.prefix }) }); } - if (!hasProperty(Identifier73.prototype, "isInJSDocNamespace")) { - Object.defineProperty(Identifier73.prototype, "isInJSDocNamespace", { + if (!hasProperty(Identifier74.prototype, "isInJSDocNamespace")) { + Object.defineProperty(Identifier74.prototype, "isInJSDocNamespace", { get: deprecate(function() { return this.flags & 2048 /* IdentifierIsInJSDocNamespace */ ? true : void 0; }, { @@ -167779,8 +169626,8 @@ ${options.prefix}` : "\n" : options.prefix }); // src/typescript/_namespaces/ts.ts - var ts_exports3 = {}; - __export(ts_exports3, { + var ts_exports2 = {}; + __export(ts_exports2, { ANONYMOUS: () => ANONYMOUS, AccessFlags: () => AccessFlags, AssertionLevel: () => AssertionLevel, @@ -167836,6 +169683,7 @@ ${options.prefix}` : "\n" : options.prefix ImportKind: () => ImportKind, ImportsNotUsedAsValues: () => ImportsNotUsedAsValues, IndentStyle: () => IndentStyle, + IndexFlags: () => IndexFlags, IndexKind: () => IndexKind, InferenceFlags: () => InferenceFlags, InferencePriority: () => InferencePriority, @@ -168001,6 +169849,8 @@ ${options.prefix}` : "\n" : options.prefix canJsonReportNoInputFiles: () => canJsonReportNoInputFiles, canProduceDiagnostics: () => canProduceDiagnostics, canUsePropertyAccess: () => canUsePropertyAccess, + canWatchAffectingLocation: () => canWatchAffectingLocation, + canWatchAtTypes: () => canWatchAtTypes, canWatchDirectoryOrFile: () => canWatchDirectoryOrFile, cartesianProduct: () => cartesianProduct, cast: () => cast, @@ -168082,8 +169932,8 @@ ${options.prefix}` : "\n" : options.prefix convertCompilerOptionsFromJson: () => convertCompilerOptionsFromJson, convertJsonOption: () => convertJsonOption, convertToBase64: () => convertToBase64, + convertToJson: () => convertToJson, convertToObject: () => convertToObject, - convertToObjectWorker: () => convertToObjectWorker, convertToOptionsWithAbsolutePaths: () => convertToOptionsWithAbsolutePaths, convertToRelativePath: () => convertToRelativePath, convertToTSConfig: () => convertToTSConfig, @@ -168160,6 +170010,7 @@ ${options.prefix}` : "\n" : options.prefix createMemberAccessForPropertyName: () => createMemberAccessForPropertyName, createModeAwareCache: () => createModeAwareCache, createModeAwareCacheKey: () => createModeAwareCacheKey, + createModuleNotFoundChain: () => createModuleNotFoundChain, createModuleResolutionCache: () => createModuleResolutionCache, createModuleResolutionLoader: () => createModuleResolutionLoader, createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost, @@ -168216,7 +170067,6 @@ ${options.prefix}` : "\n" : options.prefix createTypeChecker: () => createTypeChecker, createTypeReferenceDirectiveResolutionCache: () => createTypeReferenceDirectiveResolutionCache, createTypeReferenceResolutionLoader: () => createTypeReferenceResolutionLoader, - createUnderscoreEscapedMultiMap: () => createUnderscoreEscapedMultiMap, createUnparsedSourceFile: () => createUnparsedSourceFile, createWatchCompilerHost: () => createWatchCompilerHost2, createWatchCompilerHostOfConfigFile: () => createWatchCompilerHostOfConfigFile, @@ -168290,11 +170140,13 @@ ${options.prefix}` : "\n" : options.prefix extendsHelper: () => extendsHelper, extensionFromPath: () => extensionFromPath, extensionIsTS: () => extensionIsTS, + extensionsNotSupportingExtensionlessResolution: () => extensionsNotSupportingExtensionlessResolution, externalHelpersModuleNameText: () => externalHelpersModuleNameText, factory: () => factory, fileExtensionIs: () => fileExtensionIs, fileExtensionIsOneOf: () => fileExtensionIsOneOf, fileIncludeReasonToDiagnostics: () => fileIncludeReasonToDiagnostics, + fileShouldUseJavaScriptRequire: () => fileShouldUseJavaScriptRequire, filter: () => filter, filterMutate: () => filterMutate, filterSemanticDiagnostics: () => filterSemanticDiagnostics, @@ -168350,10 +170202,12 @@ ${options.prefix}` : "\n" : options.prefix forEachKey: () => forEachKey, forEachLeadingCommentRange: () => forEachLeadingCommentRange, forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft, + forEachPropertyAssignment: () => forEachPropertyAssignment, forEachResolvedProjectReference: () => forEachResolvedProjectReference, forEachReturnStatement: () => forEachReturnStatement, forEachRight: () => forEachRight, forEachTrailingCommentRange: () => forEachTrailingCommentRange, + forEachTsConfigPropArray: () => forEachTsConfigPropArray, forEachUnique: () => forEachUnique, forEachYieldExpression: () => forEachYieldExpression, forSomeAncestorDirectory: () => forSomeAncestorDirectory, @@ -168448,6 +170302,8 @@ ${options.prefix}` : "\n" : options.prefix getDiagnosticText: () => getDiagnosticText, getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan, getDirectoryPath: () => getDirectoryPath, + getDirectoryToWatchFailedLookupLocation: () => getDirectoryToWatchFailedLookupLocation, + getDirectoryToWatchFailedLookupLocationFromTypeRoot: () => getDirectoryToWatchFailedLookupLocationFromTypeRoot, getDocumentPositionMapper: () => getDocumentPositionMapper, getESModuleInterop: () => getESModuleInterop, getEditsForFileRename: () => getEditsForFileRename, @@ -168485,6 +170341,8 @@ ${options.prefix}` : "\n" : options.prefix getErrorSpanForNode: () => getErrorSpanForNode, getErrorSummaryText: () => getErrorSummaryText, getEscapedTextOfIdentifierOrLiteral: () => getEscapedTextOfIdentifierOrLiteral, + getEscapedTextOfJsxAttributeName: () => getEscapedTextOfJsxAttributeName, + getEscapedTextOfJsxNamespacedName: () => getEscapedTextOfJsxNamespacedName, getExpandoInitializer: () => getExpandoInitializer, getExportAssignmentExpression: () => getExportAssignmentExpression, getExportInfoMap: () => getExportInfoMap, @@ -168524,6 +170382,7 @@ ${options.prefix}` : "\n" : options.prefix getImportNeedsImportStarHelper: () => getImportNeedsImportStarHelper, getIndentSize: () => getIndentSize, getIndentString: () => getIndentString, + getInferredLibraryNameResolveFrom: () => getInferredLibraryNameResolveFrom, getInitializedVariables: () => getInitializedVariables, getInitializerOfBinaryExpression: () => getInitializerOfBinaryExpression, getInitializerOfBindingOrAssignmentElement: () => getInitializerOfBindingOrAssignmentElement, @@ -168644,6 +170503,7 @@ ${options.prefix}` : "\n" : options.prefix getOperatorAssociativity: () => getOperatorAssociativity, getOperatorPrecedence: () => getOperatorPrecedence, getOptionFromName: () => getOptionFromName, + getOptionsForLibraryResolution: () => getOptionsForLibraryResolution, getOptionsNameMap: () => getOptionsNameMap, getOrCreateEmitNode: () => getOrCreateEmitNode, getOrCreateExternalHelpersModuleNameIfNeeded: () => getOrCreateExternalHelpersModuleNameIfNeeded, @@ -168686,7 +170546,6 @@ ${options.prefix}` : "\n" : options.prefix getProperties: () => getProperties, getProperty: () => getProperty, getPropertyArrayElementValue: () => getPropertyArrayElementValue, - getPropertyAssignment: () => getPropertyAssignment, getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression, getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode, getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol, @@ -168718,7 +170577,9 @@ ${options.prefix}` : "\n" : options.prefix getRestParameterElementType: () => getRestParameterElementType, getRightMostAssignedExpression: () => getRightMostAssignedExpression, getRootDeclaration: () => getRootDeclaration, + getRootDirectoryOfResolutionCache: () => getRootDirectoryOfResolutionCache, getRootLength: () => getRootLength, + getRootPathSplitLength: () => getRootPathSplitLength, getScriptKind: () => getScriptKind, getScriptKindFromFileName: () => getScriptKindFromFileName, getScriptTargetFeatures: () => getScriptTargetFeatures, @@ -168775,6 +170636,8 @@ ${options.prefix}` : "\n" : options.prefix getTextOfConstantValue: () => getTextOfConstantValue, getTextOfIdentifierOrLiteral: () => getTextOfIdentifierOrLiteral, getTextOfJSDocComment: () => getTextOfJSDocComment, + getTextOfJsxAttributeName: () => getTextOfJsxAttributeName, + getTextOfJsxNamespacedName: () => getTextOfJsxNamespacedName, getTextOfNode: () => getTextOfNode, getTextOfNodeFromSourceText: () => getTextOfNodeFromSourceText, getTextOfPropertyName: () => getTextOfPropertyName, @@ -168791,7 +170654,6 @@ ${options.prefix}` : "\n" : options.prefix getTransformers: () => getTransformers, getTsBuildInfoEmitOutputFilePath: () => getTsBuildInfoEmitOutputFilePath, getTsConfigObjectLiteralExpression: () => getTsConfigObjectLiteralExpression, - getTsConfigPropArray: () => getTsConfigPropArray, getTsConfigPropArrayElementValue: () => getTsConfigPropArrayElementValue, getTypeAnnotationNode: () => getTypeAnnotationNode, getTypeArgumentOrTypeParameterList: () => getTypeArgumentOrTypeParameterList, @@ -168875,6 +170737,7 @@ ${options.prefix}` : "\n" : options.prefix insertStatementsAfterCustomPrologue: () => insertStatementsAfterCustomPrologue, insertStatementsAfterStandardPrologue: () => insertStatementsAfterStandardPrologue, intersperse: () => intersperse, + intrinsicTagNameToString: () => intrinsicTagNameToString, introducesArgumentsExoticObject: () => introducesArgumentsExoticObject, inverseJsxOptionMap: () => inverseJsxOptionMap, isAbstractConstructorSymbol: () => isAbstractConstructorSymbol, @@ -169031,7 +170894,6 @@ ${options.prefix}` : "\n" : options.prefix isEmptyObjectLiteral: () => isEmptyObjectLiteral, isEmptyStatement: () => isEmptyStatement, isEmptyStringLiteral: () => isEmptyStringLiteral, - isEndOfDeclarationMarker: () => isEndOfDeclarationMarker, isEntityName: () => isEntityName, isEntityNameExpression: () => isEntityNameExpression, isEnumConst: () => isEnumConst, @@ -169214,6 +171076,7 @@ ${options.prefix}` : "\n" : options.prefix isJsonSourceFile: () => isJsonSourceFile, isJsxAttribute: () => isJsxAttribute, isJsxAttributeLike: () => isJsxAttributeLike, + isJsxAttributeName: () => isJsxAttributeName, isJsxAttributes: () => isJsxAttributes, isJsxChild: () => isJsxChild, isJsxClosingElement: () => isJsxClosingElement, @@ -169221,6 +171084,7 @@ ${options.prefix}` : "\n" : options.prefix isJsxElement: () => isJsxElement, isJsxExpression: () => isJsxExpression, isJsxFragment: () => isJsxFragment, + isJsxNamespacedName: () => isJsxNamespacedName, isJsxOpeningElement: () => isJsxOpeningElement, isJsxOpeningFragment: () => isJsxOpeningFragment, isJsxOpeningLikeElement: () => isJsxOpeningLikeElement, @@ -169231,6 +171095,7 @@ ${options.prefix}` : "\n" : options.prefix isJsxText: () => isJsxText, isJumpStatementTarget: () => isJumpStatementTarget, isKeyword: () => isKeyword, + isKeywordOrPunctuation: () => isKeywordOrPunctuation, isKnownSymbol: () => isKnownSymbol, isLabelName: () => isLabelName, isLabelOfLabeledStatement: () => isLabelOfLabeledStatement, @@ -169259,7 +171124,6 @@ ${options.prefix}` : "\n" : options.prefix isLogicalOrCoalescingBinaryOperator: () => isLogicalOrCoalescingBinaryOperator, isMappedTypeNode: () => isMappedTypeNode, isMemberName: () => isMemberName, - isMergeDeclarationMarker: () => isMergeDeclarationMarker, isMetaProperty: () => isMetaProperty, isMethodDeclaration: () => isMethodDeclaration, isMethodOrAccessor: () => isMethodOrAccessor, @@ -169627,7 +171491,6 @@ ${options.prefix}` : "\n" : options.prefix nodeToDisplayParts: () => nodeToDisplayParts, noop: () => noop, noopFileWatcher: () => noopFileWatcher, - noopPush: () => noopPush, normalizePath: () => normalizePath, normalizeSlashes: () => normalizeSlashes, not: () => not, @@ -169750,6 +171613,7 @@ ${options.prefix}` : "\n" : options.prefix resolutionExtensionIsTSOrJson: () => resolutionExtensionIsTSOrJson, resolveConfigFileProjectName: () => resolveConfigFileProjectName, resolveJSModule: () => resolveJSModule, + resolveLibrary: () => resolveLibrary, resolveModuleName: () => resolveModuleName, resolveModuleNameFromCache: () => resolveModuleNameFromCache, resolvePackageNameToPackageJson: () => resolvePackageNameToPackageJson, @@ -170060,7 +171924,7 @@ ${options.prefix}` : "\n" : options.prefix } }; } - module2.exports = ts_exports3; + module2.exports = ts_exports2; } }); return require_typescript(); diff --git a/cli/tsc/dts/lib.dom.d.ts b/cli/tsc/dts/lib.dom.d.ts index 0480b01b2d..e31ab1cae5 100644 --- a/cli/tsc/dts/lib.dom.d.ts +++ b/cli/tsc/dts/lib.dom.d.ts @@ -152,6 +152,10 @@ interface AuthenticatorSelectionCriteria { userVerification?: UserVerificationRequirement; } +interface AvcEncoderConfig { + format?: AvcBitstreamFormat; +} + interface BiquadFilterOptions extends AudioNodeOptions { Q?: number; detune?: number; @@ -170,6 +174,21 @@ interface BlobPropertyBag { type?: string; } +interface CSSMatrixComponentOptions { + is2D?: boolean; +} + +interface CSSNumericType { + angle?: number; + flex?: number; + frequency?: number; + length?: number; + percent?: number; + percentHint?: CSSNumericBaseType; + resolution?: number; + time?: number; +} + interface CSSStyleSheetInit { baseURL?: string; disabled?: boolean; @@ -425,7 +444,7 @@ interface EcdsaParams extends Algorithm { interface EffectTiming { delay?: number; direction?: PlaybackDirection; - duration?: number | string; + duration?: number | CSSNumericValue | string; easing?: string; endDelay?: number; fill?: FillMode; @@ -442,6 +461,17 @@ interface ElementDefinitionOptions { extends?: string; } +interface EncodedVideoChunkInit { + data: BufferSource; + duration?: number; + timestamp: number; + type: EncodedVideoChunkType; +} + +interface EncodedVideoChunkMetadata { + decoderConfig?: VideoDecoderConfig; +} + interface ErrorEventInit extends EventInit { colno?: number; error?: any; @@ -485,6 +515,10 @@ interface FilePropertyBag extends BlobPropertyBag { lastModified?: number; } +interface FileSystemCreateWritableOptions { + keepExistingData?: boolean; +} + interface FileSystemFlags { create?: boolean; exclusive?: boolean; @@ -539,6 +573,13 @@ interface GainOptions extends AudioNodeOptions { gain?: number; } +interface GamepadEffectParameters { + duration?: number; + startDelay?: number; + strongMagnitude?: number; + weakMagnitude?: number; +} + interface GamepadEventInit extends EventInit { gamepad: Gamepad; } @@ -1142,6 +1183,11 @@ interface PictureInPictureEventInit extends EventInit { pictureInPictureWindow: PictureInPictureWindow; } +interface PlaneLayout { + offset: number; + stride: number; +} + interface PointerEventInit extends MouseEventInit { coalescedEvents?: PointerEvent[]; height?: number; @@ -1178,6 +1224,13 @@ interface PromiseRejectionEventInit extends EventInit { reason?: any; } +interface PropertyDefinition { + inherits: boolean; + initialValue?: string; + name: string; + syntax?: string; +} + interface PropertyIndexedKeyframes { composite?: CompositeOperationOrAuto | CompositeOperationOrAuto[]; easing?: string | string[]; @@ -1329,6 +1382,11 @@ interface RTCIceCandidateInit { usernameFragment?: string | null; } +interface RTCIceCandidatePair { + local?: RTCIceCandidate; + remote?: RTCIceCandidate; +} + interface RTCIceCandidatePairStats extends RTCStats { availableIncomingBitrate?: number; availableOutgoingBitrate?: number; @@ -1462,19 +1520,18 @@ interface RTCRtpCapabilities { headerExtensions: RTCRtpHeaderExtensionCapability[]; } -interface RTCRtpCodecCapability { +interface RTCRtpCodec { channels?: number; clockRate: number; mimeType: string; sdpFmtpLine?: string; } -interface RTCRtpCodecParameters { - channels?: number; - clockRate: number; - mimeType: string; +interface RTCRtpCodecCapability extends RTCRtpCodec { +} + +interface RTCRtpCodecParameters extends RTCRtpCodec { payloadType: number; - sdpFmtpLine?: string; } interface RTCRtpCodingParameters { @@ -1498,7 +1555,7 @@ interface RTCRtpEncodingParameters extends RTCRtpCodingParameters { } interface RTCRtpHeaderExtensionCapability { - uri?: string; + uri: string; } interface RTCRtpHeaderExtensionParameters { @@ -1608,6 +1665,11 @@ interface RegistrationOptions { updateViaCache?: ServiceWorkerUpdateViaCache; } +interface ReportingObserverOptions { + buffered?: boolean; + types?: string[]; +} + interface RequestInit { /** A BodyInit object or null to set request's body. */ body?: BodyInit | null; @@ -1931,6 +1993,71 @@ interface VideoConfiguration { width: number; } +interface VideoDecoderConfig { + codec: string; + codedHeight?: number; + codedWidth?: number; + colorSpace?: VideoColorSpaceInit; + description?: BufferSource; + displayAspectHeight?: number; + displayAspectWidth?: number; + hardwareAcceleration?: HardwareAcceleration; + optimizeForLatency?: boolean; +} + +interface VideoDecoderInit { + error: WebCodecsErrorCallback; + output: VideoFrameOutputCallback; +} + +interface VideoDecoderSupport { + config?: VideoDecoderConfig; + supported?: boolean; +} + +interface VideoEncoderConfig { + alpha?: AlphaOption; + avc?: AvcEncoderConfig; + bitrate?: number; + bitrateMode?: VideoEncoderBitrateMode; + codec: string; + displayHeight?: number; + displayWidth?: number; + framerate?: number; + hardwareAcceleration?: HardwareAcceleration; + height: number; + latencyMode?: LatencyMode; + scalabilityMode?: string; + width: number; +} + +interface VideoEncoderEncodeOptions { + keyFrame?: boolean; +} + +interface VideoEncoderInit { + error: WebCodecsErrorCallback; + output: EncodedVideoChunkOutputCallback; +} + +interface VideoEncoderSupport { + config?: VideoEncoderConfig; + supported?: boolean; +} + +interface VideoFrameBufferInit { + codedHeight: number; + codedWidth: number; + colorSpace?: VideoColorSpaceInit; + displayHeight?: number; + displayWidth?: number; + duration?: number; + format: VideoPixelFormat; + layout?: PlaneLayout[]; + timestamp: number; + visibleRect?: DOMRectInit; +} + interface VideoFrameCallbackMetadata { captureTime?: DOMHighResTimeStamp; expectedDisplayTime: DOMHighResTimeStamp; @@ -1944,6 +2071,20 @@ interface VideoFrameCallbackMetadata { width: number; } +interface VideoFrameCopyToOptions { + layout?: PlaneLayout[]; + rect?: DOMRectInit; +} + +interface VideoFrameInit { + alpha?: AlphaOption; + displayHeight?: number; + displayWidth?: number; + duration?: number; + timestamp?: number; + visibleRect?: DOMRectInit; +} + interface WaveShaperOptions extends AudioNodeOptions { curve?: number[] | Float32Array; oversample?: OverSampleType; @@ -1986,6 +2127,13 @@ interface WorkletOptions { credentials?: RequestCredentials; } +interface WriteParams { + data?: BufferSource | Blob | string | null; + position?: number | null; + size?: number | null; + type: WriteCommandType; +} + type NodeFilter = ((node: Node) => number) | { acceptNode(node: Node): number; }; declare var NodeFilter: { @@ -2009,60 +2157,115 @@ declare var NodeFilter: { type XPathNSResolver = ((prefix: string | null) => string | null) | { lookupNamespaceURI(prefix: string | null): string | null; }; -/** The ANGLE_instanced_arrays extension is part of the WebGL API and allows to draw the same object, or groups of similar objects multiple times, if they share the same vertex data, primitive count and type. */ +/** + * The ANGLE_instanced_arrays extension is part of the WebGL API and allows to draw the same object, or groups of similar objects multiple times, if they share the same vertex data, primitive count and type. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays) + */ interface ANGLE_instanced_arrays { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/drawArraysInstancedANGLE) */ drawArraysInstancedANGLE(mode: GLenum, first: GLint, count: GLsizei, primcount: GLsizei): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/drawElementsInstancedANGLE) */ drawElementsInstancedANGLE(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, primcount: GLsizei): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ANGLE_instanced_arrays/vertexAttribDivisorANGLE) */ vertexAttribDivisorANGLE(index: GLuint, divisor: GLuint): void; readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: 0x88FE; } interface ARIAMixin { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAtomic) */ ariaAtomic: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaAutoComplete) */ ariaAutoComplete: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaBusy) */ ariaBusy: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaChecked) */ ariaChecked: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColCount) */ ariaColCount: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColIndex) */ ariaColIndex: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaColSpan) */ ariaColSpan: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaCurrent) */ ariaCurrent: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaDisabled) */ ariaDisabled: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaExpanded) */ ariaExpanded: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHasPopup) */ ariaHasPopup: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaHidden) */ ariaHidden: string | null; ariaInvalid: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaKeyShortcuts) */ ariaKeyShortcuts: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLabel) */ ariaLabel: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLevel) */ ariaLevel: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaLive) */ ariaLive: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaModal) */ ariaModal: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaMultiLine) */ ariaMultiLine: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaMultiSelectable) */ ariaMultiSelectable: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaOrientation) */ ariaOrientation: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPlaceholder) */ ariaPlaceholder: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPosInSet) */ ariaPosInSet: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaPressed) */ ariaPressed: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaReadOnly) */ ariaReadOnly: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRequired) */ ariaRequired: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRoleDescription) */ ariaRoleDescription: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowCount) */ ariaRowCount: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowIndex) */ ariaRowIndex: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaRowSpan) */ ariaRowSpan: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSelected) */ ariaSelected: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSetSize) */ ariaSetSize: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaSort) */ ariaSort: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueMax) */ ariaValueMax: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueMin) */ ariaValueMin: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueNow) */ ariaValueNow: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/ariaValueText) */ ariaValueText: string | null; role: string | null; } -/** A controller object that allows you to abort one or more DOM requests as and when desired. */ +/** + * A controller object that allows you to abort one or more DOM requests as and when desired. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController) + */ interface AbortController { - /** Returns the AbortSignal object associated with this object. */ + /** + * Returns the AbortSignal object associated with this object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/signal) + */ readonly signal: AbortSignal; - /** Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. */ + /** + * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortController/abort) + */ abort(reason?: any): void; } @@ -2075,12 +2278,23 @@ interface AbortSignalEventMap { "abort": Event; } -/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ +/** + * A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal) + */ interface AbortSignal extends EventTarget { - /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */ + /** + * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/aborted) + */ readonly aborted: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort_event) */ onabort: ((this: AbortSignal, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/reason) */ readonly reason: any; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/throwIfAborted) */ throwIfAborted(): void; addEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -2091,20 +2305,43 @@ interface AbortSignal extends EventTarget { declare var AbortSignal: { prototype: AbortSignal; new(): AbortSignal; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/abort) */ abort(reason?: any): AbortSignal; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbortSignal/timeout) */ timeout(milliseconds: number): AbortSignal; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbstractRange) */ interface AbstractRange { - /** Returns true if range is collapsed, and false otherwise. */ + /** + * Returns true if range is collapsed, and false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbstractRange/collapsed) + */ readonly collapsed: boolean; - /** Returns range's end node. */ + /** + * Returns range's end node. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbstractRange/endContainer) + */ readonly endContainer: Node; - /** Returns range's end offset. */ + /** + * Returns range's end offset. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbstractRange/endOffset) + */ readonly endOffset: number; - /** Returns range's start node. */ + /** + * Returns range's start node. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbstractRange/startContainer) + */ readonly startContainer: Node; - /** Returns range's start offset. */ + /** + * Returns range's start offset. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AbstractRange/startOffset) + */ readonly startOffset: number; } @@ -2118,6 +2355,7 @@ interface AbstractWorkerEventMap { } interface AbstractWorker { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ServiceWorker/error_event) */ onerror: ((this: AbstractWorker, ev: ErrorEvent) => any) | null; addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -2125,16 +2363,29 @@ interface AbstractWorker { removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } -/** A node able to provide real-time frequency and time-domain analysis information. It is an AudioNode that passes the audio stream unchanged from the input to the output, but allows you to take the generated data, process it, and create audio visualizations. */ +/** + * A node able to provide real-time frequency and time-domain analysis information. It is an AudioNode that passes the audio stream unchanged from the input to the output, but allows you to take the generated data, process it, and create audio visualizations. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode) + */ interface AnalyserNode extends AudioNode { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/fftSize) */ fftSize: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/frequencyBinCount) */ readonly frequencyBinCount: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/maxDecibels) */ maxDecibels: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/minDecibels) */ minDecibels: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/smoothingTimeConstant) */ smoothingTimeConstant: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/getByteFrequencyData) */ getByteFrequencyData(array: Uint8Array): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/getByteTimeDomainData) */ getByteTimeDomainData(array: Uint8Array): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/getFloatFrequencyData) */ getFloatFrequencyData(array: Float32Array): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnalyserNode/getFloatTimeDomainData) */ getFloatTimeDomainData(array: Float32Array): void; } @@ -2144,7 +2395,9 @@ declare var AnalyserNode: { }; interface Animatable { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animate) */ animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAnimations) */ getAnimations(options?: GetAnimationsOptions): Animation[]; } @@ -2154,28 +2407,51 @@ interface AnimationEventMap { "remove": Event; } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation) */ interface Animation extends EventTarget { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/currentTime) */ currentTime: CSSNumberish | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/effect) */ effect: AnimationEffect | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/finished) */ readonly finished: Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/id) */ id: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/cancel_event) */ oncancel: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/finish_event) */ onfinish: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/remove_event) */ onremove: ((this: Animation, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/pending) */ readonly pending: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/playState) */ readonly playState: AnimationPlayState; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/playbackRate) */ playbackRate: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/ready) */ readonly ready: Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/replaceState) */ readonly replaceState: AnimationReplaceState; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/startTime) */ startTime: CSSNumberish | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/timeline) */ timeline: AnimationTimeline | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/cancel) */ cancel(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/commitStyles) */ commitStyles(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/finish) */ finish(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/pause) */ pause(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/persist) */ persist(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/play) */ play(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/reverse) */ reverse(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Animation/updatePlaybackRate) */ updatePlaybackRate(playbackRate: number): void; addEventListener(type: K, listener: (this: Animation, ev: AnimationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -2188,9 +2464,13 @@ declare var Animation: { new(effect?: AnimationEffect | null, timeline?: AnimationTimeline | null): Animation; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEffect) */ interface AnimationEffect { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEffect/getComputedTiming) */ getComputedTiming(): ComputedEffectTiming; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEffect/getTiming) */ getTiming(): EffectTiming; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEffect/updateTiming) */ updateTiming(timing?: OptionalEffectTiming): void; } @@ -2199,10 +2479,17 @@ declare var AnimationEffect: { new(): AnimationEffect; }; -/** Events providing information related to animations. */ +/** + * Events providing information related to animations. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEvent) + */ interface AnimationEvent extends Event { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEvent/animationName) */ readonly animationName: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEvent/elapsedTime) */ readonly elapsedTime: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationEvent/pseudoElement) */ readonly pseudoElement: string; } @@ -2216,8 +2503,11 @@ interface AnimationFrameProvider { requestAnimationFrame(callback: FrameRequestCallback): number; } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationPlaybackEvent) */ interface AnimationPlaybackEvent extends Event { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationPlaybackEvent/currentTime) */ readonly currentTime: CSSNumberish | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationPlaybackEvent/timelineTime) */ readonly timelineTime: CSSNumberish | null; } @@ -2226,8 +2516,10 @@ declare var AnimationPlaybackEvent: { new(type: string, eventInitDict?: AnimationPlaybackEventInit): AnimationPlaybackEvent; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationTimeline) */ interface AnimationTimeline { - readonly currentTime: number | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AnimationTimeline/currentTime) */ + readonly currentTime: CSSNumberish | null; } declare var AnimationTimeline: { @@ -2235,16 +2527,30 @@ declare var AnimationTimeline: { new(): AnimationTimeline; }; -/** A DOM element's attribute as an object. In most DOM methods, you will probably directly retrieve the attribute as a string (e.g., Element.getAttribute(), but certain functions (e.g., Element.getAttributeNode()) or means of iterating give Attr types. */ +/** + * A DOM element's attribute as an object. In most DOM methods, you will probably directly retrieve the attribute as a string (e.g., Element.getAttribute(), but certain functions (e.g., Element.getAttributeNode()) or means of iterating give Attr types. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr) + */ interface Attr extends Node { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr/localName) */ readonly localName: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr/name) */ readonly name: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr/namespaceURI) */ readonly namespaceURI: string | null; readonly ownerDocument: Document; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr/ownerElement) */ readonly ownerElement: Element | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr/prefix) */ readonly prefix: string | null; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr/specified) + */ readonly specified: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Attr/value) */ value: string; } @@ -2253,14 +2559,25 @@ declare var Attr: { new(): Attr; }; -/** A short audio asset residing in memory, created from an audio file using the AudioContext.decodeAudioData() method, or from raw data using AudioContext.createBuffer(). Once put into an AudioBuffer, the audio can then be played by being passed into an AudioBufferSourceNode. */ +/** + * A short audio asset residing in memory, created from an audio file using the AudioContext.decodeAudioData() method, or from raw data using AudioContext.createBuffer(). Once put into an AudioBuffer, the audio can then be played by being passed into an AudioBufferSourceNode. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer) + */ interface AudioBuffer { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer/duration) */ readonly duration: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer/length) */ readonly length: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer/numberOfChannels) */ readonly numberOfChannels: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer/sampleRate) */ readonly sampleRate: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer/copyFromChannel) */ copyFromChannel(destination: Float32Array, channelNumber: number, bufferOffset?: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer/copyToChannel) */ copyToChannel(source: Float32Array, channelNumber: number, bufferOffset?: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBuffer/getChannelData) */ getChannelData(channel: number): Float32Array; } @@ -2269,14 +2586,25 @@ declare var AudioBuffer: { new(options: AudioBufferOptions): AudioBuffer; }; -/** An AudioScheduledSourceNode which represents an audio source consisting of in-memory audio data, stored in an AudioBuffer. It's especially useful for playing back audio which has particularly stringent timing accuracy requirements, such as for sounds that must match a specific rhythm and can be kept in memory rather than being played from disk or the network. */ +/** + * An AudioScheduledSourceNode which represents an audio source consisting of in-memory audio data, stored in an AudioBuffer. It's especially useful for playing back audio which has particularly stringent timing accuracy requirements, such as for sounds that must match a specific rhythm and can be kept in memory rather than being played from disk or the network. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode) + */ interface AudioBufferSourceNode extends AudioScheduledSourceNode { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode/buffer) */ buffer: AudioBuffer | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode/detune) */ readonly detune: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode/loop) */ loop: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode/loopEnd) */ loopEnd: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode/loopStart) */ loopStart: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode/playbackRate) */ readonly playbackRate: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioBufferSourceNode/start) */ start(when?: number, offset?: number, duration?: number): void; addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -2289,16 +2617,29 @@ declare var AudioBufferSourceNode: { new(context: BaseAudioContext, options?: AudioBufferSourceOptions): AudioBufferSourceNode; }; -/** An audio-processing graph built from audio modules linked together, each represented by an AudioNode. */ +/** + * An audio-processing graph built from audio modules linked together, each represented by an AudioNode. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext) + */ interface AudioContext extends BaseAudioContext { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/baseLatency) */ readonly baseLatency: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/outputLatency) */ readonly outputLatency: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/close) */ close(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/createMediaElementSource) */ createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/createMediaStreamDestination) */ createMediaStreamDestination(): MediaStreamAudioDestinationNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/createMediaStreamSource) */ createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/getOutputTimestamp) */ getOutputTimestamp(): AudioTimestamp; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/resume) */ resume(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioContext/suspend) */ suspend(): Promise; addEventListener(type: K, listener: (this: AudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -2311,8 +2652,13 @@ declare var AudioContext: { new(contextOptions?: AudioContextOptions): AudioContext; }; -/** AudioDestinationNode has no output (as it is the output, no more AudioNode can be linked after it in the audio graph) and one input. The number of channels in the input must be between 0 and the maxChannelCount value or an exception is raised. */ +/** + * AudioDestinationNode has no output (as it is the output, no more AudioNode can be linked after it in the audio graph) and one input. The number of channels in the input must be between 0 and the maxChannelCount value or an exception is raised. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioDestinationNode) + */ interface AudioDestinationNode extends AudioNode { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioDestinationNode/maxChannelCount) */ readonly maxChannelCount: number; } @@ -2321,20 +2667,41 @@ declare var AudioDestinationNode: { new(): AudioDestinationNode; }; -/** The position and orientation of the unique person listening to the audio scene, and is used in audio spatialization. All PannerNodes spatialize in relation to the AudioListener stored in the BaseAudioContext.listener attribute. */ +/** + * The position and orientation of the unique person listening to the audio scene, and is used in audio spatialization. All PannerNodes spatialize in relation to the AudioListener stored in the BaseAudioContext.listener attribute. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener) + */ interface AudioListener { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/forwardX) */ readonly forwardX: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/forwardY) */ readonly forwardY: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/forwardZ) */ readonly forwardZ: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/positionX) */ readonly positionX: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/positionY) */ readonly positionY: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/positionZ) */ readonly positionZ: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/upX) */ readonly upX: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/upY) */ readonly upY: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/upZ) */ readonly upZ: AudioParam; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/setOrientation) + */ setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioListener/setPosition) + */ setPosition(x: number, y: number, z: number): void; } @@ -2343,16 +2710,28 @@ declare var AudioListener: { new(): AudioListener; }; -/** A generic interface for representing an audio processing module. Examples include: */ +/** + * A generic interface for representing an audio processing module. Examples include: + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode) + */ interface AudioNode extends EventTarget { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/channelCount) */ channelCount: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/channelCountMode) */ channelCountMode: ChannelCountMode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/channelInterpretation) */ channelInterpretation: ChannelInterpretation; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/context) */ readonly context: BaseAudioContext; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/numberOfInputs) */ readonly numberOfInputs: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/numberOfOutputs) */ readonly numberOfOutputs: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/connect) */ connect(destinationNode: AudioNode, output?: number, input?: number): AudioNode; connect(destinationParam: AudioParam, output?: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioNode/disconnect) */ disconnect(): void; disconnect(output: number): void; disconnect(destinationNode: AudioNode): void; @@ -2367,19 +2746,35 @@ declare var AudioNode: { new(): AudioNode; }; -/** The Web Audio API's AudioParam interface represents an audio-related parameter, usually a parameter of an AudioNode (such as GainNode.gain). */ +/** + * The Web Audio API's AudioParam interface represents an audio-related parameter, usually a parameter of an AudioNode (such as GainNode.gain). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam) + */ interface AudioParam { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/automationRate) */ automationRate: AutomationRate; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/defaultValue) */ readonly defaultValue: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/maxValue) */ readonly maxValue: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/minValue) */ readonly minValue: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/value) */ value: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/cancelAndHoldAtTime) */ cancelAndHoldAtTime(cancelTime: number): AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/cancelScheduledValues) */ cancelScheduledValues(cancelTime: number): AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/exponentialRampToValueAtTime) */ exponentialRampToValueAtTime(value: number, endTime: number): AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/linearRampToValueAtTime) */ linearRampToValueAtTime(value: number, endTime: number): AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/setTargetAtTime) */ setTargetAtTime(target: number, startTime: number, timeConstant: number): AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/setValueAtTime) */ setValueAtTime(value: number, startTime: number): AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParam/setValueCurveAtTime) */ setValueCurveAtTime(values: number[] | Float32Array, startTime: number, duration: number): AudioParam; } @@ -2388,6 +2783,7 @@ declare var AudioParam: { new(): AudioParam; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioParamMap) */ interface AudioParamMap { forEach(callbackfn: (value: AudioParam, key: string, parent: AudioParamMap) => void, thisArg?: any): void; } @@ -2400,13 +2796,27 @@ declare var AudioParamMap: { /** * The Web Audio API events that occur when a ScriptProcessorNode input buffer is ready to be processed. * @deprecated As of the August 29 2014 Web Audio API spec publication, this feature has been marked as deprecated, and is soon to be replaced by AudioWorklet. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioProcessingEvent) */ interface AudioProcessingEvent extends Event { - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioProcessingEvent/inputBuffer) + */ readonly inputBuffer: AudioBuffer; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioProcessingEvent/outputBuffer) + */ readonly outputBuffer: AudioBuffer; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioProcessingEvent/playbackTime) + */ readonly playbackTime: number; } @@ -2420,9 +2830,13 @@ interface AudioScheduledSourceNodeEventMap { "ended": Event; } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioScheduledSourceNode) */ interface AudioScheduledSourceNode extends AudioNode { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioScheduledSourceNode/ended_event) */ onended: ((this: AudioScheduledSourceNode, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioScheduledSourceNode/start) */ start(when?: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioScheduledSourceNode/stop) */ stop(when?: number): void; addEventListener(type: K, listener: (this: AudioScheduledSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -2435,7 +2849,11 @@ declare var AudioScheduledSourceNode: { new(): AudioScheduledSourceNode; }; -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorklet) + */ interface AudioWorklet extends Worklet { } @@ -2448,10 +2866,17 @@ interface AudioWorkletNodeEventMap { "processorerror": Event; } -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletNode) + */ interface AudioWorkletNode extends AudioNode { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletNode/processorerror_event) */ onprocessorerror: ((this: AudioWorkletNode, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletNode/parameters) */ readonly parameters: AudioParamMap; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AudioWorkletNode/port) */ readonly port: MessagePort; addEventListener(type: K, listener: (this: AudioWorkletNode, ev: AudioWorkletNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -2464,10 +2889,17 @@ declare var AudioWorkletNode: { new(context: BaseAudioContext, name: string, options?: AudioWorkletNodeOptions): AudioWorkletNode; }; -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAssertionResponse) + */ interface AuthenticatorAssertionResponse extends AuthenticatorResponse { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAssertionResponse/authenticatorData) */ readonly authenticatorData: ArrayBuffer; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAssertionResponse/signature) */ readonly signature: ArrayBuffer; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAssertionResponse/userHandle) */ readonly userHandle: ArrayBuffer | null; } @@ -2476,12 +2908,18 @@ declare var AuthenticatorAssertionResponse: { new(): AuthenticatorAssertionResponse; }; -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAttestationResponse) + */ interface AuthenticatorAttestationResponse extends AuthenticatorResponse { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAttestationResponse/attestationObject) */ readonly attestationObject: ArrayBuffer; getAuthenticatorData(): ArrayBuffer; getPublicKey(): ArrayBuffer | null; getPublicKeyAlgorithm(): COSEAlgorithmIdentifier; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorAttestationResponse/getTransports) */ getTransports(): string[]; } @@ -2490,8 +2928,13 @@ declare var AuthenticatorAttestationResponse: { new(): AuthenticatorAttestationResponse; }; -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorResponse) + */ interface AuthenticatorResponse { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/AuthenticatorResponse/clientDataJSON) */ readonly clientDataJSON: ArrayBuffer; } @@ -2500,7 +2943,9 @@ declare var AuthenticatorResponse: { new(): AuthenticatorResponse; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BarProp) */ interface BarProp { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BarProp/visible) */ readonly visible: boolean; } @@ -2513,34 +2958,67 @@ interface BaseAudioContextEventMap { "statechange": Event; } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext) */ interface BaseAudioContext extends EventTarget { - /** Available only in secure contexts. */ + /** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/audioWorklet) + */ readonly audioWorklet: AudioWorklet; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/currentTime) */ readonly currentTime: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/destination) */ readonly destination: AudioDestinationNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/listener) */ readonly listener: AudioListener; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/statechange_event) */ onstatechange: ((this: BaseAudioContext, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/sampleRate) */ readonly sampleRate: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/state) */ readonly state: AudioContextState; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createAnalyser) */ createAnalyser(): AnalyserNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createBiquadFilter) */ createBiquadFilter(): BiquadFilterNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createBuffer) */ createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createBufferSource) */ createBufferSource(): AudioBufferSourceNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createChannelMerger) */ createChannelMerger(numberOfInputs?: number): ChannelMergerNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createChannelSplitter) */ createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createConstantSource) */ createConstantSource(): ConstantSourceNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createConvolver) */ createConvolver(): ConvolverNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createDelay) */ createDelay(maxDelayTime?: number): DelayNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createDynamicsCompressor) */ createDynamicsCompressor(): DynamicsCompressorNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createGain) */ createGain(): GainNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createIIRFilter) */ createIIRFilter(feedforward: number[], feedback: number[]): IIRFilterNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createOscillator) */ createOscillator(): OscillatorNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createPanner) */ createPanner(): PannerNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createPeriodicWave) */ createPeriodicWave(real: number[] | Float32Array, imag: number[] | Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createScriptProcessor) + */ createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createStereoPanner) */ createStereoPanner(): StereoPannerNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/createWaveShaper) */ createWaveShaper(): WaveShaperNode; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BaseAudioContext/decodeAudioData) */ decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback | null, errorCallback?: DecodeErrorCallback | null): Promise; addEventListener(type: K, listener: (this: BaseAudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -2553,7 +3031,11 @@ declare var BaseAudioContext: { new(): BaseAudioContext; }; -/** The beforeunload event is fired when the window, the document and its resources are about to be unloaded. */ +/** + * The beforeunload event is fired when the window, the document and its resources are about to be unloaded. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BeforeUnloadEvent) + */ interface BeforeUnloadEvent extends Event { returnValue: any; } @@ -2563,13 +3045,23 @@ declare var BeforeUnloadEvent: { new(): BeforeUnloadEvent; }; -/** A simple low-order filter, and is created using the AudioContext.createBiquadFilter() method. It is an AudioNode that can represent different kinds of filters, tone control devices, and graphic equalizers. */ +/** + * A simple low-order filter, and is created using the AudioContext.createBiquadFilter() method. It is an AudioNode that can represent different kinds of filters, tone control devices, and graphic equalizers. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BiquadFilterNode) + */ interface BiquadFilterNode extends AudioNode { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BiquadFilterNode/Q) */ readonly Q: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BiquadFilterNode/detune) */ readonly detune: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BiquadFilterNode/frequency) */ readonly frequency: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BiquadFilterNode/gain) */ readonly gain: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BiquadFilterNode/type) */ type: BiquadFilterType; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BiquadFilterNode/getFrequencyResponse) */ getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; } @@ -2578,13 +3070,23 @@ declare var BiquadFilterNode: { new(context: BaseAudioContext, options?: BiquadFilterOptions): BiquadFilterNode; }; -/** A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. */ +/** + * A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob) + */ interface Blob { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/size) */ readonly size: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/type) */ readonly type: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/arrayBuffer) */ arrayBuffer(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/slice) */ slice(start?: number, end?: number, contentType?: string): Blob; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/stream) */ stream(): ReadableStream; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Blob/text) */ text(): Promise; } @@ -2593,8 +3095,11 @@ declare var Blob: { new(blobParts?: BlobPart[], options?: BlobPropertyBag): Blob; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BlobEvent) */ interface BlobEvent extends Event { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BlobEvent/data) */ readonly data: Blob; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BlobEvent/timecode) */ readonly timecode: DOMHighResTimeStamp; } @@ -2604,12 +3109,19 @@ declare var BlobEvent: { }; interface Body { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/body) */ readonly body: ReadableStream | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bodyUsed) */ readonly bodyUsed: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/arrayBuffer) */ arrayBuffer(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/blob) */ blob(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/formData) */ formData(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/json) */ json(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/text) */ text(): Promise; } @@ -2618,14 +3130,29 @@ interface BroadcastChannelEventMap { "messageerror": MessageEvent; } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BroadcastChannel) */ interface BroadcastChannel extends EventTarget { - /** Returns the channel name (as passed to the constructor). */ + /** + * Returns the channel name (as passed to the constructor). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BroadcastChannel/name) + */ readonly name: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BroadcastChannel/message_event) */ onmessage: ((this: BroadcastChannel, ev: MessageEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/BroadcastChannel/messageerror_event) */ onmessageerror: ((this: BroadcastChannel, ev: MessageEvent) => any) | null; - /** Closes the BroadcastChannel object, opening it up to garbage collection. */ + /** + * Closes the BroadcastChannel object, opening it up to garbage collection. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BroadcastChannel/close) + */ close(): void; - /** Sends the given message to other BroadcastChannel objects set up for this channel. Messages can be structured objects, e.g. nested objects and arrays. */ + /** + * Sends the given message to other BroadcastChannel objects set up for this channel. Messages can be structured objects, e.g. nested objects and arrays. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/BroadcastChannel/postMessage) + */ postMessage(message: any): void; addEventListener(type: K, listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -2638,9 +3165,15 @@ declare var BroadcastChannel: { new(name: string): BroadcastChannel; }; -/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ +/** + * This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy) + */ interface ByteLengthQueuingStrategy extends QueuingStrategy { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/highWaterMark) */ readonly highWaterMark: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ByteLengthQueuingStrategy/size) */ readonly size: QueuingStrategySize; } @@ -2649,7 +3182,11 @@ declare var ByteLengthQueuingStrategy: { new(init: QueuingStrategyInit): ByteLengthQueuingStrategy; }; -/** A CDATA section that can be used within XML to include extended portions of unescaped text. The symbols < and & don’t need escaping as they normally do when inside a CDATA section. */ +/** + * A CDATA section that can be used within XML to include extended portions of unescaped text. The symbols < and & don’t need escaping as they normally do when inside a CDATA section. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CDATASection) + */ interface CDATASection extends Text { } @@ -2658,7 +3195,9 @@ declare var CDATASection: { new(): CDATASection; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSAnimation) */ interface CSSAnimation extends Animation { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSAnimation/animationName) */ readonly animationName: string; addEventListener(type: K, listener: (this: CSSAnimation, ev: AnimationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -2671,8 +3210,13 @@ declare var CSSAnimation: { new(): CSSAnimation; }; -/** A single condition CSS at-rule, which consists of a condition and a statement block. It is a child of CSSGroupingRule. */ +/** + * A single condition CSS at-rule, which consists of a condition and a statement block. It is a child of CSSGroupingRule. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSConditionRule) + */ interface CSSConditionRule extends CSSGroupingRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSConditionRule/conditionText) */ readonly conditionText: string; } @@ -2681,7 +3225,12 @@ declare var CSSConditionRule: { new(): CSSConditionRule; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSContainerRule) */ interface CSSContainerRule extends CSSConditionRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSContainerRule/containerName) */ + readonly containerName: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSContainerRule/containerQuery) */ + readonly containerQuery: string; } declare var CSSContainerRule: { @@ -2689,17 +3238,29 @@ declare var CSSContainerRule: { new(): CSSContainerRule; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule) */ interface CSSCounterStyleRule extends CSSRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/additiveSymbols) */ additiveSymbols: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/fallback) */ fallback: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/name) */ name: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/negative) */ negative: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/pad) */ pad: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/prefix) */ prefix: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/range) */ range: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/speakAs) */ speakAs: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/suffix) */ suffix: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/symbols) */ symbols: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSCounterStyleRule/system) */ system: string; } @@ -2708,7 +3269,9 @@ declare var CSSCounterStyleRule: { new(): CSSCounterStyleRule; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontFaceRule) */ interface CSSFontFaceRule extends CSSRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontFaceRule/style) */ readonly style: CSSStyleDeclaration; } @@ -2717,7 +3280,9 @@ declare var CSSFontFaceRule: { new(): CSSFontFaceRule; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontFeatureValuesRule) */ interface CSSFontFeatureValuesRule extends CSSRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontFeatureValuesRule/fontFamily) */ fontFamily: string; } @@ -2726,10 +3291,15 @@ declare var CSSFontFeatureValuesRule: { new(): CSSFontFeatureValuesRule; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontPaletteValuesRule) */ interface CSSFontPaletteValuesRule extends CSSRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontPaletteValuesRule/basePalette) */ readonly basePalette: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontPaletteValuesRule/fontFamily) */ readonly fontFamily: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontPaletteValuesRule/name) */ readonly name: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSFontPaletteValuesRule/overrideColors) */ readonly overrideColors: string; } @@ -2738,10 +3308,17 @@ declare var CSSFontPaletteValuesRule: { new(): CSSFontPaletteValuesRule; }; -/** Any CSS at-rule that contains other rules nested within it. */ +/** + * Any CSS at-rule that contains other rules nested within it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSGroupingRule) + */ interface CSSGroupingRule extends CSSRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSGroupingRule/cssRules) */ readonly cssRules: CSSRuleList; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSGroupingRule/deleteRule) */ deleteRule(index: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSGroupingRule/insertRule) */ insertRule(rule: string, index?: number): number; } @@ -2750,10 +3327,24 @@ declare var CSSGroupingRule: { new(): CSSGroupingRule; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSImageValue) */ +interface CSSImageValue extends CSSStyleValue { +} + +declare var CSSImageValue: { + prototype: CSSImageValue; + new(): CSSImageValue; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSImportRule) */ interface CSSImportRule extends CSSRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSImportRule/href) */ readonly href: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSImportRule/layerName) */ readonly layerName: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSImportRule/media) */ readonly media: MediaList; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSImportRule/styleSheet) */ readonly styleSheet: CSSStyleSheet; } @@ -2762,9 +3353,15 @@ declare var CSSImportRule: { new(): CSSImportRule; }; -/** An object representing a set of style for a given keyframe. It corresponds to the contains of a single keyframe of a @keyframes at-rule. It implements the CSSRule interface with a type value of 8 (CSSRule.KEYFRAME_RULE). */ +/** + * An object representing a set of style for a given keyframe. It corresponds to the contains of a single keyframe of a @keyframes at-rule. It implements the CSSRule interface with a type value of 8 (CSSRule.KEYFRAME_RULE). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframeRule) + */ interface CSSKeyframeRule extends CSSRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframeRule/keyText) */ keyText: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframeRule/style) */ readonly style: CSSStyleDeclaration; } @@ -2773,12 +3370,21 @@ declare var CSSKeyframeRule: { new(): CSSKeyframeRule; }; -/** An object representing a complete set of keyframes for a CSS animation. It corresponds to the contains of a whole @keyframes at-rule. It implements the CSSRule interface with a type value of 7 (CSSRule.KEYFRAMES_RULE). */ +/** + * An object representing a complete set of keyframes for a CSS animation. It corresponds to the contains of a whole @keyframes at-rule. It implements the CSSRule interface with a type value of 7 (CSSRule.KEYFRAMES_RULE). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframesRule) + */ interface CSSKeyframesRule extends CSSRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframesRule/cssRules) */ readonly cssRules: CSSRuleList; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframesRule/name) */ name: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframesRule/appendRule) */ appendRule(rule: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframesRule/deleteRule) */ deleteRule(select: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeyframesRule/findRule) */ findRule(select: string): CSSKeyframeRule | null; [index: number]: CSSKeyframeRule; } @@ -2788,7 +3394,20 @@ declare var CSSKeyframesRule: { new(): CSSKeyframesRule; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeywordValue) */ +interface CSSKeywordValue extends CSSStyleValue { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSKeywordValue/value) */ + value: string; +} + +declare var CSSKeywordValue: { + prototype: CSSKeywordValue; + new(value: string): CSSKeywordValue; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSLayerBlockRule) */ interface CSSLayerBlockRule extends CSSGroupingRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSLayerBlockRule/name) */ readonly name: string; } @@ -2797,7 +3416,9 @@ declare var CSSLayerBlockRule: { new(): CSSLayerBlockRule; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSLayerStatementRule) */ interface CSSLayerStatementRule extends CSSRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSLayerStatementRule/nameList) */ readonly nameList: ReadonlyArray; } @@ -2806,8 +3427,112 @@ declare var CSSLayerStatementRule: { new(): CSSLayerStatementRule; }; -/** A single CSS @media rule. It implements the CSSConditionRule interface, and therefore the CSSGroupingRule and the CSSRule interface with a type value of 4 (CSSRule.MEDIA_RULE). */ +interface CSSMathClamp extends CSSMathValue { + readonly lower: CSSNumericValue; + readonly upper: CSSNumericValue; + readonly value: CSSNumericValue; +} + +declare var CSSMathClamp: { + prototype: CSSMathClamp; + new(lower: CSSNumberish, value: CSSNumberish, upper: CSSNumberish): CSSMathClamp; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathInvert) */ +interface CSSMathInvert extends CSSMathValue { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathInvert/value) */ + readonly value: CSSNumericValue; +} + +declare var CSSMathInvert: { + prototype: CSSMathInvert; + new(arg: CSSNumberish): CSSMathInvert; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathMax) */ +interface CSSMathMax extends CSSMathValue { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathMax/values) */ + readonly values: CSSNumericArray; +} + +declare var CSSMathMax: { + prototype: CSSMathMax; + new(...args: CSSNumberish[]): CSSMathMax; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathMin) */ +interface CSSMathMin extends CSSMathValue { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathMin/values) */ + readonly values: CSSNumericArray; +} + +declare var CSSMathMin: { + prototype: CSSMathMin; + new(...args: CSSNumberish[]): CSSMathMin; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathNegate) */ +interface CSSMathNegate extends CSSMathValue { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathNegate/value) */ + readonly value: CSSNumericValue; +} + +declare var CSSMathNegate: { + prototype: CSSMathNegate; + new(arg: CSSNumberish): CSSMathNegate; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathProduct) */ +interface CSSMathProduct extends CSSMathValue { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathProduct/values) */ + readonly values: CSSNumericArray; +} + +declare var CSSMathProduct: { + prototype: CSSMathProduct; + new(...args: CSSNumberish[]): CSSMathProduct; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathSum) */ +interface CSSMathSum extends CSSMathValue { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathSum/values) */ + readonly values: CSSNumericArray; +} + +declare var CSSMathSum: { + prototype: CSSMathSum; + new(...args: CSSNumberish[]): CSSMathSum; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathValue) */ +interface CSSMathValue extends CSSNumericValue { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMathValue/operator) */ + readonly operator: CSSMathOperator; +} + +declare var CSSMathValue: { + prototype: CSSMathValue; + new(): CSSMathValue; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMatrixComponent) */ +interface CSSMatrixComponent extends CSSTransformComponent { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMatrixComponent/matrix) */ + matrix: DOMMatrix; +} + +declare var CSSMatrixComponent: { + prototype: CSSMatrixComponent; + new(matrix: DOMMatrixReadOnly, options?: CSSMatrixComponentOptions): CSSMatrixComponent; +}; + +/** + * A single CSS @media rule. It implements the CSSConditionRule interface, and therefore the CSSGroupingRule and the CSSRule interface with a type value of 4 (CSSRule.MEDIA_RULE). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMediaRule) + */ interface CSSMediaRule extends CSSConditionRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSMediaRule/media) */ readonly media: MediaList; } @@ -2816,9 +3541,15 @@ declare var CSSMediaRule: { new(): CSSMediaRule; }; -/** An object representing a single CSS @namespace at-rule. It implements the CSSRule interface, with a type value of 10 (CSSRule.NAMESPACE_RULE). */ +/** + * An object representing a single CSS @namespace at-rule. It implements the CSSRule interface, with a type value of 10 (CSSRule.NAMESPACE_RULE). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNamespaceRule) + */ interface CSSNamespaceRule extends CSSRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNamespaceRule/namespaceURI) */ readonly namespaceURI: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNamespaceRule/prefix) */ readonly prefix: string; } @@ -2827,9 +3558,59 @@ declare var CSSNamespaceRule: { new(): CSSNamespaceRule; }; -/** CSSPageRule is an interface representing a single CSS @page rule. It implements the CSSRule interface with a type value of 6 (CSSRule.PAGE_RULE). */ +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericArray) */ +interface CSSNumericArray { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericArray/length) */ + readonly length: number; + forEach(callbackfn: (value: CSSNumericValue, key: number, parent: CSSNumericArray) => void, thisArg?: any): void; + [index: number]: CSSNumericValue; +} + +declare var CSSNumericArray: { + prototype: CSSNumericArray; + new(): CSSNumericArray; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue) */ +interface CSSNumericValue extends CSSStyleValue { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/add) */ + add(...values: CSSNumberish[]): CSSNumericValue; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/div) */ + div(...values: CSSNumberish[]): CSSNumericValue; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/equals) */ + equals(...value: CSSNumberish[]): boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/max) */ + max(...values: CSSNumberish[]): CSSNumericValue; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/min) */ + min(...values: CSSNumberish[]): CSSNumericValue; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/mul) */ + mul(...values: CSSNumberish[]): CSSNumericValue; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/sub) */ + sub(...values: CSSNumberish[]): CSSNumericValue; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/to) */ + to(unit: string): CSSUnitValue; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/toSum) */ + toSum(...units: string[]): CSSMathSum; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/type) */ + type(): CSSNumericType; +} + +declare var CSSNumericValue: { + prototype: CSSNumericValue; + new(): CSSNumericValue; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSNumericValue/parse) */ + parse(cssText: string): CSSNumericValue; +}; + +/** + * CSSPageRule is an interface representing a single CSS @page rule. It implements the CSSRule interface with a type value of 6 (CSSRule.PAGE_RULE). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPageRule) + */ interface CSSPageRule extends CSSGroupingRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPageRule/selectorText) */ selectorText: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPageRule/style) */ readonly style: CSSStyleDeclaration; } @@ -2838,12 +3619,69 @@ declare var CSSPageRule: { new(): CSSPageRule; }; -/** A single CSS rule. There are several types of rules, listed in the Type constants section below. */ +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPerspective) */ +interface CSSPerspective extends CSSTransformComponent { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPerspective/length) */ + length: CSSPerspectiveValue; +} + +declare var CSSPerspective: { + prototype: CSSPerspective; + new(length: CSSPerspectiveValue): CSSPerspective; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPropertyRule) */ +interface CSSPropertyRule extends CSSRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPropertyRule/inherits) */ + readonly inherits: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPropertyRule/initialValue) */ + readonly initialValue: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPropertyRule/name) */ + readonly name: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSPropertyRule/syntax) */ + readonly syntax: string; +} + +declare var CSSPropertyRule: { + prototype: CSSPropertyRule; + new(): CSSPropertyRule; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRotate) */ +interface CSSRotate extends CSSTransformComponent { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRotate/angle) */ + angle: CSSNumericValue; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRotate/x) */ + x: CSSNumberish; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRotate/y) */ + y: CSSNumberish; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRotate/z) */ + z: CSSNumberish; +} + +declare var CSSRotate: { + prototype: CSSRotate; + new(angle: CSSNumericValue): CSSRotate; + new(x: CSSNumberish, y: CSSNumberish, z: CSSNumberish, angle: CSSNumericValue): CSSRotate; +}; + +/** + * A single CSS rule. There are several types of rules, listed in the Type constants section below. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRule) + */ interface CSSRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRule/cssText) */ cssText: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRule/parentRule) */ readonly parentRule: CSSRule | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRule/parentStyleSheet) */ readonly parentStyleSheet: CSSStyleSheet | null; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRule/type) + */ readonly type: number; readonly STYLE_RULE: 1; readonly CHARSET_RULE: 2; @@ -2872,9 +3710,15 @@ declare var CSSRule: { readonly SUPPORTS_RULE: 12; }; -/** A CSSRuleList is an (indirect-modify only) array-like object containing an ordered collection of CSSRule objects. */ +/** + * A CSSRuleList is an (indirect-modify only) array-like object containing an ordered collection of CSSRule objects. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRuleList) + */ interface CSSRuleList { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRuleList/length) */ readonly length: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSRuleList/item) */ item(index: number): CSSRule | null; [index: number]: CSSRule; } @@ -2884,354 +3728,742 @@ declare var CSSRuleList: { new(): CSSRuleList; }; -/** An object that is a CSS declaration block, and exposes style information and various style-related methods and properties. */ +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSScale) */ +interface CSSScale extends CSSTransformComponent { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSScale/x) */ + x: CSSNumberish; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSScale/y) */ + y: CSSNumberish; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSScale/z) */ + z: CSSNumberish; +} + +declare var CSSScale: { + prototype: CSSScale; + new(x: CSSNumberish, y: CSSNumberish, z?: CSSNumberish): CSSScale; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkew) */ +interface CSSSkew extends CSSTransformComponent { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkew/ax) */ + ax: CSSNumericValue; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkew/ay) */ + ay: CSSNumericValue; +} + +declare var CSSSkew: { + prototype: CSSSkew; + new(ax: CSSNumericValue, ay: CSSNumericValue): CSSSkew; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkewX) */ +interface CSSSkewX extends CSSTransformComponent { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkewX/ax) */ + ax: CSSNumericValue; +} + +declare var CSSSkewX: { + prototype: CSSSkewX; + new(ax: CSSNumericValue): CSSSkewX; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkewY) */ +interface CSSSkewY extends CSSTransformComponent { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSkewY/ay) */ + ay: CSSNumericValue; +} + +declare var CSSSkewY: { + prototype: CSSSkewY; + new(ay: CSSNumericValue): CSSSkewY; +}; + +/** + * An object that is a CSS declaration block, and exposes style information and various style-related methods and properties. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration) + */ interface CSSStyleDeclaration { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/accent-color) */ accentColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/align-content) */ alignContent: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/align-items) */ alignItems: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/align-self) */ alignSelf: string; alignmentBaseline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/all) */ all: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation) */ animation: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-composition) */ + animationComposition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-delay) */ animationDelay: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-direction) */ animationDirection: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-duration) */ animationDuration: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-fill-mode) */ animationFillMode: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-iteration-count) */ animationIterationCount: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-name) */ animationName: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-play-state) */ animationPlayState: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-timing-function) */ animationTimingFunction: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/appearance) */ appearance: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/aspect-ratio) */ aspectRatio: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/backdrop-filter) */ backdropFilter: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/backface-visibility) */ backfaceVisibility: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background) */ background: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-attachment) */ backgroundAttachment: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-blend-mode) */ backgroundBlendMode: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-clip) */ backgroundClip: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-color) */ backgroundColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-image) */ backgroundImage: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-origin) */ backgroundOrigin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-position) */ backgroundPosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-position-x) */ backgroundPositionX: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-position-y) */ backgroundPositionY: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-repeat) */ backgroundRepeat: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-size) */ backgroundSize: string; baselineShift: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/block-size) */ blockSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border) */ border: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block) */ borderBlock: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-color) */ borderBlockColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-end) */ borderBlockEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-end-color) */ borderBlockEndColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-end-style) */ borderBlockEndStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-end-width) */ borderBlockEndWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-start) */ borderBlockStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-start-color) */ borderBlockStartColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-start-style) */ borderBlockStartStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-start-width) */ borderBlockStartWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-style) */ borderBlockStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-block-width) */ borderBlockWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom) */ borderBottom: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom-color) */ borderBottomColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom-left-radius) */ borderBottomLeftRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom-right-radius) */ borderBottomRightRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom-style) */ borderBottomStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom-width) */ borderBottomWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-collapse) */ borderCollapse: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-color) */ borderColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-end-end-radius) */ borderEndEndRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-end-start-radius) */ borderEndStartRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-image) */ borderImage: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-image-outset) */ borderImageOutset: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-image-repeat) */ borderImageRepeat: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-image-slice) */ borderImageSlice: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-image-source) */ borderImageSource: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-image-width) */ borderImageWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline) */ borderInline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-color) */ borderInlineColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-end) */ borderInlineEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-end-color) */ borderInlineEndColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-end-style) */ borderInlineEndStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-end-width) */ borderInlineEndWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-start) */ borderInlineStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-start-color) */ borderInlineStartColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-start-style) */ borderInlineStartStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-start-width) */ borderInlineStartWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-style) */ borderInlineStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-inline-width) */ borderInlineWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-left) */ borderLeft: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-left-color) */ borderLeftColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-left-style) */ borderLeftStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-left-width) */ borderLeftWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-radius) */ borderRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-right) */ borderRight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-right-color) */ borderRightColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-right-style) */ borderRightStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-right-width) */ borderRightWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-spacing) */ borderSpacing: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-start-end-radius) */ borderStartEndRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-start-start-radius) */ borderStartStartRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-style) */ borderStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top) */ borderTop: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top-color) */ borderTopColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top-left-radius) */ borderTopLeftRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top-right-radius) */ borderTopRightRadius: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top-style) */ borderTopStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top-width) */ borderTopWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-width) */ borderWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/bottom) */ bottom: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-shadow) */ boxShadow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-sizing) */ boxSizing: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/break-after) */ breakAfter: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/break-before) */ breakBefore: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/break-inside) */ breakInside: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/caption-side) */ captionSide: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/caret-color) */ caretColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/clear) */ clear: string; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/clip) + */ clip: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/clip-path) */ clipPath: string; clipRule: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/color) */ color: string; colorInterpolation: string; colorInterpolationFilters: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/color-scheme) */ colorScheme: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-count) */ columnCount: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-fill) */ columnFill: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-gap) */ columnGap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-rule) */ columnRule: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-rule-color) */ columnRuleColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-rule-style) */ columnRuleStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-rule-width) */ columnRuleWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-span) */ columnSpan: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/column-width) */ columnWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/columns) */ columns: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/contain) */ contain: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/contain-intrinsic-contain-intrinsic-block-size) */ containIntrinsicBlockSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/contain-intrinsic-height) */ containIntrinsicHeight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/contain-intrinsic-contain-intrinsic-inline-size) */ containIntrinsicInlineSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/contain-intrinsic-size) */ containIntrinsicSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/contain-intrinsic-width) */ containIntrinsicWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/container) */ container: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/container-name) */ containerName: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/container-type) */ containerType: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/content) */ content: string; - contentVisibility: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/counter-increment) */ counterIncrement: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/counter-reset) */ counterReset: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/counter-set) */ counterSet: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/cssFloat) */ cssFloat: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/cssText) */ cssText: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/cursor) */ cursor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/direction) */ direction: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/display) */ display: string; dominantBaseline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/empty-cells) */ emptyCells: string; fill: string; fillOpacity: string; fillRule: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/filter) */ filter: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex) */ flex: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-basis) */ flexBasis: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-direction) */ flexDirection: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-flow) */ flexFlow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-grow) */ flexGrow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-shrink) */ flexShrink: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-wrap) */ flexWrap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/float) */ float: string; floodColor: string; floodOpacity: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font) */ font: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-family) */ fontFamily: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-feature-settings) */ fontFeatureSettings: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-kerning) */ fontKerning: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-optical-sizing) */ fontOpticalSizing: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-palette) */ fontPalette: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-size) */ fontSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-size-adjust) */ fontSizeAdjust: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-stretch) */ fontStretch: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-style) */ fontStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-synthesis) */ fontSynthesis: string; + fontSynthesisSmallCaps: string; + fontSynthesisStyle: string; + fontSynthesisWeight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variant) */ fontVariant: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variant-alternates) */ fontVariantAlternates: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variant-caps) */ fontVariantCaps: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variant-east-asian) */ fontVariantEastAsian: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variant-ligatures) */ fontVariantLigatures: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variant-numeric) */ fontVariantNumeric: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variant-position) */ fontVariantPosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-variation-settings) */ fontVariationSettings: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/font-weight) */ fontWeight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/gap) */ gap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid) */ grid: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-area) */ gridArea: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-auto-columns) */ gridAutoColumns: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-auto-flow) */ gridAutoFlow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-auto-rows) */ gridAutoRows: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-column) */ gridColumn: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-column-end) */ gridColumnEnd: string; /** @deprecated This is a legacy alias of `columnGap`. */ gridColumnGap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-column-start) */ gridColumnStart: string; /** @deprecated This is a legacy alias of `gap`. */ gridGap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-row) */ gridRow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-row-end) */ gridRowEnd: string; /** @deprecated This is a legacy alias of `rowGap`. */ gridRowGap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-row-start) */ gridRowStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-template) */ gridTemplate: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-template-areas) */ gridTemplateAreas: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-template-columns) */ gridTemplateColumns: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/grid-template-rows) */ gridTemplateRows: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/height) */ height: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/hyphenate-character) */ hyphenateCharacter: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/hyphens) */ hyphens: string; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/image-orientation) + */ imageOrientation: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/image-rendering) */ imageRendering: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inline-size) */ inlineSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inset) */ inset: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inset-block) */ insetBlock: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inset-block-end) */ insetBlockEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inset-block-start) */ insetBlockStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inset-inline) */ insetInline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inset-inline-end) */ insetInlineEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/inset-inline-start) */ insetInlineStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/isolation) */ isolation: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/justify-content) */ justifyContent: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/justify-items) */ justifyItems: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/justify-self) */ justifySelf: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/left) */ left: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/length) */ readonly length: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/letter-spacing) */ letterSpacing: string; lightingColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/line-break) */ lineBreak: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/line-height) */ lineHeight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/list-style) */ listStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/list-style-image) */ listStyleImage: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/list-style-position) */ listStylePosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/list-style-type) */ listStyleType: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin) */ margin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-block) */ marginBlock: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-block-end) */ marginBlockEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-block-start) */ marginBlockStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-bottom) */ marginBottom: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-inline) */ marginInline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-inline-end) */ marginInlineEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-inline-start) */ marginInlineStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-left) */ marginLeft: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-right) */ marginRight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/margin-top) */ marginTop: string; marker: string; markerEnd: string; markerMid: string; markerStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask) */ mask: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-clip) */ maskClip: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-composite) */ maskComposite: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-image) */ maskImage: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-mode) */ maskMode: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-origin) */ maskOrigin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-position) */ maskPosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-repeat) */ maskRepeat: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-size) */ maskSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-type) */ maskType: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/math-style) */ mathStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/max-block-size) */ maxBlockSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/max-height) */ maxHeight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/max-inline-size) */ maxInlineSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/max-width) */ maxWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/min-block-size) */ minBlockSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/min-height) */ minHeight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/min-inline-size) */ minInlineSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/min-width) */ minWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mix-blend-mode) */ mixBlendMode: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/object-fit) */ objectFit: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/object-position) */ objectPosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/offset) */ offset: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/offset-distance) */ offsetDistance: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/offset-path) */ offsetPath: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/offset-rotate) */ offsetRotate: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/opacity) */ opacity: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/order) */ order: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/orphans) */ orphans: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/outline) */ outline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/outline-color) */ outlineColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/outline-offset) */ outlineOffset: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/outline-style) */ outlineStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/outline-width) */ outlineWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow) */ overflow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow-anchor) */ overflowAnchor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow-clip-margin) */ overflowClipMargin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow-wrap) */ overflowWrap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow-x) */ overflowX: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow-y) */ overflowY: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior) */ overscrollBehavior: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-block) */ overscrollBehaviorBlock: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-inline) */ overscrollBehaviorInline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-x) */ overscrollBehaviorX: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overscroll-behavior-y) */ overscrollBehaviorY: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding) */ padding: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-block) */ paddingBlock: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-block-end) */ paddingBlockEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-block-start) */ paddingBlockStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-bottom) */ paddingBottom: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-inline) */ paddingInline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-inline-end) */ paddingInlineEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-inline-start) */ paddingInlineStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-left) */ paddingLeft: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-right) */ paddingRight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/padding-top) */ paddingTop: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/page) */ + page: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/page-break-after) */ pageBreakAfter: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/page-break-before) */ pageBreakBefore: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/page-break-inside) */ pageBreakInside: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/paint-order) */ paintOrder: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/parentRule) */ readonly parentRule: CSSRule | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/perspective) */ perspective: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/perspective-origin) */ perspectiveOrigin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/place-content) */ placeContent: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/place-items) */ placeItems: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/place-self) */ placeSelf: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/pointer-events) */ pointerEvents: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/position) */ position: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/print-color-adjust) */ printColorAdjust: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/quotes) */ quotes: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/resize) */ resize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/right) */ right: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/rotate) */ rotate: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/row-gap) */ rowGap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/ruby-position) */ rubyPosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scale) */ scale: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-behavior) */ scrollBehavior: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin) */ scrollMargin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block) */ scrollMarginBlock: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-end) */ scrollMarginBlockEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-block-start) */ scrollMarginBlockStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-bottom) */ scrollMarginBottom: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline) */ scrollMarginInline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-end) */ scrollMarginInlineEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-inline-start) */ scrollMarginInlineStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-left) */ scrollMarginLeft: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-right) */ scrollMarginRight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-margin-top) */ scrollMarginTop: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding) */ scrollPadding: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block) */ scrollPaddingBlock: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-end) */ scrollPaddingBlockEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-block-start) */ scrollPaddingBlockStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-bottom) */ scrollPaddingBottom: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline) */ scrollPaddingInline: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-end) */ scrollPaddingInlineEnd: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-inline-start) */ scrollPaddingInlineStart: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-left) */ scrollPaddingLeft: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-right) */ scrollPaddingRight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-padding-top) */ scrollPaddingTop: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-snap-align) */ scrollSnapAlign: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-snap-stop) */ scrollSnapStop: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scroll-snap-type) */ scrollSnapType: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/scrollbar-gutter) */ scrollbarGutter: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/shape-image-threshold) */ shapeImageThreshold: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/shape-margin) */ shapeMargin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/shape-outside) */ shapeOutside: string; shapeRendering: string; stopColor: string; @@ -3244,194 +4476,512 @@ interface CSSStyleDeclaration { strokeMiterlimit: string; strokeOpacity: string; strokeWidth: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/tab-size) */ tabSize: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/table-layout) */ tableLayout: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-align) */ textAlign: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-align-last) */ textAlignLast: string; textAnchor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-combine-upright) */ textCombineUpright: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-decoration) */ textDecoration: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-decoration-color) */ textDecorationColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-decoration-line) */ textDecorationLine: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-decoration-skip-ink) */ textDecorationSkipInk: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-decoration-style) */ textDecorationStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-decoration-thickness) */ textDecorationThickness: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-emphasis) */ textEmphasis: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-emphasis-color) */ textEmphasisColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-emphasis-position) */ textEmphasisPosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-emphasis-style) */ textEmphasisStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-indent) */ textIndent: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-orientation) */ textOrientation: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-overflow) */ textOverflow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-rendering) */ textRendering: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-shadow) */ textShadow: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-transform) */ textTransform: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-underline-offset) */ textUnderlineOffset: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-underline-position) */ textUnderlinePosition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/top) */ top: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/touch-action) */ touchAction: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transform) */ transform: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transform-box) */ transformBox: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transform-origin) */ transformOrigin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transform-style) */ transformStyle: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition) */ transition: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-delay) */ transitionDelay: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-duration) */ transitionDuration: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-property) */ transitionProperty: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-timing-function) */ transitionTimingFunction: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/translate) */ translate: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/unicode-bidi) */ unicodeBidi: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/user-select) */ userSelect: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/vertical-align) */ verticalAlign: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/visibility) */ visibility: string; - /** @deprecated This is a legacy alias of `alignContent`. */ + /** + * @deprecated This is a legacy alias of `alignContent`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/align-content) + */ webkitAlignContent: string; - /** @deprecated This is a legacy alias of `alignItems`. */ + /** + * @deprecated This is a legacy alias of `alignItems`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/align-items) + */ webkitAlignItems: string; - /** @deprecated This is a legacy alias of `alignSelf`. */ + /** + * @deprecated This is a legacy alias of `alignSelf`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/align-self) + */ webkitAlignSelf: string; - /** @deprecated This is a legacy alias of `animation`. */ + /** + * @deprecated This is a legacy alias of `animation`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation) + */ webkitAnimation: string; - /** @deprecated This is a legacy alias of `animationDelay`. */ + /** + * @deprecated This is a legacy alias of `animationDelay`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-delay) + */ webkitAnimationDelay: string; - /** @deprecated This is a legacy alias of `animationDirection`. */ + /** + * @deprecated This is a legacy alias of `animationDirection`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-direction) + */ webkitAnimationDirection: string; - /** @deprecated This is a legacy alias of `animationDuration`. */ + /** + * @deprecated This is a legacy alias of `animationDuration`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-duration) + */ webkitAnimationDuration: string; - /** @deprecated This is a legacy alias of `animationFillMode`. */ + /** + * @deprecated This is a legacy alias of `animationFillMode`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-fill-mode) + */ webkitAnimationFillMode: string; - /** @deprecated This is a legacy alias of `animationIterationCount`. */ + /** + * @deprecated This is a legacy alias of `animationIterationCount`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-iteration-count) + */ webkitAnimationIterationCount: string; - /** @deprecated This is a legacy alias of `animationName`. */ + /** + * @deprecated This is a legacy alias of `animationName`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-name) + */ webkitAnimationName: string; - /** @deprecated This is a legacy alias of `animationPlayState`. */ + /** + * @deprecated This is a legacy alias of `animationPlayState`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-play-state) + */ webkitAnimationPlayState: string; - /** @deprecated This is a legacy alias of `animationTimingFunction`. */ + /** + * @deprecated This is a legacy alias of `animationTimingFunction`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/animation-timing-function) + */ webkitAnimationTimingFunction: string; - /** @deprecated This is a legacy alias of `appearance`. */ + /** + * @deprecated This is a legacy alias of `appearance`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/appearance) + */ webkitAppearance: string; - /** @deprecated This is a legacy alias of `backfaceVisibility`. */ + /** + * @deprecated This is a legacy alias of `backfaceVisibility`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/backface-visibility) + */ webkitBackfaceVisibility: string; - /** @deprecated This is a legacy alias of `backgroundClip`. */ + /** + * @deprecated This is a legacy alias of `backgroundClip`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-clip) + */ webkitBackgroundClip: string; - /** @deprecated This is a legacy alias of `backgroundOrigin`. */ + /** + * @deprecated This is a legacy alias of `backgroundOrigin`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-origin) + */ webkitBackgroundOrigin: string; - /** @deprecated This is a legacy alias of `backgroundSize`. */ + /** + * @deprecated This is a legacy alias of `backgroundSize`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/background-size) + */ webkitBackgroundSize: string; - /** @deprecated This is a legacy alias of `borderBottomLeftRadius`. */ + /** + * @deprecated This is a legacy alias of `borderBottomLeftRadius`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom-left-radius) + */ webkitBorderBottomLeftRadius: string; - /** @deprecated This is a legacy alias of `borderBottomRightRadius`. */ + /** + * @deprecated This is a legacy alias of `borderBottomRightRadius`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-bottom-right-radius) + */ webkitBorderBottomRightRadius: string; - /** @deprecated This is a legacy alias of `borderRadius`. */ + /** + * @deprecated This is a legacy alias of `borderRadius`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-radius) + */ webkitBorderRadius: string; - /** @deprecated This is a legacy alias of `borderTopLeftRadius`. */ + /** + * @deprecated This is a legacy alias of `borderTopLeftRadius`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top-left-radius) + */ webkitBorderTopLeftRadius: string; - /** @deprecated This is a legacy alias of `borderTopRightRadius`. */ + /** + * @deprecated This is a legacy alias of `borderTopRightRadius`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/border-top-right-radius) + */ webkitBorderTopRightRadius: string; - /** @deprecated This is a legacy alias of `boxAlign`. */ + /** + * @deprecated This is a legacy alias of `boxAlign`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-align) + */ webkitBoxAlign: string; - /** @deprecated This is a legacy alias of `boxFlex`. */ + /** + * @deprecated This is a legacy alias of `boxFlex`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-flex) + */ webkitBoxFlex: string; - /** @deprecated This is a legacy alias of `boxOrdinalGroup`. */ + /** + * @deprecated This is a legacy alias of `boxOrdinalGroup`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-ordinal-group) + */ webkitBoxOrdinalGroup: string; - /** @deprecated This is a legacy alias of `boxOrient`. */ + /** + * @deprecated This is a legacy alias of `boxOrient`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-orient) + */ webkitBoxOrient: string; - /** @deprecated This is a legacy alias of `boxPack`. */ + /** + * @deprecated This is a legacy alias of `boxPack`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-pack) + */ webkitBoxPack: string; - /** @deprecated This is a legacy alias of `boxShadow`. */ + /** + * @deprecated This is a legacy alias of `boxShadow`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-shadow) + */ webkitBoxShadow: string; - /** @deprecated This is a legacy alias of `boxSizing`. */ + /** + * @deprecated This is a legacy alias of `boxSizing`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/box-sizing) + */ webkitBoxSizing: string; - /** @deprecated This is a legacy alias of `filter`. */ + /** + * @deprecated This is a legacy alias of `filter`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/filter) + */ webkitFilter: string; - /** @deprecated This is a legacy alias of `flex`. */ + /** + * @deprecated This is a legacy alias of `flex`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex) + */ webkitFlex: string; - /** @deprecated This is a legacy alias of `flexBasis`. */ + /** + * @deprecated This is a legacy alias of `flexBasis`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-basis) + */ webkitFlexBasis: string; - /** @deprecated This is a legacy alias of `flexDirection`. */ + /** + * @deprecated This is a legacy alias of `flexDirection`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-direction) + */ webkitFlexDirection: string; - /** @deprecated This is a legacy alias of `flexFlow`. */ + /** + * @deprecated This is a legacy alias of `flexFlow`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-flow) + */ webkitFlexFlow: string; - /** @deprecated This is a legacy alias of `flexGrow`. */ + /** + * @deprecated This is a legacy alias of `flexGrow`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-grow) + */ webkitFlexGrow: string; - /** @deprecated This is a legacy alias of `flexShrink`. */ + /** + * @deprecated This is a legacy alias of `flexShrink`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-shrink) + */ webkitFlexShrink: string; - /** @deprecated This is a legacy alias of `flexWrap`. */ + /** + * @deprecated This is a legacy alias of `flexWrap`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/flex-wrap) + */ webkitFlexWrap: string; - /** @deprecated This is a legacy alias of `justifyContent`. */ + /** + * @deprecated This is a legacy alias of `justifyContent`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/justify-content) + */ webkitJustifyContent: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/-webkit-line-clamp) */ webkitLineClamp: string; - /** @deprecated This is a legacy alias of `mask`. */ + /** + * @deprecated This is a legacy alias of `mask`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask) + */ webkitMask: string; - /** @deprecated This is a legacy alias of `maskBorder`. */ + /** + * @deprecated This is a legacy alias of `maskBorder`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-border) + */ webkitMaskBoxImage: string; - /** @deprecated This is a legacy alias of `maskBorderOutset`. */ + /** + * @deprecated This is a legacy alias of `maskBorderOutset`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-border-outset) + */ webkitMaskBoxImageOutset: string; - /** @deprecated This is a legacy alias of `maskBorderRepeat`. */ + /** + * @deprecated This is a legacy alias of `maskBorderRepeat`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-border-repeat) + */ webkitMaskBoxImageRepeat: string; - /** @deprecated This is a legacy alias of `maskBorderSlice`. */ + /** + * @deprecated This is a legacy alias of `maskBorderSlice`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-border-slice) + */ webkitMaskBoxImageSlice: string; - /** @deprecated This is a legacy alias of `maskBorderSource`. */ + /** + * @deprecated This is a legacy alias of `maskBorderSource`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-border-source) + */ webkitMaskBoxImageSource: string; - /** @deprecated This is a legacy alias of `maskBorderWidth`. */ + /** + * @deprecated This is a legacy alias of `maskBorderWidth`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-border-width) + */ webkitMaskBoxImageWidth: string; - /** @deprecated This is a legacy alias of `maskClip`. */ + /** + * @deprecated This is a legacy alias of `maskClip`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-clip) + */ webkitMaskClip: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/-webkit-mask-composite) */ webkitMaskComposite: string; - /** @deprecated This is a legacy alias of `maskImage`. */ + /** + * @deprecated This is a legacy alias of `maskImage`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-image) + */ webkitMaskImage: string; - /** @deprecated This is a legacy alias of `maskOrigin`. */ + /** + * @deprecated This is a legacy alias of `maskOrigin`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-origin) + */ webkitMaskOrigin: string; - /** @deprecated This is a legacy alias of `maskPosition`. */ + /** + * @deprecated This is a legacy alias of `maskPosition`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-position) + */ webkitMaskPosition: string; - /** @deprecated This is a legacy alias of `maskRepeat`. */ + /** + * @deprecated This is a legacy alias of `maskRepeat`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-repeat) + */ webkitMaskRepeat: string; - /** @deprecated This is a legacy alias of `maskSize`. */ + /** + * @deprecated This is a legacy alias of `maskSize`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/mask-size) + */ webkitMaskSize: string; - /** @deprecated This is a legacy alias of `order`. */ + /** + * @deprecated This is a legacy alias of `order`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/order) + */ webkitOrder: string; - /** @deprecated This is a legacy alias of `perspective`. */ + /** + * @deprecated This is a legacy alias of `perspective`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/perspective) + */ webkitPerspective: string; - /** @deprecated This is a legacy alias of `perspectiveOrigin`. */ + /** + * @deprecated This is a legacy alias of `perspectiveOrigin`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/perspective-origin) + */ webkitPerspectiveOrigin: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/-webkit-text-fill-color) */ webkitTextFillColor: string; - /** @deprecated This is a legacy alias of `textSizeAdjust`. */ + /** + * @deprecated This is a legacy alias of `textSizeAdjust`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/text-size-adjust) + */ webkitTextSizeAdjust: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke) */ webkitTextStroke: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-color) */ webkitTextStrokeColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/-webkit-text-stroke-width) */ webkitTextStrokeWidth: string; - /** @deprecated This is a legacy alias of `transform`. */ + /** + * @deprecated This is a legacy alias of `transform`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transform) + */ webkitTransform: string; - /** @deprecated This is a legacy alias of `transformOrigin`. */ + /** + * @deprecated This is a legacy alias of `transformOrigin`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transform-origin) + */ webkitTransformOrigin: string; - /** @deprecated This is a legacy alias of `transformStyle`. */ + /** + * @deprecated This is a legacy alias of `transformStyle`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transform-style) + */ webkitTransformStyle: string; - /** @deprecated This is a legacy alias of `transition`. */ + /** + * @deprecated This is a legacy alias of `transition`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition) + */ webkitTransition: string; - /** @deprecated This is a legacy alias of `transitionDelay`. */ + /** + * @deprecated This is a legacy alias of `transitionDelay`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-delay) + */ webkitTransitionDelay: string; - /** @deprecated This is a legacy alias of `transitionDuration`. */ + /** + * @deprecated This is a legacy alias of `transitionDuration`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-duration) + */ webkitTransitionDuration: string; - /** @deprecated This is a legacy alias of `transitionProperty`. */ + /** + * @deprecated This is a legacy alias of `transitionProperty`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-property) + */ webkitTransitionProperty: string; - /** @deprecated This is a legacy alias of `transitionTimingFunction`. */ + /** + * @deprecated This is a legacy alias of `transitionTimingFunction`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/transition-timing-function) + */ webkitTransitionTimingFunction: string; - /** @deprecated This is a legacy alias of `userSelect`. */ + /** + * @deprecated This is a legacy alias of `userSelect`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/user-select) + */ webkitUserSelect: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/white-space) */ whiteSpace: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/widows) */ widows: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/width) */ width: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/will-change) */ willChange: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/word-break) */ wordBreak: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/word-spacing) */ wordSpacing: string; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/overflow-wrap) + */ wordWrap: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/writing-mode) */ writingMode: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/CSS/z-index) */ zIndex: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/getPropertyPriority) */ getPropertyPriority(property: string): string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/getPropertyValue) */ getPropertyValue(property: string): string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/item) */ item(index: number): string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/removeProperty) */ removeProperty(property: string): string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleDeclaration/setProperty) */ setProperty(property: string, value: string | null, priority?: string): void; [index: number]: string; } @@ -3441,10 +4991,18 @@ declare var CSSStyleDeclaration: { new(): CSSStyleDeclaration; }; -/** CSSStyleRule represents a single CSS style rule. It implements the CSSRule interface with a type value of 1 (CSSRule.STYLE_RULE). */ +/** + * CSSStyleRule represents a single CSS style rule. It implements the CSSRule interface with a type value of 1 (CSSRule.STYLE_RULE). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleRule) + */ interface CSSStyleRule extends CSSRule { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleRule/selectorText) */ selectorText: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleRule/style) */ readonly style: CSSStyleDeclaration; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleRule/styleMap) */ + readonly styleMap: StylePropertyMap; } declare var CSSStyleRule: { @@ -3452,19 +5010,41 @@ declare var CSSStyleRule: { new(): CSSStyleRule; }; -/** A single CSS style sheet. It inherits properties and methods from its parent, StyleSheet. */ +/** + * A single CSS style sheet. It inherits properties and methods from its parent, StyleSheet. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet) + */ interface CSSStyleSheet extends StyleSheet { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/cssRules) */ readonly cssRules: CSSRuleList; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/ownerRule) */ readonly ownerRule: CSSRule | null; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/rules) + */ readonly rules: CSSRuleList; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/addRule) + */ addRule(selector?: string, style?: string, index?: number): number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/deleteRule) */ deleteRule(index: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/insertRule) */ insertRule(rule: string, index?: number): number; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/removeRule) + */ removeRule(index?: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/replace) */ replace(text: string): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleSheet/replaceSync) */ replaceSync(text: string): void; } @@ -3473,7 +5053,25 @@ declare var CSSStyleSheet: { new(options?: CSSStyleSheetInit): CSSStyleSheet; }; -/** An object representing a single CSS @supports at-rule. It implements the CSSConditionRule interface, and therefore the CSSRule and CSSGroupingRule interfaces with a type value of 12 (CSSRule.SUPPORTS_RULE). */ +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleValue) */ +interface CSSStyleValue { + toString(): string; +} + +declare var CSSStyleValue: { + prototype: CSSStyleValue; + new(): CSSStyleValue; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleValue/parse) */ + parse(property: string, cssText: string): CSSStyleValue; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSStyleValue/parseAll) */ + parseAll(property: string, cssText: string): CSSStyleValue[]; +}; + +/** + * An object representing a single CSS @supports at-rule. It implements the CSSConditionRule interface, and therefore the CSSRule and CSSGroupingRule interfaces with a type value of 12 (CSSRule.SUPPORTS_RULE). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSSupportsRule) + */ interface CSSSupportsRule extends CSSConditionRule { } @@ -3482,7 +5080,40 @@ declare var CSSSupportsRule: { new(): CSSSupportsRule; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransformComponent) */ +interface CSSTransformComponent { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransformComponent/is2D) */ + is2D: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransformComponent/toMatrix) */ + toMatrix(): DOMMatrix; + toString(): string; +} + +declare var CSSTransformComponent: { + prototype: CSSTransformComponent; + new(): CSSTransformComponent; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransformValue) */ +interface CSSTransformValue extends CSSStyleValue { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransformValue/is2D) */ + readonly is2D: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransformValue/length) */ + readonly length: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransformValue/toMatrix) */ + toMatrix(): DOMMatrix; + forEach(callbackfn: (value: CSSTransformComponent, key: number, parent: CSSTransformValue) => void, thisArg?: any): void; + [index: number]: CSSTransformComponent; +} + +declare var CSSTransformValue: { + prototype: CSSTransformValue; + new(transforms: CSSTransformComponent[]): CSSTransformValue; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransition) */ interface CSSTransition extends Animation { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTransition/transitionProperty) */ readonly transitionProperty: string; addEventListener(type: K, listener: (this: CSSTransition, ev: AnimationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -3495,17 +5126,80 @@ declare var CSSTransition: { new(): CSSTransition; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTranslate) */ +interface CSSTranslate extends CSSTransformComponent { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTranslate/x) */ + x: CSSNumericValue; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTranslate/y) */ + y: CSSNumericValue; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSTranslate/z) */ + z: CSSNumericValue; +} + +declare var CSSTranslate: { + prototype: CSSTranslate; + new(x: CSSNumericValue, y: CSSNumericValue, z?: CSSNumericValue): CSSTranslate; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSUnitValue) */ +interface CSSUnitValue extends CSSNumericValue { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSUnitValue/unit) */ + readonly unit: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSUnitValue/value) */ + value: number; +} + +declare var CSSUnitValue: { + prototype: CSSUnitValue; + new(value: number, unit: string): CSSUnitValue; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSUnparsedValue) */ +interface CSSUnparsedValue extends CSSStyleValue { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSUnparsedValue/length) */ + readonly length: number; + forEach(callbackfn: (value: CSSUnparsedSegment, key: number, parent: CSSUnparsedValue) => void, thisArg?: any): void; + [index: number]: CSSUnparsedSegment; +} + +declare var CSSUnparsedValue: { + prototype: CSSUnparsedValue; + new(members: CSSUnparsedSegment[]): CSSUnparsedValue; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSVariableReferenceValue) */ +interface CSSVariableReferenceValue { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSVariableReferenceValue/fallback) */ + readonly fallback: CSSUnparsedValue | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CSSVariableReferenceValue/variable) */ + variable: string; +} + +declare var CSSVariableReferenceValue: { + prototype: CSSVariableReferenceValue; + new(variable: string, fallback?: CSSUnparsedValue | null): CSSVariableReferenceValue; +}; + /** * Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache) */ interface Cache { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/add) */ add(request: RequestInfo | URL): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/addAll) */ addAll(requests: RequestInfo[]): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/delete) */ delete(request: RequestInfo | URL, options?: CacheQueryOptions): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/keys) */ keys(request?: RequestInfo | URL, options?: CacheQueryOptions): Promise>; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/match) */ match(request: RequestInfo | URL, options?: CacheQueryOptions): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/matchAll) */ matchAll(request?: RequestInfo | URL, options?: CacheQueryOptions): Promise>; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Cache/put) */ put(request: RequestInfo | URL, response: Response): Promise; } @@ -3517,12 +5211,19 @@ declare var Cache: { /** * The storage for Cache objects. * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage) */ interface CacheStorage { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/delete) */ delete(cacheName: string): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/has) */ has(cacheName: string): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/keys) */ keys(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/match) */ match(request: RequestInfo | URL, options?: MultiCacheQueryOptions): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open) */ open(cacheName: string): Promise; } @@ -3531,8 +5232,11 @@ declare var CacheStorage: { new(): CacheStorage; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasCaptureMediaStreamTrack) */ interface CanvasCaptureMediaStreamTrack extends MediaStreamTrack { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasCaptureMediaStreamTrack/canvas) */ readonly canvas: HTMLCanvasElement; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasCaptureMediaStreamTrack/requestFrame) */ requestFrame(): void; addEventListener(type: K, listener: (this: CanvasCaptureMediaStreamTrack, ev: MediaStreamTrackEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -3546,49 +5250,71 @@ declare var CanvasCaptureMediaStreamTrack: { }; interface CanvasCompositing { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/globalAlpha) */ globalAlpha: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation) */ globalCompositeOperation: GlobalCompositeOperation; } interface CanvasDrawImage { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/drawImage) */ drawImage(image: CanvasImageSource, dx: number, dy: number): void; drawImage(image: CanvasImageSource, dx: number, dy: number, dw: number, dh: number): void; drawImage(image: CanvasImageSource, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void; } interface CanvasDrawPath { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/beginPath) */ beginPath(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/clip) */ clip(fillRule?: CanvasFillRule): void; clip(path: Path2D, fillRule?: CanvasFillRule): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fill) */ fill(fillRule?: CanvasFillRule): void; fill(path: Path2D, fillRule?: CanvasFillRule): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/isPointInPath) */ isPointInPath(x: number, y: number, fillRule?: CanvasFillRule): boolean; isPointInPath(path: Path2D, x: number, y: number, fillRule?: CanvasFillRule): boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/isPointInStroke) */ isPointInStroke(x: number, y: number): boolean; isPointInStroke(path: Path2D, x: number, y: number): boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/stroke) */ stroke(): void; stroke(path: Path2D): void; } interface CanvasFillStrokeStyles { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fillStyle) */ fillStyle: string | CanvasGradient | CanvasPattern; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/strokeStyle) */ strokeStyle: string | CanvasGradient | CanvasPattern; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/createConicGradient) */ createConicGradient(startAngle: number, x: number, y: number): CanvasGradient; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/createLinearGradient) */ createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/createPattern) */ createPattern(image: CanvasImageSource, repetition: string | null): CanvasPattern | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/createRadialGradient) */ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; } interface CanvasFilters { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/filter) */ filter: string; } -/** An opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient(). */ +/** + * An opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient(). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasGradient) + */ interface CanvasGradient { /** * Adds a color stop with the given color to the gradient at the given offset. 0.0 is the offset at one end of the gradient, 1.0 is the offset at the other end. * * Throws an "IndexSizeError" DOMException if the offset is out of range. Throws a "SyntaxError" DOMException if the color cannot be parsed. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasGradient/addColorStop) */ addColorStop(offset: number, color: string): void; } @@ -3599,44 +5325,74 @@ declare var CanvasGradient: { }; interface CanvasImageData { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/createImageData) */ createImageData(sw: number, sh: number, settings?: ImageDataSettings): ImageData; createImageData(imagedata: ImageData): ImageData; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/getImageData) */ getImageData(sx: number, sy: number, sw: number, sh: number, settings?: ImageDataSettings): ImageData; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/putImageData) */ putImageData(imagedata: ImageData, dx: number, dy: number): void; putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX: number, dirtyY: number, dirtyWidth: number, dirtyHeight: number): void; } interface CanvasImageSmoothing { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled) */ imageSmoothingEnabled: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/imageSmoothingQuality) */ imageSmoothingQuality: ImageSmoothingQuality; } interface CanvasPath { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/arc) */ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/arcTo) */ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/bezierCurveTo) */ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/closePath) */ closePath(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/ellipse) */ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineTo) */ lineTo(x: number, y: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/moveTo) */ moveTo(x: number, y: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/quadraticCurveTo) */ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/rect) */ rect(x: number, y: number, w: number, h: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/roundRect) */ roundRect(x: number, y: number, w: number, h: number, radii?: number | DOMPointInit | (number | DOMPointInit)[]): void; } interface CanvasPathDrawingStyles { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineCap) */ lineCap: CanvasLineCap; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineDashOffset) */ lineDashOffset: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineJoin) */ lineJoin: CanvasLineJoin; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/lineWidth) */ lineWidth: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/miterLimit) */ miterLimit: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/getLineDash) */ getLineDash(): number[]; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setLineDash) */ setLineDash(segments: number[]): void; } -/** An opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method. */ +/** + * An opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasPattern) + */ interface CanvasPattern { - /** Sets the transformation matrix that will be used when rendering the pattern during a fill or stroke painting operation. */ + /** + * Sets the transformation matrix that will be used when rendering the pattern during a fill or stroke painting operation. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasPattern/setTransform) + */ setTransform(transform?: DOMMatrix2DInit): void; } @@ -3646,14 +5402,23 @@ declare var CanvasPattern: { }; interface CanvasRect { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/clearRect) */ clearRect(x: number, y: number, w: number, h: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fillRect) */ fillRect(x: number, y: number, w: number, h: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/strokeRect) */ strokeRect(x: number, y: number, w: number, h: number): void; } -/** The CanvasRenderingContext2D interface, part of the Canvas API, provides the 2D rendering context for the drawing surface of a element. It is used for drawing shapes, text, images, and other objects. */ +/** + * The CanvasRenderingContext2D interface, part of the Canvas API, provides the 2D rendering context for the drawing surface of a element. It is used for drawing shapes, text, images, and other objects. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D) + */ interface CanvasRenderingContext2D extends CanvasCompositing, CanvasDrawImage, CanvasDrawPath, CanvasFillStrokeStyles, CanvasFilters, CanvasImageData, CanvasImageSmoothing, CanvasPath, CanvasPathDrawingStyles, CanvasRect, CanvasShadowStyles, CanvasState, CanvasText, CanvasTextDrawingStyles, CanvasTransform, CanvasUserInterface { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/canvas) */ readonly canvas: HTMLCanvasElement; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/getContextAttributes) */ getContextAttributes(): CanvasRenderingContext2DSettings; } @@ -3663,48 +5428,74 @@ declare var CanvasRenderingContext2D: { }; interface CanvasShadowStyles { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowBlur) */ shadowBlur: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowColor) */ shadowColor: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowOffsetX) */ shadowOffsetX: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/shadowOffsetY) */ shadowOffsetY: number; } interface CanvasState { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/restore) */ restore(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/save) */ save(): void; } interface CanvasText { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fillText) */ fillText(text: string, x: number, y: number, maxWidth?: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/measureText) */ measureText(text: string): TextMetrics; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/strokeText) */ strokeText(text: string, x: number, y: number, maxWidth?: number): void; } interface CanvasTextDrawingStyles { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/direction) */ direction: CanvasDirection; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/font) */ font: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/fontKerning) */ fontKerning: CanvasFontKerning; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/textAlign) */ textAlign: CanvasTextAlign; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/textBaseline) */ textBaseline: CanvasTextBaseline; } interface CanvasTransform { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/getTransform) */ getTransform(): DOMMatrix; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/resetTransform) */ resetTransform(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/rotate) */ rotate(angle: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/scale) */ scale(x: number, y: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/setTransform) */ setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void; setTransform(transform?: DOMMatrix2DInit): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/transform) */ transform(a: number, b: number, c: number, d: number, e: number, f: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/translate) */ translate(x: number, y: number): void; } interface CanvasUserInterface { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CanvasRenderingContext2D/drawFocusIfNeeded) */ drawFocusIfNeeded(element: Element): void; drawFocusIfNeeded(path: Path2D, element: Element): void; } -/** The ChannelMergerNode interface, often used in conjunction with its opposite, ChannelSplitterNode, reunites different mono inputs into a single output. Each input is used to fill a channel of the output. This is useful for accessing each channels separately, e.g. for performing channel mixing where gain must be separately controlled on each channel. */ +/** + * The ChannelMergerNode interface, often used in conjunction with its opposite, ChannelSplitterNode, reunites different mono inputs into a single output. Each input is used to fill a channel of the output. This is useful for accessing each channels separately, e.g. for performing channel mixing where gain must be separately controlled on each channel. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ChannelMergerNode) + */ interface ChannelMergerNode extends AudioNode { } @@ -3713,7 +5504,11 @@ declare var ChannelMergerNode: { new(context: BaseAudioContext, options?: ChannelMergerOptions): ChannelMergerNode; }; -/** The ChannelSplitterNode interface, often used in conjunction with its opposite, ChannelMergerNode, separates the different channels of an audio source into a set of mono outputs. This is useful for accessing each channel separately, e.g. for performing channel mixing where gain must be separately controlled on each channel. */ +/** + * The ChannelSplitterNode interface, often used in conjunction with its opposite, ChannelMergerNode, separates the different channels of an audio source into a set of mono outputs. This is useful for accessing each channel separately, e.g. for performing channel mixing where gain must be separately controlled on each channel. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ChannelSplitterNode) + */ interface ChannelSplitterNode extends AudioNode { } @@ -3722,15 +5517,26 @@ declare var ChannelSplitterNode: { new(context: BaseAudioContext, options?: ChannelSplitterOptions): ChannelSplitterNode; }; -/** The CharacterData abstract interface represents a Node object that contains characters. This is an abstract interface, meaning there aren't any object of type CharacterData: it is implemented by other interfaces, like Text, Comment, or ProcessingInstruction which aren't abstract. */ +/** + * The CharacterData abstract interface represents a Node object that contains characters. This is an abstract interface, meaning there aren't any object of type CharacterData: it is implemented by other interfaces, like Text, Comment, or ProcessingInstruction which aren't abstract. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData) + */ interface CharacterData extends Node, ChildNode, NonDocumentTypeChildNode { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/data) */ data: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/length) */ readonly length: number; readonly ownerDocument: Document; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/appendData) */ appendData(data: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/deleteData) */ deleteData(offset: number, count: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/insertData) */ insertData(offset: number, data: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/replaceData) */ replaceData(offset: number, count: number, data: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/substringData) */ substringData(offset: number, count: number): string; } @@ -3744,20 +5550,30 @@ interface ChildNode extends Node { * Inserts nodes just after node, while replacing strings in nodes with equivalent Text nodes. * * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/after) */ after(...nodes: (Node | string)[]): void; /** * Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes. * * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/before) */ before(...nodes: (Node | string)[]): void; - /** Removes node. */ + /** + * Removes node. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/remove) + */ remove(): void; /** * Replaces node with nodes, while replacing strings in nodes with equivalent Text nodes. * * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CharacterData/replaceWith) */ replaceWith(...nodes: (Node | string)[]): void; } @@ -3766,11 +5582,19 @@ interface ChildNode extends Node { interface ClientRect extends DOMRect { } -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clipboard) + */ interface Clipboard extends EventTarget { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clipboard/read) */ read(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clipboard/readText) */ readText(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clipboard/write) */ write(data: ClipboardItems): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Clipboard/writeText) */ writeText(data: string): Promise; } @@ -3779,8 +5603,13 @@ declare var Clipboard: { new(): Clipboard; }; -/** Events providing information related to modification of the clipboard, that is cut, copy, and paste events. */ +/** + * Events providing information related to modification of the clipboard, that is cut, copy, and paste events. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ClipboardEvent) + */ interface ClipboardEvent extends Event { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ClipboardEvent/clipboardData) */ readonly clipboardData: DataTransfer | null; } @@ -3789,10 +5618,17 @@ declare var ClipboardEvent: { new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; }; -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ClipboardItem) + */ interface ClipboardItem { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ClipboardItem/presentationStyle) */ readonly presentationStyle: PresentationStyle; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ClipboardItem/types) */ readonly types: ReadonlyArray; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ClipboardItem/getType) */ getType(type: string): Promise; } @@ -3801,13 +5637,29 @@ declare var ClipboardItem: { new(items: Record>, options?: ClipboardItemOptions): ClipboardItem; }; -/** A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute. */ +/** + * A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent) + */ interface CloseEvent extends Event { - /** Returns the WebSocket connection close code provided by the server. */ + /** + * Returns the WebSocket connection close code provided by the server. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/code) + */ readonly code: number; - /** Returns the WebSocket connection close reason provided by the server. */ + /** + * Returns the WebSocket connection close reason provided by the server. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/reason) + */ readonly reason: string; - /** Returns true if the connection closed cleanly; false otherwise. */ + /** + * Returns true if the connection closed cleanly; false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CloseEvent/wasClean) + */ readonly wasClean: boolean; } @@ -3816,7 +5668,11 @@ declare var CloseEvent: { new(type: string, eventInitDict?: CloseEventInit): CloseEvent; }; -/** Textual notations within markup; although it is generally not visually shown, such comments are available to be read in the source view. */ +/** + * Textual notations within markup; although it is generally not visually shown, such comments are available to be read in the source view. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Comment) + */ interface Comment extends CharacterData { } @@ -3825,10 +5681,19 @@ declare var Comment: { new(data?: string): Comment; }; -/** The DOM CompositionEvent represents events that occur due to the user indirectly entering text. */ +/** + * The DOM CompositionEvent represents events that occur due to the user indirectly entering text. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompositionEvent) + */ interface CompositionEvent extends UIEvent { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompositionEvent/data) */ readonly data: string; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompositionEvent/initCompositionEvent) + */ initCompositionEvent(typeArg: string, bubblesArg?: boolean, cancelableArg?: boolean, viewArg?: WindowProxy | null, dataArg?: string): void; } @@ -3837,7 +5702,18 @@ declare var CompositionEvent: { new(type: string, eventInitDict?: CompositionEventInit): CompositionEvent; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream) */ +interface CompressionStream extends GenericTransformStream { +} + +declare var CompressionStream: { + prototype: CompressionStream; + new(format: CompressionFormat): CompressionStream; +}; + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ConstantSourceNode) */ interface ConstantSourceNode extends AudioScheduledSourceNode { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ConstantSourceNode/offset) */ readonly offset: AudioParam; addEventListener(type: K, listener: (this: ConstantSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -3850,9 +5726,15 @@ declare var ConstantSourceNode: { new(context: BaseAudioContext, options?: ConstantSourceOptions): ConstantSourceNode; }; -/** An AudioNode that performs a Linear Convolution on a given AudioBuffer, often used to achieve a reverb effect. A ConvolverNode always has exactly one input and one output. */ +/** + * An AudioNode that performs a Linear Convolution on a given AudioBuffer, often used to achieve a reverb effect. A ConvolverNode always has exactly one input and one output. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ConvolverNode) + */ interface ConvolverNode extends AudioNode { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ConvolverNode/buffer) */ buffer: AudioBuffer | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ConvolverNode/normalize) */ normalize: boolean; } @@ -3861,9 +5743,15 @@ declare var ConvolverNode: { new(context: BaseAudioContext, options?: ConvolverOptions): ConvolverNode; }; -/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ +/** + * This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy) + */ interface CountQueuingStrategy extends QueuingStrategy { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/highWaterMark) */ readonly highWaterMark: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CountQueuingStrategy/size) */ readonly size: QueuingStrategySize; } @@ -3872,9 +5760,15 @@ declare var CountQueuingStrategy: { new(init: QueuingStrategyInit): CountQueuingStrategy; }; -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Credential) + */ interface Credential { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Credential/id) */ readonly id: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Credential/type) */ readonly type: string; } @@ -3883,11 +5777,19 @@ declare var Credential: { new(): Credential; }; -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CredentialsContainer) + */ interface CredentialsContainer { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/create) */ create(options?: CredentialCreationOptions): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/get) */ get(options?: CredentialRequestOptions): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/preventSilentAccess) */ preventSilentAccess(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CredentialsContainer/store) */ store(credential: Credential): Promise; } @@ -3896,12 +5798,25 @@ declare var CredentialsContainer: { new(): CredentialsContainer; }; -/** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */ +/** + * Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto) + */ interface Crypto { - /** Available only in secure contexts. */ + /** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/subtle) + */ readonly subtle: SubtleCrypto; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/getRandomValues) */ getRandomValues(array: T): T; - /** Available only in secure contexts. */ + /** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Crypto/randomUUID) + */ randomUUID(): `${string}-${string}-${string}-${string}-${string}`; } @@ -3913,11 +5828,17 @@ declare var Crypto: { /** * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey) */ interface CryptoKey { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/algorithm) */ readonly algorithm: KeyAlgorithm; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/extractable) */ readonly extractable: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/type) */ readonly type: KeyType; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CryptoKey/usages) */ readonly usages: KeyUsage[]; } @@ -3926,10 +5847,15 @@ declare var CryptoKey: { new(): CryptoKey; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry) */ interface CustomElementRegistry { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry/define) */ define(name: string, constructor: CustomElementConstructor, options?: ElementDefinitionOptions): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry/get) */ get(name: string): CustomElementConstructor | undefined; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry/upgrade) */ upgrade(root: Node): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomElementRegistry/whenDefined) */ whenDefined(name: string): Promise; } @@ -3938,10 +5864,19 @@ declare var CustomElementRegistry: { new(): CustomElementRegistry; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent) */ interface CustomEvent extends Event { - /** Returns any custom data event was created with. Typically used for synthetic events. */ + /** + * Returns any custom data event was created with. Typically used for synthetic events. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/detail) + */ readonly detail: T; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/CustomEvent/initCustomEvent) + */ initCustomEvent(type: string, bubbles?: boolean, cancelable?: boolean, detail?: T): void; } @@ -3950,11 +5885,21 @@ declare var CustomEvent: { new(type: string, eventInitDict?: CustomEventInit): CustomEvent; }; -/** An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. */ +/** + * An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException) + */ interface DOMException extends Error { - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/code) + */ readonly code: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/message) */ readonly message: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMException/name) */ readonly name: string; readonly INDEX_SIZE_ERR: 1; readonly DOMSTRING_SIZE_ERR: 2; @@ -4013,12 +5958,23 @@ declare var DOMException: { readonly DATA_CLONE_ERR: 25; }; -/** An object providing methods which are not dependent on any particular document. Such an object is returned by the Document.implementation property. */ +/** + * An object providing methods which are not dependent on any particular document. Such an object is returned by the Document.implementation property. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMImplementation) + */ interface DOMImplementation { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMImplementation/createDocument) */ createDocument(namespace: string | null, qualifiedName: string | null, doctype?: DocumentType | null): XMLDocument; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMImplementation/createDocumentType) */ createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMImplementation/createHTMLDocument) */ createHTMLDocument(title?: string): Document; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMImplementation/hasFeature) + */ hasFeature(...args: any[]): true; } @@ -4027,6 +5983,7 @@ declare var DOMImplementation: { new(): DOMImplementation; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix) */ interface DOMMatrix extends DOMMatrixReadOnly { a: number; b: number; @@ -4056,7 +6013,9 @@ interface DOMMatrix extends DOMMatrixReadOnly { rotateAxisAngleSelf(x?: number, y?: number, z?: number, angle?: number): DOMMatrix; rotateFromVectorSelf(x?: number, y?: number): DOMMatrix; rotateSelf(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/scale3dSelf) */ scale3dSelf(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrix/scaleSelf) */ scaleSelf(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; setMatrixValue(transformList: string): DOMMatrix; skewXSelf(sx?: number): DOMMatrix; @@ -4078,48 +6037,92 @@ declare var SVGMatrix: typeof DOMMatrix; type WebKitCSSMatrix = DOMMatrix; declare var WebKitCSSMatrix: typeof DOMMatrix; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly) */ interface DOMMatrixReadOnly { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/a) */ readonly a: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/b) */ readonly b: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/c) */ readonly c: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/d) */ readonly d: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/e) */ readonly e: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/f) */ readonly f: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/is2D) */ readonly is2D: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/isIdentity) */ readonly isIdentity: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m11) */ readonly m11: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m12) */ readonly m12: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m13) */ readonly m13: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m14) */ readonly m14: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m21) */ readonly m21: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m22) */ readonly m22: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m23) */ readonly m23: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m24) */ readonly m24: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m31) */ readonly m31: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m32) */ readonly m32: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m33) */ readonly m33: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m34) */ readonly m34: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m41) */ readonly m41: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m42) */ readonly m42: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m43) */ readonly m43: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/m44) */ readonly m44: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/flipX) */ flipX(): DOMMatrix; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/flipY) */ flipY(): DOMMatrix; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/inverse) */ inverse(): DOMMatrix; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/multiply) */ multiply(other?: DOMMatrixInit): DOMMatrix; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/rotate) */ rotate(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/rotateAxisAngle) */ rotateAxisAngle(x?: number, y?: number, z?: number, angle?: number): DOMMatrix; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/rotateFromVector) */ rotateFromVector(x?: number, y?: number): DOMMatrix; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/scale) */ scale(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/scale3d) */ scale3d(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/scaleNonUniform) + */ scaleNonUniform(scaleX?: number, scaleY?: number): DOMMatrix; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/skewX) */ skewX(sx?: number): DOMMatrix; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/skewY) */ skewY(sy?: number): DOMMatrix; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/toFloat32Array) */ toFloat32Array(): Float32Array; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/toFloat64Array) */ toFloat64Array(): Float64Array; toJSON(): any; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/transformPoint) */ transformPoint(point?: DOMPointInit): DOMPoint; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMMatrixReadOnly/translate) */ translate(tx?: number, ty?: number, tz?: number): DOMMatrix; toString(): string; } @@ -4130,10 +6133,13 @@ declare var DOMMatrixReadOnly: { fromFloat32Array(array32: Float32Array): DOMMatrixReadOnly; fromFloat64Array(array64: Float64Array): DOMMatrixReadOnly; fromMatrix(other?: DOMMatrixInit): DOMMatrixReadOnly; - toString(): string; }; -/** Provides the ability to parse XML or HTML source code from a string into a DOM Document. */ +/** + * Provides the ability to parse XML or HTML source code from a string into a DOM Document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMParser) + */ interface DOMParser { /** * Parses string using either the HTML or XML parser, according to type, and returns the resulting Document. type can be "text/html" (which will invoke the HTML parser), or any of "text/xml", "application/xml", "application/xhtml+xml", or "image/svg+xml" (which will invoke the XML parser). @@ -4143,6 +6149,8 @@ interface DOMParser { * Note that script elements are not evaluated during parsing, and the resulting document's encoding will always be UTF-8. * * Values other than the above for type will cause a TypeError exception to be thrown. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMParser/parseFromString) */ parseFromString(string: string, type: DOMParserSupportedType): Document; } @@ -4152,42 +6160,62 @@ declare var DOMParser: { new(): DOMParser; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPoint) */ interface DOMPoint extends DOMPointReadOnly { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPoint/w) */ w: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPoint/x) */ x: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPoint/y) */ y: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPoint/z) */ z: number; } declare var DOMPoint: { prototype: DOMPoint; new(x?: number, y?: number, z?: number, w?: number): DOMPoint; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPoint/fromPoint) */ fromPoint(other?: DOMPointInit): DOMPoint; }; type SVGPoint = DOMPoint; declare var SVGPoint: typeof DOMPoint; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly) */ interface DOMPointReadOnly { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/w) */ readonly w: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/x) */ readonly x: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/y) */ readonly y: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/z) */ readonly z: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/matrixTransform) */ matrixTransform(matrix?: DOMMatrixInit): DOMPoint; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/toJSON) */ toJSON(): any; } declare var DOMPointReadOnly: { prototype: DOMPointReadOnly; new(x?: number, y?: number, z?: number, w?: number): DOMPointReadOnly; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMPointReadOnly/fromPoint) */ fromPoint(other?: DOMPointInit): DOMPointReadOnly; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad) */ interface DOMQuad { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/p1) */ readonly p1: DOMPoint; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/p2) */ readonly p2: DOMPoint; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/p3) */ readonly p3: DOMPoint; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/p4) */ readonly p4: DOMPoint; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMQuad/getBounds) */ getBounds(): DOMRect; toJSON(): any; } @@ -4199,6 +6227,7 @@ declare var DOMQuad: { fromRect(other?: DOMRectInit): DOMQuad; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRect) */ interface DOMRect extends DOMRectReadOnly { height: number; width: number; @@ -4226,14 +6255,23 @@ declare var DOMRectList: { new(): DOMRectList; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly) */ interface DOMRectReadOnly { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/bottom) */ readonly bottom: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/height) */ readonly height: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/left) */ readonly left: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/right) */ readonly right: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/top) */ readonly top: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/width) */ readonly width: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/x) */ readonly x: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/y) */ readonly y: number; toJSON(): any; } @@ -4241,16 +6279,33 @@ interface DOMRectReadOnly { declare var DOMRectReadOnly: { prototype: DOMRectReadOnly; new(x?: number, y?: number, width?: number, height?: number): DOMRectReadOnly; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMRectReadOnly/fromRect) */ fromRect(other?: DOMRectInit): DOMRectReadOnly; }; -/** A type returned by some APIs which contains a list of DOMString (strings). */ +/** + * A type returned by some APIs which contains a list of DOMString (strings). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMStringList) + */ interface DOMStringList { - /** Returns the number of strings in strings. */ + /** + * Returns the number of strings in strings. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMStringList/length) + */ readonly length: number; - /** Returns true if strings contains string, and false otherwise. */ + /** + * Returns true if strings contains string, and false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMStringList/contains) + */ contains(string: string): boolean; - /** Returns the string with index index from strings. */ + /** + * Returns the string with index index from strings. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMStringList/item) + */ item(index: number): string | null; [index: number]: string; } @@ -4260,7 +6315,11 @@ declare var DOMStringList: { new(): DOMStringList; }; -/** Used by the dataset HTML attribute to represent data for custom attributes added to elements. */ +/** + * Used by the dataset HTML attribute to represent data for custom attributes added to elements. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMStringMap) + */ interface DOMStringMap { [name: string]: string | undefined; } @@ -4270,14 +6329,24 @@ declare var DOMStringMap: { new(): DOMStringMap; }; -/** A set of space-separated tokens. Such a set is returned by Element.classList, HTMLLinkElement.relList, HTMLAnchorElement.relList, HTMLAreaElement.relList, HTMLIframeElement.sandbox, or HTMLOutputElement.htmlFor. It is indexed beginning with 0 as with JavaScript Array objects. DOMTokenList is always case-sensitive. */ +/** + * A set of space-separated tokens. Such a set is returned by Element.classList, HTMLLinkElement.relList, HTMLAnchorElement.relList, HTMLAreaElement.relList, HTMLIframeElement.sandbox, or HTMLOutputElement.htmlFor. It is indexed beginning with 0 as with JavaScript Array objects. DOMTokenList is always case-sensitive. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList) + */ interface DOMTokenList { - /** Returns the number of tokens. */ + /** + * Returns the number of tokens. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/length) + */ readonly length: number; /** * Returns the associated set as string. * * Can be set, to change the associated attribute. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/value) */ value: string; toString(): string; @@ -4287,11 +6356,21 @@ interface DOMTokenList { * Throws a "SyntaxError" DOMException if one of the arguments is the empty string. * * Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/add) */ add(...tokens: string[]): void; - /** Returns true if token is present, and false otherwise. */ + /** + * Returns true if token is present, and false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/contains) + */ contains(token: string): boolean; - /** Returns the token with index index. */ + /** + * Returns the token with index index. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/item) + */ item(index: number): string | null; /** * Removes arguments passed, if they are present. @@ -4299,6 +6378,8 @@ interface DOMTokenList { * Throws a "SyntaxError" DOMException if one of the arguments is the empty string. * * Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/remove) */ remove(...tokens: string[]): void; /** @@ -4309,12 +6390,16 @@ interface DOMTokenList { * Throws a "SyntaxError" DOMException if one of the arguments is the empty string. * * Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/replace) */ replace(token: string, newToken: string): boolean; /** * Returns true if token is in the associated attribute's supported tokens. Returns false otherwise. * * Throws a TypeError if the associated attribute has no supported tokens defined. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/supports) */ supports(token: string): boolean; /** @@ -4325,6 +6410,8 @@ interface DOMTokenList { * Throws a "SyntaxError" DOMException if token is empty. * * Throws an "InvalidCharacterError" DOMException if token contains any spaces. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DOMTokenList/toggle) */ toggle(token: string, force?: boolean): boolean; forEach(callbackfn: (value: string, key: number, parent: DOMTokenList) => void, thisArg?: any): void; @@ -4336,7 +6423,11 @@ declare var DOMTokenList: { new(): DOMTokenList; }; -/** Used to hold the data that is being dragged during a drag and drop operation. It may hold one or more data items, each of one or more data types. For more information about drag and drop, see HTML Drag and Drop API. */ +/** + * Used to hold the data that is being dragged during a drag and drop operation. It may hold one or more data items, each of one or more data types. For more information about drag and drop, see HTML Drag and Drop API. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer) + */ interface DataTransfer { /** * Returns the kind of operation that is currently selected. If the kind of operation isn't one of those that is allowed by the effectAllowed attribute, then the operation will fail. @@ -4344,6 +6435,8 @@ interface DataTransfer { * Can be set, to change the selected operation. * * The possible values are "none", "copy", "link", and "move". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/dropEffect) */ dropEffect: "none" | "copy" | "link" | "move"; /** @@ -4352,21 +6445,51 @@ interface DataTransfer { * Can be set (during the dragstart event), to change the allowed operations. * * The possible values are "none", "copy", "copyLink", "copyMove", "link", "linkMove", "move", "all", and "uninitialized", + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/effectAllowed) */ effectAllowed: "none" | "copy" | "copyLink" | "copyMove" | "link" | "linkMove" | "move" | "all" | "uninitialized"; - /** Returns a FileList of the files being dragged, if any. */ + /** + * Returns a FileList of the files being dragged, if any. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/files) + */ readonly files: FileList; - /** Returns a DataTransferItemList object, with the drag data. */ + /** + * Returns a DataTransferItemList object, with the drag data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/items) + */ readonly items: DataTransferItemList; - /** Returns a frozen array listing the formats that were set in the dragstart event. In addition, if any files are being dragged, then one of the types will be the string "Files". */ + /** + * Returns a frozen array listing the formats that were set in the dragstart event. In addition, if any files are being dragged, then one of the types will be the string "Files". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/types) + */ readonly types: ReadonlyArray; - /** Removes the data of the specified formats. Removes all data if the argument is omitted. */ + /** + * Removes the data of the specified formats. Removes all data if the argument is omitted. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/clearData) + */ clearData(format?: string): void; - /** Returns the specified data. If there is no such data, returns the empty string. */ + /** + * Returns the specified data. If there is no such data, returns the empty string. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/getData) + */ getData(format: string): string; - /** Adds the specified data. */ + /** + * Adds the specified data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/setData) + */ setData(format: string, data: string): void; - /** Uses the given element to update the drag feedback, replacing any previously specified feedback. */ + /** + * Uses the given element to update the drag feedback, replacing any previously specified feedback. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransfer/setDragImage) + */ setDragImage(image: Element, x: number, y: number): void; } @@ -4375,16 +6498,37 @@ declare var DataTransfer: { new(): DataTransfer; }; -/** One drag data item. During a drag operation, each drag event has a dataTransfer property which contains a list of drag data items. Each item in the list is a DataTransferItem object. */ +/** + * One drag data item. During a drag operation, each drag event has a dataTransfer property which contains a list of drag data items. Each item in the list is a DataTransferItem object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItem) + */ interface DataTransferItem { - /** Returns the drag data item kind, one of: "string", "file". */ + /** + * Returns the drag data item kind, one of: "string", "file". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItem/kind) + */ readonly kind: string; - /** Returns the drag data item type string. */ + /** + * Returns the drag data item type string. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItem/type) + */ readonly type: string; - /** Returns a File object, if the drag data item kind is File. */ + /** + * Returns a File object, if the drag data item kind is File. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItem/getAsFile) + */ getAsFile(): File | null; - /** Invokes the callback with the string data as the argument, if the drag data item kind is text. */ + /** + * Invokes the callback with the string data as the argument, if the drag data item kind is text. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItem/getAsString) + */ getAsString(callback: FunctionStringCallback | null): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItem/webkitGetAsEntry) */ webkitGetAsEntry(): FileSystemEntry | null; } @@ -4393,16 +6537,36 @@ declare var DataTransferItem: { new(): DataTransferItem; }; -/** A list of DataTransferItem objects representing items being dragged. During a drag operation, each DragEvent has a dataTransfer property and that property is a DataTransferItemList. */ +/** + * A list of DataTransferItem objects representing items being dragged. During a drag operation, each DragEvent has a dataTransfer property and that property is a DataTransferItemList. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItemList) + */ interface DataTransferItemList { - /** Returns the number of items in the drag data store. */ + /** + * Returns the number of items in the drag data store. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItemList/length) + */ readonly length: number; - /** Adds a new entry for the given data to the drag data store. If the data is plain text then a type string has to be provided also. */ + /** + * Adds a new entry for the given data to the drag data store. If the data is plain text then a type string has to be provided also. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItemList/add) + */ add(data: string, type: string): DataTransferItem | null; add(data: File): DataTransferItem | null; - /** Removes all the entries in the drag data store. */ + /** + * Removes all the entries in the drag data store. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItemList/clear) + */ clear(): void; - /** Removes the indexth entry in the drag data store. */ + /** + * Removes the indexth entry in the drag data store. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DataTransferItemList/remove) + */ remove(index: number): void; [index: number]: DataTransferItem; } @@ -4412,8 +6576,22 @@ declare var DataTransferItemList: { new(): DataTransferItemList; }; -/** A delay-line; an AudioNode audio-processing module that causes a delay between the arrival of an input data and its propagation to the output. */ +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DecompressionStream) */ +interface DecompressionStream extends GenericTransformStream { +} + +declare var DecompressionStream: { + prototype: DecompressionStream; + new(format: CompressionFormat): DecompressionStream; +}; + +/** + * A delay-line; an AudioNode audio-processing module that causes a delay between the arrival of an input data and its propagation to the output. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DelayNode) + */ interface DelayNode extends AudioNode { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DelayNode/delayTime) */ readonly delayTime: AudioParam; } @@ -4425,11 +6603,17 @@ declare var DelayNode: { /** * The DeviceMotionEvent provides web developers with information about the speed of changes for the device's position and orientation. * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent) */ interface DeviceMotionEvent extends Event { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/acceleration) */ readonly acceleration: DeviceMotionEventAcceleration | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/accelerationIncludingGravity) */ readonly accelerationIncludingGravity: DeviceMotionEventAcceleration | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/interval) */ readonly interval: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEvent/rotationRate) */ readonly rotationRate: DeviceMotionEventRotationRate | null; } @@ -4438,28 +6622,48 @@ declare var DeviceMotionEvent: { new(type: string, eventInitDict?: DeviceMotionEventInit): DeviceMotionEvent; }; -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration) + */ interface DeviceMotionEventAcceleration { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration/x) */ readonly x: number | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration/y) */ readonly y: number | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventAcceleration/z) */ readonly z: number | null; } -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventRotationRate) + */ interface DeviceMotionEventRotationRate { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventRotationRate/alpha) */ readonly alpha: number | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventRotationRate/beta) */ readonly beta: number | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceMotionEventRotationRate/gamma) */ readonly gamma: number | null; } /** * The DeviceOrientationEvent provides web developers with information from the physical orientation of the device running the web page. * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceOrientationEvent) */ interface DeviceOrientationEvent extends Event { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceOrientationEvent/absolute) */ readonly absolute: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceOrientationEvent/alpha) */ readonly alpha: number | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceOrientationEvent/beta) */ readonly beta: number | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DeviceOrientationEvent/gamma) */ readonly gamma: number | null; } @@ -4478,47 +6682,83 @@ interface DocumentEventMap extends GlobalEventHandlersEventMap { "visibilitychange": Event; } -/** Any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree. */ +/** + * Any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document) + */ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEventHandlers, NonElementParentNode, ParentNode, XPathEvaluatorBase { - /** Sets or gets the URL for the current document. */ + /** + * Sets or gets the URL for the current document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/URL) + */ readonly URL: string; /** * Sets or gets the color of all active links in the document. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/alinkColor) */ alinkColor: string; /** * Returns a reference to the collection of elements contained by the object. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/all) */ readonly all: HTMLAllCollection; /** * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/anchors) */ readonly anchors: HTMLCollectionOf; /** * Retrieves a collection of all applet objects in the document. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/applets) */ readonly applets: HTMLCollection; /** * Deprecated. Sets or retrieves a value that indicates the background color behind the object. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/bgColor) */ bgColor: string; - /** Specifies the beginning and end of the document body. */ + /** + * Specifies the beginning and end of the document body. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/body) + */ body: HTMLElement; - /** Returns document's encoding. */ + /** + * Returns document's encoding. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/characterSet) + */ readonly characterSet: string; /** * Gets or sets the character set used to encode the object. * @deprecated This is a legacy alias of `characterSet`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/characterSet) */ readonly charset: string; - /** Gets a value that indicates whether standards-compliant mode is switched on for the object. */ + /** + * Gets a value that indicates whether standards-compliant mode is switched on for the object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/compatMode) + */ readonly compatMode: string; - /** Returns document's content type. */ + /** + * Returns document's content type. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/contentType) + */ readonly contentType: string; /** * Returns the HTTP cookies that apply to the Document. If there are no cookies or cookies can't be applied to this resource, the empty string will be returned. @@ -4526,132 +6766,275 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * Can be set, to add a new cookie to the element's set of HTTP cookies. * * If the contents are sandboxed into a unique origin (e.g. in an iframe with the sandbox attribute), a "SecurityError" DOMException will be thrown on getting and setting. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/cookie) */ cookie: string; /** * Returns the script element, or the SVG script element, that is currently executing, as long as the element represents a classic script. In the case of reentrant script execution, returns the one that most recently started executing amongst those that have not yet finished executing. * * Returns null if the Document is not currently executing a script or SVG script element (e.g., because the running script is an event handler, or a timeout), or if the currently executing script or SVG script element represents a module script. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/currentScript) */ readonly currentScript: HTMLOrSVGScriptElement | null; - /** Returns the Window object of the active document. */ + /** + * Returns the Window object of the active document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/defaultView) + */ readonly defaultView: (WindowProxy & typeof globalThis) | null; - /** Sets or gets a value that indicates whether the document can be edited. */ + /** + * Sets or gets a value that indicates whether the document can be edited. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/designMode) + */ designMode: string; - /** Sets or retrieves a value that indicates the reading order of the object. */ + /** + * Sets or retrieves a value that indicates the reading order of the object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/dir) + */ dir: string; - /** Gets an object representing the document type declaration associated with the current document. */ + /** + * Gets an object representing the document type declaration associated with the current document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/doctype) + */ readonly doctype: DocumentType | null; - /** Gets a reference to the root node of the document. */ + /** + * Gets a reference to the root node of the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/documentElement) + */ readonly documentElement: HTMLElement; - /** Returns document's URL. */ + /** + * Returns document's URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/documentURI) + */ readonly documentURI: string; /** * Sets or gets the security domain of the document. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/domain) */ domain: string; - /** Retrieves a collection of all embed objects in the document. */ + /** + * Retrieves a collection of all embed objects in the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/embeds) + */ readonly embeds: HTMLCollectionOf; /** * Sets or gets the foreground (text) color of the document. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/fgColor) */ fgColor: string; - /** Retrieves a collection, in source order, of all form objects in the document. */ + /** + * Retrieves a collection, in source order, of all form objects in the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/forms) + */ readonly forms: HTMLCollectionOf; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/fullscreen) + */ readonly fullscreen: boolean; - /** Returns true if document has the ability to display elements fullscreen and fullscreen is supported, or false otherwise. */ + /** + * Returns true if document has the ability to display elements fullscreen and fullscreen is supported, or false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/fullscreenEnabled) + */ readonly fullscreenEnabled: boolean; - /** Returns the head element. */ + /** + * Returns the head element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/head) + */ readonly head: HTMLHeadElement; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/hidden) */ readonly hidden: boolean; - /** Retrieves a collection, in source order, of img objects in the document. */ + /** + * Retrieves a collection, in source order, of img objects in the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/images) + */ readonly images: HTMLCollectionOf; - /** Gets the implementation object of the current document. */ + /** + * Gets the implementation object of the current document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/implementation) + */ readonly implementation: DOMImplementation; /** * Returns the character encoding used to create the webpage that is loaded into the document object. * @deprecated This is a legacy alias of `characterSet`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/characterSet) */ readonly inputEncoding: string; - /** Gets the date that the page was last modified, if the page supplies one. */ + /** + * Gets the date that the page was last modified, if the page supplies one. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/lastModified) + */ readonly lastModified: string; /** * Sets or gets the color of the document links. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/linkColor) */ linkColor: string; - /** Retrieves a collection of all a objects that specify the href property and all area objects in the document. */ + /** + * Retrieves a collection of all a objects that specify the href property and all area objects in the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/links) + */ readonly links: HTMLCollectionOf; - /** Contains information about the current URL. */ + /** + * Contains information about the current URL. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/location) + */ get location(): Location; set location(href: string | Location); + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/fullscreenchange_event) */ onfullscreenchange: ((this: Document, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/fullscreenerror_event) */ onfullscreenerror: ((this: Document, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/pointerlockchange_event) */ onpointerlockchange: ((this: Document, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/pointerlockerror_event) */ onpointerlockerror: ((this: Document, ev: Event) => any) | null; /** * Fires when the state of the object has changed. * @param ev The event + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/readystatechange_event) */ onreadystatechange: ((this: Document, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/visibilitychange_event) */ onvisibilitychange: ((this: Document, ev: Event) => any) | null; readonly ownerDocument: null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/pictureInPictureEnabled) */ readonly pictureInPictureEnabled: boolean; - /** Return an HTMLCollection of the embed elements in the Document. */ + /** + * Return an HTMLCollection of the embed elements in the Document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/plugins) + */ readonly plugins: HTMLCollectionOf; - /** Retrieves a value that indicates the current state of the object. */ + /** + * Retrieves a value that indicates the current state of the object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/readyState) + */ readonly readyState: DocumentReadyState; - /** Gets the URL of the location that referred the user to the current page. */ + /** + * Gets the URL of the location that referred the user to the current page. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/referrer) + */ readonly referrer: string; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/rootElement) + */ readonly rootElement: SVGSVGElement | null; - /** Retrieves a collection of all script objects in the document. */ + /** + * Retrieves a collection of all script objects in the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/scripts) + */ readonly scripts: HTMLCollectionOf; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/scrollingElement) */ readonly scrollingElement: Element | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/timeline) */ readonly timeline: DocumentTimeline; - /** Contains the title of the document. */ + /** + * Contains the title of the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/title) + */ title: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/visibilityState) */ readonly visibilityState: DocumentVisibilityState; /** * Sets or gets the color of the links that the user has visited. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/vlinkColor) */ vlinkColor: string; /** * Moves node from another document and returns it. * * If node is a document, throws a "NotSupportedError" DOMException or, if node is a shadow root, throws a "HierarchyRequestError" DOMException. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/adoptNode) */ adoptNode(node: T): T; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/captureEvents) + */ captureEvents(): void; /** @deprecated */ caretRangeFromPoint(x: number, y: number): Range | null; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/clear) + */ clear(): void; - /** Closes an output stream and forces the sent data to display. */ + /** + * Closes an output stream and forces the sent data to display. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/close) + */ close(): void; /** * Creates an attribute object with a specified name. * @param name String that sets the attribute object's name. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createAttribute) */ createAttribute(localName: string): Attr; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createAttributeNS) */ createAttributeNS(namespace: string | null, qualifiedName: string): Attr; - /** Returns a CDATASection node whose data is data. */ + /** + * Returns a CDATASection node whose data is data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createCDATASection) + */ createCDATASection(data: string): CDATASection; /** * Creates a comment object with the specified data. * @param data Sets the comment object's data. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createComment) */ createComment(data: string): Comment; - /** Creates a new document. */ + /** + * Creates a new document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createDocumentFragment) + */ createDocumentFragment(): DocumentFragment; /** * Creates an instance of the element for the specified tag. * @param tagName The name of an element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createElement) */ createElement(tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K]; /** @deprecated */ @@ -4671,6 +7054,8 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * namespace is the XMLNS namespace and neither qualifiedName nor namespace prefix is "xmlns". * * When supplied, options's is can be used to create a customized built-in element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createElementNS) */ createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement; createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: K): SVGElementTagNameMap[K]; @@ -4679,6 +7064,7 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve createElementNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", qualifiedName: string): MathMLElement; createElementNS(namespaceURI: string | null, qualifiedName: string, options?: ElementCreationOptions): Element; createElementNS(namespace: string | null, qualifiedName: string, options?: string | ElementCreationOptions): Element; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createEvent) */ createEvent(eventInterface: "AnimationEvent"): AnimationEvent; createEvent(eventInterface: "AnimationPlaybackEvent"): AnimationPlaybackEvent; createEvent(eventInterface: "AudioProcessingEvent"): AudioProcessingEvent; @@ -4746,15 +7132,27 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * @param root The root element or node to start traversing on. * @param whatToShow The type of nodes or elements to appear in the node list * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createNodeIterator) */ createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter | null): NodeIterator; - /** Returns a ProcessingInstruction node whose target is target and data is data. If target does not match the Name production an "InvalidCharacterError" DOMException will be thrown. If data contains "?>" an "InvalidCharacterError" DOMException will be thrown. */ + /** + * Returns a ProcessingInstruction node whose target is target and data is data. If target does not match the Name production an "InvalidCharacterError" DOMException will be thrown. If data contains "?>" an "InvalidCharacterError" DOMException will be thrown. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createProcessingInstruction) + */ createProcessingInstruction(target: string, data: string): ProcessingInstruction; - /** Returns an empty range object that has both of its boundary points positioned at the beginning of the document. */ + /** + * Returns an empty range object that has both of its boundary points positioned at the beginning of the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createRange) + */ createRange(): Range; /** * Creates a text string from the specified value. * @param data String that specifies the nodeValue property of the text node. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createTextNode) */ createTextNode(data: string): Text; /** @@ -4762,6 +7160,8 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * @param root The root element or node to start traversing on. * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. * @param filter A custom NodeFilter function to use. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/createTreeWalker) */ createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter | null): TreeWalker; /** @@ -4770,27 +7170,43 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * @param showUI Display the user interface, defaults to false. * @param value Value to assign. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/execCommand) */ execCommand(commandId: string, showUI?: boolean, value?: string): boolean; - /** Stops document's fullscreen element from being displayed fullscreen and resolves promise when done. */ + /** + * Stops document's fullscreen element from being displayed fullscreen and resolves promise when done. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/exitFullscreen) + */ exitFullscreen(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/exitPictureInPicture) */ exitPictureInPicture(): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/exitPointerLock) */ exitPointerLock(): void; /** * Returns a reference to the first object with the specified value of the ID attribute. * @param elementId String that specifies the ID value. */ getElementById(elementId: string): HTMLElement | null; - /** Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes. */ + /** + * Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/getElementsByClassName) + */ getElementsByClassName(classNames: string): HTMLCollectionOf; /** * Gets a collection of objects based on the value of the NAME or ID attribute. * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/getElementsByName) */ getElementsByName(elementName: string): NodeListOf; /** * Retrieves a collection of objects based on the specified element name. * @param name Specifies the name of an element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/getElementsByTagName) */ getElementsByTagName(qualifiedName: K): HTMLCollectionOf; getElementsByTagName(qualifiedName: K): HTMLCollectionOf; @@ -4806,20 +7222,33 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * If only localName is "*" returns a HTMLCollection of all descendant elements whose namespace is namespace. * * Otherwise, returns a HTMLCollection of all descendant elements whose namespace is namespace and local name is localName. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/getElementsByTagNameNS) */ getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf; - /** Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. */ + /** + * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/getSelection) + */ getSelection(): Selection | null; - /** Gets a value indicating whether the object currently has focus. */ + /** + * Gets a value indicating whether the object currently has focus. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/hasFocus) + */ hasFocus(): boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/hasStorageAccess) */ hasStorageAccess(): Promise; /** * Returns a copy of node. If deep is true, the copy also includes the node's descendants. * * If node is a document or a shadow root, throws a "NotSupportedError" DOMException. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/importNode) */ importNode(node: T, deep?: boolean): T; /** @@ -4828,6 +7257,8 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. * @param replace Specifies whether the existing entry for the document is replaced in the history list. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/open) */ open(unused1?: string, unused2?: string): Document; open(url: string | URL, name: string, features: string): WindowProxy | null; @@ -4835,43 +7266,62 @@ interface Document extends Node, DocumentOrShadowRoot, FontFaceSource, GlobalEve * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. * @param commandId Specifies a command identifier. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/queryCommandEnabled) */ queryCommandEnabled(commandId: string): boolean; /** * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. * @param commandId String that specifies a command identifier. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/queryCommandIndeterm) */ queryCommandIndeterm(commandId: string): boolean; /** * Returns a Boolean value that indicates the current state of the command. * @param commandId String that specifies a command identifier. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/queryCommandState) */ queryCommandState(commandId: string): boolean; /** * Returns a Boolean value that indicates whether the current command is supported on the current range. * @param commandId Specifies a command identifier. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/queryCommandSupported) */ queryCommandSupported(commandId: string): boolean; /** * Returns the current value of the document, range, or current selection for the given command. * @param commandId String that specifies a command identifier. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/queryCommandValue) */ queryCommandValue(commandId: string): string; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/releaseEvents) + */ releaseEvents(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/requestStorageAccess) */ requestStorageAccess(): Promise; /** * Writes one or more HTML expressions to a document in the specified window. * @param content Specifies the text and HTML tags to write. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/write) */ write(...text: string[]): void; /** * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. * @param content The text and HTML tags to write. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/writeln) */ writeln(...text: string[]): void; addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; @@ -4885,7 +7335,11 @@ declare var Document: { new(): Document; }; -/** A minimal document object that has no parent. It is used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document. The key difference is that because the document fragment isn't part of the active document tree structure, changes made to the fragment don't affect the document, cause reflow, or incur any performance impact that can occur when changes are made. */ +/** + * A minimal document object that has no parent. It is used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document. The key difference is that because the document fragment isn't part of the active document tree structure, changes made to the fragment don't affect the document, cause reflow, or incur any performance impact that can occur when changes are made. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DocumentFragment) + */ interface DocumentFragment extends Node, NonElementParentNode, ParentNode { readonly ownerDocument: Document; getElementById(elementId: string): HTMLElement | null; @@ -4903,14 +7357,27 @@ interface DocumentOrShadowRoot { * For the purposes of this API, when a child browsing context is focused, its container is focused in the parent browsing context. For example, if the user moves the focus to a text control in an iframe, the iframe is the element returned by the activeElement API in the iframe's node document. * * Similarly, when the focused element is in a different node tree than documentOrShadowRoot, the element returned will be the host that's located in the same node tree as documentOrShadowRoot if documentOrShadowRoot is a shadow-including inclusive ancestor of the focused element, and null if not. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/activeElement) */ readonly activeElement: Element | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/adoptedStyleSheets) */ adoptedStyleSheets: CSSStyleSheet[]; - /** Returns document's fullscreen element. */ + /** + * Returns document's fullscreen element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/fullscreenElement) + */ readonly fullscreenElement: Element | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/pictureInPictureElement) */ readonly pictureInPictureElement: Element | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/pointerLockElement) */ readonly pointerLockElement: Element | null; - /** Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. */ + /** + * Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/styleSheets) + */ readonly styleSheets: StyleSheetList; /** * Returns the element for the specified x coordinate and the specified y coordinate. @@ -4919,9 +7386,11 @@ interface DocumentOrShadowRoot { */ elementFromPoint(x: number, y: number): Element | null; elementsFromPoint(x: number, y: number): Element[]; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/getAnimations) */ getAnimations(): Animation[]; } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DocumentTimeline) */ interface DocumentTimeline extends AnimationTimeline { } @@ -4930,11 +7399,18 @@ declare var DocumentTimeline: { new(options?: DocumentTimelineOptions): DocumentTimeline; }; -/** A Node containing a doctype. */ +/** + * A Node containing a doctype. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DocumentType) + */ interface DocumentType extends Node, ChildNode { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DocumentType/name) */ readonly name: string; readonly ownerDocument: Document; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DocumentType/publicId) */ readonly publicId: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DocumentType/systemId) */ readonly systemId: string; } @@ -4943,9 +7419,17 @@ declare var DocumentType: { new(): DocumentType; }; -/** A DOM event that represents a drag and drop interaction. The user initiates a drag by placing a pointer device (such as a mouse) on the touch surface and then dragging the pointer to a new location (such as another DOM element). Applications are free to interpret a drag and drop interaction in an application-specific way. */ +/** + * A DOM event that represents a drag and drop interaction. The user initiates a drag by placing a pointer device (such as a mouse) on the touch surface and then dragging the pointer to a new location (such as another DOM element). Applications are free to interpret a drag and drop interaction in an application-specific way. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DragEvent) + */ interface DragEvent extends MouseEvent { - /** Returns the DataTransfer object for the event. */ + /** + * Returns the DataTransfer object for the event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DragEvent/dataTransfer) + */ readonly dataTransfer: DataTransfer | null; } @@ -4954,13 +7438,23 @@ declare var DragEvent: { new(type: string, eventInitDict?: DragEventInit): DragEvent; }; -/** Inherits properties from its parent, AudioNode. */ +/** + * Inherits properties from its parent, AudioNode. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/DynamicsCompressorNode) + */ interface DynamicsCompressorNode extends AudioNode { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DynamicsCompressorNode/attack) */ readonly attack: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DynamicsCompressorNode/knee) */ readonly knee: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DynamicsCompressorNode/ratio) */ readonly ratio: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DynamicsCompressorNode/reduction) */ readonly reduction: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DynamicsCompressorNode/release) */ readonly release: AudioParam; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/DynamicsCompressorNode/threshold) */ readonly threshold: AudioParam; } @@ -4969,14 +7463,17 @@ declare var DynamicsCompressorNode: { new(context: BaseAudioContext, options?: DynamicsCompressorOptions): DynamicsCompressorNode; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_blend_minmax) */ interface EXT_blend_minmax { readonly MIN_EXT: 0x8007; readonly MAX_EXT: 0x8008; } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_color_buffer_float) */ interface EXT_color_buffer_float { } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_color_buffer_half_float) */ interface EXT_color_buffer_half_float { readonly RGBA16F_EXT: 0x881A; readonly RGB16F_EXT: 0x881B; @@ -4984,13 +7481,19 @@ interface EXT_color_buffer_half_float { readonly UNSIGNED_NORMALIZED_EXT: 0x8C17; } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_float_blend) */ interface EXT_float_blend { } -/** The EXT_frag_depth extension is part of the WebGL API and enables to set a depth value of a fragment from within the fragment shader. */ +/** + * The EXT_frag_depth extension is part of the WebGL API and enables to set a depth value of a fragment from within the fragment shader. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_frag_depth) + */ interface EXT_frag_depth { } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_sRGB) */ interface EXT_sRGB { readonly SRGB_EXT: 0x8C40; readonly SRGB_ALPHA_EXT: 0x8C42; @@ -4998,9 +7501,11 @@ interface EXT_sRGB { readonly FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: 0x8210; } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_shader_texture_lod) */ interface EXT_shader_texture_lod { } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_texture_compression_bptc) */ interface EXT_texture_compression_bptc { readonly COMPRESSED_RGBA_BPTC_UNORM_EXT: 0x8E8C; readonly COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: 0x8E8D; @@ -5008,6 +7513,7 @@ interface EXT_texture_compression_bptc { readonly COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: 0x8E8F; } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_texture_compression_rgtc) */ interface EXT_texture_compression_rgtc { readonly COMPRESSED_RED_RGTC1_EXT: 0x8DBB; readonly COMPRESSED_SIGNED_RED_RGTC1_EXT: 0x8DBC; @@ -5015,12 +7521,17 @@ interface EXT_texture_compression_rgtc { readonly COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 0x8DBE; } -/** The EXT_texture_filter_anisotropic extension is part of the WebGL API and exposes two constants for anisotropic filtering (AF). */ +/** + * The EXT_texture_filter_anisotropic extension is part of the WebGL API and exposes two constants for anisotropic filtering (AF). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_texture_filter_anisotropic) + */ interface EXT_texture_filter_anisotropic { readonly TEXTURE_MAX_ANISOTROPY_EXT: 0x84FE; readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: 0x84FF; } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EXT_texture_norm16) */ interface EXT_texture_norm16 { readonly R16_EXT: 0x822A; readonly RG16_EXT: 0x822C; @@ -5037,116 +7548,255 @@ interface ElementEventMap { "fullscreenerror": Event; } -/** Element is the most general base class from which all objects in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element. */ +/** + * Element is the most general base class from which all objects in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element) + */ interface Element extends Node, ARIAMixin, Animatable, ChildNode, InnerHTML, NonDocumentTypeChildNode, ParentNode, Slottable { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/attributes) */ readonly attributes: NamedNodeMap; - /** Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object. */ + /** + * Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/classList) + */ readonly classList: DOMTokenList; - /** Returns the value of element's class content attribute. Can be set to change it. */ + /** + * Returns the value of element's class content attribute. Can be set to change it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/className) + */ className: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientHeight) */ readonly clientHeight: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientLeft) */ readonly clientLeft: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientTop) */ readonly clientTop: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/clientWidth) */ readonly clientWidth: number; - /** Returns the value of element's id content attribute. Can be set to change it. */ + /** + * Returns the value of element's id content attribute. Can be set to change it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/id) + */ id: string; - /** Returns the local name. */ + /** + * Returns the local name. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/localName) + */ readonly localName: string; - /** Returns the namespace. */ + /** + * Returns the namespace. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/namespaceURI) + */ readonly namespaceURI: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/fullscreenchange_event) */ onfullscreenchange: ((this: Element, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/fullscreenerror_event) */ onfullscreenerror: ((this: Element, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/outerHTML) */ outerHTML: string; readonly ownerDocument: Document; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/part) */ readonly part: DOMTokenList; - /** Returns the namespace prefix. */ + /** + * Returns the namespace prefix. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/prefix) + */ readonly prefix: string | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollHeight) */ readonly scrollHeight: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollLeft) */ scrollLeft: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollTop) */ scrollTop: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollWidth) */ readonly scrollWidth: number; - /** Returns element's shadow root, if any, and if shadow root's mode is "open", and null otherwise. */ + /** + * Returns element's shadow root, if any, and if shadow root's mode is "open", and null otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/shadowRoot) + */ readonly shadowRoot: ShadowRoot | null; - /** Returns the value of element's slot content attribute. Can be set to change it. */ + /** + * Returns the value of element's slot content attribute. Can be set to change it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/slot) + */ slot: string; - /** Returns the HTML-uppercased qualified name. */ + /** + * Returns the HTML-uppercased qualified name. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/tagName) + */ readonly tagName: string; - /** Creates a shadow root for element and returns it. */ + /** + * Creates a shadow root for element and returns it. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/attachShadow) + */ attachShadow(init: ShadowRootInit): ShadowRoot; checkVisibility(options?: CheckVisibilityOptions): boolean; - /** Returns the first (starting at element) inclusive ancestor that matches selectors, and null otherwise. */ + /** + * Returns the first (starting at element) inclusive ancestor that matches selectors, and null otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/closest) + */ closest(selector: K): HTMLElementTagNameMap[K] | null; closest(selector: K): SVGElementTagNameMap[K] | null; closest(selector: K): MathMLElementTagNameMap[K] | null; closest(selectors: string): E | null; - /** Returns element's first attribute whose qualified name is qualifiedName, and null if there is no such attribute otherwise. */ + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/computedStyleMap) */ + computedStyleMap(): StylePropertyMapReadOnly; + /** + * Returns element's first attribute whose qualified name is qualifiedName, and null if there is no such attribute otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttribute) + */ getAttribute(qualifiedName: string): string | null; - /** Returns element's attribute whose namespace is namespace and local name is localName, and null if there is no such attribute otherwise. */ + /** + * Returns element's attribute whose namespace is namespace and local name is localName, and null if there is no such attribute otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNS) + */ getAttributeNS(namespace: string | null, localName: string): string | null; - /** Returns the qualified names of all element's attributes. Can contain duplicates. */ + /** + * Returns the qualified names of all element's attributes. Can contain duplicates. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNames) + */ getAttributeNames(): string[]; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNode) */ getAttributeNode(qualifiedName: string): Attr | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getAttributeNodeNS) */ getAttributeNodeNS(namespace: string | null, localName: string): Attr | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getBoundingClientRect) */ getBoundingClientRect(): DOMRect; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getClientRects) */ getClientRects(): DOMRectList; - /** Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes. */ + /** + * Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getElementsByClassName) + */ getElementsByClassName(classNames: string): HTMLCollectionOf; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getElementsByTagName) */ getElementsByTagName(qualifiedName: K): HTMLCollectionOf; getElementsByTagName(qualifiedName: K): HTMLCollectionOf; getElementsByTagName(qualifiedName: K): HTMLCollectionOf; /** @deprecated */ getElementsByTagName(qualifiedName: K): HTMLCollectionOf; getElementsByTagName(qualifiedName: string): HTMLCollectionOf; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/getElementsByTagNameNS) */ getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1998/Math/MathML", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf; - /** Returns true if element has an attribute whose qualified name is qualifiedName, and false otherwise. */ + /** + * Returns true if element has an attribute whose qualified name is qualifiedName, and false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasAttribute) + */ hasAttribute(qualifiedName: string): boolean; - /** Returns true if element has an attribute whose namespace is namespace and local name is localName. */ + /** + * Returns true if element has an attribute whose namespace is namespace and local name is localName. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasAttributeNS) + */ hasAttributeNS(namespace: string | null, localName: string): boolean; - /** Returns true if element has attributes, and false otherwise. */ + /** + * Returns true if element has attributes, and false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasAttributes) + */ hasAttributes(): boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/hasPointerCapture) */ hasPointerCapture(pointerId: number): boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/insertAdjacentElement) */ insertAdjacentElement(where: InsertPosition, element: Element): Element | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/insertAdjacentHTML) */ insertAdjacentHTML(position: InsertPosition, text: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/insertAdjacentText) */ insertAdjacentText(where: InsertPosition, data: string): void; - /** Returns true if matching selectors against element's root yields element, and false otherwise. */ + /** + * Returns true if matching selectors against element's root yields element, and false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/matches) + */ matches(selectors: string): boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/releasePointerCapture) */ releasePointerCapture(pointerId: number): void; - /** Removes element's first attribute whose qualified name is qualifiedName. */ + /** + * Removes element's first attribute whose qualified name is qualifiedName. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/removeAttribute) + */ removeAttribute(qualifiedName: string): void; - /** Removes element's attribute whose namespace is namespace and local name is localName. */ + /** + * Removes element's attribute whose namespace is namespace and local name is localName. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/removeAttributeNS) + */ removeAttributeNS(namespace: string | null, localName: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/removeAttributeNode) */ removeAttributeNode(attr: Attr): Attr; /** * Displays element fullscreen and resolves promise when done. * * When supplied, options's navigationUI member indicates whether showing navigation UI while in fullscreen is preferred or not. If set to "show", navigation simplicity is preferred over screen space, and if set to "hide", more screen space is preferred. User agents are always free to honor user preference over the application's. The default value "auto" indicates no application preference. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/requestFullscreen) */ requestFullscreen(options?: FullscreenOptions): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/requestPointerLock) */ requestPointerLock(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scroll) */ scroll(options?: ScrollToOptions): void; scroll(x: number, y: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollBy) */ scrollBy(options?: ScrollToOptions): void; scrollBy(x: number, y: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollIntoView) */ scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/scrollTo) */ scrollTo(options?: ScrollToOptions): void; scrollTo(x: number, y: number): void; - /** Sets the value of element's first attribute whose qualified name is qualifiedName to value. */ + /** + * Sets the value of element's first attribute whose qualified name is qualifiedName to value. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttribute) + */ setAttribute(qualifiedName: string, value: string): void; - /** Sets the value of element's attribute whose namespace is namespace and local name is localName to value. */ + /** + * Sets the value of element's attribute whose namespace is namespace and local name is localName to value. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttributeNS) + */ setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttributeNode) */ setAttributeNode(attr: Attr): Attr | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setAttributeNodeNS) */ setAttributeNodeNS(attr: Attr): Attr | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/setPointerCapture) */ setPointerCapture(pointerId: number): void; /** * If force is not given, "toggles" qualifiedName, removing it if it is present and adding it if it is not present. If force is true, adds qualifiedName. If force is false, removes qualifiedName. * * Returns true if qualifiedName is now present, and false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/toggleAttribute) */ toggleAttribute(qualifiedName: string, force?: boolean): boolean; - /** @deprecated This is a legacy alias of `matches`. */ + /** + * @deprecated This is a legacy alias of `matches`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/matches) + */ webkitMatchesSelector(selectors: string): boolean; addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -5160,40 +7810,85 @@ declare var Element: { }; interface ElementCSSInlineStyle { + readonly attributeStyleMap: StylePropertyMap; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/style) */ readonly style: CSSStyleDeclaration; } interface ElementContentEditable { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/contentEditable) */ contentEditable: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/enterKeyHint) */ enterKeyHint: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/inputMode) */ inputMode: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/isContentEditable) */ readonly isContentEditable: boolean; } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals) */ interface ElementInternals extends ARIAMixin { - /** Returns the form owner of internals's target element. */ + /** + * Returns the form owner of internals's target element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/form) + */ readonly form: HTMLFormElement | null; - /** Returns a NodeList of all the label elements that internals's target element is associated with. */ + /** + * Returns a NodeList of all the label elements that internals's target element is associated with. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/labels) + */ readonly labels: NodeList; - /** Returns the ShadowRoot for internals's target element, if the target element is a shadow host, or null otherwise. */ + /** + * Returns the ShadowRoot for internals's target element, if the target element is a shadow host, or null otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/shadowRoot) + */ readonly shadowRoot: ShadowRoot | null; - /** Returns the error message that would be shown to the user if internals's target element was to be checked for validity. */ + /** + * Returns the error message that would be shown to the user if internals's target element was to be checked for validity. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/validationMessage) + */ readonly validationMessage: string; - /** Returns the ValidityState object for internals's target element. */ + /** + * Returns the ValidityState object for internals's target element. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/validity) + */ readonly validity: ValidityState; - /** Returns true if internals's target element will be validated when the form is submitted; false otherwise. */ + /** + * Returns true if internals's target element will be validated when the form is submitted; false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/willValidate) + */ readonly willValidate: boolean; - /** Returns true if internals's target element has no validity problems; false otherwise. Fires an invalid event at the element in the latter case. */ + /** + * Returns true if internals's target element has no validity problems; false otherwise. Fires an invalid event at the element in the latter case. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/checkValidity) + */ checkValidity(): boolean; - /** Returns true if internals's target element has no validity problems; otherwise, returns false, fires an invalid event at the element, and (if the event isn't canceled) reports the problem to the user. */ + /** + * Returns true if internals's target element has no validity problems; otherwise, returns false, fires an invalid event at the element, and (if the event isn't canceled) reports the problem to the user. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/reportValidity) + */ reportValidity(): boolean; /** * Sets both the state and submission value of internals's target element to value. * * If value is null, the element won't participate in form submission. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/setFormValue) */ setFormValue(value: File | string | FormData | null, state?: File | string | FormData | null): void; - /** Marks internals's target element as suffering from the constraints indicated by the flags argument, and sets the element's validation message to message. If anchor is specified, the user agent might use it to indicate problems with the constraints of internals's target element when the form owner is validated interactively or reportValidity() is called. */ + /** + * Marks internals's target element as suffering from the constraints indicated by the flags argument, and sets the element's validation message to message. If anchor is specified, the user agent might use it to indicate problems with the constraints of internals's target element when the form owner is validated interactively or reportValidity() is called. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ElementInternals/setValidity) + */ setValidity(flags?: ValidityStateFlags, message?: string, anchor?: HTMLElement): void; } @@ -5202,12 +7897,40 @@ declare var ElementInternals: { new(): ElementInternals; }; -/** Events providing information related to errors in scripts or in files. */ +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedVideoChunk) */ +interface EncodedVideoChunk { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedVideoChunk/byteLength) */ + readonly byteLength: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedVideoChunk/duration) */ + readonly duration: number | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedVideoChunk/timestamp) */ + readonly timestamp: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedVideoChunk/type) */ + readonly type: EncodedVideoChunkType; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EncodedVideoChunk/copyTo) */ + copyTo(destination: BufferSource): void; +} + +declare var EncodedVideoChunk: { + prototype: EncodedVideoChunk; + new(init: EncodedVideoChunkInit): EncodedVideoChunk; +}; + +/** + * Events providing information related to errors in scripts or in files. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent) + */ interface ErrorEvent extends Event { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/colno) */ readonly colno: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/error) */ readonly error: any; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/filename) */ readonly filename: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/lineno) */ readonly lineno: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/ErrorEvent/message) */ readonly message: string; } @@ -5216,43 +7939,119 @@ declare var ErrorEvent: { new(type: string, eventInitDict?: ErrorEventInit): ErrorEvent; }; -/** An event which takes place in the DOM. */ +/** + * An event which takes place in the DOM. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event) + */ interface Event { - /** Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */ + /** + * Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/bubbles) + */ readonly bubbles: boolean; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelBubble) + */ cancelBubble: boolean; - /** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */ + /** + * Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/cancelable) + */ readonly cancelable: boolean; - /** Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. */ + /** + * Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composed) + */ readonly composed: boolean; - /** Returns the object whose event listener's callback is currently being invoked. */ + /** + * Returns the object whose event listener's callback is currently being invoked. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/currentTarget) + */ readonly currentTarget: EventTarget | null; - /** Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */ + /** + * Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/defaultPrevented) + */ readonly defaultPrevented: boolean; - /** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */ + /** + * Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/eventPhase) + */ readonly eventPhase: number; - /** Returns true if event was dispatched by the user agent, and false otherwise. */ + /** + * Returns true if event was dispatched by the user agent, and false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/isTrusted) + */ readonly isTrusted: boolean; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/returnValue) + */ returnValue: boolean; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/srcElement) + */ readonly srcElement: EventTarget | null; - /** Returns the object to which event is dispatched (its target). */ + /** + * Returns the object to which event is dispatched (its target). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/target) + */ readonly target: EventTarget | null; - /** Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */ + /** + * Returns the event's timestamp as the number of milliseconds measured relative to the time origin. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/timeStamp) + */ readonly timeStamp: DOMHighResTimeStamp; - /** Returns the type of event, e.g. "click", "hashchange", or "submit". */ + /** + * Returns the type of event, e.g. "click", "hashchange", or "submit". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/type) + */ readonly type: string; - /** Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget. */ + /** + * Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/composedPath) + */ composedPath(): EventTarget[]; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/initEvent) + */ initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void; - /** If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled. */ + /** + * If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/preventDefault) + */ preventDefault(): void; - /** Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects. */ + /** + * Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopImmediatePropagation) + */ stopImmediatePropagation(): void; - /** When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object. */ + /** + * When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Event/stopPropagation) + */ stopPropagation(): void; readonly NONE: 0; readonly CAPTURING_PHASE: 1; @@ -5269,6 +8068,7 @@ declare var Event: { readonly BUBBLING_PHASE: 3; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventCounts) */ interface EventCounts { forEach(callbackfn: (value: number, key: string, parent: EventCounts) => void, thisArg?: any): void; } @@ -5292,17 +8092,37 @@ interface EventSourceEventMap { "open": Event; } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource) */ interface EventSource extends EventTarget { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/error_event) */ onerror: ((this: EventSource, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/message_event) */ onmessage: ((this: EventSource, ev: MessageEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/open_event) */ onopen: ((this: EventSource, ev: Event) => any) | null; - /** Returns the state of this EventSource object's connection. It can have the values described below. */ + /** + * Returns the state of this EventSource object's connection. It can have the values described below. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/readyState) + */ readonly readyState: number; - /** Returns the URL providing the event stream. */ + /** + * Returns the URL providing the event stream. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/url) + */ readonly url: string; - /** Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise. */ + /** + * Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/withCredentials) + */ readonly withCredentials: boolean; - /** Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED. */ + /** + * Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventSource/close) + */ close(): void; readonly CONNECTING: 0; readonly OPEN: 1; @@ -5323,7 +8143,11 @@ declare var EventSource: { readonly CLOSED: 2; }; -/** EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them. */ +/** + * EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget) + */ interface EventTarget { /** * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched. @@ -5339,11 +8163,21 @@ interface EventTarget { * If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted. * * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener) */ addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void; - /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ + /** + * Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/dispatchEvent) + */ dispatchEvent(event: Event): boolean; - /** Removes the event listener in target's event listener list with the same type, callback, and options. */ + /** + * Removes the event listener in target's event listener list with the same type, callback, and options. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener) + */ removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void; } @@ -5352,11 +8186,23 @@ declare var EventTarget: { new(): EventTarget; }; -/** @deprecated */ +/** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/External) + */ interface External { - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/External/AddSearchProvider) + */ AddSearchProvider(): void; - /** @deprecated */ + /** + * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/External/IsSearchProviderInstalled) + */ IsSearchProviderInstalled(): void; } @@ -5366,10 +8212,17 @@ declare var External: { new(): External; }; -/** Provides information about files and allows JavaScript in a web page to access their content. */ +/** + * Provides information about files and allows JavaScript in a web page to access their content. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/File) + */ interface File extends Blob { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/lastModified) */ readonly lastModified: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/name) */ readonly name: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/File/webkitRelativePath) */ readonly webkitRelativePath: string; } @@ -5378,9 +8231,15 @@ declare var File: { new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File; }; -/** An object of this type is returned by the files property of the HTML element; this lets you access the list of files selected with the element. It's also used for a list of files dropped into web content when using the drag and drop API; see the DataTransfer object for details on this usage. */ +/** + * An object of this type is returned by the files property of the HTML element; this lets you access the list of files selected with the element. It's also used for a list of files dropped into web content when using the drag and drop API; see the DataTransfer object for details on this usage. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileList) + */ interface FileList { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileList/length) */ readonly length: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileList/item) */ item(index: number): File | null; [index: number]: File; } @@ -5399,21 +8258,39 @@ interface FileReaderEventMap { "progress": ProgressEvent; } -/** Lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read. */ +/** + * Lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader) + */ interface FileReader extends EventTarget { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/error) */ readonly error: DOMException | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/abort_event) */ onabort: ((this: FileReader, ev: ProgressEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/error_event) */ onerror: ((this: FileReader, ev: ProgressEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/load_event) */ onload: ((this: FileReader, ev: ProgressEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/loadend_event) */ onloadend: ((this: FileReader, ev: ProgressEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/loadstart_event) */ onloadstart: ((this: FileReader, ev: ProgressEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/progress_event) */ onprogress: ((this: FileReader, ev: ProgressEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/readyState) */ readonly readyState: typeof FileReader.EMPTY | typeof FileReader.LOADING | typeof FileReader.DONE; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/result) */ readonly result: string | ArrayBuffer | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/abort) */ abort(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/readAsArrayBuffer) */ readAsArrayBuffer(blob: Blob): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/readAsBinaryString) */ readAsBinaryString(blob: Blob): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/readAsDataURL) */ readAsDataURL(blob: Blob): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileReader/readAsText) */ readAsText(blob: Blob, encoding?: string): void; readonly EMPTY: 0; readonly LOADING: 1; @@ -5432,8 +8309,11 @@ declare var FileReader: { readonly DONE: 2; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystem) */ interface FileSystem { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystem/name) */ readonly name: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystem/root) */ readonly root: FileSystemDirectoryEntry; } @@ -5442,9 +8322,13 @@ declare var FileSystem: { new(): FileSystem; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryEntry) */ interface FileSystemDirectoryEntry extends FileSystemEntry { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryEntry/createReader) */ createReader(): FileSystemDirectoryReader; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryEntry/getDirectory) */ getDirectory(path?: string | null, options?: FileSystemFlags, successCallback?: FileSystemEntryCallback, errorCallback?: ErrorCallback): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryEntry/getFile) */ getFile(path?: string | null, options?: FileSystemFlags, successCallback?: FileSystemEntryCallback, errorCallback?: ErrorCallback): void; } @@ -5453,12 +8337,20 @@ declare var FileSystemDirectoryEntry: { new(): FileSystemDirectoryEntry; }; -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle) + */ interface FileSystemDirectoryHandle extends FileSystemHandle { readonly kind: "directory"; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/getDirectoryHandle) */ getDirectoryHandle(name: string, options?: FileSystemGetDirectoryOptions): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/getFileHandle) */ getFileHandle(name: string, options?: FileSystemGetFileOptions): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/removeEntry) */ removeEntry(name: string, options?: FileSystemRemoveOptions): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryHandle/resolve) */ resolve(possibleDescendant: FileSystemHandle): Promise; } @@ -5467,7 +8359,9 @@ declare var FileSystemDirectoryHandle: { new(): FileSystemDirectoryHandle; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader) */ interface FileSystemDirectoryReader { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemDirectoryReader/readEntries) */ readEntries(successCallback: FileSystemEntriesCallback, errorCallback?: ErrorCallback): void; } @@ -5476,12 +8370,19 @@ declare var FileSystemDirectoryReader: { new(): FileSystemDirectoryReader; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemEntry) */ interface FileSystemEntry { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemEntry/filesystem) */ readonly filesystem: FileSystem; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemEntry/fullPath) */ readonly fullPath: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemEntry/isDirectory) */ readonly isDirectory: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemEntry/isFile) */ readonly isFile: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemEntry/name) */ readonly name: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemEntry/getParent) */ getParent(successCallback?: FileSystemEntryCallback, errorCallback?: ErrorCallback): void; } @@ -5490,7 +8391,9 @@ declare var FileSystemEntry: { new(): FileSystemEntry; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileEntry) */ interface FileSystemFileEntry extends FileSystemEntry { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileEntry/file) */ file(successCallback: FileCallback, errorCallback?: ErrorCallback): void; } @@ -5499,9 +8402,16 @@ declare var FileSystemFileEntry: { new(): FileSystemFileEntry; }; -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileHandle) + */ interface FileSystemFileHandle extends FileSystemHandle { readonly kind: "file"; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileHandle/createWritable) */ + createWritable(options?: FileSystemCreateWritableOptions): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemFileHandle/getFile) */ getFile(): Promise; } @@ -5510,10 +8420,17 @@ declare var FileSystemFileHandle: { new(): FileSystemFileHandle; }; -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle) + */ interface FileSystemHandle { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle/kind) */ readonly kind: FileSystemHandleKind; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle/name) */ readonly name: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemHandle/isSameEntry) */ isSameEntry(other: FileSystemHandle): Promise; } @@ -5522,8 +8439,32 @@ declare var FileSystemHandle: { new(): FileSystemHandle; }; -/** Focus-related events like focus, blur, focusin, or focusout. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream) + */ +interface FileSystemWritableFileStream extends WritableStream { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream/seek) */ + seek(position: number): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream/truncate) */ + truncate(size: number): Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FileSystemWritableFileStream/write) */ + write(data: FileSystemWriteChunkType): Promise; +} + +declare var FileSystemWritableFileStream: { + prototype: FileSystemWritableFileStream; + new(): FileSystemWritableFileStream; +}; + +/** + * Focus-related events like focus, blur, focusin, or focusout. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FocusEvent) + */ interface FocusEvent extends UIEvent { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FocusEvent/relatedTarget) */ readonly relatedTarget: EventTarget | null; } @@ -5532,20 +8473,35 @@ declare var FocusEvent: { new(type: string, eventInitDict?: FocusEventInit): FocusEvent; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace) */ interface FontFace { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/ascentOverride) */ ascentOverride: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/descentOverride) */ descentOverride: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/display) */ display: FontDisplay; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/family) */ family: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/featureSettings) */ featureSettings: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/lineGapOverride) */ lineGapOverride: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/loaded) */ readonly loaded: Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/status) */ readonly status: FontFaceLoadStatus; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/stretch) */ stretch: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/style) */ style: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/unicodeRange) */ unicodeRange: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/variant) */ variant: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/weight) */ weight: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFace/load) */ load(): Promise; } @@ -5560,13 +8516,21 @@ interface FontFaceSetEventMap { "loadingerror": Event; } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet) */ interface FontFaceSet extends EventTarget { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loading_event) */ onloading: ((this: FontFaceSet, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loadingdone_event) */ onloadingdone: ((this: FontFaceSet, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/loadingerror_event) */ onloadingerror: ((this: FontFaceSet, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/ready) */ readonly ready: Promise; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/status) */ readonly status: FontFaceSetLoadStatus; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/check) */ check(font: string, text?: string): boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSet/load) */ load(font: string, text?: string): Promise; forEach(callbackfn: (value: FontFace, key: FontFace, parent: FontFaceSet) => void, thisArg?: any): void; addEventListener(type: K, listener: (this: FontFaceSet, ev: FontFaceSetEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; @@ -5580,7 +8544,9 @@ declare var FontFaceSet: { new(initialFaces: FontFace[]): FontFaceSet; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSetLoadEvent) */ interface FontFaceSetLoadEvent extends Event { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FontFaceSetLoadEvent/fontfaces) */ readonly fontfaces: ReadonlyArray; } @@ -5590,27 +8556,47 @@ declare var FontFaceSetLoadEvent: { }; interface FontFaceSource { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/fonts) */ readonly fonts: FontFaceSet; } -/** Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data". */ +/** + * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data". + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData) + */ interface FormData { - append(name: string, value: string | Blob, fileName?: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/append) */ + append(name: string, value: string | Blob): void; + append(name: string, value: string): void; + append(name: string, blobValue: Blob, filename?: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/delete) */ delete(name: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/get) */ get(name: string): FormDataEntryValue | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/getAll) */ getAll(name: string): FormDataEntryValue[]; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/has) */ has(name: string): boolean; - set(name: string, value: string | Blob, fileName?: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormData/set) */ + set(name: string, value: string | Blob): void; + set(name: string, value: string): void; + set(name: string, blobValue: Blob, filename?: string): void; forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void; } declare var FormData: { prototype: FormData; - new(form?: HTMLFormElement): FormData; + new(form?: HTMLFormElement, submitter?: HTMLElement | null): FormData; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormDataEvent) */ interface FormDataEvent extends Event { - /** Returns a FormData object representing names and values of elements associated to the target form. Operations on the FormData object will affect form data to be submitted. */ + /** + * Returns a FormData object representing names and values of elements associated to the target form. Operations on the FormData object will affect form data to be submitted. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/FormDataEvent/formData) + */ readonly formData: FormData; } @@ -5619,8 +8605,13 @@ declare var FormDataEvent: { new(type: string, eventInitDict: FormDataEventInit): FormDataEvent; }; -/** A change in volume. It is an AudioNode audio-processing module that causes a given gain to be applied to the input data before its propagation to the output. A GainNode always has exactly one input and one output, both with the same number of channels. */ +/** + * A change in volume. It is an AudioNode audio-processing module that causes a given gain to be applied to the input data before its propagation to the output. A GainNode always has exactly one input and one output, both with the same number of channels. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GainNode) + */ interface GainNode extends AudioNode { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GainNode/gain) */ readonly gain: AudioParam; } @@ -5632,16 +8623,27 @@ declare var GainNode: { /** * This Gamepad API interface defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id. * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad) */ interface Gamepad { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/axes) */ readonly axes: ReadonlyArray; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/buttons) */ readonly buttons: ReadonlyArray; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/connected) */ readonly connected: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/hapticActuators) */ readonly hapticActuators: ReadonlyArray; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/id) */ readonly id: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/index) */ readonly index: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/mapping) */ readonly mapping: GamepadMappingType; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Gamepad/timestamp) */ readonly timestamp: DOMHighResTimeStamp; + readonly vibrationActuator: GamepadHapticActuator | null; } declare var Gamepad: { @@ -5652,10 +8654,15 @@ declare var Gamepad: { /** * An individual button of a gamepad or other controller, allowing access to the current state of different types of buttons available on the control device. * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadButton) */ interface GamepadButton { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadButton/pressed) */ readonly pressed: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadButton/touched) */ readonly touched: boolean; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadButton/value) */ readonly value: number; } @@ -5667,8 +8674,11 @@ declare var GamepadButton: { /** * This Gamepad API interface contains references to gamepads connected to the system, which is what the gamepad events Window.gamepadconnected and Window.gamepaddisconnected are fired in response to. * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadEvent) */ interface GamepadEvent extends Event { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadEvent/gamepad) */ readonly gamepad: Gamepad; } @@ -5677,9 +8687,16 @@ declare var GamepadEvent: { new(type: string, eventInitDict: GamepadEventInit): GamepadEvent; }; -/** This Gamepad API interface represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware. */ +/** + * This Gamepad API interface represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadHapticActuator) + */ interface GamepadHapticActuator { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GamepadHapticActuator/type) */ readonly type: GamepadHapticActuatorType; + playEffect(type: GamepadHapticEffectType, params?: GamepadEffectParameters): Promise; + reset(): Promise; } declare var GamepadHapticActuator: { @@ -5688,14 +8705,23 @@ declare var GamepadHapticActuator: { }; interface GenericTransformStream { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream/readable) */ readonly readable: ReadableStream; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/CompressionStream/writable) */ readonly writable: WritableStream; } -/** An object able to programmatically obtain the position of the device. It gives Web content access to the location of the device. This allows a Web site or app to offer customized results based on the user's location. */ +/** + * An object able to programmatically obtain the position of the device. It gives Web content access to the location of the device. This allows a Web site or app to offer customized results based on the user's location. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Geolocation) + */ interface Geolocation { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Geolocation/clearWatch) */ clearWatch(watchId: number): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Geolocation/getCurrentPosition) */ getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback | null, options?: PositionOptions): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Geolocation/watchPosition) */ watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback | null, options?: PositionOptions): number; } @@ -5704,14 +8730,25 @@ declare var Geolocation: { new(): Geolocation; }; -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates) + */ interface GeolocationCoordinates { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/accuracy) */ readonly accuracy: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/altitude) */ readonly altitude: number | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/altitudeAccuracy) */ readonly altitudeAccuracy: number | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/heading) */ readonly heading: number | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/latitude) */ readonly latitude: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/longitude) */ readonly longitude: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationCoordinates/speed) */ readonly speed: number | null; } @@ -5720,9 +8757,15 @@ declare var GeolocationCoordinates: { new(): GeolocationCoordinates; }; -/** Available only in secure contexts. */ +/** + * Available only in secure contexts. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationPosition) + */ interface GeolocationPosition { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationPosition/coords) */ readonly coords: GeolocationCoordinates; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationPosition/timestamp) */ readonly timestamp: EpochTimeStamp; } @@ -5731,8 +8774,11 @@ declare var GeolocationPosition: { new(): GeolocationPosition; }; +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationPositionError) */ interface GeolocationPositionError { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationPositionError/code) */ readonly code: number; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/GeolocationPositionError/message) */ readonly message: string; readonly PERMISSION_DENIED: 1; readonly POSITION_UNAVAILABLE: 2; @@ -5853,281 +8899,432 @@ interface GlobalEventHandlers { /** * Fires when the user aborts the download. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/abort_event) */ onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animationcancel_event) */ onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animationend_event) */ onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animationiteration_event) */ onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animationstart_event) */ onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/auxclick_event) */ onauxclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/beforeinput_event) */ onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null; /** * Fires when the object loses the input focus. * @param ev The focus event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/blur_event) */ onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLDialogElement/cancel_event) */ oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Occurs when playback is possible, but would require further buffering. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/canplay_event) */ oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/canplaythrough_event) */ oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Fires when the contents of the object or selection have changed. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/change_event) */ onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Fires when the user clicks the left mouse button on the object * @param ev The mouse event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/click_event) */ onclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLDialogElement/close_event) */ onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Fires when the user clicks the right mouse button in the client area, opening the context menu. * @param ev The mouse event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/contextmenu_event) */ oncontextmenu: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/copy_event) */ oncopy: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLTrackElement/cuechange_event) */ oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/cut_event) */ oncut: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null; /** * Fires when the user double-clicks the object. * @param ev The mouse event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/dblclick_event) */ ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; /** * Fires on the source object continuously during a drag operation. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/drag_event) */ ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; /** * Fires on the source object when the user releases the mouse at the close of a drag operation. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/dragend_event) */ ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; /** * Fires on the target element when the user drags the object to a valid drop target. * @param ev The drag event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/dragenter_event) */ ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; /** * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. * @param ev The drag event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/dragleave_event) */ ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; /** * Fires on the target element continuously while the user drags the object over a valid drop target. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/dragover_event) */ ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; /** * Fires on the source object when the user starts to drag a text selection or selected object. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/dragstart_event) */ ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/drop_event) */ ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; /** * Occurs when the duration attribute is updated. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/durationchange_event) */ ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Occurs when the media element is reset to its initial state. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/emptied_event) */ onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Occurs when the end of playback is reached. * @param ev The event + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/ended_event) */ onended: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Fires when an error occurs during object loading. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/error_event) */ onerror: OnErrorEventHandler; /** * Fires when the object receives focus. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/focus_event) */ onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/formdata_event) */ onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/gotpointercapture_event) */ ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLElement/input_event) */ oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/invalid_event) */ oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Fires when the user presses a key. * @param ev The keyboard event + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/keydown_event) */ onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null; /** * Fires when the user presses an alphanumeric key. * @param ev The event. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/keypress_event) */ onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null; /** * Fires when the user releases a key. * @param ev The keyboard event + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/keyup_event) */ onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null; /** * Fires immediately after the browser loads the object. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/SVGElement/load_event) */ onload: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Occurs when media data is loaded at the current playback position. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/loadeddata_event) */ onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Occurs when the duration and dimensions of the media have been determined. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/loadedmetadata_event) */ onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Occurs when Internet Explorer begins looking for media data. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/loadstart_event) */ onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/lostpointercapture_event) */ onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; /** * Fires when the user clicks the object with either mouse button. * @param ev The mouse event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/mousedown_event) */ onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/mouseenter_event) */ onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/mouseleave_event) */ onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; /** * Fires when the user moves the mouse over the object. * @param ev The mouse event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/mousemove_event) */ onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; /** * Fires when the user moves the mouse pointer outside the boundaries of the object. * @param ev The mouse event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/mouseout_event) */ onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; /** * Fires when the user moves the mouse pointer into the object. * @param ev The mouse event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/mouseover_event) */ onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; /** * Fires when the user releases a mouse button while the mouse is over the object. * @param ev The mouse event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/mouseup_event) */ onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/paste_event) */ onpaste: ((this: GlobalEventHandlers, ev: ClipboardEvent) => any) | null; /** * Occurs when playback is paused. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/pause_event) */ onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Occurs when the play method is requested. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/play_event) */ onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Occurs when the audio or video has started playing. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/playing_event) */ onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointercancel_event) */ onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointerdown_event) */ onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointerenter_event) */ onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointerleave_event) */ onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointermove_event) */ onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointerout_event) */ onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointerover_event) */ onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/pointerup_event) */ onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; /** * Occurs to indicate progress while downloading media data. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/progress_event) */ onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null; /** * Occurs when the playback rate is increased or decreased. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/ratechange_event) */ onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Fires when the user resets a form. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/reset_event) */ onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLVideoElement/resize_event) */ onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null; /** * Fires when the user repositions the scroll box in the scroll bar on the object. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/scroll_event) */ onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/securitypolicyviolation_event) */ onsecuritypolicyviolation: ((this: GlobalEventHandlers, ev: SecurityPolicyViolationEvent) => any) | null; /** * Occurs when the seek operation ends. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/seeked_event) */ onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Occurs when the current playback position is moved. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/seeking_event) */ onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Fires when the current selection changes. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLInputElement/select_event) */ onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Document/selectionchange_event) */ onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Node/selectstart_event) */ onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLSlotElement/slotchange_event) */ onslotchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Occurs when the download has stopped. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/stalled_event) */ onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/submit_event) */ onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null; /** * Occurs if the load operation has been intentionally halted. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/suspend_event) */ onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Occurs to indicate the current playback position. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/timeupdate_event) */ ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLDetailsElement/toggle_event) */ ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/touchcancel_event) */ ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/touchend_event) */ ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/touchmove_event) */ ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/touchstart_event) */ ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/transitioncancel_event) */ ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/transitionend_event) */ ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/transitionrun_event) */ ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/transitionstart_event) */ ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null; /** * Occurs when the volume is changed, or playback is muted or unmuted. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/volumechange_event) */ onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Occurs when playback stops because the next frame of a video resource is not available. * @param ev The event. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLMediaElement/waiting_event) */ onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** @deprecated This is a legacy alias of `onanimationend`. */ + /** + * @deprecated This is a legacy alias of `onanimationend`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animationend_event) + */ onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** @deprecated This is a legacy alias of `onanimationiteration`. */ + /** + * @deprecated This is a legacy alias of `onanimationiteration`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animationiteration_event) + */ onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** @deprecated This is a legacy alias of `onanimationstart`. */ + /** + * @deprecated This is a legacy alias of `onanimationstart`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/animationstart_event) + */ onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null; - /** @deprecated This is a legacy alias of `ontransitionend`. */ + /** + * @deprecated This is a legacy alias of `ontransitionend`. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/transitionend_event) + */ onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/Element/wheel_event) */ onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null; addEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -6135,10 +9332,19 @@ interface GlobalEventHandlers { removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAllCollection) */ interface HTMLAllCollection { - /** Returns the number of elements in the collection. */ + /** + * Returns the number of elements in the collection. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAllCollection/length) + */ readonly length: number; - /** Returns the item with index index from the collection (determined by tree order). */ + /** + * Returns the item with index index from the collection (determined by tree order). + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAllCollection/item) + */ item(nameOrIndex?: string): HTMLCollection | Element | null; /** * Returns the item with ID or name name from the collection. @@ -6146,6 +9352,8 @@ interface HTMLAllCollection { * If there are multiple matching items, then an HTMLCollection object containing all those elements is returned. * * Only button, form, iframe, input, map, meta, object, select, and textarea elements can have a name for the purpose of this method; their name is given by the value of their name attribute. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAllCollection/namedItem) */ namedItem(name: string): HTMLCollection | Element | null; [index: number]: Element; @@ -6156,45 +9364,79 @@ declare var HTMLAllCollection: { new(): HTMLAllCollection; }; -/** Hyperlink elements and provides special properties and methods (beyond those of the regular HTMLElement object interface that they inherit from) for manipulating the layout and presentation of such elements. */ +/** + * Hyperlink elements and provides special properties and methods (beyond those of the regular HTMLElement object interface that they inherit from) for manipulating the layout and presentation of such elements. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement) + */ interface HTMLAnchorElement extends HTMLElement, HTMLHyperlinkElementUtils { /** * Sets or retrieves the character set used to encode the object. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/charset) */ charset: string; /** * Sets or retrieves the coordinates of the object. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/coords) */ coords: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/download) */ download: string; - /** Sets or retrieves the language code of the object. */ + /** + * Sets or retrieves the language code of the object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/hreflang) + */ hreflang: string; /** * Sets or retrieves the shape of the object. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/name) */ name: string; ping: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/referrerPolicy) */ referrerPolicy: string; - /** Sets or retrieves the relationship between the object and the destination of the link. */ + /** + * Sets or retrieves the relationship between the object and the destination of the link. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/rel) + */ rel: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/relList) */ readonly relList: DOMTokenList; /** * Sets or retrieves the relationship between the object and the destination of the link. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/rev) */ rev: string; /** * Sets or retrieves the shape of the object. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/shape) */ shape: string; - /** Sets or retrieves the window or frame at which to target content. */ + /** + * Sets or retrieves the window or frame at which to target content. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/target) + */ target: string; - /** Retrieves or sets the text of the object as a string. */ + /** + * Retrieves or sets the text of the object as a string. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/text) + */ text: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/type) */ type: string; addEventListener(type: K, listener: (this: HTMLAnchorElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -6207,25 +9449,51 @@ declare var HTMLAnchorElement: { new(): HTMLAnchorElement; }; -/** Provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of elements. */ +/** + * Provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of elements. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement) + */ interface HTMLAreaElement extends HTMLElement, HTMLHyperlinkElementUtils { - /** Sets or retrieves a text alternative to the graphic. */ + /** + * Sets or retrieves a text alternative to the graphic. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/alt) + */ alt: string; - /** Sets or retrieves the coordinates of the object. */ + /** + * Sets or retrieves the coordinates of the object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/coords) + */ coords: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/download) */ download: string; /** * Sets or gets whether clicks in this region cause action. * @deprecated + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/noHref) */ noHref: boolean; ping: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/referrerPolicy) */ referrerPolicy: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/rel) */ rel: string; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/relList) */ readonly relList: DOMTokenList; - /** Sets or retrieves the shape of the object. */ + /** + * Sets or retrieves the shape of the object. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/shape) + */ shape: string; - /** Sets or retrieves the window or frame at which to target content. */ + /** + * Sets or retrieves the window or frame at which to target content. + * + * [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLAreaElement/target) + */ target: string; addEventListener(type: K, listener: (this: HTMLAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -6238,7 +9506,11 @@ declare var HTMLAreaElement: { new(): HTMLAreaElement; }; -/** Provides access to the properties of