@typescript-deploys/pr-build 5.7.0-pr-60122-16 → 5.7.0-pr-57718-9

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.7";
21
- var version = `${versionMajorMinor}.0-insiders.20241004`;
21
+ var version = `${versionMajorMinor}.0-insiders.20241031`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -7582,7 +7582,7 @@ var Diagnostics = {
7582
7582
  Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations: diag(9021, 1 /* Error */, "Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations_9021", "Extends clause can't contain an expression with --isolatedDeclarations."),
7583
7583
  Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations: diag(9022, 1 /* Error */, "Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations_9022", "Inference from class expressions is not supported with --isolatedDeclarations."),
7584
7584
  Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations_Add_an_explicit_declaration_for_the_properties_assigned_to_this_function: diag(9023, 1 /* Error */, "Assigning_properties_to_functions_without_declaring_them_is_not_supported_with_isolatedDeclarations__9023", "Assigning properties to functions without declaring them is not supported with --isolatedDeclarations. Add an explicit declaration for the properties assigned to this function."),
7585
- Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_supported_with_isolatedDeclarations: diag(9025, 1 /* Error */, "Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_su_9025", "Declaration emit for this parameter requires implicitly adding undefined to it's type. This is not supported with --isolatedDeclarations."),
7585
+ Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_supported_with_isolatedDeclarations: diag(9025, 1 /* Error */, "Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_sup_9025", "Declaration emit for this parameter requires implicitly adding undefined to its type. This is not supported with --isolatedDeclarations."),
7586
7586
  Declaration_emit_for_this_file_requires_preserving_this_import_for_augmentations_This_is_not_supported_with_isolatedDeclarations: diag(9026, 1 /* Error */, "Declaration_emit_for_this_file_requires_preserving_this_import_for_augmentations_This_is_not_support_9026", "Declaration emit for this file requires preserving this import for augmentations. This is not supported with --isolatedDeclarations."),
7587
7587
  Add_a_type_annotation_to_the_variable_0: diag(9027, 1 /* Error */, "Add_a_type_annotation_to_the_variable_0_9027", "Add a type annotation to the variable {0}."),
7588
7588
  Add_a_type_annotation_to_the_parameter_0: diag(9028, 1 /* Error */, "Add_a_type_annotation_to_the_parameter_0_9028", "Add a type annotation to the parameter {0}."),
@@ -16085,7 +16085,7 @@ function hasInvalidEscape(template) {
16085
16085
  }
16086
16086
  var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\u2028\u2029\u0085]/g;
16087
16087
  var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\u2028\u2029\u0085]/g;
