typescript 4.5.0-dev.20210928 → 4.5.0-dev.20211002

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.5";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20210928";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20211002";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  function tryGetNativeMap() {
@@ -3294,6 +3294,7 @@ var ts;
3294
3294
  ModuleKind[ModuleKind["System"] = 4] = "System";
3295
3295
  ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
3296
3296
  ModuleKind[ModuleKind["ES2020"] = 6] = "ES2020";
3297
+ ModuleKind[ModuleKind["ES2022"] = 7] = "ES2022";
3297
3298
  ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
3298
3299
  ModuleKind[ModuleKind["Node12"] = 100] = "Node12";
3299
3300
  ModuleKind[ModuleKind["NodeNext"] = 199] = "NodeNext";
@@ -5297,7 +5298,7 @@ var ts;
5297
5298
  Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1320, ts.DiagnosticCategory.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."),
5298
5299
  Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, ts.DiagnosticCategory.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."),
5299
5300
  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, ts.DiagnosticCategory.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."),
5300
- Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_umd_node12_or_nodenext: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node12', or 'nodenext'."),
5301
+ Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext: diag(1323, ts.DiagnosticCategory.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', 'node12', or 'nodenext'."),
5301
5302
  Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext'."),
5302
5303
  Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
5303
5304
  Dynamic_import_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments."),
@@ -5315,7 +5316,7 @@ var ts;
5315
5316
  Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.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."),
5316
5317
  Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.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}')'?"),
5317
5318
  Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
5318
- The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12_or_nodenext: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'esnext', 'system', 'node12', or 'nodenext'."),
5319
+ The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node12_or_nodenext: diag(1343, ts.DiagnosticCategory.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', 'node12', or 'nodenext'."),
5319
5320
  A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
5320
5321
  An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
5321
5322
  This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
@@ -5346,7 +5347,7 @@ var ts;
5346
5347
  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, ts.DiagnosticCategory.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."),
5347
5348
  _0_was_imported_here: diag(1376, ts.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."),
5348
5349
  _0_was_exported_here: diag(1377, ts.DiagnosticCategory.Message, "_0_was_exported_here_1377", "'{0}' was exported here."),
5349
- Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, ts.DiagnosticCategory.Error, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_noden_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
5350
+ Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, ts.DiagnosticCategory.Error, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_o_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
5350
5351
  An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type: diag(1379, ts.DiagnosticCategory.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'."),
5351
5352
  An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, ts.DiagnosticCategory.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'."),
5352
5353
  Unexpected_token_Did_you_mean_or_rbrace: diag(1381, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
@@ -5398,7 +5399,7 @@ var ts;
5398
5399
  File_redirects_to_file_0: diag(1429, ts.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
5399
5400
  The_file_is_in_the_program_because_Colon: diag(1430, ts.DiagnosticCategory.Message, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"),
5400
5401
  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, ts.DiagnosticCategory.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."),
5401
- Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, ts.DiagnosticCategory.Error, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenex_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
5402
+ Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, ts.DiagnosticCategory.Error, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or__1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
5402
5403
  Decorators_may_not_be_applied_to_this_parameters: diag(1433, ts.DiagnosticCategory.Error, "Decorators_may_not_be_applied_to_this_parameters_1433", "Decorators may not be applied to 'this' parameters."),
5403
5404
  Unexpected_keyword_or_identifier: diag(1434, ts.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
5404
5405
  Unknown_keyword_or_identifier_Did_you_mean_0: diag(1435, ts.DiagnosticCategory.Error, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"),
@@ -15522,6 +15523,7 @@ var ts;
15522
15523
  case ts.ModuleKind.AMD:
15523
15524
  case ts.ModuleKind.ES2015:
15524
15525
  case ts.ModuleKind.ES2020:
15526
+ case ts.ModuleKind.ES2022:
15525
15527
  case ts.ModuleKind.ESNext:
15526
15528
  return true;
15527
15529
  default:
@@ -16492,6 +16494,10 @@ var ts;
16492
16494
  return !!declaration && (ts.isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
16493
16495
  }
16494
16496
  ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable;
16497
+ function isFunctionExpressionOrArrowFunction(node) {
16498
+ return node.kind === 212 || node.kind === 213;
16499
+ }
16500
+ ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction;
16495
16501
  })(ts || (ts = {}));
16496
16502
  var ts;
16497
16503
  (function (ts) {
@@ -25291,7 +25297,6 @@ var ts;
25291
25297
  case 88:
25292
25298
  return nextTokenCanFollowDefaultKeyword();
25293
25299
  case 124:
25294
- return nextTokenIsOnSameLineAndCanFollowModifier();
25295
25300
  case 136:
25296
25301
  case 148:
25297
25302
  nextToken();
@@ -28684,7 +28689,7 @@ var ts;
28684
28689
  }
28685
28690
  return list && createNodeArray(list, pos);
28686
28691
  }
28687
- function tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock) {
28692
+ function tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStaticModifier) {
28688
28693
  var pos = getNodePos();
28689
28694
  var kind = token();
28690
28695
  if (token() === 85 && permitInvalidConstAsModifier) {
@@ -28695,6 +28700,9 @@ var ts;
28695
28700
  else if (stopOnStartOfClassStaticBlock && token() === 124 && lookAhead(nextTokenIsOpenBrace)) {
28696
28701
  return undefined;
28697
28702
  }
28703
+ else if (hasSeenStaticModifier && token() === 124) {
28704
+ return undefined;
28705
+ }
28698
28706
  else {
28699
28707
  if (!parseAnyContextualModifier()) {
28700
28708
  return undefined;
@@ -28704,8 +28712,10 @@ var ts;
28704
28712
  }
28705
28713
  function parseModifiers(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock) {
28706
28714
  var pos = getNodePos();
28707
- var list, modifier;
28708
- while (modifier = tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock)) {
28715
+ var list, modifier, hasSeenStatic = false;
28716
+ while (modifier = tryParseModifier(permitInvalidConstAsModifier, stopOnStartOfClassStaticBlock, hasSeenStatic)) {
28717
+ if (modifier.kind === 124)
28718
+ hasSeenStatic = true;
28709
28719
  list = ts.append(list, modifier);
28710
28720
  }
28711
28721
  return list && createNodeArray(list, pos);
@@ -31006,6 +31016,7 @@ var ts;
31006
31016
  es6: ts.ModuleKind.ES2015,
31007
31017
  es2015: ts.ModuleKind.ES2015,
31008
31018
  es2020: ts.ModuleKind.ES2020,
31019
+ es2022: ts.ModuleKind.ES2022,
31009
31020
  esnext: ts.ModuleKind.ESNext,
31010
31021
  node12: ts.ModuleKind.Node12,
31011
31022
  nodenext: ts.ModuleKind.NodeNext,
@@ -32602,29 +32613,39 @@ var ts;
32602
32613
  }
32603
32614
  return result;
32604
32615
  }
32605
- function generateTSConfig(options, fileNames, newLine) {
32616
+ function getCompilerOptionsDiffValue(options, newLine) {
32617
+ var compilerOptionsMap = getSerializedCompilerOption(options);
32618
+ return getOverwrittenDefaultOptions();
32619
+ function makePadding(paddingLength) {
32620
+ return Array(paddingLength + 1).join(" ");
32621
+ }
32622
+ function getOverwrittenDefaultOptions() {
32623
+ var result = [];
32624
+ var tab = makePadding(2);
32625
+ commandOptionsWithoutBuild.forEach(function (cmd) {
32626
+ if (!compilerOptionsMap.has(cmd.name)) {
32627
+ return;
32628
+ }
32629
+ var newValue = compilerOptionsMap.get(cmd.name);
32630
+ var defaultValue = getDefaultValueForOption(cmd);
32631
+ if (newValue !== defaultValue) {
32632
+ result.push("" + tab + cmd.name + ": " + newValue);
32633
+ }
32634
+ else if (ts.hasProperty(ts.defaultInitCompilerOptions, cmd.name)) {
32635
+ result.push("" + tab + cmd.name + ": " + defaultValue);
32636
+ }
32637
+ });
32638
+ return result.join(newLine) + newLine;
32639
+ }
32640
+ }
32641
+ ts.getCompilerOptionsDiffValue = getCompilerOptionsDiffValue;
32642
+ function getSerializedCompilerOption(options) {
32606
32643
  var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions);
32607
- var compilerOptionsMap = serializeCompilerOptions(compilerOptions);
32644
+ return serializeCompilerOptions(compilerOptions);
32645
+ }
32646
+ function generateTSConfig(options, fileNames, newLine) {
32647
+ var compilerOptionsMap = getSerializedCompilerOption(options);
32608
32648
  return writeConfigurations();
32609
- function getDefaultValueForOption(option) {
32610
- switch (option.type) {
32611
- case "number":
32612
- return 1;
32613
- case "boolean":
32614
- return true;
32615
- case "string":
32616
- return option.isFilePath ? "./" : "";
32617
- case "list":
32618
- return [];
32619
- case "object":
32620
- return {};
32621
- default:
32622
- var iterResult = option.type.keys().next();
32623
- if (!iterResult.done)
32624
- return iterResult.value;
32625
- return ts.Debug.fail("Expected 'option.type' to have entries.");
32626
- }
32627
- }
32628
32649
  function makePadding(paddingLength) {
32629
32650
  return Array(paddingLength + 1).join(" ");
32630
32651
  }
@@ -33452,6 +33473,25 @@ var ts;
33452
33473
  });
33453
33474
  }
33454
33475
  }
33476
+ function getDefaultValueForOption(option) {
33477
+ switch (option.type) {
33478
+ case "number":
33479
+ return 1;
33480
+ case "boolean":
33481
+ return true;
33482
+ case "string":
33483
+ return option.isFilePath ? "./" : "";
33484
+ case "list":
33485
+ return [];
33486
+ case "object":
33487
+ return {};
33488
+ default:
33489
+ var iterResult = option.type.keys().next();
33490
+ if (!iterResult.done)
33491
+ return iterResult.value;
33492
+ return ts.Debug.fail("Expected 'option.type' to have entries.");
33493
+ }
33494
+ }
33455
33495
  })(ts || (ts = {}));
33456
33496
  var ts;
33457
33497
  (function (ts) {
@@ -34647,6 +34687,7 @@ var ts;
34647
34687
  function allKeysStartWithDot(obj) {
34648
34688
  return ts.every(ts.getOwnKeys(obj), function (k) { return ts.startsWith(k, "."); });
34649
34689
  }
34690
+ ts.allKeysStartWithDot = allKeysStartWithDot;
34650
34691
  function noKeyStartsWithDot(obj) {
34651
34692
  return !ts.some(ts.getOwnKeys(obj), function (k) { return ts.startsWith(k, "."); });
34652
34693
  }
@@ -34848,17 +34889,18 @@ var ts;
34848
34889
  }
34849
34890
  return toSearchResult(undefined);
34850
34891
  }
34851
- function isApplicableVersionedTypesKey(conditions, key) {
34852
- if (conditions.indexOf("types") === -1)
34853
- return false;
34854
- if (!ts.startsWith(key, "types@"))
34855
- return false;
34856
- var range = ts.VersionRange.tryParse(key.substring("types@".length));
34857
- if (!range)
34858
- return false;
34859
- return range.test(ts.version);
34860
- }
34861
34892
  }
34893
+ function isApplicableVersionedTypesKey(conditions, key) {
34894
+ if (conditions.indexOf("types") === -1)
34895
+ return false;
34896
+ if (!ts.startsWith(key, "types@"))
34897
+ return false;
34898
+ var range = ts.VersionRange.tryParse(key.substring("types@".length));
34899
+ if (!range)
34900
+ return false;
34901
+ return range.test(ts.version);
34902
+ }
34903
+ ts.isApplicableVersionedTypesKey = isApplicableVersionedTypesKey;
34862
34904
  function loadModuleFromNearestNodeModulesDirectory(extensions, moduleName, directory, state, cache, redirectedReference) {
34863
34905
  return loadModuleFromNearestNodeModulesDirectoryWorker(extensions, moduleName, directory, state, false, cache, redirectedReference);
34864
34906
  }
@@ -38696,17 +38738,9 @@ var ts;
38696
38738
  }
