From 8f7fe892895acb15cc3207fdf44ed88774fa7319 Mon Sep 17 00:00:00 2001 From: Kristiyan Kostadinov Date: Wed, 25 Mar 2026 09:45:17 +0100 Subject: [PATCH] build: update to TypeScript 6 stable Updates to the stable version of TypeScript 6. --- MODULE.bazel | 6 +- MODULE.bazel.lock | 6 +- package.json | 2 +- .../blank/project-files/package.json | 2 +- .../blank/project-files/tsconfig.json | 4 +- .../schematic/files/package.json | 2 +- .../schematic/files/tsconfig.json | 2 +- packages/ngtools/webpack/package.json | 2 +- .../Microsoft/TypeScript/BUILD.bazel | 2 +- .../Microsoft/TypeScript/lib/typescript.d.ts | 128 +- .../Microsoft/TypeScript/lib/typescript.js | 4411 ++++++++++------- .../utility/latest-versions/package.json | 2 +- pnpm-lock.yaml | 160 +- .../assets/ssr-project-webpack/package.json | 2 +- .../assets/ssr-project-webpack/tsconfig.json | 3 +- tests/e2e/tests/build/ts-paths.ts | 14 +- 16 files changed, 2770 insertions(+), 1978 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 8651f5d9383e..a347c132304b 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -174,9 +174,9 @@ use_repo(npm, "npm") rules_ts_ext = use_extension("@aspect_rules_ts//ts:extensions.bzl", "ext") rules_ts_ext.deps( name = "angular_cli_npm_typescript", - # Obtained by: npm info typescript@6.0.1-rc dist.integrity - ts_integrity = "sha512-7XlzYb+p/7YxX6qSOzwB4mxVFRdAgWWkj1PgAZ+jzldeuFV6Z77vwFbNxHsUXAL/bhlWY2jCT8shLwDJR8337g==", - ts_version = "6.0.1-rc", + # Obtained by: npm info typescript@6.0.2 dist.integrity + ts_integrity = "sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==", + ts_version = "6.0.2", ) use_repo(rules_ts_ext, **{"npm_typescript": "angular_cli_npm_typescript"}) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 9c1f883a5e30..953c1d821f33 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -427,7 +427,7 @@ "@@aspect_rules_ts+//ts:extensions.bzl%ext": { "general": { "bzlTransitiveDigest": "GbfZLeEI0W26fAQ89dUljyLGSAkzkr3CkF+VDQ0IFlI=", - "usagesDigest": "NEcSh/CygeQtMiUvLufm5mltdm7VYYMKhoN+swz5Nb8=", + "usagesDigest": "M9vJ1ahjqDb8ONBLGfZdvp4Vq1o4Y6Xjfv/ZY7PlnYo=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, @@ -435,8 +435,8 @@ "angular_cli_npm_typescript": { "repoRuleId": "@@aspect_rules_ts+//ts/private:npm_repositories.bzl%http_archive_version", "attributes": { - "version": "6.0.1-rc", - "integrity": "sha512-7XlzYb+p/7YxX6qSOzwB4mxVFRdAgWWkj1PgAZ+jzldeuFV6Z77vwFbNxHsUXAL/bhlWY2jCT8shLwDJR8337g==", + "version": "6.0.2", + "integrity": "sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==", "urls": [ "https://registry.npmjs.org/typescript/-/typescript-{}.tgz" ] diff --git a/package.json b/package.json index 7143e92c8c27..1958b08c024a 100644 --- a/package.json +++ b/package.json @@ -128,7 +128,7 @@ "semver": "7.7.4", "source-map-support": "0.5.21", "tslib": "2.8.1", - "typescript": "6.0.1-rc", + "typescript": "6.0.2", "undici": "7.24.5", "unenv": "^1.10.0", "verdaccio": "6.3.2", diff --git a/packages/angular_devkit/schematics_cli/blank/project-files/package.json b/packages/angular_devkit/schematics_cli/blank/project-files/package.json index 1a912351a9b9..88693af94a7c 100644 --- a/packages/angular_devkit/schematics_cli/blank/project-files/package.json +++ b/packages/angular_devkit/schematics_cli/blank/project-files/package.json @@ -15,7 +15,7 @@ "dependencies": { "@angular-devkit/core": "^<%= coreVersion %>", "@angular-devkit/schematics": "^<%= schematicsVersion %>", - "typescript": "~5.9.2" + "typescript": "~6.0.2" }, "devDependencies": { "@types/node": "^20.17.19", diff --git a/packages/angular_devkit/schematics_cli/blank/project-files/tsconfig.json b/packages/angular_devkit/schematics_cli/blank/project-files/tsconfig.json index e1f6243c1a46..99391a4f8038 100644 --- a/packages/angular_devkit/schematics_cli/blank/project-files/tsconfig.json +++ b/packages/angular_devkit/schematics_cli/blank/project-files/tsconfig.json @@ -2,8 +2,8 @@ "compilerOptions": { "lib": ["es2018", "dom"], "declaration": true, - "module": "commonjs", - "moduleResolution": "node", + "module": "node16", + "moduleResolution": "node16", "noEmitOnError": true, "noFallthroughCasesInSwitch": true, "noImplicitAny": true, diff --git a/packages/angular_devkit/schematics_cli/schematic/files/package.json b/packages/angular_devkit/schematics_cli/schematic/files/package.json index 35fa17720131..c2aff5195638 100644 --- a/packages/angular_devkit/schematics_cli/schematic/files/package.json +++ b/packages/angular_devkit/schematics_cli/schematic/files/package.json @@ -20,6 +20,6 @@ "@types/node": "^20.17.19", "@types/jasmine": "~6.0.0", "jasmine": "~6.1.0", - "typescript": "~5.9.2" + "typescript": "~6.0.2" } } diff --git a/packages/angular_devkit/schematics_cli/schematic/files/tsconfig.json b/packages/angular_devkit/schematics_cli/schematic/files/tsconfig.json index 79285278e55c..db277e5fa543 100644 --- a/packages/angular_devkit/schematics_cli/schematic/files/tsconfig.json +++ b/packages/angular_devkit/schematics_cli/schematic/files/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "lib": ["es2018", "dom"], "module": "commonjs", - "moduleResolution": "node", + "moduleResolution": "bundler", "noEmitOnError": true, "noFallthroughCasesInSwitch": true, "noImplicitAny": true, diff --git a/packages/ngtools/webpack/package.json b/packages/ngtools/webpack/package.json index 300573b6a8df..5cf8f0089501 100644 --- a/packages/ngtools/webpack/package.json +++ b/packages/ngtools/webpack/package.json @@ -29,7 +29,7 @@ "@angular-devkit/core": "workspace:0.0.0-PLACEHOLDER", "@angular/compiler": "22.0.0-next.3", "@angular/compiler-cli": "22.0.0-next.3", - "typescript": "6.0.1-rc", + "typescript": "6.0.2", "webpack": "5.105.4" } } diff --git a/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/BUILD.bazel b/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/BUILD.bazel index b4ac5f975b5a..b04b3e0fa7cd 100644 --- a/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/BUILD.bazel +++ b/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/BUILD.bazel @@ -1,6 +1,6 @@ load("@aspect_rules_js//js:defs.bzl", "js_library") -# files fetched on 2025-08-01 +# files fetched on 2026-03-25 # Commands to update from node_modules: # cp node_modules/typescript/lib/typescript.d.ts packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts diff --git a/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts b/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts index 87942520f2ab..0f39eae746a0 100644 --- a/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts +++ b/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.d.ts @@ -7,7 +7,7 @@ License at http://www.apache.org/licenses/LICENSE-2.0 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. @@ -2530,6 +2530,7 @@ declare namespace ts { Node = "node", /** @deprecated Renamed to `Node10` */ NodeJs = "node", + /** @deprecated */ Node10 = "node10", Node16 = "node16", NodeNext = "nodenext", @@ -2542,6 +2543,7 @@ declare namespace ts { export enum ScriptTarget { /** @deprecated */ ES3 = "es3", + /** @deprecated */ ES5 = "es5", ES6 = "es6", ES2015 = "es2015", @@ -2554,9 +2556,11 @@ declare namespace ts { ES2022 = "es2022", ES2023 = "es2023", ES2024 = "es2024", + ES2025 = "es2025", ESNext = "esnext", JSON = "json", Latest = "esnext", + LatestStandard = "es2025", } } namespace typingsInstaller { @@ -3646,7 +3650,7 @@ declare namespace ts { readDirectory(rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[] | undefined, depth?: number): string[]; } } - const versionMajorMinor = "5.9"; + const versionMajorMinor = "6.0"; /** The version of the TypeScript compiler release */ const version: string; /** @@ -5907,7 +5911,6 @@ declare namespace ts { */ interface SourceFileLike { readonly text: string; - languageVariant?: LanguageVariant; } interface SourceFileLike { getLineAndCharacterOfPosition(pos: number): LineAndCharacter; @@ -5926,14 +5929,7 @@ declare namespace ts { libReferenceDirectives: readonly FileReference[]; languageVariant: LanguageVariant; isDeclarationFile: boolean; - /** - * lib.d.ts should have a reference comment like - * - * /// - * - * If any other file has this comment, it signals not to include lib.d.ts - * because this containing file is intended to act as a default library. - */ + /** @deprecated Always false. Use a Program to determine if a file is a lib file. */ hasNoDefaultLib: boolean; languageVersion: ScriptTarget; /** @@ -6598,53 +6594,53 @@ declare namespace ts { enum TypeFlags { Any = 1, Unknown = 2, - String = 4, - Number = 8, - Boolean = 16, - Enum = 32, - BigInt = 64, - StringLiteral = 128, - NumberLiteral = 256, - BooleanLiteral = 512, - EnumLiteral = 1024, - BigIntLiteral = 2048, - ESSymbol = 4096, - UniqueESSymbol = 8192, - Void = 16384, - Undefined = 32768, - Null = 65536, - Never = 131072, - TypeParameter = 262144, - Object = 524288, - Union = 1048576, - Intersection = 2097152, - Index = 4194304, - IndexedAccess = 8388608, - Conditional = 16777216, - Substitution = 33554432, - NonPrimitive = 67108864, - TemplateLiteral = 134217728, - StringMapping = 268435456, - Literal = 2944, - Unit = 109472, - Freshable = 2976, - StringOrNumberLiteral = 384, - PossiblyFalsy = 117724, - StringLike = 402653316, - NumberLike = 296, - BigIntLike = 2112, - BooleanLike = 528, - EnumLike = 1056, - ESSymbolLike = 12288, - VoidLike = 49152, - UnionOrIntersection = 3145728, - StructuredType = 3670016, - TypeVariable = 8650752, - InstantiableNonPrimitive = 58982400, - InstantiablePrimitive = 406847488, - Instantiable = 465829888, - StructuredOrInstantiable = 469499904, - Narrowable = 536624127, + Undefined = 4, + Null = 8, + Void = 16, + String = 32, + Number = 64, + BigInt = 128, + Boolean = 256, + ESSymbol = 512, + StringLiteral = 1024, + NumberLiteral = 2048, + BigIntLiteral = 4096, + BooleanLiteral = 8192, + UniqueESSymbol = 16384, + EnumLiteral = 32768, + Enum = 65536, + NonPrimitive = 131072, + Never = 262144, + TypeParameter = 524288, + Object = 1048576, + Index = 2097152, + TemplateLiteral = 4194304, + StringMapping = 8388608, + Substitution = 16777216, + IndexedAccess = 33554432, + Conditional = 67108864, + Union = 134217728, + Intersection = 268435456, + Literal = 15360, + Unit = 97292, + Freshable = 80896, + StringOrNumberLiteral = 3072, + PossiblyFalsy = 15868, + StringLike = 12583968, + NumberLike = 67648, + BigIntLike = 4224, + BooleanLike = 8448, + EnumLike = 98304, + ESSymbolLike = 16896, + VoidLike = 20, + UnionOrIntersection = 402653184, + StructuredType = 403701760, + TypeVariable = 34078720, + InstantiableNonPrimitive = 117964800, + InstantiablePrimitive = 14680064, + Instantiable = 132644864, + StructuredOrInstantiable = 536346624, + Narrowable = 536575971, } type DestructuringPattern = BindingPattern | ObjectLiteralExpression | ArrayLiteralExpression; interface Type { @@ -6951,6 +6947,7 @@ declare namespace ts { Message = 3, } enum ModuleResolutionKind { + /** @deprecated */ Classic = 1, /** * @deprecated @@ -6958,6 +6955,9 @@ declare namespace ts { * Use the new name or consider switching to a modern module resolution target. */ NodeJs = 2, + /** + * @deprecated + */ Node10 = 2, Node16 = 3, NodeNext = 99, @@ -7020,6 +7020,7 @@ declare namespace ts { allowUnreachableCode?: boolean; allowUnusedLabels?: boolean; alwaysStrict?: boolean; + /** @deprecated */ baseUrl?: string; /** @deprecated */ charset?: string; @@ -7033,6 +7034,7 @@ declare namespace ts { disableSourceOfProjectReferenceRedirect?: boolean; disableSolutionSearching?: boolean; disableReferencedProjectLoad?: boolean; + /** @deprecated */ downlevelIteration?: boolean; emitBOM?: boolean; emitDecoratorMetadata?: boolean; @@ -7150,10 +7152,14 @@ declare namespace ts { [option: string]: CompilerOptionsValue | undefined; } enum ModuleKind { + /** @deprecated */ None = 0, CommonJS = 1, + /** @deprecated */ AMD = 2, + /** @deprecated */ UMD = 3, + /** @deprecated */ System = 4, ES2015 = 5, ES2020 = 6, @@ -7205,6 +7211,7 @@ declare namespace ts { enum ScriptTarget { /** @deprecated */ ES3 = 0, + /** @deprecated */ ES5 = 1, ES2015 = 2, ES2016 = 3, @@ -7216,9 +7223,11 @@ declare namespace ts { ES2022 = 9, ES2023 = 10, ES2024 = 11, + ES2025 = 12, ESNext = 99, JSON = 100, Latest = 99, + LatestStandard = 12, } enum LanguageVariant { Standard = 0, @@ -9320,7 +9329,7 @@ declare namespace ts { * Given a set of options, returns the set of type directive names * that should be included for this program automatically. * This list could either come from the config file, - * or from enumerating the types root + initial secondary types lookup location. + * and/or from enumerating the types root + initial secondary types lookup location given "*" compat wildcard. * More type directives might appear in the program later as a result of loading actual source files; * this list is only the set of defaults that are implicitly included. */ @@ -10039,6 +10048,7 @@ declare namespace ts { libReferenceDirectives: FileReference[]; importedFiles: FileReference[]; ambientExternalModules?: string[]; + /** @deprecated Always false. Use a Program to determine if a file is a lib file. */ isLibFile: boolean; } interface HostCancellationToken { diff --git a/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.js b/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.js index 2643aa12aa64..d322bce73085 100644 --- a/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.js +++ b/packages/schematics/angular/third_party/github.com/Microsoft/TypeScript/lib/typescript.js @@ -7,7 +7,7 @@ License at http://www.apache.org/licenses/LICENSE-2.0 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. @@ -251,6 +251,7 @@ __export(typescript_exports, { canHaveLocals: () => canHaveLocals, canHaveModifiers: () => canHaveModifiers, canHaveModuleSpecifier: () => canHaveModuleSpecifier, + canHaveStatements: () => canHaveStatements, canHaveSymbol: () => canHaveSymbol, canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics, canJsonReportNoInputFiles: () => canJsonReportNoInputFiles, @@ -298,6 +299,7 @@ __export(typescript_exports, { commonOptionsWithBuild: () => commonOptionsWithBuild, compact: () => compact, compareBooleans: () => compareBooleans, + compareComparableValues: () => compareComparableValues, compareDataObjects: () => compareDataObjects, compareDiagnostics: () => compareDiagnostics, compareEmitHelpers: () => compareEmitHelpers, @@ -643,6 +645,7 @@ __export(typescript_exports, { getAllowImportingTsExtensions: () => getAllowImportingTsExtensions, getAllowJSCompilerOption: () => getAllowJSCompilerOption, getAllowSyntheticDefaultImports: () => getAllowSyntheticDefaultImports, + getAlwaysStrict: () => getAlwaysStrict, getAncestor: () => getAncestor, getAnyExtensionFromPath: () => getAnyExtensionFromPath, getAreDeclarationMapsEnabled: () => getAreDeclarationMapsEnabled, @@ -672,6 +675,7 @@ __export(typescript_exports, { getCommonSourceDirectory: () => getCommonSourceDirectory, getCommonSourceDirectoryOfConfig: () => getCommonSourceDirectoryOfConfig, getCompilerOptionValue: () => getCompilerOptionValue, + getComputedCommonSourceDirectory: () => getComputedCommonSourceDirectory, getConditions: () => getConditions, getConfigFileParsingDiagnostics: () => getConfigFileParsingDiagnostics, getConstantValue: () => getConstantValue, @@ -881,6 +885,7 @@ __export(typescript_exports, { getModuleInstanceState: () => getModuleInstanceState, getModuleNameStringLiteralAt: () => getModuleNameStringLiteralAt, getModuleSpecifierEndingPreference: () => getModuleSpecifierEndingPreference, + getModuleSpecifierOfBareOrAccessedRequire: () => getModuleSpecifierOfBareOrAccessedRequire, getModuleSpecifierResolverHost: () => getModuleSpecifierResolverHost, getNameForExportedSymbol: () => getNameForExportedSymbol, getNameFromImportAttribute: () => getNameFromImportAttribute, @@ -911,7 +916,6 @@ __export(typescript_exports, { getNonAugmentationDeclaration: () => getNonAugmentationDeclaration, getNonDecoratorTokenPosOfNode: () => getNonDecoratorTokenPosOfNode, getNonIncrementalBuildInfoRoots: () => getNonIncrementalBuildInfoRoots, - getNonModifierTokenPosOfNode: () => getNonModifierTokenPosOfNode, getNormalizedAbsolutePath: () => getNormalizedAbsolutePath, getNormalizedAbsolutePathWithoutRoot: () => getNormalizedAbsolutePathWithoutRoot, getNormalizedPathComponents: () => getNormalizedPathComponents, @@ -1642,6 +1646,7 @@ __export(typescript_exports, { isPlusToken: () => isPlusToken, isPossiblyTypeArgumentPosition: () => isPossiblyTypeArgumentPosition, isPostfixUnaryExpression: () => isPostfixUnaryExpression, + isPotentiallyExecutableNode: () => isPotentiallyExecutableNode, isPrefixUnaryExpression: () => isPrefixUnaryExpression, isPrimitiveLiteralValue: () => isPrimitiveLiteralValue, isPrivateIdentifier: () => isPrivateIdentifier, @@ -2244,9 +2249,7 @@ __export(typescript_exports, { unmangleScopedPackageName: () => unmangleScopedPackageName, unorderedRemoveItem: () => unorderedRemoveItem, unprefixedNodeCoreModules: () => unprefixedNodeCoreModules, - unreachableCodeIsError: () => unreachableCodeIsError, unsetNodeChildren: () => unsetNodeChildren, - unusedLabelIsError: () => unusedLabelIsError, unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel, unwrapParenthesizedExpression: () => unwrapParenthesizedExpression, updateErrorForNoInputFiles: () => updateErrorForNoInputFiles, @@ -2256,6 +2259,7 @@ __export(typescript_exports, { updateSharedExtendedConfigFileWatcher: () => updateSharedExtendedConfigFileWatcher, updateSourceFile: () => updateSourceFile, updateWatchingWildcardDirectories: () => updateWatchingWildcardDirectories, + usesWildcardTypes: () => usesWildcardTypes, usingSingleLineStringWriter: () => usingSingleLineStringWriter, utf16EncodeAsString: () => utf16EncodeAsString, validateLocaleAndSetLanguage: () => validateLocaleAndSetLanguage, @@ -2284,8 +2288,8 @@ __export(typescript_exports, { module.exports = __toCommonJS(typescript_exports); // src/compiler/corePublic.ts -var versionMajorMinor = "5.9"; -var version = "5.9.2"; +var versionMajorMinor = "6.0"; +var version = "6.0.2"; var Comparison = /* @__PURE__ */ ((Comparison3) => { Comparison3[Comparison3["LessThan"] = -1] = "LessThan"; Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo"; @@ -2980,7 +2984,7 @@ function binarySearchKey(array, key, keySelector, keyComparer, offset) { 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 /* LessThan */: low = middle + 1; break; @@ -4305,8 +4309,8 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`, // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { value() { - const typeHeader = this.flags & 67359327 /* Intrinsic */ ? `IntrinsicType ${this.intrinsicName}${this.debugIntrinsicName ? ` (${this.debugIntrinsicName})` : ""}` : this.flags & 98304 /* Nullable */ ? "NullableType" : this.flags & 384 /* StringOrNumberLiteral */ ? `LiteralType ${JSON.stringify(this.value)}` : this.flags & 2048 /* BigIntLiteral */ ? `LiteralType ${this.value.negative ? "-" : ""}${this.value.base10Value}n` : this.flags & 8192 /* UniqueESSymbol */ ? "UniqueESSymbolType" : this.flags & 32 /* Enum */ ? "EnumType" : this.flags & 1048576 /* Union */ ? "UnionType" : this.flags & 2097152 /* Intersection */ ? "IntersectionType" : this.flags & 4194304 /* Index */ ? "IndexType" : this.flags & 8388608 /* IndexedAccess */ ? "IndexedAccessType" : this.flags & 16777216 /* Conditional */ ? "ConditionalType" : this.flags & 33554432 /* Substitution */ ? "SubstitutionType" : this.flags & 262144 /* TypeParameter */ ? "TypeParameter" : this.flags & 524288 /* Object */ ? this.objectFlags & 3 /* ClassOrInterface */ ? "InterfaceType" : this.objectFlags & 4 /* Reference */ ? "TypeReference" : this.objectFlags & 8 /* Tuple */ ? "TupleType" : this.objectFlags & 16 /* Anonymous */ ? "AnonymousType" : this.objectFlags & 32 /* Mapped */ ? "MappedType" : this.objectFlags & 1024 /* ReverseMapped */ ? "ReverseMappedType" : this.objectFlags & 256 /* EvolvingArray */ ? "EvolvingArrayType" : "ObjectType" : "Type"; - const remainingObjectFlags = this.flags & 524288 /* Object */ ? this.objectFlags & ~1343 /* ObjectTypeKindMask */ : 0; + const typeHeader = this.flags & 402431 /* Intrinsic */ ? `IntrinsicType ${this.intrinsicName}${this.debugIntrinsicName ? ` (${this.debugIntrinsicName})` : ""}` : this.flags & 12 /* Nullable */ ? "NullableType" : this.flags & 3072 /* StringOrNumberLiteral */ ? `LiteralType ${JSON.stringify(this.value)}` : this.flags & 4096 /* BigIntLiteral */ ? `LiteralType ${this.value.negative ? "-" : ""}${this.value.base10Value}n` : this.flags & 16384 /* UniqueESSymbol */ ? "UniqueESSymbolType" : this.flags & 65536 /* Enum */ ? "EnumType" : this.flags & 134217728 /* Union */ ? "UnionType" : this.flags & 268435456 /* Intersection */ ? "IntersectionType" : this.flags & 2097152 /* Index */ ? "IndexType" : this.flags & 33554432 /* IndexedAccess */ ? "IndexedAccessType" : this.flags & 67108864 /* Conditional */ ? "ConditionalType" : this.flags & 16777216 /* Substitution */ ? "SubstitutionType" : this.flags & 524288 /* TypeParameter */ ? "TypeParameter" : this.flags & 1048576 /* Object */ ? this.objectFlags & 3 /* ClassOrInterface */ ? "InterfaceType" : this.objectFlags & 4 /* Reference */ ? "TypeReference" : this.objectFlags & 8 /* Tuple */ ? "TupleType" : this.objectFlags & 16 /* Anonymous */ ? "AnonymousType" : this.objectFlags & 32 /* Mapped */ ? "MappedType" : this.objectFlags & 1024 /* ReverseMapped */ ? "ReverseMappedType" : this.objectFlags & 256 /* EvolvingArray */ ? "EvolvingArrayType" : "ObjectType" : "Type"; + const remainingObjectFlags = this.flags & 1048576 /* Object */ ? this.objectFlags & ~142607679 /* ObjectTypeKindMask */ : 0; return `${typeHeader}${this.symbol ? ` '${symbolName(this.symbol)}'` : ""}${remainingObjectFlags ? ` (${formatObjectFlags(remainingObjectFlags)})` : ""}`; } }, @@ -4317,7 +4321,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`, }, __debugObjectFlags: { get() { - return this.flags & 524288 /* Object */ ? formatObjectFlags(this.objectFlags) : ""; + return this.flags & 1048576 /* Object */ ? formatObjectFlags(this.objectFlags) : ""; } }, __debugTypeToString: { @@ -5408,7 +5412,7 @@ var tracingEnabled; const objectFlags = type.objectFlags; const symbol = type.aliasSymbol ?? type.symbol; let display; - if (objectFlags & 16 /* Anonymous */ | type.flags & 2944 /* Literal */) { + if (objectFlags & 16 /* Anonymous */ | type.flags & 15360 /* Literal */) { try { display = (_a = type.checker) == null ? void 0 : _a.typeToString(type); } catch { @@ -5416,7 +5420,7 @@ var tracingEnabled; } } let indexedAccessProperties = {}; - if (type.flags & 8388608 /* IndexedAccess */) { + if (type.flags & 33554432 /* IndexedAccess */) { const indexedAccessType = type; indexedAccessProperties = { indexedAccessObjectType: (_b = indexedAccessType.objectType) == null ? void 0 : _b.id, @@ -5433,7 +5437,7 @@ var tracingEnabled; }; } let conditionalProperties = {}; - if (type.flags & 16777216 /* Conditional */) { + if (type.flags & 67108864 /* Conditional */) { const conditionalType = type; conditionalProperties = { conditionalCheckType: (_f = conditionalType.checkType) == null ? void 0 : _f.id, @@ -5443,7 +5447,7 @@ var tracingEnabled; }; } let substitutionProperties = {}; - if (type.flags & 33554432 /* Substitution */) { + if (type.flags & 16777216 /* Substitution */) { const substitutionType = type; substitutionProperties = { substitutionBaseType: (_j = substitutionType.baseType) == null ? void 0 : _j.id, @@ -5482,10 +5486,10 @@ var tracingEnabled; symbolName: (symbol == null ? void 0 : symbol.escapedName) && unescapeLeadingUnderscores(symbol.escapedName), recursionId: recursionToken, isTuple: objectFlags & 8 /* Tuple */ ? true : void 0, - unionTypes: type.flags & 1048576 /* Union */ ? (_p = type.types) == null ? void 0 : _p.map((t) => t.id) : void 0, - intersectionTypes: type.flags & 2097152 /* Intersection */ ? type.types.map((t) => t.id) : void 0, + unionTypes: type.flags & 134217728 /* Union */ ? (_p = type.types) == null ? void 0 : _p.map((t) => t.id) : void 0, + intersectionTypes: type.flags & 268435456 /* Intersection */ ? type.types.map((t) => t.id) : void 0, aliasTypeArguments: (_q = type.aliasTypeArguments) == null ? void 0 : _q.map((t) => t.id), - keyofType: type.flags & 4194304 /* Index */ ? (_r = type.type) == null ? void 0 : _r.id : void 0, + keyofType: type.flags & 2097152 /* Index */ ? (_r = type.type) == null ? void 0 : _r.id : void 0, ...indexedAccessProperties, ...referenceProperties, ...conditionalProperties, @@ -5951,6 +5955,7 @@ var NodeFlags = /* @__PURE__ */ ((NodeFlags3) => { 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"; @@ -6167,7 +6172,7 @@ var ContextFlags = /* @__PURE__ */ ((ContextFlags3) => { 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 || {}); @@ -6429,75 +6434,76 @@ var NodeCheckFlags = /* @__PURE__ */ ((NodeCheckFlags3) => { 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 /* TypeParameter */] = "IncludesMissingType"; - TypeFlags2[TypeFlags2["IncludesNonWideningType"] = 4194304 /* Index */] = "IncludesNonWideningType"; - TypeFlags2[TypeFlags2["IncludesWildcard"] = 8388608 /* IndexedAccess */] = "IncludesWildcard"; - TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject"; - TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable"; + TypeFlags2[TypeFlags2["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 /* TypeParameter */] = "IncludesMissingType"; + TypeFlags2[TypeFlags2["IncludesNonWideningType"] = 2097152 /* Index */] = "IncludesNonWideningType"; + TypeFlags2[TypeFlags2["IncludesWildcard"] = 33554432 /* IndexedAccess */] = "IncludesWildcard"; + TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 67108864 /* Conditional */] = "IncludesEmptyObject"; + TypeFlags2[TypeFlags2["IncludesInstantiable"] = 16777216 /* Substitution */] = "IncludesInstantiable"; TypeFlags2[TypeFlags2["IncludesConstrainedTypeVariable"] = 536870912 /* Reserved1 */] = "IncludesConstrainedTypeVariable"; TypeFlags2[TypeFlags2["IncludesError"] = 1073741824 /* Reserved2 */] = "IncludesError"; - TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion"; + TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 286523411] = "NotPrimitiveUnion"; return TypeFlags2; })(TypeFlags || {}); var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => { @@ -6528,10 +6534,10 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => { 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"; @@ -6785,15 +6791,17 @@ var ScriptTarget = /* @__PURE__ */ ((ScriptTarget12) => { 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 /* ESNext */] = "Latest"; + ScriptTarget12[ScriptTarget12["LatestStandard"] = 12 /* ES2025 */] = "LatestStandard"; return ScriptTarget12; })(ScriptTarget || {}); -var LanguageVariant = /* @__PURE__ */ ((LanguageVariant3) => { - LanguageVariant3[LanguageVariant3["Standard"] = 0] = "Standard"; - LanguageVariant3[LanguageVariant3["JSX"] = 1] = "JSX"; - return LanguageVariant3; +var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => { + LanguageVariant4[LanguageVariant4["Standard"] = 0] = "Standard"; + LanguageVariant4[LanguageVariant4["JSX"] = 1] = "JSX"; + return LanguageVariant4; })(LanguageVariant || {}); var WatchDirectoryFlags = /* @__PURE__ */ ((WatchDirectoryFlags3) => { WatchDirectoryFlags3[WatchDirectoryFlags3["None"] = 0] = "None"; @@ -7623,10 +7631,10 @@ function createSingleWatcherPerName(cache, useCaseSensitiveFileNames2, name, cal cache.set(path, { watcher: createWatcher( // Cant infer types correctly so lets satisfy checker - (param1, param2, param3) => { + ((param1, param2, param3) => { var _a; return (_a = cache.get(path)) == null ? void 0 : _a.callbacks.slice().forEach((cb) => cb(param1, param2, param3)); - } + }) ), callbacks: [callback] }); @@ -9454,7 +9462,7 @@ var Diagnostics = { A_bigint_literal_cannot_use_exponential_notation: diag(1352, 1 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, 1 /* Error */, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), @@ -9620,24 +9628,16 @@ var Diagnostics = { Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class: diag(1537, 1 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Suggestion */, - "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.", - /*reportsUnnecessary*/ - void 0, - /*elidedInCompatabilityPyramid*/ - void 0, - /*reportsDeprecated*/ - true - ), + A_namespace_declaration_should_not_be_declared_using_the_module_keyword_Please_use_the_namespace_keyword_instead: diag(1540, 1 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Message */, "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 /* Error */, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."), The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, 1 /* Error */, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."), Call_signature_return_types_0_and_1_are_incompatible: diag( @@ -10218,6 +10218,8 @@ var Diagnostics = { Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found: diag(2879, 1 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), @@ -10332,6 +10334,7 @@ var Diagnostics = { The_current_host_does_not_support_the_0_option: diag(5001, 1 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "Cannot_read_file_0_Colon_1_5012", "Cannot read file '{0}': {1}."), Unknown_compiler_option_0: diag(5023, 1 /* Error */, "Unknown_compiler_option_0_5023", "Unknown compiler option '{0}'."), Compiler_option_0_requires_a_value_of_type_1: diag(5024, 1 /* Error */, "Compiler_option_0_requires_a_value_of_type_1_5024", "Compiler option '{0}' requires a value of type {1}."), @@ -10381,8 +10384,8 @@ var Diagnostics = { The_root_value_of_a_0_file_must_be_an_object: diag(5092, 1 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Error */, "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.`), @@ -10395,6 +10398,8 @@ var Diagnostics = { Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "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 /* Error */, "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 /* Error */, "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 /* Message */, "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 /* Error */, "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(6e3, 3 /* Message */, "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 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."), Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."), @@ -10917,17 +10922,17 @@ var Diagnostics = { Check_side_effect_imports: diag(6806, 3 /* Message */, "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 /* Error */, "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 /* Message */, "Enable_lib_replacement_6808", "Enable lib replacement."), + Ensure_types_are_ordered_stably_and_deterministically_across_compilations: diag(6809, 3 /* Message */, "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 /* Message */, "one_of_Colon_6900", "one of:"), one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"), type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"), default_Colon: diag(6903, 3 /* Message */, "default_Colon_6903", "default:"), - module_system_or_esModuleInterop: diag(6904, 3 /* Message */, "module_system_or_esModuleInterop_6904", 'module === "system" or esModuleInterop'), - false_unless_strict_is_set: diag(6905, 3 /* Message */, "false_unless_strict_is_set_6905", "`false`, unless `strict` is set"), + true_unless_strict_is_false: diag(6905, 3 /* Message */, "true_unless_strict_is_false_6905", "`true`, unless `strict` is `false`"), false_unless_composite_is_set: diag(6906, 3 /* Message */, "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 /* Message */, "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 /* Message */, "if_files_is_specified_otherwise_Asterisk_Asterisk_Slash_Asterisk_6908", '`[]` if `files` is specified, otherwise `["**/*"]`'), true_if_composite_false_otherwise: diag(6909, 3 /* Message */, "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 /* Message */, "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 /* Message */, "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 /* Message */, "Computed_from_the_list_of_input_files_6911", "Computed from the list of input files"), Platform_specific: diag(6912, 3 /* Message */, "Platform_specific_6912", "Platform specific"), You_can_learn_about_all_of_the_compiler_options_at_0: diag(6913, 3 /* Message */, "You_can_learn_about_all_of_the_compiler_options_at_0_6913", "You can learn about all of the compiler options at {0}"), @@ -10949,6 +10954,7 @@ var Diagnostics = { Compiles_the_current_project_with_additional_settings: diag(6929, 3 /* Message */, "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 /* Message */, "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 /* Error */, "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 /* Message */, "false_unless_checkJs_is_set_6932", "`false`, unless `checkJs` is set"), Variable_0_implicitly_has_an_1_type: diag(7005, 1 /* Error */, "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 /* Error */, "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 /* Error */, "Member_0_implicitly_has_an_1_type_7008", "Member '{0}' implicitly has an '{1}' type."), @@ -14665,6 +14671,7 @@ function sortAndDeduplicateDiagnostics(diagnostics) { } var targetToLibMap = /* @__PURE__ */ new Map([ [99 /* ESNext */, "lib.esnext.full.d.ts"], + [12 /* ES2025 */, "lib.es2025.full.d.ts"], [11 /* ES2024 */, "lib.es2024.full.d.ts"], [10 /* ES2023 */, "lib.es2023.full.d.ts"], [9 /* ES2022 */, "lib.es2022.full.d.ts"], @@ -14681,6 +14688,7 @@ function getDefaultLibFileName(options) { const target = getEmitScriptTarget(options); switch (target) { case 99 /* ESNext */: + case 12 /* ES2025 */: case 11 /* ES2024 */: case 10 /* ES2023 */: case 9 /* ES2022 */: @@ -16659,13 +16667,6 @@ function getNonDecoratorTokenPosOfNode(node, sourceFile) { } return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, lastDecorator.end); } -function getNonModifierTokenPosOfNode(node, sourceFile) { - const lastModifier = !nodeIsMissing(node) && canHaveModifiers(node) && node.modifiers ? last(node.modifiers) : void 0; - if (!lastModifier) { - return getTokenPosOfNode(node, sourceFile); - } - return skipTrivia((sourceFile || getSourceFileOfNode(node)).text, lastModifier.end); -} function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia = false) { return getTextOfNodeFromSourceText(sourceFile.text, node, includeTrivia); } @@ -16816,6 +16817,11 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize( "unicodeSets" ] })), + RegExpConstructor: new Map(Object.entries({ + es2025: [ + "escape" + ] + })), Reflect: new Map(Object.entries({ es2015: [ "apply", @@ -16895,7 +16901,7 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize( "fround", "cbrt" ], - esnext: [ + es2025: [ "f16round" ] })), @@ -16904,6 +16910,10 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize( "entries", "keys", "values" + ], + esnext: [ + "getOrInsert", + "getOrInsertComputed" ] })), MapConstructor: new Map(Object.entries({ @@ -16917,7 +16927,7 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize( "keys", "values" ], - esnext: [ + es2025: [ "union", "intersection", "difference", @@ -16942,6 +16952,9 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize( ], es2024: [ "withResolvers" + ], + es2025: [ + "try" ] })), Symbol: new Map(Object.entries({ @@ -16958,6 +16971,10 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize( "entries", "keys", "values" + ], + esnext: [ + "getOrInsert", + "getOrInsertComputed" ] })), WeakSet: new Map(Object.entries({ @@ -17043,6 +17060,21 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize( Intl: new Map(Object.entries({ es2018: [ "PluralRules" + ], + es2020: [ + "RelativeTimeFormat", + "Locale", + "DisplayNames" + ], + es2021: [ + "ListFormat", + "DateTimeFormat" + ], + es2022: [ + "Segmenter" + ], + es2025: [ + "DurationFormat" ] })), NumberFormat: new Map(Object.entries({ @@ -17067,7 +17099,7 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize( "getBigInt64", "getBigUint64" ], - esnext: [ + es2025: [ "setFloat16", "getFloat16" ] @@ -17106,6 +17138,12 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize( "toSorted", "toSpliced", "with" + ], + esnext: [ + "toBase64", + "setFromBase64", + "toHex", + "setFromHex" ] })), Uint8ClampedArray: new Map(Object.entries({ @@ -17174,7 +17212,7 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize( ] })), Float16Array: new Map(Object.entries({ - esnext: emptyArray + es2025: emptyArray })), Float32Array: new Map(Object.entries({ es2022: [ @@ -17234,6 +17272,28 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize( 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 })) })) ); @@ -17373,7 +17433,7 @@ function isEffectiveStrictModeSourceFile(node, compilerOptions) { if (node.isDeclarationFile) { return false; } - if (getStrictOptionValue(compilerOptions, "alwaysStrict")) { + if (getAlwaysStrict(compilerOptions)) { return true; } if (startsWithUseStrict(node.statements)) { @@ -17952,12 +18012,15 @@ function forEachYieldExpression(body, visitor) { function traverse(node) { switch (node.kind) { case 230 /* YieldExpression */: - visitor(node); + const value = visitor(node); + if (value) { + return value; + } const operand = node.expression; - if (operand) { - traverse(operand); + if (!operand) { + return; } - return; + return traverse(operand); case 267 /* EnumDeclaration */: case 265 /* InterfaceDeclaration */: case 268 /* ModuleDeclaration */: @@ -17966,11 +18029,10 @@ function forEachYieldExpression(body, visitor) { default: if (isFunctionLike(node)) { if (node.name && node.name.kind === 168 /* ComputedPropertyName */) { - traverse(node.name.expression); - return; + return traverse(node.name.expression); } } else if (!isPartOfTypeNode(node)) { - forEachChild(node, traverse); + return forEachChild(node, traverse); } } } @@ -18580,6 +18642,22 @@ function isVariableDeclarationInitializedToBareOrAccessedRequire(node) { 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, + /*requireStringLiteralLikeArgument*/ + true + )) { + return leftmost.arguments[0]; + } + } + return void 0; +} function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) { return isVariableDeclaration(node) && !!node.initializer && isRequireCall( allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, @@ -20379,7 +20457,7 @@ function sourceFileMayBeEmitted(sourceFile, host, forceDtsEmit) { if (host.getRedirectFromSourceFile(sourceFile.fileName)) return false; if (options.outFile) 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 /* EqualTo */) return false; @@ -21388,7 +21466,7 @@ function getClassLikeDeclarationOfSymbol(symbol) { return (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike); } function getObjectFlags(type) { - return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0; + return type.flags & 403963917 /* ObjectFlagsType */ ? type.objectFlags : 0; } function isUMDExportSymbol(symbol) { return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]); @@ -21892,6 +21970,9 @@ function importSyntaxAffectsModuleResolution(options) { const moduleResolution = getEmitModuleResolutionKind(options); return 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */ || getResolvePackageJsonExports(options) || getResolvePackageJsonImports(options); } +function usesWildcardTypes(options) { + return some(options.types, (t) => t === "*"); +} function createComputedCompilerOptions(options) { return options; } @@ -21903,44 +21984,54 @@ var _computedOptions = createComputedCompilerOptions({ } }, target: { - dependencies: ["module"], + dependencies: [], computeValue: (compilerOptions) => { const target = compilerOptions.target === 0 /* ES3 */ ? void 0 : compilerOptions.target; - return target ?? (compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 101 /* Node18 */ && 9 /* ES2022 */ || compilerOptions.module === 102 /* Node20 */ && 10 /* ES2023 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */); + return target ?? 12 /* LatestStandard */; } }, module: { dependencies: ["target"], computeValue: (compilerOptions) => { - return typeof compilerOptions.module === "number" ? compilerOptions.module : _computedOptions.target.computeValue(compilerOptions) >= 2 /* ES2015 */ ? 5 /* ES2015 */ : 1 /* CommonJS */; + if (typeof compilerOptions.module === "number") { + return compilerOptions.module; + } + const target = _computedOptions.target.computeValue(compilerOptions); + if (target === 99 /* ESNext */) { + return 99 /* ESNext */; + } + if (target >= 9 /* ES2022 */) { + return 7 /* ES2022 */; + } + if (target >= 7 /* ES2020 */) { + return 6 /* ES2020 */; + } + if (target >= 2 /* ES2015 */) { + return 5 /* ES2015 */; + } + return 1 /* CommonJS */; } }, moduleResolution: { dependencies: ["module", "target"], computeValue: (compilerOptions) => { - let moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === void 0) { - switch (_computedOptions.module.computeValue(compilerOptions)) { - case 1 /* CommonJS */: - moduleResolution = 2 /* Node10 */; - break; - case 100 /* Node16 */: - case 101 /* Node18 */: - case 102 /* Node20 */: - moduleResolution = 3 /* Node16 */; - break; - case 199 /* NodeNext */: - moduleResolution = 99 /* NodeNext */; - break; - case 200 /* Preserve */: - moduleResolution = 100 /* Bundler */; - break; - default: - moduleResolution = 1 /* Classic */; - break; - } + if (compilerOptions.moduleResolution !== void 0) { + return compilerOptions.moduleResolution; + } + const moduleKind = _computedOptions.module.computeValue(compilerOptions); + switch (moduleKind) { + case 0 /* None */: + case 2 /* AMD */: + case 3 /* UMD */: + case 4 /* System */: + return 1 /* Classic */; + case 199 /* NodeNext */: + return 99 /* NodeNext */; + } + if (100 /* Node16 */ <= moduleKind && moduleKind < 199 /* NodeNext */) { + return 3 /* Node16 */; } - return moduleResolution; + return 100 /* Bundler */; } }, moduleDetection: { @@ -21960,33 +22051,25 @@ var _computedOptions = createComputedCompilerOptions({ } }, esModuleInterop: { - dependencies: ["module", "target"], + dependencies: [], computeValue: (compilerOptions) => { if (compilerOptions.esModuleInterop !== void 0) { return compilerOptions.esModuleInterop; } - switch (_computedOptions.module.computeValue(compilerOptions)) { - case 100 /* Node16 */: - case 101 /* Node18 */: - case 102 /* Node20 */: - case 199 /* NodeNext */: - case 200 /* Preserve */: - return true; - } - return false; + return true; } }, allowSyntheticDefaultImports: { - dependencies: ["module", "target", "moduleResolution"], + dependencies: [], computeValue: (compilerOptions) => { if (compilerOptions.allowSyntheticDefaultImports !== void 0) { return compilerOptions.allowSyntheticDefaultImports; } - return _computedOptions.esModuleInterop.computeValue(compilerOptions) || _computedOptions.module.computeValue(compilerOptions) === 4 /* System */ || _computedOptions.moduleResolution.computeValue(compilerOptions) === 100 /* Bundler */; + return true; } }, resolvePackageJsonExports: { - dependencies: ["moduleResolution"], + dependencies: ["moduleResolution", "module", "target"], computeValue: (compilerOptions) => { const moduleResolution = _computedOptions.moduleResolution.computeValue(compilerOptions); if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { @@ -22005,7 +22088,7 @@ var _computedOptions = createComputedCompilerOptions({ } }, resolvePackageJsonImports: { - dependencies: ["moduleResolution", "resolvePackageJsonExports"], + dependencies: ["moduleResolution", "resolvePackageJsonExports", "module", "target"], computeValue: (compilerOptions) => { const moduleResolution = _computedOptions.moduleResolution.computeValue(compilerOptions); if (!moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) { @@ -22118,10 +22201,11 @@ var _computedOptions = createComputedCompilerOptions({ return getStrictOptionValue(compilerOptions, "strictBuiltinIteratorReturn"); } }, + // Previously a strict-mode flag, but no longer. alwaysStrict: { - dependencies: ["strict"], + dependencies: [], computeValue: (compilerOptions) => { - return getStrictOptionValue(compilerOptions, "alwaysStrict"); + return compilerOptions.alwaysStrict !== false; } }, useUnknownInCatchVariables: { @@ -22149,6 +22233,7 @@ var isIncrementalCompilation = _computedOptions.incremental.computeValue; 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 /* ES2015 */ && moduleKind <= 99 /* ESNext */; } @@ -22161,12 +22246,6 @@ function hasJsonModuleEmitEnabled(options) { } return true; } -function unreachableCodeIsError(options) { - return options.allowUnreachableCode === false; -} -function unusedLabelIsError(options) { - return options.allowUnusedLabels === false; -} function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) { return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */; } @@ -22174,7 +22253,7 @@ function moduleSupportsImportAttributes(moduleKind) { return 101 /* Node18 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || moduleKind === 200 /* Preserve */ || moduleKind === 99 /* ESNext */; } function getStrictOptionValue(compilerOptions, flag) { - return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag]; + return compilerOptions[flag] === void 0 ? compilerOptions.strict !== false : !!compilerOptions[flag]; } function getNameOfScriptTarget(scriptTarget) { return forEachEntry(targetOptionDeclaration.type, (value, key) => value === scriptTarget ? key : void 0); @@ -22817,7 +22896,7 @@ function skipTypeCheckingIgnoringNoCheck(sourceFile, options, host) { ); } 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) return false; @@ -23121,7 +23200,7 @@ function hasContextSensitiveParameters(node) { if (node.kind !== 220 /* ArrowFunction */) { const parameter = firstOrUndefined(node.parameters); if (!(parameter && parameterIsThisKeyword(parameter))) { - return true; + return !!(node.flags & 256 /* ContainsThis */); } } } @@ -23147,7 +23226,7 @@ function createPropertyNameNodeForIdentifierOrLiteral(name, target, singleQuote, 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 /* TypeParameter */ && type.isThisType); + return !!(type.flags & 524288 /* TypeParameter */ && type.isThisType); } function getNodeModulePathParts(fullPath) { let topLevelNodeModulesIndex = 0; @@ -23290,13 +23369,13 @@ function intrinsicTagNameToString(node) { return isIdentifier(node) ? idText(node) : getTextOfJsxNamespacedName(node); } function isTypeUsableAsPropertyName(type) { - return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */); + return !!(type.flags & 19456 /* StringOrNumberLiteralOrUnique */); } function getPropertyNameFromType(type) { - if (type.flags & 8192 /* UniqueESSymbol */) { + if (type.flags & 16384 /* UniqueESSymbol */) { return type.escapedName; } - if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) { + if (type.flags & (1024 /* StringLiteral */ | 2048 /* NumberLiteral */)) { return escapeLeadingUnderscores("" + type.value); } return Debug.fail(); @@ -24026,7 +24105,6 @@ var unprefixedNodeCoreModulesList = [ "stream/web", "string_decoder", "sys", - "test/mock_loader", "timers", "timers/promises", "tls", @@ -24043,6 +24121,7 @@ var unprefixedNodeCoreModulesList = [ ]; var unprefixedNodeCoreModules = new Set(unprefixedNodeCoreModulesList); var exclusivelyPrefixedNodeCoreModules = /* @__PURE__ */ new Set([ + "node:quic", "node:sea", "node:sqlite", "node:test", @@ -24230,6 +24309,21 @@ function addEmitFlagsRecursively(node, flag, getChild) { 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 /* FirstStatement */ <= node.kind && node.kind <= 260 /* LastStatement */) { + if (isVariableStatement(node)) { + if (getCombinedNodeFlags(node.declarationList) & 7 /* BlockScoped */) { + return true; + } + return some(node.declarationList.declarations, (d) => d.initializer !== void 0); + } + return true; + } + return isClassDeclaration(node) || isEnumDeclaration(node) || isModuleDeclaration(node); +} // src/compiler/factory/baseNodeFactory.ts function createBaseNodeFactory() { @@ -24351,10 +24445,22 @@ function createParenthesizerRules(factory2) { } return parenthesizerRule; } + function mixingBinaryOperatorsRequiresParentheses(a, b) { + if (a === 61 /* QuestionQuestionToken */) { + return b === 56 /* AmpersandAmpersandToken */ || b === 57 /* BarBarToken */; + } + if (b === 61 /* QuestionQuestionToken */) { + return a === 56 /* AmpersandAmpersandToken */ || a === 57 /* BarBarToken */; + } + return false; + } function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { + const emittedOperand = skipPartiallyEmittedExpressions(operand); + if (isBinaryExpression(emittedOperand) && mixingBinaryOperatorsRequiresParentheses(binaryOperator, emittedOperand.operatorToken.kind)) { + return true; + } const binaryOperatorPrecedence = getOperatorPrecedence(227 /* BinaryExpression */, binaryOperator); const binaryOperatorAssociativity = getOperatorAssociativity(227 /* BinaryExpression */, binaryOperator); - const emittedOperand = skipPartiallyEmittedExpressions(operand); if (!isLeftSideOfBinary && operand.kind === 220 /* ArrowFunction */ && binaryOperatorPrecedence > 3 /* Assignment */) { return true; } @@ -28236,7 +28342,7 @@ function createNodeFactory(flags, baseFactory2) { node.path = ""; node.resolvedPath = ""; node.originalFileName = ""; - node.languageVersion = 1 /* ES5 */; + node.languageVersion = 12 /* LatestStandard */; node.languageVariant = 0; node.scriptKind = 0; node.isDeclarationFile = false; @@ -28337,8 +28443,17 @@ function createNodeFactory(flags, baseFactory2) { 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, + /*hasNoDefaultLib*/ + false, + libReferenceDirectives + ), node) : node; } function createBundle(sourceFiles) { const node = createBaseNode(309 /* Bundle */); @@ -28346,7 +28461,6 @@ function createNodeFactory(flags, baseFactory2) { node.syntheticFileReferences = void 0; node.syntheticTypeReferences = void 0; node.syntheticLibReferences = void 0; - node.hasNoDefaultLib = void 0; return node; } function updateBundle(node, sourceFiles) { @@ -37847,7 +37961,11 @@ var Parser; case 121 /* LetKeyword */: case 87 /* ConstKeyword */: case 160 /* UsingKeyword */: + return parseVariableStatement(pos, hasJSDoc, modifiersIn); case 135 /* AwaitKeyword */: + if (!isAwaitUsingDeclaration()) { + break; + } return parseVariableStatement(pos, hasJSDoc, modifiersIn); case 100 /* FunctionKeyword */: return parseFunctionDeclaration(pos, hasJSDoc, modifiersIn); @@ -37876,20 +37994,19 @@ var Parser; default: return parseExportDeclaration(pos, hasJSDoc, modifiersIn); } - default: - if (modifiersIn) { - const missing = createMissingNode( - 283 /* MissingDeclaration */, - /*reportAtCurrentPosition*/ - true, - Diagnostics.Declaration_expected - ); - setTextRangePos(missing, pos); - missing.modifiers = modifiersIn; - return missing; - } - return void 0; } + if (modifiersIn) { + const missing = createMissingNode( + 283 /* MissingDeclaration */, + /*reportAtCurrentPosition*/ + true, + Diagnostics.Declaration_expected + ); + setTextRangePos(missing, pos); + missing.modifiers = modifiersIn; + return missing; + } + return void 0; } function nextTokenIsStringLiteral() { return nextToken() === 11 /* StringLiteral */; @@ -38008,7 +38125,9 @@ var Parser; flags |= 4 /* Using */; break; case 135 /* AwaitKeyword */: - Debug.assert(isAwaitUsingDeclaration()); + if (!isAwaitUsingDeclaration()) { + break; + } flags |= 6 /* AwaitUsing */; nextToken(); break; @@ -38628,7 +38747,7 @@ var Parser; } function tryParseImportAttributes() { const currentToken2 = token(); - if ((currentToken2 === 118 /* WithKeyword */ || currentToken2 === 132 /* AssertKeyword */) && !scanner2.hasPrecedingLineBreak()) { + if (currentToken2 === 118 /* WithKeyword */ || currentToken2 === 132 /* AssertKeyword */ && !scanner2.hasPrecedingLineBreak()) { return parseImportAttributes(currentToken2); } } @@ -40402,7 +40521,6 @@ function processPragmasIntoFields(context, reportDiagnostic) { context.typeReferenceDirectives = []; context.libReferenceDirectives = []; context.amdDependencies = []; - context.hasNoDefaultLib = false; context.pragmas.forEach((entryOrList, key) => { switch (key) { case "reference": { @@ -40413,7 +40531,6 @@ function processPragmasIntoFields(context, reportDiagnostic) { const { types, lib, path, ["resolution-mode"]: res, preserve: _preserve } = arg.arguments; const preserve = _preserve === "true" ? true : void 0; if (arg.arguments["no-default-lib"] === "true") { - context.hasNoDefaultLib = 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 } : {} }); @@ -40604,6 +40721,7 @@ var libEntries = [ ["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"], // Host only ["dom", "lib.dom.d.ts"], @@ -40614,7 +40732,7 @@ var libEntries = [ ["webworker.iterable", "lib.webworker.iterable.d.ts"], ["webworker.asynciterable", "lib.webworker.asynciterable.d.ts"], ["scripthost", "lib.scripthost.d.ts"], - // ES2015 Or ESNext By-feature options + // ES2015 and later By-feature options ["es2015.core", "lib.es2015.core.d.ts"], ["es2015.collection", "lib.es2015.collection.d.ts"], ["es2015.generator", "lib.es2015.generator.d.ts"], @@ -40671,26 +40789,35 @@ var libEntries = [ ["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"], + // Fallback for backward compatibility ["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 By-feature options + ["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 ["decorators", "lib.decorators.d.ts"], ["decorators.legacy", "lib.decorators.legacy.d.ts"] ]; @@ -40989,18 +41116,19 @@ var targetOptionDeclaration = { es2022: 9 /* ES2022 */, es2023: 10 /* ES2023 */, es2024: 11 /* ES2024 */, + es2025: 12 /* ES2025 */, esnext: 99 /* ESNext */ })), 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 /* ES5 */ + defaultValueDescription: 12 /* LatestStandard */ }; var moduleOptionDeclaration = { name: "module", @@ -41022,6 +41150,7 @@ var moduleOptionDeclaration = { nodenext: 199 /* NodeNext */, preserve: 200 /* Preserve */ })), + deprecatedKeys: /* @__PURE__ */ new Set(["none", "amd", "system", "umd"]), affectsSourceFile: true, affectsModuleResolution: true, affectsEmit: true, @@ -41086,6 +41215,15 @@ var commandOptionsWithoutBuild = [ 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 + }, // Basic targetOptionDeclaration, moduleOptionDeclaration, @@ -41111,7 +41249,7 @@ var commandOptionsWithoutBuild = [ 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", @@ -41286,7 +41424,7 @@ var commandOptionsWithoutBuild = [ affectsProgramStructure: true, category: Diagnostics.Language_and_Environment, description: Diagnostics.Enable_lib_replacement, - defaultValueDescription: true + defaultValueDescription: false }, // Strict Type Checks { @@ -41300,7 +41438,7 @@ var commandOptionsWithoutBuild = [ showInSimplifiedHelpView: true, category: Diagnostics.Type_Checking, description: Diagnostics.Enable_all_strict_type_checking_options, - defaultValueDescription: false + defaultValueDescription: true }, { name: "noImplicitAny", @@ -41310,7 +41448,7 @@ var commandOptionsWithoutBuild = [ 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", @@ -41320,7 +41458,7 @@ var commandOptionsWithoutBuild = [ 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", @@ -41330,7 +41468,7 @@ var commandOptionsWithoutBuild = [ 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", @@ -41340,7 +41478,7 @@ var commandOptionsWithoutBuild = [ 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", @@ -41350,7 +41488,7 @@ var commandOptionsWithoutBuild = [ 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", @@ -41360,7 +41498,17 @@ var commandOptionsWithoutBuild = [ 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", @@ -41370,7 +41518,7 @@ var commandOptionsWithoutBuild = [ 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", @@ -41380,7 +41528,7 @@ var commandOptionsWithoutBuild = [ 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", @@ -41388,10 +41536,9 @@ var commandOptionsWithoutBuild = [ 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 }, // Additional Checks { @@ -41480,13 +41627,13 @@ var commandOptionsWithoutBuild = [ nodenext: 99 /* NodeNext */, bundler: 100 /* Bundler */ })), - 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", @@ -41559,7 +41706,7 @@ var commandOptionsWithoutBuild = [ 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", @@ -41570,7 +41717,7 @@ var commandOptionsWithoutBuild = [ 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", @@ -41653,7 +41800,7 @@ var commandOptionsWithoutBuild = [ affectsBuildInfo: true, category: Diagnostics.Modules, description: Diagnostics.Check_side_effect_imports, - defaultValueDescription: false + defaultValueDescription: true }, // Source Maps { @@ -44316,7 +44463,7 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil const affectingLocations = []; let features = getNodeResolutionFeatures(options); if (resolutionMode !== void 0) { - features |= 30 /* AllFeatures */; + features |= 94 /* AllFeatures */; } const moduleResolution = getEmitModuleResolutionKind(options); if (resolutionMode === 99 /* ESNext */ && (3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */)) { @@ -44471,10 +44618,10 @@ function getNodeResolutionFeatures(options) { features = 30 /* Node16Default */; break; case 99 /* NodeNext */: - features = 30 /* NodeNextDefault */; + features = 94 /* NodeNextDefault */; break; case 100 /* Bundler */: - features = 30 /* BundlerDefault */; + features = 94 /* BundlerDefault */; break; } if (options.resolvePackageJsonExports) { @@ -44523,10 +44670,10 @@ function resolvePackageNameToPackageJson(packageName, containingDirectory, optio }); } 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) { @@ -44539,7 +44686,7 @@ function getAutomaticTypeDirectiveNames(options, host) { if (!isNotNeededPackage) { const baseFileName = getBaseFileName(normalized); if (baseFileName.charCodeAt(0) !== 46 /* dot */) { - result.push(baseFileName); + wildcardMatches.push(baseFileName); } } } @@ -44547,7 +44694,7 @@ function getAutomaticTypeDirectiveNames(options, host) { } } } - return result; + return deduplicate(flatten(options.types.map((t) => t === "*" ? wildcardMatches : t)), equateValues); } function isPackageJsonInfo(entry) { return !!(entry == null ? void 0 : entry.contents); @@ -45074,10 +45221,11 @@ var NodeResolutionFeatures = /* @__PURE__ */ ((NodeResolutionFeatures2) => { 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 /* AllFeatures */] = "NodeNextDefault"; - NodeResolutionFeatures2[NodeResolutionFeatures2["BundlerDefault"] = 30] = "BundlerDefault"; + NodeResolutionFeatures2[NodeResolutionFeatures2["NodeNextDefault"] = 94 /* AllFeatures */] = "NodeNextDefault"; + NodeResolutionFeatures2[NodeResolutionFeatures2["BundlerDefault"] = 94] = "BundlerDefault"; NodeResolutionFeatures2[NodeResolutionFeatures2["EsmMode"] = 32] = "EsmMode"; return NodeResolutionFeatures2; })(NodeResolutionFeatures || {}); @@ -45095,7 +45243,7 @@ function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, h } function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) { return nodeNextModuleNameResolverWorker( - 30 /* NodeNextDefault */, + 94 /* NodeNextDefault */, moduleName, containingFile, compilerOptions, @@ -45174,11 +45322,11 @@ function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, hos } else { extensions = getResolveJsonModule(compilerOptions) ? 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */ | 8 /* Json */ : 1 /* TypeScript */ | 2 /* JavaScript */ | 4 /* Declaration */; } - return nodeModuleNameResolverWorker(conditions ? 30 /* AllFeatures */ : 0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, !!isConfigLookup, redirectedReference, conditions); + return nodeModuleNameResolverWorker(conditions ? 94 /* AllFeatures */ : 0 /* None */, moduleName, getDirectoryPath(containingFile), compilerOptions, host, cache, extensions, !!isConfigLookup, redirectedReference, conditions); } function nodeNextJsonConfigResolver(moduleName, containingFile, host) { return nodeModuleNameResolverWorker( - 30 /* NodeNextDefault */, + 94 /* NodeNextDefault */, moduleName, getDirectoryPath(containingFile), { moduleResolution: 99 /* NodeNext */ }, @@ -45251,7 +45399,7 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory, const diagnosticState = { ...state, compilerOptions: diagnosticsCompilerOptions, - features: 30 /* BundlerDefault */, + features: 94 /* BundlerDefault */, conditions: getConditions(diagnosticsCompilerOptions), reportDiagnostic: noop }; @@ -45901,7 +46049,7 @@ function loadModuleFromExports(scope, extensions, subpath, state, cache, redirec } function loadModuleFromImports(extensions, moduleName, directory, state, cache, redirectedReference) { var _a, _b; - if (moduleName === "#" || startsWith(moduleName, "#/")) { + if (moduleName === "#" || startsWith(moduleName, "#/") && !(state.features & 64 /* ImportsPatternRoot */)) { if (state.traceEnabled) { trace(state.host, Diagnostics.Invalid_import_specifier_0_has_no_possible_resolutions, moduleName); } @@ -46121,7 +46269,9 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec 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 { @@ -46154,10 +46304,7 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec if (state.traceEnabled) { trace(state.host, Diagnostics.package_json_scope_0_explicitly_maps_specifier_1_to_null, scope.packageDirectory, moduleName); } - return toSearchResult( - /*value*/ - void 0 - ); + return { value: void 0 }; } if (state.traceEnabled) { trace(state.host, Diagnostics.package_json_scope_0_has_invalid_type_for_target_of_specifier_1, scope.packageDirectory, moduleName); @@ -46179,7 +46326,7 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec 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 ? void 0 : _b2.call(_a2)) || "", getCanonicalFileName)); commonSourceDirGuesses.push(commonDir); } else if (state.requestContainingDirectory) { @@ -46786,6 +46933,7 @@ var ContainerFlags = /* @__PURE__ */ ((ContainerFlags2) => { 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) { @@ -46835,13 +46983,6 @@ function createBinder() { /*antecedent*/ void 0 ); - var reportedUnreachableFlow = createFlowNode( - 1 /* Unreachable */, - /*node*/ - void 0, - /*antecedent*/ - void 0 - ); var bindBinaryExpressionFlow = createBindBinaryExpressionFlow(); return bindSourceFile2; function createDiagnosticForNode2(node, message, ...args) { @@ -46857,7 +46998,6 @@ function createBinder() { symbolCount = 0; Symbol48 = objectAllocator.getSymbolConstructor(); Debug.attachFlowNodeDebugInfo(unreachableFlow); - Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow); if (!file.locals) { (_a = tracing) == null ? void 0 : _a.push( tracing.Phase.Bind, @@ -46899,7 +47039,7 @@ function createBinder() { emitFlags = 0 /* None */; } function bindInStrictMode(file2, opts) { - if (getStrictOptionValue(opts, "alwaysStrict") && !file2.isDeclarationFile) { + if (getAlwaysStrict(opts) && !file2.isDeclarationFile) { return true; } else { return !!file2.externalModuleIndicator; @@ -47155,6 +47295,7 @@ function createBinder() { const saveExceptionTarget = currentExceptionTarget; const saveActiveLabelList = activeLabelList; const saveHasExplicitReturn = hasExplicitReturn; + const saveSeenThisKeyword = seenThisKeyword; const isImmediatelyInvoked = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node, 1024 /* Async */) && !node.asteriskToken && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 176 /* ClassStaticBlockDeclaration */; if (!isImmediatelyInvoked) { currentFlow = createFlowNode( @@ -47174,13 +47315,17 @@ function createBinder() { currentContinueTarget = void 0; activeLabelList = void 0; hasExplicitReturn = false; + seenThisKeyword = false; bindChildren(node); - node.flags &= ~5632 /* ReachabilityAndEmitFlags */; + node.flags &= ~(5632 /* ReachabilityAndEmitFlags */ | 256 /* ContainsThis */); if (!(currentFlow.flags & 1 /* Unreachable */) && containerFlags & 8 /* IsFunctionLike */ && nodeIsPresent(node.body)) { node.flags |= 512 /* HasImplicitReturn */; if (hasExplicitReturn) node.flags |= 1024 /* HasExplicitReturn */; node.endFlowNode = currentFlow; } + if (seenThisKeyword) { + node.flags |= 256 /* ContainsThis */; + } if (node.kind === 308 /* SourceFile */) { node.flags |= emitFlags; node.endFlowNode = currentFlow; @@ -47201,11 +47346,14 @@ function createBinder() { currentExceptionTarget = saveExceptionTarget; activeLabelList = saveActiveLabelList; hasExplicitReturn = saveHasExplicitReturn; + seenThisKeyword = containerFlags & 256 /* PropagatesThisKeyword */ ? saveSeenThisKeyword || seenThisKeyword : saveSeenThisKeyword; } else if (containerFlags & 64 /* IsInterface */) { + const saveSeenThisKeyword = seenThisKeyword; seenThisKeyword = false; bindChildren(node); Debug.assertNotNode(node, isIdentifier); node.flags = seenThisKeyword ? node.flags | 256 /* ContainsThis */ : node.flags & ~256 /* ContainsThis */; + seenThisKeyword = saveSeenThisKeyword; } else { bindChildren(node); } @@ -47230,16 +47378,22 @@ function createBinder() { function bindChildren(node) { const saveInAssignmentPattern = inAssignmentPattern; inAssignmentPattern = false; - if (checkUnreachable(node)) { - if (canHaveFlowNode(node) && node.flowNode) { + if (isPotentiallyExecutableNode(node)) { + node.flags &= ~1073741824 /* Unreachable */; + } + if (currentFlow === unreachableFlow) { + if (canHaveFlowNode(node)) { node.flowNode = void 0; } + if (isPotentiallyExecutableNode(node)) { + node.flags |= 1073741824 /* Unreachable */; + } bindEachChild(node); bindJSDoc(node); inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 244 /* FirstStatement */ && node.kind <= 260 /* LastStatement */ && (!options.allowUnreachableCode || node.kind === 254 /* ReturnStatement */)) { + if (244 /* FirstStatement */ <= node.kind && node.kind <= 260 /* LastStatement */ && canHaveFlowNode(node)) { node.flowNode = currentFlow; } switch (node.kind) { @@ -47826,8 +47980,8 @@ function createBinder() { }; 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 /* Unreachable */; } activeLabelList = activeLabelList.next; addAntecedent(postStatementLabel, currentFlow); @@ -48604,20 +48758,6 @@ function createBinder() { 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 /* Suggestion */ }); - } - } function bind(node) { if (!node) { return; @@ -48693,6 +48833,9 @@ function createBinder() { } // falls through case 110 /* ThisKeyword */: + if (node.kind === 110 /* ThisKeyword */) { + seenThisKeyword = true; + } if (currentFlow && (isExpression(node) || parent2.kind === 305 /* ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } @@ -49504,61 +49647,6 @@ function createBinder() { declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 526824 /* TypeParameterExcludes */); } } - function shouldReportErrorOnModuleDeclaration(node) { - const instanceState = getModuleInstanceState(node); - return instanceState === 1 /* Instantiated */ || instanceState === 2 /* ConstEnumOnly */ && shouldPreserveConstEnums(options); - } - function checkUnreachable(node) { - if (!(currentFlow.flags & 1 /* Unreachable */)) { - return false; - } - if (currentFlow === unreachableFlow) { - const reportError = ( - // report error on all statements except empty ones - isStatementButNotDeclaration(node) && node.kind !== 243 /* EmptyStatement */ || // report error on class declarations - node.kind === 264 /* ClassDeclaration */ || // report errors on enums with preserved emit - isEnumDeclarationWithPreservedEmit(node, options) || // report error on instantiated modules - node.kind === 268 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node) - ); - if (reportError) { - currentFlow = reportedUnreachableFlow; - if (!options.allowUnreachableCode) { - const isError = unreachableCodeIsError(options) && !(node.flags & 33554432 /* Ambient */) && (!isVariableStatement(node) || !!(getCombinedNodeFlags(node.declarationList) & 7 /* BlockScoped */) || 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 /* EnumDeclaration */ && (!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) && // `var x;` may declare a variable used above - !(isVariableStatement(s) && !(getCombinedNodeFlags(s) & 7 /* BlockScoped */) && s.declarationList.declarations.some((d) => !d.initializer)); - } - function isPurelyTypeDeclaration(s) { - switch (s.kind) { - case 265 /* InterfaceDeclaration */: - case 266 /* TypeAliasDeclaration */: - return true; - case 268 /* ModuleDeclaration */: - return getModuleInstanceState(s) !== 1 /* Instantiated */; - case 267 /* EnumDeclaration */: - return !isEnumDeclarationWithPreservedEmit(s, options); - default: - return false; - } - } } function isExportsOrModuleExportsOrAlias(sourceFile, node) { let i = 0; @@ -49615,6 +49703,8 @@ function getContainerFlags(node) { // falls through case 177 /* Constructor */: case 263 /* FunctionDeclaration */: + case 176 /* ClassStaticBlockDeclaration */: + return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */; case 174 /* MethodSignature */: case 180 /* CallSignature */: case 324 /* JSDocSignature */: @@ -49622,17 +49712,15 @@ function getContainerFlags(node) { case 185 /* FunctionType */: case 181 /* ConstructSignature */: case 186 /* ConstructorType */: - case 176 /* ClassStaticBlockDeclaration */: - return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */; + return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 256 /* PropagatesThisKeyword */; case 352 /* JSDocImportTag */: - return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */; + return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 256 /* PropagatesThisKeyword */; case 219 /* FunctionExpression */: - case 220 /* ArrowFunction */: return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */; + case 220 /* ArrowFunction */: + return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */ | 256 /* PropagatesThisKeyword */; case 269 /* ModuleBlock */: return 4 /* IsControlFlowContainer */; - case 173 /* PropertyDeclaration */: - return node.initializer ? 4 /* IsControlFlowContainer */ : 0; case 300 /* CatchClause */: case 249 /* ForStatement */: case 250 /* ForInStatement */: @@ -49694,7 +49782,7 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu visitedTypes[type.id] = type; const shouldBail = visitSymbol(type.symbol); if (shouldBail) return; - if (type.flags & 524288 /* Object */) { + if (type.flags & 1048576 /* Object */) { const objectType = type; const objectFlags = objectType.objectFlags; if (objectFlags & 4 /* Reference */) { @@ -49710,16 +49798,16 @@ function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignatu visitObjectType(objectType); } } - if (type.flags & 262144 /* TypeParameter */) { + if (type.flags & 524288 /* TypeParameter */) { visitTypeParameter(type); } - if (type.flags & 3145728 /* UnionOrIntersection */) { + if (type.flags & 402653184 /* UnionOrIntersection */) { visitUnionOrIntersectionType(type); } - if (type.flags & 4194304 /* Index */) { + if (type.flags & 2097152 /* Index */) { visitIndexType(type); } - if (type.flags & 8388608 /* IndexedAccess */) { + if (type.flags & 33554432 /* IndexedAccess */) { visitIndexedAccessType(type); } } @@ -50999,6 +51087,8 @@ function createTypeChecker(host) { var currentNode; var varianceTypeParameter; var isInferencePartiallyBlocked = false; + var withinUnreachableCode = false; + var reportedUnreachableNodes; var emptySymbols = createSymbolTable(); var arrayVariances = [1 /* Covariant */]; var compilerOptions = host.getCompilerOptions(); @@ -51017,7 +51107,9 @@ function createTypeChecker(host) { 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])) : void 0; var checkBinaryExpression = createCheckBinaryExpression(); var emitResolver = createResolver(); var nodeBuilder = createNodeBuilder(); @@ -51218,7 +51310,7 @@ function createTypeChecker(host) { if (!node) { return void 0; } - if (contextFlags & 4 /* Completions */) { + if (contextFlags & 4 /* IgnoreNodeInferences */) { return runWithInferenceBlockedFromSourceNode(node, () => getContextualType2(node, contextFlags)); } return getContextualType2(node, contextFlags); @@ -51362,7 +51454,7 @@ function createTypeChecker(host) { getSuggestedSymbolForNonexistentModule, getSuggestedSymbolForNonexistentClassMember, getBaseConstraintOfType, - getDefaultFromTypeParameter: (type) => type && type.flags & 262144 /* TypeParameter */ ? getDefaultFromTypeParameter(type) : void 0, + getDefaultFromTypeParameter: (type) => type && type.flags & 524288 /* TypeParameter */ ? getDefaultFromTypeParameter(type) : void 0, resolveName(name, location, meaning, excludeGlobals) { return resolveName( location, @@ -51570,10 +51662,10 @@ function createTypeChecker(host) { var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */, "non-inferrable"); var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic"); var unknownType = createIntrinsicType(2 /* Unknown */, "unknown"); - var undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined"); - var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */, "widening"); + var undefinedType = createIntrinsicType(4 /* Undefined */, "undefined"); + var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(4 /* Undefined */, "undefined", 65536 /* ContainsWideningType */, "widening"); var missingType = createIntrinsicType( - 32768 /* Undefined */, + 4 /* Undefined */, "undefined", /*objectFlags*/ void 0, @@ -51581,33 +51673,33 @@ function createTypeChecker(host) { ); var undefinedOrMissingType = exactOptionalPropertyTypes ? missingType : undefinedType; var optionalType = createIntrinsicType( - 32768 /* Undefined */, + 4 /* Undefined */, "undefined", /*objectFlags*/ void 0, "optional" ); - var nullType = createIntrinsicType(65536 /* Null */, "null"); - var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(65536 /* Null */, "null", 65536 /* ContainsWideningType */, "widening"); - var stringType = createIntrinsicType(4 /* String */, "string"); - var numberType = createIntrinsicType(8 /* Number */, "number"); - var bigintType = createIntrinsicType(64 /* BigInt */, "bigint"); + var nullType = createIntrinsicType(8 /* Null */, "null"); + var nullWideningType = strictNullChecks ? nullType : createIntrinsicType(8 /* Null */, "null", 65536 /* ContainsWideningType */, "widening"); + var stringType = createIntrinsicType(32 /* String */, "string"); + var numberType = createIntrinsicType(64 /* Number */, "number"); + var bigintType = createIntrinsicType(128 /* BigInt */, "bigint"); var falseType = createIntrinsicType( - 512 /* BooleanLiteral */, + 8192 /* BooleanLiteral */, "false", /*objectFlags*/ void 0, "fresh" ); - var regularFalseType = createIntrinsicType(512 /* BooleanLiteral */, "false"); + var regularFalseType = createIntrinsicType(8192 /* BooleanLiteral */, "false"); var trueType = createIntrinsicType( - 512 /* BooleanLiteral */, + 8192 /* BooleanLiteral */, "true", /*objectFlags*/ void 0, "fresh" ); - var regularTrueType = createIntrinsicType(512 /* BooleanLiteral */, "true"); + var regularTrueType = createIntrinsicType(8192 /* BooleanLiteral */, "true"); trueType.regularType = regularTrueType; trueType.freshType = trueType; regularTrueType.regularType = regularTrueType; @@ -51617,40 +51709,40 @@ function createTypeChecker(host) { regularFalseType.regularType = regularFalseType; regularFalseType.freshType = falseType; var booleanType = getUnionType([regularFalseType, regularTrueType]); - var esSymbolType = createIntrinsicType(4096 /* ESSymbol */, "symbol"); - var voidType = createIntrinsicType(16384 /* Void */, "void"); - var neverType = createIntrinsicType(131072 /* Never */, "never"); - var silentNeverType = createIntrinsicType(131072 /* Never */, "never", 262144 /* NonInferrableType */, "silent"); + var esSymbolType = createIntrinsicType(512 /* ESSymbol */, "symbol"); + var voidType = createIntrinsicType(16 /* Void */, "void"); + var neverType = createIntrinsicType(262144 /* Never */, "never"); + var silentNeverType = createIntrinsicType(262144 /* Never */, "never", 262144 /* NonInferrableType */, "silent"); var implicitNeverType = createIntrinsicType( - 131072 /* Never */, + 262144 /* Never */, "never", /*objectFlags*/ void 0, "implicit" ); var unreachableNeverType = createIntrinsicType( - 131072 /* Never */, + 262144 /* Never */, "never", /*objectFlags*/ void 0, "unreachable" ); - var nonPrimitiveType = createIntrinsicType(67108864 /* NonPrimitive */, "object"); + var nonPrimitiveType = createIntrinsicType(131072 /* NonPrimitive */, "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 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t, () => "(restrictive mapper)"); - var permissiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? wildcardType : t, () => "(permissive mapper)"); + var restrictiveMapper = makeFunctionTypeMapper((t) => t.flags & 524288 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t, () => "(restrictive mapper)"); + var permissiveMapper = makeFunctionTypeMapper((t) => t.flags & 524288 /* TypeParameter */ ? wildcardType : t, () => "(permissive mapper)"); var uniqueLiteralType = createIntrinsicType( - 131072 /* Never */, + 262144 /* Never */, "never", /*objectFlags*/ void 0, "unique literal" ); - var uniqueLiteralMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t, () => "(unique literal mapper)"); + var uniqueLiteralMapper = makeFunctionTypeMapper((t) => t.flags & 524288 /* TypeParameter */ ? uniqueLiteralType : t, () => "(unique literal mapper)"); var outofbandVarianceMarkerHandler; var reportUnreliableMapper = makeFunctionTypeMapper((t) => { if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) { @@ -51839,7 +51931,6 @@ function createTypeChecker(host) { } }; var anyIterationTypes = createIterationTypes(anyType, anyType, anyType); - var silentNeverIterationTypes = createIterationTypes(silentNeverType, silentNeverType, silentNeverType); var asyncIterationTypesResolver = { iterableCacheKey: "iterationTypesOfAsyncIterable", iteratorCacheKey: "iterationTypesOfAsyncIterator", @@ -52362,7 +52453,9 @@ function createTypeChecker(host) { const targetSymbol = target.get(id); const merged = targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol); if (mergedParent && targetSymbol) { - merged.parent = mergedParent; + if (merged.flags & 33554432 /* Transient */) { + merged.parent = mergedParent; + } } target.set(id, merged); }); @@ -52928,9 +53021,9 @@ function createTypeChecker(host) { 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 /* Union */) && allTypesAssignableToKind( + return !!(type.flags & 134217728 /* Union */) && allTypesAssignableToKind( type, - 384 /* StringOrNumberLiteral */, + 3072 /* StringOrNumberLiteral */, /*strict*/ true ); @@ -53142,6 +53235,15 @@ function createTypeChecker(host) { if (usageMode === 99 /* ESNext */ && targetMode === 99 /* ESNext */) { 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 /* ESNext */ && 5 /* ES2015 */ <= targetModuleKind && targetModuleKind <= 99 /* ESNext */) { + return false; + } + } + } } if (!allowSyntheticDefaultImports) { return false; @@ -53993,9 +54095,9 @@ function createTypeChecker(host) { } } } - function resolveExternalModuleName(location, moduleReferenceExpression, ignoreErrors) { + function resolveExternalModuleName(location, moduleReferenceExpression, ignoreErrors, errorMessage) { const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */; - 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 ? void 0 : errorMessage, ignoreErrors); } function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, ignoreErrors = false, isForAugmentation = false) { @@ -54017,11 +54119,7 @@ function createTypeChecker(host) { 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 : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isVariableDeclaration(location) && location.initializer && isRequireCall( - location.initializer, - /*requireStringLiteralLikeArgument*/ - true - ) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, or(isImportDeclaration, isJSDocImportTag, isExportDeclaration))) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression); + const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || isVariableDeclarationInitializedToBareOrAccessedRequire(location) && getModuleSpecifierOfBareOrAccessedRequire(location) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, or(isImportDeclaration, isJSDocImportTag, isExportDeclaration))) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _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 ? void 0 : _f.resolvedModule; @@ -54285,7 +54383,7 @@ function createTypeChecker(host) { /*skipObjectFunctionPropertyAugment*/ true ) || isEsmCjsRef) { - const moduleType = type.flags & 3670016 /* StructuredType */ ? getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference) : createDefaultPropertyWrapperForModule(symbol, symbol.parent); + const moduleType = type.flags & 403701760 /* StructuredType */ ? getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, reference) : createDefaultPropertyWrapperForModule(symbol, symbol.parent); return cloneTypeAsModuleType(symbol, moduleType, referenceParent); } } @@ -54363,7 +54461,7 @@ function createTypeChecker(host) { return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0; } function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) { - return !(resolvedExternalModuleType.flags & 402784252 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path + return !(resolvedExternalModuleType.flags & 12713980 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType)); } function getExportsOfSymbol(symbol) { @@ -54568,7 +54666,7 @@ function createTypeChecker(host) { )) { return append(concatenate(concatenate([container2], additionalContainers), reexportContainers), objectLiteralContainer); } - const firstVariableMatch = !(container2.flags & getQualifiedLeftMeaning(meaning)) && container2.flags & 788968 /* Type */ && getDeclaredTypeOfSymbol(container2).flags & 524288 /* Object */ && meaning === 111551 /* Value */ ? forEachSymbolTableInScope(enclosingDeclaration, (t) => { + const firstVariableMatch = !(container2.flags & getQualifiedLeftMeaning(meaning)) && container2.flags & 788968 /* Type */ && getDeclaredTypeOfSymbol(container2).flags & 1048576 /* Object */ && meaning === 111551 /* Value */ ? forEachSymbolTableInScope(enclosingDeclaration, (t) => { return forEachEntry(t, (s) => { if (s.flags & getQualifiedLeftMeaning(meaning) && getTypeOfSymbol(s) === getDeclaredTypeOfSymbol(container2)) { return s; @@ -54659,7 +54757,7 @@ function createTypeChecker(host) { seenIntrinsicNames.add(key); } function createObjectType(objectFlags, symbol) { - const type = createTypeWithSymbol(524288 /* Object */, symbol); + const type = createTypeWithSymbol(1048576 /* Object */, symbol); type.objectFlags = objectFlags; type.members = void 0; type.properties = void 0; @@ -54669,28 +54767,64 @@ function createTypeChecker(host) { 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 /* TypeParameter */, symbol); + return createTypeWithSymbol(524288 /* TypeParameter */, symbol); } function isReservedMemberName(name) { return name.charCodeAt(0) === 95 /* _ */ && name.charCodeAt(1) === 95 /* _ */ && name.charCodeAt(2) !== 95 /* _ */ && name.charCodeAt(2) !== 64 /* at */ && name.charCodeAt(2) !== 35 /* hash */; } - 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 /* Class */ | 64 /* Interface */)) { + 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 /* Class */ | 64 /* Interface */)) || !isDeclarationContainedBy(symbol, container))) { + nonContained = append(nonContained, symbol); } }); - return result || emptyArray; + contained == null ? void 0 : contained.sort(compareSymbols); + nonContained == null ? void 0 : 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; } @@ -54701,7 +54835,7 @@ function createTypeChecker(host) { resolved.callSignatures = callSignatures; resolved.constructSignatures = constructSignatures; resolved.indexInfos = indexInfos; - if (members !== emptySymbols) resolved.properties = getNamedMembers(members); + if (members !== emptySymbols) resolved.properties = getNamedMembers(members, type.symbol); return resolved; } function createAnonymousType(symbol, members, callSignatures, constructSignatures, indexInfos) { @@ -55268,7 +55402,7 @@ function createTypeChecker(host) { return flags & 848330095 /* NodeBuilderFlagsMask */; } function isClassInstanceSide(type) { - return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || !!(type.flags & 524288 /* Object */) && !!(getObjectFlags(type) & 16777216 /* IsClassInstanceClone */)); + return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || !!(type.flags & 1048576 /* Object */) && !!(getObjectFlags(type) & 16777216 /* IsClassInstanceClone */)); } function getTypeFromTypeNodeWithoutContext(node) { return getTypeFromTypeNode(node); @@ -55417,7 +55551,7 @@ function createTypeChecker(host) { if (name.includes("/node_modules/")) { context.encounteredError = true; if (context.tracker.reportLikelyUnsafeImportRequiredError) { - context.tracker.reportLikelyUnsafeImportRequiredError(name); + context.tracker.reportLikelyUnsafeImportRequiredError(name, nodeSymbol ? unescapeLeadingUnderscores(nodeSymbol.escapedName) : void 0); } } if (name !== originalName) { @@ -55625,7 +55759,7 @@ function createTypeChecker(host) { if (name && isComputedPropertyName(name)) return name; } const nameType = getSymbolLinks(symbol).nameType; - if (nameType && nameType.flags & (1024 /* EnumLiteral */ | 8192 /* UniqueESSymbol */)) { + if (nameType && nameType.flags & (32768 /* EnumLiteral */ | 16384 /* UniqueESSymbol */)) { context.enclosingDeclaration = nameType.symbol.valueDeclaration; return factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); } @@ -55702,7 +55836,7 @@ function createTypeChecker(host) { return statements; } function withContext2(enclosingDeclaration, flags, internalFlags, tracker, maximumLength, verbosityLevel, cb, out) { - const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : (internalFlags || 0 /* None */) & 4 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0; + const moduleResolverHost = (tracker == null ? void 0 : tracker.moduleResolverHost) ?? createBasicNodeBuilderModuleSpecifierResolutionHost(host); flags = flags || 0 /* None */; const maxTruncationLength = maximumLength || (flags & 1 /* NoTruncation */ ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength); const context = { @@ -55847,23 +55981,23 @@ function createTypeChecker(host) { if (type.flags & 2 /* Unknown */) { return factory.createKeywordTypeNode(159 /* UnknownKeyword */); } - if (type.flags & 4 /* String */) { + if (type.flags & 32 /* String */) { context.approximateLength += 6; return factory.createKeywordTypeNode(154 /* StringKeyword */); } - if (type.flags & 8 /* Number */) { + if (type.flags & 64 /* Number */) { context.approximateLength += 6; return factory.createKeywordTypeNode(150 /* NumberKeyword */); } - if (type.flags & 64 /* BigInt */) { + if (type.flags & 128 /* BigInt */) { context.approximateLength += 6; return factory.createKeywordTypeNode(163 /* BigIntKeyword */); } - if (type.flags & 16 /* Boolean */ && !type.aliasSymbol) { + if (type.flags & 256 /* Boolean */ && !type.aliasSymbol) { context.approximateLength += 7; return factory.createKeywordTypeNode(136 /* BooleanKeyword */); } - if (type.flags & 1056 /* EnumLike */) { + if (type.flags & 98304 /* EnumLike */) { if (type.symbol.flags & 8 /* EnumMember */) { const parentSymbol = getParentOfSymbol(type.symbol); const parentName = symbolToTypeNode(parentSymbol, context, 788968 /* Type */); @@ -55871,7 +56005,7 @@ function createTypeChecker(host) { return parentName; } const memberName = symbolName(type.symbol); - if (isIdentifierText(memberName, 1 /* ES5 */)) { + if (isIdentifierText(memberName, 99 /* ESNext */)) { return appendReferenceToType( parentName, factory.createTypeReferenceNode( @@ -55896,24 +56030,24 @@ function createTypeChecker(host) { expandingEnum = true; } } - if (type.flags & 128 /* StringLiteral */) { + if (type.flags & 1024 /* StringLiteral */) { context.approximateLength += type.value.length + 2; return factory.createLiteralTypeNode(setEmitFlags(factory.createStringLiteral(type.value, !!(context.flags & 268435456 /* UseSingleQuotesForStringLiteralType */)), 16777216 /* NoAsciiEscaping */)); } - if (type.flags & 256 /* NumberLiteral */) { + if (type.flags & 2048 /* NumberLiteral */) { const value = type.value; context.approximateLength += ("" + value).length; return factory.createLiteralTypeNode(value < 0 ? factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(-value)) : factory.createNumericLiteral(value)); } - if (type.flags & 2048 /* BigIntLiteral */) { + if (type.flags & 4096 /* BigIntLiteral */) { context.approximateLength += pseudoBigIntToString(type.value).length + 1; return factory.createLiteralTypeNode(factory.createBigIntLiteral(type.value)); } - if (type.flags & 512 /* BooleanLiteral */) { + if (type.flags & 8192 /* BooleanLiteral */) { context.approximateLength += type.intrinsicName.length; return factory.createLiteralTypeNode(type.intrinsicName === "true" ? factory.createTrue() : factory.createFalse()); } - if (type.flags & 8192 /* UniqueESSymbol */) { + if (type.flags & 16384 /* UniqueESSymbol */) { if (!(context.flags & 1048576 /* AllowUniqueESSymbolType */)) { if (isValueSymbolAccessible(type.symbol, context.enclosingDeclaration)) { context.approximateLength += 6; @@ -55926,27 +56060,27 @@ function createTypeChecker(host) { context.approximateLength += 13; return factory.createTypeOperatorNode(158 /* UniqueKeyword */, factory.createKeywordTypeNode(155 /* SymbolKeyword */)); } - if (type.flags & 16384 /* Void */) { + if (type.flags & 16 /* Void */) { context.approximateLength += 4; return factory.createKeywordTypeNode(116 /* VoidKeyword */); } - if (type.flags & 32768 /* Undefined */) { + if (type.flags & 4 /* Undefined */) { context.approximateLength += 9; return factory.createKeywordTypeNode(157 /* UndefinedKeyword */); } - if (type.flags & 65536 /* Null */) { + if (type.flags & 8 /* Null */) { context.approximateLength += 4; return factory.createLiteralTypeNode(factory.createNull()); } - if (type.flags & 131072 /* Never */) { + if (type.flags & 262144 /* Never */) { context.approximateLength += 5; return factory.createKeywordTypeNode(146 /* NeverKeyword */); } - if (type.flags & 4096 /* ESSymbol */) { + if (type.flags & 512 /* ESSymbol */) { context.approximateLength += 6; return factory.createKeywordTypeNode(155 /* SymbolKeyword */); } - if (type.flags & 67108864 /* NonPrimitive */) { + if (type.flags & 131072 /* NonPrimitive */) { context.approximateLength += 6; return factory.createKeywordTypeNode(151 /* ObjectKeyword */); } @@ -55978,7 +56112,7 @@ function createTypeChecker(host) { } const objectFlags = getObjectFlags(type); if (objectFlags & 4 /* Reference */) { - Debug.assert(!!(type.flags & 524288 /* Object */)); + Debug.assert(!!(type.flags & 1048576 /* Object */)); if (shouldExpandType(type, context)) { context.depth += 1; return createAnonymousTypeNode( @@ -55991,8 +56125,8 @@ function createTypeChecker(host) { } return type.node ? visitAndTransformType(type, typeReferenceToTypeNode) : typeReferenceToTypeNode(type); } - if (type.flags & 262144 /* TypeParameter */ || objectFlags & 3 /* ClassOrInterface */) { - if (type.flags & 262144 /* TypeParameter */ && contains(context.inferTypeParameters, type)) { + if (type.flags & 524288 /* TypeParameter */ || objectFlags & 3 /* ClassOrInterface */) { + if (type.flags & 524288 /* TypeParameter */ && contains(context.inferTypeParameters, type)) { context.approximateLength += symbolName(type.symbol).length + 6; let constraintNode; const constraint = getConstraintOfTypeParameter(type); @@ -56009,7 +56143,7 @@ function createTypeChecker(host) { } return factory.createInferTypeNode(typeParameterToDeclarationWithConstraint(type, context, constraintNode)); } - if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 262144 /* TypeParameter */) { + if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type.flags & 524288 /* TypeParameter */) { const name2 = typeParameterToName(type, context); context.approximateLength += idText(name2).length; return factory.createTypeReferenceNode( @@ -56038,11 +56172,11 @@ function createTypeChecker(host) { void 0 ); } - if (type.flags & 1048576 /* Union */ && type.origin) { + if (type.flags & 134217728 /* Union */ && type.origin) { type = type.origin; } - if (type.flags & (1048576 /* Union */ | 2097152 /* Intersection */)) { - const types = type.flags & 1048576 /* Union */ ? formatUnionTypes(type.types, expandingEnum) : type.types; + if (type.flags & (134217728 /* Union */ | 268435456 /* Intersection */)) { + const types = type.flags & 134217728 /* Union */ ? formatUnionTypes(type.types, expandingEnum) : type.types; if (length(types) === 1) { return typeToTypeNodeHelper(types[0], context); } @@ -56053,7 +56187,7 @@ function createTypeChecker(host) { true ); if (typeNodes && typeNodes.length > 0) { - return type.flags & 1048576 /* Union */ ? factory.createUnionTypeNode(typeNodes) : factory.createIntersectionTypeNode(typeNodes); + return type.flags & 134217728 /* Union */ ? factory.createUnionTypeNode(typeNodes) : factory.createIntersectionTypeNode(typeNodes); } else { if (!context.encounteredError && !(context.flags & 262144 /* AllowEmptyUnionOrIntersection */)) { context.encounteredError = true; @@ -56062,16 +56196,16 @@ function createTypeChecker(host) { } } if (objectFlags & (16 /* Anonymous */ | 32 /* Mapped */)) { - Debug.assert(!!(type.flags & 524288 /* Object */)); + Debug.assert(!!(type.flags & 1048576 /* Object */)); return createAnonymousTypeNode(type); } - if (type.flags & 4194304 /* Index */) { + if (type.flags & 2097152 /* Index */) { const indexedType = type.type; context.approximateLength += 6; const indexTypeNode = typeToTypeNodeHelper(indexedType, context); return factory.createTypeOperatorNode(143 /* KeyOfKeyword */, indexTypeNode); } - if (type.flags & 134217728 /* TemplateLiteral */) { + if (type.flags & 4194304 /* TemplateLiteral */) { const texts = type.texts; const types = type.types; const templateHead = factory.createTemplateHead(texts[0]); @@ -56084,20 +56218,20 @@ function createTypeChecker(host) { context.approximateLength += 2; return factory.createTemplateLiteralType(templateHead, templateSpans); } - if (type.flags & 268435456 /* StringMapping */) { + if (type.flags & 8388608 /* StringMapping */) { const typeNode = typeToTypeNodeHelper(type.type, context); return symbolToTypeNode(type.symbol, context, 788968 /* Type */, [typeNode]); } - if (type.flags & 8388608 /* IndexedAccess */) { + if (type.flags & 33554432 /* IndexedAccess */) { const objectTypeNode = typeToTypeNodeHelper(type.objectType, context); const indexTypeNode = typeToTypeNodeHelper(type.indexType, context); context.approximateLength += 2; return factory.createIndexedAccessTypeNode(objectTypeNode, indexTypeNode); } - if (type.flags & 16777216 /* Conditional */) { + if (type.flags & 67108864 /* Conditional */) { return visitAndTransformType(type, (type2) => conditionalTypeToTypeNode(type2)); } - if (type.flags & 33554432 /* Substitution */) { + if (type.flags & 16777216 /* Substitution */) { const typeNode = typeToTypeNodeHelper(type.baseType, context); const noInferSymbol = isNoInferType(type) && getGlobalTypeSymbol( "NoInfer", @@ -56110,7 +56244,7 @@ function createTypeChecker(host) { function conditionalTypeToTypeNode(type2) { const checkTypeNode = typeToTypeNodeHelper(type2.checkType, context); context.approximateLength += 15; - if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type2.root.isDistributive && !(type2.checkType.flags & 262144 /* TypeParameter */)) { + if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && type2.root.isDistributive && !(type2.checkType.flags & 524288 /* TypeParameter */)) { const newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T")); const name = typeParameterToName(newParam, context); const newTypeVariable = factory.createTypeReferenceNode(name); @@ -56148,7 +56282,7 @@ function createTypeChecker(host) { } function typeToTypeNodeOrCircularityElision(type2) { var _a2, _b2, _c; - if (type2.flags & 1048576 /* Union */) { + if (type2.flags & 134217728 /* Union */) { if ((_a2 = context.visitedTypes) == null ? void 0 : _a2.has(getTypeId(type2))) { if (!(context.flags & 131072 /* AllowAnonymousIdentifier */)) { context.encounteredError = true; @@ -56168,14 +56302,14 @@ function createTypeChecker(host) { } function createMappedTypeNodeFromType(type2) { var _a2; - Debug.assert(!!(type2.flags & 524288 /* Object */)); + Debug.assert(!!(type2.flags & 1048576 /* Object */)); const readonlyToken = type2.declaration.readonlyToken ? factory.createToken(type2.declaration.readonlyToken.kind) : void 0; const questionToken = type2.declaration.questionToken ? factory.createToken(type2.declaration.questionToken.kind) : void 0; let appropriateConstraintTypeNode; let newTypeVariable; let templateType = getTemplateTypeFromMappedType(type2); const typeParameter = getTypeParameterFromMappedType(type2); - const needsModifierPreservingWrapper = !isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 2 /* Unknown */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && !(getConstraintTypeFromMappedType(type2).flags & 262144 /* TypeParameter */ && ((_a2 = getConstraintOfTypeParameter(getConstraintTypeFromMappedType(type2))) == null ? void 0 : _a2.flags) & 4194304 /* Index */); + const needsModifierPreservingWrapper = !isMappedTypeWithKeyofConstraintDeclaration(type2) && !(getModifiersTypeFromMappedType(type2).flags & 2 /* Unknown */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && !(getConstraintTypeFromMappedType(type2).flags & 524288 /* TypeParameter */ && ((_a2 = getConstraintOfTypeParameter(getConstraintTypeFromMappedType(type2))) == null ? void 0 : _a2.flags) & 2097152 /* Index */); if (isMappedTypeWithKeyofConstraintDeclaration(type2)) { if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) { const newConstraintParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T")); @@ -56311,7 +56445,7 @@ function createTypeChecker(host) { var _a2, _b2, _c; const typeId = type2.id; const isConstructorObject = getObjectFlags(type2) & 16 /* Anonymous */ && type2.symbol && type2.symbol.flags & 32 /* Class */; - const id = getObjectFlags(type2) & 4 /* Reference */ && type2.node ? "N" + getNodeId(type2.node) : type2.flags & 16777216 /* Conditional */ ? "N" + getNodeId(type2.root.node) : type2.symbol ? (isConstructorObject ? "+" : "") + getSymbolId(type2.symbol) : void 0; + const id = getObjectFlags(type2) & 4 /* Reference */ && type2.node ? "N" + getNodeId(type2.node) : type2.flags & 67108864 /* Conditional */ ? "N" + getNodeId(type2.root.node) : type2.symbol ? (isConstructorObject ? "+" : "") + getSymbolId(type2.symbol) : void 0; if (!context.visitedTypes) { context.visitedTypes = /* @__PURE__ */ new Set(); } @@ -56679,6 +56813,9 @@ function createTypeChecker(host) { if (getDeclarationModifierFlagsFromSymbol(propertySymbol) & (2 /* Private */ | 4 /* Protected */) && 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; @@ -56838,7 +56975,7 @@ function createTypeChecker(host) { } const optionalToken = propertySymbol.flags & 16777216 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0; if (propertySymbol.flags & (16 /* Function */ | 8192 /* Method */) && !getPropertiesOfObjectType(propertyType).length && !isReadonlySymbol(propertySymbol)) { - const signatures = getSignaturesOfType(filterType(propertyType, (t) => !(t.flags & 32768 /* Undefined */)), 0 /* Call */); + const signatures = getSignaturesOfType(filterType(propertyType, (t) => !(t.flags & 4 /* Undefined */)), 0 /* Call */); for (const signature of signatures) { const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 174 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration, signature.declaration || propertySymbol.valueDeclaration)); @@ -57127,8 +57264,8 @@ function createTypeChecker(host) { reportInaccessibleUniqueSymbolError() { markError(() => oldTracker.reportInaccessibleUniqueSymbolError()); }, - reportLikelyUnsafeImportRequiredError(specifier) { - markError(() => oldTracker.reportLikelyUnsafeImportRequiredError(specifier)); + reportLikelyUnsafeImportRequiredError(specifier, symbolName2) { + markError(() => oldTracker.reportLikelyUnsafeImportRequiredError(specifier, symbolName2)); }, reportNonSerializableProperty(name) { markError(() => oldTracker.reportNonSerializableProperty(name)); @@ -57654,7 +57791,7 @@ function createTypeChecker(host) { if (!attributes) { context.encounteredError = true; if (context.tracker.reportLikelyUnsafeImportRequiredError) { - context.tracker.reportLikelyUnsafeImportRequiredError(oldSpecifier); + context.tracker.reportLikelyUnsafeImportRequiredError(oldSpecifier, unescapeLeadingUnderscores(symbol.escapedName)); } } } @@ -57888,11 +58025,11 @@ function createTypeChecker(host) { } if (isComputedPropertyName(name)) { const type = checkExpression(name.expression); - return !!(type.flags & 402653316 /* StringLike */); + return !!(type.flags & 12583968 /* StringLike */); } if (isElementAccessExpression(name)) { const type = checkExpression(name.argumentExpression); - return !!(type.flags & 402653316 /* StringLike */); + return !!(type.flags & 12583968 /* StringLike */); } return isStringLiteral(name); } @@ -57922,7 +58059,7 @@ function createTypeChecker(host) { function getPropertyNameNodeForSymbolFromNameType(symbol, context, singleQuote, stringNamed, isMethod) { const nameType = getSymbolLinks(symbol).nameType; if (nameType) { - if (nameType.flags & 384 /* StringOrNumberLiteral */) { + if (nameType.flags & 3072 /* StringOrNumberLiteral */) { const name = "" + nameType.value; if (!isIdentifierText(name, getEmitScriptTarget(compilerOptions)) && (stringNamed || !isNumericLiteralName(name))) { return factory.createStringLiteral(name, !!singleQuote); @@ -57932,7 +58069,7 @@ function createTypeChecker(host) { } return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod); } - if (nameType.flags & 8192 /* UniqueESSymbol */) { + if (nameType.flags & 16384 /* UniqueESSymbol */) { return factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, 111551 /* Value */)); } } @@ -57974,7 +58111,7 @@ function createTypeChecker(host) { return enclosingDeclaration; } function serializeInferredTypeForDeclaration(symbol, context, type) { - if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === context.enclosingFile))) { + if (type.flags & 16384 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === context.enclosingFile))) { context.flags |= 1048576 /* AllowUniqueESSymbolType */; } const result = typeToTypeNodeHelper(type, context); @@ -58207,7 +58344,7 @@ function createTypeChecker(host) { } function serializeExistingTypeNode(context, typeNode, addUndefined) { const type = getTypeFromTypeNode2(context, typeNode); - if (addUndefined && !someType(type, (t) => !!(t.flags & 32768 /* Undefined */)) && canReuseTypeNode(context, typeNode)) { + if (addUndefined && !someType(type, (t) => !!(t.flags & 4 /* Undefined */)) && canReuseTypeNode(context, typeNode)) { const clone2 = syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode); if (clone2) { return factory.createUnionTypeNode([clone2, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]); @@ -59973,10 +60110,10 @@ function createTypeChecker(host) { for (let i = 0; i < types.length; i++) { const t = types[i]; flags |= t.flags; - if (!(t.flags & 98304 /* Nullable */)) { - if (t.flags & 512 /* BooleanLiteral */ || !expandingEnum && t.flags | 1056 /* EnumLike */) { - const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t); - if (baseType.flags & 1048576 /* Union */) { + if (!(t.flags & 12 /* Nullable */)) { + if (t.flags & 8192 /* BooleanLiteral */ || !expandingEnum && t.flags | 98304 /* EnumLike */) { + const baseType = t.flags & 8192 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t); + if (baseType.flags & 134217728 /* Union */) { const count = baseType.types.length; if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) { result.push(baseType); @@ -59988,8 +60125,8 @@ function createTypeChecker(host) { result.push(t); } } - if (flags & 65536 /* Null */) result.push(nullType); - if (flags & 32768 /* Undefined */) result.push(undefinedType); + if (flags & 8 /* Null */) result.push(nullType); + if (flags & 4 /* Undefined */) result.push(undefinedType); return result || types; } function visibilityToString(flags) { @@ -60019,7 +60156,7 @@ function createTypeChecker(host) { function getNameOfSymbolFromNameType(symbol, context) { const nameType = getSymbolLinks(symbol).nameType; if (nameType) { - if (nameType.flags & 384 /* StringOrNumberLiteral */) { + if (nameType.flags & 3072 /* StringOrNumberLiteral */) { const name = "" + nameType.value; if (!isIdentifierText(name, getEmitScriptTarget(compilerOptions)) && !isNumericLiteralName(name)) { return `"${escapeString(name, 34 /* doubleQuote */)}"`; @@ -60029,7 +60166,7 @@ function createTypeChecker(host) { } return name; } - if (nameType.flags & 8192 /* UniqueESSymbol */) { + if (nameType.flags & 16384 /* UniqueESSymbol */) { return `[${getNameOfSymbolAsWritten(nameType.symbol, context)}]`; } } @@ -60054,7 +60191,7 @@ function createTypeChecker(host) { } if (isComputedPropertyName(name2) && !(getCheckFlags(symbol) & 4096 /* Late */)) { const nameType = getSymbolLinks(symbol).nameType; - if (nameType && nameType.flags & 384 /* StringOrNumberLiteral */) { + if (nameType && nameType.flags & 3072 /* StringOrNumberLiteral */) { const result = getNameOfSymbolFromNameType(symbol, context); if (result !== void 0) { return result; @@ -60335,18 +60472,18 @@ function createTypeChecker(host) { ); } function getRestType(source, properties, symbol) { - source = filterType(source, (t) => !(t.flags & 98304 /* Nullable */)); - if (source.flags & 131072 /* Never */) { + source = filterType(source, (t) => !(t.flags & 12 /* Nullable */)); + if (source.flags & 262144 /* Never */) { return emptyObjectType; } - if (source.flags & 1048576 /* Union */) { + if (source.flags & 134217728 /* Union */) { 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 /* StringOrNumberLiteralOrUnique */); + const literalTypeFromProperty = getLiteralTypeFromProperty(prop, 19456 /* StringOrNumberLiteralOrUnique */); if (!isTypeAssignableTo(literalTypeFromProperty, omitKeyType) && !(getDeclarationModifierFlagsFromSymbol(prop) & (2 /* Private */ | 4 /* Protected */)) && isSpreadableProperty(prop)) { spreadableProperties.push(prop); } else { @@ -60357,7 +60494,7 @@ function createTypeChecker(host) { if (unspreadableToRestKeys.length) { omitKeyType = getUnionType([omitKeyType, ...unspreadableToRestKeys]); } - if (omitKeyType.flags & 131072 /* Never */) { + if (omitKeyType.flags & 262144 /* Never */) { return source; } const omitTypeAlias = getGlobalOmitSymbol(); @@ -60379,10 +60516,10 @@ function createTypeChecker(host) { return result; } function isGenericTypeWithUndefinedConstraint(type) { - return !!(type.flags & 465829888 /* Instantiable */) && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 32768 /* Undefined */); + return !!(type.flags & 132644864 /* Instantiable */) && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 4 /* Undefined */); } function getNonUndefinedType(type) { - const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t) : type; + const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags & 132644864 /* Instantiable */ ? getBaseConstraintOrType(t) : t) : type; return getTypeWithFacts(typeOrConstraint, 524288 /* NEUndefined */); } function getFlowTypeOfDestructuring(node, declaredType) { @@ -60433,7 +60570,7 @@ function createTypeChecker(host) { } function getLiteralPropertyNameText(name) { const type = getLiteralTypeFromPropertyName(name); - return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0; + return type.flags & (1024 /* StringLiteral */ | 2048 /* NumberLiteral */) ? "" + type.value : void 0; } function getTypeForBindingElement(declaration) { const checkMode = declaration.dotDotDotToken ? 32 /* RestBindingElement */ : 0 /* Normal */; @@ -60481,7 +60618,7 @@ function createTypeChecker(host) { const elementType = checkIteratedTypeOrElementType(65 /* Destructuring */ | (declaration.dotDotDotToken ? 0 : 128 /* PossiblyOutOfBounds */), parentType, undefinedType, pattern); const index = pattern.elements.indexOf(declaration); if (declaration.dotDotDotToken) { - const baseConstraint = mapType(parentType, (t) => t.flags & 58982400 /* InstantiableNonPrimitive */ ? getBaseConstraintOrType(t) : t); + const baseConstraint = mapType(parentType, (t) => t.flags & 117964800 /* InstantiableNonPrimitive */ ? getBaseConstraintOrType(t) : t); type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType); } else if (isArrayLikeType(parentType)) { const indexType = getNumberLiteralType(index); @@ -60532,7 +60669,7 @@ function createTypeChecker(host) { /*checkMode*/ checkMode ))); - return indexType.flags & (262144 /* TypeParameter */ | 4194304 /* Index */) ? getExtractStringType(indexType) : stringType; + return indexType.flags & (524288 /* TypeParameter */ | 2097152 /* Index */) ? getExtractStringType(indexType) : stringType; } if (isVariableDeclaration(declaration) && declaration.parent.parent.kind === 251 /* ForOfStatement */) { const forOfStatement = declaration.parent.parent; @@ -60773,7 +60910,7 @@ function createTypeChecker(host) { definedInConstructor = true; } } - const sourceTypes = some(constructorTypes, (t) => !!(t.flags & ~98304 /* Nullable */)) ? constructorTypes : types; + const sourceTypes = some(constructorTypes, (t) => !!(t.flags & ~12 /* Nullable */)) ? constructorTypes : types; type = getUnionType(sourceTypes); } } @@ -60783,7 +60920,7 @@ function createTypeChecker(host) { false, definedInMethod && !definedInConstructor )); - if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) { + if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~12 /* Nullable */)) === neverType) { reportImplicitAny(symbol.valueDeclaration, anyType); return anyType; } @@ -60872,7 +61009,7 @@ function createTypeChecker(host) { } const isDirectExport = kind === 1 /* ExportsProperty */ && (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 /* Object */ && kind === 2 /* ModuleExports */ && symbol.escapedName === "export=" /* ExportEquals */) { + if (type.flags & 1048576 /* Object */ && kind === 2 /* ModuleExports */ && symbol.escapedName === "export=" /* ExportEquals */) { const exportedType = resolveStructuredTypeMembers(type); const members = createSymbolTable(); copyEntries(exportedType.members, members); @@ -61081,13 +61218,13 @@ function createTypeChecker(host) { } function widenTypeForVariableLikeDeclaration(type, declaration, reportErrors2) { if (type) { - if (type.flags & 4096 /* ESSymbol */ && isGlobalSymbolConstructor(declaration.parent)) { + if (type.flags & 512 /* ESSymbol */ && isGlobalSymbolConstructor(declaration.parent)) { type = getESSymbolLikeTypeForNode(declaration); } if (reportErrors2) { reportErrorsFromWidening(declaration, type); } - if (type.flags & 8192 /* UniqueESSymbol */ && (isBindingElement(declaration) || !tryGetTypeFromEffectiveTypeNode(declaration)) && type.symbol !== getSymbolOfDeclaration(declaration)) { + if (type.flags & 16384 /* UniqueESSymbol */ && (isBindingElement(declaration) || !tryGetTypeFromEffectiveTypeNode(declaration)) && type.symbol !== getSymbolOfDeclaration(declaration)) { type = esSymbolType; } return getWidenedType(type); @@ -61299,7 +61436,7 @@ function createTypeChecker(host) { } function getBaseTypeVariableOfClass(symbol) { const baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol)); - return baseConstructorType.flags & 8650752 /* TypeVariable */ ? baseConstructorType : baseConstructorType.flags & 2097152 /* Intersection */ ? find(baseConstructorType.types, (t) => !!(t.flags & 8650752 /* TypeVariable */)) : void 0; + return baseConstructorType.flags & 34078720 /* TypeVariable */ ? baseConstructorType : baseConstructorType.flags & 268435456 /* Intersection */ ? find(baseConstructorType.types, (t) => !!(t.flags & 34078720 /* TypeVariable */)) : void 0; } function getTypeOfFuncClassEnumModule(symbol) { let links = getSymbolLinks(symbol); @@ -61409,7 +61546,7 @@ function createTypeChecker(host) { if (!links.type) { Debug.assertIsDefined(links.deferralParent); Debug.assertIsDefined(links.deferralConstituents); - links.type = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents); + links.type = links.deferralParent.flags & 134217728 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents); } return links.type; } @@ -61418,7 +61555,7 @@ function createTypeChecker(host) { if (!links.writeType && links.deferralWriteConstituents) { Debug.assertIsDefined(links.deferralParent); Debug.assertIsDefined(links.deferralConstituents); - links.writeType = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents); + links.writeType = links.deferralParent.flags & 134217728 /* Union */ ? getUnionType(links.deferralWriteConstituents) : getIntersectionType(links.deferralWriteConstituents); } return links.writeType; } @@ -61495,7 +61632,7 @@ function createTypeChecker(host) { if (getObjectFlags(type2) & (3 /* ClassOrInterface */ | 4 /* Reference */)) { const target = getTargetType(type2); return target === checkBase || some(getBaseTypes(target), check); - } else if (type2.flags & 2097152 /* Intersection */) { + } else if (type2.flags & 268435456 /* Intersection */) { return some(type2.types, check); } return false; @@ -61619,7 +61756,7 @@ function createTypeChecker(host) { if (getSignaturesOfType(type, 1 /* Construct */).length > 0) { return true; } - if (type.flags & 8650752 /* TypeVariable */) { + if (type.flags & 34078720 /* TypeVariable */) { const constraint = getBaseConstraintOfType(type); return !!constraint && isMixinConstructorType(constraint); } @@ -61655,7 +61792,7 @@ function createTypeChecker(host) { Debug.assert(!extended.typeArguments); checkExpression(extended.expression); } - if (baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */)) { + if (baseConstructorType.flags & (1048576 /* Object */ | 268435456 /* Intersection */)) { resolveStructuredTypeMembers(baseConstructorType); } if (!popTypeResolution()) { @@ -61664,7 +61801,7 @@ function createTypeChecker(host) { } if (!(baseConstructorType.flags & 1 /* Any */) && baseConstructorType !== nullWideningType && !isConstructorType(baseConstructorType)) { const err = error2(baseTypeNode.expression, Diagnostics.Type_0_is_not_a_constructor_function_type, typeToString(baseConstructorType)); - if (baseConstructorType.flags & 262144 /* TypeParameter */) { + if (baseConstructorType.flags & 524288 /* TypeParameter */) { const constraint = getConstraintFromTypeParameter(baseConstructorType); let ctorReturn = unknownType; if (constraint) { @@ -61712,6 +61849,9 @@ function createTypeChecker(host) { )); } function getBaseTypes(type) { + if (!(getObjectFlags(type) & (3 /* ClassOrInterface */ | 4 /* Reference */))) { + return emptyArray; + } if (!type.baseTypesResolved) { if (pushTypeResolution(type, 6 /* ResolvedBaseTypes */)) { if (type.objectFlags & 8 /* Tuple */) { @@ -61745,7 +61885,7 @@ function createTypeChecker(host) { function resolveBaseTypesOfClass(type) { type.resolvedBaseTypes = resolvingEmptyArray; const baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type)); - if (!(baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 1 /* Any */))) { + if (!(baseConstructorType.flags & (1048576 /* Object */ | 268435456 /* Intersection */ | 1 /* Any */))) { return type.resolvedBaseTypes = emptyArray; } const baseTypeNode = getBaseTypeNodeOfClass(type); @@ -61801,13 +61941,13 @@ function createTypeChecker(host) { return true; } function isValidBaseType(type) { - if (type.flags & 262144 /* TypeParameter */) { + if (type.flags & 524288 /* TypeParameter */) { const constraint = getBaseConstraintOfType(type); if (constraint) { return isValidBaseType(constraint); } } - return !!(type.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */ | 1 /* Any */) && !isGenericMappedType(type) || type.flags & 2097152 /* Intersection */ && every(type.types, isValidBaseType)); + return !!(type.flags & (1048576 /* Object */ | 131072 /* NonPrimitive */ | 1 /* Any */) && !isGenericMappedType(type) || type.flags & 268435456 /* Intersection */ && every(type.types, isValidBaseType)); } function resolveBaseTypesOfInterface(type) { type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; @@ -61927,7 +62067,7 @@ function createTypeChecker(host) { return links.declaredType; } function getBaseTypeOfEnumLikeType(type) { - return type.flags & 1056 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type; + return type.flags & 98304 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type; } function getDeclaredTypeOfEnum(symbol) { const links = getSymbolLinks(symbol); @@ -61957,8 +62097,8 @@ function createTypeChecker(host) { /*aliasTypeArguments*/ void 0 ) : createComputedEnumType(symbol); - if (enumType.flags & 1048576 /* Union */) { - enumType.flags |= 1024 /* EnumLiteral */; + if (enumType.flags & 134217728 /* Union */) { + enumType.flags |= 32768 /* EnumLiteral */; enumType.symbol = symbol; } links.declaredType = enumType; @@ -61966,8 +62106,8 @@ function createTypeChecker(host) { return links.declaredType; } function createComputedEnumType(symbol) { - const regularType = createTypeWithSymbol(32 /* Enum */, symbol); - const freshType = createTypeWithSymbol(32 /* Enum */, symbol); + const regularType = createTypeWithSymbol(65536 /* Enum */, symbol); + const freshType = createTypeWithSymbol(65536 /* Enum */, symbol); regularType.regularType = regularType; regularType.freshType = freshType; freshType.regularType = regularType; @@ -62096,7 +62236,7 @@ function createTypeChecker(host) { 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; @@ -62167,7 +62307,7 @@ function createTypeChecker(host) { const earlySymbol = earlySymbols && earlySymbols.get(memberName); if (!(parent2.flags & 32 /* Class */) && lateSymbol.flags & getExcludedSymbolFlags(symbolFlags)) { const declarations = earlySymbol ? concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations; - const name = !(type.flags & 8192 /* UniqueESSymbol */) && unescapeLeadingUnderscores(memberName) || declarationNameToString(declName); + const name = !(type.flags & 16384 /* UniqueESSymbol */) && 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 /* None */, memberName, 4096 /* Late */); @@ -62280,7 +62420,7 @@ function createTypeChecker(host) { 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 /* Intersection */) { + } else if (type.flags & 268435456 /* Intersection */) { const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType)); return types !== type.types ? getIntersectionType(types) : type; } @@ -62380,7 +62520,7 @@ function createTypeChecker(host) { function createUnionSignature(signature, unionSignatures) { const result = cloneSignature(signature); result.compositeSignatures = unionSignatures; - result.compositeKind = 1048576 /* Union */; + result.compositeKind = 134217728 /* Union */; result.target = void 0; result.mapper = void 0; return result; @@ -62408,7 +62548,7 @@ function createTypeChecker(host) { const restType = getTypeOfSymbol(restSymbol); if (isTupleType(restType)) { return [expandSignatureParametersWithTupleMembers(restType, restIndex, restSymbol)]; - } else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) { + } else if (!skipUnionExpanding && restType.flags & 134217728 /* Union */ && every(restType.types, isTupleType)) { return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restSymbol)); } } @@ -62691,11 +62831,11 @@ function createTypeChecker(host) { minArgCount, flags ); - result.compositeKind = 1048576 /* Union */; - result.compositeSignatures = concatenate(left.compositeKind !== 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]); + result.compositeKind = 134217728 /* Union */; + result.compositeSignatures = concatenate(left.compositeKind !== 268435456 /* Intersection */ && left.compositeSignatures || [left], [right]); if (paramMapper) { - result.mapper = left.compositeKind !== 2097152 /* Intersection */ && left.mapper && left.compositeSignatures ? combineTypeMappers(left.mapper, paramMapper) : paramMapper; - } else if (left.compositeKind !== 2097152 /* Intersection */ && left.mapper && left.compositeSignatures) { + result.mapper = left.compositeKind !== 268435456 /* Intersection */ && left.mapper && left.compositeSignatures ? combineTypeMappers(left.mapper, paramMapper) : paramMapper; + } else if (left.compositeKind !== 268435456 /* Intersection */ && left.mapper && left.compositeSignatures) { result.mapper = left.mapper; } return result; @@ -62848,8 +62988,8 @@ function createTypeChecker(host) { if (symbol.flags & 32 /* Class */) { const classType = getDeclaredTypeOfClassOrInterface(symbol); const baseConstructorType = getBaseConstructorTypeOfClass(classType); - if (baseConstructorType.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 8650752 /* TypeVariable */)) { - members = createSymbolTable(getNamedOrIndexSignatureMembers(members)); + if (baseConstructorType.flags & (1048576 /* Object */ | 268435456 /* Intersection */ | 34078720 /* TypeVariable */)) { + members = createSymbolTable(getNamedOrIndexSignatureMembers(members, symbol)); addInheritedMembers(members, getPropertiesOfType(baseConstructorType)); } else if (baseConstructorType === anyType) { baseConstructorIndexInfo = anyBaseTypeIndexInfo; @@ -62862,7 +63002,7 @@ function createTypeChecker(host) { if (baseConstructorIndexInfo) { indexInfos = append(indexInfos, baseConstructorIndexInfo); } - if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 32 /* Enum */ || some(type.properties, (prop) => !!(getTypeOfSymbol(prop).flags & 296 /* NumberLike */)))) { + if (symbol.flags & 384 /* Enum */ && (getDeclaredTypeOfSymbol(symbol).flags & 65536 /* Enum */ || some(type.properties, (prop) => !!(getTypeOfSymbol(prop).flags & 67648 /* NumberLike */)))) { indexInfos = append(indexInfos, enumNumberIndexInfo); } } @@ -62903,11 +63043,11 @@ function createTypeChecker(host) { } function getLimitedConstraint(type) { const constraint = getConstraintTypeFromMappedType(type.mappedType); - if (!(constraint.flags & 1048576 /* Union */ || constraint.flags & 2097152 /* Intersection */)) { + if (!(constraint.flags & 134217728 /* Union */ || constraint.flags & 268435456 /* Intersection */)) { return; } - const origin = constraint.flags & 1048576 /* Union */ ? constraint.origin : constraint; - if (!origin || !(origin.flags & 2097152 /* Intersection */)) { + const origin = constraint.flags & 134217728 /* Union */ ? constraint.origin : constraint; + if (!origin || !(origin.flags & 268435456 /* Intersection */)) { return; } const limitedConstraint = getIntersectionType(origin.types.filter((t) => t !== type.constraintType)); @@ -62923,7 +63063,7 @@ function createTypeChecker(host) { const limitedConstraint = getLimitedConstraint(type); for (const prop of getPropertiesOfType(type.source)) { if (limitedConstraint) { - const propertyNameType = getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */); + const propertyNameType = getLiteralTypeFromProperty(prop, 19456 /* StringOrNumberLiteralOrUnique */); if (!isTypeAssignableTo(propertyNameType, limitedConstraint)) { continue; } @@ -62933,7 +63073,7 @@ function createTypeChecker(host) { inferredProp.declarations = prop.declarations; inferredProp.links.nameType = getSymbolLinks(prop).nameType; inferredProp.links.propertyType = getTypeOfSymbol(prop); - if (type.constraintType.type.flags & 8388608 /* IndexedAccess */ && type.constraintType.type.objectType.flags & 262144 /* TypeParameter */ && type.constraintType.type.indexType.flags & 262144 /* TypeParameter */) { + if (type.constraintType.type.flags & 33554432 /* IndexedAccess */ && type.constraintType.type.objectType.flags & 524288 /* TypeParameter */ && type.constraintType.type.indexType.flags & 524288 /* TypeParameter */) { const newTypeParam = type.constraintType.type.objectType; const newMappedType = replaceIndexedAccess(type.mappedType, type.constraintType.type, newTypeParam); inferredProp.links.mappedType = newMappedType; @@ -62947,11 +63087,11 @@ function createTypeChecker(host) { setStructuredTypeMembers(type, members, emptyArray, emptyArray, indexInfos); } function getLowerBoundOfKeyType(type) { - if (type.flags & 4194304 /* Index */) { + if (type.flags & 2097152 /* Index */) { const t = getApparentType(type.type); return isGenericTupleType(t) ? getKnownKeysOfTupleType(t) : getIndexType(t); } - if (type.flags & 16777216 /* Conditional */) { + if (type.flags & 67108864 /* Conditional */) { if (type.root.isDistributive) { const checkType = type.checkType; const constraint = getLowerBoundOfKeyType(checkType); @@ -62966,7 +63106,7 @@ function createTypeChecker(host) { } return type; } - if (type.flags & 1048576 /* Union */) { + if (type.flags & 134217728 /* Union */) { return mapType( type, getLowerBoundOfKeyType, @@ -62974,9 +63114,9 @@ function createTypeChecker(host) { true ); } - if (type.flags & 2097152 /* Intersection */) { + if (type.flags & 268435456 /* Intersection */) { const types = type.types; - if (types.length === 2 && !!(types[0].flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) && types[1] === emptyTypeLiteralType) { + if (types.length === 2 && !!(types[0].flags & (32 /* String */ | 64 /* Number */ | 128 /* BigInt */)) && types[1] === emptyTypeLiteralType) { return type; } return getIntersectionType(sameMap(type.types, getLowerBoundOfKeyType)); @@ -62994,7 +63134,7 @@ function createTypeChecker(host) { cb(stringType); } else { for (const info of getIndexInfosOfType(type)) { - if (!stringsOnly || info.keyType.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) { + if (!stringsOnly || info.keyType.flags & (32 /* String */ | 4194304 /* TemplateLiteral */)) { cb(info.keyType); } } @@ -63012,7 +63152,7 @@ function createTypeChecker(host) { const templateType = getTemplateTypeFromMappedType(mappedType); const modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); const templateModifiers = getMappedTypeModifiers(type); - const include = 8576 /* StringOrNumberLiteralOrUnique */; + const include = 19456 /* StringOrNumberLiteralOrUnique */; if (isMappedTypeWithKeyofConstraintDeclaration(type)) { forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType( modifiersType, @@ -63052,8 +63192,8 @@ function createTypeChecker(host) { } members.set(propName, prop); } - } else if (isValidIndexKeyType(propNameType) || propNameType.flags & (1 /* Any */ | 32 /* Enum */)) { - const indexKeyType = propNameType.flags & (1 /* Any */ | 4 /* String */) ? stringType : propNameType.flags & (8 /* Number */ | 32 /* Enum */) ? numberType : propNameType; + } else if (isValidIndexKeyType(propNameType) || propNameType.flags & (1 /* Any */ | 65536 /* Enum */)) { + const indexKeyType = propNameType.flags & (1 /* Any */ | 32 /* String */) ? stringType : propNameType.flags & (64 /* Number */ | 65536 /* Enum */) ? numberType : propNameType; const propType = instantiateType(templateType, appendTypeMapping(type.mapper, typeParameter, keyType)); const modifiersIndexInfo = getApplicableIndexInfo(modifiersType, propNameType); const isReadonly = !!(templateModifiers & 1 /* IncludeReadonly */ || !(templateModifiers & 2 /* ExcludeReadonly */) && (modifiersIndexInfo == null ? void 0 : modifiersIndexInfo.isReadonly)); @@ -63078,7 +63218,7 @@ function createTypeChecker(host) { 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 /* Optional */ && !maybeTypeOfKind(propType, 32768 /* Undefined */ | 16384 /* Void */) ? getOptionalType( + let type = strictNullChecks && symbol.flags & 16777216 /* Optional */ && !maybeTypeOfKind(propType, 4 /* Undefined */ | 16 /* Void */) ? getOptionalType( propType, /*isProperty*/ true @@ -63122,8 +63262,8 @@ function createTypeChecker(host) { } else { const declaredType = getTypeFromMappedTypeNode(type.declaration); const constraint = getConstraintTypeFromMappedType(declaredType); - const extendedConstraint = constraint && constraint.flags & 262144 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint; - type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper) : unknownType; + const extendedConstraint = constraint && constraint.flags & 524288 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint; + type.modifiersType = extendedConstraint && extendedConstraint.flags & 2097152 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper) : unknownType; } } return type.modifiersType; @@ -63140,7 +63280,7 @@ function createTypeChecker(host) { if (getObjectFlags(type) & 32 /* Mapped */) { return getMappedTypeOptionality(type) || getCombinedMappedTypeOptionality(getModifiersTypeFromMappedType(type)); } - if (type.flags & 2097152 /* Intersection */) { + if (type.flags & 268435456 /* Intersection */) { const optionality = getCombinedMappedTypeOptionality(type.types[0]); return every(type.types, (t, i) => i === 0 || getCombinedMappedTypeOptionality(t) === optionality) ? optionality : 0; } @@ -63171,7 +63311,7 @@ function createTypeChecker(host) { } function resolveStructuredTypeMembers(type) { if (!type.members) { - if (type.flags & 524288 /* Object */) { + if (type.flags & 1048576 /* Object */) { if (type.objectFlags & 4 /* Reference */) { resolveTypeReferenceMembers(type); } else if (type.objectFlags & 3 /* ClassOrInterface */) { @@ -63185,9 +63325,9 @@ function createTypeChecker(host) { } else { Debug.fail("Unhandled object type " + Debug.formatObjectFlags(type.objectFlags)); } - } else if (type.flags & 1048576 /* Union */) { + } else if (type.flags & 134217728 /* Union */) { resolveUnionTypeMembers(type); - } else if (type.flags & 2097152 /* Intersection */) { + } else if (type.flags & 268435456 /* Intersection */) { resolveIntersectionTypeMembers(type); } else { Debug.fail("Unhandled type " + Debug.formatTypeFlags(type.flags)); @@ -63196,13 +63336,13 @@ function createTypeChecker(host) { return type; } function getPropertiesOfObjectType(type) { - if (type.flags & 524288 /* Object */) { + if (type.flags & 1048576 /* Object */) { return resolveStructuredTypeMembers(type).properties; } return emptyArray; } function getPropertyOfObjectType(type, name) { - if (type.flags & 524288 /* Object */) { + if (type.flags & 1048576 /* Object */) { const resolved = resolveStructuredTypeMembers(type); const symbol = resolved.members.get(name); if (symbol && symbolIsValue(symbol)) { @@ -63220,28 +63360,28 @@ function createTypeChecker(host) { type, prop.escapedName, /*skipObjectFunctionPropertyAugment*/ - !!(type.flags & 2097152 /* Intersection */) + !!(type.flags & 268435456 /* Intersection */) ); if (combinedProp) { members.set(prop.escapedName, combinedProp); } } } - if (type.flags & 1048576 /* Union */ && getIndexInfosOfType(current).length === 0) { + if (type.flags & 134217728 /* Union */ && 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 /* UnionOrIntersection */ ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); + return type.flags & 402653184 /* UnionOrIntersection */ ? getPropertiesOfUnionOrIntersectionType(type) : getPropertiesOfObjectType(type); } function forEachPropertyOfType(type, action) { type = getReducedApparentType(type); - if (type.flags & 3670016 /* StructuredType */) { + if (type.flags & 403701760 /* StructuredType */) { resolveStructuredTypeMembers(type).members.forEach((symbol, escapedName) => { if (isNamedMember(symbol, escapedName)) { action(symbol, escapedName); @@ -63260,7 +63400,7 @@ function createTypeChecker(host) { } function getAllPossiblePropertiesOfTypes(types) { const unionType = getUnionType(types); - if (!(unionType.flags & 1048576 /* Union */)) { + if (!(unionType.flags & 134217728 /* Union */)) { return getAugmentedPropertiesOfType(unionType); } const props = createSymbolTable(); @@ -63275,7 +63415,7 @@ function createTypeChecker(host) { return arrayFrom(props.values()); } function getConstraintOfType(type) { - return type.flags & 262144 /* TypeParameter */ ? getConstraintOfTypeParameter(type) : type.flags & 8388608 /* IndexedAccess */ ? getConstraintOfIndexedAccess(type) : type.flags & 16777216 /* Conditional */ ? getConstraintOfConditionalType(type) : getBaseConstraintOfType(type); + return type.flags & 524288 /* TypeParameter */ ? getConstraintOfTypeParameter(type) : type.flags & 33554432 /* IndexedAccess */ ? getConstraintOfIndexedAccess(type) : type.flags & 67108864 /* Conditional */ ? getConstraintOfConditionalType(type) : getBaseConstraintOfType(type); } function getConstraintOfTypeParameter(typeParameter) { return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : void 0; @@ -63286,7 +63426,7 @@ function createTypeChecker(host) { } function isConstTypeVariable(type, depth = 0) { var _a; - return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 4096 /* Const */)) || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType, depth) || getObjectFlags(type) & 32 /* Mapped */ && isConstMappedType(type, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t, depth)) >= 0)); + return depth < 5 && !!(type && (type.flags & 524288 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 4096 /* Const */)) || type.flags & 402653184 /* UnionOrIntersection */ && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 33554432 /* IndexedAccess */ && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 67108864 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 16777216 /* Substitution */ && isConstTypeVariable(type.baseType, depth) || getObjectFlags(type) & 32 /* Mapped */ && isConstMappedType(type, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t, depth)) >= 0)); } function getConstraintOfIndexedAccess(type) { return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0; @@ -63342,7 +63482,7 @@ function createTypeChecker(host) { /*forConstraint*/ true ); - if (!(instantiated.flags & 131072 /* Never */)) { + if (!(instantiated.flags & 262144 /* Never */)) { type.resolvedConstraintOfDistributive = instantiated; return instantiated; } @@ -63361,9 +63501,9 @@ function createTypeChecker(host) { let constraints; let hasDisjointDomainType = false; for (const t of types) { - if (t.flags & 465829888 /* Instantiable */) { + if (t.flags & 132644864 /* Instantiable */) { let constraint = getConstraintOfType(t); - while (constraint && constraint.flags & (262144 /* TypeParameter */ | 4194304 /* Index */ | 16777216 /* Conditional */)) { + while (constraint && constraint.flags & (524288 /* TypeParameter */ | 2097152 /* Index */ | 67108864 /* Conditional */)) { constraint = getConstraintOfType(constraint); } if (constraint) { @@ -63372,14 +63512,14 @@ function createTypeChecker(host) { constraints = append(constraints, t); } } - } else if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) { + } else if (t.flags & 12812284 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) { hasDisjointDomainType = true; } } if (constraints && (targetIsUnion || hasDisjointDomainType)) { if (hasDisjointDomainType) { for (const t of types) { - if (t.flags & 469892092 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) { + if (t.flags & 12812284 /* DisjointDomains */ || isEmptyAnonymousObjectType(t)) { constraints = append(constraints, t); } } @@ -63393,11 +63533,11 @@ function createTypeChecker(host) { return void 0; } function getBaseConstraintOfType(type) { - if (type.flags & (58982400 /* InstantiableNonPrimitive */ | 3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || isGenericTupleType(type)) { + if (type.flags & (117964800 /* InstantiableNonPrimitive */ | 402653184 /* UnionOrIntersection */ | 4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */) || isGenericTupleType(type)) { const constraint = getResolvedBaseConstraint(type); return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : void 0; } - return type.flags & 4194304 /* Index */ ? stringNumberSymbolType : void 0; + return type.flags & 2097152 /* Index */ ? stringNumberSymbolType : void 0; } function getBaseConstraintOrType(type) { return getBaseConstraintOfType(type) || type; @@ -63428,7 +63568,7 @@ function createTypeChecker(host) { stack.pop(); } if (!popTypeResolution()) { - if (t.flags & 262144 /* TypeParameter */) { + if (t.flags & 524288 /* TypeParameter */) { const errorNode = getConstraintDeclaration(t); if (errorNode) { const diagnostic = error2(errorNode, Diagnostics.Type_parameter_0_has_a_circular_constraint, typeToString(t)); @@ -63448,11 +63588,11 @@ function createTypeChecker(host) { return c !== noConstraintType && c !== circularConstraintType ? c : void 0; } function computeBaseConstraint(t) { - if (t.flags & 262144 /* TypeParameter */) { + if (t.flags & 524288 /* TypeParameter */) { const constraint = getConstraintFromTypeParameter(t); return t.isThisType || !constraint ? constraint : getBaseConstraint(constraint); } - if (t.flags & 3145728 /* UnionOrIntersection */) { + if (t.flags & 402653184 /* UnionOrIntersection */) { const types = t.types; const baseTypes = []; let different = false; @@ -63470,21 +63610,27 @@ function createTypeChecker(host) { if (!different) { return t; } - return t.flags & 1048576 /* Union */ && baseTypes.length === types.length ? getUnionType(baseTypes) : t.flags & 2097152 /* Intersection */ && baseTypes.length ? getIntersectionType(baseTypes) : void 0; + return t.flags & 134217728 /* Union */ && baseTypes.length === types.length ? getUnionType(baseTypes) : t.flags & 268435456 /* Intersection */ && baseTypes.length ? getIntersectionType(baseTypes) : void 0; } - if (t.flags & 4194304 /* Index */) { + if (t.flags & 2097152 /* Index */) { + if (isGenericMappedType(t.type)) { + const mappedType = t.type; + if (getNameTypeFromMappedType(mappedType) && !isMappedTypeWithKeyofConstraintDeclaration(mappedType)) { + return getBaseConstraint(getIndexTypeForMappedType(mappedType, 0 /* None */)); + } + } return stringNumberSymbolType; } - if (t.flags & 134217728 /* TemplateLiteral */) { + if (t.flags & 4194304 /* TemplateLiteral */) { const types = t.types; const constraints = mapDefined(types, getBaseConstraint); return constraints.length === types.length ? getTemplateLiteralType(t.texts, constraints) : stringType; } - if (t.flags & 268435456 /* StringMapping */) { + if (t.flags & 8388608 /* StringMapping */) { const constraint = getBaseConstraint(t.type); return constraint && constraint !== t.type ? getStringMappingType(t.symbol, constraint) : stringType; } - if (t.flags & 8388608 /* IndexedAccess */) { + if (t.flags & 33554432 /* IndexedAccess */) { if (isMappedTypeGenericIndexedAccess(t)) { return getBaseConstraint(substituteIndexedMappedType(t.objectType, t.indexType)); } @@ -63493,16 +63639,16 @@ function createTypeChecker(host) { const baseIndexedAccess = baseObjectType && baseIndexType && getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, t.accessFlags); return baseIndexedAccess && getBaseConstraint(baseIndexedAccess); } - if (t.flags & 16777216 /* Conditional */) { + if (t.flags & 67108864 /* Conditional */) { const constraint = getConstraintFromConditionalType(t); return constraint && getBaseConstraint(constraint); } - if (t.flags & 33554432 /* Substitution */) { + if (t.flags & 16777216 /* Substitution */) { return getBaseConstraint(getSubstitutionIntersection(t)); } if (isGenericTupleType(t)) { const newElements = map(getElementTypes(t), (v, i) => { - const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v; + const constraint = v.flags & 524288 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v; return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v; }); return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations); @@ -63571,16 +63717,16 @@ function createTypeChecker(host) { return type; } function isArrayOrTupleOrIntersection(type) { - return !!(type.flags & 2097152 /* Intersection */) && every(type.types, isArrayOrTupleType); + return !!(type.flags & 268435456 /* Intersection */) && every(type.types, isArrayOrTupleType); } function isMappedTypeGenericIndexedAccess(type) { let objectType; - return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType); + return !!(type.flags & 33554432 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType); } function getApparentType(type) { - const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type; + const t = type.flags & 132644864 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type; const objectFlags = getObjectFlags(t); - return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? stringNumberSymbolType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t; + return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 268435456 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 12583968 /* StringLike */ ? globalStringType : t.flags & 67648 /* NumberLike */ ? globalNumberType : t.flags & 4224 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 8448 /* BooleanLike */ ? globalBooleanType : t.flags & 16896 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 131072 /* NonPrimitive */ ? emptyObjectType : t.flags & 2097152 /* Index */ ? stringNumberSymbolType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t; } function getReducedApparentType(type) { return getReducedType(getApparentType(getReducedType(type))); @@ -63591,14 +63737,14 @@ function createTypeChecker(host) { let singleProp; let propSet; let indexTypes; - const isUnion = containingType.flags & 1048576 /* Union */; + const isUnion = containingType.flags & 134217728 /* Union */; let optionalFlag; let syntheticFlag = 4 /* SyntheticMethod */; let checkFlags = isUnion ? 0 : 8 /* Readonly */; let mergedInstantiations = false; for (const current of containingType.types) { const type = getApparentType(current); - if (!(isErrorType(type) || type.flags & 131072 /* Never */)) { + if (!(isErrorType(type) || type.flags & 262144 /* Never */)) { const prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment); const modifiers = prop ? getDeclarationModifierFlagsFromSymbol(prop) : 0; if (prop) { @@ -63701,7 +63847,7 @@ function createTypeChecker(host) { if (isLiteralType(type) || isPatternLiteralType(type)) { checkFlags |= 128 /* HasLiteralType */; } - if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) { + if (type.flags & 262144 /* Never */ && type !== uniqueLiteralType) { checkFlags |= 131072 /* HasNeverType */; } propTypes.push(type); @@ -63772,9 +63918,9 @@ function createTypeChecker(host) { return property && !(getCheckFlags(property) & 16 /* ReadPartial */) ? property : void 0; } function getReducedType(type) { - if (type.flags & 1048576 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */) { + if (type.flags & 134217728 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */) { return type.resolvedReducedType || (type.resolvedReducedType = getReducedUnionType(type)); - } else if (type.flags & 2097152 /* Intersection */) { + } else if (type.flags & 268435456 /* Intersection */) { if (!(type.objectFlags & 16777216 /* IsNeverIntersectionComputed */)) { type.objectFlags |= 16777216 /* IsNeverIntersectionComputed */ | (some(getPropertiesOfUnionOrIntersectionType(type), isNeverReducedProperty) ? 33554432 /* IsNeverIntersection */ : 0); } @@ -63788,7 +63934,7 @@ function createTypeChecker(host) { return unionType; } const reduced = getUnionType(reducedTypes); - if (reduced.flags & 1048576 /* Union */) { + if (reduced.flags & 134217728 /* Union */) { reduced.resolvedReducedType = reduced; } return reduced; @@ -63797,20 +63943,20 @@ function createTypeChecker(host) { return isDiscriminantWithNeverType(prop) || isConflictingPrivateProperty(prop); } function isDiscriminantWithNeverType(prop) { - return !(prop.flags & 16777216 /* Optional */) && (getCheckFlags(prop) & (192 /* Discriminant */ | 131072 /* HasNeverType */)) === 192 /* Discriminant */ && !!(getTypeOfSymbol(prop).flags & 131072 /* Never */); + return !(prop.flags & 16777216 /* Optional */) && (getCheckFlags(prop) & (192 /* Discriminant */ | 131072 /* HasNeverType */)) === 192 /* Discriminant */ && !!(getTypeOfSymbol(prop).flags & 262144 /* Never */); } function isConflictingPrivateProperty(prop) { return !prop.valueDeclaration && !!(getCheckFlags(prop) & 1024 /* ContainsPrivate */); } function isGenericReducibleType(type) { - return !!(type.flags & 1048576 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */ && some(type.types, isGenericReducibleType) || type.flags & 2097152 /* Intersection */ && isReducibleIntersection(type)); + return !!(type.flags & 134217728 /* Union */ && type.objectFlags & 16777216 /* ContainsIntersections */ && some(type.types, isGenericReducibleType) || type.flags & 268435456 /* Intersection */ && isReducibleIntersection(type)); } function isReducibleIntersection(type) { const uniqueFilled = type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper)); return getReducedType(uniqueFilled) !== uniqueFilled; } function elaborateNeverIntersection(errorInfo, type) { - if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) { + if (type.flags & 268435456 /* Intersection */ && getObjectFlags(type) & 33554432 /* IsNeverIntersection */) { 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( @@ -63835,7 +63981,7 @@ function createTypeChecker(host) { function getPropertyOfType(type, name, skipObjectFunctionPropertyAugment, includeTypeOnlyMembers) { var _a, _b; type = getReducedApparentType(type); - if (type.flags & 524288 /* Object */) { + if (type.flags & 1048576 /* Object */) { const resolved = resolveStructuredTypeMembers(type); const symbol = resolved.members.get(name); if (symbol && !includeTypeOnlyMembers && ((_a = type.symbol) == null ? void 0 : _a.flags) & 512 /* ValueModule */ && ((_b = getSymbolLinks(type.symbol).typeOnlyExportStarMap) == null ? void 0 : _b.has(name))) { @@ -63854,7 +64000,7 @@ function createTypeChecker(host) { } return getPropertyOfObjectType(globalObjectType, name); } - if (type.flags & 2097152 /* Intersection */) { + if (type.flags & 268435456 /* Intersection */) { const prop = getPropertyOfUnionOrIntersectionType( type, name, @@ -63869,13 +64015,13 @@ function createTypeChecker(host) { } return void 0; } - if (type.flags & 1048576 /* Union */) { + if (type.flags & 134217728 /* Union */) { return getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment); } return void 0; } function getSignaturesOfStructuredType(type, kind) { - if (type.flags & 3670016 /* StructuredType */) { + if (type.flags & 403701760 /* StructuredType */) { const resolved = resolveStructuredTypeMembers(type); return kind === 0 /* Call */ ? resolved.callSignatures : resolved.constructSignatures; } @@ -63883,7 +64029,7 @@ function createTypeChecker(host) { } function getSignaturesOfType(type, kind) { const result = getSignaturesOfStructuredType(getReducedApparentType(type), kind); - if (kind === 0 /* Call */ && !length(result) && type.flags & 1048576 /* Union */) { + if (kind === 0 /* Call */ && !length(result) && type.flags & 134217728 /* Union */) { if (type.arrayFallbackSignatures) { return type.arrayFallbackSignatures; } @@ -63938,10 +64084,10 @@ function createTypeChecker(host) { )) : applicableInfo ? applicableInfo : stringIndexInfo && isApplicableIndexType(keyType, stringType) ? stringIndexInfo : void 0; } function isApplicableIndexType(source, target) { - return isTypeAssignableTo(source, target) || target === stringType && isTypeAssignableTo(source, numberType) || target === numberType && (source === numericStringType || !!(source.flags & 128 /* StringLiteral */) && isNumericLiteralName(source.value)); + return isTypeAssignableTo(source, target) || target === stringType && isTypeAssignableTo(source, numberType) || target === numberType && (source === numericStringType || !!(source.flags & 1024 /* StringLiteral */) && isNumericLiteralName(source.value)); } function getIndexInfosOfStructuredType(type) { - if (type.flags & 3670016 /* StructuredType */) { + if (type.flags & 403701760 /* StructuredType */) { const resolved = resolveStructuredTypeMembers(type); return resolved.indexInfos; } @@ -64267,7 +64413,7 @@ function createTypeChecker(host) { } 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 /* Boolean */) && getParameterCount(signature) > 0) { + } else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType.flags & 256 /* Boolean */) && getParameterCount(signature) > 0) { const { declaration } = signature; signature.resolvedTypePredicate = noTypePredicate; signature.resolvedTypePredicate = getTypePredicateFromBody(declaration) || noTypePredicate; @@ -64292,7 +64438,7 @@ function createTypeChecker(host) { ) : createTypePredicate(node.assertsModifier ? 3 /* AssertsIdentifier */ : 1 /* Identifier */, parameterName.escapedText, findIndex(signature.parameters, (p) => p.escapedName === parameterName.escapedText), type); } function getUnionOrIntersectionType(types, kind, unionReduction) { - return kind !== 2097152 /* Intersection */ ? getUnionType(types, unionReduction) : getIntersectionType(types); + return kind !== 268435456 /* Intersection */ ? getUnionType(types, unionReduction) : getIntersectionType(types); } function getReturnTypeOfSignature(signature) { if (!signature.resolvedReturnType) { @@ -64538,7 +64684,7 @@ function createTypeChecker(host) { return emptyArray; } function isValidIndexKeyType(type) { - return !!(type.flags & (4 /* String */ | 8 /* Number */ | 4096 /* ESSymbol */)) || isPatternLiteralType(type) || !!(type.flags & 2097152 /* Intersection */) && !isGenericType(type) && some(type.types, isValidIndexKeyType); + return !!(type.flags & (32 /* String */ | 64 /* Number */ | 512 /* ESSymbol */)) || isPatternLiteralType(type) || !!(type.flags & 268435456 /* Intersection */) && !isGenericType(type) && some(type.types, isValidIndexKeyType); } function getConstraintDeclaration(type) { return mapDefined(filter(type.symbol && type.symbol.declarations, isTypeParameterDeclaration), getEffectiveConstraintOfTypeParameter)[0]; @@ -64909,10 +65055,10 @@ function createTypeChecker(host) { return isNoInferTargetType(type) ? getOrCreateSubstitutionType(type, unknownType) : type; } function isNoInferTargetType(type) { - return !!(type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, isNoInferTargetType) || type.flags & 33554432 /* Substitution */ && !isNoInferType(type) && isNoInferTargetType(type.baseType) || type.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(type) || type.flags & (465829888 /* Instantiable */ & ~33554432 /* Substitution */) && !isPatternLiteralType(type)); + return !!(type.flags & 402653184 /* UnionOrIntersection */ && some(type.types, isNoInferTargetType) || type.flags & 16777216 /* Substitution */ && !isNoInferType(type) && isNoInferTargetType(type.baseType) || type.flags & 1048576 /* Object */ && !isEmptyAnonymousObjectType(type) || type.flags & (132644864 /* Instantiable */ & ~16777216 /* Substitution */) && !isPatternLiteralType(type)); } function isNoInferType(type) { - return !!(type.flags & 33554432 /* Substitution */ && type.constraint.flags & 2 /* Unknown */); + return !!(type.flags & 16777216 /* Substitution */ && type.constraint.flags & 2 /* Unknown */); } function getSubstitutionType(baseType, constraint) { return constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */ ? baseType : getOrCreateSubstitutionType(baseType, constraint); @@ -64923,7 +65069,7 @@ function createTypeChecker(host) { if (cached) { return cached; } - const result = createType(33554432 /* Substitution */); + const result = createType(16777216 /* Substitution */); result.baseType = baseType; result.constraint = constraint; substitutionTypes.set(id, result); @@ -64946,12 +65092,12 @@ function createTypeChecker(host) { if (parent2.kind === 170 /* Parameter */) { covariant = !covariant; } - if ((covariant || type.flags & 8650752 /* TypeVariable */) && parent2.kind === 195 /* ConditionalType */ && node === parent2.trueType) { + if ((covariant || type.flags & 34078720 /* TypeVariable */) && parent2.kind === 195 /* ConditionalType */ && node === parent2.trueType) { const constraint = getImpliedConstraint(type, parent2.checkType, parent2.extendsType); if (constraint) { constraints = append(constraints, constraint); } - } else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 201 /* MappedType */ && !parent2.nameType && node === parent2.type) { + } else if (type.flags & 524288 /* TypeParameter */ && parent2.kind === 201 /* MappedType */ && !parent2.nameType && node === parent2.type) { const mappedType = getTypeFromTypeNode(parent2); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { const typeParameter = getHomomorphicTypeVariable(mappedType); @@ -65039,7 +65185,7 @@ function createTypeChecker(host) { } function getTypeFromJSDocNullableTypeNode(node) { const type = getTypeFromTypeNode(node.type); - return strictNullChecks ? getNullableType(type, 65536 /* Null */) : type; + return strictNullChecks ? getNullableType(type, 8 /* Null */) : type; } function getTypeFromTypeReference(node) { const links = getNodeLinks(node); @@ -65106,7 +65252,7 @@ function createTypeChecker(host) { return arity ? emptyGenericType : emptyObjectType; } const type = getDeclaredTypeOfSymbol(symbol); - if (!(type.flags & 524288 /* Object */)) { + if (!(type.flags & 1048576 /* Object */)) { error2(getTypeDeclaration(symbol), Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbolName(symbol)); return arity ? emptyGenericType : emptyObjectType; } @@ -65703,7 +65849,7 @@ function createTypeChecker(host) { return createTypeReference(target, elementTypes); } if (target.combinedFlags & 8 /* Variadic */) { - const unionIndex = findIndex(elementTypes, (t, i) => !!(target.elementFlags[i] & 8 /* Variadic */ && t.flags & (131072 /* Never */ | 1048576 /* Union */))); + const unionIndex = findIndex(elementTypes, (t, i) => !!(target.elementFlags[i] & 8 /* Variadic */ && t.flags & (262144 /* Never */ | 134217728 /* Union */))); if (unionIndex >= 0) { return checkCrossProductUnion(map(elementTypes, (t, i) => target.elementFlags[i] & 8 /* Variadic */ ? t : unknownType)) ? mapType(elementTypes[unionIndex], (t) => createNormalizedTupleType(target, replaceElement(elementTypes, unionIndex, t))) : errorType; } @@ -65720,7 +65866,7 @@ function createTypeChecker(host) { if (flags & 8 /* Variadic */) { if (type.flags & 1 /* Any */) { addElement(type, 4 /* Rest */, (_a = target.labeledElementDeclarations) == null ? void 0 : _a[i]); - } else if (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) { + } else if (type.flags & 117964800 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) { addElement(type, 8 /* Variadic */, (_b = target.labeledElementDeclarations) == null ? void 0 : _b[i]); } else if (isTupleType(type)) { const elements = getElementTypes(type); @@ -65812,10 +65958,10 @@ function createTypeChecker(host) { 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; @@ -65824,17 +65970,17 @@ function createTypeChecker(host) { } function addTypeToUnion(typeSet, includes, type) { const flags = type.flags; - if (!(flags & 131072 /* Never */)) { - includes |= flags & 473694207 /* IncludesMask */; - if (flags & 465829888 /* Instantiable */) includes |= 33554432 /* IncludesInstantiable */; - if (flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) includes |= 536870912 /* IncludesConstrainedTypeVariable */; - if (type === wildcardType) includes |= 8388608 /* IncludesWildcard */; + if (!(flags & 262144 /* Never */)) { + includes |= flags & 416808959 /* IncludesMask */; + if (flags & 132644864 /* Instantiable */) includes |= 16777216 /* IncludesInstantiable */; + if (flags & 268435456 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) includes |= 536870912 /* IncludesConstrainedTypeVariable */; + if (type === wildcardType) includes |= 33554432 /* IncludesWildcard */; if (isErrorType(type)) includes |= 1073741824 /* IncludesError */; - if (!strictNullChecks && flags & 98304 /* Nullable */) { - if (!(getObjectFlags(type) & 65536 /* ContainsWideningType */)) includes |= 4194304 /* IncludesNonWideningType */; + if (!strictNullChecks && flags & 12 /* Nullable */) { + if (!(getObjectFlags(type) & 65536 /* ContainsWideningType */)) includes |= 2097152 /* IncludesNonWideningType */; } 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); } @@ -65846,7 +65992,7 @@ function createTypeChecker(host) { let lastType; for (const type of types) { if (type !== lastType) { - includes = type.flags & 1048576 /* Union */ ? addTypesToUnion(typeSet, includes | (isNamedUnionType(type) ? 1048576 /* Union */ : 0), type.types) : addTypeToUnion(typeSet, includes, type); + includes = type.flags & 134217728 /* Union */ ? addTypesToUnion(typeSet, includes | (isNamedUnionType(type) ? 134217728 /* Union */ : 0), type.types) : addTypeToUnion(typeSet, includes, type); lastType = type; } } @@ -65862,21 +66008,21 @@ function createTypeChecker(host) { if (match) { return match; } - const hasEmptyObject = hasObjectTypes && some(types, (t) => !!(t.flags & 524288 /* Object */) && !isGenericMappedType(t) && isEmptyResolvedType(resolveStructuredTypeMembers(t))); + const hasEmptyObject = hasObjectTypes && some(types, (t) => !!(t.flags & 1048576 /* Object */) && !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 /* StructuredOrInstantiable */) { - if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) { + if (hasEmptyObject || source.flags & 536346624 /* StructuredOrInstantiable */) { + if (source.flags & 524288 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 134217728 /* Union */) { if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) { orderedRemoveItemAt(types, i); } continue; } - const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0; + const keyProperty = source.flags & (1048576 /* Object */ | 268435456 /* Intersection */ | 117964800 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0; const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty)); for (const target of types) { if (source !== target) { @@ -65889,7 +66035,7 @@ function createTypeChecker(host) { } } count++; - if (keyProperty && target.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) { + if (keyProperty && target.flags & (1048576 /* Object */ | 268435456 /* Intersection */ | 117964800 /* InstantiableNonPrimitive */)) { const t = getTypeOfPropertyOfType(target, keyProperty.escapedName); if (t && isUnitType(t) && getRegularTypeOfLiteralType(t) !== keyPropertyType) { continue; @@ -65912,7 +66058,7 @@ function createTypeChecker(host) { i--; const t = types[i]; const flags = t.flags; - const remove = flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && includes & 4 /* String */ || flags & 256 /* NumberLiteral */ && includes & 8 /* Number */ || flags & 2048 /* BigIntLiteral */ && includes & 64 /* BigInt */ || flags & 8192 /* UniqueESSymbol */ && includes & 4096 /* ESSymbol */ || reduceVoidUndefined && flags & 32768 /* Undefined */ && includes & 16384 /* Void */ || isFreshLiteralType(t) && containsType(types, t.regularType); + const remove = flags & (1024 /* StringLiteral */ | 4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */) && includes & 32 /* String */ || flags & 2048 /* NumberLiteral */ && includes & 64 /* Number */ || flags & 4096 /* BigIntLiteral */ && includes & 128 /* BigInt */ || flags & 16384 /* UniqueESSymbol */ && includes & 512 /* ESSymbol */ || reduceVoidUndefined && flags & 4 /* Undefined */ && includes & 16 /* Void */ || isFreshLiteralType(t) && containsType(types, t.regularType); if (remove) { orderedRemoveItemAt(types, i); } @@ -65925,28 +66071,28 @@ function createTypeChecker(host) { while (i > 0) { i--; const t = types[i]; - if (t.flags & 128 /* StringLiteral */ && some(templates, (template) => isTypeMatchedByTemplateLiteralOrStringMapping(t, template))) { + if (t.flags & 1024 /* StringLiteral */ && some(templates, (template) => isTypeMatchedByTemplateLiteralOrStringMapping(t, template))) { orderedRemoveItemAt(types, i); } } } } function isTypeMatchedByTemplateLiteralOrStringMapping(type, template) { - return template.flags & 134217728 /* TemplateLiteral */ ? isTypeMatchedByTemplateLiteralType(type, template) : isMemberOfStringMapping(type, template); + return template.flags & 4194304 /* TemplateLiteral */ ? isTypeMatchedByTemplateLiteralType(type, template) : isMemberOfStringMapping(type, template); } function removeConstrainedTypeVariables(types) { const typeVariables = []; for (const type of types) { - if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) { - const index = type.types[0].flags & 8650752 /* TypeVariable */ ? 0 : 1; + if (type.flags & 268435456 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) { + const index = type.types[0].flags & 34078720 /* TypeVariable */ ? 0 : 1; pushIfUnique(typeVariables, type.types[index]); } } for (const typeVariable of typeVariables) { const primitives = []; for (const type of types) { - if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) { - const index = type.types[0].flags & 8650752 /* TypeVariable */ ? 0 : 1; + if (type.flags & 268435456 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) { + const index = type.types[0].flags & 34078720 /* TypeVariable */ ? 0 : 1; if (type.types[index] === typeVariable) { insertType(primitives, type.types[1 - index]); } @@ -65958,8 +66104,8 @@ function createTypeChecker(host) { while (i > 0) { i--; const type = types[i]; - if (type.flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) { - const index = type.types[0].flags & 8650752 /* TypeVariable */ ? 0 : 1; + if (type.flags & 268435456 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) { + const index = type.types[0].flags & 34078720 /* TypeVariable */ ? 0 : 1; if (type.types[index] === typeVariable && containsType(primitives, type.types[1 - index])) { orderedRemoveItemAt(types, i); } @@ -65970,15 +66116,15 @@ function createTypeChecker(host) { } } function isNamedUnionType(type) { - return !!(type.flags & 1048576 /* Union */ && (type.aliasSymbol || type.origin)); + return !!(type.flags & 134217728 /* Union */ && (type.aliasSymbol || type.origin)); } function addNamedUnions(namedUnions, types) { for (const t of types) { - if (t.flags & 1048576 /* Union */) { + if (t.flags & 134217728 /* Union */) { const origin = t.origin; - if (t.aliasSymbol || origin && !(origin.flags & 1048576 /* Union */)) { + if (t.aliasSymbol || origin && !(origin.flags & 134217728 /* Union */)) { pushIfUnique(namedUnions, t); - } else if (origin && origin.flags & 1048576 /* Union */) { + } else if (origin && origin.flags & 134217728 /* Union */) { addNamedUnions(namedUnions, origin.types); } } @@ -65996,7 +66142,7 @@ function createTypeChecker(host) { if (types.length === 1) { return types[0]; } - if (types.length === 2 && !origin && (types[0].flags & 1048576 /* Union */ || types[1].flags & 1048576 /* Union */)) { + if (types.length === 2 && !origin && (types[0].flags & 134217728 /* Union */ || types[1].flags & 134217728 /* Union */)) { const infix = unionReduction === 0 /* None */ ? "N" : unionReduction === 2 /* Subtype */ ? "S" : "L"; const index = types[0].id < types[1].id ? 0 : 1; const id = types[index].id + infix + types[1 - index].id + getAliasId(aliasSymbol, aliasTypeArguments); @@ -66021,33 +66167,33 @@ function createTypeChecker(host) { const includes = addTypesToUnion(typeSet, 0, types); if (unionReduction !== 0 /* None */) { if (includes & 3 /* AnyOrUnknown */) { - return includes & 1 /* Any */ ? includes & 8388608 /* IncludesWildcard */ ? wildcardType : includes & 1073741824 /* IncludesError */ ? errorType : anyType : unknownType; + return includes & 1 /* Any */ ? includes & 33554432 /* IncludesWildcard */ ? wildcardType : includes & 1073741824 /* IncludesError */ ? errorType : anyType : unknownType; } - if (includes & 32768 /* Undefined */) { + if (includes & 4 /* Undefined */) { if (typeSet.length >= 2 && typeSet[0] === undefinedType && typeSet[1] === missingType) { orderedRemoveItemAt(typeSet, 1); } } - if (includes & (32 /* Enum */ | 2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) { + if (includes & (65536 /* Enum */ | 15360 /* Literal */ | 16384 /* UniqueESSymbol */ | 4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */) || includes & 16 /* Void */ && includes & 4 /* Undefined */) { removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */)); } - if (includes & 128 /* StringLiteral */ && includes & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) { + if (includes & 1024 /* StringLiteral */ && includes & (4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */)) { removeStringLiteralsMatchedByTemplateLiterals(typeSet); } if (includes & 536870912 /* IncludesConstrainedTypeVariable */) { removeConstrainedTypeVariables(typeSet); } if (unionReduction === 2 /* Subtype */) { - typeSet = removeSubtypes(typeSet, !!(includes & 524288 /* Object */)); + typeSet = removeSubtypes(typeSet, !!(includes & 1048576 /* Object */)); if (!typeSet) { return errorType; } } if (typeSet.length === 0) { - return includes & 65536 /* Null */ ? includes & 4194304 /* IncludesNonWideningType */ ? nullType : nullWideningType : includes & 32768 /* Undefined */ ? includes & 4194304 /* IncludesNonWideningType */ ? undefinedType : undefinedWideningType : neverType; + return includes & 8 /* Null */ ? includes & 2097152 /* IncludesNonWideningType */ ? nullType : nullWideningType : includes & 4 /* Undefined */ ? includes & 2097152 /* IncludesNonWideningType */ ? undefinedType : undefinedWideningType : neverType; } } - if (!origin && includes & 1048576 /* Union */) { + if (!origin && includes & 134217728 /* Union */) { const namedUnions = []; addNamedUnions(namedUnions, types); const reducedTypes = []; @@ -66064,10 +66210,10 @@ function createTypeChecker(host) { for (const t of namedUnions) { insertType(reducedTypes, t); } - origin = createOriginUnionOrIntersectionType(1048576 /* Union */, reducedTypes); + origin = createOriginUnionOrIntersectionType(134217728 /* Union */, reducedTypes); } } - const objectFlags = (includes & 36323331 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 2097152 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0); + const objectFlags = (includes & 286523411 /* NotPrimitiveUnion */ ? 0 : 32768 /* PrimitiveUnion */) | (includes & 268435456 /* Intersection */ ? 16777216 /* ContainsIntersections */ : 0); return getUnionTypeFromSortedList(typeSet, objectFlags, aliasSymbol, aliasTypeArguments, origin); } function getUnionOrIntersectionTypePredicate(signatures, kind) { @@ -66082,7 +66228,7 @@ function createTypeChecker(host) { last2 = pred; types.push(pred.type); } else { - const returnType = kind !== 2097152 /* Intersection */ ? getReturnTypeOfSignature(sig) : void 0; + const returnType = kind !== 268435456 /* Intersection */ ? getReturnTypeOfSignature(sig) : void 0; if (returnType !== falseType && returnType !== regularFalseType) { return void 0; } @@ -66104,22 +66250,22 @@ function createTypeChecker(host) { if (types.length === 1) { return types[0]; } - const typeKey = !origin ? getTypeListId(types) : origin.flags & 1048576 /* Union */ ? `|${getTypeListId(origin.types)}` : origin.flags & 2097152 /* Intersection */ ? `&${getTypeListId(origin.types)}` : `#${origin.type.id}|${getTypeListId(types)}`; + const typeKey = !origin ? getTypeListId(types) : origin.flags & 134217728 /* Union */ ? `|${getTypeListId(origin.types)}` : origin.flags & 268435456 /* Intersection */ ? `&${getTypeListId(origin.types)}` : `#${origin.type.id}|${getTypeListId(types)}`; const id = typeKey + getAliasId(aliasSymbol, aliasTypeArguments); let type = unionTypes.get(id); if (!type) { - type = createType(1048576 /* Union */); + type = createType(134217728 /* Union */); type.objectFlags = precomputedObjectFlags | getPropagatingFlagsOfTypes( types, /*excludeKinds*/ - 98304 /* Nullable */ + 12 /* Nullable */ ); type.types = types; type.origin = origin; type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = aliasTypeArguments; - if (types.length === 2 && types[0].flags & 512 /* BooleanLiteral */ && types[1].flags & 512 /* BooleanLiteral */) { - type.flags |= 16 /* Boolean */; + if (types.length === 2 && types[0].flags & 8192 /* BooleanLiteral */ && types[1].flags & 8192 /* BooleanLiteral */) { + type.flags |= 256 /* Boolean */; type.intrinsicName = "boolean"; } unionTypes.set(id, type); @@ -66136,31 +66282,31 @@ function createTypeChecker(host) { } function addTypeToIntersection(typeSet, includes, type) { const flags = type.flags; - if (flags & 2097152 /* Intersection */) { + if (flags & 268435456 /* Intersection */) { return addTypesToIntersection(typeSet, includes, type.types); } if (isEmptyAnonymousObjectType(type)) { - if (!(includes & 16777216 /* IncludesEmptyObject */)) { - includes |= 16777216 /* IncludesEmptyObject */; + if (!(includes & 67108864 /* IncludesEmptyObject */)) { + includes |= 67108864 /* IncludesEmptyObject */; typeSet.set(type.id.toString(), type); } } else { if (flags & 3 /* AnyOrUnknown */) { - if (type === wildcardType) includes |= 8388608 /* IncludesWildcard */; + if (type === wildcardType) includes |= 33554432 /* IncludesWildcard */; if (isErrorType(type)) includes |= 1073741824 /* IncludesError */; - } else if (strictNullChecks || !(flags & 98304 /* Nullable */)) { + } else if (strictNullChecks || !(flags & 12 /* Nullable */)) { if (type === missingType) { - includes |= 262144 /* IncludesMissingType */; + includes |= 524288 /* IncludesMissingType */; type = undefinedType; } if (!typeSet.has(type.id.toString())) { - if (type.flags & 109472 /* Unit */ && includes & 109472 /* Unit */) { - includes |= 67108864 /* NonPrimitive */; + if (type.flags & 97292 /* Unit */ && includes & 97292 /* Unit */) { + includes |= 131072 /* NonPrimitive */; } typeSet.set(type.id.toString(), type); } } - includes |= flags & 473694207 /* IncludesMask */; + includes |= flags & 416808959 /* IncludesMask */; } return includes; } @@ -66175,7 +66321,7 @@ function createTypeChecker(host) { while (i > 0) { i--; const t = types[i]; - const remove = t.flags & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || t.flags & 8 /* Number */ && includes & 256 /* NumberLiteral */ || t.flags & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ || t.flags & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ || t.flags & 16384 /* Void */ && includes & 32768 /* Undefined */ || isEmptyAnonymousObjectType(t) && includes & 470302716 /* DefinitelyNonNullable */; + const remove = t.flags & 32 /* String */ && includes & (1024 /* StringLiteral */ | 4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */) || t.flags & 64 /* Number */ && includes & 2048 /* NumberLiteral */ || t.flags & 128 /* BigInt */ && includes & 4096 /* BigIntLiteral */ || t.flags & 512 /* ESSymbol */ && includes & 16384 /* UniqueESSymbol */ || t.flags & 16 /* Void */ && includes & 4 /* Undefined */ || isEmptyAnonymousObjectType(t) && includes & 13893600 /* DefinitelyNonNullable */; if (remove) { orderedRemoveItemAt(types, i); } @@ -66190,7 +66336,7 @@ function createTypeChecker(host) { if (type === undefinedType) { return containsType(u.types, missingType); } - const primitive = type.flags & 128 /* StringLiteral */ ? stringType : type.flags & (32 /* Enum */ | 256 /* NumberLiteral */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : void 0; + const primitive = type.flags & 1024 /* StringLiteral */ ? stringType : type.flags & (65536 /* Enum */ | 2048 /* NumberLiteral */) ? numberType : type.flags & 4096 /* BigIntLiteral */ ? bigintType : type.flags & 16384 /* UniqueESSymbol */ ? esSymbolType : void 0; if (!primitive || !containsType(u.types, primitive)) { return false; } @@ -66200,11 +66346,11 @@ function createTypeChecker(host) { } function extractRedundantTemplateLiterals(types) { let i = types.length; - const literals = filter(types, (t) => !!(t.flags & 128 /* StringLiteral */)); + const literals = filter(types, (t) => !!(t.flags & 1024 /* StringLiteral */)); while (i > 0) { i--; const t = types[i]; - if (!(t.flags & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */))) continue; + if (!(t.flags & (4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */))) continue; for (const t2 of literals) { if (isTypeSubtypeOf(t2, t)) { orderedRemoveItemAt(types, i); @@ -66262,11 +66408,11 @@ function createTypeChecker(host) { return true; } function createIntersectionType(types, objectFlags, aliasSymbol, aliasTypeArguments) { - const result = createType(2097152 /* Intersection */); + const result = createType(268435456 /* Intersection */); result.objectFlags = objectFlags | getPropagatingFlagsOfTypes( types, /*excludeKinds*/ - 98304 /* Nullable */ + 12 /* Nullable */ ); result.types = types; result.aliasSymbol = aliasSymbol; @@ -66278,25 +66424,25 @@ function createTypeChecker(host) { const includes = addTypesToIntersection(typeMembershipMap, 0, types); const typeSet = arrayFrom(typeMembershipMap.values()); let objectFlags = 0 /* None */; - if (includes & 131072 /* Never */) { + if (includes & 262144 /* Never */) { return contains(typeSet, silentNeverType) ? silentNeverType : neverType; } - if (strictNullChecks && includes & 98304 /* Nullable */ && includes & (524288 /* Object */ | 67108864 /* NonPrimitive */ | 16777216 /* IncludesEmptyObject */) || includes & 67108864 /* NonPrimitive */ && includes & (469892092 /* DisjointDomains */ & ~67108864 /* NonPrimitive */) || includes & 402653316 /* StringLike */ && includes & (469892092 /* DisjointDomains */ & ~402653316 /* StringLike */) || includes & 296 /* NumberLike */ && includes & (469892092 /* DisjointDomains */ & ~296 /* NumberLike */) || includes & 2112 /* BigIntLike */ && includes & (469892092 /* DisjointDomains */ & ~2112 /* BigIntLike */) || includes & 12288 /* ESSymbolLike */ && includes & (469892092 /* DisjointDomains */ & ~12288 /* ESSymbolLike */) || includes & 49152 /* VoidLike */ && includes & (469892092 /* DisjointDomains */ & ~49152 /* VoidLike */)) { + if (strictNullChecks && includes & 12 /* Nullable */ && includes & (1048576 /* Object */ | 131072 /* NonPrimitive */ | 67108864 /* IncludesEmptyObject */) || includes & 131072 /* NonPrimitive */ && includes & (12812284 /* DisjointDomains */ & ~131072 /* NonPrimitive */) || includes & 12583968 /* StringLike */ && includes & (12812284 /* DisjointDomains */ & ~12583968 /* StringLike */) || includes & 67648 /* NumberLike */ && includes & (12812284 /* DisjointDomains */ & ~67648 /* NumberLike */) || includes & 4224 /* BigIntLike */ && includes & (12812284 /* DisjointDomains */ & ~4224 /* BigIntLike */) || includes & 16896 /* ESSymbolLike */ && includes & (12812284 /* DisjointDomains */ & ~16896 /* ESSymbolLike */) || includes & 20 /* VoidLike */ && includes & (12812284 /* DisjointDomains */ & ~20 /* VoidLike */)) { return neverType; } - if (includes & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && includes & 128 /* StringLiteral */ && extractRedundantTemplateLiterals(typeSet)) { + if (includes & (4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */) && includes & 1024 /* StringLiteral */ && extractRedundantTemplateLiterals(typeSet)) { return neverType; } if (includes & 1 /* Any */) { - return includes & 8388608 /* IncludesWildcard */ ? wildcardType : includes & 1073741824 /* IncludesError */ ? errorType : anyType; + return includes & 33554432 /* IncludesWildcard */ ? wildcardType : includes & 1073741824 /* IncludesError */ ? errorType : anyType; } - if (!strictNullChecks && includes & 98304 /* Nullable */) { - return includes & 16777216 /* IncludesEmptyObject */ ? neverType : includes & 32768 /* Undefined */ ? undefinedType : nullType; + if (!strictNullChecks && includes & 12 /* Nullable */) { + return includes & 67108864 /* IncludesEmptyObject */ ? neverType : includes & 4 /* Undefined */ ? undefinedType : nullType; } - if (includes & 4 /* String */ && includes & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 8 /* Number */ && includes & 256 /* NumberLiteral */ || includes & 64 /* BigInt */ && includes & 2048 /* BigIntLiteral */ || includes & 4096 /* ESSymbol */ && includes & 8192 /* UniqueESSymbol */ || includes & 16384 /* Void */ && includes & 32768 /* Undefined */ || includes & 16777216 /* IncludesEmptyObject */ && includes & 470302716 /* DefinitelyNonNullable */) { + if (includes & 32 /* String */ && includes & (1024 /* StringLiteral */ | 4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */) || includes & 64 /* Number */ && includes & 2048 /* NumberLiteral */ || includes & 128 /* BigInt */ && includes & 4096 /* BigIntLiteral */ || includes & 512 /* ESSymbol */ && includes & 16384 /* UniqueESSymbol */ || includes & 16 /* Void */ && includes & 4 /* Undefined */ || includes & 67108864 /* IncludesEmptyObject */ && includes & 13893600 /* DefinitelyNonNullable */) { if (!(flags & 1 /* NoSupertypeReduction */)) removeRedundantSupertypes(typeSet, includes); } - if (includes & 262144 /* IncludesMissingType */) { + if (includes & 524288 /* IncludesMissingType */) { typeSet[typeSet.indexOf(undefinedType)] = missingType; } if (typeSet.length === 0) { @@ -66306,16 +66452,16 @@ function createTypeChecker(host) { return typeSet[0]; } if (typeSet.length === 2 && !(flags & 2 /* NoConstraintReduction */)) { - const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1; + const typeVarIndex = typeSet[0].flags & 34078720 /* TypeVariable */ ? 0 : 1; const typeVariable = typeSet[typeVarIndex]; const primitiveType = typeSet[1 - typeVarIndex]; - if (typeVariable.flags & 8650752 /* TypeVariable */ && (primitiveType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) && !isGenericStringLikeType(primitiveType) || includes & 16777216 /* IncludesEmptyObject */)) { + if (typeVariable.flags & 34078720 /* TypeVariable */ && (primitiveType.flags & (12713980 /* Primitive */ | 131072 /* NonPrimitive */) && !isGenericStringLikeType(primitiveType) || includes & 67108864 /* IncludesEmptyObject */)) { const constraint = getBaseConstraintOfType(typeVariable); - if (constraint && everyType(constraint, (t) => !!(t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) { + if (constraint && everyType(constraint, (t) => !!(t.flags & (12713980 /* Primitive */ | 131072 /* NonPrimitive */)) || isEmptyAnonymousObjectType(t))) { if (isTypeStrictSubtypeOf(constraint, primitiveType)) { return typeVariable; } - if (!(constraint.flags & 1048576 /* Union */ && someType(constraint, (c) => isTypeStrictSubtypeOf(c, primitiveType)))) { + if (!(constraint.flags & 134217728 /* Union */ && someType(constraint, (c) => isTypeStrictSubtypeOf(c, primitiveType)))) { if (!isTypeStrictSubtypeOf(primitiveType, constraint)) { return neverType; } @@ -66327,15 +66473,15 @@ function createTypeChecker(host) { const id = getTypeListId(typeSet) + (flags & 2 /* NoConstraintReduction */ ? "*" : getAliasId(aliasSymbol, aliasTypeArguments)); let result = intersectionTypes.get(id); if (!result) { - if (includes & 1048576 /* Union */) { + if (includes & 134217728 /* Union */) { if (intersectUnionsOfPrimitiveTypes(typeSet)) { result = getIntersectionType(typeSet, flags, aliasSymbol, aliasTypeArguments); - } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && t.types[0].flags & 32768 /* Undefined */))) { + } else if (every(typeSet, (t) => !!(t.flags & 134217728 /* Union */ && t.types[0].flags & 4 /* Undefined */))) { const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType; - removeFromEach(typeSet, 32768 /* Undefined */); + removeFromEach(typeSet, 4 /* Undefined */); result = getUnionType([getIntersectionType(typeSet, flags), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments); - } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) { - removeFromEach(typeSet, 65536 /* Null */); + } else if (every(typeSet, (t) => !!(t.flags & 134217728 /* Union */ && (t.types[0].flags & 8 /* Null */ || t.types[1].flags & 8 /* Null */)))) { + removeFromEach(typeSet, 8 /* Null */); result = getUnionType([getIntersectionType(typeSet, flags), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments); } else if (typeSet.length >= 3 && types.length > 2) { const middle = Math.floor(typeSet.length / 2); @@ -66345,7 +66491,7 @@ function createTypeChecker(host) { return errorType; } const constituents = getCrossProductIntersections(typeSet, flags); - const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : void 0; + const origin = some(constituents, (t) => !!(t.flags & 268435456 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(268435456 /* Intersection */, typeSet) : void 0; result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin); } } else { @@ -66356,7 +66502,7 @@ function createTypeChecker(host) { return result; } function getCrossProductUnionSize(types) { - return reduceLeft(types, (n, t) => t.flags & 1048576 /* Union */ ? n * t.types.length : t.flags & 131072 /* Never */ ? 0 : n, 1); + return reduceLeft(types, (n, t) => t.flags & 134217728 /* Union */ ? n * t.types.length : t.flags & 262144 /* Never */ ? 0 : n, 1); } function checkCrossProductUnion(types) { var _a; @@ -66375,7 +66521,7 @@ function createTypeChecker(host) { const constituents = types.slice(); let n = i; for (let j = types.length - 1; j >= 0; j--) { - if (types[j].flags & 1048576 /* Union */) { + if (types[j].flags & 134217728 /* Union */) { const sourceTypes = types[j].types; const length2 = sourceTypes.length; constituents[j] = sourceTypes[n % length2]; @@ -66383,12 +66529,12 @@ function createTypeChecker(host) { } } const t = getIntersectionType(constituents, flags); - if (!(t.flags & 131072 /* Never */)) intersections.push(t); + if (!(t.flags & 262144 /* Never */)) intersections.push(t); } return intersections; } function getConstituentCount(type) { - return !(type.flags & 3145728 /* UnionOrIntersection */) || type.aliasSymbol ? 1 : type.flags & 1048576 /* Union */ && type.origin ? getConstituentCount(type.origin) : getConstituentCountOfTypes(type.types); + return !(type.flags & 402653184 /* UnionOrIntersection */) || type.aliasSymbol ? 1 : type.flags & 134217728 /* Union */ && type.origin ? getConstituentCount(type.origin) : getConstituentCountOfTypes(type.types); } function getConstituentCountOfTypes(types) { return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0); @@ -66400,19 +66546,19 @@ function createTypeChecker(host) { 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 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t)); + const noSupertypeReduction = !!(t.flags & (32 /* String */ | 64 /* Number */ | 128 /* BigInt */) || t.flags & 4194304 /* TemplateLiteral */ && isPatternLiteralType(t)); links.resolvedType = getIntersectionType(types, noSupertypeReduction ? 1 /* NoSupertypeReduction */ : 0, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol)); } return links.resolvedType; } function createIndexType(type, indexFlags) { - const result = createType(4194304 /* Index */); + const result = createType(2097152 /* Index */); result.type = type; result.indexFlags = indexFlags; return result; } function createOriginIndexType(type) { - const result = createOriginType(4194304 /* Index */); + const result = createOriginType(2097152 /* Index */); result.type = type; return result; } @@ -66434,12 +66580,12 @@ function createTypeChecker(host) { forEachType(constraintType, addMemberForKeyType); } else if (isMappedTypeWithKeyofConstraintDeclaration(type)) { const modifiersType = getApparentType(getModifiersTypeFromMappedType(type)); - forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType); + forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 19456 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType); } else { forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType); } - const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes); - if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) { + const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 32 /* String */))) : getUnionType(keyTypes); + if (result.flags & 134217728 /* Union */ && constraintType.flags & 134217728 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) { return constraintType; } return result; @@ -66448,13 +66594,6 @@ function createTypeChecker(host) { 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 /* AnyOrUnknown */ | 402784252 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false; - } - } function getLiteralTypeFromPropertyName(name) { if (isPrivateIdentifier(name)) { return neverType; @@ -66488,12 +66627,12 @@ function createTypeChecker(host) { return neverType; } function isKeyTypeIncluded(keyType, include) { - return !!(keyType.flags & include || keyType.flags & 2097152 /* Intersection */ && some(keyType.types, (t) => isKeyTypeIncluded(t, include))); + return !!(keyType.flags & include || keyType.flags & 268435456 /* Intersection */ && some(keyType.types, (t) => isKeyTypeIncluded(t, include))); } function getLiteralTypeFromProperties(type, include, includeOrigin) { const origin = includeOrigin && (getObjectFlags(type) & (3 /* ClassOrInterface */ | 4 /* Reference */) || type.aliasSymbol) ? createOriginIndexType(type) : void 0; 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 /* Number */ ? stringOrNumberType : info.keyType : neverType); + const indexKeyTypes = map(getIndexInfosOfType(type), (info) => info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ? info.keyType === stringType && include & 64 /* Number */ ? stringOrNumberType : info.keyType : neverType); return getUnionType( concatenate(propertyTypes, indexKeyTypes), 1 /* Literal */, @@ -66505,11 +66644,11 @@ function createTypeChecker(host) { ); } function shouldDeferIndexType(type, indexFlags = 0 /* None */) { - return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && (!hasDistributiveNameType(type) || getMappedTypeNameTypeKind(type) === 2 /* Remapping */) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType)); + return !!(type.flags & 117964800 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && getNameTypeFromMappedType(type) || type.flags & 134217728 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 268435456 /* Intersection */ && maybeTypeOfKind(type, 132644864 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType)); } function getIndexType(type, indexFlags = 0 /* None */) { type = getReducedType(type); - return isNoInferType(type) ? getNoInferType(getIndexType(type.baseType, indexFlags)) : shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? stringNumberSymbolType : getLiteralTypeFromProperties(type, (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */), indexFlags === 0 /* None */); + return isNoInferType(type) ? getNoInferType(getIndexType(type.baseType, indexFlags)) : shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 134217728 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 268435456 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 262144 /* Never */) ? stringNumberSymbolType : getLiteralTypeFromProperties(type, (indexFlags & 2 /* NoIndexSignatures */ ? 1024 /* StringLiteral */ : 12583968 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 67648 /* NumberLike */ | 16896 /* ESSymbolLike */), indexFlags === 0 /* None */); } function getExtractStringType(type) { const extractTypeAlias = getGlobalExtractSymbol(); @@ -66517,7 +66656,7 @@ function createTypeChecker(host) { } function getIndexTypeOrString(type) { const indexType = getExtractStringType(getIndexType(type)); - return indexType.flags & 131072 /* Never */ ? stringType : indexType; + return indexType.flags & 262144 /* Never */ ? stringType : indexType; } function getTypeFromTypeOperatorNode(node) { const links = getNodeLinks(node); @@ -66549,7 +66688,7 @@ function createTypeChecker(host) { return links.resolvedType; } function getTemplateLiteralType(texts, types) { - const unionIndex = findIndex(types, (t) => !!(t.flags & (131072 /* Never */ | 1048576 /* Union */))); + const unionIndex = findIndex(types, (t) => !!(t.flags & (262144 /* Never */ | 134217728 /* Union */))); if (unionIndex >= 0) { return checkCrossProductUnion(types) ? mapType(types[unionIndex], (t) => getTemplateLiteralType(texts, replaceElement(types, unionIndex, t))) : errorType; } @@ -66567,7 +66706,7 @@ function createTypeChecker(host) { } newTexts.push(text); if (every(newTexts, (t) => t === "")) { - if (every(newTypes, (t) => !!(t.flags & 4 /* String */))) { + if (every(newTypes, (t) => !!(t.flags & 32 /* String */))) { return stringType; } if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) { @@ -66583,10 +66722,10 @@ function createTypeChecker(host) { function addSpans(texts2, types2) { for (let i = 0; i < types2.length; i++) { const t = types2[i]; - if (t.flags & (2944 /* Literal */ | 65536 /* Null */ | 32768 /* Undefined */)) { + if (t.flags & (15360 /* Literal */ | 8 /* Null */ | 4 /* Undefined */)) { text += getTemplateStringForType(t) || ""; text += texts2[i + 1]; - } else if (t.flags & 134217728 /* TemplateLiteral */) { + } else if (t.flags & 4194304 /* TemplateLiteral */) { text += t.texts[0]; if (!addSpans(t.texts, t.types)) return false; text += texts2[i + 1]; @@ -66602,18 +66741,18 @@ function createTypeChecker(host) { } } function getTemplateStringForType(type) { - return type.flags & 128 /* StringLiteral */ ? type.value : type.flags & 256 /* NumberLiteral */ ? "" + type.value : type.flags & 2048 /* BigIntLiteral */ ? pseudoBigIntToString(type.value) : type.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) ? type.intrinsicName : void 0; + return type.flags & 1024 /* StringLiteral */ ? type.value : type.flags & 2048 /* NumberLiteral */ ? "" + type.value : type.flags & 4096 /* BigIntLiteral */ ? pseudoBigIntToString(type.value) : type.flags & (8192 /* BooleanLiteral */ | 12 /* Nullable */) ? type.intrinsicName : void 0; } function createTemplateLiteralType(texts, types) { - const type = createType(134217728 /* TemplateLiteral */); + const type = createType(4194304 /* TemplateLiteral */); type.texts = texts; type.types = types; return type; } function getStringMappingType(symbol, type) { - return type.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapType(type, (t) => getStringMappingType(symbol, t)) : type.flags & 128 /* StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : type.flags & 134217728 /* TemplateLiteral */ ? getTemplateLiteralType(...applyTemplateStringMapping(symbol, type.texts, type.types)) : ( + return type.flags & (134217728 /* Union */ | 262144 /* Never */) ? mapType(type, (t) => getStringMappingType(symbol, t)) : type.flags & 1024 /* StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : type.flags & 4194304 /* TemplateLiteral */ ? getTemplateLiteralType(...applyTemplateStringMapping(symbol, type.texts, type.types)) : ( // Mapping> === Mapping - type.flags & 268435456 /* StringMapping */ && symbol === type.symbol ? type : type.flags & (1 /* Any */ | 4 /* String */ | 268435456 /* StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : ( + type.flags & 8388608 /* StringMapping */ && symbol === type.symbol ? type : type.flags & (1 /* Any */ | 32 /* String */ | 8388608 /* StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : ( // This handles Mapping<`${number}`> and Mapping<`${bigint}`> isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) : type ) @@ -66654,12 +66793,12 @@ function createTypeChecker(host) { return result; } function createStringMappingType(symbol, type) { - const result = createTypeWithSymbol(268435456 /* StringMapping */, symbol); + const result = createTypeWithSymbol(8388608 /* StringMapping */, symbol); result.type = type; return result; } function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments) { - const type = createType(8388608 /* IndexedAccess */); + const type = createType(33554432 /* IndexedAccess */); type.objectType = objectType; type.indexType = indexType; type.accessFlags = accessFlags; @@ -66674,13 +66813,13 @@ function createTypeChecker(host) { if (getObjectFlags(type) & 4096 /* JSLiteral */) { return true; } - if (type.flags & 1048576 /* Union */) { + if (type.flags & 134217728 /* Union */) { return every(type.types, isJSLiteralType); } - if (type.flags & 2097152 /* Intersection */) { + if (type.flags & 268435456 /* Intersection */) { return some(type.types, isJSLiteralType); } - if (type.flags & 465829888 /* Instantiable */) { + if (type.flags & 132644864 /* Instantiable */) { const constraint = getResolvedBaseConstraint(type); return constraint !== type && isJSLiteralType(constraint); } @@ -66751,8 +66890,8 @@ function createTypeChecker(host) { } } } - if (!(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */)) { - if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) { + if (!(indexType.flags & 12 /* Nullable */) && isTypeAssignableToKind(indexType, 12583968 /* StringLike */ | 67648 /* NumberLike */ | 16896 /* ESSymbolLike */)) { + if (objectType.flags & (1 /* Any */ | 262144 /* Never */)) { return objectType; } const indexInfo = getApplicableIndexInfo(objectType, indexType) || getIndexInfoOfType(objectType, stringType); @@ -66767,18 +66906,18 @@ function createTypeChecker(host) { } return void 0; } - if (accessNode && indexInfo.keyType === stringType && !isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) { + if (accessNode && indexInfo.keyType === stringType && !isTypeAssignableToKind(indexType, 32 /* String */ | 64 /* Number */)) { const indexNode = getIndexNodeForAccessExpression(accessNode); error2(indexNode, Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType)); return accessFlags & 1 /* IncludeUndefined */ ? getUnionType([indexInfo.type, missingType]) : indexInfo.type; } errorIfWritingToReadonlyIndex(indexInfo); - if (accessFlags & 1 /* IncludeUndefined */ && !(objectType.symbol && objectType.symbol.flags & (256 /* RegularEnum */ | 128 /* ConstEnum */) && (indexType.symbol && indexType.flags & 1024 /* EnumLiteral */ && getParentOfSymbol(indexType.symbol) === objectType.symbol))) { + if (accessFlags & 1 /* IncludeUndefined */ && !(objectType.symbol && objectType.symbol.flags & (256 /* RegularEnum */ | 128 /* ConstEnum */) && (indexType.symbol && indexType.flags & 32768 /* EnumLiteral */ && getParentOfSymbol(indexType.symbol) === objectType.symbol))) { return getUnionType([indexInfo.type, missingType]); } return indexInfo.type; } - if (indexType.flags & 131072 /* Never */) { + if (indexType.flags & 262144 /* Never */) { return neverType; } if (isJSLiteralType(objectType)) { @@ -66786,10 +66925,10 @@ function createTypeChecker(host) { } if (accessExpression && !isConstEnumObjectType(objectType)) { if (isObjectLiteralType2(objectType)) { - if (noImplicitAny && indexType.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) { + if (noImplicitAny && indexType.flags & (1024 /* StringLiteral */ | 2048 /* NumberLiteral */)) { diagnostics.add(createDiagnosticForNode(accessExpression, Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType))); return undefinedType; - } else if (indexType.flags & (8 /* Number */ | 4 /* String */)) { + } else if (indexType.flags & (64 /* Number */ | 32 /* String */)) { const types = map(objectType.properties, (property) => { return getTypeOfSymbol(property); }); @@ -66816,7 +66955,7 @@ function createTypeChecker(host) { 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 /* EnumLiteral */) { + if (indexType.flags & 32768 /* EnumLiteral */) { errorInfo = chainDiagnosticMessages( /*details*/ void 0, @@ -66824,7 +66963,7 @@ function createTypeChecker(host) { "[" + typeToString(indexType) + "]", typeToString(objectType) ); - } else if (indexType.flags & 8192 /* UniqueESSymbol */) { + } else if (indexType.flags & 16384 /* UniqueESSymbol */) { const symbolName2 = getFullyQualifiedName(indexType.symbol, accessExpression); errorInfo = chainDiagnosticMessages( /*details*/ @@ -66833,7 +66972,7 @@ function createTypeChecker(host) { "[" + symbolName2 + "]", typeToString(objectType) ); - } else if (indexType.flags & 128 /* StringLiteral */) { + } else if (indexType.flags & 1024 /* StringLiteral */) { errorInfo = chainDiagnosticMessages( /*details*/ void 0, @@ -66841,7 +66980,7 @@ function createTypeChecker(host) { indexType.value, typeToString(objectType) ); - } else if (indexType.flags & 256 /* NumberLiteral */) { + } else if (indexType.flags & 2048 /* NumberLiteral */) { errorInfo = chainDiagnosticMessages( /*details*/ void 0, @@ -66849,7 +66988,7 @@ function createTypeChecker(host) { indexType.value, typeToString(objectType) ); - } else if (indexType.flags & (8 /* Number */ | 4 /* String */)) { + } else if (indexType.flags & (64 /* Number */ | 32 /* String */)) { errorInfo = chainDiagnosticMessages( /*details*/ void 0, @@ -66880,9 +67019,9 @@ function createTypeChecker(host) { } if (accessNode) { const indexNode = getIndexNodeForAccessExpression(accessNode); - if (indexNode.kind !== 10 /* BigIntLiteral */ && indexType.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) { + if (indexNode.kind !== 10 /* BigIntLiteral */ && indexType.flags & (1024 /* StringLiteral */ | 2048 /* NumberLiteral */)) { error2(indexNode, Diagnostics.Property_0_does_not_exist_on_type_1, "" + indexType.value, typeToString(objectType)); - } else if (indexType.flags & (4 /* String */ | 8 /* Number */)) { + } else if (indexType.flags & (32 /* String */ | 64 /* Number */)) { error2(indexNode, Diagnostics.Type_0_has_no_matching_index_signature_for_type_1, typeToString(objectType), typeToString(indexType)); } else { const typeString = indexNode.kind === 10 /* BigIntLiteral */ ? "bigint" : typeToString(indexType); @@ -66903,24 +67042,24 @@ function createTypeChecker(host) { return accessNode.kind === 213 /* ElementAccessExpression */ ? accessNode.argumentExpression : accessNode.kind === 200 /* IndexedAccessType */ ? accessNode.indexType : accessNode.kind === 168 /* ComputedPropertyName */ ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { - if (type.flags & 2097152 /* Intersection */) { + if (type.flags & 268435456 /* Intersection */) { let seenPlaceholder = false; for (const t of type.types) { - if (t.flags & (2944 /* Literal */ | 98304 /* Nullable */) || isPatternLiteralPlaceholderType(t)) { + if (t.flags & (15360 /* Literal */ | 12 /* Nullable */) || isPatternLiteralPlaceholderType(t)) { seenPlaceholder = true; - } else if (!(t.flags & 524288 /* Object */)) { + } else if (!(t.flags & 1048576 /* Object */)) { return false; } } return seenPlaceholder; } - return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type); + return !!(type.flags & (1 /* Any */ | 32 /* String */ | 64 /* Number */ | 128 /* BigInt */)) || isPatternLiteralType(type); } function isPatternLiteralType(type) { - return !!(type.flags & 134217728 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 268435456 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type); + return !!(type.flags & 4194304 /* TemplateLiteral */) && every(type.types, isPatternLiteralPlaceholderType) || !!(type.flags & 8388608 /* StringMapping */) && isPatternLiteralPlaceholderType(type.type); } function isGenericStringLikeType(type) { - return !!(type.flags & (134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */)) && !isPatternLiteralType(type); + return !!(type.flags & (4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */)) && !isPatternLiteralType(type); } function isGenericType(type) { return !!getGenericObjectFlags(type); @@ -66932,31 +67071,31 @@ function createTypeChecker(host) { return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */); } function getGenericObjectFlags(type) { - if (type.flags & 3145728 /* UnionOrIntersection */) { + if (type.flags & 402653184 /* UnionOrIntersection */) { if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) { type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0); } return type.objectFlags & 12582912 /* IsGenericType */; } - if (type.flags & 33554432 /* Substitution */) { + if (type.flags & 16777216 /* Substitution */) { if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) { type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); } return type.objectFlags & 12582912 /* IsGenericType */; } - return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */) || isGenericStringLikeType(type) ? 8388608 /* IsGenericIndexType */ : 0); + return (type.flags & 117964800 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (117964800 /* InstantiableNonPrimitive */ | 2097152 /* Index */) || isGenericStringLikeType(type) ? 8388608 /* IsGenericIndexType */ : 0); } function getSimplifiedType(type, writing) { - return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type; + return type.flags & 33554432 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 67108864 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type.flags & 2097152 /* Index */ ? getSimplifiedIndexType(type) : type; } function distributeIndexOverObjectType(objectType, indexType, writing) { - if (objectType.flags & 1048576 /* Union */ || objectType.flags & 2097152 /* Intersection */ && !shouldDeferIndexType(objectType)) { + if (objectType.flags & 134217728 /* Union */ || objectType.flags & 268435456 /* Intersection */ && !shouldDeferIndexType(objectType)) { const types = map(objectType.types, (t) => getSimplifiedType(getIndexedAccessType(t, indexType), writing)); - return objectType.flags & 2097152 /* Intersection */ || writing ? getIntersectionType(types) : getUnionType(types); + return objectType.flags & 268435456 /* Intersection */ || writing ? getIntersectionType(types) : getUnionType(types); } } function distributeObjectOverIndexType(objectType, indexType, writing) { - if (indexType.flags & 1048576 /* Union */) { + if (indexType.flags & 134217728 /* Union */) { const types = map(indexType.types, (t) => getSimplifiedType(getIndexedAccessType(objectType, t), writing)); return writing ? getIntersectionType(types) : getUnionType(types); } @@ -66973,16 +67112,16 @@ function createTypeChecker(host) { if (distributedOverIndex) { return type[cache] = distributedOverIndex; } - if (!(indexType.flags & 465829888 /* Instantiable */)) { + if (!(indexType.flags & 132644864 /* Instantiable */)) { const distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing); if (distributedOverObject) { return type[cache] = distributedOverObject; } } - if (isGenericTupleType(objectType) && indexType.flags & 296 /* NumberLike */) { + if (isGenericTupleType(objectType) && indexType.flags & 67648 /* NumberLike */) { const elementType = getElementTypeOfSliceOfTupleType( objectType, - indexType.flags & 8 /* Number */ ? 0 : objectType.target.fixedLength, + indexType.flags & 64 /* Number */ ? 0 : objectType.target.fixedLength, /*endSkipCount*/ 0, writing @@ -67003,13 +67142,13 @@ function createTypeChecker(host) { const extendsType = type.extendsType; const trueType2 = getTrueTypeFromConditionalType(type); const falseType2 = getFalseTypeFromConditionalType(type); - if (falseType2.flags & 131072 /* Never */ && getActualTypeVariable(trueType2) === getActualTypeVariable(checkType)) { + if (falseType2.flags & 262144 /* Never */ && getActualTypeVariable(trueType2) === getActualTypeVariable(checkType)) { if (checkType.flags & 1 /* Any */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { return getSimplifiedType(trueType2, writing); } else if (isIntersectionEmpty(checkType, extendsType)) { return neverType; } - } else if (trueType2.flags & 131072 /* Never */ && getActualTypeVariable(falseType2) === getActualTypeVariable(checkType)) { + } else if (trueType2.flags & 262144 /* Never */ && getActualTypeVariable(falseType2) === getActualTypeVariable(checkType)) { if (!(checkType.flags & 1 /* Any */) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { return neverType; } else if (checkType.flags & 1 /* Any */ || isIntersectionEmpty(checkType, extendsType)) { @@ -67018,8 +67157,14 @@ function createTypeChecker(host) { } return type; } + function getSimplifiedIndexType(type) { + if (isGenericMappedType(type.type) && getNameTypeFromMappedType(type.type) && !isMappedTypeWithKeyofConstraintDeclaration(type.type)) { + return getIndexTypeForMappedType(type.type, 0 /* None */); + } + return type; + } function isIntersectionEmpty(type1, type2) { - return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */); + return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 262144 /* Never */); } function substituteIndexedMappedType(objectType, index) { const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]); @@ -67035,14 +67180,14 @@ function createTypeChecker(host) { } function couldAccessOptionalProperty(objectType, indexType) { const indexConstraint = getBaseConstraintOfType(indexType); - return !!indexConstraint && some(getPropertiesOfType(objectType), (p) => !!(p.flags & 16777216 /* Optional */) && isTypeAssignableTo(getLiteralTypeFromProperty(p, 8576 /* StringOrNumberLiteralOrUnique */), indexConstraint)); + return !!indexConstraint && some(getPropertiesOfType(objectType), (p) => !!(p.flags & 16777216 /* Optional */) && isTypeAssignableTo(getLiteralTypeFromProperty(p, 19456 /* StringOrNumberLiteralOrUnique */), indexConstraint)); } function getIndexedAccessType(objectType, indexType, accessFlags = 0 /* None */, 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 /* StringOrNumberLiteral */) { + if (t.flags & 3072 /* StringOrNumberLiteral */) { const propName = getPropertyNameFromType(t); if (isNumericLiteralName(propName)) { const index = +propName; @@ -67057,7 +67202,7 @@ function createTypeChecker(host) { return wildcardType; } objectType = getReducedType(objectType); - if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) { + if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 12 /* Nullable */) && isTypeAssignableToKind(indexType, 32 /* String */ | 64 /* Number */)) { indexType = stringType; } if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32 /* ExpressionPosition */) accessFlags |= 1 /* IncludeUndefined */; @@ -67074,7 +67219,7 @@ function createTypeChecker(host) { return type; } const apparentObjectType = getReducedApparentType(objectType); - if (indexType.flags & 1048576 /* Union */ && !(indexType.flags & 16 /* Boolean */)) { + if (indexType.flags & 134217728 /* Union */ && !(indexType.flags & 256 /* Boolean */)) { const propTypes = []; let wasMissingProp = false; for (const t of indexType.types) { @@ -67117,10 +67262,10 @@ function createTypeChecker(host) { return links.resolvedType; } function getActualTypeVariable(type) { - if (type.flags & 33554432 /* Substitution */) { + if (type.flags & 16777216 /* Substitution */) { return getActualTypeVariable(type.baseType); } - if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ || type.indexType.flags & 33554432 /* Substitution */)) { + if (type.flags & 33554432 /* IndexedAccess */ && (type.objectType.flags & 16777216 /* Substitution */ || type.indexType.flags & 16777216 /* Substitution */)) { return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType)); } return type; @@ -67171,11 +67316,11 @@ function createTypeChecker(host) { const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType; if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) { if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) { - if (checkType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) { + if (checkType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 262144 /* Never */) && 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 /* Conditional */) { + if (falseType2.flags & 67108864 /* Conditional */) { const newRoot = falseType2.root; if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) { root = newRoot; @@ -67198,7 +67343,7 @@ function createTypeChecker(host) { break; } } - result = createType(16777216 /* Conditional */); + result = createType(67108864 /* Conditional */); result.root = root; result.checkType = instantiateType(root.checkType, mapper); result.extendsType = instantiateType(root.extendsType, mapper); @@ -67210,14 +67355,14 @@ function createTypeChecker(host) { } return extraTypes ? getUnionType(append(extraTypes, result)) : result; function canTailRecurse(newType, newMapper) { - if (newType.flags & 16777216 /* Conditional */ && newMapper) { + if (newType.flags & 67108864 /* Conditional */ && 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) : void 0; - if (!newCheckType || newCheckType === newRoot.checkType || !(newCheckType.flags & (1048576 /* Union */ | 131072 /* Never */))) { + if (!newCheckType || newCheckType === newRoot.checkType || !(newCheckType.flags & (134217728 /* Union */ | 262144 /* Never */))) { root = newRoot; mapper = newRootMapper; aliasSymbol = void 0; @@ -67271,7 +67416,7 @@ function createTypeChecker(host) { node, checkType, extendsType: getTypeFromTypeNode(node.extendsType), - isDistributive: !!(checkType.flags & 262144 /* TypeParameter */), + isDistributive: !!(checkType.flags & 524288 /* TypeParameter */), inferTypeParameters: getInferTypeParameters(node), outerTypeParameters, instantiations: void 0, @@ -67404,13 +67549,13 @@ function createTypeChecker(host) { return symbol ? getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) : void 0; } function isNonGenericObjectType(type) { - return !!(type.flags & 524288 /* Object */) && !isGenericMappedType(type); + return !!(type.flags & 1048576 /* Object */) && !isGenericMappedType(type); } function isEmptyObjectTypeOrSpreadsIntoEmptyObject(type) { - return isEmptyObjectType(type) || !!(type.flags & (65536 /* Null */ | 32768 /* Undefined */ | 528 /* BooleanLike */ | 296 /* NumberLike */ | 2112 /* BigIntLike */ | 402653316 /* StringLike */ | 1056 /* EnumLike */ | 67108864 /* NonPrimitive */ | 4194304 /* Index */)); + return isEmptyObjectType(type) || !!(type.flags & (8 /* Null */ | 4 /* Undefined */ | 8448 /* BooleanLike */ | 67648 /* NumberLike */ | 4224 /* BigIntLike */ | 12583968 /* StringLike */ | 98304 /* EnumLike */ | 131072 /* NonPrimitive */ | 2097152 /* Index */)); } function tryMergeUnionOfObjectTypeAndEmptyObject(type, readonly) { - if (!(type.flags & 1048576 /* Union */)) { + if (!(type.flags & 134217728 /* Union */)) { return type; } if (every(type.types, isEmptyObjectTypeOrSpreadsIntoEmptyObject)) { @@ -67456,28 +67601,28 @@ function createTypeChecker(host) { if (left.flags & 2 /* Unknown */ || right.flags & 2 /* Unknown */) { return unknownType; } - if (left.flags & 131072 /* Never */) { + if (left.flags & 262144 /* Never */) { return right; } - if (right.flags & 131072 /* Never */) { + if (right.flags & 262144 /* Never */) { return left; } left = tryMergeUnionOfObjectTypeAndEmptyObject(left, readonly); - if (left.flags & 1048576 /* Union */) { + if (left.flags & 134217728 /* Union */) { return checkCrossProductUnion([left, right]) ? mapType(left, (t) => getSpreadType(t, right, symbol, objectFlags, readonly)) : errorType; } right = tryMergeUnionOfObjectTypeAndEmptyObject(right, readonly); - if (right.flags & 1048576 /* Union */) { + if (right.flags & 134217728 /* Union */) { return checkCrossProductUnion([left, right]) ? mapType(right, (t) => getSpreadType(left, t, symbol, objectFlags, readonly)) : errorType; } - if (right.flags & (528 /* BooleanLike */ | 296 /* NumberLike */ | 2112 /* BigIntLike */ | 402653316 /* StringLike */ | 1056 /* EnumLike */ | 67108864 /* NonPrimitive */ | 4194304 /* Index */)) { + if (right.flags & (8448 /* BooleanLike */ | 67648 /* NumberLike */ | 4224 /* BigIntLike */ | 12583968 /* StringLike */ | 98304 /* EnumLike */ | 131072 /* NonPrimitive */ | 2097152 /* Index */)) { return left; } if (isGenericObjectType(left) || isGenericObjectType(right)) { if (isEmptyObjectType(left)) { return right; } - if (left.flags & 2097152 /* Intersection */) { + if (left.flags & 268435456 /* Intersection */) { const types = left.types; const lastLeft = types[types.length - 1]; if (isNonGenericObjectType(lastLeft) && isNonGenericObjectType(right)) { @@ -67552,7 +67697,7 @@ function createTypeChecker(host) { return type; } function getFreshTypeOfLiteralType(type) { - if (type.flags & 2976 /* Freshable */) { + if (type.flags & 80896 /* Freshable */) { if (!type.freshType) { const freshType = createLiteralType(type.flags, type.value, type.symbol, type); freshType.freshType = freshType; @@ -67563,28 +67708,28 @@ function createTypeChecker(host) { return type; } function getRegularTypeOfLiteralType(type) { - return type.flags & 2976 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type; + return type.flags & 80896 /* Freshable */ ? type.regularType : type.flags & 134217728 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type; } function isFreshLiteralType(type) { - return !!(type.flags & 2976 /* Freshable */) && type.freshType === type; + return !!(type.flags & 80896 /* Freshable */) && type.freshType === type; } function getStringLiteralType(value) { let type; - return stringLiteralTypes.get(value) || (stringLiteralTypes.set(value, type = createLiteralType(128 /* StringLiteral */, value)), type); + return stringLiteralTypes.get(value) || (stringLiteralTypes.set(value, type = createLiteralType(1024 /* StringLiteral */, value)), type); } function getNumberLiteralType(value) { let type; - return numberLiteralTypes.get(value) || (numberLiteralTypes.set(value, type = createLiteralType(256 /* NumberLiteral */, value)), type); + return numberLiteralTypes.get(value) || (numberLiteralTypes.set(value, type = createLiteralType(2048 /* NumberLiteral */, value)), type); } function getBigIntLiteralType(value) { let type; const key = pseudoBigIntToString(value); - return bigIntLiteralTypes.get(key) || (bigIntLiteralTypes.set(key, type = createLiteralType(2048 /* BigIntLiteral */, value)), type); + return bigIntLiteralTypes.get(key) || (bigIntLiteralTypes.set(key, type = createLiteralType(4096 /* BigIntLiteral */, value)), type); } function getEnumLiteralType(value, enumId, symbol) { let type; const key = `${enumId}${typeof value === "string" ? "@" : "#"}${value}`; - const flags = 1024 /* EnumLiteral */ | (typeof value === "string" ? 128 /* StringLiteral */ : 256 /* NumberLiteral */); + const flags = 32768 /* EnumLiteral */ | (typeof value === "string" ? 1024 /* StringLiteral */ : 2048 /* NumberLiteral */); return enumLiteralTypes.get(key) || (enumLiteralTypes.set(key, type = createLiteralType(flags, value, symbol)), type); } function getTypeFromLiteralTypeNode(node) { @@ -67598,7 +67743,7 @@ function createTypeChecker(host) { return links.resolvedType; } function createUniqueESSymbolType(symbol) { - const type = createTypeWithSymbol(8192 /* UniqueESSymbol */, symbol); + const type = createTypeWithSymbol(16384 /* UniqueESSymbol */, symbol); type.escapedName = `__@${type.symbol.escapedName}@${getSymbolId(type.symbol)}`; return type; } @@ -67987,7 +68132,7 @@ function createTypeChecker(host) { result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments); target.instantiations.set(id, result); const resultObjectFlags = getObjectFlags(result); - if (result.flags & 3899393 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) { + if (result.flags & 403963917 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) { const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables); if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) { if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) { @@ -68050,9 +68195,9 @@ function createTypeChecker(host) { } function getHomomorphicTypeVariable(type) { const constraintType = getConstraintTypeFromMappedType(type); - if (constraintType.flags & 4194304 /* Index */) { + if (constraintType.flags & 2097152 /* Index */) { const typeVariable = getActualTypeVariable(constraintType.type); - if (typeVariable.flags & 262144 /* TypeParameter */) { + if (typeVariable.flags & 524288 /* TypeParameter */) { return typeVariable; } } @@ -68068,7 +68213,7 @@ function createTypeChecker(host) { } return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments); function instantiateConstituent(t) { - if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) { + if (t.flags & (3 /* AnyOrUnknown */ | 117964800 /* InstantiableNonPrimitive */ | 1048576 /* Object */ | 268435456 /* Intersection */) && t !== wildcardType && !isErrorType(t)) { if (!type.declaration.nameType) { let constraint; if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) { @@ -68116,7 +68261,7 @@ function createTypeChecker(host) { const templateMapper = appendTypeMapping(mapper, getTypeParameterFromMappedType(type), key); const propType = instantiateType(getTemplateTypeFromMappedType(type.target || type), templateMapper); const modifiers = getMappedTypeModifiers(type); - return strictNullChecks && modifiers & 4 /* IncludeOptional */ && !maybeTypeOfKind(propType, 32768 /* Undefined */ | 16384 /* Void */) ? getOptionalType( + return strictNullChecks && modifiers & 4 /* IncludeOptional */ && !maybeTypeOfKind(propType, 4 /* Undefined */ | 16 /* Void */) ? getOptionalType( propType, /*isProperty*/ true @@ -68153,7 +68298,7 @@ function createTypeChecker(host) { const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments); const checkType = root.checkType; const distributionType = root.isDistributive ? getReducedType(getMappedType(checkType, newMapper)) : void 0; - result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? 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 /* Union */ | 262144 /* Never */) ? 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; @@ -68204,10 +68349,10 @@ function createTypeChecker(host) { } function instantiateTypeWorker(type, mapper, aliasSymbol, aliasTypeArguments) { const flags = type.flags; - if (flags & 262144 /* TypeParameter */) { + if (flags & 524288 /* TypeParameter */) { return getMappedType(type, mapper); } - if (flags & 524288 /* Object */) { + if (flags & 1048576 /* Object */) { const objectFlags = type.objectFlags; if (objectFlags & (4 /* Reference */ | 16 /* Anonymous */ | 32 /* Mapped */)) { if (objectFlags & 4 /* Reference */ && !type.node) { @@ -68222,27 +68367,27 @@ function createTypeChecker(host) { } return type; } - if (flags & 3145728 /* UnionOrIntersection */) { - const origin = type.flags & 1048576 /* Union */ ? type.origin : void 0; - const types = origin && origin.flags & 3145728 /* UnionOrIntersection */ ? origin.types : type.types; + if (flags & 402653184 /* UnionOrIntersection */) { + const origin = type.flags & 134217728 /* Union */ ? type.origin : void 0; + const types = origin && origin.flags & 402653184 /* UnionOrIntersection */ ? 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 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ? getIntersectionType(newTypes, 0 /* None */, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments); + return flags & 268435456 /* Intersection */ || origin && origin.flags & 268435456 /* Intersection */ ? getIntersectionType(newTypes, 0 /* None */, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments); } - if (flags & 4194304 /* Index */) { + if (flags & 2097152 /* Index */) { return getIndexType(instantiateType(type.type, mapper)); } - if (flags & 134217728 /* TemplateLiteral */) { + if (flags & 4194304 /* TemplateLiteral */) { return getTemplateLiteralType(type.texts, instantiateTypes(type.types, mapper)); } - if (flags & 268435456 /* StringMapping */) { + if (flags & 8388608 /* StringMapping */) { return getStringMappingType(type.symbol, instantiateType(type.type, mapper)); } - if (flags & 8388608 /* IndexedAccess */) { + if (flags & 33554432 /* IndexedAccess */) { const newAliasSymbol = aliasSymbol || type.aliasSymbol; const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper); return getIndexedAccessType( @@ -68255,7 +68400,7 @@ function createTypeChecker(host) { newAliasTypeArguments ); } - if (flags & 16777216 /* Conditional */) { + if (flags & 67108864 /* Conditional */) { return getConditionalTypeInstantiation( type, combineTypeMappers(type.mapper, mapper), @@ -68265,19 +68410,19 @@ function createTypeChecker(host) { aliasTypeArguments ); } - if (flags & 33554432 /* Substitution */) { + if (flags & 16777216 /* Substitution */) { const newBaseType = instantiateType(type.baseType, mapper); if (isNoInferType(type)) { return getNoInferType(newBaseType); } const newConstraint = instantiateType(type.constraint, mapper); - if (newBaseType.flags & 8650752 /* TypeVariable */ && isGenericType(newConstraint)) { + if (newBaseType.flags & 34078720 /* TypeVariable */ && isGenericType(newConstraint)) { return getSubstitutionType(newBaseType, newConstraint); } if (newConstraint.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { return newBaseType; } - return newBaseType.flags & 8650752 /* TypeVariable */ ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); + return newBaseType.flags & 34078720 /* TypeVariable */ ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); } return type; } @@ -68287,7 +68432,7 @@ function createTypeChecker(host) { return type; } const innerIndexType = instantiateType(type.constraintType, mapper); - if (!(innerIndexType.flags & 4194304 /* Index */)) { + if (!(innerIndexType.flags & 2097152 /* Index */)) { return type; } const instantiated = inferTypeForHomomorphicMappedType( @@ -68301,10 +68446,10 @@ function createTypeChecker(host) { return type; } function getPermissiveInstantiation(type) { - return type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper)); + return type.flags & (12713980 /* Primitive */ | 3 /* AnyOrUnknown */ | 262144 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper)); } function getRestrictiveInstantiation(type) { - if (type.flags & (402784252 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) { + if (type.flags & (12713980 /* Primitive */ | 3 /* AnyOrUnknown */ | 262144 /* Never */)) { return type; } if (type.restrictiveInstantiation) { @@ -68343,7 +68488,8 @@ function createTypeChecker(host) { const { initializer } = node; return !!initializer && isContextSensitive(initializer); } - case 295 /* JsxExpression */: { + case 295 /* JsxExpression */: + case 230 /* YieldExpression */: { const { expression } = node; return !!expression && isContextSensitive(expression); } @@ -68351,7 +68497,7 @@ function createTypeChecker(host) { 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) { @@ -68362,11 +68508,14 @@ function createTypeChecker(host) { } return !!forEachReturnStatement(node.body, (statement) => !!statement.expression && isContextSensitive(statement.expression)); } + function hasContextSensitiveYieldExpression(node) { + return !!(getFunctionFlags(node) & 1 /* Generator */ && node.body && forEachYieldExpression(node.body, isContextSensitive)); + } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { return (isFunctionExpressionOrArrowFunction(func) || isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { - if (type.flags & 524288 /* Object */) { + if (type.flags & 1048576 /* Object */) { const resolved = resolveStructuredTypeMembers(type); if (resolved.constructSignatures.length || resolved.callSignatures.length) { const result = createObjectType(16 /* Anonymous */, type.symbol); @@ -68377,7 +68526,7 @@ function createTypeChecker(host) { result.indexInfos = emptyArray; return result; } - } else if (type.flags & 2097152 /* Intersection */) { + } else if (type.flags & 268435456 /* Intersection */) { return getIntersectionType(map(type.types, getTypeWithoutSignatures)); } return type; @@ -68404,7 +68553,7 @@ function createTypeChecker(host) { return isTypeRelatedTo(source, target, assignableRelation); } function isTypeDerivedFrom(source, target) { - return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType); + return source.flags & 134217728 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 134217728 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 268435456 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 117964800 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (1048576 /* Object */ | 131072 /* NonPrimitive */)) : target === globalObjectType ? !!(source.flags & (1048576 /* Object */ | 131072 /* NonPrimitive */)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 1048576 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType); } function isTypeComparableTo(source, target) { return isTypeRelatedTo(source, target, comparableRelation); @@ -68436,7 +68585,7 @@ function createTypeChecker(host) { return false; } function isOrHasGenericConditional(type) { - return !!(type.flags & 16777216 /* Conditional */ || type.flags & 2097152 /* Intersection */ && some(type.types, isOrHasGenericConditional)); + return !!(type.flags & 67108864 /* Conditional */ || type.flags & 268435456 /* Intersection */ && some(type.types, isOrHasGenericConditional)); } function elaborateError(node, source, target, relation, headMessage, containingMessageChain, errorOutputContainer) { if (!node || isOrHasGenericConditional(target)) return false; @@ -68482,7 +68631,7 @@ function createTypeChecker(host) { for (const signatures of [constructSignatures, callSignatures]) { if (some(signatures, (s) => { const returnType = getReturnTypeOfSignature(s); - return !(returnType.flags & (1 /* Any */ | 131072 /* Never */)) && checkTypeRelatedTo( + return !(returnType.flags & (1 /* Any */ | 262144 /* Never */)) && checkTypeRelatedTo( returnType, target, relation, @@ -68589,7 +68738,7 @@ function createTypeChecker(host) { if (idx) { return idx; } - if (target.flags & 1048576 /* Union */) { + if (target.flags & 134217728 /* Union */) { const best = getBestMatchingType(source, target); if (best) { return getIndexedAccessTypeOrUndefined(best, nameType); @@ -68612,7 +68761,7 @@ function createTypeChecker(host) { for (const value of iterator) { const { errorNode: prop, innerExpression: next, nameType, errorMessage } = value; let targetPropType = getBestMatchIndexedAccessTypeOrUndefined(source, target, nameType); - if (!targetPropType || targetPropType.flags & 8388608 /* IndexedAccess */) continue; + if (!targetPropType || targetPropType.flags & 33554432 /* IndexedAccess */) continue; let sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType); if (!sourcePropType) continue; const propName = getPropertyNameFromIndex( @@ -68662,20 +68811,20 @@ function createTypeChecker(host) { 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) { + 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 & 8192 /* UniqueESSymbol */) ? unescapeLeadingUnderscores(propertyName) : typeToString(nameType), + propertyName && !(nameType.flags & 16384 /* UniqueESSymbol */) ? unescapeLeadingUnderscores(propertyName) : typeToString(nameType), typeToString(target) ) ); @@ -68702,7 +68851,7 @@ function createTypeChecker(host) { const { errorNode: prop, innerExpression: next, nameType, errorMessage } = status.value; let targetPropType = iterationType; const targetIndexedPropType = tupleOrArrayLikeTargetParts !== neverType ? getBestMatchIndexedAccessTypeOrUndefined(source, tupleOrArrayLikeTargetParts, nameType) : void 0; - if (targetIndexedPropType && !(targetIndexedPropType.flags & 8388608 /* IndexedAccess */)) { + if (targetIndexedPropType && !(targetIndexedPropType.flags & 33554432 /* IndexedAccess */)) { targetPropType = iterationType ? getUnionType([iterationType, targetIndexedPropType]) : targetIndexedPropType; } if (!targetPropType) continue; @@ -68842,9 +68991,9 @@ function createTypeChecker(host) { const elem = getElaborationElementForJsxChild(child, childrenNameType, getInvalidTextualChildDiagnostic); if (elem) { result = elaborateElementwise( - function* () { + (function* () { yield elem; - }(), + })(), source, target, relation, @@ -68892,7 +69041,7 @@ function createTypeChecker(host) { } } function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) { - if (target.flags & (402784252 /* Primitive */ | 131072 /* Never */)) return false; + if (target.flags & (12713980 /* Primitive */ | 262144 /* Never */)) return false; if (isTupleLikeType(source)) { return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer); } @@ -68918,8 +69067,8 @@ function createTypeChecker(host) { if (!length(node.properties)) return; for (const prop of node.properties) { if (isSpreadAssignment(prop)) continue; - const type = getLiteralTypeFromProperty(getSymbolOfDeclaration(prop), 8576 /* StringOrNumberLiteralOrUnique */); - if (!type || type.flags & 131072 /* Never */) { + const type = getLiteralTypeFromProperty(getSymbolOfDeclaration(prop), 19456 /* StringOrNumberLiteralOrUnique */); + if (!type || type.flags & 262144 /* Never */) { continue; } switch (prop.kind) { @@ -68938,7 +69087,7 @@ function createTypeChecker(host) { } } function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) { - if (target.flags & (402784252 /* Primitive */ | 131072 /* Never */)) return false; + if (target.flags & (12713980 /* Primitive */ | 262144 /* Never */)) return false; return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer); } function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) { @@ -68964,11 +69113,11 @@ function createTypeChecker(host) { 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 /* Any */ | 131072 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */); + return !!(restType.flags & (1 /* Any */ | 262144 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */); } 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 /* True */; } @@ -68993,7 +69142,7 @@ function createTypeChecker(host) { target, /*inferenceContext*/ void 0, - compareTypes + compareTypes2 ); } const sourceCount = getParameterCount(source); @@ -69009,12 +69158,12 @@ function createTypeChecker(host) { if (sourceThisType && sourceThisType !== voidType) { const targetThisType = getThisTypeOfSignature(target); if (targetThisType) { - const related = !strictVariance && compareTypes( + const related = !strictVariance && compareTypes2( sourceThisType, targetThisType, /*reportErrors*/ false - ) || compareTypes(targetThisType, sourceThisType, reportErrors2); + ) || compareTypes2(targetThisType, sourceThisType, reportErrors2); if (!related) { if (reportErrors2) { errorReporter(Diagnostics.The_this_types_of_each_signature_are_incompatible); @@ -69033,13 +69182,13 @@ function createTypeChecker(host) { const sourceSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(source, i) ? void 0 : getSingleCallSignature(getNonNullableType(sourceType)); const targetSig = checkMode & 3 /* Callback */ || isInstantiatedGenericParameter(target, i) ? void 0 : getSingleCallSignature(getNonNullableType(targetType)); const callbacks = sourceSig && targetSig && !getTypePredicateOfSignature(sourceSig) && !getTypePredicateOfSignature(targetSig) && getTypeFacts(sourceType, 50331648 /* IsUndefinedOrNull */) === getTypeFacts(targetType, 50331648 /* IsUndefinedOrNull */); - let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes( + let related = callbacks ? compareSignaturesRelated(targetSig, sourceSig, checkMode & 8 /* StrictArity */ | (strictVariance ? 2 /* StrictCallback */ : 1 /* BivariantCallback */), reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes2, reportUnreliableMarkers) : !(checkMode & 3 /* Callback */) && !strictVariance && compareTypes2( sourceType, targetType, /*reportErrors*/ false - ) || compareTypes(targetType, sourceType, reportErrors2); - if (related && checkMode & 8 /* StrictArity */ && i >= getMinArgumentCount(source) && i < getMinArgumentCount(target) && compareTypes( + ) || compareTypes2(targetType, sourceType, reportErrors2); + if (related && checkMode & 8 /* StrictArity */ && i >= getMinArgumentCount(source) && i < getMinArgumentCount(target) && compareTypes2( sourceType, targetType, /*reportErrors*/ @@ -69066,7 +69215,7 @@ function createTypeChecker(host) { 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)); @@ -69074,12 +69223,12 @@ function createTypeChecker(host) { return 0 /* False */; } } else { - result &= checkMode & 1 /* BivariantCallback */ && compareTypes( + result &= checkMode & 1 /* BivariantCallback */ && compareTypes2( targetReturnType, sourceReturnType, /*reportErrors*/ false - ) || compareTypes(sourceReturnType, targetReturnType, reportErrors2); + ) || compareTypes2(sourceReturnType, targetReturnType, reportErrors2); if (!result && reportErrors2 && incompatibleErrorReporter) { incompatibleErrorReporter(sourceReturnType, targetReturnType); } @@ -69087,7 +69236,7 @@ function createTypeChecker(host) { } 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); @@ -69104,7 +69253,7 @@ function createTypeChecker(host) { return 0 /* False */; } } - const related = source.type === target.type ? -1 /* True */ : source.type && target.type ? compareTypes(source.type, target.type, reportErrors2) : 0 /* False */; + const related = source.type === target.type ? -1 /* True */ : source.type && target.type ? compareTypes2(source.type, target.type, reportErrors2) : 0 /* False */; if (related === 0 /* False */ && reportErrors2) { errorReporter(Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); } @@ -69129,30 +69278,30 @@ function createTypeChecker(host) { 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 /* Object */ ? !isGenericMappedType(type) && isEmptyResolvedType(resolveStructuredTypeMembers(type)) : type.flags & 67108864 /* NonPrimitive */ ? true : type.flags & 1048576 /* Union */ ? some(type.types, isEmptyObjectType) : type.flags & 2097152 /* Intersection */ ? every(type.types, isEmptyObjectType) : false; + return type.flags & 1048576 /* Object */ ? !isGenericMappedType(type) && isEmptyResolvedType(resolveStructuredTypeMembers(type)) : type.flags & 131072 /* NonPrimitive */ ? true : type.flags & 134217728 /* Union */ ? some(type.types, isEmptyObjectType) : type.flags & 268435456 /* Intersection */ ? every(type.types, isEmptyObjectType) : false; } function isEmptyAnonymousObjectType(type) { return !!(getObjectFlags(type) & 16 /* Anonymous */ && (type.members && isEmptyResolvedType(type) || type.symbol && type.symbol.flags & 2048 /* TypeLiteral */ && getMembersOfSymbol(type.symbol).size === 0)); } function isUnknownLikeUnionType(type) { - if (strictNullChecks && type.flags & 1048576 /* Union */) { + if (strictNullChecks && type.flags & 134217728 /* Union */) { if (!(type.objectFlags & 33554432 /* IsUnknownLikeUnionComputed */)) { const types = type.types; - type.objectFlags |= 33554432 /* IsUnknownLikeUnionComputed */ | (types.length >= 3 && types[0].flags & 32768 /* Undefined */ && types[1].flags & 65536 /* Null */ && some(types, isEmptyAnonymousObjectType) ? 67108864 /* IsUnknownLikeUnion */ : 0); + type.objectFlags |= 33554432 /* IsUnknownLikeUnionComputed */ | (types.length >= 3 && types[0].flags & 4 /* Undefined */ && types[1].flags & 8 /* Null */ && some(types, isEmptyAnonymousObjectType) ? 67108864 /* IsUnknownLikeUnion */ : 0); } return !!(type.objectFlags & 67108864 /* IsUnknownLikeUnion */); } return false; } function containsUndefinedType(type) { - return !!((type.flags & 1048576 /* Union */ ? type.types[0] : type).flags & 32768 /* Undefined */); + return !!((type.flags & 134217728 /* Union */ ? type.types[0] : type).flags & 4 /* Undefined */); } function containsNonMissingUndefinedType(type) { - const candidate = type.flags & 1048576 /* Union */ ? type.types[0] : type; - return !!(candidate.flags & 32768 /* Undefined */) && candidate !== missingType; + const candidate = type.flags & 134217728 /* Union */ ? type.types[0] : type; + return !!(candidate.flags & 4 /* Undefined */) && candidate !== missingType; } function isStringIndexSignatureOnlyType(type) { - return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 3145728 /* UnionOrIntersection */ && every(type.types, isStringIndexSignatureOnlyType) || false; + return type.flags & 1048576 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) || type.flags & 402653184 /* UnionOrIntersection */ && every(type.types, isStringIndexSignatureOnlyType) || false; } function isEnumTypeRelatedTo(source, target, errorReporter) { const sourceSymbol = source.flags & 8 /* EnumMember */ ? getParentOfSymbol(source) : source; @@ -69217,28 +69366,28 @@ function createTypeChecker(host) { function isSimpleTypeRelatedTo(source, target, relation, errorReporter) { const s = source.flags; const t = target.flags; - if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType) return true; + if (t & 1 /* Any */ || s & 262144 /* Never */ || source === wildcardType) return true; if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */)) return true; - if (t & 131072 /* Never */) return false; - if (s & 402653316 /* StringLike */ && t & 4 /* String */) return true; - if (s & 128 /* StringLiteral */ && s & 1024 /* EnumLiteral */ && t & 128 /* StringLiteral */ && !(t & 1024 /* EnumLiteral */) && source.value === target.value) return true; - if (s & 296 /* NumberLike */ && t & 8 /* Number */) return true; - if (s & 256 /* NumberLiteral */ && s & 1024 /* EnumLiteral */ && t & 256 /* NumberLiteral */ && !(t & 1024 /* EnumLiteral */) && source.value === target.value) return true; - if (s & 2112 /* BigIntLike */ && t & 64 /* BigInt */) return true; - if (s & 528 /* BooleanLike */ && t & 16 /* Boolean */) return true; - if (s & 12288 /* ESSymbolLike */ && t & 4096 /* ESSymbol */) return true; - if (s & 32 /* Enum */ && t & 32 /* Enum */ && source.symbol.escapedName === target.symbol.escapedName && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true; - if (s & 1024 /* EnumLiteral */ && t & 1024 /* EnumLiteral */) { - if (s & 1048576 /* Union */ && t & 1048576 /* Union */ && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true; - if (s & 2944 /* Literal */ && t & 2944 /* Literal */ && source.value === target.value && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true; - } - if (s & 32768 /* Undefined */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & (32768 /* Undefined */ | 16384 /* Void */))) return true; - if (s & 65536 /* Null */ && (!strictNullChecks && !(t & 3145728 /* UnionOrIntersection */) || t & 65536 /* Null */)) return true; - if (s & 524288 /* Object */ && t & 67108864 /* NonPrimitive */ && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source) && !(getObjectFlags(source) & 8192 /* FreshLiteral */))) return true; + if (t & 262144 /* Never */) return false; + if (s & 12583968 /* StringLike */ && t & 32 /* String */) return true; + if (s & 1024 /* StringLiteral */ && s & 32768 /* EnumLiteral */ && t & 1024 /* StringLiteral */ && !(t & 32768 /* EnumLiteral */) && source.value === target.value) return true; + if (s & 67648 /* NumberLike */ && t & 64 /* Number */) return true; + if (s & 2048 /* NumberLiteral */ && s & 32768 /* EnumLiteral */ && t & 2048 /* NumberLiteral */ && !(t & 32768 /* EnumLiteral */) && source.value === target.value) return true; + if (s & 4224 /* BigIntLike */ && t & 128 /* BigInt */) return true; + if (s & 8448 /* BooleanLike */ && t & 256 /* Boolean */) return true; + if (s & 16896 /* ESSymbolLike */ && t & 512 /* ESSymbol */) return true; + if (s & 65536 /* Enum */ && t & 65536 /* Enum */ && source.symbol.escapedName === target.symbol.escapedName && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true; + if (s & 32768 /* EnumLiteral */ && t & 32768 /* EnumLiteral */) { + if (s & 134217728 /* Union */ && t & 134217728 /* Union */ && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true; + if (s & 15360 /* Literal */ && t & 15360 /* Literal */ && source.value === target.value && isEnumTypeRelatedTo(source.symbol, target.symbol, errorReporter)) return true; + } + if (s & 4 /* Undefined */ && (!strictNullChecks && !(t & 402653184 /* UnionOrIntersection */) || t & (4 /* Undefined */ | 16 /* Void */))) return true; + if (s & 8 /* Null */ && (!strictNullChecks && !(t & 402653184 /* UnionOrIntersection */) || t & 8 /* Null */)) return true; + if (s & 1048576 /* Object */ && t & 131072 /* NonPrimitive */ && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source) && !(getObjectFlags(source) & 8192 /* FreshLiteral */))) return true; if (relation === assignableRelation || relation === comparableRelation) { if (s & 1 /* Any */) return true; - if (s & 8 /* Number */ && (t & 32 /* Enum */ || t & 256 /* NumberLiteral */ && t & 1024 /* EnumLiteral */)) return true; - if (s & 256 /* NumberLiteral */ && !(s & 1024 /* EnumLiteral */) && (t & 32 /* Enum */ || t & 256 /* NumberLiteral */ && t & 1024 /* EnumLiteral */ && source.value === target.value)) return true; + if (s & 64 /* Number */ && (t & 65536 /* Enum */ || t & 2048 /* NumberLiteral */ && t & 32768 /* EnumLiteral */)) return true; + if (s & 2048 /* NumberLiteral */ && !(s & 32768 /* EnumLiteral */) && (t & 65536 /* Enum */ || t & 2048 /* NumberLiteral */ && t & 32768 /* EnumLiteral */ && source.value === target.value)) return true; if (isUnknownLikeUnionType(target)) return true; } return false; @@ -69254,14 +69403,14 @@ function createTypeChecker(host) { return true; } if (relation !== identityRelation) { - if (relation === comparableRelation && !(target.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(target, source, relation) || isSimpleTypeRelatedTo(source, target, relation)) { + if (relation === comparableRelation && !(target.flags & 262144 /* Never */) && isSimpleTypeRelatedTo(target, source, relation) || isSimpleTypeRelatedTo(source, target, relation)) { return true; } - } else if (!((source.flags | target.flags) & (3145728 /* UnionOrIntersection */ | 8388608 /* IndexedAccess */ | 16777216 /* Conditional */ | 33554432 /* Substitution */))) { + } else if (!((source.flags | target.flags) & (402653184 /* UnionOrIntersection */ | 33554432 /* IndexedAccess */ | 67108864 /* Conditional */ | 16777216 /* Substitution */))) { if (source.flags !== target.flags) return false; - if (source.flags & 67358815 /* Singleton */) return true; + if (source.flags & 394239 /* Singleton */) return true; } - if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) { + if (source.flags & 1048576 /* Object */ && target.flags & 1048576 /* Object */) { const related = relation.get(getRelationKey( source, target, @@ -69274,7 +69423,7 @@ function createTypeChecker(host) { return !!(related & 1 /* Succeeded */); } } - if (source.flags & 469499904 /* StructuredOrInstantiable */ || target.flags & 469499904 /* StructuredOrInstantiable */) { + if (source.flags & 536346624 /* StructuredOrInstantiable */ || target.flags & 536346624 /* StructuredOrInstantiable */) { return checkTypeRelatedTo( source, target, @@ -69290,7 +69439,7 @@ function createTypeChecker(host) { } function getNormalizedType(type, writing) { while (true) { - const t = isFreshLiteralType(type) ? type.regularType : isGenericTupleType(type) ? getNormalizedTupleType(type, writing) : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) : type; + const t = isFreshLiteralType(type) ? type.regularType : isGenericTupleType(type) ? getNormalizedTupleType(type, writing) : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 402653184 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 16777216 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 102760448 /* Simplifiable */ ? getSimplifiedType(type, writing) : type; if (t === type) return t; type = t; } @@ -69300,7 +69449,7 @@ function createTypeChecker(host) { if (reduced !== type) { return reduced; } - if (type.flags & 2097152 /* Intersection */ && shouldNormalizeIntersection(type)) { + if (type.flags & 268435456 /* Intersection */ && shouldNormalizeIntersection(type)) { const normalizedTypes = sameMap(type.types, (t) => getNormalizedType(t, writing)); if (normalizedTypes !== type.types) { return getIntersectionType(normalizedTypes); @@ -69312,15 +69461,15 @@ function createTypeChecker(host) { let hasInstantiable = false; let hasNullableOrEmpty = false; for (const t of type.types) { - hasInstantiable || (hasInstantiable = !!(t.flags & 465829888 /* Instantiable */)); - hasNullableOrEmpty || (hasNullableOrEmpty = !!(t.flags & 98304 /* Nullable */) || isEmptyAnonymousObjectType(t)); + hasInstantiable || (hasInstantiable = !!(t.flags & 132644864 /* Instantiable */)); + hasNullableOrEmpty || (hasNullableOrEmpty = !!(t.flags & 12 /* Nullable */) || isEmptyAnonymousObjectType(t)); if (hasInstantiable && hasNullableOrEmpty) return true; } return false; } function getNormalizedTupleType(type, writing) { const elements = getElementTypes(type); - const normalizedElements = sameMap(elements, (t) => t.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(t, writing) : t); + const normalizedElements = sameMap(elements, (t) => t.flags & 102760448 /* Simplifiable */ ? getSimplifiedType(t, writing) : t); return elements !== normalizedElements ? createNormalizedTupleType(type.target, normalizedElements) : type; } function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) { @@ -69550,13 +69699,13 @@ function createTypeChecker(host) { const [sourceType, targetType] = getTypeNamesForErrorDisplay(source2, target2); let generalizedSource = source2; let generalizedSourceType = sourceType; - if (!(target2.flags & 131072 /* Never */) && isLiteralType(source2) && !typeCouldHaveTopLevelSingletonTypes(target2)) { + if (!(target2.flags & 262144 /* Never */) && 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 /* IndexedAccess */ && !(source2.flags & 8388608 /* IndexedAccess */) ? target2.objectType.flags : target2.flags; - if (targetFlags & 262144 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) { + const targetFlags = target2.flags & 33554432 /* IndexedAccess */ && !(source2.flags & 33554432 /* IndexedAccess */) ? target2.objectType.flags : target2.flags; + if (targetFlags & 524288 /* TypeParameter */ && target2 !== markerSuperTypeForCheck && target2 !== markerSubTypeForCheck) { const constraint = getBaseConstraintOfType(target2); let needsOriginalSource; if (constraint && (isTypeAssignableTo(generalizedSource, constraint) || (needsOriginalSource = isTypeAssignableTo(source2, constraint)))) { @@ -69583,7 +69732,7 @@ function createTypeChecker(host) { } 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 /* StringLiteral */ && target2.flags & 1048576 /* Union */) { + if (source2.flags & 1024 /* StringLiteral */ && target2.flags & 134217728 /* Union */) { 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)); @@ -69630,8 +69779,8 @@ function createTypeChecker(host) { } function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) { if (originalSource === originalTarget) return -1 /* True */; - if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 402784252 /* Primitive */) { - if (relation === comparableRelation && !(originalTarget.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) { + if (originalSource.flags & 1048576 /* Object */ && originalTarget.flags & 12713980 /* Primitive */) { + if (relation === comparableRelation && !(originalTarget.flags & 262144 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) { return -1 /* True */; } if (reportErrors2) { @@ -69652,7 +69801,7 @@ function createTypeChecker(host) { if (source2 === target2) return -1 /* True */; if (relation === identityRelation) { if (source2.flags !== target2.flags) return 0 /* False */; - if (source2.flags & 67358815 /* Singleton */) return -1 /* True */; + if (source2.flags & 394239 /* Singleton */) return -1 /* True */; traceUnionsOrIntersectionsTooLarge(source2, target2); return recursiveTypeRelatedTo( source2, @@ -69663,13 +69812,13 @@ function createTypeChecker(host) { recursionFlags ); } - if (source2.flags & 262144 /* TypeParameter */ && getConstraintOfType(source2) === target2) { + if (source2.flags & 524288 /* TypeParameter */ && getConstraintOfType(source2) === target2) { return -1 /* True */; } - if (source2.flags & 470302716 /* DefinitelyNonNullable */ && target2.flags & 1048576 /* Union */) { + if (source2.flags & 13893600 /* DefinitelyNonNullable */ && target2.flags & 134217728 /* Union */) { const types = target2.types; - const candidate = types.length === 2 && types[0].flags & 98304 /* Nullable */ ? types[1] : types.length === 3 && types[0].flags & 98304 /* Nullable */ && types[1].flags & 98304 /* Nullable */ ? types[2] : void 0; - if (candidate && !(candidate.flags & 98304 /* Nullable */)) { + const candidate = types.length === 2 && types[0].flags & 12 /* Nullable */ ? types[1] : types.length === 3 && types[0].flags & 12 /* Nullable */ && types[1].flags & 12 /* Nullable */ ? types[2] : void 0; + if (candidate && !(candidate.flags & 12 /* Nullable */)) { target2 = getNormalizedType( candidate, /*writing*/ @@ -69678,8 +69827,8 @@ function createTypeChecker(host) { if (source2 === target2) return -1 /* True */; } } - if (relation === comparableRelation && !(target2.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(target2, source2, relation) || isSimpleTypeRelatedTo(source2, target2, relation, reportErrors2 ? reportError : void 0)) return -1 /* True */; - if (source2.flags & 469499904 /* StructuredOrInstantiable */ || target2.flags & 469499904 /* StructuredOrInstantiable */) { + if (relation === comparableRelation && !(target2.flags & 262144 /* Never */) && isSimpleTypeRelatedTo(target2, source2, relation) || isSimpleTypeRelatedTo(source2, target2, relation, reportErrors2 ? reportError : void 0)) return -1 /* True */; + if (source2.flags & 536346624 /* StructuredOrInstantiable */ || target2.flags & 536346624 /* StructuredOrInstantiable */) { const isPerformingExcessPropertyChecks = !(intersectionState & 2 /* Target */) && (isObjectLiteralType2(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */); if (isPerformingExcessPropertyChecks) { if (hasExcessProperties(source2, target2, reportErrors2)) { @@ -69689,7 +69838,7 @@ function createTypeChecker(host) { return 0 /* False */; } } - const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (402784252 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2)); + const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (12713980 /* Primitive */ | 1048576 /* Object */ | 268435456 /* Intersection */) && source2 !== globalObjectType && target2.flags & (1048576 /* Object */ | 268435456 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures(source2)); const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */); if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) { if (reportErrors2) { @@ -69718,7 +69867,7 @@ function createTypeChecker(host) { return 0 /* False */; } traceUnionsOrIntersectionsTooLarge(source2, target2); - const skipCaching = source2.flags & 1048576 /* Union */ && source2.types.length < 4 && !(target2.flags & 1048576 /* Union */) || target2.flags & 1048576 /* Union */ && target2.types.length < 4 && !(source2.flags & 469499904 /* StructuredOrInstantiable */); + const skipCaching = source2.flags & 134217728 /* Union */ && source2.types.length < 4 && !(target2.flags & 134217728 /* Union */) || target2.flags & 134217728 /* Union */ && target2.types.length < 4 && !(source2.flags & 536346624 /* StructuredOrInstantiable */); const result2 = skipCaching ? unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) : recursiveTypeRelatedTo(source2, target2, reportErrors2, intersectionState, recursionFlags); if (result2) { return result2; @@ -69739,7 +69888,7 @@ function createTypeChecker(host) { if (maybeSuppress) { overrideNextErrorInfo--; } - if (source2.flags & 524288 /* Object */ && target2.flags & 524288 /* Object */) { + if (source2.flags & 1048576 /* Object */ && target2.flags & 1048576 /* Object */) { const currentError = errorInfo; tryElaborateArrayLikeErrors( source2, @@ -69751,11 +69900,11 @@ function createTypeChecker(host) { maybeSuppress = !!errorInfo; } } - if (source2.flags & 524288 /* Object */ && target2.flags & 402784252 /* Primitive */) { + if (source2.flags & 1048576 /* Object */ && target2.flags & 12713980 /* Primitive */) { tryElaborateErrorsForPrimitivesAndObjects(source2, target2); - } else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) { + } else if (source2.symbol && source2.flags & 1048576 /* Object */ && 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 /* JsxAttributes */ && target2.flags & 2097152 /* Intersection */) { + } else if (getObjectFlags(source2) & 2048 /* JsxAttributes */ && target2.flags & 268435456 /* Intersection */) { const targetTypes = target2.types; const intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, errorNode); const intrinsicClassAttributes = getJsxType(JsxNames.IntrinsicClassAttributes, errorNode); @@ -69780,7 +69929,7 @@ function createTypeChecker(host) { return; } reportRelationError(headMessage2, source2, target2); - if (source2.flags & 262144 /* TypeParameter */ && ((_b = (_a2 = source2.symbol) == null ? void 0 : _a2.declarations) == null ? void 0 : _b[0]) && !getConstraintOfType(source2)) { + if (source2.flags & 524288 /* TypeParameter */ && ((_b = (_a2 = source2.symbol) == null ? void 0 : _a2.declarations) == null ? void 0 : _b[0]) && !getConstraintOfType(source2)) { const syntheticParam = cloneTypeParameter(source2); syntheticParam.constraint = instantiateType(target2, makeUnaryTypeMapper(source2, syntheticParam)); if (hasNonCircularBaseConstraint(syntheticParam)) { @@ -69793,7 +69942,7 @@ function createTypeChecker(host) { if (!tracing) { return; } - if (source2.flags & 3145728 /* UnionOrIntersection */ && target2.flags & 3145728 /* UnionOrIntersection */) { + if (source2.flags & 402653184 /* UnionOrIntersection */ && target2.flags & 402653184 /* UnionOrIntersection */) { const sourceUnionOrIntersection = source2; const targetUnionOrIntersection = target2; if (sourceUnionOrIntersection.objectFlags & targetUnionOrIntersection.objectFlags & 32768 /* PrimitiveUnion */) { @@ -69817,7 +69966,7 @@ function createTypeChecker(host) { const appendPropType = (propTypes, type) => { var _a2; type = getApparentType(type); - const prop = type.flags & 3145728 /* UnionOrIntersection */ ? getPropertyOfUnionOrIntersectionType(type, name) : getPropertyOfObjectType(type, name); + const prop = type.flags & 402653184 /* UnionOrIntersection */ ? getPropertyOfUnionOrIntersectionType(type, name) : getPropertyOfObjectType(type, name); const propType = prop && getTypeOfSymbol(prop) || ((_a2 = getApplicableIndexInfoForName(type, name)) == null ? void 0 : _a2.type) || undefinedType; return append(propTypes, propType); }; @@ -69839,9 +69988,9 @@ function createTypeChecker(host) { } let reducedTarget = target2; let checkTypes; - if (target2.flags & 1048576 /* Union */) { + if (target2.flags & 134217728 /* Union */) { reducedTarget = findMatchingDiscriminantType(source2, target2, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target2); - checkTypes = reducedTarget.flags & 1048576 /* Union */ ? reducedTarget.types : [reducedTarget]; + checkTypes = reducedTarget.flags & 134217728 /* Union */ ? reducedTarget.types : [reducedTarget]; } for (const prop of getPropertiesOfType(source2)) { if (shouldCheckAsExcessProperty(prop, source2.symbol) && !isIgnoredJsxProperty(source2, prop)) { @@ -69896,33 +70045,33 @@ function createTypeChecker(host) { return prop.valueDeclaration && container.valueDeclaration && prop.valueDeclaration.parent === container.valueDeclaration; } function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) { - if (source2.flags & 1048576 /* Union */) { - if (target2.flags & 1048576 /* Union */) { + if (source2.flags & 134217728 /* Union */) { + if (target2.flags & 134217728 /* Union */) { const sourceOrigin = source2.origin; - if (sourceOrigin && sourceOrigin.flags & 2097152 /* Intersection */ && target2.aliasSymbol && contains(sourceOrigin.types, target2)) { + if (sourceOrigin && sourceOrigin.flags & 268435456 /* Intersection */ && target2.aliasSymbol && contains(sourceOrigin.types, target2)) { return -1 /* True */; } const targetOrigin = target2.origin; - if (targetOrigin && targetOrigin.flags & 1048576 /* Union */ && source2.aliasSymbol && contains(targetOrigin.types, source2)) { + if (targetOrigin && targetOrigin.flags & 134217728 /* Union */ && source2.aliasSymbol && contains(targetOrigin.types, source2)) { return -1 /* True */; } } - return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState); + return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 12713980 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 12713980 /* Primitive */), intersectionState); } - if (target2.flags & 1048576 /* Union */) { - return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */), intersectionState); + if (target2.flags & 134217728 /* Union */) { + return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 12713980 /* Primitive */) && !(target2.flags & 12713980 /* Primitive */), intersectionState); } - if (target2.flags & 2097152 /* Intersection */) { + if (target2.flags & 268435456 /* Intersection */) { return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */); } - if (relation === comparableRelation && target2.flags & 402784252 /* Primitive */) { - const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t); + if (relation === comparableRelation && target2.flags & 12713980 /* Primitive */) { + const constraints = sameMap(source2.types, (t) => t.flags & 132644864 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t); if (constraints !== source2.types) { source2 = getIntersectionType(constraints); - if (source2.flags & 131072 /* Never */) { + if (source2.flags & 262144 /* Never */) { return 0 /* False */; } - if (!(source2.flags & 2097152 /* Intersection */)) { + if (!(source2.flags & 268435456 /* Intersection */)) { return isRelatedTo( source2, target2, @@ -69967,13 +70116,13 @@ function createTypeChecker(host) { } function typeRelatedToSomeType(source2, target2, reportErrors2, intersectionState) { const targetTypes = target2.types; - if (target2.flags & 1048576 /* Union */) { + if (target2.flags & 134217728 /* Union */) { if (containsType(targetTypes, source2)) { return -1 /* True */; } - if (relation !== comparableRelation && getObjectFlags(target2) & 32768 /* PrimitiveUnion */ && !(source2.flags & 1024 /* EnumLiteral */) && (source2.flags & (128 /* StringLiteral */ | 512 /* BooleanLiteral */ | 2048 /* BigIntLiteral */) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 256 /* NumberLiteral */)) { + if (relation !== comparableRelation && getObjectFlags(target2) & 32768 /* PrimitiveUnion */ && !(source2.flags & 32768 /* EnumLiteral */) && (source2.flags & (1024 /* StringLiteral */ | 8192 /* BooleanLiteral */ | 4096 /* BigIntLiteral */) || (relation === subtypeRelation || relation === strictSubtypeRelation) && source2.flags & 2048 /* NumberLiteral */)) { const alternateForm = source2 === source2.regularType ? source2.freshType : source2.regularType; - const primitive = source2.flags & 128 /* StringLiteral */ ? stringType : source2.flags & 256 /* NumberLiteral */ ? numberType : source2.flags & 2048 /* BigIntLiteral */ ? bigintType : void 0; + const primitive = source2.flags & 1024 /* StringLiteral */ ? stringType : source2.flags & 2048 /* NumberLiteral */ ? numberType : source2.flags & 4096 /* BigIntLiteral */ ? bigintType : void 0; return primitive && containsType(targetTypes, primitive) || alternateForm && containsType(targetTypes, alternateForm) ? -1 /* True */ : 0 /* False */; } const match = getMatchingUnionConstituentForType(target2, source2); @@ -70047,7 +70196,7 @@ function createTypeChecker(host) { } function someTypeRelatedToType(source2, target2, reportErrors2, intersectionState) { const sourceTypes = source2.types; - if (source2.flags & 1048576 /* Union */ && containsType(sourceTypes, target2)) { + if (source2.flags & 134217728 /* Union */ && containsType(sourceTypes, target2)) { return -1 /* True */; } const len = sourceTypes.length; @@ -70068,8 +70217,8 @@ function createTypeChecker(host) { return 0 /* False */; } function getUndefinedStrippedTargetIfNeeded(source2, target2) { - if (source2.flags & 1048576 /* Union */ && target2.flags & 1048576 /* Union */ && !(source2.types[0].flags & 32768 /* Undefined */) && target2.types[0].flags & 32768 /* Undefined */) { - return extractTypesOfKind(target2, ~32768 /* Undefined */); + if (source2.flags & 134217728 /* Union */ && target2.flags & 134217728 /* Union */ && !(source2.types[0].flags & 4 /* Undefined */) && target2.types[0].flags & 4 /* Undefined */) { + return extractTypesOfKind(target2, ~4 /* Undefined */); } return target2; } @@ -70079,7 +70228,7 @@ function createTypeChecker(host) { const undefinedStrippedTarget = getUndefinedStrippedTargetIfNeeded(source2, target2); for (let i = 0; i < sourceTypes.length; i++) { const sourceType = sourceTypes[i]; - if (undefinedStrippedTarget.flags & 1048576 /* Union */ && sourceTypes.length >= undefinedStrippedTarget.types.length && sourceTypes.length % undefinedStrippedTarget.types.length === 0) { + if (undefinedStrippedTarget.flags & 134217728 /* Union */ && sourceTypes.length >= undefinedStrippedTarget.types.length && sourceTypes.length % undefinedStrippedTarget.types.length === 0) { const related2 = isRelatedTo( sourceType, undefinedStrippedTarget.types[i % undefinedStrippedTarget.types.length], @@ -70132,35 +70281,11 @@ function createTypeChecker(host) { /*reportErrors*/ false ) : compareTypesIdentical(s, t); - } else if (variance === 1 /* Covariant */) { - related = isRelatedTo( - s, - t, - 3 /* Both */, - reportErrors2, - /*headMessage*/ - void 0, - intersectionState - ); - } else if (variance === 2 /* Contravariant */) { - related = isRelatedTo( - t, - s, - 3 /* Both */, - reportErrors2, - /*headMessage*/ - void 0, - intersectionState - ); - } else if (variance === 3 /* Bivariant */) { - related = isRelatedTo( - t, - s, - 3 /* Both */, - /*reportErrors*/ - false - ); - if (!related) { + } else { + if (inVarianceComputation && varianceFlags & 16 /* Unreliable */) { + instantiateType(s, reportUnreliableMapper); + } + if (variance === 1 /* Covariant */) { related = isRelatedTo( s, t, @@ -70170,19 +70295,8 @@ function createTypeChecker(host) { void 0, intersectionState ); - } - } else { - related = isRelatedTo( - s, - t, - 3 /* Both */, - reportErrors2, - /*headMessage*/ - void 0, - intersectionState - ); - if (related) { - related &= isRelatedTo( + } else if (variance === 2 /* Contravariant */) { + related = isRelatedTo( t, s, 3 /* Both */, @@ -70191,6 +70305,46 @@ function createTypeChecker(host) { void 0, intersectionState ); + } else if (variance === 3 /* Bivariant */) { + related = isRelatedTo( + t, + s, + 3 /* Both */, + /*reportErrors*/ + false + ); + if (!related) { + related = isRelatedTo( + s, + t, + 3 /* Both */, + reportErrors2, + /*headMessage*/ + void 0, + intersectionState + ); + } + } else { + related = isRelatedTo( + s, + t, + 3 /* Both */, + reportErrors2, + /*headMessage*/ + void 0, + intersectionState + ); + if (related) { + related &= isRelatedTo( + t, + s, + 3 /* Both */, + reportErrors2, + /*headMessage*/ + void 0, + intersectionState + ); + } } } if (!related) { @@ -70352,8 +70506,8 @@ function createTypeChecker(host) { const saveErrorInfo = captureErrorCalculationState(); let result2 = structuredTypeRelatedToWorker(source2, target2, reportErrors2, intersectionState, saveErrorInfo); if (relation !== identityRelation) { - if (!result2 && (source2.flags & 2097152 /* Intersection */ || source2.flags & 262144 /* TypeParameter */ && target2.flags & 1048576 /* Union */)) { - const constraint = getEffectiveConstraintOfIntersection(source2.flags & 2097152 /* Intersection */ ? source2.types : [source2], !!(target2.flags & 1048576 /* Union */)); + if (!result2 && (source2.flags & 268435456 /* Intersection */ || source2.flags & 524288 /* TypeParameter */ && target2.flags & 134217728 /* Union */)) { + const constraint = getEffectiveConstraintOfIntersection(source2.flags & 268435456 /* Intersection */ ? source2.types : [source2], !!(target2.flags & 134217728 /* Union */)); if (constraint && everyType(constraint, (c) => c !== source2)) { result2 = isRelatedTo( constraint, @@ -70367,7 +70521,7 @@ function createTypeChecker(host) { ); } } - if (result2 && !(intersectionState & 2 /* Target */) && target2.flags & 2097152 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (524288 /* Object */ | 2097152 /* Intersection */)) { + if (result2 && !(intersectionState & 2 /* Target */) && target2.flags & 268435456 /* Intersection */ && !isGenericObjectType(target2) && source2.flags & (1048576 /* Object */ | 268435456 /* Intersection */)) { result2 &= propertiesRelatedTo( source2, target2, @@ -70388,7 +70542,7 @@ function createTypeChecker(host) { 0 /* None */ ); } - } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => t === target2 || !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) { + } else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 268435456 /* Intersection */ && getApparentType(source2).flags & 403701760 /* StructuredType */ && !some(source2.types, (t) => t === target2 || !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) { result2 &= propertiesRelatedTo( source2, target2, @@ -70411,7 +70565,7 @@ function createTypeChecker(host) { const mappedKeys = []; forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType( modifiersType, - 8576 /* StringOrNumberLiteralOrUnique */, + 19456 /* StringOrNumberLiteralOrUnique */, /*stringsOnly*/ false, (t) => void mappedKeys.push(instantiateType(nameType, appendTypeMapping(targetType.mapper, getTypeParameterFromMappedType(targetType), t))) @@ -70425,14 +70579,14 @@ function createTypeChecker(host) { let sourceFlags = source2.flags; const targetFlags = target2.flags; if (relation === identityRelation) { - if (sourceFlags & 3145728 /* UnionOrIntersection */) { + if (sourceFlags & 402653184 /* UnionOrIntersection */) { let result3 = eachTypeRelatedToSomeType(source2, target2); if (result3) { result3 &= eachTypeRelatedToSomeType(target2, source2); } return result3; } - if (sourceFlags & 4194304 /* Index */) { + if (sourceFlags & 2097152 /* Index */) { return isRelatedTo( source2.type, target2.type, @@ -70441,7 +70595,7 @@ function createTypeChecker(host) { false ); } - if (sourceFlags & 8388608 /* IndexedAccess */) { + if (sourceFlags & 33554432 /* IndexedAccess */) { if (result2 = isRelatedTo( source2.objectType, target2.objectType, @@ -70460,7 +70614,7 @@ function createTypeChecker(host) { } } } - if (sourceFlags & 16777216 /* Conditional */) { + if (sourceFlags & 67108864 /* Conditional */) { if (source2.root.isDistributive === target2.root.isDistributive) { if (result2 = isRelatedTo( source2.checkType, @@ -70497,7 +70651,7 @@ function createTypeChecker(host) { } } } - if (sourceFlags & 33554432 /* Substitution */) { + if (sourceFlags & 16777216 /* Substitution */) { if (result2 = isRelatedTo( source2.baseType, target2.baseType, @@ -70516,7 +70670,7 @@ function createTypeChecker(host) { } } } - if (sourceFlags & 134217728 /* TemplateLiteral */) { + if (sourceFlags & 4194304 /* TemplateLiteral */) { if (arrayIsEqualTo(source2.texts, target2.texts)) { const sourceTypes = source2.types; const targetTypes = target2.types; @@ -70535,7 +70689,7 @@ function createTypeChecker(host) { return result2; } } - if (sourceFlags & 268435456 /* StringMapping */) { + if (sourceFlags & 8388608 /* StringMapping */) { if (source2.symbol === target2.symbol) { return isRelatedTo( source2.type, @@ -70546,18 +70700,18 @@ function createTypeChecker(host) { ); } } - if (!(sourceFlags & 524288 /* Object */)) { + if (!(sourceFlags & 1048576 /* Object */)) { return 0 /* False */; } - } else if (sourceFlags & 3145728 /* UnionOrIntersection */ || targetFlags & 3145728 /* UnionOrIntersection */) { + } else if (sourceFlags & 402653184 /* UnionOrIntersection */ || targetFlags & 402653184 /* UnionOrIntersection */) { if (result2 = unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState)) { return result2; } - if (!(sourceFlags & 465829888 /* Instantiable */ || sourceFlags & 524288 /* Object */ && targetFlags & 1048576 /* Union */ || sourceFlags & 2097152 /* Intersection */ && targetFlags & (524288 /* Object */ | 1048576 /* Union */ | 465829888 /* Instantiable */))) { + if (!(sourceFlags & 132644864 /* Instantiable */ || sourceFlags & 1048576 /* Object */ && targetFlags & 134217728 /* Union */ || sourceFlags & 268435456 /* Intersection */ && targetFlags & (1048576 /* Object */ | 134217728 /* Union */ | 132644864 /* Instantiable */))) { return 0 /* False */; } } - if (sourceFlags & (524288 /* Object */ | 16777216 /* Conditional */) && source2.aliasSymbol && source2.aliasTypeArguments && source2.aliasSymbol === target2.aliasSymbol && !(isMarkerType(source2) || isMarkerType(target2))) { + if (sourceFlags & (1048576 /* Object */ | 67108864 /* Conditional */) && source2.aliasSymbol && source2.aliasTypeArguments && source2.aliasSymbol === target2.aliasSymbol && !(isMarkerType(source2) || isMarkerType(target2))) { const variances = getAliasVariances(source2.aliasSymbol); if (variances === emptyArray) { return 1 /* Unknown */; @@ -70574,7 +70728,7 @@ function createTypeChecker(host) { if (isSingleElementGenericTupleType(source2) && !source2.target.readonly && (result2 = isRelatedTo(getTypeArguments(source2)[0], target2, 1 /* Source */)) || isSingleElementGenericTupleType(target2) && (target2.target.readonly || isMutableArrayOrTuple(getBaseConstraintOfType(source2) || source2)) && (result2 = isRelatedTo(source2, getTypeArguments(target2)[0], 2 /* Target */))) { return result2; } - if (targetFlags & 262144 /* TypeParameter */) { + if (targetFlags & 524288 /* TypeParameter */) { if (getObjectFlags(source2) & 32 /* Mapped */ && !source2.declaration.nameType && isRelatedTo(getIndexType(target2), getConstraintTypeFromMappedType(source2), 3 /* Both */)) { if (!(getMappedTypeModifiers(source2) & 4 /* IncludeOptional */)) { const templateType = getTemplateTypeFromMappedType(source2); @@ -70584,10 +70738,10 @@ function createTypeChecker(host) { } } } - if (relation === comparableRelation && sourceFlags & 262144 /* TypeParameter */) { + if (relation === comparableRelation && sourceFlags & 524288 /* TypeParameter */) { let constraint = getConstraintOfTypeParameter(source2); if (constraint) { - while (constraint && someType(constraint, (c) => !!(c.flags & 262144 /* TypeParameter */))) { + while (constraint && someType(constraint, (c) => !!(c.flags & 524288 /* TypeParameter */))) { if (result2 = isRelatedTo( constraint, target2, @@ -70602,9 +70756,9 @@ function createTypeChecker(host) { } return 0 /* False */; } - } else if (targetFlags & 4194304 /* Index */) { + } else if (targetFlags & 2097152 /* Index */) { const targetType = target2.type; - if (sourceFlags & 4194304 /* Index */) { + if (sourceFlags & 2097152 /* Index */) { if (result2 = isRelatedTo( targetType, source2.type, @@ -70640,8 +70794,8 @@ function createTypeChecker(host) { } } } - } else if (targetFlags & 8388608 /* IndexedAccess */) { - if (sourceFlags & 8388608 /* IndexedAccess */) { + } else if (targetFlags & 33554432 /* IndexedAccess */) { + if (sourceFlags & 33554432 /* IndexedAccess */) { if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) { result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2); } @@ -70689,7 +70843,7 @@ function createTypeChecker(host) { const templateType = getTemplateTypeFromMappedType(target2); const modifiers = getMappedTypeModifiers(target2); if (!(modifiers & 8 /* ExcludeOptional */)) { - if (!keysRemapped && templateType.flags & 8388608 /* IndexedAccess */ && templateType.objectType === source2 && templateType.indexType === getTypeParameterFromMappedType(target2)) { + if (!keysRemapped && templateType.flags & 33554432 /* IndexedAccess */ && templateType.objectType === source2 && templateType.indexType === getTypeParameterFromMappedType(target2)) { return -1 /* True */; } if (!isGenericMappedType(source2)) { @@ -70697,11 +70851,11 @@ function createTypeChecker(host) { const sourceKeys = getIndexType(source2, 2 /* NoIndexSignatures */); const includeOptional = modifiers & 4 /* IncludeOptional */; const filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : void 0; - if (includeOptional ? !(filteredByApplicability.flags & 131072 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) { + if (includeOptional ? !(filteredByApplicability.flags & 262144 /* Never */) : isRelatedTo(targetKeys, sourceKeys, 3 /* Both */)) { const templateType2 = getTemplateTypeFromMappedType(target2); const typeParameter = getTypeParameterFromMappedType(target2); - const nonNullComponent = extractTypesOfKind(templateType2, ~98304 /* Nullable */); - if (!keysRemapped && nonNullComponent.flags & 8388608 /* IndexedAccess */ && nonNullComponent.indexType === typeParameter) { + const nonNullComponent = extractTypesOfKind(templateType2, ~12 /* Nullable */); + if (!keysRemapped && nonNullComponent.flags & 33554432 /* IndexedAccess */ && nonNullComponent.indexType === typeParameter) { if (result2 = isRelatedTo(source2, nonNullComponent.objectType, 2 /* Target */, reportErrors2)) { return result2; } @@ -70717,12 +70871,12 @@ function createTypeChecker(host) { resetErrorInfo(saveErrorInfo); } } - } else if (targetFlags & 16777216 /* Conditional */) { + } else if (targetFlags & 67108864 /* Conditional */) { if (isDeeplyNestedType(target2, targetStack, targetDepth, 10)) { return 3 /* Maybe */; } const c = target2; - if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) { + if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 67108864 /* Conditional */ && source2.root === c.root)) { const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType)); const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType)); if (result2 = skipTrue ? -1 /* True */ : isRelatedTo( @@ -70750,8 +70904,8 @@ function createTypeChecker(host) { } } } - } else if (targetFlags & 134217728 /* TemplateLiteral */) { - if (sourceFlags & 134217728 /* TemplateLiteral */) { + } else if (targetFlags & 4194304 /* TemplateLiteral */) { + if (sourceFlags & 4194304 /* TemplateLiteral */) { if (relation === comparableRelation) { return templateLiteralTypesDefinitelyUnrelated(source2, target2) ? 0 /* False */ : -1 /* True */; } @@ -70760,15 +70914,15 @@ function createTypeChecker(host) { if (isTypeMatchedByTemplateLiteralType(source2, target2)) { return -1 /* True */; } - } else if (target2.flags & 268435456 /* StringMapping */) { - if (!(source2.flags & 268435456 /* StringMapping */)) { + } else if (target2.flags & 8388608 /* StringMapping */) { + if (!(source2.flags & 8388608 /* StringMapping */)) { if (isMemberOfStringMapping(source2, target2)) { return -1 /* True */; } } } - if (sourceFlags & 8650752 /* TypeVariable */) { - if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) { + if (sourceFlags & 34078720 /* TypeVariable */) { + if (!(sourceFlags & 33554432 /* IndexedAccess */ && targetFlags & 33554432 /* IndexedAccess */)) { const constraint = getConstraintOfType(source2) || unknownType; if (result2 = isRelatedTo( constraint, @@ -70785,7 +70939,7 @@ function createTypeChecker(host) { getTypeWithThisArgument(constraint, source2), target2, 1 /* Source */, - reportErrors2 && constraint !== unknownType && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), + reportErrors2 && constraint !== unknownType && !(targetFlags & sourceFlags & 524288 /* TypeParameter */), /*headMessage*/ void 0, intersectionState @@ -70801,7 +70955,7 @@ function createTypeChecker(host) { } } } - } else if (sourceFlags & 4194304 /* Index */) { + } else if (sourceFlags & 2097152 /* Index */) { const isDeferredMappedIndex = shouldDeferIndexType(source2.type, source2.indexFlags) && getObjectFlags(source2.type) & 32 /* Mapped */; if (result2 = isRelatedTo(stringNumberSymbolType, target2, 1 /* Source */, reportErrors2 && !isDeferredMappedIndex)) { return result2; @@ -70814,15 +70968,15 @@ function createTypeChecker(host) { return result2; } } - } else if (sourceFlags & 134217728 /* TemplateLiteral */ && !(targetFlags & 524288 /* Object */)) { - if (!(targetFlags & 134217728 /* TemplateLiteral */)) { + } else if (sourceFlags & 4194304 /* TemplateLiteral */ && !(targetFlags & 1048576 /* Object */)) { + if (!(targetFlags & 4194304 /* TemplateLiteral */)) { const constraint = getBaseConstraintOfType(source2); if (constraint && constraint !== source2 && (result2 = isRelatedTo(constraint, target2, 1 /* Source */, reportErrors2))) { return result2; } } - } else if (sourceFlags & 268435456 /* StringMapping */) { - if (targetFlags & 268435456 /* StringMapping */) { + } else if (sourceFlags & 8388608 /* StringMapping */) { + if (targetFlags & 8388608 /* StringMapping */) { if (source2.symbol !== target2.symbol) { return 0 /* False */; } @@ -70835,11 +70989,11 @@ function createTypeChecker(host) { return result2; } } - } else if (sourceFlags & 16777216 /* Conditional */) { + } else if (sourceFlags & 67108864 /* Conditional */) { if (isDeeplyNestedType(source2, sourceStack, sourceDepth, 10)) { return 3 /* Maybe */; } - if (targetFlags & 16777216 /* Conditional */) { + if (targetFlags & 67108864 /* Conditional */) { const sourceParams = source2.root.inferTypeParameters; let sourceExtends = source2.extendsType; let mapper; @@ -70870,7 +71024,7 @@ function createTypeChecker(host) { return result2; } } - const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0; + const distributiveConstraint = !(targetFlags & 67108864 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0; if (distributiveConstraint) { resetErrorInfo(saveErrorInfo); if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) { @@ -70889,7 +71043,7 @@ function createTypeChecker(host) { } return 0 /* False */; } - const sourceIsPrimitive = !!(sourceFlags & 402784252 /* Primitive */); + const sourceIsPrimitive = !!(sourceFlags & 12713980 /* Primitive */); if (relation !== identityRelation) { source2 = getApparentType(source2); sourceFlags = source2.flags; @@ -70922,7 +71076,7 @@ function createTypeChecker(host) { } else if ((relation === subtypeRelation || relation === strictSubtypeRelation) && isEmptyObjectType(target2) && getObjectFlags(target2) & 8192 /* FreshLiteral */ && !isEmptyObjectType(source2)) { return 0 /* False */; } - if (sourceFlags & (524288 /* Object */ | 2097152 /* Intersection */) && targetFlags & 524288 /* Object */) { + if (sourceFlags & (1048576 /* Object */ | 268435456 /* Intersection */) && targetFlags & 1048576 /* Object */) { const reportStructuralErrors = reportErrors2 && errorInfo === saveErrorInfo.errorInfo && !sourceIsPrimitive; result2 = propertiesRelatedTo( source2, @@ -70949,9 +71103,9 @@ function createTypeChecker(host) { return result2; } } - if (sourceFlags & (524288 /* Object */ | 2097152 /* Intersection */) && targetFlags & 1048576 /* Union */) { - const objectOnlyTarget = extractTypesOfKind(target2, 524288 /* Object */ | 2097152 /* Intersection */ | 33554432 /* Substitution */); - if (objectOnlyTarget.flags & 1048576 /* Union */) { + if (sourceFlags & (1048576 /* Object */ | 268435456 /* Intersection */) && targetFlags & 134217728 /* Union */) { + const objectOnlyTarget = extractTypesOfKind(target2, 1048576 /* Object */ | 268435456 /* Intersection */ | 16777216 /* Substitution */); + if (objectOnlyTarget.flags & 134217728 /* Union */) { const result3 = typeRelatedToDiscriminatedType(source2, objectOnlyTarget); if (result3) { return result3; @@ -71017,7 +71171,7 @@ function createTypeChecker(host) { for (let i = 0; i < sourcePropertiesFiltered.length; i++) { const sourceProperty = sourcePropertiesFiltered[i]; const sourcePropertyType = getNonMissingTypeOfSymbol(sourceProperty); - sourceDiscriminantTypes[i] = sourcePropertyType.flags & 1048576 /* Union */ ? sourcePropertyType.types : [sourcePropertyType]; + sourceDiscriminantTypes[i] = sourcePropertyType.flags & 134217728 /* Union */ ? sourcePropertyType.types : [sourcePropertyType]; excludedProperties.add(sourceProperty.escapedName); } const discriminantCombinations = cartesianProduct(sourceDiscriminantTypes); @@ -71363,13 +71517,10 @@ function createTypeChecker(host) { if (isObjectLiteralType2(target2)) { for (const sourceProp of excludeProperties(getPropertiesOfType(source2), excludedProperties)) { if (!getPropertyOfObjectType(target2, sourceProp.escapedName)) { - const sourceType = getTypeOfSymbol(sourceProp); - if (!(sourceType.flags & 32768 /* Undefined */)) { - if (reportErrors2) { - reportError(Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target2)); - } - return 0 /* False */; + if (reportErrors2) { + reportError(Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target2)); } + return 0 /* False */; } } } @@ -71391,7 +71542,7 @@ function createTypeChecker(host) { return result2; } function propertiesIdenticalTo(source2, target2, excludedProperties) { - if (!(source2.flags & 524288 /* Object */ && target2.flags & 524288 /* Object */)) { + if (!(source2.flags & 1048576 /* Object */ && target2.flags & 1048576 /* Object */)) { return 0 /* False */; } const sourceProperties = excludeProperties(getPropertiesOfObjectType(source2), excludedProperties); @@ -71418,9 +71569,12 @@ function createTypeChecker(host) { if (relation === identityRelation) { return signaturesIdenticalTo(source2, target2, kind); } - if (target2 === anyFunctionType || source2 === anyFunctionType) { + if (source2 === anyFunctionType) { return -1 /* True */; } + if (target2 === anyFunctionType) { + return 0 /* False */; + } const sourceIsJSConstructor = source2.symbol && isJSConstructor(source2.symbol.valueDeclaration); const targetIsJSConstructor = target2.symbol && isJSConstructor(target2.symbol.valueDeclaration); const sourceSignatures = getSignaturesOfType( @@ -71587,14 +71741,14 @@ function createTypeChecker(host) { function membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState) { let result2 = -1 /* True */; const keyType = targetInfo.keyType; - const props = source2.flags & 2097152 /* Intersection */ ? getPropertiesOfUnionOrIntersectionType(source2) : getPropertiesOfObjectType(source2); + const props = source2.flags & 268435456 /* Intersection */ ? getPropertiesOfUnionOrIntersectionType(source2) : getPropertiesOfObjectType(source2); for (const prop of props) { if (isIgnoredJsxProperty(source2, prop)) { continue; } - if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */), keyType)) { + if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 19456 /* StringOrNumberLiteralOrUnique */), keyType)) { const propType = getNonMissingTypeOfSymbol(prop); - const type = exactOptionalPropertyTypes || propType.flags & 32768 /* Undefined */ || keyType === numberType || !(prop.flags & 16777216 /* Optional */) ? propType : getTypeWithFacts(propType, 524288 /* NEUndefined */); + const type = exactOptionalPropertyTypes || propType.flags & 4 /* Undefined */ || keyType === numberType || !(prop.flags & 16777216 /* Optional */) ? propType : getTypeWithFacts(propType, 524288 /* NEUndefined */); const related = isRelatedTo( type, targetInfo.type, @@ -71708,26 +71862,26 @@ function createTypeChecker(host) { } } function typeCouldHaveTopLevelSingletonTypes(type) { - if (type.flags & 16 /* Boolean */) { + if (type.flags & 256 /* Boolean */) { return false; } - if (type.flags & 3145728 /* UnionOrIntersection */) { + if (type.flags & 402653184 /* UnionOrIntersection */) { return !!forEach(type.types, typeCouldHaveTopLevelSingletonTypes); } - if (type.flags & 465829888 /* Instantiable */) { + if (type.flags & 132644864 /* Instantiable */) { const constraint = getConstraintOfType(type); if (constraint && constraint !== type) { return typeCouldHaveTopLevelSingletonTypes(constraint); } } - return isUnitType(type) || !!(type.flags & 134217728 /* TemplateLiteral */) || !!(type.flags & 268435456 /* StringMapping */); + return isUnitType(type) || !!(type.flags & 4194304 /* TemplateLiteral */) || !!(type.flags & 8388608 /* StringMapping */); } function getExactOptionalUnassignableProperties(source, target) { if (isTupleType(source) && isTupleType(target)) return emptyArray; return getPropertiesOfType(target).filter((targetProp) => isExactOptionalPropertyMismatch(getTypeOfPropertyOfType(source, targetProp.escapedName), getTypeOfSymbol(targetProp))); } function isExactOptionalPropertyMismatch(source, target) { - return !!source && !!target && maybeTypeOfKind(source, 32768 /* Undefined */) && !!containsMissingType(target); + return !!source && !!target && maybeTypeOfKind(source, 4 /* Undefined */) && !!containsMissingType(target); } function getExactOptionalProperties(type) { return getPropertiesOfType(type).filter((targetProp) => containsMissingType(getTypeOfSymbol(targetProp))); @@ -71737,7 +71891,7 @@ function createTypeChecker(host) { } function discriminateTypeByDiscriminableItems(target, discriminators, related) { const types = target.types; - const include = types.map((t) => t.flags & 402784252 /* Primitive */ ? 0 /* False */ : -1 /* True */); + const include = types.map((t) => t.flags & 12713980 /* Primitive */ || getReducedType(t).flags & 262144 /* Never */ ? 0 /* False */ : -1 /* True */); for (const [getDiscriminatingType, propertyName] of discriminators) { let matched = false; for (let i = 0; i < types.length; i++) { @@ -71759,17 +71913,17 @@ function createTypeChecker(host) { } } const filtered = contains(include, 0 /* False */) ? getUnionType(types.filter((_, i) => include[i]), 0 /* None */) : target; - return filtered.flags & 131072 /* Never */ ? target : filtered; + return filtered.flags & 262144 /* Never */ ? target : filtered; } function isWeakType(type) { - if (type.flags & 524288 /* Object */) { + if (type.flags & 1048576 /* Object */) { 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 /* Optional */)); } - if (type.flags & 33554432 /* Substitution */) { + if (type.flags & 16777216 /* Substitution */) { return isWeakType(type.baseType); } - if (type.flags & 2097152 /* Intersection */) { + if (type.flags & 268435456 /* Intersection */) { return every(type.types, isWeakType); } return false; @@ -71855,20 +72009,20 @@ function createTypeChecker(host) { } function hasCovariantVoidArgument(typeArguments, variances) { for (let i = 0; i < variances.length; i++) { - if ((variances[i] & 7 /* VarianceMask */) === 1 /* Covariant */ && typeArguments[i].flags & 16384 /* Void */) { + if ((variances[i] & 7 /* VarianceMask */) === 1 /* Covariant */ && typeArguments[i].flags & 16 /* Void */) { return true; } } return false; } function isUnconstrainedTypeParameter(type) { - return type.flags & 262144 /* TypeParameter */ && !getConstraintOfTypeParameter(type); + return type.flags & 524288 /* TypeParameter */ && !getConstraintOfTypeParameter(type); } function isNonDeferredTypeReference(type) { return !!(getObjectFlags(type) & 4 /* Reference */) && !type.node; } function isTypeReferenceWithGenericArguments(type) { - return isNonDeferredTypeReference(type) && some(getTypeArguments(type), (t) => !!(t.flags & 262144 /* TypeParameter */) || isTypeReferenceWithGenericArguments(t)); + return isNonDeferredTypeReference(type) && some(getTypeArguments(type), (t) => !!(t.flags & 524288 /* TypeParameter */) || isTypeReferenceWithGenericArguments(t)); } function getGenericTypeReferenceRelationKey(source, target, postFix, ignoreConstraints) { const typeParameters = []; @@ -71879,7 +72033,7 @@ function createTypeChecker(host) { function getTypeReferenceId(type, depth = 0) { let result = "" + type.target.id; for (const t of getTypeArguments(type)) { - if (t.flags & 262144 /* TypeParameter */) { + if (t.flags & 524288 /* TypeParameter */) { if (ignoreConstraints || isUnconstrainedTypeParameter(t)) { let index = typeParameters.indexOf(t); if (index < 0) { @@ -71946,7 +72100,7 @@ function createTypeChecker(host) { if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) { type = getMappedTargetWithSymbol(type); } - if (type.flags & 2097152 /* Intersection */) { + if (type.flags & 268435456 /* Intersection */) { return some(type.types, (t) => isDeeplyNestedType(t, stack, depth, maxDepth)); } const identity2 = getRecursionIdentity(type); @@ -71969,7 +72123,7 @@ function createTypeChecker(host) { } function getMappedTargetWithSymbol(type) { let target; - while ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && (target = getModifiersTypeFromMappedType(type)) && (target.symbol || target.flags & 2097152 /* Intersection */ && some(target.types, (t) => !!t.symbol))) { + while ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */ && (target = getModifiersTypeFromMappedType(type)) && (target.symbol || target.flags & 268435456 /* Intersection */ && some(target.types, (t) => !!t.symbol))) { type = target; } return type; @@ -71978,13 +72132,13 @@ function createTypeChecker(host) { if ((getObjectFlags(type) & 96 /* InstantiatedMapped */) === 96 /* InstantiatedMapped */) { type = getMappedTargetWithSymbol(type); } - if (type.flags & 2097152 /* Intersection */) { + if (type.flags & 268435456 /* Intersection */) { return some(type.types, (t) => hasMatchingRecursionIdentity(t, identity2)); } return getRecursionIdentity(type) === identity2; } function getRecursionIdentity(type) { - if (type.flags & 524288 /* Object */ && !isObjectOrArrayLiteralType(type)) { + if (type.flags & 1048576 /* Object */ && !isObjectOrArrayLiteralType(type)) { if (getObjectFlags(type) & 4 /* Reference */ && type.node) { return type.node; } @@ -71995,16 +72149,16 @@ function createTypeChecker(host) { return type.target; } } - if (type.flags & 262144 /* TypeParameter */) { + if (type.flags & 524288 /* TypeParameter */) { return type.symbol; } - if (type.flags & 8388608 /* IndexedAccess */) { + if (type.flags & 33554432 /* IndexedAccess */) { do { type = type.objectType; - } while (type.flags & 8388608 /* IndexedAccess */); + } while (type.flags & 33554432 /* IndexedAccess */); return type; } - if (type.flags & 16777216 /* Conditional */) { + if (type.flags & 67108864 /* Conditional */) { return type.root; } return type; @@ -72012,7 +72166,7 @@ function createTypeChecker(host) { function isPropertyIdenticalTo(sourceProp, targetProp) { return compareProperties2(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */; } - function compareProperties2(sourceProp, targetProp, compareTypes) { + function compareProperties2(sourceProp, targetProp, compareTypes2) { if (sourceProp === targetProp) { return -1 /* True */; } @@ -72033,7 +72187,7 @@ function createTypeChecker(host) { if (isReadonlySymbol(sourceProp) !== isReadonlySymbol(targetProp)) { return 0 /* False */; } - return compareTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); + return compareTypes2(getNonMissingTypeOfSymbol(sourceProp), getNonMissingTypeOfSymbol(targetProp)); } function isMatchingSignature(source, target, partialMatch) { const sourceParameterCount = getParameterCount(source); @@ -72050,7 +72204,7 @@ function createTypeChecker(host) { } return false; } - function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes) { + function compareSignaturesIdentical(source, target, partialMatch, ignoreThisTypes, ignoreReturnTypes, compareTypes2) { if (source === target) { return -1 /* True */; } @@ -72065,7 +72219,7 @@ function createTypeChecker(host) { 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 /* False */; } } @@ -72082,7 +72236,7 @@ function createTypeChecker(host) { if (sourceThisType) { const targetThisType = getThisTypeOfSignature(target); if (targetThisType) { - const related = compareTypes(sourceThisType, targetThisType); + const related = compareTypes2(sourceThisType, targetThisType); if (!related) { return 0 /* False */; } @@ -72094,7 +72248,7 @@ function createTypeChecker(host) { 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 /* False */; } @@ -72103,17 +72257,17 @@ function createTypeChecker(host) { 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 /* False */ : source.type === target.type ? -1 /* True */ : source.type && target.type ? compareTypes(source.type, target.type) : 0 /* False */; + function compareTypePredicatesIdentical(source, target, compareTypes2) { + return !(source && target && typePredicateKindsMatch(source, target)) ? 0 /* False */ : source.type === target.type ? -1 /* True */ : source.type && target.type ? compareTypes2(source.type, target.type) : 0 /* False */; } function literalTypesWithSameBaseType(types) { let commonBaseType; for (const t of types) { - if (!(t.flags & 131072 /* Never */)) { + if (!(t.flags & 262144 /* Never */)) { const baseType = getBaseTypeOfLiteralType(t); commonBaseType ?? (commonBaseType = baseType); if (baseType === t || baseType !== commonBaseType) { @@ -72124,15 +72278,15 @@ function createTypeChecker(host) { return true; } function getCombinedTypeFlags(types) { - return reduceLeft(types, (flags, t) => flags | (t.flags & 1048576 /* Union */ ? getCombinedTypeFlags(t.types) : t.flags), 0); + return reduceLeft(types, (flags, t) => flags | (t.flags & 134217728 /* Union */ ? 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 /* Nullable */))) : types; + const primaryTypes = strictNullChecks ? sameMap(types, (t) => filterType(t, (u) => !(u.flags & 12 /* Nullable */))) : types; const superTypeOrUnion = literalTypesWithSameBaseType(primaryTypes) ? getUnionType(primaryTypes) : getSingleCommonSupertype(primaryTypes); - return primaryTypes === types ? superTypeOrUnion : getNullableType(superTypeOrUnion, getCombinedTypeFlags(types) & 98304 /* Nullable */); + return primaryTypes === types ? superTypeOrUnion : getNullableType(superTypeOrUnion, getCombinedTypeFlags(types) & 12 /* Nullable */); } function getSingleCommonSupertype(types) { const candidate = reduceLeft(types, (s, t) => isTypeStrictSubtypeOf(s, t) ? t : s); @@ -72157,10 +72311,10 @@ function createTypeChecker(host) { return isArrayType(type) ? getTypeArguments(type)[0] : void 0; } function isArrayLikeType(type) { - return isArrayType(type) || !(type.flags & 98304 /* Nullable */) && isTypeAssignableTo(type, anyReadonlyArrayType); + return isArrayType(type) || !(type.flags & 12 /* Nullable */) && isTypeAssignableTo(type, anyReadonlyArrayType); } function isMutableArrayLikeType(type) { - return isMutableArrayOrTuple(type) || !(type.flags & (1 /* Any */ | 98304 /* Nullable */)) && isTypeAssignableTo(type, anyArrayType); + return isMutableArrayOrTuple(type) || !(type.flags & (1 /* Any */ | 12 /* Nullable */)) && isTypeAssignableTo(type, anyArrayType); } function getSingleBaseForNonAugmentingSubtype(type) { if (!(getObjectFlags(type) & 4 /* Reference */) || !(getObjectFlags(type.target) & 3 /* ClassOrInterface */)) { @@ -72200,7 +72354,7 @@ function createTypeChecker(host) { } function isTupleLikeType(type) { let lengthType; - return isTupleType(type) || !!getPropertyOfType(type, "0") || isArrayLikeType(type) && !!(lengthType = getTypeOfPropertyOfType(type, "length")) && everyType(lengthType, (t) => !!(t.flags & 256 /* NumberLiteral */)); + return isTupleType(type) || !!getPropertyOfType(type, "0") || isArrayLikeType(type) && !!(lengthType = getTypeOfPropertyOfType(type, "length")) && everyType(lengthType, (t) => !!(t.flags & 2048 /* NumberLiteral */)); } function isArrayOrTupleLikeType(type) { return isArrayLikeType(type) || isTupleLikeType(type); @@ -72216,36 +72370,36 @@ function createTypeChecker(host) { return void 0; } function isNeitherUnitTypeNorNever(type) { - return !(type.flags & (109472 /* Unit */ | 131072 /* Never */)); + return !(type.flags & (97292 /* Unit */ | 262144 /* Never */)); } function isUnitType(type) { - return !!(type.flags & 109472 /* Unit */); + return !!(type.flags & 97292 /* Unit */); } function isUnitLikeType(type) { const t = getBaseConstraintOrType(type); - return t.flags & 2097152 /* Intersection */ ? some(t.types, isUnitType) : isUnitType(t); + return t.flags & 268435456 /* Intersection */ ? some(t.types, isUnitType) : isUnitType(t); } function extractUnitType(type) { - return type.flags & 2097152 /* Intersection */ ? find(type.types, isUnitType) || type : type; + return type.flags & 268435456 /* Intersection */ ? find(type.types, isUnitType) || type : type; } function isLiteralType(type) { - return type.flags & 16 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 1024 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type); + return type.flags & 256 /* Boolean */ ? true : type.flags & 134217728 /* Union */ ? type.flags & 32768 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type); } function getBaseTypeOfLiteralType(type) { - return type.flags & 1056 /* EnumLike */ ? getBaseTypeOfEnumLikeType(type) : type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) : type; + return type.flags & 98304 /* EnumLike */ ? getBaseTypeOfEnumLikeType(type) : type.flags & (1024 /* StringLiteral */ | 4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */) ? stringType : type.flags & 2048 /* NumberLiteral */ ? numberType : type.flags & 4096 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* BooleanLiteral */ ? booleanType : type.flags & 134217728 /* Union */ ? 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 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type; + return type.flags & (1024 /* StringLiteral */ | 4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */) ? stringType : type.flags & (2048 /* NumberLiteral */ | 65536 /* Enum */) ? numberType : type.flags & 4096 /* BigIntLiteral */ ? bigintType : type.flags & 8192 /* BooleanLiteral */ ? booleanType : type.flags & 134217728 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type; } function getWidenedLiteralType(type) { - return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type; + return type.flags & 98304 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 1024 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 2048 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 4096 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 8192 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 134217728 /* Union */ ? mapType(type, getWidenedLiteralType) : type; } function getWidenedUniqueESSymbolType(type) { - return type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type; + return type.flags & 16384 /* UniqueESSymbol */ ? esSymbolType : type.flags & 134217728 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type; } function getWidenedLiteralLikeTypeForContextualType(type, contextualType) { if (!isLiteralOfContextualType(type, contextualType)) { @@ -72322,16 +72476,16 @@ function createTypeChecker(host) { return mapType(type, getDefinitelyFalsyPartOfType); } function getDefinitelyFalsyPartOfType(type) { - return type.flags & 4 /* String */ ? emptyStringType : type.flags & 8 /* Number */ ? zeroType : type.flags & 64 /* BigInt */ ? zeroBigIntType : type === regularFalseType || type === falseType || type.flags & (16384 /* Void */ | 32768 /* Undefined */ | 65536 /* Null */ | 3 /* AnyOrUnknown */) || type.flags & 128 /* StringLiteral */ && type.value === "" || type.flags & 256 /* NumberLiteral */ && type.value === 0 || type.flags & 2048 /* BigIntLiteral */ && isZeroBigInt(type) ? type : neverType; + return type.flags & 32 /* String */ ? emptyStringType : type.flags & 64 /* Number */ ? zeroType : type.flags & 128 /* BigInt */ ? zeroBigIntType : type === regularFalseType || type === falseType || type.flags & (16 /* Void */ | 4 /* Undefined */ | 8 /* Null */ | 3 /* AnyOrUnknown */) || type.flags & 1024 /* StringLiteral */ && type.value === "" || type.flags & 2048 /* NumberLiteral */ && type.value === 0 || type.flags & 4096 /* BigIntLiteral */ && isZeroBigInt(type) ? type : neverType; } function getNullableType(type, flags) { - const missing = flags & ~type.flags & (32768 /* Undefined */ | 65536 /* Null */); - return missing === 0 ? type : missing === 32768 /* Undefined */ ? getUnionType([type, undefinedType]) : missing === 65536 /* Null */ ? getUnionType([type, nullType]) : getUnionType([type, undefinedType, nullType]); + const missing = flags & ~type.flags & (4 /* Undefined */ | 8 /* Null */); + return missing === 0 ? type : missing === 4 /* Undefined */ ? getUnionType([type, undefinedType]) : missing === 8 /* Null */ ? 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 /* Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); + return type === missingOrUndefined || type.flags & 134217728 /* Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); } function getGlobalNonNullableTypeInstantiation(type) { if (!deferredGlobalNonNullableTypeAlias) { @@ -72363,17 +72517,17 @@ function createTypeChecker(host) { return exactOptionalPropertyTypes && isOptional ? removeType(type, missingType) : type; } function containsMissingType(type) { - return type === missingType || !!(type.flags & 1048576 /* Union */) && type.types[0] === missingType; + return type === missingType || !!(type.flags & 134217728 /* Union */) && type.types[0] === missingType; } function removeMissingOrUndefinedType(type) { return exactOptionalPropertyTypes ? removeType(type, missingType) : getTypeWithFacts(type, 524288 /* NEUndefined */); } function isCoercibleUnderDoubleEquals(source, target) { - return (source.flags & (8 /* Number */ | 4 /* String */ | 512 /* BooleanLiteral */)) !== 0 && (target.flags & (8 /* Number */ | 4 /* String */ | 16 /* Boolean */)) !== 0; + return (source.flags & (64 /* Number */ | 32 /* String */ | 8192 /* BooleanLiteral */)) !== 0 && (target.flags & (64 /* Number */ | 32 /* String */ | 256 /* Boolean */)) !== 0; } function isObjectTypeWithInferableIndex(type) { const objectFlags = getObjectFlags(type); - return type.flags & 2097152 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source)); + return type.flags & 268435456 /* Intersection */ ? every(type.types, isObjectTypeWithInferableIndex) : !!(type.symbol && (type.symbol.flags & (4096 /* ObjectLiteral */ | 2048 /* TypeLiteral */ | 384 /* Enum */ | 512 /* ValueModule */)) !== 0 && !(type.symbol.flags & 32 /* Class */) && !typeHasCallOrConstructSignatures(type)) || !!(objectFlags & 4194304 /* ObjectRestType */) || !!(objectFlags & 1024 /* ReverseMapped */ && isObjectTypeWithInferableIndex(type.source)); } function createSymbolWithType(source, type) { const symbol = createSymbol(source.flags, source.escapedName, getCheckFlags(source) & 8 /* Readonly */); @@ -72502,11 +72656,11 @@ function createTypeChecker(host) { return type.widened; } let result; - if (type.flags & (1 /* Any */ | 98304 /* Nullable */)) { + if (type.flags & (1 /* Any */ | 12 /* Nullable */)) { result = anyType; } else if (isObjectLiteralType2(type)) { result = getWidenedTypeOfObjectLiteral(type, context); - } else if (type.flags & 1048576 /* Union */) { + } else if (type.flags & 134217728 /* Union */) { const unionContext = context || createWideningContext( /*parent*/ void 0, @@ -72514,9 +72668,9 @@ function createTypeChecker(host) { void 0, type.types ); - const widenedTypes = sameMap(type.types, (t) => t.flags & 98304 /* Nullable */ ? t : getWidenedTypeWithContext(t, unionContext)); + const widenedTypes = sameMap(type.types, (t) => t.flags & 12 /* Nullable */ ? t : getWidenedTypeWithContext(t, unionContext)); result = getUnionType(widenedTypes, some(widenedTypes, isEmptyObjectType) ? 2 /* Subtype */ : 1 /* Literal */); - } else if (type.flags & 2097152 /* Intersection */) { + } else if (type.flags & 268435456 /* Intersection */) { result = getIntersectionType(sameMap(type.types, getWidenedType)); } else if (isArrayOrTupleType(type)) { result = createTypeReference(type.target, sameMap(getTypeArguments(type), getWidenedType)); @@ -72532,7 +72686,7 @@ function createTypeChecker(host) { var _a; let errorReported = false; if (getObjectFlags(type) & 65536 /* ContainsWideningType */) { - if (type.flags & 1048576 /* Union */) { + if (type.flags & 134217728 /* Union */) { if (some(type.types, isEmptyObjectType)) { errorReported = true; } else { @@ -72714,18 +72868,18 @@ function createTypeChecker(host) { 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, // initialize to a noop mapper so the context object is available, but the underlying object shape is right upon construction nonFixingMapper: reportUnmeasurableMapper @@ -72812,8 +72966,8 @@ function createTypeChecker(host) { if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) { return !!(objectFlags & 1048576 /* CouldContainTypeVariables */); } - const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables)); - if (type.flags & 3899393 /* ObjectFlagsType */) { + const result = !!(type.flags & 132644864 /* Instantiable */ || type.flags & 1048576 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 402653184 /* UnionOrIntersection */ && !(type.flags & 32768 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables)); + if (type.flags & 403963917 /* ObjectFlagsType */) { type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0); } return result; @@ -72826,7 +72980,7 @@ function createTypeChecker(host) { return false; } function isTypeParameterAtTopLevel(type, tp, depth = 0) { - return !!(type === tp || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isTypeParameterAtTopLevel(t, tp, depth)) || depth < 3 && type.flags & 16777216 /* Conditional */ && (isTypeParameterAtTopLevel(getTrueTypeFromConditionalType(type), tp, depth + 1) || isTypeParameterAtTopLevel(getFalseTypeFromConditionalType(type), tp, depth + 1))); + return !!(type === tp || type.flags & 402653184 /* UnionOrIntersection */ && some(type.types, (t) => isTypeParameterAtTopLevel(t, tp, depth)) || depth < 3 && type.flags & 67108864 /* Conditional */ && (isTypeParameterAtTopLevel(getTrueTypeFromConditionalType(type), tp, depth + 1) || isTypeParameterAtTopLevel(getFalseTypeFromConditionalType(type), tp, depth + 1))); } function isTypeParameterAtTopLevelInReturnType(signature, typeParameter) { const typePredicate = getTypePredicateOfSignature(signature); @@ -72835,7 +72989,7 @@ function createTypeChecker(host) { function createEmptyObjectTypeFromStringLiteral(type) { const members = createSymbolTable(); forEachType(type, (t) => { - if (!(t.flags & 128 /* StringLiteral */)) { + if (!(t.flags & 1024 /* StringLiteral */)) { return; } const name = escapeLeadingUnderscores(t.value); @@ -72847,7 +73001,7 @@ function createTypeChecker(host) { } members.set(name, literalProp); }); - const indexInfos = type.flags & 4 /* String */ ? [createIndexInfo( + const indexInfos = type.flags & 32 /* String */ ? [createIndexInfo( stringType, emptyObjectType, /*isReadonly*/ @@ -72915,7 +73069,7 @@ function createTypeChecker(host) { 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; @@ -72949,7 +73103,7 @@ function createTypeChecker(host) { yield targetProp; } else if (matchDiscriminantProperties) { const targetType = getTypeOfSymbol(targetProp); - if (targetType.flags & 109472 /* Unit */) { + if (targetType.flags & 97292 /* Unit */) { const sourceType = getTypeOfSymbol(sourceProp); if (!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) { yield targetProp; @@ -73012,12 +73166,12 @@ function createTypeChecker(host) { if (target.flags & 1 /* Any */) { return true; } - if (target.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) { + if (target.flags & (32 /* String */ | 4194304 /* TemplateLiteral */)) { return isTypeAssignableTo(source, target); } - if (target.flags & 268435456 /* StringMapping */) { + if (target.flags & 8388608 /* StringMapping */) { const mappingStack = []; - while (target.flags & 268435456 /* StringMapping */) { + while (target.flags & 8388608 /* StringMapping */) { mappingStack.unshift(target.symbol); target = target.type; } @@ -73027,32 +73181,32 @@ function createTypeChecker(host) { return false; } function isValidTypeForTemplateLiteralPlaceholder(source, target) { - if (target.flags & 2097152 /* Intersection */) { + if (target.flags & 268435456 /* Intersection */) { return every(target.types, (t) => t === emptyTypeLiteralType || isValidTypeForTemplateLiteralPlaceholder(source, t)); } - if (target.flags & 4 /* String */ || isTypeAssignableTo(source, target)) { + if (target.flags & 32 /* String */ || isTypeAssignableTo(source, target)) { return true; } - if (source.flags & 128 /* StringLiteral */) { + if (source.flags & 1024 /* StringLiteral */) { const value = source.value; - return !!(target.flags & 8 /* Number */ && isValidNumberString( + return !!(target.flags & 64 /* Number */ && isValidNumberString( value, /*roundTripOnly*/ false - ) || target.flags & 64 /* BigInt */ && isValidBigIntString( + ) || target.flags & 128 /* BigInt */ && isValidBigIntString( value, /*roundTripOnly*/ false - ) || target.flags & (512 /* BooleanLiteral */ | 98304 /* Nullable */) && value === target.intrinsicName || target.flags & 268435456 /* StringMapping */ && isMemberOfStringMapping(source, target) || target.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target)); + ) || target.flags & (8192 /* BooleanLiteral */ | 12 /* Nullable */) && value === target.intrinsicName || target.flags & 8388608 /* StringMapping */ && isMemberOfStringMapping(source, target) || target.flags & 4194304 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source, target)); } - if (source.flags & 134217728 /* TemplateLiteral */) { + if (source.flags & 4194304 /* TemplateLiteral */) { 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 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arrayIsEqualTo(source.texts, target.texts) ? map(source.types, (s, i) => { + return source.flags & 1024 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 4194304 /* TemplateLiteral */ ? 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) : void 0; } @@ -73061,7 +73215,7 @@ function createTypeChecker(host) { return !!inferences && every(inferences, (r, i) => isValidTypeForTemplateLiteralPlaceholder(r, target.types[i])); } function getStringLikeTypeForType(type) { - return type.flags & (1 /* Any */ | 402653316 /* StringLike */) ? type : getTemplateLiteralType(["", ""], [type]); + return type.flags & (1 /* Any */ | 12583968 /* StringLike */) ? type : getTemplateLiteralType(["", ""], [type]); } function inferFromLiteralPartsToTemplateLiteral(sourceTexts, sourceTypes, target) { const lastSourceIndex = sourceTexts.length - 1; @@ -73143,14 +73297,14 @@ function createTypeChecker(host) { } return; } - if (source === target && source.flags & 3145728 /* UnionOrIntersection */) { + if (source === target && source.flags & 402653184 /* UnionOrIntersection */) { for (const t of source.types) { inferFromTypes(t, t); } return; } - if (target.flags & 1048576 /* Union */) { - const [tempSources, tempTargets] = inferFromMatchingTypes(source.flags & 1048576 /* Union */ ? source.types : [source], target.types, isTypeOrBaseIdenticalTo); + if (target.flags & 134217728 /* Union */) { + const [tempSources, tempTargets] = inferFromMatchingTypes(source.flags & 134217728 /* Union */ ? source.types : [source], target.types, isTypeOrBaseIdenticalTo); const [sources, targets] = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy); if (targets.length === 0) { return; @@ -73161,9 +73315,9 @@ function createTypeChecker(host) { return; } source = getUnionType(sources); - } else if (target.flags & 2097152 /* Intersection */ && !every(target.types, isNonGenericObjectType)) { - if (!(source.flags & 1048576 /* Union */)) { - const [sources, targets] = inferFromMatchingTypes(source.flags & 2097152 /* Intersection */ ? source.types : [source], target.types, isTypeIdenticalTo); + } else if (target.flags & 268435456 /* Intersection */ && !every(target.types, isNonGenericObjectType)) { + if (!(source.flags & 134217728 /* Union */)) { + const [sources, targets] = inferFromMatchingTypes(source.flags & 268435456 /* Intersection */ ? source.types : [source], target.types, isTypeIdenticalTo); if (sources.length === 0 || targets.length === 0) { return; } @@ -73171,13 +73325,13 @@ function createTypeChecker(host) { target = getIntersectionType(targets); } } - if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) { + if (target.flags & (33554432 /* IndexedAccess */ | 16777216 /* Substitution */)) { if (isNoInferType(target)) { return; } target = getActualTypeVariable(target); } - if (target.flags & 8650752 /* TypeVariable */) { + if (target.flags & 34078720 /* TypeVariable */) { if (isFromInferenceBlockedSource(source)) { return; } @@ -73208,7 +73362,7 @@ function createTypeChecker(host) { clearCachedInferences(inferences); } } - if (!(priority & 128 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) { + if (!(priority & 128 /* ReturnType */) && target.flags & 524288 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) { inference.topLevel = false; clearCachedInferences(inferences); } @@ -73223,13 +73377,13 @@ function createTypeChecker(host) { ); if (simplified !== target) { inferFromTypes(source, simplified); - } else if (target.flags & 8388608 /* IndexedAccess */) { + } else if (target.flags & 33554432 /* IndexedAccess */) { const indexType = getSimplifiedType( target.indexType, /*writing*/ false ); - if (indexType.flags & 465829888 /* Instantiable */) { + if (indexType.flags & 132644864 /* Instantiable */) { const simplified2 = distributeIndexOverObjectType( getSimplifiedType( target.objectType, @@ -73248,45 +73402,45 @@ function createTypeChecker(host) { } if (getObjectFlags(source) & 4 /* Reference */ && getObjectFlags(target) & 4 /* Reference */ && (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 /* Index */ && target.flags & 4194304 /* Index */) { + } else if (source.flags & 2097152 /* Index */ && target.flags & 2097152 /* Index */) { inferFromContravariantTypes(source.type, target.type); - } else if ((isLiteralType(source) || source.flags & 4 /* String */) && target.flags & 4194304 /* Index */) { + } else if ((isLiteralType(source) || source.flags & 32 /* String */) && target.flags & 2097152 /* Index */) { const empty = createEmptyObjectTypeFromStringLiteral(source); inferFromContravariantTypesWithPriority(empty, target.type, 256 /* LiteralKeyof */); - } else if (source.flags & 8388608 /* IndexedAccess */ && target.flags & 8388608 /* IndexedAccess */) { + } else if (source.flags & 33554432 /* IndexedAccess */ && target.flags & 33554432 /* IndexedAccess */) { inferFromTypes(source.objectType, target.objectType); inferFromTypes(source.indexType, target.indexType); - } else if (source.flags & 268435456 /* StringMapping */ && target.flags & 268435456 /* StringMapping */) { + } else if (source.flags & 8388608 /* StringMapping */ && target.flags & 8388608 /* StringMapping */) { if (source.symbol === target.symbol) { inferFromTypes(source.type, target.type); } - } else if (source.flags & 33554432 /* Substitution */) { + } else if (source.flags & 16777216 /* Substitution */) { inferFromTypes(source.baseType, target); inferWithPriority(getSubstitutionIntersection(source), target, 4 /* SubstituteSource */); - } else if (target.flags & 16777216 /* Conditional */) { + } else if (target.flags & 67108864 /* Conditional */) { invokeOnce(source, target, inferToConditionalType); - } else if (target.flags & 3145728 /* UnionOrIntersection */) { + } else if (target.flags & 402653184 /* UnionOrIntersection */) { inferToMultipleTypes(source, target.types, target.flags); - } else if (source.flags & 1048576 /* Union */) { + } else if (source.flags & 134217728 /* Union */) { const sourceTypes = source.types; for (const sourceType of sourceTypes) { inferFromTypes(sourceType, target); } - } else if (target.flags & 134217728 /* TemplateLiteral */) { + } else if (target.flags & 4194304 /* TemplateLiteral */) { inferToTemplateLiteralType(source, target); } else { source = getReducedType(source); if (isGenericMappedType(source) && isGenericMappedType(target)) { invokeOnce(source, target, inferFromGenericMappedTypes); } - if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */))) { + if (!(priority & 512 /* NoConstraints */ && source.flags & (268435456 /* Intersection */ | 132644864 /* Instantiable */))) { const apparentSource = getApparentType(source); - if (apparentSource !== source && !(apparentSource.flags & (524288 /* Object */ | 2097152 /* Intersection */))) { + if (apparentSource !== source && !(apparentSource.flags & (1048576 /* Object */ | 268435456 /* Intersection */))) { return inferFromTypes(apparentSource, target); } source = apparentSource; } - if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */)) { + if (source.flags & (1048576 /* Object */ | 268435456 /* Intersection */)) { invokeOnce(source, target, inferFromObjectTypes); } } @@ -73375,7 +73529,7 @@ function createTypeChecker(host) { } } function getInferenceInfoForType(type) { - if (type.flags & 8650752 /* TypeVariable */) { + if (type.flags & 34078720 /* TypeVariable */) { for (const inference of inferences) { if (type === inference.typeParameter) { return inference; @@ -73387,7 +73541,7 @@ function createTypeChecker(host) { function getSingleTypeVariableFromIntersectionTypes(types) { let typeVariable; for (const type of types) { - const t = type.flags & 2097152 /* Intersection */ && find(type.types, (t2) => !!getInferenceInfoForType(t2)); + const t = type.flags & 268435456 /* Intersection */ && find(type.types, (t2) => !!getInferenceInfoForType(t2)); if (!t || typeVariable && t !== typeVariable) { return void 0; } @@ -73397,9 +73551,9 @@ function createTypeChecker(host) { } function inferToMultipleTypes(source, targets, targetFlags) { let typeVariableCount = 0; - if (targetFlags & 1048576 /* Union */) { + if (targetFlags & 134217728 /* Union */) { let nakedTypeVariable; - const sources = source.flags & 1048576 /* Union */ ? source.types : [source]; + const sources = source.flags & 134217728 /* Union */ ? source.types : [source]; const matched = new Array(sources.length); let inferenceCircularity = false; for (const t of targets) { @@ -73440,7 +73594,7 @@ function createTypeChecker(host) { } } } - if (targetFlags & 2097152 /* Intersection */ ? typeVariableCount === 1 : typeVariableCount > 0) { + if (targetFlags & 268435456 /* Intersection */ ? typeVariableCount === 1 : typeVariableCount > 0) { for (const t of targets) { if (getInferenceInfoForType(t)) { inferWithPriority(source, t, 1 /* NakedTypeVariable */); @@ -73449,14 +73603,14 @@ function createTypeChecker(host) { } } function inferToMappedType(source, target, constraintType) { - if (constraintType.flags & 1048576 /* Union */ || constraintType.flags & 2097152 /* Intersection */) { + if (constraintType.flags & 134217728 /* Union */ || constraintType.flags & 268435456 /* Intersection */) { let result = false; for (const type of constraintType.types) { result = inferToMappedType(source, target, type) || result; } return result; } - if (constraintType.flags & 4194304 /* Index */) { + if (constraintType.flags & 2097152 /* Index */) { const inference = getInferenceInfoForType(constraintType.type); if (inference && !inference.isFixed && !isFromInferenceBlockedSource(source)) { const inferredType = inferTypeForHomomorphicMappedType(source, target, constraintType); @@ -73470,7 +73624,7 @@ function createTypeChecker(host) { } return true; } - if (constraintType.flags & 262144 /* TypeParameter */) { + if (constraintType.flags & 524288 /* TypeParameter */) { inferWithPriority(getIndexType( source, /*indexFlags*/ @@ -73488,7 +73642,7 @@ function createTypeChecker(host) { return false; } function inferToConditionalType(source, target) { - if (source.flags & 16777216 /* Conditional */) { + if (source.flags & 67108864 /* Conditional */) { inferFromTypes(source.checkType, target.checkType); inferFromTypes(source.extendsType, target.extendsType); inferFromTypes(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target)); @@ -73505,30 +73659,30 @@ function createTypeChecker(host) { for (let i = 0; i < types.length; i++) { const source2 = matches ? matches[i] : neverType; const target2 = types[i]; - if (source2.flags & 128 /* StringLiteral */ && target2.flags & 8650752 /* TypeVariable */) { + if (source2.flags & 1024 /* StringLiteral */ && target2.flags & 34078720 /* TypeVariable */) { const inferenceContext = getInferenceInfoForType(target2); const constraint = inferenceContext ? getBaseConstraintOfType(inferenceContext.typeParameter) : void 0; if (constraint && !isTypeAny(constraint)) { - const constraintTypes = constraint.flags & 1048576 /* Union */ ? constraint.types : [constraint]; + const constraintTypes = constraint.flags & 134217728 /* Union */ ? constraint.types : [constraint]; let allTypeFlags = reduceLeft(constraintTypes, (flags, t) => flags | t.flags, 0); - if (!(allTypeFlags & 4 /* String */)) { + if (!(allTypeFlags & 32 /* String */)) { const str = source2.value; - if (allTypeFlags & 296 /* NumberLike */ && !isValidNumberString( + if (allTypeFlags & 67648 /* NumberLike */ && !isValidNumberString( str, /*roundTripOnly*/ true )) { - allTypeFlags &= ~296 /* NumberLike */; + allTypeFlags &= ~67648 /* NumberLike */; } - if (allTypeFlags & 2112 /* BigIntLike */ && !isValidBigIntString( + if (allTypeFlags & 4224 /* BigIntLike */ && !isValidBigIntString( str, /*roundTripOnly*/ true )) { - allTypeFlags &= ~2112 /* BigIntLike */; + allTypeFlags &= ~4224 /* BigIntLike */; } - const matchingType = reduceLeft(constraintTypes, (left, right) => !(right.flags & allTypeFlags) ? left : left.flags & 4 /* String */ ? left : right.flags & 4 /* String */ ? source2 : left.flags & 134217728 /* TemplateLiteral */ ? left : right.flags & 134217728 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source2, right) ? source2 : left.flags & 268435456 /* StringMapping */ ? left : right.flags & 268435456 /* StringMapping */ && str === applyStringMapping(right.symbol, str) ? source2 : left.flags & 128 /* StringLiteral */ ? left : right.flags & 128 /* StringLiteral */ && right.value === str ? right : left.flags & 8 /* Number */ ? left : right.flags & 8 /* Number */ ? getNumberLiteralType(+str) : left.flags & 32 /* Enum */ ? left : right.flags & 32 /* Enum */ ? getNumberLiteralType(+str) : left.flags & 256 /* NumberLiteral */ ? left : right.flags & 256 /* NumberLiteral */ && right.value === +str ? right : left.flags & 64 /* BigInt */ ? left : right.flags & 64 /* BigInt */ ? parseBigIntLiteralType(str) : left.flags & 2048 /* BigIntLiteral */ ? left : right.flags & 2048 /* BigIntLiteral */ && pseudoBigIntToString(right.value) === str ? right : left.flags & 16 /* Boolean */ ? left : right.flags & 16 /* Boolean */ ? str === "true" ? trueType : str === "false" ? falseType : booleanType : left.flags & 512 /* BooleanLiteral */ ? left : right.flags & 512 /* BooleanLiteral */ && right.intrinsicName === str ? right : left.flags & 32768 /* Undefined */ ? left : right.flags & 32768 /* Undefined */ && right.intrinsicName === str ? right : left.flags & 65536 /* Null */ ? left : right.flags & 65536 /* Null */ && right.intrinsicName === str ? right : left, neverType); - if (!(matchingType.flags & 131072 /* Never */)) { + const matchingType = reduceLeft(constraintTypes, (left, right) => !(right.flags & allTypeFlags) ? left : left.flags & 32 /* String */ ? left : right.flags & 32 /* String */ ? source2 : left.flags & 4194304 /* TemplateLiteral */ ? left : right.flags & 4194304 /* TemplateLiteral */ && isTypeMatchedByTemplateLiteralType(source2, right) ? source2 : left.flags & 8388608 /* StringMapping */ ? left : right.flags & 8388608 /* StringMapping */ && str === applyStringMapping(right.symbol, str) ? source2 : left.flags & 1024 /* StringLiteral */ ? left : right.flags & 1024 /* StringLiteral */ && right.value === str ? right : left.flags & 64 /* Number */ ? left : right.flags & 64 /* Number */ ? getNumberLiteralType(+str) : left.flags & 65536 /* Enum */ ? left : right.flags & 65536 /* Enum */ ? getNumberLiteralType(+str) : left.flags & 2048 /* NumberLiteral */ ? left : right.flags & 2048 /* NumberLiteral */ && right.value === +str ? right : left.flags & 128 /* BigInt */ ? left : right.flags & 128 /* BigInt */ ? parseBigIntLiteralType(str) : left.flags & 4096 /* BigIntLiteral */ ? left : right.flags & 4096 /* BigIntLiteral */ && pseudoBigIntToString(right.value) === str ? right : left.flags & 256 /* Boolean */ ? left : right.flags & 256 /* Boolean */ ? str === "true" ? trueType : str === "false" ? falseType : booleanType : left.flags & 8192 /* BooleanLiteral */ ? left : right.flags & 8192 /* BooleanLiteral */ && right.intrinsicName === str ? right : left.flags & 4 /* Undefined */ ? left : right.flags & 4 /* Undefined */ && right.intrinsicName === str ? right : left.flags & 8 /* Null */ ? left : right.flags & 8 /* Null */ && right.intrinsicName === str ? right : left, neverType); + if (!(matchingType.flags & 262144 /* Never */)) { inferFromTypes(matchingType, target2); continue; } @@ -73687,7 +73841,7 @@ function createTypeChecker(host) { for (const targetInfo of indexInfos) { const propTypes = []; for (const prop of getPropertiesOfType(source)) { - if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 8576 /* StringOrNumberLiteralOrUnique */), targetInfo.keyType)) { + if (isApplicableIndexType(getLiteralTypeFromProperty(prop, 19456 /* StringOrNumberLiteralOrUnique */), targetInfo.keyType)) { const propType = getTypeOfSymbol(prop); propTypes.push(prop.flags & 16777216 /* Optional */ ? removeMissingOrUndefinedType(propType) : propType); } @@ -73711,14 +73865,14 @@ function createTypeChecker(host) { } } function isTypeOrBaseIdenticalTo(s, t) { - return t === missingType ? s === t : isTypeIdenticalTo(s, t) || !!(t.flags & 4 /* String */ && s.flags & 128 /* StringLiteral */ || t.flags & 8 /* Number */ && s.flags & 256 /* NumberLiteral */); + return t === missingType ? s === t : isTypeIdenticalTo(s, t) || !!(t.flags & 32 /* String */ && s.flags & 1024 /* StringLiteral */ || t.flags & 64 /* Number */ && s.flags & 2048 /* NumberLiteral */); } function isTypeCloselyMatchedBy(s, t) { - return !!(s.flags & 524288 /* Object */ && t.flags & 524288 /* Object */ && s.symbol && s.symbol === t.symbol || s.aliasSymbol && s.aliasTypeArguments && s.aliasSymbol === t.aliasSymbol); + return !!(s.flags & 1048576 /* Object */ && t.flags & 1048576 /* Object */ && 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 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 402784252 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */); + return !!constraint && maybeTypeOfKind(constraint.flags & 67108864 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 12713980 /* Primitive */ | 2097152 /* Index */ | 4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */); } function isObjectLiteralType2(type) { return !!(getObjectFlags(type) & 128 /* ObjectLiteral */); @@ -73756,7 +73910,7 @@ function createTypeChecker(host) { const inferredCovariantType = inference.candidates ? getCovariantInference(inference, context.signature) : void 0; const inferredContravariantType = inference.contraCandidates ? getContravariantInference(inference) : void 0; if (inferredCovariantType || inferredContravariantType) { - const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & (131072 /* Never */ | 1 /* Any */)) && 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 /* Never */ | 1 /* Any */)) && 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 /* NoDefault */) { @@ -73774,9 +73928,17 @@ function createTypeChecker(host) { 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 /* ReturnType */ ? filterType(inferredType, (t) => !!context.compareTypes(t, constraintWithThis)) : neverType; + inferredType = !(filteredByConstraint.flags & 262144 /* Never */) ? filteredByConstraint : void 0; + } + } + if (!inferredType) { + inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint; } + inference.inferredType = inferredType; } clearActiveMapperCaches(); } @@ -73798,19 +73960,21 @@ function createTypeChecker(host) { 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": @@ -73843,6 +74007,18 @@ function createTypeChecker(host) { } } } + function getCannotResolveModuleNameErrorForSpecificModule(moduleName) { + if (moduleName.kind === 11 /* StringLiteral */) { + 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 void 0; + } function getResolvedSymbol(node) { const links = getNodeLinks(node); if (!links.resolvedSymbol) { @@ -73964,7 +74140,7 @@ function createTypeChecker(host) { return void 0; } function tryGetNameFromType(type) { - return type.flags & 8192 /* UniqueESSymbol */ ? type.escapedName : type.flags & 384 /* StringOrNumberLiteral */ ? escapeLeadingUnderscores("" + type.value) : void 0; + return type.flags & 16384 /* UniqueESSymbol */ ? type.escapedName : type.flags & 3072 /* StringOrNumberLiteral */ ? escapeLeadingUnderscores("" + type.value) : void 0; } function tryGetElementAccessExpressionName(node) { return isStringOrNumericLiteralLike(node.argumentExpression) ? escapeLeadingUnderscores(node.argumentExpression.text) : isEntityNameExpression(node.argumentExpression) ? tryGetNameFromEntityNameExpression(node.argumentExpression) : void 0; @@ -74017,7 +74193,7 @@ function createTypeChecker(host) { return false; } function isDiscriminantProperty(type, name) { - if (type && type.flags & 1048576 /* Union */) { + if (type && type.flags & 134217728 /* Union */) { const prop = getUnionOrIntersectionProperty(type, name); if (prop && getCheckFlags(prop) & 2 /* SyntheticProperty */) { if (prop.links.isDiscriminantProperty === void 0) { @@ -74045,36 +74221,34 @@ function createTypeChecker(host) { const map2 = /* @__PURE__ */ new Map(); let count = 0; for (const type of types) { - if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) { + if (type.flags & (1048576 /* Object */ | 268435456 /* Intersection */ | 117964800 /* InstantiableNonPrimitive */)) { const discriminant = getTypeOfPropertyOfType(type, name); - if (discriminant) { - if (!isLiteralType(discriminant)) { - return void 0; - } - 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 void 0; } + 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 : void 0; } function getKeyPropertyName(unionType) { const types = unionType.types; - if (types.length < 10 || getObjectFlags(unionType) & 32768 /* PrimitiveUnion */ || countWhere(types, (t) => !!(t.flags & (524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */))) < 10) { + if (types.length < 10 || getObjectFlags(unionType) & 32768 /* PrimitiveUnion */ || countWhere(types, (t) => !!(t.flags & (1048576 /* Object */ | 117964800 /* InstantiableNonPrimitive */))) < 10) { return void 0; } if (unionType.keyPropertyName === void 0) { - const keyPropertyName = forEach(types, (t) => t.flags & (524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */) ? forEach(getPropertiesOfType(t), (p) => isUnitType(getTypeOfSymbol(p)) ? p.escapedName : void 0) : void 0); + const keyPropertyName = forEach(types, (t) => t.flags & (1048576 /* Object */ | 117964800 /* InstantiableNonPrimitive */) ? forEach(getPropertiesOfType(t), (p) => isUnitType(getTypeOfSymbol(p)) ? p.escapedName : void 0) : void 0); const mapByKeyProperty = keyPropertyName && mapTypesByKeyProperty(types, keyPropertyName); unionType.keyPropertyName = mapByKeyProperty ? keyPropertyName : ""; unionType.constituentMap = mapByKeyProperty; @@ -74121,7 +74295,7 @@ function createTypeChecker(host) { return flow.id; } function typeMaybeAssignableTo(source, target) { - if (!(source.flags & 1048576 /* Union */)) { + if (!(source.flags & 134217728 /* Union */)) { return isTypeAssignableTo(source, target); } for (const t of source.types) { @@ -74135,7 +74309,7 @@ function createTypeChecker(host) { if (declaredType === assignedType) { return declaredType; } - if (assignedType.flags & 131072 /* Never */) { + if (assignedType.flags & 262144 /* Never */) { return assignedType; } const key = `A${getTypeId(declaredType)},${getTypeId(assignedType)}`; @@ -74143,7 +74317,7 @@ function createTypeChecker(host) { } function getAssignmentReducedTypeWorker(declaredType, assignedType) { const filteredType = filterType(declaredType, (t) => typeMaybeAssignableTo(assignedType, t)); - const reducedType = assignedType.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(assignedType) ? mapType(filteredType, getFreshTypeOfLiteralType) : filteredType; + const reducedType = assignedType.flags & 8192 /* BooleanLiteral */ && isFreshLiteralType(assignedType) ? mapType(filteredType, getFreshTypeOfLiteralType) : filteredType; return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType; } function isFunctionObjectType(type) { @@ -74160,76 +74334,76 @@ function createTypeChecker(host) { return getTypeFacts(type, mask2) !== 0; } function getTypeFactsWorker(type, callerOnlyNeeds) { - if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) { + if (type.flags & (268435456 /* Intersection */ | 132644864 /* Instantiable */)) { type = getBaseConstraintOfType(type) || unknownType; } const flags = type.flags; - if (flags & (4 /* String */ | 268435456 /* StringMapping */)) { + if (flags & (32 /* String */ | 8388608 /* StringMapping */)) { return strictNullChecks ? 16317953 /* StringStrictFacts */ : 16776705 /* StringFacts */; } - if (flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */)) { - const isEmpty = flags & 128 /* StringLiteral */ && type.value === ""; + if (flags & (1024 /* StringLiteral */ | 4194304 /* TemplateLiteral */)) { + const isEmpty = flags & 1024 /* StringLiteral */ && type.value === ""; return strictNullChecks ? isEmpty ? 12123649 /* EmptyStringStrictFacts */ : 7929345 /* NonEmptyStringStrictFacts */ : isEmpty ? 12582401 /* EmptyStringFacts */ : 16776705 /* NonEmptyStringFacts */; } - if (flags & (8 /* Number */ | 32 /* Enum */)) { + if (flags & (64 /* Number */ | 65536 /* Enum */)) { return strictNullChecks ? 16317698 /* NumberStrictFacts */ : 16776450 /* NumberFacts */; } - if (flags & 256 /* NumberLiteral */) { + if (flags & 2048 /* NumberLiteral */) { const isZero = type.value === 0; return strictNullChecks ? isZero ? 12123394 /* ZeroNumberStrictFacts */ : 7929090 /* NonZeroNumberStrictFacts */ : isZero ? 12582146 /* ZeroNumberFacts */ : 16776450 /* NonZeroNumberFacts */; } - if (flags & 64 /* BigInt */) { + if (flags & 128 /* BigInt */) { return strictNullChecks ? 16317188 /* BigIntStrictFacts */ : 16775940 /* BigIntFacts */; } - if (flags & 2048 /* BigIntLiteral */) { + if (flags & 4096 /* BigIntLiteral */) { const isZero = isZeroBigInt(type); return strictNullChecks ? isZero ? 12122884 /* ZeroBigIntStrictFacts */ : 7928580 /* NonZeroBigIntStrictFacts */ : isZero ? 12581636 /* ZeroBigIntFacts */ : 16775940 /* NonZeroBigIntFacts */; } - if (flags & 16 /* Boolean */) { + if (flags & 256 /* Boolean */) { return strictNullChecks ? 16316168 /* BooleanStrictFacts */ : 16774920 /* BooleanFacts */; } - if (flags & 528 /* BooleanLike */) { + if (flags & 8448 /* BooleanLike */) { return strictNullChecks ? type === falseType || type === regularFalseType ? 12121864 /* FalseStrictFacts */ : 7927560 /* TrueStrictFacts */ : type === falseType || type === regularFalseType ? 12580616 /* FalseFacts */ : 16774920 /* TrueFacts */; } - if (flags & 524288 /* Object */) { + if (flags & 1048576 /* Object */) { const possibleFacts = strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ | 7880640 /* FunctionStrictFacts */ | 7888800 /* ObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ | 16728e3 /* FunctionFacts */ | 16736160 /* ObjectFacts */; if ((callerOnlyNeeds & possibleFacts) === 0) { return 0; } return getObjectFlags(type) & 16 /* Anonymous */ && isEmptyObjectType(type) ? strictNullChecks ? 83427327 /* EmptyObjectStrictFacts */ : 83886079 /* EmptyObjectFacts */ : isFunctionObjectType(type) ? strictNullChecks ? 7880640 /* FunctionStrictFacts */ : 16728e3 /* FunctionFacts */ : strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */; } - if (flags & 16384 /* Void */) { + if (flags & 16 /* Void */) { return 9830144 /* VoidFacts */; } - if (flags & 32768 /* Undefined */) { + if (flags & 4 /* Undefined */) { return 26607360 /* UndefinedFacts */; } - if (flags & 65536 /* Null */) { + if (flags & 8 /* Null */) { return 42917664 /* NullFacts */; } - if (flags & 12288 /* ESSymbolLike */) { + if (flags & 16896 /* ESSymbolLike */) { return strictNullChecks ? 7925520 /* SymbolStrictFacts */ : 16772880 /* SymbolFacts */; } - if (flags & 67108864 /* NonPrimitive */) { + if (flags & 131072 /* NonPrimitive */) { return strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */; } - if (flags & 131072 /* Never */) { + if (flags & 262144 /* Never */) { return 0 /* None */; } - if (flags & 1048576 /* Union */) { + if (flags & 134217728 /* Union */) { return reduceLeft(type.types, (facts, t) => facts | getTypeFactsWorker(t, callerOnlyNeeds), 0 /* None */); } - if (flags & 2097152 /* Intersection */) { + if (flags & 268435456 /* Intersection */) { return getIntersectionTypeFacts(type, callerOnlyNeeds); } return 83886079 /* UnknownFacts */; } function getIntersectionTypeFacts(type, callerOnlyNeeds) { - const ignoreObjects = maybeTypeOfKind(type, 402784252 /* Primitive */); + const ignoreObjects = maybeTypeOfKind(type, 12713980 /* Primitive */); let oredFacts = 0 /* None */; let andedFacts = 134217727 /* All */; for (const t of type.types) { - if (!(ignoreObjects && t.flags & 524288 /* Object */)) { + if (!(ignoreObjects && t.flags & 1048576 /* Object */)) { const f = getTypeFactsWorker(t, callerOnlyNeeds); oredFacts |= f; andedFacts &= f; @@ -74416,13 +74590,13 @@ function createTypeChecker(host) { return witnesses; } function eachTypeContainedIn(source, types) { - return source.flags & 1048576 /* Union */ ? !forEach(source.types, (t) => !contains(types, t)) : contains(types, source); + return source.flags & 134217728 /* Union */ ? !forEach(source.types, (t) => !contains(types, t)) : contains(types, source); } function isTypeSubsetOf(source, target) { - return !!(source === target || source.flags & 131072 /* Never */ || target.flags & 1048576 /* Union */ && isTypeSubsetOfUnion(source, target)); + return !!(source === target || source.flags & 262144 /* Never */ || target.flags & 134217728 /* Union */ && isTypeSubsetOfUnion(source, target)); } function isTypeSubsetOfUnion(source, target) { - if (source.flags & 1048576 /* Union */) { + if (source.flags & 134217728 /* Union */) { for (const t of source.types) { if (!containsType(target.types, t)) { return false; @@ -74430,25 +74604,25 @@ function createTypeChecker(host) { } return true; } - if (source.flags & 1056 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) { + if (source.flags & 98304 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) { return true; } return containsType(target.types, source); } function forEachType(type, f) { - return type.flags & 1048576 /* Union */ ? forEach(type.types, f) : f(type); + return type.flags & 134217728 /* Union */ ? forEach(type.types, f) : f(type); } function someType(type, f) { - return type.flags & 1048576 /* Union */ ? some(type.types, f) : f(type); + return type.flags & 134217728 /* Union */ ? some(type.types, f) : f(type); } function everyType(type, f) { - return type.flags & 1048576 /* Union */ ? every(type.types, f) : f(type); + return type.flags & 134217728 /* Union */ ? every(type.types, f) : f(type); } function everyContainedType(type, f) { - return type.flags & 3145728 /* UnionOrIntersection */ ? every(type.types, f) : f(type); + return type.flags & 402653184 /* UnionOrIntersection */ ? every(type.types, f) : f(type); } function filterType(type, f) { - if (type.flags & 1048576 /* Union */) { + if (type.flags & 134217728 /* Union */) { const types = type.types; const filtered = filter(types, f); if (filtered === types) { @@ -74456,14 +74630,14 @@ function createTypeChecker(host) { } const origin = type.origin; let newOrigin; - if (origin && origin.flags & 1048576 /* Union */) { + if (origin && origin.flags & 134217728 /* Union */) { const originTypes = origin.types; - const originFiltered = filter(originTypes, (t) => !!(t.flags & 1048576 /* Union */) || f(t)); + const originFiltered = filter(originTypes, (t) => !!(t.flags & 134217728 /* Union */) || f(t)); if (originTypes.length - originFiltered.length === types.length - filtered.length) { if (originFiltered.length === 1) { return originFiltered[0]; } - newOrigin = createOriginUnionOrIntersectionType(1048576 /* Union */, originFiltered); + newOrigin = createOriginUnionOrIntersectionType(134217728 /* Union */, originFiltered); } } return getUnionTypeFromSortedList( @@ -74476,27 +74650,27 @@ function createTypeChecker(host) { newOrigin ); } - return type.flags & 131072 /* Never */ || f(type) ? type : neverType; + return type.flags & 262144 /* Never */ || f(type) ? type : neverType; } function removeType(type, targetType) { return filterType(type, (t) => t !== targetType); } function countTypes(type) { - return type.flags & 1048576 /* Union */ ? type.types.length : 1; + return type.flags & 134217728 /* Union */ ? type.types.length : 1; } function mapType(type, mapper, noReductions) { - if (type.flags & 131072 /* Never */) { + if (type.flags & 262144 /* Never */) { return type; } - if (!(type.flags & 1048576 /* Union */)) { + if (!(type.flags & 134217728 /* Union */)) { return mapper(type); } const origin = type.origin; - const types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types; + const types = origin && origin.flags & 134217728 /* Union */ ? origin.types : type.types; let mappedTypes; let changed = false; for (const t of types) { - const mapped = t.flags & 1048576 /* Union */ ? mapType(t, mapper, noReductions) : mapper(t); + const mapped = t.flags & 134217728 /* Union */ ? mapType(t, mapper, noReductions) : mapper(t); changed || (changed = t !== mapped); if (mapped) { if (!mappedTypes) { @@ -74509,14 +74683,14 @@ function createTypeChecker(host) { return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : type; } function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) { - return type.flags & 1048576 /* Union */ && aliasSymbol ? getUnionType(map(type.types, mapper), 1 /* Literal */, aliasSymbol, aliasTypeArguments) : mapType(type, mapper); + return type.flags & 134217728 /* Union */ && aliasSymbol ? getUnionType(map(type.types, mapper), 1 /* Literal */, 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 /* String */ | 134217728 /* TemplateLiteral */ | 8 /* Number */ | 64 /* BigInt */) && maybeTypeOfKind(typeWithLiterals, 128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */ | 256 /* NumberLiteral */ | 2048 /* BigIntLiteral */)) { - return mapType(typeWithPrimitives, (t) => t.flags & 4 /* String */ ? extractTypesOfKind(typeWithLiterals, 4 /* String */ | 128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) : isPatternLiteralType(t) && !maybeTypeOfKind(typeWithLiterals, 4 /* String */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? extractTypesOfKind(typeWithLiterals, 128 /* StringLiteral */) : t.flags & 8 /* Number */ ? extractTypesOfKind(typeWithLiterals, 8 /* Number */ | 256 /* NumberLiteral */) : t.flags & 64 /* BigInt */ ? extractTypesOfKind(typeWithLiterals, 64 /* BigInt */ | 2048 /* BigIntLiteral */) : t); + if (maybeTypeOfKind(typeWithPrimitives, 32 /* String */ | 4194304 /* TemplateLiteral */ | 64 /* Number */ | 128 /* BigInt */) && maybeTypeOfKind(typeWithLiterals, 1024 /* StringLiteral */ | 4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */ | 2048 /* NumberLiteral */ | 4096 /* BigIntLiteral */)) { + return mapType(typeWithPrimitives, (t) => t.flags & 32 /* String */ ? extractTypesOfKind(typeWithLiterals, 32 /* String */ | 1024 /* StringLiteral */ | 4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */) : isPatternLiteralType(t) && !maybeTypeOfKind(typeWithLiterals, 32 /* String */ | 4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */) ? extractTypesOfKind(typeWithLiterals, 1024 /* StringLiteral */) : t.flags & 64 /* Number */ ? extractTypesOfKind(typeWithLiterals, 64 /* Number */ | 2048 /* NumberLiteral */) : t.flags & 128 /* BigInt */ ? extractTypesOfKind(typeWithLiterals, 128 /* BigInt */ | 4096 /* BigIntLiteral */) : t); } return typeWithPrimitives; } @@ -74527,7 +74701,7 @@ function createTypeChecker(host) { return flowType.flags === 0 ? flowType.type : flowType; } function createFlowType(type, incomplete) { - return incomplete ? { flags: 0, type: type.flags & 131072 /* Never */ ? silentNeverType : type } : type; + return incomplete ? { flags: 0, type: type.flags & 262144 /* Never */ ? silentNeverType : type } : type; } function createEvolvingArrayType(elementType) { const result = createObjectType(256 /* EvolvingArray */); @@ -74542,8 +74716,8 @@ function createTypeChecker(host) { return isTypeSubsetOf(elementType, evolvingArrayType.elementType) ? evolvingArrayType : getEvolvingArrayType(getUnionType([evolvingArrayType.elementType, elementType])); } function createFinalArrayType(elementType) { - return elementType.flags & 131072 /* Never */ ? autoArrayType : createArrayType( - elementType.flags & 1048576 /* Union */ ? getUnionType(elementType.types, 2 /* Subtype */) : elementType + return elementType.flags & 262144 /* Never */ ? autoArrayType : createArrayType( + elementType.flags & 134217728 /* Union */ ? getUnionType(elementType.types, 2 /* Subtype */) : elementType ); } function getFinalArrayType(evolvingArrayType) { @@ -74558,7 +74732,7 @@ function createTypeChecker(host) { function isEvolvingArrayTypeList(types) { let hasEvolvingArrayType = false; for (const t of types) { - if (!(t.flags & 131072 /* Never */)) { + if (!(t.flags & 262144 /* Never */)) { if (!(getObjectFlags(t) & 256 /* EvolvingArray */)) { return false; } @@ -74571,7 +74745,7 @@ function createTypeChecker(host) { const root = getReferenceRoot(node); const parent2 = root.parent; const isLengthPushOrUnshift = isPropertyAccessExpression(parent2) && (parent2.name.escapedText === "length" || parent2.parent.kind === 214 /* CallExpression */ && isIdentifier(parent2.name) && isPushOrUnshiftIdentifier(parent2.name)); - const isElementAssignment = parent2.kind === 213 /* ElementAccessExpression */ && parent2.expression === root && parent2.parent.kind === 227 /* BinaryExpression */ && parent2.parent.operatorToken.kind === 64 /* EqualsToken */ && parent2.parent.left === parent2 && !isAssignmentTarget(parent2.parent) && isTypeAssignableToKind(getTypeOfExpression(parent2.argumentExpression), 296 /* NumberLike */); + const isElementAssignment = parent2.kind === 213 /* ElementAccessExpression */ && parent2.expression === root && parent2.parent.kind === 227 /* BinaryExpression */ && parent2.parent.operatorToken.kind === 64 /* EqualsToken */ && parent2.parent.left === parent2 && !isAssignmentTarget(parent2.parent) && isTypeAssignableToKind(getTypeOfExpression(parent2.argumentExpression), 67648 /* NumberLike */); return isLengthPushOrUnshift || isElementAssignment; } function isDeclarationWithExplicitTypeAnnotation(node) { @@ -74681,7 +74855,7 @@ function createTypeChecker(host) { return signature === unknownSignature ? void 0 : signature; } function hasTypePredicateOrNeverReturnType(signature) { - return !!(getTypePredicateOfSignature(signature) || signature.declaration && (getReturnTypeFromAnnotation(signature.declaration) || unknownType).flags & 131072 /* Never */); + return !!(getTypePredicateOfSignature(signature) || signature.declaration && (getReturnTypeFromAnnotation(signature.declaration) || unknownType).flags & 262144 /* Never */); } function getTypePredicateArgument(predicate, callExpression) { if (predicate.kind === 1 /* Identifier */ || predicate.kind === 3 /* AssertsIdentifier */) { @@ -74744,7 +74918,7 @@ function createTypeChecker(host) { return false; } } - if (getReturnTypeOfSignature(signature).flags & 131072 /* Never */) { + if (getReturnTypeOfSignature(signature).flags & 262144 /* Never */) { return false; } } @@ -74865,7 +75039,7 @@ function createTypeChecker(host) { const evolvedType = getTypeFromFlowType(getTypeAtFlowNode(flowNode)); sharedFlowCount = sharedFlowStart; const resultType = getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 236 /* NonNullExpression */ && !(resultType.flags & 131072 /* Never */) && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 236 /* NonNullExpression */ && !(resultType.flags & 262144 /* Never */) && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 262144 /* Never */) { return declaredType; } return resultType; @@ -74976,7 +75150,7 @@ function createTypeChecker(host) { return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType; } const t = isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(declaredType) : declaredType; - if (t.flags & 1048576 /* Union */) { + if (t.flags & 134217728 /* Union */) { return getAssignmentReducedType(t, getInitialOrAssignedType(flow)); } return t; @@ -75038,7 +75212,7 @@ function createTypeChecker(host) { ) : predicate.kind === 3 /* AssertsIdentifier */ && 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 /* Never */) { + if (getReturnTypeOfSignature(signature).flags & 262144 /* Never */) { return unreachableNeverType; } } @@ -75059,7 +75233,7 @@ function createTypeChecker(host) { } } else { const indexType = getContextFreeTypeOfExpression(node.left.argumentExpression); - if (isTypeAssignableToKind(indexType, 296 /* NumberLike */)) { + if (isTypeAssignableToKind(indexType, 67648 /* NumberLike */)) { evolvedType2 = addEvolvingArrayElementType(evolvedType2, node.right); } } @@ -75073,7 +75247,7 @@ function createTypeChecker(host) { function getTypeAtFlowCondition(flow) { const flowType = getTypeAtFlowNode(flow.antecedent); const type = getTypeFromFlowType(flowType); - if (type.flags & 131072 /* Never */) { + if (type.flags & 262144 /* Never */) { return flowType; } const assumeTrue = (flow.flags & 32 /* TrueCondition */) !== 0; @@ -75097,9 +75271,9 @@ function createTypeChecker(host) { } else { if (strictNullChecks) { if (optionalChainContainsReference(expr, reference)) { - type = narrowTypeBySwitchOptionalChainContainment(type, flow.node, (t) => !(t.flags & (32768 /* Undefined */ | 131072 /* Never */))); + type = narrowTypeBySwitchOptionalChainContainment(type, flow.node, (t) => !(t.flags & (4 /* Undefined */ | 262144 /* Never */))); } else if (expr.kind === 222 /* TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { - type = narrowTypeBySwitchOptionalChainContainment(type, flow.node, (t) => !(t.flags & 131072 /* Never */ || t.flags & 128 /* StringLiteral */ && t.value === "undefined")); + type = narrowTypeBySwitchOptionalChainContainment(type, flow.node, (t) => !(t.flags & 262144 /* Never */ || t.flags & 1024 /* StringLiteral */ && t.value === "undefined")); } } const access = getDiscriminantPropertyAccess(expr, type); @@ -75135,7 +75309,7 @@ function createTypeChecker(host) { if (bypassFlow) { const flowType = getTypeAtFlowNode(bypassFlow); const type = getTypeFromFlowType(flowType); - if (!(type.flags & 131072 /* Never */) && !contains(antecedentTypes, type) && !isExhaustiveSwitchStatement(bypassFlow.node.switchStatement)) { + if (!(type.flags & 262144 /* Never */) && !contains(antecedentTypes, type) && !isExhaustiveSwitchStatement(bypassFlow.node.switchStatement)) { if (type === declaredType && declaredType === initialType) { return type; } @@ -75217,7 +75391,7 @@ function createTypeChecker(host) { return getEvolvingArrayType(getUnionType(map(types, getElementTypeOfEvolvingArrayType))); } const result = recombineUnknownType(getUnionType(sameMap(types, finalizeEvolvingArrayType), subtypeReduction)); - if (result !== declaredType && result.flags & declaredType.flags & 1048576 /* Union */ && arrayIsEqualTo(result.types, declaredType.types)) { + if (result !== declaredType && result.flags & declaredType.flags & 134217728 /* Union */ && arrayIsEqualTo(result.types, declaredType.types)) { return declaredType; } return result; @@ -75239,26 +75413,30 @@ function createTypeChecker(host) { 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 void 0; + function getCandidateVariableDeclarationInitializer(node) { + return isVariableDeclaration(node) && !node.type && node.initializer ? skipParentheses(node.initializer) : void 0; + } } function getDiscriminantPropertyAccess(expr, computedType) { - if (declaredType.flags & 1048576 /* Union */ || computedType.flags & 1048576 /* Union */) { + if (declaredType.flags & 134217728 /* Union */ || computedType.flags & 134217728 /* Union */) { const access = getCandidateDiscriminantPropertyAccess(expr); if (access) { const name = getAccessedPropertyName(access); if (name) { - const type = declaredType.flags & 1048576 /* Union */ && isTypeSubsetOf(computedType, declaredType) ? declaredType : computedType; + const type = declaredType.flags & 134217728 /* Union */ && isTypeSubsetOf(computedType, declaredType) ? declaredType : computedType; if (isDiscriminantProperty(type, name)) { return access; } @@ -75273,7 +75451,7 @@ function createTypeChecker(host) { return type; } const optionalChain = isOptionalChain(access); - const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(access)) && maybeTypeOfKind(type, 98304 /* Nullable */); + const removeNullable = strictNullChecks && (optionalChain || isNonNullAccess(access)) && maybeTypeOfKind(type, 12 /* Nullable */); let propType = getTypeOfPropertyOfType(removeNullable ? getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type, propName); if (!propType) { return type; @@ -75282,11 +75460,11 @@ function createTypeChecker(host) { const narrowedPropType = narrowType2(propType); return filterType(type, (t) => { const discriminantType = getTypeOfPropertyOrIndexSignatureOfType(t, propName) || unknownType; - return !(discriminantType.flags & 131072 /* Never */) && !(narrowedPropType.flags & 131072 /* Never */) && areTypesComparable(narrowedPropType, discriminantType); + return !(discriminantType.flags & 262144 /* Never */) && !(narrowedPropType.flags & 262144 /* Never */) && areTypesComparable(narrowedPropType, discriminantType); }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { - if ((operator === 37 /* EqualsEqualsEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */) && type.flags & 1048576 /* Union */) { + if ((operator === 37 /* EqualsEqualsEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */) && type.flags & 134217728 /* Union */) { const keyPropertyName = getKeyPropertyName(type); if (keyPropertyName && keyPropertyName === getAccessedPropertyName(access)) { const candidate = getConstituentTypeForKeyType(type, getTypeOfExpression(value)); @@ -75298,7 +75476,7 @@ function createTypeChecker(host) { return narrowTypeByDiscriminant(type, access, (t) => narrowTypeByEquality(t, operator, value, assumeTrue)); } function narrowTypeBySwitchOnDiscriminantProperty(type, access, data) { - if (data.clauseStart < data.clauseEnd && type.flags & 1048576 /* Union */ && getKeyPropertyName(type) === getAccessedPropertyName(access)) { + if (data.clauseStart < data.clauseEnd && type.flags & 134217728 /* Union */ && 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) { @@ -75495,7 +75673,7 @@ function createTypeChecker(host) { } function narrowTypeByOptionalChainContainment(type, operator, value, assumeTrue) { const equalsOperator = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */; - const nullableFlags = operator === 35 /* EqualsEqualsToken */ || operator === 36 /* ExclamationEqualsToken */ ? 98304 /* Nullable */ : 32768 /* Undefined */; + const nullableFlags = operator === 35 /* EqualsEqualsToken */ || operator === 36 /* ExclamationEqualsToken */ ? 12 /* Nullable */ : 4 /* Undefined */; const valueType = getTypeOfExpression(value); const removeNullable = equalsOperator !== assumeTrue && everyType(valueType, (t) => !!(t.flags & nullableFlags)) || equalsOperator === assumeTrue && everyType(valueType, (t) => !(t.flags & (3 /* AnyOrUnknown */ | nullableFlags))); return removeNullable ? getAdjustedTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */) : type; @@ -75509,19 +75687,19 @@ function createTypeChecker(host) { } const valueType = getTypeOfExpression(value); const doubleEquals = operator === 35 /* EqualsEqualsToken */ || operator === 36 /* ExclamationEqualsToken */; - if (valueType.flags & 98304 /* Nullable */) { + if (valueType.flags & 12 /* Nullable */) { if (!strictNullChecks) { return type; } - const facts = doubleEquals ? assumeTrue ? 262144 /* EQUndefinedOrNull */ : 2097152 /* NEUndefinedOrNull */ : valueType.flags & 65536 /* Null */ ? assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ : assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */; + const facts = doubleEquals ? assumeTrue ? 262144 /* EQUndefinedOrNull */ : 2097152 /* NEUndefinedOrNull */ : valueType.flags & 8 /* Null */ ? assumeTrue ? 131072 /* EQNull */ : 1048576 /* NENull */ : assumeTrue ? 65536 /* EQUndefined */ : 524288 /* NEUndefined */; return getAdjustedTypeWithFacts(type, facts); } if (assumeTrue) { if (!doubleEquals && (type.flags & 2 /* Unknown */ || someType(type, isEmptyAnonymousObjectType))) { - if (valueType.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) { + if (valueType.flags & (12713980 /* Primitive */ | 131072 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) { return valueType; } - if (valueType.flags & 524288 /* Object */) { + if (valueType.flags & 1048576 /* Object */) { return nonPrimitiveType; } } @@ -75568,11 +75746,11 @@ function createTypeChecker(host) { let groundClauseTypes; for (let i = 0; i < clauseTypes.length; i += 1) { const t = clauseTypes[i]; - if (t.flags & (402784252 /* Primitive */ | 67108864 /* NonPrimitive */)) { + if (t.flags & (12713980 /* Primitive */ | 131072 /* NonPrimitive */)) { if (groundClauseTypes !== void 0) { groundClauseTypes.push(t); } - } else if (t.flags & 524288 /* Object */) { + } else if (t.flags & 1048576 /* Object */) { if (groundClauseTypes === void 0) { groundClauseTypes = clauseTypes.slice(0, i); } @@ -75584,12 +75762,12 @@ function createTypeChecker(host) { return getUnionType(groundClauseTypes === void 0 ? clauseTypes : groundClauseTypes); } const discriminantType = getUnionType(clauseTypes); - const caseType = discriminantType.flags & 131072 /* Never */ ? neverType : replacePrimitivesWithLiterals(filterType(type, (t) => areTypesComparable(discriminantType, t)), discriminantType); + const caseType = discriminantType.flags & 262144 /* Never */ ? 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 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t))))); - return caseType.flags & 131072 /* Never */ ? defaultType : getUnionType([caseType, defaultType]); + const defaultType = filterType(type, (t) => !(isUnitLikeType(t) && contains(switchTypes, t.flags & 4 /* Undefined */ ? undefinedType : getRegularTypeOfLiteralType(extractUnitType(t)), (t1, t2) => isUnitType(t1) && areTypesComparable(t1, t2)))); + return caseType.flags & 262144 /* Never */ ? defaultType : getUnionType([caseType, defaultType]); } function narrowTypeByTypeName(type, typeName) { switch (typeName) { @@ -75705,7 +75883,7 @@ function createTypeChecker(host) { } return filterType(type, (t) => isConstructedBy(t, candidate)); function isConstructedBy(source, target) { - if (source.flags & 524288 /* Object */ && getObjectFlags(source) & 1 /* Class */ || target.flags & 524288 /* Object */ && getObjectFlags(target) & 1 /* Class */) { + if (source.flags & 1048576 /* Object */ && getObjectFlags(source) & 1 /* Class */ || target.flags & 1048576 /* Object */ && getObjectFlags(target) & 1 /* Class */) { return source.symbol === target.symbol; } return isTypeSubtypeOf(source, target); @@ -75739,7 +75917,7 @@ function createTypeChecker(host) { return type; } const instanceType = mapType(rightType, getInstanceType); - if (isTypeAny(type) && (instanceType === globalObjectType || instanceType === globalFunctionType) || !assumeTrue && !(instanceType.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(instanceType))) { + if (isTypeAny(type) && (instanceType === globalObjectType || instanceType === globalFunctionType) || !assumeTrue && !(instanceType.flags & 1048576 /* Object */ && !isEmptyAnonymousObjectType(instanceType))) { return type; } return getNarrowedType( @@ -75762,7 +75940,7 @@ function createTypeChecker(host) { return emptyObjectType; } function getNarrowedType(type, candidate, assumeTrue, checkDerived) { - const key2 = type.flags & 1048576 /* Union */ ? `N${getTypeId(type)},${getTypeId(candidate)},${(assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)}` : void 0; + const key2 = type.flags & 134217728 /* Union */ ? `N${getTypeId(type)},${getTypeId(candidate)},${(assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)}` : void 0; return getCachedType(key2) ?? setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived)); } function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) { @@ -75791,7 +75969,7 @@ function createTypeChecker(host) { return candidate; } const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf; - const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0; + const keyPropertyName = type.flags & 134217728 /* Union */ ? getKeyPropertyName(type) : void 0; const narrowedType = mapType(candidate, (c) => { const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName); const matching = discriminant && getConstituentTypeForKeyType(type, discriminant); @@ -75799,9 +75977,9 @@ function createTypeChecker(host) { 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 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated; + return directlyRelated.flags & 262144 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 132644864 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated; }); - return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]); + return !(narrowedType.flags & 262144 /* Never */) ? 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)) { @@ -76079,10 +76257,10 @@ function createTypeChecker(host) { return parent2.kind === 212 /* PropertyAccessExpression */ || parent2.kind === 167 /* QualifiedName */ || parent2.kind === 214 /* CallExpression */ && parent2.expression === node || parent2.kind === 215 /* NewExpression */ && parent2.expression === node || parent2.kind === 213 /* ElementAccessExpression */ && parent2.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent2.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { - return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */)); + return type.flags & 268435456 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 132644864 /* Instantiable */ && getBaseConstraintOrType(type).flags & (12 /* Nullable */ | 134217728 /* Union */)); } function isGenericTypeWithoutNullableConstraint(type) { - return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */)); + return type.flags & 268435456 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 132644864 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 12 /* Nullable */)); } 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 /* RestBindingElement */ ? getContextualType2(node, 8 /* SkipBindingPatterns */) : getContextualType2( @@ -76468,7 +76646,7 @@ function createTypeChecker(host) { const parentType = getTypeForBindingElementParent(parent2, 0 /* Normal */); const parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~4194304 /* InCheckIdentifier */; - if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* Union */ && !(rootDeclaration.kind === 170 /* Parameter */ && isSomeSymbolAssigned(rootDeclaration))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 134217728 /* Union */ && !(rootDeclaration.kind === 170 /* Parameter */ && isSomeSymbolAssigned(rootDeclaration))) { const pattern = declaration.parent; const narrowedType = getFlowTypeOfReference( pattern, @@ -76478,7 +76656,7 @@ function createTypeChecker(host) { void 0, location.flowNode ); - if (narrowedType.flags & 131072 /* Never */) { + if (narrowedType.flags & 262144 /* Never */) { return neverType; } return getBindingElementTypeFromParentType( @@ -76497,7 +76675,7 @@ function createTypeChecker(host) { const contextualSignature = getContextualSignature(func); if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) { const restType = getReducedApparentType(instantiateType(getTypeOfSymbol(contextualSignature.parameters[0]), (_a = getInferenceContext(func)) == null ? void 0 : _a.nonFixingMapper)); - if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !some(func.parameters, isSomeSymbolAssigned)) { + if (restType.flags & 134217728 /* Union */ && everyType(restType, isTupleType) && !some(func.parameters, isSomeSymbolAssigned)) { const narrowedType = getFlowTypeOfReference( func, restType, @@ -76588,7 +76766,11 @@ function createTypeChecker(host) { } checkIdentifierCalculateNodeCheckFlags(node, symbol); if (symbol === argumentsSymbol) { - if (isInPropertyInitializerOrClassStaticBlock(node)) { + if (isInPropertyInitializerOrClassStaticBlock( + node, + /*ignoreArrowFunctions*/ + true + )) { return errorType; } return getTypeOfSymbol(symbol); @@ -76644,8 +76826,8 @@ function createTypeChecker(host) { while (flowContainer !== declarationContainer && (flowContainer.kind === 219 /* FunctionExpression */ || flowContainer.kind === 220 /* ArrowFunction */ || 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 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 282 /* ExportSpecifier */) || node.parent.kind === 236 /* NonNullExpression */ || declaration.kind === 261 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */; + 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 /* AnyOrUnknown */ | 16 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 282 /* ExportSpecifier */) || node.parent.kind === 236 /* NonNullExpression */ || declaration.kind === 261 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */; const initialType = isAutomaticTypeInNonNull ? undefinedType : assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : typeIsAutomatic ? undefinedType : getOptionalType(type); const flowType = isAutomaticTypeInNonNull ? getNonNullableType(getFlowTypeOfReference(node, type, initialType, flowContainer)) : getFlowTypeOfReference(node, type, initialType, flowContainer); if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) { @@ -77068,7 +77250,7 @@ function createTypeChecker(host) { } function getThisTypeFromContextualType(type) { return mapType(type, (t) => { - return t.flags & 2097152 /* Intersection */ ? forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t); + return t.flags & 268435456 /* Intersection */ ? forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t); }); } function getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType) { @@ -77232,7 +77414,7 @@ function createTypeChecker(host) { const functionFlags = getFunctionFlags(func); if (functionFlags & 1 /* Generator */) { const isAsyncGenerator = (functionFlags & 2 /* Async */) !== 0; - if (contextualReturnType.flags & 1048576 /* Union */) { + if (contextualReturnType.flags & 134217728 /* Union */) { contextualReturnType = filterType(contextualReturnType, (type) => !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator)); } const iterationReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, contextualReturnType, (functionFlags & 2 /* Async */) !== 0); @@ -77265,7 +77447,7 @@ function createTypeChecker(host) { let contextualReturnType = getContextualReturnType(func, contextFlags); if (contextualReturnType) { const isAsyncGenerator = (functionFlags & 2 /* Async */) !== 0; - if (!node.asteriskToken && contextualReturnType.flags & 1048576 /* Union */) { + if (!node.asteriskToken && contextualReturnType.flags & 134217728 /* Union */) { contextualReturnType = filterType(contextualReturnType, (type) => !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator)); } if (node.asteriskToken) { @@ -77333,7 +77515,7 @@ function createTypeChecker(host) { const functionFlags = getFunctionFlags(functionDecl); if (functionFlags & 1 /* Generator */) { return filterType(returnType2, (t) => { - return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 58982400 /* InstantiableNonPrimitive */)) || checkGeneratorInstantiationAssignabilityToReturnType( + return !!(t.flags & (3 /* AnyOrUnknown */ | 16 /* Void */ | 117964800 /* InstantiableNonPrimitive */)) || checkGeneratorInstantiationAssignabilityToReturnType( t, functionFlags, /*errorNode*/ @@ -77343,7 +77525,7 @@ function createTypeChecker(host) { } if (functionFlags & 2 /* Async */) { return filterType(returnType2, (t) => { - return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 58982400 /* InstantiableNonPrimitive */)) || !!getAwaitedTypeOfPromise(t); + return !!(t.flags & (3 /* AnyOrUnknown */ | 16 /* Void */ | 117964800 /* InstantiableNonPrimitive */)) || !!getAwaitedTypeOfPromise(t); }); } return returnType2; @@ -77551,11 +77733,11 @@ function createTypeChecker(host) { return !!(getCheckFlags(symbol) & 262144 /* Mapped */ && !symbol.links.type && findResolutionCycleStartIndex(symbol, 0 /* Type */) >= 0); } function isExcludedMappedPropertyName(constraint, propertyNameType) { - if (constraint.flags & 16777216 /* Conditional */) { + if (constraint.flags & 67108864 /* Conditional */) { const type = constraint; - return !!(getReducedType(getTrueTypeFromConditionalType(type)).flags & 131072 /* Never */) && getActualTypeVariable(getFalseTypeFromConditionalType(type)) === getActualTypeVariable(type.checkType) && isTypeAssignableTo(propertyNameType, type.extendsType); + return !!(getReducedType(getTrueTypeFromConditionalType(type)).flags & 262144 /* Never */) && getActualTypeVariable(getFalseTypeFromConditionalType(type)) === getActualTypeVariable(type.checkType) && isTypeAssignableTo(propertyNameType, type.extendsType); } - if (constraint.flags & 2097152 /* Intersection */) { + if (constraint.flags & 268435456 /* Intersection */) { return some(constraint.types, (t) => isExcludedMappedPropertyName(t, propertyNameType)); } return false; @@ -77564,12 +77746,12 @@ function createTypeChecker(host) { return mapType( type, (t) => { - if (t.flags & 2097152 /* Intersection */) { + if (t.flags & 268435456 /* Intersection */) { let types; let indexInfoCandidates; let ignoreIndexInfos = false; for (const constituentType of t.types) { - if (!(constituentType.flags & 524288 /* Object */)) { + if (!(constituentType.flags & 1048576 /* Object */)) { continue; } if (isGenericMappedType(constituentType) && getMappedTypeNameTypeKind(constituentType) !== 2 /* Remapping */) { @@ -77602,7 +77784,7 @@ function createTypeChecker(host) { } return getIntersectionType(types); } - if (!(t.flags & 524288 /* Object */)) { + if (!(t.flags & 1048576 /* Object */)) { return; } return isGenericMappedType(t) && getMappedTypeNameTypeKind(t) !== 2 /* Remapping */ ? getIndexedMappedTypeSubstitutedTypeOfContextualType(t, name, nameType) : getTypeOfConcretePropertyOfContextualType(t, name) ?? getTypeFromIndexInfosOfContextualType(t, name, nameType); @@ -77851,7 +78033,7 @@ function createTypeChecker(host) { concatenate( map( filter(node.properties, (p) => !!p.symbol && p.kind === 292 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer))), - (prop) => [!prop.initializer ? () => trueType : () => getContextFreeTypeOfExpression(prop.initializer), prop.symbol.escapedName] + (prop) => [!prop.initializer ? (() => trueType) : (() => getContextFreeTypeOfExpression(prop.initializer)), prop.symbol.escapedName] ), map( filter(getPropertiesOfType(contextualType), (s) => { @@ -77875,7 +78057,7 @@ function createTypeChecker(host) { 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 /* NoConstraints */ && instantiatedType.flags & 8650752 /* TypeVariable */)) { + if (instantiatedType && !(contextFlags && contextFlags & 2 /* NoConstraints */ && instantiatedType.flags & 34078720 /* TypeVariable */)) { const apparentType = mapType( instantiatedType, // When obtaining apparent type of *contextual* type we don't want to get apparent type of mapped types. @@ -77886,30 +78068,35 @@ function createTypeChecker(host) { /*noReductions*/ true ); - return apparentType.flags & 1048576 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 1048576 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType; + return apparentType.flags & 134217728 /* Union */ && isObjectLiteralExpression(node) ? discriminateContextualTypeByObjectMembers(node, apparentType) : apparentType.flags & 134217728 /* Union */ && isJsxAttributes(node) ? discriminateContextualTypeByJSXAttributes(node, apparentType) : apparentType; } } function instantiateContextualType(contextualType, node, contextFlags) { - if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* Instantiable */)) { + if (contextualType && maybeTypeOfKind(contextualType, 132644864 /* Instantiable */)) { const inferenceContext = getInferenceContext(node); if (inferenceContext && contextFlags & 1 /* Signature */ && some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) { - return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper); + const type = instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper); + if (!(type.flags & 3 /* AnyOrUnknown */)) { + return type; + } } if (inferenceContext == null ? void 0 : inferenceContext.returnMapper) { const type = instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper); - return type.flags & 1048576 /* Union */ && containsType(type.types, regularFalseType) && containsType(type.types, regularTrueType) ? filterType(type, (t) => t !== regularFalseType && t !== regularTrueType) : type; + if (!(type.flags & 3 /* AnyOrUnknown */)) { + return type.flags & 134217728 /* Union */ && 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 /* Instantiable */) { + if (type.flags & 132644864 /* Instantiable */) { return instantiateType(type, mapper); } - if (type.flags & 1048576 /* Union */) { + if (type.flags & 134217728 /* Union */) { return getUnionType(map(type.types, (t) => instantiateInstantiableTypes(t, mapper)), 0 /* None */); } - if (type.flags & 2097152 /* Intersection */) { + if (type.flags & 268435456 /* Intersection */) { return getIntersectionType(map(type.types, (t) => instantiateInstantiableTypes(t, mapper))); } return type; @@ -78079,7 +78266,7 @@ function createTypeChecker(host) { ), getNameFromImportAttribute(node)); } function getContextualJsxElementAttributesType(node, contextFlags) { - if (isJsxOpeningElement(node) && contextFlags !== 4 /* Completions */) { + if (isJsxOpeningElement(node) && contextFlags !== 4 /* IgnoreNodeInferences */) { const index = findContextualNode( node.parent, /*includeCaches*/ @@ -78130,7 +78317,7 @@ function createTypeChecker(host) { return getOrCreateTypeFromSignature(fakeSignature); } const tagType = checkExpressionCached(context.tagName); - if (tagType.flags & 128 /* StringLiteral */) { + if (tagType.flags & 1024 /* StringLiteral */) { const result = getIntrinsicAttributesTypeFromStringLiteralType(tagType, context); if (!result) { return errorType; @@ -78266,10 +78453,10 @@ function createTypeChecker(host) { minArgCount, flags ); - result.compositeKind = 2097152 /* Intersection */; - result.compositeSignatures = concatenate(left.compositeKind === 2097152 /* Intersection */ && left.compositeSignatures || [left], [right]); + result.compositeKind = 268435456 /* Intersection */; + result.compositeSignatures = concatenate(left.compositeKind === 268435456 /* Intersection */ && left.compositeSignatures || [left], [right]); if (paramMapper) { - result.mapper = left.compositeKind === 2097152 /* Intersection */ && left.mapper && left.compositeSignatures ? combineTypeMappers(left.mapper, paramMapper) : paramMapper; + result.mapper = left.compositeKind === 268435456 /* Intersection */ && left.mapper && left.compositeSignatures ? combineTypeMappers(left.mapper, paramMapper) : paramMapper; } return result; } @@ -78304,7 +78491,7 @@ function createTypeChecker(host) { if (!type) { return void 0; } - if (!(type.flags & 1048576 /* Union */)) { + if (!(type.flags & 134217728 /* Union */)) { return getContextualCallSignature(type, node); } let signatureList; @@ -78502,7 +78689,7 @@ function createTypeChecker(host) { } } function isNumericComputedName(name) { - return isTypeAssignableToKind(checkComputedPropertyName(name), 296 /* NumberLike */); + return isTypeAssignableToKind(checkComputedPropertyName(name), 67648 /* NumberLike */); } function checkComputedPropertyName(node) { const links = getNodeLinks(node.expression); @@ -78520,7 +78707,7 @@ function createTypeChecker(host) { getNodeLinks(node.parent.parent).flags |= 32768 /* BlockScopedBindingInLoop */; } } - if (links.resolvedType.flags & 98304 /* Nullable */ || !isTypeAssignableToKind(links.resolvedType, 402653316 /* StringLike */ | 296 /* NumberLike */ | 12288 /* ESSymbolLike */) && !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) { + if (links.resolvedType.flags & 12 /* Nullable */ || !isTypeAssignableToKind(links.resolvedType, 12583968 /* StringLike */ | 67648 /* NumberLike */ | 16896 /* ESSymbolLike */) && !isTypeAssignableTo(links.resolvedType, stringNumberSymbolType)) { error2(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } } @@ -78534,7 +78721,7 @@ function createTypeChecker(host) { function isSymbolWithSymbolName(symbol) { var _a; const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0]; - return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096 /* ESSymbol */); + return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 512 /* ESSymbol */); } function isSymbolWithComputedName(symbol) { var _a; @@ -78690,7 +78877,7 @@ function createTypeChecker(host) { Debug.assert(memberDecl.kind === 178 /* GetAccessor */ || memberDecl.kind === 179 /* SetAccessor */); checkNodeDeferred(memberDecl); } - if (computedNameType && !(computedNameType.flags & 8576 /* StringOrNumberLiteralOrUnique */)) { + if (computedNameType && !(computedNameType.flags & 19456 /* StringOrNumberLiteralOrUnique */)) { if (isTypeAssignableTo(computedNameType, stringNumberSymbolType)) { if (isTypeAssignableTo(computedNameType, numberType)) { hasComputedNumberProperty = true; @@ -78745,7 +78932,7 @@ function createTypeChecker(host) { } function isValidSpreadType(type) { const t = removeDefinitelyFalsyTypes(mapType(type, getBaseConstraintOrType)); - return !!(t.flags & (1 /* Any */ | 67108864 /* NonPrimitive */ | 524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */) || t.flags & 3145728 /* UnionOrIntersection */ && every(t.types, isValidSpreadType)); + return !!(t.flags & (1 /* Any */ | 131072 /* NonPrimitive */ | 1048576 /* Object */ | 117964800 /* InstantiableNonPrimitive */) || t.flags & 402653184 /* UnionOrIntersection */ && every(t.types, isValidSpreadType)); } function checkJsxSelfClosingElementDeferred(node) { checkJsxOpeningLikeElementOrOpeningFragment(node); @@ -78916,7 +79103,7 @@ function createTypeChecker(host) { spread, createAnonymousType(attributesSymbol, childPropMap, emptyArray, emptyArray, emptyArray), attributesSymbol, - objectFlags, + objectFlags | getPropagatingFlagsOfTypes(childrenTypes), /*readonly*/ false ); @@ -78956,7 +79143,7 @@ function createTypeChecker(host) { } function checkSpreadPropOverrides(type, props, spread) { for (const right of getPropertiesOfType(type)) { - if (!(right.flags & 16777216 /* Optional */)) { + if (!(right.flags & 16777216 /* Optional */) && !(getCheckFlags(right) & 48 /* Partial */)) { 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)); @@ -79103,9 +79290,9 @@ function createTypeChecker(host) { return getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer, jsxNamespace); } function getUninstantiatedJsxSignaturesOfType(elementType, caller) { - if (elementType.flags & 4 /* String */) { + if (elementType.flags & 32 /* String */) { return [anySignature]; - } else if (elementType.flags & 128 /* StringLiteral */) { + } else if (elementType.flags & 1024 /* StringLiteral */) { const intrinsicType = getIntrinsicAttributesTypeFromStringLiteralType(elementType, caller); if (!intrinsicType) { error2(caller, Diagnostics.Property_0_does_not_exist_on_type_1, elementType.value, "JSX." + JsxNames.IntrinsicElements); @@ -79120,7 +79307,7 @@ function createTypeChecker(host) { if (signatures.length === 0) { signatures = getSignaturesOfType(apparentElemType, 0 /* Call */); } - if (signatures.length === 0 && apparentElemType.flags & 1048576 /* Union */) { + if (signatures.length === 0 && apparentElemType.flags & 134217728 /* Union */) { signatures = getUnionSignatures(map(apparentElemType.types, (t) => getUninstantiatedJsxSignaturesOfType(t, caller))); } return signatures; @@ -79270,15 +79457,15 @@ function createTypeChecker(host) { } } function isKnownProperty(targetType, name, isComparingJsxAttributes) { - if (targetType.flags & 524288 /* Object */) { + if (targetType.flags & 1048576 /* Object */) { if (getPropertyOfObjectType(targetType, name) || getApplicableIndexInfoForName(targetType, name) || isLateBoundName(name) && getIndexInfoOfType(targetType, stringType) || isComparingJsxAttributes && isHyphenatedJsxName(name)) { return true; } } - if (targetType.flags & 33554432 /* Substitution */) { + if (targetType.flags & 16777216 /* Substitution */) { return isKnownProperty(targetType.baseType, name, isComparingJsxAttributes); } - if (targetType.flags & 3145728 /* UnionOrIntersection */ && isExcessPropertyCheckTarget(targetType)) { + if (targetType.flags & 402653184 /* UnionOrIntersection */ && isExcessPropertyCheckTarget(targetType)) { for (const t of targetType.types) { if (isKnownProperty(t, name, isComparingJsxAttributes)) { return true; @@ -79288,7 +79475,7 @@ function createTypeChecker(host) { return false; } function isExcessPropertyCheckTarget(type) { - return !!(type.flags & 524288 /* Object */ && !(getObjectFlags(type) & 512 /* ObjectLiteralPatternWithComputedProperties */) || type.flags & 67108864 /* NonPrimitive */ || type.flags & 33554432 /* Substitution */ && isExcessPropertyCheckTarget(type.baseType) || type.flags & 1048576 /* Union */ && some(type.types, isExcessPropertyCheckTarget) || type.flags & 2097152 /* Intersection */ && every(type.types, isExcessPropertyCheckTarget)); + return !!(type.flags & 1048576 /* Object */ && !(getObjectFlags(type) & 512 /* ObjectLiteralPatternWithComputedProperties */) || type.flags & 131072 /* NonPrimitive */ || type.flags & 16777216 /* Substitution */ && isExcessPropertyCheckTarget(type.baseType) || type.flags & 134217728 /* Union */ && some(type.types, isExcessPropertyCheckTarget) || type.flags & 268435456 /* Intersection */ && every(type.types, isExcessPropertyCheckTarget)); } function checkJsxExpression(node, checkMode) { checkGrammarJsxExpression(node); @@ -79344,10 +79531,10 @@ function createTypeChecker(host) { } } if (flags & 64 /* Abstract */ && 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 /* Class */ && 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; } @@ -79385,7 +79572,7 @@ function createTypeChecker(host) { if (flags & 256 /* Static */) { return true; } - if (containingType.flags & 262144 /* TypeParameter */) { + if (containingType.flags & 524288 /* TypeParameter */) { containingType = containingType.isThisType ? getConstraintOfTypeParameter(containingType) : getBaseConstraintOfType(containingType); } if (!containingType || !hasBaseType(containingType, enclosingClass)) { @@ -79400,7 +79587,7 @@ function createTypeChecker(host) { const thisParameter = getThisParameterFromNodeContext(node); let thisType = (thisParameter == null ? void 0 : thisParameter.type) && getTypeFromTypeNode(thisParameter.type); if (thisType) { - if (thisType.flags & 262144 /* TypeParameter */) { + if (thisType.flags & 524288 /* TypeParameter */) { thisType = getConstraintOfTypeParameter(thisType); } } else { @@ -79487,7 +79674,7 @@ function createTypeChecker(host) { if (facts & 50331648 /* IsUndefinedOrNull */) { reportError(node, facts); const t = getNonNullableType(type); - return t.flags & (98304 /* Nullable */ | 131072 /* Never */) ? errorType : t; + return t.flags & (12 /* Nullable */ | 262144 /* Never */) ? errorType : t; } return type; } @@ -79496,7 +79683,7 @@ function createTypeChecker(host) { } function checkNonNullNonVoidType(type, node) { const nonNullType = checkNonNullType(type, node); - if (nonNullType.flags & 16384 /* Void */) { + if (nonNullType.flags & 16 /* Void */) { if (isEntityNameExpression(node)) { const nodeText2 = entityNameToString(node); if (isIdentifier(node) && nodeText2 === "undefined") { @@ -79787,7 +79974,7 @@ function createTypeChecker(host) { if (assignmentKind === 1 /* Definite */) { return removeMissingType(propType, !!(prop && prop.flags & 16777216 /* Optional */)); } - if (prop && !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && !(prop.flags & 8192 /* Method */ && propType.flags & 1048576 /* Union */) && !isDuplicatedCommonJSExport(prop.declarations)) { + if (prop && !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && !(prop.flags & 8192 /* Method */ && propType.flags & 134217728 /* Union */) && !isDuplicatedCommonJSExport(prop.declarations)) { return propType; } if (propType === autoType) { @@ -79850,27 +80037,14 @@ function createTypeChecker(host) { }); } function isPropertyDeclaredInAncestorClass(prop) { - if (!(prop.parent.flags & 32 /* Class */)) { - 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 /* Class */) { + 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 void 0; - } - return getIntersectionType(x); + return false; } function reportNonexistentProperty(propNode, containingType, isUncheckedJS) { const links = getNodeLinks(propNode); @@ -79882,7 +80056,7 @@ function createTypeChecker(host) { cache.add(key); let errorInfo; let relatedInfo; - if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 402784252 /* Primitive */)) { + if (!isPrivateIdentifier(propNode) && containingType.flags & 134217728 /* Union */ && !(containingType.flags & 12713980 /* Primitive */)) { for (const subtype of containingType.types) { if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) { errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype)); @@ -79981,16 +80155,15 @@ function createTypeChecker(host) { function getSuggestionForSymbolNameLookup(symbols, name, meaning) { 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 /* TypeAlias */, s) : void 0 ); - 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) { @@ -80009,7 +80182,7 @@ function createTypeChecker(host) { return result; } function getSuggestedSymbolForNonexistentModule(name, targetModule) { - return targetModule.exports && getSpellingSuggestionForName(idText(name), getExportsOfModuleAsArray(targetModule), 2623475 /* ModuleMember */); + return targetModule.exports && getSpellingSuggestionForName(idText(name), sortSymbolsIfTSGoCompat(getExportsOfModuleAsArray(targetModule)), 2623475 /* ModuleMember */); } function getSuggestionForNonexistentIndexSignature(objectType, expr, keyedType) { function hasProp(name) { @@ -80033,7 +80206,7 @@ function createTypeChecker(host) { return suggestion; } function getSuggestedTypeForNonexistentStringLiteralType(source, target) { - const candidates = target.types.filter((type) => !!(type.flags & 128 /* StringLiteral */)); + const candidates = target.types.filter((type) => !!(type.flags & 1024 /* StringLiteral */)); return getSpellingSuggestion(source.value, candidates, (type) => type.value); } function getSpellingSuggestionForName(name, symbols, meaning) { @@ -80265,10 +80438,10 @@ function createTypeChecker(host) { return findIndex(args, isSpreadArgument); } function acceptsVoid(t) { - return !!(t.flags & 16384 /* Void */); + return !!(t.flags & 16 /* Void */); } function acceptsVoidUndefinedUnknownOrAny(t) { - return !!(t.flags & (16384 /* Void */ | 32768 /* Undefined */ | 2 /* Unknown */ | 1 /* Any */)); + return !!(t.flags & (16 /* Void */ | 4 /* Undefined */ | 2 /* Unknown */ | 1 /* Any */)); } function hasCorrectArity(node, args, signature, signatureHelpTrailingComma = false) { if (isJsxOpeningFragment(node)) return true; @@ -80317,7 +80490,7 @@ function createTypeChecker(host) { } for (let i = argCount; i < effectiveMinimumArguments; i++) { const type = getTypeAtPosition(signature, i); - if (filterType(type, isInJSFile(node) && !strictNullChecks ? acceptsVoidUndefinedUnknownOrAny : acceptsVoid).flags & 131072 /* Never */) { + if (filterType(type, isInJSFile(node) && !strictNullChecks ? acceptsVoidUndefinedUnknownOrAny : acceptsVoid).flags & 262144 /* Never */) { return false; } } @@ -80354,7 +80527,7 @@ function createTypeChecker(host) { ); } function getSingleSignature(type, kind, allowMembers) { - if (type.flags & 524288 /* Object */) { + if (type.flags & 1048576 /* Object */) { const resolved = resolveStructuredTypeMembers(type); if (allowMembers || resolved.properties.length === 0 && resolved.indexInfos.length === 0) { if (kind === 0 /* Call */ && resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0) { @@ -80367,10 +80540,10 @@ function createTypeChecker(host) { } return void 0; } - function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes) { - const context = createInferenceContext(getTypeParametersForMapper(signature), signature, 0 /* None */, compareTypes); + function instantiateSignatureInContextOf(signature, contextualSignature, inferenceContext, compareTypes2) { + const context = createInferenceContext(getTypeParametersForMapper(signature), signature, 0 /* None */, compareTypes2); const restType = getEffectiveRestType(contextualSignature); - const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper : inferenceContext.mapper); + const mapper = inferenceContext && (restType && restType.flags & 524288 /* TypeParameter */ ? inferenceContext.nonFixingMapper : inferenceContext.mapper); const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature; applyToParameterTypes(sourceSignature, signature, (source, target) => { inferTypes(context.inferences, source, target); @@ -80423,7 +80596,7 @@ function createTypeChecker(host) { } const restType = getNonArrayRestType(signature); const argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; - if (restType && restType.flags & 262144 /* TypeParameter */) { + if (restType && restType.flags & 524288 /* TypeParameter */) { const info = find(context.inferences, (info2) => info2.typeParameter === restType); if (info) { info.impliedArity = findIndex(args, isSpreadArgument, argCount) < 0 ? args.length - argCount : void 0; @@ -80451,7 +80624,7 @@ function createTypeChecker(host) { return getInferredTypes(context); } function getMutableArrayOrTupleType(type) { - return type.flags & 1048576 /* Union */ ? mapType(type, getMutableArrayOrTupleType) : type.flags & 1 /* Any */ || isMutableArrayOrTuple(getBaseConstraintOfType(type) || type) ? type : isTupleType(type) ? createTupleType( + return type.flags & 134217728 /* Union */ ? mapType(type, getMutableArrayOrTupleType) : type.flags & 1 /* Any */ || isMutableArrayOrTuple(getBaseConstraintOfType(type) || type) ? type : isTupleType(type) ? createTupleType( getElementTypes(type), type.target.elementFlags, /*readonly*/ @@ -80488,7 +80661,7 @@ function createTypeChecker(host) { } else { const contextualType = isTupleType(restType) ? getContextualTypeForElementExpression(restType, i - index, argCount - index) || unknownType : getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */); const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode); - const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 402784252 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */); + const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 12713980 /* Primitive */ | 2097152 /* Index */ | 4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */); types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1 /* Required */); } @@ -80509,11 +80682,11 @@ function createTypeChecker(host) { Debug.assert(typeParameters[i] !== void 0, "Should not call checkTypeArguments with too many type arguments"); const constraint = getConstraintOfTypeParameter(typeParameters[i]); if (constraint) { - const errorInfo = reportErrors2 && headMessage ? () => chainDiagnosticMessages( + const errorInfo = reportErrors2 && headMessage ? (() => chainDiagnosticMessages( /*details*/ void 0, Diagnostics.Type_0_does_not_satisfy_the_constraint_1 - ) : void 0; + )) : void 0; const typeArgumentHeadMessage = headMessage || Diagnostics.Type_0_does_not_satisfy_the_constraint_1; if (!mapper) { mapper = createTypeMapper(typeParameters, typeArgumentTypes); @@ -81510,7 +81683,7 @@ function createTypeChecker(host) { return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature))); } function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) { - return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 1048576 /* Union */) && !(getReducedType(apparentFuncType).flags & 131072 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType); + return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 524288 /* TypeParameter */) || !numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & 134217728 /* Union */) && !(getReducedType(apparentFuncType).flags & 262144 /* Never */) && isTypeAssignableTo(funcType, globalFunctionType); } function resolveNewExpression(node, candidatesOutArray, checkMode) { let expressionType = checkNonNullExpression(node.expression); @@ -81563,7 +81736,7 @@ function createTypeChecker(host) { if (isArray(signatures)) { return some(signatures, (signature) => someSignature(signature, f)); } - return signatures.compositeKind === 1048576 /* Union */ ? some(signatures.compositeSignatures, f) : f(signatures); + return signatures.compositeKind === 134217728 /* Union */ ? some(signatures.compositeSignatures, f) : f(signatures); } function typeHasProtectedAccessibleBase(target, type) { const baseTypes = getBaseTypes(type); @@ -81571,7 +81744,7 @@ function createTypeChecker(host) { return false; } const firstBase = baseTypes[0]; - if (firstBase.flags & 2097152 /* Intersection */) { + if (firstBase.flags & 268435456 /* Intersection */) { const types = firstBase.types; const mixinFlags = findMixins(types); let i = 0; @@ -81629,7 +81802,7 @@ function createTypeChecker(host) { const isCall = kind === 0 /* Call */; const awaitedType = getAwaitedType(apparentType); const maybeMissingAwait = awaitedType && getSignaturesOfType(awaitedType, kind).length > 0; - if (apparentType.flags & 1048576 /* Union */) { + if (apparentType.flags & 134217728 /* Union */) { const types = apparentType.types; let hasSignatures2 = false; for (const constituent of types) { @@ -82093,10 +82266,10 @@ function createTypeChecker(host) { return resolveExternalModuleTypeByLiteral(node.arguments[0]); } const returnType = getReturnTypeOfSignature(signature); - if (returnType.flags & 12288 /* ESSymbolLike */ && isSymbolOrSymbolForCall(node)) { + if (returnType.flags & 16896 /* ESSymbolLike */ && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 214 /* CallExpression */ && !node.questionDotToken && node.parent.kind === 245 /* ExpressionStatement */ && returnType.flags & 16384 /* Void */ && getTypePredicateOfSignature(signature)) { + if (node.kind === 214 /* CallExpression */ && !node.questionDotToken && node.parent.kind === 245 /* ExpressionStatement */ && returnType.flags & 16 /* Void */ && 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)) { @@ -82186,7 +82359,7 @@ function createTypeChecker(host) { for (let i = 2; i < node.arguments.length; ++i) { checkExpressionCached(node.arguments[i]); } - if (specifierType.flags & 32768 /* Undefined */ || specifierType.flags & 65536 /* Null */ || !isTypeAssignableTo(specifierType, stringType)) { + if (specifierType.flags & 4 /* Undefined */ || specifierType.flags & 8 /* Null */ || !isTypeAssignableTo(specifierType, stringType)) { error2(specifier, Diagnostics.Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0, typeToString(specifierType)); } if (optionsType) { @@ -82195,7 +82368,15 @@ function createTypeChecker(host) { true ); if (importCallOptionsType !== emptyObjectType) { - checkTypeAssignableTo(optionsType, getNullableType(importCallOptionsType, 32768 /* Undefined */), node.arguments[1]); + checkTypeAssignableTo(optionsType, getNullableType(importCallOptionsType, 4 /* Undefined */), 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); @@ -82362,7 +82543,7 @@ function createTypeChecker(host) { 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); } @@ -82455,7 +82636,7 @@ function createTypeChecker(host) { } return result2; function getInstantiatedTypePart(type2) { - if (type2.flags & 524288 /* Object */) { + if (type2.flags & 1048576 /* Object */) { const resolved = resolveStructuredTypeMembers(type2); const callSignatures = getInstantiatedSignatures(resolved.callSignatures); const constructSignatures = getInstantiatedSignatures(resolved.constructSignatures); @@ -82467,7 +82648,7 @@ function createTypeChecker(host) { result3.node = node; return result3; } - } else if (type2.flags & 58982400 /* InstantiableNonPrimitive */) { + } else if (type2.flags & 117964800 /* InstantiableNonPrimitive */) { const constraint = getBaseConstraintOfType(type2); if (constraint) { const instantiated = getInstantiatedTypePart(constraint); @@ -82475,9 +82656,9 @@ function createTypeChecker(host) { return instantiated; } } - } else if (type2.flags & 1048576 /* Union */) { + } else if (type2.flags & 134217728 /* Union */) { return mapType(type2, getInstantiatedType); - } else if (type2.flags & 2097152 /* Intersection */) { + } else if (type2.flags & 268435456 /* Intersection */) { return getIntersectionType(sameMap(type2.types, getInstantiatedTypePart)); } return type2; @@ -82762,7 +82943,7 @@ function createTypeChecker(host) { } for (let i = minArgumentCount - 1; i >= 0; i--) { const type = getTypeAtPosition(signature, i); - if (filterType(type, acceptsVoid).flags & 131072 /* Never */) { + if (filterType(type, acceptsVoid).flags & 262144 /* Never */) { break; } minArgumentCount = i; @@ -83214,6 +83395,9 @@ function createTypeChecker(host) { let fallbackReturnType = voidType; if (func.body.kind !== 242 /* Block */) { returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* SkipGenericFunctions */); + if (isConstContext(func.body)) { + returnType = getRegularTypeOfLiteralType(returnType); + } if (isAsync) { returnType = unwrapAwaitedType(checkAwaitedType( returnType, @@ -83245,7 +83429,7 @@ function createTypeChecker(host) { /*contextFlags*/ void 0 ); - const returnType2 = contextualReturnType && (unwrapReturnType(contextualReturnType, functionFlags) || voidType).flags & 32768 /* Undefined */ ? undefinedType : voidType; + const returnType2 = contextualReturnType && someType(unwrapReturnType(contextualReturnType, functionFlags) || voidType, (t) => !!(t.flags & 4 /* Undefined */)) ? undefinedType : voidType; return functionFlags & 2 /* Async */ ? createPromiseReturnType(func, returnType2) : ( // Async function returnType2 @@ -83325,7 +83509,10 @@ function createTypeChecker(host) { const nextTypes = []; const isAsync = (getFunctionFlags(func) & 2 /* Async */) !== 0; forEachYieldExpression(func.body, (yieldExpression) => { - const yieldExpressionType = yieldExpression.expression ? checkExpression(yieldExpression.expression, checkMode) : undefinedWideningType; + let yieldExpressionType = yieldExpression.expression ? checkExpression(yieldExpression.expression, checkMode && checkMode & ~8 /* SkipGenericFunctions */) : undefinedWideningType; + if (yieldExpression.expression && isConstContext(yieldExpression.expression)) { + yieldExpressionType = getRegularTypeOfLiteralType(yieldExpressionType); + } pushIfUnique(yieldTypes, getYieldedTypeOfYieldExpression(yieldExpression, yieldExpressionType, anyType, isAsync)); let nextType; if (yieldExpression.asteriskToken) { @@ -83347,9 +83534,6 @@ function createTypeChecker(host) { 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 /* AsyncYieldStar */ : 17 /* YieldStar */, expressionType, sentType, errorNode) : expressionType; return !isAsync ? yieldedType : getAwaitedType( @@ -83439,10 +83623,10 @@ function createTypeChecker(host) { 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 /* Never */) { + if (type.flags & 262144 /* Never */) { hasReturnOfTypeNever = true; } - pushIfUnique(aggregatedTypes, type); + pushIfUnique(aggregatedTypes, isConstContext(expr) ? getRegularTypeOfLiteralType(type) : type); } else { hasReturnWithNoExpression = true; } @@ -83494,10 +83678,10 @@ function createTypeChecker(host) { true ); const returnType = checkExpressionCached(expr); - if (!(returnType.flags & 16 /* Boolean */)) return void 0; + if (!(returnType.flags & 256 /* Boolean */)) return void 0; return forEach(func.parameters, (param, i) => { const initType = getTypeOfSymbol(param.symbol); - if (!initType || initType.flags & 16 /* Boolean */ || !isIdentifier(param.name) || isSymbolAssigned(param.symbol) || isRestParameter(param)) { + if (!initType || initType.flags & 256 /* Boolean */ || !isIdentifier(param.name) || isSymbolAssigned(param.symbol) || isRestParameter(param)) { return; } const trueType2 = checkIfExpressionRefinesParameter(func, expr, param, initType); @@ -83519,7 +83703,7 @@ function createTypeChecker(host) { if (trueType2 === initType) return void 0; const falseCondition = createFlowNode(64 /* FalseCondition */, expr, antecedent); const falseSubtype = getReducedType(getFlowTypeOfReference(param.name, initType, trueType2, func, falseCondition)); - return falseSubtype.flags & 131072 /* Never */ ? trueType2 : void 0; + return falseSubtype.flags & 262144 /* Never */ ? trueType2 : void 0; } function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) { addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics); @@ -83527,7 +83711,7 @@ function createTypeChecker(host) { function checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics() { const functionFlags = getFunctionFlags(func); const type = returnType && unwrapReturnType(returnType, functionFlags); - if (type && (maybeTypeOfKind(type, 16384 /* Void */) || type.flags & (1 /* Any */ | 32768 /* Undefined */))) { + if (type && (maybeTypeOfKind(type, 16 /* Void */) || type.flags & (1 /* Any */ | 4 /* Undefined */))) { return; } if (func.kind === 174 /* MethodSignature */ || nodeIsMissing(func.body) || func.body.kind !== 242 /* Block */ || !functionHasImplicitReturn(func)) { @@ -83535,7 +83719,7 @@ function createTypeChecker(host) { } const hasExplicitReturn = func.flags & 1024 /* HasExplicitReturn */; const errorNode = getEffectiveReturnTypeNode(func) || func; - if (type && type.flags & 131072 /* Never */) { + if (type && type.flags & 262144 /* Never */) { 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); @@ -83615,7 +83799,7 @@ function createTypeChecker(host) { if (checkMode && checkMode & 2 /* Inferential */) { inferFromAnnotatedParametersAndReturn(signature, contextualSignature, inferenceContext); const restType = getEffectiveRestType(contextualSignature); - if (restType && restType.flags & 262144 /* TypeParameter */) { + if (restType && restType.flags & 524288 /* TypeParameter */) { instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper); } } @@ -83772,7 +83956,7 @@ function createTypeChecker(host) { } function checkDeleteExpressionMustBeOptional(expr, symbol) { const type = getTypeOfSymbol(symbol); - if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 131072 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : hasTypeFacts(type, 16777216 /* IsUndefined */))) { + if (strictNullChecks && !(type.flags & (3 /* AnyOrUnknown */ | 262144 /* Never */)) && !(exactOptionalPropertyTypes ? symbol.flags & 16777216 /* Optional */ : hasTypeFacts(type, 16777216 /* IsUndefined */))) { error2(expr, Diagnostics.The_operand_of_a_delete_operator_must_be_optional); } } @@ -83900,11 +84084,11 @@ function createTypeChecker(host) { case 41 /* MinusToken */: case 55 /* TildeToken */: checkNonNullType(operandType, node.operand); - if (maybeTypeOfKindConsideringBaseConstraint(operandType, 12288 /* ESSymbolLike */)) { + if (maybeTypeOfKindConsideringBaseConstraint(operandType, 16896 /* ESSymbolLike */)) { error2(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator)); } if (node.operator === 40 /* PlusToken */) { - if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112 /* BigIntLike */)) { + if (maybeTypeOfKindConsideringBaseConstraint(operandType, 4224 /* BigIntLike */)) { error2(node.operand, Diagnostics.Operator_0_cannot_be_applied_to_type_1, tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType))); } return numberType; @@ -83948,8 +84132,8 @@ function createTypeChecker(host) { return getUnaryResultType(operandType); } function getUnaryResultType(operandType) { - if (maybeTypeOfKind(operandType, 2112 /* BigIntLike */)) { - return isTypeAssignableToKind(operandType, 3 /* AnyOrUnknown */) || maybeTypeOfKind(operandType, 296 /* NumberLike */) ? numberOrBigIntType : bigintType; + if (maybeTypeOfKind(operandType, 4224 /* BigIntLike */)) { + return isTypeAssignableToKind(operandType, 3 /* AnyOrUnknown */) || maybeTypeOfKind(operandType, 67648 /* NumberLike */) ? numberOrBigIntType : bigintType; } return numberType; } @@ -83964,7 +84148,7 @@ function createTypeChecker(host) { if (type.flags & kind) { return true; } - if (type.flags & 3145728 /* UnionOrIntersection */) { + if (type.flags & 402653184 /* UnionOrIntersection */) { const types = type.types; for (const t of types) { if (maybeTypeOfKind(t, kind)) { @@ -83978,13 +84162,13 @@ function createTypeChecker(host) { if (source.flags & kind) { return true; } - if (strict && source.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 32768 /* Undefined */ | 65536 /* Null */)) { + if (strict && source.flags & (3 /* AnyOrUnknown */ | 16 /* Void */ | 4 /* Undefined */ | 8 /* Null */)) { return false; } - return !!(kind & 296 /* NumberLike */) && isTypeAssignableTo(source, numberType) || !!(kind & 2112 /* BigIntLike */) && isTypeAssignableTo(source, bigintType) || !!(kind & 402653316 /* StringLike */) && isTypeAssignableTo(source, stringType) || !!(kind & 528 /* BooleanLike */) && isTypeAssignableTo(source, booleanType) || !!(kind & 16384 /* Void */) && isTypeAssignableTo(source, voidType) || !!(kind & 131072 /* Never */) && isTypeAssignableTo(source, neverType) || !!(kind & 65536 /* Null */) && isTypeAssignableTo(source, nullType) || !!(kind & 32768 /* Undefined */) && isTypeAssignableTo(source, undefinedType) || !!(kind & 4096 /* ESSymbol */) && isTypeAssignableTo(source, esSymbolType) || !!(kind & 67108864 /* NonPrimitive */) && isTypeAssignableTo(source, nonPrimitiveType); + return !!(kind & 67648 /* NumberLike */) && isTypeAssignableTo(source, numberType) || !!(kind & 4224 /* BigIntLike */) && isTypeAssignableTo(source, bigintType) || !!(kind & 12583968 /* StringLike */) && isTypeAssignableTo(source, stringType) || !!(kind & 8448 /* BooleanLike */) && isTypeAssignableTo(source, booleanType) || !!(kind & 16 /* Void */) && isTypeAssignableTo(source, voidType) || !!(kind & 262144 /* Never */) && isTypeAssignableTo(source, neverType) || !!(kind & 8 /* Null */) && isTypeAssignableTo(source, nullType) || !!(kind & 4 /* Undefined */) && isTypeAssignableTo(source, undefinedType) || !!(kind & 512 /* ESSymbol */) && isTypeAssignableTo(source, esSymbolType) || !!(kind & 131072 /* NonPrimitive */) && isTypeAssignableTo(source, nonPrimitiveType); } function allTypesAssignableToKind(source, kind, strict) { - return source.flags & 1048576 /* Union */ ? every(source.types, (subType) => allTypesAssignableToKind(subType, kind, strict)) : isTypeAssignableToKind(source, kind, strict); + return source.flags & 134217728 /* Union */ ? every(source.types, (subType) => allTypesAssignableToKind(subType, kind, strict)) : isTypeAssignableToKind(source, kind, strict); } function isConstEnumObjectType(type) { return !!(getObjectFlags(type) & 16 /* Anonymous */) && !!type.symbol && isConstEnumSymbol(type.symbol); @@ -83994,7 +84178,7 @@ function createTypeChecker(host) { } function getSymbolHasInstanceMethodOfObjectType(type) { const hasInstancePropertyName = getPropertyNameForKnownSymbolName("hasInstance"); - if (allTypesAssignableToKind(type, 67108864 /* NonPrimitive */)) { + if (allTypesAssignableToKind(type, 131072 /* NonPrimitive */)) { const hasInstanceProperty = getPropertyOfType(type, hasInstancePropertyName); if (hasInstanceProperty) { const hasInstancePropertyType = getTypeOfSymbol(hasInstanceProperty); @@ -84008,7 +84192,7 @@ function createTypeChecker(host) { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 402784252 /* Primitive */)) { + if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 12713980 /* Primitive */)) { 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)); @@ -84026,7 +84210,7 @@ function createTypeChecker(host) { return booleanType; } function hasEmptyObjectIntersection(type) { - return someType(type, (t) => t === unknownEmptyObjectType || !!(t.flags & 2097152 /* Intersection */) && isEmptyAnonymousObjectType(getBaseConstraintOrType(t))); + return someType(type, (t) => t === unknownEmptyObjectType || !!(t.flags & 268435456 /* Intersection */) && isEmptyAnonymousObjectType(getBaseConstraintOrType(t))); } function checkInExpression(left, right, leftType, rightType) { if (leftType === silentNeverType || rightType === silentNeverType) { @@ -84254,7 +84438,7 @@ function createTypeChecker(host) { } } function isTypeEqualityComparableTo(source, target) { - return (target.flags & 98304 /* Nullable */) !== 0 || isTypeComparableTo(source, target); + return (target.flags & 12 /* Nullable */) !== 0 || isTypeComparableTo(source, target); } function createCheckBinaryExpression() { const trampoline = createBinaryExpressionTrampoline(onEnter, onLeft, onOperator, onRight, onExit, foldState); @@ -84403,7 +84587,6 @@ function createTypeChecker(host) { } } checkNullishCoalesceOperandLeft(node); - checkNullishCoalesceOperandRight(node); } function checkNullishCoalesceOperandLeft(node) { const leftTarget = skipOuterExpressions(node.left, 63 /* All */); @@ -84416,21 +84599,6 @@ function createTypeChecker(host) { } } } - function checkNullishCoalesceOperandRight(node) { - const rightTarget = skipOuterExpressions(node.right, 63 /* All */); - const nullishSemantics = getSyntacticNullishnessSemantics(rightTarget); - if (isNotWithinNullishCoalesceExpression(node)) { - return; - } - if (nullishSemantics === 1 /* Always */) { - error2(rightTarget, Diagnostics.This_expression_is_always_nullish); - } else if (nullishSemantics === 2 /* Never */) { - error2(rightTarget, Diagnostics.This_expression_is_never_nullish); - } - } - function isNotWithinNullishCoalesceExpression(node) { - return !isBinaryExpression(node.parent) || node.parent.operatorToken.kind !== 61 /* QuestionQuestionToken */; - } function getSyntacticNullishnessSemantics(node) { node = skipOuterExpressions(node); switch (node.kind) { @@ -84446,15 +84614,16 @@ function createTypeChecker(host) { return 3 /* Sometimes */; case 227 /* BinaryExpression */: switch (node.operatorToken.kind) { - case 64 /* EqualsToken */: - case 61 /* QuestionQuestionToken */: - case 78 /* QuestionQuestionEqualsToken */: case 57 /* BarBarToken */: case 76 /* BarBarEqualsToken */: case 56 /* AmpersandAmpersandToken */: case 77 /* AmpersandAmpersandEqualsToken */: return 3 /* Sometimes */; + // For these operator kinds, the right operand is effectively controlling case 28 /* CommaToken */: + case 64 /* EqualsToken */: + case 61 /* QuestionQuestionToken */: + case 78 /* QuestionQuestionEqualsToken */: return getSyntacticNullishnessSemantics(node.right); } return 2 /* Never */; @@ -84515,7 +84684,7 @@ function createTypeChecker(host) { leftType = checkNonNullType(leftType, left); rightType = checkNonNullType(rightType, right); let suggestedOperator; - if (leftType.flags & 528 /* BooleanLike */ && rightType.flags & 528 /* BooleanLike */ && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== void 0) { + if (leftType.flags & 8448 /* BooleanLike */ && rightType.flags & 8448 /* BooleanLike */ && (suggestedOperator = getSuggestedBooleanOperator(operatorToken.kind)) !== void 0) { 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 { @@ -84535,7 +84704,7 @@ function createTypeChecker(host) { ); let resultType2; if (isTypeAssignableToKind(leftType, 3 /* AnyOrUnknown */) && isTypeAssignableToKind(rightType, 3 /* AnyOrUnknown */) || // Or, if neither could be bigint, implicit coercion results in a number result - !(maybeTypeOfKind(leftType, 2112 /* BigIntLike */) || maybeTypeOfKind(rightType, 2112 /* BigIntLike */))) { + !(maybeTypeOfKind(leftType, 4224 /* BigIntLike */) || maybeTypeOfKind(rightType, 4224 /* BigIntLike */))) { resultType2 = numberType; } else if (bothAreBigIntLike(leftType, rightType)) { switch (operator) { @@ -84587,43 +84756,43 @@ function createTypeChecker(host) { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (!isTypeAssignableToKind(leftType, 402653316 /* StringLike */) && !isTypeAssignableToKind(rightType, 402653316 /* StringLike */)) { + if (!isTypeAssignableToKind(leftType, 12583968 /* StringLike */) && !isTypeAssignableToKind(rightType, 12583968 /* StringLike */)) { leftType = checkNonNullType(leftType, left); rightType = checkNonNullType(rightType, right); } let resultType; if (isTypeAssignableToKind( leftType, - 296 /* NumberLike */, + 67648 /* NumberLike */, /*strict*/ true ) && isTypeAssignableToKind( rightType, - 296 /* NumberLike */, + 67648 /* NumberLike */, /*strict*/ true )) { resultType = numberType; } else if (isTypeAssignableToKind( leftType, - 2112 /* BigIntLike */, + 4224 /* BigIntLike */, /*strict*/ true ) && isTypeAssignableToKind( rightType, - 2112 /* BigIntLike */, + 4224 /* BigIntLike */, /*strict*/ true )) { resultType = bigintType; } else if (isTypeAssignableToKind( leftType, - 402653316 /* StringLike */, + 12583968 /* StringLike */, /*strict*/ true ) || isTypeAssignableToKind( rightType, - 402653316 /* StringLike */, + 12583968 /* StringLike */, /*strict*/ true )) { @@ -84635,7 +84804,7 @@ function createTypeChecker(host) { return resultType; } if (!resultType) { - const closeEnoughKind = 296 /* NumberLike */ | 2112 /* BigIntLike */ | 402653316 /* StringLike */ | 3 /* AnyOrUnknown */; + const closeEnoughKind = 67648 /* NumberLike */ | 4224 /* BigIntLike */ | 12583968 /* StringLike */ | 3 /* AnyOrUnknown */; reportOperatorError( (left2, right2) => isTypeAssignableToKind(left2, closeEnoughKind) && isTypeAssignableToKind(right2, closeEnoughKind) ); @@ -84708,7 +84877,7 @@ function createTypeChecker(host) { const declKind = isBinaryExpression(left.parent) ? getAssignmentDeclarationKind(left.parent) : 0 /* None */; checkAssignmentDeclaration(declKind, rightType); if (isAssignmentDeclaration2(declKind)) { - if (!(rightType.flags & 524288 /* Object */) || declKind !== 2 /* ModuleExports */ && declKind !== 6 /* Prototype */ && !isEmptyObjectType(rightType) && !isFunctionObjectType(rightType) && !(getObjectFlags(rightType) & 1 /* Class */)) { + if (!(rightType.flags & 1048576 /* Object */) || declKind !== 2 /* ModuleExports */ && declKind !== 6 /* Prototype */ && !isEmptyObjectType(rightType) && !isFunctionObjectType(rightType) && !(getObjectFlags(rightType) & 1 /* Class */)) { checkAssignmentOperator(rightType); } return leftType; @@ -84732,7 +84901,7 @@ function createTypeChecker(host) { return Debug.fail(); } function bothAreBigIntLike(left2, right2) { - return isTypeAssignableToKind(left2, 2112 /* BigIntLike */) && isTypeAssignableToKind(right2, 2112 /* BigIntLike */); + return isTypeAssignableToKind(left2, 4224 /* BigIntLike */) && isTypeAssignableToKind(right2, 4224 /* BigIntLike */); } function checkAssignmentDeclaration(kind, rightType2) { if (kind === 2 /* ModuleExports */) { @@ -84762,7 +84931,7 @@ function createTypeChecker(host) { (isAccessExpression(node.right) || isIdentifier(node.right) && node.right.escapedText === "eval"); } function checkForDisallowedESSymbolOperand(operator2) { - const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 12288 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 12288 /* ESSymbolLike */) ? right : void 0; + const offendingSymbolOperand = maybeTypeOfKindConsideringBaseConstraint(leftType, 16896 /* ESSymbolLike */) ? left : maybeTypeOfKindConsideringBaseConstraint(rightType, 16896 /* ESSymbolLike */) ? right : void 0; if (offendingSymbolOperand) { error2(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator2)); return false; @@ -84801,7 +84970,7 @@ function createTypeChecker(host) { } 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 /* Undefined */)) { + if (exactOptionalPropertyTypes && isPropertyAccessExpression(left) && maybeTypeOfKind(valueType, 4 /* Undefined */)) { 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; @@ -84926,7 +85095,7 @@ function createTypeChecker(host) { } } let returnType = getReturnTypeFromAnnotation(func); - if (returnType && returnType.flags & 1048576 /* Union */) { + if (returnType && returnType.flags & 134217728 /* Union */) { returnType = filterType(returnType, (t) => checkGeneratorInstantiationAssignabilityToReturnType( t, functionFlags, @@ -84990,7 +85159,7 @@ function createTypeChecker(host) { const types = []; for (const span of node.templateSpans) { const type = checkExpression(span.expression); - if (maybeTypeOfKindConsideringBaseConstraint(type, 12288 /* ESSymbolLike */)) { + if (maybeTypeOfKindConsideringBaseConstraint(type, 16896 /* ESSymbolLike */)) { 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); @@ -85010,7 +85179,7 @@ function createTypeChecker(host) { return stringType; } function isTemplateLiteralContextualType(type) { - return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */)); + return !!(type.flags & (1024 /* StringLiteral */ | 4194304 /* TemplateLiteral */) || type.flags & 117964800 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 12583968 /* StringLike */)); } function getContextNode2(node) { if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) { @@ -85031,7 +85200,7 @@ function createTypeChecker(host) { if (inferenceContext && inferenceContext.intraExpressionInferenceSites) { inferenceContext.intraExpressionInferenceSites = void 0; } - const result = maybeTypeOfKind(type, 2944 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType( + const result = maybeTypeOfKind(type, 15360 /* Literal */) && isLiteralOfContextualType(type, instantiateContextualType( contextualType, node, /*contextFlags*/ @@ -85169,15 +85338,15 @@ function createTypeChecker(host) { } function isLiteralOfContextualType(candidateType, contextualType) { if (contextualType) { - if (contextualType.flags & 3145728 /* UnionOrIntersection */) { + if (contextualType.flags & 402653184 /* UnionOrIntersection */) { const types = contextualType.types; return some(types, (t) => isLiteralOfContextualType(candidateType, t)); } - if (contextualType.flags & 58982400 /* InstantiableNonPrimitive */) { + if (contextualType.flags & 117964800 /* InstantiableNonPrimitive */) { const constraint = getBaseConstraintOfType(contextualType) || unknownType; - return maybeTypeOfKind(constraint, 4 /* String */) && maybeTypeOfKind(candidateType, 128 /* StringLiteral */) || maybeTypeOfKind(constraint, 8 /* Number */) && maybeTypeOfKind(candidateType, 256 /* NumberLiteral */) || maybeTypeOfKind(constraint, 64 /* BigInt */) && maybeTypeOfKind(candidateType, 2048 /* BigIntLiteral */) || maybeTypeOfKind(constraint, 4096 /* ESSymbol */) && maybeTypeOfKind(candidateType, 8192 /* UniqueESSymbol */) || isLiteralOfContextualType(candidateType, constraint); + return maybeTypeOfKind(constraint, 32 /* String */) && maybeTypeOfKind(candidateType, 1024 /* StringLiteral */) || maybeTypeOfKind(constraint, 64 /* Number */) && maybeTypeOfKind(candidateType, 2048 /* NumberLiteral */) || maybeTypeOfKind(constraint, 128 /* BigInt */) && maybeTypeOfKind(candidateType, 4096 /* BigIntLiteral */) || maybeTypeOfKind(constraint, 512 /* ESSymbol */) && maybeTypeOfKind(candidateType, 16384 /* UniqueESSymbol */) || isLiteralOfContextualType(candidateType, constraint); } - return !!(contextualType.flags & (128 /* StringLiteral */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && maybeTypeOfKind(candidateType, 128 /* StringLiteral */) || contextualType.flags & 256 /* NumberLiteral */ && maybeTypeOfKind(candidateType, 256 /* NumberLiteral */) || contextualType.flags & 2048 /* BigIntLiteral */ && maybeTypeOfKind(candidateType, 2048 /* BigIntLiteral */) || contextualType.flags & 512 /* BooleanLiteral */ && maybeTypeOfKind(candidateType, 512 /* BooleanLiteral */) || contextualType.flags & 8192 /* UniqueESSymbol */ && maybeTypeOfKind(candidateType, 8192 /* UniqueESSymbol */)); + return !!(contextualType.flags & (1024 /* StringLiteral */ | 2097152 /* Index */ | 4194304 /* TemplateLiteral */ | 8388608 /* StringMapping */) && maybeTypeOfKind(candidateType, 1024 /* StringLiteral */) || contextualType.flags & 2048 /* NumberLiteral */ && maybeTypeOfKind(candidateType, 2048 /* NumberLiteral */) || contextualType.flags & 4096 /* BigIntLiteral */ && maybeTypeOfKind(candidateType, 4096 /* BigIntLiteral */) || contextualType.flags & 8192 /* BooleanLiteral */ && maybeTypeOfKind(candidateType, 8192 /* BooleanLiteral */) || contextualType.flags & 16384 /* UniqueESSymbol */ && maybeTypeOfKind(candidateType, 16384 /* UniqueESSymbol */)); } return false; } @@ -86180,6 +86349,47 @@ function createTypeChecker(host) { } return void 0; } + function getUninstantiatedSignatures(node) { + switch (node.kind) { + case 214 /* CallExpression */: + case 171 /* Decorator */: + return getSignaturesOfType( + getTypeOfExpression(node.expression), + 0 /* Call */ + ); + case 215 /* NewExpression */: + return getSignaturesOfType( + getTypeOfExpression(node.expression), + 1 /* Construct */ + ); + case 286 /* JsxSelfClosingElement */: + case 287 /* JsxOpeningElement */: + if (isJsxIntrinsicTagName(node.tagName)) return []; + return getSignaturesOfType( + getTypeOfExpression(node.tagName), + 0 /* Call */ + ); + case 216 /* TaggedTemplateExpression */: + return getSignaturesOfType( + getTypeOfExpression(node.tag), + 0 /* Call */ + ); + case 227 /* BinaryExpression */: + case 290 /* JsxOpeningFragment */: + return []; + } + } + function getTypeParameterConstraintForPositionAcrossSignatures(signatures, position) { + const relevantTypeParameterConstraints = flatMap(signatures, (signature) => { + var _a; + const relevantTypeParameter = (_a = signature.typeParameters) == null ? void 0 : _a[position]; + if (relevantTypeParameter === void 0) return []; + const relevantConstraint = getConstraintOfTypeParameter(relevantTypeParameter); + if (relevantConstraint === void 0) return []; + return [relevantConstraint]; + }); + return getUnionType(relevantTypeParameterConstraints); + } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); if (node.kind === 184 /* TypeReference */ && !isInJSFile(node) && !isInJSDoc(node) && node.typeArguments && node.typeName.end !== node.typeArguments.pos) { @@ -86215,12 +86425,48 @@ function createTypeChecker(host) { } } function getTypeArgumentConstraint(node) { - const typeReferenceNode = tryCast(node.parent, isTypeReferenceType); - if (!typeReferenceNode) return void 0; - const typeParameters = getTypeParametersForTypeReferenceOrImport(typeReferenceNode); - if (!typeParameters) return void 0; - 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 !== void 0) { + 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 /* Call */), + typeArgumentPosition + ); + const constructConstraint = getTypeParameterConstraintForPositionAcrossSignatures( + getSignaturesOfType(uninstantiatedType, 1 /* Construct */), + typeArgumentPosition + ); + if (constructConstraint.flags & 262144 /* Never */) return callConstraint; + if (callConstraint.flags & 262144 /* Never */) return constructConstraint; + return getIntersectionType([callConstraint, constructConstraint]); + } + if (isTypeReferenceType(node.parent)) { + const typeParameters = getTypeParametersForTypeReferenceOrImport(node.parent); + if (!typeParameters) return void 0; + const relevantTypeParameter = typeParameters[typeArgumentPosition]; + const constraint = getConstraintOfTypeParameter(relevantTypeParameter); + return constraint && instantiateType( + constraint, + createTypeMapper(typeParameters, getEffectiveTypeArguments2(node.parent, typeParameters)) + ); + } + } } function checkTypeQuery(node) { getTypeFromTypeQueryNode(node); @@ -86278,14 +86524,13 @@ function createTypeChecker(host) { getTypeFromTypeNode(node); } function checkIndexedAccessIndexType(type, accessNode) { - if (!(type.flags & 8388608 /* IndexedAccess */)) { + if (!(type.flags & 33554432 /* IndexedAccess */)) { return type; } const objectType = type.objectType; const indexType = type.indexType; - const objectIndexType = isGenericMappedType(objectType) && getMappedTypeNameTypeKind(objectType) === 2 /* Remapping */ ? getIndexTypeForMappedType(objectType, 0 /* None */) : getIndexType(objectType, 0 /* None */); 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 /* None */)) || hasNumberIndexInfo && isApplicableIndexType(t, numberType))) { if (accessNode.kind === 213 /* ElementAccessExpression */ && isAssignmentTarget(accessNode) && getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) { error2(accessNode, Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -86375,6 +86620,9 @@ function createTypeChecker(host) { function checkImportType(node) { checkSourceElement(node.argument); if (node.attributes) { + if (node.attributes.token !== 118 /* WithKeyword */ && 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); @@ -86712,7 +86960,7 @@ function createTypeChecker(host) { ))) { return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0]; } - if (allTypesAssignableToKind(getBaseConstraintOrType(type), 402784252 /* Primitive */ | 131072 /* Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 12713980 /* Primitive */ | 262144 /* Never */)) { return void 0; } const thenFunction = getTypeOfPropertyOfType(type, "then"); @@ -86764,7 +87012,7 @@ function createTypeChecker(host) { return awaitedType || errorType; } function isThenableType(type) { - if (allTypesAssignableToKind(getBaseConstraintOrType(type), 402784252 /* Primitive */ | 131072 /* Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 12713980 /* Primitive */ | 262144 /* Never */)) { return false; } const thenFunction = getTypeOfPropertyOfType(type, "then"); @@ -86772,7 +87020,7 @@ function createTypeChecker(host) { } function isAwaitedTypeInstantiation(type) { var _a; - if (type.flags & 16777216 /* Conditional */) { + if (type.flags & 67108864 /* Conditional */) { const awaitedSymbol = getGlobalAwaitedSymbol( /*reportErrors*/ false @@ -86782,7 +87030,7 @@ function createTypeChecker(host) { return false; } function unwrapAwaitedType(type) { - return type.flags & 1048576 /* Union */ ? mapType(type, unwrapAwaitedType) : isAwaitedTypeInstantiation(type) ? type.aliasTypeArguments[0] : type; + return type.flags & 134217728 /* Union */ ? mapType(type, unwrapAwaitedType) : isAwaitedTypeInstantiation(type) ? type.aliasTypeArguments[0] : type; } function isAwaitedTypeNeeded(type) { if (isTypeAny(type) || isAwaitedTypeInstantiation(type)) { @@ -86790,7 +87038,7 @@ function createTypeChecker(host) { } if (isGenericObjectType(type)) { const baseConstraint = getBaseConstraintOfType(type); - if (baseConstraint ? baseConstraint.flags & 3 /* AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) : maybeTypeOfKind(type, 8650752 /* TypeVariable */)) { + if (baseConstraint ? baseConstraint.flags & 3 /* AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) : maybeTypeOfKind(type, 34078720 /* TypeVariable */)) { return true; } } @@ -86828,7 +87076,7 @@ function createTypeChecker(host) { if (typeAsAwaitable.awaitedTypeOfType) { return typeAsAwaitable.awaitedTypeOfType; } - if (type.flags & 1048576 /* Union */) { + if (type.flags & 134217728 /* Union */) { 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); @@ -88039,7 +88287,7 @@ function createTypeChecker(host) { return; } const type = location === condExpr2 ? condType : checkExpression(location); - if (type.flags & 1024 /* EnumLiteral */ && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384 /* Enum */) { + if (type.flags & 32768 /* EnumLiteral */ && isPropertyAccessExpression(location) && (getNodeLinks(location.expression).resolvedSymbol ?? unknownSymbol).flags & 384 /* Enum */) { error2(location, Diagnostics.This_condition_will_always_return_0, !!type.value ? "true" : "false"); return; } @@ -88131,7 +88379,7 @@ function createTypeChecker(host) { checkSourceElement(node.statement); } function checkTruthinessOfType(type, node) { - if (type.flags & 16384 /* Void */) { + if (type.flags & 16 /* Void */) { error2(node, Diagnostics.An_expression_of_type_void_cannot_be_tested_for_truthiness); } else { const semantics = getSyntacticTruthySemantics(node); @@ -88264,7 +88512,7 @@ function createTypeChecker(host) { ); } } - if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 58982400 /* InstantiableNonPrimitive */)) { + if (rightType === neverType || !isTypeAssignableToKind(rightType, 131072 /* NonPrimitive */ | 117964800 /* InstantiableNonPrimitive */)) { 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); @@ -88297,7 +88545,11 @@ function createTypeChecker(host) { } return void 0; } - const uplevelIteration = languageVersion >= 2 /* ES2015 */; + const iterableExists = getGlobalIterableType( + /*reportErrors*/ + false + ) !== emptyGenericType; + const uplevelIteration = languageVersion >= 2 /* ES2015 */ && iterableExists; const downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration; const possibleOutOfBounds = compilerOptions.noUncheckedIndexedAccess && !!(use & 128 /* PossiblyOutOfBounds */); if (uplevelIteration || downlevelIteration || allowAsyncIterables) { @@ -88317,18 +88569,18 @@ function createTypeChecker(host) { let arrayType = inputType; let hasStringConstituent = false; if (use & 4 /* AllowsStringInputFlag */) { - if (arrayType.flags & 1048576 /* Union */) { + if (arrayType.flags & 134217728 /* Union */) { const arrayTypes = inputType.types; - const filteredTypes = filter(arrayTypes, (t) => !(t.flags & 402653316 /* StringLike */)); + const filteredTypes = filter(arrayTypes, (t) => !(t.flags & 12583968 /* StringLike */)); if (filteredTypes !== arrayTypes) { arrayType = getUnionType(filteredTypes, 2 /* Subtype */); } - } else if (arrayType.flags & 402653316 /* StringLike */) { + } else if (arrayType.flags & 12583968 /* StringLike */) { arrayType = neverType; } hasStringConstituent = arrayType !== inputType; if (hasStringConstituent) { - if (arrayType.flags & 131072 /* Never */) { + if (arrayType.flags & 262144 /* Never */) { return possibleOutOfBounds ? includeUndefinedInIndexSignature(stringType) : stringType; } } @@ -88348,7 +88600,7 @@ function createTypeChecker(host) { } const arrayElementType = getIndexTypeOfType(arrayType, numberType); if (hasStringConstituent && arrayElementType) { - if (arrayElementType.flags & 402653316 /* StringLike */ && !compilerOptions.noUncheckedIndexedAccess) { + if (arrayElementType.flags & 12583968 /* StringLike */ && !compilerOptions.noUncheckedIndexedAccess) { return stringType; } return getUnionType(possibleOutOfBounds ? [arrayElementType, stringType, undefinedType] : [arrayElementType, stringType], 2 /* Subtype */); @@ -88399,7 +88651,7 @@ function createTypeChecker(host) { return iterationTypes && iterationTypes[getIterationTypesKeyFromIterationTypeKind(typeKind)]; } function createIterationTypes(yieldType = neverType, returnType = neverType, nextType = unknownType) { - if (yieldType.flags & 67359327 /* Intrinsic */ && returnType.flags & (1 /* Any */ | 131072 /* Never */ | 2 /* Unknown */ | 16384 /* Void */ | 32768 /* Undefined */) && nextType.flags & (1 /* Any */ | 131072 /* Never */ | 2 /* Unknown */ | 16384 /* Void */ | 32768 /* Undefined */)) { + if (yieldType.flags & 402431 /* Intrinsic */ && returnType.flags & (1 /* Any */ | 262144 /* Never */ | 2 /* Unknown */ | 16 /* Void */ | 4 /* Undefined */) && nextType.flags & (1 /* Any */ | 262144 /* Never */ | 2 /* Unknown */ | 16 /* Void */ | 4 /* Undefined */)) { const id = getTypeListId([yieldType, returnType, nextType]); let iterationTypes = iterationTypesCache.get(id); if (!iterationTypes) { @@ -88442,13 +88694,11 @@ function createTypeChecker(host) { } 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 /* Union */)) { + if (!(type.flags & 134217728 /* Union */)) { const errorOutputContainer = errorNode ? { errors: void 0, skipLogging: true } : void 0; const iterationTypes2 = getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer); if (iterationTypes2 === noIterationTypes) { @@ -88515,7 +88765,7 @@ function createTypeChecker(host) { } let noCache = false; if (use & 2 /* AllowsAsyncIterablesFlag */) { - const iterationTypes = getIterationTypesOfIterableCached(type, asyncIterationTypesResolver) || getIterationTypesOfIterableFast(type, asyncIterationTypesResolver); + let iterationTypes = getIterationTypesOfIterableCached(type, asyncIterationTypesResolver) || getIterationTypesOfIterableFast(type, asyncIterationTypesResolver); if (iterationTypes) { if (iterationTypes === noIterationTypes && errorNode) { noCache = true; @@ -88523,6 +88773,10 @@ function createTypeChecker(host) { return use & 8 /* ForOfFlag */ ? getAsyncFromSyncIterationTypes(iterationTypes, errorNode) : iterationTypes; } } + iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode, errorOutputContainer, noCache); + if (iterationTypes !== noIterationTypes) { + return iterationTypes; + } } if (use & 1 /* AllowsSyncIterablesFlag */) { let iterationTypes = getIterationTypesOfIterableCached(type, syncIterationTypesResolver) || getIterationTypesOfIterableFast(type, syncIterationTypesResolver); @@ -88540,15 +88794,7 @@ function createTypeChecker(host) { } } } - } - if (use & 2 /* AllowsAsyncIterablesFlag */) { - const iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode, errorOutputContainer, noCache); - if (iterationTypes !== noIterationTypes) { - return iterationTypes; - } - } - if (use & 1 /* AllowsSyncIterablesFlag */) { - let iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode, errorOutputContainer, noCache); + iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode, errorOutputContainer, noCache); if (iterationTypes !== noIterationTypes) { if (use & 2 /* AllowsAsyncIterablesFlag */) { iterationTypes = getAsyncFromSyncIterationTypes(iterationTypes, errorNode); @@ -88898,7 +89144,7 @@ function createTypeChecker(host) { } function isUnwrappedReturnTypeUndefinedVoidOrAny(func, returnType) { const type = unwrapReturnType(returnType, getFunctionFlags(func)); - return !!(type && (maybeTypeOfKind(type, 16384 /* Void */) || type.flags & (1 /* Any */ | 32768 /* Undefined */))); + return !!(type && (maybeTypeOfKind(type, 16 /* Void */) || type.flags & (1 /* Any */ | 4 /* Undefined */))); } function checkReturnStatement(node) { if (checkGrammarStatementInAmbientContext(node)) { @@ -88915,7 +89161,7 @@ function createTypeChecker(host) { } const signature = getSignatureFromDeclaration(container); const returnType = getReturnTypeOfSignature(signature); - if (strictNullChecks || node.expression || returnType.flags & 131072 /* Never */) { + if (strictNullChecks || node.expression || returnType.flags & 262144 /* Never */) { const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; if (container.kind === 179 /* SetAccessor */) { if (node.expression) { @@ -89040,6 +89286,9 @@ function createTypeChecker(host) { return false; }); } + if (node.label.flags & 1073741824 /* Unreachable */ && compilerOptions.allowUnusedLabels !== true) { + errorOrSuggestion(compilerOptions.allowUnusedLabels === false, node.label, Diagnostics.Unused_label); + } checkSourceElement(node.statement); } function checkThrowStatement(node) { @@ -89095,7 +89344,7 @@ function createTypeChecker(host) { if (!(isStaticIndex && prop.flags & 4194304 /* Prototype */)) { checkIndexConstraintForProperty(type, prop, getLiteralTypeFromProperty( prop, - 8576 /* StringOrNumberLiteralOrUnique */, + 19456 /* StringOrNumberLiteralOrUnique */, /*includeNonPublic*/ true ), getNonMissingTypeOfSymbol(prop)); @@ -89169,7 +89418,7 @@ function createTypeChecker(host) { } } function checkClassNameCollisionWithObject(name) { - if (languageVersion >= 1 /* ES5 */ && name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5 /* ES2015 */) { + if (name.escapedText === "Object" && host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < 5 /* ES2015 */) { error2(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0, ModuleKind[moduleKind]); } } @@ -89241,7 +89490,7 @@ function createTypeChecker(host) { function visit(node) { if (node.kind === 184 /* TypeReference */) { const type = getTypeFromTypeReference(node); - if (type.flags & 262144 /* TypeParameter */) { + if (type.flags & 524288 /* TypeParameter */) { 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); @@ -89429,7 +89678,7 @@ function createTypeChecker(host) { } else { checkTypeAssignableTo(staticType, getTypeWithoutSignatures(staticBaseType), node.name || node, Diagnostics.Class_static_side_0_incorrectly_extends_base_class_static_side_1); } - if (baseConstructorType.flags & 8650752 /* TypeVariable */) { + if (baseConstructorType.flags & 34078720 /* TypeVariable */) { if (!isMixinConstructorType(staticType)) { error2(node.name || node, Diagnostics.A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any); } else { @@ -89439,7 +89688,7 @@ function createTypeChecker(host) { } } } - if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */) && !(baseConstructorType.flags & 8650752 /* TypeVariable */)) { + if (!(staticBaseType.symbol && staticBaseType.symbol.flags & 32 /* Class */) && !(baseConstructorType.flags & 34078720 /* TypeVariable */)) { 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); @@ -90249,12 +90498,7 @@ function createTypeChecker(host) { if (isIdentifier(node.name)) { checkCollisionsForDeclarationName(node, node.name); if (!(node.flags & (32 /* Namespace */ | 2048 /* GlobalAugmentation */))) { - 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); @@ -90568,7 +90812,7 @@ function createTypeChecker(host) { true ); if (importAttributesType !== emptyObjectType) { - checkTypeAssignableTo(getTypeFromImportAttributes(node), getNullableType(importAttributesType, 32768 /* Undefined */), node); + checkTypeAssignableTo(getTypeFromImportAttributes(node), getNullableType(importAttributesType, 4 /* Undefined */), node); } const validForTypeAttributes = isExclusivelyTypeOnlyImportOrExport(declaration); const override = getResolutionModeOverride(node, validForTypeAttributes ? grammarErrorOnNode : void 0); @@ -90585,6 +90829,9 @@ function createTypeChecker(host) { if (102 /* Node20 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ && !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 /* CommonJS */) { return grammarErrorOnNode( node, @@ -90634,7 +90881,13 @@ function createTypeChecker(host) { 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) { - void resolveExternalModuleName(node, node.moduleSpecifier); + void resolveExternalModuleName( + node, + node.moduleSpecifier, + /*ignoreErrors*/ + void 0, + Diagnostics.Cannot_find_module_or_type_declarations_for_side_effect_import_of_0 + ); } } checkImportAttributes(node); @@ -90926,10 +91179,12 @@ function createTypeChecker(host) { function checkSourceElement(node) { if (node) { const saveCurrentNode = currentNode; + const saveWithinUnreachableCode = withinUnreachableCode; currentNode = node; instantiationCount = 0; checkSourceElementWorker(node); currentNode = saveCurrentNode; + withinUnreachableCode = saveWithinUnreachableCode; } } function checkSourceElementWorker(node) { @@ -90957,8 +91212,10 @@ function createTypeChecker(host) { cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 244 /* FirstStatement */ && kind <= 260 /* LastStatement */ && 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 /* TypeParameter */: @@ -91136,6 +91393,66 @@ function createTypeChecker(host) { return checkMissingDeclaration(node); } } + function checkSourceElementUnreachable(node) { + if (!isPotentiallyExecutableNode(node)) { + return false; + } + if (reportedUnreachableNodes == null ? void 0 : 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 /* Unreachable */) { + switch (node.kind) { + case 267 /* EnumDeclaration */: + return !isEnumConst(node) || shouldPreserveConstEnums(compilerOptions); + case 268 /* ModuleDeclaration */: + 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) => { @@ -91298,6 +91615,7 @@ function createTypeChecker(host) { mark(afterMark); measure("Check", beforeMark, afterMark); (_b = tracing) == null ? void 0 : _b.pop(); + reportedUnreachableNodes = void 0; } function unusedIsError(kind, isAmbient) { if (isAmbient) { @@ -91969,7 +92287,7 @@ function createTypeChecker(host) { 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 /* Union */ ? objectType.types : [objectType]; + const objectTypes = objectType.flags & 134217728 /* Union */ ? objectType.types : [objectType]; return flatMap(objectTypes, (t) => filter(getIndexInfosOfType(t), (info) => isApplicableIndexType(keyType, info.keyType))); } return void 0; @@ -92124,7 +92442,7 @@ function createTypeChecker(host) { return getStringLiteralType(name.text); case 168 /* ComputedPropertyName */: const nameType = checkComputedPropertyName(name); - return isTypeAssignableToKind(nameType, 12288 /* ESSymbolLike */) ? nameType : stringType; + return isTypeAssignableToKind(nameType, 16896 /* ESSymbolLike */) ? nameType : stringType; default: return Debug.fail("Unsupported property name."); } @@ -92140,7 +92458,11 @@ function createTypeChecker(host) { } }); } - return getNamedMembers(propsByName); + return getNamedMembers( + propsByName, + /*container*/ + void 0 + ); } function typeHasCallOrConstructSignatures(type) { return getSignaturesOfType(type, 0 /* Call */).length !== 0 || getSignaturesOfType(type, 1 /* Construct */).length !== 0; @@ -92577,7 +92899,7 @@ function createTypeChecker(host) { return void 0; } function isFunctionType(type) { - return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0; + return !!(type.flags & 1048576 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0; } function getTypeReferenceSerializationKind(typeNameIn, location) { var _a; @@ -92645,19 +92967,19 @@ function createTypeChecker(host) { return isTypeOnly ? 11 /* ObjectType */ : 0 /* Unknown */; } else if (type.flags & 3 /* AnyOrUnknown */) { return 11 /* ObjectType */; - } else if (isTypeAssignableToKind(type, 16384 /* Void */ | 98304 /* Nullable */ | 131072 /* Never */)) { + } else if (isTypeAssignableToKind(type, 16 /* Void */ | 12 /* Nullable */ | 262144 /* Never */)) { return 2 /* VoidNullableOrNeverType */; - } else if (isTypeAssignableToKind(type, 528 /* BooleanLike */)) { + } else if (isTypeAssignableToKind(type, 8448 /* BooleanLike */)) { return 6 /* BooleanType */; - } else if (isTypeAssignableToKind(type, 296 /* NumberLike */)) { + } else if (isTypeAssignableToKind(type, 67648 /* NumberLike */)) { return 3 /* NumberLikeType */; - } else if (isTypeAssignableToKind(type, 2112 /* BigIntLike */)) { + } else if (isTypeAssignableToKind(type, 4224 /* BigIntLike */)) { return 4 /* BigIntLikeType */; - } else if (isTypeAssignableToKind(type, 402653316 /* StringLike */)) { + } else if (isTypeAssignableToKind(type, 12583968 /* StringLike */)) { return 5 /* StringLikeType */; } else if (isTupleType(type)) { return 7 /* ArrayLikeType */; - } else if (isTypeAssignableToKind(type, 12288 /* ESSymbolLike */)) { + } else if (isTypeAssignableToKind(type, 16896 /* ESSymbolLike */)) { return 8 /* ESSymbolType */; } else if (isFunctionType(type)) { return 10 /* TypeWithCallSignature */; @@ -92800,7 +93122,7 @@ function createTypeChecker(host) { return false; } function literalTypeToNode(type, enclosing, tracker) { - const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression( + const enumResult = type.flags & 98304 /* EnumLike */ ? nodeBuilder.symbolToExpression( type.symbol, 111551 /* Value */, enclosing, @@ -93822,7 +94144,7 @@ function createTypeChecker(host) { 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 /* StringOrNumberLiteralOrUnique */)) || isGenericType(type)) { + if (someType(type, (t) => !!(t.flags & 19456 /* StringOrNumberLiteralOrUnique */)) || 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)) { @@ -94354,7 +94676,7 @@ function createTypeChecker(host) { } function isSimpleLiteralEnumReference(expr) { if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) { - return !!(checkExpressionCached(expr).flags & 1056 /* EnumLike */); + return !!(checkExpressionCached(expr).flags & 98304 /* EnumLike */); } } function checkAmbientInitializer(node) { @@ -94453,6 +94775,11 @@ function createTypeChecker(host) { declarationList, blockScopeFlags === 4 /* Using */ ? 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 /* Using */ ? 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 /* Ambient */) { return grammarErrorOnNode( @@ -94764,9 +95091,9 @@ function createTypeChecker(host) { } function findMatchingTypeReferenceOrTypeAliasReference(source, unionTarget) { const sourceObjectFlags = getObjectFlags(source); - if (sourceObjectFlags & (4 /* Reference */ | 16 /* Anonymous */) && unionTarget.flags & 1048576 /* Union */) { + if (sourceObjectFlags & (4 /* Reference */ | 16 /* Anonymous */) && unionTarget.flags & 134217728 /* Union */) { return find(unionTarget.types, (target) => { - if (target.flags & 524288 /* Object */) { + if (target.flags & 1048576 /* Object */) { const overlapObjFlags = sourceObjectFlags & getObjectFlags(target); if (overlapObjFlags & 4 /* Reference */) { return source.target === target.target; @@ -94793,15 +95120,15 @@ function createTypeChecker(host) { } function findMostOverlappyType(source, unionTarget) { let bestMatch; - if (!(source.flags & (402784252 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) { + if (!(source.flags & (12713980 /* Primitive */ | 14680064 /* InstantiablePrimitive */))) { let matchingCount = 0; for (const target of unionTarget.types) { - if (!(target.flags & (402784252 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) { + if (!(target.flags & (12713980 /* Primitive */ | 14680064 /* InstantiablePrimitive */))) { const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]); - if (overlap.flags & 4194304 /* Index */) { + if (overlap.flags & 2097152 /* Index */) { return target; - } else if (isUnitType(overlap) || overlap.flags & 1048576 /* Union */) { - const len = overlap.flags & 1048576 /* Union */ ? countWhere(overlap.types, isUnitType) : 1; + } else if (isUnitType(overlap) || overlap.flags & 134217728 /* Union */) { + const len = overlap.flags & 134217728 /* Union */ ? countWhere(overlap.types, isUnitType) : 1; if (len >= matchingCount) { bestMatch = target; matchingCount = len; @@ -94813,16 +95140,16 @@ function createTypeChecker(host) { return bestMatch; } function filterPrimitivesIfContainsNonPrimitive(type) { - if (maybeTypeOfKind(type, 67108864 /* NonPrimitive */)) { - const result = filterType(type, (t) => !(t.flags & 402784252 /* Primitive */)); - if (!(result.flags & 131072 /* Never */)) { + if (maybeTypeOfKind(type, 131072 /* NonPrimitive */)) { + const result = filterType(type, (t) => !(t.flags & 12713980 /* Primitive */)); + if (!(result.flags & 262144 /* Never */)) { return result; } } return type; } function findMatchingDiscriminantType(source, target, isRelatedTo) { - if (target.flags & 1048576 /* Union */ && source.flags & (2097152 /* Intersection */ | 524288 /* Object */)) { + if (target.flags & 134217728 /* Union */ && source.flags & (268435456 /* Intersection */ | 1048576 /* Object */)) { const match = getMatchingUnionConstituentForType(target, source); if (match) { return match; @@ -94878,6 +95205,330 @@ function createTypeChecker(host) { 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 === void 0) return 1; + if (s2 === void 0) 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 === void 0) return 1; + if (n2 === void 0) 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 === void 0) return -1; + if (t2 === void 0) 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 /* Any */ | 2 /* Unknown */ | 32 /* String */ | 64 /* Number */ | 256 /* Boolean */ | 128 /* BigInt */ | 512 /* ESSymbol */ | 16 /* Void */ | 4 /* Undefined */ | 8 /* Null */ | 262144 /* Never */ | 131072 /* NonPrimitive */)) { + } else if (t1.flags & 1048576 /* Object */) { + const c2 = compareSymbols(t1.symbol, t2.symbol); + if (c2 !== 0) return c2; + if (getObjectFlags(t1) & 4 /* Reference */ && getObjectFlags(t2) & 4 /* Reference */) { + const r1 = t1; + const r2 = t2; + if (getObjectFlags(r1.target) & 8 /* Tuple */ && getObjectFlags(r2.target) & 8 /* Tuple */) { + const c3 = compareTupleTypes(r1.target, r2.target); + if (c3 !== 0) { + return c3; + } + } + if (r1.node === void 0 && r2.node === void 0) { + 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 /* Reference */) { + return -1; + } else if (getObjectFlags(t2) & 4 /* Reference */) { + return 1; + } else { + let c3 = (getObjectFlags(t1) & 142607679 /* ObjectTypeKindMask */) - (getObjectFlags(t2) & 142607679 /* ObjectTypeKindMask */); + if (c3 !== 0) { + return c3; + } + c3 = compareTypeMappers(t1.mapper, t2.mapper); + if (c3 !== 0) { + return c3; + } + } + } else if (t1.flags & 134217728 /* Union */) { + const o1 = t1.origin; + const o2 = t2.origin; + if (o1 === void 0 && o2 === void 0) { + const c2 = compareTypeLists(t1.types, t2.types); + if (c2 !== 0) { + return c2; + } + } else if (o1 === void 0) { + return 1; + } else if (o2 === void 0) { + return -1; + } else { + const c2 = compareTypes(o1, o2); + if (c2 !== 0) { + return c2; + } + } + } else if (t1.flags & 268435456 /* Intersection */) { + const c2 = compareTypeLists(t1.types, t2.types); + if (c2 !== 0) { + return c2; + } + } else if (t1.flags & (65536 /* Enum */ | 32768 /* EnumLiteral */ | 16384 /* UniqueESSymbol */)) { + const c2 = compareSymbols(t1.symbol, t2.symbol); + if (c2 !== 0) { + return c2; + } + } else if (t1.flags & 1024 /* StringLiteral */) { + const c2 = compareComparableValues(t1.value, t2.value); + if (c2 !== 0) { + return c2; + } + } else if (t1.flags & 2048 /* NumberLiteral */) { + const c2 = compareComparableValues(t1.value, t2.value); + if (c2 !== 0) { + return c2; + } + } else if (t1.flags & 8192 /* BooleanLiteral */) { + const b1 = t1.intrinsicName === "true"; + const b2 = t2.intrinsicName === "true"; + if (b1 !== b2) { + if (b1) { + return 1; + } + return -1; + } + } else if (t1.flags & 524288 /* TypeParameter */) { + const c2 = compareSymbols(t1.symbol, t2.symbol); + if (c2 !== 0) { + return c2; + } + } else if (t1.flags & 2097152 /* Index */) { + 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 /* IndexedAccess */) { + 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 /* Conditional */) { + 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 /* Substitution */) { + 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 /* TemplateLiteral */) { + 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 /* StringMapping */) { + 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 /* EnumLiteral */ | 65536 /* Enum */) && !(t.flags & 134217728 /* Union */)) { + return 65536 /* Enum */; + } + return t.flags; + } + function compareTypeNames(t1, t2) { + const s1 = getTypeNameSymbol(t1); + const s2 = getTypeNameSymbol(t2); + if (s1 === s2) { + if (t1.aliasTypeArguments !== void 0) { + return compareTypeLists(t1.aliasTypeArguments, t2.aliasTypeArguments); + } + return 0; + } + if (s1 === void 0) { + return 1; + } + if (s2 === void 0) { + return -1; + } + return compareComparableValues(s1.escapedName, s2.escapedName); + } + function getTypeNameSymbol(t) { + if (t.aliasSymbol !== void 0) { + return t.aliasSymbol; + } + if (t.flags & (524288 /* TypeParameter */ | 8388608 /* StringMapping */) || getObjectFlags(t) & (3 /* ClassOrInterface */ | 4 /* Reference */)) { + return t.symbol; + } + return void 0; + } + 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 ? void 0 : _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 === void 0) { + return -1; + } + if (n2 === void 0) { + 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 ? void 0 : s2[i]); + if (c !== 0) return c; + } + return 0; + } + function compareTypeMappers(m1, m2) { + if (m1 === m2) { + return 0; + } + if (m1 === void 0) { + return 1; + } + if (m2 === void 0) { + return -1; + } + const kind1 = m1.kind; + const kind2 = m2.kind; + if (kind1 !== kind2) { + return kind1 - kind2; + } + switch (kind1) { + case 0 /* Simple */: { + const c = compareTypes(m1.source, m2.source); + if (c !== 0) { + return c; + } + return compareTypes(m1.target, m2.target); + } + case 1 /* Array */: { + const c = compareTypeLists(m1.sources, m2.sources); + if (c !== 0) { + return c; + } + return compareTypeLists(m1.targets, m2.targets); + } + case 5 /* Merged */: { + 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); @@ -94942,7 +95593,7 @@ function createBasicNodeBuilderModuleSpecifierResolutionHost(host) { isSourceOfProjectReferenceRedirect: (fileName) => host.isSourceOfProjectReferenceRedirect(fileName), fileExists: (fileName) => host.fileExists(fileName), getFileIncludeReasons: () => host.getFileIncludeReasons(), - readFile: host.readFile ? (fileName) => host.readFile(fileName) : void 0, + readFile: host.readFile ? ((fileName) => host.readFile(fileName)) : void 0, getDefaultResolutionModeForFile: (file) => host.getDefaultResolutionModeForFile(file), getModeForResolutionAtIndex: (file, index) => host.getModeForResolutionAtIndex(file, index), getGlobalTypingsCacheLocation: maybeBind(host, host.getGlobalTypingsCacheLocation) @@ -95001,11 +95652,11 @@ var SymbolTrackerImpl = class _SymbolTrackerImpl { this.inner.reportCyclicStructureError(); } } - reportLikelyUnsafeImportRequiredError(specifier) { + reportLikelyUnsafeImportRequiredError(specifier, symbolName2) { var _a; if ((_a = this.inner) == null ? void 0 : _a.reportLikelyUnsafeImportRequiredError) { this.onDiagnosticReported(); - this.inner.reportLikelyUnsafeImportRequiredError(specifier); + this.inner.reportLikelyUnsafeImportRequiredError(specifier, symbolName2); } } reportTruncationError() { @@ -98552,7 +99203,7 @@ function transformTypeScript(context) { } } function visitSourceFile(node) { - const alwaysStrict = getStrictOptionValue(compilerOptions, "alwaysStrict") && !(isExternalModule(node) && moduleKind >= 5 /* ES2015 */) && !isJsonSourceFile(node); + const alwaysStrict = getAlwaysStrict(compilerOptions) && !(isExternalModule(node) && moduleKind >= 5 /* ES2015 */) && !isJsonSourceFile(node); return factory2.updateSourceFile( node, visitLexicalEnvironment( @@ -98597,7 +99248,7 @@ function transformTypeScript(context) { } function visitClassDeclaration(node) { const facts = getClassFacts(node); - const promoteToIIFE = languageVersion <= 1 /* ES5 */ && !!(facts & 7 /* MayNeedImmediatelyInvokedFunctionExpression */); + const promoteToIIFE = languageVersion < 2 /* ES2015 */ && !!(facts & 7 /* MayNeedImmediatelyInvokedFunctionExpression */); if (!isClassLikeDeclarationWithTypeScriptSyntax(node) && !classOrConstructorParameterIsDecorated(legacyDecorators, node) && !isExportOfNamespace(node)) { return factory2.updateClassDeclaration( node, @@ -98732,6 +99383,9 @@ function transformTypeScript(context) { 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( /*modifiers*/ void 0, @@ -103830,7 +104484,7 @@ function transformESDecorators(context) { } else { Debug.assertIsDefined(node.name, "A class declaration that is not a default export must have a name."); const iife = transformClassLike(node); - const modifierVisitorNoExport = isExport ? (node2) => isExportModifier(node2) ? void 0 : modifierVisitor(node2) : modifierVisitor; + const modifierVisitorNoExport = isExport ? ((node2) => isExportModifier(node2) ? void 0 : modifierVisitor(node2)) : modifierVisitor; const modifiers = visitNodes2(node.modifiers, modifierVisitorNoExport, isModifier); const declName = factory2.getLocalName( node, @@ -107473,8 +108127,6 @@ function transformESNext(context) { return visitForStatement(node); case 251 /* ForOfStatement */: return visitForOfStatement(node); - case 256 /* SwitchStatement */: - return visitSwitchStatement(node); default: return visitEachChild(node, visitor, context); } @@ -107638,60 +108290,6 @@ function transformESNext(context) { } return visitEachChild(node, visitor, context); } - function visitCaseOrDefaultClause(node, envBinding) { - if (getUsingKindOfStatements(node.statements) !== 0 /* None */) { - if (isCaseClause(node)) { - return factory2.updateCaseClause( - node, - visitNode(node.expression, visitor, isExpression), - transformUsingDeclarations( - node.statements, - /*start*/ - 0, - node.statements.length, - envBinding, - /*topLevelStatements*/ - void 0 - ) - ); - } else { - return factory2.updateDefaultClause( - node, - transformUsingDeclarations( - node.statements, - /*start*/ - 0, - node.statements.length, - envBinding, - /*topLevelStatements*/ - void 0 - ) - ); - } - } - 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 /* Async */ - ); - } - return visitEachChild(node, visitor, context); - } function transformUsingDeclarations(statementsIn, start, end, envBinding, topLevelStatements) { const statements = []; for (let i = start; i < end; i++) { @@ -108057,15 +108655,6 @@ function getUsingKindOfStatements(statements) { } return result; } -function getUsingKindOfCaseOrDefaultClauses(clauses) { - let result = 0 /* None */; - for (const clause of clauses) { - const usingKind = getUsingKindOfStatements(clause.statements); - if (usingKind === 2 /* Async */) return 2 /* Async */; - if (usingKind > result) result = usingKind; - } - return result; -} // src/compiler/transformers/jsx.ts function transformJsx(context) { @@ -108296,7 +108885,7 @@ function transformJsx(context) { node.children, isChild, /*location*/ - node + createRange(skipTrivia(currentSourceFile.text, node.pos), node.end) ); } function visitJsxSelfClosingElement(node, isChild) { @@ -108307,7 +108896,7 @@ function transformJsx(context) { void 0, isChild, /*location*/ - node + createRange(skipTrivia(currentSourceFile.text, node.pos), node.end) ); } function visitJsxFragment(node, isChild) { @@ -108317,7 +108906,7 @@ function transformJsx(context) { node.children, isChild, /*location*/ - node + createRange(skipTrivia(currentSourceFile.text, node.pos), node.end) ); } function convertJsxChildrenToChildrenPropObject(children) { @@ -114393,7 +114982,7 @@ function transformModule(context) { 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()); @@ -116406,7 +116995,7 @@ function transformSystemModule(context) { 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( @@ -118622,9 +119211,13 @@ function transformDeclarations(context) { 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() { @@ -118669,11 +119262,9 @@ function transformDeclarations(context) { rawReferencedFiles = []; rawTypeReferenceDirectives = []; rawLibReferenceDirectives = []; - let hasNoDefaultLib = false; const bundle = factory2.createBundle( map(node.sourceFiles, (sourceFile) => { if (sourceFile.isDeclarationFile) return void 0; - hasNoDefaultLib = hasNoDefaultLib || sourceFile.hasNoDefaultLib; currentSourceFile = sourceFile; enclosingDeclaration = sourceFile; lateMarkedStatements = void 0; @@ -118734,7 +119325,6 @@ function transformDeclarations(context) { bundle.syntheticFileReferences = getReferencedFiles(outputFilePath2); bundle.syntheticTypeReferences = getTypeReferences(); bundle.syntheticLibReferences = getLibReferences(); - bundle.hasNoDefaultLib = hasNoDefaultLib; return bundle; } needsDeclare = true; @@ -118775,7 +119365,8 @@ function transformDeclarations(context) { true, getReferencedFiles(outputFilePath), getTypeReferences(), - node.hasNoDefaultLib, + /*hasNoDefaultLib*/ + false, getLibReferences() ); function collectFileReferences(sourceFile) { @@ -119799,6 +120390,7 @@ function transformDeclarations(context) { if (isOmittedExpression(elem)) continue; if (isBindingPattern(elem.name)) { elems = concatenate(elems, walkBindingPattern(elem.name)); + continue; } elems = elems || []; elems.push(factory2.createPropertyDeclaration( @@ -120685,7 +121277,7 @@ function getCommonSourceDirectory(options, emittedFiles, currentDirectory, getCa if (options.rootDir) { commonSourceDirectory = getNormalizedAbsolutePath(options.rootDir, currentDirectory); checkSourceFilesBelongToPath == null ? void 0 : checkSourceFilesBelongToPath(options.rootDir); - } else if (options.composite && options.configFilePath) { + } else if (options.configFilePath) { commonSourceDirectory = getDirectoryPath(normalizeSlashes(options.configFilePath)); checkSourceFilesBelongToPath == null ? void 0 : checkSourceFilesBelongToPath(commonSourceDirectory); } else { @@ -120696,6 +121288,13 @@ function getCommonSourceDirectory(options, emittedFiles, currentDirectory, getCa } 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, @@ -122440,7 +123039,7 @@ function createPrinter(printerOptions = {}, handlers = {}) { increaseIndent(); } const preferNewLine = node.multiLine ? 65536 /* PreferNewLine */ : 0 /* None */; - const allowTrailingComma = currentSourceFile && currentSourceFile.languageVersion >= 1 /* ES5 */ && !isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */; + const allowTrailingComma = currentSourceFile && !isJsonSourceFile(currentSourceFile) ? 64 /* AllowTrailingComma */ : 0 /* None */; emitList(node, node.properties, 526226 /* ObjectLiteralExpressionProperties */ | allowTrailingComma | preferNewLine); if (indentedFlag) { decreaseIndent(); @@ -123945,16 +124544,12 @@ function createPrinter(printerOptions = {}, handlers = {}) { 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); + if (node.isDeclarationFile) 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(); @@ -126947,7 +127542,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi 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; @@ -127035,6 +127629,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi 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() : void 0; let resolvedProjectReferences; @@ -127096,8 +127691,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi name, /*isDefaultLib*/ false, - /*ignoreNoDefaultLib*/ - false, { kind: 0 /* RootFile */, index } )); (_j = tracing) == null ? void 0 : _j.pop(); @@ -127129,15 +127722,14 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi } (_n = tracing) == null ? void 0 : _n.pop(); } - if (rootNames.length && !skipDefaultLib) { + if (rootNames.length && !options.noLib) { const defaultLibraryFileName = getDefaultLibraryFileName(); if (!options.lib && defaultLibraryFileName) { + libFiles.add(toPath3(defaultLibraryFileName)); processRootFile( defaultLibraryFileName, /*isDefaultLib*/ true, - /*ignoreNoDefaultLib*/ - false, { kind: 6 /* LibFile */ } ); } else { @@ -127146,8 +127738,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi pathForLibFile(libFileName), /*isDefaultLib*/ true, - /*ignoreNoDefaultLib*/ - false, { kind: 6 /* LibFile */, index } ); }); @@ -127658,8 +128248,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi structureIsReused = 1 /* SafeModules */; } else if (!arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) { structureIsReused = 1 /* SafeModules */; - } else if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { - structureIsReused = 1 /* SafeModules */; } else if (!arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) { structureIsReused = 1 /* SafeModules */; } else { @@ -127730,6 +128318,9 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi 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) => { @@ -127841,24 +128432,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi 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)); @@ -128339,11 +128913,10 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi function getConfigFileParsingDiagnostics2() { return configFileParsingDiagnostics || emptyArray; } - function processRootFile(fileName, isDefaultLib, ignoreNoDefaultLib, reason) { + function processRootFile(fileName, isDefaultLib, reason) { processSourceFile( normalizePath(fileName), isDefaultLib, - ignoreNoDefaultLib, /*packageId*/ void 0, reason @@ -128508,10 +129081,10 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi return sourceFileWithAddedExtension; } } - function processSourceFile(fileName, isDefaultLib, ignoreNoDefaultLib, packageId, reason) { + function processSourceFile(fileName, isDefaultLib, packageId, reason) { getSourceFileFromReferenceWorker( fileName, - (fileName2) => findSourceFile(fileName2, isDefaultLib, ignoreNoDefaultLib, reason, packageId), + (fileName2) => findSourceFile(fileName2, isDefaultLib, reason, packageId), // TODO: GH#18217 (diagnostic, ...args) => addFilePreprocessingFileExplainingDiagnostic( /*file*/ @@ -128528,8 +129101,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi fileName, /*isDefaultLib*/ false, - /*ignoreNoDefaultLib*/ - false, /*packageId*/ void 0, reason @@ -128555,14 +129126,14 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi 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 ? void 0 : _a2.push(tracing.Phase.Program, "findSourceFile", { fileName, isDefaultLib: isDefaultLib || void 0, fileIncludeKind: FileIncludeKind[reason.kind] }); - const result = findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId); + const result = findSourceFileWorker(fileName, isDefaultLib, reason, packageId); (_b2 = tracing) == null ? void 0 : _b2.pop(); return result; } @@ -128572,7 +129143,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi 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) { @@ -128582,7 +129153,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi if (realPath2 !== path) source = getRedirectFromOutput(realPath2); } if (source == null ? void 0 : source.source) { - const file2 = findSourceFile(source.source, isDefaultLib, ignoreNoDefaultLib, reason, packageId); + const file2 = findSourceFile(source.source, isDefaultLib, reason, packageId); if (file2) addFileToFilesByName( file2, path, @@ -128702,7 +129273,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi filesByNameIgnoreCase.set(pathLowerCase, file); } } - skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib && !ignoreNoDefaultLib; if (!options.noResolve) { processReferencedFiles(file, isDefaultLib); processTypeReferenceDirectives(file); @@ -128763,8 +129333,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi processSourceFile( resolveTripleslashReference(ref.fileName, file.fileName), isDefaultLib, - /*ignoreNoDefaultLib*/ - false, /*packageId*/ void 0, { kind: 4 /* ReferenceFile */, file: file.path, index } @@ -128805,8 +129373,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi resolvedTypeReferenceDirective.resolvedFileName, /*isDefaultLib*/ false, - /*ignoreNoDefaultLib*/ - false, resolvedTypeReferenceDirective.packageId, reason ); @@ -128826,13 +129392,14 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi if (existing) 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) { var _a2, _b2, _c2, _d2, _e2; const existing = resolvedLibProcessing == null ? void 0 : resolvedLibProcessing.get(libFileName); if (existing) return existing; - if (options.libReplacement === false) { + if (!options.libReplacement) { const result2 = { resolution: { resolvedModule: void 0 @@ -128884,8 +129451,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi pathForLibFile(libFileName), /*isDefaultLib*/ true, - /*ignoreNoDefaultLib*/ - true, { kind: 7 /* LibReferenceDirective */, file: file.path, index } ); } else { @@ -128933,8 +129498,6 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi resolvedFileName, /*isDefaultLib*/ false, - /*ignoreNoDefaultLib*/ - false, { kind: 3 /* Import */, file: file.path, index }, resolution.packageId ); @@ -129038,10 +129601,9 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi } const getCommonSourceDirectory3 = memoize(() => getCommonSourceDirectoryOfConfig(resolvedRef.commandLine, !host.useCaseSensitiveFileNames())); commandLine.fileNames.forEach((fileName) => { - if (isDeclarationFileName(fileName)) return; const path = toPath3(fileName); let outputDts; - if (!fileExtensionIs(fileName, ".json" /* Json */)) { + if (!isDeclarationFileName(fileName) && !fileExtensionIs(fileName, ".json" /* Json */)) { if (!commandLine.options.outFile) { outputDts = getOutputDeclarationFileName(fileName, resolvedRef.commandLine, !host.useCaseSensitiveFileNames(), getCommonSourceDirectory3); mapOutputFileToResolvedRef.set(toPath3(outputDts), { resolvedRef, source: fileName }); @@ -129225,6 +129787,31 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi createDiagnosticForOptionName(Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir"); } } + if (!options.noEmit && !options.composite && !options.rootDir && options.configFilePath && (options.outDir || // there is --outDir specified + getEmitDeclarations(options) && options.declarationDir || // there is --declarationDir specified + options.outFile)) { + const dir = getCommonSourceDirectory2(); + const emittedFiles = mapDefined(files, (file) => !file.isDeclarationFile && sourceFileMayBeEmitted(file, program) ? file.fileName : void 0); + const dir59 = getComputedCommonSourceDirectory(emittedFiles, currentDirectory, getCanonicalFileName); + if (dir59 !== "" && getCanonicalFileName(dir) !== getCanonicalFileName(dir59)) { + createDiagnosticForOption( + /*onKey*/ + true, + options.outFile ? "outFile" : options.outDir ? "outDir" : "declarationDir", + !options.outFile && options.outDir ? "declarationDir" : void 0, + chainDiagnosticMessages( + chainDiagnosticMessages( + /*details*/ + void 0, + 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"); } @@ -129277,7 +129864,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi } } 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)) { @@ -129289,8 +129876,8 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi 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 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind) && moduleKind !== 200 /* Preserve */) { - createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "bundler"); + if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind) && moduleKind !== 200 /* Preserve */ && moduleKind !== 1 /* CommonJS */) { + 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 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) && !(3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */)) { const moduleKindName = ModuleKind[moduleKind]; @@ -129337,7 +129924,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi function getIgnoreDeprecationsVersion() { const ignoreDeprecations = options.ignoreDeprecations; if (ignoreDeprecations) { - if (ignoreDeprecations === "5.0") { + if (ignoreDeprecations === "5.0" || ignoreDeprecations === "6.0") { return new Version(ignoreDeprecations); } reportInvalidIgnoreDeprecations(); @@ -129352,32 +129939,35 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi const mustBeRemoved = !(removedInVersion.compareTo(typescriptVersion) === 1 /* GreaterThan */); const canBeSilenced = !mustBeRemoved && ignoreDeprecationsVersion.compareTo(deprecatedInVersion) === -1 /* LessThan */; if (mustBeRemoved || canBeSilenced) { - fn((name, value, useInstead) => { + fn((name, value, useInstead, related) => { if (mustBeRemoved) { if (value === void 0) { - 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 === void 0) { - 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( + let details = chainDiagnosticMessages( /*details*/ void 0, Diagnostics.Use_0_instead, useInstead ); + if (related) { + details = chainDiagnosticMessages(details, related); + } const chain = chainDiagnosticMessages(details, message, ...args); createDiagnosticForOption( /*onKey*/ @@ -129388,14 +129978,22 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi chain ); } else { + let details; + if (related) { + details = chainDiagnosticMessages( + /*details*/ + void 0, + related + ); + } + const chain = chainDiagnosticMessages(details, message, ...args); createDiagnosticForOption( /*onKey*/ !value, name, /*option2*/ void 0, - message, - ...args + chain ); } } @@ -129422,12 +130020,7 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi createDeprecatedDiagnostic("charset"); } if (options.out) { - createDeprecatedDiagnostic( - "out", - /*value*/ - void 0, - "outFile" - ); + createDeprecatedDiagnostic("out"); } if (options.importsNotUsedAsValues) { createDeprecatedDiagnostic( @@ -129446,9 +130039,89 @@ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _confi ); } }); + checkDeprecations("6.0", "7.0", createDiagnostic, (createDeprecatedDiagnostic) => { + if (options.alwaysStrict === false) { + createDeprecatedDiagnostic( + "alwaysStrict", + "false", + /*useInstead*/ + void 0, + /*related*/ + void 0 + ); + } + if (options.target === 1 /* ES5 */) { + createDeprecatedDiagnostic("target", "ES5"); + } + if (options.moduleResolution === 2 /* Node10 */) { + createDeprecatedDiagnostic( + "moduleResolution", + "node10", + /*useInstead*/ + void 0, + Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information + ); + } + if (options.moduleResolution === 1 /* Classic */) { + createDeprecatedDiagnostic( + "moduleResolution", + "classic", + /*useInstead*/ + void 0, + /*related*/ + void 0 + ); + } + if (options.baseUrl !== void 0) { + createDeprecatedDiagnostic( + "baseUrl", + /*value*/ + void 0, + /*useInstead*/ + void 0, + Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information + ); + } + if (options.esModuleInterop === false) { + createDeprecatedDiagnostic( + "esModuleInterop", + "false", + /*useInstead*/ + void 0, + /*related*/ + void 0 + ); + } + if (options.allowSyntheticDefaultImports === false) { + createDeprecatedDiagnostic( + "allowSyntheticDefaultImports", + "false", + /*useInstead*/ + void 0, + /*related*/ + void 0 + ); + } + if (options.outFile) { + createDeprecatedDiagnostic("outFile"); + } + if (options.module === 0 /* None */ || options.module === 2 /* AMD */ || options.module === 3 /* UMD */ || options.module === 4 /* System */) { + createDeprecatedDiagnostic( + "module", + ModuleKind[options.module], + /*useInstead*/ + void 0, + /*related*/ + void 0 + ); + } + if (options.downlevelIteration !== void 0) { + 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) => { @@ -130201,8 +130874,7 @@ function createProgramDiagnostics(getCompilerOptionsObjectLiteralSyntax) { reason.kind === 2 /* OutputFromProjectReference */ ? Diagnostics.File_is_output_from_referenced_project_specified_here : Diagnostics.File_is_source_from_referenced_project_specified_here ) : void 0; case 8 /* AutomaticTypeDirectiveFile */: - if (!options.types) return void 0; - 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 /* LibFile */: @@ -130712,7 +131384,7 @@ function createBuilderProgramState(newProgram, oldState) { } if (canCopySemanticDiagnostics) { if (sourceFile.isDeclarationFile && !copyDeclarationFileDiagnostics) return; - if (sourceFile.hasNoDefaultLib && !copyLibFileDiagnostics) return; + if (newProgram.isSourceFileDefaultLibrary(sourceFile) && !copyLibFileDiagnostics) return; const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath); if (diagnostics) { state.semanticDiagnosticsPerFile.set( @@ -132639,7 +133311,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW 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 = []; @@ -132660,7 +133332,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW resolutionHost.onDiscoveredSymlink(); } resolutionsInFile.set(name, mode, resolution); - if (resolution !== existingResolution) { + if (resolution !== existingResolution && !((_b = resolutionHost.skipWatchingFailedLookups) == null ? void 0 : _b.call(resolutionHost, path))) { watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName, deferWatchingNonRelativeResolution); if (existingResolution) { stopWatchFailedLookupLocationOfResolution(existingResolution, path, getResolutionWithResolvedFileName); @@ -132697,8 +133369,11 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW ); 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 ? void 0 : _a2.call(resolutionHost, path))) { + stopWatchFailedLookupLocationOfResolution(resolution, path, getResolutionWithResolvedFileName); + } resolutionsInFile.delete(name, mode); } }); @@ -133112,15 +133787,18 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW }, nonRecursive ? 0 /* None */ : 1 /* Recursive */); } 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 ? void 0 : _a.call(resolutionHost, filePath))) { + resolutions.forEach( + (resolution) => stopWatchFailedLookupLocationOfResolution( + resolution, + filePath, + getResolutionWithResolvedFileName + ) + ); + } cache.delete(filePath); } } @@ -133275,8 +133953,13 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW }, 1 /* Recursive */) : noopFileWatcher; } function updateTypeRootsWatch() { + var _a; const options = resolutionHost.getCompilationSettings(); - if (options.types) { + if (!usesWildcardTypes(options)) { + closeTypeRootsWatch(); + return; + } + if (!isRootWatchable || ((_a = resolutionHost.skipWatchingTypeRoots) == null ? void 0 : _a.call(resolutionHost))) { closeTypeRootsWatch(); return; } @@ -133629,7 +134312,7 @@ function fileIncludeReasonToDiagnostics(program, reason, fileNameConvertor) { options.outFile ? "--outFile" : "--out" ); case 8 /* AutomaticTypeDirectiveFile */: { - const messageAndArgs = options.types ? reason.packageId ? [Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions_with_packageId_1, reason.typeReference, packageIdToString(reason.packageId)] : [Diagnostics.Entry_point_of_type_library_0_specified_in_compilerOptions, reason.typeReference] : reason.packageId ? [Diagnostics.Entry_point_for_implicit_type_library_0_with_packageId_1, reason.typeReference, packageIdToString(reason.packageId)] : [Diagnostics.Entry_point_for_implicit_type_library_0, reason.typeReference]; + 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( /*details*/ void 0, @@ -133771,7 +134454,7 @@ var WatchType = { }; function createWatchFactory(host, options) { const watchLogLevel = host.trace ? options.extendedDiagnostics ? 2 /* Verbose */ : options.diagnostics ? 1 /* TriggerOnly */ : 0 /* None */ : 0 /* None */; - const writeLog = watchLogLevel !== 0 /* None */ ? (s) => host.trace(s) : noop; + const writeLog = watchLogLevel !== 0 /* None */ ? ((s) => host.trace(s)) : noop; const result = getWatchFactory(host, watchLogLevel, writeLog); result.writeLog = writeLog; return result; @@ -134105,7 +134788,7 @@ function createWatchProgram(host) { compilerHost.resolveTypeReferenceDirectiveReferences = resolutionCache.resolveTypeReferenceDirectiveReferences.bind(resolutionCache); } compilerHost.resolveLibrary = !host.resolveLibrary ? resolutionCache.resolveLibrary.bind(resolutionCache) : host.resolveLibrary.bind(host); - compilerHost.getModuleResolutionCache = host.resolveModuleNameLiterals || host.resolveModuleNames ? maybeBind(host, host.getModuleResolutionCache) : () => resolutionCache.getModuleResolutionCache(); + compilerHost.getModuleResolutionCache = host.resolveModuleNameLiterals || host.resolveModuleNames ? maybeBind(host, host.getModuleResolutionCache) : (() => resolutionCache.getModuleResolutionCache()); const userProvidedResolution = !!host.resolveModuleNameLiterals || !!host.resolveTypeReferenceDirectiveReferences || !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; const customHasInvalidatedResolutions = userProvidedResolution ? maybeBind(host, host.hasInvalidatedResolutions) || returnTrue : returnFalse; const customHasInvalidLibResolutions = host.resolveLibrary ? maybeBind(host, host.hasInvalidatedLibResolutions) || returnTrue : returnFalse; @@ -136498,7 +137181,13 @@ function updateReportDiagnostic(sys2, existing, options) { ) : 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") { @@ -136507,7 +137196,8 @@ function shouldBePretty(sys2, options) { 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); @@ -136823,7 +137513,7 @@ function printAllHelp(sys2, compilerOptions, buildOptions, watchOptions) { output = [...output, ...generateSectionOptionsOutput( sys2, getDiagnosticText(Diagnostics.WATCH_OPTIONS), - watchOptions, + filter(watchOptions, (option) => option.showInHelp !== false), /*subCategory*/ 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) @@ -136831,7 +137521,7 @@ function printAllHelp(sys2, compilerOptions, buildOptions, watchOptions) { output = [...output, ...generateSectionOptionsOutput( sys2, getDiagnosticText(Diagnostics.BUILD_OPTIONS), - filter(buildOptions, (option) => option !== tscBuildOption), + filter(buildOptions, (option) => option !== tscBuildOption && option.showInHelp !== false), /*subCategory*/ 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") @@ -136845,7 +137535,7 @@ function printBuildHelp(sys2, buildOptions) { output = [...output, ...generateSectionOptionsOutput( sys2, getDiagnosticText(Diagnostics.BUILD_OPTIONS), - filter(buildOptions, (option) => option !== tscBuildOption), + filter(buildOptions, (option) => option !== tscBuildOption && option.showInHelp !== false), /*subCategory*/ 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") @@ -136925,18 +137615,23 @@ function executeCommandLineWorker(sys2, cb, commandLine) { return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */); } } - } 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 /* DiagnosticsPresent_OutputsSkipped */); + } + } 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 /* DiagnosticsPresent_OutputsSkipped */); } - return sys2.exit(1 /* DiagnosticsPresent_OutputsSkipped */); } const currentDirectory = sys2.getCurrentDirectory(); const commandLineOptions = convertToOptionsWithAbsolutePaths( @@ -138826,7 +139521,7 @@ function discoverTypings(host, log, fileNames, projectRootPath, safeList, packag const filesToWatch = []; 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) => { @@ -140403,7 +141098,7 @@ function isInsideJsxElementOrAttribute(sourceFile, position) { if (token && token.kind === 20 /* CloseBraceToken */ && token.parent.kind === 295 /* JsxExpression */) { return true; } - if (token.kind === 31 /* LessThanSlashToken */ && token.parent.kind === 288 /* JsxClosingElement */) { + if (token.kind === 30 /* LessThanToken */ && token.parent.kind === 288 /* JsxClosingElement */) { return true; } return false; @@ -140431,7 +141126,7 @@ function isInJSXText(sourceFile, position) { function isInsideJsxElement(sourceFile, position) { function isInsideJsxElementTraversal(node) { while (node) { - if (node.kind >= 286 /* JsxSelfClosingElement */ && node.kind <= 295 /* JsxExpression */ || node.kind === 12 /* JsxText */ || node.kind === 30 /* LessThanToken */ || node.kind === 32 /* GreaterThanToken */ || node.kind === 80 /* Identifier */ || node.kind === 20 /* CloseBraceToken */ || node.kind === 19 /* OpenBraceToken */ || node.kind === 44 /* SlashToken */ || node.kind === 31 /* LessThanSlashToken */) { + if (node.kind >= 286 /* JsxSelfClosingElement */ && node.kind <= 295 /* JsxExpression */ || node.kind === 12 /* JsxText */ || node.kind === 30 /* LessThanToken */ || node.kind === 32 /* GreaterThanToken */ || node.kind === 80 /* Identifier */ || node.kind === 20 /* CloseBraceToken */ || node.kind === 19 /* OpenBraceToken */ || node.kind === 44 /* SlashToken */) { node = node.parent; } else if (node.kind === 285 /* JsxElement */) { if (position > node.getStart(sourceFile)) return true; @@ -140617,7 +141312,7 @@ function isStringOrRegularExpressionOrTemplateLiteral(kind) { return false; } function areIntersectedTypesAvoidingStringReduction(checker, t1, t2) { - return !!(t1.flags & 4 /* String */) && checker.isEmptyAnonymousObjectType(t2); + return !!(t1.flags & 32 /* String */) && checker.isEmptyAnonymousObjectType(t2); } function isStringAndEmptyAnonymousObjectIntersection(type) { if (!type.isIntersection()) { @@ -142404,7 +143099,7 @@ function forEachExternalModule(checker, allSourceFiles, excludePatterns, host, c function getIsExcluded(excludePatterns, host) { var _a; const realpathsWithSymlinks = (_a = host.getSymlinkCache) == null ? void 0 : _a.call(host).getSymlinkedDirectoriesByRealpath(); - return ({ fileName, path }) => { + return (({ fileName, path }) => { if (excludePatterns.some((p) => p.test(fileName))) return true; if ((realpathsWithSymlinks == null ? void 0 : realpathsWithSymlinks.size) && pathContainsNodeModules(fileName)) { let dir = getDirectoryPath(fileName); @@ -142421,7 +143116,7 @@ function getIsExcluded(excludePatterns, host) { ) ?? false; } return false; - }; + }); } function getIsFileExcluded(host, preferences) { if (!preferences.autoImportFileExcludePatterns) return () => false; @@ -144595,7 +145290,7 @@ function every2(s, pred, start = 0, end = s.length) { // src/services/preProcess.ts function preProcessFile(sourceText, readImportFiles = true, detectJavaScriptImports = false) { const pragmaContext = { - languageVersion: 1 /* ES5 */, + languageVersion: 12 /* LatestStandard */, // controls whether the token scanner considers unicode identifiers or not - shouldn't matter, since we're only using it for trivia pragmas: void 0, checkJsDirective: void 0, @@ -144603,7 +145298,6 @@ function preProcessFile(sourceText, readImportFiles = true, detectJavaScriptImpo typeReferenceDirectives: [], libReferenceDirectives: [], amdDependencies: [], - hasNoDefaultLib: void 0, moduleName: void 0 }; const importedFiles = []; @@ -144912,7 +145606,7 @@ function preProcessFile(sourceText, readImportFiles = true, detectJavaScriptImpo importedFiles.push(decl.ref); } } - return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, libReferenceDirectives: pragmaContext.libReferenceDirectives, importedFiles, isLibFile: !!pragmaContext.hasNoDefaultLib, ambientExternalModules: void 0 }; + return { referencedFiles: pragmaContext.referencedFiles, typeReferenceDirectives: pragmaContext.typeReferenceDirectives, libReferenceDirectives: pragmaContext.libReferenceDirectives, importedFiles, isLibFile: false, ambientExternalModules: void 0 }; } else { let ambientModuleNames; if (ambientExternalModules) { @@ -144927,7 +145621,7 @@ function preProcessFile(sourceText, readImportFiles = true, detectJavaScriptImpo } } } - 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 }; } } @@ -145301,8 +145995,7 @@ function transpileDeclaration(input, transpileOptions) { true ); } -var barebonesLibContent = `/// -interface Boolean {} +var barebonesLibContent = `interface Boolean {} interface Function {} interface CallableFunction {} interface NewableFunction {} @@ -145349,6 +146042,7 @@ function transpileWorker(input, transpileOptions, declaration) { 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 : void 0, @@ -145396,8 +146090,7 @@ function transpileWorker(input, transpileOptions, declaration) { } 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( /*to*/ @@ -145466,7 +146159,7 @@ __export(ts_NavigateTo_exports, { }); // src/services/navigateTo.ts -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; const rawItems = []; @@ -145476,26 +146169,26 @@ function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue 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 === void 0 ? 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)) continue; + if (!shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile, program)) continue; if (patternMatcher.patternContainsDots) { const fullMatch = patternMatcher.getFullMatch(getContainers(declaration), name); if (fullMatch) { @@ -145506,7 +146199,7 @@ function getItemsFromNamedDeclaration(patternMatcher, name, declarations, checke } } } -function shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile) { +function shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile, program) { var _a; switch (declaration.kind) { case 274 /* ImportClause */: @@ -145514,7 +146207,7 @@ function shouldKeepItem(declaration, checker, excludeLibFiles, singleCurrentFile case 272 /* ImportEqualsDeclaration */: const importer = checker.getSymbolAtLocation(declaration.name); const imported = checker.getAliasedSymbol(importer); - return importer.escapedName !== imported.escapedName && !((_a = imported.declarations) == null ? void 0 : _a.every((d) => shouldExcludeFile(d.getSourceFile(), excludeLibFiles, singleCurrentFile))); + return importer.escapedName !== imported.escapedName && !((_a = imported.declarations) == null ? void 0 : _a.every((d) => shouldExcludeFile(d.getSourceFile(), excludeLibFiles, singleCurrentFile, program))); default: return true; } @@ -145810,8 +146503,8 @@ function addChildrenRecursively(node) { addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; case 278 /* ExportAssignment */: { - const expression2 = node.expression; - const child = isObjectLiteralExpression(expression2) || isCallExpression(expression2) ? expression2 : isArrowFunction(expression2) || isFunctionExpression(expression2) ? expression2.body : void 0; + const expression2 = skipOuterExpressions(node.expression); + const child = isObjectLiteralExpression(expression2) || isCallExpression(expression2) || isClassExpression(expression2) ? expression2 : isArrowFunction(expression2) || isFunctionExpression(expression2) ? expression2.body : void 0; if (child) { startNode(node); addChildrenRecursively(child); @@ -151107,7 +151800,7 @@ function collectReadsAndWrites(targetRange, scopes, enclosingTextRange, sourceFi const start = first(statements).getStart(); const end = last(statements).end; expressionDiagnostic = createFileDiagnostic(sourceFile, start, end - start, Messages.expressionExpected); - } else if (checker.getTypeAtLocation(expression).flags & (16384 /* Void */ | 131072 /* Never */)) { + } else if (checker.getTypeAtLocation(expression).flags & (16 /* Void */ | 262144 /* Never */)) { expressionDiagnostic = createDiagnosticForNode(expression, Messages.uselessConstantType); } for (const scope of scopes) { @@ -151873,9 +152566,7 @@ function createChildren(node, sourceFile) { }); return children; } - const languageVariant = (sourceFile == null ? void 0 : sourceFile.languageVariant) ?? 0 /* Standard */; scanner.setText((sourceFile || node.getSourceFile()).text); - scanner.setLanguageVariant(languageVariant); let pos = node.pos; const processNode = (child) => { addSyntheticNodes(children, pos, child.pos, node); @@ -151892,7 +152583,6 @@ function createChildren(node, sourceFile) { node.forEachChild(processNode, processNodes); addSyntheticNodes(children, pos, node.end, node); scanner.setText(void 0); - scanner.setLanguageVariant(0 /* Standard */); return children; } function addSyntheticNodes(nodes, pos, end, parent2) { @@ -152158,25 +152848,25 @@ var TypeObject = class { return this.checker.getDefaultFromTypeParameter(this); } isUnion() { - return !!(this.flags & 1048576 /* Union */); + return !!(this.flags & 134217728 /* Union */); } isIntersection() { - return !!(this.flags & 2097152 /* Intersection */); + return !!(this.flags & 268435456 /* Intersection */); } isUnionOrIntersection() { - return !!(this.flags & 3145728 /* UnionOrIntersection */); + return !!(this.flags & 402653184 /* UnionOrIntersection */); } isLiteral() { - return !!(this.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */ | 2048 /* BigIntLiteral */)); + return !!(this.flags & (1024 /* StringLiteral */ | 2048 /* NumberLiteral */ | 4096 /* BigIntLiteral */)); } isStringLiteral() { - return !!(this.flags & 128 /* StringLiteral */); + return !!(this.flags & 1024 /* StringLiteral */); } isNumberLiteral() { - return !!(this.flags & 256 /* NumberLiteral */); + return !!(this.flags & 2048 /* NumberLiteral */); } isTypeParameter() { - return !!(this.flags & 262144 /* TypeParameter */); + return !!(this.flags & 524288 /* TypeParameter */); } isClassOrInterface() { return !!(getObjectFlags(this) & 3 /* ClassOrInterface */); @@ -152185,7 +152875,7 @@ var TypeObject = class { return !!(getObjectFlags(this) & 1 /* Class */); } isIndexType() { - return !!(this.flags & 4194304 /* Index */); + return !!(this.flags & 2097152 /* Index */); } /** * This polyfills `referenceType.typeArguments` for API consumers @@ -152496,7 +153186,7 @@ function displayPartsToString(displayParts) { } function getDefaultCompilerOptions2() { return { - target: 1 /* ES5 */, + target: 12 /* LatestStandard */, jsx: 1 /* Preserve */ }; } @@ -153322,7 +154012,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h 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(); @@ -154100,6 +154790,7 @@ function getSymbolAtLocationForQuickInfo(node, checker) { return checker.getSymbolAtLocation(node); } function getPropertySymbolsFromContextualType(node, checker, contextualType, unionSymbolOk) { + contextualType = contextualType.getNonNullableType(); const name = getNameFromPropertyName(node.name); if (!name) return emptyArray; if (!contextualType.isUnion()) { @@ -160919,7 +161610,7 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) { return { kind: 0 /* TypeLikeDeclaration */, token, call, modifierFlags, parentDeclaration: declaration, declSourceFile, isJSFile }; } const enumDeclaration = find(symbol.declarations, isEnumDeclaration); - if (enumDeclaration && !(leftExpressionType.flags & 1056 /* EnumLike */) && !isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { + if (enumDeclaration && !(leftExpressionType.flags & 98304 /* EnumLike */) && !isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { return { kind: 1 /* Enum */, token, parentDeclaration: enumDeclaration }; } return void 0; @@ -161095,7 +161786,7 @@ function addMethodDeclaration(context, changes, callExpression, name, modifierFl function addEnumMemberDeclaration(changes, checker, { token, parentDeclaration }) { const hasStringInitializer = some(parentDeclaration.members, (member) => { const type = checker.getTypeAtLocation(member); - return !!(type && type.flags & 402653316 /* StringLike */); + return !!(type && type.flags & 12583968 /* StringLike */); }); const sourceFile = parentDeclaration.getSourceFile(); const enumMember = factory.createEnumMember(token, hasStringInitializer ? factory.createStringLiteral(token.text) : void 0); @@ -161183,23 +161874,23 @@ function tryGetValueFromType(context, checker, importAdder, quotePreference, typ if (type.flags & 3 /* AnyOrUnknown */) { return createUndefined(); } - if (type.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) { + if (type.flags & (32 /* String */ | 4194304 /* TemplateLiteral */)) { return factory.createStringLiteral( "", /* isSingleQuote */ quotePreference === 0 /* Single */ ); } - if (type.flags & 8 /* Number */) { + if (type.flags & 64 /* Number */) { return factory.createNumericLiteral(0); } - if (type.flags & 64 /* BigInt */) { + if (type.flags & 128 /* BigInt */) { return factory.createBigIntLiteral("0n"); } - if (type.flags & 16 /* Boolean */) { + if (type.flags & 256 /* Boolean */) { return factory.createFalse(); } - if (type.flags & 1056 /* EnumLike */) { + if (type.flags & 98304 /* EnumLike */) { const enumMember = type.symbol.exports ? firstOrUndefinedIterator(type.symbol.exports.values()) : type.symbol; const symbol = type.symbol.parent && type.symbol.parent.flags & 256 /* RegularEnum */ ? type.symbol.parent : type.symbol; const name = checker.symbolToExpression( @@ -161212,29 +161903,29 @@ function tryGetValueFromType(context, checker, importAdder, quotePreference, typ ); return enumMember === void 0 || name === void 0 ? factory.createNumericLiteral(0) : factory.createPropertyAccessExpression(name, checker.symbolToString(enumMember)); } - if (type.flags & 256 /* NumberLiteral */) { + if (type.flags & 2048 /* NumberLiteral */) { return factory.createNumericLiteral(type.value); } - if (type.flags & 2048 /* BigIntLiteral */) { + if (type.flags & 4096 /* BigIntLiteral */) { return factory.createBigIntLiteral(type.value); } - if (type.flags & 128 /* StringLiteral */) { + if (type.flags & 1024 /* StringLiteral */) { return factory.createStringLiteral( type.value, /* isSingleQuote */ quotePreference === 0 /* Single */ ); } - if (type.flags & 512 /* BooleanLiteral */) { + if (type.flags & 8192 /* BooleanLiteral */) { return type === checker.getFalseType() || type === checker.getFalseType( /*fresh*/ true ) ? factory.createFalse() : factory.createTrue(); } - if (type.flags & 65536 /* Null */) { + if (type.flags & 8 /* Null */) { return factory.createNull(); } - if (type.flags & 1048576 /* Union */) { + if (type.flags & 134217728 /* Union */) { const expression = firstDefined(type.types, (t) => tryGetValueFromType(context, checker, importAdder, quotePreference, t, enclosingDeclaration)); return expression ?? createUndefined(); } @@ -161294,7 +161985,7 @@ function createUndefined() { return factory.createIdentifier("undefined"); } function isObjectLiteralType(type) { - return type.flags & 524288 /* Object */ && (getObjectFlags(type) & 128 /* ObjectLiteral */ || type.symbol && tryCast(singleOrUndefined(type.symbol.declarations), isTypeLiteralNode)); + return type.flags & 1048576 /* Object */ && (getObjectFlags(type) & 128 /* ObjectLiteral */ || type.symbol && tryCast(singleOrUndefined(type.symbol.declarations), isTypeLiteralNode)); } function getUnmatchedAttributes(checker, target, source) { const attrsType = checker.getContextualType(source.attributes); @@ -161639,6 +162330,8 @@ var errorCannotFindImplicitJsxImport = Diagnostics.This_JSX_tag_requires_the_mod 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({ @@ -161689,7 +162382,13 @@ function tryGetImportedPackageName(sourceFile, pos) { } function getTypesPackageNameToInstall(packageName, host, diagCode) { var _a; - return diagCode === errorCodeCannotFindModule ? nodeCoreModules.has(packageName) ? "@types/node" : void 0 : ((_a = host.isKnownTypesPackageName) == null ? void 0 : _a.call(host, packageName)) ? getTypesPackageName(packageName) : void 0; + if (nodeCoreModules.has(packageName)) { + return "@types/node"; + } + if (diagCode !== errorCodeCannotFindModule) { + return ((_a = host.isKnownTypesPackageName) == null ? void 0 : _a.call(host, packageName)) ? getTypesPackageName(packageName) : void 0; + } + return void 0; } // src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts @@ -162691,7 +163390,7 @@ registerCodeFix({ const info = getInfo15(err.file, err.start, checker); if (!info) return; const { typeNode, type } = info; - const fixedType = typeNode.kind === 315 /* JSDocNullableType */ && fixId56 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type; + const fixedType = typeNode.kind === 315 /* JSDocNullableType */ && fixId56 === fixIdNullable ? checker.getNullableType(type, 4 /* Undefined */) : type; doChange29(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -162980,7 +163679,7 @@ function withContext(context, typePrintMode, cb) { } const variableDeclaration = findAncestor(targetNode, isVariableDeclaration); const type = variableDeclaration && typeChecker.getTypeAtLocation(variableDeclaration); - if (type && type.flags & 8192 /* UniqueESSymbol */) { + if (type && type.flags & 16384 /* UniqueESSymbol */) { return void 0; } if (!(isExpressionTarget || isShorthandPropertyAssignmentTarget)) return void 0; @@ -163461,7 +164160,7 @@ function withContext(context, typePrintMode, cb) { mutatedTarget: false }; function getFlags(type2) { - return (isVariableDeclaration(node) || isPropertyDeclaration(node) && hasSyntacticModifier(node, 256 /* Static */ | 8 /* Readonly */)) && type2.flags & 8192 /* UniqueESSymbol */ ? 1048576 /* AllowUniqueESSymbolType */ : 0 /* None */; + return (isVariableDeclaration(node) || isPropertyDeclaration(node) && hasSyntacticModifier(node, 256 /* Static */ | 8 /* Readonly */)) && type2.flags & 16384 /* UniqueESSymbol */ ? 1048576 /* AllowUniqueESSymbolType */ : 0 /* None */; } } function createTypeOfFromEntityNameExpression(node) { @@ -164441,7 +165140,7 @@ function inferTypeFromReferences(program, references, cancellationToken) { case 32 /* GreaterThanToken */: case 34 /* GreaterThanEqualsToken */: const operandType = checker.getTypeAtLocation(parent2.left === node ? parent2.right : parent2.left); - if (operandType.flags & 1056 /* EnumLike */) { + if (operandType.flags & 98304 /* EnumLike */) { addCandidateType(usage, operandType); } else { usage.isNumber = true; @@ -164450,11 +165149,11 @@ function inferTypeFromReferences(program, references, cancellationToken) { case 65 /* PlusEqualsToken */: case 40 /* PlusToken */: const otherOperandType = checker.getTypeAtLocation(parent2.left === node ? parent2.right : parent2.left); - if (otherOperandType.flags & 1056 /* EnumLike */) { + if (otherOperandType.flags & 98304 /* EnumLike */) { addCandidateType(usage, otherOperandType); - } else if (otherOperandType.flags & 296 /* NumberLike */) { + } else if (otherOperandType.flags & 67648 /* NumberLike */) { usage.isNumber = true; - } else if (otherOperandType.flags & 402653316 /* StringLike */) { + } else if (otherOperandType.flags & 12583968 /* StringLike */) { usage.isString = true; } else if (otherOperandType.flags & 1 /* Any */) { } else { @@ -164531,7 +165230,7 @@ function inferTypeFromReferences(program, references, cancellationToken) { const indexType = checker.getTypeAtLocation(parent2.argumentExpression); const indexUsage = createEmptyUsage(); calculateUsageOfNode(parent2, indexUsage); - if (indexType.flags & 296 /* NumberLike */) { + if (indexType.flags & 67648 /* NumberLike */) { usage.numberIndex = indexUsage; } else { usage.stringIndex = indexUsage; @@ -164569,11 +165268,11 @@ function inferTypeFromReferences(program, references, cancellationToken) { low: (t) => t === stringNumber }, { - high: (t) => !(t.flags & (1 /* Any */ | 16384 /* Void */)), - low: (t) => !!(t.flags & (1 /* Any */ | 16384 /* Void */)) + high: (t) => !(t.flags & (1 /* Any */ | 16 /* Void */)), + low: (t) => !!(t.flags & (1 /* Any */ | 16 /* Void */)) }, { - high: (t) => !(t.flags & (98304 /* Nullable */ | 1 /* Any */ | 16384 /* Void */)) && !(getObjectFlags(t) & 16 /* Anonymous */), + high: (t) => !(t.flags & (12 /* Nullable */ | 1 /* Any */ | 16 /* Void */)) && !(getObjectFlags(t) & 16 /* Anonymous */), low: (t) => !!(getObjectFlags(t) & 16 /* Anonymous */) } ]; @@ -164730,7 +165429,7 @@ function inferTypeFromReferences(program, references, cancellationToken) { function inferTypeParameters(genericType, usageType, typeParameter) { if (genericType === typeParameter) { return [usageType]; - } else if (genericType.flags & 3145728 /* UnionOrIntersection */) { + } else if (genericType.flags & 402653184 /* UnionOrIntersection */) { return flatMap(genericType.types, (t) => inferTypeParameters(t, usageType, typeParameter)); } else if (getObjectFlags(genericType) & 4 /* Reference */ && getObjectFlags(usageType) & 4 /* Reference */) { const genericArgs = checker.getTypeArguments(genericType); @@ -164813,12 +165512,12 @@ function inferTypeFromReferences(program, references, cancellationToken) { ); } function addCandidateType(usage, type) { - if (type && !(type.flags & 1 /* Any */) && !(type.flags & 131072 /* Never */)) { + if (type && !(type.flags & 1 /* Any */) && !(type.flags & 262144 /* Never */)) { (usage.candidateTypes || (usage.candidateTypes = [])).push(type); } } function addCandidateThisType(usage, type) { - if (type && !(type.flags & 1 /* Any */) && !(type.flags & 131072 /* Never */)) { + if (type && !(type.flags & 1 /* Any */) && !(type.flags & 262144 /* Never */)) { (usage.candidateThisTypes || (usage.candidateThisTypes = [])).push(type); } } @@ -165405,7 +166104,7 @@ function typeContainsTypeParameter(type) { if (type.isUnionOrIntersection()) { return type.types.some(typeContainsTypeParameter); } - return type.flags & 262144 /* TypeParameter */; + return type.flags & 524288 /* TypeParameter */; } function getArgumentTypesAndTypeParameters(checker, importAdder, instanceTypes, contextNode, scriptTarget, flags, internalFlags, tracker) { const argumentTypeNodes = []; @@ -165433,11 +166132,11 @@ function getArgumentTypesAndTypeParameters(checker, importAdder, instanceTypes, return { argumentTypeNodes, argumentTypeParameters: arrayFrom(argumentTypeParameters.entries()) }; } function isAnonymousObjectConstraintType(type) { - return type.flags & 524288 /* Object */ && type.objectFlags === 16 /* Anonymous */; + return type.flags & 1048576 /* Object */ && type.objectFlags === 16 /* Anonymous */; } function getFirstTypeParameterName(type) { var _a; - if (type.flags & (1048576 /* Union */ | 2097152 /* Intersection */)) { + if (type.flags & (134217728 /* Union */ | 268435456 /* Intersection */)) { for (const subType of type.types) { const subTypeName = getFirstTypeParameterName(subType); if (subTypeName) { @@ -165445,7 +166144,7 @@ function getFirstTypeParameterName(type) { } } } - return type.flags & 262144 /* TypeParameter */ ? (_a = type.getSymbol()) == null ? void 0 : _a.getName() : void 0; + return type.flags & 524288 /* TypeParameter */ ? (_a = type.getSymbol()) == null ? void 0 : _a.getName() : void 0; } function createDummyParameters(argCount, names, types, minArgumentCount, inJs) { const parameters = []; @@ -166072,7 +166771,7 @@ function getInitializer(checker, propertyDeclaration) { return getDefaultValueFromType(checker, checker.getTypeFromTypeNode(propertyDeclaration.type)); } function getDefaultValueFromType(checker, type) { - if (type.flags & 512 /* BooleanLiteral */) { + if (type.flags & 8192 /* BooleanLiteral */) { return type === checker.getFalseType() || type === checker.getFalseType( /*fresh*/ true @@ -166081,7 +166780,7 @@ function getDefaultValueFromType(checker, type) { return factory.createStringLiteral(type.value); } else if (type.isNumberLiteral()) { return factory.createNumericLiteral(type.value); - } else if (type.flags & 2048 /* BigIntLiteral */) { + } else if (type.flags & 4096 /* BigIntLiteral */) { return factory.createBigIntLiteral(type.value); } else if (type.isUnion()) { return firstDefined(type.types, (t) => getDefaultValueFromType(checker, t)); @@ -166705,6 +167404,7 @@ __export(ts_Completions_exports, { getCompletionEntryDetails: () => getCompletionEntryDetails, getCompletionEntrySymbol: () => getCompletionEntrySymbol, getCompletionsAtPosition: () => getCompletionsAtPosition, + getConstraintOfTypeArgumentProperty: () => getConstraintOfTypeArgumentProperty, getDefaultCommitCharacters: () => getDefaultCommitCharacters, getPropertiesForObjectExpression: () => getPropertiesForObjectExpression, moduleSpecifierResolutionCacheAttemptLimit: () => moduleSpecifierResolutionCacheAttemptLimit, @@ -166759,7 +167459,7 @@ var SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => { SymbolOriginInfoKind2[SymbolOriginInfoKind2["Ignore"] = 256] = "Ignore"; SymbolOriginInfoKind2[SymbolOriginInfoKind2["ComputedPropertyName"] = 512] = "ComputedPropertyName"; SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberNoExport"] = 2 /* SymbolMember */] = "SymbolMemberNoExport"; - SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberExport"] = 6] = "SymbolMemberExport"; + SymbolOriginInfoKind2[SymbolOriginInfoKind2["SymbolMemberExport"] = 34] = "SymbolMemberExport"; return SymbolOriginInfoKind2; })(SymbolOriginInfoKind || {}); function originIsThisType(origin) { @@ -166772,7 +167472,7 @@ function originIsExport(origin) { return !!(origin && origin.kind & 4 /* Export */); } function originIsResolvedExport(origin) { - return !!(origin && origin.kind === 32 /* ResolvedExport */); + return !!(origin && origin.kind & 32 /* ResolvedExport */); } function originIncludesSymbolName(origin) { return originIsExport(origin) || originIsResolvedExport(origin) || originIsComputedPropertyName(origin); @@ -167246,7 +167946,7 @@ function getJSDocParamAnnotation(paramName, initializer, dotDotDotToken, isJs, i } else { if (initializer) { const inferredType = checker.getTypeAtLocation(initializer.parent); - if (!(inferredType.flags & (1 /* Any */ | 16384 /* Void */))) { + if (!(inferredType.flags & (1 /* Any */ | 16 /* Void */))) { const sourceFile = initializer.getSourceFile(); const quotePreference = getQuotePreference(sourceFile, preferences); const builderFlags = quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */; @@ -167478,7 +168178,7 @@ function getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, options, const importAdder = ts_codefix_exports.createImportAdder(sourceFile, program, preferences, host); const elements = []; for (const type of switchType.types) { - if (type.flags & 1024 /* EnumLiteral */) { + if (type.flags & 32768 /* EnumLiteral */) { 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); @@ -167606,7 +168306,7 @@ function getJsxClosingTagCompletion(location, sourceFile) { switch (node.kind) { case 288 /* JsxClosingElement */: return true; - case 31 /* LessThanSlashToken */: + case 44 /* SlashToken */: case 32 /* GreaterThanToken */: case 80 /* Identifier */: case 212 /* PropertyAccessExpression */: @@ -167772,8 +168472,8 @@ function createCompletionEntry(symbol, sortText, replacementToken, contextToken, 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 /* BooleanLike */) && !(type.flags & 1048576 /* Union */ && find(type.types, (type2) => !!(type2.flags & 528 /* BooleanLike */)))) { - if (type.flags & 402653316 /* StringLike */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & (402653316 /* StringLike */ | 32768 /* Undefined */) || isStringAndEmptyAnonymousObjectIntersection(type2)))) { + if (preferences.jsxAttributeCompletionStyle === "auto" && !(type.flags & 8448 /* BooleanLike */) && !(type.flags & 134217728 /* Union */ && find(type.types, (type2) => !!(type2.flags & 8448 /* BooleanLike */)))) { + if (type.flags & 12583968 /* StringLike */ || type.flags & 134217728 /* Union */ && every(type.types, (type2) => !!(type2.flags & (12583968 /* StringLike */ | 4 /* Undefined */) || isStringAndEmptyAnonymousObjectIntersection(type2)))) { insertText = `${escapeSnippetText(name)}=${quote(sourceFile, preferences, "$1")}`; isSnippet = true; } else { @@ -168080,8 +168780,8 @@ function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, pro case 173 /* PropertyDeclaration */: case 174 /* MethodSignature */: case 175 /* MethodDeclaration */: { - let effectiveType = type.flags & 1048576 /* Union */ && type.types.length < 10 ? checker.getUnionType(type.types, 2 /* Subtype */) : type; - if (effectiveType.flags & 1048576 /* Union */) { + let effectiveType = type.flags & 134217728 /* Union */ && type.types.length < 10 ? checker.getUnionType(type.types, 2 /* Subtype */) : type; + if (effectiveType.flags & 134217728 /* Union */) { const functionTypes = filter(effectiveType.types, (type2) => checker.getSignaturesOfType(type2, 0 /* Call */).length > 0); if (functionTypes.length === 1) { effectiveType = functionTypes[0]; @@ -168349,12 +169049,12 @@ function isRecommendedCompletionMatch(localSymbol, recommendedCompletion, checke return localSymbol === recommendedCompletion || !!(localSymbol.flags & 1048576 /* ExportValue */) && 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 ? void 0 : origin.kind) === 1 /* ThisType */) { return "ThisProperty/" /* ThisProperty */; } @@ -168793,7 +169493,7 @@ function getContextualType(previousToken, position, sourceFile, checker) { return argInfo ? checker.getContextualTypeForArgumentAtIndex(argInfo.invocation, argInfo.argumentIndex) : isEqualityOperatorKind(previousToken.kind) && isBinaryExpression(parent2) && isEqualityOperatorKind(parent2.operatorToken.kind) ? ( // completion at `x ===/**/` should be for the right side checker.getTypeAtLocation(parent2.left) - ) : checker.getContextualType(previousToken, 4 /* Completions */) || checker.getContextualType(previousToken); + ) : checker.getContextualType(previousToken, 4 /* IgnoreNodeInferences */) || checker.getContextualType(previousToken); } } function getFirstSymbolInChain(symbol, enclosingDeclaration, checker) { @@ -168942,7 +169642,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position, location = currentToken; } break; - case 31 /* LessThanSlashToken */: + case 44 /* SlashToken */: if (currentToken.parent.kind === 286 /* JsxSelfClosingElement */) { location = currentToken; } @@ -168951,7 +169651,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position, } switch (parent2.kind) { case 288 /* JsxClosingElement */: - if (contextToken.kind === 31 /* LessThanSlashToken */) { + if (contextToken.kind === 44 /* SlashToken */) { isStartingCloseTag = true; location = contextToken; } @@ -169029,13 +169729,13 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position, } } 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 /* EnumLiteral */) ? t.value : void 0 + contextualTypeOrConstraint && (contextualTypeOrConstraint.isUnion() ? contextualTypeOrConstraint.types : [contextualTypeOrConstraint]), + (t) => t.isLiteral() && !(t.flags & 32768 /* EnumLiteral */) ? t.value : void 0 ); - const recommendedCompletion = previousToken && contextualType && getRecommendedCompletion(previousToken, contextualType, typeChecker); + const recommendedCompletion = previousToken && contextualTypeOrConstraint && getRecommendedCompletion(previousToken, contextualTypeOrConstraint, typeChecker); return { kind: 0 /* Data */, symbols, @@ -169238,7 +169938,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position, ) || {}; if (moduleSpecifier) { const origin = { - kind: getNullableSymbolOriginInfoKind(6 /* SymbolMemberExport */), + kind: getNullableSymbolOriginInfoKind(34 /* SymbolMemberExport */), moduleSymbol, isDefaultExport: false, symbolName: firstAccessibleSymbol.name, @@ -169298,7 +169998,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position, const jsxContainer = tryGetContainingJsxElement(contextToken); const attrsType = jsxContainer && typeChecker.getContextualType(jsxContainer.attributes); if (!attrsType) return 0 /* Continue */; - const completionsType = jsxContainer && typeChecker.getContextualType(jsxContainer.attributes, 4 /* Completions */); + const completionsType = jsxContainer && typeChecker.getContextualType(jsxContainer.attributes, 4 /* IgnoreNodeInferences */); symbols = concatenate(symbols, filterJsxAttributes(getPropertiesForObjectExpression(attrsType, completionsType, jsxContainer.attributes, typeChecker), jsxContainer.attributes.properties)); setSortTextToOptionalMember(); completionKind = 3 /* MemberLike */; @@ -169442,9 +170142,6 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position, 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; @@ -169455,6 +170152,9 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position, 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 /* Default */; const symbol = isDefaultExport && getLocalSymbolForExportDefault(Debug.checkDefined(exportInfo2.symbol)) || Debug.checkDefined(exportInfo2.symbol); pushAutoImportSymbol(symbol, { @@ -169725,7 +170425,7 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position, } return 0 /* Continue */; } - const completionsType = typeChecker.getContextualType(objectLikeContainer, 4 /* Completions */); + const completionsType = typeChecker.getContextualType(objectLikeContainer, 4 /* IgnoreNodeInferences */); const hasStringIndexType = (completionsType || instantiatedType).getStringIndexType(); const hasNumberIndextype = (completionsType || instantiatedType).getNumberIndexType(); isNewIdentifierLocation = !!hasStringIndexType || !!hasNumberIndextype; @@ -170444,7 +171144,7 @@ function getPropertiesForObjectExpression(contextualType, completionsType, obj, const hasCompletionsType = completionsType && completionsType !== contextualType; const promiseFilteredContextualType = checker.getUnionType( filter( - contextualType.flags & 1048576 /* Union */ ? contextualType.types : [contextualType], + contextualType.flags & 134217728 /* Union */ ? contextualType.types : [contextualType], (t) => !checker.getPromisedTypeOfPromise(t) ) ); @@ -170458,7 +171158,7 @@ function getPropertiesForObjectExpression(contextualType, completionsType, obj, } function getApparentProperties(type, node, checker) { if (!type.isUnion()) return type.getApparentProperties(); - return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 402784252 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties())))); + return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 12713980 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || checker.typeHasCallOrConstructSignatures(memberType) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties())))); } function containsNonPublicProperties(props) { return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 6 /* NonPublicAccessibilityModifier */)); @@ -170541,18 +171241,26 @@ function tryGetTypeLiteralNode(node) { } function getConstraintOfTypeArgumentProperty(node, checker) { if (!node) return void 0; - 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) return void 0; switch (node.kind) { case 172 /* PropertySignature */: return checker.getTypeOfPropertyOfContextualType(t, node.symbol.escapedName); + case 59 /* ColonToken */: + if (node.parent.kind === 172 /* PropertySignature */) { + return t; + } + break; case 194 /* IntersectionType */: case 188 /* TypeLiteral */: case 193 /* UnionType */: return t; + case 23 /* OpenBracketToken */: + return checker.getElementTypeOfArrayType(t); } } function isFromObjectTypeDeclaration(node) { @@ -170572,7 +171280,7 @@ function isValidTrigger(sourceFile, triggerCharacter, contextToken, position) { case "<": return !!contextToken && contextToken.kind === 30 /* LessThanToken */ && (!isBinaryExpression(contextToken.parent) || binaryExpressionMayBeOpenTag(contextToken.parent)); case "/": - return !!contextToken && (isStringLiteralLike(contextToken) ? !!tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 31 /* LessThanSlashToken */ && isJsxClosingElement(contextToken.parent)); + return !!contextToken && (isStringLiteralLike(contextToken) ? !!tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 44 /* SlashToken */ && isJsxClosingElement(contextToken.parent)); case " ": return !!contextToken && isImportKeyword(contextToken) && contextToken.parent.kind === 308 /* SourceFile */; default: @@ -171014,7 +171722,15 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program, if (isObjectLiteralExpression(parent2.parent) && parent2.name === node) { return stringLiteralCompletionsForObjectLiteral(typeChecker, parent2.parent); } - return fromContextualType() || fromContextualType(0 /* None */); + if (findAncestor(parent2.parent, isCallLikeExpression)) { + const uniques2 = /* @__PURE__ */ new Set(); + const stringLiteralTypes = concatenate( + getStringLiteralTypes(typeChecker.getContextualType(node, 0 /* None */), uniques2), + getStringLiteralTypes(typeChecker.getContextualType(node, 4 /* IgnoreNodeInferences */), uniques2) + ); + return toStringLiteralCompletionsFromTypes(stringLiteralTypes); + } + return fromContextualType(0 /* None */); case 213 /* ElementAccessExpression */: { const { expression, argumentExpression } = parent2; if (node === skipParentheses(argumentExpression)) { @@ -171074,7 +171790,12 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program, } function fromUnionableLiteralType(grandParent) { switch (grandParent.kind) { + case 214 /* CallExpression */: case 234 /* ExpressionWithTypeArguments */: + case 287 /* JsxOpeningElement */: + case 286 /* JsxSelfClosingElement */: + case 215 /* NewExpression */: + case 216 /* TaggedTemplateExpression */: case 184 /* TypeReference */: { const typeArgument = findAncestor(parent2, (n) => n.parent === grandParent); if (typeArgument) { @@ -171088,6 +171809,8 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program, return void 0; } return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType)); + case 172 /* PropertySignature */: + return { kind: 2 /* Types */, types: getStringLiteralTypes(getConstraintOfTypeArgumentProperty(grandParent, typeChecker)), isNewIdentifier: false }; case 193 /* UnionType */: { const result = fromUnionableLiteralType(walkUpParentheses(grandParent.parent)); if (!result) { @@ -171103,14 +171826,13 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, program, return void 0; } } - function fromContextualType(contextFlags = 4 /* Completions */) { - const types = getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags)); - if (!types.length) { - return; - } - return { kind: 2 /* Types */, types, isNewIdentifier: false }; + function fromContextualType(contextFlags = 4 /* IgnoreNodeInferences */) { + return toStringLiteralCompletionsFromTypes(getStringLiteralTypes(getContextualTypeFromParent(node, typeChecker, contextFlags))); } } +function toStringLiteralCompletionsFromTypes(types) { + return types.length ? { kind: 2 /* Types */, types, isNewIdentifier: false } : void 0; +} function walkUpParentheses(node) { switch (node.kind) { case 197 /* ParenthesizedType */: @@ -171138,7 +171860,7 @@ function getStringLiteralCompletionsFromSignature(call, arg, argumentInfo, check type = propType; } } - isNewIdentifier = isNewIdentifier || !!(type.flags & 4 /* String */); + isNewIdentifier = isNewIdentifier || !!(type.flags & 32 /* String */); return getStringLiteralTypes(type, uniques); }); return length(types) ? { kind: 2 /* Types */, types, isNewIdentifier } : void 0; @@ -171153,7 +171875,7 @@ function stringLiteralCompletionsFromProperties(type) { function stringLiteralCompletionsForObjectLiteral(checker, objectLiteralExpression) { const contextualType = checker.getContextualType(objectLiteralExpression); if (!contextualType) return void 0; - const completionsType = checker.getContextualType(objectLiteralExpression, 4 /* Completions */); + const completionsType = checker.getContextualType(objectLiteralExpression, 4 /* IgnoreNodeInferences */); const symbols = getPropertiesForObjectExpression( contextualType, completionsType, @@ -171169,7 +171891,7 @@ function stringLiteralCompletionsForObjectLiteral(checker, objectLiteralExpressi function getStringLiteralTypes(type, uniques = /* @__PURE__ */ new Set()) { if (!type) return emptyArray; type = skipConstraint(type); - return type.isUnion() ? flatMap(type.types, (t) => getStringLiteralTypes(t, uniques)) : type.isStringLiteral() && !(type.flags & 1024 /* EnumLiteral */) && addToSeen(uniques, type.value) ? [type] : emptyArray; + return type.isUnion() ? flatMap(type.types, (t) => getStringLiteralTypes(t, uniques)) : type.isStringLiteral() && !(type.flags & 32768 /* EnumLiteral */) && addToSeen(uniques, type.value) ? [type] : emptyArray; } function nameAndKind(name, kind, extension) { return { name, kind, extension }; @@ -171545,7 +172267,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p if (tryFileExists(host, packageFile)) { const packageJson = readJson(packageFile, host); const fragmentSubpath = components.join("/") + (components.length && hasTrailingDirectorySeparator(fragment) ? "/" : ""); - exportsOrImportsLookup( + if (exportsOrImportsLookup( packageJson.exports, fragmentSubpath, packageDirectory, @@ -171553,8 +172275,9 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p true, /*isImports*/ false - ); - return; + )) { + return; + } } return nodeModulesDirectoryOrImportsLookup(ancestor); }; @@ -171565,7 +172288,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p return arrayFrom(result.values()); function exportsOrImportsLookup(lookupTable, fragment2, baseDirectory, isExports, isImports) { if (typeof lookupTable !== "object" || lookupTable === null) { - return; + return lookupTable !== void 0; } const keys = getOwnKeys(lookupTable); const conditions = getConditions(compilerOptions, mode); @@ -171589,6 +172312,7 @@ function getCompletionEntriesForNonRelativeModules(fragment, scriptPath, mode, p }, comparePatternKeys ); + return true; } } function getPatternFromFirstMatchingCondition(target, conditions) { @@ -174446,13 +175170,29 @@ function getDefinitionFromObjectLiteralElement(typeChecker, node) { if (element) { const contextualType = element && typeChecker.getContextualType(element.parent); if (contextualType) { - return flatMap(getPropertySymbolsFromContextualType( + let properties = getPropertySymbolsFromContextualType( element, typeChecker, contextualType, /*unionSymbolOk*/ false - ), (propertySymbol) => getDefinitionFromSymbol(typeChecker, propertySymbol, node)); + ); + if (some(properties, (p) => !!(p.valueDeclaration && isObjectLiteralExpression(p.valueDeclaration.parent) && isObjectLiteralElementLike(p.valueDeclaration) && p.valueDeclaration.name === node))) { + const withoutNodeInferencesType = typeChecker.getContextualType(element.parent, 4 /* IgnoreNodeInferences */); + if (withoutNodeInferencesType) { + const withoutNodeInferencesProperties = getPropertySymbolsFromContextualType( + element, + typeChecker, + withoutNodeInferencesType, + /*unionSymbolOk*/ + false + ); + if (withoutNodeInferencesProperties.length) { + properties = withoutNodeInferencesProperties; + } + } + } + return flatMap(properties, (propertySymbol) => getDefinitionFromSymbol(typeChecker, propertySymbol, node)); } } return emptyArray; @@ -174625,7 +175365,7 @@ function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) { return typeDefinitions.length ? [...getFirstTypeArgumentDefinitions(typeChecker, resolvedType, node, failedAliasResolution), ...typeDefinitions] : !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, skipAlias(symbol, typeChecker), node, failedAliasResolution) : void 0; } function definitionFromType(type, checker, node, failedAliasResolution) { - return flatMap(type.isUnion() && !(type.flags & 32 /* Enum */) ? type.types : [type], (t) => t.symbol && getDefinitionFromSymbol(checker, t.symbol, node, failedAliasResolution)); + return flatMap(type.isUnion() && !(type.flags & 65536 /* Enum */) ? type.types : [type], (t) => t.symbol && getDefinitionFromSymbol(checker, t.symbol, node, failedAliasResolution)); } function tryGetReturnTypeOfFunction(symbol, type, checker) { if (type.symbol === symbol || // At `const f = () => {}`, the symbol is `f` and the type symbol is at `() => {}` @@ -175277,6 +176017,7 @@ function provideInlayHints(context) { Debug.assertNode(node2, isTypeParameterDeclaration); if (node2.modifiers) { visitDisplayPartList(node2.modifiers, " "); + parts.push({ text: " " }); } visitForDisplayParts(node2.name); if (node2.constraint) { @@ -175292,6 +176033,7 @@ function provideInlayHints(context) { Debug.assertNode(node2, isParameter); if (node2.modifiers) { visitDisplayPartList(node2.modifiers, " "); + parts.push({ text: " " }); } if (node2.dotDotDotToken) { parts.push({ text: "..." }); @@ -177345,7 +178087,7 @@ function getRenameInfoForNode(node, typeChecker, sourceFile, program, preference if (!symbol) { if (isStringLiteralLike(node)) { const type = getContextualTypeFromParentOrAncestorTypeNode(node, typeChecker); - if (type && (type.flags & 128 /* StringLiteral */ || type.flags & 1048576 /* Union */ && every(type.types, (type2) => !!(type2.flags & 128 /* StringLiteral */)))) { + if (type && (type.flags & 1024 /* StringLiteral */ || type.flags & 134217728 /* Union */ && every(type.types, (type2) => !!(type2.flags & 1024 /* StringLiteral */)))) { return getRenameInfoSuccess(node.text, node.text, "string" /* string */, "", node, sourceFile); } } else if (isLabelName(node)) { @@ -183458,6 +184200,7 @@ __export(ts_exports2, { canHaveLocals: () => canHaveLocals, canHaveModifiers: () => canHaveModifiers, canHaveModuleSpecifier: () => canHaveModuleSpecifier, + canHaveStatements: () => canHaveStatements, canHaveSymbol: () => canHaveSymbol, canIncludeBindAndCheckDiagnostics: () => canIncludeBindAndCheckDiagnostics, canJsonReportNoInputFiles: () => canJsonReportNoInputFiles, @@ -183505,6 +184248,7 @@ __export(ts_exports2, { commonOptionsWithBuild: () => commonOptionsWithBuild, compact: () => compact, compareBooleans: () => compareBooleans, + compareComparableValues: () => compareComparableValues, compareDataObjects: () => compareDataObjects, compareDiagnostics: () => compareDiagnostics, compareEmitHelpers: () => compareEmitHelpers, @@ -183850,6 +184594,7 @@ __export(ts_exports2, { getAllowImportingTsExtensions: () => getAllowImportingTsExtensions, getAllowJSCompilerOption: () => getAllowJSCompilerOption, getAllowSyntheticDefaultImports: () => getAllowSyntheticDefaultImports, + getAlwaysStrict: () => getAlwaysStrict, getAncestor: () => getAncestor, getAnyExtensionFromPath: () => getAnyExtensionFromPath, getAreDeclarationMapsEnabled: () => getAreDeclarationMapsEnabled, @@ -183879,6 +184624,7 @@ __export(ts_exports2, { getCommonSourceDirectory: () => getCommonSourceDirectory, getCommonSourceDirectoryOfConfig: () => getCommonSourceDirectoryOfConfig, getCompilerOptionValue: () => getCompilerOptionValue, + getComputedCommonSourceDirectory: () => getComputedCommonSourceDirectory, getConditions: () => getConditions, getConfigFileParsingDiagnostics: () => getConfigFileParsingDiagnostics, getConstantValue: () => getConstantValue, @@ -184088,6 +184834,7 @@ __export(ts_exports2, { getModuleInstanceState: () => getModuleInstanceState, getModuleNameStringLiteralAt: () => getModuleNameStringLiteralAt, getModuleSpecifierEndingPreference: () => getModuleSpecifierEndingPreference, + getModuleSpecifierOfBareOrAccessedRequire: () => getModuleSpecifierOfBareOrAccessedRequire, getModuleSpecifierResolverHost: () => getModuleSpecifierResolverHost, getNameForExportedSymbol: () => getNameForExportedSymbol, getNameFromImportAttribute: () => getNameFromImportAttribute, @@ -184118,7 +184865,6 @@ __export(ts_exports2, { getNonAugmentationDeclaration: () => getNonAugmentationDeclaration, getNonDecoratorTokenPosOfNode: () => getNonDecoratorTokenPosOfNode, getNonIncrementalBuildInfoRoots: () => getNonIncrementalBuildInfoRoots, - getNonModifierTokenPosOfNode: () => getNonModifierTokenPosOfNode, getNormalizedAbsolutePath: () => getNormalizedAbsolutePath, getNormalizedAbsolutePathWithoutRoot: () => getNormalizedAbsolutePathWithoutRoot, getNormalizedPathComponents: () => getNormalizedPathComponents, @@ -184849,6 +185595,7 @@ __export(ts_exports2, { isPlusToken: () => isPlusToken, isPossiblyTypeArgumentPosition: () => isPossiblyTypeArgumentPosition, isPostfixUnaryExpression: () => isPostfixUnaryExpression, + isPotentiallyExecutableNode: () => isPotentiallyExecutableNode, isPrefixUnaryExpression: () => isPrefixUnaryExpression, isPrimitiveLiteralValue: () => isPrimitiveLiteralValue, isPrivateIdentifier: () => isPrivateIdentifier, @@ -185451,9 +186198,7 @@ __export(ts_exports2, { unmangleScopedPackageName: () => unmangleScopedPackageName, unorderedRemoveItem: () => unorderedRemoveItem, unprefixedNodeCoreModules: () => unprefixedNodeCoreModules, - unreachableCodeIsError: () => unreachableCodeIsError, unsetNodeChildren: () => unsetNodeChildren, - unusedLabelIsError: () => unusedLabelIsError, unwrapInnermostStatementOfLabel: () => unwrapInnermostStatementOfLabel, unwrapParenthesizedExpression: () => unwrapParenthesizedExpression, updateErrorForNoInputFiles: () => updateErrorForNoInputFiles, @@ -185463,6 +186208,7 @@ __export(ts_exports2, { updateSharedExtendedConfigFileWatcher: () => updateSharedExtendedConfigFileWatcher, updateSourceFile: () => updateSourceFile, updateWatchingWildcardDirectories: () => updateWatchingWildcardDirectories, + usesWildcardTypes: () => usesWildcardTypes, usingSingleLineStringWriter: () => usingSingleLineStringWriter, utf16EncodeAsString: () => utf16EncodeAsString, validateLocaleAndSetLanguage: () => validateLocaleAndSetLanguage, @@ -185827,7 +186573,7 @@ var TypingsInstaller = class { } const discoverTypingsResult = ts_JsTyping_exports.discoverTypings( this.installTypingHost, - this.log.isEnabled() ? (s) => this.log.writeLine(s) : void 0, + this.log.isEnabled() ? ((s) => this.log.writeLine(s)) : void 0, req.fileNames, req.projectRootPath, this.safeList, @@ -186486,9 +187232,11 @@ var ScriptTarget11 = /* @__PURE__ */ ((ScriptTarget12) => { ScriptTarget12["ES2022"] = "es2022"; ScriptTarget12["ES2023"] = "es2023"; ScriptTarget12["ES2024"] = "es2024"; + ScriptTarget12["ES2025"] = "es2025"; ScriptTarget12["ESNext"] = "esnext"; ScriptTarget12["JSON"] = "json"; ScriptTarget12["Latest"] = "esnext" /* ESNext */; + ScriptTarget12["LatestStandard"] = "es2025" /* ES2025 */; return ScriptTarget12; })(ScriptTarget11 || {}); { @@ -187998,6 +188746,9 @@ var Project2 = class _Project { } /** @internal */ watchTypingLocations(files) { + if (this.currentDirectory === this.projectService.currentDirectory || !canWatchDirectoryOrFilePath(this.toPath(this.currentDirectory))) { + return; + } if (!files) { this.typingWatchers.isInvoked = false; return; @@ -188066,6 +188817,15 @@ var Project2 = class _Project { }); } /** @internal */ + skipWatchingFailedLookups(path) { + const info = this.projectService.getScriptInfoForPath(path); + return info == null ? void 0 : info.isDynamic; + } + /** @internal */ + skipWatchingTypeRoots() { + return isInferredProject(this) && this.currentDirectory === this.projectService.currentDirectory; + } + /** @internal */ getCurrentProgram() { return this.program; } @@ -189463,6 +190223,9 @@ function convertCompilerOptions(protocolOptions) { 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) { @@ -190039,7 +190802,7 @@ var _ProjectService = class _ProjectService { this ); const watchLogLevel = this.logger.hasLevel(3 /* verbose */) ? 2 /* Verbose */ : this.logger.loggingEnabled() ? 1 /* TriggerOnly */ : 0 /* None */; - const log = watchLogLevel !== 0 /* None */ ? (s) => this.logger.info(s) : noop; + const log = watchLogLevel !== 0 /* None */ ? ((s) => this.logger.info(s)) : noop; this.packageJsonCache = createPackageJsonCache(this); this.watchFactory = this.serverMode !== 0 /* Semantic */ ? { watchFile: returnNoopFileWatcher, @@ -190503,7 +191266,7 @@ var _ProjectService = class _ProjectService { useCaseSensitiveFileNames: this.host.useCaseSensitiveFileNames, writeLog: (s) => this.logger.info(s), toPath: (s) => this.toPath(s), - getScriptKind: configuredProjectForConfig ? (fileName) => configuredProjectForConfig.getScriptKind(fileName) : void 0 + getScriptKind: configuredProjectForConfig ? ((fileName) => configuredProjectForConfig.getScriptKind(fileName)) : void 0 })) return; if (config.updateLevel !== 2 /* Full */) config.updateLevel = 1 /* RootNamesAndUpdate */; config.projects.forEach((watchWildcardDirectories, projectCanonicalPath) => { @@ -198219,6 +198982,7 @@ if (typeof console !== "undefined") { canHaveLocals, canHaveModifiers, canHaveModuleSpecifier, + canHaveStatements, canHaveSymbol, canIncludeBindAndCheckDiagnostics, canJsonReportNoInputFiles, @@ -198266,6 +199030,7 @@ if (typeof console !== "undefined") { commonOptionsWithBuild, compact, compareBooleans, + compareComparableValues, compareDataObjects, compareDiagnostics, compareEmitHelpers, @@ -198611,6 +199376,7 @@ if (typeof console !== "undefined") { getAllowImportingTsExtensions, getAllowJSCompilerOption, getAllowSyntheticDefaultImports, + getAlwaysStrict, getAncestor, getAnyExtensionFromPath, getAreDeclarationMapsEnabled, @@ -198640,6 +199406,7 @@ if (typeof console !== "undefined") { getCommonSourceDirectory, getCommonSourceDirectoryOfConfig, getCompilerOptionValue, + getComputedCommonSourceDirectory, getConditions, getConfigFileParsingDiagnostics, getConstantValue, @@ -198849,6 +199616,7 @@ if (typeof console !== "undefined") { getModuleInstanceState, getModuleNameStringLiteralAt, getModuleSpecifierEndingPreference, + getModuleSpecifierOfBareOrAccessedRequire, getModuleSpecifierResolverHost, getNameForExportedSymbol, getNameFromImportAttribute, @@ -198879,7 +199647,6 @@ if (typeof console !== "undefined") { getNonAugmentationDeclaration, getNonDecoratorTokenPosOfNode, getNonIncrementalBuildInfoRoots, - getNonModifierTokenPosOfNode, getNormalizedAbsolutePath, getNormalizedAbsolutePathWithoutRoot, getNormalizedPathComponents, @@ -199610,6 +200377,7 @@ if (typeof console !== "undefined") { isPlusToken, isPossiblyTypeArgumentPosition, isPostfixUnaryExpression, + isPotentiallyExecutableNode, isPrefixUnaryExpression, isPrimitiveLiteralValue, isPrivateIdentifier, @@ -200212,9 +200980,7 @@ if (typeof console !== "undefined") { unmangleScopedPackageName, unorderedRemoveItem, unprefixedNodeCoreModules, - unreachableCodeIsError, unsetNodeChildren, - unusedLabelIsError, unwrapInnermostStatementOfLabel, unwrapParenthesizedExpression, updateErrorForNoInputFiles, @@ -200224,6 +200990,7 @@ if (typeof console !== "undefined") { updateSharedExtendedConfigFileWatcher, updateSourceFile, updateWatchingWildcardDirectories, + usesWildcardTypes, usingSingleLineStringWriter, utf16EncodeAsString, validateLocaleAndSetLanguage, diff --git a/packages/schematics/angular/utility/latest-versions/package.json b/packages/schematics/angular/utility/latest-versions/package.json index ea0e8e92de5a..a696fc09273c 100644 --- a/packages/schematics/angular/utility/latest-versions/package.json +++ b/packages/schematics/angular/utility/latest-versions/package.json @@ -23,7 +23,7 @@ "tailwindcss": "^4.1.12", "@tailwindcss/postcss": "^4.1.12", "tslib": "^2.3.0", - "typescript": "~5.9.2", + "typescript": "~6.0.2", "vitest": "^4.0.8", "@vitest/browser-playwright": "^4.0.8", "@vitest/browser-webdriverio": "^4.0.8", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 952115f50b4c..d6d71bddc8c3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -33,7 +33,7 @@ importers: version: 22.0.0-next.3 '@angular/compiler-cli': specifier: 22.0.0-next.3 - version: 22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.1-rc) + version: 22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.2) '@angular/core': specifier: 22.0.0-next.3 version: 22.0.0-next.3(@angular/compiler@22.0.0-next.3)(rxjs@7.8.2)(zone.js@0.16.1) @@ -42,7 +42,7 @@ importers: version: 22.0.0-next.3(@angular/common@22.0.0-next.3(@angular/core@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(rxjs@7.8.2)(zone.js@0.16.1))(rxjs@7.8.2))(@angular/core@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(rxjs@7.8.2)(zone.js@0.16.1))(@angular/platform-browser@22.0.0-next.3(@angular/animations@22.0.0-next.3(@angular/core@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(rxjs@7.8.2)(zone.js@0.16.1)))(@angular/common@22.0.0-next.3(@angular/core@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(rxjs@7.8.2)(zone.js@0.16.1))(rxjs@7.8.2))(@angular/core@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(rxjs@7.8.2)(zone.js@0.16.1)))(rxjs@7.8.2) '@angular/localize': specifier: 22.0.0-next.3 - version: 22.0.0-next.3(@angular/compiler-cli@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.1-rc))(@angular/compiler@22.0.0-next.3) + version: 22.0.0-next.3(@angular/compiler-cli@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.2))(@angular/compiler@22.0.0-next.3) '@angular/material': specifier: 22.0.0-next.0 version: 22.0.0-next.0(2d75345887a5a4c2bc113233c009d4e6) @@ -168,10 +168,10 @@ importers: version: 1.1.9 '@typescript-eslint/eslint-plugin': specifier: 8.57.1 - version: 8.57.1(@typescript-eslint/parser@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc))(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc) + version: 8.57.1(@typescript-eslint/parser@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2))(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2) '@typescript-eslint/parser': specifier: 8.57.1 - version: 8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc) + version: 8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2) ajv: specifier: 8.18.0 version: 8.18.0 @@ -192,7 +192,7 @@ importers: version: 10.1.8(eslint@10.1.0(jiti@2.6.1)) eslint-plugin-import: specifier: 2.32.0 - version: 2.32.0(@typescript-eslint/parser@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc))(eslint@10.1.0(jiti@2.6.1)) + version: 2.32.0(@typescript-eslint/parser@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2))(eslint@10.1.0(jiti@2.6.1)) express: specifier: 5.2.1 version: 5.2.1 @@ -252,7 +252,7 @@ importers: version: 3.8.1 puppeteer: specifier: 24.40.0 - version: 24.40.0(bufferutil@4.1.0)(typescript@6.0.1-rc)(utf-8-validate@6.0.6) + version: 24.40.0(bufferutil@4.1.0)(typescript@6.0.2)(utf-8-validate@6.0.6) quicktype-core: specifier: 23.2.6 version: 23.2.6(encoding@0.1.13) @@ -264,7 +264,7 @@ importers: version: 3.2.1 rollup-plugin-dts: specifier: 6.4.1 - version: 6.4.1(rollup@4.60.0)(typescript@6.0.1-rc) + version: 6.4.1(rollup@4.60.0)(typescript@6.0.2) rollup-plugin-sourcemaps2: specifier: 0.5.6 version: 0.5.6(@types/node@22.19.15)(rollup@4.60.0) @@ -278,8 +278,8 @@ importers: specifier: 2.8.1 version: 2.8.1 typescript: - specifier: 6.0.1-rc - version: 6.0.1-rc + specifier: 6.0.2 + version: 6.0.2 undici: specifier: 7.24.5 version: 7.24.5 @@ -321,7 +321,7 @@ importers: version: 29.0.1 ng-packagr: specifier: 22.0.0-next.0 - version: 22.0.0-next.0(@angular/compiler-cli@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.1-rc))(tslib@2.8.1)(typescript@6.0.1-rc) + version: 22.0.0-next.0(@angular/compiler-cli@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.2))(tslib@2.8.1)(typescript@6.0.2) rxjs: specifier: 7.8.2 version: 7.8.2 @@ -424,7 +424,7 @@ importers: version: 4.6.4 ng-packagr: specifier: 22.0.0-next.0 - version: 22.0.0-next.0(@angular/compiler-cli@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.1-rc))(tslib@2.8.1)(typescript@6.0.1-rc) + version: 22.0.0-next.0(@angular/compiler-cli@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.2))(tslib@2.8.1)(typescript@6.0.2) postcss: specifier: 8.5.8 version: 8.5.8 @@ -666,7 +666,7 @@ importers: version: 8.5.8 postcss-loader: specifier: 8.2.1 - version: 8.2.1(postcss@8.5.8)(typescript@6.0.1-rc)(webpack@5.105.4(esbuild@0.27.3)) + version: 8.2.1(postcss@8.5.8)(typescript@6.0.2)(webpack@5.105.4(esbuild@0.27.3)) resolve-url-loader: specifier: 5.0.0 version: 5.0.0 @@ -721,7 +721,7 @@ importers: version: 3.0.4(bufferutil@4.1.0)(utf-8-validate@6.0.6) ng-packagr: specifier: 22.0.0-next.0 - version: 22.0.0-next.0(@angular/compiler-cli@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.1-rc))(tslib@2.8.1)(typescript@6.0.1-rc) + version: 22.0.0-next.0(@angular/compiler-cli@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.2))(tslib@2.8.1)(typescript@6.0.2) undici: specifier: 7.24.5 version: 7.24.5 @@ -817,10 +817,10 @@ importers: version: 22.0.0-next.3 '@angular/compiler-cli': specifier: 22.0.0-next.3 - version: 22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.1-rc) + version: 22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.2) typescript: - specifier: 6.0.1-rc - version: 6.0.1-rc + specifier: 6.0.2 + version: 6.0.2 webpack: specifier: 5.105.4 version: 5.105.4(esbuild@0.27.3) @@ -3779,6 +3779,12 @@ packages: peerDependencies: typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/tsconfig-utils@8.57.2': + resolution: {integrity: sha512-3Lm5DSM+DCowsUOJC+YqHHnKEfFh5CoGkj5Z31NQSNF4l5wdOwqGn99wmwN/LImhfY3KJnmordBq/4+VDe2eKw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '>=4.8.4 <6.0.0' + '@typescript-eslint/type-utils@8.57.1': resolution: {integrity: sha512-+Bwwm0ScukFdyoJsh2u6pp4S9ktegF98pYUU0hkphOOqdMB+1sNQhIz8y5E9+4pOioZijrkfNO/HUJVAFFfPKA==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -3794,6 +3800,10 @@ packages: resolution: {integrity: sha512-S29BOBPJSFUiblEl6RzPPjJt6w25A6XsBqRVDt53tA/tlL8q7ceQNZHTjPeONt/3S7KRI4quk+yP9jK2WjBiPQ==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/types@8.57.2': + resolution: {integrity: sha512-/iZM6FnM4tnx9csuTxspMW4BOSegshwX5oBDznJ7S4WggL7Vczz5d2W11ecc4vRrQMQHXRSxzrCsyG5EsPPTbA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@typescript-eslint/typescript-estree@8.57.1': resolution: {integrity: sha512-ybe2hS9G6pXpqGtPli9Gx9quNV0TWLOmh58ADlmZe9DguLq0tiAKVjirSbtM1szG6+QH6rVXyU6GTLQbWnMY+g==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -8035,8 +8045,8 @@ packages: engines: {node: '>=14.17'} hasBin: true - typescript@6.0.1-rc: - resolution: {integrity: sha512-7XlzYb+p/7YxX6qSOzwB4mxVFRdAgWWkj1PgAZ+jzldeuFV6Z77vwFbNxHsUXAL/bhlWY2jCT8shLwDJR8337g==} + typescript@6.0.2: + resolution: {integrity: sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==} engines: {node: '>=14.17'} hasBin: true @@ -8666,7 +8676,7 @@ snapshots: rxjs: 7.8.2 tslib: 2.8.1 - '@angular/compiler-cli@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.1-rc)': + '@angular/compiler-cli@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.2)': dependencies: '@angular/compiler': 22.0.0-next.3 '@babel/core': 7.29.0 @@ -8678,7 +8688,7 @@ snapshots: tslib: 2.8.1 yargs: 18.0.0 optionalDependencies: - typescript: 6.0.1-rc + typescript: 6.0.2 transitivePeerDependencies: - supports-color @@ -8703,10 +8713,10 @@ snapshots: rxjs: 7.8.2 tslib: 2.8.1 - '@angular/localize@22.0.0-next.3(@angular/compiler-cli@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.1-rc))(@angular/compiler@22.0.0-next.3)': + '@angular/localize@22.0.0-next.3(@angular/compiler-cli@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.2))(@angular/compiler@22.0.0-next.3)': dependencies: '@angular/compiler': 22.0.0-next.3 - '@angular/compiler-cli': 22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.1-rc) + '@angular/compiler-cli': 22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.2) '@babel/core': 7.29.0 '@types/babel__core': 7.20.5 tinyglobby: 0.2.15 @@ -11681,40 +11691,40 @@ snapshots: '@types/node': 22.19.15 optional: true - '@typescript-eslint/eslint-plugin@8.57.1(@typescript-eslint/parser@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc))(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc)': + '@typescript-eslint/eslint-plugin@8.57.1(@typescript-eslint/parser@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2))(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2)': dependencies: '@eslint-community/regexpp': 4.12.2 - '@typescript-eslint/parser': 8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc) + '@typescript-eslint/parser': 8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2) '@typescript-eslint/scope-manager': 8.57.1 - '@typescript-eslint/type-utils': 8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc) - '@typescript-eslint/utils': 8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc) + '@typescript-eslint/type-utils': 8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2) + '@typescript-eslint/utils': 8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2) '@typescript-eslint/visitor-keys': 8.57.1 eslint: 10.1.0(jiti@2.6.1) ignore: 7.0.5 natural-compare: 1.4.0 - ts-api-utils: 2.4.0(typescript@6.0.1-rc) - typescript: 6.0.1-rc + ts-api-utils: 2.4.0(typescript@6.0.2) + typescript: 6.0.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/parser@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc)': + '@typescript-eslint/parser@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2)': dependencies: '@typescript-eslint/scope-manager': 8.57.1 '@typescript-eslint/types': 8.57.1 - '@typescript-eslint/typescript-estree': 8.57.1(typescript@6.0.1-rc) + '@typescript-eslint/typescript-estree': 8.57.1(typescript@6.0.2) '@typescript-eslint/visitor-keys': 8.57.1 debug: 4.4.3(supports-color@10.2.2) eslint: 10.1.0(jiti@2.6.1) - typescript: 6.0.1-rc + typescript: 6.0.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/project-service@8.57.1(typescript@6.0.1-rc)': + '@typescript-eslint/project-service@8.57.1(typescript@6.0.2)': dependencies: - '@typescript-eslint/tsconfig-utils': 8.57.1(typescript@6.0.1-rc) - '@typescript-eslint/types': 8.57.1 + '@typescript-eslint/tsconfig-utils': 8.57.2(typescript@6.0.2) + '@typescript-eslint/types': 8.57.2 debug: 4.4.3(supports-color@10.2.2) - typescript: 6.0.1-rc + typescript: 6.0.2 transitivePeerDependencies: - supports-color @@ -11723,19 +11733,23 @@ snapshots: '@typescript-eslint/types': 8.57.1 '@typescript-eslint/visitor-keys': 8.57.1 - '@typescript-eslint/tsconfig-utils@8.57.1(typescript@6.0.1-rc)': + '@typescript-eslint/tsconfig-utils@8.57.1(typescript@6.0.2)': dependencies: - typescript: 6.0.1-rc + typescript: 6.0.2 - '@typescript-eslint/type-utils@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc)': + '@typescript-eslint/tsconfig-utils@8.57.2(typescript@6.0.2)': + dependencies: + typescript: 6.0.2 + + '@typescript-eslint/type-utils@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2)': dependencies: '@typescript-eslint/types': 8.57.1 - '@typescript-eslint/typescript-estree': 8.57.1(typescript@6.0.1-rc) - '@typescript-eslint/utils': 8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc) + '@typescript-eslint/typescript-estree': 8.57.1(typescript@6.0.2) + '@typescript-eslint/utils': 8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2) debug: 4.4.3(supports-color@10.2.2) eslint: 10.1.0(jiti@2.6.1) - ts-api-utils: 2.4.0(typescript@6.0.1-rc) - typescript: 6.0.1-rc + ts-api-utils: 2.4.0(typescript@6.0.2) + typescript: 6.0.2 transitivePeerDependencies: - supports-color @@ -11743,29 +11757,31 @@ snapshots: '@typescript-eslint/types@8.57.1': {} - '@typescript-eslint/typescript-estree@8.57.1(typescript@6.0.1-rc)': + '@typescript-eslint/types@8.57.2': {} + + '@typescript-eslint/typescript-estree@8.57.1(typescript@6.0.2)': dependencies: - '@typescript-eslint/project-service': 8.57.1(typescript@6.0.1-rc) - '@typescript-eslint/tsconfig-utils': 8.57.1(typescript@6.0.1-rc) + '@typescript-eslint/project-service': 8.57.1(typescript@6.0.2) + '@typescript-eslint/tsconfig-utils': 8.57.1(typescript@6.0.2) '@typescript-eslint/types': 8.57.1 '@typescript-eslint/visitor-keys': 8.57.1 debug: 4.4.3(supports-color@10.2.2) minimatch: 10.2.4 semver: 7.7.4 tinyglobby: 0.2.15 - ts-api-utils: 2.4.0(typescript@6.0.1-rc) - typescript: 6.0.1-rc + ts-api-utils: 2.4.0(typescript@6.0.2) + typescript: 6.0.2 transitivePeerDependencies: - supports-color - '@typescript-eslint/utils@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc)': + '@typescript-eslint/utils@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2)': dependencies: '@eslint-community/eslint-utils': 4.9.1(eslint@10.1.0(jiti@2.6.1)) '@typescript-eslint/scope-manager': 8.57.1 '@typescript-eslint/types': 8.57.1 - '@typescript-eslint/typescript-estree': 8.57.1(typescript@6.0.1-rc) + '@typescript-eslint/typescript-estree': 8.57.1(typescript@6.0.2) eslint: 10.1.0(jiti@2.6.1) - typescript: 6.0.1-rc + typescript: 6.0.2 transitivePeerDependencies: - supports-color @@ -12845,14 +12861,14 @@ snapshots: object-assign: 4.1.1 vary: 1.1.2 - cosmiconfig@9.0.1(typescript@6.0.1-rc): + cosmiconfig@9.0.1(typescript@6.0.2): dependencies: env-paths: 2.2.1 import-fresh: 3.3.1 js-yaml: 4.1.1 parse-json: 5.2.0 optionalDependencies: - typescript: 6.0.1-rc + typescript: 6.0.2 cross-fetch@4.1.0(encoding@0.1.13): dependencies: @@ -13330,17 +13346,17 @@ snapshots: transitivePeerDependencies: - supports-color - eslint-module-utils@2.12.1(@typescript-eslint/parser@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc))(eslint-import-resolver-node@0.3.9)(eslint@10.1.0(jiti@2.6.1)): + eslint-module-utils@2.12.1(@typescript-eslint/parser@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2))(eslint-import-resolver-node@0.3.9)(eslint@10.1.0(jiti@2.6.1)): dependencies: debug: 3.2.7 optionalDependencies: - '@typescript-eslint/parser': 8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc) + '@typescript-eslint/parser': 8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2) eslint: 10.1.0(jiti@2.6.1) eslint-import-resolver-node: 0.3.9 transitivePeerDependencies: - supports-color - eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc))(eslint@10.1.0(jiti@2.6.1)): + eslint-plugin-import@2.32.0(@typescript-eslint/parser@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2))(eslint@10.1.0(jiti@2.6.1)): dependencies: '@rtsao/scc': 1.1.0 array-includes: 3.1.9 @@ -13351,7 +13367,7 @@ snapshots: doctrine: 2.1.0 eslint: 10.1.0(jiti@2.6.1) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc))(eslint-import-resolver-node@0.3.9)(eslint@10.1.0(jiti@2.6.1)) + eslint-module-utils: 2.12.1(@typescript-eslint/parser@8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2))(eslint-import-resolver-node@0.3.9)(eslint@10.1.0(jiti@2.6.1)) hasown: 2.0.2 is-core-module: 2.16.1 is-glob: 4.0.3 @@ -13363,7 +13379,7 @@ snapshots: string.prototype.trimend: 1.0.9 tsconfig-paths: 3.15.0 optionalDependencies: - '@typescript-eslint/parser': 8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.1-rc) + '@typescript-eslint/parser': 8.57.1(eslint@10.1.0(jiti@2.6.1))(typescript@6.0.2) transitivePeerDependencies: - eslint-import-resolver-typescript - eslint-import-resolver-webpack @@ -15086,10 +15102,10 @@ snapshots: netmask@2.0.2: {} - ng-packagr@22.0.0-next.0(@angular/compiler-cli@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.1-rc))(tslib@2.8.1)(typescript@6.0.1-rc): + ng-packagr@22.0.0-next.0(@angular/compiler-cli@22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.2))(tslib@2.8.1)(typescript@6.0.2): dependencies: '@ampproject/remapping': 2.3.0 - '@angular/compiler-cli': 22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.1-rc) + '@angular/compiler-cli': 22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@6.0.2) '@rollup/plugin-json': 6.1.0(rollup@4.59.0) '@rollup/wasm-node': 4.59.0 ajv: 8.18.0 @@ -15106,12 +15122,12 @@ snapshots: ora: 9.3.0 piscina: 5.1.4 postcss: 8.5.8 - rollup-plugin-dts: 6.4.0(rollup@4.59.0)(typescript@6.0.1-rc) + rollup-plugin-dts: 6.4.0(rollup@4.59.0)(typescript@6.0.2) rxjs: 7.8.2 sass: 1.98.0 tinyglobby: 0.2.15 tslib: 2.8.1 - typescript: 6.0.1-rc + typescript: 6.0.2 optionalDependencies: rollup: 4.59.0 @@ -15548,9 +15564,9 @@ snapshots: possible-typed-array-names@1.1.0: {} - postcss-loader@8.2.1(postcss@8.5.8)(typescript@6.0.1-rc)(webpack@5.105.4(esbuild@0.27.3)): + postcss-loader@8.2.1(postcss@8.5.8)(typescript@6.0.2)(webpack@5.105.4(esbuild@0.27.3)): dependencies: - cosmiconfig: 9.0.1(typescript@6.0.1-rc) + cosmiconfig: 9.0.1(typescript@6.0.2) jiti: 2.6.1 postcss: 8.5.8 semver: 7.7.4 @@ -15703,11 +15719,11 @@ snapshots: - supports-color - utf-8-validate - puppeteer@24.40.0(bufferutil@4.1.0)(typescript@6.0.1-rc)(utf-8-validate@6.0.6): + puppeteer@24.40.0(bufferutil@4.1.0)(typescript@6.0.2)(utf-8-validate@6.0.6): dependencies: '@puppeteer/browsers': 2.13.0 chromium-bidi: 14.0.0(devtools-protocol@0.0.1581282) - cosmiconfig: 9.0.1(typescript@6.0.1-rc) + cosmiconfig: 9.0.1(typescript@6.0.2) devtools-protocol: 0.0.1581282 puppeteer-core: 24.40.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) typed-query-selector: 2.12.1 @@ -15957,25 +15973,25 @@ snapshots: semver: 7.7.4 spdx-expression-validate: 2.0.0 - rollup-plugin-dts@6.4.0(rollup@4.59.0)(typescript@6.0.1-rc): + rollup-plugin-dts@6.4.0(rollup@4.59.0)(typescript@6.0.2): dependencies: '@jridgewell/remapping': 2.3.5 '@jridgewell/sourcemap-codec': 1.5.5 convert-source-map: 2.0.0 magic-string: 0.30.21 rollup: 4.59.0 - typescript: 6.0.1-rc + typescript: 6.0.2 optionalDependencies: '@babel/code-frame': 7.29.0 - rollup-plugin-dts@6.4.1(rollup@4.60.0)(typescript@6.0.1-rc): + rollup-plugin-dts@6.4.1(rollup@4.60.0)(typescript@6.0.2): dependencies: '@jridgewell/remapping': 2.3.5 '@jridgewell/sourcemap-codec': 1.5.5 convert-source-map: 2.0.0 magic-string: 0.30.21 rollup: 4.60.0 - typescript: 6.0.1-rc + typescript: 6.0.2 optionalDependencies: '@babel/code-frame': 7.29.0 @@ -16750,9 +16766,9 @@ snapshots: dependencies: tslib: 2.8.1 - ts-api-utils@2.4.0(typescript@6.0.1-rc): + ts-api-utils@2.4.0(typescript@6.0.2): dependencies: - typescript: 6.0.1-rc + typescript: 6.0.2 tsconfig-paths@3.15.0: dependencies: @@ -16850,7 +16866,7 @@ snapshots: typescript@5.9.3: {} - typescript@6.0.1-rc: {} + typescript@6.0.2: {} ua-parser-js@0.7.41: {} diff --git a/tests/e2e/assets/ssr-project-webpack/package.json b/tests/e2e/assets/ssr-project-webpack/package.json index 06d680c58fa0..a157b69db1dc 100644 --- a/tests/e2e/assets/ssr-project-webpack/package.json +++ b/tests/e2e/assets/ssr-project-webpack/package.json @@ -35,6 +35,6 @@ "@types/express": "^4.17.24", "@types/jasmine": "~4.3.0", "@types/node": "^20.17.19", - "typescript": "~5.9.2" + "typescript": "~6.0.2" } } diff --git a/tests/e2e/assets/ssr-project-webpack/tsconfig.json b/tests/e2e/assets/ssr-project-webpack/tsconfig.json index 9fbbe86694c4..5a24f418c6cf 100644 --- a/tests/e2e/assets/ssr-project-webpack/tsconfig.json +++ b/tests/e2e/assets/ssr-project-webpack/tsconfig.json @@ -10,9 +10,8 @@ "noFallthroughCasesInSwitch": true, "sourceMap": true, "declaration": false, - "downlevelIteration": true, "experimentalDecorators": true, - "moduleResolution": "node", + "moduleResolution": "node16", "importHelpers": true, "target": "ES2022", "module": "ES2022", diff --git a/tests/e2e/tests/build/ts-paths.ts b/tests/e2e/tests/build/ts-paths.ts index 76ee53e5d2b2..1461aaef2636 100644 --- a/tests/e2e/tests/build/ts-paths.ts +++ b/tests/e2e/tests/build/ts-paths.ts @@ -4,11 +4,11 @@ import { updateTsConfig } from '../../utils/project'; export default async function () { await updateTsConfig((json) => { - json['compilerOptions']['baseUrl'] = './src'; json['compilerOptions']['paths'] = { - '@shared': ['app/shared'], - '@shared/*': ['app/shared/*'], - '@root/*': ['./*'], + '@shared': ['./src/app/shared'], + '@shared/*': ['./src/app/shared/*'], + '@root/*': ['./src/*'], + 'src/*': ['./src/*'], }; }); @@ -23,17 +23,17 @@ export default async function () { await ng('build', '--configuration=development'); await updateTsConfig((json) => { - json['compilerOptions']['paths']['*'] = ['*', 'app/shared/*']; + json['compilerOptions']['paths']['*'] = ['./*', './src/app/shared/*']; }); await appendToFile( 'src/app/app.ts', ` - import { meaning } from 'app/shared/meaning'; + import { meaning } from 'src/app/shared/meaning'; import { meaning as meaning2 } from '@shared'; import { meaning as meaning3 } from '@shared/meaning'; import { meaning as meaning4 } from 'meaning'; - import { meaning as meaning5 } from 'meaning-too'; + import { meaning as meaning5 } from 'src/meaning-too'; // need to use imports otherwise they are ignored and // no error is outputted, even if baseUrl/paths don't work