@typescript-deploys/pr-build 5.5.0-pr-58398-2 → 5.5.0-pr-58404-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/lib/tsc.js +71 -202
  2. package/lib/typescript.js +82 -207
  3. package/package.json +1 -1
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-insiders.20240502`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240503`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -56906,7 +56906,7 @@ function createTypeChecker(host) {
56906
56906
  }
56907
56907
  }
56908
56908
  return getNormalizedType(
56909
- getIntersectionType(constraints),
56909
+ getIntersectionType(constraints, 2 /* NoConstraintReduction */),
56910
56910
  /*writing*/
56911
56911
  false
56912
56912
  );
@@ -59711,7 +59711,7 @@ function createTypeChecker(host) {
59711
59711
  result.aliasTypeArguments = aliasTypeArguments;
59712
59712
  return result;
59713
59713
  }
59714
- function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
59714
+ function getIntersectionType(types, flags = 0 /* None */, aliasSymbol, aliasTypeArguments) {
59715
59715
  const typeMembershipMap = /* @__PURE__ */ new Map();
59716
59716
  const includes = addTypesToIntersection(typeMembershipMap, 0, types);
59717
59717
  const typeSet = arrayFrom(typeMembershipMap.values());
@@ -59732,7 +59732,7 @@ function createTypeChecker(host) {
59732
59732
  return includes & 16777216 /* IncludesEmptyObject */ ? neverType : includes & 32768 /* Undefined */ ? undefinedType : nullType;
59733
59733
  }
59734
59734
  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 */) {
59735
- if (!noSupertypeReduction)
59735
+ if (!(flags & 1 /* NoSupertypeReduction */))
59736
59736
  removeRedundantSupertypes(typeSet, includes);
59737
59737
  }
59738
59738
  if (includes & 262144 /* IncludesMissingType */) {
@@ -59744,7 +59744,7 @@ function createTypeChecker(host) {
59744
59744
  if (typeSet.length === 1) {
59745
59745
  return typeSet[0];
59746
59746
  }
59747
- if (typeSet.length === 2) {
59747
+ if (typeSet.length === 2 && !(flags & 2 /* NoConstraintReduction */)) {
59748
59748
  const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
59749
59749
  const typeVariable = typeSet[typeVarIndex];
59750
59750
  const primitiveType = typeSet[1 - typeVarIndex];
@@ -59763,27 +59763,27 @@ function createTypeChecker(host) {
59763
59763
  }
59764
59764
  }
59765
59765
  }
59766
- const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
59766
+ const id = getTypeListId(typeSet) + (flags & 2 /* NoConstraintReduction */ ? "*" : getAliasId(aliasSymbol, aliasTypeArguments));
59767
59767
  let result = intersectionTypes.get(id);
59768
59768
  if (!result) {
59769
59769
  if (includes & 1048576 /* Union */) {
59770
59770
  if (intersectUnionsOfPrimitiveTypes(typeSet)) {
59771
- result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
59771
+ result = getIntersectionType(typeSet, flags, aliasSymbol, aliasTypeArguments);
59772
59772
  } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && t.types[0].flags & 32768 /* Undefined */))) {
59773
59773
  const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
59774
59774
  removeFromEach(typeSet, 32768 /* Undefined */);
59775
- result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
59775
+ result = getUnionType([getIntersectionType(typeSet, flags), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
59776
59776
  } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
59777
59777
  removeFromEach(typeSet, 65536 /* Null */);
59778
- result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
59778
+ result = getUnionType([getIntersectionType(typeSet, flags), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
59779
59779
  } else if (typeSet.length >= 4) {
59780
59780
  const middle = Math.floor(typeSet.length / 2);
59781
- result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle)), getIntersectionType(typeSet.slice(middle))], aliasSymbol, aliasTypeArguments);
59781
+ result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle), flags), getIntersectionType(typeSet.slice(middle), flags)], flags, aliasSymbol, aliasTypeArguments);
59782
59782
  } else {
59783
59783
  if (!checkCrossProductUnion(typeSet)) {
59784
59784
  return errorType;
59785
59785
  }
59786
- const constituents = getCrossProductIntersections(typeSet);
59786
+ const constituents = getCrossProductIntersections(typeSet, flags);
59787
59787
  const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : void 0;
59788
59788
  result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
59789
59789
  }
@@ -59807,7 +59807,7 @@ function createTypeChecker(host) {
59807
59807
  }
59808
59808
  return true;
59809
59809
  }
59810
- function getCrossProductIntersections(types) {
59810
+ function getCrossProductIntersections(types, flags) {
59811
59811
  const count = getCrossProductUnionSize(types);
59812
59812
  const intersections = [];
59813
59813
  for (let i = 0; i < count; i++) {
@@ -59821,7 +59821,7 @@ function createTypeChecker(host) {
59821
59821
  n = Math.floor(n / length2);
59822
59822
  }
59823
59823
  }
59824
- const t = getIntersectionType(constituents);
59824
+ const t = getIntersectionType(constituents, flags);
59825
59825
  if (!(t.flags & 131072 /* Never */))
59826
59826
  intersections.push(t);
59827
59827
  }
@@ -59841,7 +59841,7 @@ function createTypeChecker(host) {
59841
59841
  const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
59842
59842
  const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
59843
59843
  const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
59844
- links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
59844
+ links.resolvedType = getIntersectionType(types, noSupertypeReduction ? 1 /* NoSupertypeReduction */ : 0, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
59845
59845
  }
59846
59846
  return links.resolvedType;
59847
59847
  }
@@ -60532,7 +60532,7 @@ function createTypeChecker(host) {
60532
60532
  if (wasMissingProp) {
60533
60533
  return void 0;
60534
60534
  }
60535
- return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
60535
+ return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, 0 /* None */, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
60536
60536
  }
60537
60537
  return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags | 8 /* CacheSymbol */ | 64 /* ReportDeprecated */);
60538
60538
  }
@@ -61656,7 +61656,7 @@ function createTypeChecker(host) {
61656
61656
  }
61657
61657
  const newAliasSymbol = aliasSymbol || type.aliasSymbol;
61658
61658
  const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
61659
- return flags & 2097152 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ? getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments);
61659
+ return flags & 2097152 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ? getIntersectionType(newTypes, 0 /* None */, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments);
61660
61660
  }
61661
61661
  if (flags & 4194304 /* Index */) {
61662
61662
  return getIndexType(instantiateType(type.type, mapper));
@@ -118794,41 +118794,10 @@ function getLibraryNameFromLibFileName(libFileName) {
118794
118794
  }
118795
118795
  return "@typescript/lib-" + path;
118796
118796
  }
