typescript 5.8.0-dev.20250123 → 5.8.0-dev.20250124

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.8";
21
- var version = `${versionMajorMinor}.0-dev.20250123`;
21
+ var version = `${versionMajorMinor}.0-dev.20250124`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6021,6 +6021,7 @@ var Diagnostics = {
6021
6021
  _0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
6022
6022
  _0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
6023
6023
  ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
6024
+ This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled: diag(1294, 1 /* Error */, "This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled_1294", "This syntax is not allowed when 'erasableSyntaxOnly' is enabled."),
6024
6025
  with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
6025
6026
  await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
6026
6027
  The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
@@ -7508,11 +7509,13 @@ var Diagnostics = {
7508
7509
  Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
7509
7510
  Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files: diag(6719, 3 /* Message */, "Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files_6719", "Require sufficient annotation on exports so other tools can trivially generate declaration files."),
7510
7511
  Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any: diag(6720, 3 /* Message */, "Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any_6720", "Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'."),
7512
+ Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript: diag(6721, 3 /* Message */, "Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript_6721", "Do not allow runtime constructs that are not part of ECMAScript."),
7511
7513
  Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
7512
7514
  Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
7513
7515
  Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported: diag(6805, 3 /* Message */, "Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported_6805", "Disable full type checking (only critical parse and emit errors will be reported)."),
7514
7516
  Check_side_effect_imports: diag(6806, 3 /* Message */, "Check_side_effect_imports_6806", "Check side effect imports."),
7515
7517
  This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2: diag(6807, 1 /* Error */, "This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2_6807", "This operation can be simplified. This shift is identical to `{0} {1} {2}`."),
7518
+ Enable_lib_replacement: diag(6808, 3 /* Message */, "Enable_lib_replacement_6808", "Enable lib replacement."),
7516
7519
  one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
7517
7520
  one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
7518
7521
  type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
@@ -36847,6 +36850,23 @@ var commandOptionsWithoutBuild = [
36847
36850
  affectsBuildInfo: true,
36848
36851
  affectsSemanticDiagnostics: true
36849
36852
  },
36853
+ {
36854
+ name: "erasableSyntaxOnly",
36855
+ type: "boolean",
36856
+ category: Diagnostics.Interop_Constraints,
36857
+ description: Diagnostics.Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript,
36858
+ defaultValueDescription: false,
36859
+ affectsBuildInfo: true,
36860
+ affectsSemanticDiagnostics: true
36861
+ },
36862
+ {
36863
+ name: "libReplacement",
36864
+ type: "boolean",
36865
+ affectsProgramStructure: true,
36866
+ category: Diagnostics.Language_and_Environment,
36867
+ description: Diagnostics.Enable_lib_replacement,
36868
+ defaultValueDescription: true
36869
+ },
36850
36870
  // Strict Type Checks
36851
36871
  {
36852
36872
  name: "strict",
@@ -41303,6 +41323,7 @@ function hasOneAsterisk(patternKey) {
41303
41323
  function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
41304
41324
  return loadModuleFromTargetExportOrImport;
41305
41325
  function loadModuleFromTargetExportOrImport(target, subpath, pattern, key) {
41326
+ var _a, _b;
41306
41327
  if (typeof target === "string") {
41307
41328
  if (!pattern && subpath.length > 0 && !endsWith(target, "/")) {
41308
41329
  if (state.traceEnabled) {
@@ -41331,6 +41352,8 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
41331
41352
  redirectedReference,
41332
41353
  state.conditions
41333
41354
  );
41355
+ (_a = state.failedLookupLocations) == null ? void 0 : _a.push(...result.failedLookupLocations ?? emptyArray);
41356
+ (_b = state.affectingLocations) == null ? void 0 : _b.push(...result.affectingLocations ?? emptyArray);
41334
41357
  return toSearchResult(
41335
41358
  result.resolvedModule ? {
41336
41359
  path: result.resolvedModule.resolvedFileName,
@@ -41440,20 +41463,20 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
41440
41463
  void 0
41441
41464
  );
41442
41465
  function toAbsolutePath(path) {
41443
- var _a, _b;
41466
+ var _a2, _b2;
41444
41467
  if (path === void 0) return path;
41445
- return getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
41468
+ return getNormalizedAbsolutePath(path, (_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2));
41446
41469
  }
41447
41470
  function combineDirectoryPath(root, dir) {
41448
41471
  return ensureTrailingDirectorySeparator(combinePaths(root, dir));
41449
41472
  }
41450
41473
  function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports2) {
41451
- var _a, _b, _c, _d;
41474
+ var _a2, _b2, _c, _d;
41452
41475
  if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && !finalPath.includes("/node_modules/") && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames(state)) : true)) {
41453
41476
  const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames(state) });
41454
41477
  const commonSourceDirGuesses = [];
41455
41478
  if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) {
41456
- const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a)) || "", getCanonicalFileName));
41479
+ const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2)) || "", getCanonicalFileName));
41457
41480
  commonSourceDirGuesses.push(commonDir);