38697
38739
  }
38698
38740
  else {
38699
- if (file.localJsxNamespace) {
38700
- return file.localJsxNamespace;
38701
- }
38702
- var jsxPragma = file.pragmas.get("jsx");
38703
- if (jsxPragma) {
38704
- var chosenPragma = ts.isArray(jsxPragma) ? jsxPragma[0] : jsxPragma;
38705
- file.localJsxFactory = ts.parseIsolatedEntityName(chosenPragma.arguments.factory, languageVersion);
38706
- ts.visitNode(file.localJsxFactory, markAsSynthetic);
38707
- if (file.localJsxFactory) {
38708
- return file.localJsxNamespace = ts.getFirstIdentifier(file.localJsxFactory).escapedText;
38709
- }
38741
+ var localJsxNamespace = getLocalJsxNamespace(file);
38742
+ if (localJsxNamespace) {
38743
+ return file.localJsxNamespace = localJsxNamespace;
38710
38744
  }
38711
38745
  }
38712
38746
  }
@@ -38728,11 +38762,25 @@ var ts;
38728
38762
  _jsxFactoryEntity = ts.factory.createQualifiedName(ts.factory.createIdentifier(ts.unescapeLeadingUnderscores(_jsxNamespace)), "createElement");
38729
38763
  }
38730
38764
  return _jsxNamespace;
38731
- function markAsSynthetic(node) {
38732
- ts.setTextRangePosEnd(node, -1, -1);
38733
- return ts.visitEachChild(node, markAsSynthetic, ts.nullTransformationContext);
38765
+ }
38766
+ function getLocalJsxNamespace(file) {
38767
+ if (file.localJsxNamespace) {
38768
+ return file.localJsxNamespace;
38769
+ }
38770
+ var jsxPragma = file.pragmas.get("jsx");
38771
+ if (jsxPragma) {
38772
+ var chosenPragma = ts.isArray(jsxPragma) ? jsxPragma[0] : jsxPragma;
38773
+ file.localJsxFactory = ts.parseIsolatedEntityName(chosenPragma.arguments.factory, languageVersion);
38774
+ ts.visitNode(file.localJsxFactory, markAsSynthetic);
38775
+ if (file.localJsxFactory) {
38776
+ return file.localJsxNamespace = ts.getFirstIdentifier(file.localJsxFactory).escapedText;
38777
+ }
38734
38778
  }
38735
38779
  }
38780
+ function markAsSynthetic(node) {
38781
+ ts.setTextRangePosEnd(node, -1, -1);
38782
+ return ts.visitEachChild(node, markAsSynthetic, ts.nullTransformationContext);
38783
+ }
38736
38784
  function getEmitResolver(sourceFile, cancellationToken) {
38737
38785
  getDiagnostics(sourceFile, cancellationToken);
38738
38786
  return emitResolver;
@@ -39942,7 +39990,20 @@ var ts;
39942
39990
  function isSyntacticDefault(node) {
39943
39991
  return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512) || ts.isExportSpecifier(node));
39944
39992
  }
39945
- function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias) {
39993
+ function getUsageModeForExpression(usage) {
39994
+ return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined;
39995
+ }
39996
+ function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
39997
+ return usageMode === ts.ModuleKind.ESNext && targetMode === ts.ModuleKind.CommonJS;
39998
+ }
39999
+ function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
40000
+ var usageMode = file && getUsageModeForExpression(usage);
40001
+ if (file && usageMode !== undefined) {
40002
+ var result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
40003
+ if (usageMode === ts.ModuleKind.ESNext || result) {
40004
+ return result;
40005
+ }
40006
+ }
39946
40007
  if (!allowSyntheticDefaultImports) {
39947
40008
  return false;
39948
40009
  }
@@ -39973,7 +40034,7 @@ var ts;
39973
40034
  exportDefaultSymbol = resolveExportByName(moduleSymbol, "default", node, dontResolveAlias);
39974
40035
  }
39975
40036
  var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
39976
- var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias);
40037
+ var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, node.parent.moduleSpecifier);
39977
40038
  if (!exportDefaultSymbol && !hasSyntheticDefault) {
39978
40039
  if (hasExportAssignmentSymbol(moduleSymbol)) {
39979
40040
  var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
@@ -40092,7 +40153,7 @@ var ts;
40092
40153
  var symbolFromModule = getExportOfModule(targetSymbol, name, specifier, dontResolveAlias);
40093
40154
  if (symbolFromModule === undefined && name.escapedText === "default") {
40094
40155
  var file = (_a = moduleSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
40095
- if (canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias)) {
40156
+ if (canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, moduleSpecifier)) {
40096
40157
  symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
40097
40158
  }
40098
40159
  }
@@ -40701,7 +40762,7 @@ var ts;
40701
40762
  sigs = getSignaturesOfStructuredType(type, 1);
40702
40763
  }
40703
40764
  if (sigs && sigs.length) {
40704
- var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol);
40765
+ var moduleType = getTypeWithSyntheticDefaultImportType(type, symbol, moduleSymbol, ts.isImportCall(referenceParent) ? referenceParent.arguments[0] : referenceParent.moduleSpecifier);
40705
40766
  var result = createSymbol(symbol.flags, symbol.escapedName);
40706
40767
  result.declarations = symbol.declarations ? symbol.declarations.slice() : [];
40707
40768
  result.parent = symbol.parent;
@@ -47376,7 +47437,7 @@ var ts;
47376
47437
  else if (type !== firstType) {
47377
47438
  checkFlags |= 64;
47378
47439
  }
47379
- if (isLiteralType(type)) {
47440
+ if (isLiteralType(type) || isPatternLiteralType(type)) {
47380
47441
  checkFlags |= 128;
47381
47442
  }
47382
47443
  if (type.flags & 131072) {
@@ -51299,7 +51360,7 @@ var ts;
51299
51360
  return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 234 && isContextSensitive(node.body);
51300
51361
  }
51301
51362
  function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
51302
- return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
51363
+ return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
51303
51364
  isContextSensitiveFunctionLikeDeclaration(func);
51304
51365
  }
51305
51366
  function getTypeWithoutSignatures(type) {
@@ -52083,7 +52144,8 @@ var ts;
52083
52144
  var sourceStack;
52084
52145
  var targetStack;
52085
52146
  var maybeCount = 0;
52086
- var depth = 0;
52147
+ var sourceDepth = 0;
52148
+ var targetDepth = 0;
52087
52149
  var expandingFlags = 0;
52088
52150
  var overflow = false;
52089
52151
  var overrideNextErrorInfo = 0;
@@ -52091,12 +52153,12 @@ var ts;
52091
52153
  var incompatibleStack = [];
52092
52154
  var inPropertyCheck = false;
52093
52155
  ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
52094
- var result = isRelatedTo(source, target, !!errorNode, headMessage);
52156
+ var result = isRelatedTo(source, target, 3, !!errorNode, headMessage);
52095
52157
  if (incompatibleStack.length) {
52096
52158
  reportIncompatibleStack();
52097
52159
  }
52098
52160
  if (overflow) {
52099
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes", "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: depth });
52161
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes", "checkTypeRelatedTo_DepthLimit", { sourceId: source.id, targetId: target.id, depth: sourceDepth, targetDepth: targetDepth });
52100
52162
  var diag = error(errorNode || currentNode, ts.Diagnostics.Excessive_stack_depth_comparing_types_0_and_1, typeToString(source), typeToString(target));
52101
52163
  if (errorOutputContainer) {
52102
52164
  (errorOutputContainer.errors || (errorOutputContainer.errors = [])).push(diag);
@@ -52349,7 +52411,11 @@ var ts;
52349
52411
  }
52350
52412
  return true;
52351
52413
  }
52352
- function isRelatedTo(originalSource, originalTarget, reportErrors, headMessage, intersectionState) {
52414
+ function isRelatedToWorker(source, target, reportErrors) {
52415
+ return isRelatedTo(source, target, 3, reportErrors);
52416
+ }
52417
+ function isRelatedTo(originalSource, originalTarget, recursionFlags, reportErrors, headMessage, intersectionState) {
52418
+ if (recursionFlags === void 0) { recursionFlags = 3; }
52353
52419
  if (reportErrors === void 0) { reportErrors = false; }
52354
52420
  if (intersectionState === void 0) { intersectionState = 0; }
52355
52421
  if (originalSource.flags & 524288 && originalTarget.flags & 131068) {
@@ -52364,7 +52430,7 @@ var ts;
52364
52430
  if (source === target)
52365
52431
  return -1;
52366
52432
  if (relation === identityRelation) {
52367
- return isIdenticalTo(source, target);
52433
+ return isIdenticalTo(source, target, recursionFlags);
52368
52434
  }
52369
52435
  if (source.flags & 262144 && getConstraintOfType(source) === target) {
52370
52436
  return -1;
@@ -52401,8 +52467,8 @@ var ts;
52401
52467
  var targetString = typeToString(originalTarget.aliasSymbol ? originalTarget : target);
52402
52468
  var calls = getSignaturesOfType(source, 0);
52403
52469
  var constructs = getSignaturesOfType(source, 1);
52404
- if (calls.length > 0 && isRelatedTo(getReturnTypeOfSignature(calls[0]), target, false) ||
52405
- constructs.length > 0 && isRelatedTo(getReturnTypeOfSignature(constructs[0]), target, false)) {
52470
+ if (calls.length > 0 && isRelatedTo(getReturnTypeOfSignature(calls[0]), target, 1, false) ||
52471
+ constructs.length > 0 && isRelatedTo(getReturnTypeOfSignature(constructs[0]), target, 1, false)) {
52406
52472
  reportError(ts.Diagnostics.Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it, sourceString, targetString);
52407
52473
  }
52408
52474
  else {
@@ -52416,11 +52482,11 @@ var ts;
52416
52482
  var saveErrorInfo = captureErrorCalculationState();
52417
52483
  if (source.flags & 3145728 || target.flags & 3145728) {
52418
52484
  result = getConstituentCount(source) * getConstituentCount(target) >= 4 ?
52419
- recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8) :
52485
+ recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8, recursionFlags) :
52420
52486
  structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8);
52421
52487
  }
52422
52488
  if (!result && !(source.flags & 1048576) && (source.flags & (469499904) || target.flags & 469499904)) {
52423
- if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState)) {
52489
+ if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags)) {
52424
52490
  resetErrorInfo(saveErrorInfo);
52425
52491
  }
52426
52492
  }