118797
- function getLibNameFromLibReference(libReference) {
118798
- return toFileNameLowerCase(libReference.fileName);
118799
- }
118800
118797
  function getLibFileNameFromLibReference(libReference) {
118801
- const libName = getLibNameFromLibReference(libReference);
118802
- return libMap.get(libName);
118803
- }
118804
- function fileIncludeReasonIsEqual(a, b) {
118805
- if (a === b)
118806
- return true;
118807
- if (a.kind !== b.kind)
118808
- return false;
118809
- switch (a.kind) {
118810
- case 0 /* RootFile */:
118811
- Debug.type(b);
118812
- return a.index === b.index;
118813
- case 6 /* LibFile */:
118814
- Debug.type(b);
118815
- return a.index === b.index;
118816
- case 1 /* SourceFromProjectReference */:
118817
- case 2 /* OutputFromProjectReference */:
118818
- Debug.type(b);
118819
- return a.index === b.index;
118820
- case 3 /* Import */:
118821
- case 4 /* ReferenceFile */:
118822
- case 5 /* TypeReferenceDirective */:
118823
- case 7 /* LibReferenceDirective */:
118824
- Debug.type(b);
118825
- return a.file === b.file && a.index === b.index;
118826
- case 8 /* AutomaticTypeDirectiveFile */:
118827
- Debug.type(b);
118828
- return a.typeReference === b.typeReference && packageIdIsEqual(a.packageId, b.packageId);
118829
- default:
118830
- return Debug.assertNever(a);
118831
- }
118798
+ const libName = toFileNameLowerCase(libReference.fileName);
118799
+ const libFileName = libMap.get(libName);
118800
+ return { libName, libFileName };
118832
118801
  }
118833
118802
  function isReferencedFile(reason) {
118834
118803
  switch (reason == null ? void 0 : reason.kind) {
@@ -119071,8 +119040,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119071
119040
  let classifiableNames;
119072
119041
  const ambientModuleNameToUnmodifiedFileName = /* @__PURE__ */ new Map();
119073
119042
  let fileReasons = createMultiMap();
119074
- let fileReasonsToChain;
119075
- let reasonToRelatedInfo;
119076
119043
  const cachedBindAndCheckDiagnosticsForFile = {};
119077
119044
  const cachedDeclarationDiagnosticsForFile = {};
119078
119045
  let resolvedTypeReferenceDirectives = createModeAwareCache();
@@ -119104,7 +119071,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119104
119071
  const getDefaultLibraryFileName = memoize(() => host.getDefaultLibFileName(options));
119105
119072
  const defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : getDirectoryPath(getDefaultLibraryFileName());
119106
119073
  const programDiagnostics = createDiagnosticCollection();
119107
- let lazyProgramDiagnosticExplainingFile = [];
119108
119074
  const currentDirectory = host.getCurrentDirectory();
119109
119075
  const supportedExtensions = getSupportedExtensions(options);
119110
119076
  const supportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
@@ -119433,64 +119399,24 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119433
119399
  writeFile: writeFile2
119434
119400
  };
119435
119401
  onProgramCreateComplete();
119402
+ fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
119403
+ switch (diagnostic.kind) {
119404
+ case 1 /* FilePreprocessingFileExplainingDiagnostic */:
119405
+ return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || emptyArray));
119406
+ case 0 /* FilePreprocessingReferencedDiagnostic */:
119407
+ const { file, pos, end } = getReferencedFileLocation(program, diagnostic.reason);
119408
+ return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
119409
+ case 2 /* ResolutionDiagnostics */:
119410
+ return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
119411
+ default:
119412
+ Debug.assertNever(diagnostic);
119413
+ }
119414
+ });
119436
119415
  verifyCompilerOptions();
119437
119416
  mark("afterProgram");
119438
119417
  measure("Program", "beforeProgram", "afterProgram");
119439
119418
  (_p = tracing) == null ? void 0 : _p.pop();
119440
119419
  return program;
119441
- function updateAndGetProgramDiagnostics() {
119442
- if (lazyProgramDiagnosticExplainingFile) {
119443
- fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
119444
- switch (diagnostic.kind) {
119445
- case 1 /* FilePreprocessingFileExplainingDiagnostic */:
119446
- return programDiagnostics.add(
119447
- createDiagnosticExplainingFile(
119448
- diagnostic.file && getSourceFileByPath(diagnostic.file),
119449
- diagnostic.fileProcessingReason,
119450
- diagnostic.diagnostic,
119451
- diagnostic.args || emptyArray
119452
- )
119453
- );
119454
- case 0 /* FilePreprocessingLibreferenceDiagnostic */:
119455
- return programDiagnostics.add(filePreprocessingLibreferenceDiagnostic(diagnostic));
119456
- case 2 /* ResolutionDiagnostics */:
119457
- return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
119458
- default:
119459
- Debug.assertNever(diagnostic);
119460
- }
119461
- });
119462
- lazyProgramDiagnosticExplainingFile.forEach(
119463
- ({ file, diagnostic, args }) => programDiagnostics.add(
119464
- createDiagnosticExplainingFile(
119465
- file,
119466
- /*fileProcessingReason*/
119467
- void 0,
119468
- diagnostic,
119469
- args
119470
- )
119471
- )
119472
- );
119473
- lazyProgramDiagnosticExplainingFile = void 0;
119474
- fileReasonsToChain = void 0;
119475
- reasonToRelatedInfo = void 0;
119476
- }
119477
- return programDiagnostics;
119478
- }
119479
- function filePreprocessingLibreferenceDiagnostic({ reason }) {
119480
- const { file, pos, end } = getReferencedFileLocation(program, reason);
119481
- const libReference = file.libReferenceDirectives[reason.index];
119482
- const libName = getLibNameFromLibReference(libReference);
119483
- const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
119484
- const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
119485
- return createFileDiagnostic(
119486
- file,
119487
- Debug.checkDefined(pos),
119488
- Debug.checkDefined(end) - pos,
119489
- suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0,
119490
- libName,
119491
- suggestion
119492
- );
119493
- }
119494
119420
  function getResolvedModule(file, moduleName, mode) {
119495
119421
  var _a2;
119496
119422
  return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
@@ -120183,7 +120109,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120183
120109
  if (skipTypeChecking(sourceFile, options, program)) {
120184
120110
  return emptyArray;
120185
120111
  }
120186
- const programDiagnosticsInFile = updateAndGetProgramDiagnostics().getDiagnostics(sourceFile.fileName);
120112
+ const programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);
120187
120113
  if (!((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
120188
120114
  return programDiagnosticsInFile;
120189
120115
  }
@@ -120530,16 +120456,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120530
120456
  }
120531
120457
  function getOptionsDiagnostics() {
120532
120458
  return sortAndDeduplicateDiagnostics(concatenate(
120533
- updateAndGetProgramDiagnostics().getGlobalDiagnostics(),
120459
+ programDiagnostics.getGlobalDiagnostics(),
120534
120460
  getOptionsDiagnosticsOfConfigFile()
120535
120461
  ));
120536
120462
  }
120537
120463
  function getOptionsDiagnosticsOfConfigFile() {
120538
120464
  if (!options.configFile)
120539
120465
  return emptyArray;
120540
- let diagnostics = updateAndGetProgramDiagnostics().getDiagnostics(options.configFile.fileName);
120466
+ let diagnostics = programDiagnostics.getDiagnostics(options.configFile.fileName);
120541
120467
  forEachResolvedProjectReference2((resolvedRef) => {
120542
- diagnostics = concatenate(diagnostics, updateAndGetProgramDiagnostics().getDiagnostics(resolvedRef.sourceFile.fileName));
120468
+ diagnostics = concatenate(diagnostics, programDiagnostics.getDiagnostics(resolvedRef.sourceFile.fileName));
120543
120469
  });
120544
120470
  return diagnostics;
120545
120471
  }
@@ -120713,7 +120639,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120713
120639
  }