16088
- var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\u2028\u2029\u0085]/g;
16088
+ var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u0009\u000b-\u001f\u2028\u2029\u0085]/g;
16089
16089
  var escapedCharsMap = new Map(Object.entries({
16090
16090
  " ": "\\t",
16091
16091
  "\v": "\\v",
@@ -17376,6 +17376,13 @@ function getLastChild(node) {
17376
17376
  });
17377
17377
  return lastChild;
17378
17378
  }
17379
+ function addToSeen(seen, key) {
17380
+ if (seen.has(key)) {
17381
+ return false;
17382
+ }
17383
+ seen.add(key);
17384
+ return true;
17385
+ }
17379
17386
  function isTypeNodeKind(kind) {
17380
17387
  return kind >= 182 /* FirstTypeNode */ && kind <= 205 /* LastTypeNode */ || kind === 133 /* AnyKeyword */ || kind === 159 /* UnknownKeyword */ || kind === 150 /* NumberKeyword */ || kind === 163 /* BigIntKeyword */ || kind === 151 /* ObjectKeyword */ || kind === 136 /* BooleanKeyword */ || kind === 154 /* StringKeyword */ || kind === 155 /* SymbolKeyword */ || kind === 116 /* VoidKeyword */ || kind === 157 /* UndefinedKeyword */ || kind === 146 /* NeverKeyword */ || kind === 141 /* IntrinsicKeyword */ || kind === 233 /* ExpressionWithTypeArguments */ || kind === 312 /* JSDocAllType */ || kind === 313 /* JSDocUnknownType */ || kind === 314 /* JSDocNullableType */ || kind === 315 /* JSDocNonNullableType */ || kind === 316 /* JSDocOptionalType */ || kind === 317 /* JSDocFunctionType */ || kind === 318 /* JSDocVariadicType */;
17381
17388
  }
@@ -26005,13 +26012,23 @@ var importStarHelper = {
26005
26012
  dependencies: [createBindingHelper, setModuleDefaultHelper],
26006
26013
  priority: 2,
26007
26014
  text: `
26008
- var __importStar = (this && this.__importStar) || function (mod) {
26009
- if (mod && mod.__esModule) return mod;
26010
- var result = {};
26011
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
26012
- __setModuleDefault(result, mod);
26013
- return result;
26014
- };`
26015
+ var __importStar = (this && this.__importStar) || (function () {
26016
+ var ownKeys = function(o) {
26017
+ ownKeys = Object.getOwnPropertyNames || function (o) {
26018
+ var ar = [];
26019
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26020
+ return ar;
26021
+ };
26022
+ return ownKeys(o);
26023
+ };
26024
+ return function (mod) {
26025
+ if (mod && mod.__esModule) return mod;
26026
+ var result = {};
26027
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
26028
+ __setModuleDefault(result, mod);
26029
+ return result;
26030
+ };
26031
+ })();`
26015
26032
  };
26016
26033
  var importDefaultHelper = {
26017
26034
  name: "typescript:commonjsimportdefault",
@@ -29531,10 +29548,12 @@ var Parser;
29531
29548
  case 90 /* DefaultKeyword */:
29532
29549
  return nextTokenCanFollowDefaultKeyword();
29533
29550
  case 126 /* StaticKeyword */:
29551
+ nextToken();
29552
+ return canFollowModifier();
29534
29553
  case 139 /* GetKeyword */:
29535
29554
  case 153 /* SetKeyword */:
29536
29555
  nextToken();
29537
- return canFollowModifier();
29556
+ return canFollowGetOrSetKeyword();
29538
29557
  default:
29539
29558
  return nextTokenIsOnSameLineAndCanFollowModifier();
29540
29559
  }
@@ -29552,6 +29571,9 @@ var Parser;
29552
29571
  function canFollowModifier() {
29553
29572
  return token() === 23 /* OpenBracketToken */ || token() === 19 /* OpenBraceToken */ || token() === 42 /* AsteriskToken */ || token() === 26 /* DotDotDotToken */ || isLiteralPropertyName();
29554
29573
  }
29574
+ function canFollowGetOrSetKeyword() {
29575
+ return token() === 23 /* OpenBracketToken */ || isLiteralPropertyName();
29576
+ }
29555
29577
  function nextTokenCanFollowDefaultKeyword() {
29556
29578
  nextToken();
29557
29579
  return token() === 86 /* ClassKeyword */ || token() === 100 /* FunctionKeyword */ || token() === 120 /* InterfaceKeyword */ || token() === 60 /* AtToken */ || token() === 128 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine) || token() === 134 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine);
@@ -38162,7 +38184,7 @@ function convertToTSConfig(configParseResult, configFileName, host) {
38162
38184
  const providedKeys = new Set(optionMap.keys());
38163
38185
  const impliedCompilerOptions = {};
38164
38186
  for (const option in computedOptions) {
38165
- if (!providedKeys.has(option) && some(computedOptions[option].dependencies, (dep) => providedKeys.has(dep))) {
38187
+ if (!providedKeys.has(option) && optionDependsOn(option, providedKeys)) {
38166
38188
  const implied = computedOptions[option].computeValue(configParseResult.options);
38167
38189
  const defaultValue = computedOptions[option].computeValue({});
38168
38190
  if (implied !== defaultValue) {
@@ -38173,6 +38195,17 @@ function convertToTSConfig(configParseResult, configFileName, host) {
38173
38195
  assign(config.compilerOptions, optionMapToObject(serializeCompilerOptions(impliedCompilerOptions, pathOptions)));
38174
38196
  return config;
38175
38197
  }
38198
+ function optionDependsOn(option, dependsOn) {
38199
+ const seen = /* @__PURE__ */ new Set();
38200
+ return optionDependsOnRecursive(option);
38201
+ function optionDependsOnRecursive(option2) {
38202
+ var _a;
38203
+ if (addToSeen(seen, option2)) {
38204
+ return some((_a = computedOptions[option2]) == null ? void 0 : _a.dependencies, (dep) => dependsOn.has(dep) || optionDependsOnRecursive(dep));
38205
+ }
38206
+ return false;
38207
+ }
38208
+ }
38176
38209
  function optionMapToObject(optionMap) {
38177
38210
  return Object.fromEntries(optionMap);
38178
38211
  }
@@ -40473,25 +40506,28 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
40473
40506
  return toSearchResult({ resolved, isExternalLibraryImport: pathContainsNodeModules(resolved.path) });
40474
40507
  }
40475
40508
  if (!isExternalModuleNameRelative(moduleName)) {
40476
- let resolved2;
40477
40509
  if (features & 2 /* Imports */ && startsWith(moduleName, "#")) {
40478
- resolved2 = loadModuleFromImports(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
40479
- }
40480
- if (!resolved2 && features & 4 /* SelfName */) {
40481
- resolved2 = loadModuleFromSelfNameReference(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
40510
+ const resolved3 = loadModuleFromImports(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
40511
+ if (resolved3) {
40512
+ return resolved3.value && { value: { resolved: resolved3.value, isExternalLibraryImport: false } };
40513
+ }
40482
40514
  }
40483
- if (!resolved2) {
40484
- if (moduleName.includes(":")) {
40485
- if (traceEnabled) {
40486
- trace(host, Diagnostics.Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
40487
- }
40488
- return void 0;
40515
+ if (features & 4 /* SelfName */) {
40516
+ const resolved3 = loadModuleFromSelfNameReference(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
40517
+ if (resolved3) {
40518
+ return resolved3.value && { value: { resolved: resolved3.value, isExternalLibraryImport: false } };
40489
40519
  }
40520
+ }
40521
+ if (moduleName.includes(":")) {
40490
40522
  if (traceEnabled) {
40491
- trace(host, Diagnostics.Loading_module_0_from_node_modules_folder_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
40523
+ trace(host, Diagnostics.Skipping_module_0_that_looks_like_an_absolute_URI_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
40492
40524
  }
40493
- resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
40525
+ return void 0;
40526
+ }
40527
+ if (traceEnabled) {
40528
+ trace(host, Diagnostics.Loading_module_0_from_node_modules_folder_target_file_types_Colon_1, moduleName, formatExtensions(extensions2));
40494
40529
  }
40530
+ let resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
40495
40531
  if (extensions2 & 4 /* Declaration */) {
40496
40532
  resolved2 ?? (resolved2 = resolveFromTypeRoot(moduleName, state2));
40497
40533
  }
@@ -40919,7 +40955,7 @@ function loadModuleFromExports(scope, extensions, subpath, state, cache, redirec
40919
40955
  mainExport = scope.contents.packageJsonContent.exports["."];
40920
40956
  }
40921
40957
  if (mainExport) {
40922
- const loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(
40958
+ const loadModuleFromTargetExportOrImport = getLoadModuleFromTargetExportOrImport(
40923
40959
  extensions,
40924
40960
  state,
40925
40961
  cache,
@@ -40929,7 +40965,7 @@ function loadModuleFromExports(scope, extensions, subpath, state, cache, redirec
40929
40965
  /*isImports*/
40930
40966
  false
40931
40967
  );
40932
- return loadModuleFromTargetImportOrExport(
40968
+ return loadModuleFromTargetExportOrImport(
40933
40969
  mainExport,
40934
40970
  "",
40935
40971
  /*pattern*/
@@ -40947,7 +40983,7 @@ function loadModuleFromExports(scope, extensions, subpath, state, cache, redirec
40947
40983
  void 0
40948
40984
  );
40949
40985
  }
40950
- const result = loadModuleFromImportsOrExports(
40986
+ const result = loadModuleFromExportsOrImports(
40951
40987
  extensions,
40952
40988
  state,
40953
40989
  cache,
@@ -41001,7 +41037,7 @@ function loadModuleFromImports(extensions, moduleName, directory, state, cache,
41001
41037
  void 0
41002
41038
  );
41003
41039
  }
41004
- const result = loadModuleFromImportsOrExports(
41040
+ const result = loadModuleFromExportsOrImports(
41005
41041
  extensions,
41006
41042
  state,
41007
41043
  cache,
@@ -41036,11 +41072,11 @@ function comparePatternKeys(a, b) {
41036
41072
  if (b.length > a.length) return 1 /* GreaterThan */;
41037
41073
  return 0 /* EqualTo */;
41038
41074
  }
41039
- function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
41040
- const loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
41075
+ function loadModuleFromExportsOrImports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
41076
+ const loadModuleFromTargetExportOrImport = getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
41041
41077
  if (!endsWith(moduleName, directorySeparator) && !moduleName.includes("*") && hasProperty(lookupTable, moduleName)) {
41042
41078
  const target = lookupTable[moduleName];
41043
- return loadModuleFromTargetImportOrExport(
41079
+ return loadModuleFromTargetExportOrImport(
41044
41080
  target,
41045
41081
  /*subpath*/
41046
41082
  "",
@@ -41055,7 +41091,7 @@ function loadModuleFromImportsOrExports(extensions, state, cache, redirectedRefe
41055
41091
  const target = lookupTable[potentialTarget];
41056
41092
  const starPos = potentialTarget.indexOf("*");
41057
41093
  const subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos));
41058
- return loadModuleFromTargetImportOrExport(
41094
+ return loadModuleFromTargetExportOrImport(
41059
41095
  target,
41060
41096
  subpath,
41061
41097
  /*pattern*/
@@ -41065,7 +41101,7 @@ function loadModuleFromImportsOrExports(extensions, state, cache, redirectedRefe
41065
41101
  } else if (endsWith(potentialTarget, "*") && startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) {
41066
41102
  const target = lookupTable[potentialTarget];
41067
41103
  const subpath = moduleName.substring(potentialTarget.length - 1);
41068
- return loadModuleFromTargetImportOrExport(
41104
+ return loadModuleFromTargetExportOrImport(
41069
41105
  target,
41070
41106
  subpath,
41071
41107
  /*pattern*/
@@ -41075,7 +41111,7 @@ function loadModuleFromImportsOrExports(extensions, state, cache, redirectedRefe
41075
41111
  } else if (startsWith(moduleName, potentialTarget)) {
41076
41112
  const target = lookupTable[potentialTarget];
41077
41113
  const subpath = moduleName.substring(potentialTarget.length);
41078
- return loadModuleFromTargetImportOrExport(
41114
+ return loadModuleFromTargetExportOrImport(
41079
41115
  target,
41080
41116
  subpath,
41081
41117
  /*pattern*/
@@ -41095,9 +41131,9 @@ function hasOneAsterisk(patternKey) {
41095
41131
  const firstStar = patternKey.indexOf("*");
41096
41132
  return firstStar !== -1 && firstStar === patternKey.lastIndexOf("*");
41097
41133
  }
41098
- function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
41099
- return loadModuleFromTargetImportOrExport;
41100
- function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) {
41134
+ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
41135
+ return loadModuleFromTargetExportOrImport;
41136
+ function loadModuleFromTargetExportOrImport(target, subpath, pattern, key) {
41101
41137
  if (typeof target === "string") {
41102
41138
  if (!pattern && subpath.length > 0 && !endsWith(target, "/")) {
41103
41139
  if (state.traceEnabled) {
@@ -41187,7 +41223,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
41187
41223
  if (condition === "default" || state.conditions.includes(condition) || isApplicableVersionedTypesKey(state.conditions, condition)) {
41188
41224
  traceIfEnabled(state, Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
41189
41225
  const subTarget = target[condition];
41190
- const result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
41226
+ const result = loadModuleFromTargetExportOrImport(subTarget, subpath, pattern, key);
41191
41227
  if (result) {
41192
41228
  traceIfEnabled(state, Diagnostics.Resolved_under_condition_0, condition);
41193
41229
  traceIfEnabled(state, Diagnostics.Exiting_conditional_exports);
@@ -41212,7 +41248,7 @@ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirec
41212
41248
  );
41213
41249
  }
41214
41250
  for (const elem of target) {
41215
- const result = loadModuleFromTargetImportOrExport(elem, subpath, pattern, key);
41251
+ const result = loadModuleFromTargetExportOrImport(elem, subpath, pattern, key);
41216
41252
  if (result) {
41217
41253
  return result;
41218
41254
  }
@@ -45005,31 +45041,29 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
45005
45041
  return { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true };
45006
45042
  }
45007
45043
  }
45008
- if (!specifier) {
45009
- const local = getLocalModuleSpecifier(
45010
- modulePath.path,
45011
- info,
45012
- compilerOptions,
45013
- host,
45014
- options.overrideImportMode || importingSourceFile.impliedNodeFormat,
45015
- preferences,
45016
- /*pathsOnly*/
45017
- modulePath.isRedirect
45018
- );
45019
- if (!local || forAutoImport && isExcludedByRegex(local, preferences.excludeRegexes)) {
45020
- continue;
45021
- }
45022
- if (modulePath.isRedirect) {
45023
- redirectPathsSpecifiers = append(redirectPathsSpecifiers, local);
45024
- } else if (pathIsBareSpecifier(local)) {
45025
- if (pathContainsNodeModules(local)) {
45026
- relativeSpecifiers = append(relativeSpecifiers, local);
45027
- } else {
45028
- pathsSpecifiers = append(pathsSpecifiers, local);
45029
- }
45030
- } else if (forAutoImport || !importedFileIsInNodeModules || modulePath.isInNodeModules) {
45044
+ const local = getLocalModuleSpecifier(
45045
+ modulePath.path,
45046
+ info,
45047
+ compilerOptions,
45048
+ host,
45049
+ options.overrideImportMode || importingSourceFile.impliedNodeFormat,
45050
+ preferences,
45051
+ /*pathsOnly*/
45052
+ modulePath.isRedirect || !!specifier
45053
+ );
45054
+ if (!local || forAutoImport && isExcludedByRegex(local, preferences.excludeRegexes)) {
45055
+ continue;
45056
+ }
45057
+ if (modulePath.isRedirect) {
45058
+ redirectPathsSpecifiers = append(redirectPathsSpecifiers, local);
45059
+ } else if (pathIsBareSpecifier(local)) {
45060
+ if (pathContainsNodeModules(local)) {
45031
45061
  relativeSpecifiers = append(relativeSpecifiers, local);
45062
+ } else {
45063
+ pathsSpecifiers = append(pathsSpecifiers, local);
45032
45064
  }
45065
+ } else if (forAutoImport || !importedFileIsInNodeModules || modulePath.isInNodeModules) {
45066
+ relativeSpecifiers = append(relativeSpecifiers, local);
45033
45067
  }
45034
45068
  }
45035
45069
  return (pathsSpecifiers == null ? void 0 : pathsSpecifiers.length) ? { kind: "paths", moduleSpecifiers: pathsSpecifiers, computedWithoutCache: true } : (redirectPathsSpecifiers == null ? void 0 : redirectPathsSpecifiers.length) ? { kind: "redirect", moduleSpecifiers: redirectPathsSpecifiers, computedWithoutCache: true } : (nodeModulesSpecifiers == null ? void 0 : nodeModulesSpecifiers.length) ? { kind: "node_modules", moduleSpecifiers: nodeModulesSpecifiers, computedWithoutCache: true } : { kind: "relative", moduleSpecifiers: relativeSpecifiers ?? emptyArray, computedWithoutCache: true };
@@ -45075,7 +45109,7 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
45075
45109
  importMode,
45076
45110
  prefersTsExtension(allowedEndings)
45077
45111
  );
45078
- const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) : void 0;
45112
+ const fromPaths = pathsOnly || fromPackageJsonImports === void 0 ? paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, baseDirectory, getCanonicalFileName, host, compilerOptions) : void 0;
45079
45113
  if (pathsOnly) {
45080
45114
  return fromPaths;
45081
45115
  }
@@ -45289,10 +45323,11 @@ function tryGetModuleNameFromAmbientModule(moduleSymbol, checker) {
45289
45323
  return ambientModuleDeclare.name.text;
45290
45324
  }
45291
45325
  }
45292
- function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
45326
+ function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, baseDirectory, getCanonicalFileName, host, compilerOptions) {
45293
45327
  for (const key in paths) {
45294
45328
  for (const patternText2 of paths[key]) {
45295
- const pattern = normalizePath(patternText2);
45329
+ const normalized = normalizePath(patternText2);
45330
+ const pattern = getRelativePathIfInSameVolume(normalized, baseDirectory, getCanonicalFileName) ?? normalized;
45296
45331
  const indexOfStar = pattern.indexOf("*");
45297
45332
  const candidates = allowedEndings.map((ending) => ({
45298
45333
  ending,
@@ -45621,6 +45656,8 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
45621
45656
  subModuleName,
45622
45657
  versionPaths.paths,
45623
45658
  allowedEndings,
45659
+ packageRootPath,
45660
+ getCanonicalFileName,
45624
45661
  host,
45625
45662
  options
45626
45663
  );
@@ -50278,6 +50315,9 @@ function createTypeChecker(host) {
50278
50315
  }
50279
50316
  }
50280
50317
  let annotationType = getTypeFromTypeNodeWithoutContext(existing);
50318
+ if (isErrorType(annotationType)) {
50319
+ return true;
50320
+ }
50281
50321
  if (requiresAddingUndefined && annotationType) {
50282
50322
  annotationType = getOptionalType(annotationType, !isParameter(node));
50283
50323
  }
@@ -51304,7 +51344,7 @@ function createTypeChecker(host) {
51304
51344
  const signatures = getSignaturesOfType(filterType(propertyType, (t) => !(t.flags & 32768 /* Undefined */)), 0 /* Call */);
51305
51345
  for (const signature of signatures) {
51306
51346
  const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 173 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
51307
- typeElements.push(preserveCommentsOn(methodDeclaration));
51347
+ typeElements.push(preserveCommentsOn(methodDeclaration, signature.declaration || propertySymbol.valueDeclaration));
51308
51348
  }
51309
51349
  if (signatures.length || !optionalToken) {
51310
51350
  return;
@@ -51339,8 +51379,8 @@ function createTypeChecker(host) {
51339
51379
  optionalToken,
51340
51380
  propertyTypeNode
51341
51381
  );
51342
- typeElements.push(preserveCommentsOn(propertySignature));
51343
- function preserveCommentsOn(node) {
51382
+ typeElements.push(preserveCommentsOn(propertySignature, propertySymbol.valueDeclaration));
51383
+ function preserveCommentsOn(node, range) {
51344
51384
  var _a2;
51345
51385
  const jsdocPropertyTag = (_a2 = propertySymbol.declarations) == null ? void 0 : _a2.find((d) => d.kind === 348 /* JSDocPropertyTag */);
51346
51386
  if (jsdocPropertyTag) {
@@ -51348,8 +51388,8 @@ function createTypeChecker(host) {
51348
51388
  if (commentText) {
51349
51389
  setSyntheticLeadingComments(node, [{ kind: 3 /* MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]);
51350
51390
  }
51351
- } else if (propertySymbol.valueDeclaration) {
51352
- setCommentRange2(context, node, propertySymbol.valueDeclaration);
51391
+ } else if (range) {
51392
+ setCommentRange2(context, node, range);
51353
51393
  }
51354
51394
  return node;
51355
51395
  }
@@ -55461,7 +55501,7 @@ function createTypeChecker(host) {
55461
55501
  const getter = getDeclarationOfKind(symbol, 177 /* GetAccessor */);
55462
55502
  const setter = getDeclarationOfKind(symbol, 178 /* SetAccessor */);
55463
55503
  const accessor = tryCast(getDeclarationOfKind(symbol, 172 /* PropertyDeclaration */), isAutoAccessorPropertyDeclaration);
55464
- let type = getter && isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || getAnnotatedAccessorType(accessor) || getter && getter.body && getReturnTypeFromBody(getter) || accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(
55504
+ let type = getter && isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || getAnnotatedAccessorType(accessor) || getter && getter.body && getReturnTypeFromBody(getter) || accessor && getWidenedTypeForVariableLikeDeclaration(
55465
55505
  accessor,
55466
55506
  /*reportErrors*/
55467
55507
  true
@@ -61606,7 +61646,7 @@ function createTypeChecker(host) {
61606
61646
  const links = getNodeLinks(node);
61607
61647
  if (!links.resolvedType) {
61608
61648
  const aliasSymbol = getAliasSymbolForTypeNode(node);
61609
- if (getMembersOfSymbol(node.symbol).size === 0 && !aliasSymbol) {
61649
+ if (!node.symbol || getMembersOfSymbol(node.symbol).size === 0 && !aliasSymbol) {
61610
61650
  links.resolvedType = emptyTypeLiteralType;
61611
61651
  } else {
61612
61652
  let type = createObjectType(16 /* Anonymous */, node.symbol);
@@ -82537,7 +82577,7 @@ function createTypeChecker(host) {
82537
82577
  return anyIterationTypes;
82538
82578
  }
82539
82579
  if (!(type.flags & 1048576 /* Union */)) {
82540
- const errorOutputContainer = errorNode ? { errors: void 0 } : void 0;
82580
+ const errorOutputContainer = errorNode ? { errors: void 0, skipLogging: true } : void 0;
82541
82581
  const iterationTypes2 = getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer);
82542
82582
  if (iterationTypes2 === noIterationTypes) {
82543
82583
  if (errorNode) {
@@ -82705,11 +82745,27 @@ function createTypeChecker(host) {
82705
82745
  if (isTypeAny(methodType)) {
82706
82746
  return noCache ? anyIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, anyIterationTypes);
82707
82747
  }
82708
- const signatures = methodType ? getSignaturesOfType(methodType, 0 /* Call */) : void 0;
82709
- if (!some(signatures)) {
82748
+ const allSignatures = methodType ? getSignaturesOfType(methodType, 0 /* Call */) : void 0;
82749
+ const validSignatures = filter(allSignatures, (sig) => getMinArgumentCount(sig) === 0);
82750
+ if (!some(validSignatures)) {
82751
+ if (errorNode && some(allSignatures)) {
82752
+ checkTypeAssignableTo(
82753
+ type,
82754
+ resolver.getGlobalIterableType(
82755
+ /*reportErrors*/
82756
+ true
82757
+ ),
82758
+ errorNode,
82759
+ /*headMessage*/
82760
+ void 0,
82761
+ /*containingMessageChain*/
82762
+ void 0,
82763
+ errorOutputContainer
82764
+ );
82765
+ }
82710
82766
  return noCache ? noIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, noIterationTypes);
82711
82767
  }
82712
- const iteratorType = getIntersectionType(map(signatures, getReturnTypeOfSignature));
82768
+ const iteratorType = getIntersectionType(map(validSignatures, getReturnTypeOfSignature));
82713
82769
  const iterationTypes = getIterationTypesOfIteratorWorker(iteratorType, resolver, errorNode, errorOutputContainer, noCache) ?? noIterationTypes;
82714
82770
  return noCache ? iterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, iterationTypes);
82715
82771
  }
@@ -83943,6 +83999,9 @@ function createTypeChecker(host) {
83943
83999
  }
83944
84000
  function checkInterfaceDeclaration(node) {
83945
84001
  if (!checkGrammarModifiers(node)) checkGrammarInterfaceDeclaration(node);
84002
+ if (!allowBlockDeclarations(node.parent)) {
84003
+ grammarErrorOnNode(node, Diagnostics._0_declarations_can_only_be_declared_inside_a_block, "interface");
84004
+ }
83946
84005
  checkTypeParameters(node.typeParameters);
83947
84006
  addLazyDiagnostic(() => {
83948
84007
  checkTypeNameIsReserved(node.name, Diagnostics.Interface_name_cannot_be_0);
@@ -83977,6 +84036,9 @@ function createTypeChecker(host) {
83977
84036
  function checkTypeAliasDeclaration(node) {
83978
84037
  checkGrammarModifiers(node);
83979
84038
  checkTypeNameIsReserved(node.name, Diagnostics.Type_alias_name_cannot_be_0);
84039
+ if (!allowBlockDeclarations(node.parent)) {
84040
+ grammarErrorOnNode(node, Diagnostics._0_declarations_can_only_be_declared_inside_a_block, "type");
84041
+ }
83980
84042
  checkExportsOnMergedDeclarations(node);
83981
84043
  checkTypeParameters(node.typeParameters);
83982
84044
  if (node.type.kind === 141 /* IntrinsicKeyword */) {
@@ -86363,7 +86425,7 @@ function createTypeChecker(host) {
86363
86425
  const typeNode = getNonlocalEffectiveTypeAnnotationNode(parameter);
86364
86426
  if (!typeNode) return false;
86365
86427
  const type = getTypeFromTypeNode(typeNode);
86366
- return containsUndefinedType(type);
86428
+ return isErrorType(type) || containsUndefinedType(type);
86367
86429
  }
86368
86430
  function requiresAddingImplicitUndefined(parameter, enclosingDeclaration) {
86369
86431
  return (isRequiredInitializedParameter(parameter, enclosingDeclaration) || isOptionalUninitializedParameterProperty(parameter)) && !declaredParameterTypeContainsUndefined(parameter);
@@ -88389,7 +88451,7 @@ function createTypeChecker(host) {
88389
88451
  }
88390
88452
  return false;
88391
88453
  }
88392
- function allowLetAndConstDeclarations(parent) {
88454
+ function allowBlockDeclarations(parent) {
88393
88455
  switch (parent.kind) {
88394
88456
  case 245 /* IfStatement */:
88395
88457
  case 246 /* DoStatement */:
@@ -88400,12 +88462,12 @@ function createTypeChecker(host) {
88400
88462
  case 250 /* ForOfStatement */:
88401
88463
  return false;
88402
88464
  case 256 /* LabeledStatement */:
88403
- return allowLetAndConstDeclarations(parent.parent);
88465
+ return allowBlockDeclarations(parent.parent);
88404
88466
  }
88405
88467
  return true;
88406
88468
  }
88407
88469
  function checkGrammarForDisallowedBlockScopedVariableStatement(node) {
88408
- if (!allowLetAndConstDeclarations(node.parent)) {
88470
+ if (!allowBlockDeclarations(node.parent)) {
88409
88471
  const blockScopeKind = getCombinedNodeFlagsCached(node.declarationList) & 7 /* BlockScoped */;
88410
88472
  if (blockScopeKind) {
88411
88473
  const keyword = blockScopeKind === 1 /* Let */ ? "let" : blockScopeKind === 2 /* Const */ ? "const" : blockScopeKind === 4 /* Using */ ? "using" : blockScopeKind === 6 /* AwaitUsing */ ? "await using" : Debug.fail("Unknown BlockScope flag");
@@ -91011,9 +91073,9 @@ function getDecoratorsOfParameters(node) {
91011
91073
  }
91012
91074
  return decorators;
91013
91075
  }
91014
- function getAllDecoratorsOfClass(node) {
91076
+ function getAllDecoratorsOfClass(node, useLegacyDecorators) {
91015
91077
  const decorators = getDecorators(node);
91016
- const parameters = getDecoratorsOfParameters(getFirstConstructorWithBody(node));
91078
+ const parameters = useLegacyDecorators ? getDecoratorsOfParameters(getFirstConstructorWithBody(node)) : void 0;
91017
91079
  if (!some(decorators) && !some(parameters)) {
91018
91080
  return void 0;
91019
91081
  }
@@ -91027,18 +91089,27 @@ function getAllDecoratorsOfClassElement(member, parent, useLegacyDecorators) {
91027
91089
  case 177 /* GetAccessor */:
91028
91090
  case 178 /* SetAccessor */:
91029
91091
  if (!useLegacyDecorators) {
91030
- return getAllDecoratorsOfMethod(member);
91092
+ return getAllDecoratorsOfMethod(
91093
+ member,
91094
+ /*useLegacyDecorators*/
91095
+ false
91096
+ );
91031
91097
  }
91032
- return getAllDecoratorsOfAccessors(member, parent);
91098
+ return getAllDecoratorsOfAccessors(
91099
+ member,
91100
+ parent,
91101
+ /*useLegacyDecorators*/
91102
+ true
91103
+ );
91033
91104
  case 174 /* MethodDeclaration */:
91034
- return getAllDecoratorsOfMethod(member);
91105
+ return getAllDecoratorsOfMethod(member, useLegacyDecorators);
91035
91106
  case 172 /* PropertyDeclaration */:
91036
91107
  return getAllDecoratorsOfProperty(member);
91037
91108
  default:
91038
91109
  return void 0;
91039
91110
  }
91040
91111
  }
91041
- function getAllDecoratorsOfAccessors(accessor, parent) {
91112
+ function getAllDecoratorsOfAccessors(accessor, parent, useLegacyDecorators) {
91042
91113
  if (!accessor.body) {
91043
91114
  return void 0;
91044
91115
  }
@@ -91048,7 +91119,7 @@ function getAllDecoratorsOfAccessors(accessor, parent) {
91048
91119
  return void 0;
91049
91120
  }
91050
91121
  const decorators = getDecorators(firstAccessorWithDecorators);
91051
- const parameters = getDecoratorsOfParameters(setAccessor);
91122
+ const parameters = useLegacyDecorators ? getDecoratorsOfParameters(setAccessor) : void 0;
91052
91123
  if (!some(decorators) && !some(parameters)) {
91053
91124
  return void 0;
91054
91125
  }
@@ -91059,12 +91130,12 @@ function getAllDecoratorsOfAccessors(accessor, parent) {
91059
91130
  setDecorators: setAccessor && getDecorators(setAccessor)
91060
91131
  };
91061
91132
  }
91062
- function getAllDecoratorsOfMethod(method) {
91133
+ function getAllDecoratorsOfMethod(method, useLegacyDecorators) {
91063
91134
  if (!method.body) {
91064
91135
  return void 0;
91065
91136
  }
91066
91137
  const decorators = getDecorators(method);
91067
- const parameters = getDecoratorsOfParameters(method);
91138
+ const parameters = useLegacyDecorators ? getDecoratorsOfParameters(method) : void 0;
91068
91139
  if (!some(decorators) && !some(parameters)) {
91069
91140
  return void 0;
91070
91141
  }
@@ -96698,7 +96769,11 @@ function transformLegacyDecorators(context) {
96698
96769
  }
96699
96770
  }
96700
96771
  function generateConstructorDecorationExpression(node) {
96701
- const allDecorators = getAllDecoratorsOfClass(node);
96772
+ const allDecorators = getAllDecoratorsOfClass(
96773
+ node,
96774
+ /*useLegacyDecorators*/
96775
+ true
96776
+ );
96702
96777
  const decoratorExpressions = transformAllDecoratorsOfDeclaration(allDecorators);
96703
96778
  if (!decoratorExpressions) {
96704
96779
  return void 0;
@@ -97210,7 +97285,11 @@ function transformESDecorators(context) {
97210
97285
  let syntheticConstructor;
97211
97286
  let heritageClauses;
97212
97287
  let shouldTransformPrivateStaticElementsInClass = false;
97213
- const classDecorators = transformAllDecoratorsOfDeclaration(getAllDecoratorsOfClass(node));
97288
+ const classDecorators = transformAllDecoratorsOfDeclaration(getAllDecoratorsOfClass(
97289
+ node,
97290
+ /*useLegacyDecorators*/
97291
+ false
97292
+ ));
97214
97293
  if (classDecorators) {
97215
97294
  classInfo2.classDecoratorsName = factory2.createUniqueName("_classDecorators", 16 /* Optimistic */ | 32 /* FileLevel */);
97216
97295
  classInfo2.classDescriptorName = factory2.createUniqueName("_classDescriptor", 16 /* Optimistic */ | 32 /* FileLevel */);
@@ -112132,7 +112211,7 @@ function createGetIsolatedDeclarationErrors(resolver) {
112132
112211
  if (!addUndefined && node.initializer) {
112133
112212
  return createExpressionError(node.initializer);
112134
112213
  }
112135
- const message = addUndefined ? Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_it_s_type_This_is_not_supported_with_isolatedDeclarations : errorByDeclarationKind[node.kind];
112214
+ const message = addUndefined ? Diagnostics.Declaration_emit_for_this_parameter_requires_implicitly_adding_undefined_to_its_type_This_is_not_supported_with_isolatedDeclarations : errorByDeclarationKind[node.kind];
112136
112215
  const diag2 = createDiagnosticForNode(node, message);
112137
112216
  const targetStr = getTextOfNode(
112138
112217
  node.name,
@@ -116705,15 +116784,88 @@ function createPrinter(printerOptions = {}, handlers = {}) {
116705
116784
  return false;
116706
116785
  }
116707
116786
  function parenthesizeExpressionForNoAsi(node) {
116708
- if (!commentsDisabled && isPartiallyEmittedExpression(node) && willEmitLeadingNewLine(node)) {
116709
- const parseNode = getParseTreeNode(node);
116710
- if (parseNode && isParenthesizedExpression(parseNode)) {
116711
- const parens = factory.createParenthesizedExpression(node.expression);
116712
- setOriginalNode(parens, node);
116713
- setTextRange(parens, parseNode);
116714
- return parens;
116787
+ if (!commentsDisabled) {
116788
+ switch (node.kind) {
116789
+ case 355 /* PartiallyEmittedExpression */:
116790
+ if (willEmitLeadingNewLine(node)) {
116791
+ const parseNode = getParseTreeNode(node);
116792
+ if (parseNode && isParenthesizedExpression(parseNode)) {
116793
+ const parens = factory.createParenthesizedExpression(node.expression);
116794
+ setOriginalNode(parens, node);
116795
+ setTextRange(parens, parseNode);
116796
+ return parens;
116797
+ }
116798
+ return factory.createParenthesizedExpression(node);
116799
+ }
116800
+ return factory.updatePartiallyEmittedExpression(
116801
+ node,
116802
+ parenthesizeExpressionForNoAsi(node.expression)
116803
+ );
116804
+ case 211 /* PropertyAccessExpression */:
116805
+ return factory.updatePropertyAccessExpression(
116806
+ node,
116807
+ parenthesizeExpressionForNoAsi(node.expression),
116808
+ node.name
116809
+ );
116810
+ case 212 /* ElementAccessExpression */:
116811
+ return factory.updateElementAccessExpression(
116812
+ node,
116813
+ parenthesizeExpressionForNoAsi(node.expression),
116814
+ node.argumentExpression
116815
+ );
116816
+ case 213 /* CallExpression */:
116817
+ return factory.updateCallExpression(
116818
+ node,
116819
+ parenthesizeExpressionForNoAsi(node.expression),
116820
+ node.typeArguments,
116821
+ node.arguments
116822
+ );
116823
+ case 215 /* TaggedTemplateExpression */:
116824
+ return factory.updateTaggedTemplateExpression(
116825
+ node,
116826
+ parenthesizeExpressionForNoAsi(node.tag),
116827
+ node.typeArguments,
116828
+ node.template
116829
+ );
116830
+ case 225 /* PostfixUnaryExpression */:
116831
+ return factory.updatePostfixUnaryExpression(
116832
+ node,
116833
+ parenthesizeExpressionForNoAsi(node.operand)
116834
+ );
116835
+ case 226 /* BinaryExpression */:
116836
+ return factory.updateBinaryExpression(
116837
+ node,
116838
+ parenthesizeExpressionForNoAsi(node.left),
116839
+ node.operatorToken,
116840
+ node.right
116841
+ );
116842
+ case 227 /* ConditionalExpression */:
116843
+ return factory.updateConditionalExpression(
116844
+ node,
116845
+ parenthesizeExpressionForNoAsi(node.condition),
116846
+ node.questionToken,
116847
+ node.whenTrue,
116848
+ node.colonToken,
116849
+ node.whenFalse
116850
+ );
116851
+ case 234 /* AsExpression */:
116852
+ return factory.updateAsExpression(
116853
+ node,
116854
+ parenthesizeExpressionForNoAsi(node.expression),
116855
+ node.type
116856
+ );
116857
+ case 238 /* SatisfiesExpression */:
116858
+ return factory.updateSatisfiesExpression(
116859
+ node,
116860
+ parenthesizeExpressionForNoAsi(node.expression),
116861
+ node.type
116862
+ );
116863
+ case 235 /* NonNullExpression */:
116864
+ return factory.updateNonNullExpression(
116865
+ node,
116866
+ parenthesizeExpressionForNoAsi(node.expression)
116867
+ );
116715
116868
  }
116716
- return factory.createParenthesizedExpression(node);
116717
116869
  }
116718
116870
  return node;
116719
116871
  }