@@ -52428,7 +52494,7 @@ var ts;
52428
52494
  var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
52429
52495
  if (constraint && (source.flags & 2097152 || target.flags & 1048576)) {
52430
52496
  if (everyType(constraint, function (c) { return c !== source; })) {
52431
- if (result = isRelatedTo(constraint, target, false, undefined, intersectionState)) {
52497
+ if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
52432
52498
  resetErrorInfo(saveErrorInfo);
52433
52499
  }
52434
52500
  }
@@ -52437,7 +52503,7 @@ var ts;
52437
52503
  if (result && !inPropertyCheck && (target.flags & 2097152 && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
52438
52504
  isNonGenericObjectType(target) && !isArrayType(target) && !isTupleType(target) && source.flags & 2097152 && getApparentType(source).flags & 3670016 && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 524288); }))) {
52439
52505
  inPropertyCheck = true;
52440
- result &= recursiveTypeRelatedTo(source, target, reportErrors, 4);
52506
+ result &= recursiveTypeRelatedTo(source, target, reportErrors, 4, recursionFlags);
52441
52507
  inPropertyCheck = false;
52442
52508
  }
52443
52509
  reportErrorResults(source, target, result, isComparingJsxAttributes);
@@ -52509,7 +52575,7 @@ var ts;
52509
52575
  }
52510
52576
  }
52511
52577
  }
52512
- function isIdenticalTo(source, target) {
52578
+ function isIdenticalTo(source, target, recursionFlags) {
52513
52579
  if (source.flags !== target.flags)
52514
52580
  return 0;
52515
52581
  if (source.flags & 67358815)
@@ -52522,7 +52588,7 @@ var ts;
52522
52588
  }
52523
52589
  return result_7;
52524
52590
  }
52525
- return recursiveTypeRelatedTo(source, target, false, 0);
52591
+ return recursiveTypeRelatedTo(source, target, false, 0, recursionFlags);
52526
52592
  }
52527
52593
  function getTypeOfPropertyInTypes(types, name) {
52528
52594
  var appendPropType = function (propTypes, type) {
@@ -52593,7 +52659,7 @@ var ts;
52593
52659
  }
52594
52660
  return { value: true };
52595
52661
  }
52596
- if (checkTypes && !isRelatedTo(getTypeOfSymbol(prop), getTypeOfPropertyInTypes(checkTypes, prop.escapedName), reportErrors)) {
52662
+ if (checkTypes && !isRelatedTo(getTypeOfSymbol(prop), getTypeOfPropertyInTypes(checkTypes, prop.escapedName), 3, reportErrors)) {
52597
52663
  if (reportErrors) {
52598
52664
  reportIncompatibleError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(prop));
52599
52665
  }
@@ -52633,7 +52699,7 @@ var ts;
52633
52699
  }
52634
52700
  var match = getMatchingUnionConstituentForType(target, source);
52635
52701
  if (match) {
52636
- var related = isRelatedTo(source, match, false);
52702
+ var related = isRelatedTo(source, match, 2, false);
52637
52703
  if (related) {
52638
52704
  return related;
52639
52705
  }
@@ -52641,14 +52707,14 @@ var ts;
52641
52707
  }
52642
52708
  for (var _i = 0, targetTypes_1 = targetTypes; _i < targetTypes_1.length; _i++) {
52643
52709
  var type = targetTypes_1[_i];
52644
- var related = isRelatedTo(source, type, false);
52710
+ var related = isRelatedTo(source, type, 2, false);
52645
52711
  if (related) {
52646
52712
  return related;
52647
52713
  }
52648
52714
  }
52649
52715
  if (reportErrors) {
52650
52716
  var bestMatchingType = getBestMatchingType(source, target, isRelatedTo);
52651
- isRelatedTo(source, bestMatchingType || targetTypes[targetTypes.length - 1], true);
52717
+ isRelatedTo(source, bestMatchingType || targetTypes[targetTypes.length - 1], 2, true);
52652
52718
  }
52653
52719
  return 0;
52654
52720
  }
@@ -52657,7 +52723,7 @@ var ts;
52657
52723
  var targetTypes = target.types;
52658
52724
  for (var _i = 0, targetTypes_2 = targetTypes; _i < targetTypes_2.length; _i++) {
52659
52725
  var targetType = targetTypes_2[_i];
52660
- var related = isRelatedTo(source, targetType, reportErrors, undefined, intersectionState);
52726
+ var related = isRelatedTo(source, targetType, 2, reportErrors, undefined, intersectionState);
52661
52727
  if (!related) {
52662
52728
  return 0;
52663
52729
  }
@@ -52672,7 +52738,7 @@ var ts;
52672
52738
  }
52673
52739
  var len = sourceTypes.length;
52674
52740
  for (var i = 0; i < len; i++) {
52675
- var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1, undefined, intersectionState);
52741
+ var related = isRelatedTo(sourceTypes[i], target, 1, reportErrors && i === len - 1, undefined, intersectionState);
52676
52742
  if (related) {
52677
52743
  return related;
52678
52744
  }
@@ -52693,13 +52759,13 @@ var ts;
52693
52759
  for (var i = 0; i < sourceTypes.length; i++) {
52694
52760
  var sourceType = sourceTypes[i];
52695
52761
  if (undefinedStrippedTarget.flags & 1048576 && sourceTypes.length >= undefinedStrippedTarget.types.length && sourceTypes.length % undefinedStrippedTarget.types.length === 0) {
52696
- var related_1 = isRelatedTo(sourceType, undefinedStrippedTarget.types[i % undefinedStrippedTarget.types.length], false, undefined, intersectionState);
52762
+ var related_1 = isRelatedTo(sourceType, undefinedStrippedTarget.types[i % undefinedStrippedTarget.types.length], 3, false, undefined, intersectionState);
52697
52763
  if (related_1) {
52698
52764
  result &= related_1;
52699
52765
  continue;
52700
52766
  }
52701
52767
  }
52702
- var related = isRelatedTo(sourceType, target, reportErrors, undefined, intersectionState);
52768
+ var related = isRelatedTo(sourceType, target, 1, reportErrors, undefined, intersectionState);
52703
52769
  if (!related) {
52704
52770
  return 0;
52705
52771
  }
@@ -52724,24 +52790,24 @@ var ts;
52724
52790
  var t = targets[i];
52725
52791
  var related = -1;
52726
52792
  if (varianceFlags & 8) {
52727
- related = relation === identityRelation ? isRelatedTo(s, t, false) : compareTypesIdentical(s, t);
52793
+ related = relation === identityRelation ? isRelatedTo(s, t, 3, false) : compareTypesIdentical(s, t);
52728
52794
  }
52729
52795
  else if (variance === 1) {
52730
- related = isRelatedTo(s, t, reportErrors, undefined, intersectionState);
52796
+ related = isRelatedTo(s, t, 3, reportErrors, undefined, intersectionState);
52731
52797
  }
52732
52798
  else if (variance === 2) {
52733
- related = isRelatedTo(t, s, reportErrors, undefined, intersectionState);
52799
+ related = isRelatedTo(t, s, 3, reportErrors, undefined, intersectionState);
52734
52800
  }
52735
52801
  else if (variance === 3) {
52736
- related = isRelatedTo(t, s, false);
52802
+ related = isRelatedTo(t, s, 3, false);
52737
52803
  if (!related) {
52738
- related = isRelatedTo(s, t, reportErrors, undefined, intersectionState);
52804
+ related = isRelatedTo(s, t, 3, reportErrors, undefined, intersectionState);
52739
52805
  }
52740
52806
  }
52741
52807
  else {
52742
- related = isRelatedTo(s, t, reportErrors, undefined, intersectionState);
52808
+ related = isRelatedTo(s, t, 3, reportErrors, undefined, intersectionState);
52743
52809
  if (related) {
52744
- related &= isRelatedTo(t, s, reportErrors, undefined, intersectionState);
52810
+ related &= isRelatedTo(t, s, 3, reportErrors, undefined, intersectionState);
52745
52811
  }
52746
52812
  }
52747
52813
  if (!related) {
@@ -52752,7 +52818,7 @@ var ts;
52752
52818
  }
52753
52819
  return result;
52754
52820
  }
52755
- function recursiveTypeRelatedTo(source, target, reportErrors, intersectionState) {
52821
+ function recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags) {
52756
52822
  if (overflow) {
52757
52823
  return 0;
52758
52824
  }
@@ -52789,7 +52855,7 @@ var ts;
52789
52855
  return 3;
52790
52856
  }
52791
52857
  }
52792
- if (depth === 100) {
52858
+ if (sourceDepth === 100 || targetDepth === 100) {
52793
52859
  overflow = true;
52794
52860
  return 0;
52795
52861
  }
@@ -52797,13 +52863,18 @@ var ts;
52797
52863
  var maybeStart = maybeCount;
52798
52864
  maybeKeys[maybeCount] = id;
52799
52865
  maybeCount++;
52800
- sourceStack[depth] = source;
52801
- targetStack[depth] = target;
52802
- depth++;
52866
+ if (recursionFlags & 1) {
52867
+ sourceStack[sourceDepth] = source;
52868
+ sourceDepth++;
52869
+ }
52870
+ if (recursionFlags & 2) {
52871
+ targetStack[targetDepth] = target;
52872
+ targetDepth++;
52873
+ }
52803
52874
  var saveExpandingFlags = expandingFlags;
52804
- if (!(expandingFlags & 1) && isDeeplyNestedType(source, sourceStack, depth))
52875
+ if (!(expandingFlags & 1) && isDeeplyNestedType(source, sourceStack, sourceDepth))
52805
52876
  expandingFlags |= 1;
52806
- if (!(expandingFlags & 2) && isDeeplyNestedType(target, targetStack, depth))
52877
+ if (!(expandingFlags & 2) && isDeeplyNestedType(target, targetStack, targetDepth))
52807
52878
  expandingFlags |= 2;
52808
52879
  var originalHandler;
52809
52880
  var propagatingVarianceFlags = 0;
@@ -52820,7 +52891,8 @@ var ts;
52820
52891
  sourceIdStack: sourceStack.map(function (t) { return t.id; }),
52821
52892
  targetId: target.id,
52822
52893
  targetIdStack: targetStack.map(function (t) { return t.id; }),
52823
- depth: depth,
52894
+ depth: sourceDepth,
52895
+ targetDepth: targetDepth
52824
52896
  });