120714
120640
  function getLibFileFromReference(ref) {
120715
120641
  var _a2;
120716
- const libFileName = getLibFileNameFromLibReference(ref);
120642
+ const { libFileName } = getLibFileNameFromLibReference(ref);
120717
120643
  const actualFileName = libFileName && ((_a2 = resolvedLibReferences == null ? void 0 : resolvedLibReferences.get(libFileName)) == null ? void 0 : _a2.actual);
120718
120644
  return actualFileName !== void 0 ? getSourceFile(actualFileName) : void 0;
120719
120645
  }
@@ -120961,12 +120887,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120961
120887
  return file;
120962
120888
  }
120963
120889
  function addFileIncludeReason(file, reason) {
120964
- if (file) {
120965
- const existing = fileReasons.get(file.path);
120966
- if (!some(existing, (r) => fileIncludeReasonIsEqual(r, reason))) {
120967
- fileReasons.add(file.path, reason);
120968
- }
120969
- }
120890
+ if (file)
120891
+ fileReasons.add(file.path, reason);
120970
120892
  }
120971
120893
  function addFileToFilesByName(file, path, fileName, redirectedPath) {
120972
120894
  if (redirectedPath) {
@@ -121196,7 +121118,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121196
121118
  }
121197
121119
  function processLibReferenceDirectives(file) {
121198
121120
  forEach(file.libReferenceDirectives, (libReference, index) => {
121199
- const libFileName = getLibFileNameFromLibReference(libReference);
121121
+ const { libName, libFileName } = getLibFileNameFromLibReference(libReference);
121200
121122
  if (libFileName) {
121201
121123
  processRootFile(
121202
121124
  pathForLibFile(libFileName),
@@ -121207,9 +121129,15 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121207
121129
  { kind: 7 /* LibReferenceDirective */, file: file.path, index }
121208
121130
  );
121209
121131
  } else {
121132
+ const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
121133
+ const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
121134
+ const diagnostic = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0;
121135
+ const args = suggestion ? [libName, suggestion] : [libName];
121210
121136
  (fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
121211
- kind: 0 /* FilePreprocessingLibreferenceDiagnostic */,
121212
- reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index }
121137
+ kind: 0 /* FilePreprocessingReferencedDiagnostic */,
121138
+ reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index },
121139
+ diagnostic,
121140
+ args
121213
121141
  });
121214
121142
  }
121215
121143
  });
@@ -121270,7 +121198,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121270
121198
  if (!sourceFile.isDeclarationFile) {
121271
121199
  const absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
121272
121200
  if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
121273
- addLazyProgramDiagnosticExplainingFile(
121201
+ addProgramDiagnosticExplainingFile(
121274
121202
  sourceFile,
121275
121203
  Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files,
121276
121204
  [sourceFile.fileName, rootDirectory]
@@ -121400,7 +121328,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121400
121328
  const rootPaths = new Set(rootNames.map(toPath3));
121401
121329
  for (const file of files) {
121402
121330
  if (sourceFileMayBeEmitted(file, program) && !rootPaths.has(file.path)) {
121403
- addLazyProgramDiagnosticExplainingFile(
121331
+ addProgramDiagnosticExplainingFile(
121404
121332
  file,
121405
121333
  Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern,
121406
121334
  [file.fileName, options.configFilePath || ""]
@@ -121763,90 +121691,31 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121763
121691
  });
121764
121692
  }
121765
121693
  function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
121766
- let seenReasons;
121767
- const reasons = file && fileReasons.get(file.path);
121694
+ var _a2;
121768
121695
  let fileIncludeReasons;
121769
121696
  let relatedInfo;
121770
121697
  let locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : void 0;
121771
- let fileIncludeReasonDetails;
121772
- let redirectInfo;
121773
- let cachedChain = file && (fileReasonsToChain == null ? void 0 : fileReasonsToChain.get(file.path));
121774
- let chain;
121775
- if (cachedChain) {
121776
- if (cachedChain.fileIncludeReasonDetails) {
121777
- seenReasons = new Set(reasons);
121778
- reasons == null ? void 0 : reasons.forEach(populateRelatedInfo);
121779
- } else {
121780
- reasons == null ? void 0 : reasons.forEach(processReason);
121781
- }
121782
- redirectInfo = cachedChain.redirectInfo;
121783
- } else {
121784
- reasons == null ? void 0 : reasons.forEach(processReason);
121785
- redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, getCompilerOptionsForFile(file));
121786
- }
121698
+ if (file)
121699
+ (_a2 = fileReasons.get(file.path)) == null ? void 0 : _a2.forEach(processReason);
121787
121700
  if (fileProcessingReason)
121788
121701
  processReason(fileProcessingReason);
121789
- const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
121790
- if (locationReason && (seenReasons == null ? void 0 : seenReasons.size) === 1)
121791
- seenReasons = void 0;
121792
- if (seenReasons && cachedChain) {
121793
- if (cachedChain.details && !processedExtraReason) {
121794
- chain = chainDiagnosticMessages(cachedChain.details, diagnostic, ...args || emptyArray);
121795
- } else if (cachedChain.fileIncludeReasonDetails) {
121796
- if (!processedExtraReason) {
121797
- if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
121798
- fileIncludeReasonDetails = cachedChain.fileIncludeReasonDetails;
121799
- } else {
121800
- fileIncludeReasons = cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length);
121801
- }
121802
- } else {
121803
- if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
121804
- fileIncludeReasons = [...cachedChain.fileIncludeReasonDetails.next, fileIncludeReasons[0]];
121805
- } else {
121806
- fileIncludeReasons = append(cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length), fileIncludeReasons[0]);
121807
- }
121808
- }
121809
- }
121810
- }
121811
- if (!chain) {
121812
- if (!fileIncludeReasonDetails)
121813
- fileIncludeReasonDetails = seenReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
121814
- chain = chainDiagnosticMessages(
121815
- redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails,
121816
- diagnostic,
121817
- ...args || emptyArray
121818
- );
121819
- }
121820
- if (file) {
121821
- if (cachedChain) {
121822
- if (!cachedChain.fileIncludeReasonDetails || !processedExtraReason && fileIncludeReasonDetails) {
121823
- cachedChain.fileIncludeReasonDetails = fileIncludeReasonDetails;
121824
- }
121825
- } else {
121826
- (fileReasonsToChain ?? (fileReasonsToChain = /* @__PURE__ */ new Map())).set(file.path, cachedChain = { fileIncludeReasonDetails, redirectInfo });
121827
- }
121828
- if (!cachedChain.details && !processedExtraReason)
121829
- cachedChain.details = chain.next;
121830
- }
121702
+ if (locationReason && (fileIncludeReasons == null ? void 0 : fileIncludeReasons.length) === 1)
121703
+ fileIncludeReasons = void 0;
121831
121704
  const location = locationReason && getReferencedFileLocation(program, locationReason);
