From 442a3106ed28020f8a144902c509be745f59be51 Mon Sep 17 00:00:00 2001 From: Ajay Ghanwat Date: Tue, 18 Aug 2026 15:50:26 +0530 Subject: [PATCH] test(islands): guard zero-JS routes and single-React bundling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two guards protect the core promise: a route with no islands emits no assets at all, and a page with several islands keeps React in one shared chunk. buildIslands now writes a generated entry per island instead of passing component sources directly. Two islands sharing a source deduped to a single entrypoint, and output order is not guaranteed to match input order, so island names could bind to the wrong bundle. Island modules are excluded from the editor compiler bundle: it globs packages/compiler/src, and island-bundle.ts calls Bun.build while island-codegen.ts imports @wrnexus/core — neither belongs in a Node-only VS Code artifact. Integration assertions share one build. bun test interferes with Bun.build's module reads after several build calls in one process, while the same calls succeed repeatedly outside the runner; production is unaffected. Co-Authored-By: Claude Opus 5 --- docs/public-api-0.8.json | 24 + editors/vscode/src/compiler.cjs | 34 +- editors/vscode/src/extension.bundle.cjs | 2 +- editors/vscode/src/language-server.cjs | 4053 ++++++++++------- examples/basic-app/app/islands/Counter.tsx | 10 + packages/compiler/src/island-bundle.ts | 88 +- .../compiler/test/island-integration.test.ts | 83 + packages/react/README.md | 9 + scripts/build-editor-compiler.mjs | 18 +- 9 files changed, 2619 insertions(+), 1702 deletions(-) create mode 100644 examples/basic-app/app/islands/Counter.tsx create mode 100644 packages/compiler/test/island-integration.test.ts create mode 100644 packages/react/README.md diff --git a/docs/public-api-0.8.json b/docs/public-api-0.8.json index 6a4df2f7..b6ce1e94 100644 --- a/docs/public-api-0.8.json +++ b/docs/public-api-0.8.json @@ -2259,6 +2259,30 @@ "subjectQueue" ] }, + "@wrnexus/react": { + ".": [ + "BoundStore", + "IslandErrorBoundary", + "IslandErrorBoundaryProps", + "IslandStore", + "MountOptions", + "SnapshotCache", + "SnapshotSource", + "StoreResolver", + "createSelectorCache", + "createSnapshotCache", + "islandRootCount", + "mountIslands", + "remountIslands", + "setStoreResolver", + "unmountIslands", + "useWrnActions", + "useWrnStore" + ], + "./runtime": [ + "getIslandRuntime" + ] + }, "@wrnexus/reactive": { ".": [ "AnimationTimeline", diff --git a/editors/vscode/src/compiler.cjs b/editors/vscode/src/compiler.cjs index e3979dc1..c7e34baa 100644 --- a/editors/vscode/src/compiler.cjs +++ b/editors/vscode/src/compiler.cjs @@ -1,8 +1,8 @@ "use strict"; // Generated by scripts/build-editor-compiler.mjs. Do not edit directly. -// WRN editor compiler source hash: c0e3e8c72c68cb3c182e2de84c13ef0b8921579d9b081550002b8cdbe4af3397 -// WRN editor compiler generator hash: c71e7fe4258c97b73b384ff14b321f0cf0b30cc2ed0322f5f84b04e757159b18 -// Generated with TypeScript: 5.9.3 +// WRN editor compiler source hash: 182fd799ca860d927879d4259c182ea61cbd89d913758cc9f690e1ae4a35d90f +// WRN editor compiler generator hash: 2690208ba65bb00d9fea3e08cb3ab324cfda77792021cd46785814fadf41c1bc +// Generated with TypeScript: 6.0.3 const __nodeRequire = require; const __path = __nodeRequire("node:path"); const __modules = { @@ -11,6 +11,7 @@ const __modules = { Object.defineProperty(exports, "__esModule", { value: true }); exports.optimizeAst = optimizeAst; exports.analyzeOptimizations = analyzeOptimizations; +exports.routeNeedsIslands = routeNeedsIslands; exports.analyzeRuntimeRequirements = analyzeRuntimeRequirements; function identifiers(value) { return new Set(value.match(/[A-Za-z_$][\w$]*/g) ?? []); @@ -191,8 +192,18 @@ function hasEvent(nodes) { } return false; } -function analyzeRuntimeRequirements(ast) { +/** + * A route containing a React island ships JavaScript and can no longer be + * classified as zero-JS static, so island presence must reach the classifier. + */ +function routeNeedsIslands(imports) { + return imports.some((entry) => entry.kind === "island"); +} +function analyzeRuntimeRequirements(ast, options = {}) { + const hasIslands = options.hasIslands ?? false; const reasons = []; + if (hasIslands) + reasons.push("react island"); const clientFunctions = ast.runtimeFunctions.some((fn) => fn.runtime !== "server"); const clientState = ast.states.some((state) => state.runtime !== "server"); const interactive = clientFunctions || @@ -246,11 +257,16 @@ function analyzeRuntimeRequirements(ast) { kind = "streaming-ssr"; reasons.push("partial-static shell with streamed dynamic regions"); } + // An island ships JavaScript, so a would-be zero-JS static route must be + // reported as static-interactive. Explicit render modes still win above. + if (hasIslands && kind === "static") + kind = "static-interactive"; const clientDisabled = ast.renderMode === "static" || ast.renderMode === "server"; const serverDisabled = ast.renderMode === "client"; return { kind, canPrerender: kind === "static" || kind === "static-interactive", + needsIslandRuntime: hasIslands, needsClientRuntime: !clientDisabled && (interactive || ast.renderMode === "client") && ast.hydrate !== "none" && @@ -3107,9 +3123,11 @@ function candidates(path) { path, `${path}.wrn`, `${path}.ts`, + `${path}.tsx`, `${path}.d.ts`, (0, node_path_1.join)(path, "index.wrn"), (0, node_path_1.join)(path, "index.ts"), + (0, node_path_1.join)(path, "index.tsx"), ]; } function resolveWrnImport(declaration, importer, options) { @@ -3136,8 +3154,12 @@ function resolveWrnImport(declaration, importer, options) { return false; } }); - if (found) - return { declaration, resolved: (0, node_fs_1.realpathSync)(found) }; + if (found) { + const resolved = (0, node_fs_1.realpathSync)(found); + return resolved.endsWith(".tsx") + ? { declaration, resolved, kind: "island" } + : { declaration, resolved }; + } const severity = (options.mode ?? "compatible") === "explicit" ? "error" : "warning"; return { declaration, diff --git a/editors/vscode/src/extension.bundle.cjs b/editors/vscode/src/extension.bundle.cjs index bb600b33..1b0d8369 100644 --- a/editors/vscode/src/extension.bundle.cjs +++ b/editors/vscode/src/extension.bundle.cjs @@ -1,4 +1,4 @@ -// WRN editor extension source hash: 28a3937b948e6affb33150753d537162c6702786551dd90ab0968ef9166f21ac +// WRN editor extension source hash: 4d9518778cef65c0400da0e8be9ece65be85acbd581e3024d484b7cbd2fb8116 // WRN editor extension generator hash: 456d1d614e44e5fb1f19b784176c09cf2ade9b64ef73a17934c2698150b62728 "use strict"; var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports); diff --git a/editors/vscode/src/language-server.cjs b/editors/vscode/src/language-server.cjs index 10623de1..8d6d21ad 100644 --- a/editors/vscode/src/language-server.cjs +++ b/editors/vscode/src/language-server.cjs @@ -1,5 +1,5 @@ #!/usr/bin/env node -// WRN editor language server source hash: 41ff6d71dda68160ce6236e7a1a07ee8164c1c6173ba71e392aef4c3bf455390 +// WRN editor language server source hash: 1bd55ffaa78400919477610f5dafac99b2c2f51c2687e5bbae781ce2e0012391 // WRN editor language server generator hash: f593a44aaf05495b789ce7a3086bee1eebb951b884d41c0e017bbcfe5f547e72 // @bun @bun-cjs (function(exports, require, module, __filename, __dirname) {var __create = Object.create; @@ -34,9 +34,9 @@ var __toESM = (mod, isNodeMode, target) => { }; var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports); -// node_modules/.bun/typescript@5.9.3/node_modules/typescript/lib/typescript.js +// node_modules/.bun/typescript@6.0.3/node_modules/typescript/lib/typescript.js var require_typescript = __commonJS((exports2, module2) => { - var __dirname = "E:\\WireJS\\node_modules\\.bun\\typescript@5.9.3\\node_modules\\typescript\\lib", __filename = "E:\\WireJS\\node_modules\\.bun\\typescript@5.9.3\\node_modules\\typescript\\lib\\typescript.js"; + var __dirname = "E:\\WireJS\\node_modules\\.bun\\typescript@6.0.3\\node_modules\\typescript\\lib", __filename = "E:\\WireJS\\node_modules\\.bun\\typescript@6.0.3\\node_modules\\typescript\\lib\\typescript.js"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use @@ -46,7 +46,7 @@ var require_typescript = __commonJS((exports2, module2) => { THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, - MERCHANTABLITY OR NON-INFRINGEMENT. + MERCHANTABILITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. @@ -287,6 +287,7 @@ var require_typescript = __commonJS((exports2, module2) => { canHaveLocals: () => canHaveLocals, canHaveModifiers: () => canHaveModifiers, canHaveModuleSpecifier: () => canHaveModuleSpecifier, + canHaveStatements: () => canHaveStatements, canHaveSymbol: () => canHaveSymbol, canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics, canJsonReportNoInputFiles: () => canJsonReportNoInputFiles, @@ -334,6 +335,7 @@ var require_typescript = __commonJS((exports2, module2) => { commonOptionsWithBuild: () => commonOptionsWithBuild, compact: () => compact, compareBooleans: () => compareBooleans, + compareComparableValues: () => compareComparableValues, compareDataObjects: () => compareDataObjects, compareDiagnostics: () => compareDiagnostics, compareEmitHelpers: () => compareEmitHelpers, @@ -679,6 +681,7 @@ var require_typescript = __commonJS((exports2, module2) => { getAllowImportingTsExtensions: () => getAllowImportingTsExtensions, getAllowJSCompilerOption: () => getAllowJSCompilerOption, getAllowSyntheticDefaultImports: () => getAllowSyntheticDefaultImports, + getAlwaysStrict: () => getAlwaysStrict, getAncestor: () => getAncestor, getAnyExtensionFromPath: () => getAnyExtensionFromPath, getAreDeclarationMapsEnabled: () => getAreDeclarationMapsEnabled, @@ -708,6 +711,7 @@ var require_typescript = __commonJS((exports2, module2) => { getCommonSourceDirectory: () => getCommonSourceDirectory, getCommonSourceDirectoryOfConfig: () => getCommonSourceDirectoryOfConfig, getCompilerOptionValue: () => getCompilerOptionValue, + getComputedCommonSourceDirectory: () => getComputedCommonSourceDirectory, getConditions: () => getConditions, getConfigFileParsingDiagnostics: () => getConfigFileParsingDiagnostics, getConstantValue: () => getConstantValue, @@ -917,6 +921,7 @@ var require_typescript = __commonJS((exports2, module2) => { getModuleInstanceState: () => getModuleInstanceState, getModuleNameStringLiteralAt: () => getModuleNameStringLiteralAt, getModuleSpecifierEndingPreference: () => getModuleSpecifierEndingPreference, + getModuleSpecifierOfBareOrAccessedRequire: () => getModuleSpecifierOfBareOrAccessedRequire, getModuleSpecifierResolverHost: () => getModuleSpecifierResolverHost, getNameForExportedSymbol: () => getNameForExportedSymbol, getNameFromImportAttribute: () => getNameFromImportAttribute, @@ -947,7 +952,6 @@ var require_typescript = __commonJS((exports2, module2) => { getNonAugmentationDeclaration: () => getNonAugmentationDeclaration, getNonDecoratorTokenPosOfNode: () => getNonDecoratorTokenPosOfNode, getNonIncrementalBuildInfoRoots: () => getNonIncrementalBuildInfoRoots, - getNonModifierTokenPosOfNode: () => getNonModifierTokenPosOfNode, getNormalizedAbsolutePath: () => getNormalizedAbsolutePath, getNormalizedAbsolutePathWithoutRoot: () => getNormalizedAbsolutePathWithoutRoot, getNormalizedPathComponents: () => getNormalizedPathComponents, @@ -1678,6 +1682,7 @@ var require_typescript = __commonJS((exports2, module2) => { isPlusToken: () => isPlusToken, isPossiblyTypeArgumentPosition: () => isPossiblyTypeArgumentPosition, isPostfixUnaryExpression: () => isPostfixUnaryExpression, + isPotentiallyExecutableNode: () => isPotentiallyExecutableNode, isPrefixUnaryExpression: () => isPrefixUnaryExpression, isPrimitiveLiteralValue: () => isPrimitiveLiteralValue, isPrivateIdentifier: () => isPrivateIdentifier, @@ -2280,9 +2285,7 @@ var require_typescript = __commonJS((exports2, module2) => { unmangleScopedPackageName: () => unmangleScopedPackageName, unorderedRemoveItem: () => unorderedRemoveItem, unprefixedNodeCoreModules: () => unprefixedNodeCoreModules, - unreachableCodeIsError: () => unreachableCodeIsError, unsetNodeChildren: () => unsetNodeChildren, - unusedLabelIsError: () => unusedLabelIsError, unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel, unwrapParenthesizedExpression: () => unwrapParenthesizedExpression, updateErrorForNoInputFiles: () => updateErrorForNoInputFiles, @@ -2292,6 +2295,7 @@ var require_typescript = __commonJS((exports2, module2) => { updateSharedExtendedConfigFileWatcher: () => updateSharedExtendedConfigFileWatcher, updateSourceFile: () => updateSourceFile, updateWatchingWildcardDirectories: () => updateWatchingWildcardDirectories, + usesWildcardTypes: () => usesWildcardTypes, usingSingleLineStringWriter: () => usingSingleLineStringWriter, utf16EncodeAsString: () => utf16EncodeAsString, validateLocaleAndSetLanguage: () => validateLocaleAndSetLanguage, @@ -2318,8 +2322,8 @@ var require_typescript = __commonJS((exports2, module2) => { zipWith: () => zipWith }); module3.exports = __toCommonJS(typescript_exports); - var versionMajorMinor = "5.9"; - var version = "5.9.3"; + var versionMajorMinor = "6.0"; + var version = "6.0.3"; var Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -3029,7 +3033,7 @@ var require_typescript = __commonJS((exports2, module2) => { while (low <= high) { const middle = low + (high - low >> 1); const midKey = keySelector(array[middle], middle); - switch (keyComparer(midKey, key)) { + switch (Math.sign(keyComparer(midKey, key))) { case -1: low = middle + 1; break; @@ -4227,8 +4231,8 @@ Verbose Debug Information: ` + (typeof verboseDebugInfo === "string" ? verboseDe Object.defineProperties(objectAllocator.getTypeConstructor().prototype, { __tsDebuggerDisplay: { value() { - const typeHeader = this.flags & 67359327 ? `IntrinsicType ${this.intrinsicName}${this.debugIntrinsicName ? ` (${this.debugIntrinsicName})` : ""}` : this.flags & 98304 ? "NullableType" : this.flags & 384 ? `LiteralType ${JSON.stringify(this.value)}` : this.flags & 2048 ? `LiteralType ${this.value.negative ? "-" : ""}${this.value.base10Value}n` : this.flags & 8192 ? "UniqueESSymbolType" : this.flags & 32 ? "EnumType" : this.flags & 1048576 ? "UnionType" : this.flags & 2097152 ? "IntersectionType" : this.flags & 4194304 ? "IndexType" : this.flags & 8388608 ? "IndexedAccessType" : this.flags & 16777216 ? "ConditionalType" : this.flags & 33554432 ? "SubstitutionType" : this.flags & 262144 ? "TypeParameter" : this.flags & 524288 ? this.objectFlags & 3 ? "InterfaceType" : this.objectFlags & 4 ? "TypeReference" : this.objectFlags & 8 ? "TupleType" : this.objectFlags & 16 ? "AnonymousType" : this.objectFlags & 32 ? "MappedType" : this.objectFlags & 1024 ? "ReverseMappedType" : this.objectFlags & 256 ? "EvolvingArrayType" : "ObjectType" : "Type"; - const remainingObjectFlags = this.flags & 524288 ? this.objectFlags & ~1343 : 0; + const typeHeader = this.flags & 402431 ? `IntrinsicType ${this.intrinsicName}${this.debugIntrinsicName ? ` (${this.debugIntrinsicName})` : ""}` : this.flags & 12 ? "NullableType" : this.flags & 3072 ? `LiteralType ${JSON.stringify(this.value)}` : this.flags & 4096 ? `LiteralType ${this.value.negative ? "-" : ""}${this.value.base10Value}n` : this.flags & 16384 ? "UniqueESSymbolType" : this.flags & 65536 ? "EnumType" : this.flags & 134217728 ? "UnionType" : this.flags & 268435456 ? "IntersectionType" : this.flags & 2097152 ? "IndexType" : this.flags & 33554432 ? "IndexedAccessType" : this.flags & 67108864 ? "ConditionalType" : this.flags & 16777216 ? "SubstitutionType" : this.flags & 524288 ? "TypeParameter" : this.flags & 1048576 ? this.objectFlags & 3 ? "InterfaceType" : this.objectFlags & 4 ? "TypeReference" : this.objectFlags & 8 ? "TupleType" : this.objectFlags & 16 ? "AnonymousType" : this.objectFlags & 32 ? "MappedType" : this.objectFlags & 1024 ? "ReverseMappedType" : this.objectFlags & 256 ? "EvolvingArrayType" : "ObjectType" : "Type"; + const remainingObjectFlags = this.flags & 1048576 ? this.objectFlags & ~142607679 : 0; return `${typeHeader}${this.symbol ? ` '${symbolName(this.symbol)}'` : ""}${remainingObjectFlags ? ` (${formatObjectFlags(remainingObjectFlags)})` : ""}`; } }, @@ -4239,7 +4243,7 @@ Verbose Debug Information: ` + (typeof verboseDebugInfo === "string" ? verboseDe }, __debugObjectFlags: { get() { - return this.flags & 524288 ? formatObjectFlags(this.objectFlags) : ""; + return this.flags & 1048576 ? formatObjectFlags(this.objectFlags) : ""; } }, __debugTypeToString: { @@ -5325,7 +5329,7 @@ ${lanes.join(` const objectFlags = type.objectFlags; const symbol = type.aliasSymbol ?? type.symbol; let display; - if (objectFlags & 16 | type.flags & 2944) { + if (objectFlags & 16 | type.flags & 15360) { try { display = (_a = type.checker) == null ? undefined : _a.typeToString(type); } catch { @@ -5333,7 +5337,7 @@ ${lanes.join(` } } let indexedAccessProperties = {}; - if (type.flags & 8388608) { + if (type.flags & 33554432) { const indexedAccessType = type; indexedAccessProperties = { indexedAccessObjectType: (_b = indexedAccessType.objectType) == null ? undefined : _b.id, @@ -5350,7 +5354,7 @@ ${lanes.join(` }; } let conditionalProperties = {}; - if (type.flags & 16777216) { + if (type.flags & 67108864) { const conditionalType = type; conditionalProperties = { conditionalCheckType: (_f = conditionalType.checkType) == null ? undefined : _f.id, @@ -5360,7 +5364,7 @@ ${lanes.join(` }; } let substitutionProperties = {}; - if (type.flags & 33554432) { + if (type.flags & 16777216) { const substitutionType = type; substitutionProperties = { substitutionBaseType: (_j = substitutionType.baseType) == null ? undefined : _j.id, @@ -5399,10 +5403,10 @@ ${lanes.join(` symbolName: (symbol == null ? undefined : symbol.escapedName) && unescapeLeadingUnderscores(symbol.escapedName), recursionId: recursionToken, isTuple: objectFlags & 8 ? true : undefined, - unionTypes: type.flags & 1048576 ? (_p = type.types) == null ? undefined : _p.map((t) => t.id) : undefined, - intersectionTypes: type.flags & 2097152 ? type.types.map((t) => t.id) : undefined, + unionTypes: type.flags & 134217728 ? (_p = type.types) == null ? undefined : _p.map((t) => t.id) : undefined, + intersectionTypes: type.flags & 268435456 ? type.types.map((t) => t.id) : undefined, aliasTypeArguments: (_q = type.aliasTypeArguments) == null ? undefined : _q.map((t) => t.id), - keyofType: type.flags & 4194304 ? (_r = type.type) == null ? undefined : _r.id : undefined, + keyofType: type.flags & 2097152 ? (_r = type.type) == null ? undefined : _r.id : undefined, ...indexedAccessProperties, ...referenceProperties, ...conditionalProperties, @@ -5868,6 +5872,7 @@ ${lanes.join(` NodeFlags3[NodeFlags3["JsonFile"] = 134217728] = "JsonFile"; NodeFlags3[NodeFlags3["TypeCached"] = 268435456] = "TypeCached"; NodeFlags3[NodeFlags3["Deprecated"] = 536870912] = "Deprecated"; + NodeFlags3[NodeFlags3["Unreachable"] = 1073741824] = "Unreachable"; NodeFlags3[NodeFlags3["BlockScoped"] = 7] = "BlockScoped"; NodeFlags3[NodeFlags3["Constant"] = 6] = "Constant"; NodeFlags3[NodeFlags3["ReachabilityCheckFlags"] = 1536] = "ReachabilityCheckFlags"; @@ -6084,7 +6089,7 @@ ${lanes.join(` ContextFlags3[ContextFlags3["None"] = 0] = "None"; ContextFlags3[ContextFlags3["Signature"] = 1] = "Signature"; ContextFlags3[ContextFlags3["NoConstraints"] = 2] = "NoConstraints"; - ContextFlags3[ContextFlags3["Completions"] = 4] = "Completions"; + ContextFlags3[ContextFlags3["IgnoreNodeInferences"] = 4] = "IgnoreNodeInferences"; ContextFlags3[ContextFlags3["SkipBindingPatterns"] = 8] = "SkipBindingPatterns"; return ContextFlags3; })(ContextFlags || {}); @@ -6346,75 +6351,76 @@ ${lanes.join(` var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => { TypeFlags2[TypeFlags2["Any"] = 1] = "Any"; TypeFlags2[TypeFlags2["Unknown"] = 2] = "Unknown"; - TypeFlags2[TypeFlags2["String"] = 4] = "String"; - TypeFlags2[TypeFlags2["Number"] = 8] = "Number"; - TypeFlags2[TypeFlags2["Boolean"] = 16] = "Boolean"; - TypeFlags2[TypeFlags2["Enum"] = 32] = "Enum"; - TypeFlags2[TypeFlags2["BigInt"] = 64] = "BigInt"; - TypeFlags2[TypeFlags2["StringLiteral"] = 128] = "StringLiteral"; - TypeFlags2[TypeFlags2["NumberLiteral"] = 256] = "NumberLiteral"; - TypeFlags2[TypeFlags2["BooleanLiteral"] = 512] = "BooleanLiteral"; - TypeFlags2[TypeFlags2["EnumLiteral"] = 1024] = "EnumLiteral"; - TypeFlags2[TypeFlags2["BigIntLiteral"] = 2048] = "BigIntLiteral"; - TypeFlags2[TypeFlags2["ESSymbol"] = 4096] = "ESSymbol"; - TypeFlags2[TypeFlags2["UniqueESSymbol"] = 8192] = "UniqueESSymbol"; - TypeFlags2[TypeFlags2["Void"] = 16384] = "Void"; - TypeFlags2[TypeFlags2["Undefined"] = 32768] = "Undefined"; - TypeFlags2[TypeFlags2["Null"] = 65536] = "Null"; - TypeFlags2[TypeFlags2["Never"] = 131072] = "Never"; - TypeFlags2[TypeFlags2["TypeParameter"] = 262144] = "TypeParameter"; - TypeFlags2[TypeFlags2["Object"] = 524288] = "Object"; - TypeFlags2[TypeFlags2["Union"] = 1048576] = "Union"; - TypeFlags2[TypeFlags2["Intersection"] = 2097152] = "Intersection"; - TypeFlags2[TypeFlags2["Index"] = 4194304] = "Index"; - TypeFlags2[TypeFlags2["IndexedAccess"] = 8388608] = "IndexedAccess"; - TypeFlags2[TypeFlags2["Conditional"] = 16777216] = "Conditional"; - TypeFlags2[TypeFlags2["Substitution"] = 33554432] = "Substitution"; - TypeFlags2[TypeFlags2["NonPrimitive"] = 67108864] = "NonPrimitive"; - TypeFlags2[TypeFlags2["TemplateLiteral"] = 134217728] = "TemplateLiteral"; - TypeFlags2[TypeFlags2["StringMapping"] = 268435456] = "StringMapping"; + TypeFlags2[TypeFlags2["Undefined"] = 4] = "Undefined"; + TypeFlags2[TypeFlags2["Null"] = 8] = "Null"; + TypeFlags2[TypeFlags2["Void"] = 16] = "Void"; + TypeFlags2[TypeFlags2["String"] = 32] = "String"; + TypeFlags2[TypeFlags2["Number"] = 64] = "Number"; + TypeFlags2[TypeFlags2["BigInt"] = 128] = "BigInt"; + TypeFlags2[TypeFlags2["Boolean"] = 256] = "Boolean"; + TypeFlags2[TypeFlags2["ESSymbol"] = 512] = "ESSymbol"; + TypeFlags2[TypeFlags2["StringLiteral"] = 1024] = "StringLiteral"; + TypeFlags2[TypeFlags2["NumberLiteral"] = 2048] = "NumberLiteral"; + TypeFlags2[TypeFlags2["BigIntLiteral"] = 4096] = "BigIntLiteral"; + TypeFlags2[TypeFlags2["BooleanLiteral"] = 8192] = "BooleanLiteral"; + TypeFlags2[TypeFlags2["UniqueESSymbol"] = 16384] = "UniqueESSymbol"; + TypeFlags2[TypeFlags2["EnumLiteral"] = 32768] = "EnumLiteral"; + TypeFlags2[TypeFlags2["Enum"] = 65536] = "Enum"; + TypeFlags2[TypeFlags2["NonPrimitive"] = 131072] = "NonPrimitive"; + TypeFlags2[TypeFlags2["Never"] = 262144] = "Never"; + TypeFlags2[TypeFlags2["TypeParameter"] = 524288] = "TypeParameter"; + TypeFlags2[TypeFlags2["Object"] = 1048576] = "Object"; + TypeFlags2[TypeFlags2["Index"] = 2097152] = "Index"; + TypeFlags2[TypeFlags2["TemplateLiteral"] = 4194304] = "TemplateLiteral"; + TypeFlags2[TypeFlags2["StringMapping"] = 8388608] = "StringMapping"; + TypeFlags2[TypeFlags2["Substitution"] = 16777216] = "Substitution"; + TypeFlags2[TypeFlags2["IndexedAccess"] = 33554432] = "IndexedAccess"; + TypeFlags2[TypeFlags2["Conditional"] = 67108864] = "Conditional"; + TypeFlags2[TypeFlags2["Union"] = 134217728] = "Union"; + TypeFlags2[TypeFlags2["Intersection"] = 268435456] = "Intersection"; TypeFlags2[TypeFlags2["Reserved1"] = 536870912] = "Reserved1"; TypeFlags2[TypeFlags2["Reserved2"] = 1073741824] = "Reserved2"; + TypeFlags2[TypeFlags2["Reserved3"] = -2147483648] = "Reserved3"; TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown"; - TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable"; - TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal"; - TypeFlags2[TypeFlags2["Unit"] = 109472] = "Unit"; - TypeFlags2[TypeFlags2["Freshable"] = 2976] = "Freshable"; - TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral"; - TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 8576] = "StringOrNumberLiteralOrUnique"; - TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy"; - TypeFlags2[TypeFlags2["PossiblyFalsy"] = 117724] = "PossiblyFalsy"; - TypeFlags2[TypeFlags2["Intrinsic"] = 67359327] = "Intrinsic"; - TypeFlags2[TypeFlags2["StringLike"] = 402653316] = "StringLike"; - TypeFlags2[TypeFlags2["NumberLike"] = 296] = "NumberLike"; - TypeFlags2[TypeFlags2["BigIntLike"] = 2112] = "BigIntLike"; - TypeFlags2[TypeFlags2["BooleanLike"] = 528] = "BooleanLike"; - 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"; - TypeFlags2[TypeFlags2["StructuredType"] = 3670016] = "StructuredType"; - TypeFlags2[TypeFlags2["TypeVariable"] = 8650752] = "TypeVariable"; - TypeFlags2[TypeFlags2["InstantiableNonPrimitive"] = 58982400] = "InstantiableNonPrimitive"; - TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive"; - TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable"; - TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable"; - TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType"; - TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable"; - TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton"; - TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable"; - TypeFlags2[TypeFlags2["IncludesMask"] = 473694207] = "IncludesMask"; - TypeFlags2[TypeFlags2["IncludesMissingType"] = 262144] = "IncludesMissingType"; - TypeFlags2[TypeFlags2["IncludesNonWideningType"] = 4194304] = "IncludesNonWideningType"; - TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608] = "IncludesWildcard"; - TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216] = "IncludesEmptyObject"; - TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432] = "IncludesInstantiable"; + TypeFlags2[TypeFlags2["Nullable"] = 12] = "Nullable"; + TypeFlags2[TypeFlags2["Literal"] = 15360] = "Literal"; + TypeFlags2[TypeFlags2["Unit"] = 97292] = "Unit"; + TypeFlags2[TypeFlags2["Freshable"] = 80896] = "Freshable"; + TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 3072] = "StringOrNumberLiteral"; + TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 19456] = "StringOrNumberLiteralOrUnique"; + TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 15388] = "DefinitelyFalsy"; + TypeFlags2[TypeFlags2["PossiblyFalsy"] = 15868] = "PossiblyFalsy"; + TypeFlags2[TypeFlags2["Intrinsic"] = 402431] = "Intrinsic"; + TypeFlags2[TypeFlags2["StringLike"] = 12583968] = "StringLike"; + TypeFlags2[TypeFlags2["NumberLike"] = 67648] = "NumberLike"; + TypeFlags2[TypeFlags2["BigIntLike"] = 4224] = "BigIntLike"; + TypeFlags2[TypeFlags2["BooleanLike"] = 8448] = "BooleanLike"; + TypeFlags2[TypeFlags2["EnumLike"] = 98304] = "EnumLike"; + TypeFlags2[TypeFlags2["ESSymbolLike"] = 16896] = "ESSymbolLike"; + TypeFlags2[TypeFlags2["VoidLike"] = 20] = "VoidLike"; + TypeFlags2[TypeFlags2["Primitive"] = 12713980] = "Primitive"; + TypeFlags2[TypeFlags2["DefinitelyNonNullable"] = 13893600] = "DefinitelyNonNullable"; + TypeFlags2[TypeFlags2["DisjointDomains"] = 12812284] = "DisjointDomains"; + TypeFlags2[TypeFlags2["UnionOrIntersection"] = 402653184] = "UnionOrIntersection"; + TypeFlags2[TypeFlags2["StructuredType"] = 403701760] = "StructuredType"; + TypeFlags2[TypeFlags2["TypeVariable"] = 34078720] = "TypeVariable"; + TypeFlags2[TypeFlags2["InstantiableNonPrimitive"] = 117964800] = "InstantiableNonPrimitive"; + TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 14680064] = "InstantiablePrimitive"; + TypeFlags2[TypeFlags2["Instantiable"] = 132644864] = "Instantiable"; + TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 536346624] = "StructuredOrInstantiable"; + TypeFlags2[TypeFlags2["ObjectFlagsType"] = 403963917] = "ObjectFlagsType"; + TypeFlags2[TypeFlags2["Simplifiable"] = 102760448] = "Simplifiable"; + TypeFlags2[TypeFlags2["Singleton"] = 394239] = "Singleton"; + TypeFlags2[TypeFlags2["Narrowable"] = 536575971] = "Narrowable"; + TypeFlags2[TypeFlags2["IncludesMask"] = 416808959] = "IncludesMask"; + TypeFlags2[TypeFlags2["IncludesMissingType"] = 524288] = "IncludesMissingType"; + TypeFlags2[TypeFlags2["IncludesNonWideningType"] = 2097152] = "IncludesNonWideningType"; + TypeFlags2[TypeFlags2["IncludesWildcard"] = 33554432] = "IncludesWildcard"; + TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 67108864] = "IncludesEmptyObject"; + TypeFlags2[TypeFlags2["IncludesInstantiable"] = 16777216] = "IncludesInstantiable"; TypeFlags2[TypeFlags2["IncludesConstrainedTypeVariable"] = 536870912] = "IncludesConstrainedTypeVariable"; TypeFlags2[TypeFlags2["IncludesError"] = 1073741824] = "IncludesError"; - TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion"; + TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 286523411] = "NotPrimitiveUnion"; return TypeFlags2; })(TypeFlags || {}); var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => { @@ -6445,10 +6451,10 @@ ${lanes.join(` ObjectFlags3[ObjectFlags3["RequiresWidening"] = 196608] = "RequiresWidening"; ObjectFlags3[ObjectFlags3["PropagatingFlags"] = 458752] = "PropagatingFlags"; ObjectFlags3[ObjectFlags3["InstantiatedMapped"] = 96] = "InstantiatedMapped"; - ObjectFlags3[ObjectFlags3["ObjectTypeKindMask"] = 1343] = "ObjectTypeKindMask"; ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread"; ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType"; ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType"; + ObjectFlags3[ObjectFlags3["ObjectTypeKindMask"] = 142607679] = "ObjectTypeKindMask"; ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone"; ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated"; ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists"; @@ -6702,9 +6708,11 @@ ${lanes.join(` ScriptTarget12[ScriptTarget12["ES2022"] = 9] = "ES2022"; ScriptTarget12[ScriptTarget12["ES2023"] = 10] = "ES2023"; ScriptTarget12[ScriptTarget12["ES2024"] = 11] = "ES2024"; + ScriptTarget12[ScriptTarget12["ES2025"] = 12] = "ES2025"; ScriptTarget12[ScriptTarget12["ESNext"] = 99] = "ESNext"; ScriptTarget12[ScriptTarget12["JSON"] = 100] = "JSON"; ScriptTarget12[ScriptTarget12["Latest"] = 99] = "Latest"; + ScriptTarget12[ScriptTarget12["LatestStandard"] = 12] = "LatestStandard"; return ScriptTarget12; })(ScriptTarget || {}); var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => { @@ -9232,7 +9240,7 @@ ${lanes.join(` A_bigint_literal_cannot_use_exponential_notation: diag(1352, 1, "A_bigint_literal_cannot_use_exponential_notation_1352", "A bigint literal cannot use exponential notation."), A_bigint_literal_must_be_an_integer: diag(1353, 1, "A_bigint_literal_must_be_an_integer_1353", "A bigint literal must be an integer."), readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types: diag(1354, 1, "readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354", "'readonly' type modifier is only permitted on array and tuple literal types."), - A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals: diag(1355, 1, "A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355", "A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals."), + A_const_assertion_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals: diag(1355, 1, "A_const_assertion_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_o_1355", "A 'const' assertion can only be applied to references to enum members, or string, number, boolean, array, or object literals."), Did_you_mean_to_mark_this_function_as_async: diag(1356, 1, "Did_you_mean_to_mark_this_function_as_async_1356", "Did you mean to mark this function as 'async'?"), An_enum_member_name_must_be_followed_by_a_or: diag(1357, 1, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, 1, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), @@ -9398,13 +9406,16 @@ ${lanes.join(` Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class: diag(1537, 1, "Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_1537", "Decimal escape sequences and backreferences are not allowed in a character class."), Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set: diag(1538, 1, "Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_se_1538", "Unicode escape sequences are only available when the Unicode (u) flag or the Unicode Sets (v) flag is set."), A_bigint_literal_cannot_be_used_as_a_property_name: diag(1539, 1, "A_bigint_literal_cannot_be_used_as_a_property_name_1539", "A 'bigint' literal cannot be used as a property name."), - A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_keyword_instead: diag(1540, 2, "A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_key_1540", "A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead.", undefined, undefined, true), + A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_keyword_instead: diag(1540, 1, "A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_key_1540", "A 'namespace' declaration should not be declared using the 'module' keyword. Please use the 'namespace' keyword instead."), Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute: diag(1541, 1, "Type_only_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribut_1541", "Type-only import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute."), Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute: diag(1542, 1, "Type_import_of_an_ECMAScript_module_from_a_CommonJS_module_must_have_a_resolution_mode_attribute_1542", "Type import of an ECMAScript module from a CommonJS module must have a 'resolution-mode' attribute."), Importing_a_JSON_file_into_an_ECMAScript_module_requires_a_type_Colon_json_import_attribute_when_module_is_set_to_0: diag(1543, 1, "Importing_a_JSON_file_into_an_ECMAScript_module_requires_a_type_Colon_json_import_attribute_when_mod_1543", `Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to '{0}'.`), Named_imports_from_a_JSON_file_into_an_ECMAScript_module_are_not_allowed_when_module_is_set_to_0: diag(1544, 1, "Named_imports_from_a_JSON_file_into_an_ECMAScript_module_are_not_allowed_when_module_is_set_to_0_1544", "Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to '{0}'."), using_declarations_are_not_allowed_in_ambient_contexts: diag(1545, 1, "using_declarations_are_not_allowed_in_ambient_contexts_1545", "'using' declarations are not allowed in ambient contexts."), await_using_declarations_are_not_allowed_in_ambient_contexts: diag(1546, 1, "await_using_declarations_are_not_allowed_in_ambient_contexts_1546", "'await using' declarations are not allowed in ambient contexts."), + using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block: diag(1547, 1, "using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block_1547", "'using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block."), + await_using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block: diag(1548, 1, "await_using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block_1548", "'await using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block."), + Ignore_the_tsconfig_found_and_build_with_commandline_options_and_files: diag(1549, 3, "Ignore_the_tsconfig_found_and_build_with_commandline_options_and_files_1549", "Ignore the tsconfig found and build with commandline options and files."), The_types_of_0_are_incompatible_between_these_types: diag(2200, 1, "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, "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(2202, 1, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", undefined, true), @@ -9942,6 +9953,8 @@ ${lanes.join(` Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found: diag(2879, 1, "Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found_2879", "Using JSX fragments requires fragment factory '{0}' to be in scope, but it could not be found."), Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert: diag(2880, 1, "Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert_2880", "Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'."), This_expression_is_never_nullish: diag(2881, 1, "This_expression_is_never_nullish_2881", "This expression is never nullish."), + Cannot_find_module_or_type_declarations_for_side_effect_import_of_0: diag(2882, 1, "Cannot_find_module_or_type_declarations_for_side_effect_import_of_0_2882", "Cannot find module or type declarations for side-effect import of '{0}'."), + The_inferred_type_of_0_cannot_be_named_without_a_reference_to_2_from_1_This_is_likely_not_portable_A_type_annotation_is_necessary: diag(2883, 1, "The_inferred_type_of_0_cannot_be_named_without_a_reference_to_2_from_1_This_is_likely_not_portable_A_2883", "The inferred type of '{0}' cannot be named without a reference to '{2}' from '{1}'. This is likely not portable. A type annotation is necessary."), Import_declaration_0_is_using_private_name_1: diag(4000, 1, "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, "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, "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}'."), @@ -10056,6 +10069,7 @@ ${lanes.join(` The_current_host_does_not_support_the_0_option: diag(5001, 1, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."), Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."), File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."), + The_common_source_directory_of_0_is_1_The_rootDir_setting_must_be_explicitly_set_to_this_or_another_path_to_adjust_your_output_s_file_layout: diag(5011, 1, "The_common_source_directory_of_0_is_1_The_rootDir_setting_must_be_explicitly_set_to_this_or_another__5011", "The common source directory of '{0}' is '{1}'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout."), Cannot_read_file_0_Colon_1: diag(5012, 1, "Cannot_read_file_0_Colon_1_5012", "Cannot read file '{0}': {1}."), Unknown_compiler_option_0: diag(5023, 1, "Unknown_compiler_option_0_5023", "Unknown compiler option '{0}'."), Compiler_option_0_requires_a_value_of_type_1: diag(5024, 1, "Compiler_option_0_requires_a_value_of_type_1_5024", "Compiler option '{0}' requires a value of type {1}."), @@ -10105,8 +10119,8 @@ ${lanes.join(` The_root_value_of_a_0_file_must_be_an_object: diag(5092, 1, "The_root_value_of_a_0_file_must_be_an_object_5092", "The root value of a '{0}' file must be an object."), Compiler_option_0_may_only_be_used_with_build: diag(5093, 1, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."), Compiler_option_0_may_not_be_used_with_build: diag(5094, 1, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."), - Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later: diag(5095, 1, "Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095", "Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later."), - Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."), + Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later: diag(5095, 1, "Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later_5095", "Option '{0}' can only be used when 'module' is set to 'preserve', 'commonjs', or 'es2015' or later."), + Option_allowImportingTsExtensions_can_only_be_used_when_one_of_noEmit_emitDeclarationOnly_or_rewriteRelativeImportExtensions_is_set: diag(5096, 1, "Option_allowImportingTsExtensions_can_only_be_used_when_one_of_noEmit_emitDeclarationOnly_or_rewrite_5096", "Option 'allowImportingTsExtensions' can only be used when one of 'noEmit', 'emitDeclarationOnly', or 'rewriteRelativeImportExtensions' is set."), An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."), Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."), Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1, "Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprec_5101", `Option '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`), @@ -10119,6 +10133,8 @@ ${lanes.join(` Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."), Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1: diag(5109, 1, "Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1_5109", "Option 'moduleResolution' must be set to '{0}' (or left unspecified) when option 'module' is set to '{1}'."), Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1: diag(5110, 1, "Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1_5110", "Option 'module' must be set to '{0}' when option 'moduleResolution' is set to '{1}'."), + Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information: diag(5111, 3, "Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information_5111", "Visit https://aka.ms/ts6 for migration information."), + tsconfig_json_is_present_but_will_not_be_loaded_if_files_are_specified_on_commandline_Use_ignoreConfig_to_skip_this_error: diag(5112, 1, "tsconfig_json_is_present_but_will_not_be_loaded_if_files_are_specified_on_commandline_Use_ignoreConf_5112", "tsconfig.json is present but will not be loaded if files are specified on commandline. Use '--ignoreConfig' to skip this error."), Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6000, 3, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."), Concatenate_and_emit_output_to_single_file: diag(6001, 3, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."), Generates_corresponding_d_ts_file: diag(6002, 3, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."), @@ -10577,17 +10593,17 @@ ${lanes.join(` Check_side_effect_imports: diag(6806, 3, "Check_side_effect_imports_6806", "Check side effect imports."), This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2: diag(6807, 1, "This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2_6807", "This operation can be simplified. This shift is identical to `{0} {1} {2}`."), Enable_lib_replacement: diag(6808, 3, "Enable_lib_replacement_6808", "Enable lib replacement."), + Ensure_types_are_ordered_stably_and_deterministically_across_compilations: diag(6809, 3, "Ensure_types_are_ordered_stably_and_deterministically_across_compilations_6809", "Ensure types are ordered stably and deterministically across compilations."), one_of_Colon: diag(6900, 3, "one_of_Colon_6900", "one of:"), one_or_more_Colon: diag(6901, 3, "one_or_more_Colon_6901", "one or more:"), type_Colon: diag(6902, 3, "type_Colon_6902", "type:"), default_Colon: diag(6903, 3, "default_Colon_6903", "default:"), - module_system_or_esModuleInterop: diag(6904, 3, "module_system_or_esModuleInterop_6904", 'module === "system" or esModuleInterop'), - false_unless_strict_is_set: diag(6905, 3, "false_unless_strict_is_set_6905", "`false`, unless `strict` is set"), + true_unless_strict_is_false: diag(6905, 3, "true_unless_strict_is_false_6905", "`true`, unless `strict` is `false`"), false_unless_composite_is_set: diag(6906, 3, "false_unless_composite_is_set_6906", "`false`, unless `composite` is set"), node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified: diag(6907, 3, "node_modules_bower_components_jspm_packages_plus_the_value_of_outDir_if_one_is_specified_6907", '`["node_modules", "bower_components", "jspm_packages"]`, plus the value of `outDir` if one is specified.'), if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk: diag(6908, 3, "if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk_6908", '`[]` if `files` is specified, otherwise `["**/*"]`'), true_if_composite_false_otherwise: diag(6909, 3, "true_if_composite_false_otherwise_6909", "`true` if `composite`, `false` otherwise"), - module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node: diag(69010, 3, "module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node_69010", "module === `AMD` or `UMD` or `System` or `ES6`, then `Classic`, Otherwise `Node`"), + nodenext_if_module_is_nodenext_node16_if_module_is_node16_or_node18_otherwise_bundler: diag(69010, 3, "nodenext_if_module_is_nodenext_node16_if_module_is_node16_or_node18_otherwise_bundler_69010", "`nodenext` if `module` is `nodenext`; `node16` if `module` is `node16` or `node18`; otherwise, `bundler`."), Computed_from_the_list_of_input_files: diag(6911, 3, "Computed_from_the_list_of_input_files_6911", "Computed from the list of input files"), Platform_specific: diag(6912, 3, "Platform_specific_6912", "Platform specific"), You_can_learn_about_all_of_the_compiler_options_at_0: diag(6913, 3, "You_can_learn_about_all_of_the_compiler_options_at_0_6913", "You can learn about all of the compiler options at {0}"), @@ -10609,6 +10625,7 @@ ${lanes.join(` Compiles_the_current_project_with_additional_settings: diag(6929, 3, "Compiles_the_current_project_with_additional_settings_6929", "Compiles the current project, with additional settings."), true_for_ES2022_and_above_including_ESNext: diag(6930, 3, "true_for_ES2022_and_above_including_ESNext_6930", "`true` for ES2022 and above, including ESNext."), List_of_file_name_suffixes_to_search_when_resolving_a_module: diag(6931, 1, "List_of_file_name_suffixes_to_search_when_resolving_a_module_6931", "List of file name suffixes to search when resolving a module."), + false_unless_checkJs_is_set: diag(6932, 3, "false_unless_checkJs_is_set_6932", "`false`, unless `checkJs` is set"), Variable_0_implicitly_has_an_1_type: diag(7005, 1, "Variable_0_implicitly_has_an_1_type_7005", "Variable '{0}' implicitly has an '{1}' type."), Parameter_0_implicitly_has_an_1_type: diag(7006, 1, "Parameter_0_implicitly_has_an_1_type_7006", "Parameter '{0}' implicitly has an '{1}' type."), Member_0_implicitly_has_an_1_type: diag(7008, 1, "Member_0_implicitly_has_an_1_type_7008", "Member '{0}' implicitly has an '{1}' type."), @@ -14140,6 +14157,7 @@ ${lanes.join(` } var targetToLibMap = /* @__PURE__ */ new Map([ [99, "lib.esnext.full.d.ts"], + [12, "lib.es2025.full.d.ts"], [11, "lib.es2024.full.d.ts"], [10, "lib.es2023.full.d.ts"], [9, "lib.es2022.full.d.ts"], @@ -14155,6 +14173,7 @@ ${lanes.join(` const target = getEmitScriptTarget(options); switch (target) { case 99: + case 12: case 11: case 10: case 9: @@ -15994,13 +16013,6 @@ ${lanes.join(` } return skipTrivia2((sourceFile || getSourceFileOfNode(node)).text, lastDecorator.end); } - function getNonModifierTokenPosOfNode(node, sourceFile) { - const lastModifier = !nodeIsMissing(node) && canHaveModifiers(node) && node.modifiers ? last(node.modifiers) : undefined; - if (!lastModifier) { - return getTokenPosOfNode(node, sourceFile); - } - return skipTrivia2((sourceFile || getSourceFileOfNode(node)).text, lastModifier.end); - } function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia = false) { return getTextOfNodeFromSourceText(sourceFile.text, node, includeTrivia); } @@ -16151,6 +16163,11 @@ ${lanes.join(` "unicodeSets" ] })), + RegExpConstructor: new Map(Object.entries({ + es2025: [ + "escape" + ] + })), Reflect: new Map(Object.entries({ es2015: [ "apply", @@ -16230,7 +16247,7 @@ ${lanes.join(` "fround", "cbrt" ], - esnext: [ + es2025: [ "f16round" ] })), @@ -16239,6 +16256,10 @@ ${lanes.join(` "entries", "keys", "values" + ], + esnext: [ + "getOrInsert", + "getOrInsertComputed" ] })), MapConstructor: new Map(Object.entries({ @@ -16252,7 +16273,7 @@ ${lanes.join(` "keys", "values" ], - esnext: [ + es2025: [ "union", "intersection", "difference", @@ -16277,6 +16298,9 @@ ${lanes.join(` ], es2024: [ "withResolvers" + ], + es2025: [ + "try" ] })), Symbol: new Map(Object.entries({ @@ -16293,6 +16317,10 @@ ${lanes.join(` "entries", "keys", "values" + ], + esnext: [ + "getOrInsert", + "getOrInsertComputed" ] })), WeakSet: new Map(Object.entries({ @@ -16378,6 +16406,21 @@ ${lanes.join(` Intl: new Map(Object.entries({ es2018: [ "PluralRules" + ], + es2020: [ + "RelativeTimeFormat", + "Locale", + "DisplayNames" + ], + es2021: [ + "ListFormat", + "DateTimeFormat" + ], + es2022: [ + "Segmenter" + ], + es2025: [ + "DurationFormat" ] })), NumberFormat: new Map(Object.entries({ @@ -16402,7 +16445,7 @@ ${lanes.join(` "getBigInt64", "getBigUint64" ], - esnext: [ + es2025: [ "setFloat16", "getFloat16" ] @@ -16441,6 +16484,12 @@ ${lanes.join(` "toSorted", "toSpliced", "with" + ], + esnext: [ + "toBase64", + "setFromBase64", + "toHex", + "setFromHex" ] })), Uint8ClampedArray: new Map(Object.entries({ @@ -16509,7 +16558,7 @@ ${lanes.join(` ] })), Float16Array: new Map(Object.entries({ - esnext: emptyArray + es2025: emptyArray })), Float32Array: new Map(Object.entries({ es2022: [ @@ -16569,6 +16618,28 @@ ${lanes.join(` es2022: [ "cause" ] + })), + ErrorConstructor: new Map(Object.entries({ + esnext: [ + "isError" + ] + })), + Uint8ArrayConstructor: new Map(Object.entries({ + esnext: [ + "fromBase64", + "fromHex" + ] + })), + Date: new Map(Object.entries({ + esnext: [ + "toTemporalInstant" + ] + })), + DisposableStack: new Map(Object.entries({ + esnext: emptyArray + })), + AsyncDisposableStack: new Map(Object.entries({ + esnext: emptyArray })) }))); var GetLiteralTextFlags = /* @__PURE__ */ ((GetLiteralTextFlags2) => { @@ -16707,7 +16778,7 @@ ${lanes.join(` if (node.isDeclarationFile) { return false; } - if (getStrictOptionValue(compilerOptions, "alwaysStrict")) { + if (getAlwaysStrict(compilerOptions)) { return true; } if (startsWithUseStrict(node.statements)) { @@ -17250,12 +17321,15 @@ ${lanes.join(` function traverse(node) { switch (node.kind) { case 230: - visitor(node); - const operand = node.expression; - if (operand) { - traverse(operand); + const value = visitor(node); + if (value) { + return value; } - return; + const operand = node.expression; + if (!operand) { + return; + } + return traverse(operand); case 267: case 265: case 268: @@ -17264,11 +17338,10 @@ ${lanes.join(` default: if (isFunctionLike(node)) { if (node.name && node.name.kind === 168) { - traverse(node.name.expression); - return; + return traverse(node.name.expression); } } else if (!isPartOfTypeNode(node)) { - forEachChild(node, traverse); + return forEachChild(node, traverse); } } } @@ -17859,6 +17932,18 @@ ${lanes.join(` function isBindingElementOfBareOrAccessedRequire(node) { return isBindingElement(node) && isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } + function getModuleSpecifierOfBareOrAccessedRequire(node) { + if (isVariableDeclarationInitializedToRequire(node)) { + return node.initializer.arguments[0]; + } + if (isVariableDeclarationInitializedToBareOrAccessedRequire(node)) { + const leftmost = getLeftmostAccessExpression(node.initializer); + if (isRequireCall(leftmost, true)) { + return leftmost.arguments[0]; + } + } + return; + } function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) { return isVariableDeclaration(node) && !!node.initializer && isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, true); } @@ -19605,7 +19690,7 @@ ${lanes.join(` return true; if (!options.outDir) return false; - if (options.rootDir || options.composite && options.configFilePath) { + if (options.rootDir || options.configFilePath) { const commonDir = getNormalizedAbsolutePath(getCommonSourceDirectory(options, () => [], host.getCurrentDirectory(), host.getCanonicalFileName), host.getCurrentDirectory()); const outputPath = getSourceFilePathInNewDirWorker(sourceFile.fileName, options.outDir, host.getCurrentDirectory(), commonDir, host.getCanonicalFileName); if (comparePaths(sourceFile.fileName, outputPath, host.getCurrentDirectory(), !host.useCaseSensitiveFileNames()) === 0) @@ -20548,7 +20633,7 @@ ${lanes.join(` return (_a = symbol.declarations) == null ? undefined : _a.find(isClassLike); } function getObjectFlags(type) { - return type.flags & 3899393 ? type.objectFlags : 0; + return type.flags & 403963917 ? type.objectFlags : 0; } function isUMDExportSymbol(symbol) { return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]); @@ -21053,6 +21138,9 @@ ${lanes.join(` const moduleResolution = getEmitModuleResolutionKind(options); return 3 <= moduleResolution && moduleResolution <= 99 || getResolvePackageJsonExports(options) || getResolvePackageJsonImports(options); } + function usesWildcardTypes(options) { + return some(options.types, (t) => t === "*"); + } function createComputedCompilerOptions(options) { return options; } @@ -21064,44 +21152,54 @@ ${lanes.join(` } }, target: { - dependencies: ["module"], + dependencies: [], computeValue: (compilerOptions) => { const target = compilerOptions.target === 0 ? undefined : compilerOptions.target; - return target ?? (compilerOptions.module === 100 && 9 || compilerOptions.module === 101 && 9 || compilerOptions.module === 102 && 10 || compilerOptions.module === 199 && 99 || 1); + return target ?? 12; } }, module: { dependencies: ["target"], computeValue: (compilerOptions) => { - return typeof compilerOptions.module === "number" ? compilerOptions.module : _computedOptions.target.computeValue(compilerOptions) >= 2 ? 5 : 1; + if (typeof compilerOptions.module === "number") { + return compilerOptions.module; + } + const target = _computedOptions.target.computeValue(compilerOptions); + if (target === 99) { + return 99; + } + if (target >= 9) { + return 7; + } + if (target >= 7) { + return 6; + } + if (target >= 2) { + return 5; + } + return 1; } }, moduleResolution: { dependencies: ["module", "target"], computeValue: (compilerOptions) => { - let moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - switch (_computedOptions.module.computeValue(compilerOptions)) { - case 1: - moduleResolution = 2; - break; - case 100: - case 101: - case 102: - moduleResolution = 3; - break; - case 199: - moduleResolution = 99; - break; - case 200: - moduleResolution = 100; - break; - default: - moduleResolution = 1; - break; - } + if (compilerOptions.moduleResolution !== undefined) { + return compilerOptions.moduleResolution; } - return moduleResolution; + const moduleKind = _computedOptions.module.computeValue(compilerOptions); + switch (moduleKind) { + case 0: + case 2: + case 3: + case 4: + return 1; + case 199: + return 99; + } + if (100 <= moduleKind && moduleKind < 199) { + return 3; + } + return 100; } }, moduleDetection: { @@ -21121,33 +21219,25 @@ ${lanes.join(` } }, esModuleInterop: { - dependencies: ["module", "target"], + dependencies: [], computeValue: (compilerOptions) => { if (compilerOptions.esModuleInterop !== undefined) { return compilerOptions.esModuleInterop; } - switch (_computedOptions.module.computeValue(compilerOptions)) { - case 100: - case 101: - case 102: - case 199: - case 200: - return true; - } - return false; + return true; } }, allowSyntheticDefaultImports: { - dependencies: ["module", "target", "moduleResolution"], + dependencies: [], computeValue: (compilerOptions) => { if (compilerOptions.allowSyntheticDefaultImports !== undefined) { return compilerOptions.allowSyntheticDefaultImports; } - return _computedOptions.esModuleInterop.computeValue(compilerOptions) || _computedOptions.module.computeValue(compilerOptions) === 4 || _computedOptions.moduleResolution.computeValue(compilerOptions) === 100; + return true; } }, resolvePackageJsonExports: { - dependencies: ["moduleResolution"], + dependencies: ["moduleResolution", "module", "target"], computeValue: (compilerOptions) => { const moduleResolution = _computedOptions.moduleResolution.computeValue(compilerOptions); if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { @@ -21166,7 +21256,7 @@ ${lanes.join(` } }, resolvePackageJsonImports: { - dependencies: ["moduleResolution", "resolvePackageJsonExports"], + dependencies: ["moduleResolution", "resolvePackageJsonExports", "module", "target"], computeValue: (compilerOptions) => { const moduleResolution = _computedOptions.moduleResolution.computeValue(compilerOptions); if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { @@ -21277,9 +21367,9 @@ ${lanes.join(` } }, alwaysStrict: { - dependencies: ["strict"], + dependencies: [], computeValue: (compilerOptions) => { - return getStrictOptionValue(compilerOptions, "alwaysStrict"); + return compilerOptions.alwaysStrict !== false; } }, useUnknownInCatchVariables: { @@ -21307,6 +21397,7 @@ ${lanes.join(` var getAreDeclarationMapsEnabled = _computedOptions.declarationMap.computeValue; var getAllowJSCompilerOption = _computedOptions.allowJs.computeValue; var getUseDefineForClassFields = _computedOptions.useDefineForClassFields.computeValue; + var getAlwaysStrict = _computedOptions.alwaysStrict.computeValue; function emitModuleKindIsNonNodeESM(moduleKind) { return moduleKind >= 5 && moduleKind <= 99; } @@ -21319,12 +21410,6 @@ ${lanes.join(` } return true; } - function unreachableCodeIsError(options) { - return options.allowUnreachableCode === false; - } - function unusedLabelIsError(options) { - return options.allowUnusedLabels === false; - } function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) { return moduleResolution >= 3 && moduleResolution <= 99 || moduleResolution === 100; } @@ -21332,7 +21417,7 @@ ${lanes.join(` return 101 <= moduleKind && moduleKind <= 199 || moduleKind === 200 || moduleKind === 99; } function getStrictOptionValue(compilerOptions, flag) { - return compilerOptions[flag] === undefined ? !!compilerOptions.strict : !!compilerOptions[flag]; + return compilerOptions[flag] === undefined ? compilerOptions.strict !== false : !!compilerOptions[flag]; } function getNameOfScriptTarget(scriptTarget) { return forEachEntry(targetOptionDeclaration.type, (value, key) => value === scriptTarget ? key : undefined); @@ -21938,7 +22023,7 @@ ${lanes.join(` return skipTypeCheckingWorker(sourceFile, options, host, true); } function skipTypeCheckingWorker(sourceFile, options, host, ignoreNoCheck) { - return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib || !ignoreNoCheck && options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName) || !canIncludeBindAndCheckDiagnostics(sourceFile, options); + return options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && host.isSourceFileDefaultLibrary(sourceFile) || !ignoreNoCheck && options.noCheck || host.isSourceOfProjectReferenceRedirect(sourceFile.fileName) || !canIncludeBindAndCheckDiagnostics(sourceFile, options); } function canIncludeBindAndCheckDiagnostics(sourceFile, options) { if (!!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false) @@ -22244,7 +22329,7 @@ ${lanes.join(` if (node.kind !== 220) { const parameter = firstOrUndefined(node.parameters); if (!(parameter && parameterIsThisKeyword(parameter))) { - return true; + return !!(node.flags & 256); } } } @@ -22270,7 +22355,7 @@ ${lanes.join(` return !isMethodNamedNew && isIdentifierText(name, target) ? factory.createIdentifier(name) : !stringNamed && !isMethodNamedNew && isNumericLiteralName(name) && +name >= 0 ? factory.createNumericLiteral(+name) : factory.createStringLiteral(name, !!singleQuote); } function isThisTypeParameter(type) { - return !!(type.flags & 262144 && type.isThisType); + return !!(type.flags & 524288 && type.isThisType); } function getNodeModulePathParts(fullPath) { let topLevelNodeModulesIndex = 0; @@ -22412,13 +22497,13 @@ ${lanes.join(` return isIdentifier(node) ? idText(node) : getTextOfJsxNamespacedName(node); } function isTypeUsableAsPropertyName(type) { - return !!(type.flags & 8576); + return !!(type.flags & 19456); } function getPropertyNameFromType(type) { - if (type.flags & 8192) { + if (type.flags & 16384) { return type.escapedName; } - if (type.flags & (128 | 256)) { + if (type.flags & (1024 | 2048)) { return escapeLeadingUnderscores("" + type.value); } return Debug.fail(); @@ -23102,7 +23187,6 @@ ${lanes.join(` "stream/web", "string_decoder", "sys", - "test/mock_loader", "timers", "timers/promises", "tls", @@ -23119,6 +23203,7 @@ ${lanes.join(` ]; var unprefixedNodeCoreModules = new Set(unprefixedNodeCoreModulesList); var exclusivelyPrefixedNodeCoreModules = /* @__PURE__ */ new Set([ + "node:quic", "node:sea", "node:sqlite", "node:test", @@ -23269,6 +23354,21 @@ ${lanes.join(` function getFirstChild(node) { return forEachChild(node, (child) => child); } + function canHaveStatements(node) { + return isBlock(node) || isModuleBlock(node) || isSourceFile(node) || isCaseClause(node) || isDefaultClause(node); + } + function isPotentiallyExecutableNode(node) { + if (244 <= node.kind && node.kind <= 260) { + if (isVariableStatement(node)) { + if (getCombinedNodeFlags(node.declarationList) & 7) { + return true; + } + return some(node.declarationList.declarations, (d) => d.initializer !== undefined); + } + return true; + } + return isClassDeclaration(node) || isEnumDeclaration(node) || isModuleDeclaration(node); + } function createBaseNodeFactory() { let NodeConstructor2; let TokenConstructor2; @@ -27066,7 +27166,7 @@ ${lanes.join(` node.path = ""; node.resolvedPath = ""; node.originalFileName = ""; - node.languageVersion = 1; + node.languageVersion = 12; node.languageVariant = 0; node.scriptKind = 0; node.isDeclarationFile = false; @@ -27167,8 +27267,8 @@ ${lanes.join(` node.transformFlags = propagateChildrenFlags(node.statements) | propagateChildFlags(node.endOfFileToken); return node; } - function updateSourceFile2(node, statements, isDeclarationFile = node.isDeclarationFile, referencedFiles = node.referencedFiles, typeReferenceDirectives = node.typeReferenceDirectives, hasNoDefaultLib = node.hasNoDefaultLib, libReferenceDirectives = node.libReferenceDirectives) { - 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 updateSourceFile2(node, statements, isDeclarationFile = node.isDeclarationFile, referencedFiles = node.referencedFiles, typeReferenceDirectives = node.typeReferenceDirectives, _hasNoDefaultLib = false, libReferenceDirectives = node.libReferenceDirectives) { + return node.statements !== statements || node.isDeclarationFile !== isDeclarationFile || node.referencedFiles !== referencedFiles || node.typeReferenceDirectives !== typeReferenceDirectives || node.libReferenceDirectives !== libReferenceDirectives ? update(cloneSourceFileWithChanges(node, statements, isDeclarationFile, referencedFiles, typeReferenceDirectives, false, libReferenceDirectives), node) : node; } function createBundle(sourceFiles) { const node = createBaseNode(309); @@ -27176,7 +27276,6 @@ ${lanes.join(` node.syntheticFileReferences = undefined; node.syntheticTypeReferences = undefined; node.syntheticLibReferences = undefined; - node.hasNoDefaultLib = undefined; return node; } function updateBundle(node, sourceFiles) { @@ -35204,7 +35303,11 @@ ${lanes.join(` case 121: case 87: case 160: + return parseVariableStatement(pos, hasJSDoc, modifiersIn); case 135: + if (!isAwaitUsingDeclaration()) { + break; + } return parseVariableStatement(pos, hasJSDoc, modifiersIn); case 100: return parseFunctionDeclaration(pos, hasJSDoc, modifiersIn); @@ -35233,15 +35336,14 @@ ${lanes.join(` default: return parseExportDeclaration(pos, hasJSDoc, modifiersIn); } - default: - if (modifiersIn) { - const missing = createMissingNode(283, true, Diagnostics.Declaration_expected); - setTextRangePos(missing, pos); - missing.modifiers = modifiersIn; - return missing; - } - return; } + if (modifiersIn) { + const missing = createMissingNode(283, true, Diagnostics.Declaration_expected); + setTextRangePos(missing, pos); + missing.modifiers = modifiersIn; + return missing; + } + return; } function nextTokenIsStringLiteral() { return nextToken() === 11; @@ -35351,7 +35453,9 @@ ${lanes.join(` flags |= 4; break; case 135: - Debug.assert(isAwaitUsingDeclaration()); + if (!isAwaitUsingDeclaration()) { + break; + } flags |= 6; nextToken(); break; @@ -35862,7 +35966,7 @@ ${lanes.join(` } function tryParseImportAttributes() { const currentToken2 = token(); - if ((currentToken2 === 118 || currentToken2 === 132) && !scanner2.hasPrecedingLineBreak()) { + if (currentToken2 === 118 || currentToken2 === 132 && !scanner2.hasPrecedingLineBreak()) { return parseImportAttributes(currentToken2); } } @@ -37457,7 +37561,6 @@ ${lanes.join(` context.typeReferenceDirectives = []; context.libReferenceDirectives = []; context.amdDependencies = []; - context.hasNoDefaultLib = false; context.pragmas.forEach((entryOrList, key) => { switch (key) { case "reference": { @@ -37467,9 +37570,7 @@ ${lanes.join(` forEach(toArray(entryOrList), (arg) => { const { types, lib, path, ["resolution-mode"]: res, preserve: _preserve } = arg.arguments; const preserve = _preserve === "true" ? true : undefined; - if (arg.arguments["no-default-lib"] === "true") { - context.hasNoDefaultLib = true; - } else if (types) { + if (arg.arguments["no-default-lib"] === "true") {} else if (types) { const parsed = parseResolutionMode(res, types.pos, types.end, reportDiagnostic); typeReferenceDirectives.push({ pos: types.pos, end: types.end, fileName: types.value, ...parsed ? { resolutionMode: parsed } : {}, ...preserve ? { preserve } : {} }); } else if (lib) { @@ -37656,6 +37757,7 @@ ${lanes.join(` ["es2022", "lib.es2022.d.ts"], ["es2023", "lib.es2023.d.ts"], ["es2024", "lib.es2024.d.ts"], + ["es2025", "lib.es2025.d.ts"], ["esnext", "lib.esnext.d.ts"], ["dom", "lib.dom.d.ts"], ["dom.iterable", "lib.dom.iterable.d.ts"], @@ -37721,26 +37823,32 @@ ${lanes.join(` ["es2024.regexp", "lib.es2024.regexp.d.ts"], ["es2024.sharedmemory", "lib.es2024.sharedmemory.d.ts"], ["es2024.string", "lib.es2024.string.d.ts"], - ["esnext.array", "lib.es2023.array.d.ts"], - ["esnext.collection", "lib.esnext.collection.d.ts"], - ["esnext.symbol", "lib.es2019.symbol.d.ts"], + ["es2025.collection", "lib.es2025.collection.d.ts"], + ["es2025.float16", "lib.es2025.float16.d.ts"], + ["es2025.intl", "lib.es2025.intl.d.ts"], + ["es2025.iterator", "lib.es2025.iterator.d.ts"], + ["es2025.promise", "lib.es2025.promise.d.ts"], + ["es2025.regexp", "lib.es2025.regexp.d.ts"], ["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"], - ["esnext.intl", "lib.esnext.intl.d.ts"], - ["esnext.disposable", "lib.esnext.disposable.d.ts"], + ["esnext.symbol", "lib.es2019.symbol.d.ts"], ["esnext.bigint", "lib.es2020.bigint.d.ts"], - ["esnext.string", "lib.es2022.string.d.ts"], - ["esnext.promise", "lib.es2024.promise.d.ts"], ["esnext.weakref", "lib.es2021.weakref.d.ts"], - ["esnext.decorators", "lib.esnext.decorators.d.ts"], ["esnext.object", "lib.es2024.object.d.ts"], - ["esnext.array", "lib.esnext.array.d.ts"], ["esnext.regexp", "lib.es2024.regexp.d.ts"], ["esnext.string", "lib.es2024.string.d.ts"], - ["esnext.iterator", "lib.esnext.iterator.d.ts"], - ["esnext.promise", "lib.esnext.promise.d.ts"], - ["esnext.float16", "lib.esnext.float16.d.ts"], + ["esnext.float16", "lib.es2025.float16.d.ts"], + ["esnext.iterator", "lib.es2025.iterator.d.ts"], + ["esnext.promise", "lib.es2025.promise.d.ts"], + ["esnext.array", "lib.esnext.array.d.ts"], + ["esnext.collection", "lib.esnext.collection.d.ts"], + ["esnext.date", "lib.esnext.date.d.ts"], + ["esnext.decorators", "lib.esnext.decorators.d.ts"], + ["esnext.disposable", "lib.esnext.disposable.d.ts"], ["esnext.error", "lib.esnext.error.d.ts"], + ["esnext.intl", "lib.esnext.intl.d.ts"], ["esnext.sharedmemory", "lib.esnext.sharedmemory.d.ts"], + ["esnext.temporal", "lib.esnext.temporal.d.ts"], + ["esnext.typedarrays", "lib.esnext.typedarrays.d.ts"], ["decorators", "lib.decorators.d.ts"], ["decorators.legacy", "lib.decorators.legacy.d.ts"] ]; @@ -38033,18 +38141,19 @@ ${lanes.join(` es2022: 9, es2023: 10, es2024: 11, + es2025: 12, esnext: 99 })), affectsSourceFile: true, affectsModuleResolution: true, affectsEmit: true, affectsBuildInfo: true, - deprecatedKeys: /* @__PURE__ */ new Set(["es3"]), + deprecatedKeys: /* @__PURE__ */ new Set(["es3", "es5"]), paramType: Diagnostics.VERSION, showInSimplifiedHelpView: true, category: Diagnostics.Language_and_Environment, description: Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations, - defaultValueDescription: 1 + defaultValueDescription: 12 }; var moduleOptionDeclaration = { name: "module", @@ -38066,6 +38175,7 @@ ${lanes.join(` nodenext: 199, preserve: 200 })), + deprecatedKeys: /* @__PURE__ */ new Set(["none", "amd", "system", "umd"]), affectsSourceFile: true, affectsModuleResolution: true, affectsEmit: true, @@ -38129,6 +38239,15 @@ ${lanes.join(` description: Diagnostics.Print_names_of_files_that_are_part_of_the_compilation_and_then_stop_processing, defaultValueDescription: false }, + { + name: "ignoreConfig", + type: "boolean", + showInSimplifiedHelpView: true, + category: Diagnostics.Command_line_Options, + isCommandLineOnly: true, + description: Diagnostics.Ignore_the_tsconfig_found_and_build_with_commandline_options_and_files, + defaultValueDescription: false + }, targetOptionDeclaration, moduleOptionDeclaration, { @@ -38153,7 +38272,7 @@ ${lanes.join(` showInSimplifiedHelpView: true, category: Diagnostics.JavaScript_Support, description: Diagnostics.Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJs_option_to_get_errors_from_these_files, - defaultValueDescription: false + defaultValueDescription: Diagnostics.false_unless_checkJs_is_set }, { name: "checkJs", @@ -38324,7 +38443,7 @@ ${lanes.join(` affectsProgramStructure: true, category: Diagnostics.Language_and_Environment, description: Diagnostics.Enable_lib_replacement, - defaultValueDescription: true + defaultValueDescription: false }, { name: "strict", @@ -38333,7 +38452,7 @@ ${lanes.join(` showInSimplifiedHelpView: true, category: Diagnostics.Type_Checking, description: Diagnostics.Enable_all_strict_type_checking_options, - defaultValueDescription: false + defaultValueDescription: true }, { name: "noImplicitAny", @@ -38343,7 +38462,7 @@ ${lanes.join(` strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.Enable_error_reporting_for_expressions_and_declarations_with_an_implied_any_type, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: Diagnostics.true_unless_strict_is_false }, { name: "strictNullChecks", @@ -38353,7 +38472,7 @@ ${lanes.join(` strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.When_type_checking_take_into_account_null_and_undefined, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: Diagnostics.true_unless_strict_is_false }, { name: "strictFunctionTypes", @@ -38363,7 +38482,7 @@ ${lanes.join(` strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.When_assigning_functions_check_to_ensure_parameters_and_the_return_values_are_subtype_compatible, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: Diagnostics.true_unless_strict_is_false }, { name: "strictBindCallApply", @@ -38373,7 +38492,7 @@ ${lanes.join(` strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.Check_that_the_arguments_for_bind_call_and_apply_methods_match_the_original_function, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: Diagnostics.true_unless_strict_is_false }, { name: "strictPropertyInitialization", @@ -38383,7 +38502,7 @@ ${lanes.join(` strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: Diagnostics.true_unless_strict_is_false }, { name: "strictBuiltinIteratorReturn", @@ -38393,7 +38512,17 @@ ${lanes.join(` strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: Diagnostics.true_unless_strict_is_false + }, + { + name: "stableTypeOrdering", + type: "boolean", + affectsSemanticDiagnostics: true, + affectsBuildInfo: true, + showInHelp: false, + category: Diagnostics.Type_Checking, + description: Diagnostics.Ensure_types_are_ordered_stably_and_deterministically_across_compilations, + defaultValueDescription: false }, { name: "noImplicitThis", @@ -38403,7 +38532,7 @@ ${lanes.join(` strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.Enable_error_reporting_when_this_is_given_the_type_any, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: Diagnostics.true_unless_strict_is_false }, { name: "useUnknownInCatchVariables", @@ -38413,7 +38542,7 @@ ${lanes.join(` strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.Default_catch_clause_variables_as_unknown_instead_of_any, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: Diagnostics.true_unless_strict_is_false }, { name: "alwaysStrict", @@ -38421,10 +38550,9 @@ ${lanes.join(` affectsSourceFile: true, affectsEmit: true, affectsBuildInfo: true, - strictFlag: true, category: Diagnostics.Type_Checking, description: Diagnostics.Ensure_use_strict_is_always_emitted, - defaultValueDescription: Diagnostics.false_unless_strict_is_set + defaultValueDescription: true }, { name: "noUnusedLocals", @@ -38510,13 +38638,13 @@ ${lanes.join(` nodenext: 99, bundler: 100 })), - deprecatedKeys: /* @__PURE__ */ new Set(["node"]), + deprecatedKeys: /* @__PURE__ */ new Set(["node", "node10", "classic"]), affectsSourceFile: true, affectsModuleResolution: true, paramType: Diagnostics.STRATEGY, category: Diagnostics.Modules, description: Diagnostics.Specify_how_TypeScript_looks_up_a_file_from_a_given_module_specifier, - defaultValueDescription: Diagnostics.module_AMD_or_UMD_or_System_or_ES6_then_Classic_Otherwise_Node + defaultValueDescription: Diagnostics.nodenext_if_module_is_nodenext_node16_if_module_is_node16_or_node18_otherwise_bundler }, { name: "baseUrl", @@ -38585,7 +38713,7 @@ ${lanes.join(` affectsBuildInfo: true, category: Diagnostics.Interop_Constraints, description: Diagnostics.Allow_import_x_from_y_when_a_module_doesn_t_have_a_default_export, - defaultValueDescription: Diagnostics.module_system_or_esModuleInterop + defaultValueDescription: true }, { name: "esModuleInterop", @@ -38596,7 +38724,7 @@ ${lanes.join(` showInSimplifiedHelpView: true, category: Diagnostics.Interop_Constraints, description: Diagnostics.Emit_additional_JavaScript_to_ease_support_for_importing_CommonJS_modules_This_enables_allowSyntheticDefaultImports_for_type_compatibility, - defaultValueDescription: false + defaultValueDescription: true }, { name: "preserveSymlinks", @@ -38679,7 +38807,7 @@ ${lanes.join(` affectsBuildInfo: true, category: Diagnostics.Modules, description: Diagnostics.Check_side_effect_imports, - defaultValueDescription: false + defaultValueDescription: true }, { name: "sourceRoot", @@ -41082,7 +41210,7 @@ ${lanes.join(` const affectingLocations = []; let features = getNodeResolutionFeatures(options); if (resolutionMode !== undefined) { - features |= 30; + features |= 94; } const moduleResolution = getEmitModuleResolutionKind(options); if (resolutionMode === 99 && (3 <= moduleResolution && moduleResolution <= 99)) { @@ -41210,10 +41338,10 @@ ${lanes.join(` features = 30; break; case 99: - features = 30; + features = 94; break; case 100: - features = 30; + features = 94; break; } if (options.resolvePackageJsonExports) { @@ -41257,10 +41385,10 @@ ${lanes.join(` }); } function getAutomaticTypeDirectiveNames(options, host) { - if (options.types) { - return options.types; + if (!usesWildcardTypes(options)) { + return options.types ?? []; } - const result = []; + const wildcardMatches = []; if (host.directoryExists && host.getDirectories) { const typeRoots = getEffectiveTypeRoots(options, host); if (typeRoots) { @@ -41273,7 +41401,7 @@ ${lanes.join(` if (!isNotNeededPackage) { const baseFileName = getBaseFileName(normalized); if (baseFileName.charCodeAt(0) !== 46) { - result.push(baseFileName); + wildcardMatches.push(baseFileName); } } } @@ -41281,7 +41409,7 @@ ${lanes.join(` } } } - return result; + return deduplicate(flatten(options.types.map((t) => t === "*" ? wildcardMatches : t)), equateValues); } function isPackageJsonInfo(entry) { return !!(entry == null ? undefined : entry.contents); @@ -41766,10 +41894,11 @@ ${lanes.join(` NodeResolutionFeatures2[NodeResolutionFeatures2["SelfName"] = 4] = "SelfName"; NodeResolutionFeatures2[NodeResolutionFeatures2["Exports"] = 8] = "Exports"; NodeResolutionFeatures2[NodeResolutionFeatures2["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers"; - NodeResolutionFeatures2[NodeResolutionFeatures2["AllFeatures"] = 30] = "AllFeatures"; + NodeResolutionFeatures2[NodeResolutionFeatures2["ImportsPatternRoot"] = 64] = "ImportsPatternRoot"; + NodeResolutionFeatures2[NodeResolutionFeatures2["AllFeatures"] = 94] = "AllFeatures"; NodeResolutionFeatures2[NodeResolutionFeatures2["Node16Default"] = 30] = "Node16Default"; - NodeResolutionFeatures2[NodeResolutionFeatures2["NodeNextDefault"] = 30] = "NodeNextDefault"; - NodeResolutionFeatures2[NodeResolutionFeatures2["BundlerDefault"] = 30] = "BundlerDefault"; + NodeResolutionFeatures2[NodeResolutionFeatures2["NodeNextDefault"] = 94] = "NodeNextDefault"; + NodeResolutionFeatures2[NodeResolutionFeatures2["BundlerDefault"] = 94] = "BundlerDefault"; NodeResolutionFeatures2[NodeResolutionFeatures2["EsmMode"] = 32] = "EsmMode"; return NodeResolutionFeatures2; })(NodeResolutionFeatures || {}); @@ -41777,7 +41906,7 @@ ${lanes.join(` return nodeNextModuleNameResolverWorker(30, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode); } function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) { - return nodeNextModuleNameResolverWorker(30, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode); + return nodeNextModuleNameResolverWorker(94, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode); } function nodeNextModuleNameResolverWorker(features, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode, conditions) { const containingDirectory = getDirectoryPath(containingFile); @@ -41810,10 +41939,10 @@ ${lanes.join(` } else { extensions = getResolveJsonModule(compilerOptions) ? 1 | 2 | 4 | 8 : 1 | 2 | 4; } - return nodeModuleNameResolverWorker(conditions ? 30 : 0, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, !!isConfigLookup, redirectedReference, conditions); + return nodeModuleNameResolverWorker(conditions ? 94 : 0, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, !!isConfigLookup, redirectedReference, conditions); } function nodeNextJsonConfigResolver(moduleName, containingFile, host) { - return nodeModuleNameResolverWorker(30, moduleName, getDirectoryPath(containingFile), { moduleResolution: 99 }, host, undefined, 8, true, undefined, undefined); + return nodeModuleNameResolverWorker(94, moduleName, getDirectoryPath(containingFile), { moduleResolution: 99 }, host, undefined, 8, true, undefined, undefined); } function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, compilerOptions, host, cache, extensions, isConfigLookup, redirectedReference, conditions) { var _a, _b, _c, _d, _e; @@ -41869,7 +41998,7 @@ ${lanes.join(` const diagnosticState = { ...state, compilerOptions: diagnosticsCompilerOptions, - features: 30, + features: 94, conditions: getConditions(diagnosticsCompilerOptions), reportDiagnostic: noop }; @@ -42406,7 +42535,7 @@ ${lanes.join(` } function loadModuleFromImports(extensions, moduleName, directory, state, cache, redirectedReference) { var _a, _b; - if (moduleName === "#" || startsWith(moduleName, "#/")) { + if (moduleName === "#" || startsWith(moduleName, "#/") && !(state.features & 64)) { if (state.traceEnabled) { trace(state.host, Diagnostics.Invalid_import_specifier_0_has_no_possible_resolutions, moduleName); } @@ -42555,7 +42684,9 @@ ${lanes.join(` const subTarget = target[condition]; const result = loadModuleFromTargetExportOrImport(subTarget, subpath, pattern, key); if (result) { - traceIfEnabled(state, Diagnostics.Resolved_under_condition_0, condition); + if (result.value) { + traceIfEnabled(state, Diagnostics.Resolved_under_condition_0, condition); + } traceIfEnabled(state, Diagnostics.Exiting_conditional_exports); return result; } else { @@ -42585,7 +42716,7 @@ ${lanes.join(` if (state.traceEnabled) { trace(state.host, Diagnostics.package_json_scope_0_explicitly_maps_specifier_1_to_null, scope.packageDirectory, moduleName); } - return toSearchResult(undefined); + return { value: undefined }; } if (state.traceEnabled) { trace(state.host, Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName); @@ -42605,7 +42736,7 @@ ${lanes.join(` if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && !finalPath.includes("/node_modules/") && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames(state)) : true)) { const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames(state) }); const commonSourceDirGuesses = []; - if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) { + if (state.compilerOptions.rootDir || state.compilerOptions.configFilePath) { const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((_b2 = (_a2 = state.host).getCurrentDirectory) == null ? undefined : _b2.call(_a2)) || "", getCanonicalFileName)); commonSourceDirGuesses.push(commonDir); } else if (state.requestContainingDirectory) { @@ -43100,6 +43231,7 @@ ${lanes.join(` ContainerFlags2[ContainerFlags2["HasLocals"] = 32] = "HasLocals"; ContainerFlags2[ContainerFlags2["IsInterface"] = 64] = "IsInterface"; ContainerFlags2[ContainerFlags2["IsObjectLiteralOrClassExpressionMethodOrAccessor"] = 128] = "IsObjectLiteralOrClassExpressionMethodOrAccessor"; + ContainerFlags2[ContainerFlags2["PropagatesThisKeyword"] = 256] = "PropagatesThisKeyword"; return ContainerFlags2; })(ContainerFlags || {}); function createFlowNode(flags, node, antecedent) { @@ -43143,7 +43275,6 @@ ${lanes.join(` var Symbol48; var classifiableNames; var unreachableFlow = createFlowNode(1, undefined, undefined); - var reportedUnreachableFlow = createFlowNode(1, undefined, undefined); var bindBinaryExpressionFlow = createBindBinaryExpressionFlow(); return bindSourceFile2; function createDiagnosticForNode2(node, message, ...args) { @@ -43159,7 +43290,6 @@ ${lanes.join(` symbolCount = 0; Symbol48 = objectAllocator.getSymbolConstructor(); Debug.attachFlowNodeDebugInfo(unreachableFlow); - Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow); if (!file.locals) { (_a = tracing) == null || _a.push(tracing.Phase.Bind, "bindSourceFile", { path: file.path }, true); bind(file); @@ -43195,7 +43325,7 @@ ${lanes.join(` emitFlags = 0; } function bindInStrictMode(file2, opts) { - if (getStrictOptionValue(opts, "alwaysStrict") && !file2.isDeclarationFile) { + if (getAlwaysStrict(opts) && !file2.isDeclarationFile) { return true; } else { return !!file2.externalModuleIndicator; @@ -43436,6 +43566,7 @@ ${lanes.join(` const saveExceptionTarget = currentExceptionTarget; const saveActiveLabelList = activeLabelList; const saveHasExplicitReturn = hasExplicitReturn; + const saveSeenThisKeyword = seenThisKeyword; const isImmediatelyInvoked = containerFlags & 16 && !hasSyntacticModifier(node, 1024) && !node.asteriskToken && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 176; if (!isImmediatelyInvoked) { currentFlow = createFlowNode(2, undefined, undefined); @@ -43449,14 +43580,18 @@ ${lanes.join(` currentContinueTarget = undefined; activeLabelList = undefined; hasExplicitReturn = false; + seenThisKeyword = false; bindChildren(node); - node.flags &= ~5632; + node.flags &= ~(5632 | 256); if (!(currentFlow.flags & 1) && containerFlags & 8 && nodeIsPresent(node.body)) { node.flags |= 512; if (hasExplicitReturn) node.flags |= 1024; node.endFlowNode = currentFlow; } + if (seenThisKeyword) { + node.flags |= 256; + } if (node.kind === 308) { node.flags |= emitFlags; node.endFlowNode = currentFlow; @@ -43477,11 +43612,14 @@ ${lanes.join(` currentExceptionTarget = saveExceptionTarget; activeLabelList = saveActiveLabelList; hasExplicitReturn = saveHasExplicitReturn; + seenThisKeyword = containerFlags & 256 ? saveSeenThisKeyword || seenThisKeyword : saveSeenThisKeyword; } else if (containerFlags & 64) { + const saveSeenThisKeyword = seenThisKeyword; seenThisKeyword = false; bindChildren(node); Debug.assertNotNode(node, isIdentifier); node.flags = seenThisKeyword ? node.flags | 256 : node.flags & ~256; + seenThisKeyword = saveSeenThisKeyword; } else { bindChildren(node); } @@ -43506,16 +43644,22 @@ ${lanes.join(` function bindChildren(node) { const saveInAssignmentPattern = inAssignmentPattern; inAssignmentPattern = false; - if (checkUnreachable(node)) { - if (canHaveFlowNode(node) && node.flowNode) { + if (isPotentiallyExecutableNode(node)) { + node.flags &= ~1073741824; + } + if (currentFlow === unreachableFlow) { + if (canHaveFlowNode(node)) { node.flowNode = undefined; } + if (isPotentiallyExecutableNode(node)) { + node.flags |= 1073741824; + } bindEachChild(node); bindJSDoc(node); inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 244 && node.kind <= 260 && (!options.allowUnreachableCode || node.kind === 254)) { + if (244 <= node.kind && node.kind <= 260 && canHaveFlowNode(node)) { node.flowNode = currentFlow; } switch (node.kind) { @@ -44087,8 +44231,8 @@ ${lanes.join(` }; bind(node.label); bind(node.statement); - if (!activeLabelList.referenced && !options.allowUnusedLabels) { - errorOrSuggestionOnNode(unusedLabelIsError(options), node.label, Diagnostics.Unused_label); + if (!activeLabelList.referenced) { + node.label.flags |= 1073741824; } activeLabelList = activeLabelList.next; addAntecedent(postStatementLabel, currentFlow); @@ -44805,20 +44949,6 @@ ${lanes.join(` const span = getSpanOfTokenAtPosition(file, node.pos); file.bindDiagnostics.push(createFileDiagnostic(file, span.start, span.length, message, ...args)); } - function errorOrSuggestionOnNode(isError, node, message) { - errorOrSuggestionOnRange(isError, node, node, message); - } - function errorOrSuggestionOnRange(isError, startNode2, endNode2, message) { - addErrorOrSuggestionDiagnostic(isError, { pos: getTokenPosOfNode(startNode2, file), end: endNode2.end }, message); - } - function addErrorOrSuggestionDiagnostic(isError, range, message) { - const diag2 = createFileDiagnostic(file, range.pos, range.end - range.pos, message); - if (isError) { - file.bindDiagnostics.push(diag2); - } else { - file.bindSuggestionDiagnostics = append(file.bindSuggestionDiagnostics, { ...diag2, category: 2 }); - } - } function bind(node) { if (!node) { return; @@ -44890,6 +45020,9 @@ ${lanes.join(` break; } case 110: + if (node.kind === 110) { + seenThisKeyword = true; + } if (currentFlow && (isExpression(node) || parent2.kind === 305)) { node.flowNode = currentFlow; } @@ -45582,54 +45715,6 @@ ${lanes.join(` declareSymbolAndAddToSymbolTable(node, 262144, 526824); } } - function shouldReportErrorOnModuleDeclaration(node) { - const instanceState = getModuleInstanceState(node); - return instanceState === 1 || instanceState === 2 && shouldPreserveConstEnums(options); - } - function checkUnreachable(node) { - if (!(currentFlow.flags & 1)) { - return false; - } - if (currentFlow === unreachableFlow) { - const reportError = isStatementButNotDeclaration(node) && node.kind !== 243 || node.kind === 264 || isEnumDeclarationWithPreservedEmit(node, options) || node.kind === 268 && shouldReportErrorOnModuleDeclaration(node); - if (reportError) { - currentFlow = reportedUnreachableFlow; - if (!options.allowUnreachableCode) { - const isError = unreachableCodeIsError(options) && !(node.flags & 33554432) && (!isVariableStatement(node) || !!(getCombinedNodeFlags(node.declarationList) & 7) || node.declarationList.declarations.some((d) => !!d.initializer)); - eachUnreachableRange(node, options, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected)); - } - } - } - return true; - } - } - function isEnumDeclarationWithPreservedEmit(node, options) { - return node.kind === 267 && (!isEnumConst(node) || shouldPreserveConstEnums(options)); - } - function eachUnreachableRange(node, options, cb) { - if (isStatement(node) && isExecutableStatement(node) && isBlock(node.parent)) { - const { statements } = node.parent; - const slice = sliceAfter(statements, node); - getRangesWhere(slice, isExecutableStatement, (start, afterEnd) => cb(slice[start], slice[afterEnd - 1])); - } else { - cb(node, node); - } - function isExecutableStatement(s) { - return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && !(isVariableStatement(s) && !(getCombinedNodeFlags(s) & 7) && s.declarationList.declarations.some((d) => !d.initializer)); - } - function isPurelyTypeDeclaration(s) { - switch (s.kind) { - case 265: - case 266: - return true; - case 268: - return getModuleInstanceState(s) !== 1; - case 267: - return !isEnumDeclarationWithPreservedEmit(s, options); - default: - return false; - } - } } function isExportsOrModuleExportsOrAlias(sourceFile, node) { let i = 0; @@ -45681,6 +45766,8 @@ ${lanes.join(` } case 177: case 263: + case 176: + return 1 | 4 | 32 | 8; case 174: case 180: case 324: @@ -45688,13 +45775,13 @@ ${lanes.join(` case 185: case 181: case 186: - case 176: - return 1 | 4 | 32 | 8; + return 1 | 4 | 32 | 8 | 256; case 352: - return 1 | 4 | 32; + return 1 | 4 | 32 | 256; case 219: - case 220: return 1 | 4 | 32 | 8 | 16; + case 220: + return 1 | 4 | 32 | 8 | 16 | 256; case 269: return 4; case 173: @@ -45759,7 +45846,7 @@ ${lanes.join(` const shouldBail = visitSymbol(type.symbol); if (shouldBail) return; - if (type.flags & 524288) { + if (type.flags & 1048576) { const objectType = type; const objectFlags = objectType.objectFlags; if (objectFlags & 4) { @@ -45775,16 +45862,16 @@ ${lanes.join(` visitObjectType(objectType); } } - if (type.flags & 262144) { + if (type.flags & 524288) { visitTypeParameter(type); } - if (type.flags & 3145728) { + if (type.flags & 402653184) { visitUnionOrIntersectionType(type); } - if (type.flags & 4194304) { + if (type.flags & 2097152) { visitIndexType(type); } - if (type.flags & 8388608) { + if (type.flags & 33554432) { visitIndexedAccessType(type); } } @@ -46856,6 +46943,8 @@ ${lanes.join(` var currentNode; var varianceTypeParameter; var isInferencePartiallyBlocked = false; + var withinUnreachableCode = false; + var reportedUnreachableNodes; var emptySymbols = createSymbolTable(); var arrayVariances = [1]; var compilerOptions = host.getCompilerOptions(); @@ -46874,7 +46963,9 @@ ${lanes.join(` var noImplicitThis = getStrictOptionValue(compilerOptions, "noImplicitThis"); var useUnknownInCatchVariables = getStrictOptionValue(compilerOptions, "useUnknownInCatchVariables"); var exactOptionalPropertyTypes = compilerOptions.exactOptionalPropertyTypes; - var noUncheckedSideEffectImports = !!compilerOptions.noUncheckedSideEffectImports; + var noUncheckedSideEffectImports = compilerOptions.noUncheckedSideEffectImports !== false; + var stableTypeOrdering = !!compilerOptions.stableTypeOrdering; + var fileIndexMap = stableTypeOrdering ? new Map(host.getSourceFiles().map((file, i) => [file, i])) : undefined; var checkBinaryExpression = createCheckBinaryExpression(); var emitResolver = createResolver(); var nodeBuilder = createNodeBuilder(); @@ -47185,7 +47276,7 @@ ${lanes.join(` getSuggestedSymbolForNonexistentModule, getSuggestedSymbolForNonexistentClassMember, getBaseConstraintOfType, - getDefaultFromTypeParameter: (type) => type && type.flags & 262144 ? getDefaultFromTypeParameter(type) : undefined, + getDefaultFromTypeParameter: (type) => type && type.flags & 524288 ? getDefaultFromTypeParameter(type) : undefined, resolveName(name, location, meaning, excludeGlobals) { return resolveName(location, escapeLeadingUnderscores(name), meaning, undefined, false, excludeGlobals); }, @@ -47356,20 +47447,20 @@ ${lanes.join(` var nonInferrableAnyType = createIntrinsicType(1, "any", 65536, "non-inferrable"); var intrinsicMarkerType = createIntrinsicType(1, "intrinsic"); var unknownType = createIntrinsicType(2, "unknown"); - var undefinedType = createIntrinsicType(32768, "undefined"); - var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768, "undefined", 65536, "widening"); - var missingType = createIntrinsicType(32768, "undefined", undefined, "missing"); + var undefinedType = createIntrinsicType(4, "undefined"); + var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(4, "undefined", 65536, "widening"); + var missingType = createIntrinsicType(4, "undefined", undefined, "missing"); var undefinedOrMissingType = exactOptionalPropertyTypes ? missingType : undefinedType; - var optionalType = createIntrinsicType(32768, "undefined", undefined, "optional"); - var nullType = createIntrinsicType(65536, "null"); - var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(65536, "null", 65536, "widening"); - var stringType = createIntrinsicType(4, "string"); - var numberType = createIntrinsicType(8, "number"); - var bigintType = createIntrinsicType(64, "bigint"); - var falseType = createIntrinsicType(512, "false", undefined, "fresh"); - var regularFalseType = createIntrinsicType(512, "false"); - var trueType = createIntrinsicType(512, "true", undefined, "fresh"); - var regularTrueType = createIntrinsicType(512, "true"); + var optionalType = createIntrinsicType(4, "undefined", undefined, "optional"); + var nullType = createIntrinsicType(8, "null"); + var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(8, "null", 65536, "widening"); + var stringType = createIntrinsicType(32, "string"); + var numberType = createIntrinsicType(64, "number"); + var bigintType = createIntrinsicType(128, "bigint"); + var falseType = createIntrinsicType(8192, "false", undefined, "fresh"); + var regularFalseType = createIntrinsicType(8192, "false"); + var trueType = createIntrinsicType(8192, "true", undefined, "fresh"); + var regularTrueType = createIntrinsicType(8192, "true"); trueType.regularType = regularTrueType; trueType.freshType = trueType; regularTrueType.regularType = regularTrueType; @@ -47379,22 +47470,22 @@ ${lanes.join(` regularFalseType.regularType = regularFalseType; regularFalseType.freshType = falseType; var booleanType = getUnionType([regularFalseType, regularTrueType]); - var esSymbolType = createIntrinsicType(4096, "symbol"); - var voidType = createIntrinsicType(16384, "void"); - var neverType = createIntrinsicType(131072, "never"); - var silentNeverType = createIntrinsicType(131072, "never", 262144, "silent"); - var implicitNeverType = createIntrinsicType(131072, "never", undefined, "implicit"); - var unreachableNeverType = createIntrinsicType(131072, "never", undefined, "unreachable"); - var nonPrimitiveType = createIntrinsicType(67108864, "object"); + var esSymbolType = createIntrinsicType(512, "symbol"); + var voidType = createIntrinsicType(16, "void"); + var neverType = createIntrinsicType(262144, "never"); + var silentNeverType = createIntrinsicType(262144, "never", 262144, "silent"); + var implicitNeverType = createIntrinsicType(262144, "never", undefined, "implicit"); + var unreachableNeverType = createIntrinsicType(262144, "never", undefined, "unreachable"); + var nonPrimitiveType = createIntrinsicType(131072, "object"); var stringOrNumberType = getUnionType([stringType, numberType]); var stringNumberSymbolType = getUnionType([stringType, numberType, esSymbolType]); var numberOrBigIntType = getUnionType([numberType, bigintType]); var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]); var numericStringType = getTemplateLiteralType(["", ""], [numberType]); - var restrictiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 ? getRestrictiveTypeParameter(t) : t, () => "(restrictive mapper)"); - var permissiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 ? wildcardType : t, () => "(permissive mapper)"); - var uniqueLiteralType = createIntrinsicType(131072, "never", undefined, "unique literal"); - var uniqueLiteralMapper = makeFunctionTypeMapper((t) => t.flags & 262144 ? uniqueLiteralType : t, () => "(unique literal mapper)"); + var restrictiveMapper = makeFunctionTypeMapper((t) => t.flags & 524288 ? getRestrictiveTypeParameter(t) : t, () => "(restrictive mapper)"); + var permissiveMapper = makeFunctionTypeMapper((t) => t.flags & 524288 ? wildcardType : t, () => "(permissive mapper)"); + var uniqueLiteralType = createIntrinsicType(262144, "never", undefined, "unique literal"); + var uniqueLiteralMapper = makeFunctionTypeMapper((t) => t.flags & 524288 ? uniqueLiteralType : t, () => "(unique literal mapper)"); var outofbandVarianceMarkerHandler; var reportUnreliableMapper = makeFunctionTypeMapper((t) => { if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) { @@ -47452,7 +47543,6 @@ ${lanes.join(` } }; var anyIterationTypes = createIterationTypes(anyType, anyType, anyType); - var silentNeverIterationTypes = createIterationTypes(silentNeverType, silentNeverType, silentNeverType); var asyncIterationTypesResolver = { iterableCacheKey: "iterationTypesOfAsyncIterable", iteratorCacheKey: "iterationTypesOfAsyncIterator", @@ -47986,7 +48076,9 @@ ${lanes.join(` const targetSymbol = target.get(id); const merged = targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol); if (mergedParent && targetSymbol) { - merged.parent = mergedParent; + if (merged.flags & 33554432) { + merged.parent = mergedParent; + } } target.set(id, merged); }); @@ -48466,7 +48558,7 @@ ${lanes.join(` const container = findAncestor(node.parent, (n) => isComputedPropertyName(n) || isPropertySignature(n) ? false : isTypeLiteralNode(n) || "quit"); if (container && container.members.length === 1) { const type = getDeclaredTypeOfSymbol(symbol); - return !!(type.flags & 1048576) && allTypesAssignableToKind(type, 384, true); + return !!(type.flags & 134217728) && allTypesAssignableToKind(type, 3072, true); } return false; } @@ -48622,6 +48714,15 @@ ${lanes.join(` if (usageMode === 99 && targetMode === 99) { return false; } + if (!targetMode && file.isDeclarationFile) { + const redirect = host.getRedirectFromSourceFile(file.path) || host.getRedirectFromOutput(file.path); + if (redirect) { + const targetModuleKind = host.getEmitModuleFormatOfFile(file); + if (usageMode === 99 && 5 <= targetModuleKind && targetModuleKind <= 99) { + return false; + } + } + } } if (!allowSyntheticDefaultImports) { return false; @@ -49248,9 +49349,9 @@ ${lanes.join(` } } } - function resolveExternalModuleName(location, moduleReferenceExpression, ignoreErrors) { + function resolveExternalModuleName(location, moduleReferenceExpression, ignoreErrors, errorMessage) { const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1; - const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations; + errorMessage ?? (errorMessage = getCannotResolveModuleNameErrorForSpecificModule(moduleReferenceExpression) ?? (isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations)); return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? undefined : errorMessage, ignoreErrors); } function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, ignoreErrors = false, isForAugmentation = false) { @@ -49268,7 +49369,7 @@ ${lanes.join(` return ambientModule; } const currentSourceFile = getSourceFileOfNode(location); - const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : undefined) == null ? undefined : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : undefined) == null ? undefined : _b.argument.literal) || (isVariableDeclaration(location) && location.initializer && isRequireCall(location.initializer, true) ? location.initializer.arguments[0] : undefined) || ((_c = findAncestor(location, isImportCall)) == null ? undefined : _c.arguments[0]) || ((_d = findAncestor(location, or(isImportDeclaration, isJSDocImportTag, isExportDeclaration))) == null ? undefined : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? undefined : _e.moduleReference.expression); + const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : undefined) == null ? undefined : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : undefined) == null ? undefined : _b.argument.literal) || isVariableDeclarationInitializedToBareOrAccessedRequire(location) && getModuleSpecifierOfBareOrAccessedRequire(location) || ((_c = findAncestor(location, isImportCall)) == null ? undefined : _c.arguments[0]) || ((_d = findAncestor(location, or(isImportDeclaration, isJSDocImportTag, isExportDeclaration))) == null ? undefined : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? undefined : _e.moduleReference.expression); const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : host.getDefaultResolutionModeForFile(currentSourceFile); const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions); const resolvedModule = (_f = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? undefined : _f.resolvedModule; @@ -49479,7 +49580,7 @@ ${lanes.join(` const isEsmCjsRef = targetFile && isESMFormatImportImportingCommonjsFormatFile(usageMode, host.getImpliedNodeFormatForEmit(targetFile)); if (getESModuleInterop(compilerOptions) || isEsmCjsRef) { if (hasSignatures(type) || getPropertyOfType(type, "default", true) || isEsmCjsRef) { - const moduleType = type.flags & 3670016 ? getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference) : createDefaultPropertyWrapperForModule(symbol, symbol.parent); + const moduleType = type.flags & 403701760 ? getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference) : createDefaultPropertyWrapperForModule(symbol, symbol.parent); return cloneTypeAsModuleType(symbol, moduleType, referenceParent); } } @@ -49561,7 +49662,7 @@ ${lanes.join(` return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : undefined; } function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) { - return !(resolvedExternalModuleType.flags & 402784252 || getObjectFlags(resolvedExternalModuleType) & 1 || isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType)); + return !(resolvedExternalModuleType.flags & 12713980 || getObjectFlags(resolvedExternalModuleType) & 1 || isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType)); } function getExportsOfSymbol(symbol) { return symbol.flags & 6256 ? getResolvedMembersOrExportsOfSymbol(symbol, "resolvedExports") : symbol.flags & 1536 ? getExportsOfModule(symbol) : symbol.exports || emptySymbols; @@ -49746,7 +49847,7 @@ ${lanes.join(` if (enclosingDeclaration && container2.flags & getQualifiedLeftMeaning(meaning) && getAccessibleSymbolChain(container2, enclosingDeclaration, 1920, false)) { return append(concatenate(concatenate([container2], additionalContainers), reexportContainers), objectLiteralContainer); } - const firstVariableMatch = !(container2.flags & getQualifiedLeftMeaning(meaning)) && container2.flags & 788968 && getDeclaredTypeOfSymbol(container2).flags & 524288 && meaning === 111551 ? forEachSymbolTableInScope(enclosingDeclaration, (t) => { + const firstVariableMatch = !(container2.flags & getQualifiedLeftMeaning(meaning)) && container2.flags & 788968 && getDeclaredTypeOfSymbol(container2).flags & 1048576 && meaning === 111551 ? forEachSymbolTableInScope(enclosingDeclaration, (t) => { return forEachEntry(t, (s) => { if (s.flags & getQualifiedLeftMeaning(meaning) && getTypeOfSymbol(s) === getDeclaredTypeOfSymbol(container2)) { return s; @@ -49837,7 +49938,7 @@ ${lanes.join(` seenIntrinsicNames.add(key); } function createObjectType(objectFlags, symbol) { - const type = createTypeWithSymbol(524288, symbol); + const type = createTypeWithSymbol(1048576, symbol); type.objectFlags = objectFlags; type.members = undefined; type.properties = undefined; @@ -49847,28 +49948,64 @@ ${lanes.join(` return type; } function createTypeofType() { - return getUnionType(arrayFrom(typeofNEFacts.keys(), getStringLiteralType)); + return getUnionType(map(stableTypeOrdering ? [...typeofNEFacts.keys()].sort() : arrayFrom(typeofNEFacts.keys()), getStringLiteralType)); } function createTypeParameter(symbol) { - return createTypeWithSymbol(262144, symbol); + return createTypeWithSymbol(524288, symbol); } function isReservedMemberName(name) { return name.charCodeAt(0) === 95 && name.charCodeAt(1) === 95 && name.charCodeAt(2) !== 95 && name.charCodeAt(2) !== 64 && name.charCodeAt(2) !== 35; } - function getNamedMembers(members) { - let result; + function getNamedMembers(members, container) { + if (!stableTypeOrdering) { + let result; + members.forEach((symbol, id) => { + if (isNamedMember(symbol, id)) { + (result ?? (result = [])).push(symbol); + } + }); + return result ?? emptyArray; + } + if (members.size === 0) { + return emptyArray; + } + let contained; + if (container && container.flags & (32 | 64)) { + members.forEach((symbol, id) => { + if (isNamedMember(symbol, id) && isDeclarationContainedBy(symbol, container)) { + contained = append(contained, symbol); + } + }); + } + let nonContained; members.forEach((symbol, id) => { - if (isNamedMember(symbol, id)) { - (result || (result = [])).push(symbol); + if (isNamedMember(symbol, id) && (!container || !(container.flags & (32 | 64)) || !isDeclarationContainedBy(symbol, container))) { + nonContained = append(nonContained, symbol); } }); - return result || emptyArray; + contained == null || contained.sort(compareSymbols); + nonContained == null || nonContained.sort(compareSymbols); + return concatenate(contained, nonContained) ?? emptyArray; + function isDeclarationContainedBy(symbol, container2) { + const declaration = symbol.valueDeclaration; + if (declaration && container2.declarations) { + for (const d of container2.declarations) { + if (containedBy(declaration, d)) { + return true; + } + } + } + return false; + function containedBy(a, b) { + return b.pos <= a.pos && b.end >= a.end; + } + } } function isNamedMember(member, escapedName) { return !isReservedMemberName(escapedName) && symbolIsValue(member); } - function getNamedOrIndexSignatureMembers(members) { - const result = getNamedMembers(members); + function getNamedOrIndexSignatureMembers(members, symbol) { + const result = getNamedMembers(members, symbol); const index = getIndexSymbolFromSymbolTable(members); return index ? concatenate(result, [index]) : result; } @@ -49880,7 +50017,7 @@ ${lanes.join(` resolved.constructSignatures = constructSignatures; resolved.indexInfos = indexInfos; if (members !== emptySymbols) - resolved.properties = getNamedMembers(members); + resolved.properties = getNamedMembers(members, type.symbol); return resolved; } function createAnonymousType(symbol, members, callSignatures, constructSignatures, indexInfos) { @@ -50295,7 +50432,7 @@ ${lanes.join(` return flags & 848330095; } function isClassInstanceSide(type) { - return !!type.symbol && !!(type.symbol.flags & 32) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || !!(type.flags & 524288) && !!(getObjectFlags(type) & 16777216)); + return !!type.symbol && !!(type.symbol.flags & 32) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || !!(type.flags & 1048576) && !!(getObjectFlags(type) & 16777216)); } function getTypeFromTypeNodeWithoutContext(node) { return getTypeFromTypeNode(node); @@ -50424,7 +50561,7 @@ ${lanes.join(` if (name.includes("/node_modules/")) { context.encounteredError = true; if (context.tracker.reportLikelyUnsafeImportRequiredError) { - context.tracker.reportLikelyUnsafeImportRequiredError(name); + context.tracker.reportLikelyUnsafeImportRequiredError(name, nodeSymbol ? unescapeLeadingUnderscores(nodeSymbol.escapedName) : undefined); } } if (name !== originalName) { @@ -50515,7 +50652,7 @@ ${lanes.join(` return name; } const nameType = getSymbolLinks(symbol).nameType; - if (nameType && nameType.flags & (1024 | 8192)) { + if (nameType && nameType.flags & (32768 | 16384)) { context.enclosingDeclaration = nameType.symbol.valueDeclaration; return factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); } @@ -50572,7 +50709,7 @@ ${lanes.join(` return statements; } function withContext2(enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, cb, out) { - const moduleResolverHost = (tracker == null ? undefined : tracker.trackSymbol) ? tracker.moduleResolverHost : (internalFlags || 0) & 4 ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : undefined; + const moduleResolverHost = (tracker == null ? undefined : tracker.moduleResolverHost) ?? createBasicNodeBuilderModuleSpecifierResolutionHost(host); flags = flags || 0; const maxTruncationLength = maximumLength || (flags & 1 ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength); const context = { @@ -50720,23 +50857,23 @@ ${lanes.join(` if (type.flags & 2) { return factory.createKeywordTypeNode(159); } - if (type.flags & 4) { + if (type.flags & 32) { context.approximateLength += 6; return factory.createKeywordTypeNode(154); } - if (type.flags & 8) { + if (type.flags & 64) { context.approximateLength += 6; return factory.createKeywordTypeNode(150); } - if (type.flags & 64) { + if (type.flags & 128) { context.approximateLength += 6; return factory.createKeywordTypeNode(163); } - if (type.flags & 16 && !type.aliasSymbol) { + if (type.flags & 256 && !type.aliasSymbol) { context.approximateLength += 7; return factory.createKeywordTypeNode(136); } - if (type.flags & 1056) { + if (type.flags & 98304) { if (type.symbol.flags & 8) { const parentSymbol = getParentOfSymbol(type.symbol); const parentName = symbolToTypeNode(parentSymbol, context, 788968); @@ -50744,7 +50881,7 @@ ${lanes.join(` return parentName; } const memberName = symbolName(type.symbol); - if (isIdentifierText(memberName, 1)) { + if (isIdentifierText(memberName, 99)) { return appendReferenceToType(parentName, factory.createTypeReferenceNode(memberName, undefined)); } if (isImportTypeNode(parentName)) { @@ -50762,24 +50899,24 @@ ${lanes.join(` expandingEnum = true; } } - if (type.flags & 128) { + if (type.flags & 1024) { context.approximateLength += type.value.length + 2; return factory.createLiteralTypeNode(setEmitFlags(factory.createStringLiteral(type.value, !!(context.flags & 268435456)), 16777216)); } - if (type.flags & 256) { + if (type.flags & 2048) { const value = type.value; context.approximateLength += ("" + value).length; return factory.createLiteralTypeNode(value < 0 ? factory.createPrefixUnaryExpression(41, factory.createNumericLiteral(-value)) : factory.createNumericLiteral(value)); } - if (type.flags & 2048) { + if (type.flags & 4096) { context.approximateLength += pseudoBigIntToString(type.value).length + 1; return factory.createLiteralTypeNode(factory.createBigIntLiteral(type.value)); } - if (type.flags & 512) { + if (type.flags & 8192) { context.approximateLength += type.intrinsicName.length; return factory.createLiteralTypeNode(type.intrinsicName === "true" ? factory.createTrue() : factory.createFalse()); } - if (type.flags & 8192) { + if (type.flags & 16384) { if (!(context.flags & 1048576)) { if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) { context.approximateLength += 6; @@ -50792,27 +50929,27 @@ ${lanes.join(` context.approximateLength += 13; return factory.createTypeOperatorNode(158, factory.createKeywordTypeNode(155)); } - if (type.flags & 16384) { + if (type.flags & 16) { context.approximateLength += 4; return factory.createKeywordTypeNode(116); } - if (type.flags & 32768) { + if (type.flags & 4) { context.approximateLength += 9; return factory.createKeywordTypeNode(157); } - if (type.flags & 65536) { + if (type.flags & 8) { context.approximateLength += 4; return factory.createLiteralTypeNode(factory.createNull()); } - if (type.flags & 131072) { + if (type.flags & 262144) { context.approximateLength += 5; return factory.createKeywordTypeNode(146); } - if (type.flags & 4096) { + if (type.flags & 512) { context.approximateLength += 6; return factory.createKeywordTypeNode(155); } - if (type.flags & 67108864) { + if (type.flags & 131072) { context.approximateLength += 6; return factory.createKeywordTypeNode(151); } @@ -50840,15 +50977,15 @@ ${lanes.join(` } const objectFlags = getObjectFlags(type); if (objectFlags & 4) { - Debug.assert(!!(type.flags & 524288)); + Debug.assert(!!(type.flags & 1048576)); if (shouldExpandType(type, context)) { context.depth += 1; return createAnonymousTypeNode(type, true, true); } return type.node ? visitAndTransformType(type, typeReferenceToTypeNode) : typeReferenceToTypeNode(type); } - if (type.flags & 262144 || objectFlags & 3) { - if (type.flags & 262144 && contains(context.inferTypeParameters, type)) { + if (type.flags & 524288 || objectFlags & 3) { + if (type.flags & 524288 && contains(context.inferTypeParameters, type)) { context.approximateLength += symbolName(type.symbol).length + 6; let constraintNode; const constraint = getConstraintOfTypeParameter(type); @@ -50861,7 +50998,7 @@ ${lanes.join(` } return factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode)); } - if (context.flags & 4 && type.flags & 262144) { + if (context.flags & 4 && type.flags & 524288) { const name2 = typeParameterToName(type, context); context.approximateLength += idText(name2).length; return factory.createTypeReferenceNode(factory.createIdentifier(idText(name2)), undefined); @@ -50876,17 +51013,17 @@ ${lanes.join(` const name = (type === markerSuperTypeForCheck || type === markerSubTypeForCheck) && varianceTypeParameter && varianceTypeParameter.symbol ? (type === markerSubTypeForCheck ? "sub-" : "super-") + symbolName(varianceTypeParameter.symbol) : "?"; return factory.createTypeReferenceNode(factory.createIdentifier(name), undefined); } - if (type.flags & 1048576 && type.origin) { + if (type.flags & 134217728 && type.origin) { type = type.origin; } - if (type.flags & (1048576 | 2097152)) { - const types = type.flags & 1048576 ? formatUnionTypes(type.types, expandingEnum) : type.types; + if (type.flags & (134217728 | 268435456)) { + const types = type.flags & 134217728 ? formatUnionTypes(type.types, expandingEnum) : type.types; if (length(types) === 1) { return typeToTypeNodeHelper(types[0], context); } const typeNodes = mapToTypeNodes(types, context, true); if (typeNodes && typeNodes.length > 0) { - return type.flags & 1048576 ? factory.createUnionTypeNode(typeNodes) : factory.createIntersectionTypeNode(typeNodes); + return type.flags & 134217728 ? factory.createUnionTypeNode(typeNodes) : factory.createIntersectionTypeNode(typeNodes); } else { if (!context.encounteredError && !(context.flags & 262144)) { context.encounteredError = true; @@ -50895,16 +51032,16 @@ ${lanes.join(` } } if (objectFlags & (16 | 32)) { - Debug.assert(!!(type.flags & 524288)); + Debug.assert(!!(type.flags & 1048576)); return createAnonymousTypeNode(type); } - if (type.flags & 4194304) { + if (type.flags & 2097152) { const indexedType = type.type; context.approximateLength += 6; const indexTypeNode = typeToTypeNodeHelper(indexedType, context); return factory.createTypeOperatorNode(143, indexTypeNode); } - if (type.flags & 134217728) { + if (type.flags & 4194304) { const texts = type.texts; const types = type.types; const templateHead = factory.createTemplateHead(texts[0]); @@ -50912,20 +51049,20 @@ ${lanes.join(` context.approximateLength += 2; return factory.createTemplateLiteralType(templateHead, templateSpans); } - if (type.flags & 268435456) { + if (type.flags & 8388608) { const typeNode = typeToTypeNodeHelper(type.type, context); return symbolToTypeNode(type.symbol, context, 788968, [typeNode]); } - if (type.flags & 8388608) { + if (type.flags & 33554432) { const objectTypeNode = typeToTypeNodeHelper(type.objectType, context); const indexTypeNode = typeToTypeNodeHelper(type.indexType, context); context.approximateLength += 2; return factory.createIndexedAccessTypeNode(objectTypeNode, indexTypeNode); } - if (type.flags & 16777216) { + if (type.flags & 67108864) { return visitAndTransformType(type, (type2) => conditionalTypeToTypeNode(type2)); } - if (type.flags & 33554432) { + if (type.flags & 16777216) { const typeNode = typeToTypeNodeHelper(type.baseType, context); const noInferSymbol = isNoInferType(type) && getGlobalTypeSymbol("NoInfer", false); return noInferSymbol ? symbolToTypeNode(noInferSymbol, context, 788968, [typeNode]) : typeNode; @@ -50934,7 +51071,7 @@ ${lanes.join(` function conditionalTypeToTypeNode(type2) { const checkTypeNode = typeToTypeNodeHelper(type2.checkType, context); context.approximateLength += 15; - if (context.flags & 4 && type2.root.isDistributive && !(type2.checkType.flags & 262144)) { + if (context.flags & 4 && type2.root.isDistributive && !(type2.checkType.flags & 524288)) { const newParam = createTypeParameter(createSymbol(262144, "T")); const name = typeParameterToName(newParam, context); const newTypeVariable = factory.createTypeReferenceNode(name); @@ -50958,7 +51095,7 @@ ${lanes.join(` } function typeToTypeNodeOrCircularityElision(type2) { var _a2, _b2, _c; - if (type2.flags & 1048576) { + if (type2.flags & 134217728) { if ((_a2 = context.visitedTypes) == null ? undefined : _a2.has(getTypeId(type2))) { if (!(context.flags & 131072)) { context.encounteredError = true; @@ -50978,14 +51115,14 @@ ${lanes.join(` } function createMappedTypeNodeFromType(type2) { var _a2; - Debug.assert(!!(type2.flags & 524288)); + Debug.assert(!!(type2.flags & 1048576)); const readonlyToken = type2.declaration.readonlyToken ? factory.createToken(type2.declaration.readonlyToken.kind) : undefined; const questionToken = type2.declaration.questionToken ? factory.createToken(type2.declaration.questionToken.kind) : undefined; let appropriateConstraintTypeNode; let newTypeVariable; let templateType = getTemplateTypeFromMappedType(type2); const typeParameter = getTypeParameterFromMappedType(type2); - const needsModifierPreservingWrapper = !isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 2) && context.flags & 4 && !(getConstraintTypeFromMappedType(type2).flags & 262144 && ((_a2 = getConstraintOfTypeParameter(getConstraintTypeFromMappedType(type2))) == null ? undefined : _a2.flags) & 4194304); + const needsModifierPreservingWrapper = !isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 2) && context.flags & 4 && !(getConstraintTypeFromMappedType(type2).flags & 524288 && ((_a2 = getConstraintOfTypeParameter(getConstraintTypeFromMappedType(type2))) == null ? undefined : _a2.flags) & 2097152); if (isMappedTypeWithKeyofConstraintDeclaration(type2)) { if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4) { const newConstraintParam = createTypeParameter(createSymbol(262144, "T")); @@ -51075,7 +51212,7 @@ ${lanes.join(` var _a2, _b2, _c; const typeId = type2.id; const isConstructorObject = getObjectFlags(type2) & 16 && type2.symbol && type2.symbol.flags & 32; - const id = getObjectFlags(type2) & 4 && type2.node ? "N" + getNodeId(type2.node) : type2.flags & 16777216 ? "N" + getNodeId(type2.root.node) : type2.symbol ? (isConstructorObject ? "+" : "") + getSymbolId(type2.symbol) : undefined; + const id = getObjectFlags(type2) & 4 && type2.node ? "N" + getNodeId(type2.node) : type2.flags & 67108864 ? "N" + getNodeId(type2.root.node) : type2.symbol ? (isConstructorObject ? "+" : "") + getSymbolId(type2.symbol) : undefined; if (!context.visitedTypes) { context.visitedTypes = /* @__PURE__ */ new Set; } @@ -51372,6 +51509,9 @@ ${lanes.join(` if (getDeclarationModifierFlagsFromSymbol(propertySymbol) & (2 | 4) && context.tracker.reportPrivateInBaseOfClassExpression) { context.tracker.reportPrivateInBaseOfClassExpression(unescapeLeadingUnderscores(propertySymbol.escapedName)); } + if (isPrivateIdentifierSymbol(propertySymbol) && context.tracker.reportPrivateInBaseOfClassExpression) { + context.tracker.reportPrivateInBaseOfClassExpression(idText(propertySymbol.valueDeclaration.name)); + } } if (checkTruncationLength(context) && i + 2 < properties.length - 1) { context.out.truncated = true; @@ -51473,7 +51613,7 @@ ${lanes.join(` } const optionalToken = propertySymbol.flags & 16777216 ? factory.createToken(58) : undefined; if (propertySymbol.flags & (16 | 8192) && !getPropertiesOfObjectType(propertyType).length && !isReadonlySymbol(propertySymbol)) { - const signatures = getSignaturesOfType(filterType(propertyType, (t) => !(t.flags & 32768)), 0); + const signatures = getSignaturesOfType(filterType(propertyType, (t) => !(t.flags & 4)), 0); for (const signature of signatures) { const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 174, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration, signature.declaration || propertySymbol.valueDeclaration)); @@ -51655,8 +51795,8 @@ ${lanes.join(` reportInaccessibleUniqueSymbolError() { markError(() => oldTracker.reportInaccessibleUniqueSymbolError()); }, - reportLikelyUnsafeImportRequiredError(specifier) { - markError(() => oldTracker.reportLikelyUnsafeImportRequiredError(specifier)); + reportLikelyUnsafeImportRequiredError(specifier, symbolName2) { + markError(() => oldTracker.reportLikelyUnsafeImportRequiredError(specifier, symbolName2)); }, reportNonSerializableProperty(name) { markError(() => oldTracker.reportNonSerializableProperty(name)); @@ -52088,7 +52228,7 @@ ${lanes.join(` if (!attributes) { context.encounteredError = true; if (context.tracker.reportLikelyUnsafeImportRequiredError) { - context.tracker.reportLikelyUnsafeImportRequiredError(oldSpecifier); + context.tracker.reportLikelyUnsafeImportRequiredError(oldSpecifier, unescapeLeadingUnderscores(symbol.escapedName)); } } } @@ -52304,11 +52444,11 @@ ${lanes.join(` } if (isComputedPropertyName(name)) { const type = checkExpression(name.expression); - return !!(type.flags & 402653316); + return !!(type.flags & 12583968); } if (isElementAccessExpression(name)) { const type = checkExpression(name.argumentExpression); - return !!(type.flags & 402653316); + return !!(type.flags & 12583968); } return isStringLiteral(name); } @@ -52319,14 +52459,7 @@ ${lanes.join(` function getPropertyNameNodeForSymbol(symbol, context) { const hashPrivateName = getClonedHashPrivateName(symbol); if (hashPrivateName) { - const shouldEmitErroneousFieldName = !!context.tracker.reportPrivateInBaseOfClassExpression && context.flags & 2048; - if (!shouldEmitErroneousFieldName) { - return hashPrivateName; - } else { - let rawName2 = unescapeLeadingUnderscores(symbol.escapedName); - rawName2 = rawName2.replace(/__#\d+@#/g, "__#private@#"); - return createPropertyNameNodeForIdentifierOrLiteral(rawName2, getEmitScriptTarget(compilerOptions), false, true, !!(symbol.flags & 8192)); - } + return hashPrivateName; } const stringNamed = !!length(symbol.declarations) && every(symbol.declarations, isStringNamed); const singleQuote = !!length(symbol.declarations) && every(symbol.declarations, isSingleQuotedStringNamed); @@ -52341,7 +52474,7 @@ ${lanes.join(` function getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed, isMethod) { const nameType = getSymbolLinks(symbol).nameType; if (nameType) { - if (nameType.flags & 384) { + if (nameType.flags & 3072) { const name = "" + nameType.value; if (!isIdentifierText(name, getEmitScriptTarget(compilerOptions)) && (stringNamed || !isNumericLiteralName(name))) { return factory.createStringLiteral(name, !!singleQuote); @@ -52351,7 +52484,7 @@ ${lanes.join(` } return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod); } - if (nameType.flags & 8192) { + if (nameType.flags & 16384) { return factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, 111551)); } } @@ -52396,7 +52529,7 @@ ${lanes.join(` return enclosingDeclaration; } function serializeInferredTypeForDeclaration(symbol, context, type) { - if (type.flags & 8192 && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === context.enclosingFile))) { + if (type.flags & 16384 && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === context.enclosingFile))) { context.flags |= 1048576; } const result = typeToTypeNodeHelper(type, context); @@ -52572,7 +52705,7 @@ ${lanes.join(` } function serializeExistingTypeNode(context, typeNode, addUndefined) { const type = getTypeFromTypeNode2(context, typeNode); - if (addUndefined && !someType(type, (t) => !!(t.flags & 32768)) && canReuseTypeNode(context, typeNode)) { + if (addUndefined && !someType(type, (t) => !!(t.flags & 4)) && canReuseTypeNode(context, typeNode)) { const clone2 = syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode); if (clone2) { return factory.createUnionTypeNode([clone2, factory.createKeywordTypeNode(157)]); @@ -53705,10 +53838,10 @@ ${lanes.join(` for (let i = 0;i < types.length; i++) { const t = types[i]; flags |= t.flags; - if (!(t.flags & 98304)) { - if (t.flags & 512 || !expandingEnum && t.flags | 1056) { - const baseType = t.flags & 512 ? booleanType : getBaseTypeOfEnumLikeType(t); - if (baseType.flags & 1048576) { + if (!(t.flags & 12)) { + if (t.flags & 8192 || !expandingEnum && t.flags | 98304) { + const baseType = t.flags & 8192 ? booleanType : getBaseTypeOfEnumLikeType(t); + if (baseType.flags & 134217728) { const count = baseType.types.length; if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) { result.push(baseType); @@ -53720,9 +53853,9 @@ ${lanes.join(` result.push(t); } } - if (flags & 65536) + if (flags & 8) result.push(nullType); - if (flags & 32768) + if (flags & 4) result.push(undefinedType); return result || types; } @@ -53753,7 +53886,7 @@ ${lanes.join(` function getNameOfSymbolFromNameType(symbol, context) { const nameType = getSymbolLinks(symbol).nameType; if (nameType) { - if (nameType.flags & 384) { + if (nameType.flags & 3072) { const name = "" + nameType.value; if (!isIdentifierText(name, getEmitScriptTarget(compilerOptions)) && !isNumericLiteralName(name)) { return `"${escapeString(name, 34)}"`; @@ -53763,7 +53896,7 @@ ${lanes.join(` } return name; } - if (nameType.flags & 8192) { + if (nameType.flags & 16384) { return `[${getNameOfSymbolAsWritten(nameType.symbol, context)}]`; } } @@ -53785,7 +53918,7 @@ ${lanes.join(` } if (isComputedPropertyName(name2) && !(getCheckFlags(symbol) & 4096)) { const nameType = getSymbolLinks(symbol).nameType; - if (nameType && nameType.flags & 384) { + if (nameType && nameType.flags & 3072) { const result = getNameOfSymbolFromNameType(symbol, context); if (result !== undefined) { return result; @@ -54022,18 +54155,18 @@ ${lanes.join(` return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false, checkMode); } function getRestType(source, properties, symbol) { - source = filterType(source, (t) => !(t.flags & 98304)); - if (source.flags & 131072) { + source = filterType(source, (t) => !(t.flags & 12)); + if (source.flags & 262144) { return emptyObjectType; } - if (source.flags & 1048576) { + if (source.flags & 134217728) { return mapType(source, (t) => getRestType(t, properties, symbol)); } let omitKeyType = getUnionType(map(properties, getLiteralTypeFromPropertyName)); const spreadableProperties = []; const unspreadableToRestKeys = []; for (const prop of getPropertiesOfType(source)) { - const literalTypeFromProperty = getLiteralTypeFromProperty(prop, 8576); + const literalTypeFromProperty = getLiteralTypeFromProperty(prop, 19456); if (!isTypeAssignableTo(literalTypeFromProperty, omitKeyType) && !(getDeclarationModifierFlagsFromSymbol(prop) & (2 | 4)) && isSpreadableProperty(prop)) { spreadableProperties.push(prop); } else { @@ -54044,7 +54177,7 @@ ${lanes.join(` if (unspreadableToRestKeys.length) { omitKeyType = getUnionType([omitKeyType, ...unspreadableToRestKeys]); } - if (omitKeyType.flags & 131072) { + if (omitKeyType.flags & 262144) { return source; } const omitTypeAlias = getGlobalOmitSymbol(); @@ -54062,10 +54195,10 @@ ${lanes.join(` return result; } function isGenericTypeWithUndefinedConstraint(type) { - return !!(type.flags & 465829888) && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 32768); + return !!(type.flags & 132644864) && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 4); } function getNonUndefinedType(type) { - const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags & 465829888 ? getBaseConstraintOrType(t) : t) : type; + const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags & 132644864 ? getBaseConstraintOrType(t) : t) : type; return getTypeWithFacts(typeOrConstraint, 524288); } function getFlowTypeOfDestructuring(node, declaredType) { @@ -54116,7 +54249,7 @@ ${lanes.join(` } function getLiteralPropertyNameText(name) { const type = getLiteralTypeFromPropertyName(name); - return type.flags & (128 | 256) ? "" + type.value : undefined; + return type.flags & (1024 | 2048) ? "" + type.value : undefined; } function getTypeForBindingElement(declaration) { const checkMode = declaration.dotDotDotToken ? 32 : 0; @@ -54159,7 +54292,7 @@ ${lanes.join(` const elementType = checkIteratedTypeOrElementType(65 | (declaration.dotDotDotToken ? 0 : 128), parentType, undefinedType, pattern); const index = pattern.elements.indexOf(declaration); if (declaration.dotDotDotToken) { - const baseConstraint = mapType(parentType, (t) => t.flags & 58982400 ? getBaseConstraintOrType(t) : t); + const baseConstraint = mapType(parentType, (t) => t.flags & 117964800 ? getBaseConstraintOrType(t) : t); type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType); } else if (isArrayLikeType(parentType)) { const indexType = getNumberLiteralType(index); @@ -54198,7 +54331,7 @@ ${lanes.join(` function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === 250) { const indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, checkMode))); - return indexType.flags & (262144 | 4194304) ? getExtractStringType(indexType) : stringType; + return indexType.flags & (524288 | 2097152) ? getExtractStringType(indexType) : stringType; } if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === 251) { const forOfStatement = declaration.parent.parent; @@ -54407,12 +54540,12 @@ ${lanes.join(` definedInConstructor = true; } } - const sourceTypes = some(constructorTypes, (t) => !!(t.flags & ~98304)) ? constructorTypes : types; + const sourceTypes = some(constructorTypes, (t) => !!(t.flags & ~12)) ? constructorTypes : types; type = getUnionType(sourceTypes); } } const widened = getWidenedType(addOptionality(type, false, definedInMethod && !definedInConstructor)); - if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304)) === neverType) { + if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~12)) === neverType) { reportImplicitAny(symbol.valueDeclaration, anyType); return anyType; } @@ -54495,7 +54628,7 @@ ${lanes.join(` } const isDirectExport = kind === 1 && (isPropertyAccessExpression(expression.left) || isElementAccessExpression(expression.left)) && (isModuleExportsAccessExpression(expression.left.expression) || isIdentifier(expression.left.expression) && isExportsIdentifier(expression.left.expression)); const type = resolvedSymbol ? getTypeOfSymbol(resolvedSymbol) : isDirectExport ? getRegularTypeOfLiteralType(checkExpressionCached(expression.right)) : getWidenedLiteralType(checkExpressionCached(expression.right)); - if (type.flags & 524288 && kind === 2 && symbol.escapedName === "export=") { + if (type.flags & 1048576 && kind === 2 && symbol.escapedName === "export=") { const exportedType = resolveStructuredTypeMembers(type); const members = createSymbolTable(); copyEntries(exportedType.members, members); @@ -54661,13 +54794,13 @@ ${lanes.join(` } function widenTypeForVariableLikeDeclaration(type, declaration, reportErrors2) { if (type) { - if (type.flags & 4096 && isGlobalSymbolConstructor(declaration.parent)) { + if (type.flags & 512 && isGlobalSymbolConstructor(declaration.parent)) { type = getESSymbolLikeTypeForNode(declaration); } if (reportErrors2) { reportErrorsFromWidening(declaration, type); } - if (type.flags & 8192 && (isBindingElement(declaration) || !tryGetTypeFromEffectiveTypeNode(declaration)) && type.symbol !== getSymbolOfDeclaration(declaration)) { + if (type.flags & 16384 && (isBindingElement(declaration) || !tryGetTypeFromEffectiveTypeNode(declaration)) && type.symbol !== getSymbolOfDeclaration(declaration)) { type = esSymbolType; } return getWidenedType(type); @@ -54874,7 +55007,7 @@ ${lanes.join(` } function getBaseTypeVariableOfClass(symbol) { const baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol)); - return baseConstructorType.flags & 8650752 ? baseConstructorType : baseConstructorType.flags & 2097152 ? find(baseConstructorType.types, (t) => !!(t.flags & 8650752)) : undefined; + return baseConstructorType.flags & 34078720 ? baseConstructorType : baseConstructorType.flags & 268435456 ? find(baseConstructorType.types, (t) => !!(t.flags & 34078720)) : undefined; } function getTypeOfFuncClassEnumModule(symbol) { let links = getSymbolLinks(symbol); @@ -54972,7 +55105,7 @@ ${lanes.join(` if (!links.type) { Debug.assertIsDefined(links.deferralParent); Debug.assertIsDefined(links.deferralConstituents); - links.type = links.deferralParent.flags & 1048576 ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents); + links.type = links.deferralParent.flags & 134217728 ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents); } return links.type; } @@ -54981,7 +55114,7 @@ ${lanes.join(` if (!links.writeType && links.deferralWriteConstituents) { Debug.assertIsDefined(links.deferralParent); Debug.assertIsDefined(links.deferralConstituents); - links.writeType = links.deferralParent.flags & 1048576 ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents); + links.writeType = links.deferralParent.flags & 134217728 ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents); } return links.writeType; } @@ -55055,7 +55188,7 @@ ${lanes.join(` if (getObjectFlags(type2) & (3 | 4)) { const target = getTargetType(type2); return target === checkBase || some(getBaseTypes(target), check); - } else if (type2.flags & 2097152) { + } else if (type2.flags & 268435456) { return some(type2.types, check); } return false; @@ -55179,7 +55312,7 @@ ${lanes.join(` if (getSignaturesOfType(type, 1).length > 0) { return true; } - if (type.flags & 8650752) { + if (type.flags & 34078720) { const constraint = getBaseConstraintOfType(type); return !!constraint && isMixinConstructorType(constraint); } @@ -55215,7 +55348,7 @@ ${lanes.join(` Debug.assert(!extended.typeArguments); checkExpression(extended.expression); } - if (baseConstructorType.flags & (524288 | 2097152)) { + if (baseConstructorType.flags & (1048576 | 268435456)) { resolveStructuredTypeMembers(baseConstructorType); } if (!popTypeResolution()) { @@ -55224,7 +55357,7 @@ ${lanes.join(` } if (!(baseConstructorType.flags & 1) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) { const err = error2(baseTypeNode.expression, Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType)); - if (baseConstructorType.flags & 262144) { + if (baseConstructorType.flags & 524288) { const constraint = getConstraintFromTypeParameter(baseConstructorType); let ctorReturn = unknownType; if (constraint) { @@ -55268,6 +55401,9 @@ ${lanes.join(` error2(node, Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 2)); } function getBaseTypes(type) { + if (!(getObjectFlags(type) & (3 | 4))) { + return emptyArray; + } if (!type.baseTypesResolved) { if (pushTypeResolution(type, 6)) { if (type.objectFlags & 8) { @@ -55301,7 +55437,7 @@ ${lanes.join(` function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = resolvingEmptyArray; const baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type)); - if (!(baseConstructorType.flags & (524288 | 2097152 | 1))) { + if (!(baseConstructorType.flags & (1048576 | 268435456 | 1))) { return type.resolvedBaseTypes = emptyArray; } const baseTypeNode = getBaseTypeNodeOfClass(type); @@ -55348,13 +55484,13 @@ ${lanes.join(` return true; } function isValidBaseType(type) { - if (type.flags & 262144) { + if (type.flags & 524288) { const constraint = getBaseConstraintOfType(type); if (constraint) { return isValidBaseType(constraint); } } - return !!(type.flags & (524288 | 67108864 | 1) && !isGenericMappedType(type) || type.flags & 2097152 && every(type.types, isValidBaseType)); + return !!(type.flags & (1048576 | 131072 | 1) && !isGenericMappedType(type) || type.flags & 268435456 && every(type.types, isValidBaseType)); } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; @@ -55469,7 +55605,7 @@ ${lanes.join(` return links.declaredType; } function getBaseTypeOfEnumLikeType(type) { - return type.flags & 1056 && type.symbol.flags & 8 ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type; + return type.flags & 98304 && type.symbol.flags & 8 ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type; } function getDeclaredTypeOfEnum(symbol) { const links = getSymbolLinks(symbol); @@ -55491,8 +55627,8 @@ ${lanes.join(` } } const enumType = memberTypeList.length ? getUnionType(memberTypeList, 1, symbol, undefined) : createComputedEnumType(symbol); - if (enumType.flags & 1048576) { - enumType.flags |= 1024; + if (enumType.flags & 134217728) { + enumType.flags |= 32768; enumType.symbol = symbol; } links.declaredType = enumType; @@ -55500,8 +55636,8 @@ ${lanes.join(` return links.declaredType; } function createComputedEnumType(symbol) { - const regularType = createTypeWithSymbol(32, symbol); - const freshType = createTypeWithSymbol(32, symbol); + const regularType = createTypeWithSymbol(65536, symbol); + const freshType = createTypeWithSymbol(65536, symbol); regularType.regularType = regularType; regularType.freshType = freshType; freshType.regularType = regularType; @@ -55630,7 +55766,7 @@ ${lanes.join(` if (!type.declaredProperties) { const symbol = type.symbol; const members = getMembersOfSymbol(symbol); - type.declaredProperties = getNamedMembers(members); + type.declaredProperties = getNamedMembers(members, symbol); type.declaredCallSignatures = emptyArray; type.declaredConstructSignatures = emptyArray; type.declaredIndexInfos = emptyArray; @@ -55702,7 +55838,7 @@ ${lanes.join(` const earlySymbol = earlySymbols && earlySymbols.get(memberName); if (!(parent2.flags & 32) && lateSymbol.flags & getExcludedSymbolFlags(symbolFlags)) { const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations; - const name = !(type.flags & 8192) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName); + const name = !(type.flags & 16384) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName); forEach(declarations, (declaration) => error2(getNameOfDeclaration(declaration) || declaration, Diagnostics.Property_0_was_also_declared_here, name)); error2(declName || decl, Diagnostics.Duplicate_property_0, name); lateSymbol = createSymbol(0, memberName, 4096); @@ -55819,7 +55955,7 @@ ${lanes.join(` const target = type.target; const typeArguments = getTypeArguments(type); return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type; - } else if (type.flags & 2097152) { + } else if (type.flags & 268435456) { const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType)); return types !== type.types ? getIntersectionType(types) : type; } @@ -55903,7 +56039,7 @@ ${lanes.join(` function createUnionSignature(signature, unionSignatures) { const result = cloneSignature(signature); result.compositeSignatures = unionSignatures; - result.compositeKind = 1048576; + result.compositeKind = 134217728; result.target = undefined; result.mapper = undefined; return result; @@ -55931,7 +56067,7 @@ ${lanes.join(` const restType = getTypeOfSymbol(restSymbol); if (isTupleType(restType)) { return [expandSignatureParametersWithTupleMembers(restType, restIndex, restSymbol)]; - } else if (!skipUnionExpanding && restType.flags & 1048576 && every(restType.types, isTupleType)) { + } else if (!skipUnionExpanding && restType.flags & 134217728 && every(restType.types, isTupleType)) { return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restSymbol)); } } @@ -56154,11 +56290,11 @@ ${lanes.join(` const thisParam = combineUnionThisParam(left.thisParameter, right.thisParameter, paramMapper); const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount); const result = createSignature(declaration, typeParams, thisParam, params, undefined, undefined, minArgCount, flags); - result.compositeKind = 1048576; - result.compositeSignatures = concatenate(left.compositeKind !== 2097152 && left.compositeSignatures || [left], [right]); + result.compositeKind = 134217728; + result.compositeSignatures = concatenate(left.compositeKind !== 268435456 && left.compositeSignatures || [left], [right]); if (paramMapper) { - result.mapper = left.compositeKind !== 2097152 && left.mapper && left.compositeSignatures ? combineTypeMappers(left.mapper, paramMapper) : paramMapper; - } else if (left.compositeKind !== 2097152 && left.mapper && left.compositeSignatures) { + result.mapper = left.compositeKind !== 268435456 && left.mapper && left.compositeSignatures ? combineTypeMappers(left.mapper, paramMapper) : paramMapper; + } else if (left.compositeKind !== 268435456 && left.mapper && left.compositeSignatures) { result.mapper = left.mapper; } return result; @@ -56288,8 +56424,8 @@ ${lanes.join(` if (symbol.flags & 32) { const classType = getDeclaredTypeOfClassOrInterface(symbol); const baseConstructorType = getBaseConstructorTypeOfClass(classType); - if (baseConstructorType.flags & (524288 | 2097152 | 8650752)) { - members = createSymbolTable(getNamedOrIndexSignatureMembers(members)); + if (baseConstructorType.flags & (1048576 | 268435456 | 34078720)) { + members = createSymbolTable(getNamedOrIndexSignatureMembers(members, symbol)); addInheritedMembers(members, getPropertiesOfType(baseConstructorType)); } else if (baseConstructorType === anyType) { baseConstructorIndexInfo = anyBaseTypeIndexInfo; @@ -56302,7 +56438,7 @@ ${lanes.join(` if (baseConstructorIndexInfo) { indexInfos = append(indexInfos, baseConstructorIndexInfo); } - if (symbol.flags & 384 && (getDeclaredTypeOfSymbol(symbol).flags & 32 || some(type.properties, (prop) => !!(getTypeOfSymbol(prop).flags & 296)))) { + if (symbol.flags & 384 && (getDeclaredTypeOfSymbol(symbol).flags & 65536 || some(type.properties, (prop) => !!(getTypeOfSymbol(prop).flags & 67648)))) { indexInfos = append(indexInfos, enumNumberIndexInfo); } } @@ -56327,11 +56463,11 @@ ${lanes.join(` } function getLimitedConstraint(type) { const constraint = getConstraintTypeFromMappedType(type.mappedType); - if (!(constraint.flags & 1048576 || constraint.flags & 2097152)) { + if (!(constraint.flags & 134217728 || constraint.flags & 268435456)) { return; } - const origin = constraint.flags & 1048576 ? constraint.origin : constraint; - if (!origin || !(origin.flags & 2097152)) { + const origin = constraint.flags & 134217728 ? constraint.origin : constraint; + if (!origin || !(origin.flags & 268435456)) { return; } const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType)); @@ -56347,7 +56483,7 @@ ${lanes.join(` const limitedConstraint = getLimitedConstraint(type); for (const prop of getPropertiesOfType(type.source)) { if (limitedConstraint) { - const propertyNameType = getLiteralTypeFromProperty(prop, 8576); + const propertyNameType = getLiteralTypeFromProperty(prop, 19456); if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) { continue; } @@ -56357,7 +56493,7 @@ ${lanes.join(` inferredProp.declarations = prop.declarations; inferredProp.links.nameType = getSymbolLinks(prop).nameType; inferredProp.links.propertyType = getTypeOfSymbol(prop); - if (type.constraintType.type.flags & 8388608 && type.constraintType.type.objectType.flags & 262144 && type.constraintType.type.indexType.flags & 262144) { + if (type.constraintType.type.flags & 33554432 && type.constraintType.type.objectType.flags & 524288 && type.constraintType.type.indexType.flags & 524288) { const newTypeParam = type.constraintType.type.objectType; const newMappedType = replaceIndexedAccess(type.mappedType, type.constraintType.type, newTypeParam); inferredProp.links.mappedType = newMappedType; @@ -56371,11 +56507,11 @@ ${lanes.join(` setStructuredTypeMembers(type, members, emptyArray, emptyArray, indexInfos); } function getLowerBoundOfKeyType(type) { - if (type.flags & 4194304) { + if (type.flags & 2097152) { const t = getApparentType(type.type); return isGenericTupleType(t) ? getKnownKeysOfTupleType(t) : getIndexType(t); } - if (type.flags & 16777216) { + if (type.flags & 67108864) { if (type.root.isDistributive) { const checkType = type.checkType; const constraint = getLowerBoundOfKeyType(checkType); @@ -56385,12 +56521,12 @@ ${lanes.join(` } return type; } - if (type.flags & 1048576) { + if (type.flags & 134217728) { return mapType(type, getLowerBoundOfKeyType, true); } - if (type.flags & 2097152) { + if (type.flags & 268435456) { const types = type.types; - if (types.length === 2 && !!(types[0].flags & (4 | 8 | 64)) && types[1] === emptyTypeLiteralType) { + if (types.length === 2 && !!(types[0].flags & (32 | 64 | 128)) && types[1] === emptyTypeLiteralType) { return type; } return getIntersectionType(sameMap(type.types, getLowerBoundOfKeyType)); @@ -56408,7 +56544,7 @@ ${lanes.join(` cb(stringType); } else { for (const info of getIndexInfosOfType(type)) { - if (!stringsOnly || info.keyType.flags & (4 | 134217728)) { + if (!stringsOnly || info.keyType.flags & (32 | 4194304)) { cb(info.keyType); } } @@ -56426,7 +56562,7 @@ ${lanes.join(` const templateType = getTemplateTypeFromMappedType(mappedType); const modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); const templateModifiers = getMappedTypeModifiers(type); - const include = 8576; + const include = 19456; if (isMappedTypeWithKeyofConstraintDeclaration(type)) { forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, include, false, addMemberForKeyType); } else { @@ -56460,8 +56596,8 @@ ${lanes.join(` } members.set(propName, prop); } - } else if (isValidIndexKeyType(propNameType) || propNameType.flags & (1 | 32)) { - const indexKeyType = propNameType.flags & (1 | 4) ? stringType : propNameType.flags & (8 | 32) ? numberType : propNameType; + } else if (isValidIndexKeyType(propNameType) || propNameType.flags & (1 | 65536)) { + const indexKeyType = propNameType.flags & (1 | 32) ? stringType : propNameType.flags & (64 | 65536) ? numberType : propNameType; const propType = instantiateType(templateType, appendTypeMapping(type.mapper, typeParameter, keyType)); const modifiersIndexInfo = getApplicableIndexInfo(modifiersType, propNameType); const isReadonly = !!(templateModifiers & 1 || !(templateModifiers & 2) && (modifiersIndexInfo == null ? undefined : modifiersIndexInfo.isReadonly)); @@ -56481,7 +56617,7 @@ ${lanes.join(` const templateType = getTemplateTypeFromMappedType(mappedType.target || mappedType); const mapper = appendTypeMapping(mappedType.mapper, getTypeParameterFromMappedType(mappedType), symbol.links.keyType); const propType = instantiateType(templateType, mapper); - let type = strictNullChecks && symbol.flags & 16777216 && !maybeTypeOfKind(propType, 32768 | 16384) ? getOptionalType(propType, true) : symbol.links.checkFlags & 524288 ? removeMissingOrUndefinedType(propType) : propType; + let type = strictNullChecks && symbol.flags & 16777216 && !maybeTypeOfKind(propType, 4 | 16) ? getOptionalType(propType, true) : symbol.links.checkFlags & 524288 ? removeMissingOrUndefinedType(propType) : propType; if (!popTypeResolution()) { error2(currentNode, Diagnostics.Type_of_property_0_circularly_references_itself_in_mapped_type_1, symbolToString(symbol), typeToString(mappedType)); type = errorType; @@ -56516,8 +56652,8 @@ ${lanes.join(` } else { const declaredType = getTypeFromMappedTypeNode(type.declaration); const constraint = getConstraintTypeFromMappedType(declaredType); - const extendedConstraint = constraint && constraint.flags & 262144 ? getConstraintOfTypeParameter(constraint) : constraint; - type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 ? instantiateType(extendedConstraint.type, type.mapper) : unknownType; + const extendedConstraint = constraint && constraint.flags & 524288 ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint && extendedConstraint.flags & 2097152 ? instantiateType(extendedConstraint.type, type.mapper) : unknownType; } } return type.modifiersType; @@ -56534,7 +56670,7 @@ ${lanes.join(` if (getObjectFlags(type) & 32) { return getMappedTypeOptionality(type) || getCombinedMappedTypeOptionality(getModifiersTypeFromMappedType(type)); } - if (type.flags & 2097152) { + if (type.flags & 268435456) { const optionality = getCombinedMappedTypeOptionality(type.types[0]); return every(type.types, (t, i) => i === 0 || getCombinedMappedTypeOptionality(t) === optionality) ? optionality : 0; } @@ -56565,7 +56701,7 @@ ${lanes.join(` } function resolveStructuredTypeMembers(type) { if (!type.members) { - if (type.flags & 524288) { + if (type.flags & 1048576) { if (type.objectFlags & 4) { resolveTypeReferenceMembers(type); } else if (type.objectFlags & 3) { @@ -56579,9 +56715,9 @@ ${lanes.join(` } else { Debug.fail("Unhandled object type " + Debug.formatObjectFlags(type.objectFlags)); } - } else if (type.flags & 1048576) { + } else if (type.flags & 134217728) { resolveUnionTypeMembers(type); - } else if (type.flags & 2097152) { + } else if (type.flags & 268435456) { resolveIntersectionTypeMembers(type); } else { Debug.fail("Unhandled type " + Debug.formatTypeFlags(type.flags)); @@ -56590,13 +56726,13 @@ ${lanes.join(` return type; } function getPropertiesOfObjectType(type) { - if (type.flags & 524288) { + if (type.flags & 1048576) { return resolveStructuredTypeMembers(type).properties; } return emptyArray; } function getPropertyOfObjectType(type, name) { - if (type.flags & 524288) { + if (type.flags & 1048576) { const resolved = resolveStructuredTypeMembers(type); const symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { @@ -56610,27 +56746,27 @@ ${lanes.join(` for (const current of type.types) { for (const prop of getPropertiesOfType(current)) { if (!members.has(prop.escapedName)) { - const combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.escapedName, !!(type.flags & 2097152)); + const combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.escapedName, !!(type.flags & 268435456)); if (combinedProp) { members.set(prop.escapedName, combinedProp); } } } - if (type.flags & 1048576 && getIndexInfosOfType(current).length === 0) { + if (type.flags & 134217728 && getIndexInfosOfType(current).length === 0) { break; } } - type.resolvedProperties = getNamedMembers(members); + type.resolvedProperties = getNamedMembers(members, type.symbol); } return type.resolvedProperties; } function getPropertiesOfType(type) { type = getReducedApparentType(type); - return type.flags & 3145728 ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); + return type.flags & 402653184 ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } function forEachPropertyOfType(type, action) { type = getReducedApparentType(type); - if (type.flags & 3670016) { + if (type.flags & 403701760) { resolveStructuredTypeMembers(type).members.forEach((symbol, escapedName) => { if (isNamedMember(symbol, escapedName)) { action(symbol, escapedName); @@ -56649,7 +56785,7 @@ ${lanes.join(` } function getAllPossiblePropertiesOfTypes(types) { const unionType = getUnionType(types); - if (!(unionType.flags & 1048576)) { + if (!(unionType.flags & 134217728)) { return getAugmentedPropertiesOfType(unionType); } const props = createSymbolTable(); @@ -56665,7 +56801,7 @@ ${lanes.join(` return arrayFrom(props.values()); } function getConstraintOfType(type) { - return type.flags & 262144 ? getConstraintOfTypeParameter(type) : type.flags & 8388608 ? getConstraintOfIndexedAccess(type) : type.flags & 16777216 ? getConstraintOfConditionalType(type) : getBaseConstraintOfType(type); + return type.flags & 524288 ? getConstraintOfTypeParameter(type) : type.flags & 33554432 ? getConstraintOfIndexedAccess(type) : type.flags & 67108864 ? getConstraintOfConditionalType(type) : getBaseConstraintOfType(type); } function getConstraintOfTypeParameter(typeParameter) { return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined; @@ -56676,7 +56812,7 @@ ${lanes.join(` } function isConstTypeVariable(type, depth = 0) { var _a; - return depth < 5 && !!(type && (type.flags & 262144 && some((_a = type.symbol) == null ? undefined : _a.declarations, (d) => hasSyntacticModifier(d, 4096)) || type.flags & 3145728 && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 8388608 && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 16777216 && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 33554432 && isConstTypeVariable(type.baseType, depth) || getObjectFlags(type) & 32 && isConstMappedType(type, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8) && isConstTypeVariable(t, depth)) >= 0)); + return depth < 5 && !!(type && (type.flags & 524288 && some((_a = type.symbol) == null ? undefined : _a.declarations, (d) => hasSyntacticModifier(d, 4096)) || type.flags & 402653184 && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 33554432 && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 67108864 && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 16777216 && isConstTypeVariable(type.baseType, depth) || getObjectFlags(type) & 32 && isConstMappedType(type, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8) && isConstTypeVariable(t, depth)) >= 0)); } function getConstraintOfIndexedAccess(type) { return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : undefined; @@ -56719,7 +56855,7 @@ ${lanes.join(` const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified; if (constraint && constraint !== type.checkType) { const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper), true); - if (!(instantiated.flags & 131072)) { + if (!(instantiated.flags & 262144)) { type.resolvedConstraintOfDistributive = instantiated; return instantiated; } @@ -56738,9 +56874,9 @@ ${lanes.join(` let constraints; let hasDisjointDomainType = false; for (const t of types) { - if (t.flags & 465829888) { + if (t.flags & 132644864) { let constraint = getConstraintOfType(t); - while (constraint && constraint.flags & (262144 | 4194304 | 16777216)) { + while (constraint && constraint.flags & (524288 | 2097152 | 67108864)) { constraint = getConstraintOfType(constraint); } if (constraint) { @@ -56749,14 +56885,14 @@ ${lanes.join(` constraints = append(constraints, t); } } - } else if (t.flags & 469892092 || isEmptyAnonymousObjectType(t)) { + } else if (t.flags & 12812284 || isEmptyAnonymousObjectType(t)) { hasDisjointDomainType = true; } } if (constraints && (targetIsUnion || hasDisjointDomainType)) { if (hasDisjointDomainType) { for (const t of types) { - if (t.flags & 469892092 || isEmptyAnonymousObjectType(t)) { + if (t.flags & 12812284 || isEmptyAnonymousObjectType(t)) { constraints = append(constraints, t); } } @@ -56766,11 +56902,11 @@ ${lanes.join(` return; } function getBaseConstraintOfType(type) { - if (type.flags & (58982400 | 3145728 | 134217728 | 268435456) || isGenericTupleType(type)) { + if (type.flags & (117964800 | 402653184 | 4194304 | 8388608) || isGenericTupleType(type)) { const constraint = getResolvedBaseConstraint(type); return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : undefined; } - return type.flags & 4194304 ? stringNumberSymbolType : undefined; + return type.flags & 2097152 ? stringNumberSymbolType : undefined; } function getBaseConstraintOrType(type) { return getBaseConstraintOfType(type) || type; @@ -56797,7 +56933,7 @@ ${lanes.join(` stack.pop(); } if (!popTypeResolution()) { - if (t.flags & 262144) { + if (t.flags & 524288) { const errorNode = getConstraintDeclaration(t); if (errorNode) { const diagnostic = error2(errorNode, Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t)); @@ -56817,11 +56953,11 @@ ${lanes.join(` return c !== noConstraintType && c !== circularConstraintType ? c : undefined; } function computeBaseConstraint(t) { - if (t.flags & 262144) { + if (t.flags & 524288) { const constraint = getConstraintFromTypeParameter(t); return t.isThisType || !constraint ? constraint : getBaseConstraint(constraint); } - if (t.flags & 3145728) { + if (t.flags & 402653184) { const types = t.types; const baseTypes = []; let different = false; @@ -56839,21 +56975,27 @@ ${lanes.join(` if (!different) { return t; } - return t.flags & 1048576 && baseTypes.length === types.length ? getUnionType(baseTypes) : t.flags & 2097152 && baseTypes.length ? getIntersectionType(baseTypes) : undefined; + return t.flags & 134217728 && baseTypes.length === types.length ? getUnionType(baseTypes) : t.flags & 268435456 && baseTypes.length ? getIntersectionType(baseTypes) : undefined; } - if (t.flags & 4194304) { + if (t.flags & 2097152) { + if (isGenericMappedType(t.type)) { + const mappedType = t.type; + if (getNameTypeFromMappedType(mappedType) && !isMappedTypeWithKeyofConstraintDeclaration(mappedType)) { + return getBaseConstraint(getIndexTypeForMappedType(mappedType, 0)); + } + } return stringNumberSymbolType; } - if (t.flags & 134217728) { + if (t.flags & 4194304) { const types = t.types; const constraints = mapDefined(types, getBaseConstraint); return constraints.length === types.length ? getTemplateLiteralType(t.texts, constraints) : stringType; } - if (t.flags & 268435456) { + if (t.flags & 8388608) { const constraint = getBaseConstraint(t.type); return constraint && constraint !== t.type ? getStringMappingType(t.symbol, constraint) : stringType; } - if (t.flags & 8388608) { + if (t.flags & 33554432) { if (isMappedTypeGenericIndexedAccess(t)) { return getBaseConstraint(substituteIndexedMappedType(t.objectType, t.indexType)); } @@ -56862,16 +57004,16 @@ ${lanes.join(` const baseIndexedAccess = baseObjectType && baseIndexType && getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, t.accessFlags); return baseIndexedAccess && getBaseConstraint(baseIndexedAccess); } - if (t.flags & 16777216) { + if (t.flags & 67108864) { const constraint = getConstraintFromConditionalType(t); return constraint && getBaseConstraint(constraint); } - if (t.flags & 33554432) { + if (t.flags & 16777216) { return getBaseConstraint(getSubstitutionIntersection(t)); } if (isGenericTupleType(t)) { const newElements = map(getElementTypes(t), (v, i) => { - const constraint = v.flags & 262144 && t.target.elementFlags[i] & 8 && getBaseConstraint(v) || v; + const constraint = v.flags & 524288 && t.target.elementFlags[i] & 8 && 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); @@ -56930,16 +57072,16 @@ ${lanes.join(` return type; } function isArrayOrTupleOrIntersection(type) { - return !!(type.flags & 2097152) && every(type.types, isArrayOrTupleType); + return !!(type.flags & 268435456) && every(type.types, isArrayOrTupleType); } function isMappedTypeGenericIndexedAccess(type) { let objectType; - return !!(type.flags & 8388608 && getObjectFlags(objectType = type.objectType) & 32 && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8) && !objectType.declaration.nameType); + return !!(type.flags & 33554432 && getObjectFlags(objectType = type.objectType) & 32 && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8) && !objectType.declaration.nameType); } function getApparentType(type) { - const t = type.flags & 465829888 ? getBaseConstraintOfType(type) || unknownType : type; + const t = type.flags & 132644864 ? getBaseConstraintOfType(type) || unknownType : type; const objectFlags = getObjectFlags(t); - return objectFlags & 32 ? getApparentTypeOfMappedType(t) : objectFlags & 4 && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 ? globalStringType : t.flags & 296 ? globalNumberType : t.flags & 2112 ? getGlobalBigIntType() : t.flags & 528 ? globalBooleanType : t.flags & 12288 ? getGlobalESSymbolType() : t.flags & 67108864 ? emptyObjectType : t.flags & 4194304 ? stringNumberSymbolType : t.flags & 2 && !strictNullChecks ? emptyObjectType : t; + return objectFlags & 32 ? getApparentTypeOfMappedType(t) : objectFlags & 4 && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 268435456 ? getApparentTypeOfIntersectionType(t, type) : t.flags & 12583968 ? globalStringType : t.flags & 67648 ? globalNumberType : t.flags & 4224 ? getGlobalBigIntType() : t.flags & 8448 ? globalBooleanType : t.flags & 16896 ? getGlobalESSymbolType() : t.flags & 131072 ? emptyObjectType : t.flags & 2097152 ? stringNumberSymbolType : t.flags & 2 && !strictNullChecks ? emptyObjectType : t; } function getReducedApparentType(type) { return getReducedType(getApparentType(getReducedType(type))); @@ -56950,14 +57092,14 @@ ${lanes.join(` let singleProp; let propSet; let indexTypes; - const isUnion = containingType.flags & 1048576; + const isUnion = containingType.flags & 134217728; let optionalFlag; let syntheticFlag = 4; let checkFlags = isUnion ? 0 : 8; let mergedInstantiations = false; for (const current of containingType.types) { const type = getApparentType(current); - if (!(isErrorType(type) || type.flags & 131072)) { + if (!(isErrorType(type) || type.flags & 262144)) { const prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment); const modifiers = prop ? getDeclarationModifierFlagsFromSymbol(prop) : 0; if (prop) { @@ -57060,7 +57202,7 @@ ${lanes.join(` if (isLiteralType(type) || isPatternLiteralType(type)) { checkFlags |= 128; } - if (type.flags & 131072 && type !== uniqueLiteralType) { + if (type.flags & 262144 && type !== uniqueLiteralType) { checkFlags |= 131072; } propTypes.push(type); @@ -57131,9 +57273,9 @@ ${lanes.join(` return property && !(getCheckFlags(property) & 16) ? property : undefined; } function getReducedType(type) { - if (type.flags & 1048576 && type.objectFlags & 16777216) { + if (type.flags & 134217728 && type.objectFlags & 16777216) { return type.resolvedReducedType || (type.resolvedReducedType = getReducedUnionType(type)); - } else if (type.flags & 2097152) { + } else if (type.flags & 268435456) { if (!(type.objectFlags & 16777216)) { type.objectFlags |= 16777216 | (some(getPropertiesOfUnionOrIntersectionType(type), isNeverReducedProperty) ? 33554432 : 0); } @@ -57147,7 +57289,7 @@ ${lanes.join(` return unionType; } const reduced = getUnionType(reducedTypes); - if (reduced.flags & 1048576) { + if (reduced.flags & 134217728) { reduced.resolvedReducedType = reduced; } return reduced; @@ -57156,20 +57298,20 @@ ${lanes.join(` return isDiscriminantWithNeverType(prop) || isConflictingPrivateProperty(prop); } function isDiscriminantWithNeverType(prop) { - return !(prop.flags & 16777216) && (getCheckFlags(prop) & (192 | 131072)) === 192 && !!(getTypeOfSymbol(prop).flags & 131072); + return !(prop.flags & 16777216) && (getCheckFlags(prop) & (192 | 131072)) === 192 && !!(getTypeOfSymbol(prop).flags & 262144); } function isConflictingPrivateProperty(prop) { return !prop.valueDeclaration && !!(getCheckFlags(prop) & 1024); } function isGenericReducibleType(type) { - return !!(type.flags & 1048576 && type.objectFlags & 16777216 && some(type.types, isGenericReducibleType) || type.flags & 2097152 && isReducibleIntersection(type)); + return !!(type.flags & 134217728 && type.objectFlags & 16777216 && some(type.types, isGenericReducibleType) || type.flags & 268435456 && 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 && getObjectFlags(type) & 33554432) { + if (type.flags & 268435456 && getObjectFlags(type) & 33554432) { const neverProp = find(getPropertiesOfUnionOrIntersectionType(type), isDiscriminantWithNeverType); if (neverProp) { return chainDiagnosticMessages(errorInfo, Diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents, typeToString(type, undefined, 536870912), symbolToString(neverProp)); @@ -57184,7 +57326,7 @@ ${lanes.join(` function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment, includeTypeOnlyMembers) { var _a, _b; type = getReducedApparentType(type); - if (type.flags & 524288) { + if (type.flags & 1048576) { const resolved = resolveStructuredTypeMembers(type); const symbol = resolved.members.get(name); if (symbol && !includeTypeOnlyMembers && ((_a = type.symbol) == null ? undefined : _a.flags) & 512 && ((_b = getSymbolLinks(type.symbol).typeOnlyExportStarMap) == null ? undefined : _b.has(name))) { @@ -57204,7 +57346,7 @@ ${lanes.join(` } return getPropertyOfObjectType(globalObjectType, name); } - if (type.flags & 2097152) { + if (type.flags & 268435456) { const prop = getPropertyOfUnionOrIntersectionType(type, name, true); if (prop) { return prop; @@ -57214,13 +57356,13 @@ ${lanes.join(` } return; } - if (type.flags & 1048576) { + if (type.flags & 134217728) { return getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment); } return; } function getSignaturesOfStructuredType(type, kind) { - if (type.flags & 3670016) { + if (type.flags & 403701760) { const resolved = resolveStructuredTypeMembers(type); return kind === 0 ? resolved.callSignatures : resolved.constructSignatures; } @@ -57228,7 +57370,7 @@ ${lanes.join(` } function getSignaturesOfType(type, kind) { const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind); - if (kind === 0 && !length(result) && type.flags & 1048576) { + if (kind === 0 && !length(result) && type.flags & 134217728) { if (type.arrayFallbackSignatures) { return type.arrayFallbackSignatures; } @@ -57278,10 +57420,10 @@ ${lanes.join(` return applicableInfos ? createIndexInfo(unknownType, getIntersectionType(map(applicableInfos, (info) => info.type)), reduceLeft(applicableInfos, (isReadonly, info) => isReadonly && info.isReadonly, true)) : applicableInfo ? applicableInfo : stringIndexInfo && isApplicableIndexType(keyType, stringType) ? stringIndexInfo : undefined; } function isApplicableIndexType(source, target) { - return isTypeAssignableTo(source, target) || target === stringType && isTypeAssignableTo(source, numberType) || target === numberType && (source === numericStringType || !!(source.flags & 128) && isNumericLiteralName(source.value)); + return isTypeAssignableTo(source, target) || target === stringType && isTypeAssignableTo(source, numberType) || target === numberType && (source === numericStringType || !!(source.flags & 1024) && isNumericLiteralName(source.value)); } function getIndexInfosOfStructuredType(type) { - if (type.flags & 3670016) { + if (type.flags & 403701760) { const resolved = resolveStructuredTypeMembers(type); return resolved.indexInfos; } @@ -57591,7 +57733,7 @@ ${lanes.join(` } if (type || jsdocPredicate) { signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate; - } else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType.flags & 16) && getParameterCount(signature) > 0) { + } else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType.flags & 256) && getParameterCount(signature) > 0) { const { declaration } = signature; signature.resolvedTypePredicate = noTypePredicate; signature.resolvedTypePredicate = getTypePredicateFromBody(declaration) || noTypePredicate; @@ -57609,7 +57751,7 @@ ${lanes.join(` return parameterName.kind === 198 ? createTypePredicate(node.assertsModifier ? 2 : 0, undefined, undefined, type) : createTypePredicate(node.assertsModifier ? 3 : 1, parameterName.escapedText, findIndex(signature.parameters, (p) => p.escapedName === parameterName.escapedText), type); } function getUnionOrIntersectionType(types, kind, unionReduction) { - return kind !== 2097152 ? getUnionType(types, unionReduction) : getIntersectionType(types); + return kind !== 268435456 ? getUnionType(types, unionReduction) : getIntersectionType(types); } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { @@ -57839,7 +57981,7 @@ ${lanes.join(` return emptyArray; } function isValidIndexKeyType(type) { - return !!(type.flags & (4 | 8 | 4096)) || isPatternLiteralType(type) || !!(type.flags & 2097152) && !isGenericType(type) && some(type.types, isValidIndexKeyType); + return !!(type.flags & (32 | 64 | 512)) || isPatternLiteralType(type) || !!(type.flags & 268435456) && !isGenericType(type) && some(type.types, isValidIndexKeyType); } function getConstraintDeclaration(type) { return mapDefined(filter(type.symbol && type.symbol.declarations, isTypeParameterDeclaration), getEffectiveConstraintOfTypeParameter)[0]; @@ -58176,10 +58318,10 @@ ${lanes.join(` return isNoInferTargetType(type) ? getOrCreateSubstitutionType(type, unknownType) : type; } function isNoInferTargetType(type) { - return !!(type.flags & 3145728 && some(type.types, isNoInferTargetType) || type.flags & 33554432 && !isNoInferType(type) && isNoInferTargetType(type.baseType) || type.flags & 524288 && !isEmptyAnonymousObjectType(type) || type.flags & (465829888 & ~33554432) && !isPatternLiteralType(type)); + return !!(type.flags & 402653184 && some(type.types, isNoInferTargetType) || type.flags & 16777216 && !isNoInferType(type) && isNoInferTargetType(type.baseType) || type.flags & 1048576 && !isEmptyAnonymousObjectType(type) || type.flags & (132644864 & ~16777216) && !isPatternLiteralType(type)); } function isNoInferType(type) { - return !!(type.flags & 33554432 && type.constraint.flags & 2); + return !!(type.flags & 16777216 && type.constraint.flags & 2); } function getSubstitutionType(baseType, constraint) { return constraint.flags & 3 || constraint === baseType || baseType.flags & 1 ? baseType : getOrCreateSubstitutionType(baseType, constraint); @@ -58190,7 +58332,7 @@ ${lanes.join(` if (cached) { return cached; } - const result = createType(33554432); + const result = createType(16777216); result.baseType = baseType; result.constraint = constraint; substitutionTypes.set(id, result); @@ -58213,12 +58355,12 @@ ${lanes.join(` if (parent2.kind === 170) { covariant = !covariant; } - if ((covariant || type.flags & 8650752) && parent2.kind === 195 && node === parent2.trueType) { + if ((covariant || type.flags & 34078720) && parent2.kind === 195 && node === parent2.trueType) { const constraint = getImpliedConstraint(type, parent2.checkType, parent2.extendsType); if (constraint) { constraints = append(constraints, constraint); } - } else if (type.flags & 262144 && parent2.kind === 201 && !parent2.nameType && node === parent2.type) { + } else if (type.flags & 524288 && parent2.kind === 201 && !parent2.nameType && node === parent2.type) { const mappedType = getTypeFromTypeNode(parent2); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { const typeParameter = getHomomorphicTypeVariable(mappedType); @@ -58294,7 +58436,7 @@ ${lanes.join(` } function getTypeFromJSDocNullableTypeNode(node) { const type = getTypeFromTypeNode(node.type); - return strictNullChecks ? getNullableType(type, 65536) : type; + return strictNullChecks ? getNullableType(type, 8) : type; } function getTypeFromTypeReference(node) { const links = getNodeLinks(node); @@ -58356,7 +58498,7 @@ ${lanes.join(` return arity ? emptyGenericType : emptyObjectType; } const type = getDeclaredTypeOfSymbol(symbol); - if (!(type.flags & 524288)) { + if (!(type.flags & 1048576)) { error2(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbolName(symbol)); return arity ? emptyGenericType : emptyObjectType; } @@ -58734,7 +58876,7 @@ ${lanes.join(` return createTypeReference(target, elementTypes); } if (target.combinedFlags & 8) { - const unionIndex = findIndex(elementTypes, (t, i) => !!(target.elementFlags[i] & 8 && t.flags & (131072 | 1048576))); + const unionIndex = findIndex(elementTypes, (t, i) => !!(target.elementFlags[i] & 8 && t.flags & (262144 | 134217728))); if (unionIndex >= 0) { return checkCrossProductUnion(map(elementTypes, (t, i) => target.elementFlags[i] & 8 ? t : unknownType)) ? mapType(elementTypes[unionIndex], (t) => createNormalizedTupleType(target, replaceElement(elementTypes, unionIndex, t))) : errorType; } @@ -58751,7 +58893,7 @@ ${lanes.join(` if (flags & 8) { if (type.flags & 1) { addElement(type, 4, (_a = target.labeledElementDeclarations) == null ? undefined : _a[i]); - } else if (type.flags & 58982400 || isGenericMappedType(type)) { + } else if (type.flags & 117964800 || isGenericMappedType(type)) { addElement(type, 8, (_b = target.labeledElementDeclarations) == null ? undefined : _b[i]); } else if (isTupleType(type)) { const elements = getElementTypes(type); @@ -58827,10 +58969,10 @@ ${lanes.join(` return type.id; } function containsType(types, type) { - return binarySearch(types, type, getTypeId, compareValues) >= 0; + return stableTypeOrdering ? binarySearch(types, type, identity, compareTypes) >= 0 : binarySearch(types, type, getTypeId, compareValues) >= 0; } function insertType(types, type) { - const index = binarySearch(types, type, getTypeId, compareValues); + const index = stableTypeOrdering ? binarySearch(types, type, identity, compareTypes) : binarySearch(types, type, getTypeId, compareValues); if (index < 0) { types.splice(~index, 0, type); return true; @@ -58839,22 +58981,22 @@ ${lanes.join(` } function addTypeToUnion(typeSet, includes, type) { const flags = type.flags; - if (!(flags & 131072)) { - includes |= flags & 473694207; - if (flags & 465829888) - includes |= 33554432; - if (flags & 2097152 && getObjectFlags(type) & 67108864) + if (!(flags & 262144)) { + includes |= flags & 416808959; + if (flags & 132644864) + includes |= 16777216; + if (flags & 268435456 && getObjectFlags(type) & 67108864) includes |= 536870912; if (type === wildcardType) - includes |= 8388608; + includes |= 33554432; if (isErrorType(type)) includes |= 1073741824; - if (!strictNullChecks && flags & 98304) { + if (!strictNullChecks && flags & 12) { if (!(getObjectFlags(type) & 65536)) - includes |= 4194304; + includes |= 2097152; } else { const len = typeSet.length; - const index = len && type.id > typeSet[len - 1].id ? ~len : binarySearch(typeSet, type, getTypeId, compareValues); + const index = stableTypeOrdering ? binarySearch(typeSet, type, identity, compareTypes) : len && type.id > typeSet[len - 1].id ? ~len : binarySearch(typeSet, type, getTypeId, compareValues); if (index < 0) { typeSet.splice(~index, 0, type); } @@ -58866,7 +59008,7 @@ ${lanes.join(` let lastType; for (const type of types) { if (type !== lastType) { - includes = type.flags & 1048576 ? addTypesToUnion(typeSet, includes | (isNamedUnionType(type) ? 1048576 : 0), type.types) : addTypeToUnion(typeSet, includes, type); + includes = type.flags & 134217728 ? addTypesToUnion(typeSet, includes | (isNamedUnionType(type) ? 134217728 : 0), type.types) : addTypeToUnion(typeSet, includes, type); lastType = type; } } @@ -58882,21 +59024,21 @@ ${lanes.join(` if (match) { return match; } - const hasEmptyObject = hasObjectTypes && some(types, (t) => !!(t.flags & 524288) && !isGenericMappedType(t) && isEmptyResolvedType(resolveStructuredTypeMembers(t))); + const hasEmptyObject = hasObjectTypes && some(types, (t) => !!(t.flags & 1048576) && !isGenericMappedType(t) && isEmptyResolvedType(resolveStructuredTypeMembers(t))); const len = types.length; let i = len; let count = 0; while (i > 0) { i--; const source = types[i]; - if (hasEmptyObject || source.flags & 469499904) { - if (source.flags & 262144 && getBaseConstraintOrType(source).flags & 1048576) { + if (hasEmptyObject || source.flags & 536346624) { + if (source.flags & 524288 && getBaseConstraintOrType(source).flags & 134217728) { if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) { orderedRemoveItemAt(types, i); } continue; } - const keyProperty = source.flags & (524288 | 2097152 | 58982400) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : undefined; + const keyProperty = source.flags & (1048576 | 268435456 | 117964800) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : undefined; const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty)); for (const target of types) { if (source !== target) { @@ -58909,7 +59051,7 @@ ${lanes.join(` } } count++; - if (keyProperty && target.flags & (524288 | 2097152 | 58982400)) { + if (keyProperty && target.flags & (1048576 | 268435456 | 117964800)) { const t = getTypeOfPropertyOfType(target, keyProperty.escapedName); if (t && isUnitType(t) && getRegularTypeOfLiteralType(t) !== keyPropertyType) { continue; @@ -58932,7 +59074,7 @@ ${lanes.join(` i--; const t = types[i]; const flags = t.flags; - const remove = flags & (128 | 134217728 | 268435456) && includes & 4 || flags & 256 && includes & 8 || flags & 2048 && includes & 64 || flags & 8192 && includes & 4096 || reduceVoidUndefined && flags & 32768 && includes & 16384 || isFreshLiteralType(t) && containsType(types, t.regularType); + const remove = flags & (1024 | 4194304 | 8388608) && includes & 32 || flags & 2048 && includes & 64 || flags & 4096 && includes & 128 || flags & 16384 && includes & 512 || reduceVoidUndefined && flags & 4 && includes & 16 || isFreshLiteralType(t) && containsType(types, t.regularType); if (remove) { orderedRemoveItemAt(types, i); } @@ -58945,28 +59087,28 @@ ${lanes.join(` while (i > 0) { i--; const t = types[i]; - if (t.flags & 128 && some(templates, (template) => isTypeMatchedByTemplateLiteralOrStringMapping(t, template))) { + if (t.flags & 1024 && some(templates, (template) => isTypeMatchedByTemplateLiteralOrStringMapping(t, template))) { orderedRemoveItemAt(types, i); } } } } function isTypeMatchedByTemplateLiteralOrStringMapping(type, template) { - return template.flags & 134217728 ? isTypeMatchedByTemplateLiteralType(type, template) : isMemberOfStringMapping(type, template); + return template.flags & 4194304 ? isTypeMatchedByTemplateLiteralType(type, template) : isMemberOfStringMapping(type, template); } function removeConstrainedTypeVariables(types) { const typeVariables = []; for (const type of types) { - if (type.flags & 2097152 && getObjectFlags(type) & 67108864) { - const index = type.types[0].flags & 8650752 ? 0 : 1; + if (type.flags & 268435456 && getObjectFlags(type) & 67108864) { + const index = type.types[0].flags & 34078720 ? 0 : 1; pushIfUnique(typeVariables, type.types[index]); } } for (const typeVariable of typeVariables) { const primitives = []; for (const type of types) { - if (type.flags & 2097152 && getObjectFlags(type) & 67108864) { - const index = type.types[0].flags & 8650752 ? 0 : 1; + if (type.flags & 268435456 && getObjectFlags(type) & 67108864) { + const index = type.types[0].flags & 34078720 ? 0 : 1; if (type.types[index] === typeVariable) { insertType(primitives, type.types[1 - index]); } @@ -58978,8 +59120,8 @@ ${lanes.join(` while (i > 0) { i--; const type = types[i]; - if (type.flags & 2097152 && getObjectFlags(type) & 67108864) { - const index = type.types[0].flags & 8650752 ? 0 : 1; + if (type.flags & 268435456 && getObjectFlags(type) & 67108864) { + const index = type.types[0].flags & 34078720 ? 0 : 1; if (type.types[index] === typeVariable && containsType(primitives, type.types[1 - index])) { orderedRemoveItemAt(types, i); } @@ -58990,15 +59132,15 @@ ${lanes.join(` } } function isNamedUnionType(type) { - return !!(type.flags & 1048576 && (type.aliasSymbol || type.origin)); + return !!(type.flags & 134217728 && (type.aliasSymbol || type.origin)); } function addNamedUnions(namedUnions, types) { for (const t of types) { - if (t.flags & 1048576) { + if (t.flags & 134217728) { const origin = t.origin; - if (t.aliasSymbol || origin && !(origin.flags & 1048576)) { + if (t.aliasSymbol || origin && !(origin.flags & 134217728)) { pushIfUnique(namedUnions, t); - } else if (origin && origin.flags & 1048576) { + } else if (origin && origin.flags & 134217728) { addNamedUnions(namedUnions, origin.types); } } @@ -59016,7 +59158,7 @@ ${lanes.join(` if (types.length === 1) { return types[0]; } - if (types.length === 2 && !origin && (types[0].flags & 1048576 || types[1].flags & 1048576)) { + if (types.length === 2 && !origin && (types[0].flags & 134217728 || types[1].flags & 134217728)) { const infix = unionReduction === 0 ? "N" : unionReduction === 2 ? "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); @@ -59034,33 +59176,33 @@ ${lanes.join(` const includes = addTypesToUnion(typeSet, 0, types); if (unionReduction !== 0) { if (includes & 3) { - return includes & 1 ? includes & 8388608 ? wildcardType : includes & 1073741824 ? errorType : anyType : unknownType; + return includes & 1 ? includes & 33554432 ? wildcardType : includes & 1073741824 ? errorType : anyType : unknownType; } - if (includes & 32768) { + if (includes & 4) { if (typeSet.length >= 2 && typeSet[0] === undefinedType && typeSet[1] === missingType) { orderedRemoveItemAt(typeSet, 1); } } - if (includes & (32 | 2944 | 8192 | 134217728 | 268435456) || includes & 16384 && includes & 32768) { + if (includes & (65536 | 15360 | 16384 | 4194304 | 8388608) || includes & 16 && includes & 4) { removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2)); } - if (includes & 128 && includes & (134217728 | 268435456)) { + if (includes & 1024 && includes & (4194304 | 8388608)) { removeStringLiteralsMatchedByTemplateLiterals(typeSet); } if (includes & 536870912) { removeConstrainedTypeVariables(typeSet); } if (unionReduction === 2) { - typeSet = removeSubtypes(typeSet, !!(includes & 524288)); + typeSet = removeSubtypes(typeSet, !!(includes & 1048576)); if (!typeSet) { return errorType; } } if (typeSet.length === 0) { - return includes & 65536 ? includes & 4194304 ? nullType : nullWideningType : includes & 32768 ? includes & 4194304 ? undefinedType : undefinedWideningType : neverType; + return includes & 8 ? includes & 2097152 ? nullType : nullWideningType : includes & 4 ? includes & 2097152 ? undefinedType : undefinedWideningType : neverType; } } - if (!origin && includes & 1048576) { + if (!origin && includes & 134217728) { const namedUnions = []; addNamedUnions(namedUnions, types); const reducedTypes = []; @@ -59077,10 +59219,10 @@ ${lanes.join(` for (const t of namedUnions) { insertType(reducedTypes, t); } - origin = createOriginUnionOrIntersectionType(1048576, reducedTypes); + origin = createOriginUnionOrIntersectionType(134217728, reducedTypes); } } - const objectFlags = (includes & 36323331 ? 0 : 32768) | (includes & 2097152 ? 16777216 : 0); + const objectFlags = (includes & 286523411 ? 0 : 32768) | (includes & 268435456 ? 16777216 : 0); return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin); } function getUnionOrIntersectionTypePredicate(signatures, kind) { @@ -59095,7 +59237,7 @@ ${lanes.join(` last2 = pred; types.push(pred.type); } else { - const returnType = kind !== 2097152 ? getReturnTypeOfSignature(sig) : undefined; + const returnType = kind !== 268435456 ? getReturnTypeOfSignature(sig) : undefined; if (returnType !== falseType && returnType !== regularFalseType) { return; } @@ -59117,18 +59259,18 @@ ${lanes.join(` if (types.length === 1) { return types[0]; } - const typeKey = !origin ? getTypeListId(types) : origin.flags & 1048576 ? `|${getTypeListId(origin.types)}` : origin.flags & 2097152 ? `&${getTypeListId(origin.types)}` : `#${origin.type.id}|${getTypeListId(types)}`; + const typeKey = !origin ? getTypeListId(types) : origin.flags & 134217728 ? `|${getTypeListId(origin.types)}` : origin.flags & 268435456 ? `&${getTypeListId(origin.types)}` : `#${origin.type.id}|${getTypeListId(types)}`; const id = typeKey + getAliasId(aliasSymbol, aliasTypeArguments); let type = unionTypes.get(id); if (!type) { - type = createType(1048576); - type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(types, 98304); + type = createType(134217728); + type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes(types, 12); type.types = types; type.origin = origin; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; - if (types.length === 2 && types[0].flags & 512 && types[1].flags & 512) { - type.flags |= 16; + if (types.length === 2 && types[0].flags & 8192 && types[1].flags & 8192) { + type.flags |= 256; type.intrinsicName = "boolean"; } unionTypes.set(id, type); @@ -59145,33 +59287,33 @@ ${lanes.join(` } function addTypeToIntersection(typeSet, includes, type) { const flags = type.flags; - if (flags & 2097152) { + if (flags & 268435456) { return addTypesToIntersection(typeSet, includes, type.types); } if (isEmptyAnonymousObjectType(type)) { - if (!(includes & 16777216)) { - includes |= 16777216; + if (!(includes & 67108864)) { + includes |= 67108864; typeSet.set(type.id.toString(), type); } } else { if (flags & 3) { if (type === wildcardType) - includes |= 8388608; + includes |= 33554432; if (isErrorType(type)) includes |= 1073741824; - } else if (strictNullChecks || !(flags & 98304)) { + } else if (strictNullChecks || !(flags & 12)) { if (type === missingType) { - includes |= 262144; + includes |= 524288; type = undefinedType; } if (!typeSet.has(type.id.toString())) { - if (type.flags & 109472 && includes & 109472) { - includes |= 67108864; + if (type.flags & 97292 && includes & 97292) { + includes |= 131072; } typeSet.set(type.id.toString(), type); } } - includes |= flags & 473694207; + includes |= flags & 416808959; } return includes; } @@ -59186,7 +59328,7 @@ ${lanes.join(` while (i > 0) { i--; const t = types[i]; - const remove = t.flags & 4 && includes & (128 | 134217728 | 268435456) || t.flags & 8 && includes & 256 || t.flags & 64 && includes & 2048 || t.flags & 4096 && includes & 8192 || t.flags & 16384 && includes & 32768 || isEmptyAnonymousObjectType(t) && includes & 470302716; + const remove = t.flags & 32 && includes & (1024 | 4194304 | 8388608) || t.flags & 64 && includes & 2048 || t.flags & 128 && includes & 4096 || t.flags & 512 && includes & 16384 || t.flags & 16 && includes & 4 || isEmptyAnonymousObjectType(t) && includes & 13893600; if (remove) { orderedRemoveItemAt(types, i); } @@ -59201,7 +59343,7 @@ ${lanes.join(` if (type === undefinedType) { return containsType(u.types, missingType); } - const primitive = type.flags & 128 ? stringType : type.flags & (32 | 256) ? numberType : type.flags & 2048 ? bigintType : type.flags & 8192 ? esSymbolType : undefined; + const primitive = type.flags & 1024 ? stringType : type.flags & (65536 | 2048) ? numberType : type.flags & 4096 ? bigintType : type.flags & 16384 ? esSymbolType : undefined; if (!primitive || !containsType(u.types, primitive)) { return false; } @@ -59211,11 +59353,11 @@ ${lanes.join(` } function extractRedundantTemplateLiterals(types) { let i = types.length; - const literals = filter(types, (t) => !!(t.flags & 128)); + const literals = filter(types, (t) => !!(t.flags & 1024)); while (i > 0) { i--; const t = types[i]; - if (!(t.flags & (134217728 | 268435456))) + if (!(t.flags & (4194304 | 8388608))) continue; for (const t2 of literals) { if (isTypeSubtypeOf(t2, t)) { @@ -59274,8 +59416,8 @@ ${lanes.join(` return true; } function createIntersectionType(types, objectFlags, aliasSymbol, aliasTypeArguments) { - const result = createType(2097152); - result.objectFlags = objectFlags | getPropagatingFlagsOfTypes(types, 98304); + const result = createType(268435456); + result.objectFlags = objectFlags | getPropagatingFlagsOfTypes(types, 12); result.types = types; result.aliasSymbol = aliasSymbol; result.aliasTypeArguments = aliasTypeArguments; @@ -59286,26 +59428,26 @@ ${lanes.join(` const includes = addTypesToIntersection(typeMembershipMap, 0, types); const typeSet = arrayFrom(typeMembershipMap.values()); let objectFlags = 0; - if (includes & 131072) { + if (includes & 262144) { return contains(typeSet, silentNeverType) ? silentNeverType : neverType; } - if (strictNullChecks && includes & 98304 && includes & (524288 | 67108864 | 16777216) || includes & 67108864 && includes & (469892092 & ~67108864) || includes & 402653316 && includes & (469892092 & ~402653316) || includes & 296 && includes & (469892092 & ~296) || includes & 2112 && includes & (469892092 & ~2112) || includes & 12288 && includes & (469892092 & ~12288) || includes & 49152 && includes & (469892092 & ~49152)) { + if (strictNullChecks && includes & 12 && includes & (1048576 | 131072 | 67108864) || includes & 131072 && includes & (12812284 & ~131072) || includes & 12583968 && includes & (12812284 & ~12583968) || includes & 67648 && includes & (12812284 & ~67648) || includes & 4224 && includes & (12812284 & ~4224) || includes & 16896 && includes & (12812284 & ~16896) || includes & 20 && includes & (12812284 & ~20)) { return neverType; } - if (includes & (134217728 | 268435456) && includes & 128 && extractRedundantTemplateLiterals(typeSet)) { + if (includes & (4194304 | 8388608) && includes & 1024 && extractRedundantTemplateLiterals(typeSet)) { return neverType; } if (includes & 1) { - return includes & 8388608 ? wildcardType : includes & 1073741824 ? errorType : anyType; + return includes & 33554432 ? wildcardType : includes & 1073741824 ? errorType : anyType; } - if (!strictNullChecks && includes & 98304) { - return includes & 16777216 ? neverType : includes & 32768 ? undefinedType : nullType; + if (!strictNullChecks && includes & 12) { + return includes & 67108864 ? neverType : includes & 4 ? undefinedType : nullType; } - if (includes & 4 && includes & (128 | 134217728 | 268435456) || includes & 8 && includes & 256 || includes & 64 && includes & 2048 || includes & 4096 && includes & 8192 || includes & 16384 && includes & 32768 || includes & 16777216 && includes & 470302716) { + if (includes & 32 && includes & (1024 | 4194304 | 8388608) || includes & 64 && includes & 2048 || includes & 128 && includes & 4096 || includes & 512 && includes & 16384 || includes & 16 && includes & 4 || includes & 67108864 && includes & 13893600) { if (!(flags & 1)) removeRedundantSupertypes(typeSet, includes); } - if (includes & 262144) { + if (includes & 524288) { typeSet[typeSet.indexOf(undefinedType)] = missingType; } if (typeSet.length === 0) { @@ -59315,16 +59457,16 @@ ${lanes.join(` return typeSet[0]; } if (typeSet.length === 2 && !(flags & 2)) { - const typeVarIndex = typeSet[0].flags & 8650752 ? 0 : 1; + const typeVarIndex = typeSet[0].flags & 34078720 ? 0 : 1; const typeVariable = typeSet[typeVarIndex]; const primitiveType = typeSet[1 - typeVarIndex]; - if (typeVariable.flags & 8650752 && (primitiveType.flags & (402784252 | 67108864) && !isGenericStringLikeType(primitiveType) || includes & 16777216)) { + if (typeVariable.flags & 34078720 && (primitiveType.flags & (12713980 | 131072) && !isGenericStringLikeType(primitiveType) || includes & 67108864)) { const constraint = getBaseConstraintOfType(typeVariable); - if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 | 67108864)) || isEmptyAnonymousObjectType(t))) { + if (constraint && everyType(constraint, (t) => !!(t.flags & (12713980 | 131072)) || isEmptyAnonymousObjectType(t))) { if (isTypeStrictSubtypeOf(constraint, primitiveType)) { return typeVariable; } - if (!(constraint.flags & 1048576 && someType(constraint, (c) => isTypeStrictSubtypeOf(c, primitiveType)))) { + if (!(constraint.flags & 134217728 && someType(constraint, (c) => isTypeStrictSubtypeOf(c, primitiveType)))) { if (!isTypeStrictSubtypeOf(primitiveType, constraint)) { return neverType; } @@ -59336,15 +59478,15 @@ ${lanes.join(` const id = getTypeListId(typeSet) + (flags & 2 ? "*" : getAliasId(aliasSymbol, aliasTypeArguments)); let result = intersectionTypes.get(id); if (!result) { - if (includes & 1048576) { + if (includes & 134217728) { if (intersectUnionsOfPrimitiveTypes(typeSet)) { result = getIntersectionType(typeSet, flags, aliasSymbol, aliasTypeArguments); - } else if (every(typeSet, (t) => !!(t.flags & 1048576 && t.types[0].flags & 32768))) { + } else if (every(typeSet, (t) => !!(t.flags & 134217728 && t.types[0].flags & 4))) { const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType; - removeFromEach(typeSet, 32768); + removeFromEach(typeSet, 4); result = getUnionType([getIntersectionType(typeSet, flags), containedUndefinedType], 1, aliasSymbol, aliasTypeArguments); - } else if (every(typeSet, (t) => !!(t.flags & 1048576 && (t.types[0].flags & 65536 || t.types[1].flags & 65536)))) { - removeFromEach(typeSet, 65536); + } else if (every(typeSet, (t) => !!(t.flags & 134217728 && (t.types[0].flags & 8 || t.types[1].flags & 8)))) { + removeFromEach(typeSet, 8); result = getUnionType([getIntersectionType(typeSet, flags), nullType], 1, aliasSymbol, aliasTypeArguments); } else if (typeSet.length >= 3 && types.length > 2) { const middle = Math.floor(typeSet.length / 2); @@ -59354,7 +59496,7 @@ ${lanes.join(` return errorType; } const constituents = getCrossProductIntersections(typeSet, flags); - const origin = some(constituents, (t) => !!(t.flags & 2097152)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152, typeSet) : undefined; + const origin = some(constituents, (t) => !!(t.flags & 268435456)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(268435456, typeSet) : undefined; result = getUnionType(constituents, 1, aliasSymbol, aliasTypeArguments, origin); } } else { @@ -59365,7 +59507,7 @@ ${lanes.join(` return result; } function getCrossProductUnionSize(types) { - return reduceLeft(types, (n, t) => t.flags & 1048576 ? n * t.types.length : t.flags & 131072 ? 0 : n, 1); + return reduceLeft(types, (n, t) => t.flags & 134217728 ? n * t.types.length : t.flags & 262144 ? 0 : n, 1); } function checkCrossProductUnion(types) { var _a; @@ -59384,7 +59526,7 @@ ${lanes.join(` const constituents = types.slice(); let n = i; for (let j = types.length - 1;j >= 0; j--) { - if (types[j].flags & 1048576) { + if (types[j].flags & 134217728) { const sourceTypes = types[j].types; const length2 = sourceTypes.length; constituents[j] = sourceTypes[n % length2]; @@ -59392,13 +59534,13 @@ ${lanes.join(` } } const t = getIntersectionType(constituents, flags); - if (!(t.flags & 131072)) + if (!(t.flags & 262144)) intersections.push(t); } return intersections; } function getConstituentCount(type) { - return !(type.flags & 3145728) || type.aliasSymbol ? 1 : type.flags & 1048576 && type.origin ? getConstituentCount(type.origin) : getConstituentCountOfTypes(type.types); + return !(type.flags & 402653184) || type.aliasSymbol ? 1 : type.flags & 134217728 && type.origin ? getConstituentCount(type.origin) : getConstituentCountOfTypes(type.types); } function getConstituentCountOfTypes(types) { return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0); @@ -59410,19 +59552,19 @@ ${lanes.join(` const types = map(node.types, getTypeFromTypeNode); const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1; const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType; - const noSupertypeReduction = !!(t.flags & (4 | 8 | 64) || t.flags & 134217728 && isPatternLiteralType(t)); + const noSupertypeReduction = !!(t.flags & (32 | 64 | 128) || t.flags & 4194304 && isPatternLiteralType(t)); links.resolvedType = getIntersectionType(types, noSupertypeReduction ? 1 : 0, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol)); } return links.resolvedType; } function createIndexType(type, indexFlags) { - const result = createType(4194304); + const result = createType(2097152); result.type = type; result.indexFlags = indexFlags; return result; } function createOriginIndexType(type) { - const result = createOriginType(4194304); + const result = createOriginType(2097152); result.type = type; return result; } @@ -59444,12 +59586,12 @@ ${lanes.join(` forEachType(constraintType, addMemberForKeyType); } else if (isMappedTypeWithKeyofConstraintDeclaration(type)) { const modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); - forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576, !!(indexFlags & 1), addMemberForKeyType); + forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 19456, !!(indexFlags & 1), addMemberForKeyType); } else { forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType); } - const result = indexFlags & 2 ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 | 4))) : getUnionType(keyTypes); - if (result.flags & 1048576 && constraintType.flags & 1048576 && getTypeListId(result.types) === getTypeListId(constraintType.types)) { + const result = indexFlags & 2 ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 | 32))) : getUnionType(keyTypes); + if (result.flags & 134217728 && constraintType.flags & 134217728 && getTypeListId(result.types) === getTypeListId(constraintType.types)) { return constraintType; } return result; @@ -59458,13 +59600,6 @@ ${lanes.join(` keyTypes.push(propNameType === stringType ? stringOrNumberType : propNameType); } } - function hasDistributiveNameType(mappedType) { - const typeVariable = getTypeParameterFromMappedType(mappedType); - return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable); - function isDistributive(type) { - return type.flags & (3 | 402784252 | 131072 | 262144 | 524288 | 67108864) ? true : type.flags & 16777216 ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 | 134217728) ? every(type.types, isDistributive) : type.flags & 8388608 ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 ? isDistributive(type.type) : false; - } - } function getLiteralTypeFromPropertyName(name) { if (isPrivateIdentifier(name)) { return neverType; @@ -59498,20 +59633,20 @@ ${lanes.join(` return neverType; } function isKeyTypeIncluded(keyType, include) { - return !!(keyType.flags & include || keyType.flags & 2097152 && some(keyType.types, (t) => isKeyTypeIncluded(t, include))); + return !!(keyType.flags & include || keyType.flags & 268435456 && some(keyType.types, (t) => isKeyTypeIncluded(t, include))); } function getLiteralTypeFromProperties(type, include, includeOrigin) { const origin = includeOrigin && (getObjectFlags(type) & (3 | 4) || type.aliasSymbol) ? createOriginIndexType(type) : undefined; const propertyTypes = map(getPropertiesOfType(type), (prop) => getLiteralTypeFromProperty(prop, include)); - const indexKeyTypes = map(getIndexInfosOfType(type), (info) => info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ? info.keyType === stringType && include & 8 ? stringOrNumberType : info.keyType : neverType); + const indexKeyTypes = map(getIndexInfosOfType(type), (info) => info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ? info.keyType === stringType && include & 64 ? stringOrNumberType : info.keyType : neverType); return getUnionType(concatenate(propertyTypes, indexKeyTypes), 1, undefined, undefined, origin); } function shouldDeferIndexType(type, indexFlags = 0) { - return !!(type.flags & 58982400 || isGenericTupleType(type) || isGenericMappedType(type) && (!hasDistributiveNameType(type) || getMappedTypeNameTypeKind(type) === 2) || type.flags & 1048576 && !(indexFlags & 4) && isGenericReducibleType(type) || type.flags & 2097152 && maybeTypeOfKind(type, 465829888) && some(type.types, isEmptyAnonymousObjectType)); + return !!(type.flags & 117964800 || isGenericTupleType(type) || isGenericMappedType(type) && getNameTypeFromMappedType(type) || type.flags & 134217728 && !(indexFlags & 4) && isGenericReducibleType(type) || type.flags & 268435456 && maybeTypeOfKind(type, 132644864) && some(type.types, isEmptyAnonymousObjectType)); } function getIndexType(type, indexFlags = 0) { type = getReducedType(type); - return isNoInferType(type) ? getNoInferType(getIndexType(type.baseType, indexFlags)) : shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 ? neverType : type.flags & (1 | 131072) ? stringNumberSymbolType : getLiteralTypeFromProperties(type, (indexFlags & 2 ? 128 : 402653316) | (indexFlags & 1 ? 0 : 296 | 12288), indexFlags === 0); + return isNoInferType(type) ? getNoInferType(getIndexType(type.baseType, indexFlags)) : shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 134217728 ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 268435456 ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 ? neverType : type.flags & (1 | 262144) ? stringNumberSymbolType : getLiteralTypeFromProperties(type, (indexFlags & 2 ? 1024 : 12583968) | (indexFlags & 1 ? 0 : 67648 | 16896), indexFlags === 0); } function getExtractStringType(type) { const extractTypeAlias = getGlobalExtractSymbol(); @@ -59519,7 +59654,7 @@ ${lanes.join(` } function getIndexTypeOrString(type) { const indexType = getExtractStringType(getIndexType(type)); - return indexType.flags & 131072 ? stringType : indexType; + return indexType.flags & 262144 ? stringType : indexType; } function getTypeFromTypeOperatorNode(node) { const links = getNodeLinks(node); @@ -59548,7 +59683,7 @@ ${lanes.join(` return links.resolvedType; } function getTemplateLiteralType(texts, types) { - const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 | 1048576))); + const unionIndex = findIndex(types, (t) => !!(t.flags & (262144 | 134217728))); if (unionIndex >= 0) { return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType; } @@ -59566,7 +59701,7 @@ ${lanes.join(` } newTexts.push(text); if (every(newTexts, (t) => t === "")) { - if (every(newTypes, (t) => !!(t.flags & 4))) { + if (every(newTypes, (t) => !!(t.flags & 32))) { return stringType; } if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) { @@ -59582,10 +59717,10 @@ ${lanes.join(` function addSpans(texts2, types2) { for (let i = 0;i < types2.length; i++) { const t = types2[i]; - if (t.flags & (2944 | 65536 | 32768)) { + if (t.flags & (15360 | 8 | 4)) { text += getTemplateStringForType(t) || ""; text += texts2[i + 1]; - } else if (t.flags & 134217728) { + } else if (t.flags & 4194304) { text += t.texts[0]; if (!addSpans(t.texts, t.types)) return false; @@ -59602,16 +59737,16 @@ ${lanes.join(` } } function getTemplateStringForType(type) { - return type.flags & 128 ? type.value : type.flags & 256 ? "" + type.value : type.flags & 2048 ? pseudoBigIntToString(type.value) : type.flags & (512 | 98304) ? type.intrinsicName : undefined; + return type.flags & 1024 ? type.value : type.flags & 2048 ? "" + type.value : type.flags & 4096 ? pseudoBigIntToString(type.value) : type.flags & (8192 | 12) ? type.intrinsicName : undefined; } function createTemplateLiteralType(texts, types) { - const type = createType(134217728); + const type = createType(4194304); type.texts = texts; type.types = types; return type; } function getStringMappingType(symbol, type) { - return type.flags & (1048576 | 131072) ? mapType(type, (t) => getStringMappingType(symbol, t)) : type.flags & 128 ? getStringLiteralType(applyStringMapping(symbol, type.value)) : type.flags & 134217728 ? getTemplateLiteralType(...applyTemplateStringMapping(symbol, type.texts, type.types)) : type.flags & 268435456 && symbol === type.symbol ? type : type.flags & (1 | 4 | 268435456) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) : type; + return type.flags & (134217728 | 262144) ? mapType(type, (t) => getStringMappingType(symbol, t)) : type.flags & 1024 ? getStringLiteralType(applyStringMapping(symbol, type.value)) : type.flags & 4194304 ? getTemplateLiteralType(...applyTemplateStringMapping(symbol, type.texts, type.types)) : type.flags & 8388608 && symbol === type.symbol ? type : type.flags & (1 | 32 | 8388608) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) : type; } function applyStringMapping(symbol, str) { switch (intrinsicTypeKinds.get(symbol.escapedName)) { @@ -59648,12 +59783,12 @@ ${lanes.join(` return result; } function createStringMappingType(symbol, type) { - const result = createTypeWithSymbol(268435456, symbol); + const result = createTypeWithSymbol(8388608, symbol); result.type = type; return result; } function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments) { - const type = createType(8388608); + const type = createType(33554432); type.objectType = objectType; type.indexType = indexType; type.accessFlags = accessFlags; @@ -59668,13 +59803,13 @@ ${lanes.join(` if (getObjectFlags(type) & 4096) { return true; } - if (type.flags & 1048576) { + if (type.flags & 134217728) { return every(type.types, isJSLiteralType); } - if (type.flags & 2097152) { + if (type.flags & 268435456) { return some(type.types, isJSLiteralType); } - if (type.flags & 465829888) { + if (type.flags & 132644864) { const constraint = getResolvedBaseConstraint(type); return constraint !== type && isJSLiteralType(constraint); } @@ -59742,8 +59877,8 @@ ${lanes.join(` } } } - if (!(indexType.flags & 98304) && isTypeAssignableToKind(indexType, 402653316 | 296 | 12288)) { - if (objectType.flags & (1 | 131072)) { + if (!(indexType.flags & 12) && isTypeAssignableToKind(indexType, 12583968 | 67648 | 16896)) { + if (objectType.flags & (1 | 262144)) { return objectType; } const indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType); @@ -59758,18 +59893,18 @@ ${lanes.join(` } return; } - if (accessNode && indexInfo.keyType === stringType && !isTypeAssignableToKind(indexType, 4 | 8)) { + if (accessNode && indexInfo.keyType === stringType && !isTypeAssignableToKind(indexType, 32 | 64)) { const indexNode = getIndexNodeForAccessExpression(accessNode); error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); return accessFlags & 1 ? getUnionType([indexInfo.type, missingType]) : indexInfo.type; } errorIfWritingToReadonlyIndex(indexInfo); - if (accessFlags & 1 && !(objectType.symbol && objectType.symbol.flags & (256 | 128) && (indexType.symbol && indexType.flags & 1024 && getParentOfSymbol(indexType.symbol) === objectType.symbol))) { + if (accessFlags & 1 && !(objectType.symbol && objectType.symbol.flags & (256 | 128) && (indexType.symbol && indexType.flags & 32768 && getParentOfSymbol(indexType.symbol) === objectType.symbol))) { return getUnionType([indexInfo.type, missingType]); } return indexInfo.type; } - if (indexType.flags & 131072) { + if (indexType.flags & 262144) { return neverType; } if (isJSLiteralType(objectType)) { @@ -59777,10 +59912,10 @@ ${lanes.join(` } if (accessExpression && !isConstEnumObjectType(objectType)) { if (isObjectLiteralType2(objectType)) { - if (noImplicitAny && indexType.flags & (128 | 256)) { + if (noImplicitAny && indexType.flags & (1024 | 2048)) { diagnostics.add(createDiagnosticForNode(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType))); return undefinedType; - } else if (indexType.flags & (8 | 4)) { + } else if (indexType.flags & (64 | 32)) { const types = map(objectType.properties, (property) => { return getTypeOfSymbol(property); }); @@ -59807,16 +59942,16 @@ ${lanes.join(` error2(accessExpression, Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion2); } else { let errorInfo; - if (indexType.flags & 1024) { + if (indexType.flags & 32768) { errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Property_0_does_not_exist_on_type_1, "[" + typeToString(indexType) + "]", typeToString(objectType)); - } else if (indexType.flags & 8192) { + } else if (indexType.flags & 16384) { const symbolName2 = getFullyQualifiedName(indexType.symbol, accessExpression); errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Property_0_does_not_exist_on_type_1, "[" + symbolName2 + "]", typeToString(objectType)); - } else if (indexType.flags & 128) { + } else if (indexType.flags & 1024) { errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType)); - } else if (indexType.flags & 256) { + } else if (indexType.flags & 2048) { errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType)); - } else if (indexType.flags & (8 | 4)) { + } else if (indexType.flags & (64 | 32)) { errorInfo = chainDiagnosticMessages(undefined, Diagnostics.No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1, typeToString(indexType), typeToString(objectType)); } errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1, typeToString(fullIndexType), typeToString(objectType)); @@ -59836,9 +59971,9 @@ ${lanes.join(` } if (accessNode) { const indexNode = getIndexNodeForAccessExpression(accessNode); - if (indexNode.kind !== 10 && indexType.flags & (128 | 256)) { + if (indexNode.kind !== 10 && indexType.flags & (1024 | 2048)) { error2(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType)); - } else if (indexType.flags & (4 | 8)) { + } else if (indexType.flags & (32 | 64)) { error2(indexNode, Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType)); } else { const typeString = indexNode.kind === 10 ? "bigint" : typeToString(indexType); @@ -59859,24 +59994,24 @@ ${lanes.join(` return accessNode.kind === 213 ? accessNode.argumentExpression : accessNode.kind === 200 ? accessNode.indexType : accessNode.kind === 168 ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { - if (type.flags & 2097152) { + if (type.flags & 268435456) { let seenPlaceholder = false; for (const t of type.types) { - if (t.flags & (2944 | 98304) || isPatternLiteralPlaceholderType(t)) { + if (t.flags & (15360 | 12) || isPatternLiteralPlaceholderType(t)) { seenPlaceholder = true; - } else if (!(t.flags & 524288)) { + } else if (!(t.flags & 1048576)) { return false; } } return seenPlaceholder; } - return !!(type.flags & (1 | 4 | 8 | 64)) || isPatternLiteralType(type); + return !!(type.flags & (1 | 32 | 64 | 128)) || isPatternLiteralType(type); } function isPatternLiteralType(type) { - return !!(type.flags & 134217728) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456) && isPatternLiteralPlaceholderType(type.type); + return !!(type.flags & 4194304) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 8388608) && isPatternLiteralPlaceholderType(type.type); } function isGenericStringLikeType(type) { - return !!(type.flags & (134217728 | 268435456)) && !isPatternLiteralType(type); + return !!(type.flags & (4194304 | 8388608)) && !isPatternLiteralType(type); } function isGenericType(type) { return !!getGenericObjectFlags(type); @@ -59888,31 +60023,31 @@ ${lanes.join(` return !!(getGenericObjectFlags(type) & 8388608); } function getGenericObjectFlags(type) { - if (type.flags & 3145728) { + if (type.flags & 402653184) { if (!(type.objectFlags & 2097152)) { type.objectFlags |= 2097152 | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0); } return type.objectFlags & 12582912; } - if (type.flags & 33554432) { + if (type.flags & 16777216) { if (!(type.objectFlags & 2097152)) { type.objectFlags |= 2097152 | getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); } return type.objectFlags & 12582912; } - return (type.flags & 58982400 || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 : 0) | (type.flags & (58982400 | 4194304) || isGenericStringLikeType(type) ? 8388608 : 0); + return (type.flags & 117964800 || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 : 0) | (type.flags & (117964800 | 2097152) || isGenericStringLikeType(type) ? 8388608 : 0); } function getSimplifiedType(type, writing) { - return type.flags & 8388608 ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 ? getSimplifiedConditionalType(type, writing) : type; + return type.flags & 33554432 ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 67108864 ? getSimplifiedConditionalType(type, writing) : type.flags & 2097152 ? getSimplifiedIndexType(type) : type; } function distributeIndexOverObjectType(objectType, indexType, writing) { - if (objectType.flags & 1048576 || objectType.flags & 2097152 && !shouldDeferIndexType(objectType)) { + if (objectType.flags & 134217728 || objectType.flags & 268435456 && !shouldDeferIndexType(objectType)) { const types = map(objectType.types, (t) => getSimplifiedType(getIndexedAccessType(t, indexType), writing)); - return objectType.flags & 2097152 || writing ? getIntersectionType(types) : getUnionType(types); + return objectType.flags & 268435456 || writing ? getIntersectionType(types) : getUnionType(types); } } function distributeObjectOverIndexType(objectType, indexType, writing) { - if (indexType.flags & 1048576) { + if (indexType.flags & 134217728) { const types = map(indexType.types, (t) => getSimplifiedType(getIndexedAccessType(objectType, t), writing)); return writing ? getIntersectionType(types) : getUnionType(types); } @@ -59929,14 +60064,14 @@ ${lanes.join(` if (distributedOverIndex) { return type[cache] = distributedOverIndex; } - if (!(indexType.flags & 465829888)) { + if (!(indexType.flags & 132644864)) { const distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing); if (distributedOverObject) { return type[cache] = distributedOverObject; } } - if (isGenericTupleType(objectType) && indexType.flags & 296) { - const elementType = getElementTypeOfSliceOfTupleType(objectType, indexType.flags & 8 ? 0 : objectType.target.fixedLength, 0, writing); + if (isGenericTupleType(objectType) && indexType.flags & 67648) { + const elementType = getElementTypeOfSliceOfTupleType(objectType, indexType.flags & 64 ? 0 : objectType.target.fixedLength, 0, writing); if (elementType) { return type[cache] = elementType; } @@ -59953,13 +60088,13 @@ ${lanes.join(` const extendsType = type.extendsType; const trueType2 = getTrueTypeFromConditionalType(type); const falseType2 = getFalseTypeFromConditionalType(type); - if (falseType2.flags & 131072 && getActualTypeVariable(trueType2) === getActualTypeVariable(checkType)) { + if (falseType2.flags & 262144 && getActualTypeVariable(trueType2) === getActualTypeVariable(checkType)) { if (checkType.flags & 1 || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { return getSimplifiedType(trueType2, writing); } else if (isIntersectionEmpty(checkType, extendsType)) { return neverType; } - } else if (trueType2.flags & 131072 && getActualTypeVariable(falseType2) === getActualTypeVariable(checkType)) { + } else if (trueType2.flags & 262144 && getActualTypeVariable(falseType2) === getActualTypeVariable(checkType)) { if (!(checkType.flags & 1) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { return neverType; } else if (checkType.flags & 1 || isIntersectionEmpty(checkType, extendsType)) { @@ -59968,8 +60103,14 @@ ${lanes.join(` } return type; } + function getSimplifiedIndexType(type) { + if (isGenericMappedType(type.type) && getNameTypeFromMappedType(type.type) && !isMappedTypeWithKeyofConstraintDeclaration(type.type)) { + return getIndexTypeForMappedType(type.type, 0); + } + return type; + } function isIntersectionEmpty(type1, type2) { - return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072); + return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 262144); } function substituteIndexedMappedType(objectType, index) { const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]); @@ -59980,14 +60121,14 @@ ${lanes.join(` } function couldAccessOptionalProperty(objectType, indexType) { const indexConstraint = getBaseConstraintOfType(indexType); - return !!indexConstraint && some(getPropertiesOfType(objectType), (p) => !!(p.flags & 16777216) && isTypeAssignableTo(getLiteralTypeFromProperty(p, 8576), indexConstraint)); + return !!indexConstraint && some(getPropertiesOfType(objectType), (p) => !!(p.flags & 16777216) && isTypeAssignableTo(getLiteralTypeFromProperty(p, 19456), indexConstraint)); } function getIndexedAccessType(objectType, indexType, accessFlags = 0, accessNode, aliasSymbol, aliasTypeArguments) { return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType); } function indexTypeLessThan(indexType, limit) { return everyType(indexType, (t) => { - if (t.flags & 384) { + if (t.flags & 3072) { const propName = getPropertyNameFromType(t); if (isNumericLiteralName(propName)) { const index = +propName; @@ -60002,7 +60143,7 @@ ${lanes.join(` return wildcardType; } objectType = getReducedType(objectType); - if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304) && isTypeAssignableToKind(indexType, 4 | 8)) { + if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 12) && isTypeAssignableToKind(indexType, 32 | 64)) { indexType = stringType; } if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32) @@ -60020,7 +60161,7 @@ ${lanes.join(` return type; } const apparentObjectType = getReducedApparentType(objectType); - if (indexType.flags & 1048576 && !(indexType.flags & 16)) { + if (indexType.flags & 134217728 && !(indexType.flags & 256)) { const propTypes = []; let wasMissingProp = false; for (const t of indexType.types) { @@ -60063,10 +60204,10 @@ ${lanes.join(` return links.resolvedType; } function getActualTypeVariable(type) { - if (type.flags & 33554432) { + if (type.flags & 16777216) { return getActualTypeVariable(type.baseType); } - if (type.flags & 8388608 && (type.objectType.flags & 33554432 || type.indexType.flags & 33554432)) { + if (type.flags & 33554432 && (type.objectType.flags & 16777216 || type.indexType.flags & 16777216)) { return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType)); } return type; @@ -60112,11 +60253,11 @@ ${lanes.join(` const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType; if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) { if (!(inferredExtendsType.flags & 3) && (checkType.flags & 1 || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) { - if (checkType.flags & 1 || forConstraint && !(inferredExtendsType.flags & 131072) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) { + if (checkType.flags & 1 || forConstraint && !(inferredExtendsType.flags & 262144) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) { (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper)); } const falseType2 = getTypeFromTypeNode(root.node.falseType); - if (falseType2.flags & 16777216) { + if (falseType2.flags & 67108864) { const newRoot = falseType2.root; if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) { root = newRoot; @@ -60139,7 +60280,7 @@ ${lanes.join(` break; } } - result = createType(16777216); + result = createType(67108864); result.root = root; result.checkType = instantiateType(root.checkType, mapper); result.extendsType = instantiateType(root.extendsType, mapper); @@ -60151,14 +60292,14 @@ ${lanes.join(` } return extraTypes ? getUnionType(append(extraTypes, result)) : result; function canTailRecurse(newType, newMapper) { - if (newType.flags & 16777216 && newMapper) { + if (newType.flags & 67108864 && newMapper) { const newRoot = newType.root; if (newRoot.outerTypeParameters) { const typeParamMapper = combineTypeMappers(newType.mapper, newMapper); const typeArguments = map(newRoot.outerTypeParameters, (t) => getMappedType(t, typeParamMapper)); const newRootMapper = createTypeMapper(newRoot.outerTypeParameters, typeArguments); const newCheckType = newRoot.isDistributive ? getMappedType(newRoot.checkType, newRootMapper) : undefined; - if (!newCheckType || newCheckType === newRoot.checkType || !(newCheckType.flags & (1048576 | 131072))) { + if (!newCheckType || newCheckType === newRoot.checkType || !(newCheckType.flags & (134217728 | 262144))) { root = newRoot; mapper = newRootMapper; aliasSymbol = undefined; @@ -60208,7 +60349,7 @@ ${lanes.join(` node, checkType, extendsType: getTypeFromTypeNode(node.extendsType), - isDistributive: !!(checkType.flags & 262144), + isDistributive: !!(checkType.flags & 524288), inferTypeParameters: getInferTypeParameters(node), outerTypeParameters, instantiations: undefined, @@ -60324,13 +60465,13 @@ ${lanes.join(` return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : undefined; } function isNonGenericObjectType(type) { - return !!(type.flags & 524288) && !isGenericMappedType(type); + return !!(type.flags & 1048576) && !isGenericMappedType(type); } function isEmptyObjectTypeOrSpreadsIntoEmptyObject(type) { - return isEmptyObjectType(type) || !!(type.flags & (65536 | 32768 | 528 | 296 | 2112 | 402653316 | 1056 | 67108864 | 4194304)); + return isEmptyObjectType(type) || !!(type.flags & (8 | 4 | 8448 | 67648 | 4224 | 12583968 | 98304 | 131072 | 2097152)); } function tryMergeUnionOfObjectTypeAndEmptyObject(type, readonly) { - if (!(type.flags & 1048576)) { + if (!(type.flags & 134217728)) { return type; } if (every(type.types, isEmptyObjectTypeOrSpreadsIntoEmptyObject)) { @@ -60371,28 +60512,28 @@ ${lanes.join(` if (left.flags & 2 || right.flags & 2) { return unknownType; } - if (left.flags & 131072) { + if (left.flags & 262144) { return right; } - if (right.flags & 131072) { + if (right.flags & 262144) { return left; } left = tryMergeUnionOfObjectTypeAndEmptyObject(left, readonly); - if (left.flags & 1048576) { + if (left.flags & 134217728) { return checkCrossProductUnion([left, right]) ? mapType(left, (t) => getSpreadType(t, right, symbol, objectFlags, readonly)) : errorType; } right = tryMergeUnionOfObjectTypeAndEmptyObject(right, readonly); - if (right.flags & 1048576) { + if (right.flags & 134217728) { return checkCrossProductUnion([left, right]) ? mapType(right, (t) => getSpreadType(left, t, symbol, objectFlags, readonly)) : errorType; } - if (right.flags & (528 | 296 | 2112 | 402653316 | 1056 | 67108864 | 4194304)) { + if (right.flags & (8448 | 67648 | 4224 | 12583968 | 98304 | 131072 | 2097152)) { return left; } if (isGenericObjectType(left) || isGenericObjectType(right)) { if (isEmptyObjectType(left)) { return right; } - if (left.flags & 2097152) { + if (left.flags & 268435456) { const types = left.types; const lastLeft = types[types.length - 1]; if (isNonGenericObjectType(lastLeft) && isNonGenericObjectType(right)) { @@ -60467,7 +60608,7 @@ ${lanes.join(` return type; } function getFreshTypeOfLiteralType(type) { - if (type.flags & 2976) { + if (type.flags & 80896) { if (!type.freshType) { const freshType = createLiteralType(type.flags, type.value, type.symbol, type); freshType.freshType = freshType; @@ -60478,28 +60619,28 @@ ${lanes.join(` return type; } function getRegularTypeOfLiteralType(type) { - return type.flags & 2976 ? type.regularType : type.flags & 1048576 ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type; + return type.flags & 80896 ? type.regularType : type.flags & 134217728 ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type; } function isFreshLiteralType(type) { - return !!(type.flags & 2976) && type.freshType === type; + return !!(type.flags & 80896) && type.freshType === type; } function getStringLiteralType(value) { let type; - return stringLiteralTypes.get(value) || (stringLiteralTypes.set(value, type = createLiteralType(128, value)), type); + return stringLiteralTypes.get(value) || (stringLiteralTypes.set(value, type = createLiteralType(1024, value)), type); } function getNumberLiteralType(value) { let type; - return numberLiteralTypes.get(value) || (numberLiteralTypes.set(value, type = createLiteralType(256, value)), type); + return numberLiteralTypes.get(value) || (numberLiteralTypes.set(value, type = createLiteralType(2048, value)), type); } function getBigIntLiteralType(value) { let type; const key = pseudoBigIntToString(value); - return bigIntLiteralTypes.get(key) || (bigIntLiteralTypes.set(key, type = createLiteralType(2048, value)), type); + return bigIntLiteralTypes.get(key) || (bigIntLiteralTypes.set(key, type = createLiteralType(4096, value)), type); } function getEnumLiteralType(value, enumId, symbol) { let type; const key = `${enumId}${typeof value === "string" ? "@" : "#"}${value}`; - const flags = 1024 | (typeof value === "string" ? 128 : 256); + const flags = 32768 | (typeof value === "string" ? 1024 : 2048); return enumLiteralTypes.get(key) || (enumLiteralTypes.set(key, type = createLiteralType(flags, value, symbol)), type); } function getTypeFromLiteralTypeNode(node) { @@ -60513,7 +60654,7 @@ ${lanes.join(` return links.resolvedType; } function createUniqueESSymbolType(symbol) { - const type = createTypeWithSymbol(8192, symbol); + const type = createTypeWithSymbol(16384, symbol); type.escapedName = `__@${type.symbol.escapedName}@${getSymbolId(type.symbol)}`; return type; } @@ -60869,7 +61010,7 @@ ${lanes.join(` result = target.objectFlags & 4 ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments); target.instantiations.set(id, result); const resultObjectFlags = getObjectFlags(result); - if (result.flags & 3899393 && !(resultObjectFlags & 524288)) { + if (result.flags & 403963917 && !(resultObjectFlags & 524288)) { const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables); if (!(getObjectFlags(result) & 524288)) { if (resultObjectFlags & (32 | 16 | 4)) { @@ -60925,9 +61066,9 @@ ${lanes.join(` } function getHomomorphicTypeVariable(type) { const constraintType = getConstraintTypeFromMappedType(type); - if (constraintType.flags & 4194304) { + if (constraintType.flags & 2097152) { const typeVariable = getActualTypeVariable(constraintType.type); - if (typeVariable.flags & 262144) { + if (typeVariable.flags & 524288) { return typeVariable; } } @@ -60943,7 +61084,7 @@ ${lanes.join(` } return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments); function instantiateConstituent(t) { - if (t.flags & (3 | 58982400 | 524288 | 2097152) && t !== wildcardType && !isErrorType(t)) { + if (t.flags & (3 | 117964800 | 1048576 | 268435456) && t !== wildcardType && !isErrorType(t)) { if (!type.declaration.nameType) { let constraint; if (isArrayType(t) || t.flags & 1 && findResolutionCycleStartIndex(typeVariable, 4) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) { @@ -60985,7 +61126,7 @@ ${lanes.join(` const templateMapper = appendTypeMapping(mapper, getTypeParameterFromMappedType(type), key); const propType = instantiateType(getTemplateTypeFromMappedType(type.target || type), templateMapper); const modifiers = getMappedTypeModifiers(type); - return strictNullChecks && modifiers & 4 && !maybeTypeOfKind(propType, 32768 | 16384) ? getOptionalType(propType, true) : strictNullChecks && modifiers & 8 && isOptional ? getTypeWithFacts(propType, 524288) : propType; + return strictNullChecks && modifiers & 4 && !maybeTypeOfKind(propType, 4 | 16) ? getOptionalType(propType, true) : strictNullChecks && modifiers & 8 && isOptional ? getTypeWithFacts(propType, 524288) : propType; } function instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments) { Debug.assert(type.symbol, "anonymous type must have symbol to be instantiated"); @@ -61018,7 +61159,7 @@ ${lanes.join(` const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments); const checkType = root.checkType; const distributionType = root.isDistributive ? getReducedType(getMappedType(checkType, newMapper)) : undefined; - result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 | 131072) ? mapTypeWithAlias(distributionType, (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments); + result = distributionType && checkType !== distributionType && distributionType.flags & (134217728 | 262144) ? mapTypeWithAlias(distributionType, (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments); root.instantiations.set(id, result); } return result; @@ -61062,10 +61203,10 @@ ${lanes.join(` } function instantiateTypeWorker(type, mapper, aliasSymbol, aliasTypeArguments) { const flags = type.flags; - if (flags & 262144) { + if (flags & 524288) { return getMappedType(type, mapper); } - if (flags & 524288) { + if (flags & 1048576) { const objectFlags = type.objectFlags; if (objectFlags & (4 | 16 | 32)) { if (objectFlags & 4 && !type.node) { @@ -61080,47 +61221,47 @@ ${lanes.join(` } return type; } - if (flags & 3145728) { - const origin = type.flags & 1048576 ? type.origin : undefined; - const types = origin && origin.flags & 3145728 ? origin.types : type.types; + if (flags & 402653184) { + const origin = type.flags & 134217728 ? type.origin : undefined; + const types = origin && origin.flags & 402653184 ? origin.types : type.types; const newTypes = instantiateTypes(types, mapper); if (newTypes === types && aliasSymbol === type.aliasSymbol) { return type; } const newAliasSymbol = aliasSymbol || type.aliasSymbol; const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper); - return flags & 2097152 || origin && origin.flags & 2097152 ? getIntersectionType(newTypes, 0, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1, newAliasSymbol, newAliasTypeArguments); + return flags & 268435456 || origin && origin.flags & 268435456 ? getIntersectionType(newTypes, 0, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1, newAliasSymbol, newAliasTypeArguments); } - if (flags & 4194304) { + if (flags & 2097152) { return getIndexType(instantiateType(type.type, mapper)); } - if (flags & 134217728) { + if (flags & 4194304) { return getTemplateLiteralType(type.texts, instantiateTypes(type.types, mapper)); } - if (flags & 268435456) { + if (flags & 8388608) { return getStringMappingType(type.symbol, instantiateType(type.type, mapper)); } - if (flags & 8388608) { + if (flags & 33554432) { const newAliasSymbol = aliasSymbol || type.aliasSymbol; const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper); return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper), type.accessFlags, undefined, newAliasSymbol, newAliasTypeArguments); } - if (flags & 16777216) { + if (flags & 67108864) { return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), false, aliasSymbol, aliasTypeArguments); } - if (flags & 33554432) { + if (flags & 16777216) { const newBaseType = instantiateType(type.baseType, mapper); if (isNoInferType(type)) { return getNoInferType(newBaseType); } const newConstraint = instantiateType(type.constraint, mapper); - if (newBaseType.flags & 8650752 && isGenericType(newConstraint)) { + if (newBaseType.flags & 34078720 && isGenericType(newConstraint)) { return getSubstitutionType(newBaseType, newConstraint); } if (newConstraint.flags & 3 || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { return newBaseType; } - return newBaseType.flags & 8650752 ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); + return newBaseType.flags & 34078720 ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); } return type; } @@ -61130,7 +61271,7 @@ ${lanes.join(` return type; } const innerIndexType = instantiateType(type.constraintType, mapper); - if (!(innerIndexType.flags & 4194304)) { + if (!(innerIndexType.flags & 2097152)) { return type; } const instantiated = inferTypeForHomomorphicMappedType(instantiateType(type.source, mapper), innerMappedType, innerIndexType); @@ -61140,10 +61281,10 @@ ${lanes.join(` return type; } function getPermissiveInstantiation(type) { - return type.flags & (402784252 | 3 | 131072) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper)); + return type.flags & (12713980 | 3 | 262144) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper)); } function getRestrictiveInstantiation(type) { - if (type.flags & (402784252 | 3 | 131072)) { + if (type.flags & (12713980 | 3 | 262144)) { return type; } if (type.restrictiveInstantiation) { @@ -61182,7 +61323,8 @@ ${lanes.join(` const { initializer } = node; return !!initializer && isContextSensitive(initializer); } - case 295: { + case 295: + case 230: { const { expression } = node; return !!expression && isContextSensitive(expression); } @@ -61190,7 +61332,7 @@ ${lanes.join(` return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); + return hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node) || hasContextSensitiveYieldExpression(node); } function hasContextSensitiveReturnExpression(node) { if (node.typeParameters || getEffectiveReturnTypeNode(node) || !node.body) { @@ -61201,11 +61343,14 @@ ${lanes.join(` } return !!forEachReturnStatement(node.body, (statement) => !!statement.expression && isContextSensitive(statement.expression)); } + function hasContextSensitiveYieldExpression(node) { + return !!(getFunctionFlags(node) & 1 && node.body && forEachYieldExpression(node.body, isContextSensitive)); + } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { - if (type.flags & 524288) { + if (type.flags & 1048576) { const resolved = resolveStructuredTypeMembers(type); if (resolved.constructSignatures.length || resolved.callSignatures.length) { const result = createObjectType(16, type.symbol); @@ -61216,7 +61361,7 @@ ${lanes.join(` result.indexInfos = emptyArray; return result; } - } else if (type.flags & 2097152) { + } else if (type.flags & 268435456) { return getIntersectionType(map(type.types, getTypeWithoutSignatures)); } return type; @@ -61243,7 +61388,7 @@ ${lanes.join(` return isTypeRelatedTo(source, target, assignableRelation); } function isTypeDerivedFrom(source, target) { - return source.flags & 1048576 ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 58982400 ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (524288 | 67108864)) : target === globalObjectType ? !!(source.flags & (524288 | 67108864)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 524288) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType); + return source.flags & 134217728 ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 134217728 ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 268435456 ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 117964800 ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (1048576 | 131072)) : target === globalObjectType ? !!(source.flags & (1048576 | 131072)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 1048576) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType); } function isTypeComparableTo(source, target) { return isTypeRelatedTo(source, target, comparableRelation); @@ -61266,7 +61411,7 @@ ${lanes.join(` return false; } function isOrHasGenericConditional(type) { - return !!(type.flags & 16777216 || type.flags & 2097152 && some(type.types, isOrHasGenericConditional)); + return !!(type.flags & 67108864 || type.flags & 268435456 && some(type.types, isOrHasGenericConditional)); } function elaborateError(node, source, target, relation, headMessage, containingMessageChain, errorOutputContainer) { if (!node || isOrHasGenericConditional(target)) @@ -61306,7 +61451,7 @@ ${lanes.join(` for (const signatures of [constructSignatures, callSignatures]) { if (some(signatures, (s) => { const returnType = getReturnTypeOfSignature(s); - return !(returnType.flags & (1 | 131072)) && checkTypeRelatedTo(returnType, target, relation, undefined); + return !(returnType.flags & (1 | 262144)) && checkTypeRelatedTo(returnType, target, relation, undefined); })) { const resultObj = errorOutputContainer || {}; checkTypeAssignableTo(source, target, node, headMessage, containingMessageChain, resultObj); @@ -61359,7 +61504,7 @@ ${lanes.join(` if (idx) { return idx; } - if (target.flags & 1048576) { + if (target.flags & 134217728) { const best = getBestMatchingType(source, target); if (best) { return getIndexedAccessTypeOrUndefined(best, nameType); @@ -61377,7 +61522,7 @@ ${lanes.join(` for (const value of iterator) { const { errorNode: prop, innerExpression: next, nameType, errorMessage } = value; let targetPropType = getBestMatchIndexedAccessTypeOrUndefined(source, target, nameType); - if (!targetPropType || targetPropType.flags & 8388608) + if (!targetPropType || targetPropType.flags & 33554432) continue; let sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType); if (!sourcePropType) @@ -61410,15 +61555,15 @@ ${lanes.join(` let issuedElaboration = false; if (!targetProp) { const indexInfo = getApplicableIndexInfo(target, nameType); - if (indexInfo && indexInfo.declaration && !getSourceFileOfNode(indexInfo.declaration).hasNoDefaultLib) { + if (indexInfo && indexInfo.declaration && !host.isSourceFileDefaultLibrary(getSourceFileOfNode(indexInfo.declaration))) { issuedElaboration = true; addRelatedInfo(reportedDiag, createDiagnosticForNode(indexInfo.declaration, Diagnostics.The_expected_type_comes_from_this_index_signature)); } } if (!issuedElaboration && (targetProp && length(targetProp.declarations) || target.symbol && length(target.symbol.declarations))) { const targetNode = targetProp && length(targetProp.declarations) ? targetProp.declarations[0] : target.symbol.declarations[0]; - if (!getSourceFileOfNode(targetNode).hasNoDefaultLib) { - addRelatedInfo(reportedDiag, createDiagnosticForNode(targetNode, Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 8192) ? unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target))); + if (!host.isSourceFileDefaultLibrary(getSourceFileOfNode(targetNode))) { + addRelatedInfo(reportedDiag, createDiagnosticForNode(targetNode, Diagnostics.The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1, propertyName && !(nameType.flags & 16384) ? unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target))); } } } @@ -61436,7 +61581,7 @@ ${lanes.join(` const { errorNode: prop, innerExpression: next, nameType, errorMessage } = status.value; let targetPropType = iterationType; const targetIndexedPropType = tupleOrArrayLikeTargetParts !== neverType ? getBestMatchIndexedAccessTypeOrUndefined(source, tupleOrArrayLikeTargetParts, nameType) : undefined; - if (targetIndexedPropType && !(targetIndexedPropType.flags & 8388608)) { + if (targetIndexedPropType && !(targetIndexedPropType.flags & 33554432)) { targetPropType = iterationType ? getUnionType([iterationType, targetIndexedPropType]) : targetIndexedPropType; } if (!targetPropType) @@ -61595,7 +61740,7 @@ ${lanes.join(` } } function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) { - if (target.flags & (402784252 | 131072)) + if (target.flags & (12713980 | 262144)) return false; if (isTupleLikeType(source)) { return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer); @@ -61614,8 +61759,8 @@ ${lanes.join(` for (const prop of node.properties) { if (isSpreadAssignment(prop)) continue; - const type = getLiteralTypeFromProperty(getSymbolOfDeclaration(prop), 8576); - if (!type || type.flags & 131072) { + const type = getLiteralTypeFromProperty(getSymbolOfDeclaration(prop), 19456); + if (!type || type.flags & 262144) { continue; } switch (prop.kind) { @@ -61634,7 +61779,7 @@ ${lanes.join(` } } function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) { - if (target.flags & (402784252 | 131072)) + if (target.flags & (12713980 | 262144)) return false; return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer); } @@ -61648,11 +61793,11 @@ ${lanes.join(` if (!s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s)) { const paramType = getTypeOfParameter(s.parameters[0]); const restType = isArrayType(paramType) ? getTypeArguments(paramType)[0] : paramType; - return !!(restType.flags & (1 | 131072) && getReturnTypeOfSignature(s).flags & 3); + return !!(restType.flags & (1 | 262144) && getReturnTypeOfSignature(s).flags & 3); } return false; } - function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) { + function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes2, reportUnreliableMarkers) { if (source === target) { return -1; } @@ -61672,7 +61817,7 @@ ${lanes.join(` } if (source.typeParameters && source.typeParameters !== target.typeParameters) { target = getCanonicalSignature(target); - source = instantiateSignatureInContextOf(source, target, undefined, compareTypes); + source = instantiateSignatureInContextOf(source, target, undefined, compareTypes2); } const sourceCount = getParameterCount(source); const sourceRestType = getNonArrayRestType(source); @@ -61687,7 +61832,7 @@ ${lanes.join(` if (sourceThisType && sourceThisType !== voidType) { const targetThisType = getThisTypeOfSignature(target); if (targetThisType) { - const related = !strictVariance && compareTypes(sourceThisType, targetThisType, false) || compareTypes(targetThisType, sourceThisType, reportErrors2); + const related = !strictVariance && compareTypes2(sourceThisType, targetThisType, false) || compareTypes2(targetThisType, sourceThisType, reportErrors2); if (!related) { if (reportErrors2) { errorReporter(Diagnostics.The_this_types_of_each_signature_are_incompatible); @@ -61706,8 +61851,8 @@ ${lanes.join(` const sourceSig = checkMode & 3 || isInstantiatedGenericParameter(source, i) ? undefined : getSingleCallSignature(getNonNullableType(sourceType)); const targetSig = checkMode & 3 || isInstantiatedGenericParameter(target, i) ? undefined : getSingleCallSignature(getNonNullableType(targetType)); const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648) === getTypeFacts(targetType, 50331648); - let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 | (strictVariance ? 2 : 1), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3) && !strictVariance && compareTypes(sourceType, targetType, false) || compareTypes(targetType, sourceType, reportErrors2); - if (related && checkMode & 8 && i >= getMinArgumentCount(source) && i < getMinArgumentCount(target) && compareTypes(sourceType, targetType, false)) { + let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 | (strictVariance ? 2 : 1), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes2, reportUnreliableMarkers) : !(checkMode & 3) && !strictVariance && compareTypes2(sourceType, targetType, false) || compareTypes2(targetType, sourceType, reportErrors2); + if (related && checkMode & 8 && i >= getMinArgumentCount(source) && i < getMinArgumentCount(target) && compareTypes2(sourceType, targetType, false)) { related = 0; } if (!related) { @@ -61729,7 +61874,7 @@ ${lanes.join(` if (targetTypePredicate) { const sourceTypePredicate = getTypePredicateOfSignature(source); if (sourceTypePredicate) { - result &= compareTypePredicateRelatedTo(sourceTypePredicate, targetTypePredicate, reportErrors2, errorReporter, compareTypes); + result &= compareTypePredicateRelatedTo(sourceTypePredicate, targetTypePredicate, reportErrors2, errorReporter, compareTypes2); } else if (isIdentifierTypePredicate(targetTypePredicate) || isThisTypePredicate(targetTypePredicate)) { if (reportErrors2) { errorReporter(Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source)); @@ -61737,7 +61882,7 @@ ${lanes.join(` return 0; } } else { - result &= checkMode & 1 && compareTypes(targetReturnType, sourceReturnType, false) || compareTypes(sourceReturnType, targetReturnType, reportErrors2); + result &= checkMode & 1 && compareTypes2(targetReturnType, sourceReturnType, false) || compareTypes2(sourceReturnType, targetReturnType, reportErrors2); if (!result && reportErrors2 && incompatibleErrorReporter) { incompatibleErrorReporter(sourceReturnType, targetReturnType); } @@ -61745,7 +61890,7 @@ ${lanes.join(` } return result; } - function compareTypePredicateRelatedTo(source, target, reportErrors2, errorReporter, compareTypes) { + function compareTypePredicateRelatedTo(source, target, reportErrors2, errorReporter, compareTypes2) { if (source.kind !== target.kind) { if (reportErrors2) { errorReporter(Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard); @@ -61762,7 +61907,7 @@ ${lanes.join(` return 0; } } - const related = source.type === target.type ? -1 : source.type && target.type ? compareTypes(source.type, target.type, reportErrors2) : 0; + const related = source.type === target.type ? -1 : source.type && target.type ? compareTypes2(source.type, target.type, reportErrors2) : 0; if (related === 0 && reportErrors2) { errorReporter(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); } @@ -61782,30 +61927,30 @@ ${lanes.join(` return t !== anyFunctionType && t.properties.length === 0 && t.callSignatures.length === 0 && t.constructSignatures.length === 0 && t.indexInfos.length === 0; } function isEmptyObjectType(type) { - return type.flags & 524288 ? !isGenericMappedType(type) && isEmptyResolvedType(resolveStructuredTypeMembers(type)) : type.flags & 67108864 ? true : type.flags & 1048576 ? some(type.types, isEmptyObjectType) : type.flags & 2097152 ? every(type.types, isEmptyObjectType) : false; + return type.flags & 1048576 ? !isGenericMappedType(type) && isEmptyResolvedType(resolveStructuredTypeMembers(type)) : type.flags & 131072 ? true : type.flags & 134217728 ? some(type.types, isEmptyObjectType) : type.flags & 268435456 ? every(type.types, isEmptyObjectType) : false; } function isEmptyAnonymousObjectType(type) { return !!(getObjectFlags(type) & 16 && (type.members && isEmptyResolvedType(type) || type.symbol && type.symbol.flags & 2048 && getMembersOfSymbol(type.symbol).size === 0)); } function isUnknownLikeUnionType(type) { - if (strictNullChecks && type.flags & 1048576) { + if (strictNullChecks && type.flags & 134217728) { if (!(type.objectFlags & 33554432)) { const types = type.types; - type.objectFlags |= 33554432 | (types.length >= 3 && types[0].flags & 32768 && types[1].flags & 65536 && some(types, isEmptyAnonymousObjectType) ? 67108864 : 0); + type.objectFlags |= 33554432 | (types.length >= 3 && types[0].flags & 4 && types[1].flags & 8 && some(types, isEmptyAnonymousObjectType) ? 67108864 : 0); } return !!(type.objectFlags & 67108864); } return false; } function containsUndefinedType(type) { - return !!((type.flags & 1048576 ? type.types[0] : type).flags & 32768); + return !!((type.flags & 134217728 ? type.types[0] : type).flags & 4); } function containsNonMissingUndefinedType(type) { - const candidate = type.flags & 1048576 ? type.types[0] : type; - return !!(candidate.flags & 32768) && candidate !== missingType; + const candidate = type.flags & 134217728 ? type.types[0] : type; + return !!(candidate.flags & 4) && candidate !== missingType; } function isStringIndexSignatureOnlyType(type) { - return type.flags & 524288 && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 3145728 && every(type.types, isStringIndexSignatureOnlyType) || false; + return type.flags & 1048576 && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 402653184 && every(type.types, isStringIndexSignatureOnlyType) || false; } function isEnumTypeRelatedTo(source, target, errorReporter) { const sourceSymbol = source.flags & 8 ? getParentOfSymbol(source) : source; @@ -61865,46 +62010,46 @@ ${lanes.join(` function isSimpleTypeRelatedTo(source, target, relation, errorReporter) { const s = source.flags; const t = target.flags; - if (t & 1 || s & 131072 || source === wildcardType) + if (t & 1 || s & 262144 || source === wildcardType) return true; if (t & 2 && !(relation === strictSubtypeRelation && s & 1)) return true; - if (t & 131072) + if (t & 262144) return false; - if (s & 402653316 && t & 4) + if (s & 12583968 && t & 32) return true; - if (s & 128 && s & 1024 && t & 128 && !(t & 1024) && source.value === target.value) + if (s & 1024 && s & 32768 && t & 1024 && !(t & 32768) && source.value === target.value) return true; - if (s & 296 && t & 8) + if (s & 67648 && t & 64) return true; - if (s & 256 && s & 1024 && t & 256 && !(t & 1024) && source.value === target.value) + if (s & 2048 && s & 32768 && t & 2048 && !(t & 32768) && source.value === target.value) return true; - if (s & 2112 && t & 64) + if (s & 4224 && t & 128) return true; - if (s & 528 && t & 16) + if (s & 8448 && t & 256) return true; - if (s & 12288 && t & 4096) + if (s & 16896 && t & 512) return true; - if (s & 32 && t & 32 && source.symbol.escapedName === target.symbol.escapedName && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) + if (s & 65536 && t & 65536 && source.symbol.escapedName === target.symbol.escapedName && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true; - if (s & 1024 && t & 1024) { - if (s & 1048576 && t & 1048576 && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) + if (s & 32768 && t & 32768) { + if (s & 134217728 && t & 134217728 && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true; - if (s & 2944 && t & 2944 && source.value === target.value && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) + if (s & 15360 && t & 15360 && source.value === target.value && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true; } - if (s & 32768 && (!strictNullChecks && !(t & 3145728) || t & (32768 | 16384))) + if (s & 4 && (!strictNullChecks && !(t & 402653184) || t & (4 | 16))) return true; - if (s & 65536 && (!strictNullChecks && !(t & 3145728) || t & 65536)) + if (s & 8 && (!strictNullChecks && !(t & 402653184) || t & 8)) return true; - if (s & 524288 && t & 67108864 && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source) && !(getObjectFlags(source) & 8192))) + if (s & 1048576 && t & 131072 && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source) && !(getObjectFlags(source) & 8192))) return true; if (relation === assignableRelation || relation === comparableRelation) { if (s & 1) return true; - if (s & 8 && (t & 32 || t & 256 && t & 1024)) + if (s & 64 && (t & 65536 || t & 2048 && t & 32768)) return true; - if (s & 256 && !(s & 1024) && (t & 32 || t & 256 && t & 1024 && source.value === target.value)) + if (s & 2048 && !(s & 32768) && (t & 65536 || t & 2048 && t & 32768 && source.value === target.value)) return true; if (isUnknownLikeUnionType(target)) return true; @@ -61922,22 +62067,22 @@ ${lanes.join(` return true; } if (relation !== identityRelation) { - if (relation === comparableRelation && !(target.flags & 131072) && isSimpleTypeRelatedTo(target, source, relation) || isSimpleTypeRelatedTo(source, target, relation)) { + if (relation === comparableRelation && !(target.flags & 262144) && isSimpleTypeRelatedTo(target, source, relation) || isSimpleTypeRelatedTo(source, target, relation)) { return true; } - } else if (!((source.flags | target.flags) & (3145728 | 8388608 | 16777216 | 33554432))) { + } else if (!((source.flags | target.flags) & (402653184 | 33554432 | 67108864 | 16777216))) { if (source.flags !== target.flags) return false; - if (source.flags & 67358815) + if (source.flags & 394239) return true; } - if (source.flags & 524288 && target.flags & 524288) { + if (source.flags & 1048576 && target.flags & 1048576) { const related = relation.get(getRelationKey(source, target, 0, relation, false)); if (related !== undefined) { return !!(related & 1); } } - if (source.flags & 469499904 || target.flags & 469499904) { + if (source.flags & 536346624 || target.flags & 536346624) { return checkTypeRelatedTo(source, target, relation, undefined); } return false; @@ -61947,7 +62092,7 @@ ${lanes.join(` } function getNormalizedType(type, writing) { while (true) { - const t = isFreshLiteralType(type) ? type.regularType : isGenericTupleType(type) ? getNormalizedTupleType(type, writing) : getObjectFlags(type) & 4 ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 ? getSimplifiedType(type, writing) : type; + const t = isFreshLiteralType(type) ? type.regularType : isGenericTupleType(type) ? getNormalizedTupleType(type, writing) : getObjectFlags(type) & 4 ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 402653184 ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 16777216 ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 102760448 ? getSimplifiedType(type, writing) : type; if (t === type) return t; type = t; @@ -61958,7 +62103,7 @@ ${lanes.join(` if (reduced !== type) { return reduced; } - if (type.flags & 2097152 && shouldNormalizeIntersection(type)) { + if (type.flags & 268435456 && shouldNormalizeIntersection(type)) { const normalizedTypes = sameMap(type.types, (t) => getNormalizedType(t, writing)); if (normalizedTypes !== type.types) { return getIntersectionType(normalizedTypes); @@ -61970,8 +62115,8 @@ ${lanes.join(` let hasInstantiable = false; let hasNullableOrEmpty = false; for (const t of type.types) { - hasInstantiable || (hasInstantiable = !!(t.flags & 465829888)); - hasNullableOrEmpty || (hasNullableOrEmpty = !!(t.flags & 98304) || isEmptyAnonymousObjectType(t)); + hasInstantiable || (hasInstantiable = !!(t.flags & 132644864)); + hasNullableOrEmpty || (hasNullableOrEmpty = !!(t.flags & 12) || isEmptyAnonymousObjectType(t)); if (hasInstantiable && hasNullableOrEmpty) return true; } @@ -61979,7 +62124,7 @@ ${lanes.join(` } function getNormalizedTupleType(type, writing) { const elements = getElementTypes(type); - const normalizedElements = sameMap(elements, (t) => t.flags & 25165824 ? getSimplifiedType(t, writing) : t); + const normalizedElements = sameMap(elements, (t) => t.flags & 102760448 ? getSimplifiedType(t, writing) : t); return elements !== normalizedElements ? createNormalizedTupleType(type.target, normalizedElements) : type; } function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) { @@ -62180,13 +62325,13 @@ ${lanes.join(` const [sourceType, targetType] = getTypeNamesForErrorDisplay(source2, target2); let generalizedSource = source2; let generalizedSourceType = sourceType; - if (!(target2.flags & 131072) && isLiteralType(source2) && !typeCouldHaveTopLevelSingletonTypes(target2)) { + if (!(target2.flags & 262144) && isLiteralType(source2) && !typeCouldHaveTopLevelSingletonTypes(target2)) { generalizedSource = getBaseTypeOfLiteralType(source2); Debug.assert(!isTypeAssignableTo(generalizedSource, target2), "generalized source shouldn't be assignable"); generalizedSourceType = getTypeNameForErrorDisplay(generalizedSource); } - const targetFlags = target2.flags & 8388608 && !(source2.flags & 8388608) ? target2.objectType.flags : target2.flags; - if (targetFlags & 262144 && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) { + const targetFlags = target2.flags & 33554432 && !(source2.flags & 33554432) ? target2.objectType.flags : target2.flags; + if (targetFlags & 524288 && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) { const constraint = getBaseConstraintOfType(target2); let needsOriginalSource; if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source2, constraint)))) { @@ -62204,7 +62349,7 @@ ${lanes.join(` } else if (exactOptionalPropertyTypes && getExactOptionalUnassignableProperties(source2, target2).length) { message = Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_types_of_the_target_s_properties; } else { - if (source2.flags & 128 && target2.flags & 1048576) { + if (source2.flags & 1024 && target2.flags & 134217728) { const suggestedType = getSuggestedTypeForNonexistentStringLiteralType(source2, target2); if (suggestedType) { reportError(Diagnostics.Type_0_is_not_assignable_to_type_1_Did_you_mean_2, generalizedSourceType, targetType, typeToString(suggestedType)); @@ -62252,8 +62397,8 @@ ${lanes.join(` function isRelatedTo(originalSource, originalTarget, recursionFlags = 3, reportErrors2 = false, headMessage2, intersectionState = 0) { if (originalSource === originalTarget) return -1; - if (originalSource.flags & 524288 && originalTarget.flags & 402784252) { - if (relation === comparableRelation && !(originalTarget.flags & 131072) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : undefined)) { + if (originalSource.flags & 1048576 && originalTarget.flags & 12713980) { + if (relation === comparableRelation && !(originalTarget.flags & 262144) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : undefined)) { return -1; } if (reportErrors2) { @@ -62268,26 +62413,26 @@ ${lanes.join(` if (relation === identityRelation) { if (source2.flags !== target2.flags) return 0; - if (source2.flags & 67358815) + if (source2.flags & 394239) return -1; traceUnionsOrIntersectionsTooLarge(source2, target2); return recursiveTypeRelatedTo(source2, target2, false, 0, recursionFlags); } - if (source2.flags & 262144 && getConstraintOfType(source2) === target2) { + if (source2.flags & 524288 && getConstraintOfType(source2) === target2) { return -1; } - if (source2.flags & 470302716 && target2.flags & 1048576) { + if (source2.flags & 13893600 && target2.flags & 134217728) { const types = target2.types; - const candidate = types.length === 2 && types[0].flags & 98304 ? types[1] : types.length === 3 && types[0].flags & 98304 && types[1].flags & 98304 ? types[2] : undefined; - if (candidate && !(candidate.flags & 98304)) { + const candidate = types.length === 2 && types[0].flags & 12 ? types[1] : types.length === 3 && types[0].flags & 12 && types[1].flags & 12 ? types[2] : undefined; + if (candidate && !(candidate.flags & 12)) { target2 = getNormalizedType(candidate, true); if (source2 === target2) return -1; } } - if (relation === comparableRelation && !(target2.flags & 131072) && isSimpleTypeRelatedTo(target2, source2, relation) || isSimpleTypeRelatedTo(source2, target2, relation, reportErrors2 ? reportError : undefined)) + if (relation === comparableRelation && !(target2.flags & 262144) && isSimpleTypeRelatedTo(target2, source2, relation) || isSimpleTypeRelatedTo(source2, target2, relation, reportErrors2 ? reportError : undefined)) return -1; - if (source2.flags & 469499904 || target2.flags & 469499904) { + if (source2.flags & 536346624 || target2.flags & 536346624) { const isPerformingExcessPropertyChecks = !(intersectionState & 2) && (isObjectLiteralType2(source2) && getObjectFlags(source2) & 8192); if (isPerformingExcessPropertyChecks) { if (hasExcessProperties(source2, target2, reportErrors2)) { @@ -62297,7 +62442,7 @@ ${lanes.join(` return 0; } } - const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2) && source2.flags & (402784252 | 524288 | 2097152) && source2 !== globalObjectType && target2.flags & (524288 | 2097152) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2)); + const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2) && source2.flags & (12713980 | 1048576 | 268435456) && source2 !== globalObjectType && target2.flags & (1048576 | 268435456) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2)); const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048); if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) { if (reportErrors2) { @@ -62314,7 +62459,7 @@ ${lanes.join(` return 0; } traceUnionsOrIntersectionsTooLarge(source2, target2); - const skipCaching = source2.flags & 1048576 && source2.types.length < 4 && !(target2.flags & 1048576) || target2.flags & 1048576 && target2.types.length < 4 && !(source2.flags & 469499904); + const skipCaching = source2.flags & 134217728 && source2.types.length < 4 && !(target2.flags & 134217728) || target2.flags & 134217728 && target2.types.length < 4 && !(source2.flags & 536346624); const result2 = skipCaching ? unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) : recursiveTypeRelatedTo(source2, target2, reportErrors2, intersectionState, recursionFlags); if (result2) { return result2; @@ -62335,18 +62480,18 @@ ${lanes.join(` if (maybeSuppress) { overrideNextErrorInfo--; } - if (source2.flags & 524288 && target2.flags & 524288) { + if (source2.flags & 1048576 && target2.flags & 1048576) { const currentError = errorInfo; tryElaborateArrayLikeErrors(source2, target2, true); if (errorInfo !== currentError) { maybeSuppress = !!errorInfo; } } - if (source2.flags & 524288 && target2.flags & 402784252) { + if (source2.flags & 1048576 && target2.flags & 12713980) { tryElaborateErrorsForPrimitivesAndObjects(source2, target2); - } else if (source2.symbol && source2.flags & 524288 && globalObjectType === source2) { + } else if (source2.symbol && source2.flags & 1048576 && globalObjectType === source2) { reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead); - } else if (getObjectFlags(source2) & 2048 && target2.flags & 2097152) { + } else if (getObjectFlags(source2) & 2048 && target2.flags & 268435456) { const targetTypes = target2.types; const intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, errorNode); const intrinsicClassAttributes = getJsxType(JsxNames.IntrinsicClassAttributes, errorNode); @@ -62371,7 +62516,7 @@ ${lanes.join(` return; } reportRelationError(headMessage2, source2, target2); - if (source2.flags & 262144 && ((_b = (_a2 = source2.symbol) == null ? undefined : _a2.declarations) == null ? undefined : _b[0]) && !getConstraintOfType(source2)) { + if (source2.flags & 524288 && ((_b = (_a2 = source2.symbol) == null ? undefined : _a2.declarations) == null ? undefined : _b[0]) && !getConstraintOfType(source2)) { const syntheticParam = cloneTypeParameter(source2); syntheticParam.constraint = instantiateType(target2, makeUnaryTypeMapper(source2, syntheticParam)); if (hasNonCircularBaseConstraint(syntheticParam)) { @@ -62384,7 +62529,7 @@ ${lanes.join(` if (!tracing) { return; } - if (source2.flags & 3145728 && target2.flags & 3145728) { + if (source2.flags & 402653184 && target2.flags & 402653184) { const sourceUnionOrIntersection = source2; const targetUnionOrIntersection = target2; if (sourceUnionOrIntersection.objectFlags & targetUnionOrIntersection.objectFlags & 32768) { @@ -62408,7 +62553,7 @@ ${lanes.join(` const appendPropType = (propTypes, type) => { var _a2; type = getApparentType(type); - const prop = type.flags & 3145728 ? getPropertyOfUnionOrIntersectionType(type, name) : getPropertyOfObjectType(type, name); + const prop = type.flags & 402653184 ? getPropertyOfUnionOrIntersectionType(type, name) : getPropertyOfObjectType(type, name); const propType = prop && getTypeOfSymbol(prop) || ((_a2 = getApplicableIndexInfoForName(type, name)) == null ? undefined : _a2.type) || undefinedType; return append(propTypes, propType); }; @@ -62425,9 +62570,9 @@ ${lanes.join(` } let reducedTarget = target2; let checkTypes; - if (target2.flags & 1048576) { + if (target2.flags & 134217728) { reducedTarget = findMatchingDiscriminantType(source2, target2, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target2); - checkTypes = reducedTarget.flags & 1048576 ? reducedTarget.types : [reducedTarget]; + checkTypes = reducedTarget.flags & 134217728 ? reducedTarget.types : [reducedTarget]; } for (const prop of getPropertiesOfType(source2)) { if (shouldCheckAsExcessProperty(prop, source2.symbol) && !isIgnoredJsxProperty(source2, prop)) { @@ -62483,33 +62628,33 @@ ${lanes.join(` return prop.valueDeclaration && container.valueDeclaration && prop.valueDeclaration.parent === container.valueDeclaration; } function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) { - if (source2.flags & 1048576) { - if (target2.flags & 1048576) { + if (source2.flags & 134217728) { + if (target2.flags & 134217728) { const sourceOrigin = source2.origin; - if (sourceOrigin && sourceOrigin.flags & 2097152 && target2.aliasSymbol && contains(sourceOrigin.types, target2)) { + if (sourceOrigin && sourceOrigin.flags & 268435456 && target2.aliasSymbol && contains(sourceOrigin.types, target2)) { return -1; } const targetOrigin = target2.origin; - if (targetOrigin && targetOrigin.flags & 1048576 && source2.aliasSymbol && contains(targetOrigin.types, source2)) { + if (targetOrigin && targetOrigin.flags & 134217728 && source2.aliasSymbol && contains(targetOrigin.types, source2)) { return -1; } } - return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252), intersectionState); + return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 12713980), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 12713980), intersectionState); } - if (target2.flags & 1048576) { - return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252) && !(target2.flags & 402784252), intersectionState); + if (target2.flags & 134217728) { + return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 12713980) && !(target2.flags & 12713980), intersectionState); } - if (target2.flags & 2097152) { + if (target2.flags & 268435456) { return typeRelatedToEachType(source2, target2, reportErrors2, 2); } - if (relation === comparableRelation && target2.flags & 402784252) { - const constraints = sameMap(source2.types, (t) => t.flags & 465829888 ? getBaseConstraintOfType(t) || unknownType : t); + if (relation === comparableRelation && target2.flags & 12713980) { + const constraints = sameMap(source2.types, (t) => t.flags & 132644864 ? getBaseConstraintOfType(t) || unknownType : t); if (constraints !== source2.types) { source2 = getIntersectionType(constraints); - if (source2.flags & 131072) { + if (source2.flags & 262144) { return 0; } - if (!(source2.flags & 2097152)) { + if (!(source2.flags & 268435456)) { return isRelatedTo(source2, target2, 1, false) || isRelatedTo(target2, source2, 1, false); } } @@ -62530,13 +62675,13 @@ ${lanes.join(` } function typeRelatedToSomeType(source2, target2, reportErrors2, intersectionState) { const targetTypes = target2.types; - if (target2.flags & 1048576) { + if (target2.flags & 134217728) { if (containsType(targetTypes, source2)) { return -1; } - if (relation !== comparableRelation && getObjectFlags(target2) & 32768 && !(source2.flags & 1024) && (source2.flags & (128 | 512 | 2048) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 256)) { + if (relation !== comparableRelation && getObjectFlags(target2) & 32768 && !(source2.flags & 32768) && (source2.flags & (1024 | 8192 | 4096) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 2048)) { const alternateForm = source2 === source2.regularType ? source2.freshType : source2.regularType; - const primitive = source2.flags & 128 ? stringType : source2.flags & 256 ? numberType : source2.flags & 2048 ? bigintType : undefined; + const primitive = source2.flags & 1024 ? stringType : source2.flags & 2048 ? numberType : source2.flags & 4096 ? bigintType : undefined; return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? -1 : 0; } const match = getMatchingUnionConstituentForType(target2, source2); @@ -62575,7 +62720,7 @@ ${lanes.join(` } function someTypeRelatedToType(source2, target2, reportErrors2, intersectionState) { const sourceTypes = source2.types; - if (source2.flags & 1048576 && containsType(sourceTypes, target2)) { + if (source2.flags & 134217728 && containsType(sourceTypes, target2)) { return -1; } const len = sourceTypes.length; @@ -62588,8 +62733,8 @@ ${lanes.join(` return 0; } function getUndefinedStrippedTargetIfNeeded(source2, target2) { - if (source2.flags & 1048576 && target2.flags & 1048576 && !(source2.types[0].flags & 32768) && target2.types[0].flags & 32768) { - return extractTypesOfKind(target2, ~32768); + if (source2.flags & 134217728 && target2.flags & 134217728 && !(source2.types[0].flags & 4) && target2.types[0].flags & 4) { + return extractTypesOfKind(target2, ~4); } return target2; } @@ -62599,7 +62744,7 @@ ${lanes.join(` const undefinedStrippedTarget = getUndefinedStrippedTargetIfNeeded(source2, target2); for (let i = 0;i < sourceTypes.length; i++) { const sourceType = sourceTypes[i]; - if (undefinedStrippedTarget.flags & 1048576 && sourceTypes.length >= undefinedStrippedTarget.types.length && sourceTypes.length % undefinedStrippedTarget.types.length === 0) { + if (undefinedStrippedTarget.flags & 134217728 && sourceTypes.length >= undefinedStrippedTarget.types.length && sourceTypes.length % undefinedStrippedTarget.types.length === 0) { const related2 = isRelatedTo(sourceType, undefinedStrippedTarget.types[i % undefinedStrippedTarget.types.length], 3, false, undefined, intersectionState); if (related2) { result2 &= related2; @@ -62629,19 +62774,24 @@ ${lanes.join(` let related = -1; if (varianceFlags & 8) { related = relation === identityRelation ? isRelatedTo(s, t, 3, false) : compareTypesIdentical(s, t); - } else if (variance === 1) { - related = isRelatedTo(s, t, 3, reportErrors2, undefined, intersectionState); - } else if (variance === 2) { - related = isRelatedTo(t, s, 3, reportErrors2, undefined, intersectionState); - } else if (variance === 3) { - related = isRelatedTo(t, s, 3, false); - if (!related) { - related = isRelatedTo(s, t, 3, reportErrors2, undefined, intersectionState); - } } else { - related = isRelatedTo(s, t, 3, reportErrors2, undefined, intersectionState); - if (related) { - related &= isRelatedTo(t, s, 3, reportErrors2, undefined, intersectionState); + if (inVarianceComputation && varianceFlags & 16) { + instantiateType(s, reportUnreliableMapper); + } + if (variance === 1) { + related = isRelatedTo(s, t, 3, reportErrors2, undefined, intersectionState); + } else if (variance === 2) { + related = isRelatedTo(t, s, 3, reportErrors2, undefined, intersectionState); + } else if (variance === 3) { + related = isRelatedTo(t, s, 3, false); + if (!related) { + related = isRelatedTo(s, t, 3, reportErrors2, undefined, intersectionState); + } + } else { + related = isRelatedTo(s, t, 3, reportErrors2, undefined, intersectionState); + if (related) { + related &= isRelatedTo(t, s, 3, reportErrors2, undefined, intersectionState); + } } } if (!related) { @@ -62781,18 +62931,18 @@ ${lanes.join(` const saveErrorInfo = captureErrorCalculationState(); let result2 = structuredTypeRelatedToWorker(source2, target2, reportErrors2, intersectionState, saveErrorInfo); if (relation !== identityRelation) { - if (!result2 && (source2.flags & 2097152 || source2.flags & 262144 && target2.flags & 1048576)) { - const constraint = getEffectiveConstraintOfIntersection(source2.flags & 2097152 ? source2.types : [source2], !!(target2.flags & 1048576)); + if (!result2 && (source2.flags & 268435456 || source2.flags & 524288 && target2.flags & 134217728)) { + const constraint = getEffectiveConstraintOfIntersection(source2.flags & 268435456 ? source2.types : [source2], !!(target2.flags & 134217728)); if (constraint && everyType(constraint, (c) => c !== source2)) { result2 = isRelatedTo(constraint, target2, 1, false, undefined, intersectionState); } } - if (result2 && !(intersectionState & 2) && target2.flags & 2097152 && !isGenericObjectType(target2) && source2.flags & (524288 | 2097152)) { + if (result2 && !(intersectionState & 2) && target2.flags & 268435456 && !isGenericObjectType(target2) && source2.flags & (1048576 | 268435456)) { result2 &= propertiesRelatedTo(source2, target2, reportErrors2, undefined, false, 0); if (result2 && isObjectLiteralType2(source2) && getObjectFlags(source2) & 8192) { result2 &= indexSignaturesRelatedTo(source2, target2, false, reportErrors2, 0); } - } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 && getApparentType(source2).flags & 3670016 && !some(source2.types, (t) => t === target2 || !!(getObjectFlags(t) & 262144))) { + } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 268435456 && getApparentType(source2).flags & 403701760 && !some(source2.types, (t) => t === target2 || !!(getObjectFlags(t) & 262144))) { result2 &= propertiesRelatedTo(source2, target2, reportErrors2, undefined, true, intersectionState); } } @@ -62804,7 +62954,7 @@ ${lanes.join(` function getApparentMappedTypeKeys(nameType, targetType) { const modifiersType = getApparentType(getModifiersTypeFromMappedType(targetType)); const mappedKeys = []; - forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576, false, (t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))); + forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 19456, false, (t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t)))); return getUnionType(mappedKeys); } function structuredTypeRelatedToWorker(source2, target2, reportErrors2, intersectionState, saveErrorInfo) { @@ -62814,24 +62964,24 @@ ${lanes.join(` let sourceFlags = source2.flags; const targetFlags = target2.flags; if (relation === identityRelation) { - if (sourceFlags & 3145728) { + if (sourceFlags & 402653184) { let result3 = eachTypeRelatedToSomeType(source2, target2); if (result3) { result3 &= eachTypeRelatedToSomeType(target2, source2); } return result3; } - if (sourceFlags & 4194304) { + if (sourceFlags & 2097152) { return isRelatedTo(source2.type, target2.type, 3, false); } - if (sourceFlags & 8388608) { + if (sourceFlags & 33554432) { if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3, false)) { if (result2 &= isRelatedTo(source2.indexType, target2.indexType, 3, false)) { return result2; } } } - if (sourceFlags & 16777216) { + if (sourceFlags & 67108864) { if (source2.root.isDistributive === target2.root.isDistributive) { if (result2 = isRelatedTo(source2.checkType, target2.checkType, 3, false)) { if (result2 &= isRelatedTo(source2.extendsType, target2.extendsType, 3, false)) { @@ -62844,14 +62994,14 @@ ${lanes.join(` } } } - if (sourceFlags & 33554432) { + if (sourceFlags & 16777216) { if (result2 = isRelatedTo(source2.baseType, target2.baseType, 3, false)) { if (result2 &= isRelatedTo(source2.constraint, target2.constraint, 3, false)) { return result2; } } } - if (sourceFlags & 134217728) { + if (sourceFlags & 4194304) { if (arrayIsEqualTo(source2.texts, target2.texts)) { const sourceTypes = source2.types; const targetTypes = target2.types; @@ -62864,23 +63014,23 @@ ${lanes.join(` return result2; } } - if (sourceFlags & 268435456) { + if (sourceFlags & 8388608) { if (source2.symbol === target2.symbol) { return isRelatedTo(source2.type, target2.type, 3, false); } } - if (!(sourceFlags & 524288)) { + if (!(sourceFlags & 1048576)) { return 0; } - } else if (sourceFlags & 3145728 || targetFlags & 3145728) { + } else if (sourceFlags & 402653184 || targetFlags & 402653184) { if (result2 = unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState)) { return result2; } - if (!(sourceFlags & 465829888 || sourceFlags & 524288 && targetFlags & 1048576 || sourceFlags & 2097152 && targetFlags & (524288 | 1048576 | 465829888))) { + if (!(sourceFlags & 132644864 || sourceFlags & 1048576 && targetFlags & 134217728 || sourceFlags & 268435456 && targetFlags & (1048576 | 134217728 | 132644864))) { return 0; } } - if (sourceFlags & (524288 | 16777216) && source2.aliasSymbol && source2.aliasTypeArguments && source2.aliasSymbol === target2.aliasSymbol && !(isMarkerType(source2) || isMarkerType(target2))) { + if (sourceFlags & (1048576 | 67108864) && source2.aliasSymbol && source2.aliasTypeArguments && source2.aliasSymbol === target2.aliasSymbol && !(isMarkerType(source2) || isMarkerType(target2))) { const variances = getAliasVariances(source2.aliasSymbol); if (variances === emptyArray) { return 1; @@ -62897,7 +63047,7 @@ ${lanes.join(` if (isSingleElementGenericTupleType(source2) && !source2.target.readonly && (result2 = isRelatedTo(getTypeArguments(source2)[0], target2, 1)) || isSingleElementGenericTupleType(target2) && (target2.target.readonly || isMutableArrayOrTuple(getBaseConstraintOfType(source2) || source2)) && (result2 = isRelatedTo(source2, getTypeArguments(target2)[0], 2))) { return result2; } - if (targetFlags & 262144) { + if (targetFlags & 524288) { if (getObjectFlags(source2) & 32 && !source2.declaration.nameType && isRelatedTo(getIndexType(target2), getConstraintTypeFromMappedType(source2), 3)) { if (!(getMappedTypeModifiers(source2) & 4)) { const templateType = getTemplateTypeFromMappedType(source2); @@ -62907,10 +63057,10 @@ ${lanes.join(` } } } - if (relation === comparableRelation && sourceFlags & 262144) { + if (relation === comparableRelation && sourceFlags & 524288) { let constraint = getConstraintOfTypeParameter(source2); if (constraint) { - while (constraint && someType(constraint, (c) => !!(c.flags & 262144))) { + while (constraint && someType(constraint, (c) => !!(c.flags & 524288))) { if (result2 = isRelatedTo(constraint, target2, 1, false)) { return result2; } @@ -62919,9 +63069,9 @@ ${lanes.join(` } return 0; } - } else if (targetFlags & 4194304) { + } else if (targetFlags & 2097152) { const targetType = target2.type; - if (sourceFlags & 4194304) { + if (sourceFlags & 2097152) { if (result2 = isRelatedTo(targetType, source2.type, 3, false)) { return result2; } @@ -62951,8 +63101,8 @@ ${lanes.join(` } } } - } else if (targetFlags & 8388608) { - if (sourceFlags & 8388608) { + } else if (targetFlags & 33554432) { + if (sourceFlags & 33554432) { if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3, reportErrors2)) { result2 &= isRelatedTo(source2.indexType, target2.indexType, 3, reportErrors2); } @@ -62992,7 +63142,7 @@ ${lanes.join(` const templateType = getTemplateTypeFromMappedType(target2); const modifiers = getMappedTypeModifiers(target2); if (!(modifiers & 8)) { - if (!keysRemapped && templateType.flags & 8388608 && templateType.objectType === source2 && templateType.indexType === getTypeParameterFromMappedType(target2)) { + if (!keysRemapped && templateType.flags & 33554432 && templateType.objectType === source2 && templateType.indexType === getTypeParameterFromMappedType(target2)) { return -1; } if (!isGenericMappedType(source2)) { @@ -63000,11 +63150,11 @@ ${lanes.join(` const sourceKeys = getIndexType(source2, 2); const includeOptional = modifiers & 4; const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : undefined; - if (includeOptional ? !(filteredByApplicability.flags & 131072) : isRelatedTo(targetKeys, sourceKeys, 3)) { + if (includeOptional ? !(filteredByApplicability.flags & 262144) : isRelatedTo(targetKeys, sourceKeys, 3)) { const templateType2 = getTemplateTypeFromMappedType(target2); const typeParameter = getTypeParameterFromMappedType(target2); - const nonNullComponent = extractTypesOfKind(templateType2, ~98304); - if (!keysRemapped && nonNullComponent.flags & 8388608 && nonNullComponent.indexType === typeParameter) { + const nonNullComponent = extractTypesOfKind(templateType2, ~12); + if (!keysRemapped && nonNullComponent.flags & 33554432 && nonNullComponent.indexType === typeParameter) { if (result2 = isRelatedTo(source2, nonNullComponent.objectType, 2, reportErrors2)) { return result2; } @@ -63020,12 +63170,12 @@ ${lanes.join(` resetErrorInfo(saveErrorInfo); } } - } else if (targetFlags & 16777216) { + } else if (targetFlags & 67108864) { if (isDeeplyNestedType(target2, targetStack, targetDepth, 10)) { return 3; } const c = target2; - if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 && source2.root === c.root)) { + if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 67108864 && 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 : isRelatedTo(source2, getTrueTypeFromConditionalType(c), 2, false, undefined, intersectionState)) { @@ -63035,8 +63185,8 @@ ${lanes.join(` } } } - } else if (targetFlags & 134217728) { - if (sourceFlags & 134217728) { + } else if (targetFlags & 4194304) { + if (sourceFlags & 4194304) { if (relation === comparableRelation) { return templateLiteralTypesDefinitelyUnrelated(source2, target2) ? 0 : -1; } @@ -63045,19 +63195,19 @@ ${lanes.join(` if (isTypeMatchedByTemplateLiteralType(source2, target2)) { return -1; } - } else if (target2.flags & 268435456) { - if (!(source2.flags & 268435456)) { + } else if (target2.flags & 8388608) { + if (!(source2.flags & 8388608)) { if (isMemberOfStringMapping(source2, target2)) { return -1; } } } - if (sourceFlags & 8650752) { - if (!(sourceFlags & 8388608 && targetFlags & 8388608)) { + if (sourceFlags & 34078720) { + if (!(sourceFlags & 33554432 && targetFlags & 33554432)) { const constraint = getConstraintOfType(source2) || unknownType; if (result2 = isRelatedTo(constraint, target2, 1, false, undefined, intersectionState)) { return result2; - } else if (result2 = isRelatedTo(getTypeWithThisArgument(constraint, source2), target2, 1, reportErrors2 && constraint !== unknownType && !(targetFlags & sourceFlags & 262144), undefined, intersectionState)) { + } else if (result2 = isRelatedTo(getTypeWithThisArgument(constraint, source2), target2, 1, reportErrors2 && constraint !== unknownType && !(targetFlags & sourceFlags & 524288), undefined, intersectionState)) { return result2; } if (isMappedTypeGenericIndexedAccess(source2)) { @@ -63069,7 +63219,7 @@ ${lanes.join(` } } } - } else if (sourceFlags & 4194304) { + } else if (sourceFlags & 2097152) { const isDeferredMappedIndex = shouldDeferIndexType(source2.type, source2.indexFlags) && getObjectFlags(source2.type) & 32; if (result2 = isRelatedTo(stringNumberSymbolType, target2, 1, reportErrors2 && !isDeferredMappedIndex)) { return result2; @@ -63082,15 +63232,15 @@ ${lanes.join(` return result2; } } - } else if (sourceFlags & 134217728 && !(targetFlags & 524288)) { - if (!(targetFlags & 134217728)) { + } else if (sourceFlags & 4194304 && !(targetFlags & 1048576)) { + if (!(targetFlags & 4194304)) { const constraint = getBaseConstraintOfType(source2); if (constraint && constraint !== source2 && (result2 = isRelatedTo(constraint, target2, 1, reportErrors2))) { return result2; } } - } else if (sourceFlags & 268435456) { - if (targetFlags & 268435456) { + } else if (sourceFlags & 8388608) { + if (targetFlags & 8388608) { if (source2.symbol !== target2.symbol) { return 0; } @@ -63103,11 +63253,11 @@ ${lanes.join(` return result2; } } - } else if (sourceFlags & 16777216) { + } else if (sourceFlags & 67108864) { if (isDeeplyNestedType(source2, sourceStack, sourceDepth, 10)) { return 3; } - if (targetFlags & 16777216) { + if (targetFlags & 67108864) { const sourceParams = source2.root.inferTypeParameters; let sourceExtends = source2.extendsType; let mapper; @@ -63132,7 +63282,7 @@ ${lanes.join(` return result2; } } - const distributiveConstraint = !(targetFlags & 16777216) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : undefined; + const distributiveConstraint = !(targetFlags & 67108864) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : undefined; if (distributiveConstraint) { resetErrorInfo(saveErrorInfo); if (result2 = isRelatedTo(distributiveConstraint, target2, 1, reportErrors2)) { @@ -63151,7 +63301,7 @@ ${lanes.join(` } return 0; } - const sourceIsPrimitive = !!(sourceFlags & 402784252); + const sourceIsPrimitive = !!(sourceFlags & 12713980); if (relation !== identityRelation) { source2 = getApparentType(source2); sourceFlags = source2.flags; @@ -63184,7 +63334,7 @@ ${lanes.join(` } else if ((relation === subtypeRelation || relation === strictSubtypeRelation) && isEmptyObjectType(target2) && getObjectFlags(target2) & 8192 && !isEmptyObjectType(source2)) { return 0; } - if (sourceFlags & (524288 | 2097152) && targetFlags & 524288) { + if (sourceFlags & (1048576 | 268435456) && targetFlags & 1048576) { const reportStructuralErrors = reportErrors2 && errorInfo === saveErrorInfo.errorInfo && !sourceIsPrimitive; result2 = propertiesRelatedTo(source2, target2, reportStructuralErrors, undefined, false, intersectionState); if (result2) { @@ -63202,9 +63352,9 @@ ${lanes.join(` return result2; } } - if (sourceFlags & (524288 | 2097152) && targetFlags & 1048576) { - const objectOnlyTarget = extractTypesOfKind(target2, 524288 | 2097152 | 33554432); - if (objectOnlyTarget.flags & 1048576) { + if (sourceFlags & (1048576 | 268435456) && targetFlags & 134217728) { + const objectOnlyTarget = extractTypesOfKind(target2, 1048576 | 268435456 | 16777216); + if (objectOnlyTarget.flags & 134217728) { const result3 = typeRelatedToDiscriminatedType(source2, objectOnlyTarget); if (result3) { return result3; @@ -63272,7 +63422,7 @@ ${lanes.join(` for (let i = 0;i < sourcePropertiesFiltered.length; i++) { const sourceProperty = sourcePropertiesFiltered[i]; const sourcePropertyType = getNonMissingTypeOfSymbol(sourceProperty); - sourceDiscriminantTypes[i] = sourcePropertyType.flags & 1048576 ? sourcePropertyType.types : [sourcePropertyType]; + sourceDiscriminantTypes[i] = sourcePropertyType.flags & 134217728 ? sourcePropertyType.types : [sourcePropertyType]; excludedProperties.add(sourceProperty.escapedName); } const discriminantCombinations = cartesianProduct(sourceDiscriminantTypes); @@ -63530,13 +63680,10 @@ ${lanes.join(` if (isObjectLiteralType2(target2)) { for (const sourceProp of excludeProperties(getPropertiesOfType(source2), excludedProperties)) { if (!getPropertyOfObjectType(target2, sourceProp.escapedName)) { - const sourceType = getTypeOfSymbol(sourceProp); - if (!(sourceType.flags & 32768)) { - if (reportErrors2) { - reportError(Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target2)); - } - return 0; + if (reportErrors2) { + reportError(Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target2)); } + return 0; } } } @@ -63558,7 +63705,7 @@ ${lanes.join(` return result2; } function propertiesIdenticalTo(source2, target2, excludedProperties) { - if (!(source2.flags & 524288 && target2.flags & 524288)) { + if (!(source2.flags & 1048576 && target2.flags & 1048576)) { return 0; } const sourceProperties = excludeProperties(getPropertiesOfObjectType(source2), excludedProperties); @@ -63585,9 +63732,12 @@ ${lanes.join(` if (relation === identityRelation) { return signaturesIdenticalTo(source2, target2, kind); } - if (target2 === anyFunctionType || source2 === anyFunctionType) { + if (source2 === anyFunctionType) { return -1; } + if (target2 === anyFunctionType) { + return 0; + } const sourceIsJSConstructor = source2.symbol && isJSConstructor(source2.symbol.valueDeclaration); const targetIsJSConstructor = target2.symbol && isJSConstructor(target2.symbol.valueDeclaration); const sourceSignatures = getSignaturesOfType(source2, sourceIsJSConstructor && kind === 1 ? 0 : kind); @@ -63701,14 +63851,14 @@ ${lanes.join(` function membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) { let result2 = -1; const keyType = targetInfo.keyType; - const props = source2.flags & 2097152 ? getPropertiesOfUnionOrIntersectionType(source2) : getPropertiesOfObjectType(source2); + const props = source2.flags & 268435456 ? getPropertiesOfUnionOrIntersectionType(source2) : getPropertiesOfObjectType(source2); for (const prop of props) { if (isIgnoredJsxProperty(source2, prop)) { continue; } - if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 8576), keyType)) { + if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 19456), keyType)) { const propType = getNonMissingTypeOfSymbol(prop); - const type = exactOptionalPropertyTypes || propType.flags & 32768 || keyType === numberType || !(prop.flags & 16777216) ? propType : getTypeWithFacts(propType, 524288); + const type = exactOptionalPropertyTypes || propType.flags & 4 || keyType === numberType || !(prop.flags & 16777216) ? propType : getTypeWithFacts(propType, 524288); const related = isRelatedTo(type, targetInfo.type, 3, reportErrors2, undefined, intersectionState); if (!related) { if (reportErrors2) { @@ -63806,19 +63956,19 @@ ${lanes.join(` } } function typeCouldHaveTopLevelSingletonTypes(type) { - if (type.flags & 16) { + if (type.flags & 256) { return false; } - if (type.flags & 3145728) { + if (type.flags & 402653184) { return !!forEach(type.types, typeCouldHaveTopLevelSingletonTypes); } - if (type.flags & 465829888) { + if (type.flags & 132644864) { const constraint = getConstraintOfType(type); if (constraint && constraint !== type) { return typeCouldHaveTopLevelSingletonTypes(constraint); } } - return isUnitType(type) || !!(type.flags & 134217728) || !!(type.flags & 268435456); + return isUnitType(type) || !!(type.flags & 4194304) || !!(type.flags & 8388608); } function getExactOptionalUnassignableProperties(source, target) { if (isTupleType(source) && isTupleType(target)) @@ -63826,7 +63976,7 @@ ${lanes.join(` return getPropertiesOfType(target).filter((targetProp) => isExactOptionalPropertyMismatch(getTypeOfPropertyOfType(source, targetProp.escapedName), getTypeOfSymbol(targetProp))); } function isExactOptionalPropertyMismatch(source, target) { - return !!source && !!target && maybeTypeOfKind(source, 32768) && !!containsMissingType(target); + return !!source && !!target && maybeTypeOfKind(source, 4) && !!containsMissingType(target); } function getExactOptionalProperties(type) { return getPropertiesOfType(type).filter((targetProp) => containsMissingType(getTypeOfSymbol(targetProp))); @@ -63836,7 +63986,7 @@ ${lanes.join(` } function discriminateTypeByDiscriminableItems(target, discriminators, related) { const types = target.types; - const include = types.map((t) => t.flags & 402784252 ? 0 : -1); + const include = types.map((t) => t.flags & 12713980 || getReducedType(t).flags & 262144 ? 0 : -1); for (const [getDiscriminatingType, propertyName] of discriminators) { let matched = false; for (let i = 0;i < types.length; i++) { @@ -63858,17 +64008,17 @@ ${lanes.join(` } } const filtered = contains(include, 0) ? getUnionType(types.filter((_, i) => include[i]), 0) : target; - return filtered.flags & 131072 ? target : filtered; + return filtered.flags & 262144 ? target : filtered; } function isWeakType(type) { - if (type.flags & 524288) { + if (type.flags & 1048576) { const resolved = resolveStructuredTypeMembers(type); return resolved.callSignatures.length === 0 && resolved.constructSignatures.length === 0 && resolved.indexInfos.length === 0 && resolved.properties.length > 0 && every(resolved.properties, (p) => !!(p.flags & 16777216)); } - if (type.flags & 33554432) { + if (type.flags & 16777216) { return isWeakType(type.baseType); } - if (type.flags & 2097152) { + if (type.flags & 268435456) { return every(type.types, isWeakType); } return false; @@ -63954,20 +64104,20 @@ ${lanes.join(` } function hasCovariantVoidArgument(typeArguments, variances) { for (let i = 0;i < variances.length; i++) { - if ((variances[i] & 7) === 1 && typeArguments[i].flags & 16384) { + if ((variances[i] & 7) === 1 && typeArguments[i].flags & 16) { return true; } } return false; } function isUnconstrainedTypeParameter(type) { - return type.flags & 262144 && !getConstraintOfTypeParameter(type); + return type.flags & 524288 && !getConstraintOfTypeParameter(type); } function isNonDeferredTypeReference(type) { return !!(getObjectFlags(type) & 4) && !type.node; } function isTypeReferenceWithGenericArguments(type) { - return isNonDeferredTypeReference(type) && some(getTypeArguments(type), (t) => !!(t.flags & 262144) || isTypeReferenceWithGenericArguments(t)); + return isNonDeferredTypeReference(type) && some(getTypeArguments(type), (t) => !!(t.flags & 524288) || isTypeReferenceWithGenericArguments(t)); } function getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) { const typeParameters = []; @@ -63978,7 +64128,7 @@ ${lanes.join(` function getTypeReferenceId(type, depth = 0) { let result = "" + type.target.id; for (const t of getTypeArguments(type)) { - if (t.flags & 262144) { + if (t.flags & 524288) { if (ignoreConstraints || isUnconstrainedTypeParameter(t)) { let index = typeParameters.indexOf(t); if (index < 0) { @@ -64045,7 +64195,7 @@ ${lanes.join(` if ((getObjectFlags(type) & 96) === 96) { type = getMappedTargetWithSymbol(type); } - if (type.flags & 2097152) { + if (type.flags & 268435456) { return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth)); } const identity2 = getRecursionIdentity(type); @@ -64068,7 +64218,7 @@ ${lanes.join(` } function getMappedTargetWithSymbol(type) { let target; - while ((getObjectFlags(type) & 96) === 96 && (target = getModifiersTypeFromMappedType(type)) && (target.symbol || target.flags & 2097152 && some(target.types, (t) => !!t.symbol))) { + while ((getObjectFlags(type) & 96) === 96 && (target = getModifiersTypeFromMappedType(type)) && (target.symbol || target.flags & 268435456 && some(target.types, (t) => !!t.symbol))) { type = target; } return type; @@ -64077,13 +64227,13 @@ ${lanes.join(` if ((getObjectFlags(type) & 96) === 96) { type = getMappedTargetWithSymbol(type); } - if (type.flags & 2097152) { + if (type.flags & 268435456) { return some(type.types, (t) => hasMatchingRecursionIdentity(t, identity2)); } return getRecursionIdentity(type) === identity2; } function getRecursionIdentity(type) { - if (type.flags & 524288 && !isObjectOrArrayLiteralType(type)) { + if (type.flags & 1048576 && !isObjectOrArrayLiteralType(type)) { if (getObjectFlags(type) & 4 && type.node) { return type.node; } @@ -64094,16 +64244,16 @@ ${lanes.join(` return type.target; } } - if (type.flags & 262144) { + if (type.flags & 524288) { return type.symbol; } - if (type.flags & 8388608) { + if (type.flags & 33554432) { do { type = type.objectType; - } while (type.flags & 8388608); + } while (type.flags & 33554432); return type; } - if (type.flags & 16777216) { + if (type.flags & 67108864) { return type.root; } return type; @@ -64111,7 +64261,7 @@ ${lanes.join(` function isPropertyIdenticalTo(sourceProp, targetProp) { return compareProperties2(sourceProp, targetProp, compareTypesIdentical) !== 0; } - function compareProperties2(sourceProp, targetProp, compareTypes) { + function compareProperties2(sourceProp, targetProp, compareTypes2) { if (sourceProp === targetProp) { return -1; } @@ -64132,7 +64282,7 @@ ${lanes.join(` if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) { return 0; } - return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + return compareTypes2(getNonMissingTypeOfSymbol(sourceProp), getNonMissingTypeOfSymbol(targetProp)); } function isMatchingSignature(source, target, partialMatch) { const sourceParameterCount = getParameterCount(source); @@ -64149,7 +64299,7 @@ ${lanes.join(` } return false; } - function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) { + function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes2) { if (source === target) { return -1; } @@ -64164,7 +64314,7 @@ ${lanes.join(` for (let i = 0;i < target.typeParameters.length; i++) { const s = source.typeParameters[i]; const t = target.typeParameters[i]; - if (!(s === t || compareTypes(instantiateType(getConstraintFromTypeParameter(s), mapper) || unknownType, getConstraintFromTypeParameter(t) || unknownType) && compareTypes(instantiateType(getDefaultFromTypeParameter(s), mapper) || unknownType, getDefaultFromTypeParameter(t) || unknownType))) { + if (!(s === t || compareTypes2(instantiateType(getConstraintFromTypeParameter(s), mapper) || unknownType, getConstraintFromTypeParameter(t) || unknownType) && compareTypes2(instantiateType(getDefaultFromTypeParameter(s), mapper) || unknownType, getDefaultFromTypeParameter(t) || unknownType))) { return 0; } } @@ -64176,7 +64326,7 @@ ${lanes.join(` if (sourceThisType) { const targetThisType = getThisTypeOfSignature(target); if (targetThisType) { - const related = compareTypes(sourceThisType, targetThisType); + const related = compareTypes2(sourceThisType, targetThisType); if (!related) { return 0; } @@ -64188,7 +64338,7 @@ ${lanes.join(` for (let i = 0;i < targetLen; i++) { const s = getTypeAtPosition(source, i); const t = getTypeAtPosition(target, i); - const related = compareTypes(t, s); + const related = compareTypes2(t, s); if (!related) { return 0; } @@ -64197,17 +64347,17 @@ ${lanes.join(` if (!ignoreReturnTypes) { const sourceTypePredicate = getTypePredicateOfSignature(source); const targetTypePredicate = getTypePredicateOfSignature(target); - result &= sourceTypePredicate || targetTypePredicate ? compareTypePredicatesIdentical(sourceTypePredicate, targetTypePredicate, compareTypes) : compareTypes(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); + result &= sourceTypePredicate || targetTypePredicate ? compareTypePredicatesIdentical(sourceTypePredicate, targetTypePredicate, compareTypes2) : compareTypes2(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target)); } return result; } - function compareTypePredicatesIdentical(source, target, compareTypes) { - return !(source && target && typePredicateKindsMatch(source, target)) ? 0 : source.type === target.type ? -1 : source.type && target.type ? compareTypes(source.type, target.type) : 0; + function compareTypePredicatesIdentical(source, target, compareTypes2) { + return !(source && target && typePredicateKindsMatch(source, target)) ? 0 : source.type === target.type ? -1 : source.type && target.type ? compareTypes2(source.type, target.type) : 0; } function literalTypesWithSameBaseType(types) { let commonBaseType; for (const t of types) { - if (!(t.flags & 131072)) { + if (!(t.flags & 262144)) { const baseType = getBaseTypeOfLiteralType(t); commonBaseType ?? (commonBaseType = baseType); if (baseType === t || baseType !== commonBaseType) { @@ -64218,15 +64368,15 @@ ${lanes.join(` return true; } function getCombinedTypeFlags(types) { - return reduceLeft(types, (flags, t) => flags | (t.flags & 1048576 ? getCombinedTypeFlags(t.types) : t.flags), 0); + return reduceLeft(types, (flags, t) => flags | (t.flags & 134217728 ? getCombinedTypeFlags(t.types) : t.flags), 0); } function getCommonSupertype(types) { if (types.length === 1) { return types[0]; } - const primaryTypes = strictNullChecks ? sameMap(types, (t) => filterType(t, (u) => !(u.flags & 98304))) : types; + const primaryTypes = strictNullChecks ? sameMap(types, (t) => filterType(t, (u) => !(u.flags & 12))) : types; const superTypeOrUnion = literalTypesWithSameBaseType(primaryTypes) ? getUnionType(primaryTypes) : getSingleCommonSupertype(primaryTypes); - return primaryTypes === types ? superTypeOrUnion : getNullableType(superTypeOrUnion, getCombinedTypeFlags(types) & 98304); + return primaryTypes === types ? superTypeOrUnion : getNullableType(superTypeOrUnion, getCombinedTypeFlags(types) & 12); } function getSingleCommonSupertype(types) { const candidate = reduceLeft(types, (s, t) => isTypeStrictSubtypeOf(s, t) ? t : s); @@ -64251,10 +64401,10 @@ ${lanes.join(` return isArrayType(type) ? getTypeArguments(type)[0] : undefined; } function isArrayLikeType(type) { - return isArrayType(type) || !(type.flags & 98304) && isTypeAssignableTo(type, anyReadonlyArrayType); + return isArrayType(type) || !(type.flags & 12) && isTypeAssignableTo(type, anyReadonlyArrayType); } function isMutableArrayLikeType(type) { - return isMutableArrayOrTuple(type) || !(type.flags & (1 | 98304)) && isTypeAssignableTo(type, anyArrayType); + return isMutableArrayOrTuple(type) || !(type.flags & (1 | 12)) && isTypeAssignableTo(type, anyArrayType); } function getSingleBaseForNonAugmentingSubtype(type) { if (!(getObjectFlags(type) & 4) || !(getObjectFlags(type.target) & 3)) { @@ -64294,7 +64444,7 @@ ${lanes.join(` } function isTupleLikeType(type) { let lengthType; - return isTupleType(type) || !!getPropertyOfType(type, "0") || isArrayLikeType(type) && !!(lengthType = getTypeOfPropertyOfType(type, "length")) && everyType(lengthType, (t) => !!(t.flags & 256)); + return isTupleType(type) || !!getPropertyOfType(type, "0") || isArrayLikeType(type) && !!(lengthType = getTypeOfPropertyOfType(type, "length")) && everyType(lengthType, (t) => !!(t.flags & 2048)); } function isArrayOrTupleLikeType(type) { return isArrayLikeType(type) || isTupleLikeType(type); @@ -64310,36 +64460,36 @@ ${lanes.join(` return; } function isNeitherUnitTypeNorNever(type) { - return !(type.flags & (109472 | 131072)); + return !(type.flags & (97292 | 262144)); } function isUnitType(type) { - return !!(type.flags & 109472); + return !!(type.flags & 97292); } function isUnitLikeType(type) { const t = getBaseConstraintOrType(type); - return t.flags & 2097152 ? some(t.types, isUnitType) : isUnitType(t); + return t.flags & 268435456 ? some(t.types, isUnitType) : isUnitType(t); } function extractUnitType(type) { - return type.flags & 2097152 ? find(type.types, isUnitType) || type : type; + return type.flags & 268435456 ? find(type.types, isUnitType) || type : type; } function isLiteralType(type) { - return type.flags & 16 ? true : type.flags & 1048576 ? type.flags & 1024 ? true : every(type.types, isUnitType) : isUnitType(type); + return type.flags & 256 ? true : type.flags & 134217728 ? type.flags & 32768 ? true : every(type.types, isUnitType) : isUnitType(type); } function getBaseTypeOfLiteralType(type) { - return type.flags & 1056 ? getBaseTypeOfEnumLikeType(type) : type.flags & (128 | 134217728 | 268435456) ? stringType : type.flags & 256 ? numberType : type.flags & 2048 ? bigintType : type.flags & 512 ? booleanType : type.flags & 1048576 ? getBaseTypeOfLiteralTypeUnion(type) : type; + return type.flags & 98304 ? getBaseTypeOfEnumLikeType(type) : type.flags & (1024 | 4194304 | 8388608) ? stringType : type.flags & 2048 ? numberType : type.flags & 4096 ? bigintType : type.flags & 8192 ? booleanType : type.flags & 134217728 ? getBaseTypeOfLiteralTypeUnion(type) : type; } function getBaseTypeOfLiteralTypeUnion(type) { const key = `B${getTypeId(type)}`; return getCachedType(key) ?? setCachedType(key, mapType(type, getBaseTypeOfLiteralType)); } function getBaseTypeOfLiteralTypeForComparison(type) { - return type.flags & (128 | 134217728 | 268435456) ? stringType : type.flags & (256 | 32) ? numberType : type.flags & 2048 ? bigintType : type.flags & 512 ? booleanType : type.flags & 1048576 ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type; + return type.flags & (1024 | 4194304 | 8388608) ? stringType : type.flags & (2048 | 65536) ? numberType : type.flags & 4096 ? bigintType : type.flags & 8192 ? booleanType : type.flags & 134217728 ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type; } function getWidenedLiteralType(type) { - return type.flags & 1056 && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 && isFreshLiteralType(type) ? stringType : type.flags & 256 && isFreshLiteralType(type) ? numberType : type.flags & 2048 && isFreshLiteralType(type) ? bigintType : type.flags & 512 && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 ? mapType(type, getWidenedLiteralType) : type; + return type.flags & 98304 && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 1024 && isFreshLiteralType(type) ? stringType : type.flags & 2048 && isFreshLiteralType(type) ? numberType : type.flags & 4096 && isFreshLiteralType(type) ? bigintType : type.flags & 8192 && isFreshLiteralType(type) ? booleanType : type.flags & 134217728 ? mapType(type, getWidenedLiteralType) : type; } function getWidenedUniqueESSymbolType(type) { - return type.flags & 8192 ? esSymbolType : type.flags & 1048576 ? mapType(type, getWidenedUniqueESSymbolType) : type; + return type.flags & 16384 ? esSymbolType : type.flags & 134217728 ? mapType(type, getWidenedUniqueESSymbolType) : type; } function getWidenedLiteralLikeTypeForContextualType(type, contextualType) { if (!isLiteralOfContextualType(type, contextualType)) { @@ -64416,16 +64566,16 @@ ${lanes.join(` return mapType(type, getDefinitelyFalsyPartOfType); } function getDefinitelyFalsyPartOfType(type) { - return type.flags & 4 ? emptyStringType : type.flags & 8 ? zeroType : type.flags & 64 ? zeroBigIntType : type === regularFalseType || type === falseType || type.flags & (16384 | 32768 | 65536 | 3) || type.flags & 128 && type.value === "" || type.flags & 256 && type.value === 0 || type.flags & 2048 && isZeroBigInt(type) ? type : neverType; + return type.flags & 32 ? emptyStringType : type.flags & 64 ? zeroType : type.flags & 128 ? zeroBigIntType : type === regularFalseType || type === falseType || type.flags & (16 | 4 | 8 | 3) || type.flags & 1024 && type.value === "" || type.flags & 2048 && type.value === 0 || type.flags & 4096 && isZeroBigInt(type) ? type : neverType; } function getNullableType(type, flags) { - const missing = flags & ~type.flags & (32768 | 65536); - return missing === 0 ? type : missing === 32768 ? getUnionType([type, undefinedType]) : missing === 65536 ? getUnionType([type, nullType]) : getUnionType([type, undefinedType, nullType]); + const missing = flags & ~type.flags & (4 | 8); + return missing === 0 ? type : missing === 4 ? getUnionType([type, undefinedType]) : missing === 8 ? getUnionType([type, nullType]) : getUnionType([type, undefinedType, nullType]); } function getOptionalType(type, isProperty = false) { Debug.assert(strictNullChecks); const missingOrUndefined = isProperty ? undefinedOrMissingType : undefinedType; - return type === missingOrUndefined || type.flags & 1048576 && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); + return type === missingOrUndefined || type.flags & 134217728 && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); } function getGlobalNonNullableTypeInstantiation(type) { if (!deferredGlobalNonNullableTypeAlias) { @@ -64452,17 +64602,17 @@ ${lanes.join(` return exactOptionalPropertyTypes && isOptional ? removeType(type, missingType) : type; } function containsMissingType(type) { - return type === missingType || !!(type.flags & 1048576) && type.types[0] === missingType; + return type === missingType || !!(type.flags & 134217728) && type.types[0] === missingType; } function removeMissingOrUndefinedType(type) { return exactOptionalPropertyTypes ? removeType(type, missingType) : getTypeWithFacts(type, 524288); } function isCoercibleUnderDoubleEquals(source, target) { - return (source.flags & (8 | 4 | 512)) !== 0 && (target.flags & (8 | 4 | 16)) !== 0; + return (source.flags & (64 | 32 | 8192)) !== 0 && (target.flags & (64 | 32 | 256)) !== 0; } function isObjectTypeWithInferableIndex(type) { const objectFlags = getObjectFlags(type); - return type.flags & 2097152 ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 | 2048 | 384 | 512)) !== 0 && !(type.symbol.flags & 32) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304) || !!(objectFlags & 1024 && isObjectTypeWithInferableIndex(type.source)); + return type.flags & 268435456 ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 | 2048 | 384 | 512)) !== 0 && !(type.symbol.flags & 32) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304) || !!(objectFlags & 1024 && isObjectTypeWithInferableIndex(type.source)); } function createSymbolWithType(source, type) { const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8); @@ -64582,15 +64732,15 @@ ${lanes.join(` return type.widened; } let result; - if (type.flags & (1 | 98304)) { + if (type.flags & (1 | 12)) { result = anyType; } else if (isObjectLiteralType2(type)) { result = getWidenedTypeOfObjectLiteral(type, context); - } else if (type.flags & 1048576) { + } else if (type.flags & 134217728) { const unionContext = context || createWideningContext(undefined, undefined, type.types); - const widenedTypes = sameMap(type.types, (t) => t.flags & 98304 ? t : getWidenedTypeWithContext(t, unionContext)); + const widenedTypes = sameMap(type.types, (t) => t.flags & 12 ? t : getWidenedTypeWithContext(t, unionContext)); result = getUnionType(widenedTypes, some(widenedTypes, isEmptyObjectType) ? 2 : 1); - } else if (type.flags & 2097152) { + } else if (type.flags & 268435456) { result = getIntersectionType(sameMap(type.types, getWidenedType)); } else if (isArrayOrTupleType(type)) { result = createTypeReference(type.target, sameMap(getTypeArguments(type), getWidenedType)); @@ -64606,7 +64756,7 @@ ${lanes.join(` var _a; let errorReported = false; if (getObjectFlags(type) & 65536) { - if (type.flags & 1048576) { + if (type.flags & 134217728) { if (some(type.types, isEmptyObjectType)) { errorReported = true; } else { @@ -64775,18 +64925,18 @@ ${lanes.join(` callback(getReturnTypeOfSignature(source), targetReturnType); } } - function createInferenceContext(typeParameters, signature, flags, compareTypes) { - return createInferenceContextWorker(typeParameters.map(createInferenceInfo), signature, flags, compareTypes || compareTypesAssignable); + function createInferenceContext(typeParameters, signature, flags, compareTypes2) { + return createInferenceContextWorker(typeParameters.map(createInferenceInfo), signature, flags, compareTypes2 || compareTypesAssignable); } function cloneInferenceContext(context, extraFlags = 0) { return context && createInferenceContextWorker(map(context.inferences, cloneInferenceInfo), context.signature, context.flags | extraFlags, context.compareTypes); } - function createInferenceContextWorker(inferences, signature, flags, compareTypes) { + function createInferenceContextWorker(inferences, signature, flags, compareTypes2) { const context = { inferences, signature, flags, - compareTypes, + compareTypes: compareTypes2, mapper: reportUnmeasurableMapper, nonFixingMapper: reportUnmeasurableMapper }; @@ -64866,8 +65016,8 @@ ${lanes.join(` if (objectFlags & 524288) { return !!(objectFlags & 1048576); } - const result = !!(type.flags & 465829888 || type.flags & 524288 && !isNonGenericTopLevelType(type) && (objectFlags & 4 && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 && type.symbol && type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) && type.symbol.declarations || objectFlags & (32 | 1024 | 4194304 | 8388608)) || type.flags & 3145728 && !(type.flags & 1024) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables)); - if (type.flags & 3899393) { + const result = !!(type.flags & 132644864 || type.flags & 1048576 && !isNonGenericTopLevelType(type) && (objectFlags & 4 && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 && type.symbol && type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) && type.symbol.declarations || objectFlags & (32 | 1024 | 4194304 | 8388608)) || type.flags & 402653184 && !(type.flags & 32768) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables)); + if (type.flags & 403963917) { type.objectFlags |= 524288 | (result ? 1048576 : 0); } return result; @@ -64880,7 +65030,7 @@ ${lanes.join(` return false; } function isTypeParameterAtTopLevel(type, tp, depth = 0) { - return !!(type === tp || type.flags & 3145728 && some(type.types, (t) => isTypeParameterAtTopLevel(t, tp, depth)) || depth < 3 && type.flags & 16777216 && (isTypeParameterAtTopLevel(getTrueTypeFromConditionalType(type), tp, depth + 1) || isTypeParameterAtTopLevel(getFalseTypeFromConditionalType(type), tp, depth + 1))); + return !!(type === tp || type.flags & 402653184 && some(type.types, (t) => isTypeParameterAtTopLevel(t, tp, depth)) || depth < 3 && type.flags & 67108864 && (isTypeParameterAtTopLevel(getTrueTypeFromConditionalType(type), tp, depth + 1) || isTypeParameterAtTopLevel(getFalseTypeFromConditionalType(type), tp, depth + 1))); } function isTypeParameterAtTopLevelInReturnType(signature, typeParameter) { const typePredicate = getTypePredicateOfSignature(signature); @@ -64889,7 +65039,7 @@ ${lanes.join(` function createEmptyObjectTypeFromStringLiteral(type) { const members = createSymbolTable(); forEachType(type, (t) => { - if (!(t.flags & 128)) { + if (!(t.flags & 1024)) { return; } const name = escapeLeadingUnderscores(t.value); @@ -64901,7 +65051,7 @@ ${lanes.join(` } members.set(name, literalProp); }); - const indexInfos = type.flags & 4 ? [createIndexInfo(stringType, emptyObjectType, false)] : emptyArray; + const indexInfos = type.flags & 32 ? [createIndexInfo(stringType, emptyObjectType, false)] : emptyArray; return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfos); } function inferTypeForHomomorphicMappedType(source, target, constraint) { @@ -64953,7 +65103,7 @@ ${lanes.join(` const templateType = getTemplateTypeFromMappedType(target); const inference = createInferenceInfo(typeParameter); inferTypes([inference], sourceType, templateType); - return getTypeFromInference(inference) || unknownType; + return getWidenedType(getTypeFromInference(inference) || unknownType); } function inferReverseMappedType(source, target, constraint) { const cacheKey = source.id + "," + target.id + "," + constraint.id; @@ -64989,7 +65139,7 @@ ${lanes.join(` yield targetProp; } else if (matchDiscriminantProperties) { const targetType = getTypeOfSymbol(targetProp); - if (targetType.flags & 109472) { + if (targetType.flags & 97292) { const sourceType = getTypeOfSymbol(sourceProp); if (!(sourceType.flags & 1 || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) { yield targetProp; @@ -65039,12 +65189,12 @@ ${lanes.join(` if (target.flags & 1) { return true; } - if (target.flags & (4 | 134217728)) { + if (target.flags & (32 | 4194304)) { return isTypeAssignableTo(source, target); } - if (target.flags & 268435456) { + if (target.flags & 8388608) { const mappingStack = []; - while (target.flags & 268435456) { + while (target.flags & 8388608) { mappingStack.unshift(target.symbol); target = target.type; } @@ -65054,24 +65204,24 @@ ${lanes.join(` return false; } function isValidTypeForTemplateLiteralPlaceholder(source, target) { - if (target.flags & 2097152) { + if (target.flags & 268435456) { return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t)); } - if (target.flags & 4 || isTypeAssignableTo(source, target)) { + if (target.flags & 32 || isTypeAssignableTo(source, target)) { return true; } - if (source.flags & 128) { + if (source.flags & 1024) { const value = source.value; - return !!(target.flags & 8 && isValidNumberString(value, false) || target.flags & 64 && isValidBigIntString(value, false) || target.flags & (512 | 98304) && value === target.intrinsicName || target.flags & 268435456 && isMemberOfStringMapping(source, target) || target.flags & 134217728 && isTypeMatchedByTemplateLiteralType(source, target)); + return !!(target.flags & 64 && isValidNumberString(value, false) || target.flags & 128 && isValidBigIntString(value, false) || target.flags & (8192 | 12) && value === target.intrinsicName || target.flags & 8388608 && isMemberOfStringMapping(source, target) || target.flags & 4194304 && isTypeMatchedByTemplateLiteralType(source, target)); } - if (source.flags & 134217728) { + if (source.flags & 4194304) { const texts = source.texts; return texts.length === 2 && texts[0] === "" && texts[1] === "" && isTypeAssignableTo(source.types[0], target); } return false; } function inferTypesFromTemplateLiteralType(source, target) { - return source.flags & 128 ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 ? arrayIsEqualTo(source.texts, target.texts) ? map(source.types, (s, i) => { + return source.flags & 1024 ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 4194304 ? arrayIsEqualTo(source.texts, target.texts) ? map(source.types, (s, i) => { return isTypeAssignableTo(getBaseConstraintOrType(s), getBaseConstraintOrType(target.types[i])) ? s : getStringLikeTypeForType(s); }) : inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) : undefined; } @@ -65080,7 +65230,7 @@ ${lanes.join(` return !!inferences && every(inferences, (r, i) => isValidTypeForTemplateLiteralPlaceholder(r, target.types[i])); } function getStringLikeTypeForType(type) { - return type.flags & (1 | 402653316) ? type : getTemplateLiteralType(["", ""], [type]); + return type.flags & (1 | 12583968) ? type : getTemplateLiteralType(["", ""], [type]); } function inferFromLiteralPartsToTemplateLiteral(sourceTexts, sourceTypes, target) { const lastSourceIndex = sourceTexts.length - 1; @@ -65162,14 +65312,14 @@ ${lanes.join(` } return; } - if (source === target && source.flags & 3145728) { + if (source === target && source.flags & 402653184) { for (const t of source.types) { inferFromTypes(t, t); } return; } - if (target.flags & 1048576) { - const [tempSources, tempTargets] = inferFromMatchingTypes(source.flags & 1048576 ? source.types : [source], target.types, isTypeOrBaseIdenticalTo); + if (target.flags & 134217728) { + const [tempSources, tempTargets] = inferFromMatchingTypes(source.flags & 134217728 ? source.types : [source], target.types, isTypeOrBaseIdenticalTo); const [sources, targets] = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy); if (targets.length === 0) { return; @@ -65180,9 +65330,9 @@ ${lanes.join(` return; } source = getUnionType(sources); - } else if (target.flags & 2097152 && !every(target.types, isNonGenericObjectType)) { - if (!(source.flags & 1048576)) { - const [sources, targets] = inferFromMatchingTypes(source.flags & 2097152 ? source.types : [source], target.types, isTypeIdenticalTo); + } else if (target.flags & 268435456 && !every(target.types, isNonGenericObjectType)) { + if (!(source.flags & 134217728)) { + const [sources, targets] = inferFromMatchingTypes(source.flags & 268435456 ? source.types : [source], target.types, isTypeIdenticalTo); if (sources.length === 0 || targets.length === 0) { return; } @@ -65190,13 +65340,13 @@ ${lanes.join(` target = getIntersectionType(targets); } } - if (target.flags & (8388608 | 33554432)) { + if (target.flags & (33554432 | 16777216)) { if (isNoInferType(target)) { return; } target = getActualTypeVariable(target); } - if (target.flags & 8650752) { + if (target.flags & 34078720) { if (isFromInferenceBlockedSource(source)) { return; } @@ -65227,7 +65377,7 @@ ${lanes.join(` clearCachedInferences(inferences); } } - if (!(priority & 128) && target.flags & 262144 && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) { + if (!(priority & 128) && target.flags & 524288 && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) { inference.topLevel = false; clearCachedInferences(inferences); } @@ -65238,9 +65388,9 @@ ${lanes.join(` const simplified = getSimplifiedType(target, false); if (simplified !== target) { inferFromTypes(source, simplified); - } else if (target.flags & 8388608) { + } else if (target.flags & 33554432) { const indexType = getSimplifiedType(target.indexType, false); - if (indexType.flags & 465829888) { + if (indexType.flags & 132644864) { const simplified2 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, false), indexType, false); if (simplified2 && simplified2 !== target) { inferFromTypes(source, simplified2); @@ -65250,45 +65400,45 @@ ${lanes.join(` } if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && (source.target === target.target || isArrayType(source) && isArrayType(target)) && !(source.node && target.node)) { inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target)); - } else if (source.flags & 4194304 && target.flags & 4194304) { + } else if (source.flags & 2097152 && target.flags & 2097152) { inferFromContravariantTypes(source.type, target.type); - } else if ((isLiteralType(source) || source.flags & 4) && target.flags & 4194304) { + } else if ((isLiteralType(source) || source.flags & 32) && target.flags & 2097152) { const empty = createEmptyObjectTypeFromStringLiteral(source); inferFromContravariantTypesWithPriority(empty, target.type, 256); - } else if (source.flags & 8388608 && target.flags & 8388608) { + } else if (source.flags & 33554432 && target.flags & 33554432) { inferFromTypes(source.objectType, target.objectType); inferFromTypes(source.indexType, target.indexType); - } else if (source.flags & 268435456 && target.flags & 268435456) { + } else if (source.flags & 8388608 && target.flags & 8388608) { if (source.symbol === target.symbol) { inferFromTypes(source.type, target.type); } - } else if (source.flags & 33554432) { + } else if (source.flags & 16777216) { inferFromTypes(source.baseType, target); inferWithPriority(getSubstitutionIntersection(source), target, 4); - } else if (target.flags & 16777216) { + } else if (target.flags & 67108864) { invokeOnce(source, target, inferToConditionalType); - } else if (target.flags & 3145728) { + } else if (target.flags & 402653184) { inferToMultipleTypes(source, target.types, target.flags); - } else if (source.flags & 1048576) { + } else if (source.flags & 134217728) { const sourceTypes = source.types; for (const sourceType of sourceTypes) { inferFromTypes(sourceType, target); } - } else if (target.flags & 134217728) { + } else if (target.flags & 4194304) { inferToTemplateLiteralType(source, target); } else { source = getReducedType(source); if (isGenericMappedType(source) && isGenericMappedType(target)) { invokeOnce(source, target, inferFromGenericMappedTypes); } - if (!(priority & 512 && source.flags & (2097152 | 465829888))) { + if (!(priority & 512 && source.flags & (268435456 | 132644864))) { const apparentSource = getApparentType(source); - if (apparentSource !== source && !(apparentSource.flags & (524288 | 2097152))) { + if (apparentSource !== source && !(apparentSource.flags & (1048576 | 268435456))) { return inferFromTypes(apparentSource, target); } source = apparentSource; } - if (source.flags & (524288 | 2097152)) { + if (source.flags & (1048576 | 268435456)) { invokeOnce(source, target, inferFromObjectTypes); } } @@ -65379,7 +65529,7 @@ ${lanes.join(` } } function getInferenceInfoForType(type) { - if (type.flags & 8650752) { + if (type.flags & 34078720) { for (const inference of inferences) { if (type === inference.typeParameter) { return inference; @@ -65391,7 +65541,7 @@ ${lanes.join(` function getSingleTypeVariableFromIntersectionTypes(types) { let typeVariable; for (const type of types) { - const t = type.flags & 2097152 && find(type.types, (t2) => !!getInferenceInfoForType(t2)); + const t = type.flags & 268435456 && find(type.types, (t2) => !!getInferenceInfoForType(t2)); if (!t || typeVariable && t !== typeVariable) { return; } @@ -65401,9 +65551,9 @@ ${lanes.join(` } function inferToMultipleTypes(source, targets, targetFlags) { let typeVariableCount = 0; - if (targetFlags & 1048576) { + if (targetFlags & 134217728) { let nakedTypeVariable; - const sources = source.flags & 1048576 ? source.types : [source]; + const sources = source.flags & 134217728 ? source.types : [source]; const matched = new Array(sources.length); let inferenceCircularity = false; for (const t of targets) { @@ -65445,7 +65595,7 @@ ${lanes.join(` } } } - if (targetFlags & 2097152 ? typeVariableCount === 1 : typeVariableCount > 0) { + if (targetFlags & 268435456 ? typeVariableCount === 1 : typeVariableCount > 0) { for (const t of targets) { if (getInferenceInfoForType(t)) { inferWithPriority(source, t, 1); @@ -65454,14 +65604,14 @@ ${lanes.join(` } } function inferToMappedType(source, target, constraintType) { - if (constraintType.flags & 1048576 || constraintType.flags & 2097152) { + if (constraintType.flags & 134217728 || constraintType.flags & 268435456) { let result = false; for (const type of constraintType.types) { result = inferToMappedType(source, target, type) || result; } return result; } - if (constraintType.flags & 4194304) { + if (constraintType.flags & 2097152) { const inference = getInferenceInfoForType(constraintType.type); if (inference && !inference.isFixed && !isFromInferenceBlockedSource(source)) { const inferredType = inferTypeForHomomorphicMappedType(source, target, constraintType); @@ -65471,7 +65621,7 @@ ${lanes.join(` } return true; } - if (constraintType.flags & 262144) { + if (constraintType.flags & 524288) { inferWithPriority(getIndexType(source, source.pattern ? 2 : 0), constraintType, 32); const extendedConstraint = getConstraintOfType(constraintType); if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) { @@ -65485,7 +65635,7 @@ ${lanes.join(` return false; } function inferToConditionalType(source, target) { - if (source.flags & 16777216) { + if (source.flags & 67108864) { inferFromTypes(source.checkType, target.checkType); inferFromTypes(source.extendsType, target.extendsType); inferFromTypes(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target)); @@ -65502,22 +65652,22 @@ ${lanes.join(` for (let i = 0;i < types.length; i++) { const source2 = matches ? matches[i] : neverType; const target2 = types[i]; - if (source2.flags & 128 && target2.flags & 8650752) { + if (source2.flags & 1024 && target2.flags & 34078720) { const inferenceContext = getInferenceInfoForType(target2); const constraint = inferenceContext ? getBaseConstraintOfType(inferenceContext.typeParameter) : undefined; if (constraint && !isTypeAny(constraint)) { - const constraintTypes = constraint.flags & 1048576 ? constraint.types : [constraint]; + const constraintTypes = constraint.flags & 134217728 ? constraint.types : [constraint]; let allTypeFlags = reduceLeft(constraintTypes, (flags, t) => flags | t.flags, 0); - if (!(allTypeFlags & 4)) { + if (!(allTypeFlags & 32)) { const str = source2.value; - if (allTypeFlags & 296 && !isValidNumberString(str, true)) { - allTypeFlags &= ~296; + if (allTypeFlags & 67648 && !isValidNumberString(str, true)) { + allTypeFlags &= ~67648; } - if (allTypeFlags & 2112 && !isValidBigIntString(str, true)) { - allTypeFlags &= ~2112; + if (allTypeFlags & 4224 && !isValidBigIntString(str, true)) { + allTypeFlags &= ~4224; } - const matchingType = reduceLeft(constraintTypes, (left, right) => !(right.flags & allTypeFlags) ? left : left.flags & 4 ? left : right.flags & 4 ? source2 : left.flags & 134217728 ? left : right.flags & 134217728 && isTypeMatchedByTemplateLiteralType(source2, right) ? source2 : left.flags & 268435456 ? left : right.flags & 268435456 && str === applyStringMapping(right.symbol, str) ? source2 : left.flags & 128 ? left : right.flags & 128 && right.value === str ? right : left.flags & 8 ? left : right.flags & 8 ? getNumberLiteralType(+str) : left.flags & 32 ? left : right.flags & 32 ? getNumberLiteralType(+str) : left.flags & 256 ? left : right.flags & 256 && right.value === +str ? right : left.flags & 64 ? left : right.flags & 64 ? parseBigIntLiteralType(str) : left.flags & 2048 ? left : right.flags & 2048 && pseudoBigIntToString(right.value) === str ? right : left.flags & 16 ? left : right.flags & 16 ? str === "true" ? trueType : str === "false" ? falseType : booleanType : left.flags & 512 ? left : right.flags & 512 && right.intrinsicName === str ? right : left.flags & 32768 ? left : right.flags & 32768 && right.intrinsicName === str ? right : left.flags & 65536 ? left : right.flags & 65536 && right.intrinsicName === str ? right : left, neverType); - if (!(matchingType.flags & 131072)) { + const matchingType = reduceLeft(constraintTypes, (left, right) => !(right.flags & allTypeFlags) ? left : left.flags & 32 ? left : right.flags & 32 ? source2 : left.flags & 4194304 ? left : right.flags & 4194304 && isTypeMatchedByTemplateLiteralType(source2, right) ? source2 : left.flags & 8388608 ? left : right.flags & 8388608 && str === applyStringMapping(right.symbol, str) ? source2 : left.flags & 1024 ? left : right.flags & 1024 && right.value === str ? right : left.flags & 64 ? left : right.flags & 64 ? getNumberLiteralType(+str) : left.flags & 65536 ? left : right.flags & 65536 ? getNumberLiteralType(+str) : left.flags & 2048 ? left : right.flags & 2048 && right.value === +str ? right : left.flags & 128 ? left : right.flags & 128 ? parseBigIntLiteralType(str) : left.flags & 4096 ? left : right.flags & 4096 && pseudoBigIntToString(right.value) === str ? right : left.flags & 256 ? left : right.flags & 256 ? str === "true" ? trueType : str === "false" ? falseType : booleanType : left.flags & 8192 ? left : right.flags & 8192 && right.intrinsicName === str ? right : left.flags & 4 ? left : right.flags & 4 && right.intrinsicName === str ? right : left.flags & 8 ? left : right.flags & 8 && right.intrinsicName === str ? right : left, neverType); + if (!(matchingType.flags & 262144)) { inferFromTypes(matchingType, target2); continue; } @@ -65668,7 +65818,7 @@ ${lanes.join(` for (const targetInfo of indexInfos) { const propTypes = []; for (const prop of getPropertiesOfType(source)) { - if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 8576), targetInfo.keyType)) { + if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 19456), targetInfo.keyType)) { const propType = getTypeOfSymbol(prop); propTypes.push(prop.flags & 16777216 ? removeMissingOrUndefinedType(propType) : propType); } @@ -65692,14 +65842,14 @@ ${lanes.join(` } } function isTypeOrBaseIdenticalTo(s, t) { - return t === missingType ? s === t : isTypeIdenticalTo(s, t) || !!(t.flags & 4 && s.flags & 128 || t.flags & 8 && s.flags & 256); + return t === missingType ? s === t : isTypeIdenticalTo(s, t) || !!(t.flags & 32 && s.flags & 1024 || t.flags & 64 && s.flags & 2048); } function isTypeCloselyMatchedBy(s, t) { - return !!(s.flags & 524288 && t.flags & 524288 && s.symbol && s.symbol === t.symbol || s.aliasSymbol && s.aliasTypeArguments && s.aliasSymbol === t.aliasSymbol); + return !!(s.flags & 1048576 && t.flags & 1048576 && s.symbol && s.symbol === t.symbol || s.aliasSymbol && s.aliasTypeArguments && s.aliasSymbol === t.aliasSymbol); } function hasPrimitiveConstraint(type) { const constraint = getConstraintOfTypeParameter(type); - return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 ? getDefaultConstraintOfConditionalType(constraint) : constraint, 402784252 | 4194304 | 134217728 | 268435456); + return !!constraint && maybeTypeOfKind(constraint.flags & 67108864 ? getDefaultConstraintOfConditionalType(constraint) : constraint, 12713980 | 2097152 | 4194304 | 8388608); } function isObjectLiteralType2(type) { return !!(getObjectFlags(type) & 128); @@ -65737,7 +65887,7 @@ ${lanes.join(` const inferredCovariantType = inference.candidates ? getCovariantInference(inference, context.signature) : undefined; const inferredContravariantType = inference.contraCandidates ? getContravariantInference(inference) : undefined; if (inferredCovariantType || inferredContravariantType) { - const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & (131072 | 1)) && some(inference.contraCandidates, (t) => isTypeAssignableTo(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeAssignableTo(t, inferredCovariantType)))); + const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & (262144 | 1)) && some(inference.contraCandidates, (t) => isTypeAssignableTo(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeAssignableTo(t, inferredCovariantType)))); inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType; fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType; } else if (context.flags & 1) { @@ -65755,9 +65905,17 @@ ${lanes.join(` const constraint = getConstraintOfTypeParameter(inference.typeParameter); if (constraint) { const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper); - if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { - inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint; + if (inferredType) { + const constraintWithThis = getTypeWithThisArgument(instantiatedConstraint, inferredType); + if (!context.compareTypes(inferredType, constraintWithThis)) { + const filteredByConstraint = inference.priority === 128 ? filterType(inferredType, (t) => !!context.compareTypes(t, constraintWithThis)) : neverType; + inferredType = !(filteredByConstraint.flags & 262144) ? filteredByConstraint : undefined; + } } + if (!inferredType) { + inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint; + } + inference.inferredType = inferredType; } clearActiveMapperCaches(); } @@ -65779,19 +65937,21 @@ ${lanes.join(` case "console": return Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom; case "$": - return compilerOptions.types ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery; + return usesWildcardTypes(compilerOptions) ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig; + case "beforeEach": case "describe": case "suite": case "it": case "test": - return compilerOptions.types ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha; + return usesWildcardTypes(compilerOptions) ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_types_Slashjest_or_npm_i_save_dev_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig; case "process": case "require": case "Buffer": case "module": - return compilerOptions.types ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode; + case "NodeJS": + return usesWildcardTypes(compilerOptions) ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig; case "Bun": - return compilerOptions.types ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_and_then_add_bun_to_the_types_field_in_your_tsconfig : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun; + return usesWildcardTypes(compilerOptions) ? Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun : Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_Bun_Try_npm_i_save_dev_types_Slashbun_and_then_add_bun_to_the_types_field_in_your_tsconfig; case "Map": case "Set": case "Promise": @@ -65823,6 +65983,18 @@ ${lanes.join(` } } } + function getCannotResolveModuleNameErrorForSpecificModule(moduleName) { + if (moduleName.kind === 11) { + if (nodeCoreModules.has(moduleName.text)) { + if (usesWildcardTypes(compilerOptions)) { + return Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode; + } else { + return Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig; + } + } + } + return; + } function getResolvedSymbol(node) { const links = getNodeLinks(node); if (!links.resolvedSymbol) { @@ -65935,7 +66107,7 @@ ${lanes.join(` return; } function tryGetNameFromType(type) { - return type.flags & 8192 ? type.escapedName : type.flags & 384 ? escapeLeadingUnderscores("" + type.value) : undefined; + return type.flags & 16384 ? type.escapedName : type.flags & 3072 ? escapeLeadingUnderscores("" + type.value) : undefined; } function tryGetElementAccessExpressionName(node) { return isStringOrNumericLiteralLike(node.argumentExpression) ? escapeLeadingUnderscores(node.argumentExpression.text) : isEntityNameExpression(node.argumentExpression) ? tryGetNameFromEntityNameExpression(node.argumentExpression) : undefined; @@ -65985,7 +66157,7 @@ ${lanes.join(` return false; } function isDiscriminantProperty(type, name) { - if (type && type.flags & 1048576) { + if (type && type.flags & 134217728) { const prop = getUnionOrIntersectionProperty(type, name); if (prop && getCheckFlags(prop) & 2) { if (prop.links.isDiscriminantProperty === undefined) { @@ -66013,37 +66185,35 @@ ${lanes.join(` const map2 = /* @__PURE__ */ new Map; let count = 0; for (const type of types) { - if (type.flags & (524288 | 2097152 | 58982400)) { + if (type.flags & (1048576 | 268435456 | 117964800)) { const discriminant = getTypeOfPropertyOfType(type, name); - if (discriminant) { - if (!isLiteralType(discriminant)) { - return; - } - let duplicate = false; - forEachType(discriminant, (t) => { - const id = getTypeId(getRegularTypeOfLiteralType(t)); - const existing = map2.get(id); - if (!existing) { - map2.set(id, type); - } else if (existing !== unknownType) { - map2.set(id, unknownType); - duplicate = true; - } - }); - if (!duplicate) - count++; + if (!discriminant || !isLiteralType(discriminant)) { + return; } + let duplicate = false; + forEachType(discriminant, (t) => { + const id = getTypeId(getRegularTypeOfLiteralType(t)); + const existing = map2.get(id); + if (!existing) { + map2.set(id, type); + } else if (existing !== unknownType) { + map2.set(id, unknownType); + duplicate = true; + } + }); + if (!duplicate) + count++; } } return count >= 10 && count * 2 >= types.length ? map2 : undefined; } function getKeyPropertyName(unionType) { const types = unionType.types; - if (types.length < 10 || getObjectFlags(unionType) & 32768 || countWhere(types, (t) => !!(t.flags & (524288 | 58982400))) < 10) { + if (types.length < 10 || getObjectFlags(unionType) & 32768 || countWhere(types, (t) => !!(t.flags & (1048576 | 117964800))) < 10) { return; } if (unionType.keyPropertyName === undefined) { - const keyPropertyName = forEach(types, (t) => t.flags & (524288 | 58982400) ? forEach(getPropertiesOfType(t), (p) => isUnitType(getTypeOfSymbol(p)) ? p.escapedName : undefined) : undefined); + const keyPropertyName = forEach(types, (t) => t.flags & (1048576 | 117964800) ? forEach(getPropertiesOfType(t), (p) => isUnitType(getTypeOfSymbol(p)) ? p.escapedName : undefined) : undefined); const mapByKeyProperty = keyPropertyName && mapTypesByKeyProperty(types, keyPropertyName); unionType.keyPropertyName = mapByKeyProperty ? keyPropertyName : ""; unionType.constituentMap = mapByKeyProperty; @@ -66090,7 +66260,7 @@ ${lanes.join(` return flow.id; } function typeMaybeAssignableTo(source, target) { - if (!(source.flags & 1048576)) { + if (!(source.flags & 134217728)) { return isTypeAssignableTo(source, target); } for (const t of source.types) { @@ -66104,7 +66274,7 @@ ${lanes.join(` if (declaredType === assignedType) { return declaredType; } - if (assignedType.flags & 131072) { + if (assignedType.flags & 262144) { return assignedType; } const key = `A${getTypeId(declaredType)},${getTypeId(assignedType)}`; @@ -66112,7 +66282,7 @@ ${lanes.join(` } function getAssignmentReducedTypeWorker(declaredType, assignedType) { const filteredType = filterType(declaredType, (t) => typeMaybeAssignableTo(assignedType, t)); - const reducedType = assignedType.flags & 512 && isFreshLiteralType(assignedType) ? mapType(filteredType, getFreshTypeOfLiteralType) : filteredType; + const reducedType = assignedType.flags & 8192 && isFreshLiteralType(assignedType) ? mapType(filteredType, getFreshTypeOfLiteralType) : filteredType; return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType; } function isFunctionObjectType(type) { @@ -66129,76 +66299,76 @@ ${lanes.join(` return getTypeFacts(type, mask2) !== 0; } function getTypeFactsWorker(type, callerOnlyNeeds) { - if (type.flags & (2097152 | 465829888)) { + if (type.flags & (268435456 | 132644864)) { type = getBaseConstraintOfType(type) || unknownType; } const flags = type.flags; - if (flags & (4 | 268435456)) { + if (flags & (32 | 8388608)) { return strictNullChecks ? 16317953 : 16776705; } - if (flags & (128 | 134217728)) { - const isEmpty = flags & 128 && type.value === ""; + if (flags & (1024 | 4194304)) { + const isEmpty = flags & 1024 && type.value === ""; return strictNullChecks ? isEmpty ? 12123649 : 7929345 : isEmpty ? 12582401 : 16776705; } - if (flags & (8 | 32)) { + if (flags & (64 | 65536)) { return strictNullChecks ? 16317698 : 16776450; } - if (flags & 256) { + if (flags & 2048) { const isZero = type.value === 0; return strictNullChecks ? isZero ? 12123394 : 7929090 : isZero ? 12582146 : 16776450; } - if (flags & 64) { + if (flags & 128) { return strictNullChecks ? 16317188 : 16775940; } - if (flags & 2048) { + if (flags & 4096) { const isZero = isZeroBigInt(type); return strictNullChecks ? isZero ? 12122884 : 7928580 : isZero ? 12581636 : 16775940; } - if (flags & 16) { + if (flags & 256) { return strictNullChecks ? 16316168 : 16774920; } - if (flags & 528) { + if (flags & 8448) { return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 : 7927560 : type === falseType || type === regularFalseType ? 12580616 : 16774920; } - if (flags & 524288) { + if (flags & 1048576) { const possibleFacts = strictNullChecks ? 83427327 | 7880640 | 7888800 : 83886079 | 16728000 | 16736160; if ((callerOnlyNeeds & possibleFacts) === 0) { return 0; } return getObjectFlags(type) & 16 && isEmptyObjectType(type) ? strictNullChecks ? 83427327 : 83886079 : isFunctionObjectType(type) ? strictNullChecks ? 7880640 : 16728000 : strictNullChecks ? 7888800 : 16736160; } - if (flags & 16384) { + if (flags & 16) { return 9830144; } - if (flags & 32768) { + if (flags & 4) { return 26607360; } - if (flags & 65536) { + if (flags & 8) { return 42917664; } - if (flags & 12288) { + if (flags & 16896) { return strictNullChecks ? 7925520 : 16772880; } - if (flags & 67108864) { + if (flags & 131072) { return strictNullChecks ? 7888800 : 16736160; } - if (flags & 131072) { + if (flags & 262144) { return 0; } - if (flags & 1048576) { + if (flags & 134217728) { return reduceLeft(type.types, (facts, t) => facts | getTypeFactsWorker(t, callerOnlyNeeds), 0); } - if (flags & 2097152) { + if (flags & 268435456) { return getIntersectionTypeFacts(type, callerOnlyNeeds); } return 83886079; } function getIntersectionTypeFacts(type, callerOnlyNeeds) { - const ignoreObjects = maybeTypeOfKind(type, 402784252); + const ignoreObjects = maybeTypeOfKind(type, 12713980); let oredFacts = 0; let andedFacts = 134217727; for (const t of type.types) { - if (!(ignoreObjects && t.flags & 524288)) { + if (!(ignoreObjects && t.flags & 1048576)) { const f = getTypeFactsWorker(t, callerOnlyNeeds); oredFacts |= f; andedFacts &= f; @@ -66375,13 +66545,13 @@ ${lanes.join(` return witnesses; } function eachTypeContainedIn(source, types) { - return source.flags & 1048576 ? !forEach(source.types, (t) => !contains(types, t)) : contains(types, source); + return source.flags & 134217728 ? !forEach(source.types, (t) => !contains(types, t)) : contains(types, source); } function isTypeSubsetOf(source, target) { - return !!(source === target || source.flags & 131072 || target.flags & 1048576 && isTypeSubsetOfUnion(source, target)); + return !!(source === target || source.flags & 262144 || target.flags & 134217728 && isTypeSubsetOfUnion(source, target)); } function isTypeSubsetOfUnion(source, target) { - if (source.flags & 1048576) { + if (source.flags & 134217728) { for (const t of source.types) { if (!containsType(target.types, t)) { return false; @@ -66389,25 +66559,25 @@ ${lanes.join(` } return true; } - if (source.flags & 1056 && getBaseTypeOfEnumLikeType(source) === target) { + if (source.flags & 98304 && getBaseTypeOfEnumLikeType(source) === target) { return true; } return containsType(target.types, source); } function forEachType(type, f) { - return type.flags & 1048576 ? forEach(type.types, f) : f(type); + return type.flags & 134217728 ? forEach(type.types, f) : f(type); } function someType(type, f) { - return type.flags & 1048576 ? some(type.types, f) : f(type); + return type.flags & 134217728 ? some(type.types, f) : f(type); } function everyType(type, f) { - return type.flags & 1048576 ? every(type.types, f) : f(type); + return type.flags & 134217728 ? every(type.types, f) : f(type); } function everyContainedType(type, f) { - return type.flags & 3145728 ? every(type.types, f) : f(type); + return type.flags & 402653184 ? every(type.types, f) : f(type); } function filterType(type, f) { - if (type.flags & 1048576) { + if (type.flags & 134217728) { const types = type.types; const filtered = filter(types, f); if (filtered === types) { @@ -66415,39 +66585,39 @@ ${lanes.join(` } const origin = type.origin; let newOrigin; - if (origin && origin.flags & 1048576) { + if (origin && origin.flags & 134217728) { const originTypes = origin.types; - const originFiltered = filter(originTypes, (t) => !!(t.flags & 1048576) || f(t)); + const originFiltered = filter(originTypes, (t) => !!(t.flags & 134217728) || f(t)); if (originTypes.length - originFiltered.length === types.length - filtered.length) { if (originFiltered.length === 1) { return originFiltered[0]; } - newOrigin = createOriginUnionOrIntersectionType(1048576, originFiltered); + newOrigin = createOriginUnionOrIntersectionType(134217728, originFiltered); } } return getUnionTypeFromSortedList(filtered, type.objectFlags & (32768 | 16777216), undefined, undefined, newOrigin); } - return type.flags & 131072 || f(type) ? type : neverType; + return type.flags & 262144 || f(type) ? type : neverType; } function removeType(type, targetType) { return filterType(type, (t) => t !== targetType); } function countTypes(type) { - return type.flags & 1048576 ? type.types.length : 1; + return type.flags & 134217728 ? type.types.length : 1; } function mapType(type, mapper, noReductions) { - if (type.flags & 131072) { + if (type.flags & 262144) { return type; } - if (!(type.flags & 1048576)) { + if (!(type.flags & 134217728)) { return mapper(type); } const origin = type.origin; - const types = origin && origin.flags & 1048576 ? origin.types : type.types; + const types = origin && origin.flags & 134217728 ? origin.types : type.types; let mappedTypes; let changed = false; for (const t of types) { - const mapped = t.flags & 1048576 ? mapType(t, mapper, noReductions) : mapper(t); + const mapped = t.flags & 134217728 ? mapType(t, mapper, noReductions) : mapper(t); changed || (changed = t !== mapped); if (mapped) { if (!mappedTypes) { @@ -66460,14 +66630,14 @@ ${lanes.join(` return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? 0 : 1) : type; } function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) { - return type.flags & 1048576 && aliasSymbol ? getUnionType(map(type.types, mapper), 1, aliasSymbol, aliasTypeArguments) : mapType(type, mapper); + return type.flags & 134217728 && aliasSymbol ? getUnionType(map(type.types, mapper), 1, aliasSymbol, aliasTypeArguments) : mapType(type, mapper); } function extractTypesOfKind(type, kind) { return filterType(type, (t) => (t.flags & kind) !== 0); } function replacePrimitivesWithLiterals(typeWithPrimitives, typeWithLiterals) { - if (maybeTypeOfKind(typeWithPrimitives, 4 | 134217728 | 8 | 64) && maybeTypeOfKind(typeWithLiterals, 128 | 134217728 | 268435456 | 256 | 2048)) { - return mapType(typeWithPrimitives, (t) => t.flags & 4 ? extractTypesOfKind(typeWithLiterals, 4 | 128 | 134217728 | 268435456) : isPatternLiteralType(t) && !maybeTypeOfKind(typeWithLiterals, 4 | 134217728 | 268435456) ? extractTypesOfKind(typeWithLiterals, 128) : t.flags & 8 ? extractTypesOfKind(typeWithLiterals, 8 | 256) : t.flags & 64 ? extractTypesOfKind(typeWithLiterals, 64 | 2048) : t); + if (maybeTypeOfKind(typeWithPrimitives, 32 | 4194304 | 64 | 128) && maybeTypeOfKind(typeWithLiterals, 1024 | 4194304 | 8388608 | 2048 | 4096)) { + return mapType(typeWithPrimitives, (t) => t.flags & 32 ? extractTypesOfKind(typeWithLiterals, 32 | 1024 | 4194304 | 8388608) : isPatternLiteralType(t) && !maybeTypeOfKind(typeWithLiterals, 32 | 4194304 | 8388608) ? extractTypesOfKind(typeWithLiterals, 1024) : t.flags & 64 ? extractTypesOfKind(typeWithLiterals, 64 | 2048) : t.flags & 128 ? extractTypesOfKind(typeWithLiterals, 128 | 4096) : t); } return typeWithPrimitives; } @@ -66478,7 +66648,7 @@ ${lanes.join(` return flowType.flags === 0 ? flowType.type : flowType; } function createFlowType(type, incomplete) { - return incomplete ? { flags: 0, type: type.flags & 131072 ? silentNeverType : type } : type; + return incomplete ? { flags: 0, type: type.flags & 262144 ? silentNeverType : type } : type; } function createEvolvingArrayType(elementType) { const result = createObjectType(256); @@ -66493,7 +66663,7 @@ ${lanes.join(` return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])); } function createFinalArrayType(elementType) { - return elementType.flags & 131072 ? autoArrayType : createArrayType(elementType.flags & 1048576 ? getUnionType(elementType.types, 2) : elementType); + return elementType.flags & 262144 ? autoArrayType : createArrayType(elementType.flags & 134217728 ? getUnionType(elementType.types, 2) : elementType); } function getFinalArrayType(evolvingArrayType) { return evolvingArrayType.finalArrayType || (evolvingArrayType.finalArrayType = createFinalArrayType(evolvingArrayType.elementType)); @@ -66507,7 +66677,7 @@ ${lanes.join(` function isEvolvingArrayTypeList(types) { let hasEvolvingArrayType = false; for (const t of types) { - if (!(t.flags & 131072)) { + if (!(t.flags & 262144)) { if (!(getObjectFlags(t) & 256)) { return false; } @@ -66520,7 +66690,7 @@ ${lanes.join(` const root = getReferenceRoot(node); const parent2 = root.parent; const isLengthPushOrUnshift = isPropertyAccessExpression(parent2) && (parent2.name.escapedText === "length" || parent2.parent.kind === 214 && isIdentifier(parent2.name) && isPushOrUnshiftIdentifier(parent2.name)); - const isElementAssignment = parent2.kind === 213 && parent2.expression === root && parent2.parent.kind === 227 && parent2.parent.operatorToken.kind === 64 && parent2.parent.left === parent2 && !isAssignmentTarget(parent2.parent) && isTypeAssignableToKind(getTypeOfExpression(parent2.argumentExpression), 296); + const isElementAssignment = parent2.kind === 213 && parent2.expression === root && parent2.parent.kind === 227 && parent2.parent.operatorToken.kind === 64 && parent2.parent.left === parent2 && !isAssignmentTarget(parent2.parent) && isTypeAssignableToKind(getTypeOfExpression(parent2.argumentExpression), 67648); return isLengthPushOrUnshift || isElementAssignment; } function isDeclarationWithExplicitTypeAnnotation(node) { @@ -66613,7 +66783,7 @@ ${lanes.join(` return signature === unknownSignature ? undefined : signature; } function hasTypePredicateOrNeverReturnType(signature) { - return !!(getTypePredicateOfSignature(signature) || signature.declaration && (getReturnTypeFromAnnotation(signature.declaration) || unknownType).flags & 131072); + return !!(getTypePredicateOfSignature(signature) || signature.declaration && (getReturnTypeFromAnnotation(signature.declaration) || unknownType).flags & 262144); } function getTypePredicateArgument(predicate, callExpression) { if (predicate.kind === 1 || predicate.kind === 3) { @@ -66664,7 +66834,7 @@ ${lanes.join(` return false; } } - if (getReturnTypeOfSignature(signature).flags & 131072) { + if (getReturnTypeOfSignature(signature).flags & 262144) { return false; } } @@ -66765,7 +66935,7 @@ ${lanes.join(` const evolvedType = getTypeFromFlowType(getTypeAtFlowNode(flowNode)); sharedFlowCount = sharedFlowStart; const resultType = getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 236 && !(resultType.flags & 131072) && getTypeWithFacts(resultType, 2097152).flags & 131072) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 236 && !(resultType.flags & 262144) && getTypeWithFacts(resultType, 2097152).flags & 262144) { return declaredType; } return resultType; @@ -66873,7 +67043,7 @@ ${lanes.join(` return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType; } const t = isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(declaredType) : declaredType; - if (t.flags & 1048576) { + if (t.flags & 134217728) { return getAssignmentReducedType(t, getInitialOrAssignedType(flow)); } return t; @@ -66920,7 +67090,7 @@ ${lanes.join(` const narrowedType = predicate.type ? narrowTypeByTypePredicate(type, predicate, flow.node, true) : predicate.kind === 3 && predicate.parameterIndex >= 0 && predicate.parameterIndex < flow.node.arguments.length ? narrowTypeByAssertion(type, flow.node.arguments[predicate.parameterIndex]) : type; return narrowedType === type ? flowType : createFlowType(narrowedType, isIncomplete(flowType)); } - if (getReturnTypeOfSignature(signature).flags & 131072) { + if (getReturnTypeOfSignature(signature).flags & 262144) { return unreachableNeverType; } } @@ -66941,7 +67111,7 @@ ${lanes.join(` } } else { const indexType = getContextFreeTypeOfExpression(node.left.argumentExpression); - if (isTypeAssignableToKind(indexType, 296)) { + if (isTypeAssignableToKind(indexType, 67648)) { evolvedType2 = addEvolvingArrayElementType(evolvedType2, node.right); } } @@ -66955,7 +67125,7 @@ ${lanes.join(` function getTypeAtFlowCondition(flow) { const flowType = getTypeAtFlowNode(flow.antecedent); const type = getTypeFromFlowType(flowType); - if (type.flags & 131072) { + if (type.flags & 262144) { return flowType; } const assumeTrue = (flow.flags & 32) !== 0; @@ -66979,9 +67149,9 @@ ${lanes.join(` } else { if (strictNullChecks) { if (optionalChainContainsReference(expr, reference)) { - type = narrowTypeBySwitchOptionalChainContainment(type, flow.node, (t) => !(t.flags & (32768 | 131072))); + type = narrowTypeBySwitchOptionalChainContainment(type, flow.node, (t) => !(t.flags & (4 | 262144))); } else if (expr.kind === 222 && optionalChainContainsReference(expr.expression, reference)) { - type = narrowTypeBySwitchOptionalChainContainment(type, flow.node, (t) => !(t.flags & 131072 || t.flags & 128 && t.value === "undefined")); + type = narrowTypeBySwitchOptionalChainContainment(type, flow.node, (t) => !(t.flags & 262144 || t.flags & 1024 && t.value === "undefined")); } } const access = getDiscriminantPropertyAccess(expr, type); @@ -67017,7 +67187,7 @@ ${lanes.join(` if (bypassFlow) { const flowType = getTypeAtFlowNode(bypassFlow); const type = getTypeFromFlowType(flowType); - if (!(type.flags & 131072) && !contains(antecedentTypes, type) && !isExhaustiveSwitchStatement(bypassFlow.node.switchStatement)) { + if (!(type.flags & 262144) && !contains(antecedentTypes, type) && !isExhaustiveSwitchStatement(bypassFlow.node.switchStatement)) { if (type === declaredType && declaredType === initialType) { return type; } @@ -67091,7 +67261,7 @@ ${lanes.join(` return getEvolvingArrayType(getUnionType(map(types, getElementTypeOfEvolvingArrayType))); } const result = recombineUnknownType(getUnionType(sameMap(types, finalizeEvolvingArrayType), subtypeReduction)); - if (result !== declaredType && result.flags & declaredType.flags & 1048576 && arrayIsEqualTo(result.types, declaredType.types)) { + if (result !== declaredType && result.flags & declaredType.flags & 134217728 && arrayIsEqualTo(result.types, declaredType.types)) { return declaredType; } return result; @@ -67113,26 +67283,30 @@ ${lanes.join(` const symbol = getResolvedSymbol(expr); if (isConstantVariable(symbol)) { const declaration = symbol.valueDeclaration; - if (isVariableDeclaration(declaration) && !declaration.type && declaration.initializer && isAccessExpression(declaration.initializer) && isMatchingReference(reference, declaration.initializer.expression)) { - return declaration.initializer; + let initializer = getCandidateVariableDeclarationInitializer(declaration); + if (initializer && isAccessExpression(initializer) && isMatchingReference(reference, initializer.expression)) { + return initializer; } if (isBindingElement(declaration) && !declaration.initializer) { - const parent2 = declaration.parent.parent; - if (isVariableDeclaration(parent2) && !parent2.type && parent2.initializer && (isIdentifier(parent2.initializer) || isAccessExpression(parent2.initializer)) && isMatchingReference(reference, parent2.initializer)) { + initializer = getCandidateVariableDeclarationInitializer(declaration.parent.parent); + if (initializer && (isIdentifier(initializer) || isAccessExpression(initializer)) && isMatchingReference(reference, initializer)) { return declaration; } } } } return; + function getCandidateVariableDeclarationInitializer(node) { + return isVariableDeclaration(node) && !node.type && node.initializer ? skipParentheses(node.initializer) : undefined; + } } function getDiscriminantPropertyAccess(expr, computedType) { - if (declaredType.flags & 1048576 || computedType.flags & 1048576) { + if (declaredType.flags & 134217728 || computedType.flags & 134217728) { const access = getCandidateDiscriminantPropertyAccess(expr); if (access) { const name = getAccessedPropertyName(access); if (name) { - const type = declaredType.flags & 1048576 && isTypeSubsetOf(computedType, declaredType) ? declaredType : computedType; + const type = declaredType.flags & 134217728 && isTypeSubsetOf(computedType, declaredType) ? declaredType : computedType; if (isDiscriminantProperty(type, name)) { return access; } @@ -67147,7 +67321,7 @@ ${lanes.join(` return type; } const optionalChain = isOptionalChain(access); - const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(access)) && maybeTypeOfKind(type, 98304); + const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(access)) && maybeTypeOfKind(type, 12); let propType = getTypeOfPropertyOfType(removeNullable ? getTypeWithFacts(type, 2097152) : type, propName); if (!propType) { return type; @@ -67156,11 +67330,11 @@ ${lanes.join(` const narrowedPropType = narrowType2(propType); return filterType(type, (t) => { const discriminantType = getTypeOfPropertyOrIndexSignatureOfType(t, propName) || unknownType; - return !(discriminantType.flags & 131072) && !(narrowedPropType.flags & 131072) && areTypesComparable(narrowedPropType, discriminantType); + return !(discriminantType.flags & 262144) && !(narrowedPropType.flags & 262144) && areTypesComparable(narrowedPropType, discriminantType); }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { - if ((operator === 37 || operator === 38) && type.flags & 1048576) { + if ((operator === 37 || operator === 38) && type.flags & 134217728) { const keyPropertyName = getKeyPropertyName(type); if (keyPropertyName && keyPropertyName === getAccessedPropertyName(access)) { const candidate = getConstituentTypeForKeyType(type, getTypeOfExpression(value)); @@ -67172,7 +67346,7 @@ ${lanes.join(` return narrowTypeByDiscriminant(type, access, (t) => narrowTypeByEquality(t, operator, value, assumeTrue)); } function narrowTypeBySwitchOnDiscriminantProperty(type, access, data) { - if (data.clauseStart < data.clauseEnd && type.flags & 1048576 && getKeyPropertyName(type) === getAccessedPropertyName(access)) { + if (data.clauseStart < data.clauseEnd && type.flags & 134217728 && getKeyPropertyName(type) === getAccessedPropertyName(access)) { const clauseTypes = getSwitchClauseTypes(data.switchStatement).slice(data.clauseStart, data.clauseEnd); const candidate = getUnionType(map(clauseTypes, (t) => getConstituentTypeForKeyType(type, t) || unknownType)); if (candidate !== unknownType) { @@ -67315,7 +67489,7 @@ ${lanes.join(` } function narrowTypeByOptionalChainContainment(type, operator, value, assumeTrue) { const equalsOperator = operator === 35 || operator === 37; - const nullableFlags = operator === 35 || operator === 36 ? 98304 : 32768; + const nullableFlags = operator === 35 || operator === 36 ? 12 : 4; const valueType = getTypeOfExpression(value); const removeNullable = equalsOperator !== assumeTrue && everyType(valueType, (t) => !!(t.flags & nullableFlags)) || equalsOperator === assumeTrue && everyType(valueType, (t) => !(t.flags & (3 | nullableFlags))); return removeNullable ? getAdjustedTypeWithFacts(type, 2097152) : type; @@ -67329,19 +67503,19 @@ ${lanes.join(` } const valueType = getTypeOfExpression(value); const doubleEquals = operator === 35 || operator === 36; - if (valueType.flags & 98304) { + if (valueType.flags & 12) { if (!strictNullChecks) { return type; } - const facts = doubleEquals ? assumeTrue ? 262144 : 2097152 : valueType.flags & 65536 ? assumeTrue ? 131072 : 1048576 : assumeTrue ? 65536 : 524288; + const facts = doubleEquals ? assumeTrue ? 262144 : 2097152 : valueType.flags & 8 ? assumeTrue ? 131072 : 1048576 : assumeTrue ? 65536 : 524288; return getAdjustedTypeWithFacts(type, facts); } if (assumeTrue) { if (!doubleEquals && (type.flags & 2 || someType(type, isEmptyAnonymousObjectType))) { - if (valueType.flags & (402784252 | 67108864) || isEmptyAnonymousObjectType(valueType)) { + if (valueType.flags & (12713980 | 131072) || isEmptyAnonymousObjectType(valueType)) { return valueType; } - if (valueType.flags & 524288) { + if (valueType.flags & 1048576) { return nonPrimitiveType; } } @@ -67388,11 +67562,11 @@ ${lanes.join(` let groundClauseTypes; for (let i = 0;i < clauseTypes.length; i += 1) { const t = clauseTypes[i]; - if (t.flags & (402784252 | 67108864)) { + if (t.flags & (12713980 | 131072)) { if (groundClauseTypes !== undefined) { groundClauseTypes.push(t); } - } else if (t.flags & 524288) { + } else if (t.flags & 1048576) { if (groundClauseTypes === undefined) { groundClauseTypes = clauseTypes.slice(0, i); } @@ -67404,12 +67578,12 @@ ${lanes.join(` return getUnionType(groundClauseTypes === undefined ? clauseTypes : groundClauseTypes); } const discriminantType = getUnionType(clauseTypes); - const caseType = discriminantType.flags & 131072 ? neverType : replacePrimitivesWithLiterals(filterType(type, (t) => areTypesComparable(discriminantType, t)), discriminantType); + const caseType = discriminantType.flags & 262144 ? neverType : replacePrimitivesWithLiterals(filterType(type, (t) => areTypesComparable(discriminantType, t)), discriminantType); if (!hasDefaultClause) { return caseType; } - const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 32768 ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t))))); - return caseType.flags & 131072 ? defaultType : getUnionType([caseType, defaultType]); + const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 4 ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)), (t1, t2) => isUnitType(t1) && areTypesComparable(t1, t2)))); + return caseType.flags & 262144 ? defaultType : getUnionType([caseType, defaultType]); } function narrowTypeByTypeName(type, typeName) { switch (typeName) { @@ -67495,7 +67669,7 @@ ${lanes.join(` } return filterType(type, (t) => isConstructedBy(t, candidate)); function isConstructedBy(source, target) { - if (source.flags & 524288 && getObjectFlags(source) & 1 || target.flags & 524288 && getObjectFlags(target) & 1) { + if (source.flags & 1048576 && getObjectFlags(source) & 1 || target.flags & 1048576 && getObjectFlags(target) & 1) { return source.symbol === target.symbol; } return isTypeSubtypeOf(source, target); @@ -67523,7 +67697,7 @@ ${lanes.join(` return type; } const instanceType = mapType(rightType, getInstanceType); - if (isTypeAny(type) && (instanceType === globalObjectType || instanceType === globalFunctionType) || !assumeTrue && !(instanceType.flags & 524288 && !isEmptyAnonymousObjectType(instanceType))) { + if (isTypeAny(type) && (instanceType === globalObjectType || instanceType === globalFunctionType) || !assumeTrue && !(instanceType.flags & 1048576 && !isEmptyAnonymousObjectType(instanceType))) { return type; } return getNarrowedType(type, instanceType, assumeTrue, true); @@ -67540,7 +67714,7 @@ ${lanes.join(` return emptyObjectType; } function getNarrowedType(type, candidate, assumeTrue, checkDerived) { - const key2 = type.flags & 1048576 ? `N${getTypeId(type)},${getTypeId(candidate)},${(assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)}` : undefined; + const key2 = type.flags & 134217728 ? `N${getTypeId(type)},${getTypeId(candidate)},${(assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)}` : undefined; return getCachedType(key2) ?? setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived)); } function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) { @@ -67562,14 +67736,14 @@ ${lanes.join(` return candidate; } const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf; - const keyPropertyName = type.flags & 1048576 ? getKeyPropertyName(type) : undefined; + const keyPropertyName = type.flags & 134217728 ? getKeyPropertyName(type) : undefined; const narrowedType = mapType(candidate, (c) => { const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName); const matching = discriminant && getConstituentTypeForKeyType(type, discriminant); const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType); - return directlyRelated.flags & 131072 ? mapType(type, (t) => maybeTypeOfKind(t, 465829888) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated; + return directlyRelated.flags & 262144 ? mapType(type, (t) => maybeTypeOfKind(t, 132644864) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated; }); - return !(narrowedType.flags & 131072) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]); + return !(narrowedType.flags & 262144) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]); } function narrowTypeByCallExpression(type, callExpression, assumeTrue) { if (hasMatchingArgument(callExpression, reference)) { @@ -67815,10 +67989,10 @@ ${lanes.join(` return parent2.kind === 212 || parent2.kind === 167 || parent2.kind === 214 && parent2.expression === node || parent2.kind === 215 && parent2.expression === node || parent2.kind === 213 && parent2.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent2.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { - return type.flags & 2097152 ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 465829888 && getBaseConstraintOrType(type).flags & (98304 | 1048576)); + return type.flags & 268435456 ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 132644864 && getBaseConstraintOrType(type).flags & (12 | 134217728)); } function isGenericTypeWithoutNullableConstraint(type) { - return type.flags & 2097152 ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304)); + return type.flags & 268435456 ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 132644864 && !maybeTypeOfKind(getBaseConstraintOrType(type), 12)); } function hasContextualTypeWithNoGenericTypes(node, checkMode) { const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 32 ? getContextualType2(node, 8) : getContextualType2(node, undefined)); @@ -68145,10 +68319,10 @@ ${lanes.join(` const parentType = getTypeForBindingElementParent(parent2, 0); const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~4194304; - if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 && !(rootDeclaration.kind === 170 && isSomeSymbolAssigned(rootDeclaration))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 134217728 && !(rootDeclaration.kind === 170 && isSomeSymbolAssigned(rootDeclaration))) { const pattern = declaration.parent; const narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, undefined, location.flowNode); - if (narrowedType.flags & 131072) { + if (narrowedType.flags & 262144) { return neverType; } return getBindingElementTypeFromParentType(declaration, narrowedType, true); @@ -68162,7 +68336,7 @@ ${lanes.join(` const contextualSignature = getContextualSignature(func); if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) { const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (_a = getInferenceContext(func)) == null ? undefined : _a.nonFixingMapper)); - if (restType.flags & 1048576 && everyType(restType, isTupleType) && !some(func.parameters, isSomeSymbolAssigned)) { + if (restType.flags & 134217728 && everyType(restType, isTupleType) && !some(func.parameters, isSomeSymbolAssigned)) { const narrowedType = getFlowTypeOfReference(func, restType, restType, undefined, location.flowNode); const index = func.parameters.indexOf(declaration) - (getThisParameter(func) ? 1 : 0); return getIndexedAccessType(narrowedType, getNumberLiteralType(index)); @@ -68231,7 +68405,7 @@ ${lanes.join(` } checkIdentifierCalculateNodeCheckFlags(node, symbol); if (symbol === argumentsSymbol) { - if (isInPropertyInitializerOrClassStaticBlock(node)) { + if (isInPropertyInitializerOrClassStaticBlock(node, true)) { return errorType; } return getTypeOfSymbol(symbol); @@ -68287,8 +68461,8 @@ ${lanes.join(` while (flowContainer !== declarationContainer && (flowContainer.kind === 219 || flowContainer.kind === 220 || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrMutableLocalVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) { flowContainer = getControlFlowContainer(flowContainer); } - const isNeverInitialized = immediateDeclaration && isVariableDeclaration(immediateDeclaration) && !immediateDeclaration.initializer && !immediateDeclaration.exclamationToken && isMutableLocalVariableDeclaration(immediateDeclaration) && !isSymbolAssignedDefinitely(symbol); - const assumeInitialized = isParameter2 || isAlias || isOuterVariable && !isNeverInitialized || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 | 16384)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 282) || node.parent.kind === 236 || declaration.kind === 261 && declaration.exclamationToken || declaration.flags & 33554432; + const isNeverInitialized = immediateDeclaration && isVariableDeclaration(immediateDeclaration) && !isForInOrOfStatement(immediateDeclaration.parent.parent) && !immediateDeclaration.initializer && !immediateDeclaration.exclamationToken && isMutableLocalVariableDeclaration(immediateDeclaration) && !isSymbolAssignedDefinitely(symbol); + const assumeInitialized = isParameter2 || isAlias || isOuterVariable && !isNeverInitialized || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 | 16)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 282) || node.parent.kind === 236 || declaration.kind === 261 && declaration.exclamationToken || declaration.flags & 33554432; 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)) { @@ -68664,7 +68838,7 @@ ${lanes.join(` } function getThisTypeFromContextualType(type) { return mapType(type, (t) => { - return t.flags & 2097152 ? forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t); + return t.flags & 268435456 ? forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t); }); } function getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType) { @@ -68809,7 +68983,7 @@ ${lanes.join(` const functionFlags = getFunctionFlags(func); if (functionFlags & 1) { const isAsyncGenerator = (functionFlags & 2) !== 0; - if (contextualReturnType.flags & 1048576) { + if (contextualReturnType.flags & 134217728) { contextualReturnType = filterType(contextualReturnType, (type) => !!getIterationTypeOfGeneratorFunctionReturnType(1, type, isAsyncGenerator)); } const iterationReturnType = getIterationTypeOfGeneratorFunctionReturnType(1, contextualReturnType, (functionFlags & 2) !== 0); @@ -68842,7 +69016,7 @@ ${lanes.join(` let contextualReturnType = getContextualReturnType(func, contextFlags); if (contextualReturnType) { const isAsyncGenerator = (functionFlags & 2) !== 0; - if (!node.asteriskToken && contextualReturnType.flags & 1048576) { + if (!node.asteriskToken && contextualReturnType.flags & 134217728) { contextualReturnType = filterType(contextualReturnType, (type) => !!getIterationTypeOfGeneratorFunctionReturnType(1, type, isAsyncGenerator)); } if (node.asteriskToken) { @@ -68894,12 +69068,12 @@ ${lanes.join(` const functionFlags = getFunctionFlags(functionDecl); if (functionFlags & 1) { return filterType(returnType2, (t) => { - return !!(t.flags & (3 | 16384 | 58982400)) || checkGeneratorInstantiationAssignabilityToReturnType(t, functionFlags, undefined); + return !!(t.flags & (3 | 16 | 117964800)) || checkGeneratorInstantiationAssignabilityToReturnType(t, functionFlags, undefined); }); } if (functionFlags & 2) { return filterType(returnType2, (t) => { - return !!(t.flags & (3 | 16384 | 58982400)) || !!getAwaitedTypeOfPromise(t); + return !!(t.flags & (3 | 16 | 117964800)) || !!getAwaitedTypeOfPromise(t); }); } return returnType2; @@ -69081,23 +69255,23 @@ ${lanes.join(` return !!(getCheckFlags(symbol) & 262144 && !symbol.links.type && findResolutionCycleStartIndex(symbol, 0) >= 0); } function isExcludedMappedPropertyName(constraint, propertyNameType) { - if (constraint.flags & 16777216) { + if (constraint.flags & 67108864) { const type = constraint; - return !!(getReducedType(getTrueTypeFromConditionalType(type)).flags & 131072) && getActualTypeVariable(getFalseTypeFromConditionalType(type)) === getActualTypeVariable(type.checkType) && isTypeAssignableTo(propertyNameType, type.extendsType); + return !!(getReducedType(getTrueTypeFromConditionalType(type)).flags & 262144) && getActualTypeVariable(getFalseTypeFromConditionalType(type)) === getActualTypeVariable(type.checkType) && isTypeAssignableTo(propertyNameType, type.extendsType); } - if (constraint.flags & 2097152) { + if (constraint.flags & 268435456) { return some(constraint.types, (t) => isExcludedMappedPropertyName(t, propertyNameType)); } return false; } function getTypeOfPropertyOfContextualType(type, name, nameType) { return mapType(type, (t) => { - if (t.flags & 2097152) { + if (t.flags & 268435456) { let types; let indexInfoCandidates; let ignoreIndexInfos = false; for (const constituentType of t.types) { - if (!(constituentType.flags & 524288)) { + if (!(constituentType.flags & 1048576)) { continue; } if (isGenericMappedType(constituentType) && getMappedTypeNameTypeKind(constituentType) !== 2) { @@ -69130,7 +69304,7 @@ ${lanes.join(` } return getIntersectionType(types); } - if (!(t.flags & 524288)) { + if (!(t.flags & 1048576)) { return; } return isGenericMappedType(t) && getMappedTypeNameTypeKind(t) !== 2 ? getIndexedMappedTypeSubstitutedTypeOfContextualType(t, name, nameType) : getTypeOfConcretePropertyOfContextualType(t, name) ?? getTypeFromIndexInfosOfContextualType(t, name, nameType); @@ -69329,32 +69503,37 @@ ${lanes.join(` function getApparentTypeOfContextualType(node, contextFlags) { const contextualType = isObjectLiteralMethod(node) ? getContextualTypeForObjectLiteralMethod(node, contextFlags) : getContextualType2(node, contextFlags); const instantiatedType = instantiateContextualType(contextualType, node, contextFlags); - if (instantiatedType && !(contextFlags && contextFlags & 2 && instantiatedType.flags & 8650752)) { + if (instantiatedType && !(contextFlags && contextFlags & 2 && instantiatedType.flags & 34078720)) { const apparentType = mapType(instantiatedType, (t) => getObjectFlags(t) & 32 ? t : getApparentType(t), true); - return apparentType.flags & 1048576 && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType; + return apparentType.flags & 134217728 && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 134217728 && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType; } } function instantiateContextualType(contextualType, node, contextFlags) { - if (contextualType && maybeTypeOfKind(contextualType, 465829888)) { + if (contextualType && maybeTypeOfKind(contextualType, 132644864)) { const inferenceContext = getInferenceContext(node); if (inferenceContext && contextFlags & 1 && some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) { - return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper); + const type = instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper); + if (!(type.flags & 3)) { + return type; + } } if (inferenceContext == null ? undefined : inferenceContext.returnMapper) { const type = instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper); - return type.flags & 1048576 && containsType(type.types, regularFalseType) && containsType(type.types, regularTrueType) ? filterType(type, (t) => t !== regularFalseType && t !== regularTrueType) : type; + if (!(type.flags & 3)) { + return type.flags & 134217728 && containsType(type.types, regularFalseType) && containsType(type.types, regularTrueType) ? filterType(type, (t) => t !== regularFalseType && t !== regularTrueType) : type; + } } } return contextualType; } function instantiateInstantiableTypes(type, mapper) { - if (type.flags & 465829888) { + if (type.flags & 132644864) { return instantiateType(type, mapper); } - if (type.flags & 1048576) { + if (type.flags & 134217728) { return getUnionType(map(type.types, (t) => instantiateInstantiableTypes(t, mapper)), 0); } - if (type.flags & 2097152) { + if (type.flags & 268435456) { return getIntersectionType(map(type.types, (t) => instantiateInstantiableTypes(t, mapper))); } return type; @@ -69556,7 +69735,7 @@ ${lanes.join(` return getOrCreateTypeFromSignature(fakeSignature); } const tagType = checkExpressionCached(context.tagName); - if (tagType.flags & 128) { + if (tagType.flags & 1024) { const result = getIntrinsicAttributesTypeFromStringLiteralType(tagType, context); if (!result) { return errorType; @@ -69675,10 +69854,10 @@ ${lanes.join(` const thisParam = combineIntersectionThisParam(left.thisParameter, right.thisParameter, paramMapper); const minArgCount = Math.max(left.minArgumentCount, right.minArgumentCount); const result = createSignature(declaration, typeParams, thisParam, params, undefined, undefined, minArgCount, flags); - result.compositeKind = 2097152; - result.compositeSignatures = concatenate(left.compositeKind === 2097152 && left.compositeSignatures || [left], [right]); + result.compositeKind = 268435456; + result.compositeSignatures = concatenate(left.compositeKind === 268435456 && left.compositeSignatures || [left], [right]); if (paramMapper) { - result.mapper = left.compositeKind === 2097152 && left.mapper && left.compositeSignatures ? combineTypeMappers(left.mapper, paramMapper) : paramMapper; + result.mapper = left.compositeKind === 268435456 && left.mapper && left.compositeSignatures ? combineTypeMappers(left.mapper, paramMapper) : paramMapper; } return result; } @@ -69713,7 +69892,7 @@ ${lanes.join(` if (!type) { return; } - if (!(type.flags & 1048576)) { + if (!(type.flags & 134217728)) { return getContextualCallSignature(type, node); } let signatureList; @@ -69866,7 +70045,7 @@ ${lanes.join(` } } function isNumericComputedName(name) { - return isTypeAssignableToKind(checkComputedPropertyName(name), 296); + return isTypeAssignableToKind(checkComputedPropertyName(name), 67648); } function checkComputedPropertyName(node) { const links = getNodeLinks(node.expression); @@ -69884,7 +70063,7 @@ ${lanes.join(` getNodeLinks(node.parent.parent).flags |= 32768; } } - if (links.resolvedType.flags & 98304 || !isTypeAssignableToKind(links.resolvedType, 402653316 | 296 | 12288) && !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) { + if (links.resolvedType.flags & 12 || !isTypeAssignableToKind(links.resolvedType, 12583968 | 67648 | 16896) && !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) { error2(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } } @@ -69898,7 +70077,7 @@ ${lanes.join(` function isSymbolWithSymbolName(symbol) { var _a; const firstDecl = (_a = symbol.declarations) == null ? undefined : _a[0]; - return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096); + return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 512); } function isSymbolWithComputedName(symbol) { var _a; @@ -70035,7 +70214,7 @@ ${lanes.join(` Debug.assert(memberDecl.kind === 178 || memberDecl.kind === 179); checkNodeDeferred(memberDecl); } - if (computedNameType && !(computedNameType.flags & 8576)) { + if (computedNameType && !(computedNameType.flags & 19456)) { if (isTypeAssignableTo(computedNameType, stringNumberSymbolType)) { if (isTypeAssignableTo(computedNameType, numberType)) { hasComputedNumberProperty = true; @@ -70093,7 +70272,7 @@ ${lanes.join(` } function isValidSpreadType(type) { const t = removeDefinitelyFalsyTypes(mapType(type, getBaseConstraintOrType)); - return !!(t.flags & (1 | 67108864 | 524288 | 58982400) || t.flags & 3145728 && every(t.types, isValidSpreadType)); + return !!(t.flags & (1 | 131072 | 1048576 | 117964800) || t.flags & 402653184 && every(t.types, isValidSpreadType)); } function checkJsxSelfClosingElementDeferred(node) { checkJsxOpeningLikeElementOrOpeningFragment(node); @@ -70224,7 +70403,7 @@ ${lanes.join(` childrenPropSymbol.valueDeclaration.symbol = childrenPropSymbol; const childPropMap = createSymbolTable(); childPropMap.set(jsxChildrenPropertyName, childrenPropSymbol); - spread = getSpreadType(spread, createAnonymousType(attributesSymbol, childPropMap, emptyArray, emptyArray, emptyArray), attributesSymbol, objectFlags, false); + spread = getSpreadType(spread, createAnonymousType(attributesSymbol, childPropMap, emptyArray, emptyArray, emptyArray), attributesSymbol, objectFlags | getPropagatingFlagsOfTypes(childrenTypes), false); } } if (hasSpreadAnyType) { @@ -70261,7 +70440,7 @@ ${lanes.join(` } function checkSpreadPropOverrides(type, props, spread) { for (const right of getPropertiesOfType(type)) { - if (!(right.flags & 16777216)) { + if (!(right.flags & 16777216) && !(getCheckFlags(right) & 48)) { const left = props.get(right.escapedName); if (left) { const diagnostic = error2(left.valueDeclaration, Diagnostics._0_is_specified_more_than_once_so_this_usage_will_be_overwritten, unescapeLeadingUnderscores(left.escapedName)); @@ -70396,9 +70575,9 @@ ${lanes.join(` return getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer, jsxNamespace); } function getUninstantiatedJsxSignaturesOfType(elementType, caller) { - if (elementType.flags & 4) { + if (elementType.flags & 32) { return [anySignature]; - } else if (elementType.flags & 128) { + } else if (elementType.flags & 1024) { const intrinsicType = getIntrinsicAttributesTypeFromStringLiteralType(elementType, caller); if (!intrinsicType) { error2(caller, Diagnostics.Property_0_does_not_exist_on_type_1, elementType.value, "JSX." + JsxNames.IntrinsicElements); @@ -70413,7 +70592,7 @@ ${lanes.join(` if (signatures.length === 0) { signatures = getSignaturesOfType(apparentElemType, 0); } - if (signatures.length === 0 && apparentElemType.flags & 1048576) { + if (signatures.length === 0 && apparentElemType.flags & 134217728) { signatures = getUnionSignatures(map(apparentElemType.types, (t) => getUninstantiatedJsxSignaturesOfType(t, caller))); } return signatures; @@ -70557,15 +70736,15 @@ ${lanes.join(` } } function isKnownProperty(targetType, name, isComparingJsxAttributes) { - if (targetType.flags & 524288) { + if (targetType.flags & 1048576) { if (getPropertyOfObjectType(targetType, name) || getApplicableIndexInfoForName(targetType, name) || isLateBoundName(name) && getIndexInfoOfType(targetType, stringType) || isComparingJsxAttributes && isHyphenatedJsxName(name)) { return true; } } - if (targetType.flags & 33554432) { + if (targetType.flags & 16777216) { return isKnownProperty(targetType.baseType, name, isComparingJsxAttributes); } - if (targetType.flags & 3145728 && isExcessPropertyCheckTarget(targetType)) { + if (targetType.flags & 402653184 && isExcessPropertyCheckTarget(targetType)) { for (const t of targetType.types) { if (isKnownProperty(t, name, isComparingJsxAttributes)) { return true; @@ -70575,7 +70754,7 @@ ${lanes.join(` return false; } function isExcessPropertyCheckTarget(type) { - return !!(type.flags & 524288 && !(getObjectFlags(type) & 512) || type.flags & 67108864 || type.flags & 33554432 && isExcessPropertyCheckTarget(type.baseType) || type.flags & 1048576 && some(type.types, isExcessPropertyCheckTarget) || type.flags & 2097152 && every(type.types, isExcessPropertyCheckTarget)); + return !!(type.flags & 1048576 && !(getObjectFlags(type) & 512) || type.flags & 131072 || type.flags & 16777216 && isExcessPropertyCheckTarget(type.baseType) || type.flags & 134217728 && some(type.types, isExcessPropertyCheckTarget) || type.flags & 268435456 && every(type.types, isExcessPropertyCheckTarget)); } function checkJsxExpression(node, checkMode) { checkGrammarJsxExpression(node); @@ -70631,10 +70810,10 @@ ${lanes.join(` } } if (flags & 64 && symbolHasNonMethodDeclaration(prop) && (isThisProperty(location) || isThisInitializedObjectBindingExpression(location) || isObjectBindingPattern(location.parent) && isThisInitializedDeclaration(location.parent.parent))) { - const declaringClassDeclaration = getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); - if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { + const parentSymbol = getParentOfSymbol(prop); + if (parentSymbol && parentSymbol.flags & 32 && isNodeUsedDuringClassInitialization(location)) { if (errorNode) { - error2(errorNode, Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor, symbolToString(prop), getTextOfIdentifierOrLiteral(declaringClassDeclaration.name)); + error2(errorNode, Diagnostics.Abstract_property_0_in_class_1_cannot_be_accessed_in_the_constructor, symbolToString(prop), symbolToString(parentSymbol)); } return false; } @@ -70672,7 +70851,7 @@ ${lanes.join(` if (flags & 256) { return true; } - if (containingType.flags & 262144) { + if (containingType.flags & 524288) { containingType = containingType.isThisType ? getConstraintOfTypeParameter(containingType) : getBaseConstraintOfType(containingType); } if (!containingType || !hasBaseType(containingType, enclosingClass)) { @@ -70687,7 +70866,7 @@ ${lanes.join(` const thisParameter = getThisParameterFromNodeContext(node); let thisType = (thisParameter == null ? undefined : thisParameter.type) && getTypeFromTypeNode(thisParameter.type); if (thisType) { - if (thisType.flags & 262144) { + if (thisType.flags & 524288) { thisType = getConstraintOfTypeParameter(thisType); } } else { @@ -70752,7 +70931,7 @@ ${lanes.join(` if (facts & 50331648) { reportError(node, facts); const t = getNonNullableType(type); - return t.flags & (98304 | 131072) ? errorType : t; + return t.flags & (12 | 262144) ? errorType : t; } return type; } @@ -70761,7 +70940,7 @@ ${lanes.join(` } function checkNonNullNonVoidType(type, node) { const nonNullType = checkNonNullType(type, node); - if (nonNullType.flags & 16384) { + if (nonNullType.flags & 16) { if (isEntityNameExpression(node)) { const nodeText2 = entityNameToString(node); if (isIdentifier(node) && nodeText2 === "undefined") { @@ -70996,7 +71175,7 @@ ${lanes.join(` if (assignmentKind === 1) { return removeMissingType(propType, !!(prop && prop.flags & 16777216)); } - if (prop && !(prop.flags & (3 | 4 | 98304)) && !(prop.flags & 8192 && propType.flags & 1048576) && !isDuplicatedCommonJSExport(prop.declarations)) { + if (prop && !(prop.flags & (3 | 4 | 98304)) && !(prop.flags & 8192 && propType.flags & 134217728) && !isDuplicatedCommonJSExport(prop.declarations)) { return propType; } if (propType === autoType) { @@ -71059,27 +71238,14 @@ ${lanes.join(` }); } function isPropertyDeclaredInAncestorClass(prop) { - if (!(prop.parent.flags & 32)) { - return false; - } - let classType = getTypeOfSymbol(prop.parent); - while (true) { - classType = classType.symbol && getSuperClass(classType); - if (!classType) { - return false; - } - const superProperty = getPropertyOfType(classType, prop.escapedName); - if (superProperty && superProperty.valueDeclaration) { - return true; + if (prop.parent && prop.parent.flags & 32) { + const baseTypes = getBaseTypes(getDeclaredTypeOfSymbol(prop.parent)); + if (baseTypes.length) { + const superProperty = getPropertyOfType(baseTypes[0], prop.escapedName); + return !!(superProperty && superProperty.valueDeclaration); } } - } - function getSuperClass(classType) { - const x = getBaseTypes(classType); - if (x.length === 0) { - return; - } - return getIntersectionType(x); + return false; } function reportNonexistentProperty(propNode, containingType, isUncheckedJS) { const links = getNodeLinks(propNode); @@ -71091,7 +71257,7 @@ ${lanes.join(` cache.add(key); let errorInfo; let relatedInfo; - if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 && !(containingType.flags & 402784252)) { + if (!isPrivateIdentifier(propNode) && containingType.flags & 134217728 && !(containingType.flags & 12713980)) { 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)); @@ -71191,13 +71357,12 @@ ${lanes.join(` const symbol = getSymbol2(symbols, name, meaning); if (symbol) return symbol; - let candidates; + let candidates = arrayFrom(symbols.values()); if (symbols === globals) { const primitives = mapDefined(["string", "number", "boolean", "object", "bigint", "symbol"], (s) => symbols.has(s.charAt(0).toUpperCase() + s.slice(1)) ? createSymbol(524288, s) : undefined); - candidates = primitives.concat(arrayFrom(symbols.values())); - } else { - candidates = arrayFrom(symbols.values()); + candidates = concatenate(primitives, candidates); } + sortSymbolsIfTSGoCompat(candidates); return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning); } function getSuggestedSymbolForNonexistentSymbol(location, outerName, meaning) { @@ -71206,7 +71371,7 @@ ${lanes.join(` return result; } function getSuggestedSymbolForNonexistentModule(name, targetModule) { - return targetModule.exports && getSpellingSuggestionForName(idText(name), getExportsOfModuleAsArray(targetModule), 2623475); + return targetModule.exports && getSpellingSuggestionForName(idText(name), sortSymbolsIfTSGoCompat(getExportsOfModuleAsArray(targetModule)), 2623475); } function getSuggestionForNonexistentIndexSignature(objectType, expr, keyedType) { function hasProp(name) { @@ -71230,7 +71395,7 @@ ${lanes.join(` return suggestion; } function getSuggestedTypeForNonexistentStringLiteralType(source, target) { - const candidates = target.types.filter((type) => !!(type.flags & 128)); + const candidates = target.types.filter((type) => !!(type.flags & 1024)); return getSpellingSuggestion(source.value, candidates, (type) => type.value); } function getSpellingSuggestionForName(name, symbols, meaning) { @@ -71436,10 +71601,10 @@ ${lanes.join(` return findIndex(args, isSpreadArgument); } function acceptsVoid(t) { - return !!(t.flags & 16384); + return !!(t.flags & 16); } function acceptsVoidUndefinedUnknownOrAny(t) { - return !!(t.flags & (16384 | 32768 | 2 | 1)); + return !!(t.flags & (16 | 4 | 2 | 1)); } function hasCorrectArity(node, args, signature, signatureHelpTrailingComma = false) { if (isJsxOpeningFragment(node)) @@ -71489,7 +71654,7 @@ ${lanes.join(` } for (let i = argCount;i < effectiveMinimumArguments; i++) { const type = getTypeAtPosition(signature, i); - if (filterType(type, isInJSFile(node) && !strictNullChecks ? acceptsVoidUndefinedUnknownOrAny : acceptsVoid).flags & 131072) { + if (filterType(type, isInJSFile(node) && !strictNullChecks ? acceptsVoidUndefinedUnknownOrAny : acceptsVoid).flags & 262144) { return false; } } @@ -71511,7 +71676,7 @@ ${lanes.join(` return getSingleSignature(type, 0, false) || getSingleSignature(type, 1, false); } function getSingleSignature(type, kind, allowMembers) { - if (type.flags & 524288) { + if (type.flags & 1048576) { const resolved = resolveStructuredTypeMembers(type); if (allowMembers || resolved.properties.length === 0 && resolved.indexInfos.length === 0) { if (kind === 0 && resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0) { @@ -71524,10 +71689,10 @@ ${lanes.join(` } return; } - function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes) { - const context = createInferenceContext(getTypeParametersForMapper(signature), signature, 0, compareTypes); + function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes2) { + const context = createInferenceContext(getTypeParametersForMapper(signature), signature, 0, compareTypes2); const restType = getEffectiveRestType(contextualSignature); - const mapper = inferenceContext && (restType && restType.flags & 262144 ? inferenceContext.nonFixingMapper : inferenceContext.mapper); + const mapper = inferenceContext && (restType && restType.flags & 524288 ? inferenceContext.nonFixingMapper : inferenceContext.mapper); const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature; applyToParameterTypes(sourceSignature, signature, (source, target) => { inferTypes(context.inferences, source, target); @@ -71580,7 +71745,7 @@ ${lanes.join(` } const restType = getNonArrayRestType(signature); const argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; - if (restType && restType.flags & 262144) { + if (restType && restType.flags & 524288) { const info = find(context.inferences, (info2) => info2.typeParameter === restType); if (info) { info.impliedArity = findIndex(args, isSpreadArgument, argCount) < 0 ? args.length - argCount : undefined; @@ -71608,7 +71773,7 @@ ${lanes.join(` return getInferredTypes(context); } function getMutableArrayOrTupleType(type) { - return type.flags & 1048576 ? mapType(type, getMutableArrayOrTupleType) : type.flags & 1 || isMutableArrayOrTuple(getBaseConstraintOfType(type) || type) ? type : isTupleType(type) ? createTupleType(getElementTypes(type), type.target.elementFlags, false, type.target.labeledElementDeclarations) : createTupleType([type], [8]); + return type.flags & 134217728 ? mapType(type, getMutableArrayOrTupleType) : type.flags & 1 || isMutableArrayOrTuple(getBaseConstraintOfType(type) || type) ? type : isTupleType(type) ? createTupleType(getElementTypes(type), type.target.elementFlags, false, type.target.labeledElementDeclarations) : createTupleType([type], [8]); } function getSpreadArgumentType(args, index, argCount, restType, context, checkMode) { const inConstContext = isConstTypeVariable(restType); @@ -71639,7 +71804,7 @@ ${lanes.join(` } else { const contextualType = isTupleType(restType) ? getContextualTypeForElementExpression(restType, i - index, argCount - index) || unknownType : getIndexedAccessType(restType, getNumberLiteralType(i - index), 256); const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode); - const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 402784252 | 4194304 | 134217728 | 268435456); + const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 12713980 | 2097152 | 4194304 | 8388608); types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1); } @@ -72452,7 +72617,7 @@ ${lanes.join(` return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature))); } function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) { - return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576) && !(getReducedType(apparentFuncType).flags & 131072) && isTypeAssignableTo(funcType, globalFunctionType); + return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 524288) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 134217728) && !(getReducedType(apparentFuncType).flags & 262144) && isTypeAssignableTo(funcType, globalFunctionType); } function resolveNewExpression(node, candidatesOutArray, checkMode) { let expressionType = checkNonNullExpression(node.expression); @@ -72505,7 +72670,7 @@ ${lanes.join(` if (isArray(signatures)) { return some(signatures, (signature) => someSignature(signature, f)); } - return signatures.compositeKind === 1048576 ? some(signatures.compositeSignatures, f) : f(signatures); + return signatures.compositeKind === 134217728 ? some(signatures.compositeSignatures, f) : f(signatures); } function typeHasProtectedAccessibleBase(target, type) { const baseTypes = getBaseTypes(type); @@ -72513,7 +72678,7 @@ ${lanes.join(` return false; } const firstBase = baseTypes[0]; - if (firstBase.flags & 2097152) { + if (firstBase.flags & 268435456) { const types = firstBase.types; const mixinFlags = findMixins(types); let i = 0; @@ -72571,7 +72736,7 @@ ${lanes.join(` const isCall = kind === 0; const awaitedType = getAwaitedType(apparentType); const maybeMissingAwait = awaitedType && getSignaturesOfType(awaitedType, kind).length > 0; - if (apparentType.flags & 1048576) { + if (apparentType.flags & 134217728) { const types = apparentType.types; let hasSignatures2 = false; for (const constituent of types) { @@ -72958,10 +73123,10 @@ ${lanes.join(` return resolveExternalModuleTypeByLiteral(node.arguments[0]); } const returnType = getReturnTypeOfSignature(signature); - if (returnType.flags & 12288 && isSymbolOrSymbolForCall(node)) { + if (returnType.flags & 16896 && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 214 && !node.questionDotToken && node.parent.kind === 245 && returnType.flags & 16384 && getTypePredicateOfSignature(signature)) { + if (node.kind === 214 && !node.questionDotToken && node.parent.kind === 245 && returnType.flags & 16 && getTypePredicateOfSignature(signature)) { if (!isDottedName(node.expression)) { error2(node.expression, Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); } else if (!getEffectsSignature(node)) { @@ -73038,13 +73203,21 @@ ${lanes.join(` for (let i = 2;i < node.arguments.length; ++i) { checkExpressionCached(node.arguments[i]); } - if (specifierType.flags & 32768 || specifierType.flags & 65536 || !isTypeAssignableTo(specifierType, stringType)) { + if (specifierType.flags & 4 || specifierType.flags & 8 || !isTypeAssignableTo(specifierType, stringType)) { error2(specifier, Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0, typeToString(specifierType)); } if (optionsType) { const importCallOptionsType = getGlobalImportCallOptionsType(true); if (importCallOptionsType !== emptyObjectType) { - checkTypeAssignableTo(optionsType, getNullableType(importCallOptionsType, 32768), node.arguments[1]); + checkTypeAssignableTo(optionsType, getNullableType(importCallOptionsType, 4), node.arguments[1]); + } + if (compilerOptions.ignoreDeprecations !== "6.0" && isObjectLiteralExpression(node.arguments[1])) { + for (const prop of node.arguments[1].properties) { + if (isPropertyAssignment(prop) && isIdentifier(prop.name) && prop.name.escapedText === "assert") { + grammarErrorOnNode(prop.name, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert); + break; + } + } } } const moduleSymbol = resolveExternalModuleName(node, specifier); @@ -73172,7 +73345,7 @@ ${lanes.join(` const exprType = checkExpression(expression, checkMode); if (isConstTypeReference(type)) { if (!isValidConstAssertionArgument(expression)) { - error2(expression, Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals); + error2(expression, Diagnostics.A_const_assertion_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals); } return getRegularTypeOfLiteralType(exprType); } @@ -73265,7 +73438,7 @@ ${lanes.join(` } return result2; function getInstantiatedTypePart(type2) { - if (type2.flags & 524288) { + if (type2.flags & 1048576) { const resolved = resolveStructuredTypeMembers(type2); const callSignatures = getInstantiatedSignatures(resolved.callSignatures); const constructSignatures = getInstantiatedSignatures(resolved.constructSignatures); @@ -73277,7 +73450,7 @@ ${lanes.join(` result3.node = node; return result3; } - } else if (type2.flags & 58982400) { + } else if (type2.flags & 117964800) { const constraint = getBaseConstraintOfType(type2); if (constraint) { const instantiated = getInstantiatedTypePart(constraint); @@ -73285,9 +73458,9 @@ ${lanes.join(` return instantiated; } } - } else if (type2.flags & 1048576) { + } else if (type2.flags & 134217728) { return mapType(type2, getInstantiatedType); - } else if (type2.flags & 2097152) { + } else if (type2.flags & 268435456) { return getIntersectionType(sameMap(type2.types, getInstantiatedTypePart)); } return type2; @@ -73561,7 +73734,7 @@ ${lanes.join(` } for (let i = minArgumentCount - 1;i >= 0; i--) { const type = getTypeAtPosition(signature, i); - if (filterType(type, acceptsVoid).flags & 131072) { + if (filterType(type, acceptsVoid).flags & 262144) { break; } minArgumentCount = i; @@ -73902,6 +74075,9 @@ ${lanes.join(` let fallbackReturnType = voidType; if (func.body.kind !== 242) { returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8); + if (isConstContext(func.body)) { + returnType = getRegularTypeOfLiteralType(returnType); + } if (isAsync) { returnType = unwrapAwaitedType(checkAwaitedType(returnType, false, func, Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member)); } @@ -73922,7 +74098,7 @@ ${lanes.join(` } if (types.length === 0) { const contextualReturnType = getContextualReturnType(func, undefined); - const returnType2 = contextualReturnType && (unwrapReturnType(contextualReturnType, functionFlags) || voidType).flags & 32768 ? undefinedType : voidType; + const returnType2 = contextualReturnType && someType(unwrapReturnType(contextualReturnType, functionFlags) || voidType, (t) => !!(t.flags & 4)) ? undefinedType : voidType; return functionFlags & 2 ? createPromiseReturnType(func, returnType2) : returnType2; } returnType = getUnionType(types, 2); @@ -73978,7 +74154,10 @@ ${lanes.join(` const nextTypes = []; const isAsync = (getFunctionFlags(func) & 2) !== 0; forEachYieldExpression(func.body, (yieldExpression) => { - const yieldExpressionType = yieldExpression.expression ? checkExpression(yieldExpression.expression, checkMode) : undefinedWideningType; + let yieldExpressionType = yieldExpression.expression ? checkExpression(yieldExpression.expression, checkMode && checkMode & ~8) : undefinedWideningType; + if (yieldExpression.expression && isConstContext(yieldExpression.expression)) { + yieldExpressionType = getRegularTypeOfLiteralType(yieldExpressionType); + } pushIfUnique(yieldTypes, getYieldedTypeOfYieldExpression(yieldExpression, yieldExpressionType, anyType, isAsync)); let nextType; if (yieldExpression.asteriskToken) { @@ -73993,9 +74172,6 @@ ${lanes.join(` return { yieldTypes, nextTypes }; } function getYieldedTypeOfYieldExpression(node, expressionType, sentType, isAsync) { - if (expressionType === silentNeverType) { - return silentNeverType; - } const errorNode = node.expression || node; const yieldedType = node.asteriskToken ? checkIteratedTypeOrElementType(isAsync ? 19 : 17, expressionType, sentType, errorNode) : expressionType; return !isAsync ? yieldedType : getAwaitedType(yieldedType, errorNode, node.asteriskToken ? Diagnostics.Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member : Diagnostics.Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member); @@ -74067,10 +74243,10 @@ ${lanes.join(` if (functionFlags & 2) { type = unwrapAwaitedType(checkAwaitedType(type, false, func, Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member)); } - if (type.flags & 131072) { + if (type.flags & 262144) { hasReturnOfTypeNever = true; } - pushIfUnique(aggregatedTypes, type); + pushIfUnique(aggregatedTypes, isConstContext(expr) ? getRegularTypeOfLiteralType(type) : type); } else { hasReturnWithNoExpression = true; } @@ -74121,11 +74297,11 @@ ${lanes.join(` function checkIfExpressionRefinesAnyParameter(func, expr) { expr = skipParentheses(expr, true); const returnType = checkExpressionCached(expr); - if (!(returnType.flags & 16)) + if (!(returnType.flags & 256)) return; return forEach(func.parameters, (param, i) => { const initType = getTypeOfSymbol(param.symbol); - if (!initType || initType.flags & 16 || !isIdentifier(param.name) || isSymbolAssigned(param.symbol) || isRestParameter(param)) { + if (!initType || initType.flags & 256 || !isIdentifier(param.name) || isSymbolAssigned(param.symbol) || isRestParameter(param)) { return; } const trueType2 = checkIfExpressionRefinesParameter(func, expr, param, initType); @@ -74142,7 +74318,7 @@ ${lanes.join(` return; const falseCondition = createFlowNode(64, expr, antecedent); const falseSubtype = getReducedType(getFlowTypeOfReference(param.name, initType, trueType2, func, falseCondition)); - return falseSubtype.flags & 131072 ? trueType2 : undefined; + return falseSubtype.flags & 262144 ? trueType2 : undefined; } function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) { addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics); @@ -74150,7 +74326,7 @@ ${lanes.join(` function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() { const functionFlags = getFunctionFlags(func); const type = returnType && unwrapReturnType(returnType, functionFlags); - if (type && (maybeTypeOfKind(type, 16384) || type.flags & (1 | 32768))) { + if (type && (maybeTypeOfKind(type, 16) || type.flags & (1 | 4))) { return; } if (func.kind === 174 || nodeIsMissing(func.body) || func.body.kind !== 242 || !functionHasImplicitReturn(func)) { @@ -74158,7 +74334,7 @@ ${lanes.join(` } const hasExplicitReturn = func.flags & 1024; const errorNode = getEffectiveReturnTypeNode(func) || func; - if (type && type.flags & 131072) { + if (type && type.flags & 262144) { error2(errorNode, Diagnostics.A_function_returning_never_cannot_have_a_reachable_end_point); } else if (type && !hasExplicitReturn) { error2(errorNode, Diagnostics.A_function_whose_declared_type_is_neither_undefined_void_nor_any_must_return_a_value); @@ -74225,7 +74401,7 @@ ${lanes.join(` if (checkMode && checkMode & 2) { inferFromAnnotatedParametersAndReturn(signature, contextualSignature, inferenceContext); const restType = getEffectiveRestType(contextualSignature); - if (restType && restType.flags & 262144) { + if (restType && restType.flags & 524288) { instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper); } } @@ -74378,7 +74554,7 @@ ${lanes.join(` } function checkDeleteExpressionMustBeOptional(expr, symbol) { const type = getTypeOfSymbol(symbol); - if (strictNullChecks && !(type.flags & (3 | 131072)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 : hasTypeFacts(type, 16777216))) { + if (strictNullChecks && !(type.flags & (3 | 262144)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 : hasTypeFacts(type, 16777216))) { error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional); } } @@ -74492,11 +74668,11 @@ ${lanes.join(` case 41: case 55: checkNonNullType(operandType, node.operand); - if (maybeTypeOfKindConsideringBaseConstraint(operandType, 12288)) { + if (maybeTypeOfKindConsideringBaseConstraint(operandType, 16896)) { error2(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator)); } if (node.operator === 40) { - if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112)) { + if (maybeTypeOfKindConsideringBaseConstraint(operandType, 4224)) { error2(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType))); } return numberType; @@ -74528,8 +74704,8 @@ ${lanes.join(` return getUnaryResultType(operandType); } function getUnaryResultType(operandType) { - if (maybeTypeOfKind(operandType, 2112)) { - return isTypeAssignableToKind(operandType, 3) || maybeTypeOfKind(operandType, 296) ? numberOrBigIntType : bigintType; + if (maybeTypeOfKind(operandType, 4224)) { + return isTypeAssignableToKind(operandType, 3) || maybeTypeOfKind(operandType, 67648) ? numberOrBigIntType : bigintType; } return numberType; } @@ -74544,7 +74720,7 @@ ${lanes.join(` if (type.flags & kind) { return true; } - if (type.flags & 3145728) { + if (type.flags & 402653184) { const types = type.types; for (const t of types) { if (maybeTypeOfKind(t, kind)) { @@ -74558,13 +74734,13 @@ ${lanes.join(` if (source.flags & kind) { return true; } - if (strict && source.flags & (3 | 16384 | 32768 | 65536)) { + if (strict && source.flags & (3 | 16 | 4 | 8)) { return false; } - return !!(kind & 296) && isTypeAssignableTo(source, numberType) || !!(kind & 2112) && isTypeAssignableTo(source, bigintType) || !!(kind & 402653316) && isTypeAssignableTo(source, stringType) || !!(kind & 528) && isTypeAssignableTo(source, booleanType) || !!(kind & 16384) && isTypeAssignableTo(source, voidType) || !!(kind & 131072) && isTypeAssignableTo(source, neverType) || !!(kind & 65536) && isTypeAssignableTo(source, nullType) || !!(kind & 32768) && isTypeAssignableTo(source, undefinedType) || !!(kind & 4096) && isTypeAssignableTo(source, esSymbolType) || !!(kind & 67108864) && isTypeAssignableTo(source, nonPrimitiveType); + return !!(kind & 67648) && isTypeAssignableTo(source, numberType) || !!(kind & 4224) && isTypeAssignableTo(source, bigintType) || !!(kind & 12583968) && isTypeAssignableTo(source, stringType) || !!(kind & 8448) && isTypeAssignableTo(source, booleanType) || !!(kind & 16) && isTypeAssignableTo(source, voidType) || !!(kind & 262144) && isTypeAssignableTo(source, neverType) || !!(kind & 8) && isTypeAssignableTo(source, nullType) || !!(kind & 4) && isTypeAssignableTo(source, undefinedType) || !!(kind & 512) && isTypeAssignableTo(source, esSymbolType) || !!(kind & 131072) && isTypeAssignableTo(source, nonPrimitiveType); } function allTypesAssignableToKind(source, kind, strict) { - return source.flags & 1048576 ? every(source.types, (subType) => allTypesAssignableToKind(subType, kind, strict)) : isTypeAssignableToKind(source, kind, strict); + return source.flags & 134217728 ? every(source.types, (subType) => allTypesAssignableToKind(subType, kind, strict)) : isTypeAssignableToKind(source, kind, strict); } function isConstEnumObjectType(type) { return !!(getObjectFlags(type) & 16) && !!type.symbol && isConstEnumSymbol(type.symbol); @@ -74574,7 +74750,7 @@ ${lanes.join(` } function getSymbolHasInstanceMethodOfObjectType(type) { const hasInstancePropertyName = getPropertyNameForKnownSymbolName("hasInstance"); - if (allTypesAssignableToKind(type, 67108864)) { + if (allTypesAssignableToKind(type, 131072)) { const hasInstanceProperty = getPropertyOfType(type, hasInstancePropertyName); if (hasInstanceProperty) { const hasInstancePropertyType = getTypeOfSymbol(hasInstanceProperty); @@ -74588,7 +74764,7 @@ ${lanes.join(` if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252)) { + if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 12713980)) { error2(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } Debug.assert(isInstanceOfExpression(left.parent)); @@ -74601,7 +74777,7 @@ ${lanes.join(` return booleanType; } function hasEmptyObjectIntersection(type) { - return someType(type, (t) => t === unknownEmptyObjectType || !!(t.flags & 2097152) && isEmptyAnonymousObjectType(getBaseConstraintOrType(t))); + return someType(type, (t) => t === unknownEmptyObjectType || !!(t.flags & 268435456) && isEmptyAnonymousObjectType(getBaseConstraintOrType(t))); } function checkInExpression(left, right, leftType, rightType) { if (leftType === silentNeverType || rightType === silentNeverType) { @@ -74812,7 +74988,7 @@ ${lanes.join(` } } function isTypeEqualityComparableTo(source, target) { - return (target.flags & 98304) !== 0 || isTypeComparableTo(source, target); + return (target.flags & 12) !== 0 || isTypeComparableTo(source, target); } function createCheckBinaryExpression() { const trampoline = createBinaryExpressionTrampoline(onEnter, onLeft, onOperator, onRight, onExit, foldState); @@ -74941,7 +75117,6 @@ ${lanes.join(` } } checkNullishCoalesceOperandLeft(node); - checkNullishCoalesceOperandRight(node); } function checkNullishCoalesceOperandLeft(node) { const leftTarget = skipOuterExpressions(node.left, 63); @@ -74954,21 +75129,6 @@ ${lanes.join(` } } } - function checkNullishCoalesceOperandRight(node) { - const rightTarget = skipOuterExpressions(node.right, 63); - const nullishSemantics = getSyntacticNullishnessSemantics(rightTarget); - if (isNotWithinNullishCoalesceExpression(node)) { - return; - } - if (nullishSemantics === 1) { - error2(rightTarget, Diagnostics.This_expression_is_always_nullish); - } else if (nullishSemantics === 2) { - error2(rightTarget, Diagnostics.This_expression_is_never_nullish); - } - } - function isNotWithinNullishCoalesceExpression(node) { - return !isBinaryExpression(node.parent) || node.parent.operatorToken.kind !== 61; - } function getSyntacticNullishnessSemantics(node) { node = skipOuterExpressions(node); switch (node.kind) { @@ -74984,15 +75144,15 @@ ${lanes.join(` return 3; case 227: switch (node.operatorToken.kind) { - case 64: - case 61: - case 78: case 57: case 76: case 56: case 77: return 3; case 28: + case 64: + case 61: + case 78: return getSyntacticNullishnessSemantics(node.right); } return 2; @@ -75053,14 +75213,14 @@ ${lanes.join(` leftType = checkNonNullType(leftType, left); rightType = checkNonNullType(rightType, right); let suggestedOperator; - if (leftType.flags & 528 && rightType.flags & 528 && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) { + if (leftType.flags & 8448 && rightType.flags & 8448 && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== undefined) { error2(errorNode || operatorToken, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(operatorToken.kind), tokenToString(suggestedOperator)); return numberType; } else { const leftOk = checkArithmeticOperandType(left, leftType, Diagnostics.The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type, true); const rightOk = checkArithmeticOperandType(right, rightType, Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type, true); let resultType2; - if (isTypeAssignableToKind(leftType, 3) && isTypeAssignableToKind(rightType, 3) || !(maybeTypeOfKind(leftType, 2112) || maybeTypeOfKind(rightType, 2112))) { + if (isTypeAssignableToKind(leftType, 3) && isTypeAssignableToKind(rightType, 3) || !(maybeTypeOfKind(leftType, 4224) || maybeTypeOfKind(rightType, 4224))) { resultType2 = numberType; } else if (bothAreBigIntLike(leftType, rightType)) { switch (operator) { @@ -75104,16 +75264,16 @@ ${lanes.join(` if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (!isTypeAssignableToKind(leftType, 402653316) && !isTypeAssignableToKind(rightType, 402653316)) { + if (!isTypeAssignableToKind(leftType, 12583968) && !isTypeAssignableToKind(rightType, 12583968)) { leftType = checkNonNullType(leftType, left); rightType = checkNonNullType(rightType, right); } let resultType; - if (isTypeAssignableToKind(leftType, 296, true) && isTypeAssignableToKind(rightType, 296, true)) { + if (isTypeAssignableToKind(leftType, 67648, true) && isTypeAssignableToKind(rightType, 67648, true)) { resultType = numberType; - } else if (isTypeAssignableToKind(leftType, 2112, true) && isTypeAssignableToKind(rightType, 2112, true)) { + } else if (isTypeAssignableToKind(leftType, 4224, true) && isTypeAssignableToKind(rightType, 4224, true)) { resultType = bigintType; - } else if (isTypeAssignableToKind(leftType, 402653316, true) || isTypeAssignableToKind(rightType, 402653316, true)) { + } else if (isTypeAssignableToKind(leftType, 12583968, true) || isTypeAssignableToKind(rightType, 12583968, true)) { resultType = stringType; } else if (isTypeAny(leftType) || isTypeAny(rightType)) { resultType = isErrorType(leftType) || isErrorType(rightType) ? errorType : anyType; @@ -75122,7 +75282,7 @@ ${lanes.join(` return resultType; } if (!resultType) { - const closeEnoughKind = 296 | 2112 | 402653316 | 3; + const closeEnoughKind = 67648 | 4224 | 12583968 | 3; reportOperatorError((left2, right2) => isTypeAssignableToKind(left2, closeEnoughKind) && isTypeAssignableToKind(right2, closeEnoughKind)); return anyType; } @@ -75192,7 +75352,7 @@ ${lanes.join(` const declKind = isBinaryExpression(left.parent) ? getAssignmentDeclarationKind(left.parent) : 0; checkAssignmentDeclaration(declKind, rightType); if (isAssignmentDeclaration2(declKind)) { - if (!(rightType.flags & 524288) || declKind !== 2 && declKind !== 6 && !isEmptyObjectType(rightType) && !isFunctionObjectType(rightType) && !(getObjectFlags(rightType) & 1)) { + if (!(rightType.flags & 1048576) || declKind !== 2 && declKind !== 6 && !isEmptyObjectType(rightType) && !isFunctionObjectType(rightType) && !(getObjectFlags(rightType) & 1)) { checkAssignmentOperator(rightType); } return leftType; @@ -75218,7 +75378,7 @@ ${lanes.join(` return Debug.fail(); } function bothAreBigIntLike(left2, right2) { - return isTypeAssignableToKind(left2, 2112) && isTypeAssignableToKind(right2, 2112); + return isTypeAssignableToKind(left2, 4224) && isTypeAssignableToKind(right2, 4224); } function checkAssignmentDeclaration(kind, rightType2) { if (kind === 2) { @@ -75239,7 +75399,7 @@ ${lanes.join(` return node.parent.kind === 218 && isNumericLiteral(node.left) && node.left.text === "0" && (isCallExpression(node.parent.parent) && node.parent.parent.expression === node.parent || node.parent.parent.kind === 216) && (isAccessExpression(node.right) || isIdentifier(node.right) && node.right.escapedText === "eval"); } function checkForDisallowedESSymbolOperand(operator2) { - const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288) ? right : undefined; + const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 16896) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 16896) ? right : undefined; if (offendingSymbolOperand) { error2(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator2)); return false; @@ -75272,7 +75432,7 @@ ${lanes.join(` } if (checkReferenceExpression(left, Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access, Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access)) { let headMessage; - if (exactOptionalPropertyTypes && isPropertyAccessExpression(left) && maybeTypeOfKind(valueType, 32768)) { + if (exactOptionalPropertyTypes && isPropertyAccessExpression(left) && maybeTypeOfKind(valueType, 4)) { const target = getTypeOfPropertyOfType(getTypeOfExpression(left.expression), left.name.escapedText); if (isExactOptionalPropertyMismatch(valueType, target)) { headMessage = Diagnostics.Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefined_to_the_type_of_the_target; @@ -75386,7 +75546,7 @@ ${lanes.join(` } } let returnType = getReturnTypeFromAnnotation(func); - if (returnType && returnType.flags & 1048576) { + if (returnType && returnType.flags & 134217728) { returnType = filterType(returnType, (t) => checkGeneratorInstantiationAssignabilityToReturnType(t, functionFlags, undefined)); } const iterationTypes = returnType && getIterationTypesOfGeneratorFunctionReturnType(returnType, isAsync); @@ -75441,7 +75601,7 @@ ${lanes.join(` const types = []; for (const span of node.templateSpans) { const type = checkExpression(span.expression); - if (maybeTypeOfKindConsideringBaseConstraint(type, 12288)) { + if (maybeTypeOfKindConsideringBaseConstraint(type, 16896)) { error2(span.expression, Diagnostics.Implicit_conversion_of_a_symbol_to_a_string_will_fail_at_runtime_Consider_wrapping_this_expression_in_String); } texts.push(span.literal.text); @@ -75457,7 +75617,7 @@ ${lanes.join(` return stringType; } function isTemplateLiteralContextualType(type) { - return !!(type.flags & (128 | 134217728) || type.flags & 58982400 && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316)); + return !!(type.flags & (1024 | 4194304) || type.flags & 117964800 && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 12583968)); } function getContextNode2(node) { if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) { @@ -75473,7 +75633,7 @@ ${lanes.join(` if (inferenceContext && inferenceContext.intraExpressionInferenceSites) { inferenceContext.intraExpressionInferenceSites = undefined; } - const result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node, undefined)) ? getRegularTypeOfLiteralType(type) : type; + const result = maybeTypeOfKind(type, 15360) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node, undefined)) ? getRegularTypeOfLiteralType(type) : type; popInferenceContext(); popContextualType(); return result; @@ -75584,15 +75744,15 @@ ${lanes.join(` } function isLiteralOfContextualType(candidateType, contextualType) { if (contextualType) { - if (contextualType.flags & 3145728) { + if (contextualType.flags & 402653184) { const types = contextualType.types; return some(types, (t) => isLiteralOfContextualType(candidateType, t)); } - if (contextualType.flags & 58982400) { + if (contextualType.flags & 117964800) { const constraint = getBaseConstraintOfType(contextualType) || unknownType; - return maybeTypeOfKind(constraint, 4) && maybeTypeOfKind(candidateType, 128) || maybeTypeOfKind(constraint, 8) && maybeTypeOfKind(candidateType, 256) || maybeTypeOfKind(constraint, 64) && maybeTypeOfKind(candidateType, 2048) || maybeTypeOfKind(constraint, 4096) && maybeTypeOfKind(candidateType, 8192) || isLiteralOfContextualType(candidateType, constraint); + return maybeTypeOfKind(constraint, 32) && maybeTypeOfKind(candidateType, 1024) || maybeTypeOfKind(constraint, 64) && maybeTypeOfKind(candidateType, 2048) || maybeTypeOfKind(constraint, 128) && maybeTypeOfKind(candidateType, 4096) || maybeTypeOfKind(constraint, 512) && maybeTypeOfKind(candidateType, 16384) || isLiteralOfContextualType(candidateType, constraint); } - return !!(contextualType.flags & (128 | 4194304 | 134217728 | 268435456) && maybeTypeOfKind(candidateType, 128) || contextualType.flags & 256 && maybeTypeOfKind(candidateType, 256) || contextualType.flags & 2048 && maybeTypeOfKind(candidateType, 2048) || contextualType.flags & 512 && maybeTypeOfKind(candidateType, 512) || contextualType.flags & 8192 && maybeTypeOfKind(candidateType, 8192)); + return !!(contextualType.flags & (1024 | 2097152 | 4194304 | 8388608) && maybeTypeOfKind(candidateType, 1024) || contextualType.flags & 2048 && maybeTypeOfKind(candidateType, 2048) || contextualType.flags & 4096 && maybeTypeOfKind(candidateType, 4096) || contextualType.flags & 8192 && maybeTypeOfKind(candidateType, 8192) || contextualType.flags & 16384 && maybeTypeOfKind(candidateType, 16384)); } return false; } @@ -76523,6 +76683,38 @@ ${lanes.join(` } return; } + function getUninstantiatedSignatures(node) { + switch (node.kind) { + case 214: + case 171: + return getSignaturesOfType(getTypeOfExpression(node.expression), 0); + case 215: + return getSignaturesOfType(getTypeOfExpression(node.expression), 1); + case 286: + case 287: + if (isJsxIntrinsicTagName(node.tagName)) + return []; + return getSignaturesOfType(getTypeOfExpression(node.tagName), 0); + case 216: + return getSignaturesOfType(getTypeOfExpression(node.tag), 0); + case 227: + case 290: + return []; + } + } + function getTypeParameterConstraintForPositionAcrossSignatures(signatures, position) { + const relevantTypeParameterConstraints = flatMap(signatures, (signature) => { + var _a; + const relevantTypeParameter = (_a = signature.typeParameters) == null ? undefined : _a[position]; + if (relevantTypeParameter === undefined) + return []; + const relevantConstraint = getConstraintOfTypeParameter(relevantTypeParameter); + if (relevantConstraint === undefined) + return []; + return [relevantConstraint]; + }); + return getUnionType(relevantTypeParameterConstraints); + } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); if (node.kind === 184 && !isInJSFile(node) && !isInJSDoc(node) && node.typeArguments && node.typeName.end !== node.typeArguments.pos) { @@ -76554,14 +76746,36 @@ ${lanes.join(` } } function getTypeArgumentConstraint(node) { - const typeReferenceNode = tryCast(node.parent, isTypeReferenceType); - if (!typeReferenceNode) - return; - const typeParameters = getTypeParametersForTypeReferenceOrImport(typeReferenceNode); - if (!typeParameters) - return; - const constraint = getConstraintOfTypeParameter(typeParameters[typeReferenceNode.typeArguments.indexOf(node)]); - return constraint && instantiateType(constraint, createTypeMapper(typeParameters, getEffectiveTypeArguments2(typeReferenceNode, typeParameters))); + let typeArgumentPosition; + if (hasTypeArguments(node.parent) && Array.isArray(node.parent.typeArguments)) { + typeArgumentPosition = node.parent.typeArguments.indexOf(node); + } + if (typeArgumentPosition !== undefined) { + if (isCallLikeExpression(node.parent)) { + return getTypeParameterConstraintForPositionAcrossSignatures(getUninstantiatedSignatures(node.parent), typeArgumentPosition); + } + if (isDecorator(node.parent.parent)) { + return getTypeParameterConstraintForPositionAcrossSignatures(getUninstantiatedSignatures(node.parent.parent), typeArgumentPosition); + } + if (isExpressionWithTypeArguments(node.parent) && isExpressionStatement(node.parent.parent)) { + const uninstantiatedType = checkExpression(node.parent.expression); + const callConstraint = getTypeParameterConstraintForPositionAcrossSignatures(getSignaturesOfType(uninstantiatedType, 0), typeArgumentPosition); + const constructConstraint = getTypeParameterConstraintForPositionAcrossSignatures(getSignaturesOfType(uninstantiatedType, 1), typeArgumentPosition); + if (constructConstraint.flags & 262144) + return callConstraint; + if (callConstraint.flags & 262144) + return constructConstraint; + return getIntersectionType([callConstraint, constructConstraint]); + } + if (isTypeReferenceType(node.parent)) { + const typeParameters = getTypeParametersForTypeReferenceOrImport(node.parent); + if (!typeParameters) + return; + const relevantTypeParameter = typeParameters[typeArgumentPosition]; + const constraint = getConstraintOfTypeParameter(relevantTypeParameter); + return constraint && instantiateType(constraint, createTypeMapper(typeParameters, getEffectiveTypeArguments2(node.parent, typeParameters))); + } + } } function checkTypeQuery(node) { getTypeFromTypeQueryNode(node); @@ -76619,14 +76833,13 @@ ${lanes.join(` getTypeFromTypeNode(node); } function checkIndexedAccessIndexType(type, accessNode) { - if (!(type.flags & 8388608)) { + if (!(type.flags & 33554432)) { return type; } const objectType = type.objectType; const indexType = type.indexType; - const objectIndexType = isGenericMappedType(objectType) && getMappedTypeNameTypeKind(objectType) === 2 ? getIndexTypeForMappedType(objectType, 0) : getIndexType(objectType, 0); const hasNumberIndexInfo = !!getIndexInfoOfType(objectType, numberType); - if (everyType(indexType, (t) => isTypeAssignableTo(t, objectIndexType) || hasNumberIndexInfo && isApplicableIndexType(t, numberType))) { + if (everyType(indexType, (t) => isTypeAssignableTo(t, getIndexType(objectType, 0)) || hasNumberIndexInfo && isApplicableIndexType(t, numberType))) { if (accessNode.kind === 213 && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 && getMappedTypeModifiers(objectType) & 1) { error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -76716,6 +76929,9 @@ ${lanes.join(` function checkImportType(node) { checkSourceElement(node.argument); if (node.attributes) { + if (node.attributes.token !== 118 && compilerOptions.ignoreDeprecations !== "6.0") { + grammarErrorOnFirstToken(node.attributes, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert); + } getResolutionModeOverride(node.attributes, grammarErrorOnNode); } checkTypeReferenceOrImport(node); @@ -77036,7 +77252,7 @@ ${lanes.join(` if (isReferenceToType2(type, getGlobalPromiseType(false))) { return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0]; } - if (allTypesAssignableToKind(getBaseConstraintOrType(type), 402784252 | 131072)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 12713980 | 262144)) { return; } const thenFunction = getTypeOfPropertyOfType(type, "then"); @@ -77088,7 +77304,7 @@ ${lanes.join(` return awaitedType || errorType; } function isThenableType(type) { - if (allTypesAssignableToKind(getBaseConstraintOrType(type), 402784252 | 131072)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 12713980 | 262144)) { return false; } const thenFunction = getTypeOfPropertyOfType(type, "then"); @@ -77096,14 +77312,14 @@ ${lanes.join(` } function isAwaitedTypeInstantiation(type) { var _a; - if (type.flags & 16777216) { + if (type.flags & 67108864) { const awaitedSymbol = getGlobalAwaitedSymbol(false); return !!awaitedSymbol && type.aliasSymbol === awaitedSymbol && ((_a = type.aliasTypeArguments) == null ? undefined : _a.length) === 1; } return false; } function unwrapAwaitedType(type) { - return type.flags & 1048576 ? mapType(type, unwrapAwaitedType) : isAwaitedTypeInstantiation(type) ? type.aliasTypeArguments[0] : type; + return type.flags & 134217728 ? mapType(type, unwrapAwaitedType) : isAwaitedTypeInstantiation(type) ? type.aliasTypeArguments[0] : type; } function isAwaitedTypeNeeded(type) { if (isTypeAny(type) || isAwaitedTypeInstantiation(type)) { @@ -77111,7 +77327,7 @@ ${lanes.join(` } if (isGenericObjectType(type)) { const baseConstraint = getBaseConstraintOfType(type); - if (baseConstraint ? baseConstraint.flags & 3 || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) : maybeTypeOfKind(type, 8650752)) { + if (baseConstraint ? baseConstraint.flags & 3 || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) : maybeTypeOfKind(type, 34078720)) { return true; } } @@ -77146,7 +77362,7 @@ ${lanes.join(` if (typeAsAwaitable.awaitedTypeOfType) { return typeAsAwaitable.awaitedTypeOfType; } - if (type.flags & 1048576) { + if (type.flags & 134217728) { if (awaitedTypeStack.lastIndexOf(type.id) >= 0) { if (errorNode) { error2(errorNode, Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method); @@ -78241,7 +78457,7 @@ ${lanes.join(` return; } const type = location === condExpr2 ? condType : checkExpression(location); - if (type.flags & 1024 && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384) { + if (type.flags & 32768 && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384) { error2(location, Diagnostics.This_condition_will_always_return_0, type.value ? "true" : "false"); return; } @@ -78328,7 +78544,7 @@ ${lanes.join(` checkSourceElement(node.statement); } function checkTruthinessOfType(type, node) { - if (type.flags & 16384) { + if (type.flags & 16) { error2(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness); } else { const semantics = getSyntacticTruthySemantics(node); @@ -78452,7 +78668,7 @@ ${lanes.join(` checkReferenceExpression(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access, Diagnostics.The_left_hand_side_of_a_for_in_statement_may_not_be_an_optional_property_access); } } - if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 | 58982400)) { + if (rightType === neverType || !isTypeAssignableToKind(rightType, 131072 | 117964800)) { error2(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType)); } checkSourceElement(node.statement); @@ -78478,7 +78694,8 @@ ${lanes.join(` } return; } - const uplevelIteration = languageVersion >= 2; + const iterableExists = getGlobalIterableType(false) !== emptyGenericType; + const uplevelIteration = languageVersion >= 2 && iterableExists; const downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; const possibleOutOfBounds = compilerOptions.noUncheckedIndexedAccess && !!(use & 128); if (uplevelIteration || downlevelIteration || allowAsyncIterables) { @@ -78498,18 +78715,18 @@ ${lanes.join(` let arrayType = inputType; let hasStringConstituent = false; if (use & 4) { - if (arrayType.flags & 1048576) { + if (arrayType.flags & 134217728) { const arrayTypes = inputType.types; - const filteredTypes = filter(arrayTypes, (t) => !(t.flags & 402653316)); + const filteredTypes = filter(arrayTypes, (t) => !(t.flags & 12583968)); if (filteredTypes !== arrayTypes) { arrayType = getUnionType(filteredTypes, 2); } - } else if (arrayType.flags & 402653316) { + } else if (arrayType.flags & 12583968) { arrayType = neverType; } hasStringConstituent = arrayType !== inputType; if (hasStringConstituent) { - if (arrayType.flags & 131072) { + if (arrayType.flags & 262144) { return possibleOutOfBounds ? includeUndefinedInIndexSignature(stringType) : stringType; } } @@ -78524,7 +78741,7 @@ ${lanes.join(` } const arrayElementType = getIndexTypeOfType(arrayType, numberType); if (hasStringConstituent && arrayElementType) { - if (arrayElementType.flags & 402653316 && !compilerOptions.noUncheckedIndexedAccess) { + if (arrayElementType.flags & 12583968 && !compilerOptions.noUncheckedIndexedAccess) { return stringType; } return getUnionType(possibleOutOfBounds ? [arrayElementType, stringType, undefinedType] : [arrayElementType, stringType], 2); @@ -78569,7 +78786,7 @@ ${lanes.join(` return iterationTypes && iterationTypes[getIterationTypesKeyFromIterationTypeKind(typeKind)]; } function createIterationTypes(yieldType = neverType, returnType = neverType, nextType = unknownType) { - if (yieldType.flags & 67359327 && returnType.flags & (1 | 131072 | 2 | 16384 | 32768) && nextType.flags & (1 | 131072 | 2 | 16384 | 32768)) { + if (yieldType.flags & 402431 && returnType.flags & (1 | 262144 | 2 | 16 | 4) && nextType.flags & (1 | 262144 | 2 | 16 | 4)) { const id = getTypeListId([yieldType, returnType, nextType]); let iterationTypes = iterationTypesCache.get(id); if (!iterationTypes) { @@ -78608,13 +78825,11 @@ ${lanes.join(` } function getIterationTypesOfIterable(type, use, errorNode) { var _a, _b; - if (type === silentNeverType) { - return silentNeverIterationTypes; - } + type = getReducedType(type); if (isTypeAny(type)) { return anyIterationTypes; } - if (!(type.flags & 1048576)) { + if (!(type.flags & 134217728)) { const errorOutputContainer = errorNode ? { errors: undefined, skipLogging: true } : undefined; const iterationTypes2 = getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer); if (iterationTypes2 === noIterationTypes) { @@ -78677,7 +78892,7 @@ ${lanes.join(` } let noCache = false; if (use & 2) { - const iterationTypes = getIterationTypesOfIterableCached(type, asyncIterationTypesResolver) || getIterationTypesOfIterableFast(type, asyncIterationTypesResolver); + let iterationTypes = getIterationTypesOfIterableCached(type, asyncIterationTypesResolver) || getIterationTypesOfIterableFast(type, asyncIterationTypesResolver); if (iterationTypes) { if (iterationTypes === noIterationTypes && errorNode) { noCache = true; @@ -78685,6 +78900,10 @@ ${lanes.join(` return use & 8 ? getAsyncFromSyncIterationTypes(iterationTypes, errorNode) : iterationTypes; } } + iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode, errorOutputContainer, noCache); + if (iterationTypes !== noIterationTypes) { + return iterationTypes; + } } if (use & 1) { let iterationTypes = getIterationTypesOfIterableCached(type, syncIterationTypesResolver) || getIterationTypesOfIterableFast(type, syncIterationTypesResolver); @@ -78702,15 +78921,7 @@ ${lanes.join(` } } } - } - if (use & 2) { - const iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode, errorOutputContainer, noCache); - if (iterationTypes !== noIterationTypes) { - return iterationTypes; - } - } - if (use & 1) { - let iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode, errorOutputContainer, noCache); + iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode, errorOutputContainer, noCache); if (iterationTypes !== noIterationTypes) { if (use & 2) { iterationTypes = getAsyncFromSyncIterationTypes(iterationTypes, errorNode); @@ -78945,7 +79156,7 @@ ${lanes.join(` } function isUnwrappedReturnTypeUndefinedVoidOrAny(func, returnType) { const type = unwrapReturnType(returnType, getFunctionFlags(func)); - return !!(type && (maybeTypeOfKind(type, 16384) || type.flags & (1 | 32768))); + return !!(type && (maybeTypeOfKind(type, 16) || type.flags & (1 | 4))); } function checkReturnStatement(node) { if (checkGrammarStatementInAmbientContext(node)) { @@ -78962,7 +79173,7 @@ ${lanes.join(` } const signature = getSignatureFromDeclaration(container); const returnType = getReturnTypeOfSignature(signature); - if (strictNullChecks || node.expression || returnType.flags & 131072) { + if (strictNullChecks || node.expression || returnType.flags & 262144) { const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; if (container.kind === 179) { if (node.expression) { @@ -79059,6 +79270,9 @@ ${lanes.join(` return false; }); } + if (node.label.flags & 1073741824 && compilerOptions.allowUnusedLabels !== true) { + errorOrSuggestion(compilerOptions.allowUnusedLabels === false, node.label, Diagnostics.Unused_label); + } checkSourceElement(node.statement); } function checkThrowStatement(node) { @@ -79112,7 +79326,7 @@ ${lanes.join(` } for (const prop of getPropertiesOfObjectType(type)) { if (!(isStaticIndex && prop.flags & 4194304)) { - checkIndexConstraintForProperty(type, prop, getLiteralTypeFromProperty(prop, 8576, true), getNonMissingTypeOfSymbol(prop)); + checkIndexConstraintForProperty(type, prop, getLiteralTypeFromProperty(prop, 19456, true), getNonMissingTypeOfSymbol(prop)); } } const typeDeclaration = symbol.valueDeclaration; @@ -79184,7 +79398,7 @@ ${lanes.join(` } } function checkClassNameCollisionWithObject(name) { - if (languageVersion >= 1 && name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5) { + if (name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5) { error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0, ModuleKind[moduleKind]); } } @@ -79257,7 +79471,7 @@ ${lanes.join(` function visit(node) { if (node.kind === 184) { const type = getTypeFromTypeReference(node); - if (type.flags & 262144) { + if (type.flags & 524288) { for (let i = index;i < typeParameters.length; i++) { if (type.symbol === getSymbolOfDeclaration(typeParameters[i])) { error2(node, Diagnostics.Type_parameter_defaults_can_only_reference_previously_declared_type_parameters); @@ -79429,7 +79643,7 @@ ${lanes.join(` } else { checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); } - if (baseConstructorType.flags & 8650752) { + if (baseConstructorType.flags & 34078720) { if (!isMixinConstructorType(staticType)) { error2(node.name || node, Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); } else { @@ -79439,7 +79653,7 @@ ${lanes.join(` } } } - if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32) && !(baseConstructorType.flags & 8650752)) { + if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32) && !(baseConstructorType.flags & 34078720)) { const constructors = getInstantiatedConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); if (forEach(constructors, (sig) => !isJSConstructor(sig.declaration) && !isTypeIdenticalTo(getReturnTypeOfSignature(sig), baseType))) { error2(baseTypeNode.expression, Diagnostics.Base_constructors_must_all_have_the_same_return_type); @@ -80090,10 +80304,7 @@ ${lanes.join(` if (isIdentifier(node.name)) { checkCollisionsForDeclarationName(node, node.name); if (!(node.flags & (32 | 2048))) { - const sourceFile = getSourceFileOfNode(node); - const pos = getNonModifierTokenPosOfNode(node); - const span = getSpanOfTokenAtPosition(sourceFile, pos); - suggestionDiagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, Diagnostics.A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_keyword_instead)); + error2(node.name, Diagnostics.A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_keyword_instead); } } checkExportsOnMergedDeclarations(node); @@ -80382,7 +80593,7 @@ ${lanes.join(` if (node) { const importAttributesType = getGlobalImportAttributesType(true); if (importAttributesType !== emptyObjectType) { - checkTypeAssignableTo(getTypeFromImportAttributes(node), getNullableType(importAttributesType, 32768), node); + checkTypeAssignableTo(getTypeFromImportAttributes(node), getNullableType(importAttributesType, 4), node); } const validForTypeAttributes = isExclusivelyTypeOnlyImportOrExport(declaration); const override = getResolutionModeOverride(node, validForTypeAttributes ? grammarErrorOnNode : undefined); @@ -80396,6 +80607,9 @@ ${lanes.join(` if (102 <= moduleKind && moduleKind <= 199 && !isImportAttributes2) { return grammarErrorOnFirstToken(node, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert); } + if (!isImportAttributes2 && compilerOptions.ignoreDeprecations !== "6.0") { + grammarErrorOnFirstToken(node, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert); + } if (declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier) === 1) { return grammarErrorOnNode(node, isImportAttributes2 ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls); } @@ -80442,7 +80656,7 @@ ${lanes.join(` error2(node.moduleSpecifier, Diagnostics.Importing_a_JSON_file_into_an_ECMAScript_module_requires_a_type_Colon_json_import_attribute_when_module_is_set_to_0, ModuleKind[moduleKind]); } } else if (noUncheckedSideEffectImports && !importClause) { - resolveExternalModuleName(node, node.moduleSpecifier); + resolveExternalModuleName(node, node.moduleSpecifier, undefined, Diagnostics.Cannot_find_module_or_type_declarations_for_side_effect_import_of_0); } } checkImportAttributes(node); @@ -80682,10 +80896,12 @@ ${lanes.join(` function checkSourceElement(node) { if (node) { const saveCurrentNode = currentNode; + const saveWithinUnreachableCode = withinUnreachableCode; currentNode = node; instantiationCount = 0; checkSourceElementWorker(node); currentNode = saveCurrentNode; + withinUnreachableCode = saveWithinUnreachableCode; } } function checkSourceElementWorker(node) { @@ -80713,8 +80929,10 @@ ${lanes.join(` cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 244 && kind <= 260 && canHaveFlowNode(node) && node.flowNode && !isReachableFlowNode(node.flowNode)) { - errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, Diagnostics.Unreachable_code_detected); + if (compilerOptions.allowUnreachableCode !== true && !withinUnreachableCode) { + if (checkSourceElementUnreachable(node)) { + withinUnreachableCode = true; + } } switch (kind) { case 169: @@ -80891,6 +81109,66 @@ ${lanes.join(` return checkMissingDeclaration(node); } } + function checkSourceElementUnreachable(node) { + if (!isPotentiallyExecutableNode(node)) { + return false; + } + if (reportedUnreachableNodes == null ? undefined : reportedUnreachableNodes.has(node)) { + return true; + } + if (!isSourceElementUnreachable(node)) { + return false; + } + (reportedUnreachableNodes ?? (reportedUnreachableNodes = /* @__PURE__ */ new Set)).add(node); + const sourceFile = getSourceFileOfNode(node); + let startNode2 = node; + let endNode2 = node; + const parent2 = node.parent; + if (canHaveStatements(parent2)) { + const statements = parent2.statements; + const offset = statements.indexOf(node); + if (offset >= 0) { + let first2 = offset; + for (let i = offset - 1;i >= 0; i--) { + const prevNode = statements[i]; + if (!isPotentiallyExecutableNode(prevNode) || reportedUnreachableNodes.has(prevNode) || !isSourceElementUnreachable(prevNode)) { + break; + } + first2 = i; + reportedUnreachableNodes.add(prevNode); + } + let last2 = offset; + for (let i = offset + 1;i < statements.length; i++) { + const nextNode = statements[i]; + if (!isPotentiallyExecutableNode(nextNode) || !isSourceElementUnreachable(nextNode)) { + break; + } + last2 = i; + reportedUnreachableNodes.add(nextNode); + } + startNode2 = statements[first2]; + endNode2 = statements[last2]; + } + } + const start = getTokenPosOfNode(startNode2, sourceFile); + addErrorOrSuggestion(compilerOptions.allowUnreachableCode === false, createFileDiagnostic(sourceFile, start, endNode2.end - start, Diagnostics.Unreachable_code_detected)); + return true; + } + function isSourceElementUnreachable(node) { + if (node.flags & 1073741824) { + switch (node.kind) { + case 267: + return !isEnumConst(node) || shouldPreserveConstEnums(compilerOptions); + case 268: + return isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions)); + default: + return true; + } + } else if (canHaveFlowNode(node) && node.flowNode) { + return !isReachableFlowNode(node.flowNode); + } + return false; + } function checkJSDocCommentWorker(node) { if (isArray(node)) { forEach(node, (tag) => { @@ -81040,6 +81318,7 @@ ${lanes.join(` mark(afterMark); measure("Check", beforeMark, afterMark); (_b = tracing) == null || _b.pop(); + reportedUnreachableNodes = undefined; } function unusedIsError(kind, isAmbient) { if (isAmbient) { @@ -81625,7 +81904,7 @@ ${lanes.join(` if (isIdentifier(node) && isPropertyAccessExpression(node.parent) && node.parent.name === node) { const keyType = getLiteralTypeFromPropertyName(node); const objectType = getTypeOfExpression(node.parent.expression); - const objectTypes = objectType.flags & 1048576 ? objectType.types : [objectType]; + const objectTypes = objectType.flags & 134217728 ? objectType.types : [objectType]; return flatMap(objectTypes, (t) => filter(getIndexInfosOfType(t), (info) => isApplicableIndexType(keyType, info.keyType))); } return; @@ -81749,7 +82028,7 @@ ${lanes.join(` return getStringLiteralType(name.text); case 168: const nameType = checkComputedPropertyName(name); - return isTypeAssignableToKind(nameType, 12288) ? nameType : stringType; + return isTypeAssignableToKind(nameType, 16896) ? nameType : stringType; default: return Debug.fail("Unsupported property name."); } @@ -81765,7 +82044,7 @@ ${lanes.join(` } }); } - return getNamedMembers(propsByName); + return getNamedMembers(propsByName, undefined); } function typeHasCallOrConstructSignatures(type) { return getSignaturesOfType(type, 0).length !== 0 || getSignaturesOfType(type, 1).length !== 0; @@ -82163,7 +82442,7 @@ ${lanes.join(` return; } function isFunctionType(type) { - return !!(type.flags & 524288) && getSignaturesOfType(type, 0).length > 0; + return !!(type.flags & 1048576) && getSignaturesOfType(type, 0).length > 0; } function getTypeReferenceSerializationKind(typeNameIn, location) { var _a; @@ -82206,19 +82485,19 @@ ${lanes.join(` return isTypeOnly ? 11 : 0; } else if (type.flags & 3) { return 11; - } else if (isTypeAssignableToKind(type, 16384 | 98304 | 131072)) { + } else if (isTypeAssignableToKind(type, 16 | 12 | 262144)) { return 2; - } else if (isTypeAssignableToKind(type, 528)) { + } else if (isTypeAssignableToKind(type, 8448)) { return 6; - } else if (isTypeAssignableToKind(type, 296)) { + } else if (isTypeAssignableToKind(type, 67648)) { return 3; - } else if (isTypeAssignableToKind(type, 2112)) { + } else if (isTypeAssignableToKind(type, 4224)) { return 4; - } else if (isTypeAssignableToKind(type, 402653316)) { + } else if (isTypeAssignableToKind(type, 12583968)) { return 5; } else if (isTupleType(type)) { return 7; - } else if (isTypeAssignableToKind(type, 12288)) { + } else if (isTypeAssignableToKind(type, 16896)) { return 8; } else if (isFunctionType(type)) { return 10; @@ -82343,7 +82622,7 @@ ${lanes.join(` return false; } function literalTypeToNode(type, enclosing, tracker) { - const enumResult = type.flags & 1056 ? nodeBuilder.symbolToExpression(type.symbol, 111551, enclosing, undefined, undefined, tracker) : type === trueType ? factory.createTrue() : type === falseType && factory.createFalse(); + const enumResult = type.flags & 98304 ? nodeBuilder.symbolToExpression(type.symbol, 111551, enclosing, undefined, undefined, tracker) : type === trueType ? factory.createTrue() : type === falseType && factory.createFalse(); if (enumResult) return enumResult; const literalValue = type.value; @@ -83255,7 +83534,7 @@ ${lanes.join(` return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } const type = getTypeFromTypeNode(parameter.type); - if (someType(type, (t) => !!(t.flags & 8576)) || isGenericType(type)) { + if (someType(type, (t) => !!(t.flags & 19456)) || isGenericType(type)) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead); } if (!everyType(type, isValidIndexKeyType)) { @@ -83764,7 +84043,7 @@ ${lanes.join(` } function isSimpleLiteralEnumReference(expr) { if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) { - return !!(checkExpressionCached(expr).flags & 1056); + return !!(checkExpressionCached(expr).flags & 98304); } } function checkAmbientInitializer(node) { @@ -83860,6 +84139,8 @@ ${lanes.join(` if (blockScopeFlags === 4 || blockScopeFlags === 6) { if (isForInStatement(declarationList.parent)) { return grammarErrorOnNode(declarationList, blockScopeFlags === 4 ? Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_using_declaration : Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_an_await_using_declaration); + } else if (isVariableStatement(declarationList.parent) && isCaseOrDefaultClause(declarationList.parent.parent)) { + return grammarErrorOnNode(declarationList, blockScopeFlags === 4 ? Diagnostics.using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block : Diagnostics.await_using_declarations_are_not_allowed_in_case_or_default_clauses_unless_contained_within_a_block); } if (declarationList.flags & 33554432) { return grammarErrorOnNode(declarationList, blockScopeFlags === 4 ? Diagnostics.using_declarations_are_not_allowed_in_ambient_contexts : Diagnostics.await_using_declarations_are_not_allowed_in_ambient_contexts); @@ -84153,9 +84434,9 @@ ${lanes.join(` } function findMatchingTypeReferenceOrTypeAliasReference(source, unionTarget) { const sourceObjectFlags = getObjectFlags(source); - if (sourceObjectFlags & (4 | 16) && unionTarget.flags & 1048576) { + if (sourceObjectFlags & (4 | 16) && unionTarget.flags & 134217728) { return find(unionTarget.types, (target) => { - if (target.flags & 524288) { + if (target.flags & 1048576) { const overlapObjFlags = sourceObjectFlags & getObjectFlags(target); if (overlapObjFlags & 4) { return source.target === target.target; @@ -84182,15 +84463,15 @@ ${lanes.join(` } function findMostOverlappyType(source, unionTarget) { let bestMatch; - if (!(source.flags & (402784252 | 406847488))) { + if (!(source.flags & (12713980 | 14680064))) { let matchingCount = 0; for (const target of unionTarget.types) { - if (!(target.flags & (402784252 | 406847488))) { + if (!(target.flags & (12713980 | 14680064))) { const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]); - if (overlap.flags & 4194304) { + if (overlap.flags & 2097152) { return target; - } else if (isUnitType(overlap) || overlap.flags & 1048576) { - const len = overlap.flags & 1048576 ? countWhere(overlap.types, isUnitType) : 1; + } else if (isUnitType(overlap) || overlap.flags & 134217728) { + const len = overlap.flags & 134217728 ? countWhere(overlap.types, isUnitType) : 1; if (len >= matchingCount) { bestMatch = target; matchingCount = len; @@ -84202,16 +84483,16 @@ ${lanes.join(` return bestMatch; } function filterPrimitivesIfContainsNonPrimitive(type) { - if (maybeTypeOfKind(type, 67108864)) { - const result = filterType(type, (t) => !(t.flags & 402784252)); - if (!(result.flags & 131072)) { + if (maybeTypeOfKind(type, 131072)) { + const result = filterType(type, (t) => !(t.flags & 12713980)); + if (!(result.flags & 262144)) { return result; } } return type; } function findMatchingDiscriminantType(source, target, isRelatedTo) { - if (target.flags & 1048576 && source.flags & (2097152 | 524288)) { + if (target.flags & 134217728 && source.flags & (268435456 | 1048576)) { const match = getMatchingUnionConstituentForType(target, source); if (match) { return match; @@ -84267,6 +84548,345 @@ ${lanes.join(` Debug.assert(specifier && nodeIsSynthesized(specifier) && specifier.text === "tslib", `Expected sourceFile.imports[0] to be the synthesized tslib import`); return specifier; } + function sortSymbolsIfTSGoCompat(array) { + if (stableTypeOrdering && array) { + return array.sort(compareSymbols); + } + return array; + } + function compareSymbols(s1, s2) { + if (s1 === s2) + return 0; + if (s1 === undefined) + return 1; + if (s2 === undefined) + return -1; + if (length(s1.declarations) !== 0 && length(s2.declarations) !== 0) { + const r2 = compareNodes(s1.declarations[0], s2.declarations[0]); + if (r2 !== 0) + return r2; + } else if (length(s1.declarations) !== 0) { + return -1; + } else if (length(s2.declarations) !== 0) { + return 1; + } + const r = compareComparableValues(s1.escapedName, s2.escapedName); + if (r !== 0) + return r; + return getSymbolId(s1) - getSymbolId(s2); + } + function compareNodes(n1, n2) { + if (n1 === n2) + return 0; + if (n1 === undefined) + return 1; + if (n2 === undefined) + return -1; + const s1 = getSourceFileOfNode(n1); + const s2 = getSourceFileOfNode(n2); + if (s1 !== s2) { + const f1 = fileIndexMap.get(s1); + const f2 = fileIndexMap.get(s2); + return f1 - f2; + } + return n1.pos - n2.pos; + } + function compareTypes(t1, t2) { + if (t1 === t2) + return 0; + if (t1 === undefined) + return -1; + if (t2 === undefined) + return 1; + let c = getSortOrderFlags(t1) - getSortOrderFlags(t2); + if (c !== 0) + return c; + c = compareTypeNames(t1, t2); + if (c !== 0) + return c; + if (t1.flags & (1 | 2 | 32 | 64 | 256 | 128 | 512 | 16 | 4 | 8 | 262144 | 131072)) {} else if (t1.flags & 1048576) { + const c2 = compareSymbols(t1.symbol, t2.symbol); + if (c2 !== 0) + return c2; + if (getObjectFlags(t1) & 4 && getObjectFlags(t2) & 4) { + const r1 = t1; + const r2 = t2; + if (getObjectFlags(r1.target) & 8 && getObjectFlags(r2.target) & 8) { + const c3 = compareTupleTypes(r1.target, r2.target); + if (c3 !== 0) { + return c3; + } + } + if (r1.node === undefined && r2.node === undefined) { + const c3 = compareTypeLists(t1.resolvedTypeArguments, t2.resolvedTypeArguments); + if (c3 !== 0) { + return c3; + } + } else { + let c3 = compareNodes(r1.node, r2.node); + if (c3 !== 0) { + return c3; + } + c3 = compareTypeMappers(t1.mapper, t2.mapper); + if (c3 !== 0) { + return c3; + } + } + } else if (getObjectFlags(t1) & 4) { + return -1; + } else if (getObjectFlags(t2) & 4) { + return 1; + } else { + let c3 = (getObjectFlags(t1) & 142607679) - (getObjectFlags(t2) & 142607679); + if (c3 !== 0) { + return c3; + } + c3 = compareTypeMappers(t1.mapper, t2.mapper); + if (c3 !== 0) { + return c3; + } + } + } else if (t1.flags & 134217728) { + const o1 = t1.origin; + const o2 = t2.origin; + if (o1 === undefined && o2 === undefined) { + const c2 = compareTypeLists(t1.types, t2.types); + if (c2 !== 0) { + return c2; + } + } else if (o1 === undefined) { + return 1; + } else if (o2 === undefined) { + return -1; + } else { + const c2 = compareTypes(o1, o2); + if (c2 !== 0) { + return c2; + } + } + } else if (t1.flags & 268435456) { + const c2 = compareTypeLists(t1.types, t2.types); + if (c2 !== 0) { + return c2; + } + } else if (t1.flags & (65536 | 32768 | 16384)) { + const c2 = compareSymbols(t1.symbol, t2.symbol); + if (c2 !== 0) { + return c2; + } + } else if (t1.flags & 1024) { + const c2 = compareComparableValues(t1.value, t2.value); + if (c2 !== 0) { + return c2; + } + } else if (t1.flags & 2048) { + const c2 = compareComparableValues(t1.value, t2.value); + if (c2 !== 0) { + return c2; + } + } else if (t1.flags & 8192) { + const b1 = t1.intrinsicName === "true"; + const b2 = t2.intrinsicName === "true"; + if (b1 !== b2) { + if (b1) { + return 1; + } + return -1; + } + } else if (t1.flags & 524288) { + const c2 = compareSymbols(t1.symbol, t2.symbol); + if (c2 !== 0) { + return c2; + } + } else if (t1.flags & 2097152) { + let c2 = compareTypes(t1.type, t2.type); + if (c2 !== 0) { + return c2; + } + c2 = t1.indexFlags - t2.indexFlags; + if (c2 !== 0) { + return c2; + } + } else if (t1.flags & 33554432) { + let c2 = compareTypes(t1.objectType, t2.objectType); + if (c2 !== 0) { + return c2; + } + c2 = compareTypes(t1.indexType, t2.indexType); + if (c2 !== 0) { + return c2; + } + } else if (t1.flags & 67108864) { + let c2 = compareNodes(t1.root.node, t2.root.node); + if (c2 !== 0) { + return c2; + } + c2 = compareTypeMappers(t1.mapper, t2.mapper); + if (c2 !== 0) { + return c2; + } + } else if (t1.flags & 16777216) { + let c2 = compareTypes(t1.baseType, t2.baseType); + if (c2 !== 0) { + return c2; + } + c2 = compareTypes(t1.constraint, t2.constraint); + if (c2 !== 0) { + return c2; + } + } else if (t1.flags & 4194304) { + let c2 = slicesCompareString(t1.texts, t2.texts); + if (c2 !== 0) { + return c2; + } + c2 = compareTypeLists(t1.types, t2.types); + if (c2 !== 0) { + return c2; + } + } else if (t1.flags & 8388608) { + const c2 = compareTypes(t1.type, t2.type); + if (c2 !== 0) { + return c2; + } + } + return t1.id - t2.id; + function slicesCompareString(s1, s2) { + for (let i = 0;i < s1.length; i++) { + if (i > s2.length) { + return 1; + } + const v1 = s1[i]; + const v2 = s2[i]; + const c2 = compareComparableValues(v1, v2); + if (c2 !== 0) + return c2; + } + if (s1.length < s2.length) { + return -1; + } + return 0; + } + } + function getSortOrderFlags(t) { + if (t.flags & (32768 | 65536) && !(t.flags & 134217728)) { + return 65536; + } + return t.flags; + } + function compareTypeNames(t1, t2) { + const s1 = getTypeNameSymbol(t1); + const s2 = getTypeNameSymbol(t2); + if (s1 === s2) { + if (t1.aliasTypeArguments !== undefined) { + return compareTypeLists(t1.aliasTypeArguments, t2.aliasTypeArguments); + } + return 0; + } + if (s1 === undefined) { + return 1; + } + if (s2 === undefined) { + return -1; + } + return compareComparableValues(s1.escapedName, s2.escapedName); + } + function getTypeNameSymbol(t) { + if (t.aliasSymbol !== undefined) { + return t.aliasSymbol; + } + if (t.flags & (524288 | 8388608) || getObjectFlags(t) & (3 | 4)) { + return t.symbol; + } + return; + } + function compareTupleTypes(t1, t2) { + var _a; + if (t1 === t2) { + return 0; + } + if (t1.readonly !== t2.readonly) { + return t1.readonly ? 1 : -1; + } + if (t1.elementFlags.length !== t2.elementFlags.length) { + return t1.elementFlags.length - t2.elementFlags.length; + } + for (let i = 0;i < t1.elementFlags.length; i++) { + const c = t1.elementFlags[i] - t2.elementFlags[i]; + if (c !== 0) { + return c; + } + } + for (let i = 0;i < (((_a = t1.labeledElementDeclarations) == null ? undefined : _a.length) ?? 0); i++) { + const c = compareElementLabels(t1.labeledElementDeclarations[i], t2.labeledElementDeclarations[i]); + if (c !== 0) { + return c; + } + } + return 0; + } + function compareElementLabels(n1, n2) { + if (n1 === n2) { + return 0; + } + if (n1 === undefined) { + return -1; + } + if (n2 === undefined) { + return 1; + } + return compareComparableValues(n1.name.escapedText, n2.name.escapedText); + } + function compareTypeLists(s1, s2) { + if (length(s1) !== length(s2)) { + return length(s1) - length(s2); + } + for (let i = 0;i < length(s1); i++) { + const c = compareTypes(s1[i], s2 == null ? undefined : s2[i]); + if (c !== 0) + return c; + } + return 0; + } + function compareTypeMappers(m1, m2) { + if (m1 === m2) { + return 0; + } + if (m1 === undefined) { + return 1; + } + if (m2 === undefined) { + return -1; + } + const kind1 = m1.kind; + const kind2 = m2.kind; + if (kind1 !== kind2) { + return kind1 - kind2; + } + switch (kind1) { + case 0: { + const c = compareTypes(m1.source, m2.source); + if (c !== 0) { + return c; + } + return compareTypes(m1.target, m2.target); + } + case 1: { + const c = compareTypeLists(m1.sources, m2.sources); + if (c !== 0) { + return c; + } + return compareTypeLists(m1.targets, m2.targets); + } + case 5: { + const c = compareTypeMappers(m1.mapper1, m2.mapper1); + if (c !== 0) { + return c; + } + return compareTypeMappers(m1.mapper2, m2.mapper2); + } + } + return 0; + } } function isNotAccessor(declaration) { return !isAccessor(declaration); @@ -84391,11 +85011,11 @@ ${lanes.join(` this.inner.reportCyclicStructureError(); } } - reportLikelyUnsafeImportRequiredError(specifier) { + reportLikelyUnsafeImportRequiredError(specifier, symbolName2) { var _a; if ((_a = this.inner) == null ? undefined : _a.reportLikelyUnsafeImportRequiredError) { this.onDiagnosticReported(); - this.inner.reportLikelyUnsafeImportRequiredError(specifier); + this.inner.reportLikelyUnsafeImportRequiredError(specifier, symbolName2); } } reportTruncationError() { @@ -86979,7 +87599,7 @@ ${lanes.join(` } } function visitSourceFile(node) { - const alwaysStrict = getStrictOptionValue(compilerOptions, "alwaysStrict") && !(isExternalModule(node) && moduleKind >= 5) && !isJsonSourceFile(node); + const alwaysStrict = getAlwaysStrict(compilerOptions) && !(isExternalModule(node) && moduleKind >= 5) && !isJsonSourceFile(node); return factory2.updateSourceFile(node, visitLexicalEnvironment(node.statements, sourceElementVisitor, context, 0, alwaysStrict)); } function visitObjectLiteralExpression(node) { @@ -87012,7 +87632,7 @@ ${lanes.join(` } function visitClassDeclaration(node) { const facts = getClassFacts(node); - const promoteToIIFE = languageVersion <= 1 && !!(facts & 7); + const promoteToIIFE = languageVersion < 2 && !!(facts & 7); if (!isClassLikeDeclarationWithTypeScriptSyntax(node) && !classOrConstructorParameterIsDecorated(legacyDecorators, node) && !isExportOfNamespace(node)) { return factory2.updateClassDeclaration(node, visitNodes2(node.modifiers, modifierVisitor, isModifier), node.name, undefined, visitNodes2(node.heritageClauses, visitor, isHeritageClause), visitNodes2(node.members, getClassElementVisitor(node), isClassElement)); } @@ -87094,6 +87714,9 @@ ${lanes.join(` const parametersWithPropertyAssignments = constructor && filter(constructor.parameters, (p) => isParameterPropertyDeclaration(p, constructor)); if (parametersWithPropertyAssignments) { for (const parameter of parametersWithPropertyAssignments) { + if (!isIdentifier(parameter.name)) { + continue; + } const parameterProperty = factory2.createPropertyDeclaration(undefined, parameter.name, undefined, undefined, undefined); setOriginalNode(parameterProperty, parameter); newMembers = append(newMembers, parameterProperty); @@ -93066,8 +93689,6 @@ ${lanes.join(` return visitForStatement(node); case 251: return visitForOfStatement(node); - case 256: - return visitSwitchStatement(node); default: return visitEachChild(node, visitor, context); } @@ -93152,26 +93773,6 @@ ${lanes.join(` } return visitEachChild(node, visitor, context); } - function visitCaseOrDefaultClause(node, envBinding) { - if (getUsingKindOfStatements(node.statements) !== 0) { - if (isCaseClause(node)) { - return factory2.updateCaseClause(node, visitNode(node.expression, visitor, isExpression), transformUsingDeclarations(node.statements, 0, node.statements.length, envBinding, undefined)); - } else { - return factory2.updateDefaultClause(node, transformUsingDeclarations(node.statements, 0, node.statements.length, envBinding, undefined)); - } - } - return visitEachChild(node, visitor, context); - } - function visitSwitchStatement(node) { - const usingKind = getUsingKindOfCaseOrDefaultClauses(node.caseBlock.clauses); - if (usingKind) { - const envBinding = createEnvBinding(); - return createDownlevelUsingStatements([ - factory2.updateSwitchStatement(node, visitNode(node.expression, visitor, isExpression), factory2.updateCaseBlock(node.caseBlock, node.caseBlock.clauses.map((clause) => visitCaseOrDefaultClause(clause, envBinding)))) - ], envBinding, usingKind === 2); - } - return visitEachChild(node, visitor, context); - } function transformUsingDeclarations(statementsIn, start, end, envBinding, topLevelStatements) { const statements = []; for (let i = start;i < end; i++) { @@ -93424,17 +94025,6 @@ ${lanes.join(` } return result; } - function getUsingKindOfCaseOrDefaultClauses(clauses) { - let result = 0; - for (const clause of clauses) { - const usingKind = getUsingKindOfStatements(clause.statements); - if (usingKind === 2) - return 2; - if (usingKind > result) - result = usingKind; - } - return result; - } function transformJsx(context) { const { factory: factory2, @@ -93573,15 +94163,15 @@ ${lanes.join(` } function visitJsxElement(node, isChild) { const tagTransform = shouldUseCreateElement(node.openingElement) ? visitJsxOpeningLikeElementCreateElement : visitJsxOpeningLikeElementJSX; - return tagTransform(node.openingElement, node.children, isChild, node); + return tagTransform(node.openingElement, node.children, isChild, createRange(skipTrivia2(currentSourceFile.text, node.pos), node.end)); } function visitJsxSelfClosingElement(node, isChild) { const tagTransform = shouldUseCreateElement(node) ? visitJsxOpeningLikeElementCreateElement : visitJsxOpeningLikeElementJSX; - return tagTransform(node, undefined, isChild, node); + return tagTransform(node, undefined, isChild, createRange(skipTrivia2(currentSourceFile.text, node.pos), node.end)); } function visitJsxFragment(node, isChild) { const tagTransform = currentFileState.importSpecifier === undefined ? visitJsxOpeningFragmentCreateElement : visitJsxOpeningFragmentJSX; - return tagTransform(node.openingFragment, node.children, isChild, node); + return tagTransform(node.openingFragment, node.children, isChild, createRange(skipTrivia2(currentSourceFile.text, node.pos), node.end)); } function convertJsxChildrenToChildrenPropObject(children) { const prop = convertJsxChildrenToChildrenPropAssignment(children); @@ -97843,7 +98433,7 @@ ${lanes.join(` function transformCommonJSModule(node) { startLexicalEnvironment(); const statements = []; - const ensureUseStrict = getStrictOptionValue(compilerOptions, "alwaysStrict") || isExternalModule(currentSourceFile); + const ensureUseStrict = getAlwaysStrict(compilerOptions) || isExternalModule(currentSourceFile); const statementOffset = factory2.copyPrologue(node.statements, statements, ensureUseStrict && !isJsonSourceFile(node), topLevelVisitor); if (shouldEmitUnderscoreUnderscoreESModule()) { append(statements, createUnderscoreUnderscoreESModule()); @@ -98924,7 +99514,7 @@ ${lanes.join(` function createSystemModuleBody(node, dependencyGroups) { const statements = []; startLexicalEnvironment(); - const ensureUseStrict = getStrictOptionValue(compilerOptions, "alwaysStrict") || isExternalModule(currentSourceFile); + const ensureUseStrict = getAlwaysStrict(compilerOptions) || isExternalModule(currentSourceFile); const statementOffset = factory2.copyPrologue(node.statements, statements, ensureUseStrict, topLevelVisitor); statements.push(factory2.createVariableStatement(undefined, factory2.createVariableDeclarationList([ factory2.createVariableDeclaration("__moduleName", undefined, undefined, factory2.createLogicalAnd(contextObject, factory2.createPropertyAccessExpression(contextObject, "id"))) @@ -100508,9 +101098,13 @@ ${lanes.join(` context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_references_an_inaccessible_1_type_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), "this")); } } - function reportLikelyUnsafeImportRequiredError(specifier) { + function reportLikelyUnsafeImportRequiredError(specifier, symbolName2) { if (errorNameNode || errorFallbackNode) { - context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), specifier)); + if (symbolName2) { + context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_2_from_1_This_is_likely_not_portable_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), specifier, symbolName2)); + } else { + context.addDiagnostic(createDiagnosticForNode(errorNameNode || errorFallbackNode, Diagnostics.The_inferred_type_of_0_cannot_be_named_without_a_reference_to_1_This_is_likely_not_portable_A_type_annotation_is_necessary, errorDeclarationNameWithFallback(), specifier)); + } } } function reportTruncationError() { @@ -100552,11 +101146,9 @@ ${lanes.join(` rawReferencedFiles = []; rawTypeReferenceDirectives = []; rawLibReferenceDirectives = []; - let hasNoDefaultLib = false; const bundle = factory2.createBundle(map(node.sourceFiles, (sourceFile) => { if (sourceFile.isDeclarationFile) return; - hasNoDefaultLib = hasNoDefaultLib || sourceFile.hasNoDefaultLib; currentSourceFile = sourceFile; enclosingDeclaration = sourceFile; lateMarkedStatements = undefined; @@ -100581,7 +101173,6 @@ ${lanes.join(` bundle.syntheticFileReferences = getReferencedFiles(outputFilePath2); bundle.syntheticTypeReferences = getTypeReferences(); bundle.syntheticLibReferences = getLibReferences(); - bundle.hasNoDefaultLib = hasNoDefaultLib; return bundle; } needsDeclare = true; @@ -100610,7 +101201,7 @@ ${lanes.join(` } } const outputFilePath = getDirectoryPath(normalizeSlashes(getOutputPathsFor(node, host, true).declarationFilePath)); - return factory2.updateSourceFile(node, combinedStatements, true, getReferencedFiles(outputFilePath), getTypeReferences(), node.hasNoDefaultLib, getLibReferences()); + return factory2.updateSourceFile(node, combinedStatements, true, getReferencedFiles(outputFilePath), getTypeReferences(), false, getLibReferences()); function collectFileReferences(sourceFile) { rawReferencedFiles = concatenate(rawReferencedFiles, map(sourceFile.referencedFiles, (f) => [sourceFile, f])); rawTypeReferenceDirectives = concatenate(rawTypeReferenceDirectives, sourceFile.typeReferenceDirectives); @@ -101317,6 +101908,7 @@ ${lanes.join(` continue; if (isBindingPattern(elem.name)) { elems = concatenate(elems, walkBindingPattern(elem.name)); + continue; } elems = elems || []; elems.push(factory2.createPropertyDeclaration(ensureModifiers(param), elem.name, undefined, ensureType(elem), undefined)); @@ -102113,7 +102705,7 @@ ${lanes.join(` if (options.rootDir) { commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, currentDirectory); checkSourceFilesBelongToPath == null || checkSourceFilesBelongToPath(options.rootDir); - } else if (options.composite && options.configFilePath) { + } else if (options.configFilePath) { commonSourceDirectory = getDirectoryPath(normalizeSlashes(options.configFilePath)); checkSourceFilesBelongToPath == null || checkSourceFilesBelongToPath(commonSourceDirectory); } else { @@ -102124,6 +102716,13 @@ ${lanes.join(` } return commonSourceDirectory; } + function getComputedCommonSourceDirectory(emittedFiles, currentDirectory, getCanonicalFileName) { + let commonSourceDirectory = computeCommonSourceDirectoryOfFilenames(emittedFiles, currentDirectory, getCanonicalFileName); + if (commonSourceDirectory && commonSourceDirectory[commonSourceDirectory.length - 1] !== directorySeparator) { + commonSourceDirectory += directorySeparator; + } + return commonSourceDirectory; + } function getCommonSourceDirectoryOfConfig({ options, fileNames }, ignoreCase) { return getCommonSourceDirectory(options, () => filter(fileNames, (file) => !(options.noEmitForJsFiles && fileExtensionIsOneOf(file, supportedJSExtensionsFlat)) && !isDeclarationFileName(file)), getDirectoryPath(normalizeSlashes(Debug.checkDefined(options.configFilePath))), createGetCanonicalFileName(!ignoreCase)); } @@ -103651,7 +104250,7 @@ ${lanes.join(` increaseIndent(); } const preferNewLine = node.multiLine ? 65536 : 0; - const allowTrailingComma = currentSourceFile && currentSourceFile.languageVersion >= 1 && !isJsonSourceFile(currentSourceFile) ? 64 : 0; + const allowTrailingComma = currentSourceFile && !isJsonSourceFile(currentSourceFile) ? 64 : 0; emitList(node, node.properties, 526226 | allowTrailingComma | preferNewLine); if (indentedFlag) { decreaseIndent(); @@ -104946,17 +105545,13 @@ ${lanes.join(` emitSourceFileWorker(node); } function emitSyntheticTripleSlashReferencesIfNeeded(node) { - emitTripleSlashDirectives(!!node.hasNoDefaultLib, node.syntheticFileReferences || [], node.syntheticTypeReferences || [], node.syntheticLibReferences || []); + emitTripleSlashDirectives(node.syntheticFileReferences || [], node.syntheticTypeReferences || [], node.syntheticLibReferences || []); } function emitTripleSlashDirectivesIfNeeded(node) { if (node.isDeclarationFile) - emitTripleSlashDirectives(node.hasNoDefaultLib, node.referencedFiles, node.typeReferenceDirectives, node.libReferenceDirectives); + emitTripleSlashDirectives(node.referencedFiles, node.typeReferenceDirectives, node.libReferenceDirectives); } - function emitTripleSlashDirectives(hasNoDefaultLib, files, types, libs2) { - if (hasNoDefaultLib) { - writeComment(`/// `); - writeLine(); - } + function emitTripleSlashDirectives(files, types, libs2) { if (currentSourceFile && currentSourceFile.moduleName) { writeComment(`/// `); writeLine(); @@ -107638,7 +108233,6 @@ ${lanes.join(` mark("beforeProgram"); const host = createProgramOptionsHost || createCompilerHost(options); const configParsingHost = parseConfigHostFromCompilerHostLike(host); - let skipDefaultLib = options.noLib; const getDefaultLibraryFileName = memoize(() => host.getDefaultLibFileName(options)); const defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : getDirectoryPath(getDefaultLibraryFileName()); let skipVerifyCompilerOptions = false; @@ -107683,6 +108277,7 @@ ${lanes.join(` let redirectTargetsMap = createMultiMap(); let usesUriStyleNodeCoreModules; const filesByName = /* @__PURE__ */ new Map; + const libFiles = /* @__PURE__ */ new Set; let missingFileNames = /* @__PURE__ */ new Map; const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map : undefined; let resolvedProjectReferences; @@ -107741,7 +108336,7 @@ ${lanes.join(` } } (_i = tracing) == null || _i.push(tracing.Phase.Program, "processRootFiles", { count: rootNames.length }); - forEach(rootNames, (name, index) => processRootFile(name, false, false, { kind: 0, index })); + forEach(rootNames, (name, index) => processRootFile(name, false, { kind: 0, index })); (_j = tracing) == null || _j.pop(); automaticTypeDirectiveNames ?? (automaticTypeDirectiveNames = rootNames.length ? getAutomaticTypeDirectiveNames(options, host) : emptyArray); automaticTypeDirectiveResolutions = createModeAwareCache(); @@ -107760,13 +108355,14 @@ ${lanes.join(` } (_n = tracing) == null || _n.pop(); } - if (rootNames.length && !skipDefaultLib) { + if (rootNames.length && !options.noLib) { const defaultLibraryFileName = getDefaultLibraryFileName(); if (!options.lib && defaultLibraryFileName) { - processRootFile(defaultLibraryFileName, true, false, { kind: 6 }); + libFiles.add(toPath3(defaultLibraryFileName)); + processRootFile(defaultLibraryFileName, true, { kind: 6 }); } else { forEach(options.lib, (libFileName, index) => { - processRootFile(pathForLibFile(libFileName), true, false, { kind: 6, index }); + processRootFile(pathForLibFile(libFileName), true, { kind: 6, index }); }); } } @@ -108215,8 +108811,6 @@ ${lanes.join(` structureIsReused = 1; } else if (!arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) { structureIsReused = 1; - } else if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { - structureIsReused = 1; } else if (!arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) { structureIsReused = 1; } else { @@ -108277,6 +108871,9 @@ ${lanes.join(` Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length); for (const newSourceFile of newSourceFiles) { filesByName.set(newSourceFile.path, newSourceFile); + if (oldProgram.isSourceFileDefaultLibrary(newSourceFile)) { + libFiles.add(newSourceFile.path); + } } const oldFilesByNameMap = oldProgram.getFilesByNameMap(); oldFilesByNameMap.forEach((oldFile, path) => { @@ -108373,24 +108970,7 @@ ${lanes.join(` return !!sourceFilesFoundSearchingNodeModules.get(file.path); } function isSourceFileDefaultLibrary(file) { - if (!file.isDeclarationFile) { - return false; - } - if (file.hasNoDefaultLib) { - return true; - } - if (options.noLib) { - return false; - } - const equalityComparer = host.useCaseSensitiveFileNames() ? equateStringsCaseSensitive : equateStringsCaseInsensitive; - if (!options.lib) { - return equalityComparer(file.fileName, getDefaultLibraryFileName()); - } else { - return some(options.lib, (libFileName) => { - const resolvedLib = resolvedLibReferences.get(libFileName); - return !!resolvedLib && equalityComparer(file.fileName, resolvedLib.actual); - }); - } + return libFiles.has(file.path); } function getTypeChecker() { return typeChecker || (typeChecker = createTypeChecker(program)); @@ -108803,8 +109383,8 @@ ${lanes.join(` function getConfigFileParsingDiagnostics2() { return configFileParsingDiagnostics || emptyArray; } - function processRootFile(fileName, isDefaultLib, ignoreNoDefaultLib, reason) { - processSourceFile(normalizePath(fileName), isDefaultLib, ignoreNoDefaultLib, undefined, reason); + function processRootFile(fileName, isDefaultLib, reason) { + processSourceFile(normalizePath(fileName), isDefaultLib, undefined, reason); } function fileReferenceIsEqualTo(a, b) { return a.fileName === b.fileName; @@ -108938,11 +109518,11 @@ ${lanes.join(` return sourceFileWithAddedExtension; } } - function processSourceFile(fileName, isDefaultLib, ignoreNoDefaultLib, packageId, reason) { - getSourceFileFromReferenceWorker(fileName, (fileName2) => findSourceFile(fileName2, isDefaultLib, ignoreNoDefaultLib, reason, packageId), (diagnostic, ...args) => addFilePreprocessingFileExplainingDiagnostic(undefined, reason, diagnostic, args), reason); + function processSourceFile(fileName, isDefaultLib, packageId, reason) { + getSourceFileFromReferenceWorker(fileName, (fileName2) => findSourceFile(fileName2, isDefaultLib, reason, packageId), (diagnostic, ...args) => addFilePreprocessingFileExplainingDiagnostic(undefined, reason, diagnostic, args), reason); } function processProjectReferenceFile(fileName, reason) { - return processSourceFile(fileName, false, false, undefined, reason); + return processSourceFile(fileName, false, undefined, reason); } function reportFileNamesDifferOnlyInCasingError(fileName, existingFile, reason) { const hasExistingReasonToReportErrorOn = !isReferencedFile(reason) && some(programDiagnostics.getFileReasons().get(existingFile.path), isReferencedFile); @@ -108964,14 +109544,14 @@ ${lanes.join(` sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); return redirect; } - function findSourceFile(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) { + function findSourceFile(fileName, isDefaultLib, reason, packageId) { var _a2, _b2; (_a2 = tracing) == null || _a2.push(tracing.Phase.Program, "findSourceFile", { fileName, isDefaultLib: isDefaultLib || undefined, fileIncludeKind: FileIncludeKind[reason.kind] }); - const result = findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId); + const result = findSourceFileWorker(fileName, isDefaultLib, reason, packageId); (_b2 = tracing) == null || _b2.pop(); return result; } @@ -108981,7 +109561,7 @@ ${lanes.join(` const setExternalModuleIndicator2 = getSetExternalModuleIndicator(options2); return typeof result === "object" ? { ...result, languageVersion, setExternalModuleIndicator: setExternalModuleIndicator2, jsDocParsingMode: host2.jsDocParsingMode } : { languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator2, jsDocParsingMode: host2.jsDocParsingMode }; } - function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) { + function findSourceFileWorker(fileName, isDefaultLib, reason, packageId) { var _a2, _b2; const path = toPath3(fileName); if (useSourceOfProjectReferenceRedirect) { @@ -108992,7 +109572,7 @@ ${lanes.join(` source = getRedirectFromOutput(realPath2); } if (source == null ? undefined : source.source) { - const file2 = findSourceFile(source.source, isDefaultLib, ignoreNoDefaultLib, reason, packageId); + const file2 = findSourceFile(source.source, isDefaultLib, reason, packageId); if (file2) addFileToFilesByName(file2, path, fileName, undefined); return file2; @@ -109081,7 +109661,6 @@ ${lanes.join(` filesByNameIgnoreCase.set(pathLowerCase, file); } } - skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib && !ignoreNoDefaultLib; if (!options.noResolve) { processReferencedFiles(file, isDefaultLib); processTypeReferenceDirectives(file); @@ -109141,7 +109720,7 @@ ${lanes.join(` } function processReferencedFiles(file, isDefaultLib) { forEach(file.referencedFiles, (ref, index) => { - processSourceFile(resolveTripleslashReference(ref.fileName, file.fileName), isDefaultLib, false, undefined, { kind: 4, file: file.path, index }); + processSourceFile(resolveTripleslashReference(ref.fileName, file.fileName), isDefaultLib, undefined, { kind: 4, file: file.path, index }); }); } function processTypeReferenceDirectives(file) { @@ -109176,7 +109755,7 @@ ${lanes.join(` if (resolvedTypeReferenceDirective) { if (resolvedTypeReferenceDirective.isExternalLibraryImport) currentNodeModulesDepth++; - processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, false, resolvedTypeReferenceDirective.packageId, reason); + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, resolvedTypeReferenceDirective.packageId, reason); if (resolvedTypeReferenceDirective.isExternalLibraryImport) currentNodeModulesDepth--; } else { @@ -109189,6 +109768,7 @@ ${lanes.join(` return existing.actual; const result = pathForLibFileWorker(libFileName); (resolvedLibReferences ?? (resolvedLibReferences = /* @__PURE__ */ new Map)).set(libFileName, result); + libFiles.add(toPath3(result.actual)); return result.actual; } function pathForLibFileWorker(libFileName) { @@ -109196,7 +109776,7 @@ ${lanes.join(` const existing = resolvedLibProcessing == null ? undefined : resolvedLibProcessing.get(libFileName); if (existing) return existing; - if (options.libReplacement === false) { + if (!options.libReplacement) { const result2 = { resolution: { resolvedModule: undefined @@ -109237,7 +109817,7 @@ ${lanes.join(` forEach(file.libReferenceDirectives, (libReference, index) => { const libFileName = getLibFileNameFromLibReference(libReference); if (libFileName) { - processRootFile(pathForLibFile(libFileName), true, true, { kind: 7, file: file.path, index }); + processRootFile(pathForLibFile(libFileName), true, { kind: 7, file: file.path, index }); } else { programDiagnostics.addFileProcessingDiagnostic({ kind: 0, @@ -109279,7 +109859,7 @@ ${lanes.join(` if (elideImport) { modulesWithElidedImports.set(file.path, true); } else if (shouldAddFile) { - findSourceFile(resolvedFileName, false, false, { kind: 3, file: file.path, index }, resolution.packageId); + findSourceFile(resolvedFileName, false, { kind: 3, file: file.path, index }, resolution.packageId); } if (isFromNodeModulesSearch) { currentNodeModulesDepth--; @@ -109508,6 +110088,14 @@ ${lanes.join(` createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir"); } } + if (!options.noEmit && !options.composite && !options.rootDir && options.configFilePath && (options.outDir || getEmitDeclarations(options) && options.declarationDir || options.outFile)) { + const dir = getCommonSourceDirectory2(); + const emittedFiles = mapDefined(files, (file) => !file.isDeclarationFile && sourceFileMayBeEmitted(file, program) ? file.fileName : undefined); + const dir59 = getComputedCommonSourceDirectory(emittedFiles, currentDirectory, getCanonicalFileName); + if (dir59 !== "" && getCanonicalFileName(dir) !== getCanonicalFileName(dir59)) { + createDiagnosticForOption(true, options.outFile ? "outFile" : options.outDir ? "outDir" : "declarationDir", !options.outFile && options.outDir ? "declarationDir" : undefined, chainDiagnosticMessages(chainDiagnosticMessages(undefined, Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information), Diagnostics.The_common_source_directory_of_0_is_1_The_rootDir_setting_must_be_explicitly_set_to_this_or_another_path_to_adjust_your_output_s_file_layout, getBaseFileName(options.configFilePath), getRelativePathFromFile(options.configFilePath, dir59, getCanonicalFileName))); + } + } if (options.checkJs && !getAllowJSCompilerOption(options)) { createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs"); } @@ -109560,7 +110148,7 @@ ${lanes.join(` } } if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly || options.rewriteRelativeImportExtensions)) { - createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set); + createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_one_of_noEmit_emitDeclarationOnly_or_rewriteRelativeImportExtensions_is_set); } const moduleResolution = getEmitModuleResolutionKind(options); if (options.resolvePackageJsonExports && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { @@ -109572,8 +110160,8 @@ ${lanes.join(` if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions"); } - if (moduleResolution === 100 && !emitModuleKindIsNonNodeESM(moduleKind) && moduleKind !== 200) { - createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "bundler"); + if (moduleResolution === 100 && !emitModuleKindIsNonNodeESM(moduleKind) && moduleKind !== 200 && moduleKind !== 1) { + createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_commonjs_or_es2015_or_later, "bundler"); } if (ModuleKind[moduleKind] && (100 <= moduleKind && moduleKind <= 199) && !(3 <= moduleResolution && moduleResolution <= 99)) { const moduleKindName = ModuleKind[moduleKind]; @@ -109616,7 +110204,7 @@ ${lanes.join(` function getIgnoreDeprecationsVersion() { const ignoreDeprecations = options.ignoreDeprecations; if (ignoreDeprecations) { - if (ignoreDeprecations === "5.0") { + if (ignoreDeprecations === "5.0" || ignoreDeprecations === "6.0") { return new Version(ignoreDeprecations); } reportInvalidIgnoreDeprecations(); @@ -109631,31 +110219,39 @@ ${lanes.join(` const mustBeRemoved = !(removedInVersion.compareTo(typescriptVersion) === 1); const canBeSilenced = !mustBeRemoved && ignoreDeprecationsVersion.compareTo(deprecatedInVersion) === -1; if (mustBeRemoved || canBeSilenced) { - fn((name, value, useInstead) => { + fn((name, value, useInstead, related) => { if (mustBeRemoved) { if (value === undefined) { - createDiagnostic(name, value, useInstead, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name); + createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name); } else { - createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value); + createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value); } } else { if (value === undefined) { - createDiagnostic(name, value, useInstead, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn); + createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn); } else { - createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn); + createDiagnostic(name, value, useInstead, related, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn); } } }); } } function verifyDeprecatedCompilerOptions() { - function createDiagnostic(name, value, useInstead, message, ...args) { + function createDiagnostic(name, value, useInstead, related, message, ...args) { if (useInstead) { - const details = chainDiagnosticMessages(undefined, Diagnostics.Use_0_instead, useInstead); + let details = chainDiagnosticMessages(undefined, Diagnostics.Use_0_instead, useInstead); + if (related) { + details = chainDiagnosticMessages(details, related); + } const chain = chainDiagnosticMessages(details, message, ...args); createDiagnosticForOption(!value, name, undefined, chain); } else { - createDiagnosticForOption(!value, name, undefined, message, ...args); + let details; + if (related) { + details = chainDiagnosticMessages(undefined, related); + } + const chain = chainDiagnosticMessages(details, message, ...args); + createDiagnosticForOption(!value, name, undefined, chain); } } checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => { @@ -109681,7 +110277,7 @@ ${lanes.join(` createDeprecatedDiagnostic("charset"); } if (options.out) { - createDeprecatedDiagnostic("out", undefined, "outFile"); + createDeprecatedDiagnostic("out"); } if (options.importsNotUsedAsValues) { createDeprecatedDiagnostic("importsNotUsedAsValues", undefined, "verbatimModuleSyntax"); @@ -109690,9 +110286,41 @@ ${lanes.join(` createDeprecatedDiagnostic("preserveValueImports", undefined, "verbatimModuleSyntax"); } }); + checkDeprecations("6.0", "7.0", createDiagnostic, (createDeprecatedDiagnostic) => { + if (options.alwaysStrict === false) { + createDeprecatedDiagnostic("alwaysStrict", "false", undefined, undefined); + } + if (options.target === 1) { + createDeprecatedDiagnostic("target", "ES5"); + } + if (options.moduleResolution === 2) { + createDeprecatedDiagnostic("moduleResolution", "node10", undefined, Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information); + } + if (options.moduleResolution === 1) { + createDeprecatedDiagnostic("moduleResolution", "classic", undefined, undefined); + } + if (options.baseUrl !== undefined) { + createDeprecatedDiagnostic("baseUrl", undefined, undefined, Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information); + } + if (options.esModuleInterop === false) { + createDeprecatedDiagnostic("esModuleInterop", "false", undefined, undefined); + } + if (options.allowSyntheticDefaultImports === false) { + createDeprecatedDiagnostic("allowSyntheticDefaultImports", "false", undefined, undefined); + } + if (options.outFile) { + createDeprecatedDiagnostic("outFile"); + } + if (options.module === 0 || options.module === 2 || options.module === 3 || options.module === 4) { + createDeprecatedDiagnostic("module", ModuleKind[options.module], undefined, undefined); + } + if (options.downlevelIteration !== undefined) { + createDeprecatedDiagnostic("downlevelIteration"); + } + }); } function verifyDeprecatedProjectReference(ref, parentFile, index) { - function createDiagnostic(_name, _value, _useInstead, message, ...args) { + function createDiagnostic(_name, _value, _useInstead, _related, message, ...args) { createDiagnosticForReference(parentFile, index, message, ...args); } checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => { @@ -110374,9 +111002,7 @@ ${lanes.join(` const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : undefined); return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(sourceFile, referencesSyntax.elements[index], reason.kind === 2 ? Diagnostics.File_is_output_from_referenced_project_specified_here : Diagnostics.File_is_source_from_referenced_project_specified_here) : undefined; case 8: - if (!options.types) - return; - configFileNode = getOptionsSyntaxByArrayElementValue(getCompilerOptionsObjectLiteralSyntax(), "types", reason.typeReference); + configFileNode = getOptionsSyntaxByArrayElementValue(getCompilerOptionsObjectLiteralSyntax(), "types", usesWildcardTypes(options) ? "*" : reason.typeReference); message = Diagnostics.File_is_entry_point_of_type_library_specified_here; break; case 6: @@ -110852,7 +111478,7 @@ ${lanes.join(` if (canCopySemanticDiagnostics) { if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics) return; - if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics) + if (newProgram.isSourceFileDefaultLibrary(sourceFile) && !copyLibFileDiagnostics) return; const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath); if (diagnostics) { @@ -112481,7 +113107,7 @@ ${lanes.join(` shouldRetryResolution, logChanges }) { - var _a; + var _a, _b; const path = resolutionHost.toPath(containingFile); const resolutionsInFile = perFileCache.get(path) || perFileCache.set(path, createModeAwareCache()).get(path); const resolvedModules = []; @@ -112501,7 +113127,7 @@ ${lanes.join(` resolutionHost.onDiscoveredSymlink(); } resolutionsInFile.set(name, mode, resolution); - if (resolution !== existingResolution) { + if (resolution !== existingResolution && !((_b = resolutionHost.skipWatchingFailedLookups) == null ? undefined : _b.call(resolutionHost, path))) { watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution); if (existingResolution) { stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName); @@ -112525,8 +113151,11 @@ ${lanes.join(` reusedNames == null || reusedNames.forEach((entry) => seenNamesInFile.set(loader.nameAndMode.getName(entry), loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? undefined : redirectedReference.commandLine.options) || options), true)); if (resolutionsInFile.size() !== seenNamesInFile.size()) { resolutionsInFile.forEach((resolution, name, mode) => { + var _a2; if (!seenNamesInFile.has(name, mode)) { - stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName); + if (!((_a2 = resolutionHost.skipWatchingFailedLookups) == null ? undefined : _a2.call(resolutionHost, path))) { + stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName); + } resolutionsInFile.delete(name, mode); } }); @@ -112887,9 +113516,12 @@ ${lanes.join(` }, nonRecursive ? 0 : 1); } function removeResolutionsOfFileFromCache(cache, filePath, getResolutionWithResolvedFileName) { + var _a; const resolutions = cache.get(filePath); if (resolutions) { - resolutions.forEach((resolution) => stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName)); + if (!((_a = resolutionHost.skipWatchingFailedLookups) == null ? undefined : _a.call(resolutionHost, filePath))) { + resolutions.forEach((resolution) => stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName)); + } cache.delete(filePath); } } @@ -113040,8 +113672,13 @@ ${lanes.join(` }, 1) : noopFileWatcher; } function updateTypeRootsWatch() { + var _a; const options = resolutionHost.getCompilationSettings(); - if (options.types) { + if (!usesWildcardTypes(options)) { + closeTypeRootsWatch(); + return; + } + if (!isRootWatchable || ((_a = resolutionHost.skipWatchingTypeRoots) == null ? undefined : _a.call(resolutionHost))) { closeTypeRootsWatch(); return; } @@ -113327,7 +113964,7 @@ ${lanes.join(` const referencedResolvedRef = Debug.checkDefined((_b = program.getResolvedProjectReferences()) == null ? undefined : _b[reason.index]); return chainDiagnosticMessages(undefined, options.outFile ? isOutput ? Diagnostics.Output_from_referenced_project_0_included_because_1_specified : Diagnostics.Source_from_referenced_project_0_included_because_1_specified : isOutput ? Diagnostics.Output_from_referenced_project_0_included_because_module_is_specified_as_none : Diagnostics.Source_from_referenced_project_0_included_because_module_is_specified_as_none, toFileName(referencedResolvedRef.sourceFile.fileName, fileNameConvertor), options.outFile ? "--outFile" : "--out"); case 8: { - 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]; + const messageAndArgs = !usesWildcardTypes(options) ? 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(undefined, ...messageAndArgs); } case 6: { @@ -115729,7 +116366,13 @@ ${lanes.join(` return shouldBePretty(sys2, options) ? createDiagnosticReporter(sys2, true) : existing; } function defaultIsPretty(sys2) { - return !!sys2.writeOutputIsTTY && sys2.writeOutputIsTTY() && !sys2.getEnvironmentVariable("NO_COLOR"); + if (sys2.getEnvironmentVariable("NO_COLOR")) { + return false; + } + if (sys2.getEnvironmentVariable("FORCE_COLOR")) { + return true; + } + return !!sys2.writeOutputIsTTY && sys2.writeOutputIsTTY(); } function shouldBePretty(sys2, options) { if (!options || typeof options.pretty === "undefined") { @@ -115738,7 +116381,8 @@ ${lanes.join(` return options.pretty; } function getOptionsForHelp(commandLine) { - return commandLine.options.all ? toSorted(optionDeclarations.concat(tscBuildOption), (a, b) => compareStringsCaseInsensitive(a.name, b.name)) : filter(optionDeclarations.concat(tscBuildOption), (v) => !!v.showInSimplifiedHelpView); + const helpOptions = filter(optionDeclarations.concat(tscBuildOption), (option) => option.showInHelp !== false); + return commandLine.options.all ? toSorted(helpOptions, (a, b) => compareStringsCaseInsensitive(a.name, b.name)) : filter(helpOptions, (v) => !!v.showInSimplifiedHelpView); } function printVersion(sys2) { sys2.write(getDiagnosticText(Diagnostics.Version_0, version) + sys2.newLine); @@ -115998,15 +116642,15 @@ ${lanes.join(` function printAllHelp(sys2, compilerOptions, buildOptions, watchOptions) { let output = [...getHeader(sys2, `${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`)]; output = [...output, ...generateSectionOptionsOutput(sys2, getDiagnosticText(Diagnostics.ALL_COMPILER_OPTIONS), compilerOptions, true, undefined, formatMessage(Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsc"))]; - output = [...output, ...generateSectionOptionsOutput(sys2, getDiagnosticText(Diagnostics.WATCH_OPTIONS), watchOptions, false, getDiagnosticText(Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon))]; - output = [...output, ...generateSectionOptionsOutput(sys2, getDiagnosticText(Diagnostics.BUILD_OPTIONS), filter(buildOptions, (option) => option !== tscBuildOption), false, formatMessage(Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; + output = [...output, ...generateSectionOptionsOutput(sys2, getDiagnosticText(Diagnostics.WATCH_OPTIONS), filter(watchOptions, (option) => option.showInHelp !== false), false, getDiagnosticText(Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon))]; + output = [...output, ...generateSectionOptionsOutput(sys2, getDiagnosticText(Diagnostics.BUILD_OPTIONS), filter(buildOptions, (option) => option !== tscBuildOption && option.showInHelp !== false), false, formatMessage(Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; for (const line of output) { sys2.write(line); } } function printBuildHelp(sys2, buildOptions) { let output = [...getHeader(sys2, `${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`)]; - output = [...output, ...generateSectionOptionsOutput(sys2, getDiagnosticText(Diagnostics.BUILD_OPTIONS), filter(buildOptions, (option) => option !== tscBuildOption), false, formatMessage(Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; + output = [...output, ...generateSectionOptionsOutput(sys2, getDiagnosticText(Diagnostics.BUILD_OPTIONS), filter(buildOptions, (option) => option !== tscBuildOption && option.showInHelp !== false), false, formatMessage(Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))]; for (const line of output) { sys2.write(line); } @@ -116082,18 +116726,23 @@ ${lanes.join(` return sys2.exit(1); } } - } else if (commandLine.fileNames.length === 0) { + } else if (!commandLine.options.ignoreConfig || commandLine.fileNames.length === 0) { const searchPath = normalizePath(sys2.getCurrentDirectory()); configFileName = findConfigFile(searchPath, (fileName) => sys2.fileExists(fileName)); - } - if (commandLine.fileNames.length === 0 && !configFileName) { - if (commandLine.options.showConfig) { - reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0, normalizePath(sys2.getCurrentDirectory()))); - } else { - printVersion(sys2); - printHelp(sys2, commandLine); + if (commandLine.fileNames.length !== 0) { + if (configFileName) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.tsconfig_json_is_present_but_will_not_be_loaded_if_files_are_specified_on_commandline_Use_ignoreConfig_to_skip_this_error)); + return sys2.exit(1); + } + } else if (!configFileName) { + if (commandLine.options.showConfig) { + reportDiagnostic(createCompilerDiagnostic(Diagnostics.Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0, normalizePath(sys2.getCurrentDirectory()))); + } else { + printVersion(sys2); + printHelp(sys2, commandLine); + } + return sys2.exit(1); } - return sys2.exit(1); } const currentDirectory = sys2.getCurrentDirectory(); const commandLineOptions = convertToOptionsWithAbsolutePaths(commandLine.options, (fileName) => getNormalizedAbsolutePath(fileName, currentDirectory)); @@ -117507,7 +118156,7 @@ ${lanes.join(` if (typeAcquisition.include) addInferredTypings(typeAcquisition.include, "Explicitly included types"); const exclude = typeAcquisition.exclude || []; - if (!compilerOptions.types) { + if (!compilerOptions.types || usesWildcardTypes(compilerOptions)) { const possibleSearchDirs = new Set(fileNames.map(getDirectoryPath)); possibleSearchDirs.add(projectRootPath); possibleSearchDirs.forEach((searchDir) => { @@ -117631,6 +118280,7 @@ ${lanes.join(` NameValidationResult2[NameValidationResult2["NameTooLong"] = 2] = "NameTooLong"; NameValidationResult2[NameValidationResult2["NameStartsWithDot"] = 3] = "NameStartsWithDot"; NameValidationResult2[NameValidationResult2["NameStartsWithUnderscore"] = 4] = "NameStartsWithUnderscore"; + NameValidationResult2[NameValidationResult2["NameContainsInvalidCharacters"] = 5] = "NameContainsInvalidCharacters"; NameValidationResult2[NameValidationResult2["NameContainsNonURISafeCharacters"] = 5] = "NameContainsNonURISafeCharacters"; return NameValidationResult2; })(NameValidationResult || {}); @@ -117665,7 +118315,7 @@ ${lanes.join(` return 0; } } - if (encodeURIComponent(packageName) !== packageName) { + if (!/^[\w.-]+$/.test(packageName)) { return 5; } return 0; @@ -117685,7 +118335,7 @@ ${lanes.join(` case 4: return `'${typing}':: ${kind} name '${name}' cannot start with '_'`; case 5: - return `'${typing}':: ${kind} name '${name}' contains non URI safe characters`; + return `'${typing}':: ${kind} name '${name}' contains invalid characters`; case 0: return Debug.fail(); default: @@ -119212,7 +119862,7 @@ ${lanes.join(` return false; } function areIntersectedTypesAvoidingStringReduction(checker, t1, t2) { - return !!(t1.flags & 4) && checker.isEmptyAnonymousObjectType(t2); + return !!(t1.flags & 32) && checker.isEmptyAnonymousObjectType(t2); } function isStringAndEmptyAnonymousObjectIntersection(type) { if (!type.isIntersection()) { @@ -122933,14 +123583,13 @@ ${lanes.join(` } function preProcessFile(sourceText, readImportFiles = true, detectJavaScriptImports = false) { const pragmaContext = { - languageVersion: 1, + languageVersion: 12, pragmas: undefined, checkJsDirective: undefined, referencedFiles: [], typeReferenceDirectives: [], libReferenceDirectives: [], amdDependencies: [], - hasNoDefaultLib: undefined, moduleName: undefined }; const importedFiles = []; @@ -123235,7 +123884,7 @@ ${lanes.join(` importedFiles.push(decl.ref); } } - return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, libReferenceDirectives: pragmaContext.libReferenceDirectives, importedFiles, isLibFile: !!pragmaContext.hasNoDefaultLib, ambientExternalModules: undefined }; + return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, libReferenceDirectives: pragmaContext.libReferenceDirectives, importedFiles, isLibFile: false, ambientExternalModules: undefined }; } else { let ambientModuleNames; if (ambientExternalModules) { @@ -123250,7 +123899,7 @@ ${lanes.join(` } } } - return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, libReferenceDirectives: pragmaContext.libReferenceDirectives, importedFiles, isLibFile: !!pragmaContext.hasNoDefaultLib, ambientExternalModules: ambientModuleNames }; + return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, libReferenceDirectives: pragmaContext.libReferenceDirectives, importedFiles, isLibFile: false, ambientExternalModules: ambientModuleNames }; } } var base64UrlRegExp = /^data:(?:application\/json;charset=[uU][tT][fF]-8;base64,([A-Za-z0-9+/=]+)$)?/; @@ -123596,8 +124245,7 @@ ${lanes.join(` function transpileDeclaration(input, transpileOptions) { return transpileWorker(input, transpileOptions, true); } - var barebonesLibContent = `/// -interface Boolean {} + var barebonesLibContent = `interface Boolean {} interface Function {} interface CallableFunction {} interface NewableFunction {} @@ -123644,6 +124292,7 @@ interface Symbol { options.declaration = false; options.declarationMap = false; } + options.noLib = !declaration; const newLine = getNewLineCharacter(options); const compilerHost = { getSourceFile: (fileName) => fileName === normalizePath(inputFileName) ? sourceFile : fileName === normalizePath(barebonesLibName) ? barebonesLibSourceFile : undefined, @@ -123681,8 +124330,7 @@ interface Symbol { } let outputText; let sourceMapText; - const inputs = declaration ? [inputFileName, barebonesLibName] : [inputFileName]; - const program = createProgram(inputs, options, compilerHost); + const program = createProgram([inputFileName], options, compilerHost); if (transpileOptions.reportDiagnostics) { addRange(diagnostics, program.getSyntacticDiagnostics(sourceFile)); addRange(diagnostics, program.getOptionsDiagnostics()); @@ -123721,7 +124369,7 @@ interface Symbol { __export(ts_NavigateTo_exports, { getNavigateToItems: () => getNavigateToItems }); - function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles, excludeLibFiles) { + function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles, excludeLibFiles, program) { const patternMatcher = createPatternMatcher(searchValue); if (!patternMatcher) return emptyArray; @@ -123732,26 +124380,26 @@ interface Symbol { if (excludeDtsFiles && sourceFile.isDeclarationFile) { continue; } - if (shouldExcludeFile(sourceFile, !!excludeLibFiles, singleCurrentFile)) { + if (shouldExcludeFile(sourceFile, !!excludeLibFiles, singleCurrentFile, program)) { continue; } sourceFile.getNamedDeclarations().forEach((declarations, name) => { - getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, sourceFile.fileName, !!excludeLibFiles, singleCurrentFile, rawItems); + getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, sourceFile.fileName, !!excludeLibFiles, singleCurrentFile, rawItems, program); }); } rawItems.sort(compareNavigateToItems); return (maxResultCount === undefined ? rawItems : rawItems.slice(0, maxResultCount)).map(createNavigateToItem); } - function shouldExcludeFile(file, excludeLibFiles, singleCurrentFile) { - return file !== singleCurrentFile && excludeLibFiles && (isInsideNodeModules(file.path) || file.hasNoDefaultLib); + function shouldExcludeFile(file, excludeLibFiles, singleCurrentFile, program) { + return file !== singleCurrentFile && excludeLibFiles && (isInsideNodeModules(file.path) || program.isSourceFileDefaultLibrary(file)); } - function getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, fileName, excludeLibFiles, singleCurrentFile, rawItems) { + function getItemsFromNamedDeclaration(patternMatcher, name, declarations, checker, fileName, excludeLibFiles, singleCurrentFile, rawItems, program) { const match = patternMatcher.getMatchForLastSegmentOfPattern(name); if (!match) { return; } for (const declaration of declarations) { - if (!shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile)) + if (!shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile, program)) continue; if (patternMatcher.patternContainsDots) { const fullMatch = patternMatcher.getFullMatch(getContainers(declaration), name); @@ -123763,7 +124411,7 @@ interface Symbol { } } } - function shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile) { + function shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile, program) { var _a; switch (declaration.kind) { case 274: @@ -123771,7 +124419,7 @@ interface Symbol { case 272: const importer = checker.getSymbolAtLocation(declaration.name); const imported = checker.getAliasedSymbol(importer); - return importer.escapedName !== imported.escapedName && !((_a = imported.declarations) == null ? undefined : _a.every((d) => shouldExcludeFile(d.getSourceFile(), excludeLibFiles, singleCurrentFile))); + return importer.escapedName !== imported.escapedName && !((_a = imported.declarations) == null ? undefined : _a.every((d) => shouldExcludeFile(d.getSourceFile(), excludeLibFiles, singleCurrentFile, program))); default: return true; } @@ -124065,8 +124713,8 @@ interface Symbol { addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; case 278: { - const expression2 = node.expression; - const child = isObjectLiteralExpression(expression2) || isCallExpression(expression2) ? expression2 : isArrowFunction(expression2) || isFunctionExpression(expression2) ? expression2.body : undefined; + const expression2 = skipOuterExpressions(node.expression); + const child = isObjectLiteralExpression(expression2) || isCallExpression(expression2) || isClassExpression(expression2) ? expression2 : isArrowFunction(expression2) || isFunctionExpression(expression2) ? expression2.body : undefined; if (child) { startNode(node); addChildrenRecursively(child); @@ -128589,7 +129237,7 @@ ${newComment.split(` 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 | 131072)) { + } else if (checker.getTypeAtLocation(expression).flags & (16 | 262144)) { expressionDiagnostic = createDiagnosticForNode(expression, Messages.uselessConstantType); } for (const scope of scopes) { @@ -129614,25 +130262,25 @@ ${newComment.split(` return this.checker.getDefaultFromTypeParameter(this); } isUnion() { - return !!(this.flags & 1048576); + return !!(this.flags & 134217728); } isIntersection() { - return !!(this.flags & 2097152); + return !!(this.flags & 268435456); } isUnionOrIntersection() { - return !!(this.flags & 3145728); + return !!(this.flags & 402653184); } isLiteral() { - return !!(this.flags & (128 | 256 | 2048)); + return !!(this.flags & (1024 | 2048 | 4096)); } isStringLiteral() { - return !!(this.flags & 128); + return !!(this.flags & 1024); } isNumberLiteral() { - return !!(this.flags & 256); + return !!(this.flags & 2048); } isTypeParameter() { - return !!(this.flags & 262144); + return !!(this.flags & 524288); } isClassOrInterface() { return !!(getObjectFlags(this) & 3); @@ -129641,7 +130289,7 @@ ${newComment.split(` return !!(getObjectFlags(this) & 1); } isIndexType() { - return !!(this.flags & 4194304); + return !!(this.flags & 2097152); } get typeArguments() { if (getObjectFlags(this) & 4) { @@ -129950,7 +130598,7 @@ ${newComment.split(` } function getDefaultCompilerOptions2() { return { - target: 1, + target: 12, jsx: 1 }; } @@ -130686,7 +131334,7 @@ ${newComment.split(` function getNavigateToItems2(searchValue, maxResultCount, fileName, excludeDtsFiles = false, excludeLibFiles = false) { synchronizeHostData(); const sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles(); - return getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles, excludeLibFiles); + return getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles, excludeLibFiles, program); } function getEmitOutput(fileName, emitOnlyDtsFiles, forceDtsEmit) { synchronizeHostData(); @@ -131435,6 +132083,7 @@ ${newComment.split(` return checker.getSymbolAtLocation(node); } function getPropertySymbolsFromContextualType(node, checker, contextualType, unionSymbolOk) { + contextualType = contextualType.getNonNullableType(); const name = getNameFromPropertyName(node.name); if (!name) return emptyArray; @@ -136872,7 +137521,7 @@ ${newComment.split(` return { kind: 0, token, call, modifierFlags, parentDeclaration: declaration, declSourceFile, isJSFile }; } const enumDeclaration = find(symbol.declarations, isEnumDeclaration); - if (enumDeclaration && !(leftExpressionType.flags & 1056) && !isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { + if (enumDeclaration && !(leftExpressionType.flags & 98304) && !isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { return { kind: 1, token, parentDeclaration: enumDeclaration }; } return; @@ -137002,7 +137651,7 @@ ${newComment.split(` function addEnumMemberDeclaration(changes, checker, { token, parentDeclaration }) { const hasStringInitializer = some(parentDeclaration.members, (member) => { const type = checker.getTypeAtLocation(member); - return !!(type && type.flags & 402653316); + return !!(type && type.flags & 12583968); }); const sourceFile = parentDeclaration.getSourceFile(); const enumMember = factory.createEnumMember(token, hasStringInitializer ? factory.createStringLiteral(token.text) : undefined); @@ -137062,40 +137711,40 @@ ${newComment.split(` if (type.flags & 3) { return createUndefined(); } - if (type.flags & (4 | 134217728)) { + if (type.flags & (32 | 4194304)) { return factory.createStringLiteral("", quotePreference === 0); } - if (type.flags & 8) { + if (type.flags & 64) { return factory.createNumericLiteral(0); } - if (type.flags & 64) { + if (type.flags & 128) { return factory.createBigIntLiteral("0n"); } - if (type.flags & 16) { + if (type.flags & 256) { return factory.createFalse(); } - if (type.flags & 1056) { + if (type.flags & 98304) { const enumMember = type.symbol.exports ? firstOrUndefinedIterator(type.symbol.exports.values()) : type.symbol; const symbol = type.symbol.parent && type.symbol.parent.flags & 256 ? type.symbol.parent : type.symbol; const name = checker.symbolToExpression(symbol, 111551, undefined, 64); return enumMember === undefined || name === undefined ? factory.createNumericLiteral(0) : factory.createPropertyAccessExpression(name, checker.symbolToString(enumMember)); } - if (type.flags & 256) { + if (type.flags & 2048) { return factory.createNumericLiteral(type.value); } - if (type.flags & 2048) { + if (type.flags & 4096) { return factory.createBigIntLiteral(type.value); } - if (type.flags & 128) { + if (type.flags & 1024) { return factory.createStringLiteral(type.value, quotePreference === 0); } - if (type.flags & 512) { + if (type.flags & 8192) { return type === checker.getFalseType() || type === checker.getFalseType(true) ? factory.createFalse() : factory.createTrue(); } - if (type.flags & 65536) { + if (type.flags & 8) { return factory.createNull(); } - if (type.flags & 1048576) { + if (type.flags & 134217728) { const expression = firstDefined(type.types, (t) => tryGetValueFromType(context, checker, importAdder, quotePreference, t, enclosingDeclaration)); return expression ?? createUndefined(); } @@ -137134,7 +137783,7 @@ ${newComment.split(` return factory.createIdentifier("undefined"); } function isObjectLiteralType(type) { - return type.flags & 524288 && (getObjectFlags(type) & 128 || type.symbol && tryCast(singleOrUndefined(type.symbol.declarations), isTypeLiteralNode)); + return type.flags & 1048576 && (getObjectFlags(type) & 128 || type.symbol && tryCast(singleOrUndefined(type.symbol.declarations), isTypeLiteralNode)); } function getUnmatchedAttributes(checker, target, source) { const attrsType = checker.getContextualType(source.attributes); @@ -137406,6 +138055,8 @@ ${newComment.split(` var errorCodes31 = [ errorCodeCannotFindModule, Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code, + Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode.code, + Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig.code, errorCannotFindImplicitJsxImport ]; registerCodeFix({ @@ -137451,7 +138102,13 @@ ${newComment.split(` } function getTypesPackageNameToInstall(packageName, host, diagCode) { var _a; - return diagCode === errorCodeCannotFindModule ? nodeCoreModules.has(packageName) ? "@types/node" : undefined : ((_a = host.isKnownTypesPackageName) == null ? undefined : _a.call(host, packageName)) ? getTypesPackageName(packageName) : undefined; + if (nodeCoreModules.has(packageName)) { + return "@types/node"; + } + if (diagCode !== errorCodeCannotFindModule) { + return ((_a = host.isKnownTypesPackageName) == null ? undefined : _a.call(host, packageName)) ? getTypesPackageName(packageName) : undefined; + } + return; } var errorCodes32 = [ Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code, @@ -138356,7 +139013,7 @@ ${newComment.split(` if (!info) return; const { typeNode, type } = info; - const fixedType = typeNode.kind === 315 && fixId56 === fixIdNullable ? checker.getNullableType(type, 32768) : type; + const fixedType = typeNode.kind === 315 && fixId56 === fixIdNullable ? checker.getNullableType(type, 4) : type; doChange29(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -138618,7 +139275,7 @@ ${newComment.split(` } const variableDeclaration = findAncestor(targetNode, isVariableDeclaration); const type = variableDeclaration && typeChecker.getTypeAtLocation(variableDeclaration); - if (type && type.flags & 8192) { + if (type && type.flags & 16384) { return; } if (!(isExpressionTarget || isShorthandPropertyAssignmentTarget)) @@ -138945,7 +139602,7 @@ ${newComment.split(` mutatedTarget: false }; function getFlags(type2) { - return (isVariableDeclaration(node) || isPropertyDeclaration(node) && hasSyntacticModifier(node, 256 | 8)) && type2.flags & 8192 ? 1048576 : 0; + return (isVariableDeclaration(node) || isPropertyDeclaration(node) && hasSyntacticModifier(node, 256 | 8)) && type2.flags & 16384 ? 1048576 : 0; } } function createTypeOfFromEntityNameExpression(node) { @@ -139792,7 +140449,7 @@ ${newComment.split(` case 32: case 34: const operandType = checker.getTypeAtLocation(parent2.left === node ? parent2.right : parent2.left); - if (operandType.flags & 1056) { + if (operandType.flags & 98304) { addCandidateType(usage, operandType); } else { usage.isNumber = true; @@ -139801,11 +140458,11 @@ ${newComment.split(` case 65: case 40: const otherOperandType = checker.getTypeAtLocation(parent2.left === node ? parent2.right : parent2.left); - if (otherOperandType.flags & 1056) { + if (otherOperandType.flags & 98304) { addCandidateType(usage, otherOperandType); - } else if (otherOperandType.flags & 296) { + } else if (otherOperandType.flags & 67648) { usage.isNumber = true; - } else if (otherOperandType.flags & 402653316) { + } else if (otherOperandType.flags & 12583968) { usage.isString = true; } else if (otherOperandType.flags & 1) {} else { usage.isNumberOrString = true; @@ -139875,7 +140532,7 @@ ${newComment.split(` const indexType = checker.getTypeAtLocation(parent2.argumentExpression); const indexUsage = createEmptyUsage(); calculateUsageOfNode(parent2, indexUsage); - if (indexType.flags & 296) { + if (indexType.flags & 67648) { usage.numberIndex = indexUsage; } else { usage.stringIndex = indexUsage; @@ -139914,11 +140571,11 @@ ${newComment.split(` low: (t) => t === stringNumber }, { - high: (t) => !(t.flags & (1 | 16384)), - low: (t) => !!(t.flags & (1 | 16384)) + high: (t) => !(t.flags & (1 | 16)), + low: (t) => !!(t.flags & (1 | 16)) }, { - high: (t) => !(t.flags & (98304 | 1 | 16384)) && !(getObjectFlags(t) & 16), + high: (t) => !(t.flags & (12 | 1 | 16)) && !(getObjectFlags(t) & 16), low: (t) => !!(getObjectFlags(t) & 16) } ]; @@ -140062,7 +140719,7 @@ ${newComment.split(` function inferTypeParameters(genericType, usageType, typeParameter) { if (genericType === typeParameter) { return [usageType]; - } else if (genericType.flags & 3145728) { + } else if (genericType.flags & 402653184) { return flatMap(genericType.types, (t) => inferTypeParameters(t, usageType, typeParameter)); } else if (getObjectFlags(genericType) & 4 && getObjectFlags(usageType) & 4) { const genericArgs = checker.getTypeArguments(genericType); @@ -140125,12 +140782,12 @@ ${newComment.split(` return checker.createSignature(undefined, undefined, undefined, parameters2, returnType, undefined, length2, 0); } function addCandidateType(usage, type) { - if (type && !(type.flags & 1) && !(type.flags & 131072)) { + if (type && !(type.flags & 1) && !(type.flags & 262144)) { (usage.candidateTypes || (usage.candidateTypes = [])).push(type); } } function addCandidateThisType(usage, type) { - if (type && !(type.flags & 1) && !(type.flags & 131072)) { + if (type && !(type.flags & 1) && !(type.flags & 262144)) { (usage.candidateThisTypes || (usage.candidateThisTypes = [])).push(type); } } @@ -140556,7 +141213,7 @@ ${newComment.split(` if (type.isUnionOrIntersection()) { return type.types.some(typeContainsTypeParameter); } - return type.flags & 262144; + return type.flags & 524288; } function getArgumentTypesAndTypeParameters(checker, importAdder, instanceTypes, contextNode, scriptTarget, flags, internalFlags, tracker) { const argumentTypeNodes = []; @@ -140584,11 +141241,11 @@ ${newComment.split(` return { argumentTypeNodes, argumentTypeParameters: arrayFrom(argumentTypeParameters.entries()) }; } function isAnonymousObjectConstraintType(type) { - return type.flags & 524288 && type.objectFlags === 16; + return type.flags & 1048576 && type.objectFlags === 16; } function getFirstTypeParameterName(type) { var _a; - if (type.flags & (1048576 | 2097152)) { + if (type.flags & (134217728 | 268435456)) { for (const subType of type.types) { const subTypeName = getFirstTypeParameterName(subType); if (subTypeName) { @@ -140596,7 +141253,7 @@ ${newComment.split(` } } } - return type.flags & 262144 ? (_a = type.getSymbol()) == null ? undefined : _a.getName() : undefined; + return type.flags & 524288 ? (_a = type.getSymbol()) == null ? undefined : _a.getName() : undefined; } function createDummyParameters(argCount, names, types, minArgumentCount, inJs) { const parameters = []; @@ -141056,13 +141713,13 @@ ${newComment.split(` return getDefaultValueFromType(checker, checker.getTypeFromTypeNode(propertyDeclaration.type)); } function getDefaultValueFromType(checker, type) { - if (type.flags & 512) { + if (type.flags & 8192) { return type === checker.getFalseType() || type === checker.getFalseType(true) ? factory.createFalse() : factory.createTrue(); } else if (type.isStringLiteral()) { return factory.createStringLiteral(type.value); } else if (type.isNumberLiteral()) { return factory.createNumericLiteral(type.value); - } else if (type.flags & 2048) { + } else if (type.flags & 4096) { return factory.createBigIntLiteral(type.value); } else if (type.isUnion()) { return firstDefined(type.types, (t) => getDefaultValueFromType(checker, t)); @@ -141575,6 +142232,7 @@ ${newComment.split(` getCompletionEntryDetails: () => getCompletionEntryDetails, getCompletionEntrySymbol: () => getCompletionEntrySymbol, getCompletionsAtPosition: () => getCompletionsAtPosition, + getConstraintOfTypeArgumentProperty: () => getConstraintOfTypeArgumentProperty, getDefaultCommitCharacters: () => getDefaultCommitCharacters, getPropertiesForObjectExpression: () => getPropertiesForObjectExpression, moduleSpecifierResolutionCacheAttemptLimit: () => moduleSpecifierResolutionCacheAttemptLimit, @@ -141625,7 +142283,7 @@ ${newComment.split(` SymbolOriginInfoKind2[SymbolOriginInfoKind2["Ignore"] = 256] = "Ignore"; SymbolOriginInfoKind2[SymbolOriginInfoKind2["ComputedPropertyName"] = 512] = "ComputedPropertyName"; SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberNoExport"] = 2] = "SymbolMemberNoExport"; - SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberExport"] = 6] = "SymbolMemberExport"; + SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberExport"] = 34] = "SymbolMemberExport"; return SymbolOriginInfoKind2; })(SymbolOriginInfoKind || {}); function originIsThisType(origin) { @@ -141638,7 +142296,7 @@ ${newComment.split(` return !!(origin && origin.kind & 4); } function originIsResolvedExport(origin) { - return !!(origin && origin.kind === 32); + return !!(origin && origin.kind & 32); } function originIncludesSymbolName(origin) { return originIsExport(origin) || originIsResolvedExport(origin) || originIsComputedPropertyName(origin); @@ -141973,7 +142631,7 @@ ${newComment.split(` } else { if (initializer) { const inferredType = checker.getTypeAtLocation(initializer.parent); - if (!(inferredType.flags & (1 | 16384))) { + if (!(inferredType.flags & (1 | 16))) { const sourceFile = initializer.getSourceFile(); const quotePreference = getQuotePreference(sourceFile, preferences); const builderFlags = quotePreference === 0 ? 268435456 : 0; @@ -142154,7 +142812,7 @@ ${newComment.split(` const importAdder = ts_codefix_exports.createImportAdder(sourceFile, program, preferences, host); const elements = []; for (const type of switchType.types) { - if (type.flags & 1024) { + if (type.flags & 32768) { Debug.assert(type.symbol, "An enum member type should have a symbol"); Debug.assert(type.symbol.parent, "An enum member type should have a parent symbol (the enum symbol)"); const enumValue = type.symbol.valueDeclaration && checker.getConstantValue(type.symbol.valueDeclaration); @@ -142430,8 +143088,8 @@ ${newComment.split(` if (isJsxIdentifierExpected && !isRightOfOpenTag && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle && preferences.jsxAttributeCompletionStyle !== "none" && !(isJsxAttribute(location.parent) && location.parent.initializer)) { let useBraces2 = preferences.jsxAttributeCompletionStyle === "braces"; const type = typeChecker.getTypeOfSymbolAtLocation(symbol, location); - if (preferences.jsxAttributeCompletionStyle === "auto" && !(type.flags & 528) && !(type.flags & 1048576 && find(type.types, (type2) => !!(type2.flags & 528)))) { - if (type.flags & 402653316 || type.flags & 1048576 && every(type.types, (type2) => !!(type2.flags & (402653316 | 32768) || isStringAndEmptyAnonymousObjectIntersection(type2)))) { + if (preferences.jsxAttributeCompletionStyle === "auto" && !(type.flags & 8448) && !(type.flags & 134217728 && find(type.types, (type2) => !!(type2.flags & 8448)))) { + if (type.flags & 12583968 || type.flags & 134217728 && every(type.types, (type2) => !!(type2.flags & (12583968 | 4) || isStringAndEmptyAnonymousObjectIntersection(type2)))) { insertText = `${escapeSnippetText(name)}=${quote(sourceFile, preferences, "$1")}`; isSnippet = true; } else { @@ -142684,8 +143342,8 @@ ${newComment.split(` case 173: case 174: case 175: { - let effectiveType = type.flags & 1048576 && type.types.length < 10 ? checker.getUnionType(type.types, 2) : type; - if (effectiveType.flags & 1048576) { + let effectiveType = type.flags & 134217728 && type.types.length < 10 ? checker.getUnionType(type.types, 2) : type; + if (effectiveType.flags & 134217728) { const functionTypes = filter(effectiveType.types, (type2) => checker.getSignaturesOfType(type2, 0).length > 0); if (functionTypes.length === 1) { effectiveType = functionTypes[0]; @@ -142880,12 +143538,12 @@ ${newComment.split(` return localSymbol === recommendedCompletion || !!(localSymbol.flags & 1048576) && checker.getExportSymbolOfSymbol(localSymbol) === recommendedCompletion; } function getSourceFromOrigin(origin) { - if (originIsExport(origin)) { - return stripQuotes(origin.moduleSymbol.name); - } if (originIsResolvedExport(origin)) { return origin.moduleSpecifier; } + if (originIsExport(origin)) { + return stripQuotes(origin.moduleSymbol.name); + } if ((origin == null ? undefined : origin.kind) === 1) { return "ThisProperty/"; } @@ -143454,10 +144112,10 @@ ${newComment.split(` } } log("getCompletionData: Semantic work: " + (timestamp() - semanticStart)); - const contextualType = previousToken && getContextualType(previousToken, position, sourceFile, typeChecker); + const contextualTypeOrConstraint = previousToken && (getContextualType(previousToken, position, sourceFile, typeChecker) ?? getConstraintOfTypeArgumentProperty(previousToken, typeChecker)); const isLiteralExpected = !tryCast(previousToken, isStringLiteralLike) && !isJsxIdentifierExpected; - const literals = !isLiteralExpected ? [] : mapDefined(contextualType && (contextualType.isUnion() ? contextualType.types : [contextualType]), (t) => t.isLiteral() && !(t.flags & 1024) ? t.value : undefined); - const recommendedCompletion = previousToken && contextualType && getRecommendedCompletion(previousToken, contextualType, typeChecker); + const literals = !isLiteralExpected ? [] : mapDefined(contextualTypeOrConstraint && (contextualTypeOrConstraint.isUnion() ? contextualTypeOrConstraint.types : [contextualTypeOrConstraint]), (t) => t.isLiteral() && !(t.flags & 32768) ? t.value : undefined); + const recommendedCompletion = previousToken && contextualTypeOrConstraint && getRecommendedCompletion(previousToken, contextualTypeOrConstraint, typeChecker); return { kind: 0, symbols, @@ -143633,7 +144291,7 @@ ${newComment.split(` }], position, isValidTypeOnlyAliasUseSite(location)) || {}; if (moduleSpecifier) { const origin = { - kind: getNullableSymbolOriginInfoKind(6), + kind: getNullableSymbolOriginInfoKind(34), moduleSymbol, isDefaultExport: false, symbolName: firstAccessibleSymbol.name, @@ -143832,9 +144490,6 @@ ${newComment.split(` return true; return charactersFuzzyMatchInString(symbolName2, lowerCaseTokenText); }, (info, symbolName2, isFromAmbientModule, exportMapKey) => { - if (detailsEntryId && !some(info, (i) => detailsEntryId.source === stripQuotes(i.moduleSymbol.name))) { - return; - } info = filter(info, isImportableExportInfo); if (!info.length) { return; @@ -143846,6 +144501,9 @@ ${newComment.split(` if (result !== "skipped") { ({ exportInfo: exportInfo2 = info[0], moduleSpecifier } = result); } + if (detailsEntryId && (detailsEntryId.source !== moduleSpecifier && !some(info, (i) => detailsEntryId.source === stripQuotes(i.moduleSymbol.name)))) { + return; + } const isDefaultExport = exportInfo2.exportKind === 1; const symbol = isDefaultExport && getLocalSymbolForExportDefault(Debug.checkDefined(exportInfo2.symbol)) || Debug.checkDefined(exportInfo2.symbol); pushAutoImportSymbol(symbol, { @@ -144757,7 +145415,7 @@ ${newComment.split(` } function getPropertiesForObjectExpression(contextualType, completionsType, obj, checker) { const hasCompletionsType = completionsType && completionsType !== contextualType; - const promiseFilteredContextualType = checker.getUnionType(filter(contextualType.flags & 1048576 ? contextualType.types : [contextualType], (t) => !checker.getPromisedTypeOfPromise(t))); + const promiseFilteredContextualType = checker.getUnionType(filter(contextualType.flags & 134217728 ? contextualType.types : [contextualType], (t) => !checker.getPromisedTypeOfPromise(t))); const type = hasCompletionsType && !(completionsType.flags & 3) ? checker.getUnionType([promiseFilteredContextualType, completionsType]) : promiseFilteredContextualType; const properties = getApparentProperties(type, obj, checker); return type.isClass() && containsNonPublicProperties(properties) ? [] : hasCompletionsType ? filter(properties, hasDeclarationOtherThanSelf) : properties; @@ -144770,7 +145428,7 @@ ${newComment.split(` function getApparentProperties(type, node, checker) { if (!type.isUnion()) return type.getApparentProperties(); - return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 402784252 || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties())))); + return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 12713980 || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties())))); } function containsNonPublicProperties(props) { return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 6)); @@ -144854,8 +145512,10 @@ ${newComment.split(` function getConstraintOfTypeArgumentProperty(node, checker) { if (!node) return; - if (isTypeNode(node) && isTypeReferenceType(node.parent)) { - return checker.getTypeArgumentConstraint(node); + if (isTypeNode(node)) { + const constraint = checker.getTypeArgumentConstraint(node); + if (constraint) + return constraint; } const t = getConstraintOfTypeArgumentProperty(node.parent, checker); if (!t) @@ -144863,10 +145523,17 @@ ${newComment.split(` switch (node.kind) { case 172: return checker.getTypeOfPropertyOfContextualType(t, node.symbol.escapedName); + case 59: + if (node.parent.kind === 172) { + return t; + } + break; case 194: case 188: case 193: return t; + case 23: + return checker.getElementTypeOfArrayType(t); } } function isFromObjectTypeDeclaration(node) { @@ -145264,7 +145931,12 @@ ${newComment.split(` if (isObjectLiteralExpression(parent2.parent) && parent2.name === node) { return stringLiteralCompletionsForObjectLiteral(typeChecker, parent2.parent); } - return fromContextualType() || fromContextualType(0); + if (findAncestor(parent2.parent, isCallLikeExpression)) { + const uniques2 = /* @__PURE__ */ new Set; + const stringLiteralTypes = concatenate(getStringLiteralTypes(typeChecker.getContextualType(node, 0), uniques2), getStringLiteralTypes(typeChecker.getContextualType(node, 4), uniques2)); + return toStringLiteralCompletionsFromTypes(stringLiteralTypes); + } + return fromContextualType(0); case 213: { const { expression, argumentExpression } = parent2; if (node === skipParentheses(argumentExpression)) { @@ -145325,7 +145997,12 @@ ${newComment.split(` } function fromUnionableLiteralType(grandParent) { switch (grandParent.kind) { + case 214: case 234: + case 287: + case 286: + case 215: + case 216: case 184: { const typeArgument = findAncestor(parent2, (n) => n.parent === grandParent); if (typeArgument) { @@ -145339,6 +146016,8 @@ ${newComment.split(` return; } return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType)); + case 172: + return { kind: 2, types: getStringLiteralTypes(getConstraintOfTypeArgumentProperty(grandParent, typeChecker)), isNewIdentifier: false }; case 193: { const result = fromUnionableLiteralType(walkUpParentheses(grandParent.parent)); if (!result) { @@ -145355,13 +146034,12 @@ ${newComment.split(` } } function fromContextualType(contextFlags = 4) { - const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags)); - if (!types.length) { - return; - } - return { kind: 2, types, isNewIdentifier: false }; + return toStringLiteralCompletionsFromTypes(getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags))); } } + function toStringLiteralCompletionsFromTypes(types) { + return types.length ? { kind: 2, types, isNewIdentifier: false } : undefined; + } function walkUpParentheses(node) { switch (node.kind) { case 197: @@ -145390,7 +146068,7 @@ ${newComment.split(` type = propType; } } - isNewIdentifier = isNewIdentifier || !!(type.flags & 4); + isNewIdentifier = isNewIdentifier || !!(type.flags & 32); return getStringLiteralTypes(type, uniques); }); return length(types) ? { kind: 2, types, isNewIdentifier } : undefined; @@ -145418,7 +146096,7 @@ ${newComment.split(` if (!type) return emptyArray; type = skipConstraint(type); - return type.isUnion() ? flatMap(type.types, (t) => getStringLiteralTypes(t, uniques)) : type.isStringLiteral() && !(type.flags & 1024) && addToSeen(uniques, type.value) ? [type] : emptyArray; + return type.isUnion() ? flatMap(type.types, (t) => getStringLiteralTypes(t, uniques)) : type.isStringLiteral() && !(type.flags & 32768) && addToSeen(uniques, type.value) ? [type] : emptyArray; } function nameAndKind(name, kind, extension) { return { name, kind, extension }; @@ -145681,8 +146359,9 @@ ${newComment.split(` if (tryFileExists(host, packageFile)) { const packageJson = readJson(packageFile, host); const fragmentSubpath = components.join("/") + (components.length && hasTrailingDirectorySeparator(fragment) ? "/" : ""); - exportsOrImportsLookup(packageJson.exports, fragmentSubpath, packageDirectory, true, false); - return; + if (exportsOrImportsLookup(packageJson.exports, fragmentSubpath, packageDirectory, true, false)) { + return; + } } return nodeModulesDirectoryOrImportsLookup(ancestor); }; @@ -145693,7 +146372,7 @@ ${newComment.split(` return arrayFrom(result.values()); function exportsOrImportsLookup(lookupTable, fragment2, baseDirectory, isExports, isImports) { if (typeof lookupTable !== "object" || lookupTable === null) { - return; + return lookupTable !== undefined; } const keys = getOwnKeys(lookupTable); const conditions = getConditions(compilerOptions, mode); @@ -145704,6 +146383,7 @@ ${newComment.split(` } return singleElementArray(endsWith(key, "/") && endsWith(pattern, "/") ? pattern + "*" : pattern); }, comparePatternKeys); + return true; } } function getPatternFromFirstMatchingCondition(target, conditions) { @@ -148272,7 +148952,17 @@ ${newComment.split(` if (element) { const contextualType = element && typeChecker.getContextualType(element.parent); if (contextualType) { - return flatMap(getPropertySymbolsFromContextualType(element, typeChecker, contextualType, false), (propertySymbol) => getDefinitionFromSymbol(typeChecker, propertySymbol, node)); + let properties = getPropertySymbolsFromContextualType(element, typeChecker, contextualType, false); + if (some(properties, (p) => !!(p.valueDeclaration && isObjectLiteralExpression(p.valueDeclaration.parent) && isObjectLiteralElementLike(p.valueDeclaration) && p.valueDeclaration.name === node))) { + const withoutNodeInferencesType = typeChecker.getContextualType(element.parent, 4); + if (withoutNodeInferencesType) { + const withoutNodeInferencesProperties = getPropertySymbolsFromContextualType(element, typeChecker, withoutNodeInferencesType, false); + if (withoutNodeInferencesProperties.length) { + properties = withoutNodeInferencesProperties; + } + } + } + return flatMap(properties, (propertySymbol) => getDefinitionFromSymbol(typeChecker, propertySymbol, node)); } } return emptyArray; @@ -148426,7 +149116,7 @@ ${newComment.split(` return typeDefinitions.length ? [...getFirstTypeArgumentDefinitions(typeChecker, resolvedType, node, failedAliasResolution), ...typeDefinitions] : !(symbol.flags & 111551) && symbol.flags & 788968 ? getDefinitionFromSymbol(typeChecker, skipAlias(symbol, typeChecker), node, failedAliasResolution) : undefined; } function definitionFromType(type, checker, node, failedAliasResolution) { - return flatMap(type.isUnion() && !(type.flags & 32) ? type.types : [type], (t) => t.symbol && getDefinitionFromSymbol(checker, t.symbol, node, failedAliasResolution)); + return flatMap(type.isUnion() && !(type.flags & 65536) ? type.types : [type], (t) => t.symbol && getDefinitionFromSymbol(checker, t.symbol, node, failedAliasResolution)); } function tryGetReturnTypeOfFunction(symbol, type, checker) { if (type.symbol === symbol || symbol.valueDeclaration && type.symbol && isVariableDeclaration(symbol.valueDeclaration) && symbol.valueDeclaration.initializer === type.symbol.valueDeclaration) { @@ -149012,6 +149702,7 @@ ${newComment.split(` Debug.assertNode(node2, isTypeParameterDeclaration); if (node2.modifiers) { visitDisplayPartList(node2.modifiers, " "); + parts.push({ text: " " }); } visitForDisplayParts(node2.name); if (node2.constraint) { @@ -149027,6 +149718,7 @@ ${newComment.split(` Debug.assertNode(node2, isParameter); if (node2.modifiers) { visitDisplayPartList(node2.modifiers, " "); + parts.push({ text: " " }); } if (node2.dotDotDotToken) { parts.push({ text: "..." }); @@ -150859,7 +151551,7 @@ ${content} if (!symbol) { if (isStringLiteralLike(node)) { const type = getContextualTypeFromParentOrAncestorTypeNode(node, typeChecker); - if (type && (type.flags & 128 || type.flags & 1048576 && every(type.types, (type2) => !!(type2.flags & 128)))) { + if (type && (type.flags & 1024 || type.flags & 134217728 && every(type.types, (type2) => !!(type2.flags & 1024)))) { return getRenameInfoSuccess(node.text, node.text, "string", "", node, sourceFile); } } else if (isLabelName(node)) { @@ -156287,6 +156979,7 @@ ${options.prefix}` : ` canHaveLocals: () => canHaveLocals, canHaveModifiers: () => canHaveModifiers, canHaveModuleSpecifier: () => canHaveModuleSpecifier, + canHaveStatements: () => canHaveStatements, canHaveSymbol: () => canHaveSymbol, canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics, canJsonReportNoInputFiles: () => canJsonReportNoInputFiles, @@ -156334,6 +157027,7 @@ ${options.prefix}` : ` commonOptionsWithBuild: () => commonOptionsWithBuild, compact: () => compact, compareBooleans: () => compareBooleans, + compareComparableValues: () => compareComparableValues, compareDataObjects: () => compareDataObjects, compareDiagnostics: () => compareDiagnostics, compareEmitHelpers: () => compareEmitHelpers, @@ -156679,6 +157373,7 @@ ${options.prefix}` : ` getAllowImportingTsExtensions: () => getAllowImportingTsExtensions, getAllowJSCompilerOption: () => getAllowJSCompilerOption, getAllowSyntheticDefaultImports: () => getAllowSyntheticDefaultImports, + getAlwaysStrict: () => getAlwaysStrict, getAncestor: () => getAncestor, getAnyExtensionFromPath: () => getAnyExtensionFromPath, getAreDeclarationMapsEnabled: () => getAreDeclarationMapsEnabled, @@ -156708,6 +157403,7 @@ ${options.prefix}` : ` getCommonSourceDirectory: () => getCommonSourceDirectory, getCommonSourceDirectoryOfConfig: () => getCommonSourceDirectoryOfConfig, getCompilerOptionValue: () => getCompilerOptionValue, + getComputedCommonSourceDirectory: () => getComputedCommonSourceDirectory, getConditions: () => getConditions, getConfigFileParsingDiagnostics: () => getConfigFileParsingDiagnostics, getConstantValue: () => getConstantValue, @@ -156917,6 +157613,7 @@ ${options.prefix}` : ` getModuleInstanceState: () => getModuleInstanceState, getModuleNameStringLiteralAt: () => getModuleNameStringLiteralAt, getModuleSpecifierEndingPreference: () => getModuleSpecifierEndingPreference, + getModuleSpecifierOfBareOrAccessedRequire: () => getModuleSpecifierOfBareOrAccessedRequire, getModuleSpecifierResolverHost: () => getModuleSpecifierResolverHost, getNameForExportedSymbol: () => getNameForExportedSymbol, getNameFromImportAttribute: () => getNameFromImportAttribute, @@ -156947,7 +157644,6 @@ ${options.prefix}` : ` getNonAugmentationDeclaration: () => getNonAugmentationDeclaration, getNonDecoratorTokenPosOfNode: () => getNonDecoratorTokenPosOfNode, getNonIncrementalBuildInfoRoots: () => getNonIncrementalBuildInfoRoots, - getNonModifierTokenPosOfNode: () => getNonModifierTokenPosOfNode, getNormalizedAbsolutePath: () => getNormalizedAbsolutePath, getNormalizedAbsolutePathWithoutRoot: () => getNormalizedAbsolutePathWithoutRoot, getNormalizedPathComponents: () => getNormalizedPathComponents, @@ -157678,6 +158374,7 @@ ${options.prefix}` : ` isPlusToken: () => isPlusToken, isPossiblyTypeArgumentPosition: () => isPossiblyTypeArgumentPosition, isPostfixUnaryExpression: () => isPostfixUnaryExpression, + isPotentiallyExecutableNode: () => isPotentiallyExecutableNode, isPrefixUnaryExpression: () => isPrefixUnaryExpression, isPrimitiveLiteralValue: () => isPrimitiveLiteralValue, isPrivateIdentifier: () => isPrivateIdentifier, @@ -158280,9 +158977,7 @@ ${options.prefix}` : ` unmangleScopedPackageName: () => unmangleScopedPackageName, unorderedRemoveItem: () => unorderedRemoveItem, unprefixedNodeCoreModules: () => unprefixedNodeCoreModules, - unreachableCodeIsError: () => unreachableCodeIsError, unsetNodeChildren: () => unsetNodeChildren, - unusedLabelIsError: () => unusedLabelIsError, unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel, unwrapParenthesizedExpression: () => unwrapParenthesizedExpression, updateErrorForNoInputFiles: () => updateErrorForNoInputFiles, @@ -158292,6 +158987,7 @@ ${options.prefix}` : ` updateSharedExtendedConfigFileWatcher: () => updateSharedExtendedConfigFileWatcher, updateSourceFile: () => updateSourceFile, updateWatchingWildcardDirectories: () => updateWatchingWildcardDirectories, + usesWildcardTypes: () => usesWildcardTypes, usingSingleLineStringWriter: () => usingSingleLineStringWriter, utf16EncodeAsString: () => utf16EncodeAsString, validateLocaleAndSetLanguage: () => validateLocaleAndSetLanguage, @@ -158641,6 +159337,22 @@ ${options.prefix}` : ` } installPackage(req) { const { fileName, packageName, projectName, projectRootPath, id } = req; + const validationResult = ts_JsTyping_exports.validatePackageName(packageName); + if (validationResult !== ts_JsTyping_exports.NameValidationResult.Ok) { + const message = ts_JsTyping_exports.renderPackageNameValidationFailure(validationResult, packageName); + if (this.log.isEnabled()) { + this.log.writeLine(message); + } + const response = { + kind: ActionPackageInstalled, + projectName, + id, + success: false, + message + }; + this.sendResponse(response); + return; + } const cwd = forEachAncestorDirectory(getDirectoryPath(fileName), (directory) => { if (this.installTypingHost.fileExists(combinePaths(directory, "package.json"))) { return directory; @@ -159263,9 +159975,11 @@ ${options.prefix}` : ` ScriptTarget12["ES2022"] = "es2022"; ScriptTarget12["ES2023"] = "es2023"; ScriptTarget12["ES2024"] = "es2024"; + ScriptTarget12["ES2025"] = "es2025"; ScriptTarget12["ESNext"] = "esnext"; ScriptTarget12["JSON"] = "json"; ScriptTarget12["Latest"] = "esnext"; + ScriptTarget12["LatestStandard"] = "es2025"; return ScriptTarget12; })(ScriptTarget11 || {}); {} @@ -160540,6 +161254,9 @@ ${options.prefix}` : ` this.projectService.updateTypingsForProject({ projectName: this.getProjectName(), kind: ActionInvalidate }); } watchTypingLocations(files) { + if (this.currentDirectory === this.projectService.currentDirectory || !canWatchDirectoryOrFilePath(this.toPath(this.currentDirectory))) { + return; + } if (!files) { this.typingWatchers.isInvoked = false; return; @@ -160594,6 +161311,13 @@ ${options.prefix}` : ` this.typingWatchers.delete(path); }); } + skipWatchingFailedLookups(path) { + const info = this.projectService.getScriptInfoForPath(path); + return info == null ? undefined : info.isDynamic; + } + skipWatchingTypeRoots() { + return isInferredProject(this) && this.currentDirectory === this.projectService.currentDirectory; + } getCurrentProgram() { return this.program; } @@ -161691,6 +162415,9 @@ ${options.prefix}` : ` protocolOptions[id] = mappedValues.get(propertyValue.toLowerCase()); } }); + if (isArray(protocolOptions.lib)) { + protocolOptions.lib = protocolOptions.lib.map((libName) => libMap.get(libName) ?? libName); + } return protocolOptions; } function convertWatchOptions(protocolOptions, currentDirectory) { diff --git a/examples/basic-app/app/islands/Counter.tsx b/examples/basic-app/app/islands/Counter.tsx new file mode 100644 index 00000000..cc83ea11 --- /dev/null +++ b/examples/basic-app/app/islands/Counter.tsx @@ -0,0 +1,10 @@ +import { useState } from "react"; + +export default function Counter({ start = 0 }: { start?: number }) { + const [count, setCount] = useState(start); + return ( + + ); +} diff --git a/packages/compiler/src/island-bundle.ts b/packages/compiler/src/island-bundle.ts index 964c379f..c6463334 100644 --- a/packages/compiler/src/island-bundle.ts +++ b/packages/compiler/src/island-bundle.ts @@ -1,7 +1,8 @@ import type { BunPlugin } from "bun"; import { createHash } from "node:crypto"; +import { mkdirSync, rmSync, writeFileSync } from "node:fs"; import { createRequire } from "node:module"; -import { join } from "node:path"; +import { basename, join } from "node:path"; export interface IslandInput { name: string; @@ -42,10 +43,15 @@ export function reactJsxPlugin(): BunPlugin { return { name: "wrnexus-island-jsx", setup(build) { - build.onLoad({ filter: /\.tsx$/ }, async (args) => ({ - contents: `/** @jsxImportSource react */\n${await Bun.file(args.path).text()}`, - loader: "tsx", - })); + build.onLoad({ filter: /\.tsx$/ }, async (args) => { + // Only first-party island sources need the pragma. Third-party .tsx + // under node_modules is left alone so Bun's own handling is untouched. + if (args.path.includes("node_modules")) return undefined; + return { + contents: `/** @jsxImportSource react */\n${await Bun.file(args.path).text()}`, + loader: "tsx" as const, + }; + }); }, }; } @@ -79,35 +85,57 @@ export async function buildIslands(input: { }): Promise { if (input.islands.length === 0) return { assets: [], sharedChunks: [] }; - const result = await Bun.build({ - entrypoints: input.islands.map((island) => island.sourcePath), - outdir: input.outDir, - target: "browser", - format: "esm", - splitting: true, - minify: true, - plugins: [reactJsxPlugin()], - }); + // Each island gets its own generated entry file named after the island. + // Passing the component sources directly would dedupe two islands that share + // a source file, and output order is not guaranteed to match input order — + // both of which silently mismatch island names to bundles. + // + // The entries live inside outDir so `react` resolves from the app that + // installed it, exactly as the island's own imports do. + const entryDir = join(input.outDir, ".entries"); + mkdirSync(entryDir, { recursive: true }); - if (!result.success) { - throw new AggregateError(result.logs, "Island bundling failed"); + const islandNames = new Set(input.islands.map((island) => island.name)); + for (const island of input.islands) { + writeFileSync(join(entryDir, `${island.name}.tsx`), generateIslandEntry(island), "utf8"); } - const assets: IslandBuildResult["assets"] = []; - const sharedChunks: string[] = []; + try { + const result = await Bun.build({ + entrypoints: input.islands.map((island) => join(entryDir, `${island.name}.tsx`)), + outdir: input.outDir, + target: "browser", + format: "esm", + splitting: true, + minify: true, + plugins: [reactJsxPlugin()], + }); - for (const output of result.outputs) { - if (output.kind === "entry-point") { - const island = input.islands[assets.length]!; - assets.push({ - name: island.name, - hash: createHash("sha256").update(output.path).digest("hex").slice(0, 16), - path: output.path, - }); - } else if (output.kind === "chunk") { - sharedChunks.push(output.path); + if (!result.success) { + throw new AggregateError(result.logs, "Island bundling failed"); } - } - return { assets, sharedChunks }; + const assets: IslandBuildResult["assets"] = []; + const sharedChunks: string[] = []; + + for (const output of result.outputs) { + if (output.kind === "entry-point") { + // Bun names an entry's output after its entry file, so the basename + // identifies the island unambiguously. + const stem = basename(output.path).replace(/\.js$/, ""); + if (!islandNames.has(stem)) continue; + assets.push({ + name: stem, + hash: createHash("sha256").update(output.path).digest("hex").slice(0, 16), + path: output.path, + }); + } else if (output.kind === "chunk") { + sharedChunks.push(output.path); + } + } + + return { assets, sharedChunks }; + } finally { + rmSync(entryDir, { recursive: true, force: true }); + } } diff --git a/packages/compiler/test/island-integration.test.ts b/packages/compiler/test/island-integration.test.ts new file mode 100644 index 00000000..b13c3dd9 --- /dev/null +++ b/packages/compiler/test/island-integration.test.ts @@ -0,0 +1,83 @@ +import { afterAll, beforeAll, expect, test } from "bun:test"; +import { mkdtempSync, readFileSync, readdirSync, rmSync } from "node:fs"; +import { join, resolve } from "node:path"; +import { routeNeedsIslands } from "../src/analysis.ts"; +import { buildIslands, type IslandBuildResult } from "../src/island-bundle.ts"; + +const COUNTER = resolve(import.meta.dir, "../../../examples/basic-app/app/islands/Counter.tsx"); + +const created: string[] = []; +afterAll(() => { + for (const dir of created) rmSync(dir, { recursive: true, force: true }); +}); + +function outDir(label: string): string { + const dir = mkdtempSync(join(process.cwd(), `.island-int-${label}-`)); + created.push(dir); + return dir; +} + +// Every assertion that needs a real bundle shares this one build. +// +// Not just for speed: `bun test` interferes with Bun.build's module reads once +// several build calls have run across test files in the same process, while the +// same calls succeed repeatedly outside the runner. Production is unaffected — +// the dev server's rebuild loop was verified separately — but tests must keep +// their build count low to stay reliable in the full suite. +let dir: string; +let result: IslandBuildResult; +let bundles: string[]; + +beforeAll(async () => { + dir = outDir("shared"); + result = await buildIslands({ + islands: [ + { name: "CounterA", sourcePath: COUNTER }, + { name: "CounterB", sourcePath: COUNTER }, + ], + outDir: dir, + }); + bundles = readdirSync(dir) + .filter((file) => file.endsWith(".js")) + .map((file) => readFileSync(join(dir, file), "utf8")); +}); + +test("a route with no islands ships zero framework JavaScript", async () => { + const empty = outDir("nojs"); + const none = await buildIslands({ islands: [], outDir: empty }); + + expect(none.assets).toHaveLength(0); + expect(none.sharedChunks).toHaveLength(0); + expect(readdirSync(empty)).toHaveLength(0); + expect(routeNeedsIslands([])).toBe(false); +}); + +test("a page with multiple islands ships React exactly once", () => { + // React's internals must appear in at most one emitted file — the shared + // chunk. If splitting regresses, every island inlines its own copy. + const withReactInternals = bundles.filter( + (source) => source.includes("REACT_ELEMENT_TYPE") || source.includes("react.development"), + ); + + expect(result.assets).toHaveLength(2); + expect(withReactInternals.length).toBeLessThanOrEqual(1); +}); + +test("two islands sharing one source get distinct, correctly named assets", () => { + // Passing component sources as entrypoints deduped them, so the second island + // silently lost its bundle and names could bind to the wrong output. + expect(result.assets.map((asset) => asset.name).sort()).toEqual(["CounterA", "CounterB"]); + expect(new Set(result.assets.map((asset) => asset.path)).size).toBe(2); +}); + +test("a real island builds against React and never pulls in the WRNexus renderer", () => { + const built = bundles.join("\n"); + + expect(built).not.toContain("wrnexus"); + expect(built).not.toContain("react-dom/server"); + expect(built).toContain("useState"); +}); + +test("the generated entry directory is not left behind in the output", () => { + expect(readdirSync(dir)).not.toContain(".entries"); +}); diff --git a/packages/react/README.md b/packages/react/README.md new file mode 100644 index 00000000..dcd8c82c --- /dev/null +++ b/packages/react/README.md @@ -0,0 +1,9 @@ +# @wrnexus/react + +Opt-in React islands for WRNexusJS: mount npm React components inside server-rendered `.wrn` pages without adopting React as the framework's rendering model. + +Import a `.tsx` component in a `.wrn` script block and use it as an element. The compiler emits a `data-wrn-island` placeholder instead of a server render, and this package's runtime mounts it in the browser with `createRoot`. Islands are client-only, each mounts inside its own error boundary, and roots are disposed on client-side navigation. + +`react` and `react-dom` are optional peer dependencies, so apps that use no islands ship no React. A route with no islands still ships zero framework JavaScript. + +Use `useWrnStore(name, selector?)` to read a WRNexus store from inside an island and `useWrnActions(name)` to write to it. Writes belong in event handlers or effects, never during render. diff --git a/scripts/build-editor-compiler.mjs b/scripts/build-editor-compiler.mjs index 98ae3b41..6a28ff64 100644 --- a/scripts/build-editor-compiler.mjs +++ b/scripts/build-editor-compiler.mjs @@ -34,13 +34,28 @@ function loadTypeScript() { const ts = loadTypeScript(); +// React island modules are not used by the editor: island-bundle.ts calls +// Bun.build and island-codegen.ts imports @wrnexus/core, neither of which +// exists in this Node-only bundle. They are unreachable from the editor entry, +// so excluding them keeps Bun-only code out of the extension entirely. +const EDITOR_EXCLUDED = ["island-bundle.ts", "island-codegen.ts"]; +function isEditorExcluded(path) { + return EDITOR_EXCLUDED.some((name) => path.endsWith(name)); +} + function walk(dir) { const files = []; for (const entry of readdirSync(dir)) { const path = join(dir, entry); const stat = statSync(path); if (stat.isDirectory()) files.push(...walk(path)); - else if (stat.isFile() && path.endsWith(".ts") && !path.endsWith(".test.ts")) files.push(path); + else if ( + stat.isFile() && + path.endsWith(".ts") && + !path.endsWith(".test.ts") && + !isEditorExcluded(path) + ) + files.push(path); } return files; } @@ -69,7 +84,6 @@ for (const file of sourceFiles) { compilerOptions: { target: ts.ScriptTarget.ES2022, module: ts.ModuleKind.CommonJS, - moduleResolution: ts.ModuleResolutionKind.Node10, esModuleInterop: true, skipLibCheck: true, sourceMap: false,