@typescript-deploys/pr-build 5.4.0-pr-56488-8 → 5.4.0-pr-56504-6

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
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.4";
21
- var version = `${versionMajorMinor}.0-insiders.20231121`;
21
+ var version = `${versionMajorMinor}.0-insiders.20231122`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -3661,7 +3661,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
3661
3661
  TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
3662
3662
  TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
3663
3663
  TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
3664
- TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
3664
+ TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
3665
3665
  TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
3666
3666
  TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
3667
3667
  TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
@@ -15974,7 +15974,7 @@ function getClassLikeDeclarationOfSymbol(symbol) {
15974
15974
  return (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike);
15975
15975
  }
15976
15976
  function getObjectFlags(type) {
15977
- return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0;
15977
+ return type.flags & 3899393 /* ObjectFlagsType */ ? type.objectFlags : 0;
15978
15978
  }
15979
15979
  function isUMDExportSymbol(symbol) {
15980
15980
  return !!symbol && !!symbol.declarations && !!symbol.declarations[0] && isNamespaceExportDeclaration(symbol.declarations[0]);
@@ -18119,7 +18119,7 @@ var nullNodeConverters = {
18119
18119
  var nextAutoGenerateId = 0;
18120
18120
  var nodeFactoryPatchers = [];
18121
18121
  function createNodeFactory(flags, baseFactory2) {
18122
- const update = flags & 8 /* NoOriginalNode */ ? updateWithoutOriginal : updateWithOriginal;
18122
+ const setOriginal = flags & 8 /* NoOriginalNode */ ? identity : setOriginalNode;
18123
18123
  const parenthesizerRules = memoize(() => flags & 1 /* NoParenthesizerRules */ ? nullParenthesizerRules : createParenthesizerRules(factory2));
18124
18124
  const converters = memoize(() => flags & 2 /* NoNodeConverters */ ? nullNodeConverters : createNodeConverters(factory2));
18125
18125
  const getBinaryCreateFunction = memoizeOne((operator) => (left, right) => createBinaryExpression(left, operator, right));
@@ -21617,7 +21617,7 @@ function createNodeFactory(flags, baseFactory2) {
21617
21617
  }
21618
21618
  function cloneSourceFile(source) {
21619
21619
  const node = source.redirectInfo ? cloneRedirectedSourceFile(source) : cloneSourceFileWorker(source);
21620
- setOriginalNode(node, source);
21620
+ setOriginal(node, source);
21621
21621
  return node;
21622
21622
  }
21623
21623
  function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) {
@@ -21750,7 +21750,7 @@ function createNodeFactory(flags, baseFactory2) {
21750
21750
  const clone2 = createBaseIdentifier(node.escapedText);
21751
21751
  clone2.flags |= node.flags & ~16 /* Synthesized */;
21752
21752
  clone2.transformFlags = node.transformFlags;
21753
- setOriginalNode(clone2, node);
21753
+ setOriginal(clone2, node);
21754
21754
  setIdentifierAutoGenerate(clone2, { ...node.emitNode.autoGenerate });
21755
21755
  return clone2;
21756
21756
  }
@@ -21761,7 +21761,7 @@ function createNodeFactory(flags, baseFactory2) {
21761
21761
  clone2.flowNode = node.flowNode;
21762
21762
  clone2.symbol = node.symbol;
21763
21763
  clone2.transformFlags = node.transformFlags;
21764
- setOriginalNode(clone2, node);
21764
+ setOriginal(clone2, node);
21765
21765
  const typeArguments = getIdentifierTypeArguments(node);
21766
21766
  if (typeArguments)
21767
21767
  setIdentifierTypeArguments(clone2, typeArguments);
@@ -21771,7 +21771,7 @@ function createNodeFactory(flags, baseFactory2) {
21771
21771
  const clone2 = createBasePrivateIdentifier(node.escapedText);
21772
21772
  clone2.flags |= node.flags & ~16 /* Synthesized */;
21773
21773
  clone2.transformFlags = node.transformFlags;
21774
- setOriginalNode(clone2, node);
21774
+ setOriginal(clone2, node);
21775
21775
  setIdentifierAutoGenerate(clone2, { ...node.emitNode.autoGenerate });
21776
21776
  return clone2;
21777
21777
  }
@@ -21779,7 +21779,7 @@ function createNodeFactory(flags, baseFactory2) {
21779
21779
  const clone2 = createBasePrivateIdentifier(node.escapedText);
21780
21780
  clone2.flags |= node.flags & ~16 /* Synthesized */;
21781
21781
  clone2.transformFlags = node.transformFlags;
21782
- setOriginalNode(clone2, node);
21782
+ setOriginal(clone2, node);
21783
21783
  return clone2;
21784
21784
  }
21785
21785
  function cloneNode(node) {
@@ -21804,7 +21804,7 @@ function createNodeFactory(flags, baseFactory2) {
21804
21804
  const clone2 = !isNodeKind(node.kind) ? baseFactory2.createBaseTokenNode(node.kind) : baseFactory2.createBaseNode(node.kind);
21805
21805
  clone2.flags |= node.flags & ~16 /* Synthesized */;
21806
21806
  clone2.transformFlags = node.transformFlags;
21807
- setOriginalNode(clone2, node);
21807
+ setOriginal(clone2, node);
21808
21808
  for (const key in node) {
21809
21809
  if (hasProperty(clone2, key) || !hasProperty(node, key)) {
21810
21810
  continue;
@@ -22329,7 +22329,7 @@ function createNodeFactory(flags, baseFactory2) {
22329
22329
  return typeof value === "number" ? createToken(value) : value;
22330
22330
  }
22331
22331
  function asEmbeddedStatement(statement) {
22332
- return statement && isNotEmittedStatement(statement) ? setTextRange(setOriginalNode(createEmptyStatement(), statement), statement) : statement;
22332
+ return statement && isNotEmittedStatement(statement) ? setTextRange(setOriginal(createEmptyStatement(), statement), statement) : statement;
22333
22333
  }
22334
22334
  function asVariableDeclaration(variableDeclaration) {
22335
22335
  if (typeof variableDeclaration === "string" || variableDeclaration && !isVariableDeclaration(variableDeclaration)) {
@@ -22345,19 +22345,13 @@ function createNodeFactory(flags, baseFactory2) {
22345
22345
  }
22346
22346
  return variableDeclaration;
22347
22347
  }
22348
- }
22349
- function updateWithoutOriginal(updated, original) {
22350
- if (updated !== original) {
22351
- setTextRange(updated, original);
22348
+ function update(updated, original) {
22349
+ if (updated !== original) {
22350
+ setOriginal(updated, original);
22351
+ setTextRange(updated, original);
22352
+ }
22353
+ return updated;
22352
22354
  }
22353
- return updated;
22354
- }
22355
- function updateWithOriginal(updated, original) {
22356
- if (updated !== original) {
22357
- setOriginalNode(updated, original);
22358
- setTextRange(updated, original);
22359
- }
22360
- return updated;
22361
22355
  }
22362
22356
  function getDefaultTagNameForKind(kind) {
22363
22357
  switch (kind) {
@@ -26897,8 +26891,10 @@ var Parser;
26897
26891
  setTextRangePosWidth(sourceFile, 0, sourceText.length);
26898
26892
  setFields(sourceFile);
26899
26893
  if (!isDeclarationFile && isExternalModule(sourceFile) && sourceFile.transformFlags & 67108864 /* ContainsPossibleTopLevelAwait */) {
26894
+ const oldSourceFile = sourceFile;
26900
26895
  sourceFile = reparseTopLevelAwait(sourceFile);
26901
- setFields(sourceFile);
26896
+ if (oldSourceFile !== sourceFile)
26897
+ setFields(sourceFile);
26902
26898
  }
26903
26899
  return sourceFile;
26904
26900
  function setFields(sourceFile2) {
@@ -36787,39 +36783,34 @@ function specToDiagnostic(spec, disallowTrailingRecursion) {
36787
36783
  return [Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec];
36788
36784
  }
36789
36785
  }
36790
- function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, basePath, useCaseSensitiveFileNames2) {
36791
- const rawExcludeRegex = getRegularExpressionForWildcard(exclude, basePath, "exclude");
36786
+ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExcludeSpecs: exclude }, path, useCaseSensitiveFileNames2) {
36787
+ const rawExcludeRegex = getRegularExpressionForWildcard(exclude, path, "exclude");
36792
36788
  const excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames2 ? "" : "i");
36793
36789
  const wildcardDirectories = {};
36794
- const wildCardKeyToPath = /* @__PURE__ */ new Map();
36795
36790
  if (include !== void 0) {
36796
36791
  const recursiveKeys = [];
36797
36792
  for (const file of include) {
36798
- const spec = normalizePath(combinePaths(basePath, file));
36793
+ const spec = normalizePath(combinePaths(path, file));
36799
36794
  if (excludeRegex && excludeRegex.test(spec)) {
36800
36795
  continue;
36801
36796
  }
36802
36797
  const match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2);
36803
36798
  if (match) {
36804
- const { key, path, flags } = match;
36805
- const existingPath = wildCardKeyToPath.get(key);
36806
- const existingFlags = existingPath !== void 0 ? wildcardDirectories[existingPath] : void 0;
36799
+ const { key, flags } = match;
36800
+ const existingFlags = wildcardDirectories[key];
36807
36801
  if (existingFlags === void 0 || existingFlags < flags) {
36808
- wildcardDirectories[existingPath !== void 0 ? existingPath : path] = flags;
36809
- if (existingPath === void 0)
36810
- wildCardKeyToPath.set(key, path);
36802
+ wildcardDirectories[key] = flags;
36811
36803
  if (flags === 1 /* Recursive */) {
36812
36804
  recursiveKeys.push(key);
36813
36805
  }
36814
36806
  }
36815
36807
  }
36816
36808
  }
36817
- for (const path in wildcardDirectories) {
36818
- if (hasProperty(wildcardDirectories, path)) {
36809
+ for (const key in wildcardDirectories) {
36810
+ if (hasProperty(wildcardDirectories, key)) {
36819
36811
  for (const recursiveKey of recursiveKeys) {
36820
- const key = toCanonicalKey(path, useCaseSensitiveFileNames2);
36821
- if (key !== recursiveKey && containsPath(recursiveKey, key, basePath, !useCaseSensitiveFileNames2)) {
36822
- delete wildcardDirectories[path];
36812
+ if (key !== recursiveKey && containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames2)) {
36813
+ delete wildcardDirectories[key];
36823
36814
  }
36824
36815
  }
36825
36816
  }
@@ -36827,9 +36818,6 @@ function getWildcardDirectories({ validatedIncludeSpecs: include, validatedExclu
36827
36818
  }
36828
36819
  return wildcardDirectories;
36829
36820
  }
36830
- function toCanonicalKey(path, useCaseSensitiveFileNames2) {
36831
- return useCaseSensitiveFileNames2 ? path : toFileNameLowerCase(path);
36832
- }
36833
36821
  function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
36834
36822
  const match = wildcardDirectoryPattern.exec(spec);
36835
36823
  if (match) {
@@ -36837,16 +36825,13 @@ function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames2) {
36837
36825
  const starWildcardIndex = spec.indexOf("*");
36838
36826
  const lastDirectorySeperatorIndex = spec.lastIndexOf(directorySeparator);
36839
36827
  return {
36840
- key: toCanonicalKey(match[0], useCaseSensitiveFileNames2),
36841
- path: match[0],
36828
+ key: useCaseSensitiveFileNames2 ? match[0] : toFileNameLowerCase(match[0]),
36842
36829
  flags: questionWildcardIndex !== -1 && questionWildcardIndex < lastDirectorySeperatorIndex || starWildcardIndex !== -1 && starWildcardIndex < lastDirectorySeperatorIndex ? 1 /* Recursive */ : 0 /* None */
36843
36830
  };
36844
36831
  }
36845
36832
  if (isImplicitGlob(spec.substring(spec.lastIndexOf(directorySeparator) + 1))) {
36846
- const path = removeTrailingDirectorySeparator(spec);
36847
36833
  return {
36848
- key: toCanonicalKey(path, useCaseSensitiveFileNames2),
36849
- path,
36834
+ key: removeTrailingDirectorySeparator(useCaseSensitiveFileNames2 ? spec : toFileNameLowerCase(spec)),
36850
36835
  flags: 1 /* Recursive */
36851
36836
  };
36852
36837
  }
@@ -37528,50 +37513,22 @@ function createCacheWithRedirects(ownOptions, optionsToRedirectsKey) {
37528
37513
  }
37529
37514
  function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
37530
37515
  let cache;
37531
- let canonicalPathToCacheKey;
37532
- return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, deletePackageJsonInfo, clear: clear2, entries };
37516
+ return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2, entries, getInternalMap };
37533
37517
  function getPackageJsonInfo2(packageJsonPath) {
37534
- if (!cache)
37535
- return void 0;
37536
- const absolute = getNormalizedAbsolutePath(packageJsonPath, currentDirectory);
37537
- const result = cache.get(absolute);
37538
- if (result !== void 0)
37539
- return result;
37540
- if (!canonicalPathToCacheKey)
37541
- return void 0;
37542
- const path = getCanonicalFileName(absolute);
37543
- if (path === absolute)
37544
- return void 0;
37545
- const cacheKey = canonicalPathToCacheKey.get(path);
37546
- return cacheKey !== void 0 ? cache.get(cacheKey) : void 0;
37518
+ return cache == null ? void 0 : cache.get(toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
37547
37519
  }
37548
37520
  function setPackageJsonInfo(packageJsonPath, info) {
37549
- const absolute = getNormalizedAbsolutePath(packageJsonPath, currentDirectory);
37550
- (cache || (cache = /* @__PURE__ */ new Map())).set(absolute, info);
37551
- const path = getCanonicalFileName(absolute);
37552
- if (path !== absolute) {
37553
- (canonicalPathToCacheKey ?? (canonicalPathToCacheKey = /* @__PURE__ */ new Map())).set(path, absolute);
37554
- }
37555
- }
37556
- function deletePackageJsonInfo(packageJsonPath) {
37557
- if (!cache)
37558
- return;
37559
- const absolute = getNormalizedAbsolutePath(packageJsonPath, currentDirectory);
37560
- cache.delete(absolute);
37561
- if (canonicalPathToCacheKey) {
37562
- const path = getCanonicalFileName(absolute);
37563
- const cacheKey = canonicalPathToCacheKey.get(path);
37564
- if (cacheKey !== void 0) {
37565
- cache.delete(cacheKey);
37566
- canonicalPathToCacheKey.delete(path);
37567
- }
37568
- }
37521
+ (cache || (cache = /* @__PURE__ */ new Map())).set(toPath(packageJsonPath, currentDirectory, getCanonicalFileName), info);
37569
37522
  }
37570
37523
  function clear2() {
37571
37524
  cache = void 0;
37572
37525
  }
37573
37526
  function entries() {
37574
- return cache == null ? void 0 : cache.entries();
37527
+ const iter = cache == null ? void 0 : cache.entries();
37528
+ return iter ? arrayFrom(iter) : [];
37529
+ }
37530
+ function getInternalMap() {
37531
+ return cache;
37575
37532
  }
37576
37533
  }
37577
37534
  function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
@@ -42503,7 +42460,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
42503
42460
  if (!moduleSourceFile)
42504
42461
  return { moduleSpecifiers: emptyArray, computedWithoutCache };
42505
42462
  computedWithoutCache = true;
42506
- modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.fileName, moduleSourceFile.originalFileName, host));
42463
+ modulePaths || (modulePaths = getAllModulePathsWorker(importingSourceFile.path, moduleSourceFile.originalFileName, host));
42507
42464
  const result = computeModuleSpecifiers(
42508
42465
  modulePaths,
42509
42466
  compilerOptions,
@@ -42517,7 +42474,7 @@ function getModuleSpecifiersWithCacheInfo(moduleSymbol, checker, compilerOptions
42517
42474
  return { moduleSpecifiers: result, computedWithoutCache };
42518
42475
  }
42519
42476
  function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences, options = {}, forAutoImport) {
42520
- const info = getInfo(importingSourceFile.fileName, host);
42477
+ const info = getInfo(importingSourceFile.path, host);
42521
42478
  const preferences = getPreferences(userPreferences, compilerOptions, importingSourceFile);
42522
42479
  const existingSpecifier = forEach(modulePaths, (modulePath) => forEach(
42523
42480
  host.getFileIncludeReasons().get(toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)),
@@ -42581,7 +42538,6 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
42581
42538
  return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? pathsSpecifiers : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? redirectPathsSpecifiers : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? nodeModulesSpecifiers : Debug.checkDefined(relativeSpecifiers);
42582
42539
  }
42583
42540
  function getInfo(importingSourceFileName, host) {
42584
- importingSourceFileName = getNormalizedAbsolutePath(importingSourceFileName, host.getCurrentDirectory());
42585
42541
  const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames ? host.useCaseSensitiveFileNames() : true);
42586
42542
  const sourceDirectory = getDirectoryPath(importingSourceFileName);
42587
42543
  return { getCanonicalFileName, importingSourceFileName, sourceDirectory };
@@ -42616,7 +42572,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
42616
42572
  if (relativePreference === 3 /* ExternalNonRelative */ && !pathIsRelative(maybeNonRelative)) {
42617
42573
  const projectDirectory = compilerOptions.configFilePath ? toPath(getDirectoryPath(compilerOptions.configFilePath), host.getCurrentDirectory(), info.getCanonicalFileName) : info.getCanonicalFileName(host.getCurrentDirectory());
42618
42574
  const modulePath = toPath(moduleFileName, projectDirectory, getCanonicalFileName);
42619
- const sourceIsInternal = startsWith(info.getCanonicalFileName(sourceDirectory), projectDirectory);
42575
+ const sourceIsInternal = startsWith(sourceDirectory, projectDirectory);
42620
42576
  const targetIsInternal = startsWith(modulePath, projectDirectory);
42621
42577
  if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
42622
42578
  return maybeNonRelative;
@@ -42689,9 +42645,8 @@ function forEachFileNameOfModule(importingFileName, importedFileName, host, pref
42689
42645
  });
42690
42646
  return result || (preferSymlinks ? forEach(targets, (p) => shouldFilterIgnoredPaths && containsIgnoredPath(p) ? void 0 : cb(p, p === referenceRedirect)) : void 0);
42691
42647
  }
42692
- function getAllModulePaths(importingFileName, importedFileName, host, preferences, options = {}) {
42648
+ function getAllModulePaths(importingFilePath, importedFileName, host, preferences, options = {}) {
42693
42649
  var _a;
42694
- const importingFilePath = toPath(importingFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
42695
42650
  const importedFilePath = toPath(importedFileName, host.getCurrentDirectory(), hostGetCanonicalFileName(host));
42696
42651
  const cache = (_a = host.getModuleSpecifierCache) == null ? void 0 : _a.call(host);
42697
42652
  if (cache) {
@@ -42699,7 +42654,7 @@ function getAllModulePaths(importingFileName, importedFileName, host, preference
42699
42654
  if (cached == null ? void 0 : cached.modulePaths)
42700
42655
  return cached.modulePaths;
42701
42656
  }
42702
- const modulePaths = getAllModulePathsWorker(importingFileName, importedFileName, host);
42657
+ const modulePaths = getAllModulePathsWorker(importingFilePath, importedFileName, host);
42703
42658
  if (cache) {
42704
42659
  cache.setModulePaths(importingFilePath, importedFilePath, preferences, options, modulePaths);
42705
42660
  }
@@ -42722,7 +42677,7 @@ function getAllModulePathsWorker(importingFileName, importedFileName, host) {
42722
42677
  }
42723
42678
  );
42724
42679
  const sortedPaths = [];
42725
- for (let directory = getDirectoryPath(getCanonicalFileName(importingFileName)); allFileNames.size !== 0; ) {
42680
+ for (let directory = getDirectoryPath(importingFileName); allFileNames.size !== 0; ) {
42726
42681
  const directoryStart = ensureTrailingDirectorySeparator(directory);
42727
42682
  let pathsInDirectory;
42728
42683
  allFileNames.forEach(({ path, isRedirect, isInNodeModules }, fileName) => {
@@ -42743,10 +42698,7 @@ function getAllModulePathsWorker(importingFileName, importedFileName, host) {
42743
42698
  directory = newDirectory;
42744
42699
  }
42745
42700
  if (allFileNames.size) {
42746
- const remainingPaths = arrayFrom(
42747
- allFileNames.entries(),
42748
- ([fileName, { isRedirect, isInNodeModules }]) => ({ path: fileName, isRedirect, isInNodeModules })
42749
- );
42701
+ const remainingPaths = arrayFrom(allFileNames.values());
42750
42702
  if (remainingPaths.length > 1)
42751
42703
  remainingPaths.sort(comparePathsByRedirectAndNumberOfDirectorySeparators);
42752
42704
  sortedPaths.push(...remainingPaths);
@@ -42950,7 +42902,7 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
42950
42902
  }
42951
42903
  const globalTypingsCacheLocation = host.getGlobalTypingsCacheLocation && host.getGlobalTypingsCacheLocation();
42952
42904
  const pathToTopLevelNodeModules = getCanonicalFileName(moduleSpecifier.substring(0, parts.topLevelNodeModulesIndex));
42953
- if (!(startsWith(getCanonicalFileName(sourceDirectory), pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
42905
+ if (!(startsWith(sourceDirectory, pathToTopLevelNodeModules) || globalTypingsCacheLocation && startsWith(getCanonicalFileName(globalTypingsCacheLocation), pathToTopLevelNodeModules))) {
42954
42906
  return void 0;
42955
42907
  }
42956
42908
  const nodeModulesDirectoryName = moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1);
@@ -54245,7 +54197,12 @@ function createTypeChecker(host) {
54245
54197
  const checkType = type.checkType;
54246
54198
  const constraint = getLowerBoundOfKeyType(checkType);
54247
54199
  if (constraint !== checkType) {
54248
- return getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
54200
+ return getConditionalTypeInstantiation(
54201
+ type,
54202
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
54203
+ /*forConstraint*/
54204
+ false
54205
+ );
54249
54206
  }
54250
54207
  }
54251
54208
  return type;
@@ -54597,7 +54554,12 @@ function createTypeChecker(host) {
54597
54554
  );
54598
54555
  const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
54599
54556
  if (constraint && constraint !== type.checkType) {
54600
- const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
54557
+ const instantiated = getConditionalTypeInstantiation(
54558
+ type,
54559
+ prependTypeMapping(type.root.checkType, constraint, type.mapper),
54560
+ /*forConstraint*/
54561
+ true
54562
+ );
54601
54563
  if (!(instantiated.flags & 131072 /* Never */)) {
54602
54564
  type.resolvedConstraintOfDistributive = instantiated;
54603
54565
  return instantiated;
@@ -57031,7 +56993,7 @@ function createTypeChecker(host) {
57031
56993
  }
57032
56994
  }
57033
56995
  function removeStringLiteralsMatchedByTemplateLiterals(types) {
57034
- const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types)));
56996
+ const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
57035
56997
  if (templates.length) {
57036
56998
  let i = types.length;
57037
56999
  while (i > 0) {
@@ -57431,19 +57393,14 @@ function createTypeChecker(host) {
57431
57393
  function getConstituentCountOfTypes(types) {
57432
57394
  return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
57433
57395
  }
57434
- function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
57435
- if (types.length !== 2) {
57436
- return false;
57437
- }
57438
- const [t1, t2] = types;
57439
- return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
57440
- }
57441
57396
  function getTypeFromIntersectionTypeNode(node) {
57442
57397
  const links = getNodeLinks(node);
57443
57398
  if (!links.resolvedType) {
57444
57399
  const aliasSymbol = getAliasSymbolForTypeNode(node);
57445
57400
  const types = map(node.types, getTypeFromTypeNode);
57446
- const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
57401
+ const emptyIndex = types.length === 2 ? types.indexOf(emptyTypeLiteralType) : -1;
57402
+ const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
57403
+ const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
57447
57404
  links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
57448
57405
  }
57449
57406
  return links.resolvedType;
@@ -57470,19 +57427,17 @@ function createTypeChecker(host) {
57470
57427
  return constraintType;
57471
57428
  }
57472
57429
  const keyTypes = [];
57473
- if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
57474
- if (!isGenericIndexType(constraintType)) {
57475
- const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
57476
- forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
57477
- } else {
57430
+ if (isGenericIndexType(constraintType)) {
57431
+ if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
57478
57432
  return getIndexTypeForGenericType(type, indexFlags);
57479
57433
  }
57434
+ forEachType(constraintType, addMemberForKeyType);
57435
+ } else if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
57436
+ const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
57437
+ forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
57480
57438
  } else {
57481
57439
  forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
57482
57440
  }
57483
- if (isGenericIndexType(constraintType)) {
57484
- forEachType(constraintType, addMemberForKeyType);
57485
- }
57486
57441
  const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
57487
57442
  if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
57488
57443
  return constraintType;
@@ -57655,11 +57610,6 @@ function createTypeChecker(host) {
57655
57610
  }
57656
57611
  function createTemplateLiteralType(texts, types) {
57657
57612
  const type = createType(134217728 /* TemplateLiteral */);
57658
- type.objectFlags = getPropagatingFlagsOfTypes(
57659
- types,
57660
- /*excludeKinds*/
57661
- 98304 /* Nullable */
57662
- );
57663
57613
  type.texts = texts;
57664
57614
  type.types = types;
57665
57615
  return type;
@@ -57954,7 +57904,15 @@ function createTypeChecker(host) {
57954
57904
  }
57955
57905
  function isPatternLiteralPlaceholderType(type) {
57956
57906
  if (type.flags & 2097152 /* Intersection */) {
57957
- return !isGenericType(type) && some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 98304 /* Nullable */)) || isPatternLiteralPlaceholderType(t));
57907
+ let seenPlaceholder = false;
57908
+ for (const t of type.types) {
57909
+ if (t.flags & (2944 /* Literal */ | 98304 /* Nullable */) || isPatternLiteralPlaceholderType(t)) {
57910
+ seenPlaceholder = true;
57911
+ } else if (!(t.flags & 524288 /* Object */)) {
57912
+ return false;
57913
+ }
57914
+ }
57915
+ return seenPlaceholder;
57958
57916
  }
57959
57917
  return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
57960
57918
  }
@@ -57971,7 +57929,7 @@ function createTypeChecker(host) {
57971
57929
  return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
57972
57930
  }
57973
57931
  function getGenericObjectFlags(type) {
57974
- if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
57932
+ if (type.flags & 3145728 /* UnionOrIntersection */) {
57975
57933
  if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
57976
57934
  type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
57977
57935
  }
@@ -57983,7 +57941,7 @@ function createTypeChecker(host) {
57983
57941
  }
57984
57942
  return type.objectFlags & 12582912 /* IsGenericType */;
57985
57943
  }
57986
- return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
57944
+ return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
57987
57945
  }
57988
57946
  function getSimplifiedType(type, writing) {
57989
57947
  return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
@@ -58164,7 +58122,7 @@ function createTypeChecker(host) {
58164
58122
  function isDeferredType(type, checkTuples) {
58165
58123
  return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
58166
58124
  }
58167
- function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) {
58125
+ function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
58168
58126
  let result;
58169
58127
  let extraTypes;
58170
58128
  let tailCount = 0;
@@ -58210,7 +58168,7 @@ function createTypeChecker(host) {
58210
58168
  const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
58211
58169
  if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
58212
58170
  if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
58213
- if (checkType.flags & 1 /* Any */) {
58171
+ if (checkType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) {
58214
58172
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
58215
58173
  }
58216
58174
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -58320,7 +58278,9 @@ function createTypeChecker(host) {
58320
58278
  links.resolvedType = getConditionalType(
58321
58279
  root,
58322
58280
  /*mapper*/
58323
- void 0
58281
+ void 0,
58282
+ /*forConstraint*/
58283
+ false
58324
58284
  );
58325
58285
  if (outerTypeParameters) {
58326
58286
  root.instantiations = /* @__PURE__ */ new Map();
@@ -59009,7 +58969,7 @@ function createTypeChecker(host) {
59009
58969
  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);
59010
58970
  target.instantiations.set(id, result);
59011
58971
  const resultObjectFlags = getObjectFlags(result);
59012
- if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
58972
+ if (result.flags & 3899393 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
59013
58973
  const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
59014
58974
  if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
59015
58975
  if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
@@ -59175,17 +59135,17 @@ function createTypeChecker(host) {
59175
59135
  result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
59176
59136
  return result;
59177
59137
  }
59178
- function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
59138
+ function getConditionalTypeInstantiation(type, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
59179
59139
  const root = type.root;
59180
59140
  if (root.outerTypeParameters) {
59181
59141
  const typeArguments = map(root.outerTypeParameters, (t) => getMappedType(t, mapper));
59182
- const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
59142
+ const id = (forConstraint ? "C" : "") + getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
59183
59143
  let result = root.instantiations.get(id);
59184
59144
  if (!result) {
59185
59145
  const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
59186
59146
  const checkType = root.checkType;
59187
59147
  const distributionType = root.isDistributive ? getMappedType(checkType, newMapper) : void 0;
59188
- result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper)), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, aliasSymbol, aliasTypeArguments);
59148
+ result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments);
59189
59149
  root.instantiations.set(id, result);
59190
59150
  }
59191
59151
  return result;
@@ -59273,7 +59233,14 @@ function createTypeChecker(host) {
59273
59233
  );
59274
59234
  }
59275
59235
  if (flags & 16777216 /* Conditional */) {
59276
- return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
59236
+ return getConditionalTypeInstantiation(
59237
+ type,
59238
+ combineTypeMappers(type.mapper, mapper),
59239
+ /*forConstraint*/
59240
+ false,
59241
+ aliasSymbol,
59242
+ aliasTypeArguments
59243
+ );
59277
59244
  }
59278
59245
  if (flags & 33554432 /* Substitution */) {
59279
59246
  const newBaseType = instantiateType(type.baseType, mapper);
@@ -60917,7 +60884,7 @@ function createTypeChecker(host) {
60917
60884
  return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState);
60918
60885
  }
60919
60886
  if (target2.flags & 1048576 /* Union */) {
60920
- return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */));
60887
+ return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */), intersectionState);
60921
60888
  }
60922
60889
  if (target2.flags & 2097152 /* Intersection */) {
60923
60890
  return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
@@ -60962,7 +60929,8 @@ function createTypeChecker(host) {
60962
60929
  sourceType,
60963
60930
  target2,
60964
60931
  /*reportErrors*/
60965
- false
60932
+ false,
60933
+ 0 /* None */
60966
60934
  );
60967
60935
  if (!related) {
60968
60936
  return 0 /* False */;
@@ -60971,7 +60939,7 @@ function createTypeChecker(host) {
60971
60939
  }
60972
60940
  return result2;
60973
60941
  }
60974
- function typeRelatedToSomeType(source2, target2, reportErrors2) {
60942
+ function typeRelatedToSomeType(source2, target2, reportErrors2, intersectionState) {
60975
60943
  const targetTypes = target2.types;
60976
60944
  if (target2.flags & 1048576 /* Union */) {
60977
60945
  if (containsType(targetTypes, source2)) {
@@ -60989,7 +60957,10 @@ function createTypeChecker(host) {
60989
60957
  match,
60990
60958
  2 /* Target */,
60991
60959
  /*reportErrors*/
60992
- false
60960
+ false,
60961
+ /*headMessage*/
60962
+ void 0,
60963
+ intersectionState
60993
60964
  );
60994
60965
  if (related) {
60995
60966
  return related;
@@ -61002,7 +60973,10 @@ function createTypeChecker(host) {
61002
60973
  type,
61003
60974
  2 /* Target */,
61004
60975
  /*reportErrors*/
61005
- false
60976
+ false,
60977
+ /*headMessage*/
60978
+ void 0,
60979
+ intersectionState
61006
60980
  );
61007
60981
  if (related) {
61008
60982
  return related;
@@ -61016,7 +60990,10 @@ function createTypeChecker(host) {
61016
60990
  bestMatchingType,
61017
60991
  2 /* Target */,
61018
60992
  /*reportErrors*/
61019
- true
60993
+ true,
60994
+ /*headMessage*/
60995
+ void 0,
60996
+ intersectionState
61020
60997
  );
61021
60998
  }
61022
60999
  }
@@ -61814,13 +61791,6 @@ function createTypeChecker(host) {
61814
61791
  return result2;
61815
61792
  }
61816
61793
  }
61817
- } else {
61818
- const distributiveConstraint = hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
61819
- if (distributiveConstraint) {
61820
- if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
61821
- return result2;
61822
- }
61823
- }
61824
61794
  }
61825
61795
  const defaultConstraint = getDefaultConstraintOfConditionalType(source2);
61826
61796
  if (defaultConstraint) {
@@ -61828,6 +61798,13 @@ function createTypeChecker(host) {
61828
61798
  return result2;
61829
61799
  }
61830
61800
  }
61801
+ const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
61802
+ if (distributiveConstraint) {
61803
+ resetErrorInfo(saveErrorInfo);
61804
+ if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
61805
+ return result2;
61806
+ }
61807
+ }
61831
61808
  } else {
61832
61809
  if (relation !== subtypeRelation && relation !== strictSubtypeRelation && isPartialMappedType(target2) && isEmptyObjectType(source2)) {
61833
61810
  return -1 /* True */;
@@ -63725,8 +63702,8 @@ function createTypeChecker(host) {
63725
63702
  if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
63726
63703
  return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
63727
63704
  }
63728
- const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
63729
- if (type.flags & 138117121 /* ObjectFlagsType */) {
63705
+ 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));
63706
+ if (type.flags & 3899393 /* ObjectFlagsType */) {
63730
63707
  type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
63731
63708
  }
63732
63709
  return result;
@@ -64853,7 +64830,8 @@ function createTypeChecker(host) {
64853
64830
  if (hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node)) {
64854
64831
  const initializer = getEffectiveInitializer(declaration);
64855
64832
  if (initializer) {
64856
- return tryGetNameFromType(getTypeOfExpression(initializer));
64833
+ const initializerType = isBindingPattern(declaration.parent) ? getTypeForBindingElement(declaration) : getTypeOfExpression(initializer);
64834
+ return initializerType && tryGetNameFromType(initializerType);
64857
64835
  }
64858
64836
  if (isEnumMember(declaration)) {
64859
64837
  return getTextOfPropertyName(declaration.name);
@@ -66248,10 +66226,10 @@ function createTypeChecker(host) {
66248
66226
  if (isMatchingConstructorReference(right)) {
66249
66227
  return narrowTypeByConstructor(type, operator, left, assumeTrue);
66250
66228
  }
66251
- if (isBooleanLiteral(right)) {
66229
+ if (isBooleanLiteral(right) && !isAccessExpression(left)) {
66252
66230
  return narrowTypeByBooleanComparison(type, left, right, operator, assumeTrue);
66253
66231
  }
66254
- if (isBooleanLiteral(left)) {
66232
+ if (isBooleanLiteral(left) && !isAccessExpression(right)) {
66255
66233
  return narrowTypeByBooleanComparison(type, right, left, operator, assumeTrue);
66256
66234
  }
66257
66235
  break;
@@ -107993,8 +107971,8 @@ function transformDeclarations(context) {
107993
107971
  const specifier = getModuleSpecifier(
107994
107972
  options,
107995
107973
  currentSourceFile,
107996
- getNormalizedAbsolutePath(outputFilePath2, host.getCurrentDirectory()),
107997
- getNormalizedAbsolutePath(declFileName, host.getCurrentDirectory()),
107974
+ toPath(outputFilePath2, host.getCurrentDirectory(), host.getCanonicalFileName),
107975
+ toPath(declFileName, host.getCurrentDirectory(), host.getCanonicalFileName),
107998
107976
  host
107999
107977
  );
108000
107978
  if (!pathIsRelative(specifier)) {
@@ -115420,8 +115398,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
115420
115398
  }
115421
115399
  const baseName = getBaseNameOfFileName(fileOrDirectory);
115422
115400
  const fsQueryResult = {
115423
- fileExists: host.fileExists(fileOrDirectory),
115424
- directoryExists: host.directoryExists(fileOrDirectory)
115401
+ fileExists: host.fileExists(fileOrDirectoryPath),
115402
+ directoryExists: host.directoryExists(fileOrDirectoryPath)
115425
115403
  };
115426
115404
  if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) {
115427
115405
  clearCache();
@@ -115504,9 +115482,11 @@ function cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, t
115504
115482
  });
115505
115483
  }
115506
115484
  function updateMissingFilePathsWatch(program, missingFileWatches, createMissingFileWatch) {
115485
+ const missingFilePaths = program.getMissingFilePaths();
115486
+ const newMissingFilePathMap = arrayToMap(missingFilePaths, identity, returnTrue);
115507
115487
  mutateMap(
115508
115488
  missingFileWatches,
115509
- program.getMissingFilePaths(),
115489
+ newMissingFilePathMap,
115510
115490
  {
115511
115491
  // Watch the missing files
115512
115492
  createNewValue: createMissingFileWatch,
@@ -116333,8 +116313,7 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
116333
116313
  return false;
116334
116314
  if (program.getSourceFiles().some(sourceFileNotUptoDate))
116335
116315
  return false;
116336
- const missingPaths = program.getMissingFilePaths();
116337
- if (missingPaths && forEachEntry(missingPaths, fileExists))
116316
+ if (program.getMissingFilePaths().some(fileExists))
116338
116317
  return false;
116339
116318
  const currentOptions = program.getCompilerOptions();
116340
116319
  if (!compareDataObjects(currentOptions, newOptions))
@@ -116634,7 +116613,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116634
116613
  let redirectTargetsMap = createMultiMap();
116635
116614
  let usesUriStyleNodeCoreModules = false;
116636
116615
  const filesByName = /* @__PURE__ */ new Map();
116637
- let missingFileNames = /* @__PURE__ */ new Map();
116616
+ let missingFilePaths;
116638
116617
  const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
116639
116618
  let resolvedProjectReferences;
116640
116619
  let projectReferenceRedirects;
@@ -116753,10 +116732,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116753
116732
  });
116754
116733
  }
116755
116734
  }
116735
+ missingFilePaths = arrayFrom(mapDefinedIterator(filesByName.entries(), ([path, file]) => file === void 0 ? path : void 0));
116756
116736
  files = stableSort(processingDefaultLibFiles, compareDefaultLibFiles).concat(processingOtherFiles);
116757
116737
  processingDefaultLibFiles = void 0;
116758
116738
  processingOtherFiles = void 0;
116759
116739
  }
116740
+ Debug.assert(!!missingFilePaths);
116760
116741
  if (oldProgram && host.onReleaseOldSourceFile) {
116761
116742
  const oldSourceFiles = oldProgram.getSourceFiles();
116762
116743
  for (const oldSourceFile of oldSourceFiles) {
@@ -116801,7 +116782,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
116801
116782
  getSourceFile,
116802
116783
  getSourceFileByPath,
116803
116784
  getSourceFiles: () => files,
116804
- getMissingFilePaths: () => missingFileNames,
116785
+ getMissingFilePaths: () => missingFilePaths,
116786
+ // TODO: GH#18217
116805
116787
  getModuleResolutionCache: () => moduleResolutionCache,
116806
116788
  getFilesByNameMap: () => filesByName,
116807
116789
  getCompilerOptions: () => options,
@@ -117228,7 +117210,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117228
117210
  const newSourceFiles = [];
117229
117211
  const modifiedSourceFiles = [];
117230
117212
  structureIsReused = 2 /* Completely */;
117231
- if (forEachEntry(oldProgram.getMissingFilePaths(), (missingFilePath) => host.fileExists(missingFilePath))) {
117213
+ if (oldProgram.getMissingFilePaths().some((missingFilePath) => host.fileExists(missingFilePath))) {
117232
117214
  return 0 /* Not */;
117233
117215
  }
117234
117216
  const oldSourceFiles = oldProgram.getSourceFiles();
@@ -117368,7 +117350,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117368
117350
  if (!arrayIsEqualTo(oldProgram.getAutomaticTypeDirectiveNames(), automaticTypeDirectiveNames))
117369
117351
  return 1 /* SafeModules */;
117370
117352
  }
117371
- missingFileNames = oldProgram.getMissingFilePaths();
117353
+ missingFilePaths = oldProgram.getMissingFilePaths();
117372
117354
  Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
117373
117355
  for (const newSourceFile of newSourceFiles) {
117374
117356
  filesByName.set(newSourceFile.path, newSourceFile);
@@ -117425,7 +117407,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117425
117407
  const path = toPath3(f);
117426
117408
  if (getSourceFileByPath(path))
117427
117409
  return true;
117428
- if (missingFileNames.has(path))
117410
+ if (contains(missingFilePaths, path))
117429
117411
  return false;
117430
117412
  return host.fileExists(f);
117431
117413
  },
@@ -118237,7 +118219,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118237
118219
  addFileToFilesByName(
118238
118220
  file2,
118239
118221
  path,
118240
- fileName,
118241
118222
  /*redirectedPath*/
118242
118223
  void 0
118243
118224
  );
@@ -118310,7 +118291,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118310
118291
  if (fileFromPackageId) {
118311
118292
  const dupFile = createRedirectedSourceFile(fileFromPackageId, file, fileName, path, toPath3(fileName), originalFileName, sourceFileOptions);
118312
118293
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
118313
- addFileToFilesByName(dupFile, path, fileName, redirectedPath);
118294
+ addFileToFilesByName(dupFile, path, redirectedPath);
118314
118295
  addFileIncludeReason(dupFile, reason);
118315
118296
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
118316
118297
  processingOtherFiles.push(dupFile);
@@ -118320,7 +118301,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118320
118301
  sourceFileToPackageName.set(path, packageIdToPackageName(packageId));
118321
118302
  }
118322
118303
  }
118323
- addFileToFilesByName(file, path, fileName, redirectedPath);
118304
+ addFileToFilesByName(file, path, redirectedPath);
118324
118305
  if (file) {
118325
118306
  sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0);
118326
118307
  file.fileName = fileName;
@@ -118360,21 +118341,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118360
118341
  if (file)
118361
118342
  fileReasons.add(file.path, reason);
118362
118343
  }
118363
- function addFileToFilesByName(file, path, fileName, redirectedPath) {
118344
+ function addFileToFilesByName(file, path, redirectedPath) {
118364
118345
  if (redirectedPath) {
118365
- updateFilesByNameMap(fileName, redirectedPath, file);
118366
- updateFilesByNameMap(fileName, path, file || false);
118346
+ filesByName.set(redirectedPath, file);
118347
+ filesByName.set(path, file || false);
118367
118348
  } else {
118368
- updateFilesByNameMap(fileName, path, file);
118349
+ filesByName.set(path, file);
118369
118350
  }
118370
118351
  }
118371
- function updateFilesByNameMap(fileName, path, file) {
118372
- filesByName.set(path, file);
118373
- if (file !== void 0)
118374
- missingFileNames.delete(path);
118375
- else
118376
- missingFileNames.set(path, fileName);
118377
- }
118378
118352
  function getProjectReferenceRedirect(fileName) {
118379
118353
  const referencedProject = getProjectReferenceRedirectProject(fileName);
118380
118354
  return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
@@ -118695,7 +118669,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118695
118669
  /*file*/
118696
118670
  void 0,
118697
118671
  sourceFilePath,
118698
- refPath,
118699
118672
  /*redirectedPath*/
118700
118673
  void 0
118701
118674
  );
@@ -118707,7 +118680,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118707
118680
  addFileToFilesByName(
118708
118681
  sourceFile,
118709
118682
  sourceFilePath,
118710
- refPath,
118711
118683
  /*redirectedPath*/
118712
118684
  void 0
118713
118685
  );
@@ -118717,7 +118689,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118717
118689
  addFileToFilesByName(
118718
118690
  sourceFile,
118719
118691
  sourceFilePath,
118720
- refPath,
118721
118692
  /*redirectedPath*/
118722
118693
  void 0
118723
118694
  );
@@ -122219,7 +122190,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122219
122190
  const watcher = {
122220
122191
  watcher: canWatchAffectingLocation(resolutionHost.toPath(locationToWatch)) ? resolutionHost.watchAffectingFileLocation(locationToWatch, (fileName, eventKind) => {
122221
122192
  cachedDirectoryStructureHost == null ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
122222
- invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache());
122193
+ invalidateAffectingFileWatcher(locationToWatch, moduleResolutionCache.getPackageJsonInfoCache().getInternalMap());
122223
122194
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
122224
122195
  }) : noopFileWatcher,
122225
122196
  resolutions: isSymlink ? 0 : resolutions,
@@ -122259,7 +122230,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122259
122230
  if (watcher == null ? void 0 : watcher.files)
122260
122231
  (affectingPathChecksForFile ?? (affectingPathChecksForFile = /* @__PURE__ */ new Set())).add(path);
122261
122232
  (_a = watcher == null ? void 0 : watcher.symlinks) == null ? void 0 : _a.forEach((path2) => invalidateAffectingFileWatcher(path2, packageJsonMap));
122262
- packageJsonMap.deletePackageJsonInfo(path);
122233
+ packageJsonMap == null ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
122263
122234
  }
122264
122235
  function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
122265
122236
  const program = resolutionHost.getCurrentProgram();
@@ -122444,14 +122415,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122444
122415
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
122445
122416
  }
122446
122417
  function invalidatePackageJsonMap() {
122447
- const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().entries();
122418
+ const packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
122448
122419
  if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
122449
- for (const key of packageJsonMap) {
122450
- const path = resolutionHost.toPath(key[0]);
122451
- if (isInvalidatedFailedLookup(path)) {
122452
- moduleResolutionCache.getPackageJsonInfoCache().deletePackageJsonInfo(key[0]);
122453
- }
122454
- }
122420
+ packageJsonMap.forEach((_value, path) => isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : void 0);
122455
122421
  }
122456
122422
  }
122457
122423
  function invalidateResolutionsOfFailedLookupLocations() {
@@ -123468,11 +123434,7 @@ function createWatchProgram(host) {
123468
123434
  const oldProgram = getCurrentProgram();
123469
123435
  builderProgram = createProgram2(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
123470
123436
  resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
123471
- updateMissingFilePathsWatch(
123472
- builderProgram.getProgram(),
123473
- missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()),
123474
- watchMissingFilePath
123475
- );
123437
+ updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = /* @__PURE__ */ new Map()), watchMissingFilePath);
123476
123438
  if (needsUpdateInTypeRootWatch) {
123477
123439
  resolutionCache.updateTypeRootsWatch();
123478
123440
  }
@@ -123765,15 +123727,8 @@ function createWatchProgram(host) {
123765
123727
  cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
123766
123728
  }
123767
123729
  }
123768
- function watchMissingFilePath(missingFilePath, missingFileName) {
123769
- return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(
123770
- missingFilePath,
123771
- missingFileName,
123772
- onMissingFileChange,
123773
- 500 /* Medium */,
123774
- watchOptions,
123775
- WatchType.MissingFile
123776
- );
123730
+ function watchMissingFilePath(missingFilePath) {
123731
+ return (parsedConfigs == null ? void 0 : parsedConfigs.has(missingFilePath)) ? noopFileWatcher : watchFilePath(missingFilePath, missingFilePath, onMissingFileChange, 500 /* Medium */, watchOptions, WatchType.MissingFile);
123777
123732
  }
123778
123733
  function onMissingFileChange(fileName, eventKind, missingFilePath) {
123779
123734
  updateCachedSystemWithFile(fileName, missingFilePath, eventKind);
@@ -124248,7 +124203,6 @@ function createStateBuildOrder(state) {
124248
124203
  mutateMapSkippingNewValues(state.projectErrorsReported, currentProjects, noopOnDelete);
124249
124204
  mutateMapSkippingNewValues(state.buildInfoCache, currentProjects, noopOnDelete);
124250
124205
  mutateMapSkippingNewValues(state.outputTimeStamps, currentProjects, noopOnDelete);
124251
- mutateMapSkippingNewValues(state.lastCachedPackageJsonLookups, currentProjects, noopOnDelete);
124252
124206
  if (state.watch) {
124253
124207
  mutateMapSkippingNewValues(
124254
124208
  state.allWatchedConfigFiles,
@@ -124497,7 +124451,7 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
124497
124451
  return withProgramOrUndefined(action) || emptyArray;
124498
124452
  }
124499
124453
  function createProgram2() {
124500
- var _a, _b, _c;
124454
+ var _a, _b;
124501
124455
  Debug.assert(program === void 0);
124502
124456
  if (state.options.dry) {
124503
124457
  reportStatus(state, Diagnostics.A_non_dry_build_would_build_project_0, project);
@@ -124526,16 +124480,12 @@ function createBuildOrUpdateInvalidedProject(kind, state, project, projectPath,
124526
124480
  config.projectReferences
124527
124481
  );
124528
124482
  if (state.watch) {
124529
- const entries = (_c = state.moduleResolutionCache) == null ? void 0 : _c.getPackageJsonInfoCache().entries();
124530
124483
  state.lastCachedPackageJsonLookups.set(
124531
124484
  projectPath,
124532
- entries && new Map(arrayFrom(
124533
- entries,
124534
- ([path, data]) => {
124535
- path = state.host.realpath && data ? state.host.realpath(path) : path;
124536
- return [toPath2(state, path), path];
124537
- }
124538
- ))
124485
+ state.moduleResolutionCache && map(
124486
+ state.moduleResolutionCache.getPackageJsonInfoCache().entries(),
124487
+ ([path, data]) => [state.host.realpath && data ? toPath2(state, state.host.realpath(path)) : path, data]
124488
+ )
124539
124489
  );
124540
124490
  state.builderPrograms.set(projectPath, program);
124541
124491
  }
@@ -125268,10 +125218,9 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
125268
125218
  const extendedConfigStatus = forEach(project.options.configFile.extendedSourceFiles || emptyArray, (configFile) => checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime, oldestOutputFileName));
125269
125219
  if (extendedConfigStatus)
125270
125220
  return extendedConfigStatus;
125271
- const packageJsonLookups = state.lastCachedPackageJsonLookups.get(resolvedPath);
125272
- const dependentPackageFileStatus = packageJsonLookups && forEachEntry(
125273
- packageJsonLookups,
125274
- (path) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
125221
+ const dependentPackageFileStatus = forEach(
125222
+ state.lastCachedPackageJsonLookups.get(resolvedPath) || emptyArray,
125223
+ ([path]) => checkConfigFileUpToDateStatus(state, path, oldestOutputFileTime, oldestOutputFileName)
125275
125224
  );
125276
125225
  if (dependentPackageFileStatus)
125277
125226
  return dependentPackageFileStatus;
@@ -125682,9 +125631,9 @@ function watchPackageJsonFiles(state, resolved, resolvedPath, parsed) {
125682
125631
  getOrCreateValueMapFromConfigFileMap(state.allWatchedPackageJsonFiles, resolvedPath),
125683
125632
  new Map(state.lastCachedPackageJsonLookups.get(resolvedPath)),
125684
125633
  {
125685
- createNewValue: (_path, input) => watchFile(
125634
+ createNewValue: (path, _input) => watchFile(
125686
125635
  state,
125687
- input,
125636
+ path,
125688
125637
  () => invalidateProjectAndScheduleBuilds(state, resolvedPath, 0 /* Update */),
125689
125638
  2e3 /* High */,
125690
125639
  parsed == null ? void 0 : parsed.watchOptions,