121705
+ const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
121706
+ const optionsForFile = file && getCompilerOptionsForFile(file) || options;
121707
+ const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, optionsForFile);
121708
+ const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
121832
121709
  return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
121833
121710
  function processReason(reason) {
121834
- if (seenReasons == null ? void 0 : seenReasons.has(reason))
121835
- return;
121836
- (seenReasons ?? (seenReasons = /* @__PURE__ */ new Set())).add(reason);
121837
- (fileIncludeReasons ?? (fileIncludeReasons = [])).push(fileIncludeReasonToDiagnostics(program, reason));
121838
- populateRelatedInfo(reason);
121839
- }
121840
- function populateRelatedInfo(reason) {
121711
+ (fileIncludeReasons || (fileIncludeReasons = [])).push(fileIncludeReasonToDiagnostics(program, reason));
121841
121712
  if (!locationReason && isReferencedFile(reason)) {
121842
121713
  locationReason = reason;
121843
121714
  } else if (locationReason !== reason) {
121844
- relatedInfo = append(relatedInfo, getFileIncludeReasonToRelatedInformation(reason));
121715
+ relatedInfo = append(relatedInfo, fileIncludeReasonToRelatedInformation(reason));
121845
121716
  }
121846
- }
121847
- function cachedFileIncludeDetailsHasProcessedExtraReason() {
121848
- var _a2;
121849
- return ((_a2 = cachedChain.fileIncludeReasonDetails.next) == null ? void 0 : _a2.length) !== (reasons == null ? void 0 : reasons.length);
121717
+ if (reason === fileProcessingReason)
121718
+ fileProcessingReason = void 0;
121850
121719
  }
121851
121720
  }
121852
121721
  function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
@@ -121858,14 +121727,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121858
121727
  args
121859
121728
  });
121860
121729
  }
