@typescript-deploys/pr-build 5.6.0-pr-59048-12 → 5.6.0-pr-59059-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.
package/lib/tsc.js CHANGED
@@ -1078,10 +1078,10 @@ function matchedText(pattern, candidate) {
1078
1078
  Debug.assert(isPatternMatch(pattern, candidate));
1079
1079
  return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length);
1080
1080
  }
1081
- function findBestPatternMatch(values, getPattern, candidate, endIndex = values.length) {
1081
+ function findBestPatternMatch(values, getPattern, candidate) {
1082
1082
  let matchedValue;
1083
1083
  let longestMatchPrefixLength = -1;
1084
- for (let i = 0; i < endIndex; i++) {
1084
+ for (let i = 0; i < values.length; i++) {
1085
1085
  const v = values[i];
1086
1086
  const pattern = getPattern(v);
1087
1087
  if (isPatternMatch(pattern, candidate) && pattern.prefix.length > longestMatchPrefixLength) {
@@ -18305,65 +18305,17 @@ var emptyFileSystemEntries = {
18305
18305
  files: emptyArray,
18306
18306
  directories: emptyArray
18307
18307
  };
18308
- var patternOrStringsCache = /* @__PURE__ */ new WeakMap();
18309
18308
  function matchPatternOrExact(patternOrStrings, candidate) {
18310
- let matchableStringSet;
18311
- let sortedPatterns;
18312
- const cacheEntry = patternOrStringsCache.get(patternOrStrings);
18313
- if (cacheEntry !== void 0) {
18314
- ({ matchableStringSet, sortedPatterns } = cacheEntry);
18315
- } else {
18316
- matchableStringSet = /* @__PURE__ */ new Set();
18317
- sortedPatterns = [];
18318
- for (const patternOrString of patternOrStrings) {
18319
- if (typeof patternOrString === "string") {
18320
- matchableStringSet.add(patternOrString);
18321
- } else {
18322
- sortedPatterns.push(patternOrString);
18323
- }
18324
- }
18325
- sortedPatterns.sort((a, b) => compareStringsCaseSensitive(a.prefix, b.prefix));
18326
- patternOrStringsCache.set(patternOrStrings, {
18327
- matchableStringSet,
18328
- sortedPatterns
18329
- });
18330
- }
18331
- if (matchableStringSet.has(candidate)) {
18332
- return candidate;
18333
- }
18334
- if (sortedPatterns.length === 0) {
18335
- return void 0;
18336
- }
18337
- let index = binarySearchKey(sortedPatterns, candidate, getPatternPrefix, compareStringsCaseSensitive);
18338
- if (index < 0) {
18339
- index = ~index;
18340
- }
18341
- if (index >= sortedPatterns.length) {
18342
- index--;
18343
- }
18344
- const groupPrefix = sortedPatterns[index].prefix;
18345
- while (index > 0 && groupPrefix === sortedPatterns[index - 1].prefix) {
18346
- index--;
18347
- }
18348
- for (let i = index; i < sortedPatterns.length; i++) {
18349
- const currentPattern = sortedPatterns[i];
18350
- if (currentPattern.prefix !== groupPrefix) {
18351
- break;
18309
+ const patterns = [];
18310
+ for (const patternOrString of patternOrStrings) {
18311
+ if (patternOrString === candidate) {
18312
+ return candidate;
18352
18313
  }
18353
- if (isPatternMatch(currentPattern, candidate)) {
18354
- return currentPattern;
18314
+ if (!isString(patternOrString)) {
18315
+ patterns.push(patternOrString);
18355
18316
  }
18356
18317
  }
18357
- return findBestPatternMatch(
18358
- sortedPatterns,
18359
- (_) => _,
18360
- candidate,
18361
- /*endIndex*/
18362
- index
18363
- );
18364
- }
18365
- function getPatternPrefix(pattern) {
18366
- return pattern.prefix;
18318
+ return findBestPatternMatch(patterns, (_) => _, candidate);
18367
18319
  }
18368
18320
  function sliceAfter(arr, value) {
18369
18321
  const index = arr.indexOf(value);
@@ -39622,7 +39574,7 @@ function tryLoadModuleUsingPathsIfEligible(extensions, moduleName, loader, state
39622
39574
  trace(state.host, Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName);
39623
39575
  }
39624
39576
  const baseDirectory = getPathsBasePath(state.compilerOptions, state.host);
39625
- const pathPatterns = (configFile == null ? void 0 : configFile.configFileSpecs) ? (_a = configFile.configFileSpecs).pathPatterns ?? (_a.pathPatterns = tryParsePatterns(paths)) : void 0;
39577
+ const pathPatterns = (configFile == null ? void 0 : configFile.configFileSpecs) ? (_a = configFile.configFileSpecs).pathPatterns || (_a.pathPatterns = tryParsePatterns(paths)) : void 0;
39626
39578
  return tryLoadModuleUsingPaths(
39627
39579
  extensions,
39628
39580
  moduleName,
@@ -40919,12 +40871,8 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
40919
40871
  }
40920
40872
  return loader(extensions, candidate, !nodeModulesDirectoryExists, state);
40921
40873
  }
40922
- var pathsToPatternsCache = /* @__PURE__ */ new WeakMap();
40923
40874
  function tryLoadModuleUsingPaths(extensions, moduleName, baseDirectory, paths, pathPatterns, loader, onlyRecordFailures, state) {
40924
- pathPatterns ?? (pathPatterns = pathsToPatternsCache.get(paths));
40925
- if (pathPatterns === void 0) {
40926
- pathsToPatternsCache.set(paths, pathPatterns = tryParsePatterns(paths));
40927
- }
40875
+ pathPatterns || (pathPatterns = tryParsePatterns(paths));
40928
40876
  const matchedPattern = matchPatternOrExact(pathPatterns, moduleName);
40929
40877
  if (matchedPattern) {
40930
40878
  const matchedStar = isString(matchedPattern) ? void 0 : matchedText(matchedPattern, moduleName);
@@ -67649,7 +67597,11 @@ function createTypeChecker(host) {
67649
67597
  }
67650
67598
  function getTypeFactsWorker(type, callerOnlyNeeds) {
67651
67599
  if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
67652
- type = getBaseConstraintOfType(type) || unknownType;
67600
+ const constraintType = getBaseConstraintOfType(type) || unknownType;
67601
+ if (strictNullChecks && type.flags & 465829888 /* Instantiable */ && constraintType === unknownType) {
67602
+ return callerOnlyNeeds;
67603
+ }
67604
+ type = constraintType;
67653
67605
  }
67654
67606
  const flags = type.flags;
67655
67607
  if (flags & (4 /* String */ | 268435456 /* StringMapping */)) {
@@ -67749,7 +67701,7 @@ function createTypeChecker(host) {
67749
67701
  return type;
67750
67702
  }
67751
67703
  const emptyAndOtherUnion = getUnionType([emptyObjectType, otherType]);
67752
- return mapType(type, (t) => hasTypeFacts(t, targetFacts) ? getIntersectionType([t, !(facts & otherIncludesFacts) && hasTypeFacts(t, otherFacts) ? emptyAndOtherUnion : emptyObjectType]) : t);
67704
+ return mapType(type, (t) => hasTypeFacts(t, targetFacts) ? getIntersectionType([t, (strictNullChecks || !(facts & otherIncludesFacts)) && hasTypeFacts(t, otherFacts) ? emptyAndOtherUnion : emptyObjectType]) : t);
67753
67705
  }
67754
67706
  function recombineUnknownType(type) {
67755
67707
  return type === unknownUnionType ? unknownType : type;