@typescript-deploys/pr-build 5.4.0-pr-56794-34 → 5.4.0-pr-56877-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/lib.es5.d.ts CHANGED
@@ -1666,11 +1666,6 @@ type Capitalize<S extends string> = intrinsic;
1666
1666
  */
1667
1667
  type Uncapitalize<S extends string> = intrinsic;
1668
1668
 
1669
- /**
1670
- * Marker for non-inference type position
1671
- */
1672
- type NoInfer<T> = intrinsic;
1673
-
1674
1669
  /**
1675
1670
  * Marker for contextual 'this' type
1676
1671
  */
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.20231220`;
21
+ var version = `${versionMajorMinor}.0-insiders.20231226`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -1049,9 +1049,9 @@ function levenshteinWithMax(s1, s2, max) {
1049
1049
  const res = previous[s2.length];
1050
1050
  return res > max ? void 0 : res;
1051
1051
  }
1052
- function endsWith(str, suffix) {
1052
+ function endsWith(str, suffix, ignoreCase) {
1053
1053
  const expectedPos = str.length - suffix.length;
1054
- return expectedPos >= 0 && str.indexOf(suffix, expectedPos) === expectedPos;
1054
+ return expectedPos >= 0 && (ignoreCase ? equateStringsCaseInsensitive(str.slice(expectedPos), suffix) : str.indexOf(suffix, expectedPos) === expectedPos);
1055
1055
  }
1056
1056
  function removeSuffix(str, suffix) {
1057
1057
  return endsWith(str, suffix) ? str.slice(0, str.length - suffix.length) : str;
@@ -1109,8 +1109,8 @@ function findBestPatternMatch(values, getPattern, candidate) {
1109
1109
  }
1110
1110
  return matchedValue;
1111
1111
  }
1112
- function startsWith(str, prefix) {
1113
- return str.lastIndexOf(prefix, 0) === 0;
1112
+ function startsWith(str, prefix, ignoreCase) {
1113
+ return ignoreCase ? equateStringsCaseInsensitive(str.slice(0, prefix.length), prefix) : str.lastIndexOf(prefix, 0) === 0;
1114
1114
  }
1115
1115
  function removePrefix(str, prefix) {
1116
1116
  return startsWith(str, prefix) ? str.substr(prefix.length) : str;
@@ -3483,6 +3483,7 @@ var ModifierFlags = /* @__PURE__ */ ((ModifierFlags3) => {
3483
3483
  return ModifierFlags3;
3484
3484
  })(ModifierFlags || {});
3485
3485
  var RelationComparisonResult = /* @__PURE__ */ ((RelationComparisonResult3) => {
3486
+ RelationComparisonResult3[RelationComparisonResult3["None"] = 0] = "None";
3486
3487
  RelationComparisonResult3[RelationComparisonResult3["Succeeded"] = 1] = "Succeeded";
3487
3488
  RelationComparisonResult3[RelationComparisonResult3["Failed"] = 2] = "Failed";
3488
3489
  RelationComparisonResult3[RelationComparisonResult3["Reported"] = 4] = "Reported";
@@ -6783,6 +6784,8 @@ var Diagnostics = {
6783
6784
  This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
6784
6785
  This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
6785
6786
  Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, 1 /* Error */, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
6787
+ Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given: diag(4125, 1 /* Error */, "Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given_4125", "Each declaration of '{0}.{1}' differs in its value, where '{2}' was expected but '{3}' was given."),
6788
+ One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value: diag(4126, 1 /* Error */, "One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value_4126", "One value of '{0}.{1}' is the string '{2}', and the other is assumed to be an unknown numeric value."),
6786
6789
  The_current_host_does_not_support_the_0_option: diag(5001, 1 /* Error */, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
6787
6790
  Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, 1 /* Error */, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
6788
6791
  File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, 1 /* Error */, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -15728,6 +15731,13 @@ function readJsonOrUndefined(path, hostOrText) {
15728
15731
  function readJson(path, host) {
15729
15732
  return readJsonOrUndefined(path, host) || {};
15730
15733
  }
15734
+ function tryParseJson(text) {
15735
+ try {
15736
+ return JSON.parse(text);
15737
+ } catch {
15738
+ return void 0;
15739
+ }
15740
+ }
15731
15741
  function directoryProbablyExists(directoryName, host) {
15732
15742
  return !host.directoryExists || host.directoryExists(directoryName);
15733
15743
  }
@@ -37603,6 +37613,9 @@ function getAutomaticTypeDirectiveNames(options, host) {
37603
37613
  function isPackageJsonInfo(entry) {
37604
37614
  return !!(entry == null ? void 0 : entry.contents);
37605
37615
  }
37616
+ function isMissingPackageJsonInfo(entry) {
37617
+ return !!entry && !entry.contents;
37618
+ }
37606
37619
  function compilerOptionValueToString(value) {
37607
37620
  var _a;
37608
37621
  if (value === null || typeof value !== "object") {
@@ -42746,7 +42759,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
42746
42759
  const { sourceDirectory, canonicalSourceDirectory, getCanonicalFileName } = info;
42747
42760
  const allowedEndings = getAllowedEndingsInPrefererredOrder(importMode);
42748
42761
  const relativePath = rootDirs && tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) || processEnding(ensurePathIsNonModuleName(getRelativePathFromDirectory(sourceDirectory, moduleFileName, getCanonicalFileName)), allowedEndings, compilerOptions);
42749
- if (!baseUrl && !paths || relativePreference === 0 /* Relative */) {
42762
+ if (!baseUrl && !paths && !getResolvePackageJsonImports(compilerOptions) || relativePreference === 0 /* Relative */) {
42750
42763
  return pathsOnly ? void 0 : relativePath;
42751
42764
  }
42752
42765
  const baseDirectory = getNormalizedAbsolutePath(getPathsBasePath(compilerOptions, host) || baseUrl, host.getCurrentDirectory());
@@ -42754,11 +42767,12 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
42754
42767
  if (!relativeToBaseUrl) {
42755
42768
  return pathsOnly ? void 0 : relativePath;
42756
42769
  }
42757
- const fromPaths = paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions);
42770
+ const fromPackageJsonImports = pathsOnly ? void 0 : tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, compilerOptions, host, importMode);
42771
+ const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
42758
42772
  if (pathsOnly) {
42759
42773
  return fromPaths;
42760
42774
  }
42761
- const maybeNonRelative = fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths;
42775
+ const maybeNonRelative = fromPackageJsonImports ?? (fromPaths === void 0 && baseUrl !== void 0 ? processEnding(relativeToBaseUrl, allowedEndings, compilerOptions) : fromPaths);
42762
42776
  if (!maybeNonRelative) {
42763
42777
  return relativePath;
42764
42778
  }
@@ -42797,8 +42811,8 @@ function getNearestAncestorDirectoryWithPackageJson(host, fileName) {
42797
42811
  if (host.getNearestAncestorDirectoryWithPackageJson) {
42798
42812
  return host.getNearestAncestorDirectoryWithPackageJson(fileName);
42799
42813
  }
42800
- return !!forEachAncestorDirectory(fileName, (directory) => {
42801
- return host.fileExists(combinePaths(directory, "package.json")) ? true : void 0;
42814
+ return forEachAncestorDirectory(fileName, (directory) => {
42815
+ return host.fileExists(combinePaths(directory, "package.json")) ? directory : void 0;
42802
42816
  });
42803
42817
  }
42804
42818
  function forEachFileNameOfModule(importingFileName, importedFileName, host, preferSymlinks, cb) {
@@ -42972,8 +42986,12 @@ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, hos
42972
42986
  return ending !== 0 /* Minimal */ || value === processEnding(relativeToBaseUrl, [ending], compilerOptions, host);
42973
42987
  }
42974
42988
  }
42975
- function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, exports2, conditions, mode = 0 /* Exact */) {
42989
+ function tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions, mode, isImports) {
42976
42990
  if (typeof exports2 === "string") {
42991
+ const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
42992
+ const getCommonSourceDirectory2 = () => host.getCommonSourceDirectory();
42993
+ const outputFile = isImports && getOutputJSFileNameWorker(targetFilePath, options, ignoreCase, getCommonSourceDirectory2);
42994
+ const declarationFile = isImports && getOutputDeclarationFileNameWorker(targetFilePath, options, ignoreCase, getCommonSourceDirectory2);
42977
42995
  const pathOrPattern = getNormalizedAbsolutePath(
42978
42996
  combinePaths(packageDirectory, exports2),
42979
42997
  /*currentDirectory*/
@@ -42982,12 +43000,25 @@ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory,
42982
43000
  const extensionSwappedTarget = hasTSFileExtension(targetFilePath) ? removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : void 0;
42983
43001
  switch (mode) {
42984
43002
  case 0 /* Exact */:
42985
- if (comparePaths(targetFilePath, pathOrPattern) === 0 /* EqualTo */ || extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern) === 0 /* EqualTo */) {
43003
+ if (extensionSwappedTarget && comparePaths(extensionSwappedTarget, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || comparePaths(targetFilePath, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || outputFile && comparePaths(outputFile, pathOrPattern, ignoreCase) === 0 /* EqualTo */ || declarationFile && comparePaths(declarationFile, pathOrPattern, ignoreCase) === 0 /* EqualTo */) {
42986
43004
  return { moduleFileToTry: packageName };
42987
43005
  }
42988
43006
  break;
42989
43007
  case 1 /* Directory */:
42990
- if (containsPath(pathOrPattern, targetFilePath)) {
43008
+ if (extensionSwappedTarget && containsPath(pathOrPattern, extensionSwappedTarget, ignoreCase)) {
43009
+ const fragment = getRelativePathFromDirectory(
43010
+ pathOrPattern,
43011
+ extensionSwappedTarget,
43012
+ /*ignoreCase*/
43013
+ false
43014
+ );
43015
+ return { moduleFileToTry: getNormalizedAbsolutePath(
43016
+ combinePaths(combinePaths(packageName, exports2), fragment),
43017
+ /*currentDirectory*/
43018
+ void 0
43019
+ ) };
43020
+ }
43021
+ if (containsPath(pathOrPattern, targetFilePath, ignoreCase)) {
42991
43022
  const fragment = getRelativePathFromDirectory(
42992
43023
  pathOrPattern,
42993
43024
  targetFilePath,
@@ -43000,48 +43031,136 @@ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory,
43000
43031
  void 0
43001
43032
  ) };
43002
43033
  }
43034
+ if (outputFile && containsPath(pathOrPattern, outputFile, ignoreCase)) {
43035
+ const fragment = getRelativePathFromDirectory(
43036
+ pathOrPattern,
43037
+ outputFile,
43038
+ /*ignoreCase*/
43039
+ false
43040
+ );
43041
+ return { moduleFileToTry: combinePaths(packageName, fragment) };
43042
+ }
43043
+ if (declarationFile && containsPath(pathOrPattern, declarationFile, ignoreCase)) {
43044
+ const fragment = getRelativePathFromDirectory(
43045
+ pathOrPattern,
43046
+ declarationFile,
43047
+ /*ignoreCase*/
43048
+ false
43049
+ );
43050
+ return { moduleFileToTry: combinePaths(packageName, fragment) };
43051
+ }
43003
43052
  break;
43004
43053
  case 2 /* Pattern */:
43005
43054
  const starPos = pathOrPattern.indexOf("*");
43006
43055
  const leadingSlice = pathOrPattern.slice(0, starPos);
43007
43056
  const trailingSlice = pathOrPattern.slice(starPos + 1);
43008
- if (startsWith(targetFilePath, leadingSlice) && endsWith(targetFilePath, trailingSlice)) {
43057
+ if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice, ignoreCase) && endsWith(extensionSwappedTarget, trailingSlice, ignoreCase)) {
43058
+ const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
43059
+ return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
43060
+ }
43061
+ if (startsWith(targetFilePath, leadingSlice, ignoreCase) && endsWith(targetFilePath, trailingSlice, ignoreCase)) {
43009
43062
  const starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
43010
43063
  return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
43011
43064
  }
43012
- if (extensionSwappedTarget && startsWith(extensionSwappedTarget, leadingSlice) && endsWith(extensionSwappedTarget, trailingSlice)) {
43013
- const starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
43065
+ if (outputFile && startsWith(outputFile, leadingSlice, ignoreCase) && endsWith(outputFile, trailingSlice, ignoreCase)) {
43066
+ const starReplacement = outputFile.slice(leadingSlice.length, outputFile.length - trailingSlice.length);
43067
+ return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
43068
+ }
43069
+ if (declarationFile && startsWith(declarationFile, leadingSlice, ignoreCase) && endsWith(declarationFile, trailingSlice, ignoreCase)) {
43070
+ const starReplacement = declarationFile.slice(leadingSlice.length, declarationFile.length - trailingSlice.length);
43014
43071
  return { moduleFileToTry: replaceFirstStar(packageName, starReplacement) };
43015
43072
  }
43016
43073
  break;
43017
43074
  }
43018
43075
  } else if (Array.isArray(exports2)) {
43019
- return forEach(exports2, (e) => tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, e, conditions));
43076
+ return forEach(exports2, (e) => tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, e, conditions, mode, isImports));
43020
43077
  } else if (typeof exports2 === "object" && exports2 !== null) {
43021
- if (allKeysStartWithDot(exports2)) {
43022
- return forEach(getOwnKeys(exports2), (k) => {
43023
- const subPackageName = getNormalizedAbsolutePath(
43024
- combinePaths(packageName, k),
43025
- /*currentDirectory*/
43026
- void 0
43027
- );
43028
- const mode2 = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
43029
- return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports2[k], conditions, mode2);
43030
- });
43031
- } else {
43032
- for (const key of getOwnKeys(exports2)) {
43033
- if (key === "default" || conditions.includes(key) || isApplicableVersionedTypesKey(conditions, key)) {
43034
- const subTarget = exports2[key];
43035
- const result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode);
43036
- if (result) {
43037
- return result;
43038
- }
43078
+ for (const key of getOwnKeys(exports2)) {
43079
+ if (key === "default" || conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(conditions, key)) {
43080
+ const subTarget = exports2[key];
43081
+ const result = tryGetModuleNameFromExportsOrImports(options, host, targetFilePath, packageDirectory, packageName, subTarget, conditions, mode, isImports);
43082
+ if (result) {
43083
+ return result;
43039
43084
  }
43040
43085
  }
43041
43086
  }
43042
43087
  }
43043
43088
  return void 0;
43044
43089
  }
43090
+ function tryGetModuleNameFromExports(options, host, targetFilePath, packageDirectory, packageName, exports2, conditions) {
43091
+ if (typeof exports2 === "object" && exports2 !== null && !Array.isArray(exports2) && allKeysStartWithDot(exports2)) {
43092
+ return forEach(getOwnKeys(exports2), (k) => {
43093
+ const subPackageName = getNormalizedAbsolutePath(
43094
+ combinePaths(packageName, k),
43095
+ /*currentDirectory*/
43096
+ void 0
43097
+ );
43098
+ const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
43099
+ return tryGetModuleNameFromExportsOrImports(
43100
+ options,
43101
+ host,
43102
+ targetFilePath,
43103
+ packageDirectory,
43104
+ subPackageName,
43105
+ exports2[k],
43106
+ conditions,
43107
+ mode,
43108
+ /*isImports*/
43109
+ false
43110
+ );
43111
+ });
43112
+ }
43113
+ return tryGetModuleNameFromExportsOrImports(
43114
+ options,
43115
+ host,
43116
+ targetFilePath,
43117
+ packageDirectory,
43118
+ packageName,
43119
+ exports2,
43120
+ conditions,
43121
+ 0 /* Exact */,
43122
+ /*isImports*/
43123
+ false
43124
+ );
43125
+ }
43126
+ function tryGetModuleNameFromPackageJsonImports(moduleFileName, sourceDirectory, options, host, importMode) {
43127
+ var _a, _b, _c;
43128
+ if (!host.readFile || !getResolvePackageJsonImports(options)) {
43129
+ return void 0;
43130
+ }
43131
+ const ancestorDirectoryWithPackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
43132
+ if (!ancestorDirectoryWithPackageJson) {
43133
+ return void 0;
43134
+ }
43135
+ const packageJsonPath = combinePaths(ancestorDirectoryWithPackageJson, "package.json");
43136
+ const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
43137
+ if (isMissingPackageJsonInfo(cachedPackageJson) || !host.fileExists(packageJsonPath)) {
43138
+ return void 0;
43139
+ }
43140
+ const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
43141
+ const imports = packageJsonContent == null ? void 0 : packageJsonContent.imports;
43142
+ if (!imports) {
43143
+ return void 0;
43144
+ }
43145
+ const conditions = getConditions(options, importMode);
43146
+ return (_c = forEach(getOwnKeys(imports), (k) => {
43147
+ if (!startsWith(k, "#") || k === "#" || startsWith(k, "#/"))
43148
+ return void 0;
43149
+ const mode = endsWith(k, "/") ? 1 /* Directory */ : k.includes("*") ? 2 /* Pattern */ : 0 /* Exact */;
43150
+ return tryGetModuleNameFromExportsOrImports(
43151
+ options,
43152
+ host,
43153
+ moduleFileName,
43154
+ ancestorDirectoryWithPackageJson,
43155
+ k,
43156
+ imports[k],
43157
+ conditions,
43158
+ mode,
43159
+ /*isImports*/
43160
+ true
43161
+ );
43162
+ })) == null ? void 0 : _c.moduleFileToTry;
43163
+ }
43045
43164
  function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, allowedEndings, compilerOptions) {
43046
43165
  const normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
43047
43166
  if (normalizedTargetPaths === void 0) {
@@ -43115,22 +43234,21 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
43115
43234
  let maybeBlockedByTypesVersions = false;
43116
43235
  const cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) == null ? void 0 : _a.call(host)) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
43117
43236
  if (isPackageJsonInfo(cachedPackageJson) || cachedPackageJson === void 0 && host.fileExists(packageJsonPath)) {
43118
- const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
43237
+ const packageJsonContent = (cachedPackageJson == null ? void 0 : cachedPackageJson.contents.packageJsonContent) || tryParseJson(host.readFile(packageJsonPath));
43119
43238
  const importMode = overrideMode || importingSourceFile.impliedNodeFormat;
43120
43239
  if (getResolvePackageJsonExports(options)) {
43121
43240
  const nodeModulesDirectoryName2 = packageRootPath.substring(parts.topLevelPackageNameIndex + 1);
43122
43241
  const packageName2 = getPackageNameFromTypesPackageName(nodeModulesDirectoryName2);
43123
43242
  const conditions = getConditions(options, importMode);
43124
- const fromExports = packageJsonContent.exports ? tryGetModuleNameFromExports(options, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
43243
+ const fromExports = (packageJsonContent == null ? void 0 : packageJsonContent.exports) ? tryGetModuleNameFromExports(options, host, path, packageRootPath, packageName2, packageJsonContent.exports, conditions) : void 0;
43125
43244
  if (fromExports) {
43126
- const withJsExtension = !hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
43127
- return { ...withJsExtension, verbatimFromExports: true };
43245
+ return { ...fromExports, verbatimFromExports: true };
43128
43246
  }
43129
- if (packageJsonContent.exports) {
43247
+ if (packageJsonContent == null ? void 0 : packageJsonContent.exports) {
43130
43248
  return { moduleFileToTry: path, blockedByExports: true };
43131
43249
  }
43132
43250
  }
43133
- const versionPaths = packageJsonContent.typesVersions ? getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions) : void 0;
43251
+ const versionPaths = (packageJsonContent == null ? void 0 : packageJsonContent.typesVersions) ? getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions) : void 0;
43134
43252
  if (versionPaths) {
43135
43253
  const subModuleName = path.slice(packageRootPath.length + 1);
43136
43254
  const fromPaths = tryGetModuleNameFromPaths(
@@ -43146,13 +43264,13 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
43146
43264
  moduleFileToTry = combinePaths(packageRootPath, fromPaths);
43147
43265
  }
43148
43266
  }
43149
- const mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
43267
+ const mainFileRelative = (packageJsonContent == null ? void 0 : packageJsonContent.typings) || (packageJsonContent == null ? void 0 : packageJsonContent.types) || (packageJsonContent == null ? void 0 : packageJsonContent.main) || "index.js";
43150
43268
  if (isString(mainFileRelative) && !(maybeBlockedByTypesVersions && matchPatternOrExact(tryParsePatterns(versionPaths.paths), mainFileRelative))) {
43151
43269
  const mainExportFile = toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
43152
43270
  const canonicalModuleFileToTry = getCanonicalFileName(moduleFileToTry);
43153
43271
  if (removeFileExtension(mainExportFile) === removeFileExtension(canonicalModuleFileToTry)) {
43154
43272
  return { packageRootPath, moduleFileToTry };
43155
- } else if (packageJsonContent.type !== "module" && !fileExtensionIsOneOf(canonicalModuleFileToTry, extensionsNotSupportingExtensionlessResolution) && startsWith(canonicalModuleFileToTry, mainExportFile) && getDirectoryPath(canonicalModuleFileToTry) === removeTrailingDirectorySeparator(mainExportFile) && removeFileExtension(getBaseFileName(canonicalModuleFileToTry)) === "index") {
43273
+ } else if ((packageJsonContent == null ? void 0 : packageJsonContent.type) !== "module" && !fileExtensionIsOneOf(canonicalModuleFileToTry, extensionsNotSupportingExtensionlessResolution) && startsWith(canonicalModuleFileToTry, mainExportFile) && getDirectoryPath(canonicalModuleFileToTry) === removeTrailingDirectorySeparator(mainExportFile) && removeFileExtension(getBaseFileName(canonicalModuleFileToTry)) === "index") {
43156
43274
  return { packageRootPath, moduleFileToTry };
43157
43275
  }
43158
43276
  }
@@ -43392,8 +43510,7 @@ var intrinsicTypeKinds = new Map(Object.entries({
43392
43510
  Uppercase: 0 /* Uppercase */,
43393
43511
  Lowercase: 1 /* Lowercase */,
43394
43512
  Capitalize: 2 /* Capitalize */,
43395
- Uncapitalize: 3 /* Uncapitalize */,
43396
- NoInfer: 4 /* NoInfer */
43513
+ Uncapitalize: 3 /* Uncapitalize */
43397
43514
  }));
43398
43515
  var SymbolLinks = class {
43399
43516
  };
@@ -48247,13 +48364,7 @@ function createTypeChecker(host) {
48247
48364
  return visitAndTransformType(type, (type2) => conditionalTypeToTypeNode(type2));
48248
48365
  }
48249
48366
  if (type.flags & 33554432 /* Substitution */) {
48250
- const typeNode = typeToTypeNodeHelper(type.baseType, context);
48251
- const noInferSymbol = isNoInferType(type) && getGlobalTypeSymbol(
48252
- "NoInfer",
48253
- /*reportErrors*/
48254
- false
48255
- );
48256
- return noInferSymbol ? symbolToTypeNode(noInferSymbol, context, 788968 /* Type */, [typeNode]) : typeNode;
48367
+ return typeToTypeNodeHelper(type.baseType, context);
48257
48368
  }
48258
48369
  return Debug.fail("Should be unreachable.");
48259
48370
  function conditionalTypeToTypeNode(type2) {
@@ -56157,11 +56268,8 @@ function createTypeChecker(host) {
56157
56268
  }
56158
56269
  function getTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
56159
56270
  const type = getDeclaredTypeOfSymbol(symbol);
56160
- if (type === intrinsicMarkerType) {
56161
- const typeKind = intrinsicTypeKinds.get(symbol.escapedName);
56162
- if (typeKind !== void 0 && typeArguments && typeArguments.length === 1) {
56163
- return typeKind === 4 /* NoInfer */ ? getNoInferType(typeArguments[0]) : getStringMappingType(symbol, typeArguments[0]);
56164
- }
56271
+ if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
56272
+ return getStringMappingType(symbol, typeArguments[0]);
56165
56273
  }
56166
56274
  const links = getSymbolLinks(symbol);
56167
56275
  const typeParameters = links.typeParameters;
@@ -56315,19 +56423,10 @@ function createTypeChecker(host) {
56315
56423
  }
56316
56424
  return links.resolvedJSDocType;
56317
56425
  }
56318
- function getNoInferType(type) {
56319
- return isNoInferTargetType(type) ? getOrCreateSubstitutionType(type, unknownType) : type;
56320
- }
56321
- function isNoInferTargetType(type) {
56322
- return !!(type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, isNoInferTargetType) || type.flags & 33554432 /* Substitution */ && !isNoInferType(type) && isNoInferTargetType(type.baseType) || type.flags & 524288 /* Object */ && !isEmptyAnonymousObjectType(type) || type.flags & (465829888 /* Instantiable */ & ~33554432 /* Substitution */) && !isPatternLiteralType(type));
56323
- }
56324
- function isNoInferType(type) {
56325
- return !!(type.flags & 33554432 /* Substitution */ && type.constraint.flags & 2 /* Unknown */);
56326
- }
56327
56426
  function getSubstitutionType(baseType, constraint) {
56328
- return constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */ ? baseType : getOrCreateSubstitutionType(baseType, constraint);
56329
- }
56330
- function getOrCreateSubstitutionType(baseType, constraint) {
56427
+ if (constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */) {
56428
+ return baseType;
56429
+ }
56331
56430
  const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
56332
56431
  const cached = substitutionTypes.get(id);
56333
56432
  if (cached) {
@@ -56340,7 +56439,7 @@ function createTypeChecker(host) {
56340
56439
  return result;
56341
56440
  }
56342
56441
  function getSubstitutionIntersection(substitutionType) {
56343
- return isNoInferType(substitutionType) ? substitutionType.baseType : getIntersectionType([substitutionType.constraint, substitutionType.baseType]);
56442
+ return getIntersectionType([substitutionType.constraint, substitutionType.baseType]);
56344
56443
  }
56345
56444
  function isUnaryTupleTypeNode(node) {
56346
56445
  return node.kind === 189 /* TupleType */ && node.elements.length === 1;
@@ -57861,7 +57960,7 @@ function createTypeChecker(host) {
57861
57960
  }
57862
57961
  function getIndexType(type, indexFlags = defaultIndexFlags) {
57863
57962
  type = getReducedType(type);
57864
- return isNoInferType(type) ? getNoInferType(getIndexType(type.baseType, indexFlags)) : shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(type, (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */), indexFlags === defaultIndexFlags);
57963
+ return shouldDeferIndexType(type, indexFlags) ? getIndexTypeForGenericType(type, indexFlags) : type.flags & 1048576 /* Union */ ? getIntersectionType(map(type.types, (t) => getIndexType(t, indexFlags))) : type.flags & 2097152 /* Intersection */ ? getUnionType(map(type.types, (t) => getIndexType(t, indexFlags))) : getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, indexFlags) : type === wildcardType ? wildcardType : type.flags & 2 /* Unknown */ ? neverType : type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType : getLiteralTypeFromProperties(type, (indexFlags & 2 /* NoIndexSignatures */ ? 128 /* StringLiteral */ : 402653316 /* StringLike */) | (indexFlags & 1 /* StringsOnly */ ? 0 : 296 /* NumberLike */ | 12288 /* ESSymbolLike */), indexFlags === defaultIndexFlags);
57865
57964
  }
57866
57965
  function getExtractStringType(type) {
57867
57966
  if (keyofStringsOnly) {
@@ -59598,9 +59697,6 @@ function createTypeChecker(host) {
59598
59697
  }
59599
59698
  if (flags & 33554432 /* Substitution */) {
59600
59699
  const newBaseType = instantiateType(type.baseType, mapper);
59601
- if (isNoInferType(type)) {
59602
- return getNoInferType(newBaseType);
59603
- }
59604
59700
  const newConstraint = instantiateType(type.constraint, mapper);
59605
59701
  if (newBaseType.flags & 8650752 /* TypeVariable */ && isGenericType(newConstraint)) {
59606
59702
  return getSubstitutionType(newBaseType, newConstraint);
@@ -60510,12 +60606,12 @@ function createTypeChecker(host) {
60510
60606
  return !!(entry & 1 /* Succeeded */);
60511
60607
  }
60512
60608
  const targetEnumType = getTypeOfSymbol(targetSymbol);
60513
- for (const property of getPropertiesOfType(getTypeOfSymbol(sourceSymbol))) {
60514
- if (property.flags & 8 /* EnumMember */) {
60515
- const targetProperty = getPropertyOfType(targetEnumType, property.escapedName);
60609
+ for (const sourceProperty of getPropertiesOfType(getTypeOfSymbol(sourceSymbol))) {
60610
+ if (sourceProperty.flags & 8 /* EnumMember */) {
60611
+ const targetProperty = getPropertyOfType(targetEnumType, sourceProperty.escapedName);
60516
60612
  if (!targetProperty || !(targetProperty.flags & 8 /* EnumMember */)) {
60517
60613
  if (errorReporter) {
60518
- errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(property), typeToString(
60614
+ errorReporter(Diagnostics.Property_0_is_missing_in_type_1, symbolName(sourceProperty), typeToString(
60519
60615
  getDeclaredTypeOfSymbol(targetSymbol),
60520
60616
  /*enclosingDeclaration*/
60521
60617
  void 0,
@@ -60527,6 +60623,35 @@ function createTypeChecker(host) {
60527
60623
  }
60528
60624
  return false;
60529
60625
  }
60626
+ const sourceValue = getEnumMemberValue(getDeclarationOfKind(sourceProperty, 306 /* EnumMember */));
60627
+ const targetValue = getEnumMemberValue(getDeclarationOfKind(targetProperty, 306 /* EnumMember */));
60628
+ if (sourceValue !== targetValue) {
60629
+ const sourceIsString = typeof sourceValue === "string";
60630
+ const targetIsString = typeof targetValue === "string";
60631
+ if (sourceValue !== void 0 && targetValue !== void 0) {
60632
+ if (!errorReporter) {
60633
+ enumRelation.set(id, 2 /* Failed */);
60634
+ } else {
60635
+ const escapedSource = sourceIsString ? `"${escapeString(sourceValue)}"` : sourceValue;
60636
+ const escapedTarget = targetIsString ? `"${escapeString(targetValue)}"` : targetValue;
60637
+ errorReporter(Diagnostics.Each_declaration_of_0_1_differs_in_its_value_where_2_was_expected_but_3_was_given, symbolName(targetSymbol), symbolName(targetProperty), escapedTarget, escapedSource);
60638
+ enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
60639
+ }
60640
+ return false;
60641
+ }
60642
+ if (sourceIsString || targetIsString) {
60643
+ if (!errorReporter) {
60644
+ enumRelation.set(id, 2 /* Failed */);
60645
+ } else {
60646
+ const knownStringValue = sourceValue ?? targetValue;
60647
+ Debug.assert(typeof knownStringValue === "string");
60648
+ const escapedValue = `"${escapeString(knownStringValue)}"`;
60649
+ errorReporter(Diagnostics.One_value_of_0_1_is_the_string_2_and_the_other_is_assumed_to_be_an_unknown_numeric_value, symbolName(targetSymbol), symbolName(targetProperty), escapedValue);
60650
+ enumRelation.set(id, 2 /* Failed */ | 4 /* Reported */);
60651
+ }
60652
+ return false;
60653
+ }
60654
+ }
60530
60655
  }
60531
60656
  }
60532
60657
  enumRelation.set(id, 1 /* Succeeded */);
@@ -64351,7 +64476,7 @@ function createTypeChecker(host) {
64351
64476
  let expandingFlags = 0 /* None */;
64352
64477
  inferFromTypes(originalSource, originalTarget);
64353
64478
  function inferFromTypes(source, target) {
64354
- if (!couldContainTypeVariables(target) || isNoInferType(target)) {
64479
+ if (!couldContainTypeVariables(target)) {
64355
64480
  return;
64356
64481
  }
64357
64482
  if (source === wildcardType || source === blockedStringType) {
@@ -64400,9 +64525,6 @@ function createTypeChecker(host) {
64400
64525
  }
64401
64526
  }
64402
64527
  if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
64403
- if (isNoInferType(target)) {
64404
- return;
64405
- }
64406
64528
  target = getActualTypeVariable(target);
64407
64529
  }
64408
64530
  if (target.flags & 8650752 /* TypeVariable */) {
@@ -73920,7 +74042,7 @@ function createTypeChecker(host) {
73920
74042
  if (!witnesses) {
73921
74043
  return false;
73922
74044
  }
73923
- const operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression));
74045
+ const operandConstraint = getBaseConstraintOfType(checkExpressionCached(node.expression.expression)) || unknownType;
73924
74046
  const notEqualFacts = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses);
73925
74047
  if (operandConstraint.flags & 3 /* AnyOrUnknown */) {
73926
74048
  return (556800 /* AllTypeofNE */ & notEqualFacts) === 556800 /* AllTypeofNE */;
@@ -110440,28 +110562,34 @@ function getSourceMapFilePath(jsFilePath, options) {
110440
110562
  function getOutputExtension(fileName, options) {
110441
110563
  return fileExtensionIs(fileName, ".json" /* Json */) ? ".json" /* Json */ : options.jsx === 1 /* Preserve */ && fileExtensionIsOneOf(fileName, [".jsx" /* Jsx */, ".tsx" /* Tsx */]) ? ".jsx" /* Jsx */ : fileExtensionIsOneOf(fileName, [".mts" /* Mts */, ".mjs" /* Mjs */]) ? ".mjs" /* Mjs */ : fileExtensionIsOneOf(fileName, [".cts" /* Cts */, ".cjs" /* Cjs */]) ? ".cjs" /* Cjs */ : ".js" /* Js */;
110442
110564
  }
110443
- function getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, outputDir, getCommonSourceDirectory2) {
110565
+ function getOutputPathWithoutChangingExt(inputFileName, ignoreCase, outputDir, getCommonSourceDirectory2) {
110444
110566
  return outputDir ? resolvePath(
110445
110567
  outputDir,
110446
- getRelativePathFromDirectory(getCommonSourceDirectory2 ? getCommonSourceDirectory2() : getCommonSourceDirectoryOfConfig(configFile, ignoreCase), inputFileName, ignoreCase)
110568
+ getRelativePathFromDirectory(getCommonSourceDirectory2(), inputFileName, ignoreCase)
110447
110569
  ) : inputFileName;
110448
110570
  }
110449
- function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2) {
110571
+ function getOutputDeclarationFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2 = () => getCommonSourceDirectoryOfConfig(configFile, ignoreCase)) {
110572
+ return getOutputDeclarationFileNameWorker(inputFileName, configFile.options, ignoreCase, getCommonSourceDirectory2);
110573
+ }
110574
+ function getOutputDeclarationFileNameWorker(inputFileName, options, ignoreCase, getCommonSourceDirectory2) {
110450
110575
  return changeExtension(
110451
- getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.declarationDir || configFile.options.outDir, getCommonSourceDirectory2),
110576
+ getOutputPathWithoutChangingExt(inputFileName, ignoreCase, options.declarationDir || options.outDir, getCommonSourceDirectory2),
110452
110577
  getDeclarationEmitExtensionForPath(inputFileName)
110453
110578
  );
110454
110579
  }
110455
- function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2) {
110580
+ function getOutputJSFileName(inputFileName, configFile, ignoreCase, getCommonSourceDirectory2 = () => getCommonSourceDirectoryOfConfig(configFile, ignoreCase)) {
110456
110581
  if (configFile.options.emitDeclarationOnly)
110457
110582
  return void 0;
110458
110583
  const isJsonFile = fileExtensionIs(inputFileName, ".json" /* Json */);
110459
- const outputFileName = changeExtension(
110460
- getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir, getCommonSourceDirectory2),
110461
- getOutputExtension(inputFileName, configFile.options)
110462
- );
110584
+ const outputFileName = getOutputJSFileNameWorker(inputFileName, configFile.options, ignoreCase, getCommonSourceDirectory2);
110463
110585
  return !isJsonFile || comparePaths(inputFileName, outputFileName, Debug.checkDefined(configFile.options.configFilePath), ignoreCase) !== 0 /* EqualTo */ ? outputFileName : void 0;
110464
110586
  }
110587
+ function getOutputJSFileNameWorker(inputFileName, options, ignoreCase, getCommonSourceDirectory2) {
110588
+ return changeExtension(
110589
+ getOutputPathWithoutChangingExt(inputFileName, ignoreCase, options.outDir, getCommonSourceDirectory2),
110590
+ getOutputExtension(inputFileName, options)
110591
+ );
110592
+ }
110465
110593
  function createAddOutput() {
110466
110594
  let outputs;
110467
110595
  return { addOutput, getOutputs };