121861
- function addLazyProgramDiagnosticExplainingFile(file, diagnostic, args) {
121862
- lazyProgramDiagnosticExplainingFile.push({ file, diagnostic, args });
121863
- }
121864
- function getFileIncludeReasonToRelatedInformation(reason) {
121865
- let relatedInfo = reasonToRelatedInfo == null ? void 0 : reasonToRelatedInfo.get(reason);
121866
- if (relatedInfo === void 0)
121867
- (reasonToRelatedInfo ?? (reasonToRelatedInfo = /* @__PURE__ */ new Map())).set(reason, relatedInfo = fileIncludeReasonToRelatedInformation(reason) ?? false);
121868
- return relatedInfo || void 0;
121730
+ function addProgramDiagnosticExplainingFile(file, diagnostic, args) {
121731
+ programDiagnostics.add(createDiagnosticExplainingFile(
121732
+ file,
121733
+ /*fileProcessingReason*/
121734
+ void 0,
121735
+ diagnostic,
121736
+ args
121737
+ ));
121869
121738
  }
121870
121739
  function fileIncludeReasonToRelatedInformation(reason) {
121871
121740
  if (isReferencedFile(reason)) {
package/lib/typescript.js CHANGED
@@ -99,6 +99,7 @@ __export(typescript_exports, {
99
99
  InlayHints: () => ts_InlayHints_exports,
100
100
  InternalEmitFlags: () => InternalEmitFlags,
101
101
  InternalSymbolName: () => InternalSymbolName,
102
+ IntersectionFlags: () => IntersectionFlags,
102
103
  InvalidatedProjectKind: () => InvalidatedProjectKind,
103
104
  JSDocParsingMode: () => JSDocParsingMode,
104
105
  JsDoc: () => ts_JsDoc_exports,
@@ -1984,7 +1985,6 @@ __export(typescript_exports, {
1984
1985
  or: () => or,
1985
1986
  orderedRemoveItem: () => orderedRemoveItem,
1986
1987
  orderedRemoveItemAt: () => orderedRemoveItemAt,
1987
- packageIdIsEqual: () => packageIdIsEqual,
1988
1988
  packageIdToPackageName: () => packageIdToPackageName,
1989
1989
  packageIdToString: () => packageIdToString,
1990
1990
  paramHelper: () => paramHelper,
@@ -2364,7 +2364,7 @@ module.exports = __toCommonJS(typescript_exports);
2364
2364
 
2365
2365
  // src/compiler/corePublic.ts
2366
2366
  var versionMajorMinor = "5.5";
2367
- var version = `${versionMajorMinor}.0-insiders.20240502`;
2367
+ var version = `${versionMajorMinor}.0-insiders.20240503`;
2368
2368
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2369
2369
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2370
2370
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6355,7 +6355,7 @@ var FileIncludeKind = /* @__PURE__ */ ((FileIncludeKind2) => {
6355
6355
  return FileIncludeKind2;
6356
6356
  })(FileIncludeKind || {});
6357
6357
  var FilePreprocessingDiagnosticsKind = /* @__PURE__ */ ((FilePreprocessingDiagnosticsKind2) => {
6358
- FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["FilePreprocessingLibreferenceDiagnostic"] = 0] = "FilePreprocessingLibreferenceDiagnostic";
6358
+ FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["FilePreprocessingReferencedDiagnostic"] = 0] = "FilePreprocessingReferencedDiagnostic";
6359
6359
  FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["FilePreprocessingFileExplainingDiagnostic"] = 1] = "FilePreprocessingFileExplainingDiagnostic";
6360
6360
  FilePreprocessingDiagnosticsKind2[FilePreprocessingDiagnosticsKind2["ResolutionDiagnostics"] = 2] = "ResolutionDiagnostics";
6361
6361
  return FilePreprocessingDiagnosticsKind2;
@@ -6391,6 +6391,12 @@ var UnionReduction = /* @__PURE__ */ ((UnionReduction2) => {
6391
6391
  UnionReduction2[UnionReduction2["Subtype"] = 2] = "Subtype";
6392
6392
  return UnionReduction2;
6393
6393
  })(UnionReduction || {});
6394
+ var IntersectionFlags = /* @__PURE__ */ ((IntersectionFlags2) => {
6395
+ IntersectionFlags2[IntersectionFlags2["None"] = 0] = "None";
6396
+ IntersectionFlags2[IntersectionFlags2["NoSupertypeReduction"] = 1] = "NoSupertypeReduction";
6397
+ IntersectionFlags2[IntersectionFlags2["NoConstraintReduction"] = 2] = "NoConstraintReduction";
6398
+ return IntersectionFlags2;
6399
+ })(IntersectionFlags || {});
6394
6400
  var ContextFlags = /* @__PURE__ */ ((ContextFlags3) => {
6395
6401
  ContextFlags3[ContextFlags3["None"] = 0] = "None";
6396
6402
  ContextFlags3[ContextFlags3["Signature"] = 1] = "Signature";
@@ -61740,7 +61746,7 @@ function createTypeChecker(host) {
61740
61746
  }
61741
61747
  }
61742
61748
  return getNormalizedType(
61743
- getIntersectionType(constraints),
61749
+ getIntersectionType(constraints, 2 /* NoConstraintReduction */),
61744
61750
  /*writing*/
61745
61751
  false
61746
61752
  );
@@ -64545,7 +64551,7 @@ function createTypeChecker(host) {
64545
64551
  result.aliasTypeArguments = aliasTypeArguments;
64546
64552
  return result;
64547
64553
  }
64548
- function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
64554
+ function getIntersectionType(types, flags = 0 /* None */, aliasSymbol, aliasTypeArguments) {
64549
64555
  const typeMembershipMap = /* @__PURE__ */ new Map();
64550
64556
  const includes = addTypesToIntersection(typeMembershipMap, 0, types);
64551
64557
  const typeSet = arrayFrom(typeMembershipMap.values());
@@ -64566,7 +64572,7 @@ function createTypeChecker(host) {
64566
64572
  return includes & 16777216 /* IncludesEmptyObject */ ? neverType : includes & 32768 /* Undefined */ ? undefinedType : nullType;
64567
64573
  }
64568
64574
  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 */) {
64569
- if (!noSupertypeReduction)
64575
+ if (!(flags & 1 /* NoSupertypeReduction */))
64570
64576
  removeRedundantSupertypes(typeSet, includes);
64571
64577
  }
64572
64578
  if (includes & 262144 /* IncludesMissingType */) {
@@ -64578,7 +64584,7 @@ function createTypeChecker(host) {
64578
64584
  if (typeSet.length === 1) {
64579
64585
  return typeSet[0];
64580
64586
  }
64581
- if (typeSet.length === 2) {
64587
+ if (typeSet.length === 2 && !(flags & 2 /* NoConstraintReduction */)) {
64582
64588
  const typeVarIndex = typeSet[0].flags & 8650752 /* TypeVariable */ ? 0 : 1;
64583
64589
  const typeVariable = typeSet[typeVarIndex];
64584
64590
  const primitiveType = typeSet[1 - typeVarIndex];
@@ -64597,27 +64603,27 @@ function createTypeChecker(host) {
64597
64603
  }
64598
64604
  }
64599
64605
  }
64600
- const id = getTypeListId(typeSet) + getAliasId(aliasSymbol, aliasTypeArguments);
64606
+ const id = getTypeListId(typeSet) + (flags & 2 /* NoConstraintReduction */ ? "*" : getAliasId(aliasSymbol, aliasTypeArguments));
64601
64607
  let result = intersectionTypes.get(id);
64602
64608
  if (!result) {
64603
64609
  if (includes & 1048576 /* Union */) {
64604
64610
  if (intersectUnionsOfPrimitiveTypes(typeSet)) {
64605
- result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
64611
+ result = getIntersectionType(typeSet, flags, aliasSymbol, aliasTypeArguments);
64606
64612
  } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && t.types[0].flags & 32768 /* Undefined */))) {
64607
64613
  const containedUndefinedType = some(typeSet, containsMissingType) ? missingType : undefinedType;
64608
64614
  removeFromEach(typeSet, 32768 /* Undefined */);
64609
- result = getUnionType([getIntersectionType(typeSet), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
64615
+ result = getUnionType([getIntersectionType(typeSet, flags), containedUndefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
64610
64616
  } else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
64611
64617
  removeFromEach(typeSet, 65536 /* Null */);
64612
- result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
64618
+ result = getUnionType([getIntersectionType(typeSet, flags), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
64613
64619
  } else if (typeSet.length >= 4) {
64614
64620
  const middle = Math.floor(typeSet.length / 2);
64615
- result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle)), getIntersectionType(typeSet.slice(middle))], aliasSymbol, aliasTypeArguments);
64621
+ result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle), flags), getIntersectionType(typeSet.slice(middle), flags)], flags, aliasSymbol, aliasTypeArguments);
64616
64622
  } else {
64617
64623
  if (!checkCrossProductUnion(typeSet)) {
64618
64624
  return errorType;
64619
64625
  }
64620
- const constituents = getCrossProductIntersections(typeSet);
64626
+ const constituents = getCrossProductIntersections(typeSet, flags);
64621
64627
  const origin = some(constituents, (t) => !!(t.flags & 2097152 /* Intersection */)) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152 /* Intersection */, typeSet) : void 0;
64622
64628
  result = getUnionType(constituents, 1 /* Literal */, aliasSymbol, aliasTypeArguments, origin);
64623
64629
  }
@@ -64641,7 +64647,7 @@ function createTypeChecker(host) {
64641
64647
  }
64642
64648
  return true;
64643
64649
  }
64644
- function getCrossProductIntersections(types) {
64650
+ function getCrossProductIntersections(types, flags) {
64645
64651
  const count = getCrossProductUnionSize(types);
64646
64652
  const intersections = [];
64647
64653
  for (let i = 0; i < count; i++) {
@@ -64655,7 +64661,7 @@ function createTypeChecker(host) {
64655
64661
  n = Math.floor(n / length2);
64656
64662
  }
64657
64663
  }
64658
- const t = getIntersectionType(constituents);
64664
+ const t = getIntersectionType(constituents, flags);
64659
64665
  if (!(t.flags & 131072 /* Never */))
64660
64666
  intersections.push(t);
64661
64667
  }
@@ -64675,7 +64681,7 @@ function createTypeChecker(host) {
64675
64681
  const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
64676
64682
  const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
64677
64683
  const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
64678
- links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
64684
+ links.resolvedType = getIntersectionType(types, noSupertypeReduction ? 1 /* NoSupertypeReduction */ : 0, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol));
64679
64685
  }
64680
64686
  return links.resolvedType;
64681
64687
  }
@@ -65366,7 +65372,7 @@ function createTypeChecker(host) {
65366
65372
  if (wasMissingProp) {
65367
65373
  return void 0;
65368
65374
  }
65369
- return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
65375
+ return accessFlags & 4 /* Writing */ ? getIntersectionType(propTypes, 0 /* None */, aliasSymbol, aliasTypeArguments) : getUnionType(propTypes, 1 /* Literal */, aliasSymbol, aliasTypeArguments);
65370
65376
  }
65371
65377
  return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, accessNode, accessFlags | 8 /* CacheSymbol */ | 64 /* ReportDeprecated */);
65372
65378
  }
@@ -66490,7 +66496,7 @@ function createTypeChecker(host) {
66490
66496
  }
66491
66497
  const newAliasSymbol = aliasSymbol || type.aliasSymbol;
66492
66498
  const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
66493
- return flags & 2097152 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ? getIntersectionType(newTypes, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments);
66499
+ return flags & 2097152 /* Intersection */ || origin && origin.flags & 2097152 /* Intersection */ ? getIntersectionType(newTypes, 0 /* None */, newAliasSymbol, newAliasTypeArguments) : getUnionType(newTypes, 1 /* Literal */, newAliasSymbol, newAliasTypeArguments);
66494
66500
  }