52825
52897
  }
52826
52898
  var result = expandingFlags !== 3 ? structuredTypeRelatedTo(source, target, reportErrors, intersectionState) : 3;
@@ -52828,9 +52900,14 @@ var ts;
52828
52900
  outofbandVarianceMarkerHandler = originalHandler;
52829
52901
  }
52830
52902
  expandingFlags = saveExpandingFlags;
52831
- depth--;
52903
+ if (recursionFlags & 1) {
52904
+ sourceDepth--;
52905
+ }
52906
+ if (recursionFlags & 2) {
52907
+ targetDepth--;
52908
+ }
52832
52909
  if (result) {
52833
- if (result === -1 || depth === 0) {
52910
+ if (result === -1 || (sourceDepth === 0 && targetDepth === 0)) {
52834
52911
  if (result === -1 || result === 3) {
52835
52912
  for (var i = maybeStart; i < maybeCount; i++) {
52836
52913
  relation.set(maybeKeys[i], 1 | propagatingVarianceFlags);
@@ -52872,7 +52949,7 @@ var ts;
52872
52949
  if (constraints !== source.types) {
52873
52950
  source = getIntersectionType(constraints);
52874
52951
  if (!(source.flags & 2097152)) {
52875
- return isRelatedTo(source, target, false);
52952
+ return isRelatedTo(source, target, 1, false);
52876
52953
  }
52877
52954
  }
52878
52955
  }
@@ -52881,22 +52958,22 @@ var ts;
52881
52958
  var flags = source.flags & target.flags;
52882
52959
  if (relation === identityRelation && !(flags & 524288)) {
52883
52960
  if (flags & 4194304) {
52884
- return isRelatedTo(source.type, target.type, false);
52961
+ return isRelatedTo(source.type, target.type, 3, false);
52885
52962
  }
52886
52963
  var result_8 = 0;
52887
52964
  if (flags & 8388608) {
52888
- if (result_8 = isRelatedTo(source.objectType, target.objectType, false)) {
52889
- if (result_8 &= isRelatedTo(source.indexType, target.indexType, false)) {
52965
+ if (result_8 = isRelatedTo(source.objectType, target.objectType, 3, false)) {
52966
+ if (result_8 &= isRelatedTo(source.indexType, target.indexType, 3, false)) {
52890
52967
  return result_8;
52891
52968
  }
52892
52969
  }
52893
52970
  }
52894
52971
  if (flags & 16777216) {
52895
52972
  if (source.root.isDistributive === target.root.isDistributive) {
52896
- if (result_8 = isRelatedTo(source.checkType, target.checkType, false)) {
52897
- if (result_8 &= isRelatedTo(source.extendsType, target.extendsType, false)) {
52898
- if (result_8 &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), false)) {
52899
- if (result_8 &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), false)) {
52973
+ if (result_8 = isRelatedTo(source.checkType, target.checkType, 3, false)) {
52974
+ if (result_8 &= isRelatedTo(source.extendsType, target.extendsType, 3, false)) {
52975
+ if (result_8 &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), 3, false)) {
52976
+ if (result_8 &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3, false)) {
52900
52977
  return result_8;
52901
52978
  }
52902
52979
  }
@@ -52905,7 +52982,7 @@ var ts;
52905
52982
  }
52906
52983
  }
52907
52984
  if (flags & 33554432) {
52908
- return isRelatedTo(source.substitute, target.substitute, false);
52985
+ return isRelatedTo(source.substitute, target.substitute, 3, false);
52909
52986
  }
52910
52987
  return 0;
52911
52988
  }
@@ -52925,16 +53002,16 @@ var ts;
52925
53002
  return varianceResult;
52926
53003
  }
52927
53004
  }
52928
- if (isSingleElementGenericTupleType(source) && !source.target.readonly && (result = isRelatedTo(getTypeArguments(source)[0], target)) ||
52929
- isSingleElementGenericTupleType(target) && (target.target.readonly || isMutableArrayOrTuple(getBaseConstraintOfType(source) || source)) && (result = isRelatedTo(source, getTypeArguments(target)[0]))) {
53005
+ if (isSingleElementGenericTupleType(source) && !source.target.readonly && (result = isRelatedTo(getTypeArguments(source)[0], target, 1)) ||
53006
+ isSingleElementGenericTupleType(target) && (target.target.readonly || isMutableArrayOrTuple(getBaseConstraintOfType(source) || source)) && (result = isRelatedTo(source, getTypeArguments(target)[0], 2))) {
52930
53007
  return result;
52931
53008
  }
52932
53009
  if (target.flags & 262144) {
52933
- if (ts.getObjectFlags(source) & 32 && !source.declaration.nameType && isRelatedTo(getIndexType(target), getConstraintTypeFromMappedType(source))) {
53010
+ if (ts.getObjectFlags(source) & 32 && !source.declaration.nameType && isRelatedTo(getIndexType(target), getConstraintTypeFromMappedType(source), 3)) {
52934
53011
  if (!(getMappedTypeModifiers(source) & 4)) {
52935
53012
  var templateType = getTemplateTypeFromMappedType(source);
52936
53013
  var indexedAccessType = getIndexedAccessType(target, getTypeParameterFromMappedType(source));
52937
- if (result = isRelatedTo(templateType, indexedAccessType, reportErrors)) {
53014
+ if (result = isRelatedTo(templateType, indexedAccessType, 3, reportErrors)) {
52938
53015
  return result;
52939
53016
  }
52940
53017
  }
@@ -52943,19 +53020,19 @@ var ts;
52943
53020
  else if (target.flags & 4194304) {
52944
53021
  var targetType_1 = target.type;
52945
53022
  if (source.flags & 4194304) {
52946
- if (result = isRelatedTo(targetType_1, source.type, false)) {
53023
+ if (result = isRelatedTo(targetType_1, source.type, 3, false)) {
52947
53024
  return result;
52948
53025
  }
52949
53026
  }
52950
53027
  if (isTupleType(targetType_1)) {
52951
- if (result = isRelatedTo(source, getKnownKeysOfTupleType(targetType_1), reportErrors)) {
53028
+ if (result = isRelatedTo(source, getKnownKeysOfTupleType(targetType_1), 2, reportErrors)) {
52952
53029
  return result;
52953
53030
  }
52954
53031
  }
52955
53032
  else {
52956
53033
  var constraint = getSimplifiedTypeOrConstraint(targetType_1);
52957
53034
  if (constraint) {
52958
- if (isRelatedTo(source, getIndexType(constraint, target.stringsOnly), reportErrors) === -1) {
53035
+ if (isRelatedTo(source, getIndexType(constraint, target.stringsOnly), 2, reportErrors) === -1) {
52959
53036
  return -1;
52960
53037
  }
52961
53038
  }
@@ -52972,7 +53049,7 @@ var ts;
52972
53049
  else {
52973
53050
  targetKeys = nameType_1 || constraintType;
52974
53051
  }
52975
- if (isRelatedTo(source, targetKeys, reportErrors) === -1) {
53052
+ if (isRelatedTo(source, targetKeys, 2, reportErrors) === -1) {
52976
53053
  return -1;
52977
53054
  }
52978
53055
  }
@@ -52980,8 +53057,8 @@ var ts;
52980
53057
  }
52981
53058
  else if (target.flags & 8388608) {
52982
53059
  if (source.flags & 8388608) {
52983
- if (result = isRelatedTo(source.objectType, target.objectType, reportErrors)) {
52984
- result &= isRelatedTo(source.indexType, target.indexType, reportErrors);
53060
+ if (result = isRelatedTo(source.objectType, target.objectType, 3, reportErrors)) {
53061
+ result &= isRelatedTo(source.indexType, target.indexType, 3, reportErrors);
52985
53062
  }
52986
53063
  if (result) {
52987
53064
  resetErrorInfo(saveErrorInfo);
@@ -53003,7 +53080,7 @@ var ts;
53003
53080
  if (reportErrors && originalErrorInfo) {
53004
53081
  resetErrorInfo(saveErrorInfo);
53005
53082
  }
53006
- if (result = isRelatedTo(source, constraint, reportErrors)) {
53083
+ if (result = isRelatedTo(source, constraint, 2, reportErrors)) {
53007
53084
  return result;
53008
53085
  }
53009
53086
  if (reportErrors && originalErrorInfo && errorInfo) {
@@ -53032,11 +53109,12 @@ var ts;
53032
53109
  var filteredByApplicability = includeOptional ? intersectTypes(targetKeys, sourceKeys) : undefined;
53033
53110
  if (includeOptional
53034
53111
  ? !(filteredByApplicability.flags & 131072)
53035
- : isRelatedTo(targetKeys, sourceKeys)) {
53112
+ : isRelatedTo(targetKeys, sourceKeys, 3)) {
53113
+ var templateType_1 = getTemplateTypeFromMappedType(target);
53036
53114
  var typeParameter = getTypeParameterFromMappedType(target);
53037
- var nonNullComponent = extractTypesOfKind(templateType, ~98304);
53115
+ var nonNullComponent = extractTypesOfKind(templateType_1, ~98304);
53038
53116
  if (!keysRemapped && nonNullComponent.flags & 8388608 && nonNullComponent.indexType === typeParameter) {
53039
- if (result = isRelatedTo(source, nonNullComponent.objectType, reportErrors)) {
53117
+ if (result = isRelatedTo(source, nonNullComponent.objectType, 2, reportErrors)) {
53040
53118
  return result;
53041
53119
  }
53042
53120
  }
@@ -53047,7 +53125,7 @@ var ts;
53047
53125
  ? getIntersectionType([filteredByApplicability, typeParameter])
53048
53126
  : typeParameter;
53049
53127
  var indexedAccessType = getIndexedAccessType(source, indexingType);
53050
- if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) {
53128
+ if (result = isRelatedTo(indexedAccessType, templateType_1, 3, reportErrors)) {
53051
53129
  return result;
53052
53130
  }
53053
53131
  }
@@ -53068,10 +53146,11 @@ var ts;
53068
53146
  distributionMapper = prependTypeMapping(checkVar, newParam, c.mapper);
53069
53147
  newParam.mapper = distributionMapper;
53070
53148
  }
53071
- var localResult = void 0;
53072
- if (skipTrue || (localResult = isRelatedTo(source, distributionMapper ? instantiateType(getTypeFromTypeNode(c.root.node.trueType), distributionMapper) : getTrueTypeFromConditionalType(c), false))) {
53073
- if (!skipFalse) {
53074
- localResult = (localResult || 3) & isRelatedTo(source, distributionMapper ? instantiateType(getTypeFromTypeNode(c.root.node.falseType), distributionMapper) : getFalseTypeFromConditionalType(c), false);
53149
+ var expanding = isDeeplyNestedType(target, targetStack, targetDepth);
53150
+ var localResult = expanding ? 3 : undefined;
53151
+ if (skipTrue || expanding || (localResult = isRelatedTo(source, distributionMapper ? instantiateType(getTypeFromTypeNode(c.root.node.trueType), distributionMapper) : getTrueTypeFromConditionalType(c), 2, false))) {
53152
+ if (!skipFalse && !expanding) {
53153
+ localResult = (localResult || 3) & isRelatedTo(source, distributionMapper ? instantiateType(getTypeFromTypeNode(c.root.node.falseType), distributionMapper) : getFalseTypeFromConditionalType(c), 2, false);
53075
53154
  }
53076
53155
  }
53077
53156
  if (localResult) {
@@ -53081,6 +53160,9 @@ var ts;
53081
53160
  }
53082
53161
  else if (target.flags & 134217728) {
53083
53162
  if (source.flags & 134217728) {
53163
+ if (relation === comparableRelation) {
53164
+ return templateLiteralTypesDefinitelyUnrelated(source, target) ? 0 : -1;
53165
+ }
53084
53166
  instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
53085
53167
  }
53086
53168
  var result_9 = inferTypesFromTemplateLiteralType(source, target);
@@ -53092,32 +53174,31 @@ var ts;
53092
53174
  if (!(source.flags & 8388608 && target.flags & 8388608)) {
53093
53175
  var constraint = getConstraintOfType(source);
53094
53176
  if (!constraint || (source.flags & 262144 && constraint.flags & 1)) {
53095
- if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864))) {
53177
+ if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864), 3)) {
53096
53178
  resetErrorInfo(saveErrorInfo);
53097
53179
  return result;
53098
53180
  }
53099
53181
  }
53100
- else if (result = isRelatedTo(constraint, target, false, undefined, intersectionState)) {
53182
+ else if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
53101
53183
  resetErrorInfo(saveErrorInfo);
53102
53184
  return result;
53103
53185
  }
53104
- else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, reportErrors && !(target.flags & source.flags & 262144), undefined, intersectionState)) {
53186
+ else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && !(target.flags & source.flags & 262144), undefined, intersectionState)) {
53105
53187
  resetErrorInfo(saveErrorInfo);
53106
53188
  return result;
53107
53189
  }
53108
53190
  }
53109
53191
  }
53110
53192
  else if (source.flags & 4194304) {
53111
- if (result = isRelatedTo(keyofConstraintType, target, reportErrors)) {
53193
+ if (result = isRelatedTo(keyofConstraintType, target, 1, reportErrors)) {
53112
53194
  resetErrorInfo(saveErrorInfo);
53113
53195
  return result;
53114
53196
  }
53115
53197
  }
53116
- else if (source.flags & 134217728) {
53198
+ else if (source.flags & 134217728 && !(target.flags & 524288)) {
53117
53199
  if (!(target.flags & 134217728)) {
53118
- var baseConstraint = getBaseConstraintOfType(source);
53119
- var constraint = baseConstraint && baseConstraint !== source ? baseConstraint : stringType;
53120
- if (result = isRelatedTo(constraint, target, reportErrors)) {
53200
+ var constraint = getBaseConstraintOfType(source);
53201
+ if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
53121
53202
  resetErrorInfo(saveErrorInfo);
53122
53203
  return result;
53123
53204
  }
@@ -53125,14 +53206,14 @@ var ts;
53125
53206
  }
53126
53207
  else if (source.flags & 268435456) {
53127
53208
  if (target.flags & 268435456 && source.symbol === target.symbol) {
53128
- if (result = isRelatedTo(source.type, target.type, reportErrors)) {
53209
+ if (result = isRelatedTo(source.type, target.type, 3, reportErrors)) {
53129
53210
  resetErrorInfo(saveErrorInfo);
53130
53211
  return result;
53131
53212
  }
53132
53213
  }
53133
53214
  else {
53134
53215
  var constraint = getBaseConstraintOfType(source);
53135
- if (constraint && (result = isRelatedTo(constraint, target, reportErrors))) {
53216
+ if (constraint && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
53136
53217
  resetErrorInfo(saveErrorInfo);
53137
53218
  return result;
53138
53219
  }
@@ -53140,40 +53221,44 @@ var ts;
53140
53221
  }
53141
53222
  else if (source.flags & 16777216) {
53142
53223
  if (target.flags & 16777216) {
53143
- var sourceParams = source.root.inferTypeParameters;
53144
- var sourceExtends = source.extendsType;
53145
- var mapper = void 0;
53146
- if (sourceParams) {
53147
- var ctx = createInferenceContext(sourceParams, undefined, 0, isRelatedTo);
53148
- inferTypes(ctx.inferences, target.extendsType, sourceExtends, 512 | 1024);
53149
- sourceExtends = instantiateType(sourceExtends, ctx.mapper);
53150
- mapper = ctx.mapper;
53151
- }
53152
- if (isTypeIdenticalTo(sourceExtends, target.extendsType) &&
53153
- (isRelatedTo(source.checkType, target.checkType) || isRelatedTo(target.checkType, source.checkType))) {
53154
- if (result = isRelatedTo(instantiateType(getTrueTypeFromConditionalType(source), mapper), getTrueTypeFromConditionalType(target), reportErrors)) {
53155
- result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), reportErrors);
53224
+ if (!isDeeplyNestedType(source, sourceStack, sourceDepth) && !isDeeplyNestedType(target, targetStack, targetDepth)) {
53225
+ var sourceParams = source.root.inferTypeParameters;
53226
+ var sourceExtends = source.extendsType;
53227
+ var mapper = void 0;
53228
+ if (sourceParams) {
53229
+ var ctx = createInferenceContext(sourceParams, undefined, 0, isRelatedToWorker);
53230
+ inferTypes(ctx.inferences, target.extendsType, sourceExtends, 512 | 1024);
53231
+ sourceExtends = instantiateType(sourceExtends, ctx.mapper);
53232
+ mapper = ctx.mapper;
53156
53233
  }
53157
- if (result) {
53158
- resetErrorInfo(saveErrorInfo);
53159
- return result;
53234
+ if (isTypeIdenticalTo(sourceExtends, target.extendsType) &&
53235
+ (isRelatedTo(source.checkType, target.checkType, 3) || isRelatedTo(target.checkType, source.checkType, 3))) {
53236
+ if (result = isRelatedTo(instantiateType(getTrueTypeFromConditionalType(source), mapper), getTrueTypeFromConditionalType(target), 3, reportErrors)) {
53237
+ result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3, reportErrors);
53238
+ }
53239
+ if (result) {
53240
+ resetErrorInfo(saveErrorInfo);
53241
+ return result;
53242
+ }
53160
53243
  }
53161
53244
  }
53162
53245
  }
53163
53246
  else {
53164
53247
  var distributiveConstraint = getConstraintOfDistributiveConditionalType(source);
53165
53248
  if (distributiveConstraint) {
53166
- if (result = isRelatedTo(distributiveConstraint, target, reportErrors)) {
53249
+ if (result = isRelatedTo(distributiveConstraint, target, 1, reportErrors)) {
53167
53250
  resetErrorInfo(saveErrorInfo);
53168
53251
  return result;
53169
53252
  }
53170
53253
  }
53171
53254
  }
53172
- var defaultConstraint = getDefaultConstraintOfConditionalType(source);
53173
- if (defaultConstraint) {
53174
- if (result = isRelatedTo(defaultConstraint, target, reportErrors)) {
53175
- resetErrorInfo(saveErrorInfo);
53176
- return result;
53255
+ if (!isDeeplyNestedType(source, sourceStack, sourceDepth)) {
53256
+ var defaultConstraint = getDefaultConstraintOfConditionalType(source);
53257
+ if (defaultConstraint) {
53258
+ if (result = isRelatedTo(defaultConstraint, target, 1, reportErrors)) {
53259
+ resetErrorInfo(saveErrorInfo);
53260
+ return result;
53261
+ }
53177
53262
  }
53178
53263
  }
53179
53264
  }
@@ -53210,7 +53295,7 @@ var ts;
53210
53295
  }
53211
53296
  else if (isReadonlyArrayType(target) ? isArrayType(source) || isTupleType(source) : isArrayType(target) && isTupleType(source) && !source.target.readonly) {
53212
53297
  if (relation !== identityRelation) {
53213
- return isRelatedTo(getIndexTypeOfType(source, numberType) || anyType, getIndexTypeOfType(target, numberType) || anyType, reportErrors);
53298
+ return isRelatedTo(getIndexTypeOfType(source, numberType) || anyType, getIndexTypeOfType(target, numberType) || anyType, 3, reportErrors);
53214
53299
  }
53215
53300
  else {
53216
53301
  return 0;
@@ -53293,10 +53378,10 @@ var ts;
53293
53378
  var result_11;
53294
53379
  var targetConstraint = getConstraintTypeFromMappedType(target);
53295
53380
  var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), makeFunctionTypeMapper(getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers));
53296
- if (result_11 = isRelatedTo(targetConstraint, sourceConstraint, reportErrors)) {
53381
+ if (result_11 = isRelatedTo(targetConstraint, sourceConstraint, 3, reportErrors)) {
53297
53382
  var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
53298
53383
  if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
53299
- return result_11 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors);
53384
+ return result_11 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), 3, reportErrors);
53300
53385
  }
53301
53386
  }
53302
53387
  }
@@ -53402,7 +53487,7 @@ var ts;
53402
53487
  var targetIsOptional = strictNullChecks && !!(ts.getCheckFlags(targetProp) & 48);
53403
53488
  var effectiveTarget = addOptionality(getNonMissingTypeOfSymbol(targetProp), false, targetIsOptional);
53404
53489
  var effectiveSource = getTypeOfSourceProperty(sourceProp);
53405
- return isRelatedTo(effectiveSource, effectiveTarget, reportErrors, undefined, intersectionState);
53490
+ return isRelatedTo(effectiveSource, effectiveTarget, 3, reportErrors, undefined, intersectionState);
53406
53491
  }
53407
53492
  function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors, intersectionState, skipOptional) {
53408
53493
  var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp);
@@ -53572,7 +53657,7 @@ var ts;
53572
53657
  var targetType = targetTypeArguments[i];
53573
53658
  var targetCheckType = sourceFlags & 8 && targetFlags & 4 ? createArrayType(targetType) :
53574
53659
  removeMissingType(targetType, !!(targetFlags & 2));
53575
- var related = isRelatedTo(sourceType, targetCheckType, reportErrors, undefined, intersectionState);
53660
+ var related = isRelatedTo(sourceType, targetCheckType, 3, reportErrors, undefined, intersectionState);
53576
53661
  if (!related) {
53577
53662
  if (reportErrors && (targetArity > 1 || sourceArity > 1)) {
53578
53663
  if (i < startCount || i >= targetArity - endCount || sourceArity - startCount - endCount === 1) {
@@ -53747,7 +53832,7 @@ var ts;
53747
53832
  return function (source, target) { return reportIncompatibleError(ts.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source), typeToString(target)); };
53748
53833
  }
53749
53834
  function signatureRelatedTo(source, target, erase, reportErrors, incompatibleReporter) {
53750
- return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 : 0, reportErrors, reportError, incompatibleReporter, isRelatedTo, makeFunctionTypeMapper(reportUnreliableMarkers));
53835
+ return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker, makeFunctionTypeMapper(reportUnreliableMarkers));
53751
53836
  }
53752
53837
  function signaturesIdenticalTo(source, target, kind) {
53753
53838
  var sourceSignatures = getSignaturesOfType(source, kind);
@@ -53779,7 +53864,7 @@ var ts;
53779
53864
  var type = exactOptionalPropertyTypes || propType.flags & 32768 || keyType === numberType || !(prop.flags & 16777216)
53780
53865
  ? propType
53781
53866
  : getTypeWithFacts(propType, 524288);
53782
- var related = isRelatedTo(type, targetInfo.type, reportErrors);
53867
+ var related = isRelatedTo(type, targetInfo.type, 3, reportErrors);
53783
53868
  if (!related) {
53784
53869
  if (reportErrors) {
53785
53870
  reportError(ts.Diagnostics.Property_0_is_incompatible_with_index_signature, symbolToString(prop));
@@ -53802,7 +53887,7 @@ var ts;
53802
53887
  return result;
53803
53888
  }
53804
53889
  function indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors) {
53805
- var related = isRelatedTo(sourceInfo.type, targetInfo.type, reportErrors);
53890
+ var related = isRelatedTo(sourceInfo.type, targetInfo.type, 3, reportErrors);
53806
53891
  if (!related && reportErrors) {
53807
53892
  if (sourceInfo.keyType === targetInfo.keyType) {
53808
53893
  reportError(ts.Diagnostics._0_index_signatures_are_incompatible, typeToString(sourceInfo.keyType));
@@ -53823,7 +53908,7 @@ var ts;
53823
53908
  for (var _i = 0, indexInfos_3 = indexInfos; _i < indexInfos_3.length; _i++) {
53824
53909
  var targetInfo = indexInfos_3[_i];
53825
53910
  var related = !sourceIsPrimitive && targetHasStringIndex && targetInfo.type.flags & 1 ? -1 :
53826
- isGenericMappedType(source) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, reportErrors) :
53911
+ isGenericMappedType(source) && targetHasStringIndex ? isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, 3, reportErrors) :
53827
53912
  typeRelatedToIndexInfo(source, targetInfo, reportErrors, intersectionState);
53828
53913
  if (!related) {
53829
53914
  return 0;
@@ -53854,7 +53939,7 @@ var ts;
53854
53939
  for (var _i = 0, targetInfos_1 = targetInfos; _i < targetInfos_1.length; _i++) {
53855
53940
  var targetInfo = targetInfos_1[_i];
53856
53941
  var sourceInfo = getIndexInfoOfType(source, targetInfo.keyType);
53857
- if (!(sourceInfo && isRelatedTo(sourceInfo.type, targetInfo.type) && sourceInfo.isReadonly === targetInfo.isReadonly)) {
53942
+ if (!(sourceInfo && isRelatedTo(sourceInfo.type, targetInfo.type, 3) && sourceInfo.isReadonly === targetInfo.isReadonly)) {
53858
53943
  return 0;
53859
53944
  }
53860
53945
  }
@@ -55084,6 +55169,16 @@ var ts;
55084
55169
  function isFromInferenceBlockedSource(type) {
55085
55170
  return !!(type.symbol && ts.some(type.symbol.declarations, hasSkipDirectInferenceFlag));
55086
55171
  }
55172
+ function templateLiteralTypesDefinitelyUnrelated(source, target) {
55173
+ var sourceStart = source.texts[0];
55174
+ var targetStart = target.texts[0];
55175
+ var sourceEnd = source.texts[source.texts.length - 1];
55176
+ var targetEnd = target.texts[target.texts.length - 1];
55177
+ var startLen = Math.min(sourceStart.length, targetStart.length);
55178
+ var endLen = Math.min(sourceEnd.length, targetEnd.length);
55179
+ return sourceStart.slice(0, startLen) !== targetStart.slice(0, startLen) ||
55180
+ sourceEnd.slice(sourceEnd.length - endLen) !== targetEnd.slice(targetEnd.length - endLen);
55181
+ }
55087
55182
  function isValidBigIntString(s) {
55088
55183
  var scanner = ts.createScanner(99, false);
55089
55184
  var success = true;
@@ -55988,7 +56083,7 @@ var ts;
55988
56083
  if (prop.isDiscriminantProperty === undefined) {
55989
56084
  prop.isDiscriminantProperty =
55990
56085
  (prop.checkFlags & 192) === 192 &&
55991
- !maybeTypeOfKind(getTypeOfSymbol(prop), 465829888 & ~134217728);
56086
+ !isGenericType(getTypeOfSymbol(prop));
55992
56087
  }
55993
56088
  return !!prop.isDiscriminantProperty;
55994
56089
  }
@@ -56478,13 +56573,13 @@ var ts;
56478
56573
  return filterType(type, function (t) { return (t.flags & kind) !== 0; });
56479
56574
  }
56480
56575
  function replacePrimitivesWithLiterals(typeWithPrimitives, typeWithLiterals) {
56481
- if (isTypeSubsetOf(stringType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, 128) ||
56482
- isTypeSubsetOf(numberType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, 256) ||
56483
- isTypeSubsetOf(bigintType, typeWithPrimitives) && maybeTypeOfKind(typeWithLiterals, 2048)) {
56576
+ if (maybeTypeOfKind(typeWithPrimitives, 4 | 134217728 | 8 | 64) &&
56577
+ maybeTypeOfKind(typeWithLiterals, 128 | 134217728 | 268435456 | 256 | 2048)) {
56484
56578
  return mapType(typeWithPrimitives, function (t) {
56485
- return t.flags & 4 ? extractTypesOfKind(typeWithLiterals, 4 | 128) :
56486
- t.flags & 8 ? extractTypesOfKind(typeWithLiterals, 8 | 256) :
56487
- t.flags & 64 ? extractTypesOfKind(typeWithLiterals, 64 | 2048) : t;
56579
+ return t.flags & 4 ? extractTypesOfKind(typeWithLiterals, 4 | 128 | 134217728 | 268435456) :
56580
+ isPatternLiteralType(t) && !maybeTypeOfKind(typeWithLiterals, 4 | 134217728 | 268435456) ? extractTypesOfKind(typeWithLiterals, 128) :
56581
+ t.flags & 8 ? extractTypesOfKind(typeWithLiterals, 8 | 256) :
56582
+ t.flags & 64 ? extractTypesOfKind(typeWithLiterals, 64 | 2048) : t;
56488
56583
  });
56489
56584
  }
56490
56585
  return typeWithPrimitives;
@@ -56555,10 +56650,10 @@ var ts;
56555
56650
  isTypeAssignableToKind(getTypeOfExpression(parent.argumentExpression), 296);
56556
56651
  return isLengthPushOrUnshift || isElementAssignment;
56557
56652
  }
56558
- function isDeclarationWithExplicitTypeAnnotation(declaration) {
56559
- return (declaration.kind === 253 || declaration.kind === 163 ||
56560
- declaration.kind === 166 || declaration.kind === 165) &&
56561
- !!ts.getEffectiveTypeAnnotationNode(declaration);
56653
+ function isDeclarationWithExplicitTypeAnnotation(node) {
56654
+ return (ts.isVariableDeclaration(node) || ts.isPropertyDeclaration(node) || ts.isPropertySignature(node) || ts.isParameter(node)) &&
56655
+ !!(ts.getEffectiveTypeAnnotationNode(node) ||
56656
+ ts.isInJSFile(node) && ts.hasInitializer(node) && node.initializer && ts.isFunctionExpressionOrArrowFunction(node.initializer) && ts.getEffectiveReturnTypeNode(node.initializer));
56562
56657
  }
56563
56658
  function getExplicitTypeOfSymbol(symbol, diagnostic) {
56564
56659
  if (symbol.flags & (16 | 8192 | 32 | 512)) {
@@ -57181,7 +57276,7 @@ var ts;
57181
57276
  var narrowedPropType = narrowType(propType);
57182
57277
  return filterType(type, function (t) {
57183
57278
  var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName);
57184
- return !(discriminantType.flags & 131072) && isTypeComparableTo(discriminantType, narrowedPropType);
57279
+ return !(narrowedPropType.flags & 131072) && isTypeComparableTo(narrowedPropType, discriminantType);
57185
57280
  });
57186
57281
  }
57187
57282
  function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) {
@@ -57575,16 +57670,7 @@ var ts;
57575
57670
  }
57576
57671
  function getNarrowedType(type, candidate, assumeTrue, isRelated) {
57577
57672
  if (!assumeTrue) {
57578
- return filterType(type, function (t) {
57579
- if (!isRelated(t, candidate)) {
57580
- return true;
57581
- }
57582
- var constraint = getBaseConstraintOfType(t);
57583
- if (constraint && constraint !== t) {
57584
- return !isRelated(constraint, candidate);
57585
- }
57586
- return false;
57587
- });
57673
+ return filterType(type, function (t) { return !isRelated(t, candidate); });
57588
57674
  }
57589
57675
  if (type.flags & 1048576) {
57590
57676
  var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
@@ -59175,11 +59261,8 @@ var ts;
59175
59261
  }
59176
59262
  return !hasEffectiveRestParameter(signature) && getParameterCount(signature) < targetParameterCount;
59177
59263
  }
59178
- function isFunctionExpressionOrArrowFunction(node) {
59179
- return node.kind === 212 || node.kind === 213;
59180
- }
59181
59264
  function getContextualSignatureForFunctionLikeDeclaration(node) {
59182
- return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node)
59265
+ return ts.isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node)
59183
59266
  ? getContextualSignature(node)
59184
59267
  : undefined;
59185
59268
  }
@@ -59985,6 +60068,13 @@ var ts;
59985
60068
  markAliasSymbolAsReferenced(jsxFactorySym);
59986
60069
  }
59987
60070
  }
60071
+ if (ts.isJsxOpeningFragment(node)) {
60072
+ var file = ts.getSourceFileOfNode(node);
60073
+ var localJsxNamespace = getLocalJsxNamespace(file);
60074
+ if (localJsxNamespace) {
60075
+ resolveName(jsxFactoryLocation, localJsxNamespace, 111551, jsxFactoryRefErr, localJsxNamespace, true);
60076
+ }
60077
+ }
59988
60078
  }
59989
60079
  if (isNodeOpeningLikeElement) {
59990
60080
  var jsxOpeningLikeNode = node;
@@ -61408,7 +61498,7 @@ var ts;
61408
61498
  return false;
61409
61499
  var symbol = resolveName(node.expression, node.expression.escapedText, 111551, undefined, undefined, false);
61410
61500
  var decl = symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration;
61411
- if (!decl || !ts.isParameter(decl) || !isFunctionExpressionOrArrowFunction(decl.parent) || !ts.isNewExpression(decl.parent.parent) || !ts.isIdentifier(decl.parent.parent.expression)) {
61501
+ if (!decl || !ts.isParameter(decl) || !ts.isFunctionExpressionOrArrowFunction(decl.parent) || !ts.isNewExpression(decl.parent.parent) || !ts.isIdentifier(decl.parent.parent.expression)) {
61412
61502
  return false;
61413
61503
  }
61414
61504
  var globalPromiseSymbol = getGlobalPromiseConstructorSymbol(false);
@@ -62448,18 +62538,18 @@ var ts;
62448
62538
  if (moduleSymbol) {
62449
62539
  var esModuleSymbol = resolveESModuleSymbol(moduleSymbol, specifier, true, false);
62450
62540
  if (esModuleSymbol) {
62451
- return createPromiseReturnType(node, getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol));
62541
+ return createPromiseReturnType(node, getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol, moduleSymbol, specifier));
62452
62542
  }
62453
62543
  }
62454
62544
  return createPromiseReturnType(node, anyType);
62455
62545
  }
62456
- function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol) {
62546
+ function getTypeWithSyntheticDefaultImportType(type, symbol, originalSymbol, moduleSpecifier) {
62457
62547
  var _a;
62458
62548
  if (allowSyntheticDefaultImports && type && !isErrorType(type)) {
62459
62549
  var synthType = type;
62460
62550
  if (!synthType.syntheticType) {
62461
62551
  var file = (_a = originalSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.isSourceFile);
62462
- var hasSyntheticDefault = canHaveSyntheticDefault(file, originalSymbol, false);
62552
+ var hasSyntheticDefault = canHaveSyntheticDefault(file, originalSymbol, false, moduleSpecifier);
62463
62553
  if (hasSyntheticDefault) {
62464
62554
  var memberTable = ts.createSymbolTable();
62465
62555
  var newSymbol = createSymbol(2097152, "default");
@@ -62618,16 +62708,14 @@ var ts;
62618
62708
  }
62619
62709
  }
62620
62710
  function checkImportMetaProperty(node) {
62621
- if (moduleKind !== ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System) {
62622
- if (moduleKind === ts.ModuleKind.Node12 || moduleKind === ts.ModuleKind.NodeNext) {
62623
- if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
62624
- error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
62625
- }
62626
- }
62627
- else {
62628
- error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_esnext_system_node12_or_nodenext);
62711
+ if (moduleKind === ts.ModuleKind.Node12 || moduleKind === ts.ModuleKind.NodeNext) {
62712
+ if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
62713
+ error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
62629
62714
  }
62630
62715
  }
62716
+ else if (moduleKind < ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.System) {
62717
+ error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node12_or_nodenext);
62718
+ }
62631
62719
  var file = ts.getSourceFileOfNode(node);
62632
62720
  ts.Debug.assert(!!(file.flags & 2097152), "Containing file is missing import meta node flag.");
62633
62721
  return node.name.escapedText === "meta" ? getGlobalImportMetaType() : errorType;
@@ -63453,9 +63541,9 @@ var ts;
63453
63541
  var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.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);
63454
63542
  diagnostics.add(diagnostic);
63455
63543
  }
63456
- if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4) {
63544
+ if ((moduleKind !== ts.ModuleKind.ES2022 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4) {
63457
63545
  span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
63458
- var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher);
63546
+ var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher);
63459
63547
  diagnostics.add(diagnostic);
63460
63548
  }
63461
63549
  }
@@ -64734,7 +64822,7 @@ var ts;
64734
64822
  }
64735
64823
  }
64736
64824
  function checkParenthesizedExpression(node, checkMode) {
64737
- if (ts.isJSDocTypeAssertion(node)) {
64825
+ if (ts.hasJSDocNodes(node) && ts.isJSDocTypeAssertion(node)) {
64738
64826
  var type = ts.getJSDocTypeAssertionType(node);
64739
64827
  return checkAssertionWorker(type, type, node.expression, checkMode);
64740
64828
  }
@@ -66320,6 +66408,12 @@ var ts;
66320
66408
  }
66321
66409
  }
66322
66410
  }
66411
+ function checkJSDocAccessibilityModifiers(node) {
66412
+ var host = ts.getJSDocHost(node);
66413
+ if (host && ts.isPrivateIdentifierClassElementDeclaration(host)) {
66414
+ error(node, ts.Diagnostics.An_accessibility_modifier_cannot_be_used_with_a_private_identifier);
66415
+ }
66416
+ }
66323
66417
  function getIdentifierFromEntityNameExpression(node) {
66324
66418
  switch (node.kind) {
66325
66419
  case 79:
@@ -69441,6 +69535,10 @@ var ts;
69441
69535
  return;
69442
69536
  case 307:
69443
69537
  return checkSourceElement(node.type);
69538
+ case 331:
69539
+ case 333:
69540
+ case 332:
69541
+ return checkJSDocAccessibilityModifiers(node);
69444
69542
  case 193:
69445
69543
  return checkIndexedAccessType(node);
69446
69544
  case 194:
@@ -71884,8 +71982,8 @@ var ts;
71884
71982
  if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
71885
71983
  diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.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));
71886
71984
  }
71887
- if ((moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(forInOrOfStatement).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4) {
71888
- diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher));
71985
+ if ((moduleKind !== ts.ModuleKind.ES2022 && moduleKind !== ts.ModuleKind.ESNext && moduleKind !== ts.ModuleKind.System && !(moduleKind === ts.ModuleKind.NodeNext && ts.getSourceFileOfNode(forInOrOfStatement).impliedNodeFormat === ts.ModuleKind.ESNext)) || languageVersion < 4) {
71986
+ diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher));
71889
71987
  }
71890
71988
  }
71891
71989
  }
@@ -72512,7 +72610,7 @@ var ts;
72512
72610
  }
