typescript 5.7.3 → 5.8.0-beta

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/typescript.js CHANGED
@@ -436,6 +436,7 @@ __export(typescript_exports, {
436
436
  createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
437
437
  createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
438
438
  createProgram: () => createProgram,
439
+ createProgramDiagnostics: () => createProgramDiagnostics,
439
440
  createProgramHost: () => createProgramHost,
440
441
  createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,
441
442
  createQueue: () => createQueue,
@@ -605,6 +606,8 @@ __export(typescript_exports, {
605
606
  forEachLeadingCommentRange: () => forEachLeadingCommentRange,
606
607
  forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
607
608
  forEachNameOfDefaultExport: () => forEachNameOfDefaultExport,
609
+ forEachOptionsSyntaxByName: () => forEachOptionsSyntaxByName,
610
+ forEachProjectReference: () => forEachProjectReference,
608
611
  forEachPropertyAssignment: () => forEachPropertyAssignment,
609
612
  forEachResolvedProjectReference: () => forEachResolvedProjectReference,
610
613
  forEachReturnStatement: () => forEachReturnStatement,
@@ -844,6 +847,8 @@ __export(typescript_exports, {
844
847
  getLeadingCommentRangesOfNode: () => getLeadingCommentRangesOfNode,
845
848
  getLeftmostAccessExpression: () => getLeftmostAccessExpression,
846
849
  getLeftmostExpression: () => getLeftmostExpression,
850
+ getLibFileNameFromLibReference: () => getLibFileNameFromLibReference,
851
+ getLibNameFromLibReference: () => getLibNameFromLibReference,
847
852
  getLibraryNameFromLibFileName: () => getLibraryNameFromLibFileName,
848
853
  getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
849
854
  getLineInfo: () => getLineInfo,
@@ -916,6 +921,8 @@ __export(typescript_exports, {
916
921
  getOptionFromName: () => getOptionFromName,
917
922
  getOptionsForLibraryResolution: () => getOptionsForLibraryResolution,
918
923
  getOptionsNameMap: () => getOptionsNameMap,
924
+ getOptionsSyntaxByArrayElementValue: () => getOptionsSyntaxByArrayElementValue,
925
+ getOptionsSyntaxByValue: () => getOptionsSyntaxByValue,
919
926
  getOrCreateEmitNode: () => getOrCreateEmitNode,
920
927
  getOrUpdate: () => getOrUpdate,
921
928
  getOriginalNode: () => getOriginalNode,
@@ -952,7 +959,6 @@ __export(typescript_exports, {
952
959
  getPrivateIdentifier: () => getPrivateIdentifier,
953
960
  getProperties: () => getProperties,
954
961
  getProperty: () => getProperty,
955
- getPropertyArrayElementValue: () => getPropertyArrayElementValue,
956
962
  getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
957
963
  getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
958
964
  getPropertyNameFromType: () => getPropertyNameFromType,
@@ -1863,6 +1869,7 @@ __export(typescript_exports, {
1863
1869
  moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
1864
1870
  moduleSpecifierToValidIdentifier: () => moduleSpecifierToValidIdentifier,
1865
1871
  moduleSpecifiers: () => ts_moduleSpecifiers_exports,
1872
+ moduleSupportsImportAttributes: () => moduleSupportsImportAttributes,
1866
1873
  moduleSymbolToValidIdentifier: () => moduleSymbolToValidIdentifier,
1867
1874
  moveEmitHelpers: () => moveEmitHelpers,
1868
1875
  moveRangeEnd: () => moveRangeEnd,
@@ -2277,8 +2284,8 @@ __export(typescript_exports, {
2277
2284
  module.exports = __toCommonJS(typescript_exports);
2278
2285
 
2279
2286
  // src/compiler/corePublic.ts
2280
- var versionMajorMinor = "5.7";
2281
- var version = "5.7.3";
2287
+ var versionMajorMinor = "5.8";
2288
+ var version = "5.8.0-beta";
2282
2289
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2283
2290
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2284
2291
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6531,6 +6538,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
6531
6538
  ObjectFlags3[ObjectFlags3["IsGenericObjectType"] = 4194304] = "IsGenericObjectType";
6532
6539
  ObjectFlags3[ObjectFlags3["IsGenericIndexType"] = 8388608] = "IsGenericIndexType";
6533
6540
  ObjectFlags3[ObjectFlags3["IsGenericType"] = 12582912] = "IsGenericType";
6541
+ ObjectFlags3[ObjectFlags3["IsNarrowingType"] = 16777216] = "IsNarrowingType";
6534
6542
  ObjectFlags3[ObjectFlags3["ContainsIntersections"] = 16777216] = "ContainsIntersections";
6535
6543
  ObjectFlags3[ObjectFlags3["IsUnknownLikeUnionComputed"] = 33554432] = "IsUnknownLikeUnionComputed";
6536
6544
  ObjectFlags3[ObjectFlags3["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
@@ -6727,6 +6735,7 @@ var ModuleKind = /* @__PURE__ */ ((ModuleKind3) => {
6727
6735
  ModuleKind3[ModuleKind3["ES2022"] = 7] = "ES2022";
6728
6736
  ModuleKind3[ModuleKind3["ESNext"] = 99] = "ESNext";
6729
6737
  ModuleKind3[ModuleKind3["Node16"] = 100] = "Node16";
6738
+ ModuleKind3[ModuleKind3["Node18"] = 101] = "Node18";
6730
6739
  ModuleKind3[ModuleKind3["NodeNext"] = 199] = "NodeNext";
6731
6740
  ModuleKind3[ModuleKind3["Preserve"] = 200] = "Preserve";
6732
6741
  return ModuleKind3;
@@ -7141,8 +7150,9 @@ var OuterExpressionKinds = /* @__PURE__ */ ((OuterExpressionKinds2) => {
7141
7150
  OuterExpressionKinds2[OuterExpressionKinds2["NonNullAssertions"] = 4] = "NonNullAssertions";
7142
7151
  OuterExpressionKinds2[OuterExpressionKinds2["PartiallyEmittedExpressions"] = 8] = "PartiallyEmittedExpressions";
7143
7152
  OuterExpressionKinds2[OuterExpressionKinds2["ExpressionsWithTypeArguments"] = 16] = "ExpressionsWithTypeArguments";
7144
- OuterExpressionKinds2[OuterExpressionKinds2["Assertions"] = 6] = "Assertions";
7145
- OuterExpressionKinds2[OuterExpressionKinds2["All"] = 31] = "All";
7153
+ OuterExpressionKinds2[OuterExpressionKinds2["Satisfies"] = 32] = "Satisfies";
7154
+ OuterExpressionKinds2[OuterExpressionKinds2["Assertions"] = 38] = "Assertions";
7155
+ OuterExpressionKinds2[OuterExpressionKinds2["All"] = 63] = "All";
7146
7156
  OuterExpressionKinds2[OuterExpressionKinds2["ExcludeJSDocTypeAssertion"] = -2147483648] = "ExcludeJSDocTypeAssertion";
7147
7157
  return OuterExpressionKinds2;
7148
7158
  })(OuterExpressionKinds || {});
@@ -8871,23 +8881,105 @@ function resolvePath(path, ...paths) {
8871
8881
  function getNormalizedPathComponents(path, currentDirectory) {
8872
8882
  return reducePathComponents(getPathComponents(path, currentDirectory));
8873
8883
  }
8874
- function getNormalizedAbsolutePath(fileName, currentDirectory) {
8875
- return getPathFromPathComponents(getNormalizedPathComponents(fileName, currentDirectory));
8884
+ function getNormalizedAbsolutePath(path, currentDirectory) {
8885
+ let rootLength = getRootLength(path);
8886
+ if (rootLength === 0 && currentDirectory) {
8887
+ path = combinePaths(currentDirectory, path);
8888
+ rootLength = getRootLength(path);
8889
+ } else {
8890
+ path = normalizeSlashes(path);
8891
+ }
8892
+ const simpleNormalized = simpleNormalizePath(path);
8893
+ if (simpleNormalized !== void 0) {
8894
+ return simpleNormalized.length > rootLength ? removeTrailingDirectorySeparator(simpleNormalized) : simpleNormalized;
8895
+ }
8896
+ const length2 = path.length;
8897
+ const root = path.substring(0, rootLength);
8898
+ let normalized;
8899
+ let index = rootLength;
8900
+ let segmentStart = index;
8901
+ let normalizedUpTo = index;
8902
+ let seenNonDotDotSegment = rootLength !== 0;
8903
+ while (index < length2) {
8904
+ segmentStart = index;
8905
+ let ch = path.charCodeAt(index);
8906
+ while (ch === 47 /* slash */ && index + 1 < length2) {
8907
+ index++;
8908
+ ch = path.charCodeAt(index);
8909
+ }
8910
+ if (index > segmentStart) {
8911
+ normalized ?? (normalized = path.substring(0, segmentStart - 1));
8912
+ segmentStart = index;
8913
+ }
8914
+ let segmentEnd = path.indexOf(directorySeparator, index + 1);
8915
+ if (segmentEnd === -1) {
8916
+ segmentEnd = length2;
8917
+ }
8918
+ const segmentLength = segmentEnd - segmentStart;
8919
+ if (segmentLength === 1 && path.charCodeAt(index) === 46 /* dot */) {
8920
+ normalized ?? (normalized = path.substring(0, normalizedUpTo));
8921
+ } else if (segmentLength === 2 && path.charCodeAt(index) === 46 /* dot */ && path.charCodeAt(index + 1) === 46 /* dot */) {
8922
+ if (!seenNonDotDotSegment) {
8923
+ if (normalized !== void 0) {
8924
+ normalized += normalized.length === rootLength ? ".." : "/..";
8925
+ } else {
8926
+ normalizedUpTo = index + 2;
8927
+ }
8928
+ } else if (normalized === void 0) {
8929
+ if (normalizedUpTo - 2 >= 0) {
8930
+ normalized = path.substring(0, Math.max(rootLength, path.lastIndexOf(directorySeparator, normalizedUpTo - 2)));
8931
+ } else {
8932
+ normalized = path.substring(0, normalizedUpTo);
8933
+ }
8934
+ } else {
8935
+ const lastSlash = normalized.lastIndexOf(directorySeparator);
8936
+ if (lastSlash !== -1) {
8937
+ normalized = normalized.substring(0, Math.max(rootLength, lastSlash));
8938
+ } else {
8939
+ normalized = root;
8940
+ }
8941
+ if (normalized.length === rootLength) {
8942
+ seenNonDotDotSegment = rootLength !== 0;
8943
+ }
8944
+ }
8945
+ } else if (normalized !== void 0) {
8946
+ if (normalized.length !== rootLength) {
8947
+ normalized += directorySeparator;
8948
+ }
8949
+ seenNonDotDotSegment = true;
8950
+ normalized += path.substring(segmentStart, segmentEnd);
8951
+ } else {
8952
+ seenNonDotDotSegment = true;
8953
+ normalizedUpTo = segmentEnd;
8954
+ }
8955
+ index = segmentEnd + 1;
8956
+ }
8957
+ return normalized ?? (length2 > rootLength ? removeTrailingDirectorySeparator(path) : path);
8876
8958
  }
8877
8959
  function normalizePath(path) {
8878
8960
  path = normalizeSlashes(path);
8961
+ let normalized = simpleNormalizePath(path);
8962
+ if (normalized !== void 0) {
8963
+ return normalized;
8964
+ }
8965
+ normalized = getNormalizedAbsolutePath(path, "");
8966
+ return normalized && hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(normalized) : normalized;
8967
+ }
8968
+ function simpleNormalizePath(path) {
8879
8969
  if (!relativePathSegmentRegExp.test(path)) {
8880
8970
  return path;
8881
8971
  }
8882
- const simplified = path.replace(/\/\.\//g, "/").replace(/^\.\//, "");
8972
+ let simplified = path.replace(/\/\.\//g, "/");
8973
+ if (simplified.startsWith("./")) {
8974
+ simplified = simplified.slice(2);
8975
+ }
8883
8976
  if (simplified !== path) {
8884
8977
  path = simplified;
8885
8978
  if (!relativePathSegmentRegExp.test(path)) {
8886
8979
  return path;
8887
8980
  }
8888
8981
  }
8889
- const normalized = getPathFromPathComponents(reducePathComponents(getPathComponents(path)));
8890
- return normalized && hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(normalized) : normalized;
8982
+ return void 0;
8891
8983
  }
8892
8984
  function getPathWithoutRoot(pathComponents2) {
8893
8985
  if (pathComponents2.length === 0) return "";
@@ -9315,6 +9407,7 @@ var Diagnostics = {
9315
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."),
9316
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 }'."),
9317
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."),
9318
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."),
9319
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."),
9320
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."),
@@ -9329,8 +9422,8 @@ var Diagnostics = {
9329
9422
  Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1320, 1 /* Error */, "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."),
9330
9423
  Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, 1 /* Error */, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
9331
9424
  Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, 1 /* Error */, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
9332
- Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext: diag(1323, 1 /* Error */, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'."),
9333
- Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodenext_or_preserve: diag(1324, 1 /* Error */, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodene_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'."),
9425
+ Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_node18_or_nodenext: diag(1323, 1 /* Error */, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', or 'nodenext'."),
9426
+ Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_node18_nodenext_or_preserve: diag(1324, 1 /* Error */, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_node18_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'nodenext', or 'preserve'."),
9334
9427
  Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, 1 /* Error */, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
9335
9428
  This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments: diag(1326, 1 /* Error */, "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326", "This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),
9336
9429
  String_literal_with_double_quotes_expected: diag(1327, 1 /* Error */, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
@@ -9347,7 +9440,7 @@ var Diagnostics = {
9347
9440
  Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, 1 /* Error */, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
9348
9441
  Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, 1 /* Error */, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
9349
9442
  Class_constructor_may_not_be_an_accessor: diag(1341, 1 /* Error */, "Class_constructor_may_not_be_an_accessor_1341", "Class constructor may not be an accessor."),
9350
- The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, 1 /* Error */, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."),
9443
+ The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_node18_or_nodenext: diag(1343, 1 /* Error */, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', 'node18', or 'nodenext'."),
9351
9444
  A_label_is_not_allowed_here: diag(1344, 1 /* Error */, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
9352
9445
  An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, 1 /* Error */, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
9353
9446
  This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, 1 /* Error */, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
@@ -9377,7 +9470,7 @@ var Diagnostics = {
9377
9470
  await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, 1 /* Error */, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
9378
9471
  _0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
9379
9472
  _0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
9380
- Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, 1 /* Error */, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
9473
+ Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, 1 /* Error */, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
9381
9474
  An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type: diag(1379, 1 /* Error */, "An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379", "An import alias cannot reference a declaration that was exported using 'export type'."),
9382
9475
  An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, 1 /* Error */, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."),
9383
9476
  Unexpected_token_Did_you_mean_or_rbrace: diag(1381, 1 /* Error */, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `&rbrace;`?"),
@@ -9428,7 +9521,7 @@ var Diagnostics = {
9428
9521
  File_redirects_to_file_0: diag(1429, 3 /* Message */, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
9429
9522
  The_file_is_in_the_program_because_Colon: diag(1430, 3 /* Message */, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"),
9430
9523
  for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1431, 1 /* Error */, "for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_1431", "'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
9431
- Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, 1 /* Error */, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
9524
+ Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, 1 /* Error */, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
9432
9525
  Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters: diag(1433, 1 /* Error */, "Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters_1433", "Neither decorators nor modifiers may be applied to 'this' parameters."),
9433
9526
  Unexpected_keyword_or_identifier: diag(1434, 1 /* Error */, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
9434
9527
  Unknown_keyword_or_identifier_Did_you_mean_0: diag(1435, 1 /* Error */, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"),
@@ -10070,9 +10163,9 @@ var Diagnostics = {
10070
10163
  Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers: diag(2818, 1 /* Error */, "Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818", "Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."),
10071
10164
  Namespace_name_cannot_be_0: diag(2819, 1 /* Error */, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
10072
10165
  Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, 1 /* Error */, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),
10073
- Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve: diag(2821, 1 /* Error */, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve_2821", "Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'."),
10166
+ Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve: diag(2821, 1 /* Error */, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_pres_2821", "Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'."),
10074
10167
  Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, 1 /* Error */, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
10075
- Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve: diag(2823, 1 /* Error */, "Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve_2823", "Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'."),
10168
+ Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve: diag(2823, 1 /* Error */, "Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_pres_2823", "Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'nodenext', or 'preserve'."),
10076
10169
  Cannot_find_namespace_0_Did_you_mean_1: diag(2833, 1 /* Error */, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
10077
10170
  Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path."),
10078
10171
  Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, 1 /* Error */, "Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"),
@@ -10092,7 +10185,7 @@ var Diagnostics = {
10092
10185
  The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined: diag(2851, 1 /* Error */, "The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_2851", "The initializer of an 'await using' declaration must be either an object with a '[Symbol.asyncDispose]()' or '[Symbol.dispose]()' method, or be 'null' or 'undefined'."),
10093
10186
  await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(2852, 1 /* Error */, "await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_2852", "'await using' statements are only allowed within async functions and at the top levels of modules."),
10094
10187
  await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(2853, 1 /* Error */, "await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_th_2853", "'await using' statements are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
10095
- Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
10188
+ Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'node18', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
10096
10189
  Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super: diag(2855, 1 /* Error */, "Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super_2855", "Class field '{0}' defined by the parent class is not accessible in the child class via super."),
10097
10190
  Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls: diag(2856, 1 /* Error */, "Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls_2856", "Import attributes are not allowed on statements that compile to CommonJS 'require' calls."),
10098
10191
  Import_attributes_cannot_be_used_with_type_only_imports_or_exports: diag(2857, 1 /* Error */, "Import_attributes_cannot_be_used_with_type_only_imports_or_exports_2857", "Import attributes cannot be used with type-only imports or exports."),
@@ -10118,6 +10211,7 @@ var Diagnostics = {
10118
10211
  This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_during_emit_because_it_is_not_a_relative_path: diag(2877, 1 /* Error */, "This_import_uses_a_0_extension_to_resolve_to_an_input_TypeScript_file_but_will_not_be_rewritten_duri_2877", "This import uses a '{0}' extension to resolve to an input TypeScript file, but will not be rewritten during emit because it is not a relative path."),
10119
10212
  This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_between_the_projects_output_files_is_not_the_same_as_the_relative_path_between_its_input_files: diag(2878, 1 /* Error */, "This_import_path_is_unsafe_to_rewrite_because_it_resolves_to_another_project_and_the_relative_path_b_2878", "This import path is unsafe to rewrite because it resolves to another project, and the relative path between the projects' output files is not the same as the relative path between its input files."),
10120
10213
  Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found: diag(2879, 1 /* Error */, "Using_JSX_fragments_requires_fragment_factory_0_to_be_in_scope_but_it_could_not_be_found_2879", "Using JSX fragments requires fragment factory '{0}' to be in scope, but it could not be found."),
10214
+ Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_asserts: diag(2880, 1 /* Error */, "Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_asserts_2880", "Import assertions have been replaced by import attributes. Use 'with' instead of 'asserts'."),
10121
10215
  Import_declaration_0_is_using_private_name_1: diag(4e3, 1 /* Error */, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
10122
10216
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, 1 /* Error */, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
10123
10217
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, 1 /* Error */, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -10227,6 +10321,8 @@ var Diagnostics = {
10227
10321
  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'."),
10228
10322
  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."),
10229
10323
  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."),
10324
+ This_member_cannot_have_an_override_modifier_because_its_name_is_dynamic: diag(4127, 1 /* Error */, "This_member_cannot_have_an_override_modifier_because_its_name_is_dynamic_4127", "This member cannot have an 'override' modifier because its name is dynamic."),
10325
+ This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_name_is_dynamic: diag(4128, 1 /* Error */, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_name_is_dynamic_4128", "This member cannot have a JSDoc comment with an '@override' tag because its name is dynamic."),
10230
10326
  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."),
10231
10327
  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."),
10232
10328
  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}'."),
@@ -10799,11 +10895,13 @@ var Diagnostics = {
10799
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."),
10800
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."),
10801
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."),
10802
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'."),
10803
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."),
10804
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)."),
10805
10902
  Check_side_effect_imports: diag(6806, 3 /* Message */, "Check_side_effect_imports_6806", "Check side effect imports."),
10806
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."),
10807
10905
  one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
10808
10906
  one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
10809
10907
  type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
@@ -16771,6 +16869,9 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
16771
16869
  "trunc",
16772
16870
  "fround",
16773
16871
  "cbrt"
16872
+ ],
16873
+ esnext: [
16874
+ "f16round"
16774
16875
  ]
16775
16876
  })),
16776
16877
  Map: new Map(Object.entries({
@@ -16940,6 +17041,10 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
16940
17041
  "setBigUint64",
16941
17042
  "getBigInt64",
16942
17043
  "getBigUint64"
17044
+ ],
17045
+ esnext: [
17046
+ "setFloat16",
17047
+ "getFloat16"
16943
17048
  ]
16944
17049
  })),
16945
17050
  BigInt: new Map(Object.entries({
@@ -17043,6 +17148,9 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
17043
17148
  "with"
17044
17149
  ]
17045
17150
  })),
17151
+ Float16Array: new Map(Object.entries({
17152
+ esnext: emptyArray
17153
+ })),
17046
17154
  Float32Array: new Map(Object.entries({
17047
17155
  es2022: [
17048
17156
  "at"
@@ -17222,7 +17330,7 @@ function getNonAugmentationDeclaration(symbol) {
17222
17330
  return (_a = symbol.declarations) == null ? void 0 : _a.find((d) => !isExternalModuleAugmentation(d) && !(isModuleDeclaration(d) && isGlobalScopeAugmentation(d)));
17223
17331
  }
17224
17332
  function isCommonJSContainingModuleKind(kind) {
17225
- return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
17333
+ return kind === 1 /* CommonJS */ || 100 /* Node16 */ <= kind && kind <= 199 /* NodeNext */;
17226
17334
  }
17227
17335
  function isEffectiveExternalModule(node, compilerOptions) {
17228
17336
  return isExternalModule(node) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
@@ -17936,9 +18044,6 @@ function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
17936
18044
  return key === propName || key2 && key2 === propName ? callback(property) : void 0;
17937
18045
  });
17938
18046
  }
17939
- function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
17940
- return forEachPropertyAssignment(objectLiteral, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
17941
- }
17942
18047
  function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
17943
18048
  if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
17944
18049
  const expression = tsConfigSourceFile.statements[0].expression;
@@ -21767,7 +21872,7 @@ var _computedOptions = createComputedCompilerOptions({
21767
21872
  dependencies: ["module"],
21768
21873
  computeValue: (compilerOptions) => {
21769
21874
  const target = compilerOptions.target === 0 /* ES3 */ ? void 0 : compilerOptions.target;
21770
- return target ?? (compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */);
21875
+ return target ?? (compilerOptions.module === 100 /* Node16 */ && 9 /* ES2022 */ || compilerOptions.module === 101 /* Node18 */ && 9 /* ES2022 */ || compilerOptions.module === 199 /* NodeNext */ && 99 /* ESNext */ || 1 /* ES5 */);
21771
21876
  }
21772
21877
  },
21773
21878
  module: {
@@ -21786,6 +21891,7 @@ var _computedOptions = createComputedCompilerOptions({
21786
21891
  moduleResolution = 2 /* Node10 */;
21787
21892
  break;
21788
21893
  case 100 /* Node16 */:
21894
+ case 101 /* Node18 */:
21789
21895
  moduleResolution = 3 /* Node16 */;
21790
21896
  break;
21791
21897
  case 199 /* NodeNext */:
@@ -21805,7 +21911,11 @@ var _computedOptions = createComputedCompilerOptions({
21805
21911
  moduleDetection: {
21806
21912
  dependencies: ["module", "target"],
21807
21913
  computeValue: (compilerOptions) => {
21808
- return compilerOptions.moduleDetection || (_computedOptions.module.computeValue(compilerOptions) === 100 /* Node16 */ || _computedOptions.module.computeValue(compilerOptions) === 199 /* NodeNext */ ? 3 /* Force */ : 2 /* Auto */);
21914
+ if (compilerOptions.moduleDetection !== void 0) {
21915
+ return compilerOptions.moduleDetection;
21916
+ }
21917
+ const moduleKind = _computedOptions.module.computeValue(compilerOptions);
21918
+ return 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ ? 3 /* Force */ : 2 /* Auto */;
21809
21919
  }
21810
21920
  },
21811
21921
  isolatedModules: {
@@ -21822,6 +21932,7 @@ var _computedOptions = createComputedCompilerOptions({
21822
21932
  }
21823
21933
  switch (_computedOptions.module.computeValue(compilerOptions)) {
21824
21934
  case 100 /* Node16 */:
21935
+ case 101 /* Node18 */:
21825
21936
  case 199 /* NodeNext */:
21826
21937
  case 200 /* Preserve */:
21827
21938
  return true;
@@ -22015,6 +22126,9 @@ function unusedLabelIsError(options) {
22015
22126
  function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
22016
22127
  return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
22017
22128
  }
22129
+ function moduleSupportsImportAttributes(moduleKind) {
22130
+ return 101 /* Node18 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || moduleKind === 200 /* Preserve */ || moduleKind === 99 /* ESNext */;
22131
+ }
22018
22132
  function getStrictOptionValue(compilerOptions, flag) {
22019
22133
  return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
22020
22134
  }
@@ -22765,7 +22879,7 @@ function isValidBigIntString(s, roundTripOnly) {
22765
22879
  return success && result === 10 /* BigIntLiteral */ && scanner2.getTokenEnd() === s.length + 1 && !(flags & 512 /* ContainsSeparator */) && (!roundTripOnly || s === pseudoBigIntToString({ negative, base10Value: parsePseudoBigInt(scanner2.getTokenValue()) }));
22766
22880
  }
22767
22881
  function isValidTypeOnlyAliasUseSite(useSite) {
22768
- return !!(useSite.flags & 33554432 /* Ambient */) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite));
22882
+ return !!(useSite.flags & 33554432 /* Ambient */) || isInJSDoc(useSite) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite));
22769
22883
  }
22770
22884
  function isShorthandPropertyNameUseSite(useSite) {
22771
22885
  return isIdentifier(useSite) && isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite;
@@ -23937,6 +24051,64 @@ function getNodeAtPosition(sourceFile, position, includeJSDoc) {
23937
24051
  function isNewScopeNode(node) {
23938
24052
  return isFunctionLike(node) || isJSDocSignature(node) || isMappedTypeNode(node);
23939
24053
  }
24054
+ function getLibNameFromLibReference(libReference) {
24055
+ return toFileNameLowerCase(libReference.fileName);
24056
+ }
24057
+ function getLibFileNameFromLibReference(libReference) {
24058
+ const libName = getLibNameFromLibReference(libReference);
24059
+ return libMap.get(libName);
24060
+ }
24061
+ function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
24062
+ return forEachProjectReference(
24063
+ /*projectReferences*/
24064
+ void 0,
24065
+ resolvedProjectReferences,
24066
+ (resolvedRef, parent2) => resolvedRef && cb(resolvedRef, parent2)
24067
+ );
24068
+ }
24069
+ function forEachProjectReference(projectReferences, resolvedProjectReferences, cbResolvedRef, cbRef) {
24070
+ let seenResolvedRefs;
24071
+ return worker(
24072
+ projectReferences,
24073
+ resolvedProjectReferences,
24074
+ /*parent*/
24075
+ void 0
24076
+ );
24077
+ function worker(projectReferences2, resolvedProjectReferences2, parent2) {
24078
+ if (cbRef) {
24079
+ const result = cbRef(projectReferences2, parent2);
24080
+ if (result) return result;
24081
+ }
24082
+ let skipChildren;
24083
+ return forEach(
24084
+ resolvedProjectReferences2,
24085
+ (resolvedRef, index) => {
24086
+ if (resolvedRef && (seenResolvedRefs == null ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) {
24087
+ (skipChildren ?? (skipChildren = /* @__PURE__ */ new Set())).add(resolvedRef);
24088
+ return void 0;
24089
+ }
24090
+ const result = cbResolvedRef(resolvedRef, parent2, index);
24091
+ if (result || !resolvedRef) return result;
24092
+ (seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Set())).add(resolvedRef.sourceFile.path);
24093
+ }
24094
+ ) || forEach(
24095
+ resolvedProjectReferences2,
24096
+ (resolvedRef) => resolvedRef && !(skipChildren == null ? void 0 : skipChildren.has(resolvedRef)) ? worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef) : void 0
24097
+ );
24098
+ }
24099
+ }
24100
+ function getOptionsSyntaxByArrayElementValue(optionsObject, name, value) {
24101
+ return optionsObject && getPropertyArrayElementValue(optionsObject, name, value);
24102
+ }
24103
+ function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
24104
+ return forEachPropertyAssignment(objectLiteral, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
24105
+ }
24106
+ function getOptionsSyntaxByValue(optionsObject, name, value) {
24107
+ return forEachOptionsSyntaxByName(optionsObject, name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
24108
+ }
24109
+ function forEachOptionsSyntaxByName(optionsObject, name, callback) {
24110
+ return forEachPropertyAssignment(optionsObject, name, callback);
24111
+ }
23940
24112
 
23941
24113
  // src/compiler/factory/baseNodeFactory.ts
23942
24114
  function createBaseNodeFactory() {
@@ -26554,6 +26726,8 @@ function createNodeFactory(flags, baseFactory2) {
26554
26726
  node.colonToken = colonToken ?? createToken(59 /* ColonToken */);
26555
26727
  node.whenFalse = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenFalse);
26556
26728
  node.transformFlags |= propagateChildFlags(node.condition) | propagateChildFlags(node.questionToken) | propagateChildFlags(node.whenTrue) | propagateChildFlags(node.colonToken) | propagateChildFlags(node.whenFalse);
26729
+ node.flowNodeWhenFalse = void 0;
26730
+ node.flowNodeWhenTrue = void 0;
26557
26731
  return node;
26558
26732
  }
26559
26733
  function updateConditionalExpression(node, condition, questionToken, whenTrue, colonToken, whenFalse) {
@@ -28357,7 +28531,7 @@ function createNodeFactory(flags, baseFactory2) {
28357
28531
  function isIgnorableParen(node) {
28358
28532
  return isParenthesizedExpression(node) && nodeIsSynthesized(node) && nodeIsSynthesized(getSourceMapRange(node)) && nodeIsSynthesized(getCommentRange(node)) && !some(getSyntheticLeadingComments(node)) && !some(getSyntheticTrailingComments(node));
28359
28533
  }
28360
- function restoreOuterExpressions(outerExpression, innerExpression, kinds = 31 /* All */) {
28534
+ function restoreOuterExpressions(outerExpression, innerExpression, kinds = 63 /* All */) {
28361
28535
  if (outerExpression && isOuterExpression(outerExpression, kinds) && !isIgnorableParen(outerExpression)) {
28362
28536
  return updateOuterExpression(
28363
28537
  outerExpression,
@@ -28403,7 +28577,7 @@ function createNodeFactory(flags, baseFactory2) {
28403
28577
  }
28404
28578
  }
28405
28579
  function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers = false) {
28406
- const callee = skipOuterExpressions(expression, 31 /* All */);
28580
+ const callee = skipOuterExpressions(expression, 63 /* All */);
28407
28581
  let thisArg;
28408
28582
  let target;
28409
28583
  if (isSuperProperty(callee)) {
@@ -31406,7 +31580,7 @@ function getJSDocTypeAssertionType(node) {
31406
31580
  Debug.assertIsDefined(type);
31407
31581
  return type;
31408
31582
  }
31409
- function isOuterExpression(node, kinds = 31 /* All */) {
31583
+ function isOuterExpression(node, kinds = 63 /* All */) {
31410
31584
  switch (node.kind) {
31411
31585
  case 217 /* ParenthesizedExpression */:
31412
31586
  if (kinds & -2147483648 /* ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) {
@@ -31415,8 +31589,9 @@ function isOuterExpression(node, kinds = 31 /* All */) {
31415
31589
  return (kinds & 1 /* Parentheses */) !== 0;
31416
31590
  case 216 /* TypeAssertionExpression */:
31417
31591
  case 234 /* AsExpression */:
31418
- case 238 /* SatisfiesExpression */:
31419
31592
  return (kinds & 2 /* TypeAssertions */) !== 0;
31593
+ case 238 /* SatisfiesExpression */:
31594
+ return (kinds & (2 /* TypeAssertions */ | 32 /* Satisfies */)) !== 0;
31420
31595
  case 233 /* ExpressionWithTypeArguments */:
31421
31596
  return (kinds & 16 /* ExpressionsWithTypeArguments */) !== 0;
31422
31597
  case 235 /* NonNullExpression */:
@@ -31426,13 +31601,13 @@ function isOuterExpression(node, kinds = 31 /* All */) {
31426
31601
  }
31427
31602
  return false;
31428
31603
  }
31429
- function skipOuterExpressions(node, kinds = 31 /* All */) {
31604
+ function skipOuterExpressions(node, kinds = 63 /* All */) {
31430
31605
  while (isOuterExpression(node, kinds)) {
31431
31606
  node = node.expression;
31432
31607
  }
31433
31608
  return node;
31434
31609
  }
31435
- function walkUpOuterExpressions(node, kinds = 31 /* All */) {
31610
+ function walkUpOuterExpressions(node, kinds = 63 /* All */) {
31436
31611
  let parent2 = node.parent;
31437
31612
  while (isOuterExpression(parent2, kinds)) {
31438
31613
  parent2 = parent2.parent;
@@ -39308,6 +39483,7 @@ var Parser;
39308
39483
  const node = factory2.createExpressionWithTypeArguments(expression, typeArguments);
39309
39484
  const res = finishNode(node, pos);
39310
39485
  if (usedBrace) {
39486
+ skipWhitespace();
39311
39487
  parseExpected(20 /* CloseBraceToken */);
39312
39488
  }
39313
39489
  return res;
@@ -40353,6 +40529,8 @@ var libEntries = [
40353
40529
  ["esnext.regexp", "lib.es2024.regexp.d.ts"],
40354
40530
  ["esnext.string", "lib.es2024.string.d.ts"],
40355
40531
  ["esnext.iterator", "lib.esnext.iterator.d.ts"],
40532
+ ["esnext.promise", "lib.esnext.promise.d.ts"],
40533
+ ["esnext.float16", "lib.esnext.float16.d.ts"],
40356
40534
  ["decorators", "lib.decorators.d.ts"],
40357
40535
  ["decorators.legacy", "lib.decorators.legacy.d.ts"]
40358
40536
  ];
@@ -40679,6 +40857,7 @@ var moduleOptionDeclaration = {
40679
40857
  es2022: 7 /* ES2022 */,
40680
40858
  esnext: 99 /* ESNext */,
40681
40859
  node16: 100 /* Node16 */,
40860
+ node18: 101 /* Node18 */,
40682
40861
  nodenext: 199 /* NodeNext */,
40683
40862
  preserve: 200 /* Preserve */
40684
40863
  })),
@@ -40931,6 +41110,23 @@ var commandOptionsWithoutBuild = [
40931
41110
  affectsBuildInfo: true,
40932
41111
  affectsSemanticDiagnostics: true
40933
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
+ },
40934
41130
  // Strict Type Checks
40935
41131
  {
40936
41132
  name: "strict",
@@ -45101,9 +45297,7 @@ function tryFileLookup(fileName, onlyRecordFailures, state) {
45101
45297
  }
45102
45298
  function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
45103
45299
  const packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : void 0;
45104
- const packageJsonContent = packageInfo && packageInfo.contents.packageJsonContent;
45105
- const versionPaths = packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state);
45106
- return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths), state);
45300
+ return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo), state);
45107
45301
  }
45108
45302
  function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache, resolveJs) {
45109
45303
  if (!resolveJs && packageJsonInfo.contents.resolvedEntrypoints !== void 0) {
@@ -45121,8 +45315,7 @@ function getEntrypointsFromPackageJsonInfo(packageJsonInfo, options, host, cache
45121
45315
  /*onlyRecordFailures*/
45122
45316
  false,
45123
45317
  loadPackageJsonMainState,
45124
- packageJsonInfo.contents.packageJsonContent,
45125
- getVersionPathsOfPackageJsonInfo(packageJsonInfo, loadPackageJsonMainState)
45318
+ packageJsonInfo
45126
45319
  );
45127
45320
  entrypoints = append(entrypoints, mainResolution == null ? void 0 : mainResolution.path);
45128
45321
  if (features & 8 /* Exports */ && packageJsonInfo.contents.packageJsonContent.exports) {
@@ -45325,13 +45518,14 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
45325
45518
  (_f = state.failedLookupLocations) == null ? void 0 : _f.push(packageJsonPath);
45326
45519
  }
45327
45520
  }
45328
- function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
45521
+ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJson) {
45522
+ const versionPaths = packageJson && getVersionPathsOfPackageJsonInfo(packageJson, state);
45329
45523
  let packageFile;
45330
- if (jsonContent) {
45524
+ if (packageJson && arePathsEqual(packageJson == null ? void 0 : packageJson.packageDirectory, candidate, state.host)) {
45331
45525
  if (state.isConfigLookup) {
45332
- packageFile = readPackageJsonTSConfigField(jsonContent, candidate, state);
45526
+ packageFile = readPackageJsonTSConfigField(packageJson.contents.packageJsonContent, packageJson.packageDirectory, state);
45333
45527
  } else {
45334
- packageFile = extensions & 4 /* Declaration */ && readPackageJsonTypesFields(jsonContent, candidate, state) || extensions & (3 /* ImplementationFiles */ | 4 /* Declaration */) && readPackageJsonMainField(jsonContent, candidate, state) || void 0;
45528
+ packageFile = extensions & 4 /* Declaration */ && readPackageJsonTypesFields(packageJson.contents.packageJsonContent, packageJson.packageDirectory, state) || extensions & (3 /* ImplementationFiles */ | 4 /* Declaration */) && readPackageJsonMainField(packageJson.contents.packageJsonContent, packageJson.packageDirectory, state) || void 0;
45335
45529
  }
45336
45530
  }
45337
45531
  const loader = (extensions2, candidate2, onlyRecordFailures2, state2) => {
@@ -45350,7 +45544,7 @@ function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFail
45350
45544
  const features = state2.features;
45351
45545
  const candidateIsFromPackageJsonField = state2.candidateIsFromPackageJsonField;
45352
45546
  state2.candidateIsFromPackageJsonField = true;
45353
- if ((jsonContent == null ? void 0 : jsonContent.type) !== "module") {
45547
+ if ((packageJson == null ? void 0 : packageJson.contents.packageJsonContent.type) !== "module") {
45354
45548
  state2.features &= ~32 /* EsmMode */;
45355
45549
  }
45356
45550
  const result = nodeLoadModuleByRelativeName(
@@ -45621,6 +45815,7 @@ function hasOneAsterisk(patternKey) {
45621
45815
  function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
45622
45816
  return loadModuleFromTargetExportOrImport;
45623
45817
  function loadModuleFromTargetExportOrImport(target, subpath, pattern, key) {
45818
+ var _a, _b;
45624
45819
  if (typeof target === "string") {
45625
45820
  if (!pattern && subpath.length > 0 && !endsWith(target, "/")) {
45626
45821
  if (state.traceEnabled) {
@@ -45649,6 +45844,8 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
45649
45844
  redirectedReference,
45650
45845
  state.conditions
45651
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);
45652
45849
  return toSearchResult(
45653
45850
  result.resolvedModule ? {
45654
45851
  path: result.resolvedModule.resolvedFileName,
@@ -45758,20 +45955,20 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
45758
45955
  void 0
45759
45956
  );
45760
45957
  function toAbsolutePath(path) {
45761
- var _a, _b;
45958
+ var _a2, _b2;
45762
45959
  if (path === void 0) return path;
45763
- 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));
45764
45961
  }
45765
45962
  function combineDirectoryPath(root, dir) {
45766
45963
  return ensureTrailingDirectorySeparator(combinePaths(root, dir));
45767
45964
  }
45768
45965
  function tryLoadInputFileForPath(finalPath, entry, packagePath, isImports2) {
45769
- var _a, _b, _c, _d;
45966
+ var _a2, _b2, _c, _d;
45770
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)) {
45771
45968
  const getCanonicalFileName = hostGetCanonicalFileName({ useCaseSensitiveFileNames: () => useCaseSensitiveFileNames(state) });
45772
45969
  const commonSourceDirGuesses = [];
45773
45970
  if (state.compilerOptions.rootDir || state.compilerOptions.composite && state.compilerOptions.configFilePath) {
45774
- 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));
45775
45972
  commonSourceDirGuesses.push(commonDir);
45776
45973
  } else if (state.requestContainingDirectory) {
45777
45974
  const requestingFile = toAbsolutePath(combinePaths(state.requestContainingDirectory, "index.ts"));
@@ -45827,8 +46024,8 @@ function getLoadModuleFromTargetExportOrImport(extensions, state, cache, redirec
45827
46024
  }
45828
46025
  return void 0;
45829
46026
  function getOutputDirectoriesForBaseDirectory(commonSourceDirGuess) {
45830
- var _a2, _b2;
45831
- 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;
45832
46029
  const candidateDirectories = [];
45833
46030
  if (state.compilerOptions.declarationDir) {
45834
46031
  candidateDirectories.push(toAbsolutePath(combineDirectoryPath(currentDir, state.compilerOptions.declarationDir)));
@@ -45875,7 +46072,7 @@ function loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, directo
45875
46072
  );
45876
46073
  }
45877
46074
  function loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, typesScopeOnly, cache, redirectedReference) {
45878
- const mode = state.features === 0 ? void 0 : state.features & 32 /* EsmMode */ ? 99 /* ESNext */ : 1 /* CommonJS */;
46075
+ const mode = state.features === 0 ? void 0 : state.features & 32 /* EsmMode */ || state.conditions.includes("import") ? 99 /* ESNext */ : 1 /* CommonJS */;
45879
46076
  const priorityExtensions = extensions & (1 /* TypeScript */ | 4 /* Declaration */);
45880
46077
  const secondaryExtensions = extensions & ~(1 /* TypeScript */ | 4 /* Declaration */);
45881
46078
  if (priorityExtensions) {
@@ -45953,8 +46150,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
45953
46150
  candidate,
45954
46151
  !nodeModulesDirectoryExists,
45955
46152
  state,
45956
- packageInfo.contents.packageJsonContent,
45957
- getVersionPathsOfPackageJsonInfo(packageInfo, state)
46153
+ packageInfo
45958
46154
  );
45959
46155
  return withPackageId(packageInfo, fromDirectory, state);
45960
46156
  }
@@ -45964,8 +46160,7 @@ function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, node
45964
46160
  candidate2,
45965
46161
  onlyRecordFailures,
45966
46162
  state2,
45967
- packageInfo && packageInfo.contents.packageJsonContent,
45968
- packageInfo && getVersionPathsOfPackageJsonInfo(packageInfo, state2)
46163
+ packageInfo
45969
46164
  );
45970
46165
  if (!pathAndExtension && packageInfo && (packageInfo.contents.packageJsonContent.exports === void 0 || packageInfo.contents.packageJsonContent.exports === null) && state2.features & 32 /* EsmMode */) {
45971
46166
  pathAndExtension = loadModuleFromFile(extensions2, combinePaths(candidate2, "index.js"), onlyRecordFailures, state2);
@@ -46413,6 +46608,7 @@ function createBinder() {
46413
46608
  var preSwitchCaseFlow;
46414
46609
  var activeLabelList;
46415
46610
  var hasExplicitReturn;
46611
+ var inReturnPosition;
46416
46612
  var hasFlowEffects;
46417
46613
  var emitFlags;
46418
46614
  var inStrictMode;
@@ -46485,6 +46681,7 @@ function createBinder() {
46485
46681
  currentExceptionTarget = void 0;
46486
46682
  activeLabelList = void 0;
46487
46683
  hasExplicitReturn = false;
46684
+ inReturnPosition = false;
46488
46685
  hasFlowEffects = false;
46489
46686
  inAssignmentPattern = false;
46490
46687
  emitFlags = 0 /* None */;
@@ -46721,6 +46918,8 @@ function createBinder() {
46721
46918
  const saveContainer = container;
46722
46919
  const saveThisParentContainer = thisParentContainer;
46723
46920
  const savedBlockScopeContainer = blockScopeContainer;
46921
+ const savedInReturnPosition = inReturnPosition;
46922
+ if (node.kind === 219 /* ArrowFunction */ && node.body.kind !== 241 /* Block */) inReturnPosition = true;
46724
46923
  if (containerFlags & 1 /* IsContainer */) {
46725
46924
  if (node.kind !== 219 /* ArrowFunction */) {
46726
46925
  thisParentContainer = container;
@@ -46798,6 +46997,7 @@ function createBinder() {
46798
46997
  } else {
46799
46998
  bindChildren(node);
46800
46999
  }
47000
+ inReturnPosition = savedInReturnPosition;
46801
47001
  container = saveContainer;
46802
47002
  thisParentContainer = saveThisParentContainer;
46803
47003
  blockScopeContainer = savedBlockScopeContainer;
@@ -46819,6 +47019,9 @@ function createBinder() {
46819
47019
  const saveInAssignmentPattern = inAssignmentPattern;
46820
47020
  inAssignmentPattern = false;
46821
47021
  if (checkUnreachable(node)) {
47022
+ if (canHaveFlowNode(node) && node.flowNode) {
47023
+ node.flowNode = void 0;
47024
+ }
46822
47025
  bindEachChild(node);
46823
47026
  bindJSDoc(node);
46824
47027
  inAssignmentPattern = saveInAssignmentPattern;
@@ -47014,7 +47217,9 @@ function createBinder() {
47014
47217
  case 36 /* ExclamationEqualsToken */:
47015
47218
  case 37 /* EqualsEqualsEqualsToken */:
47016
47219
  case 38 /* ExclamationEqualsEqualsToken */:
47017
- return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) || isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right) || (isBooleanLiteral(expr.right) && isNarrowingExpression(expr.left) || isBooleanLiteral(expr.left) && isNarrowingExpression(expr.right));
47220
+ const left = skipParentheses(expr.left);
47221
+ const right = skipParentheses(expr.right);
47222
+ return isNarrowableOperand(left) || isNarrowableOperand(right) || isNarrowingTypeofOperands(right, left) || isNarrowingTypeofOperands(left, right) || (isBooleanLiteral(right) && isNarrowingExpression(left) || isBooleanLiteral(left) && isNarrowingExpression(right));
47018
47223
  case 104 /* InstanceOfKeyword */:
47019
47224
  return isNarrowableOperand(expr.left);
47020
47225
  case 103 /* InKeyword */:
@@ -47206,13 +47411,16 @@ function createBinder() {
47206
47411
  function bindForStatement(node) {
47207
47412
  const preLoopLabel = setContinueTarget(node, createLoopLabel());
47208
47413
  const preBodyLabel = createBranchLabel();
47414
+ const preIncrementorLabel = createBranchLabel();
47209
47415
  const postLoopLabel = createBranchLabel();
47210
47416
  bind(node.initializer);
47211
47417
  addAntecedent(preLoopLabel, currentFlow);
47212
47418
  currentFlow = preLoopLabel;
47213
47419
  bindCondition(node.condition, preBodyLabel, postLoopLabel);
47214
47420
  currentFlow = finishFlowLabel(preBodyLabel);
47215
- bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);
47421
+ bindIterativeStatement(node.statement, postLoopLabel, preIncrementorLabel);
47422
+ addAntecedent(preIncrementorLabel, currentFlow);
47423
+ currentFlow = finishFlowLabel(preIncrementorLabel);
47216
47424
  bind(node.incrementor);
47217
47425
  addAntecedent(preLoopLabel, currentFlow);
47218
47426
  currentFlow = finishFlowLabel(postLoopLabel);
@@ -47249,7 +47457,10 @@ function createBinder() {
47249
47457
  currentFlow = finishFlowLabel(postIfLabel);
47250
47458
  }
47251
47459
  function bindReturnOrThrow(node) {
47460
+ const savedInReturnPosition = inReturnPosition;
47461
+ inReturnPosition = true;
47252
47462
  bind(node.expression);
47463
+ inReturnPosition = savedInReturnPosition;
47253
47464
  if (node.kind === 253 /* ReturnStatement */) {
47254
47465
  hasExplicitReturn = true;
47255
47466
  if (currentReturnTarget) {
@@ -47610,10 +47821,16 @@ function createBinder() {
47610
47821
  hasFlowEffects = false;
47611
47822
  bindCondition(node.condition, trueLabel, falseLabel);
47612
47823
  currentFlow = finishFlowLabel(trueLabel);
47824
+ if (inReturnPosition) {
47825
+ node.flowNodeWhenTrue = currentFlow;
47826
+ }
47613
47827
  bind(node.questionToken);
47614
47828
  bind(node.whenTrue);
47615
47829
  addAntecedent(postExpressionLabel, currentFlow);
47616
47830
  currentFlow = finishFlowLabel(falseLabel);
47831
+ if (inReturnPosition) {
47832
+ node.flowNodeWhenFalse = currentFlow;
47833
+ }
47617
47834
  bind(node.colonToken);
47618
47835
  bind(node.whenFalse);
47619
47836
  addAntecedent(postExpressionLabel, currentFlow);
@@ -50770,8 +50987,8 @@ function createTypeChecker(host) {
50770
50987
  writeSignature: (signature, enclosingDeclaration, flags, kind, writer) => {
50771
50988
  return signatureToString(signature, getParseTreeNode(enclosingDeclaration), flags, kind, writer);
50772
50989
  },
50773
- writeType: (type, enclosingDeclaration, flags, writer) => {
50774
- return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer);
50990
+ writeType: (type, enclosingDeclaration, flags, writer, verbosityLevel, out) => {
50991
+ return typeToString(type, getParseTreeNode(enclosingDeclaration), flags, writer, verbosityLevel, out);
50775
50992
  },
50776
50993
  writeSymbol: (symbol, enclosingDeclaration, meaning, flags, writer) => {
50777
50994
  return symbolToString(symbol, getParseTreeNode(enclosingDeclaration), meaning, flags, writer);
@@ -50887,6 +51104,7 @@ function createTypeChecker(host) {
50887
51104
  getNumberLiteralType,
50888
51105
  getBigIntType: () => bigintType,
50889
51106
  getBigIntLiteralType,
51107
+ getUnknownType: () => unknownType,
50890
51108
  createPromiseType,
50891
51109
  createArrayType,
50892
51110
  getElementTypeOfArrayType,
@@ -51003,8 +51221,13 @@ function createTypeChecker(host) {
51003
51221
  getMemberOverrideModifierStatus,
51004
51222
  isTypeParameterPossiblyReferenced,
51005
51223
  typeHasCallOrConstructSignatures,
51006
- getSymbolFlags
51224
+ getSymbolFlags,
51225
+ getTypeArgumentsForResolvedSignature
51007
51226
  };
51227
+ function getTypeArgumentsForResolvedSignature(signature) {
51228
+ if (signature.mapper === void 0) return void 0;
51229
+ return instantiateTypes((signature.target || signature).typeParameters, signature.mapper);
51230
+ }
51008
51231
  function getCandidateSignaturesForStringLiteralCompletions(call, editingArgument) {
51009
51232
  const candidatesSet = /* @__PURE__ */ new Set();
51010
51233
  const candidates = [];
@@ -51563,6 +51786,7 @@ function createTypeChecker(host) {
51563
51786
  [".jsx", ".jsx"],
51564
51787
  [".json", ".json"]
51565
51788
  ];
51789
+ var narrowableReturnTypeCache = /* @__PURE__ */ new Map();
51566
51790
  initializeTypeChecker();
51567
51791
  return checker;
51568
51792
  function isDefinitelyReferenceToGlobalSymbolObject(node) {
@@ -52426,9 +52650,9 @@ function createTypeChecker(host) {
52426
52650
  const containerKind = grandparent.parent.kind;
52427
52651
  if (containerKind === 264 /* InterfaceDeclaration */ && heritageKind === 96 /* ExtendsKeyword */) {
52428
52652
  error2(errorLocation, Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_It_can_only_extend_other_named_object_types, unescapeLeadingUnderscores(name));
52429
- } else if (containerKind === 263 /* ClassDeclaration */ && heritageKind === 96 /* ExtendsKeyword */) {
52653
+ } else if (isClassLike(grandparent.parent) && heritageKind === 96 /* ExtendsKeyword */) {
52430
52654
  error2(errorLocation, Diagnostics.A_class_cannot_extend_a_primitive_type_like_0_Classes_can_only_extend_constructable_values, unescapeLeadingUnderscores(name));
52431
- } else if (containerKind === 263 /* ClassDeclaration */ && heritageKind === 119 /* ImplementsKeyword */) {
52655
+ } else if (isClassLike(grandparent.parent) && heritageKind === 119 /* ImplementsKeyword */) {
52432
52656
  error2(errorLocation, Diagnostics.A_class_cannot_implement_a_primitive_type_like_0_It_can_only_implement_other_named_object_types, unescapeLeadingUnderscores(name));
52433
52657
  }
52434
52658
  } else {
@@ -53604,7 +53828,7 @@ function createTypeChecker(host) {
53604
53828
  moduleReference
53605
53829
  );
53606
53830
  }
53607
- if (errorNode && (moduleResolutionKind === 3 /* Node16 */ || moduleResolutionKind === 99 /* NodeNext */)) {
53831
+ if (errorNode && (moduleKind === 100 /* Node16 */ || moduleKind === 101 /* Node18 */)) {
53608
53832
  const isSyncImport = currentSourceFile.impliedNodeFormat === 1 /* CommonJS */ && !findAncestor(location, isImportCall) || !!findAncestor(location, isImportEqualsDeclaration);
53609
53833
  const overrideHost = findAncestor(location, (l) => isImportTypeNode(l) || isExportDeclaration(l) || isImportDeclaration(l) || isJSDocImportTag(l));
53610
53834
  if (isSyncImport && sourceFile.impliedNodeFormat === 99 /* ESNext */ && !hasResolutionModeOverride(overrideHost)) {
@@ -54698,14 +54922,18 @@ function createTypeChecker(host) {
54698
54922
  return writer2;
54699
54923
  }
54700
54924
  }
54701
- function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter("")) {
54702
- const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */;
54925
+ function typeToString(type, enclosingDeclaration, flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer = createTextWriter(""), verbosityLevel, out) {
54926
+ const noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */ || verbosityLevel !== void 0;
54703
54927
  const typeNode = nodeBuilder.typeToTypeNode(
54704
54928
  type,
54705
54929
  enclosingDeclaration,
54706
- toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0 /* None */),
54930
+ toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0),
54707
54931
  /*internalFlags*/
54708
- void 0
54932
+ void 0,
54933
+ /*tracker*/
54934
+ void 0,
54935
+ verbosityLevel,
54936
+ out
54709
54937
  );
54710
54938
  if (typeNode === void 0) return Debug.fail("should always get typenode");
54711
54939
  const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
@@ -54845,12 +55073,7 @@ function createTypeChecker(host) {
54845
55073
  enterNewScope(context, node) {
54846
55074
  if (isFunctionLike(node) || isJSDocSignature(node)) {
54847
55075
  const signature = getSignatureFromDeclaration(node);
54848
- const expandedParams = getExpandedParameters(
54849
- signature,
54850
- /*skipUnionExpanding*/
54851
- true
54852
- )[0];
54853
- return enterNewScope(context, node, expandedParams, signature.typeParameters);
55076
+ return enterNewScope(context, node, signature.parameters, signature.typeParameters);
54854
55077
  } else {
54855
55078
  const typeParameters = isConditionalTypeNode(node) ? getInferTypeParameters(node) : [getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node.typeParameter))];
54856
55079
  return enterNewScope(
@@ -54937,31 +55160,127 @@ function createTypeChecker(host) {
54937
55160
  };
54938
55161
  return {
54939
55162
  syntacticBuilderResolver,
54940
- typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeToTypeNodeHelper(type, context)),
54941
- typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
54942
- serializeTypeForExpression: (expr, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => syntacticNodeBuilder.serializeTypeOfExpression(expr, context)),
54943
- serializeTypeForDeclaration: (declaration, symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, symbol, context)),
54944
- serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => syntacticNodeBuilder.serializeReturnTypeForSignature(signature, getSymbolOfDeclaration(signature), context)),
54945
- indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
54946
- indexInfo,
54947
- context,
54948
- /*typeNode*/
54949
- void 0
54950
- )),
54951
- signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => signatureToSignatureDeclarationHelper(signature, kind, context)),
54952
- symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToName(
54953
- symbol,
54954
- context,
54955
- meaning,
54956
- /*expectsIdentifier*/
54957
- false
54958
- )),
54959
- symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToExpression(symbol, context, meaning)),
54960
- symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParametersToTypeParameterDeclarations(symbol, context)),
54961
- symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToParameterDeclaration(symbol, context)),
54962
- typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => typeParameterToDeclaration(parameter, context)),
54963
- symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
54964
- symbolToNode: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, (context) => symbolToNode(symbol, context, meaning))
55163
+ typeToTypeNode: (type, enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, out) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, (context) => typeToTypeNodeHelper(type, context), out),
55164
+ typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
55165
+ enclosingDeclaration,
55166
+ flags,
55167
+ internalFlags,
55168
+ tracker,
55169
+ /*verbosityLevel*/
55170
+ void 0,
55171
+ (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)
55172
+ ),
55173
+ serializeTypeForDeclaration: (declaration, symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
55174
+ enclosingDeclaration,
55175
+ flags,
55176
+ internalFlags,
55177
+ tracker,
55178
+ /*verbosityLevel*/
55179
+ void 0,
55180
+ (context) => syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, symbol, context)
55181
+ ),
55182
+ serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
55183
+ enclosingDeclaration,
55184
+ flags,
55185
+ internalFlags,
55186
+ tracker,
55187
+ /*verbosityLevel*/
55188
+ void 0,
55189
+ (context) => syntacticNodeBuilder.serializeReturnTypeForSignature(signature, getSymbolOfDeclaration(signature), context)
55190
+ ),
55191
+ serializeTypeForExpression: (expr, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
55192
+ enclosingDeclaration,
55193
+ flags,
55194
+ internalFlags,
55195
+ tracker,
55196
+ /*verbosityLevel*/
55197
+ void 0,
55198
+ (context) => syntacticNodeBuilder.serializeTypeOfExpression(expr, context)
55199
+ ),
55200
+ indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
55201
+ enclosingDeclaration,
55202
+ flags,
55203
+ internalFlags,
55204
+ tracker,
55205
+ /*verbosityLevel*/
55206
+ void 0,
55207
+ (context) => indexInfoToIndexSignatureDeclarationHelper(
55208
+ indexInfo,
55209
+ context,
55210
+ /*typeNode*/
55211
+ void 0
55212
+ )
55213
+ ),
55214
+ signatureToSignatureDeclaration: (signature, kind, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
55215
+ enclosingDeclaration,
55216
+ flags,
55217
+ internalFlags,
55218
+ tracker,
55219
+ /*verbosityLevel*/
55220
+ void 0,
55221
+ (context) => signatureToSignatureDeclarationHelper(signature, kind, context)
55222
+ ),
55223
+ symbolToEntityName: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
55224
+ enclosingDeclaration,
55225
+ flags,
55226
+ internalFlags,
55227
+ tracker,
55228
+ /*verbosityLevel*/
55229
+ void 0,
55230
+ (context) => symbolToName(
55231
+ symbol,
55232
+ context,
55233
+ meaning,
55234
+ /*expectsIdentifier*/
55235
+ false
55236
+ )
55237
+ ),
55238
+ symbolToExpression: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
55239
+ enclosingDeclaration,
55240
+ flags,
55241
+ internalFlags,
55242
+ tracker,
55243
+ /*verbosityLevel*/
55244
+ void 0,
55245
+ (context) => symbolToExpression(symbol, context, meaning)
55246
+ ),
55247
+ symbolToTypeParameterDeclarations: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
55248
+ enclosingDeclaration,
55249
+ flags,
55250
+ internalFlags,
55251
+ tracker,
55252
+ /*verbosityLevel*/
55253
+ void 0,
55254
+ (context) => typeParametersToTypeParameterDeclarations(symbol, context)
55255
+ ),
55256
+ symbolToParameterDeclaration: (symbol, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
55257
+ enclosingDeclaration,
55258
+ flags,
55259
+ internalFlags,
55260
+ tracker,
55261
+ /*verbosityLevel*/
55262
+ void 0,
55263
+ (context) => symbolToParameterDeclaration(symbol, context)
55264
+ ),
55265
+ typeParameterToDeclaration: (parameter, enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel) => withContext2(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, (context) => typeParameterToDeclaration(parameter, context)),
55266
+ symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
55267
+ enclosingDeclaration,
55268
+ flags,
55269
+ internalFlags,
55270
+ tracker,
55271
+ /*verbosityLevel*/
55272
+ void 0,
55273
+ (context) => symbolTableToDeclarationStatements(symbolTable, context)
55274
+ ),
55275
+ symbolToNode: (symbol, meaning, enclosingDeclaration, flags, internalFlags, tracker) => withContext2(
55276
+ enclosingDeclaration,
55277
+ flags,
55278
+ internalFlags,
55279
+ tracker,
55280
+ /*verbosityLevel*/
55281
+ void 0,
55282
+ (context) => symbolToNode(symbol, context, meaning)
55283
+ )
54965
55284
  };
54966
55285
  function getTypeFromTypeNode2(context, node, noMappedTypes) {
54967
55286
  const type = getTypeFromTypeNodeWithoutContext(node);
@@ -55003,7 +55322,7 @@ function createTypeChecker(host) {
55003
55322
  }
55004
55323
  return symbolToExpression(symbol, context, meaning);
55005
55324
  }
55006
- function withContext2(enclosingDeclaration, flags, internalFlags, tracker, cb) {
55325
+ function withContext2(enclosingDeclaration, flags, internalFlags, tracker, verbosityLevel, cb, out) {
55007
55326
  const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : (internalFlags || 0 /* None */) & 4 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
55008
55327
  const context = {
55009
55328
  enclosingDeclaration,
@@ -55011,6 +55330,7 @@ function createTypeChecker(host) {
55011
55330
  flags: flags || 0 /* None */,
55012
55331
  internalFlags: internalFlags || 0 /* None */,
55013
55332
  tracker: void 0,
55333
+ unfoldDepth: verbosityLevel ?? -1,
55014
55334
  encounteredError: false,
55015
55335
  suppressReportInferenceFallback: false,
55016
55336
  reportedDiagnostic: false,
@@ -55032,13 +55352,18 @@ function createTypeChecker(host) {
55032
55352
  typeParameterNamesByText: void 0,
55033
55353
  typeParameterNamesByTextNextNameCount: void 0,
55034
55354
  enclosingSymbolTypes: /* @__PURE__ */ new Map(),
55035
- mapper: void 0
55355
+ mapper: void 0,
55356
+ depth: 0,
55357
+ couldUnfoldMore: false
55036
55358
  };
55037
55359
  context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
55038
55360
  const resultingNode = cb(context);
55039
55361
  if (context.truncating && context.flags & 1 /* NoTruncation */) {
55040
55362
  context.tracker.reportTruncationError();
55041
55363
  }
55364
+ if (out) {
55365
+ out.couldUnfoldMore = context.couldUnfoldMore;
55366
+ }
55042
55367
  return context.encounteredError ? void 0 : resultingNode;
55043
55368
  }
55044
55369
  function addSymbolTypeToContext(context, symbol, type) {
@@ -55057,16 +55382,36 @@ function createTypeChecker(host) {
55057
55382
  function saveRestoreFlags(context) {
55058
55383
  const flags = context.flags;
55059
55384
  const internalFlags = context.internalFlags;
55385
+ const depth = context.depth;
55060
55386
  return restore;
55061
55387
  function restore() {
55062
55388
  context.flags = flags;
55063
55389
  context.internalFlags = internalFlags;
55390
+ context.depth = depth;
55064
55391
  }
55065
55392
  }
55066
55393
  function checkTruncationLength(context) {
55067
55394
  if (context.truncating) return context.truncating;
55068
55395
  return context.truncating = context.approximateLength > (context.flags & 1 /* NoTruncation */ ? noTruncationMaximumTruncationLength : defaultMaximumTruncationLength);
55069
55396
  }
55397
+ function couldUnfoldType(type, context) {
55398
+ var _a;
55399
+ if ((_a = context.visitedTypes) == null ? void 0 : _a.has(type.id)) {
55400
+ return false;
55401
+ }
55402
+ return context.depth < context.unfoldDepth || context.depth === context.unfoldDepth && !context.couldUnfoldMore;
55403
+ }
55404
+ function canUnfoldType(type, context) {
55405
+ var _a;
55406
+ if ((_a = context.visitedTypes) == null ? void 0 : _a.has(type.id)) {
55407
+ return false;
55408
+ }
55409
+ const result = context.depth < context.unfoldDepth;
55410
+ if (!result) {
55411
+ context.couldUnfoldMore = true;
55412
+ }
55413
+ return result;
55414
+ }
55070
55415
  function typeToTypeNodeHelper(type, context) {
55071
55416
  const restoreFlags = saveRestoreFlags(context);
55072
55417
  const typeNode = typeToTypeNodeWorker(type, context);
@@ -55214,16 +55559,27 @@ function createTypeChecker(host) {
55214
55559
  return factory.createThisTypeNode();
55215
55560
  }
55216
55561
  if (!inTypeAlias && type.aliasSymbol && (context.flags & 16384 /* UseAliasDefinedOutsideCurrentScope */ || isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration))) {
55217
- const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
55218
- if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32 /* Class */)) return factory.createTypeReferenceNode(factory.createIdentifier(""), typeArgumentNodes);
55219
- if (length(typeArgumentNodes) === 1 && type.aliasSymbol === globalArrayType.symbol) {
55220
- return factory.createArrayTypeNode(typeArgumentNodes[0]);
55562
+ if (!canUnfoldType(type, context)) {
55563
+ const typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context);
55564
+ if (isReservedMemberName(type.aliasSymbol.escapedName) && !(type.aliasSymbol.flags & 32 /* Class */)) return factory.createTypeReferenceNode(factory.createIdentifier(""), typeArgumentNodes);
55565
+ if (length(typeArgumentNodes) === 1 && type.aliasSymbol === globalArrayType.symbol) {
55566
+ return factory.createArrayTypeNode(typeArgumentNodes[0]);
55567
+ }
55568
+ return symbolToTypeNode(type.aliasSymbol, context, 788968 /* Type */, typeArgumentNodes);
55221
55569
  }
55222
- return symbolToTypeNode(type.aliasSymbol, context, 788968 /* Type */, typeArgumentNodes);
55570
+ context.depth += 1;
55223
55571
  }
55224
55572
  const objectFlags = getObjectFlags(type);
55225
55573
  if (objectFlags & 4 /* Reference */) {
55226
55574
  Debug.assert(!!(type.flags & 524288 /* Object */));
55575
+ if (canUnfoldType(type, context)) {
55576
+ context.depth += 1;
55577
+ return createAnonymousTypeNode(
55578
+ type,
55579
+ /*forceClassExpansion*/
55580
+ true
55581
+ );
55582
+ }
55227
55583
  return type.node ? visitAndTransformType(type, typeReferenceToTypeNode) : typeReferenceToTypeNode(type);
55228
55584
  }
55229
55585
  if (type.flags & 262144 /* TypeParameter */ || objectFlags & 3 /* ClassOrInterface */) {
@@ -55253,6 +55609,14 @@ function createTypeChecker(host) {
55253
55609
  void 0
55254
55610
  );
55255
55611
  }
55612
+ if (objectFlags & 3 /* ClassOrInterface */ && canUnfoldType(type, context)) {
55613
+ context.depth += 1;
55614
+ return createAnonymousTypeNode(
55615
+ type,
55616
+ /*forceClassExpansion*/
55617
+ true
55618
+ );
55619
+ }
55256
55620
  if (type.symbol) {
55257
55621
  return symbolToTypeNode(type.symbol, context, 788968 /* Type */);
55258
55622
  }
@@ -55456,7 +55820,7 @@ function createTypeChecker(host) {
55456
55820
  }
55457
55821
  return result;
55458
55822
  }
55459
- function createAnonymousTypeNode(type2) {
55823
+ function createAnonymousTypeNode(type2, forceClassExpansion = false) {
55460
55824
  var _a2, _b2;
55461
55825
  const typeId = type2.id;
55462
55826
  const symbol = type2.symbol;
@@ -55479,7 +55843,7 @@ function createTypeChecker(host) {
55479
55843
  const isInstanceType = isClassInstanceSide(type2) ? 788968 /* Type */ : 111551 /* Value */;
55480
55844
  if (isJSConstructor(symbol.valueDeclaration)) {
55481
55845
  return symbolToTypeNode(symbol, context, isInstanceType);
55482
- } else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration && isClassLike(symbol.valueDeclaration) && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ && (!isClassDeclaration(symbol.valueDeclaration) || isSymbolAccessible(
55846
+ } else if (symbol.flags & 32 /* Class */ && !forceClassExpansion && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration && isClassLike(symbol.valueDeclaration) && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */ && (!isClassDeclaration(symbol.valueDeclaration) || isSymbolAccessible(
55483
55847
  symbol,
55484
55848
  context.enclosingDeclaration,
55485
55849
  isInstanceType,
@@ -55503,7 +55867,7 @@ function createTypeChecker(host) {
55503
55867
  function shouldWriteTypeOfFunctionSymbol() {
55504
55868
  var _a3;
55505
55869
  const isStaticMethodSymbol = !!(symbol.flags & 8192 /* Method */) && // typeof static method
55506
- some(symbol.declarations, (declaration) => isStatic(declaration));
55870
+ some(symbol.declarations, (declaration) => isStatic(declaration) && !isLateBindableIndexSignature(getNameOfDeclaration(declaration)));
55507
55871
  const isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) && (symbol.parent || // is exported function symbol
55508
55872
  forEach(symbol.declarations, (declaration) => declaration.parent.kind === 307 /* SourceFile */ || declaration.parent.kind === 268 /* ModuleBlock */));
55509
55873
  if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
@@ -55523,7 +55887,7 @@ function createTypeChecker(host) {
55523
55887
  if (id && !context.symbolDepth) {
55524
55888
  context.symbolDepth = /* @__PURE__ */ new Map();
55525
55889
  }
55526
- const links = context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
55890
+ const links = context.unfoldDepth >= 0 ? void 0 : context.enclosingDeclaration && getNodeLinks(context.enclosingDeclaration);
55527
55891
  const key = `${getTypeId(type2)}|${context.flags}|${context.internalFlags}`;
55528
55892
  if (links) {
55529
55893
  links.serializedTypes || (links.serializedTypes = /* @__PURE__ */ new Map());
@@ -55806,6 +56170,38 @@ function createTypeChecker(host) {
55806
56170
  ids.unshift(state);
55807
56171
  return ids;
55808
56172
  }
56173
+ function indexInfoToObjectComputedNamesOrSignatureDeclaration(indexInfo, context2, typeNode) {
56174
+ if (indexInfo.components) {
56175
+ const allComponentComputedNamesSerializable = every(indexInfo.components, (e) => {
56176
+ var _a2;
56177
+ return !!(e.name && isComputedPropertyName(e.name) && isEntityNameExpression(e.name.expression) && context2.enclosingDeclaration && ((_a2 = isEntityNameVisible(
56178
+ e.name.expression,
56179
+ context2.enclosingDeclaration,
56180
+ /*shouldComputeAliasToMakeVisible*/
56181
+ false
56182
+ )) == null ? void 0 : _a2.accessibility) === 0 /* Accessible */);
56183
+ });
56184
+ if (allComponentComputedNamesSerializable) {
56185
+ const newComponents = filter(indexInfo.components, (e) => {
56186
+ return !hasLateBindableName(e);
56187
+ });
56188
+ return map(newComponents, (e) => {
56189
+ trackComputedName(e.name.expression, context2.enclosingDeclaration, context2);
56190
+ return setTextRange2(
56191
+ context2,
56192
+ factory.createPropertySignature(
56193
+ indexInfo.isReadonly ? [factory.createModifier(148 /* ReadonlyKeyword */)] : void 0,
56194
+ e.name,
56195
+ (isPropertySignature(e) || isPropertyDeclaration(e) || isMethodSignature(e) || isMethodDeclaration(e) || isGetAccessor(e) || isSetAccessor(e)) && e.questionToken ? factory.createToken(58 /* QuestionToken */) : void 0,
56196
+ typeNode || typeToTypeNodeHelper(getTypeOfSymbol(e.symbol), context2)
56197
+ ),
56198
+ e
56199
+ );
56200
+ });
56201
+ }
56202
+ }
56203
+ return [indexInfoToIndexSignatureDeclarationHelper(indexInfo, context2, typeNode)];
56204
+ }
55809
56205
  function createTypeNodesFromResolvedType(resolvedType) {
55810
56206
  if (checkTruncationLength(context)) {
55811
56207
  if (context.flags & 1 /* NoTruncation */) {
@@ -55830,7 +56226,7 @@ function createTypeChecker(host) {
55830
56226
  typeElements.push(signatureToSignatureDeclarationHelper(signature, 180 /* ConstructSignature */, context));
55831
56227
  }
55832
56228
  for (const info of resolvedType.indexInfos) {
55833
- typeElements.push(indexInfoToIndexSignatureDeclarationHelper(info, context, resolvedType.objectFlags & 1024 /* ReverseMapped */ ? createElidedInformationPlaceholder(context) : void 0));
56229
+ typeElements.push(...indexInfoToObjectComputedNamesOrSignatureDeclaration(info, context, resolvedType.objectFlags & 1024 /* ReverseMapped */ ? createElidedInformationPlaceholder(context) : void 0));
55834
56230
  }
55835
56231
  const properties = resolvedType.properties;
55836
56232
  if (!properties) {
@@ -56438,7 +56834,7 @@ function createTypeChecker(host) {
56438
56834
  return factory.createTypeParameterDeclaration(modifiers, name, constraintNode, defaultParameterNode);
56439
56835
  }
56440
56836
  function typeToTypeNodeHelperWithPossibleReusableTypeNode(type, typeNode, context) {
56441
- return typeNode && getTypeFromTypeNode2(context, typeNode) === type && syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode) || typeToTypeNodeHelper(type, context);
56837
+ return !couldUnfoldType(type, context) && typeNode && getTypeFromTypeNode2(context, typeNode) === type && syntacticNodeBuilder.tryReuseExistingTypeNode(context, typeNode) || typeToTypeNodeHelper(type, context);
56442
56838
  }
56443
56839
  function typeParameterToDeclaration(type, context, constraint = getConstraintOfTypeParameter(type)) {
56444
56840
  const constraintNode = constraint && typeToTypeNodeHelperWithPossibleReusableTypeNode(constraint, getConstraintDeclaration(type), context);
@@ -56519,7 +56915,7 @@ function createTypeChecker(host) {
56519
56915
  if (!context.tracker.canTrackSymbol) return;
56520
56916
  const firstIdentifier = getFirstIdentifier(accessExpression);
56521
56917
  const name = resolveName(
56522
- firstIdentifier,
56918
+ enclosingDeclaration,
56523
56919
  firstIdentifier.escapedText,
56524
56920
  111551 /* Value */ | 1048576 /* ExportValue */,
56525
56921
  /*nameNotFoundMessage*/
@@ -56529,6 +56925,19 @@ function createTypeChecker(host) {
56529
56925
  );
56530
56926
  if (name) {
56531
56927
  context.tracker.trackSymbol(name, enclosingDeclaration, 111551 /* Value */);
56928
+ } else {
56929
+ const fallback = resolveName(
56930
+ firstIdentifier,
56931
+ firstIdentifier.escapedText,
56932
+ 111551 /* Value */ | 1048576 /* ExportValue */,
56933
+ /*nameNotFoundMessage*/
56934
+ void 0,
56935
+ /*isUse*/
56936
+ true
56937
+ );
56938
+ if (fallback) {
56939
+ context.tracker.trackSymbol(fallback, enclosingDeclaration, 111551 /* Value */);
56940
+ }
56532
56941
  }
56533
56942
  }
56534
56943
  function lookupSymbolChain(symbol, context, meaning, yieldModuleSymbol) {
@@ -57072,7 +57481,7 @@ function createTypeChecker(host) {
57072
57481
  let result;
57073
57482
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
57074
57483
  const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
57075
- if (decl) {
57484
+ if (!couldUnfoldType(type, context) && decl) {
57076
57485
  if (isAccessor(decl)) {
57077
57486
  result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
57078
57487
  } else if (hasInferredType(decl) && !nodeIsSynthesized(decl) && !(getObjectFlags(type) & 196608 /* RequiresWidening */)) {
@@ -63343,8 +63752,8 @@ function createTypeChecker(host) {
63343
63752
  function getIndexSymbolFromSymbolTable(symbolTable) {
63344
63753
  return symbolTable.get("__index" /* Index */);
63345
63754
  }
63346
- function createIndexInfo(keyType, type, isReadonly, declaration) {
63347
- return { keyType, type, isReadonly, declaration };
63755
+ function createIndexInfo(keyType, type, isReadonly, declaration, components) {
63756
+ return { keyType, type, isReadonly, declaration, components };
63348
63757
  }
63349
63758
  function getIndexInfosOfSymbol(symbol) {
63350
63759
  const indexSymbol = getIndexSymbol(symbol);
@@ -63784,11 +64193,14 @@ function createTypeChecker(host) {
63784
64193
  function isNoInferType(type) {
63785
64194
  return !!(type.flags & 33554432 /* Substitution */ && type.constraint.flags & 2 /* Unknown */);
63786
64195
  }
63787
- function getSubstitutionType(baseType, constraint) {
63788
- return constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */ ? baseType : getOrCreateSubstitutionType(baseType, constraint);
64196
+ function isNarrowingSubstitutionType(type) {
64197
+ return !!(type.flags & 33554432 /* Substitution */ && type.objectFlags & 16777216 /* IsNarrowingType */);
63789
64198
  }
63790
- function getOrCreateSubstitutionType(baseType, constraint) {
63791
- const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
64199
+ function getSubstitutionType(baseType, constraint, isNarrowed) {
64200
+ return constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */ ? baseType : getOrCreateSubstitutionType(baseType, constraint, isNarrowed);
64201
+ }
64202
+ function getOrCreateSubstitutionType(baseType, constraint, isNarrowed) {
64203
+ const id = `${getTypeId(baseType)}>${getTypeId(constraint)}${isNarrowed ? ">N" : ""}`;
63792
64204
  const cached = substitutionTypes.get(id);
63793
64205
  if (cached) {
63794
64206
  return cached;
@@ -63796,6 +64208,9 @@ function createTypeChecker(host) {
63796
64208
  const result = createType(33554432 /* Substitution */);
63797
64209
  result.baseType = baseType;
63798
64210
  result.constraint = constraint;
64211
+ if (isNarrowed) {
64212
+ result.objectFlags |= 16777216 /* IsNarrowingType */;
64213
+ }
63799
64214
  substitutionTypes.set(id, result);
63800
64215
  return result;
63801
64216
  }
@@ -63857,6 +64272,9 @@ function createTypeChecker(host) {
63857
64272
  case "Number":
63858
64273
  checkNoTypeArguments(node);
63859
64274
  return numberType;
64275
+ case "BigInt":
64276
+ checkNoTypeArguments(node);
64277
+ return bigintType;
63860
64278
  case "Boolean":
63861
64279
  checkNoTypeArguments(node);
63862
64280
  return booleanType;
@@ -65998,7 +66416,7 @@ function createTypeChecker(host) {
65998
66416
  function isDeferredType(type, checkTuples) {
65999
66417
  return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
66000
66418
  }
66001
- function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
66419
+ function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments, forNarrowing) {
66002
66420
  let result;
66003
66421
  let extraTypes;
66004
66422
  let tailCount = 0;
@@ -66015,10 +66433,11 @@ function createTypeChecker(host) {
66015
66433
  if (checkType === wildcardType || extendsType === wildcardType) {
66016
66434
  return wildcardType;
66017
66435
  }
66436
+ const effectiveCheckType = forNarrowing && isNarrowingSubstitutionType(checkType) ? checkType.constraint : checkType;
66018
66437
  const checkTypeNode = skipTypeParentheses(root.node.checkType);
66019
66438
  const extendsTypeNode = skipTypeParentheses(root.node.extendsType);
66020
66439
  const checkTuples = isSimpleTupleType(checkTypeNode) && isSimpleTupleType(extendsTypeNode) && length(checkTypeNode.elements) === length(extendsTypeNode.elements);
66021
- const checkTypeDeferred = isDeferredType(checkType, checkTuples);
66440
+ const checkTypeDeferred = isDeferredType(effectiveCheckType, checkTuples);
66022
66441
  let combinedMapper;
66023
66442
  if (root.inferTypeParameters) {
66024
66443
  const context = createInferenceContext(
@@ -66037,8 +66456,8 @@ function createTypeChecker(host) {
66037
66456
  }
66038
66457
  const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
66039
66458
  if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
66040
- if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
66041
- if (checkType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) {
66459
+ if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (effectiveCheckType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(effectiveCheckType), getPermissiveInstantiation(inferredExtendsType)))) {
66460
+ if (effectiveCheckType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(effectiveCheckType)))) {
66042
66461
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
66043
66462
  }
66044
66463
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -66055,7 +66474,7 @@ function createTypeChecker(host) {
66055
66474
  result = instantiateType(falseType2, mapper);
66056
66475
  break;
66057
66476
  }
66058
- if (inferredExtendsType.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(inferredExtendsType))) {
66477
+ if (inferredExtendsType.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(effectiveCheckType), getRestrictiveInstantiation(inferredExtendsType))) {
66059
66478
  const trueType2 = getTypeFromTypeNode(root.node.trueType);
66060
66479
  const trueMapper = combinedMapper || mapper;
66061
66480
  if (canTailRecurse(trueType2, trueMapper)) {
@@ -66410,7 +66829,7 @@ function createTypeChecker(host) {
66410
66829
  return result;
66411
66830
  }
66412
66831
  function getIndexInfoWithReadonly(info, readonly) {
66413
- return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration) : info;
66832
+ return info.isReadonly !== readonly ? createIndexInfo(info.keyType, info.type, readonly, info.declaration, info.components) : info;
66414
66833
  }
66415
66834
  function createLiteralType(flags, value, symbol, regularType) {
66416
66835
  const type = createTypeWithSymbol(flags, symbol);
@@ -67021,8 +67440,39 @@ function createTypeChecker(host) {
67021
67440
  if (!result) {
67022
67441
  const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
67023
67442
  const checkType = root.checkType;
67024
- const distributionType = root.isDistributive ? getReducedType(getMappedType(checkType, newMapper)) : void 0;
67025
- result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(distributionType, (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments);
67443
+ let distributionType = root.isDistributive ? getReducedType(getMappedType(checkType, newMapper)) : void 0;
67444
+ let narrowingBaseType;
67445
+ const forNarrowing = distributionType && isNarrowingSubstitutionType(distributionType) && isNarrowableConditionalType(type, mapper);
67446
+ if (forNarrowing) {
67447
+ narrowingBaseType = distributionType.baseType;
67448
+ distributionType = getReducedType(distributionType.constraint);
67449
+ }
67450
+ if (distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */)) {
67451
+ if (narrowingBaseType) {
67452
+ result = mapTypeToIntersection(
67453
+ distributionType,
67454
+ (t) => getConditionalType(
67455
+ root,
67456
+ prependTypeMapping(checkType, getSubstitutionType(
67457
+ narrowingBaseType,
67458
+ t,
67459
+ /*isNarrowed*/
67460
+ true
67461
+ ), newMapper),
67462
+ forConstraint,
67463
+ /*aliasSymbol*/
67464
+ void 0,
67465
+ /*aliasTypeArguments*/
67466
+ void 0,
67467
+ forNarrowing
67468
+ )
67469
+ );
67470
+ } else {
67471
+ result = mapTypeWithAlias(distributionType, (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments);
67472
+ }
67473
+ } else {
67474
+ result = getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments, forNarrowing);
67475
+ }
67026
67476
  root.instantiations.set(id, result);
67027
67477
  }
67028
67478
  return result;
@@ -67169,7 +67619,7 @@ function createTypeChecker(host) {
67169
67619
  return type.restrictiveInstantiation;
67170
67620
  }
67171
67621
  function instantiateIndexInfo(info, mapper) {
67172
- return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration);
67622
+ return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration, info.components);
67173
67623
  }
67174
67624
  function isContextSensitive(node) {
67175
67625
  Debug.assert(node.kind !== 174 /* MethodDeclaration */ || isObjectLiteralMethod(node));
@@ -68165,10 +68615,12 @@ function createTypeChecker(host) {
68165
68615
  function shouldNormalizeIntersection(type) {
68166
68616
  let hasInstantiable = false;
68167
68617
  let hasNullableOrEmpty = false;
68618
+ let hasSubstitution = false;
68168
68619
  for (const t of type.types) {
68169
68620
  hasInstantiable || (hasInstantiable = !!(t.flags & 465829888 /* Instantiable */));
68170
68621
  hasNullableOrEmpty || (hasNullableOrEmpty = !!(t.flags & 98304 /* Nullable */) || isEmptyAnonymousObjectType(t));
68171
- if (hasInstantiable && hasNullableOrEmpty) return true;
68622
+ hasSubstitution || (hasSubstitution = isNarrowingSubstitutionType(t));
68623
+ if (hasInstantiable && hasNullableOrEmpty || hasSubstitution) return true;
68172
68624
  }
68173
68625
  return false;
68174
68626
  }
@@ -71300,7 +71752,7 @@ function createTypeChecker(host) {
71300
71752
  }
71301
71753
  }
71302
71754
  }
71303
- const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly)));
71755
+ const result = createAnonymousType(type.symbol, members, emptyArray, emptyArray, sameMap(getIndexInfosOfType(type), (info) => createIndexInfo(info.keyType, getWidenedType(info.type), info.isReadonly, info.declaration, info.components)));
71304
71756
  result.objectFlags |= getObjectFlags(type) & (4096 /* JSLiteral */ | 262144 /* NonInferrableType */);
71305
71757
  return result;
71306
71758
  }
@@ -72742,6 +73194,7 @@ function createTypeChecker(host) {
72742
73194
  return target.kind === 108 /* SuperKeyword */;
72743
73195
  case 235 /* NonNullExpression */:
72744
73196
  case 217 /* ParenthesizedExpression */:
73197
+ case 238 /* SatisfiesExpression */:
72745
73198
  return isMatchingReference(source.expression, target);
72746
73199
  case 211 /* PropertyAccessExpression */:
72747
73200
  case 212 /* ElementAccessExpression */:
@@ -73327,6 +73780,18 @@ function createTypeChecker(host) {
73327
73780
  }
73328
73781
  return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : type;
73329
73782
  }
73783
+ function mapTypeToIntersection(type, mapper) {
73784
+ if (type.flags & 131072 /* Never */) {
73785
+ return type;
73786
+ }
73787
+ if (!(type.flags & 1048576 /* Union */)) {
73788
+ return mapper(type);
73789
+ }
73790
+ const origin = type.origin;
73791
+ const types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
73792
+ const mappedTypes = types.map((t) => t.flags & 1048576 /* Union */ ? mapTypeToIntersection(t, mapper) : mapper(t));
73793
+ return getIntersectionType(mappedTypes);
73794
+ }
73330
73795
  function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
73331
73796
  return type.flags & 1048576 /* Union */ && aliasSymbol ? getUnionType(map(type.types, mapper), 1 /* Literal */, aliasSymbol, aliasTypeArguments) : mapType(type, mapper);
73332
73797
  }
@@ -74592,6 +75057,7 @@ function createTypeChecker(host) {
74592
75057
  if (checkDerived) {
74593
75058
  return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
74594
75059
  }
75060
+ type = type.flags & 2 /* Unknown */ ? unknownUnionType : type;
74595
75061
  const trueType2 = getNarrowedType(
74596
75062
  type,
74597
75063
  candidate,
@@ -74600,7 +75066,7 @@ function createTypeChecker(host) {
74600
75066
  /*checkDerived*/
74601
75067
  false
74602
75068
  );
74603
- return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
75069
+ return recombineUnknownType(filterType(type, (t) => !isTypeSubsetOf(t, trueType2)));
74604
75070
  }
74605
75071
  if (type.flags & 3 /* AnyOrUnknown */) {
74606
75072
  return candidate;
@@ -74698,6 +75164,7 @@ function createTypeChecker(host) {
74698
75164
  return narrowTypeByCallExpression(type, expr, assumeTrue);
74699
75165
  case 217 /* ParenthesizedExpression */:
74700
75166
  case 235 /* NonNullExpression */:
75167
+ case 238 /* SatisfiesExpression */:
74701
75168
  return narrowType(type, expr.expression, assumeTrue);
74702
75169
  case 226 /* BinaryExpression */:
74703
75170
  return narrowTypeByBinaryExpression(type, expr, assumeTrue);
@@ -74909,11 +75376,11 @@ function createTypeChecker(host) {
74909
75376
  ));
74910
75377
  return contextualType && !isGenericType(contextualType);
74911
75378
  }
74912
- function getNarrowableTypeForReference(type, reference, checkMode) {
75379
+ function getNarrowableTypeForReference(type, reference, checkMode, forReturnTypeNarrowing) {
74913
75380
  if (isNoInferType(type)) {
74914
75381
  type = type.baseType;
74915
75382
  }
74916
- const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
75383
+ const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (forReturnTypeNarrowing || isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
74917
75384
  return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
74918
75385
  }
74919
75386
  function isExportOrExportExpression(location) {
@@ -75081,8 +75548,9 @@ function createTypeChecker(host) {
75081
75548
  }
75082
75549
  if (isJsxOpeningFragment(node)) {
75083
75550
  const file = getSourceFileOfNode(node);
75084
- const localJsxNamespace = getLocalJsxNamespace(file);
75085
- if (localJsxNamespace) {
75551
+ const entity = getJsxFactoryEntity(file);
75552
+ if (entity) {
75553
+ const localJsxNamespace = getFirstIdentifier(entity).escapedText;
75086
75554
  resolveName(
75087
75555
  jsxFactoryLocation,
75088
75556
  localJsxNamespace,
@@ -76039,9 +76507,16 @@ function createTypeChecker(host) {
76039
76507
  function getContextualTypeForReturnExpression(node, contextFlags) {
76040
76508
  const func = getContainingFunction(node);
76041
76509
  if (func) {
76510
+ const functionFlags = getFunctionFlags(func);
76511
+ const links = getNodeLinks(node);
76512
+ if (links.contextualReturnType) {
76513
+ if (functionFlags & 2 /* Async */) {
76514
+ return getUnionType([links.contextualReturnType, createPromiseLikeType(links.contextualReturnType)]);
76515
+ }
76516
+ return links.contextualReturnType;
76517
+ }
76042
76518
  let contextualReturnType = getContextualReturnType(func, contextFlags);
76043
76519
  if (contextualReturnType) {
76044
- const functionFlags = getFunctionFlags(func);
76045
76520
  if (functionFlags & 1 /* Generator */) {
76046
76521
  const isAsyncGenerator = (functionFlags & 2 /* Async */) !== 0;
76047
76522
  if (contextualReturnType.flags & 1048576 /* Union */) {
@@ -76739,6 +77214,13 @@ function createTypeChecker(host) {
76739
77214
  if (index >= 0) {
76740
77215
  return contextualTypes[index];
76741
77216
  }
77217
+ const links = getNodeLinks(node);
77218
+ if (links.contextualReturnType) {
77219
+ if (node.flags & 65536 /* AwaitContext */) {
77220
+ return getUnionType([links.contextualReturnType, createPromiseLikeType(links.contextualReturnType)]);
77221
+ }
77222
+ return links.contextualReturnType;
77223
+ }
76742
77224
  const { parent: parent2 } = node;
76743
77225
  switch (parent2.kind) {
76744
77226
  case 260 /* VariableDeclaration */:
@@ -77320,16 +77802,33 @@ function createTypeChecker(host) {
77320
77802
  const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0];
77321
77803
  return isKnownSymbol(symbol) || firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name) && isTypeAssignableToKind(checkComputedPropertyName(firstDecl.name), 4096 /* ESSymbol */);
77322
77804
  }
77805
+ function isSymbolWithComputedName(symbol) {
77806
+ var _a;
77807
+ const firstDecl = (_a = symbol.declarations) == null ? void 0 : _a[0];
77808
+ return firstDecl && isNamedDeclaration(firstDecl) && isComputedPropertyName(firstDecl.name);
77809
+ }
77323
77810
  function getObjectLiteralIndexInfo(isReadonly, offset, properties, keyType) {
77811
+ var _a;
77324
77812
  const propTypes = [];
77813
+ let components;
77325
77814
  for (let i = offset; i < properties.length; i++) {
77326
77815
  const prop = properties[i];
77327
77816
  if (keyType === stringType && !isSymbolWithSymbolName(prop) || keyType === numberType && isSymbolWithNumericName(prop) || keyType === esSymbolType && isSymbolWithSymbolName(prop)) {
77328
77817
  propTypes.push(getTypeOfSymbol(properties[i]));
77818
+ if (isSymbolWithComputedName(properties[i])) {
77819
+ components = append(components, (_a = properties[i].declarations) == null ? void 0 : _a[0]);
77820
+ }
77329
77821
  }
77330
77822
  }
77331
77823
  const unionType = propTypes.length ? getUnionType(propTypes, 2 /* Subtype */) : undefinedType;
77332
- return createIndexInfo(keyType, unionType, isReadonly);
77824
+ return createIndexInfo(
77825
+ keyType,
77826
+ unionType,
77827
+ isReadonly,
77828
+ /*declaration*/
77829
+ void 0,
77830
+ components
77831
+ );
77333
77832
  }
77334
77833
  function getImmediateAliasedSymbol(symbol) {
77335
77834
  Debug.assert((symbol.flags & 2097152 /* Alias */) !== 0, "Should only get Alias here.");
@@ -77864,6 +78363,9 @@ function createTypeChecker(host) {
77864
78363
  return getNameFromJsxElementAttributesContainer(JsxNames.ElementAttributesPropertyNameContainer, jsxNamespace);
77865
78364
  }
77866
78365
  function getJsxElementChildrenPropertyName(jsxNamespace) {
78366
+ if (compilerOptions.jsx === 4 /* ReactJSX */ || compilerOptions.jsx === 5 /* ReactJSXDev */) {
78367
+ return "children";
78368
+ }
77867
78369
  return getNameFromJsxElementAttributesContainer(JsxNames.ElementChildrenAttributeNameContainer, jsxNamespace);
77868
78370
  }
77869
78371
  function getUninstantiatedJsxSignaturesOfType(elementType, caller) {
@@ -79422,8 +79924,8 @@ function createTypeChecker(host) {
79422
79924
  }
79423
79925
  }
79424
79926
  function getEffectiveCheckNode(argument) {
79425
- argument = skipParentheses(argument);
79426
- return isSatisfiesExpression(argument) ? skipParentheses(argument.expression) : argument;
79927
+ const flags = isInJSFile(argument) ? 1 /* Parentheses */ | 32 /* Satisfies */ | -2147483648 /* ExcludeJSDocTypeAssertion */ : 1 /* Parentheses */ | 32 /* Satisfies */;
79928
+ return skipOuterExpressions(argument, flags);
79427
79929
  }
79428
79930
  function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain, inferenceContext) {
79429
79931
  const errorOutputContainer = { errors: void 0, skipLogging: true };
@@ -79848,11 +80350,16 @@ function createTypeChecker(host) {
79848
80350
  if (!result) {
79849
80351
  result = chooseOverload(candidates, assignableRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
79850
80352
  }
80353
+ const links = getNodeLinks(node);
80354
+ if (links.resolvedSignature !== resolvingSignature && !candidatesOutArray) {
80355
+ Debug.assert(links.resolvedSignature);
80356
+ return links.resolvedSignature;
80357
+ }
79851
80358
  if (result) {
79852
80359
  return result;
79853
80360
  }
79854
80361
  result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
79855
- getNodeLinks(node).resolvedSignature = result;
80362
+ links.resolvedSignature = result;
79856
80363
  if (reportErrors2) {
79857
80364
  if (!headMessage && isInstanceof) {
79858
80365
  headMessage = Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_assignable_to_the_first_argument_of_the_right_hand_side_s_Symbol_hasInstance_method;
@@ -80738,12 +81245,9 @@ function createTypeChecker(host) {
80738
81245
  resolutionStart = resolutionTargets.length;
80739
81246
  }
80740
81247
  links.resolvedSignature = resolvingSignature;
80741
- let result = resolveSignature(node, candidatesOutArray, checkMode || 0 /* Normal */);
81248
+ const result = resolveSignature(node, candidatesOutArray, checkMode || 0 /* Normal */);
80742
81249
  resolutionStart = saveResolutionStart;
80743
81250
  if (result !== resolvingSignature) {
80744
- if (links.resolvedSignature !== resolvingSignature) {
80745
- result = links.resolvedSignature;
80746
- }
80747
81251
  links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached;
80748
81252
  }
80749
81253
  return result;
@@ -81322,12 +81826,12 @@ function createTypeChecker(host) {
81322
81826
  }
81323
81827
  }
81324
81828
  function checkImportMetaProperty(node) {
81325
- if (moduleKind === 100 /* Node16 */ || moduleKind === 199 /* NodeNext */) {
81829
+ if (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
81326
81830
  if (getSourceFileOfNode(node).impliedNodeFormat !== 99 /* ESNext */) {
81327
81831
  error2(node, Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
81328
81832
  }
81329
81833
  } else if (moduleKind < 6 /* ES2020 */ && moduleKind !== 4 /* System */) {
81330
- error2(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);
81834
+ error2(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_node18_or_nodenext);
81331
81835
  }
81332
81836
  const file = getSourceFileOfNode(node);
81333
81837
  Debug.assert(!!(file.flags & 8388608 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
@@ -82156,7 +82660,7 @@ function createTypeChecker(host) {
82156
82660
  }
82157
82661
  return !someType(operandConstraint, (t) => getTypeFacts(t, notEqualFacts) === notEqualFacts);
82158
82662
  }
82159
- const type = checkExpressionCached(node.expression);
82663
+ const type = getBaseConstraintOrType(checkExpressionCached(node.expression));
82160
82664
  if (!isLiteralType(type)) {
82161
82665
  return false;
82162
82666
  }
@@ -82419,19 +82923,7 @@ function createTypeChecker(host) {
82419
82923
  const exprType = checkExpression(node.body);
82420
82924
  const returnOrPromisedType = returnType && unwrapReturnType(returnType, functionFlags);
82421
82925
  if (returnOrPromisedType) {
82422
- const effectiveCheckNode = getEffectiveCheckNode(node.body);
82423
- if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */) {
82424
- const awaitedType = checkAwaitedType(
82425
- exprType,
82426
- /*withAlias*/
82427
- false,
82428
- effectiveCheckNode,
82429
- Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
82430
- );
82431
- checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
82432
- } else {
82433
- checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
82434
- }
82926
+ checkReturnExpression(node, returnOrPromisedType, node.body, node.body, exprType);
82435
82927
  }
82436
82928
  }
82437
82929
  }
@@ -82485,7 +82977,7 @@ function createTypeChecker(host) {
82485
82977
  }
82486
82978
  if (isReadonlySymbol(symbol)) {
82487
82979
  if (symbol.flags & 4 /* Property */ && isAccessExpression(expr) && expr.expression.kind === 110 /* ThisKeyword */) {
82488
- const ctor = getContainingFunction(expr);
82980
+ const ctor = getControlFlowContainer(expr);
82489
82981
  if (!(ctor && (ctor.kind === 176 /* Constructor */ || isJSConstructor(ctor)))) {
82490
82982
  return true;
82491
82983
  }
@@ -82514,7 +83006,7 @@ function createTypeChecker(host) {
82514
83006
  return false;
82515
83007
  }
82516
83008
  function checkReferenceExpression(expr, invalidReferenceMessage, invalidOptionalChainMessage) {
82517
- const node = skipOuterExpressions(expr, 6 /* Assertions */ | 1 /* Parentheses */);
83009
+ const node = skipOuterExpressions(expr, 38 /* Assertions */ | 1 /* Parentheses */);
82518
83010
  if (node.kind !== 80 /* Identifier */ && !isAccessExpression(node)) {
82519
83011
  error2(expr, invalidReferenceMessage);
82520
83012
  return false;
@@ -82581,6 +83073,7 @@ function createTypeChecker(host) {
82581
83073
  }
82582
83074
  switch (moduleKind) {
82583
83075
  case 100 /* Node16 */:
83076
+ case 101 /* Node18 */:
82584
83077
  case 199 /* NodeNext */:
82585
83078
  if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) {
82586
83079
  span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
@@ -82601,7 +83094,7 @@ function createTypeChecker(host) {
82601
83094
  // fallthrough
82602
83095
  default:
82603
83096
  span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
82604
- const message = isAwaitExpression(node) ? Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher : Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher;
83097
+ const message = isAwaitExpression(node) ? Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher : Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher;
82605
83098
  diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message));
82606
83099
  hasError = true;
82607
83100
  break;
@@ -83165,7 +83658,7 @@ function createTypeChecker(host) {
83165
83658
  if (isBinaryExpression(right) && (right.operatorToken.kind === 57 /* BarBarToken */ || right.operatorToken.kind === 56 /* AmpersandAmpersandToken */)) {
83166
83659
  grammarErrorOnNode(right, Diagnostics._0_and_1_operations_cannot_be_mixed_without_parentheses, tokenToString(right.operatorToken.kind), tokenToString(operatorToken.kind));
83167
83660
  }
83168
- const leftTarget = skipOuterExpressions(left, 31 /* All */);
83661
+ const leftTarget = skipOuterExpressions(left, 63 /* All */);
83169
83662
  const nullishSemantics = getSyntacticNullishnessSemantics(leftTarget);
83170
83663
  if (nullishSemantics !== 3 /* Sometimes */) {
83171
83664
  if (node.parent.kind === 226 /* BinaryExpression */) {
@@ -84384,6 +84877,9 @@ function createTypeChecker(host) {
84384
84877
  checkVariableLikeDeclaration(node);
84385
84878
  const func = getContainingFunction(node);
84386
84879
  if (hasSyntacticModifier(node, 31 /* ParameterPropertyModifier */)) {
84880
+ if (compilerOptions.erasableSyntaxOnly) {
84881
+ error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
84882
+ }
84387
84883
  if (!(func.kind === 176 /* Constructor */ && nodeIsPresent(func.body))) {
84388
84884
  error2(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
84389
84885
  }
@@ -87657,7 +88153,6 @@ function createTypeChecker(host) {
87657
88153
  }
87658
88154
  const signature = getSignatureFromDeclaration(container);
87659
88155
  const returnType = getReturnTypeOfSignature(signature);
87660
- const functionFlags = getFunctionFlags(container);
87661
88156
  if (strictNullChecks || node.expression || returnType.flags & 131072 /* Never */) {
87662
88157
  const exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType;
87663
88158
  if (container.kind === 178 /* SetAccessor */) {
@@ -87665,26 +88160,249 @@ function createTypeChecker(host) {
87665
88160
  error2(node, Diagnostics.Setters_cannot_return_a_value);
87666
88161
  }
87667
88162
  } else if (container.kind === 176 /* Constructor */) {
87668
- if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) {
88163
+ const exprType2 = node.expression ? checkExpressionCached(node.expression) : undefinedType;
88164
+ if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType2, returnType, node, node.expression)) {
87669
88165
  error2(node, Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
87670
88166
  }
87671
88167
  } else if (getReturnTypeFromAnnotation(container)) {
87672
- const unwrappedReturnType = unwrapReturnType(returnType, functionFlags) ?? returnType;
87673
- const unwrappedExprType = functionFlags & 2 /* Async */ ? checkAwaitedType(
87674
- exprType,
87675
- /*withAlias*/
87676
- false,
87677
- node,
87678
- Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
87679
- ) : exprType;
87680
- if (unwrappedReturnType) {
87681
- checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, node, node.expression);
87682
- }
88168
+ const unwrappedReturnType = unwrapReturnType(returnType, getFunctionFlags(container)) ?? returnType;
88169
+ checkReturnExpression(container, unwrappedReturnType, node, node.expression, exprType);
87683
88170
  }
87684
88171
  } else if (container.kind !== 176 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeUndefinedVoidOrAny(container, returnType)) {
87685
88172
  error2(node, Diagnostics.Not_all_code_paths_return_a_value);
87686
88173
  }
87687
88174
  }
88175
+ function checkReturnExpression(container, unwrappedReturnType, node, expr, exprType, inConditionalExpression = false) {
88176
+ const excludeJSDocTypeAssertions = isInJSFile(node);
88177
+ const functionFlags = getFunctionFlags(container);
88178
+ if (expr) {
88179
+ const unwrappedExpr = skipParentheses(expr, excludeJSDocTypeAssertions);
88180
+ if (isConditionalExpression(unwrappedExpr)) {
88181
+ checkReturnExpression(
88182
+ container,
88183
+ unwrappedReturnType,
88184
+ node,
88185
+ unwrappedExpr.whenTrue,
88186
+ checkExpression(unwrappedExpr.whenTrue),
88187
+ /*inConditionalExpression*/
88188
+ true
88189
+ );
88190
+ checkReturnExpression(
88191
+ container,
88192
+ unwrappedReturnType,
88193
+ node,
88194
+ unwrappedExpr.whenFalse,
88195
+ checkExpression(unwrappedExpr.whenFalse),
88196
+ /*inConditionalExpression*/
88197
+ true
88198
+ );
88199
+ return;
88200
+ }
88201
+ }
88202
+ const inReturnStatement = node.kind === 253 /* ReturnStatement */;
88203
+ const unwrappedExprType = functionFlags & 2 /* Async */ ? checkAwaitedType(
88204
+ exprType,
88205
+ /*withAlias*/
88206
+ false,
88207
+ node,
88208
+ Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
88209
+ ) : exprType;
88210
+ const effectiveExpr = expr && getEffectiveCheckNode(expr);
88211
+ const errorNode = inReturnStatement && !inConditionalExpression ? node : effectiveExpr;
88212
+ if (!(unwrappedReturnType.flags & (8388608 /* IndexedAccess */ | 16777216 /* Conditional */)) || !couldContainTypeVariables(unwrappedReturnType)) {
88213
+ checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
88214
+ return;
88215
+ }
88216
+ if (checkTypeAssignableTo(
88217
+ unwrappedExprType,
88218
+ unwrappedReturnType,
88219
+ /*errorNode*/
88220
+ void 0
88221
+ )) {
88222
+ return;
88223
+ }
88224
+ let narrowPosition = node;
88225
+ let narrowFlowNode = inReturnStatement && node.flowNode;
88226
+ if (expr && isConditionalExpression(expr.parent)) {
88227
+ narrowFlowNode = expr.parent.whenTrue === expr ? expr.parent.flowNodeWhenTrue : expr.parent.flowNodeWhenFalse;
88228
+ narrowPosition = expr;
88229
+ }
88230
+ if (!narrowFlowNode) {
88231
+ checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
88232
+ return;
88233
+ }
88234
+ const allTypeParameters = appendTypeParameters(getOuterTypeParameters(
88235
+ container,
88236
+ /*includeThisTypes*/
88237
+ false
88238
+ ), getEffectiveTypeParameterDeclarations(container));
88239
+ const narrowableTypeParameters = allTypeParameters && getNarrowableTypeParameters(allTypeParameters);
88240
+ if (!narrowableTypeParameters || !narrowableTypeParameters.length || !isNarrowableReturnType(unwrappedReturnType)) {
88241
+ checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
88242
+ return;
88243
+ }
88244
+ const narrowedTypeParameters = [];
88245
+ const narrowedTypes = [];
88246
+ for (const [typeParam, symbol, reference] of narrowableTypeParameters) {
88247
+ const narrowReference = factory.cloneNode(reference);
88248
+ narrowReference.id = void 0;
88249
+ getNodeLinks(narrowReference).resolvedSymbol = symbol;
88250
+ setParent(narrowReference, narrowPosition.parent);
88251
+ narrowReference.flowNode = narrowFlowNode;
88252
+ const initialType = getNarrowableTypeForReference(
88253
+ typeParam,
88254
+ narrowReference,
88255
+ /*checkMode*/
88256
+ void 0,
88257
+ /*forReturnTypeNarrowing*/
88258
+ true
88259
+ );
88260
+ if (initialType === typeParam) {
88261
+ continue;
88262
+ }
88263
+ const flowType = getFlowTypeOfReference(narrowReference, initialType);
88264
+ const exprType2 = getTypeFromFlowType(flowType);
88265
+ if (exprType2.flags & 3 /* AnyOrUnknown */ || isErrorType(exprType2) || exprType2 === typeParam || exprType2 === mapType(typeParam, getBaseConstraintOrType)) {
88266
+ continue;
88267
+ }
88268
+ const narrowedType = getSubstitutionType(
88269
+ typeParam,
88270
+ exprType2,
88271
+ /*isNarrowed*/
88272
+ true
88273
+ );
88274
+ narrowedTypeParameters.push(typeParam);
88275
+ narrowedTypes.push(narrowedType);
88276
+ }
88277
+ const narrowMapper = createTypeMapper(narrowedTypeParameters, narrowedTypes);
88278
+ const narrowedReturnType = instantiateType(
88279
+ unwrappedReturnType,
88280
+ narrowMapper
88281
+ );
88282
+ if (expr) {
88283
+ const links = getNodeLinks(expr);
88284
+ if (!links.contextualReturnType) {
88285
+ links.contextualReturnType = narrowedReturnType;
88286
+ }
88287
+ }
88288
+ const narrowedExprType = expr ? checkExpression(expr) : undefinedType;
88289
+ const narrowedUnwrappedExprType = functionFlags & 2 /* Async */ ? checkAwaitedType(
88290
+ narrowedExprType,
88291
+ /*withAlias*/
88292
+ false,
88293
+ node,
88294
+ Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
88295
+ ) : narrowedExprType;
88296
+ checkTypeAssignableToAndOptionallyElaborate(narrowedUnwrappedExprType, narrowedReturnType, errorNode, effectiveExpr);
88297
+ }
88298
+ function getNarrowableTypeParameters(candidates) {
88299
+ const narrowableParams = [];
88300
+ for (const typeParam of candidates) {
88301
+ const constraint = getConstraintOfTypeParameter(typeParam);
88302
+ if (!constraint || !(constraint.flags & 1048576 /* Union */)) continue;
88303
+ if (typeParam.symbol && typeParam.symbol.declarations && typeParam.symbol.declarations.length === 1) {
88304
+ const declaration = typeParam.symbol.declarations[0];
88305
+ const container = isJSDocTemplateTag(declaration.parent) ? getJSDocHost(declaration.parent) : declaration.parent;
88306
+ if (!isFunctionLike(container)) continue;
88307
+ let reference;
88308
+ let hasInvalidReference = false;
88309
+ for (const paramDecl of container.parameters) {
88310
+ const typeNode = getEffectiveTypeAnnotationNode(paramDecl);
88311
+ if (!typeNode) continue;
88312
+ if (isTypeParameterReferenced(typeParam, typeNode)) {
88313
+ let candidateReference;
88314
+ if (isTypeReferenceNode(typeNode) && isReferenceToTypeParameter(typeParam, typeNode) && (candidateReference = getValidParameterReference(paramDecl, constraint))) {
88315
+ if (reference) {
88316
+ hasInvalidReference = true;
88317
+ break;
88318
+ }
88319
+ reference = candidateReference;
88320
+ } else {
88321
+ hasInvalidReference = true;
88322
+ break;
88323
+ }
88324
+ }
88325
+ }
88326
+ if (!hasInvalidReference && reference) {
88327
+ const symbol = getResolvedSymbol(reference);
88328
+ if (symbol !== unknownSymbol) narrowableParams.push([typeParam, symbol, reference]);
88329
+ }
88330
+ }
88331
+ }
88332
+ return narrowableParams;
88333
+ function getValidParameterReference(paramDecl, constraint) {
88334
+ if (!isIdentifier(paramDecl.name)) return;
88335
+ const isOptional = !!paramDecl.questionToken || isJSDocOptionalParameter(paramDecl);
88336
+ if (isOptional && !containsUndefinedType(constraint)) return;
88337
+ return paramDecl.name;
88338
+ }
88339
+ function isReferenceToTypeParameter(typeParam, node) {
88340
+ return getTypeFromTypeReference(node) === typeParam;
88341
+ }
88342
+ function isTypeParameterReferenced(typeParam, node) {
88343
+ return isReferenced(node);
88344
+ function isReferenced(node2) {
88345
+ if (isTypeReferenceNode(node2)) {
88346
+ return isReferenceToTypeParameter(typeParam, node2);
88347
+ }
88348
+ if (isTypeQueryNode(node2)) {
88349
+ return isTypeParameterPossiblyReferenced(typeParam, node2);
88350
+ }
88351
+ return !!forEachChild(node2, isReferenced);
88352
+ }
88353
+ }
88354
+ }
88355
+ function isNarrowableReturnType(returnType) {
88356
+ return isConditionalType(returnType) ? isNarrowableConditionalType(returnType) : !!(returnType.indexType.flags & 262144 /* TypeParameter */);
88357
+ }
88358
+ function isNarrowableConditionalType(type, mapper) {
88359
+ const typeArguments = mapper && map(type.root.outerTypeParameters, (t) => {
88360
+ const mapped = getMappedType(t, mapper);
88361
+ if (isNarrowingSubstitutionType(mapped)) {
88362
+ return mapped.baseType;
88363
+ }
88364
+ return mapped;
88365
+ });
88366
+ const id = `${type.id}:${getTypeListId(typeArguments)}`;
88367
+ let result = narrowableReturnTypeCache.get(id);
88368
+ if (result === void 0) {
88369
+ const nonNarrowingMapper = type.root.outerTypeParameters && typeArguments && createTypeMapper(type.root.outerTypeParameters, typeArguments);
88370
+ const instantiatedType = instantiateType(type, nonNarrowingMapper);
88371
+ result = isConditionalType(instantiatedType) && isNarrowableConditionalTypeWorker(instantiatedType);
88372
+ narrowableReturnTypeCache.set(id, result);
88373
+ }
88374
+ return result;
88375
+ }
88376
+ function isNarrowableConditionalTypeWorker(type) {
88377
+ if (!type.root.isDistributive) {
88378
+ return false;
88379
+ }
88380
+ if (type.root.inferTypeParameters) {
88381
+ return false;
88382
+ }
88383
+ if (!(type.checkType.flags & 262144 /* TypeParameter */)) {
88384
+ return false;
88385
+ }
88386
+ const constraintType = getConstraintOfTypeParameter(type.checkType);
88387
+ if (!constraintType || !(constraintType.flags & 1048576 /* Union */)) {
88388
+ return false;
88389
+ }
88390
+ if (!everyType(type.extendsType, (extendsType) => some(
88391
+ constraintType.types,
88392
+ (constraintType2) => isTypeIdenticalTo(constraintType2, extendsType)
88393
+ ))) {
88394
+ return false;
88395
+ }
88396
+ const trueType2 = getTrueTypeFromConditionalType(type);
88397
+ const isValidTrueType = isConditionalType(trueType2) ? isNarrowableConditionalType(trueType2) : true;
88398
+ if (!isValidTrueType) return false;
88399
+ const falseType2 = getFalseTypeFromConditionalType(type);
88400
+ const isValidFalseType = isConditionalType(falseType2) ? isNarrowableConditionalType(falseType2) : falseType2 === neverType;
88401
+ return isValidFalseType;
88402
+ }
88403
+ function isConditionalType(type) {
88404
+ return !!(type.flags & 16777216 /* Conditional */);
88405
+ }
87688
88406
  function checkWithStatement(node) {
87689
88407
  if (!checkGrammarStatementInAmbientContext(node)) {
87690
88408
  if (node.flags & 65536 /* AwaitContext */) {
@@ -87816,7 +88534,7 @@ function createTypeChecker(host) {
87816
88534
  const typeDeclaration = symbol.valueDeclaration;
87817
88535
  if (typeDeclaration && isClassLike(typeDeclaration)) {
87818
88536
  for (const member of typeDeclaration.members) {
87819
- if (!isStatic(member) && !hasBindableName(member)) {
88537
+ if ((!isStaticIndex && !isStatic(member) || isStaticIndex && isStatic(member)) && !hasBindableName(member)) {
87820
88538
  const symbol2 = getSymbolOfDeclaration(member);
87821
88539
  checkIndexConstraintForProperty(type, symbol2, getTypeOfExpression(member.name.expression), getNonMissingTypeOfSymbol(symbol2));
87822
88540
  }
@@ -88267,6 +88985,13 @@ function createTypeChecker(host) {
88267
88985
  function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, member, errorNode) {
88268
88986
  const isJs = isInJSFile(node);
88269
88987
  const nodeInAmbientContext = !!(node.flags & 33554432 /* Ambient */);
88988
+ if (memberHasOverrideModifier && (member == null ? void 0 : member.valueDeclaration) && isClassElement(member.valueDeclaration) && member.valueDeclaration.name && isNonBindableDynamicName(member.valueDeclaration.name)) {
88989
+ error2(
88990
+ errorNode,
88991
+ isJs ? Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_name_is_dynamic : Diagnostics.This_member_cannot_have_an_override_modifier_because_its_name_is_dynamic
88992
+ );
88993
+ return 2 /* HasInvalidOverride */;
88994
+ }
88270
88995
  if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) {
88271
88996
  const thisType = memberIsStatic ? staticType : typeWithThis;
88272
88997
  const baseType = memberIsStatic ? baseStaticType : baseWithThis;
@@ -88859,6 +89584,9 @@ function createTypeChecker(host) {
88859
89584
  checkCollisionsForDeclarationName(node, node.name);
88860
89585
  checkExportsOnMergedDeclarations(node);
88861
89586
  node.members.forEach(checkEnumMember);
89587
+ if (compilerOptions.erasableSyntaxOnly && !(node.flags & 33554432 /* Ambient */)) {
89588
+ error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
89589
+ }
88862
89590
  computeEnumMemberValues(node);
88863
89591
  const enumSymbol = getSymbolOfDeclaration(node);
88864
89592
  const firstDeclaration = getDeclarationOfKind(enumSymbol, node.kind);
@@ -88960,6 +89688,9 @@ function createTypeChecker(host) {
88960
89688
  checkExportsOnMergedDeclarations(node);
88961
89689
  const symbol = getSymbolOfDeclaration(node);
88962
89690
  if (symbol.flags & 512 /* ValueModule */ && !inAmbientContext && isInstantiatedModule(node, shouldPreserveConstEnums(compilerOptions))) {
89691
+ if (compilerOptions.erasableSyntaxOnly) {
89692
+ error2(node.name, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
89693
+ }
88963
89694
  if (getIsolatedModules(compilerOptions) && !getSourceFileOfNode(node).externalModuleIndicator) {
88964
89695
  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);
88965
89696
  }
@@ -89273,10 +90004,20 @@ function createTypeChecker(host) {
89273
90004
  if (validForTypeAttributes && override) {
89274
90005
  return;
89275
90006
  }
89276
- const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier);
89277
- if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
89278
- const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve;
89279
- return grammarErrorOnNode(node, message);
90007
+ if (!moduleSupportsImportAttributes(moduleKind)) {
90008
+ return grammarErrorOnNode(
90009
+ node,
90010
+ isImportAttributes2 ? Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_node18_nodenext_or_preserve
90011
+ );
90012
+ }
90013
+ if (moduleKind === 199 /* NodeNext */ && !isImportAttributes2) {
90014
+ return grammarErrorOnFirstToken(node, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_asserts);
90015
+ }
90016
+ if (declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier) === 1 /* CommonJS */) {
90017
+ return grammarErrorOnNode(
90018
+ node,
90019
+ isImportAttributes2 ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls
90020
+ );
89280
90021
  }
89281
90022
  const isTypeOnly = isJSDocImportTag(declaration) || (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly);
89282
90023
  if (isTypeOnly) {
@@ -89317,7 +90058,7 @@ function createTypeChecker(host) {
89317
90058
  }
89318
90059
  }
89319
90060
  }
89320
- if (!importClause.isTypeOnly && moduleKind === 199 /* NodeNext */ && isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
90061
+ if (!importClause.isTypeOnly && 101 /* Node18 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ && isOnlyImportableAsDefault(node.moduleSpecifier, resolvedModule) && !hasTypeJsonImportAttribute(node)) {
89321
90062
  error2(node.moduleSpecifier, Diagnostics.Importing_a_JSON_file_into_an_ECMAScript_module_requires_a_type_Colon_json_import_attribute_when_module_is_set_to_0, ModuleKind[moduleKind]);
89322
90063
  }
89323
90064
  } else if (noUncheckedSideEffectImports && !importClause) {
@@ -89337,7 +90078,11 @@ function createTypeChecker(host) {
89337
90078
  return;
89338
90079
  }
89339
90080
  checkGrammarModifiers(node);
89340
- if (isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) {
90081
+ const isImportEquals = isInternalModuleImportEqualsDeclaration(node);
90082
+ if (compilerOptions.erasableSyntaxOnly && isImportEquals && !(node.flags & 33554432 /* Ambient */)) {
90083
+ error2(node, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled);
90084
+ }
90085
+ if (isImportEquals || checkExternalImportOrExportDeclaration(node)) {
89341
90086
  checkImportBinding(node);
89342
90087
  markLinkedReferences(node, 6 /* ExportImportEquals */);
89343
90088
  if (node.moduleReference.kind !== 283 /* ExternalModuleReference */) {
@@ -91602,6 +92347,35 @@ function createTypeChecker(host) {
91602
92347
  for (const info of infoList) {
91603
92348
  if (info.declaration) continue;
91604
92349
  if (info === anyBaseTypeIndexInfo) continue;
92350
+ if (info.components) {
92351
+ const allComponentComputedNamesSerializable = every(info.components, (e) => {
92352
+ var _a;
92353
+ return !!(e.name && isComputedPropertyName(e.name) && isEntityNameExpression(e.name.expression) && enclosing && ((_a = isEntityNameVisible(
92354
+ e.name.expression,
92355
+ enclosing,
92356
+ /*shouldComputeAliasToMakeVisible*/
92357
+ false
92358
+ )) == null ? void 0 : _a.accessibility) === 0 /* Accessible */);
92359
+ });
92360
+ if (allComponentComputedNamesSerializable) {
92361
+ const newComponents = filter(info.components, (e) => {
92362
+ return !hasLateBindableName(e);
92363
+ });
92364
+ result.push(...map(newComponents, (e) => {
92365
+ trackComputedName(e.name.expression);
92366
+ const mods = infoList === staticInfos ? [factory.createModifier(126 /* StaticKeyword */)] : void 0;
92367
+ return factory.createPropertyDeclaration(
92368
+ append(mods, info.isReadonly ? factory.createModifier(148 /* ReadonlyKeyword */) : void 0),
92369
+ e.name,
92370
+ (isPropertySignature(e) || isPropertyDeclaration(e) || isMethodSignature(e) || isMethodDeclaration(e) || isGetAccessor(e) || isSetAccessor(e)) && e.questionToken ? factory.createToken(58 /* QuestionToken */) : void 0,
92371
+ nodeBuilder.typeToTypeNode(getTypeOfSymbol(e.symbol), enclosing, flags, internalFlags, tracker),
92372
+ /*initializer*/
92373
+ void 0
92374
+ );
92375
+ }));
92376
+ continue;
92377
+ }
92378
+ }
91605
92379
  const node = nodeBuilder.indexInfoToIndexSignatureDeclaration(info, enclosing, flags, internalFlags, tracker);
91606
92380
  if (node && infoList === staticInfos) {
91607
92381
  (node.modifiers || (node.modifiers = factory.createNodeArray())).unshift(factory.createModifier(126 /* StaticKeyword */));
@@ -91612,6 +92386,22 @@ function createTypeChecker(host) {
91612
92386
  }
91613
92387
  }
91614
92388
  return result;
92389
+ function trackComputedName(accessExpression) {
92390
+ if (!tracker.trackSymbol) return;
92391
+ const firstIdentifier = getFirstIdentifier(accessExpression);
92392
+ const name = resolveName(
92393
+ firstIdentifier,
92394
+ firstIdentifier.escapedText,
92395
+ 111551 /* Value */ | 1048576 /* ExportValue */,
92396
+ /*nameNotFoundMessage*/
92397
+ void 0,
92398
+ /*isUse*/
92399
+ true
92400
+ );
92401
+ if (name) {
92402
+ tracker.trackSymbol(name, enclosing, 111551 /* Value */);
92403
+ }
92404
+ }
91615
92405
  }
91616
92406
  };
91617
92407
  function isImportRequiredByAugmentation(node) {
@@ -92693,6 +93483,7 @@ function createTypeChecker(host) {
92693
93483
  }
92694
93484
  switch (moduleKind) {
92695
93485
  case 100 /* Node16 */:
93486
+ case 101 /* Node18 */:
92696
93487
  case 199 /* NodeNext */:
92697
93488
  if (sourceFile.impliedNodeFormat === 1 /* CommonJS */) {
92698
93489
  diagnostics.add(
@@ -92711,7 +93502,7 @@ function createTypeChecker(host) {
92711
93502
  // fallthrough
92712
93503
  default:
92713
93504
  diagnostics.add(
92714
- createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher)
93505
+ createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher)
92715
93506
  );
92716
93507
  break;
92717
93508
  }
@@ -92855,7 +93646,7 @@ function createTypeChecker(host) {
92855
93646
  }
92856
93647
  }
92857
93648
  function checkGrammarForInvalidDynamicName(node, message) {
92858
- if (isNonBindableDynamicName(node)) {
93649
+ if (isNonBindableDynamicName(node) && !isEntityNameExpression(isElementAccessExpression(node) ? skipParentheses(node.argumentExpression) : node.expression)) {
92859
93650
  return grammarErrorOnNode(node, message);
92860
93651
  }
92861
93652
  }
@@ -93314,17 +94105,17 @@ function createTypeChecker(host) {
93314
94105
  return grammarErrorOnNode(node, Diagnostics.ESM_syntax_is_not_allowed_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
93315
94106
  }
93316
94107
  if (moduleKind === 5 /* ES2015 */) {
93317
- return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext);
94108
+ return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_node18_or_nodenext);
93318
94109
  }
93319
94110
  if (node.typeArguments) {
93320
94111
  return grammarErrorOnNode(node, Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
93321
94112
  }
93322
94113
  const nodeArguments = node.arguments;
93323
- if (moduleKind !== 99 /* ESNext */ && moduleKind !== 199 /* NodeNext */ && moduleKind !== 100 /* Node16 */ && moduleKind !== 200 /* Preserve */) {
94114
+ if (!(100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
93324
94115
  checkGrammarForDisallowedTrailingComma(nodeArguments);
93325
94116
  if (nodeArguments.length > 1) {
93326
94117
  const importAttributesArgument = nodeArguments[1];
93327
- return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodenext_or_preserve);
94118
+ return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_node18_nodenext_or_preserve);
93328
94119
  }
93329
94120
  }
93330
94121
  if (nodeArguments.length === 0 || nodeArguments.length > 2) {
@@ -97841,7 +98632,7 @@ function transformTypeScript(context) {
97841
98632
  return updated;
97842
98633
  }
97843
98634
  function visitParenthesizedExpression(node) {
97844
- const innerExpression = skipOuterExpressions(node.expression, ~(6 /* Assertions */ | 16 /* ExpressionsWithTypeArguments */));
98635
+ const innerExpression = skipOuterExpressions(node.expression, ~(38 /* Assertions */ | 16 /* ExpressionsWithTypeArguments */));
97845
98636
  if (isAssertionExpression(innerExpression) || isSatisfiesExpression(innerExpression)) {
97846
98637
  const expression = visitNode(node.expression, visitor, isExpression);
97847
98638
  Debug.assert(expression);
@@ -117000,11 +117791,7 @@ function createGetIsolatedDeclarationErrors(resolver) {
117000
117791
  if (isSetAccessor(node.parent)) {
117001
117792
  return createAccessorTypeError(node.parent);
117002
117793
  }
117003
- const addUndefined = resolver.requiresAddingImplicitUndefined(
117004
- node,
117005
- /*enclosingDeclaration*/
117006
- void 0
117007
- );
117794
+ const addUndefined = resolver.requiresAddingImplicitUndefined(node, node.parent);
117008
117795
  if (!addUndefined && node.initializer) {
117009
117796
  return createExpressionError(node.initializer);
117010
117797
  }
@@ -118688,6 +119475,7 @@ function getModuleTransformer(moduleKind) {
118688
119475
  case 6 /* ES2020 */:
118689
119476
  case 5 /* ES2015 */:
118690
119477
  case 100 /* Node16 */:
119478
+ case 101 /* Node18 */:
118691
119479
  case 199 /* NodeNext */:
118692
119480
  case 1 /* CommonJS */:
118693
119481
  return transformImpliedNodeFormatDependentModule;
@@ -125247,45 +126035,6 @@ function loadWithModeAwareCache(entries, containingFile, redirectedReference, op
125247
126035
  }
125248
126036
  return resolutions;
125249
126037
  }
125250
- function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
125251
- return forEachProjectReference(
125252
- /*projectReferences*/
125253
- void 0,
125254
- resolvedProjectReferences,
125255
- (resolvedRef, parent2) => resolvedRef && cb(resolvedRef, parent2)
125256
- );
125257
- }
125258
- function forEachProjectReference(projectReferences, resolvedProjectReferences, cbResolvedRef, cbRef) {
125259
- let seenResolvedRefs;
125260
- return worker(
125261
- projectReferences,
125262
- resolvedProjectReferences,
125263
- /*parent*/
125264
- void 0
125265
- );
125266
- function worker(projectReferences2, resolvedProjectReferences2, parent2) {
125267
- if (cbRef) {
125268
- const result = cbRef(projectReferences2, parent2);
125269
- if (result) return result;
125270
- }
125271
- let skipChildren;
125272
- return forEach(
125273
- resolvedProjectReferences2,
125274
- (resolvedRef, index) => {
125275
- if (resolvedRef && (seenResolvedRefs == null ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) {
125276
- (skipChildren ?? (skipChildren = /* @__PURE__ */ new Set())).add(resolvedRef);
125277
- return void 0;
125278
- }
125279
- const result = cbResolvedRef(resolvedRef, parent2, index);
125280
- if (result || !resolvedRef) return result;
125281
- (seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Set())).add(resolvedRef.sourceFile.path);
125282
- }
125283
- ) || forEach(
125284
- resolvedProjectReferences2,
125285
- (resolvedRef) => resolvedRef && !(skipChildren == null ? void 0 : skipChildren.has(resolvedRef)) ? worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef) : void 0
125286
- );
125287
- }
125288
- }
125289
126038
  var inferredTypesContainingFile = "__inferred type names__.ts";
125290
126039
  function getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName) {
125291
126040
  const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
@@ -125301,13 +126050,6 @@ function getLibraryNameFromLibFileName(libFileName) {
125301
126050
  }
125302
126051
  return "@typescript/lib-" + path;
125303
126052
  }
125304
- function getLibNameFromLibReference(libReference) {
125305
- return toFileNameLowerCase(libReference.fileName);
125306
- }
125307
- function getLibFileNameFromLibReference(libReference) {
125308
- const libName = getLibNameFromLibReference(libReference);
125309
- return libMap.get(libName);
125310
- }
125311
126053
  function isReferencedFile(reason) {
125312
126054
  switch (reason == null ? void 0 : reason.kind) {
125313
126055
  case 3 /* Import */:
@@ -125525,11 +126267,13 @@ function createCreateProgramOptions(rootNames, options, host, oldProgram, config
125525
126267
  typeScriptVersion: typeScriptVersion3
125526
126268
  };
125527
126269
  }
125528
- function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
126270
+ function createProgram(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) {
125529
126271
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
125530
- const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
125531
- const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions;
125532
- let { oldProgram } = createProgramOptions;
126272
+ let _createProgramOptions = isArray(_rootNamesOrOptions) ? createCreateProgramOptions(_rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : _rootNamesOrOptions;
126273
+ const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3, host: createProgramOptionsHost } = _createProgramOptions;
126274
+ let { oldProgram } = _createProgramOptions;
126275
+ _createProgramOptions = void 0;
126276
+ _rootNamesOrOptions = void 0;
125533
126277
  for (const option of commandLineOptionOfCustomType) {
125534
126278
  if (hasProperty(options, option.name)) {
125535
126279
  if (typeof options[option.name] === "string") {
@@ -125542,16 +126286,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125542
126286
  let processingOtherFiles;
125543
126287
  let files;
125544
126288
  let symlinks;
125545
- let commonSourceDirectory;
125546
126289
  let typeChecker;
125547
126290
  let classifiableNames;
125548
- let fileReasons = createMultiMap();
125549
126291
  let filesWithReferencesProcessed;
125550
- let fileReasonsToChain;
125551
- let reasonToRelatedInfo;
125552
126292
  let cachedBindAndCheckDiagnosticsForFile;
125553
126293
  let cachedDeclarationDiagnosticsForFile;
125554
- let fileProcessingDiagnostics;
126294
+ const programDiagnostics = createProgramDiagnostics(getCompilerOptionsObjectLiteralSyntax);
125555
126295
  let automaticTypeDirectiveNames;
125556
126296
  let automaticTypeDirectiveResolutions;
125557
126297
  let resolvedLibReferences;
@@ -125573,13 +126313,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125573
126313
  true
125574
126314
  );
125575
126315
  mark("beforeProgram");
125576
- const host = createProgramOptions.host || createCompilerHost(options);
126316
+ const host = createProgramOptionsHost || createCompilerHost(options);
125577
126317
  const configParsingHost = parseConfigHostFromCompilerHostLike(host);
125578
126318
  let skipDefaultLib = options.noLib;
125579
126319
  const getDefaultLibraryFileName = memoize(() => host.getDefaultLibFileName(options));
125580
126320
  const defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : getDirectoryPath(getDefaultLibraryFileName());
125581
- const programDiagnostics = createDiagnosticCollection();
125582
- let lazyProgramDiagnosticExplainingFile = [];
126321
+ let skipVerifyCompilerOptions = false;
125583
126322
  const currentDirectory = host.getCurrentDirectory();
125584
126323
  const supportedExtensions = getSupportedExtensions(options);
125585
126324
  const supportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
@@ -125857,7 +126596,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125857
126596
  getTypeCount: () => getTypeChecker().getTypeCount(),
125858
126597
  getInstantiationCount: () => getTypeChecker().getInstantiationCount(),
125859
126598
  getRelationCacheSizes: () => getTypeChecker().getRelationCacheSizes(),
125860
- getFileProcessingDiagnostics: () => fileProcessingDiagnostics,
126599
+ getFileProcessingDiagnostics: () => programDiagnostics.getFileProcessingDiagnostics(),
125861
126600
  getAutomaticTypeDirectiveNames: () => automaticTypeDirectiveNames,
125862
126601
  getAutomaticTypeDirectiveResolutions: () => automaticTypeDirectiveResolutions,
125863
126602
  isSourceFileFromExternalLibrary,
@@ -125873,6 +126612,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125873
126612
  resolvedModules,
125874
126613
  resolvedTypeReferenceDirectiveNames,
125875
126614
  resolvedLibReferences,
126615
+ getProgramDiagnosticsContainer: () => programDiagnostics,
125876
126616
  getResolvedModule,
125877
126617
  getResolvedModuleFromModuleSpecifier,
125878
126618
  getResolvedTypeReferenceDirective,
@@ -125905,70 +126645,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
125905
126645
  realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
125906
126646
  useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
125907
126647
  getCanonicalFileName,
125908
- getFileIncludeReasons: () => fileReasons,
126648
+ getFileIncludeReasons: () => programDiagnostics.getFileReasons(),
125909
126649
  structureIsReused,
125910
126650
  writeFile: writeFile2,
125911
126651
  getGlobalTypingsCacheLocation: maybeBind(host, host.getGlobalTypingsCacheLocation)
125912
126652
  };
125913
126653
  onProgramCreateComplete();
125914
- verifyCompilerOptions();
126654
+ if (!skipVerifyCompilerOptions) {
126655
+ verifyCompilerOptions();
126656
+ }
125915
126657
  mark("afterProgram");
125916
126658
  measure("Program", "beforeProgram", "afterProgram");
125917
126659
  (_p = tracing) == null ? void 0 : _p.pop();
125918
126660
  return program;
125919
- function updateAndGetProgramDiagnostics() {
125920
- if (lazyProgramDiagnosticExplainingFile) {
125921
- fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
125922
- switch (diagnostic.kind) {
125923
- case 1 /* FilePreprocessingFileExplainingDiagnostic */:
125924
- return programDiagnostics.add(
125925
- createDiagnosticExplainingFile(
125926
- diagnostic.file && getSourceFileByPath(diagnostic.file),
125927
- diagnostic.fileProcessingReason,
125928
- diagnostic.diagnostic,
125929
- diagnostic.args || emptyArray
125930
- )
125931
- );
125932
- case 0 /* FilePreprocessingLibReferenceDiagnostic */:
125933
- return programDiagnostics.add(filePreprocessingLibreferenceDiagnostic(diagnostic));
125934
- case 2 /* ResolutionDiagnostics */:
125935
- return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
125936
- default:
125937
- Debug.assertNever(diagnostic);
125938
- }
125939
- });
125940
- lazyProgramDiagnosticExplainingFile.forEach(
125941
- ({ file, diagnostic, args }) => programDiagnostics.add(
125942
- createDiagnosticExplainingFile(
125943
- file,
125944
- /*fileProcessingReason*/
125945
- void 0,
125946
- diagnostic,
125947
- args
125948
- )
125949
- )
125950
- );
125951
- lazyProgramDiagnosticExplainingFile = void 0;
125952
- fileReasonsToChain = void 0;
125953
- reasonToRelatedInfo = void 0;
125954
- }
125955
- return programDiagnostics;
125956
- }
125957
- function filePreprocessingLibreferenceDiagnostic({ reason }) {
125958
- const { file, pos, end } = getReferencedFileLocation(program, reason);
125959
- const libReference = file.libReferenceDirectives[reason.index];
125960
- const libName = getLibNameFromLibReference(libReference);
125961
- const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
125962
- const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
125963
- return createFileDiagnostic(
125964
- file,
125965
- Debug.checkDefined(pos),
125966
- Debug.checkDefined(end) - pos,
125967
- suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0,
125968
- libName,
125969
- suggestion
125970
- );
125971
- }
125972
126661
  function getResolvedModule(file, moduleName, mode) {
125973
126662
  var _a2;
125974
126663
  return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
@@ -126017,7 +126706,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126017
126706
  function addResolutionDiagnostics(resolution) {
126018
126707
  var _a2;
126019
126708
  if (!((_a2 = resolution.resolutionDiagnostics) == null ? void 0 : _a2.length)) return;
126020
- (fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push({
126709
+ programDiagnostics.addFileProcessingDiagnostic({
126021
126710
  kind: 2 /* ResolutionDiagnostics */,
126022
126711
  diagnostics: resolution.resolutionDiagnostics
126023
126712
  });
@@ -126111,16 +126800,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126111
126800
  return toPath(fileName, currentDirectory, getCanonicalFileName);
126112
126801
  }
126113
126802
  function getCommonSourceDirectory2() {
126114
- if (commonSourceDirectory === void 0) {
126115
- const emittedFiles = filter(files, (file) => sourceFileMayBeEmitted(file, program));
126116
- commonSourceDirectory = getCommonSourceDirectory(
126117
- options,
126118
- () => mapDefined(emittedFiles, (file) => file.isDeclarationFile ? void 0 : file.fileName),
126119
- currentDirectory,
126120
- getCanonicalFileName,
126121
- (commonSourceDirectory2) => checkSourceFilesBelongToPath(emittedFiles, commonSourceDirectory2)
126122
- );
126803
+ let commonSourceDirectory = programDiagnostics.getCommonSourceDirectory();
126804
+ if (commonSourceDirectory !== void 0) {
126805
+ return commonSourceDirectory;
126123
126806
  }
126807
+ const emittedFiles = filter(files, (file) => sourceFileMayBeEmitted(file, program));
126808
+ commonSourceDirectory = getCommonSourceDirectory(
126809
+ options,
126810
+ () => mapDefined(emittedFiles, (file) => file.isDeclarationFile ? void 0 : file.fileName),
126811
+ currentDirectory,
126812
+ getCanonicalFileName,
126813
+ (commonSourceDirectory2) => checkSourceFilesBelongToPath(emittedFiles, commonSourceDirectory2)
126814
+ );
126815
+ programDiagnostics.setCommonSourceDirectory(commonSourceDirectory);
126124
126816
  return commonSourceDirectory;
126125
126817
  }
126126
126818
  function getClassifiableNames() {
@@ -126431,9 +127123,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126431
127123
  }
126432
127124
  filesByName.set(path, filesByName.get(oldFile.path));
126433
127125
  });
127126
+ const isConfigIdentical = oldOptions.configFile && oldOptions.configFile === options.configFile || !oldOptions.configFile && !options.configFile && !optionsHaveChanges(oldOptions, options, optionDeclarations);
127127
+ programDiagnostics.reuseStateFromOldProgram(oldProgram.getProgramDiagnosticsContainer(), isConfigIdentical);
127128
+ skipVerifyCompilerOptions = isConfigIdentical;
126434
127129
  files = newSourceFiles;
126435
- fileReasons = oldProgram.getFileIncludeReasons();
126436
- fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
126437
127130
  automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames();
126438
127131
  automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions();
126439
127132
  sourceFileToPackageName = oldProgram.sourceFileToPackageName;
@@ -126649,7 +127342,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
126649
127342
  if (skipTypeChecking(sourceFile, options, program)) {
126650
127343
  return emptyArray;
126651
127344
  }
126652
- const programDiagnosticsInFile = updateAndGetProgramDiagnostics().getDiagnostics(sourceFile.fileName);
127345
+ const programDiagnosticsInFile = programDiagnostics.getCombinedDiagnostics(program).getDiagnostics(sourceFile.fileName);
126653
127346
  if (!((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
126654
127347
  return programDiagnosticsInFile;
126655
127348
  }
@@ -127007,15 +127700,15 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127007
127700
  }
127008
127701
  function getOptionsDiagnostics() {
127009
127702
  return sortAndDeduplicateDiagnostics(concatenate(
127010
- updateAndGetProgramDiagnostics().getGlobalDiagnostics(),
127703
+ programDiagnostics.getCombinedDiagnostics(program).getGlobalDiagnostics(),
127011
127704
  getOptionsDiagnosticsOfConfigFile()
127012
127705
  ));
127013
127706
  }
127014
127707
  function getOptionsDiagnosticsOfConfigFile() {
127015
127708
  if (!options.configFile) return emptyArray;
127016
- let diagnostics = updateAndGetProgramDiagnostics().getDiagnostics(options.configFile.fileName);
127709
+ let diagnostics = programDiagnostics.getCombinedDiagnostics(program).getDiagnostics(options.configFile.fileName);
127017
127710
  forEachResolvedProjectReference2((resolvedRef) => {
127018
- diagnostics = concatenate(diagnostics, updateAndGetProgramDiagnostics().getDiagnostics(resolvedRef.sourceFile.fileName));
127711
+ diagnostics = concatenate(diagnostics, programDiagnostics.getCombinedDiagnostics(program).getDiagnostics(resolvedRef.sourceFile.fileName));
127019
127712
  });
127020
127713
  return diagnostics;
127021
127714
  }
@@ -127222,7 +127915,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127222
127915
  );
127223
127916
  }
127224
127917
  function reportFileNamesDifferOnlyInCasingError(fileName, existingFile, reason) {
127225
- const hasExistingReasonToReportErrorOn = !isReferencedFile(reason) && some(fileReasons.get(existingFile.path), isReferencedFile);
127918
+ const hasExistingReasonToReportErrorOn = !isReferencedFile(reason) && some(programDiagnostics.getFileReasons().get(existingFile.path), isReferencedFile);
127226
127919
  if (hasExistingReasonToReportErrorOn) {
127227
127920
  addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, [existingFile.fileName, fileName]);
127228
127921
  } else {
@@ -127409,7 +128102,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127409
128102
  }
127410
128103
  function addFileIncludeReason(file, reason, checkExisting) {
127411
128104
  if (file && (!checkExisting || !isReferencedFile(reason) || !(filesWithReferencesProcessed == null ? void 0 : filesWithReferencesProcessed.has(reason.file)))) {
127412
- fileReasons.add(file.path, reason);
128105
+ programDiagnostics.getFileReasons().add(file.path, reason);
127413
128106
  return true;
127414
128107
  }
127415
128108
  return false;
@@ -127561,6 +128254,16 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127561
128254
  var _a2, _b2, _c2, _d2, _e2;
127562
128255
  const existing = resolvedLibProcessing == null ? void 0 : resolvedLibProcessing.get(libFileName);
127563
128256
  if (existing) return existing;
128257
+ if (options.libReplacement === false) {
128258
+ const result2 = {
128259
+ resolution: {
128260
+ resolvedModule: void 0
128261
+ },
128262
+ actual: combinePaths(defaultLibraryPath, libFileName)
128263
+ };
128264
+ (resolvedLibProcessing ?? (resolvedLibProcessing = /* @__PURE__ */ new Map())).set(libFileName, result2);
128265
+ return result2;
128266
+ }
127564
128267
  if (structureIsReused !== 0 /* Not */ && oldProgram && !hasInvalidatedLibResolutions(libFileName)) {
127565
128268
  const oldResolution = (_a2 = oldProgram.resolvedLibReferences) == null ? void 0 : _a2.get(libFileName);
127566
128269
  if (oldResolution) {
@@ -127608,7 +128311,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127608
128311
  { kind: 7 /* LibReferenceDirective */, file: file.path, index }
127609
128312
  );
127610
128313
  } else {
127611
- (fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
128314
+ programDiagnostics.addFileProcessingDiagnostic({
127612
128315
  kind: 0 /* FilePreprocessingLibReferenceDiagnostic */,
127613
128316
  reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index }
127614
128317
  });
@@ -127671,10 +128374,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127671
128374
  if (!sourceFile.isDeclarationFile) {
127672
128375
  const absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
127673
128376
  if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
127674
- addLazyProgramDiagnosticExplainingFile(
128377
+ programDiagnostics.addLazyConfigDiagnostic(
127675
128378
  sourceFile,
127676
128379
  Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files,
127677
- [sourceFile.fileName, rootDirectory]
128380
+ sourceFile.fileName,
128381
+ rootDirectory
127678
128382
  );
127679
128383
  allFilesBelongToPath = false;
127680
128384
  }
@@ -127789,7 +128493,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127789
128493
  }
127790
128494
  const outputFile = options.outFile;
127791
128495
  if (!options.tsBuildInfoFile && options.incremental && !outputFile && !options.configFilePath) {
127792
- programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
128496
+ programDiagnostics.addConfigDiagnostic(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
127793
128497
  }
127794
128498
  verifyDeprecatedCompilerOptions();
127795
128499
  verifyProjectReferences();
@@ -127797,10 +128501,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127797
128501
  const rootPaths = new Set(rootNames.map(toPath3));
127798
128502
  for (const file of files) {
127799
128503
  if (sourceFileMayBeEmitted(file, program) && !rootPaths.has(file.path)) {
127800
- addLazyProgramDiagnosticExplainingFile(
128504
+ programDiagnostics.addLazyConfigDiagnostic(
127801
128505
  file,
127802
128506
  Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern,
127803
- [file.fileName, options.configFilePath || ""]
128507
+ file.fileName,
128508
+ options.configFilePath || ""
127804
128509
  );
127805
128510
  }
127806
128511
  }
@@ -127891,14 +128596,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127891
128596
  }
127892
128597
  } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ES2015 */ && options.module === 0 /* None */) {
127893
128598
  const span = getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, typeof firstNonAmbientExternalModuleSourceFile.externalModuleIndicator === "boolean" ? firstNonAmbientExternalModuleSourceFile : firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
127894
- programDiagnostics.add(createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none));
128599
+ programDiagnostics.addConfigDiagnostic(createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none));
127895
128600
  }
127896
128601
  if (outputFile && !options.emitDeclarationOnly) {
127897
128602
  if (options.module && !(options.module === 2 /* AMD */ || options.module === 4 /* System */)) {
127898
128603
  createDiagnosticForOptionName(Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, "outFile", "module");
127899
128604
  } else if (options.module === void 0 && firstNonAmbientExternalModuleSourceFile) {
127900
128605
  const span = getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, typeof firstNonAmbientExternalModuleSourceFile.externalModuleIndicator === "boolean" ? firstNonAmbientExternalModuleSourceFile : firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
127901
- programDiagnostics.add(createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, "outFile"));
128606
+ programDiagnostics.addConfigDiagnostic(createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, "outFile"));
127902
128607
  }
127903
128608
  }
127904
128609
  if (getResolveJsonModule(options)) {
@@ -127987,7 +128692,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127987
128692
  }
127988
128693
  if (ModuleKind[moduleKind] && (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) && !(3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */)) {
127989
128694
  const moduleKindName = ModuleKind[moduleKind];
127990
- createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1, moduleKindName, moduleKindName);
128695
+ const moduleResolutionName = ModuleResolutionKind[moduleKindName] ? moduleKindName : "Node16";
128696
+ createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1, moduleResolutionName, moduleKindName);
127991
128697
  } else if (ModuleResolutionKind[moduleResolution] && (3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) && !(100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */)) {
127992
128698
  const moduleResolutionName = ModuleResolutionKind[moduleResolution];
127993
128699
  createOptionValueDiagnostic("module", Diagnostics.Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1, moduleResolutionName, moduleResolutionName);
@@ -128149,90 +128855,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
128149
128855
  }
128150
128856
  });
128151
128857
  }
128152
- function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
128153
- let seenReasons;
128154
- const reasons = file && fileReasons.get(file.path);
128155
- let fileIncludeReasons;
128156
- let relatedInfo;
128157
- let locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : void 0;
128158
- let fileIncludeReasonDetails;
128159
- let redirectInfo;
128160
- let cachedChain = file && (fileReasonsToChain == null ? void 0 : fileReasonsToChain.get(file.path));
128161
- let chain;
128162
- if (cachedChain) {
128163
- if (cachedChain.fileIncludeReasonDetails) {
128164
- seenReasons = new Set(reasons);
128165
- reasons == null ? void 0 : reasons.forEach(populateRelatedInfo);
128166
- } else {
128167
- reasons == null ? void 0 : reasons.forEach(processReason);
128168
- }
128169
- redirectInfo = cachedChain.redirectInfo;
128170
- } else {
128171
- reasons == null ? void 0 : reasons.forEach(processReason);
128172
- redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, getCompilerOptionsForFile(file));
128173
- }
128174
- if (fileProcessingReason) processReason(fileProcessingReason);
128175
- const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
128176
- if (locationReason && (seenReasons == null ? void 0 : seenReasons.size) === 1) seenReasons = void 0;
128177
- if (seenReasons && cachedChain) {
128178
- if (cachedChain.details && !processedExtraReason) {
128179
- chain = chainDiagnosticMessages(cachedChain.details, diagnostic, ...args || emptyArray);
128180
- } else if (cachedChain.fileIncludeReasonDetails) {
128181
- if (!processedExtraReason) {
128182
- if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
128183
- fileIncludeReasonDetails = cachedChain.fileIncludeReasonDetails;
128184
- } else {
128185
- fileIncludeReasons = cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length);
128186
- }
128187
- } else {
128188
- if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
128189
- fileIncludeReasons = [...cachedChain.fileIncludeReasonDetails.next, fileIncludeReasons[0]];
128190
- } else {
128191
- fileIncludeReasons = append(cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length), fileIncludeReasons[0]);
128192
- }
128193
- }
128194
- }
128195
- }
128196
- if (!chain) {
128197
- if (!fileIncludeReasonDetails) fileIncludeReasonDetails = seenReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
128198
- chain = chainDiagnosticMessages(
128199
- redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails,
128200
- diagnostic,
128201
- ...args || emptyArray
128202
- );
128203
- }
128204
- if (file) {
128205
- if (cachedChain) {
128206
- if (!cachedChain.fileIncludeReasonDetails || !processedExtraReason && fileIncludeReasonDetails) {
128207
- cachedChain.fileIncludeReasonDetails = fileIncludeReasonDetails;
128208
- }
128209
- } else {
128210
- (fileReasonsToChain ?? (fileReasonsToChain = /* @__PURE__ */ new Map())).set(file.path, cachedChain = { fileIncludeReasonDetails, redirectInfo });
128211
- }
128212
- if (!cachedChain.details && !processedExtraReason) cachedChain.details = chain.next;
128213
- }
128214
- const location = locationReason && getReferencedFileLocation(program, locationReason);
128215
- return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
128216
- function processReason(reason) {
128217
- if (seenReasons == null ? void 0 : seenReasons.has(reason)) return;
128218
- (seenReasons ?? (seenReasons = /* @__PURE__ */ new Set())).add(reason);
128219
- (fileIncludeReasons ?? (fileIncludeReasons = [])).push(fileIncludeReasonToDiagnostics(program, reason));
128220
- populateRelatedInfo(reason);
128221
- }
128222
- function populateRelatedInfo(reason) {
128223
- if (!locationReason && isReferencedFile(reason)) {
128224
- locationReason = reason;
128225
- } else if (locationReason !== reason) {
128226
- relatedInfo = append(relatedInfo, getFileIncludeReasonToRelatedInformation(reason));
128227
- }
128228
- }
128229
- function cachedFileIncludeDetailsHasProcessedExtraReason() {
128230
- var _a2;
128231
- return ((_a2 = cachedChain.fileIncludeReasonDetails.next) == null ? void 0 : _a2.length) !== (reasons == null ? void 0 : reasons.length);
128232
- }
128233
- }
128234
128858
  function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
128235
- (fileProcessingDiagnostics || (fileProcessingDiagnostics = [])).push({
128859
+ programDiagnostics.addFileProcessingDiagnostic({
128236
128860
  kind: 1 /* FilePreprocessingFileExplainingDiagnostic */,
128237
128861
  file: file && file.path,
128238
128862
  fileProcessingReason,
@@ -128240,99 +128864,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
128240
128864
  args
128241
128865
  });
128242
128866
  }
128243
- function addLazyProgramDiagnosticExplainingFile(file, diagnostic, args) {
128244
- lazyProgramDiagnosticExplainingFile.push({ file, diagnostic, args });
128245
- }
128246
- function getFileIncludeReasonToRelatedInformation(reason) {
128247
- let relatedInfo = reasonToRelatedInfo == null ? void 0 : reasonToRelatedInfo.get(reason);
128248
- if (relatedInfo === void 0) (reasonToRelatedInfo ?? (reasonToRelatedInfo = /* @__PURE__ */ new Map())).set(reason, relatedInfo = fileIncludeReasonToRelatedInformation(reason) ?? false);
128249
- return relatedInfo || void 0;
128250
- }
128251
- function fileIncludeReasonToRelatedInformation(reason) {
128252
- if (isReferencedFile(reason)) {
128253
- const referenceLocation = getReferencedFileLocation(program, reason);
128254
- let message2;
128255
- switch (reason.kind) {
128256
- case 3 /* Import */:
128257
- message2 = Diagnostics.File_is_included_via_import_here;
128258
- break;
128259
- case 4 /* ReferenceFile */:
128260
- message2 = Diagnostics.File_is_included_via_reference_here;
128261
- break;
128262
- case 5 /* TypeReferenceDirective */:
128263
- message2 = Diagnostics.File_is_included_via_type_library_reference_here;
128264
- break;
128265
- case 7 /* LibReferenceDirective */:
128266
- message2 = Diagnostics.File_is_included_via_library_reference_here;
128267
- break;
128268
- default:
128269
- Debug.assertNever(reason);
128270
- }
128271
- return isReferenceFileLocation(referenceLocation) ? createFileDiagnostic(
128272
- referenceLocation.file,
128273
- referenceLocation.pos,
128274
- referenceLocation.end - referenceLocation.pos,
128275
- message2
128276
- ) : void 0;
128277
- }
128278
- if (!options.configFile) return void 0;
128279
- let configFileNode;
128280
- let message;
128281
- switch (reason.kind) {
128282
- case 0 /* RootFile */:
128283
- if (!options.configFile.configFileSpecs) return void 0;
128284
- const fileName = getNormalizedAbsolutePath(rootNames[reason.index], currentDirectory);
128285
- const matchedByFiles = getMatchedFileSpec(program, fileName);
128286
- if (matchedByFiles) {
128287
- configFileNode = getTsConfigPropArrayElementValue(options.configFile, "files", matchedByFiles);
128288
- message = Diagnostics.File_is_matched_by_files_list_specified_here;
128289
- break;
128290
- }
128291
- const matchedByInclude = getMatchedIncludeSpec(program, fileName);
128292
- if (!matchedByInclude || !isString(matchedByInclude)) return void 0;
128293
- configFileNode = getTsConfigPropArrayElementValue(options.configFile, "include", matchedByInclude);
128294
- message = Diagnostics.File_is_matched_by_include_pattern_specified_here;
128295
- break;
128296
- case 1 /* SourceFromProjectReference */:
128297
- case 2 /* OutputFromProjectReference */:
128298
- const referencedResolvedRef = Debug.checkDefined(resolvedProjectReferences == null ? void 0 : resolvedProjectReferences[reason.index]);
128299
- const referenceInfo = forEachProjectReference(
128300
- projectReferences,
128301
- resolvedProjectReferences,
128302
- (resolvedRef, parent2, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent2 == null ? void 0 : parent2.sourceFile) || options.configFile, index: index2 } : void 0
128303
- );
128304
- if (!referenceInfo) return void 0;
128305
- const { sourceFile, index } = referenceInfo;
128306
- const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
128307
- return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
128308
- sourceFile,
128309
- referencesSyntax.elements[index],
128310
- reason.kind === 2 /* OutputFromProjectReference */ ? Diagnostics.File_is_output_from_referenced_project_specified_here : Diagnostics.File_is_source_from_referenced_project_specified_here
128311
- ) : void 0;
128312
- case 8 /* AutomaticTypeDirectiveFile */:
128313
- if (!options.types) return void 0;
128314
- configFileNode = getOptionsSyntaxByArrayElementValue("types", reason.typeReference);
128315
- message = Diagnostics.File_is_entry_point_of_type_library_specified_here;
128316
- break;
128317
- case 6 /* LibFile */:
128318
- if (reason.index !== void 0) {
128319
- configFileNode = getOptionsSyntaxByArrayElementValue("lib", options.lib[reason.index]);
128320
- message = Diagnostics.File_is_library_specified_here;
128321
- break;
128322
- }
128323
- const target = getNameOfScriptTarget(getEmitScriptTarget(options));
128324
- configFileNode = target ? getOptionsSyntaxByValue("target", target) : void 0;
128325
- message = Diagnostics.File_is_default_library_for_target_specified_here;
128326
- break;
128327
- default:
128328
- Debug.assertNever(reason);
128329
- }
128330
- return configFileNode && createDiagnosticForNodeInSourceFile(
128331
- options.configFile,
128332
- configFileNode,
128333
- message
128334
- );
128335
- }
128336
128867
  function verifyProjectReferences() {
128337
128868
  const buildInfoPath = !options.suppressOutputPathCheck ? getTsBuildInfoEmitOutputFilePath(options) : void 0;
128338
128869
  forEachProjectReference(
@@ -128368,7 +128899,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
128368
128899
  forEachPropertyAssignment(pathProp.initializer, key, (keyProps) => {
128369
128900
  const initializer = keyProps.initializer;
128370
128901
  if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
128371
- programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
128902
+ programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
128372
128903
  needCompilerDiagnostic = false;
128373
128904
  }
128374
128905
  });
@@ -128397,18 +128928,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
128397
128928
  createCompilerOptionsDiagnostic(message, ...args);
128398
128929
  }
128399
128930
  }
128400
- function forEachOptionsSyntaxByName(name, callback) {
128401
- return forEachPropertyAssignment(getCompilerOptionsObjectLiteralSyntax(), name, callback);
128402
- }
128403
128931
  function forEachOptionPathsSyntax(callback) {
128404
- return forEachOptionsSyntaxByName("paths", callback);
128405
- }
128406
- function getOptionsSyntaxByValue(name, value) {
128407
- return forEachOptionsSyntaxByName(name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
128408
- }
128409
- function getOptionsSyntaxByArrayElementValue(name, value) {
128410
- const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
128411
- return compilerOptionsObjectLiteralSyntax && getPropertyArrayElementValue(compilerOptionsObjectLiteralSyntax, name, value);
128932
+ return forEachOptionsSyntaxByName(getCompilerOptionsObjectLiteralSyntax(), "paths", callback);
128412
128933
  }
128413
128934
  function createDiagnosticForOptionName(message, option1, option2, option3) {
128414
128935
  createDiagnosticForOption(
@@ -128436,9 +128957,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
128436
128957
  function createDiagnosticForReference(sourceFile, index, message, ...args) {
128437
128958
  const referencesSyntax = forEachTsConfigPropArray(sourceFile || options.configFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
128438
128959
  if (referencesSyntax && referencesSyntax.elements.length > index) {
128439
- programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
128960
+ programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
128440
128961
  } else {
128441
- programDiagnostics.add(createCompilerDiagnostic(message, ...args));
128962
+ programDiagnostics.addConfigDiagnostic(createCompilerDiagnostic(message, ...args));
128442
128963
  }
128443
128964
  }
128444
128965
  function createDiagnosticForOption(onKey, option1, option2, message, ...args) {
@@ -128452,14 +128973,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
128452
128973
  const compilerOptionsProperty = getCompilerOptionsPropertySyntax();
128453
128974
  if (compilerOptionsProperty) {
128454
128975
  if ("messageText" in message) {
128455
- programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, compilerOptionsProperty.name, message));
128976
+ programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeFromMessageChain(options.configFile, compilerOptionsProperty.name, message));
128456
128977
  } else {
128457
- programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, compilerOptionsProperty.name, message, ...args));
128978
+ programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(options.configFile, compilerOptionsProperty.name, message, ...args));
128458
128979
  }
128459
128980
  } else if ("messageText" in message) {
128460
- programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
128981
+ programDiagnostics.addConfigDiagnostic(createCompilerDiagnosticFromMessageChain(message));
128461
128982
  } else {
128462
- programDiagnostics.add(createCompilerDiagnostic(message, ...args));
128983
+ programDiagnostics.addConfigDiagnostic(createCompilerDiagnostic(message, ...args));
128463
128984
  }
128464
128985
  }
128465
128986
  function getCompilerOptionsObjectLiteralSyntax() {
@@ -128483,9 +129004,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
128483
129004
  let needsCompilerDiagnostic = false;
128484
129005
  forEachPropertyAssignment(objectLiteral, key1, (prop) => {
128485
129006
  if ("messageText" in message) {
128486
- programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
129007
+ programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
128487
129008
  } else {
128488
- programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
129009
+ programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
128489
129010
  }
128490
129011
  needsCompilerDiagnostic = true;
128491
129012
  }, key2);
@@ -128493,7 +129014,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
128493
129014
  }
128494
129015
  function blockEmittingOfFile(emitFileName, diag2) {
128495
129016
  hasEmitBlockingDiagnostics.set(toPath3(emitFileName), true);
128496
- programDiagnostics.add(diag2);
129017
+ programDiagnostics.addConfigDiagnostic(diag2);
128497
129018
  }
128498
129019
  function isEmittedFile(file) {
128499
129020
  if (options.noEmit) {
@@ -128816,6 +129337,293 @@ function getModuleNameStringLiteralAt({ imports, moduleAugmentations }, index) {
128816
129337
  Debug.fail("should never ask for module name at index higher than possible module name");
128817
129338
  }
128818
129339
 
129340
+ // src/compiler/programDiagnostics.ts
129341
+ function createProgramDiagnostics(getCompilerOptionsObjectLiteralSyntax) {
129342
+ let computedDiagnostics;
129343
+ let fileReasons = createMultiMap();
129344
+ let fileProcessingDiagnostics;
129345
+ let commonSourceDirectory;
129346
+ let configDiagnostics;
129347
+ let lazyConfigDiagnostics;
129348
+ let fileReasonsToChain;
129349
+ let reasonToRelatedInfo;
129350
+ return {
129351
+ addConfigDiagnostic(diag2) {
129352
+ Debug.assert(computedDiagnostics === void 0, "Cannot modify program diagnostic state after requesting combined diagnostics");
129353
+ (configDiagnostics ?? (configDiagnostics = createDiagnosticCollection())).add(diag2);
129354
+ },
129355
+ addLazyConfigDiagnostic(file, message, ...args) {
129356
+ Debug.assert(computedDiagnostics === void 0, "Cannot modify program diagnostic state after requesting combined diagnostics");
129357
+ (lazyConfigDiagnostics ?? (lazyConfigDiagnostics = [])).push({ file, diagnostic: message, args });
129358
+ },
129359
+ addFileProcessingDiagnostic(diag2) {
129360
+ Debug.assert(computedDiagnostics === void 0, "Cannot modify program diagnostic state after requesting combined diagnostics");
129361
+ (fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push(diag2);
129362
+ },
129363
+ setCommonSourceDirectory(directory) {
129364
+ commonSourceDirectory = directory;
129365
+ },
129366
+ reuseStateFromOldProgram(oldProgramDiagnostics, isConfigIdentical) {
129367
+ fileReasons = oldProgramDiagnostics.getFileReasons();
129368
+ fileProcessingDiagnostics = oldProgramDiagnostics.getFileProcessingDiagnostics();
129369
+ if (isConfigIdentical) {
129370
+ commonSourceDirectory = oldProgramDiagnostics.getCommonSourceDirectory();
129371
+ configDiagnostics = oldProgramDiagnostics.getConfigDiagnostics();
129372
+ lazyConfigDiagnostics = oldProgramDiagnostics.getLazyConfigDiagnostics();
129373
+ }
129374
+ },
129375
+ getFileProcessingDiagnostics() {
129376
+ return fileProcessingDiagnostics;
129377
+ },
129378
+ getFileReasons() {
129379
+ return fileReasons;
129380
+ },
129381
+ getCommonSourceDirectory() {
129382
+ return commonSourceDirectory;
129383
+ },
129384
+ getConfigDiagnostics() {
129385
+ return configDiagnostics;
129386
+ },
129387
+ getLazyConfigDiagnostics() {
129388
+ return lazyConfigDiagnostics;
129389
+ },
129390
+ getCombinedDiagnostics(program) {
129391
+ if (computedDiagnostics) {
129392
+ return computedDiagnostics;
129393
+ }
129394
+ computedDiagnostics = createDiagnosticCollection();
129395
+ configDiagnostics == null ? void 0 : configDiagnostics.getDiagnostics().forEach((d) => computedDiagnostics.add(d));
129396
+ fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
129397
+ switch (diagnostic.kind) {
129398
+ case 1 /* FilePreprocessingFileExplainingDiagnostic */:
129399
+ return computedDiagnostics.add(
129400
+ createDiagnosticExplainingFile(
129401
+ program,
129402
+ diagnostic.file && program.getSourceFileByPath(diagnostic.file),
129403
+ diagnostic.fileProcessingReason,
129404
+ diagnostic.diagnostic,
129405
+ diagnostic.args || emptyArray
129406
+ )
129407
+ );
129408
+ case 0 /* FilePreprocessingLibReferenceDiagnostic */:
129409
+ return computedDiagnostics.add(filePreprocessingLibreferenceDiagnostic(program, diagnostic));
129410
+ case 2 /* ResolutionDiagnostics */:
129411
+ return diagnostic.diagnostics.forEach((d) => computedDiagnostics.add(d));
129412
+ default:
129413
+ Debug.assertNever(diagnostic);
129414
+ }
129415
+ });
129416
+ lazyConfigDiagnostics == null ? void 0 : lazyConfigDiagnostics.forEach(
129417
+ ({ file, diagnostic, args }) => computedDiagnostics.add(
129418
+ createDiagnosticExplainingFile(
129419
+ program,
129420
+ file,
129421
+ /*fileProcessingReason*/
129422
+ void 0,
129423
+ diagnostic,
129424
+ args
129425
+ )
129426
+ )
129427
+ );
129428
+ fileReasonsToChain = void 0;
129429
+ reasonToRelatedInfo = void 0;
129430
+ return computedDiagnostics;
129431
+ }
129432
+ };
129433
+ function filePreprocessingLibreferenceDiagnostic(program, { reason }) {
129434
+ const { file, pos, end } = getReferencedFileLocation(program, reason);
129435
+ const libReference = file.libReferenceDirectives[reason.index];
129436
+ const libName = getLibNameFromLibReference(libReference);
129437
+ const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
129438
+ const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
129439
+ return createFileDiagnostic(
129440
+ file,
129441
+ Debug.checkDefined(pos),
129442
+ Debug.checkDefined(end) - pos,
129443
+ suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0,
129444
+ libName,
129445
+ suggestion
129446
+ );
129447
+ }
129448
+ function createDiagnosticExplainingFile(program, file, fileProcessingReason, diagnostic, args) {
129449
+ let seenReasons;
129450
+ let fileIncludeReasons;
129451
+ let relatedInfo;
129452
+ let fileIncludeReasonDetails;
129453
+ let redirectInfo;
129454
+ let chain;
129455
+ const reasons = file && fileReasons.get(file.path);
129456
+ let locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : void 0;
129457
+ let cachedChain = file && (fileReasonsToChain == null ? void 0 : fileReasonsToChain.get(file.path));
129458
+ if (cachedChain) {
129459
+ if (cachedChain.fileIncludeReasonDetails) {
129460
+ seenReasons = new Set(reasons);
129461
+ reasons == null ? void 0 : reasons.forEach(populateRelatedInfo);
129462
+ } else {
129463
+ reasons == null ? void 0 : reasons.forEach(processReason);
129464
+ }
129465
+ redirectInfo = cachedChain.redirectInfo;
129466
+ } else {
129467
+ reasons == null ? void 0 : reasons.forEach(processReason);
129468
+ redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, program.getCompilerOptionsForFile(file));
129469
+ }
129470
+ if (fileProcessingReason) processReason(fileProcessingReason);
129471
+ const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
129472
+ if (locationReason && (seenReasons == null ? void 0 : seenReasons.size) === 1) seenReasons = void 0;
129473
+ if (seenReasons && cachedChain) {
129474
+ if (cachedChain.details && !processedExtraReason) {
129475
+ chain = chainDiagnosticMessages(cachedChain.details, diagnostic, ...args ?? emptyArray);
129476
+ } else if (cachedChain.fileIncludeReasonDetails) {
129477
+ if (!processedExtraReason) {
129478
+ if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
129479
+ fileIncludeReasonDetails = cachedChain.fileIncludeReasonDetails;
129480
+ } else {
129481
+ fileIncludeReasons = cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length);
129482
+ }
129483
+ } else {
129484
+ if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
129485
+ fileIncludeReasons = [...cachedChain.fileIncludeReasonDetails.next, fileIncludeReasons[0]];
129486
+ } else {
129487
+ fileIncludeReasons = append(cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length), fileIncludeReasons[0]);
129488
+ }
129489
+ }
129490
+ }
129491
+ }
129492
+ if (!chain) {
129493
+ if (!fileIncludeReasonDetails) fileIncludeReasonDetails = seenReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
129494
+ chain = chainDiagnosticMessages(
129495
+ redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails,
129496
+ diagnostic,
129497
+ ...args || emptyArray
129498
+ );
129499
+ }
129500
+ if (file) {
129501
+ if (cachedChain) {
129502
+ if (!cachedChain.fileIncludeReasonDetails || !processedExtraReason && fileIncludeReasonDetails) {
129503
+ cachedChain.fileIncludeReasonDetails = fileIncludeReasonDetails;
129504
+ }
129505
+ } else {
129506
+ (fileReasonsToChain ?? (fileReasonsToChain = /* @__PURE__ */ new Map())).set(file.path, cachedChain = { fileIncludeReasonDetails, redirectInfo });
129507
+ }
129508
+ if (!cachedChain.details && !processedExtraReason) cachedChain.details = chain.next;
129509
+ }
129510
+ const location = locationReason && getReferencedFileLocation(program, locationReason);
129511
+ return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
129512
+ function processReason(reason) {
129513
+ if (seenReasons == null ? void 0 : seenReasons.has(reason)) return;
129514
+ (seenReasons ?? (seenReasons = /* @__PURE__ */ new Set())).add(reason);
129515
+ (fileIncludeReasons ?? (fileIncludeReasons = [])).push(fileIncludeReasonToDiagnostics(program, reason));
129516
+ populateRelatedInfo(reason);
129517
+ }
129518
+ function populateRelatedInfo(reason) {
129519
+ if (!locationReason && isReferencedFile(reason)) {
129520
+ locationReason = reason;
129521
+ } else if (locationReason !== reason) {
129522
+ relatedInfo = append(relatedInfo, getFileIncludeReasonToRelatedInformation(program, reason));
129523
+ }
129524
+ }
129525
+ function cachedFileIncludeDetailsHasProcessedExtraReason() {
129526
+ var _a;
129527
+ return ((_a = cachedChain.fileIncludeReasonDetails.next) == null ? void 0 : _a.length) !== (reasons == null ? void 0 : reasons.length);
129528
+ }
129529
+ }
129530
+ function getFileIncludeReasonToRelatedInformation(program, reason) {
129531
+ let relatedInfo = reasonToRelatedInfo == null ? void 0 : reasonToRelatedInfo.get(reason);
129532
+ if (relatedInfo === void 0) (reasonToRelatedInfo ?? (reasonToRelatedInfo = /* @__PURE__ */ new Map())).set(reason, relatedInfo = fileIncludeReasonToRelatedInformation(program, reason) ?? false);
129533
+ return relatedInfo || void 0;
129534
+ }
129535
+ function fileIncludeReasonToRelatedInformation(program, reason) {
129536
+ if (isReferencedFile(reason)) {
129537
+ const referenceLocation = getReferencedFileLocation(program, reason);
129538
+ let message2;
129539
+ switch (reason.kind) {
129540
+ case 3 /* Import */:
129541
+ message2 = Diagnostics.File_is_included_via_import_here;
129542
+ break;
129543
+ case 4 /* ReferenceFile */:
129544
+ message2 = Diagnostics.File_is_included_via_reference_here;
129545
+ break;
129546
+ case 5 /* TypeReferenceDirective */:
129547
+ message2 = Diagnostics.File_is_included_via_type_library_reference_here;
129548
+ break;
129549
+ case 7 /* LibReferenceDirective */:
129550
+ message2 = Diagnostics.File_is_included_via_library_reference_here;
129551
+ break;
129552
+ default:
129553
+ Debug.assertNever(reason);
129554
+ }
129555
+ return isReferenceFileLocation(referenceLocation) ? createFileDiagnostic(
129556
+ referenceLocation.file,
129557
+ referenceLocation.pos,
129558
+ referenceLocation.end - referenceLocation.pos,
129559
+ message2
129560
+ ) : void 0;
129561
+ }
129562
+ const currentDirectory = program.getCurrentDirectory();
129563
+ const rootNames = program.getRootFileNames();
129564
+ const options = program.getCompilerOptions();
129565
+ if (!options.configFile) return void 0;
129566
+ let configFileNode;
129567
+ let message;
129568
+ switch (reason.kind) {
129569
+ case 0 /* RootFile */:
129570
+ if (!options.configFile.configFileSpecs) return void 0;
129571
+ const fileName = getNormalizedAbsolutePath(rootNames[reason.index], currentDirectory);
129572
+ const matchedByFiles = getMatchedFileSpec(program, fileName);
129573
+ if (matchedByFiles) {
129574
+ configFileNode = getTsConfigPropArrayElementValue(options.configFile, "files", matchedByFiles);
129575
+ message = Diagnostics.File_is_matched_by_files_list_specified_here;
129576
+ break;
129577
+ }
129578
+ const matchedByInclude = getMatchedIncludeSpec(program, fileName);
129579
+ if (!matchedByInclude || !isString(matchedByInclude)) return void 0;
129580
+ configFileNode = getTsConfigPropArrayElementValue(options.configFile, "include", matchedByInclude);
129581
+ message = Diagnostics.File_is_matched_by_include_pattern_specified_here;
129582
+ break;
129583
+ case 1 /* SourceFromProjectReference */:
129584
+ case 2 /* OutputFromProjectReference */:
129585
+ const resolvedProjectReferences = program.getResolvedProjectReferences();
129586
+ const projectReferences = program.getProjectReferences();
129587
+ const referencedResolvedRef = Debug.checkDefined(resolvedProjectReferences == null ? void 0 : resolvedProjectReferences[reason.index]);
129588
+ const referenceInfo = forEachProjectReference(
129589
+ projectReferences,
129590
+ resolvedProjectReferences,
129591
+ (resolvedRef, parent2, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent2 == null ? void 0 : parent2.sourceFile) || options.configFile, index: index2 } : void 0
129592
+ );
129593
+ if (!referenceInfo) return void 0;
129594
+ const { sourceFile, index } = referenceInfo;
129595
+ const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
129596
+ return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
129597
+ sourceFile,
129598
+ referencesSyntax.elements[index],
129599
+ reason.kind === 2 /* OutputFromProjectReference */ ? Diagnostics.File_is_output_from_referenced_project_specified_here : Diagnostics.File_is_source_from_referenced_project_specified_here
129600
+ ) : void 0;
129601
+ case 8 /* AutomaticTypeDirectiveFile */:
129602
+ if (!options.types) return void 0;
129603
+ configFileNode = getOptionsSyntaxByArrayElementValue(getCompilerOptionsObjectLiteralSyntax(), "types", reason.typeReference);
129604
+ message = Diagnostics.File_is_entry_point_of_type_library_specified_here;
129605
+ break;
129606
+ case 6 /* LibFile */:
129607
+ if (reason.index !== void 0) {
129608
+ configFileNode = getOptionsSyntaxByArrayElementValue(getCompilerOptionsObjectLiteralSyntax(), "lib", options.lib[reason.index]);
129609
+ message = Diagnostics.File_is_library_specified_here;
129610
+ break;
129611
+ }
129612
+ const target = getNameOfScriptTarget(getEmitScriptTarget(options));
129613
+ configFileNode = target ? getOptionsSyntaxByValue(getCompilerOptionsObjectLiteralSyntax(), "target", target) : void 0;
129614
+ message = Diagnostics.File_is_default_library_for_target_specified_here;
129615
+ break;
129616
+ default:
129617
+ Debug.assertNever(reason);
129618
+ }
129619
+ return configFileNode && createDiagnosticForNodeInSourceFile(
129620
+ options.configFile,
129621
+ configFileNode,
129622
+ message
129623
+ );
129624
+ }
129625
+ }
129626
+
128819
129627
  // src/compiler/builderState.ts
128820
129628
  function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers, forceDtsEmit) {
128821
129629
  const outputFiles = [];
@@ -136971,18 +137779,21 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
136971
137779
  return failed;
136972
137780
  }
136973
137781
  function typeFromFunctionLikeExpression(fnNode, context) {
136974
- const oldNoInferenceFallback = context.noInferenceFallback;
136975
- context.noInferenceFallback = true;
136976
- createReturnFromSignature(
137782
+ const returnType = createReturnFromSignature(
136977
137783
  fnNode,
136978
137784
  /*symbol*/
136979
137785
  void 0,
136980
137786
  context
136981
137787
  );
136982
- reuseTypeParameters(fnNode.typeParameters, context);
136983
- fnNode.parameters.map((p) => ensureParameter(p, context));
136984
- context.noInferenceFallback = oldNoInferenceFallback;
136985
- return notImplemented2;
137788
+ const typeParameters = reuseTypeParameters(fnNode.typeParameters, context);
137789
+ const parameters = fnNode.parameters.map((p) => ensureParameter(p, context));
137790
+ return syntacticResult(
137791
+ factory.createFunctionTypeNode(
137792
+ typeParameters,
137793
+ parameters,
137794
+ returnType
137795
+ )
137796
+ );
136986
137797
  }
136987
137798
  function canGetTypeFromArrayLiteral(arrayLiteral, context, isConstContext) {
136988
137799
  if (!isConstContext) {
@@ -139829,9 +140640,9 @@ function mapToDisplayParts(writeDisplayParts) {
139829
140640
  displayPartWriter.clear();
139830
140641
  }
139831
140642
  }
139832
- function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags = 0 /* None */) {
140643
+ function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags = 0 /* None */, verbosityLevel, out) {
139833
140644
  return mapToDisplayParts((writer) => {
139834
- typechecker.writeType(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer);
140645
+ typechecker.writeType(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer, verbosityLevel, out);
139835
140646
  });
139836
140647
  }
139837
140648
  function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags = 0 /* None */) {
@@ -140538,7 +141349,7 @@ function moduleSymbolToValidIdentifier(moduleSymbol, target, forceCapitalize) {
140538
141349
  return moduleSpecifierToValidIdentifier(removeFileExtension(stripQuotes(moduleSymbol.name)), target, forceCapitalize);
140539
141350
  }
140540
141351
  function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitalize) {
140541
- const baseName = getBaseFileName(removeSuffix(moduleSpecifier, "/index"));
141352
+ const baseName = getBaseFileName(removeSuffix(removeFileExtension(moduleSpecifier), "/index"));
140542
141353
  let res = "";
140543
141354
  let lastCharWasValid = true;
140544
141355
  const firstCharCode = baseName.charCodeAt(0);
@@ -151796,7 +152607,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
151796
152607
  synchronizeHostData();
151797
152608
  return ts_Completions_exports.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name, source }, host, preferences);
151798
152609
  }
151799
- function getQuickInfoAtPosition(fileName, position) {
152610
+ function getQuickInfoAtPosition(fileName, position, verbosityLevel) {
151800
152611
  synchronizeHostData();
151801
152612
  const sourceFile = getValidSourceFile(fileName);
151802
152613
  const node = getTouchingPropertyName(sourceFile, position);
@@ -151812,19 +152623,41 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
151812
152623
  kind: "" /* unknown */,
151813
152624
  kindModifiers: "" /* none */,
151814
152625
  textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile),
151815
- displayParts: typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => typeToDisplayParts(typeChecker2, type, getContainerNode(nodeForQuickInfo))),
152626
+ displayParts: typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => typeToDisplayParts(
152627
+ typeChecker2,
152628
+ type,
152629
+ getContainerNode(nodeForQuickInfo),
152630
+ /*flags*/
152631
+ void 0,
152632
+ verbosityLevel
152633
+ )),
151816
152634
  documentation: type.symbol ? type.symbol.getDocumentationComment(typeChecker) : void 0,
151817
152635
  tags: type.symbol ? type.symbol.getJsDocTags(typeChecker) : void 0
151818
152636
  };
151819
152637
  }
151820
- const { symbolKind, displayParts, documentation, tags } = typeChecker.runWithCancellationToken(cancellationToken, (typeChecker2) => ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker2, symbol, sourceFile, getContainerNode(nodeForQuickInfo), nodeForQuickInfo));
152638
+ const { symbolKind, displayParts, documentation, tags, canIncreaseVerbosityLevel } = typeChecker.runWithCancellationToken(
152639
+ cancellationToken,
152640
+ (typeChecker2) => ts_SymbolDisplay_exports.getSymbolDisplayPartsDocumentationAndSymbolKind(
152641
+ typeChecker2,
152642
+ symbol,
152643
+ sourceFile,
152644
+ getContainerNode(nodeForQuickInfo),
152645
+ nodeForQuickInfo,
152646
+ /*semanticMeaning*/
152647
+ void 0,
152648
+ /*alias*/
152649
+ void 0,
152650
+ verbosityLevel
152651
+ )
152652
+ );
151821
152653
  return {
151822
152654
  kind: symbolKind,
151823
152655
  kindModifiers: ts_SymbolDisplay_exports.getSymbolModifiers(typeChecker, symbol),
151824
152656
  textSpan: createTextSpanFromNode(nodeForQuickInfo, sourceFile),
151825
152657
  displayParts,
151826
152658
  documentation,
151827
- tags
152659
+ tags,
152660
+ canIncreaseVerbosityLevel
151828
152661
  };
151829
152662
  }
151830
152663
  function preparePasteEditsForFile(fileName, copiedTextRange) {
@@ -156855,6 +157688,7 @@ var errorCodes19 = [
156855
157688
  Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode.code,
156856
157689
  Diagnostics.Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig.code,
156857
157690
  Diagnostics.Cannot_find_namespace_0_Did_you_mean_1.code,
157691
+ Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code,
156858
157692
  Diagnostics.This_JSX_tag_requires_0_to_be_in_scope_but_it_could_not_be_found.code
156859
157693
  ];
156860
157694
  registerCodeFix({
@@ -157958,6 +158792,7 @@ function getUmdImportKind(importingFile, program, forceImportKeyword) {
157958
158792
  case 200 /* Preserve */:
157959
158793
  return 2 /* Namespace */;
157960
158794
  case 100 /* Node16 */:
158795
+ case 101 /* Node18 */:
157961
158796
  case 199 /* NodeNext */:
157962
158797
  return getImpliedNodeFormatForEmit(importingFile, program) === 99 /* ESNext */ ? 2 /* Namespace */ : 3 /* CommonJS */;
157963
158798
  default:
@@ -159369,7 +160204,8 @@ var errorCodes28 = [
159369
160204
  Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2.code,
159370
160205
  Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more.code,
159371
160206
  Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code,
159372
- Diagnostics.Cannot_find_name_0.code
160207
+ Diagnostics.Cannot_find_name_0.code,
160208
+ Diagnostics.Type_0_does_not_satisfy_the_expected_type_1.code
159373
160209
  ];
159374
160210
  registerCodeFix({
159375
160211
  errorCodes: errorCodes28,
@@ -159406,9 +160242,9 @@ registerCodeFix({
159406
160242
  return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
159407
160243
  eachDiagnostic(context, errorCodes28, (diag2) => {
159408
160244
  const info = getInfo10(diag2.file, diag2.start, diag2.code, checker, context.program);
159409
- if (!info || !addToSeen(seen, getNodeId(info.parentDeclaration) + "#" + (info.kind === 3 /* ObjectLiteral */ ? info.identifier : info.token.text))) {
159410
- return;
159411
- }
160245
+ if (info === void 0) return;
160246
+ const nodeId = getNodeId(info.parentDeclaration) + "#" + (info.kind === 3 /* ObjectLiteral */ ? info.identifier || getNodeId(info.token) : info.token.text);
160247
+ if (!addToSeen(seen, nodeId)) return;
159412
160248
  if (fixId56 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) {
159413
160249
  addFunctionDeclaration(changes, context, info);
159414
160250
  } else if (fixId56 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
@@ -159452,7 +160288,7 @@ registerCodeFix({
159452
160288
  }
159453
160289
  });
159454
160290
  function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
159455
- var _a, _b, _c;
160291
+ var _a, _b;
159456
160292
  const token = getTokenAtPosition(sourceFile, tokenPos);
159457
160293
  const parent2 = token.parent;
159458
160294
  if (errorCode === Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code) {
@@ -159474,23 +160310,25 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
159474
160310
  if (!length(properties)) return void 0;
159475
160311
  return { kind: 3 /* ObjectLiteral */, token: param.name, identifier: param.name.text, properties, parentDeclaration: parent2 };
159476
160312
  }
159477
- if (token.kind === 19 /* OpenBraceToken */ && isObjectLiteralExpression(parent2)) {
159478
- const targetType = (_a = checker.getContextualType(parent2) || checker.getTypeAtLocation(parent2)) == null ? void 0 : _a.getNonNullableType();
159479
- const properties = arrayFrom(checker.getUnmatchedProperties(
159480
- checker.getTypeAtLocation(parent2),
159481
- targetType,
159482
- /*requireOptionalProperties*/
159483
- false,
159484
- /*matchDiscriminantProperties*/
159485
- false
159486
- ));
159487
- if (!length(properties)) return void 0;
159488
- const identifier = "";
159489
- return { kind: 3 /* ObjectLiteral */, token: parent2, identifier, properties, parentDeclaration: parent2 };
160313
+ if (token.kind === 19 /* OpenBraceToken */ || isSatisfiesExpression(parent2) || isReturnStatement(parent2)) {
160314
+ const expression = (isSatisfiesExpression(parent2) || isReturnStatement(parent2)) && parent2.expression ? parent2.expression : parent2;
160315
+ if (isObjectLiteralExpression(expression)) {
160316
+ const targetType = isSatisfiesExpression(parent2) ? checker.getTypeFromTypeNode(parent2.type) : checker.getContextualType(expression) || checker.getTypeAtLocation(expression);
160317
+ const properties = arrayFrom(checker.getUnmatchedProperties(
160318
+ checker.getTypeAtLocation(parent2),
160319
+ targetType.getNonNullableType(),
160320
+ /*requireOptionalProperties*/
160321
+ false,
160322
+ /*matchDiscriminantProperties*/
160323
+ false
160324
+ ));
160325
+ if (!length(properties)) return void 0;
160326
+ return { kind: 3 /* ObjectLiteral */, token: parent2, identifier: void 0, properties, parentDeclaration: expression, indentation: isReturnStatement(expression.parent) || isYieldExpression(expression.parent) ? 0 : void 0 };
160327
+ }
159490
160328
  }
159491
160329
  if (!isMemberName(token)) return void 0;
159492
160330
  if (isIdentifier(token) && hasInitializer(parent2) && parent2.initializer && isObjectLiteralExpression(parent2.initializer)) {
159493
- const targetType = (_b = checker.getContextualType(token) || checker.getTypeAtLocation(token)) == null ? void 0 : _b.getNonNullableType();
160331
+ const targetType = (_a = checker.getContextualType(token) || checker.getTypeAtLocation(token)) == null ? void 0 : _a.getNonNullableType();
159494
160332
  const properties = arrayFrom(checker.getUnmatchedProperties(
159495
160333
  checker.getTypeAtLocation(parent2.initializer),
159496
160334
  targetType,
@@ -159509,7 +160347,7 @@ function getInfo10(sourceFile, tokenPos, errorCode, checker, program) {
159509
160347
  return { kind: 4 /* JsxAttributes */, token, attributes, parentDeclaration: token.parent };
159510
160348
  }
159511
160349
  if (isIdentifier(token)) {
159512
- const type = (_c = checker.getContextualType(token)) == null ? void 0 : _c.getNonNullableType();
160350
+ const type = (_b = checker.getContextualType(token)) == null ? void 0 : _b.getNonNullableType();
159513
160351
  if (type && getObjectFlags(type) & 16 /* Anonymous */) {
159514
160352
  const signature = firstOrUndefined(checker.getSignaturesOfType(type, 0 /* Call */));
159515
160353
  if (signature === void 0) return void 0;
@@ -160512,9 +161350,9 @@ function getSuggestion(messageText) {
160512
161350
  // src/services/codefixes/fixModuleAndTargetOptions.ts
160513
161351
  registerCodeFix({
160514
161352
  errorCodes: [
160515
- Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher.code,
160516
- Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher.code,
160517
- Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher.code
161353
+ Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher.code,
161354
+ Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher.code,
161355
+ Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_node18_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher.code
160518
161356
  ],
160519
161357
  getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
160520
161358
  const compilerOptions = context.program.getCompilerOptions();
@@ -160983,6 +161821,8 @@ registerCodeFix({
160983
161821
  break;
160984
161822
  } else if (canDeleteEntireVariableStatement(sourceFile, token)) {
160985
161823
  deleteEntireVariableStatement(changes, sourceFile, token.parent);
161824
+ } else if (isIdentifier(token) && isFunctionDeclaration(token.parent)) {
161825
+ deleteFunctionLikeDeclaration(changes, sourceFile, token.parent);
160986
161826
  } else {
160987
161827
  tryDeleteDeclaration(
160988
161828
  sourceFile,
@@ -163950,12 +164790,10 @@ function typeToAutoImportableTypeNode(checker, importAdder, type, contextNode, s
163950
164790
  return typeNodeToAutoImportableTypeNode(typeNode, importAdder, scriptTarget);
163951
164791
  }
163952
164792
  function typeNodeToAutoImportableTypeNode(typeNode, importAdder, scriptTarget) {
163953
- if (typeNode && isImportTypeNode(typeNode)) {
163954
- const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
163955
- if (importableReference) {
163956
- importSymbols(importAdder, importableReference.symbols);
163957
- typeNode = importableReference.typeNode;
163958
- }
164793
+ const importableReference = tryGetAutoImportableReferenceFromTypeNode(typeNode, scriptTarget);
164794
+ if (importableReference) {
164795
+ importSymbols(importAdder, importableReference.symbols);
164796
+ typeNode = importableReference.typeNode;
163959
164797
  }
163960
164798
  return getSynthesizedDeepClone(typeNode);
163961
164799
  }
@@ -172474,7 +173312,7 @@ var Core;
172474
173312
  } else {
172475
173313
  addIfImplementation(body);
172476
173314
  }
172477
- } else if (isAssertionExpression(typeHavingNode)) {
173315
+ } else if (isAssertionExpression(typeHavingNode) || isSatisfiesExpression(typeHavingNode)) {
172478
173316
  addIfImplementation(typeHavingNode.expression);
172479
173317
  }
172480
173318
  }
@@ -172913,7 +173751,10 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
172913
173751
  const { parent: parent2 } = node;
172914
173752
  const typeChecker = program.getTypeChecker();
172915
173753
  if (node.kind === 164 /* OverrideKeyword */ || isIdentifier(node) && isJSDocOverrideTag(parent2) && parent2.tagName === node) {
172916
- return getDefinitionFromOverriddenMember(typeChecker, node) || emptyArray;
173754
+ const def = getDefinitionFromOverriddenMember(typeChecker, node);
173755
+ if (def !== void 0 || node.kind !== 164 /* OverrideKeyword */) {
173756
+ return def || emptyArray;
173757
+ }
172917
173758
  }
172918
173759
  if (isJumpStatementTarget(node)) {
172919
173760
  const label = getTargetLabel(node.parent, node.text);
@@ -172927,9 +173768,6 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
172927
173768
  )] : void 0;
172928
173769
  }
172929
173770
  switch (node.kind) {
172930
- case 107 /* ReturnKeyword */:
172931
- const functionDeclaration = findAncestor(node.parent, (n) => isClassStaticBlockDeclaration(n) ? "quit" : isFunctionLikeDeclaration(n));
172932
- return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
172933
173771
  case 90 /* DefaultKeyword */:
172934
173772
  if (!isDefaultClause(node.parent)) {
172935
173773
  break;
@@ -172942,15 +173780,14 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
172942
173780
  }
172943
173781
  break;
172944
173782
  }
172945
- if (node.kind === 135 /* AwaitKeyword */) {
172946
- const functionDeclaration = findAncestor(node, (n) => isFunctionLikeDeclaration(n));
172947
- const isAsyncFunction2 = functionDeclaration && some(functionDeclaration.modifiers, (node2) => node2.kind === 134 /* AsyncKeyword */);
172948
- return isAsyncFunction2 ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
172949
- }
172950
- if (node.kind === 127 /* YieldKeyword */) {
172951
- const functionDeclaration = findAncestor(node, (n) => isFunctionLikeDeclaration(n));
172952
- const isGeneratorFunction = functionDeclaration && functionDeclaration.asteriskToken;
172953
- return isGeneratorFunction ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
173783
+ let findFunctionDecl;
173784
+ switch (node.kind) {
173785
+ case 107 /* ReturnKeyword */:
173786
+ case 135 /* AwaitKeyword */:
173787
+ case 127 /* YieldKeyword */:
173788
+ findFunctionDecl = isFunctionLikeDeclaration;
173789
+ const functionDeclaration = findAncestor(node, findFunctionDecl);
173790
+ return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : void 0;
172954
173791
  }
172955
173792
  if (isStaticModifier(node) && isClassStaticBlockDeclaration(node.parent)) {
172956
173793
  const classDecl = node.parent.parent;
@@ -173000,6 +173837,9 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
173000
173837
  }];
173001
173838
  }
173002
173839
  }
173840
+ if (isModifier(node) && (isClassElement(parent2) || isNamedDeclaration(parent2))) {
173841
+ symbol = parent2.symbol;
173842
+ }
173003
173843
  if (!symbol) {
173004
173844
  return concatenate(fileReferenceDefinition, getDefinitionInfoForIndexSignatures(node, typeChecker));
173005
173845
  }
@@ -173196,12 +174036,16 @@ function getTypeDefinitionAtPosition(typeChecker, sourceFile, position) {
173196
174036
  false
173197
174037
  );
173198
174038
  }
173199
- const { symbol, failedAliasResolution } = getSymbol(
174039
+ let { symbol, failedAliasResolution } = getSymbol(
173200
174040
  node,
173201
174041
  typeChecker,
173202
174042
  /*stopAtAlias*/
173203
174043
  false
173204
174044
  );
174045
+ if (isModifier(node) && (isClassElement(node.parent) || isNamedDeclaration(node.parent))) {
174046
+ symbol = node.parent.symbol;
174047
+ failedAliasResolution = false;
174048
+ }
173205
174049
  if (!symbol) return void 0;
173206
174050
  const typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
173207
174051
  const returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
@@ -173706,22 +174550,24 @@ function provideInlayHints(context) {
173706
174550
  if (!signature) {
173707
174551
  return;
173708
174552
  }
173709
- for (let i = 0; i < node.parameters.length && i < signature.parameters.length; ++i) {
173710
- const param = node.parameters[i];
173711
- if (!isHintableDeclaration(param)) {
173712
- continue;
173713
- }
173714
- const effectiveTypeAnnotation = getEffectiveTypeAnnotationNode(param);
173715
- if (effectiveTypeAnnotation) {
173716
- continue;
174553
+ let pos = 0;
174554
+ for (const param of node.parameters) {
174555
+ if (isHintableDeclaration(param)) {
174556
+ addParameterTypeHint(param, parameterIsThisKeyword(param) ? signature.thisParameter : signature.parameters[pos]);
173717
174557
  }
173718
- const typeHints = getParameterDeclarationTypeHints(signature.parameters[i]);
173719
- if (!typeHints) {
174558
+ if (parameterIsThisKeyword(param)) {
173720
174559
  continue;
173721
174560
  }
173722
- addTypeHints(typeHints, param.questionToken ? param.questionToken.end : param.name.end);
174561
+ pos++;
173723
174562
  }
173724
174563
  }
174564
+ function addParameterTypeHint(node, symbol) {
174565
+ const effectiveTypeAnnotation = getEffectiveTypeAnnotationNode(node);
174566
+ if (effectiveTypeAnnotation || symbol === void 0) return;
174567
+ const typeHints = getParameterDeclarationTypeHints(symbol);
174568
+ if (typeHints === void 0) return;
174569
+ addTypeHints(typeHints, node.questionToken ? node.questionToken.end : node.name.end);
174570
+ }
173725
174571
  function getParameterDeclarationTypeHints(symbol) {
173726
174572
  const valueDeclaration = symbol.valueDeclaration;
173727
174573
  if (!valueDeclaration || !isParameter(valueDeclaration)) {
@@ -176887,7 +177733,7 @@ function getSymbolModifiers(typeChecker, symbol) {
176887
177733
  }
176888
177734
  return modifiers.size > 0 ? arrayFrom(modifiers.values()).join(",") : "" /* none */;
176889
177735
  }
176890
- function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, type, semanticMeaning, alias) {
177736
+ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, type, semanticMeaning, alias, verbosityLevel) {
176891
177737
  var _a;
176892
177738
  const displayParts = [];
176893
177739
  let documentation = [];
@@ -176899,6 +177745,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
176899
177745
  let documentationFromAlias;
176900
177746
  let tagsFromAlias;
176901
177747
  let hasMultipleSignatures = false;
177748
+ const typeWriterOut = verbosityLevel !== void 0 ? { couldUnfoldMore: false } : void 0;
176902
177749
  if (location.kind === 110 /* ThisKeyword */ && !isThisExpression) {
176903
177750
  return { displayParts: [keywordPart(110 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: void 0 };
176904
177751
  }
@@ -177058,7 +177905,17 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
177058
177905
  displayParts.push(spacePart());
177059
177906
  displayParts.push(operatorPart(64 /* EqualsToken */));
177060
177907
  displayParts.push(spacePart());
177061
- addRange(displayParts, typeToDisplayParts(typeChecker, location.parent && isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
177908
+ addRange(
177909
+ displayParts,
177910
+ typeToDisplayParts(
177911
+ typeChecker,
177912
+ location.parent && isConstTypeReference(location.parent) ? typeChecker.getTypeAtLocation(location.parent) : typeChecker.getDeclaredTypeOfSymbol(symbol),
177913
+ enclosingDeclaration,
177914
+ 8388608 /* InTypeAlias */,
177915
+ verbosityLevel,
177916
+ typeWriterOut
177917
+ )
177918
+ );
177062
177919
  }
177063
177920
  if (symbolFlags & 384 /* Enum */) {
177064
177921
  prefixNextMeaning();
@@ -177217,12 +178074,32 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
177217
178074
  displayParts.push(spacePart());
177218
178075
  if (type.symbol && type.symbol.flags & 262144 /* TypeParameter */ && symbolKind !== "index" /* indexSignatureElement */) {
177219
178076
  const typeParameterParts = mapToDisplayParts((writer) => {
177220
- const param = typeChecker.typeParameterToDeclaration(type, enclosingDeclaration, symbolDisplayNodeBuilderFlags);
178077
+ const param = typeChecker.typeParameterToDeclaration(
178078
+ type,
178079
+ enclosingDeclaration,
178080
+ symbolDisplayNodeBuilderFlags,
178081
+ /*internalFlags*/
178082
+ void 0,
178083
+ /*tracker*/
178084
+ void 0,
178085
+ verbosityLevel
178086
+ );
177221
178087
  getPrinter().writeNode(4 /* Unspecified */, param, getSourceFileOfNode(getParseTreeNode(enclosingDeclaration)), writer);
177222
178088
  });
177223
178089
  addRange(displayParts, typeParameterParts);
177224
178090
  } else {
177225
- addRange(displayParts, typeToDisplayParts(typeChecker, type, enclosingDeclaration));
178091
+ addRange(
178092
+ displayParts,
178093
+ typeToDisplayParts(
178094
+ typeChecker,
178095
+ type,
178096
+ enclosingDeclaration,
178097
+ /*flags*/
178098
+ void 0,
178099
+ verbosityLevel,
178100
+ typeWriterOut
178101
+ )
178102
+ );
177226
178103
  }
177227
178104
  if (isTransientSymbol(symbol) && symbol.links.target && isTransientSymbol(symbol.links.target) && symbol.links.target.links.tupleLabelDeclaration) {
177228
178105
  const labelDecl = symbol.links.target.links.tupleLabelDeclaration;
@@ -177287,7 +178164,13 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
177287
178164
  if (tags.length === 0 && tagsFromAlias) {
177288
178165
  tags = tagsFromAlias;
177289
178166
  }
177290
- return { displayParts, documentation, symbolKind, tags: tags.length === 0 ? void 0 : tags };
178167
+ return {
178168
+ displayParts,
178169
+ documentation,
178170
+ symbolKind,
178171
+ tags: tags.length === 0 ? void 0 : tags,
178172
+ canIncreaseVerbosityLevel: typeWriterOut == null ? void 0 : typeWriterOut.couldUnfoldMore
178173
+ };
177291
178174
  function getPrinter() {
177292
178175
  return createPrinterWithRemoveComments();
177293
178176
  }
@@ -177400,7 +178283,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
177400
178283
  addRange(displayParts, typeParameterParts);
177401
178284
  }
177402
178285
  }
177403
- function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias) {
178286
+ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias, verbosityLevel) {
177404
178287
  return getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
177405
178288
  typeChecker,
177406
178289
  symbol,
@@ -177410,7 +178293,8 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
177410
178293
  /*type*/
177411
178294
  void 0,
177412
178295
  semanticMeaning,
177413
- alias
178296
+ alias,
178297
+ verbosityLevel
177414
178298
  );
177415
178299
  }
177416
178300
  function isLocalVariableOrFunction(symbol) {
@@ -182080,6 +182964,7 @@ __export(ts_exports2, {
182080
182964
  createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
182081
182965
  createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
182082
182966
  createProgram: () => createProgram,
182967
+ createProgramDiagnostics: () => createProgramDiagnostics,
182083
182968
  createProgramHost: () => createProgramHost,
182084
182969
  createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,
182085
182970
  createQueue: () => createQueue,
@@ -182249,6 +183134,8 @@ __export(ts_exports2, {
182249
183134
  forEachLeadingCommentRange: () => forEachLeadingCommentRange,
182250
183135
  forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
182251
183136
  forEachNameOfDefaultExport: () => forEachNameOfDefaultExport,
183137
+ forEachOptionsSyntaxByName: () => forEachOptionsSyntaxByName,
183138
+ forEachProjectReference: () => forEachProjectReference,
182252
183139
  forEachPropertyAssignment: () => forEachPropertyAssignment,
182253
183140
  forEachResolvedProjectReference: () => forEachResolvedProjectReference,
182254
183141
  forEachReturnStatement: () => forEachReturnStatement,
@@ -182488,6 +183375,8 @@ __export(ts_exports2, {
182488
183375
  getLeadingCommentRangesOfNode: () => getLeadingCommentRangesOfNode,
182489
183376
  getLeftmostAccessExpression: () => getLeftmostAccessExpression,
182490
183377
  getLeftmostExpression: () => getLeftmostExpression,
183378
+ getLibFileNameFromLibReference: () => getLibFileNameFromLibReference,
183379
+ getLibNameFromLibReference: () => getLibNameFromLibReference,
182491
183380
  getLibraryNameFromLibFileName: () => getLibraryNameFromLibFileName,
182492
183381
  getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
182493
183382
  getLineInfo: () => getLineInfo,
@@ -182560,6 +183449,8 @@ __export(ts_exports2, {
182560
183449
  getOptionFromName: () => getOptionFromName,
182561
183450
  getOptionsForLibraryResolution: () => getOptionsForLibraryResolution,
182562
183451
  getOptionsNameMap: () => getOptionsNameMap,
183452
+ getOptionsSyntaxByArrayElementValue: () => getOptionsSyntaxByArrayElementValue,
183453
+ getOptionsSyntaxByValue: () => getOptionsSyntaxByValue,
182563
183454
  getOrCreateEmitNode: () => getOrCreateEmitNode,
182564
183455
  getOrUpdate: () => getOrUpdate,
182565
183456
  getOriginalNode: () => getOriginalNode,
@@ -182596,7 +183487,6 @@ __export(ts_exports2, {
182596
183487
  getPrivateIdentifier: () => getPrivateIdentifier,
182597
183488
  getProperties: () => getProperties,
182598
183489
  getProperty: () => getProperty,
182599
- getPropertyArrayElementValue: () => getPropertyArrayElementValue,
182600
183490
  getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
182601
183491
  getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
182602
183492
  getPropertyNameFromType: () => getPropertyNameFromType,
@@ -183507,6 +184397,7 @@ __export(ts_exports2, {
183507
184397
  moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
183508
184398
  moduleSpecifierToValidIdentifier: () => moduleSpecifierToValidIdentifier,
183509
184399
  moduleSpecifiers: () => ts_moduleSpecifiers_exports,
184400
+ moduleSupportsImportAttributes: () => moduleSupportsImportAttributes,
183510
184401
  moduleSymbolToValidIdentifier: () => moduleSymbolToValidIdentifier,
183511
184402
  moveEmitHelpers: () => moveEmitHelpers,
183512
184403
  moveRangeEnd: () => moveRangeEnd,
@@ -184881,6 +185772,7 @@ var ModuleKind2 = /* @__PURE__ */ ((ModuleKind3) => {
184881
185772
  ModuleKind3["ES2022"] = "es2022";
184882
185773
  ModuleKind3["ESNext"] = "esnext";
184883
185774
  ModuleKind3["Node16"] = "node16";
185775
+ ModuleKind3["Node18"] = "node18";
184884
185776
  ModuleKind3["NodeNext"] = "nodenext";
184885
185777
  ModuleKind3["Preserve"] = "preserve";
184886
185778
  return ModuleKind3;
@@ -194352,7 +195244,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
194352
195244
  getQuickInfoWorker(args, simplifiedResult) {
194353
195245
  const { file, project } = this.getFileAndProject(args);
194354
195246
  const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file);
194355
- const quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo));
195247
+ const quickInfo = project.getLanguageService().getQuickInfoAtPosition(file, this.getPosition(args, scriptInfo), args.verbosityLevel);
194356
195248
  if (!quickInfo) {
194357
195249
  return void 0;
194358
195250
  }
@@ -194366,7 +195258,8 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
194366
195258
  end: scriptInfo.positionToLineOffset(textSpanEnd(quickInfo.textSpan)),
194367
195259
  displayString,
194368
195260
  documentation: useDisplayParts ? this.mapDisplayParts(quickInfo.documentation, project) : displayPartsToString(quickInfo.documentation),
194369
- tags: this.mapJSDocTagInfo(quickInfo.tags, project, useDisplayParts)
195261
+ tags: this.mapJSDocTagInfo(quickInfo.tags, project, useDisplayParts),
195262
+ canIncreaseVerbosityLevel: quickInfo.canIncreaseVerbosityLevel
194370
195263
  };
194371
195264
  } else {
194372
195265
  return useDisplayParts ? quickInfo : {
@@ -194910,20 +195803,19 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
194910
195803
  try {
194911
195804
  codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes, this.getFormatOptions(file), this.getPreferences(file));
194912
195805
  } catch (e) {
195806
+ const error2 = e instanceof Error ? e : new Error(e);
194913
195807
  const ls = project.getLanguageService();
194914
195808
  const existingDiagCodes = [
194915
195809
  ...ls.getSyntacticDiagnostics(file),
194916
195810
  ...ls.getSemanticDiagnostics(file),
194917
195811
  ...ls.getSuggestionDiagnostics(file)
194918
- ].map(
194919
- (d) => decodedTextSpanIntersectsWith(startPosition, endPosition - startPosition, d.start, d.length) && d.code
194920
- );
195812
+ ].filter((d) => decodedTextSpanIntersectsWith(startPosition, endPosition - startPosition, d.start, d.length)).map((d) => d.code);
194921
195813
  const badCode = args.errorCodes.find((c) => !existingDiagCodes.includes(c));
194922
195814
  if (badCode !== void 0) {
194923
- e.message = `BADCLIENT: Bad error code, ${badCode} not found in range ${startPosition}..${endPosition} (found: ${existingDiagCodes.join(", ")}); could have caused this error:
194924
- ${e.message}`;
195815
+ error2.message += `
195816
+ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range ${startPosition}..${endPosition} (found: ${existingDiagCodes.join(", ")})`;
194925
195817
  }
194926
- throw e;
195818
+ throw error2;
194927
195819
  }
194928
195820
  return simplifiedResult ? codeActions.map((codeAction) => this.mapCodeFixAction(codeAction)) : codeActions;
194929
195821
  }
@@ -196826,6 +197718,7 @@ if (typeof console !== "undefined") {
196826
197718
  createPrinterWithRemoveCommentsNeverAsciiEscape,
196827
197719
  createPrinterWithRemoveCommentsOmitTrailingSemicolon,
196828
197720
  createProgram,
197721
+ createProgramDiagnostics,
196829
197722
  createProgramHost,
196830
197723
  createPropertyNameNodeForIdentifierOrLiteral,
196831
197724
  createQueue,
@@ -196995,6 +197888,8 @@ if (typeof console !== "undefined") {
196995
197888
  forEachLeadingCommentRange,
196996
197889
  forEachNameInAccessChainWalkingLeft,
196997
197890
  forEachNameOfDefaultExport,
197891
+ forEachOptionsSyntaxByName,
197892
+ forEachProjectReference,
196998
197893
  forEachPropertyAssignment,
196999
197894
  forEachResolvedProjectReference,
197000
197895
  forEachReturnStatement,
@@ -197234,6 +198129,8 @@ if (typeof console !== "undefined") {
197234
198129
  getLeadingCommentRangesOfNode,
197235
198130
  getLeftmostAccessExpression,
197236
198131
  getLeftmostExpression,
198132
+ getLibFileNameFromLibReference,
198133
+ getLibNameFromLibReference,
197237
198134
  getLibraryNameFromLibFileName,
197238
198135
  getLineAndCharacterOfPosition,
197239
198136
  getLineInfo,
@@ -197306,6 +198203,8 @@ if (typeof console !== "undefined") {
197306
198203
  getOptionFromName,
197307
198204
  getOptionsForLibraryResolution,
197308
198205
  getOptionsNameMap,
198206
+ getOptionsSyntaxByArrayElementValue,
198207
+ getOptionsSyntaxByValue,
197309
198208
  getOrCreateEmitNode,
197310
198209
  getOrUpdate,
197311
198210
  getOriginalNode,
@@ -197342,7 +198241,6 @@ if (typeof console !== "undefined") {
197342
198241
  getPrivateIdentifier,
197343
198242
  getProperties,
197344
198243
  getProperty,
197345
- getPropertyArrayElementValue,
197346
198244
  getPropertyAssignmentAliasLikeExpression,
197347
198245
  getPropertyNameForPropertyNameNode,
197348
198246
  getPropertyNameFromType,
@@ -198253,6 +199151,7 @@ if (typeof console !== "undefined") {
198253
199151
  moduleResolutionUsesNodeModules,
198254
199152
  moduleSpecifierToValidIdentifier,
198255
199153
  moduleSpecifiers,
199154
+ moduleSupportsImportAttributes,
198256
199155
  moduleSymbolToValidIdentifier,
198257
199156
  moveEmitHelpers,
198258
199157
  moveRangeEnd,