66495
66501
  if (flags & 4194304 /* Index */) {
66496
66502
  return getIndexType(instantiateType(type.type, mapper));
@@ -123868,41 +123874,10 @@ function getLibraryNameFromLibFileName(libFileName) {
123868
123874
  }
123869
123875
  return "@typescript/lib-" + path;
123870
123876
  }
123871
- function getLibNameFromLibReference(libReference) {
123872
- return toFileNameLowerCase(libReference.fileName);
123873
- }
123874
123877
  function getLibFileNameFromLibReference(libReference) {
123875
- const libName = getLibNameFromLibReference(libReference);
123876
- return libMap.get(libName);
123877
- }
123878
- function fileIncludeReasonIsEqual(a, b) {
123879
- if (a === b)
123880
- return true;
123881
- if (a.kind !== b.kind)
123882
- return false;
123883
- switch (a.kind) {
123884
- case 0 /* RootFile */:
123885
- Debug.type(b);
123886
- return a.index === b.index;
123887
- case 6 /* LibFile */:
123888
- Debug.type(b);
123889
- return a.index === b.index;
123890
- case 1 /* SourceFromProjectReference */:
123891
- case 2 /* OutputFromProjectReference */:
123892
- Debug.type(b);
123893
- return a.index === b.index;
123894
- case 3 /* Import */:
123895
- case 4 /* ReferenceFile */:
123896
- case 5 /* TypeReferenceDirective */:
123897
- case 7 /* LibReferenceDirective */:
123898
- Debug.type(b);
123899
- return a.file === b.file && a.index === b.index;
123900
- case 8 /* AutomaticTypeDirectiveFile */:
123901
- Debug.type(b);
123902
- return a.typeReference === b.typeReference && packageIdIsEqual(a.packageId, b.packageId);
123903
- default:
123904
- return Debug.assertNever(a);
123905
- }
123878
+ const libName = toFileNameLowerCase(libReference.fileName);
123879
+ const libFileName = libMap.get(libName);
123880
+ return { libName, libFileName };
123906
123881
  }
123907
123882
  function isReferencedFile(reason) {
123908
123883
  switch (reason == null ? void 0 : reason.kind) {
@@ -124149,8 +124124,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124149
124124
  let classifiableNames;
124150
124125
  const ambientModuleNameToUnmodifiedFileName = /* @__PURE__ */ new Map();
124151
124126
  let fileReasons = createMultiMap();
124152
- let fileReasonsToChain;
124153
- let reasonToRelatedInfo;
124154
124127
  const cachedBindAndCheckDiagnosticsForFile = {};
124155
124128
  const cachedDeclarationDiagnosticsForFile = {};
124156
124129
  let resolvedTypeReferenceDirectives = createModeAwareCache();
@@ -124182,7 +124155,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124182
124155
  const getDefaultLibraryFileName = memoize(() => host.getDefaultLibFileName(options));
124183
124156
  const defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : getDirectoryPath(getDefaultLibraryFileName());
124184
124157
  const programDiagnostics = createDiagnosticCollection();
124185
- let lazyProgramDiagnosticExplainingFile = [];
124186
124158
  const currentDirectory = host.getCurrentDirectory();
124187
124159
  const supportedExtensions = getSupportedExtensions(options);
124188
124160
  const supportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
@@ -124511,64 +124483,24 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
124511
124483
  writeFile: writeFile2
124512
124484
  };
124513
124485
  onProgramCreateComplete();
124486
+ fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
124487
+ switch (diagnostic.kind) {
124488
+ case 1 /* FilePreprocessingFileExplainingDiagnostic */:
124489
+ return programDiagnostics.add(createDiagnosticExplainingFile(diagnostic.file && getSourceFileByPath(diagnostic.file), diagnostic.fileProcessingReason, diagnostic.diagnostic, diagnostic.args || emptyArray));
124490
+ case 0 /* FilePreprocessingReferencedDiagnostic */:
124491
+ const { file, pos, end } = getReferencedFileLocation(program, diagnostic.reason);
124492
+ return programDiagnostics.add(createFileDiagnostic(file, Debug.checkDefined(pos), Debug.checkDefined(end) - pos, diagnostic.diagnostic, ...diagnostic.args || emptyArray));
124493
+ case 2 /* ResolutionDiagnostics */:
124494
+ return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
124495
+ default:
124496
+ Debug.assertNever(diagnostic);
124497
+ }
124498
+ });
124514
124499
  verifyCompilerOptions();
124515
124500
  mark("afterProgram");
124516
124501
  measure("Program", "beforeProgram", "afterProgram");
124517
124502
  (_p = tracing) == null ? void 0 : _p.pop();
124518
124503
  return program;
124519
- function updateAndGetProgramDiagnostics() {
124520
- if (lazyProgramDiagnosticExplainingFile) {
124521
- fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
124522
- switch (diagnostic.kind) {
124523
- case 1 /* FilePreprocessingFileExplainingDiagnostic */:
124524
- return programDiagnostics.add(
124525
- createDiagnosticExplainingFile(
124526
- diagnostic.file && getSourceFileByPath(diagnostic.file),
124527
- diagnostic.fileProcessingReason,
124528
- diagnostic.diagnostic,
124529
- diagnostic.args || emptyArray
124530
- )
124531
- );
124532
- case 0 /* FilePreprocessingLibreferenceDiagnostic */:
124533
- return programDiagnostics.add(filePreprocessingLibreferenceDiagnostic(diagnostic));
124534
- case 2 /* ResolutionDiagnostics */:
124535
- return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
124536
- default:
124537
- Debug.assertNever(diagnostic);
124538
- }
124539
- });
124540
- lazyProgramDiagnosticExplainingFile.forEach(
124541
- ({ file, diagnostic, args }) => programDiagnostics.add(
124542
- createDiagnosticExplainingFile(
124543
- file,
124544
- /*fileProcessingReason*/
124545
- void 0,
124546
- diagnostic,
124547
- args
124548
- )
124549
- )
124550
- );
124551
- lazyProgramDiagnosticExplainingFile = void 0;
124552
- fileReasonsToChain = void 0;
124553
- reasonToRelatedInfo = void 0;
124554
- }
124555
- return programDiagnostics;
124556
- }
124557
- function filePreprocessingLibreferenceDiagnostic({ reason }) {
124558
- const { file, pos, end } = getReferencedFileLocation(program, reason);
124559
- const libReference = file.libReferenceDirectives[reason.index];
124560
- const libName = getLibNameFromLibReference(libReference);
124561
- const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
124562
- const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
124563
- return createFileDiagnostic(
124564
- file,
124565
- Debug.checkDefined(pos),
124566
- Debug.checkDefined(end) - pos,
124567
- suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0,
124568
- libName,
124569
- suggestion
124570
- );
124571
- }
124572
124504
  function getResolvedModule(file, moduleName, mode) {
124573
124505
  var _a2;
124574
124506
  return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
@@ -125261,7 +125193,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125261
125193
  if (skipTypeChecking(sourceFile, options, program)) {
125262
125194
  return emptyArray;
125263
125195
  }
125264
- const programDiagnosticsInFile = updateAndGetProgramDiagnostics().getDiagnostics(sourceFile.fileName);
125196
+ const programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName);
125265
125197
  if (!((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
125266
125198
  return programDiagnosticsInFile;
125267
125199
  }
@@ -125608,16 +125540,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125608
125540
  }
125609
125541
  function getOptionsDiagnostics() {
125610
125542
  return sortAndDeduplicateDiagnostics(concatenate(
125611
- updateAndGetProgramDiagnostics().getGlobalDiagnostics(),
125543
+ programDiagnostics.getGlobalDiagnostics(),
125612
125544
  getOptionsDiagnosticsOfConfigFile()
125613
125545
  ));
125614
125546
  }
125615
125547
  function getOptionsDiagnosticsOfConfigFile() {
125616
125548
  if (!options.configFile)
125617
125549
  return emptyArray;
125618
- let diagnostics = updateAndGetProgramDiagnostics().getDiagnostics(options.configFile.fileName);
125550
+ let diagnostics = programDiagnostics.getDiagnostics(options.configFile.fileName);
125619
125551
  forEachResolvedProjectReference2((resolvedRef) => {
125620
- diagnostics = concatenate(diagnostics, updateAndGetProgramDiagnostics().getDiagnostics(resolvedRef.sourceFile.fileName));
125552
+ diagnostics = concatenate(diagnostics, programDiagnostics.getDiagnostics(resolvedRef.sourceFile.fileName));
125621
125553
  });
125622
125554
  return diagnostics;
125623
125555
  }
@@ -125791,7 +125723,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125791
125723
  }