72513
72611
  function checkGrammarImportCallExpression(node) {
72514
72612
  if (moduleKind === ts.ModuleKind.ES2015) {
72515
- return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_umd_node12_or_nodenext);
72613
+ return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node12_or_nodenext);
72516
72614
  }
72517
72615
  if (node.typeArguments) {
72518
72616
  return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_import_cannot_have_type_arguments);
@@ -73526,7 +73624,7 @@ var ts;
73526
73624
  }
73527
73625
  }
73528
73626
  ts.createSourceMapGenerator = createSourceMapGenerator;
73529
- var sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)$/;
73627
+ var sourceMapCommentRegExp = /^\/\/[@#] source[M]appingURL=(.+)\r?\n?$/;
73530
73628
  var whitespaceOrMapCommentRegExp = /^\s*(\/\/[@#] .*)?$/;
73531
73629
  function getLineInfo(text, lineStarts) {
73532
73630
  return {
@@ -75816,6 +75914,7 @@ var ts;
75816
75914
  || (isExternalModuleExport(node)
75817
75915
  && moduleKind !== ts.ModuleKind.ES2015
75818
75916
  && moduleKind !== ts.ModuleKind.ES2020
75917
+ && moduleKind !== ts.ModuleKind.ES2022
75819
75918
  && moduleKind !== ts.ModuleKind.ESNext
75820
75919
  && moduleKind !== ts.ModuleKind.System);
75821
75920
  }
@@ -87098,6 +87197,7 @@ var ts;
87098
87197
  function getModuleTransformer(moduleKind) {
87099
87198
  switch (moduleKind) {
87100
87199
  case ts.ModuleKind.ESNext:
87200
+ case ts.ModuleKind.ES2022:
87101
87201
  case ts.ModuleKind.ES2020:
87102
87202
  case ts.ModuleKind.ES2015:
87103
87203
  return ts.transformECMAScriptModule;
@@ -98129,6 +98229,66 @@ var ts;
98129
98229
  }
98130
98230
  }
98131
98231
  }
98232
+ function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, exports, conditions, mode) {
98233
+ if (mode === void 0) { mode = 0; }
98234
+ if (typeof exports === "string") {
98235
+ var pathOrPattern = ts.getNormalizedAbsolutePath(ts.combinePaths(packageDirectory, exports), undefined);
98236
+ var extensionSwappedTarget = ts.hasTSFileExtension(targetFilePath) ? ts.removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : undefined;
98237
+ switch (mode) {
98238
+ case 0:
98239
+ if (ts.comparePaths(targetFilePath, pathOrPattern) === 0 || (extensionSwappedTarget && ts.comparePaths(extensionSwappedTarget, pathOrPattern) === 0)) {
98240
+ return { moduleFileToTry: packageName };
98241
+ }
98242
+ break;
98243
+ case 1:
98244
+ if (ts.containsPath(pathOrPattern, targetFilePath)) {
98245
+ var fragment = ts.getRelativePathFromDirectory(pathOrPattern, targetFilePath, false);
98246
+ return { moduleFileToTry: ts.getNormalizedAbsolutePath(ts.combinePaths(ts.combinePaths(packageName, exports), fragment), undefined) };
98247
+ }
98248
+ break;
98249
+ case 2:
98250
+ var starPos = pathOrPattern.indexOf("*");
98251
+ var leadingSlice = pathOrPattern.slice(0, starPos);
98252
+ var trailingSlice = pathOrPattern.slice(starPos + 1);
98253
+ if (ts.startsWith(targetFilePath, leadingSlice) && ts.endsWith(targetFilePath, trailingSlice)) {
98254
+ var starReplacement = targetFilePath.slice(leadingSlice.length, targetFilePath.length - trailingSlice.length);
98255
+ return { moduleFileToTry: packageName.replace("*", starReplacement) };
98256
+ }
98257
+ if (extensionSwappedTarget && ts.startsWith(extensionSwappedTarget, leadingSlice) && ts.endsWith(extensionSwappedTarget, trailingSlice)) {
98258
+ var starReplacement = extensionSwappedTarget.slice(leadingSlice.length, extensionSwappedTarget.length - trailingSlice.length);
98259
+ return { moduleFileToTry: packageName.replace("*", starReplacement) };
98260
+ }
98261
+ break;
98262
+ }
98263
+ }
98264
+ else if (Array.isArray(exports)) {
98265
+ return ts.forEach(exports, function (e) { return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, e, conditions); });
98266
+ }
98267
+ else if (typeof exports === "object" && exports !== null) {
98268
+ if (ts.allKeysStartWithDot(exports)) {
98269
+ return ts.forEach(ts.getOwnKeys(exports), function (k) {
98270
+ var subPackageName = ts.getNormalizedAbsolutePath(ts.combinePaths(packageName, k), undefined);
98271
+ var mode = ts.endsWith(k, "/") ? 1
98272
+ : ts.stringContains(k, "*") ? 2
98273
+ : 0;
98274
+ return tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, subPackageName, exports[k], conditions, mode);
98275
+ });
98276
+ }
98277
+ else {
98278
+ for (var _i = 0, _a = ts.getOwnKeys(exports); _i < _a.length; _i++) {
98279
+ var key = _a[_i];
98280
+ if (key === "default" || conditions.indexOf(key) >= 0 || ts.isApplicableVersionedTypesKey(conditions, key)) {
98281
+ var subTarget = exports[key];
98282
+ var result = tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, subTarget, conditions);
98283
+ if (result) {
98284
+ return result;
98285
+ }
98286
+ }
98287
+ }
98288
+ }
98289
+ }
98290
+ return undefined;
98291
+ }
98132
98292
  function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) {
98133
98293
  var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName);