41458
41481
  } else if (state.requestContainingDirectory) {
41459
41482
  const requestingFile = toAbsolutePath(combinePaths(state.requestContainingDirectory, "index.ts"));
@@ -41509,8 +41532,8 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
41509
41532
  }
41510
41533
  return void 0;
41511
41534
  function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
41512
- var _a2, _b2;
41513
- const currentDir = state.compilerOptions.configFile ? ((_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2)) || "" : commonSourceDirGuess;
41535
+ var _a3, _b3;
41536
+ const currentDir = state.compilerOptions.configFile ? ((_b3 = (_a3 = state.host).getCurrentDirectory) == null ? void 0 : _b3.call(_a3)) || "" : commonSourceDirGuess;
41514
41537
  const candidateDirectories = [];
41515
41538
  if (state.compilerOptions.declarationDir) {
41516
41539
  candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
@@ -46588,8 +46611,13 @@ function createTypeChecker(host) {
46588
46611
  getMemberOverrideModifierStatus,
46589
46612
  isTypeParameterPossiblyReferenced,
46590
46613
  typeHasCallOrConstructSignatures,
46591
- getSymbolFlags
46614
+ getSymbolFlags,
46615
+ getTypeArgumentsForResolvedSignature
46592
46616
  };
46617
+ function getTypeArgumentsForResolvedSignature(signature) {
46618
+ if (signature.mapper === void 0) return void 0;
46619
+ return instantiateTypes((signature.target || signature).typeParameters, signature.mapper);
46620
+ }
46593
46621
  function getCandidateSignaturesForStringLiteralCompletions(call, editingArgument) {
46594
46622
  const candidatesSet = /* @__PURE__ */ new Set();
46595
46623
  const candidates = [];
@@ -73663,6 +73691,9 @@ function createTypeChecker(host) {
73663
73691
  return getNameFromJsxElementAttributesContainer(JsxNames.ElementAttributesPropertyNameContainer, jsxNamespace);
73664
73692
  }
73665
73693
  function getJsxElementChildrenPropertyName(jsxNamespace) {
73694
+ if (compilerOptions.jsx === 4 /* ReactJSX */ || compilerOptions.jsx === 5 /* ReactJSXDev */) {
73695
+ return "children";
73696
+ }
73666
73697
  return getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer, jsxNamespace);
73667
73698
  }
73668
73699
  function getUninstantiatedJsxSignaturesOfType(elementType, caller) {
@@ -80174,6 +80205,9 @@ function createTypeChecker(host) {
80174
80205
  checkVariableLikeDeclaration(node);
80175
80206
  const func = getContainingFunction(node);
80176
80207
  if (hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */)) {
80208
+ if (compilerOptions.erasableSyntaxOnly) {
80209
+ error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
80210
+ }
80177
80211
  if (!(func.kind === 176 /* Constructor */ && nodeIsPresent(func.body))) {
80178
80212
  error(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
80179
80213
  }
@@ -84878,6 +84912,9 @@ function createTypeChecker(host) {
84878
84912
  checkCollisionsForDeclarationName(node, node.name);
84879
84913
  checkExportsOnMergedDeclarations(node);
84880
84914
  node.members.forEach(checkEnumMember);
84915
+ if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
84916
+ error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
84917
+ }
84881
84918
  computeEnumMemberValues(node);
84882
84919
  const enumSymbol = getSymbolOfDeclaration(node);
84883
84920
  const firstDeclaration = getDeclarationOfKind(enumSymbol, node.kind);
@@ -84979,6 +85016,9 @@ function createTypeChecker(host) {
84979
85016
  checkExportsOnMergedDeclarations(node);
84980
85017
  const symbol = getSymbolOfDeclaration(node);
84981
85018
  if (symbol.flags & 512 /* ValueModule */ && !inAmbientContext && isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions))) {
85019
+ if (compilerOptions.erasableSyntaxOnly) {
85020
+ error(node.name, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
85021
+ }
84982
85022
  if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) {
84983
85023
  error(node.name, Diagnostics.Namespaces_are_not_allowed_in_global_script_files_when_0_is_enabled_If_this_file_is_not_intended_to_be_a_global_script_set_moduleDetection_to_force_or_add_an_empty_export_statement, isolatedModulesLikeFlagName);
84984
85024
  }
@@ -85366,7 +85406,11 @@ function createTypeChecker(host) {
85366
85406
  return;
85367
85407
  }
85368
85408
  checkGrammarModifiers(node);
85369
- if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
85409
+ const isImportEquals = isInternalModuleImportEqualsDeclaration(node);
85410
+ if (compilerOptions.erasableSyntaxOnly && isImportEquals && !(node.flags & 33554432 /* Ambient */)) {
85411
+ error(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
85412
+ }
85413
+ if (isImportEquals || checkExternalImportOrExportDeclaration(node)) {
85370
85414
  checkImportBinding(node);
85371
85415
  markLinkedReferences(node, 6 /* ExportImportEquals */);
85372
85416
  if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
@@ -121267,11 +121311,13 @@ function createCreateProgramOptions(rootNames, options, host, oldProgram, config
121267
121311
  typeScriptVersion: typeScriptVersion2
121268
121312
  };
121269
121313
  }
121270
- function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
121314
+ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
121271
121315
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
121272
- const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
121273
- const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion2 } = createProgramOptions;
121274
- let { oldProgram } = createProgramOptions;
121316
+ let _createProgramOptions = isArray(_rootNamesOrOptions) ? createCreateProgramOptions(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : _rootNamesOrOptions;
121317
+ const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion2, host: createProgramOptionsHost } = _createProgramOptions;
121318
+ let { oldProgram } = _createProgramOptions;
121319
+ _createProgramOptions = void 0;
121320
+ _rootNamesOrOptions = void 0;
121275
121321
  for (const option of commandLineOptionOfCustomType) {
121276
121322
  if (hasProperty(options, option.name)) {
121277
121323
  if (typeof options[option.name] === "string") {
@@ -121311,7 +121357,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
121311
121357
  true
121312
121358
  );
121313
121359
  mark("beforeProgram");
121314
- const host = createProgramOptions.host || createCompilerHost(options);
121360
+ const host = createProgramOptionsHost || createCompilerHost(options);
121315
121361
  const configParsingHost = parseConfigHostFromCompilerHostLike(host);
121316
121362
  let skipDefaultLib = options.noLib;
121317
121363
  const getDefaultLibraryFileName = memoize(() => host.getDefaultLibFileName(options));
@@ -123252,6 +123298,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
123252
123298
  var _a2, _b2, _c2, _d2, _e2;
123253
123299
  const existing = resolvedLibProcessing == null ? void 0 : resolvedLibProcessing.get(libFileName);
123254
123300
  if (existing) return existing;
123301
+ if (options.libReplacement === false) {
123302
+ const result2 = {
123303
+ resolution: {
123304
+ resolvedModule: void 0
123305
+ },
123306
+ actual: combinePaths(defaultLibraryPath, libFileName)
123307
+ };
123308
+ (resolvedLibProcessing ?? (resolvedLibProcessing = /* @__PURE__ */ new Map())).set(libFileName, result2);
123309
+ return result2;
123310
+ }
123255
123311
  if (structureIsReused !== 0 /* Not */ && oldProgram && !hasInvalidatedLibResolutions(libFileName)) {
123256
123312
  const oldResolution = (_a2 = oldProgram.resolvedLibReferences) == null ? void 0 : _a2.get(libFileName);
123257
123313
  if (oldResolution) {
@@ -6348,6 +6348,7 @@ declare namespace ts {
6348
6348
  * and the operation is cancelled, then it should be discarded, otherwise it is safe to keep.
6349
6349
  */
6350
6350
  runWithCancellationToken<T>(token: CancellationToken, cb: (checker: TypeChecker) => T): T;
6351
+ getTypeArgumentsForResolvedSignature(signature: Signature): readonly Type[] | undefined;
6351
6352
  }
6352
6353
  enum NodeBuilderFlags {
6353
6354
  None = 0,
@@ -7026,6 +7027,7 @@ declare namespace ts {
7026
7027
  /** @deprecated */
7027
7028
  keyofStringsOnly?: boolean;
7028
7029
  lib?: string[];
7030
+ libReplacement?: boolean;
7029
7031
  locale?: string;
7030
7032
  mapRoot?: string;
7031
7033
  maxNodeModuleJsDepth?: number;
@@ -7102,6 +7104,7 @@ declare namespace ts {
7102
7104
  /** Paths used to compute primary types search locations */
7103
7105
  typeRoots?: string[];
7104
7106
  verbatimModuleSyntax?: boolean;
7107
+ erasableSyntaxOnly?: boolean;
7105
7108
  esModuleInterop?: boolean;
7106
7109
  useDefineForClassFields?: boolean;
7107
7110
  [option: string]: CompilerOptionsValue | TsConfigSourceFile | undefined;
package/lib/typescript.js CHANGED
@@ -2285,7 +2285,7 @@ module.exports = __toCommonJS(typescript_exports);
2285
2285
 
2286
2286
  // src/compiler/corePublic.ts
2287
2287
  var versionMajorMinor = "5.8";
2288
- var version = `${versionMajorMinor}.0-dev.20250123`;
2288
+ var version = `${versionMajorMinor}.0-dev.20250124`;
2289
2289
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2290
2290
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2291
2291
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -9407,6 +9407,7 @@ var Diagnostics = {
9407
9407
  _0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_import_type_where_0_is_imported: diag(1291, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1291", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'import type' where '{0}' is imported."),
9408
9408
  _0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enabled_Consider_using_export_type_0_as_default: diag(1292, 1 /* Error */, "_0_resolves_to_a_type_and_must_be_marked_type_only_in_this_file_before_re_exporting_when_1_is_enable_1292", "'{0}' resolves to a type and must be marked type-only in this file before re-exporting when '{1}' is enabled. Consider using 'export type { {0} as default }'."),
9409
9409
  ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve: diag(1293, 1 /* Error */, "ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_module_is_set_to_preserve_1293", "ESM syntax is not allowed in a CommonJS module when 'module' is set to 'preserve'."),
9410
+ This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled: diag(1294, 1 /* Error */, "This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled_1294", "This syntax is not allowed when 'erasableSyntaxOnly' is enabled."),
9410
9411
  with_statements_are_not_allowed_in_an_async_function_block: diag(1300, 1 /* Error */, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
9411
9412
  await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, 1 /* Error */, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
9412
9413
  The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, 1 /* Error */, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
@@ -10894,11 +10895,13 @@ var Diagnostics = {
10894
10895
  Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types: diag(6718, 3 /* Message */, "Specify_emit_Slashchecking_behavior_for_imports_that_are_only_used_for_types_6718", "Specify emit/checking behavior for imports that are only used for types."),
10895
10896
  Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files: diag(6719, 3 /* Message */, "Require_sufficient_annotation_on_exports_so_other_tools_can_trivially_generate_declaration_files_6719", "Require sufficient annotation on exports so other tools can trivially generate declaration files."),
10896
10897
  Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any: diag(6720, 3 /* Message */, "Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any_6720", "Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'."),
10898
+ Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript: diag(6721, 3 /* Message */, "Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript_6721", "Do not allow runtime constructs that are not part of ECMAScript."),
10897
10899
  Default_catch_clause_variables_as_unknown_instead_of_any: diag(6803, 3 /* Message */, "Default_catch_clause_variables_as_unknown_instead_of_any_6803", "Default catch clause variables as 'unknown' instead of 'any'."),
10898
10900
  Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
10899
10901
  Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported: diag(6805, 3 /* Message */, "Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported_6805", "Disable full type checking (only critical parse and emit errors will be reported)."),
10900
10902
  Check_side_effect_imports: diag(6806, 3 /* Message */, "Check_side_effect_imports_6806", "Check side effect imports."),
10901
10903
  This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2: diag(6807, 1 /* Error */, "This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2_6807", "This operation can be simplified. This shift is identical to `{0} {1} {2}`."),
10904
+ Enable_lib_replacement: diag(6808, 3 /* Message */, "Enable_lib_replacement_6808", "Enable lib replacement."),
10902
10905
  one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
10903
10906
  one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
10904
10907
  type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
@@ -41107,6 +41110,23 @@ var commandOptionsWithoutBuild = [
41107
41110
  affectsBuildInfo: true,
41108
41111
  affectsSemanticDiagnostics: true
41109
41112
  },
41113
+ {
41114
+ name: "erasableSyntaxOnly",
41115
+ type: "boolean",
41116
+ category: Diagnostics.Interop_Constraints,
41117
+ description: Diagnostics.Do_not_allow_runtime_constructs_that_are_not_part_of_ECMAScript,
41118
+ defaultValueDescription: false,
41119
+ affectsBuildInfo: true,
41120
+ affectsSemanticDiagnostics: true
41121
+ },
41122
+ {
41123
+ name: "libReplacement",
41124
+ type: "boolean",
41125
+ affectsProgramStructure: true,
41126
+ category: Diagnostics.Language_and_Environment,
41127
+ description: Diagnostics.Enable_lib_replacement,
41128
+ defaultValueDescription: true
41129
+ },
41110
41130
  // Strict Type Checks
41111
41131
  {
41112
41132
  name: "strict",
@@ -45795,6 +45815,7 @@ function hasOneAsterisk(patternKey) {
45795
45815
  function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
45796
45816
  return loadModuleFromTargetExportOrImport;
45797
45817
  function loadModuleFromTargetExportOrImport(target, subpath, pattern, key) {
45818
+ var _a, _b;
45798
45819
  if (typeof target === "string") {
45799
45820
  if (!pattern && subpath.length > 0 && !endsWith(target, "/")) {
45800
45821
  if (state.traceEnabled) {
@@ -45823,6 +45844,8 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
45823
45844
  redirectedReference,
45824
45845
  state.conditions
45825
45846
  );
45847
+ (_a = state.failedLookupLocations) == null ? void 0 : _a.push(...result.failedLookupLocations ?? emptyArray);
45848
+ (_b = state.affectingLocations) == null ? void 0 : _b.push(...result.affectingLocations ?? emptyArray);
45826
45849
  return toSearchResult(
45827
45850
  result.resolvedModule ? {
45828
45851
  path: result.resolvedModule.resolvedFileName,
@@ -45932,20 +45955,20 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
45932
45955
  void 0
45933
45956
  );
45934
45957
  function toAbsolutePath(path) {
45935
- var _a, _b;
45958
+ var _a2, _b2;
45936
45959
  if (path === void 0) return path;
45937
- return getNormalizedAbsolutePath(path, (_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a));
45960
+ return getNormalizedAbsolutePath(path, (_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2));
45938
45961
  }
45939
45962
  function combineDirectoryPath(root, dir) {
45940
45963
  return ensureTrailingDirectorySeparator(combinePaths(root, dir));
45941
45964
  }
45942
45965
  function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports2) {
45943
- var _a, _b, _c, _d;
45966
+ var _a2, _b2, _c, _d;
45944
45967
  if (!state.isConfigLookup && (state.compilerOptions.declarationDir || state.compilerOptions.outDir) && !finalPath.includes("/node_modules/") && (state.compilerOptions.configFile ? containsPath(scope.packageDirectory, toAbsolutePath(state.compilerOptions.configFile.fileName), !useCaseSensitiveFileNames(state)) : true)) {
45945
45968
  const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames(state) });
45946
45969
  const commonSourceDirGuesses = [];
45947
45970
  if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) {
45948
- const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((_b = (_a = state.host).getCurrentDirectory) == null ? void 0 : _b.call(_a)) || "", getCanonicalFileName));
45971
+ const commonDir = toAbsolutePath(getCommonSourceDirectory(state.compilerOptions, () => [], ((_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2)) || "", getCanonicalFileName));
45949
45972
  commonSourceDirGuesses.push(commonDir);
45950
45973
  } else if (state.requestContainingDirectory) {
45951
45974
  const requestingFile = toAbsolutePath(combinePaths(state.requestContainingDirectory, "index.ts"));
@@ -46001,8 +46024,8 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
46001
46024
  }
46002
46025
  return void 0;
46003
46026
  function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
46004
- var _a2, _b2;
46005
- const currentDir = state.compilerOptions.configFile ? ((_b2 = (_a2 = state.host).getCurrentDirectory) == null ? void 0 : _b2.call(_a2)) || "" : commonSourceDirGuess;
46027
+ var _a3, _b3;
46028
+ const currentDir = state.compilerOptions.configFile ? ((_b3 = (_a3 = state.host).getCurrentDirectory) == null ? void 0 : _b3.call(_a3)) || "" : commonSourceDirGuess;
46006
46029
  const candidateDirectories = [];
46007
46030
  if (state.compilerOptions.declarationDir) {
46008
46031
  candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
@@ -51198,8 +51221,13 @@ function createTypeChecker(host) {
51198
51221
  getMemberOverrideModifierStatus,
51199
51222
  isTypeParameterPossiblyReferenced,
51200
51223
  typeHasCallOrConstructSignatures,
51201
- getSymbolFlags
51224
+ getSymbolFlags,
51225
+ getTypeArgumentsForResolvedSignature
51202
51226
  };
51227
+ function getTypeArgumentsForResolvedSignature(signature) {
51228
+ if (signature.mapper === void 0) return void 0;
51229
+ return instantiateTypes((signature.target || signature).typeParameters, signature.mapper);
51230
+ }
51203
51231
  function getCandidateSignaturesForStringLiteralCompletions(call, editingArgument) {
51204
51232
  const candidatesSet = /* @__PURE__ */ new Set();
51205
51233
  const candidates = [];
@@ -78273,6 +78301,9 @@ function createTypeChecker(host) {
78273
78301
  return getNameFromJsxElementAttributesContainer(JsxNames.ElementAttributesPropertyNameContainer, jsxNamespace);
78274
78302
  }
78275
78303
  function getJsxElementChildrenPropertyName(jsxNamespace) {
78304
+ if (compilerOptions.jsx === 4 /* ReactJSX */ || compilerOptions.jsx === 5 /* ReactJSXDev */) {
78305
+ return "children";
78306
+ }
78276
78307
  return getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer, jsxNamespace);
78277
78308
  }
78278
78309
  function getUninstantiatedJsxSignaturesOfType(elementType, caller) {
@@ -84784,6 +84815,9 @@ function createTypeChecker(host) {
84784
84815
  checkVariableLikeDeclaration(node);
84785
84816
  const func = getContainingFunction(node);
84786
84817
  if (hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */)) {
84818
+ if (compilerOptions.erasableSyntaxOnly) {
84819
+ error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
84820
+ }
84787
84821
  if (!(func.kind === 176 /* Constructor */ && nodeIsPresent(func.body))) {
84788
84822
  error2(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
84789
84823
  }
@@ -89488,6 +89522,9 @@ function createTypeChecker(host) {
89488
89522
  checkCollisionsForDeclarationName(node, node.name);
89489
89523
  checkExportsOnMergedDeclarations(node);
89490
89524
  node.members.forEach(checkEnumMember);
89525
+ if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
89526
+ error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
89527
+ }
89491
89528
  computeEnumMemberValues(node);
89492
89529
  const enumSymbol = getSymbolOfDeclaration(node);
89493
89530
  const firstDeclaration = getDeclarationOfKind(enumSymbol, node.kind);
@@ -89589,6 +89626,9 @@ function createTypeChecker(host) {
89589
89626
  checkExportsOnMergedDeclarations(node);
89590
89627
  const symbol = getSymbolOfDeclaration(node);
89591
89628
  if (symbol.flags & 512 /* ValueModule */ && !inAmbientContext && isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions))) {
89629
+ if (compilerOptions.erasableSyntaxOnly) {
89630
+ error2(node.name, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
89631
+ }
89592
89632
  if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) {
89593
89633
  error2(node.name, Diagnostics.Namespaces_are_not_allowed_in_global_script_files_when_0_is_enabled_If_this_file_is_not_intended_to_be_a_global_script_set_moduleDetection_to_force_or_add_an_empty_export_statement, isolatedModulesLikeFlagName);
89594
89634
  }
@@ -89976,7 +90016,11 @@ function createTypeChecker(host) {
89976
90016
  return;
89977
90017
  }
89978
90018
  checkGrammarModifiers(node);
89979
- if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
90019
+ const isImportEquals = isInternalModuleImportEqualsDeclaration(node);
90020
+ if (compilerOptions.erasableSyntaxOnly && isImportEquals && !(node.flags & 33554432 /* Ambient */)) {
90021
+ error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
90022
+ }
90023
+ if (isImportEquals || checkExternalImportOrExportDeclaration(node)) {
89980
90024
  checkImportBinding(node);
89981
90025
  markLinkedReferences(node, 6 /* ExportImportEquals */);
89982
90026
  if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
@@ -126116,11 +126160,13 @@ function createCreateProgramOptions(rootNames, options, host, oldProgram, config
126116
126160
  typeScriptVersion: typeScriptVersion3
126117
126161
  };
126118
126162
  }
126119
- function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
126163
+ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
126120
126164
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
126121
- const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
126122
- const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions;
126123
- let { oldProgram } = createProgramOptions;
126165
+ let _createProgramOptions = isArray(_rootNamesOrOptions) ? createCreateProgramOptions(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : _rootNamesOrOptions;
126166
+ const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3, host: createProgramOptionsHost } = _createProgramOptions;
126167
+ let { oldProgram } = _createProgramOptions;
126168
+ _createProgramOptions = void 0;
126169
+ _rootNamesOrOptions = void 0;
126124
126170
  for (const option of commandLineOptionOfCustomType) {
126125
126171
  if (hasProperty(options, option.name)) {
126126
126172
  if (typeof options[option.name] === "string") {
@@ -126160,7 +126206,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126160
126206
  true
126161
126207
  );
126162
126208
  mark("beforeProgram");
126163
- const host = createProgramOptions.host || createCompilerHost(options);
126209
+ const host = createProgramOptionsHost || createCompilerHost(options);
126164
126210
  const configParsingHost = parseConfigHostFromCompilerHostLike(host);
126165
126211
  let skipDefaultLib = options.noLib;
126166
126212
  const getDefaultLibraryFileName = memoize(() => host.getDefaultLibFileName(options));
@@ -128101,6 +128147,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
128101
128147
  var _a2, _b2, _c2, _d2, _e2;
128102
128148
  const existing = resolvedLibProcessing == null ? void 0 : resolvedLibProcessing.get(libFileName);
128103
128149
  if (existing) return existing;
128150
+ if (options.libReplacement === false) {
128151
+ const result2 = {
128152
+ resolution: {
128153
+ resolvedModule: void 0
128154
+ },
128155
+ actual: combinePaths(defaultLibraryPath, libFileName)
128156
+ };
128157
+ (resolvedLibProcessing ?? (resolvedLibProcessing = /* @__PURE__ */ new Map())).set(libFileName, result2);
128158
+ return result2;
128159
+ }
128104
128160
  if (structureIsReused !== 0 /* Not */ && oldProgram && !hasInvalidatedLibResolutions(libFileName)) {
128105
128161
  const oldResolution = (_a2 = oldProgram.resolvedLibReferences) == null ? void 0 : _a2.get(libFileName);
128106
128162
  if (oldResolution) {
@@ -173588,7 +173644,10 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
173588
173644
  const { parent: parent2 } = node;
173589
173645
  const typeChecker = program.getTypeChecker();
173590
173646
  if (node.kind === 164 /* OverrideKeyword */ || isIdentifier(node) && isJSDocOverrideTag(parent2) && parent2.tagName === node) {
173591
- return getDefinitionFromOverriddenMember(typeChecker, node) || emptyArray;
173647
+ const def = getDefinitionFromOverriddenMember(typeChecker, node);
173648
+ if (def !== void 0 || node.kind !== 164 /* OverrideKeyword */) {
173649
+ return def || emptyArray;
173650
+ }
173592
173651
  }
173593
173652
  if (isJumpStatementTarget(node)) {
173594
173653
  const label = getTargetLabel(node.parent, node.text);
@@ -173602,9 +173661,6 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
173602
173661
  )] : void 0;
173603
173662
  }
173604
173663
  switch (node.kind) {
173605
- case 107 /* ReturnKeyword */:
173606
- const functionDeclaration = findAncestor(node.parent, (n) => isClassStaticBlockDeclaration(n) ? "quit" : isFunctionLikeDeclaration(n));
173607
- return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
173608
173664
  case 90 /* DefaultKeyword */:
173609
173665
  if (!isDefaultClause(node.parent)) {
173610
173666
  break;
@@ -173617,15 +173673,14 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
173617
173673
  }
173618
173674
  break;
173619
173675
  }
173620
- if (node.kind === 135 /* AwaitKeyword */) {
173621
- const functionDeclaration = findAncestor(node, (n) => isFunctionLikeDeclaration(n));
173622
- const isAsyncFunction2 = functionDeclaration && some(functionDeclaration.modifiers, (node2) => node2.kind === 134 /* AsyncKeyword */);
173623
- return isAsyncFunction2 ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
173624
- }
173625
- if (node.kind === 127 /* YieldKeyword */) {
173626
- const functionDeclaration = findAncestor(node, (n) => isFunctionLikeDeclaration(n));
173627
- const isGeneratorFunction = functionDeclaration && functionDeclaration.asteriskToken;
173628
- return isGeneratorFunction ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
173676
+ let findFunctionDecl;
173677
+ switch (node.kind) {
173678
+ case 107 /* ReturnKeyword */:
173679
+ case 135 /* AwaitKeyword */:
173680
+ case 127 /* YieldKeyword */:
173681
+ findFunctionDecl = isFunctionLikeDeclaration;
173682
+ const functionDeclaration = findAncestor(node, findFunctionDecl);
173683
+ return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
173629
173684
  }
173630
173685
  if (isStaticModifier(node) && isClassStaticBlockDeclaration(node.parent)) {
173631
173686
  const classDecl = node.parent.parent;
@@ -173675,6 +173730,9 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
173675
173730
  }];
173676
173731
  }
173677
173732
  }
173733
+ if (isModifier(node) && (isClassElement(parent2) || isNamedDeclaration(parent2))) {
173734
+ symbol = parent2.symbol;
173735
+ }
173678
173736
  if (!symbol) {
173679
173737
  return concatenate(fileReferenceDefinition, getDefinitionInfoForIndexSignatures(node, typeChecker));
173680
173738
  }
@@ -173871,12 +173929,16 @@ function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) {
173871
173929
  false
173872
173930
  );
173873
173931
  }
173874
- const { symbol, failedAliasResolution } = getSymbol(
173932
+ let { symbol, failedAliasResolution } = getSymbol(
173875
173933
  node,
173876
173934
  typeChecker,
173877
173935
  /*stopAtAlias*/
173878
173936
  false
173879
173937
  );
173938
+ if (isModifier(node) && (isClassElement(node.parent) || isNamedDeclaration(node.parent))) {
173939
+ symbol = node.parent.symbol;
173940
+ failedAliasResolution = false;
173941
+ }
173880
173942
  if (!symbol) return void 0;
173881
173943
  const typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
173882
173944
  const returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.8.0-dev.20250123",
5
+ "version": "5.8.0-dev.20250124",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -116,5 +116,5 @@
116
116
  "node": "20.1.0",
117
117
  "npm": "8.19.4"
118
118
  },
119
- "gitHead": "5e52b28ee6d54f6637990be6d0dda1e974f78345"
119
+ "gitHead": "220706eb0320ff46fad8bf80a5e99db624ee7dfb"
120
120
  }