125792
125724
  function getLibFileFromReference(ref) {
125793
125725
  var _a2;
125794
- const libFileName = getLibFileNameFromLibReference(ref);
125726
+ const { libFileName } = getLibFileNameFromLibReference(ref);
125795
125727
  const actualFileName = libFileName && ((_a2 = resolvedLibReferences == null ? void 0 : resolvedLibReferences.get(libFileName)) == null ? void 0 : _a2.actual);
125796
125728
  return actualFileName !== void 0 ? getSourceFile(actualFileName) : void 0;
125797
125729
  }
@@ -126039,12 +125971,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126039
125971
  return file;
126040
125972
  }
126041
125973
  function addFileIncludeReason(file, reason) {
126042
- if (file) {
126043
- const existing = fileReasons.get(file.path);
126044
- if (!some(existing, (r) => fileIncludeReasonIsEqual(r, reason))) {
126045
- fileReasons.add(file.path, reason);
126046
- }
126047
- }
125974
+ if (file)
125975
+ fileReasons.add(file.path, reason);
126048
125976
  }
126049
125977
  function addFileToFilesByName(file, path, fileName, redirectedPath) {
126050
125978
  if (redirectedPath) {
@@ -126274,7 +126202,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126274
126202
  }
126275
126203
  function processLibReferenceDirectives(file) {
126276
126204
  forEach(file.libReferenceDirectives, (libReference, index) => {
126277
- const libFileName = getLibFileNameFromLibReference(libReference);
126205
+ const { libName, libFileName } = getLibFileNameFromLibReference(libReference);
126278
126206
  if (libFileName) {
126279
126207
  processRootFile(
126280
126208
  pathForLibFile(libFileName),
@@ -126285,9 +126213,15 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126285
126213
  { kind: 7 /* LibReferenceDirective */, file: file.path, index }
126286
126214
  );
126287
126215
  } else {
126216
+ const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
126217
+ const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
126218
+ const diagnostic = suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0;
126219
+ const args = suggestion ? [libName, suggestion] : [libName];
126288
126220
  (fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
126289
- kind: 0 /* FilePreprocessingLibreferenceDiagnostic */,
126290
- reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index }
126221
+ kind: 0 /* FilePreprocessingReferencedDiagnostic */,
126222
+ reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index },
126223
+ diagnostic,
126224
+ args
126291
126225
  });
126292
126226
  }
126293
126227
  });
@@ -126348,7 +126282,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126348
126282
  if (!sourceFile.isDeclarationFile) {
126349
126283
  const absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
126350
126284
  if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
126351
- addLazyProgramDiagnosticExplainingFile(
126285
+ addProgramDiagnosticExplainingFile(
126352
126286
  sourceFile,
126353
126287
  Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files,
126354
126288
  [sourceFile.fileName, rootDirectory]
@@ -126478,7 +126412,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126478
126412
  const rootPaths = new Set(rootNames.map(toPath3));
126479
126413
  for (const file of files) {
126480
126414
  if (sourceFileMayBeEmitted(file, program) && !rootPaths.has(file.path)) {
126481
- addLazyProgramDiagnosticExplainingFile(
126415
+ addProgramDiagnosticExplainingFile(
126482
126416
  file,
126483
126417
  Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern,
126484
126418
  [file.fileName, options.configFilePath || ""]
@@ -126841,90 +126775,31 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126841
126775
  });
126842
126776
  }
126843
126777
  function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
126844
- let seenReasons;
126845
- const reasons = file && fileReasons.get(file.path);
126778
+ var _a2;
126846
126779
  let fileIncludeReasons;
126847
126780
  let relatedInfo;
126848
126781
  let locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : void 0;
126849
- let fileIncludeReasonDetails;
126850
- let redirectInfo;
126851
- let cachedChain = file && (fileReasonsToChain == null ? void 0 : fileReasonsToChain.get(file.path));
126852
- let chain;
126853
- if (cachedChain) {
126854
- if (cachedChain.fileIncludeReasonDetails) {
126855
- seenReasons = new Set(reasons);
126856
- reasons == null ? void 0 : reasons.forEach(populateRelatedInfo);
126857
- } else {
126858
- reasons == null ? void 0 : reasons.forEach(processReason);
126859
- }
126860
- redirectInfo = cachedChain.redirectInfo;
126861
- } else {
126862
- reasons == null ? void 0 : reasons.forEach(processReason);
126863
- redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, getCompilerOptionsForFile(file));
126864
- }
126782
+ if (file)
126783
+ (_a2 = fileReasons.get(file.path)) == null ? void 0 : _a2.forEach(processReason);
126865
126784
  if (fileProcessingReason)
126866
126785
  processReason(fileProcessingReason);
126867
- const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
126868
- if (locationReason && (seenReasons == null ? void 0 : seenReasons.size) === 1)
126869
- seenReasons = void 0;
126870
- if (seenReasons && cachedChain) {
126871
- if (cachedChain.details && !processedExtraReason) {
126872
- chain = chainDiagnosticMessages(cachedChain.details, diagnostic, ...args || emptyArray);
126873
- } else if (cachedChain.fileIncludeReasonDetails) {
126874
- if (!processedExtraReason) {
126875
- if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
126876
- fileIncludeReasonDetails = cachedChain.fileIncludeReasonDetails;
126877
- } else {
126878
- fileIncludeReasons = cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length);
126879
- }
126880
- } else {
126881
- if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
126882
- fileIncludeReasons = [...cachedChain.fileIncludeReasonDetails.next, fileIncludeReasons[0]];
126883
- } else {
126884
- fileIncludeReasons = append(cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length), fileIncludeReasons[0]);
126885
- }
126886
- }
126887
- }
126888
- }
126889
- if (!chain) {
126890
- if (!fileIncludeReasonDetails)
126891
- fileIncludeReasonDetails = seenReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
126892
- chain = chainDiagnosticMessages(
126893
- redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails,
126894
- diagnostic,
126895
- ...args || emptyArray
126896
- );
126897
- }
126898
- if (file) {
126899
- if (cachedChain) {
126900
- if (!cachedChain.fileIncludeReasonDetails || !processedExtraReason && fileIncludeReasonDetails) {
126901
- cachedChain.fileIncludeReasonDetails = fileIncludeReasonDetails;
126902
- }
126903
- } else {
126904
- (fileReasonsToChain ?? (fileReasonsToChain = /* @__PURE__ */ new Map())).set(file.path, cachedChain = { fileIncludeReasonDetails, redirectInfo });
126905
- }
126906
- if (!cachedChain.details && !processedExtraReason)
126907
- cachedChain.details = chain.next;
126908
- }
126786
+ if (locationReason && (fileIncludeReasons == null ? void 0 : fileIncludeReasons.length) === 1)
126787
+ fileIncludeReasons = void 0;
126909
126788
  const location = locationReason && getReferencedFileLocation(program, locationReason);