98134
98294
  if (normalizedTargetPath === undefined) {
@@ -98156,7 +98316,15 @@ var ts;
98156
98316
  var packageRootIndex = parts.packageRootIndex;
98157
98317
  var moduleFileNameForExtensionless = void 0;
98158
98318
  while (true) {
98159
- var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath;
98319
+ var _c = tryDirectoryWithPackageJson(packageRootIndex), moduleFileToTry = _c.moduleFileToTry, packageRootPath = _c.packageRootPath, blockedByExports = _c.blockedByExports, verbatimFromExports = _c.verbatimFromExports;
98320
+ if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Classic) {
98321
+ if (blockedByExports) {
98322
+ return undefined;
98323
+ }
98324
+ if (verbatimFromExports) {
98325
+ return moduleFileToTry;
98326
+ }
98327
+ }
98160
98328
  if (packageRootPath) {
98161
98329
  moduleSpecifier = packageRootPath;
98162
98330
  isPackageRootPath = true;
@@ -98181,13 +98349,21 @@ var ts;
98181
98349
  }
98182
98350
  var nodeModulesDirectoryName = moduleSpecifier.substring(parts.topLevelPackageNameIndex + 1);
98183
98351
  var packageName = ts.getPackageNameFromTypesPackageName(nodeModulesDirectoryName);
98184
- return ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs && packageName === nodeModulesDirectoryName ? undefined : packageName;
98352
+ return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Classic && packageName === nodeModulesDirectoryName ? undefined : packageName;
98185
98353
  function tryDirectoryWithPackageJson(packageRootIndex) {
98186
98354
  var packageRootPath = path.substring(0, packageRootIndex);
98187
98355
  var packageJsonPath = ts.combinePaths(packageRootPath, "package.json");
98188
98356
  var moduleFileToTry = path;
98189
98357
  if (host.fileExists(packageJsonPath)) {
98190
98358
  var packageJsonContent = JSON.parse(host.readFile(packageJsonPath));
98359
+ var fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string" ? tryGetModuleNameFromExports(options, path, packageRootPath, packageJsonContent.name, packageJsonContent.exports, ["node", "types"]) : undefined;
98360
+ if (fromExports) {
98361
+ var withJsExtension = !ts.hasTSFileExtension(fromExports.moduleFileToTry) ? fromExports : { moduleFileToTry: ts.removeFileExtension(fromExports.moduleFileToTry) + tryGetJSExtensionForFile(fromExports.moduleFileToTry, options) };
98362
+ return __assign(__assign({}, withJsExtension), { verbatimFromExports: true });
98363
+ }
98364
+ if (packageJsonContent.exports) {
98365
+ return { moduleFileToTry: path, blockedByExports: true };
98366
+ }
98191
98367
  var versionPaths = packageJsonContent.typesVersions
98192
98368
  ? ts.getPackageJsonTypesVersionsPaths(packageJsonContent.typesVersions)
98193
98369
  : undefined;
@@ -101222,7 +101398,7 @@ var ts;
101222
101398
  }
101223
101399
  function printEasyHelp(sys, simpleOptions) {
101224
101400
  var colors = createColors(sys);
101225
- var output = __spreadArray([], getHelpHeader(sys), true);
101401
+ var output = __spreadArray([], getHeader(sys, ts.getDiagnosticText(ts.Diagnostics.tsc_Colon_The_TypeScript_Compiler) + " - " + ts.getDiagnosticText(ts.Diagnostics.Version_0, ts.version)), true);
101226
101402
  output.push(colors.bold(ts.getDiagnosticText(ts.Diagnostics.COMMON_COMMANDS)) + sys.newLine + sys.newLine);
101227
101403
  example("tsc", ts.Diagnostics.Compiles_the_current_project_tsconfig_json_in_the_working_directory);
101228
101404
  example("tsc app.ts util.ts", ts.Diagnostics.Ignoring_tsconfig_json_compiles_the_specified_files_with_default_compiler_options);
@@ -101248,7 +101424,7 @@ var ts;
101248
101424
  }
101249
101425
  }
101250
101426
  function printAllHelp(sys, compilerOptions, buildOptions, watchOptions) {
101251
- var output = __spreadArray([], getHelpHeader(sys), true);
101427
+ var output = __spreadArray([], getHeader(sys, ts.getDiagnosticText(ts.Diagnostics.tsc_Colon_The_TypeScript_Compiler) + " - " + ts.getDiagnosticText(ts.Diagnostics.Version_0, ts.version)), true);
101252
101428
  output = __spreadArray(__spreadArray([], output, true), generateSectionOptionsOutput(sys, ts.getDiagnosticText(ts.Diagnostics.ALL_COMPILER_OPTIONS), compilerOptions, true, undefined, ts.formatMessage(undefined, ts.Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsconfig-reference")), true);
101253
101429
  output = __spreadArray(__spreadArray([], output, true), generateSectionOptionsOutput(sys, ts.getDiagnosticText(ts.Diagnostics.WATCH_OPTIONS), watchOptions, false, ts.getDiagnosticText(ts.Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon)), true);
101254
101430
  output = __spreadArray(__spreadArray([], output, true), generateSectionOptionsOutput(sys, ts.getDiagnosticText(ts.Diagnostics.BUILD_OPTIONS), buildOptions, false, ts.formatMessage(undefined, ts.Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds")), true);
@@ -101258,31 +101434,30 @@ var ts;
101258
101434
  }
101259
101435
  }
101260
101436
  function printBuildHelp(sys, buildOptions) {
101261
- var output = __spreadArray([], getHelpHeader(sys), true);
101437
+ var output = __spreadArray([], getHeader(sys, ts.getDiagnosticText(ts.Diagnostics.tsc_Colon_The_TypeScript_Compiler) + " - " + ts.getDiagnosticText(ts.Diagnostics.Version_0, ts.version)), true);
101262
101438
  output = __spreadArray(__spreadArray([], output, true), generateSectionOptionsOutput(sys, ts.getDiagnosticText(ts.Diagnostics.BUILD_OPTIONS), buildOptions, false, ts.formatMessage(undefined, ts.Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds")), true);
101263
101439
  for (var _i = 0, output_3 = output; _i < output_3.length; _i++) {
101264
101440
  var line = output_3[_i];
101265
101441
  sys.write(line);
101266
101442
  }
101267
101443
  }
101268
- function getHelpHeader(sys) {
101444
+ function getHeader(sys, message) {
101269
101445
  var _a, _b;
101270
101446
  var colors = createColors(sys);
101271
101447
  var header = [];
101272
- var tscExplanation = ts.getDiagnosticText(ts.Diagnostics.tsc_Colon_The_TypeScript_Compiler) + " - " + ts.getDiagnosticText(ts.Diagnostics.Version_0, ts.version);
101273
101448
  var terminalWidth = (_b = (_a = sys.getWidthOfTerminal) === null || _a === void 0 ? void 0 : _a.call(sys)) !== null && _b !== void 0 ? _b : 0;
101274
101449
  ;
101275
101450
  var tsIconLength = 5;
101276
101451
  var tsIconFirstLine = colors.blueBackground(ts.padLeft("", tsIconLength));
101277
101452
  var tsIconSecondLine = colors.blueBackground(colors.brightWhite(ts.padLeft("TS ", tsIconLength)));
101278
- if (terminalWidth >= tscExplanation.length + tsIconLength) {
101453
+ if (terminalWidth >= message.length + tsIconLength) {
101279
101454
  var rightAlign = terminalWidth > 120 ? 120 : terminalWidth;
101280
101455
  var leftAlign = rightAlign - tsIconLength;
101281
- header.push(ts.padRight(tscExplanation, leftAlign) + tsIconFirstLine + sys.newLine);
101456
+ header.push(ts.padRight(message, leftAlign) + tsIconFirstLine + sys.newLine);
101282
101457
  header.push(ts.padLeft("", leftAlign) + tsIconSecondLine + sys.newLine);
101283
101458
  }
101284
101459
  else {
101285
- header.push(tscExplanation + sys.newLine);
101460
+ header.push(message + sys.newLine);
101286
101461
  header.push(sys.newLine);
101287
101462
  }
101288
101463
  return header;
@@ -101697,7 +101872,13 @@ var ts;
101697
101872
  }
101698
101873
  else {
101699
101874
  sys.writeFile(file, ts.generateTSConfig(options, fileNames, sys.newLine));
101700
- reportDiagnostic(ts.createCompilerDiagnostic(ts.Diagnostics.Successfully_created_a_tsconfig_json_file));
101875
+ var output = __spreadArray([sys.newLine], getHeader(sys, "Created a new tsconfig.json with:"), true);
101876
+ output.push(ts.getCompilerOptionsDiffValue(options, sys.newLine) + sys.newLine + sys.newLine);
101877
+ output.push("You can learn more at https://aka.ms/tsconfig.json" + sys.newLine);
101878
+ for (var _i = 0, output_4 = output; _i < output_4.length; _i++) {
101879
+ var line = output_4[_i];
101880
+ sys.write(line);
101881
+ }
101701
101882
  }
101702
101883
  return;
101703
101884
  }