126789
+ const fileIncludeReasonDetails = fileIncludeReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
126790
+ const optionsForFile = file && getCompilerOptionsForFile(file) || options;
126791
+ const redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, optionsForFile);
126792
+ const chain = chainDiagnosticMessages(redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails, diagnostic, ...args || emptyArray);
126910
126793
  return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
126911
126794
  function processReason(reason) {
126912
- if (seenReasons == null ? void 0 : seenReasons.has(reason))
126913
- return;
126914
- (seenReasons ?? (seenReasons = /* @__PURE__ */ new Set())).add(reason);
126915
- (fileIncludeReasons ?? (fileIncludeReasons = [])).push(fileIncludeReasonToDiagnostics(program, reason));
126916
- populateRelatedInfo(reason);
126917
- }
126918
- function populateRelatedInfo(reason) {
126795
+ (fileIncludeReasons || (fileIncludeReasons = [])).push(fileIncludeReasonToDiagnostics(program, reason));
126919
126796
  if (!locationReason && isReferencedFile(reason)) {
126920
126797
  locationReason = reason;
126921
126798
  } else if (locationReason !== reason) {
126922
- relatedInfo = append(relatedInfo, getFileIncludeReasonToRelatedInformation(reason));
126799
+ relatedInfo = append(relatedInfo, fileIncludeReasonToRelatedInformation(reason));
126923
126800
  }
126924
- }
126925
- function cachedFileIncludeDetailsHasProcessedExtraReason() {
126926
- var _a2;
126927
- return ((_a2 = cachedChain.fileIncludeReasonDetails.next) == null ? void 0 : _a2.length) !== (reasons == null ? void 0 : reasons.length);
126801
+ if (reason === fileProcessingReason)
126802
+ fileProcessingReason = void 0;
126928
126803
  }
126929
126804
  }
126930
126805
  function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
@@ -126936,14 +126811,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126936
126811
  args
126937
126812
  });
126938
126813
  }
126939
- function addLazyProgramDiagnosticExplainingFile(file, diagnostic, args) {
126940
- lazyProgramDiagnosticExplainingFile.push({ file, diagnostic, args });
126941
- }
126942
- function getFileIncludeReasonToRelatedInformation(reason) {
126943
- let relatedInfo = reasonToRelatedInfo == null ? void 0 : reasonToRelatedInfo.get(reason);
126944
- if (relatedInfo === void 0)
126945
- (reasonToRelatedInfo ?? (reasonToRelatedInfo = /* @__PURE__ */ new Map())).set(reason, relatedInfo = fileIncludeReasonToRelatedInformation(reason) ?? false);
126946
- return relatedInfo || void 0;
126814
+ function addProgramDiagnosticExplainingFile(file, diagnostic, args) {
126815
+ programDiagnostics.add(createDiagnosticExplainingFile(
126816
+ file,
126817
+ /*fileProcessingReason*/
126818
+ void 0,
126819
+ diagnostic,
126820
+ args
126821
+ ));
126947
126822
  }
126948
126823
  function fileIncludeReasonToRelatedInformation(reason) {
126949
126824
  if (isReferencedFile(reason)) {
@@ -149397,7 +149272,7 @@ var invalidOperationsInSyntacticMode = [
149397
149272
  "findRenameLocations",
149398
149273
  "getApplicableRefactors"
149399
149274
  ];
149400
- function createLanguageService(host, documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()), syntaxOnlyOrLanguageServiceMode) {
149275
+ function createLanguageService(host, documentRegistry = createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory(), host.jsDocParsingMode), syntaxOnlyOrLanguageServiceMode) {
149401
149276
  var _a;
149402
149277
  let languageServiceMode;
149403
149278
  if (syntaxOnlyOrLanguageServiceMode === void 0) {
@@ -179021,6 +178896,7 @@ __export(ts_exports2, {
179021
178896
  InlayHints: () => ts_InlayHints_exports,
179022
178897
  InternalEmitFlags: () => InternalEmitFlags,
179023
178898
  InternalSymbolName: () => InternalSymbolName,
178899
+ IntersectionFlags: () => IntersectionFlags,
179024
178900
  InvalidatedProjectKind: () => InvalidatedProjectKind,
179025
178901
  JSDocParsingMode: () => JSDocParsingMode,
179026
178902
  JsDoc: () => ts_JsDoc_exports,
@@ -180906,7 +180782,6 @@ __export(ts_exports2, {
180906
180782
  or: () => or,
180907
180783
  orderedRemoveItem: () => orderedRemoveItem,
180908
180784
  orderedRemoveItemAt: () => orderedRemoveItemAt,
180909
- packageIdIsEqual: () => packageIdIsEqual,
180910
180785
  packageIdToPackageName: () => packageIdToPackageName,
180911
180786
  packageIdToString: () => packageIdToString,
180912
180787
  paramHelper: () => paramHelper,
@@ -193451,6 +193326,7 @@ if (typeof console !== "undefined") {
193451
193326
  InlayHints,
193452
193327
  InternalEmitFlags,
193453
193328
  InternalSymbolName,
193329
+ IntersectionFlags,
193454
193330
  InvalidatedProjectKind,
193455
193331
  JSDocParsingMode,
193456
193332
  JsDoc,
@@ -195336,7 +195212,6 @@ if (typeof console !== "undefined") {
195336
195212
  or,
195337
195213
  orderedRemoveItem,
195338
195214
  orderedRemoveItemAt,
195339
- packageIdIsEqual,
195340
195215
  packageIdToPackageName,
195341
195216
  packageIdToString,
195342
195217
  paramHelper,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.5.0-pr-58398-2",
5
+ "version": "5.5.0-pr-58404-2",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [