@typescript-deploys/pr-build 4.8.0-pr-50098-2 → 4.8.0-pr-49552-27

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.8";
72
- ts.version = ts.versionMajorMinor + ".0-insiders.20220730";
72
+ ts.version = ts.versionMajorMinor + ".0-insiders.20240308";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -1278,41 +1278,6 @@ var ts;
1278
1278
  return createMultiMap();
1279
1279
  }
1280
1280
  ts.createUnderscoreEscapedMultiMap = createUnderscoreEscapedMultiMap;
1281
- function createQueue(items) {
1282
- var elements = (items === null || items === void 0 ? void 0 : items.slice()) || [];
1283
- var headIndex = 0;
1284
- function isEmpty() {
1285
- return headIndex === elements.length;
1286
- }
1287
- function enqueue() {
1288
- var items = [];
1289
- for (var _i = 0; _i < arguments.length; _i++) {
1290
- items[_i] = arguments[_i];
1291
- }
1292
- elements.push.apply(elements, items);
1293
- }
1294
- function dequeue() {
1295
- if (isEmpty()) {
1296
- throw new Error("Queue is empty");
1297
- }
1298
- var result = elements[headIndex];
1299
- elements[headIndex] = undefined;
1300
- headIndex++;
1301
- if (headIndex > 100 && headIndex > (elements.length >> 1)) {
1302
- var newLength = elements.length - headIndex;
1303
- elements.copyWithin(0, headIndex);
1304
- elements.length = newLength;
1305
- headIndex = 0;
1306
- }
1307
- return result;
1308
- }
1309
- return {
1310
- enqueue: enqueue,
1311
- dequeue: dequeue,
1312
- isEmpty: isEmpty,
1313
- };
1314
- }
1315
- ts.createQueue = createQueue;
1316
1281
  function createSet(getHashCode, equals) {
1317
1282
  var multiMap = new ts.Map();
1318
1283
  var size = 0;
@@ -1484,10 +1449,6 @@ var ts;
1484
1449
  ts.cast = cast;
1485
1450
  function noop(_) { }
1486
1451
  ts.noop = noop;
1487
- ts.noopPush = {
1488
- push: noop,
1489
- length: 0
1490
- };
1491
1452
  function returnFalse() {
1492
1453
  return false;
1493
1454
  }
@@ -1711,7 +1672,7 @@ var ts;
1711
1672
  }
1712
1673
  ts.compareBooleans = compareBooleans;
1713
1674
  function getSpellingSuggestion(name, candidates, getName) {
1714
- var maximumLengthDifference = Math.max(2, Math.floor(name.length * 0.34));
1675
+ var maximumLengthDifference = Math.min(2, Math.floor(name.length * 0.34));
1715
1676
  var bestDistance = Math.floor(name.length * 0.4) + 1;
1716
1677
  var bestCandidate;
1717
1678
  for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) {
@@ -2366,22 +2327,6 @@ var ts;
2366
2327
  return formatEnum(flags, ts.FlowFlags, true);
2367
2328
  }
2368
2329
  Debug.formatFlowFlags = formatFlowFlags;
2369
- function formatRelationComparisonResult(result) {
2370
- return formatEnum(result, ts.RelationComparisonResult, true);
2371
- }
2372
- Debug.formatRelationComparisonResult = formatRelationComparisonResult;
2373
- function formatCheckMode(mode) {
2374
- return formatEnum(mode, ts.CheckMode, true);
2375
- }
2376
- Debug.formatCheckMode = formatCheckMode;
2377
- function formatSignatureCheckMode(mode) {
2378
- return formatEnum(mode, ts.SignatureCheckMode, true);
2379
- }
2380
- Debug.formatSignatureCheckMode = formatSignatureCheckMode;
2381
- function formatTypeFacts(facts) {
2382
- return formatEnum(facts, ts.TypeFacts, true);
2383
- }
2384
- Debug.formatTypeFacts = formatTypeFacts;
2385
2330
  var isDebugInfoEnabled = false;
2386
2331
  var extendedDebugModule;
2387
2332
  function extendedDebug() {
@@ -2687,48 +2632,6 @@ var ts;
2687
2632
  return wrapFunction(deprecation, func);
2688
2633
  }
2689
2634
  Debug.deprecate = deprecate;
2690
- function formatVariance(varianceFlags) {
2691
- var variance = varianceFlags & 7;
2692
- var result = variance === 0 ? "in out" :
2693
- variance === 3 ? "[bivariant]" :
2694
- variance === 2 ? "in" :
2695
- variance === 1 ? "out" :
2696
- variance === 4 ? "[independent]" : "";
2697
- if (varianceFlags & 8) {
2698
- result += " (unmeasurable)";
2699
- }
2700
- else if (varianceFlags & 16) {
2701
- result += " (unreliable)";
2702
- }
2703
- return result;
2704
- }
2705
- Debug.formatVariance = formatVariance;
2706
- var DebugTypeMapper = (function () {
2707
- function DebugTypeMapper() {
2708
- }
2709
- DebugTypeMapper.prototype.__debugToString = function () {
2710
- var _a;
2711
- type(this);
2712
- switch (this.kind) {
2713
- case 3: return ((_a = this.debugInfo) === null || _a === void 0 ? void 0 : _a.call(this)) || "(function mapper)";
2714
- case 0: return this.source.__debugTypeToString() + " -> " + this.target.__debugTypeToString();
2715
- case 1: return ts.zipWith(this.sources, this.targets || ts.map(this.sources, function () { return "any"; }), function (s, t) { return s.__debugTypeToString() + " -> " + (typeof t === "string" ? t : t.__debugTypeToString()); }).join(", ");
2716
- case 2: return ts.zipWith(this.sources, this.targets, function (s, t) { return s.__debugTypeToString() + " -> " + t().__debugTypeToString(); }).join(", ");
2717
- case 5:
2718
- case 4: return "m1: " + this.mapper1.__debugToString().split("\n").join("\n ") + "\nm2: " + this.mapper2.__debugToString().split("\n").join("\n ");
2719
- default: return assertNever(this);
2720
- }
2721
- };
2722
- return DebugTypeMapper;
2723
- }());
2724
- Debug.DebugTypeMapper = DebugTypeMapper;
2725
- function attachDebugPrototypeIfDebug(mapper) {
2726
- if (Debug.isDebugging) {
2727
- return Object.setPrototypeOf(mapper, DebugTypeMapper.prototype);
2728
- }
2729
- return mapper;
2730
- }
2731
- Debug.attachDebugPrototypeIfDebug = attachDebugPrototypeIfDebug;
2732
2635
  })(Debug = ts.Debug || (ts.Debug = {}));
2733
2636
  })(ts || (ts = {}));
2734
2637
  var ts;
@@ -3301,9 +3204,9 @@ var ts;
3301
3204
  eventStack.push({ phase: phase, name: name, args: args, time: 1000 * ts.timestamp(), separateBeginAndEnd: separateBeginAndEnd });
3302
3205
  }
3303
3206
  tracingEnabled.push = push;
3304
- function pop(results) {
3207
+ function pop() {
3305
3208
  ts.Debug.assert(eventStack.length > 0);
3306
- writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp(), results);
3209
+ writeStackEvent(eventStack.length - 1, 1000 * ts.timestamp());
3307
3210
  eventStack.length--;
3308
3211
  }
3309
3212
  tracingEnabled.pop = pop;
@@ -3316,14 +3219,13 @@ var ts;
3316
3219
  }
3317
3220
  tracingEnabled.popAll = popAll;
3318
3221
  var sampleInterval = 1000 * 10;
3319
- function writeStackEvent(index, endTime, results) {
3222
+ function writeStackEvent(index, endTime) {
3320
3223
  var _a = eventStack[index], phase = _a.phase, name = _a.name, args = _a.args, time = _a.time, separateBeginAndEnd = _a.separateBeginAndEnd;
3321
3224
  if (separateBeginAndEnd) {
3322
- ts.Debug.assert(!results, "`results` are not supported for events with `separateBeginAndEnd`");
3323
3225
  writeEvent("E", phase, name, args, undefined, endTime);
3324
3226
  }
3325
3227
  else if (sampleInterval - (time % sampleInterval) <= endTime - time) {
3326
- writeEvent("X", phase, name, __assign(__assign({}, args), { results: results }), "\"dur\":" + (endTime - time), time);
3228
+ writeEvent("X", phase, name, args, "\"dur\":" + (endTime - time), time);
3327
3229
  }
3328
3230
  }
3329
3231
  function writeEvent(eventType, phase, name, args, extras, time) {
@@ -4321,10 +4223,8 @@ var ts;
4321
4223
  watchPresentFileSystemEntry();
4322
4224
  return {
4323
4225
  close: function () {
4324
- if (watcher) {
4325
- watcher.close();
4326
- watcher = undefined;
4327
- }
4226
+ watcher.close();
4227
+ watcher = undefined;
4328
4228
  }
4329
4229
  };
4330
4230
  function updateWatcher(createWatcher) {
@@ -5727,10 +5627,6 @@ var ts;
5727
5627
  resolution_mode_is_the_only_valid_key_for_type_import_assertions: diag(1455, ts.DiagnosticCategory.Error, "resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455", "`resolution-mode` is the only valid key for type import assertions."),
5728
5628
  Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require: diag(1456, ts.DiagnosticCategory.Error, "Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require_1456", "Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`."),
5729
5629
  Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk: diag(1457, ts.DiagnosticCategory.Message, "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457", "Matched by default include pattern '**/*'"),
5730
- File_is_ECMAScript_module_because_0_has_field_type_with_value_module: diag(1458, ts.DiagnosticCategory.Message, "File_is_ECMAScript_module_because_0_has_field_type_with_value_module_1458", "File is ECMAScript module because '{0}' has field \"type\" with value \"module\""),
5731
- File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module: diag(1459, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module_1459", "File is CommonJS module because '{0}' has field \"type\" whose value is not \"module\""),
5732
- File_is_CommonJS_module_because_0_does_not_have_field_type: diag(1460, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_does_not_have_field_type_1460", "File is CommonJS module because '{0}' does not have field \"type\""),
5733
- File_is_CommonJS_module_because_package_json_was_not_found: diag(1461, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_package_json_was_not_found_1461", "File is CommonJS module because 'package.json' was not found"),
5734
5630
  The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
5735
5631
  Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead."),
5736
5632
  catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
@@ -5738,8 +5634,6 @@ var ts;
5738
5634
  An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
5739
5635
  Control_what_method_is_used_to_detect_module_format_JS_files: diag(1475, ts.DiagnosticCategory.Message, "Control_what_method_is_used_to_detect_module_format_JS_files_1475", "Control what method is used to detect module-format JS files."),
5740
5636
  auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
5741
- An_instantiation_expression_cannot_be_followed_by_a_property_access: diag(1477, ts.DiagnosticCategory.Error, "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477", "An instantiation expression cannot be followed by a property access."),
5742
- Identifier_or_string_literal_expected: diag(1478, ts.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."),
5743
5637
  The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
5744
5638
  The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
5745
5639
  Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", undefined, true),
@@ -5953,7 +5847,6 @@ var ts;
5953
5847
  Cannot_create_an_instance_of_an_abstract_class: diag(2511, ts.DiagnosticCategory.Error, "Cannot_create_an_instance_of_an_abstract_class_2511", "Cannot create an instance of an abstract class."),
5954
5848
  Overload_signatures_must_all_be_abstract_or_non_abstract: diag(2512, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."),
5955
5849
  Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: diag(2513, ts.DiagnosticCategory.Error, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."),
5956
- A_tuple_type_cannot_be_indexed_with_a_negative_value: diag(2514, ts.DiagnosticCategory.Error, "A_tuple_type_cannot_be_indexed_with_a_negative_value_2514", "A tuple type cannot be indexed with a negative value."),
5957
5850
  Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, ts.DiagnosticCategory.Error, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'."),
5958
5851
  All_declarations_of_an_abstract_method_must_be_consecutive: diag(2516, ts.DiagnosticCategory.Error, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."),
5959
5852
  Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: diag(2517, ts.DiagnosticCategory.Error, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."),
@@ -6241,7 +6134,6 @@ var ts;
6241
6134
  The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_feature_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(2841, ts.DiagnosticCategory.Error, "The_type_of_this_expression_cannot_be_named_without_a_resolution_mode_assertion_which_is_an_unstable_2841", "The type of this expression cannot be named without a 'resolution-mode' assertion, which is an unstable feature. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
6242
6135
  _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"),
6243
6136
  We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."),
6244
- Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
6245
6137
  Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
6246
6138
  Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
6247
6139
  Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -11470,6 +11362,17 @@ var ts;
11470
11362
  return ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for.");
11471
11363
  }
11472
11364
  ts.getLiteralText = getLiteralText;
11365
+ function getRawTextOfTemplateLiteralLike(node, sourceFile) {
11366
+ var text = node.rawText;
11367
+ if (text === undefined) {
11368
+ ts.Debug.assertIsDefined(sourceFile, "Template literal node is missing 'rawText' and does not have a source file. Possibly bad transform.");
11369
+ text = getSourceTextOfNodeFromSourceFile(sourceFile, node);
11370
+ var isLast = node.kind === 14 || node.kind === 17;
11371
+ text = text.substring(1, text.length - (isLast ? 1 : 2));
11372
+ }
11373
+ return text.replace(/\r\n?/g, "\n");
11374
+ }
11375
+ ts.getRawTextOfTemplateLiteralLike = getRawTextOfTemplateLiteralLike;
11473
11376
  function canUseOriginalText(node, flags) {
11474
11377
  if (nodeIsSynthesized(node) || !node.parent || (flags & 4 && node.isUnterminated)) {
11475
11378
  return false;
@@ -15436,8 +15339,7 @@ var ts;
15436
15339
  function getDeclarationModifierFlagsFromSymbol(s, isWrite) {
15437
15340
  if (isWrite === void 0) { isWrite = false; }
15438
15341
  if (s.valueDeclaration) {
15439
- var declaration = (isWrite && s.declarations && ts.find(s.declarations, ts.isSetAccessorDeclaration))
15440
- || (s.flags & 32768 && ts.find(s.declarations, ts.isGetAccessorDeclaration)) || s.valueDeclaration;
15342
+ var declaration = (isWrite && s.declarations && ts.find(s.declarations, function (d) { return d.kind === 173; })) || s.valueDeclaration;
15441
15343
  var flags = ts.getCombinedModifierFlags(declaration);
15442
15344
  return s.parent && s.parent.flags & 32 ? flags : flags & ~28;
15443
15345
  }
@@ -16059,7 +15961,7 @@ var ts;
16059
15961
  return !file.isDeclarationFile ? walkTreeForJSXTags(file) : undefined;
16060
15962
  }
16061
15963
  function isFileForcedToBeModuleByFormat(file) {
16062
- return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs", ".cts", ".mjs", ".mts"]))) && !file.isDeclarationFile ? true : undefined;
15964
+ return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs", ".cts"]))) && !file.isDeclarationFile ? true : undefined;
16063
15965
  }
16064
15966
  function getSetExternalModuleIndicator(options) {
16065
15967
  switch (getEmitModuleDetectionKind(options)) {
@@ -16076,7 +15978,10 @@ var ts;
16076
15978
  if (options.jsx === 4 || options.jsx === 5) {
16077
15979
  checks.push(isFileModuleFromUsingJSXTag);
16078
15980
  }
16079
- checks.push(isFileForcedToBeModuleByFormat);
15981
+ var moduleKind = getEmitModuleKind(options);
15982
+ if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
15983
+ checks.push(isFileForcedToBeModuleByFormat);
15984
+ }
16080
15985
  var combined_1 = ts.or.apply(void 0, checks);
16081
15986
  var callback = function (file) { return void (file.externalModuleIndicator = combined_1(file)); };
16082
15987
  return callback;
@@ -19276,7 +19181,7 @@ var ts;
19276
19181
  propagateChildFlags(node.expression) |
19277
19182
  (ts.isIdentifier(node.name) ?
19278
19183
  propagateIdentifierNameFlags(node.name) :
19279
- propagateChildFlags(node.name) | 536870912);
19184
+ propagateChildFlags(node.name));
19280
19185
  if (ts.isSuperKeyword(expression)) {
19281
19186
  node.transformFlags |=
19282
19187
  256 |
@@ -19305,7 +19210,7 @@ var ts;
19305
19210
  propagateChildFlags(node.questionDotToken) |
19306
19211
  (ts.isIdentifier(node.name) ?
19307
19212
  propagateIdentifierNameFlags(node.name) :
19308
- propagateChildFlags(node.name) | 536870912);
19213
+ propagateChildFlags(node.name));
19309
19214
  return node;
19310
19215
  }
19311
19216
  function updatePropertyAccessChain(node, expression, questionDotToken, name) {
@@ -19664,9 +19569,6 @@ var ts;
19664
19569
  else if (ts.isLogicalOrCoalescingAssignmentOperator(operatorKind)) {
19665
19570
  node.transformFlags |= 16;
19666
19571
  }
19667
- if (operatorKind === 101 && ts.isPrivateIdentifier(node.left)) {
19668
- node.transformFlags |= 536870912;
19669
- }
19670
19572
  return node;
19671
19573
  }
19672
19574
  function propagateAssignmentPatternFlags(node) {
@@ -22093,29 +21995,29 @@ var ts;
22093
21995
  case 208:
22094
21996
  case 209:
22095
21997
  case 204:
22096
- return -2147450880;
21998
+ return 536903680;
22097
21999
  case 261:
22098
- return -1941676032;
22000
+ return 742678528;
22099
22001
  case 164:
22100
- return -2147483648;
22002
+ return 536870912;
22101
22003
  case 214:
22102
- return -2072174592;
22004
+ return 612179968;
22103
22005
  case 213:
22104
22006
  case 256:
22105
- return -1937940480;
22007
+ return 746414080;
22106
22008
  case 255:
22107
- return -2146893824;
22009
+ return 537460736;
22108
22010
  case 257:
22109
22011
  case 226:
22110
- return -2147344384;
22012
+ return 537010176;
22111
22013
  case 171:
22112
- return -1937948672;
22014
+ return 746405888;
22113
22015
  case 167:
22114
- return -2013249536;
22016
+ return 671105024;
22115
22017
  case 169:
22116
22018
  case 172:
22117
22019
  case 173:
22118
- return -2005057536;
22020
+ return 679297024;
22119
22021
  case 130:
22120
22022
  case 147:
22121
22023
  case 158:
@@ -22135,23 +22037,23 @@ var ts;
22135
22037
  case 259:
22136
22038
  return -2;
22137
22039
  case 205:
22138
- return -2147278848;
22040
+ return 537075712;
22139
22041
  case 292:
22140
- return -2147418112;
22042
+ return 536936448;
22141
22043
  case 201:
22142
22044
  case 202:
22143
- return -2147450880;
22045
+ return 536903680;
22144
22046
  case 211:
22145
22047
  case 229:
22146
22048
  case 350:
22147
22049
  case 212:
22148
22050
  case 106:
22149
- return -2147483648;
22051
+ return 536870912;
22150
22052
  case 206:
22151
22053
  case 207:
22152
- return -2147483648;
22054
+ return 536870912;
22153
22055
  default:
22154
- return -2147483648;
22056
+ return 536870912;
22155
22057
  }
22156
22058
  }
22157
22059
  ts.getTransformFlagsSubtreeExclusions = getTransformFlagsSubtreeExclusions;
@@ -26691,11 +26593,11 @@ var ts;
26691
26593
  }
26692
26594
  return parseElement();
26693
26595
  }
26694
- function currentNode(parsingContext, pos) {
26596
+ function currentNode(parsingContext) {
26695
26597
  if (!syntaxCursor || !isReusableParsingContext(parsingContext) || parseErrorBeforeNextFinishedNode) {
26696
26598
  return undefined;
26697
26599
  }
26698
- var node = syntaxCursor.currentNode(pos !== null && pos !== void 0 ? pos : scanner.getStartPos());
26600
+ var node = syntaxCursor.currentNode(scanner.getStartPos());
26699
26601
  if (ts.nodeIsMissing(node) || node.intersectsChange || ts.containsParseError(node)) {
26700
26602
  return undefined;
26701
26603
  }
@@ -26893,9 +26795,7 @@ var ts;
26893
26795
  case 23: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
26894
26796
  case 13: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
26895
26797
  case 14: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
26896
- case 24: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_or_string_literal_expected);
26897
- case 25: return ts.Debug.fail("ParsingContext.Count used as a context");
26898
- default: ts.Debug.assertNever(context);
26798
+ default: return [undefined];
26899
26799
  }
26900
26800
  }
26901
26801
  function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) {
@@ -27241,7 +27141,7 @@ var ts;
27241
27141
  if (allowAmbiguity === void 0) { allowAmbiguity = true; }
27242
27142
  var pos = getNodePos();
27243
27143
  var hasJSDoc = hasPrecedingJSDocComment();
27244
- var decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : doOutsideOfAwaitContext(parseDecorators);
27144
+ var decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : parseDecorators();
27245
27145
  if (token() === 108) {
27246
27146
  var node_1 = factory.createParameterDeclaration(decorators, undefined, createIdentifier(true), undefined, parseTypeAnnotation(), undefined);
27247
27147
  if (decorators) {
@@ -27417,10 +27317,10 @@ var ts;
27417
27317
  var hasJSDoc = hasPrecedingJSDocComment();
27418
27318
  var modifiers = parseModifiers();
27419
27319
  if (parseContextualModifier(136)) {
27420
- return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 172, 4);
27320
+ return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 172);
27421
27321
  }
27422
27322
  if (parseContextualModifier(149)) {
27423
- return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 173, 4);
27323
+ return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 173);
27424
27324
  }
27425
27325
  if (isIndexSignature()) {
27426
27326
  return parseIndexSignatureDeclaration(pos, hasJSDoc, undefined, modifiers);
@@ -28503,9 +28403,6 @@ var ts;
28503
28403
  var typeArguments = tryParse(parseTypeArgumentsInExpression);
28504
28404
  if (typeArguments !== undefined) {
28505
28405
  parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
28506
- if (!isTemplateStartOfTaggedTemplate()) {
28507
- expression = factory.createExpressionWithTypeArguments(expression, typeArguments);
28508
- }
28509
28406
  }
28510
28407
  }
28511
28408
  if (token() === 20 || token() === 24 || token() === 22) {
@@ -28785,11 +28682,6 @@ var ts;
28785
28682
  if (isOptionalChain && ts.isPrivateIdentifier(propertyAccess.name)) {
28786
28683
  parseErrorAtRange(propertyAccess.name, ts.Diagnostics.An_optional_chain_cannot_contain_private_identifiers);
28787
28684
  }
28788
- if (ts.isExpressionWithTypeArguments(expression) && expression.typeArguments) {
28789
- var pos_2 = expression.typeArguments.pos - 1;
28790
- var end = ts.skipTrivia(sourceText, expression.typeArguments.end) + 1;
28791
- parseErrorAt(pos_2, end, ts.Diagnostics.An_instantiation_expression_cannot_be_followed_by_a_property_access);
28792
- }
28793
28685
  return finishNode(propertyAccess, pos);
28794
28686
  }
28795
28687
  function parseElementAccessExpressionRest(pos, expression, questionDotToken) {
@@ -29014,10 +28906,10 @@ var ts;
29014
28906
  var decorators = parseDecorators();
29015
28907
  var modifiers = parseModifiers();
29016
28908
  if (parseContextualModifier(136)) {
29017
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172, 0);
28909
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172);
29018
28910
  }
29019
28911
  if (parseContextualModifier(149)) {
29020
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173, 0);
28912
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173);
29021
28913
  }
29022
28914
  var asteriskToken = parseOptionalToken(41);
29023
28915
  var tokenIsIdentifier = isIdentifier();
@@ -29558,16 +29450,18 @@ var ts;
29558
29450
  return modifier.kind === 135;
29559
29451
  }
29560
29452
  function parseDeclaration() {
29453
+ var isAmbient = ts.some(lookAhead(function () { return (parseDecorators(), parseModifiers()); }), isDeclareModifier);
29454
+ if (isAmbient) {
29455
+ var node = tryReuseAmbientDeclaration();
29456
+ if (node) {
29457
+ return node;
29458
+ }
29459
+ }
29561
29460
  var pos = getNodePos();
29562
29461
  var hasJSDoc = hasPrecedingJSDocComment();
29563
29462
  var decorators = parseDecorators();
29564
29463
  var modifiers = parseModifiers();
29565
- var isAmbient = ts.some(modifiers, isDeclareModifier);
29566
29464
  if (isAmbient) {
29567
- var node = tryReuseAmbientDeclaration(pos);
29568
- if (node) {
29569
- return node;
29570
- }
29571
29465
  for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
29572
29466
  var m = _a[_i];
29573
29467
  m.flags |= 16777216;
@@ -29578,9 +29472,9 @@ var ts;
29578
29472
  return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers);
29579
29473
  }
29580
29474
  }
29581
- function tryReuseAmbientDeclaration(pos) {
29475
+ function tryReuseAmbientDeclaration() {
29582
29476
  return doInsideOfContext(16777216, function () {
29583
- var node = currentNode(parsingContext, pos);
29477
+ var node = currentNode(parsingContext);
29584
29478
  if (node) {
29585
29479
  return consumeNode(node);
29586
29480
  }
@@ -29635,15 +29529,9 @@ var ts;
29635
29529
  return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 10);
29636
29530
  }
29637
29531
  function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) {
29638
- if (token() !== 18) {
29639
- if (flags & 4) {
29640
- parseTypeMemberSemicolon();
29641
- return;
29642
- }
29643
- if (canParseSemicolon()) {
29644
- parseSemicolon();
29645
- return;
29646
- }
29532
+ if (token() !== 18 && canParseSemicolon()) {
29533
+ parseSemicolon();
29534
+ return;
29647
29535
  }
29648
29536
  return parseFunctionBlock(flags, diagnosticMessage);
29649
29537
  }
@@ -29831,12 +29719,12 @@ var ts;
29831
29719
  }
29832
29720
  return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, questionToken);
29833
29721
  }
29834
- function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind, flags) {
29722
+ function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind) {
29835
29723
  var name = parsePropertyName();
29836
29724
  var typeParameters = parseTypeParameters();
29837
29725
  var parameters = parseParameters(0);
29838
29726
  var type = parseReturnType(58, false);
29839
- var body = parseFunctionBlockOrSemicolon(flags);
29727
+ var body = parseFunctionBlockOrSemicolon(0);
29840
29728
  var node = kind === 172
29841
29729
  ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body)
29842
29730
  : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body);
@@ -29992,10 +29880,10 @@ var ts;
29992
29880
  return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers);
29993
29881
  }
29994
29882
  if (parseContextualModifier(136)) {
29995
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172, 0);
29883
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172);
29996
29884
  }
29997
29885
  if (parseContextualModifier(149)) {
29998
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173, 0);
29886
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173);
29999
29887
  }
30000
29888
  if (token() === 134 || token() === 10) {
30001
29889
  var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers);
@@ -31490,10 +31378,10 @@ var ts;
31490
31378
  }
31491
31379
  function checkNodePositions(node, aggressiveChecks) {
31492
31380
  if (aggressiveChecks) {
31493
- var pos_3 = node.pos;
31381
+ var pos_2 = node.pos;
31494
31382
  var visitNode_1 = function (child) {
31495
- ts.Debug.assert(child.pos >= pos_3);
31496
- pos_3 = child.end;
31383
+ ts.Debug.assert(child.pos >= pos_2);
31384
+ pos_2 = child.end;
31497
31385
  };
31498
31386
  if (ts.hasJSDocNodes(node)) {
31499
31387
  for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
@@ -31502,7 +31390,7 @@ var ts;
31502
31390
  }
31503
31391
  }
31504
31392
  forEachChild(node, visitNode_1);
31505
- ts.Debug.assert(pos_3 <= node.end);
31393
+ ts.Debug.assert(pos_2 <= node.end);
31506
31394
  }
31507
31395
  }
31508
31396
  function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) {
@@ -35258,7 +35146,18 @@ var ts;
35258
35146
  NodeResolutionFeatures.None;
35259
35147
  }
35260
35148
  function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
35261
- var moduleResolutionState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
35149
+ var moduleResolutionState = {
35150
+ compilerOptions: options,
35151
+ host: host,
35152
+ traceEnabled: isTraceEnabled(options, host),
35153
+ failedLookupLocations: [],
35154
+ affectingLocations: [],
35155
+ packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
35156
+ conditions: ts.emptyArray,
35157
+ features: NodeResolutionFeatures.None,
35158
+ requestContainingDirectory: containingDirectory,
35159
+ reportDiagnostic: ts.noop
35160
+ };
35262
35161
  return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
35263
35162
  if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
35264
35163
  var nodeModulesFolder = ts.combinePaths(ancestorDirectory, "node_modules");
@@ -35338,7 +35237,7 @@ var ts;
35338
35237
  ts.createCacheWithRedirects = createCacheWithRedirects;
35339
35238
  function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
35340
35239
  var cache;
35341
- return { getPackageJsonInfo: getPackageJsonInfo, setPackageJsonInfo: setPackageJsonInfo, clear: clear, entries: entries, getInternalMap: getInternalMap };
35240
+ return { getPackageJsonInfo: getPackageJsonInfo, setPackageJsonInfo: setPackageJsonInfo, clear: clear, entries: entries };
35342
35241
  function getPackageJsonInfo(packageJsonPath) {
35343
35242
  return cache === null || cache === void 0 ? void 0 : cache.get(ts.toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
35344
35243
  }
@@ -35352,9 +35251,6 @@ var ts;
35352
35251
  var iter = cache === null || cache === void 0 ? void 0 : cache.entries();
35353
35252
  return iter ? ts.arrayFrom(iter) : [];
35354
35253
  }
35355
- function getInternalMap() {
35356
- return cache;
35357
- }
35358
35254
  }
35359
35255
  function getOrCreateCache(cacheWithRedirects, redirectedReference, key, create) {
35360
35256
  var cache = cacheWithRedirects.getOrCreateMapOfCacheRedirects(redirectedReference);
@@ -35453,17 +35349,14 @@ var ts;
35453
35349
  }
35454
35350
  ts.zipToModeAwareCache = zipToModeAwareCache;
35455
35351
  function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options, directoryToModuleNameMap, moduleNameToDirectoryMap) {
35456
- var perDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
35352
+ var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
35457
35353
  moduleNameToDirectoryMap || (moduleNameToDirectoryMap = createCacheWithRedirects(options));
35458
35354
  var packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName);
35459
- return __assign(__assign(__assign({}, packageJsonInfoCache), perDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; }, clearAllExceptPackageJsonInfoCache: clearAllExceptPackageJsonInfoCache });
35355
+ return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, clear: clear, update: update, getPackageJsonInfoCache: function () { return packageJsonInfoCache; } });
35460
35356
  function clear() {
35461
- clearAllExceptPackageJsonInfoCache();
35462
- packageJsonInfoCache.clear();
35463
- }
35464
- function clearAllExceptPackageJsonInfoCache() {
35465
- perDirectoryResolutionCache.clear();
35357
+ preDirectoryResolutionCache.clear();
35466
35358
  moduleNameToDirectoryMap.clear();
35359
+ packageJsonInfoCache.clear();
35467
35360
  }
35468
35361
  function update(options) {
35469
35362
  updateRedirectsMap(options, directoryToModuleNameMap, moduleNameToDirectoryMap);
@@ -35523,13 +35416,10 @@ var ts;
35523
35416
  function createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, options, packageJsonInfoCache, directoryToModuleNameMap) {
35524
35417
  var preDirectoryResolutionCache = createPerDirectoryResolutionCache(currentDirectory, getCanonicalFileName, directoryToModuleNameMap || (directoryToModuleNameMap = createCacheWithRedirects(options)));
35525
35418
  packageJsonInfoCache || (packageJsonInfoCache = createPackageJsonInfoCache(currentDirectory, getCanonicalFileName));
35526
- return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { clear: clear, clearAllExceptPackageJsonInfoCache: clearAllExceptPackageJsonInfoCache });
35419
+ return __assign(__assign(__assign({}, packageJsonInfoCache), preDirectoryResolutionCache), { clear: clear });
35527
35420
  function clear() {
35528
- clearAllExceptPackageJsonInfoCache();
35529
- packageJsonInfoCache.clear();
35530
- }
35531
- function clearAllExceptPackageJsonInfoCache() {
35532
35421
  preDirectoryResolutionCache.clear();
35422
+ packageJsonInfoCache.clear();
35533
35423
  }
35534
35424
  }
35535
35425
  ts.createTypeReferenceDirectiveResolutionCache = createTypeReferenceDirectiveResolutionCache;
@@ -36067,9 +35957,18 @@ var ts;
36067
35957
  var entrypoints;
36068
35958
  var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript;
36069
35959
  var features = getDefaultNodeResolutionFeatures(options);
36070
- var requireState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
36071
- requireState.conditions = ["node", "require", "types"];
36072
- requireState.requestContainingDirectory = packageJsonInfo.packageDirectory;
35960
+ var requireState = {
35961
+ compilerOptions: options,
35962
+ host: host,
35963
+ traceEnabled: isTraceEnabled(options, host),
35964
+ failedLookupLocations: [],
35965
+ affectingLocations: [],
35966
+ packageJsonInfoCache: cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(),
35967
+ conditions: ["node", "require", "types"],
35968
+ features: features,
35969
+ requestContainingDirectory: packageJsonInfo.packageDirectory,
35970
+ reportDiagnostic: ts.noop
35971
+ };
36073
35972
  var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory, false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
36074
35973
  entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
36075
35974
  if (features & NodeResolutionFeatures.Exports && packageJsonInfo.packageJsonContent.exports) {
@@ -36139,22 +36038,19 @@ var ts;
36139
36038
  }
36140
36039
  }
36141
36040
  }
36142
- function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options) {
36143
- return {
36041
+ function getPackageScopeForPath(fileName, packageJsonInfoCache, host, options) {
36042
+ var state = {
36144
36043
  host: host,
36145
36044
  compilerOptions: options,
36146
36045
  traceEnabled: isTraceEnabled(options, host),
36147
- failedLookupLocations: ts.noopPush,
36148
- affectingLocations: ts.noopPush,
36046
+ failedLookupLocations: [],
36047
+ affectingLocations: [],
36149
36048
  packageJsonInfoCache: packageJsonInfoCache,
36150
- features: NodeResolutionFeatures.None,
36151
- conditions: ts.emptyArray,
36049
+ features: 0,
36050
+ conditions: [],
36152
36051
  requestContainingDirectory: undefined,
36153
36052
  reportDiagnostic: ts.noop
36154
36053
  };
36155
- }
36156
- ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
36157
- function getPackageScopeForPath(fileName, state) {
36158
36054
  var parts = ts.getPathComponents(fileName);
36159
36055
  parts.pop();
36160
36056
  while (parts.length > 0) {
@@ -36311,7 +36207,7 @@ var ts;
36311
36207
  var _a, _b;
36312
36208
  var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
36313
36209
  var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
36314
- var scope = getPackageScopeForPath(directoryPath, state);
36210
+ var scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions);
36315
36211
  if (!scope || !scope.packageJsonContent.exports) {
36316
36212
  return undefined;
36317
36213
  }
@@ -36370,7 +36266,7 @@ var ts;
36370
36266
  }
36371
36267
  var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
36372
36268
  var directoryPath = ts.toPath(ts.combinePaths(directory, "dummy"), (_b = (_a = state.host).getCurrentDirectory) === null || _b === void 0 ? void 0 : _b.call(_a), ts.createGetCanonicalFileName(useCaseSensitiveFileNames === undefined ? true : useCaseSensitiveFileNames));
36373
- var scope = getPackageScopeForPath(directoryPath, state);
36269
+ var scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions);
36374
36270
  if (!scope) {
36375
36271
  if (state.traceEnabled) {
36376
36272
  trace(state.host, ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath);
@@ -36411,7 +36307,6 @@ var ts;
36411
36307
  return 1;
36412
36308
  return 0;
36413
36309
  }
36414
- ts.comparePatternKeys = comparePatternKeys;
36415
36310
  function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
36416
36311
  var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
36417
36312
  if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
@@ -38469,6 +38364,24 @@ var ts;
38469
38364
  typeLiteralSymbol.members.set(symbol.escapedName, symbol);
38470
38365
  }
38471
38366
  function bindObjectLiteralExpression(node) {
38367
+ if (inStrictMode && !ts.isAssignmentTarget(node)) {
38368
+ var seen = new ts.Map();
38369
+ for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
38370
+ var prop = _a[_i];
38371
+ if (prop.kind === 298 || prop.name.kind !== 79) {
38372
+ continue;
38373
+ }
38374
+ var identifier = prop.name;
38375
+ var currentKind = prop.kind === 296 || prop.kind === 297 || prop.kind === 169
38376
+ ? 1
38377
+ : 2;
38378
+ var existingKind = seen.get(identifier.escapedText);
38379
+ if (!existingKind) {
38380
+ seen.set(identifier.escapedText, currentKind);
38381
+ continue;
38382
+ }
38383
+ }
38384
+ }
38472
38385
  return bindAnonymousDeclaration(node, 4096, "__object");
38473
38386
  }
38474
38387
  function bindJsxAttributes(node) {
@@ -39596,11 +39509,10 @@ var ts;
39596
39509
  }
39597
39510
  function isExportsOrModuleExportsOrAlias(sourceFile, node) {
39598
39511
  var i = 0;
39599
- var q = ts.createQueue();
39600
- q.enqueue(node);
39601
- while (!q.isEmpty() && i < 100) {
39512
+ var q = [node];
39513
+ while (q.length && i < 100) {
39602
39514
  i++;
39603
- node = q.dequeue();
39515
+ node = q.shift();
39604
39516
  if (ts.isExportsIdentifier(node) || ts.isModuleExportsAccessExpression(node)) {
39605
39517
  return true;
39606
39518
  }
@@ -39608,10 +39520,10 @@ var ts;
39608
39520
  var symbol = lookupSymbolForName(sourceFile, node.escapedText);
39609
39521
  if (!!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) {
39610
39522
  var init = symbol.valueDeclaration.initializer;
39611
- q.enqueue(init);
39523
+ q.push(init);
39612
39524
  if (ts.isAssignmentExpression(init, true)) {
39613
- q.enqueue(init.left);
39614
- q.enqueue(init.right);
39525
+ q.push(init.left);
39526
+ q.push(init.right);
39615
39527
  }
39616
39528
  }
39617
39529
  }
@@ -40055,7 +39967,7 @@ var ts;
40055
39967
  },
40056
39968
  getContextualTypeForObjectLiteralElement: function (nodeIn) {
40057
39969
  var node = ts.getParseTreeNode(nodeIn, ts.isObjectLiteralElementLike);
40058
- return node ? getContextualTypeForObjectLiteralElement(node, undefined) : undefined;
39970
+ return node ? getContextualTypeForObjectLiteralElement(node) : undefined;
40059
39971
  },
40060
39972
  getContextualTypeForArgumentAtIndex: function (nodeIn, argIndex) {
40061
39973
  var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
@@ -40063,7 +39975,7 @@ var ts;
40063
39975
  },
40064
39976
  getContextualTypeForJsxAttribute: function (nodeIn) {
40065
39977
  var node = ts.getParseTreeNode(nodeIn, ts.isJsxAttributeLike);
40066
- return node && getContextualTypeForJsxAttribute(node, undefined);
39978
+ return node && getContextualTypeForJsxAttribute(node);
40067
39979
  },
40068
39980
  isContextSensitive: isContextSensitive,
40069
39981
  getTypeOfPropertyOfContextualType: getTypeOfPropertyOfContextualType,
@@ -40263,7 +40175,6 @@ var ts;
40263
40175
  var stringMappingTypes = new ts.Map();
40264
40176
  var substitutionTypes = new ts.Map();
40265
40177
  var subtypeReductionCache = new ts.Map();
40266
- var cachedTypes = new ts.Map();
40267
40178
  var evolvingArrayTypes = [];
40268
40179
  var undefinedProperties = new ts.Map();
40269
40180
  var markerTypes = new ts.Set();
@@ -40272,10 +40183,11 @@ var ts;
40272
40183
  var unresolvedSymbols = new ts.Map();
40273
40184
  var errorTypes = new ts.Map();
40274
40185
  var anyType = createIntrinsicType(1, "any");
40275
- var autoType = createIntrinsicType(1, "any", 262144);
40186
+ var autoType = createIntrinsicType(1, "any");
40276
40187
  var wildcardType = createIntrinsicType(1, "any");
40277
40188
  var errorType = createIntrinsicType(1, "error");
40278
40189
  var unresolvedType = createIntrinsicType(1, "unresolved");
40190
+ var nonInferrableAnyType = createIntrinsicType(1, "any", 65536);
40279
40191
  var intrinsicMarkerType = createIntrinsicType(1, "intrinsic");
40280
40192
  var unknownType = createIntrinsicType(2, "unknown");
40281
40193
  var nonNullUnknownType = createIntrinsicType(2, "unknown");
@@ -40304,7 +40216,8 @@ var ts;
40304
40216
  var esSymbolType = createIntrinsicType(4096, "symbol");
40305
40217
  var voidType = createIntrinsicType(16384, "void");
40306
40218
  var neverType = createIntrinsicType(131072, "never");
40307
- var silentNeverType = createIntrinsicType(131072, "never", 262144);
40219
+ var silentNeverType = createIntrinsicType(131072, "never");
40220
+ var nonInferrableType = createIntrinsicType(131072, "never", 262144);
40308
40221
  var implicitNeverType = createIntrinsicType(131072, "never");
40309
40222
  var unreachableNeverType = createIntrinsicType(131072, "never");
40310
40223
  var nonPrimitiveType = createIntrinsicType(67108864, "object");
@@ -40314,23 +40227,10 @@ var ts;
40314
40227
  var numberOrBigIntType = getUnionType([numberType, bigintType]);
40315
40228
  var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
40316
40229
  var numericStringType = getTemplateLiteralType(["", ""], [numberType]);
40317
- var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? getRestrictiveTypeParameter(t) : t; }, function () { return "(restrictive mapper)"; });
40318
- var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? wildcardType : t; }, function () { return "(permissive mapper)"; });
40230
+ var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? getRestrictiveTypeParameter(t) : t; });
40231
+ var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? wildcardType : t; });
40319
40232
  var uniqueLiteralType = createIntrinsicType(131072, "never");
40320
- var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? uniqueLiteralType : t; }, function () { return "(unique literal mapper)"; });
40321
- var outofbandVarianceMarkerHandler;
40322
- var reportUnreliableMapper = makeFunctionTypeMapper(function (t) {
40323
- if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
40324
- outofbandVarianceMarkerHandler(true);
40325
- }
40326
- return t;
40327
- }, function () { return "(unmeasurable reporter)"; });
40328
- var reportUnmeasurableMapper = makeFunctionTypeMapper(function (t) {
40329
- if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
40330
- outofbandVarianceMarkerHandler(false);
40331
- }
40332
- return t;
40333
- }, function () { return "(unreliable reporter)"; });
40233
+ var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? uniqueLiteralType : t; });
40334
40234
  var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
40335
40235
  var emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
40336
40236
  emptyJsxObjectType.objectFlags |= 2048;
@@ -40433,6 +40333,7 @@ var ts;
40433
40333
  var deferredGlobalAsyncIterableIteratorType;
40434
40334
  var deferredGlobalAsyncGeneratorType;
40435
40335
  var deferredGlobalTemplateStringsArrayType;
40336
+ var deferredGlobalTemplateStringsArrayOfSymbol;
40436
40337
  var deferredGlobalImportMetaType;
40437
40338
  var deferredGlobalImportMetaExpressionType;
40438
40339
  var deferredGlobalImportCallOptionsType;
@@ -40479,6 +40380,7 @@ var ts;
40479
40380
  var typeofType = createTypeofType();
40480
40381
  var _jsxNamespace;
40481
40382
  var _jsxFactoryEntity;
40383
+ var outofbandVarianceMarkerHandler;
40482
40384
  var subtypeRelation = new ts.Map();
40483
40385
  var strictSubtypeRelation = new ts.Map();
40484
40386
  var assignableRelation = new ts.Map();
@@ -40500,14 +40402,6 @@ var ts;
40500
40402
  ];
40501
40403
  initializeTypeChecker();
40502
40404
  return checker;
40503
- function getCachedType(key) {
40504
- return key ? cachedTypes.get(key) : undefined;
40505
- }
40506
- function setCachedType(key, type) {
40507
- if (key)
40508
- cachedTypes.set(key, type);
40509
- return type;
40510
- }
40511
40405
  function getJsxNamespace(location) {
40512
40406
  if (location) {
40513
40407
  var file = ts.getSourceFileOfNode(location);
@@ -41247,7 +41141,6 @@ var ts;
41247
41141
  var ctor = findConstructorDeclaration(location.parent);
41248
41142
  if (ctor && ctor.locals) {
41249
41143
  if (lookup(ctor.locals, name, meaning & 111551)) {
41250
- ts.Debug.assertNode(location, ts.isPropertyDeclaration);
41251
41144
  propertyWithInvalidInitializer = location;
41252
41145
  }
41253
41146
  }
@@ -41393,21 +41286,11 @@ var ts;
41393
41286
  }
41394
41287
  }
41395
41288
  }
41396
- function checkAndReportErrorForInvalidInitializer() {
41397
- if (propertyWithInvalidInitializer && !(useDefineForClassFields && ts.getEmitScriptTarget(compilerOptions) >= 9)) {
41398
- error(errorLocation, errorLocation && propertyWithInvalidInitializer.type && ts.textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos)
41399
- ? ts.Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor
41400
- : ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyWithInvalidInitializer.name), diagnosticName(nameArg));
41401
- return true;
41402
- }
41403
- return false;
41404
- }
41405
41289
  if (!result) {
41406
41290
  if (nameNotFoundMessage) {
41407
41291
  addLazyDiagnostic(function () {
41408
41292
  if (!errorLocation ||
41409
41293
  !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&
41410
- !checkAndReportErrorForInvalidInitializer() &&
41411
41294
  !checkAndReportErrorForExtendingInterface(errorLocation) &&
41412
41295
  !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
41413
41296
  !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) &&
@@ -41415,14 +41298,7 @@ var ts;
41415
41298
  !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
41416
41299
  !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
41417
41300
  var suggestion = void 0;
41418
- var suggestedLib = void 0;
41419
- if (nameArg) {
41420
- suggestedLib = getSuggestedLibForNonExistentName(nameArg);
41421
- if (suggestedLib) {
41422
- error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
41423
- }
41424
- }
41425
- if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
41301
+ if (getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
41426
41302
  suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
41427
41303
  var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts.isAmbientModule(suggestion.valueDeclaration) && ts.isGlobalScopeAugmentation(suggestion.valueDeclaration);
41428
41304
  if (isGlobalScopeAugmentationDeclaration) {
@@ -41441,8 +41317,16 @@ var ts;
41441
41317
  }
41442
41318
  }
41443
41319
  }
41444
- if (!suggestion && !suggestedLib && nameArg) {
41445
- error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
41320
+ if (!suggestion) {
41321
+ if (nameArg) {
41322
+ var lib = getSuggestedLibForNonExistentName(nameArg);
41323
+ if (lib) {
41324
+ error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), lib);
41325
+ }
41326
+ else {
41327
+ error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg));
41328
+ }
41329
+ }
41446
41330
  }
41447
41331
  suggestionCount++;
41448
41332
  }
@@ -41450,7 +41334,9 @@ var ts;
41450
41334
  }
41451
41335
  return undefined;
41452
41336
  }
41453
- else if (checkAndReportErrorForInvalidInitializer()) {
41337
+ if (propertyWithInvalidInitializer && !(ts.getEmitScriptTarget(compilerOptions) === 99 && useDefineForClassFields)) {
41338
+ var propertyName = propertyWithInvalidInitializer.name;
41339
+ error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), diagnosticName(nameArg));
41454
41340
  return undefined;
41455
41341
  }
41456
41342
  if (nameNotFoundMessage) {
@@ -43324,25 +43210,13 @@ var ts;
43324
43210
  && isDeclarationVisible(declaration.parent)) {
43325
43211
  return addVisibleAlias(declaration, declaration);
43326
43212
  }
43327
- else if (ts.isBindingElement(declaration)) {
43328
- if (symbol.flags & 2097152 && ts.isInJSFile(declaration) && ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.parent)
43329
- && ts.isVariableDeclaration(declaration.parent.parent)
43330
- && ((_b = declaration.parent.parent.parent) === null || _b === void 0 ? void 0 : _b.parent) && ts.isVariableStatement(declaration.parent.parent.parent.parent)
43331
- && !ts.hasSyntacticModifier(declaration.parent.parent.parent.parent, 1)
43332
- && declaration.parent.parent.parent.parent.parent
43333
- && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
43334
- return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
43335
- }
43336
- else if (symbol.flags & 2) {
43337
- var variableStatement = ts.findAncestor(declaration, ts.isVariableStatement);
43338
- if (ts.hasSyntacticModifier(variableStatement, 1)) {
43339
- return true;
43340
- }
43341
- if (!isDeclarationVisible(variableStatement.parent)) {
43342
- return false;
43343
- }
43344
- return addVisibleAlias(declaration, variableStatement);
43345
- }
43213
+ else if (symbol.flags & 2097152 && ts.isBindingElement(declaration) && ts.isInJSFile(declaration) && ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.parent)
43214
+ && ts.isVariableDeclaration(declaration.parent.parent)
43215
+ && ((_b = declaration.parent.parent.parent) === null || _b === void 0 ? void 0 : _b.parent) && ts.isVariableStatement(declaration.parent.parent.parent.parent)
43216
+ && !ts.hasSyntacticModifier(declaration.parent.parent.parent.parent, 1)
43217
+ && declaration.parent.parent.parent.parent.parent
43218
+ && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
43219
+ return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
43346
43220
  }
43347
43221
  return false;
43348
43222
  }
@@ -43462,7 +43336,7 @@ var ts;
43462
43336
  }
43463
43337
  function toNodeBuilderFlags(flags) {
43464
43338
  if (flags === void 0) { flags = 0; }
43465
- return flags & 848330091;
43339
+ return flags & 814775659;
43466
43340
  }
43467
43341
  function isClassInstanceSide(type) {
43468
43342
  return !!type.symbol && !!(type.symbol.flags & 32) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288) && !!(ts.getObjectFlags(type) & 16777216)));
@@ -43563,12 +43437,6 @@ var ts;
43563
43437
  return context.truncating = context.approximateLength > ((context.flags & 1) ? ts.noTruncationMaximumTruncationLength : ts.defaultMaximumTruncationLength);
43564
43438
  }
43565
43439
  function typeToTypeNodeHelper(type, context) {
43566
- var savedFlags = context.flags;
43567
- var typeNode = typeToTypeNodeWorker(type, context);
43568
- context.flags = savedFlags;
43569
- return typeNode;
43570
- }
43571
- function typeToTypeNodeWorker(type, context) {
43572
43440
  if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
43573
43441
  cancellationToken.throwIfCancellationRequested();
43574
43442
  }
@@ -43808,7 +43676,7 @@ var ts;
43808
43676
  var name = typeParameterToName(newParam, context);
43809
43677
  var newTypeVariable = ts.factory.createTypeReferenceNode(name);
43810
43678
  context.approximateLength += 37;
43811
- var newMapper = prependTypeMapping(type.root.checkType, newParam, type.mapper);
43679
+ var newMapper = prependTypeMapping(type.root.checkType, newParam, type.combinedMapper || type.mapper);
43812
43680
  var saveInferTypeParameters_1 = context.inferTypeParameters;
43813
43681
  context.inferTypeParameters = type.root.inferTypeParameters;
43814
43682
  var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
@@ -43839,10 +43707,6 @@ var ts;
43839
43707
  }
43840
43708
  return typeToTypeNodeHelper(type, context);
43841
43709
  }
43842
- function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) {
43843
- return isMappedTypeWithKeyofConstraintDeclaration(type)
43844
- && !(getModifiersTypeFromMappedType(type).flags & 262144);
43845
- }
43846
43710
  function createMappedTypeNodeFromType(type) {
43847
43711
  ts.Debug.assert(!!(type.flags & 524288));
43848
43712
  var readonlyToken = type.declaration.readonlyToken ? ts.factory.createToken(type.declaration.readonlyToken.kind) : undefined;
@@ -43850,7 +43714,7 @@ var ts;
43850
43714
  var appropriateConstraintTypeNode;
43851
43715
  var newTypeVariable;
43852
43716
  if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
43853
- if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4) {
43717
+ if (!(getModifiersTypeFromMappedType(type).flags & 262144) && context.flags & 4) {
43854
43718
  var newParam = createTypeParameter(createSymbol(262144, "T"));
43855
43719
  var name = typeParameterToName(newParam, context);
43856
43720
  newTypeVariable = ts.factory.createTypeReferenceNode(name);
@@ -43866,9 +43730,8 @@ var ts;
43866
43730
  var mappedTypeNode = ts.factory.createMappedTypeNode(readonlyToken, typeParameterNode, nameTypeNode, questionToken, templateTypeNode, undefined);
43867
43731
  context.approximateLength += 10;
43868
43732
  var result = ts.setEmitFlags(mappedTypeNode, 1);
43869
- if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4) {
43870
- var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper);
43871
- return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143));
43733
+ if (isMappedTypeWithKeyofConstraintDeclaration(type) && !(getModifiersTypeFromMappedType(type).flags & 262144) && context.flags & 4) {
43734
+ return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(undefined, ts.factory.cloneNode(newTypeVariable.typeName))), result, ts.factory.createKeywordTypeNode(143));
43872
43735
  }
43873
43736
  return result;
43874
43737
  }
@@ -44386,7 +44249,7 @@ var ts;
44386
44249
  }
44387
44250
  var expandedParams = getExpandedParameters(signature, true)[0];
44388
44251
  var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
44389
- var thisParameter = context.flags & 33554432 ? undefined : tryGetThisParameterDeclaration(signature, context);
44252
+ var thisParameter = tryGetThisParameterDeclaration(signature, context);
44390
44253
  if (thisParameter) {
44391
44254
  parameters.unshift(thisParameter);
44392
44255
  }
@@ -45339,11 +45202,12 @@ var ts;
45339
45202
  if (skipMembershipCheck || (!!ts.length(symbol.declarations) && ts.some(symbol.declarations, function (d) { return !!ts.findAncestor(d, function (n) { return n === enclosingDeclaration; }); }))) {
45340
45203
  var oldContext = context;
45341
45204
  context = cloneNodeBuilderContext(context);
45342
- serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
45205
+ var result = serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
45343
45206
  if (context.reportedDiagnostic) {
45344
45207
  oldcontext.reportedDiagnostic = context.reportedDiagnostic;
45345
45208
  }
45346
45209
  context = oldContext;
45210
+ return result;
45347
45211
  }
45348
45212
  }
45349
45213
  function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias) {
@@ -47041,7 +46905,7 @@ var ts;
47041
46905
  if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
47042
46906
  reportImplicitAny(element, anyType);
47043
46907
  }
47044
- return anyType;
46908
+ return includePatternInType ? nonInferrableAnyType : anyType;
47045
46909
  }
47046
46910
  function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
47047
46911
  var members = ts.createSymbolTable();
@@ -47928,7 +47792,7 @@ var ts;
47928
47792
  error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
47929
47793
  }
47930
47794
  else {
47931
- error(ts.isNamedDeclaration(declaration) ? declaration.name || declaration : declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
47795
+ error(ts.isNamedDeclaration(declaration) ? declaration.name : declaration || declaration, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
47932
47796
  }
47933
47797
  }
47934
47798
  links.declaredType = type;
@@ -49052,9 +48916,6 @@ var ts;
49052
48916
  else if (type.objectFlags & 32) {
49053
48917
  resolveMappedTypeMembers(type);
49054
48918
  }
49055
- else {
49056
- ts.Debug.fail("Unhandled object type " + ts.Debug.formatObjectFlags(type.objectFlags));
49057
- }
49058
48919
  }
49059
48920
  else if (type.flags & 1048576) {
49060
48921
  resolveUnionTypeMembers(type);
@@ -49062,9 +48923,6 @@ var ts;
49062
48923
  else if (type.flags & 2097152) {
49063
48924
  resolveIntersectionTypeMembers(type);
49064
48925
  }
49065
- else {
49066
- ts.Debug.fail("Unhandled type " + ts.Debug.formatTypeFlags(type.flags));
49067
- }
49068
48926
  }
49069
48927
  return type;
49070
48928
  }
@@ -49239,7 +49097,7 @@ var ts;
49239
49097
  }
49240
49098
  }
49241
49099
  }
49242
- return getNormalizedType(getIntersectionType(constraints), false);
49100
+ return getIntersectionType(constraints);
49243
49101
  }
49244
49102
  return undefined;
49245
49103
  }
@@ -49734,15 +49592,12 @@ var ts;
49734
49592
  return getApplicableIndexInfo(type, isLateBoundName(name) ? esSymbolType : getStringLiteralType(ts.unescapeLeadingUnderscores(name)));
49735
49593
  }
49736
49594
  function getTypeParametersFromDeclaration(declaration) {
49737
- var _a;
49738
49595
  var result;
49739
- for (var _i = 0, _b = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _b.length; _i++) {
49740
- var node = _b[_i];
49596
+ for (var _i = 0, _a = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _a.length; _i++) {
49597
+ var node = _a[_i];
49741
49598
  result = ts.appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
49742
49599
  }
49743
- return (result === null || result === void 0 ? void 0 : result.length) ? result
49744
- : ts.isFunctionDeclaration(declaration) ? (_a = getSignatureOfTypeTag(declaration)) === null || _a === void 0 ? void 0 : _a.typeParameters
49745
- : undefined;
49600
+ return result;
49746
49601
  }
49747
49602
  function symbolsToArray(symbols) {
49748
49603
  var result = [];
@@ -50245,20 +50100,19 @@ var ts;
50245
50100
  var _a;
50246
50101
  var inferences;
50247
50102
  if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
50248
- var _loop_15 = function (declaration) {
50103
+ for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
50104
+ var declaration = _b[_i];
50249
50105
  if (declaration.parent.kind === 190) {
50250
50106
  var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
50251
50107
  if (grandParent.kind === 178 && !omitTypeReferences) {
50252
- var typeReference_1 = grandParent;
50253
- var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1);
50254
- if (typeParameters_1) {
50255
- var index = typeReference_1.typeArguments.indexOf(childTypeParameter);
50256
- if (index < typeParameters_1.length) {
50257
- var declaredConstraint = getConstraintOfTypeParameter(typeParameters_1[index]);
50108
+ var typeReference = grandParent;
50109
+ var typeParameters = getTypeParametersForTypeReference(typeReference);
50110
+ if (typeParameters) {
50111
+ var index = typeReference.typeArguments.indexOf(childTypeParameter);
50112
+ if (index < typeParameters.length) {
50113
+ var declaredConstraint = getConstraintOfTypeParameter(typeParameters[index]);
50258
50114
  if (declaredConstraint) {
50259
- var mapper = makeDeferredTypeMapper(typeParameters_1, typeParameters_1.map(function (_, index) { return function () {
50260
- return getEffectiveTypeArgumentAtIndex(typeReference_1, typeParameters_1, index);
50261
- }; }));
50115
+ var mapper = createTypeMapper(typeParameters, getEffectiveTypeArguments(typeReference, typeParameters));
50262
50116
  var constraint = instantiateType(declaredConstraint, mapper);
50263
50117
  if (constraint !== typeParameter) {
50264
50118
  inferences = ts.append(inferences, constraint);
@@ -50287,10 +50141,6 @@ var ts;
50287
50141
  inferences = ts.append(inferences, instantiateType(nodeType, makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfNode(checkMappedType_1.typeParameter)), checkMappedType_1.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType_1.typeParameter.constraint) : keyofConstraintType)));
50288
50142
  }
50289
50143
  }
50290
- };
50291
- for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
50292
- var declaration = _b[_i];
50293
- _loop_15(declaration);
50294
50144
  }
50295
50145
  }
50296
50146
  return inferences && getIntersectionType(inferences);
@@ -50352,7 +50202,7 @@ var ts;
50352
50202
  var result = 0;
50353
50203
  for (var _i = 0, types_8 = types; _i < types_8.length; _i++) {
50354
50204
  var type = types_8[_i];
50355
- if (excludeKinds === undefined || !(type.flags & excludeKinds)) {
50205
+ if (!(type.flags & excludeKinds)) {
50356
50206
  result |= ts.getObjectFlags(type);
50357
50207
  }
50358
50208
  }
@@ -50364,7 +50214,7 @@ var ts;
50364
50214
  if (!type) {
50365
50215
  type = createObjectType(4, target.symbol);
50366
50216
  target.instantiations.set(id, type);
50367
- type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0;
50217
+ type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0;
50368
50218
  type.target = target;
50369
50219
  type.resolvedTypeArguments = typeArguments;
50370
50220
  }
@@ -50887,6 +50737,10 @@ var ts;
50887
50737
  function getGlobalBigIntType() {
50888
50738
  return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", 0, false))) || emptyObjectType;
50889
50739
  }
50740
+ function getGlobalTemplateStringsArrayOfSymbol() {
50741
+ deferredGlobalTemplateStringsArrayOfSymbol || (deferredGlobalTemplateStringsArrayOfSymbol = getGlobalTypeAliasSymbol("TemplateStringsArrayOf", 2, true) || unknownSymbol);
50742
+ return deferredGlobalTemplateStringsArrayOfSymbol === unknownSymbol ? undefined : deferredGlobalTemplateStringsArrayOfSymbol;
50743
+ }
50890
50744
  function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) {
50891
50745
  return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType;
50892
50746
  }
@@ -51098,7 +50952,7 @@ var ts;
51098
50952
  var lastRequiredIndex = -1;
51099
50953
  var firstRestIndex = -1;
51100
50954
  var lastOptionalOrRestIndex = -1;
51101
- var _loop_16 = function (i) {
50955
+ var _loop_15 = function (i) {
51102
50956
  var type = elementTypes[i];
51103
50957
  var flags = target.elementFlags[i];
51104
50958
  if (flags & 8) {
@@ -51124,7 +50978,7 @@ var ts;
51124
50978
  }
51125
50979
  };
51126
50980
  for (var i = 0; i < elementTypes.length; i++) {
51127
- var state_4 = _loop_16(i);
50981
+ var state_4 = _loop_15(i);
51128
50982
  if (typeof state_4 === "object")
51129
50983
  return state_4.value;
51130
50984
  }
@@ -51301,7 +51155,7 @@ var ts;
51301
51155
  var templates = ts.filter(types, isPatternLiteralType);
51302
51156
  if (templates.length) {
51303
51157
  var i = types.length;
51304
- var _loop_17 = function () {
51158
+ var _loop_16 = function () {
51305
51159
  i--;
51306
51160
  var t = types[i];
51307
51161
  if (t.flags & 128 && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
@@ -51309,7 +51163,7 @@ var ts;
51309
51163
  }
51310
51164
  };
51311
51165
  while (i > 0) {
51312
- _loop_17();
51166
+ _loop_16();
51313
51167
  }
51314
51168
  }
51315
51169
  }
@@ -51379,14 +51233,14 @@ var ts;
51379
51233
  var namedUnions = [];
51380
51234
  addNamedUnions(namedUnions, types);
51381
51235
  var reducedTypes = [];
51382
- var _loop_18 = function (t) {
51236
+ var _loop_17 = function (t) {
51383
51237
  if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
51384
51238
  reducedTypes.push(t);
51385
51239
  }
51386
51240
  };
51387
51241
  for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
51388
51242
  var t = typeSet_1[_i];
51389
- _loop_18(t);
51243
+ _loop_17(t);
51390
51244
  }
51391
51245
  if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
51392
51246
  return namedUnions[0];
@@ -51836,22 +51690,19 @@ var ts;
51836
51690
  return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1, undefined, undefined, origin);
51837
51691
  }
51838
51692
  function isPossiblyReducibleByInstantiation(type) {
51839
- var uniqueFilled = getUniqueLiteralFilledInstantiation(type);
51840
- return getReducedType(uniqueFilled) !== uniqueFilled;
51841
- }
51842
- function shouldDeferIndexType(type) {
51843
- return !!(type.flags & 58982400 ||
51844
- isGenericTupleType(type) ||
51845
- isGenericMappedType(type) && !hasDistributiveNameType(type) ||
51846
- type.flags & 1048576 && ts.some(type.types, isPossiblyReducibleByInstantiation) ||
51847
- type.flags & 2097152 && maybeTypeOfKind(type, 465829888) && ts.some(type.types, isEmptyAnonymousObjectType));
51693
+ return ts.some(type.types, function (t) {
51694
+ var uniqueFilled = getUniqueLiteralFilledInstantiation(t);
51695
+ return getReducedType(uniqueFilled) !== uniqueFilled;
51696
+ });
51848
51697
  }
51849
51698
  function getIndexType(type, stringsOnly, noIndexSignatures) {
51850
51699
  if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
51851
51700
  type = getReducedType(type);
51852
- return shouldDeferIndexType(type) ? getIndexTypeForGenericType(type, stringsOnly) :
51853
- type.flags & 1048576 ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
51854
- type.flags & 2097152 ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
51701
+ return type.flags & 1048576 ? isPossiblyReducibleByInstantiation(type)
51702
+ ? getIndexTypeForGenericType(type, stringsOnly)
51703
+ : getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
51704
+ type.flags & 2097152 ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
51705
+ type.flags & 58982400 || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) ? getIndexTypeForGenericType(type, stringsOnly) :
51855
51706
  ts.getObjectFlags(type) & 32 ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) :
51856
51707
  type === wildcardType ? wildcardType :
51857
51708
  type.flags & 2 ? neverType :
@@ -52092,28 +51943,21 @@ var ts;
52092
51943
  getFlowTypeOfReference(accessExpression, propType) :
52093
51944
  propType;
52094
51945
  }
52095
- if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)) {
52096
- var index = +propName;
51946
+ if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName) && +propName >= 0) {
52097
51947
  if (accessNode && everyType(objectType, function (t) { return !t.target.hasRestElement; }) && !(accessFlags & 16)) {
52098
51948
  var indexNode = getIndexNodeForAccessExpression(accessNode);
52099
51949
  if (isTupleType(objectType)) {
52100
- if (index < 0) {
52101
- error(indexNode, ts.Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
52102
- return undefinedType;
52103
- }
52104
51950
  error(indexNode, ts.Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), ts.unescapeLeadingUnderscores(propName));
52105
51951
  }
52106
51952
  else {
52107
51953
  error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
52108
51954
  }
52109
51955
  }
52110
- if (index >= 0) {
52111
- errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, numberType));
52112
- return mapType(objectType, function (t) {
52113
- var restType = getRestTypeOfTupleType(t) || undefinedType;
52114
- return accessFlags & 1 ? getUnionType([restType, undefinedType]) : restType;
52115
- });
52116
- }
51956
+ errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, numberType));
51957
+ return mapType(objectType, function (t) {
51958
+ var restType = getRestTypeOfTupleType(t) || undefinedType;
51959
+ return accessFlags & 1 ? getUnionType([restType, undefinedType]) : restType;
51960
+ });
52117
51961
  }
52118
51962
  }
52119
51963
  if (!(indexType.flags & 98304) && isTypeAssignableToKind(indexType, 402653316 | 296 | 12288)) {
@@ -52472,7 +52316,7 @@ var ts;
52472
52316
  var result;
52473
52317
  var extraTypes;
52474
52318
  var tailCount = 0;
52475
- var _loop_19 = function () {
52319
+ var _loop_18 = function () {
52476
52320
  if (tailCount === 1000) {
52477
52321
  error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
52478
52322
  result = errorType;
@@ -52546,7 +52390,7 @@ var ts;
52546
52390
  return "break";
52547
52391
  };
52548
52392
  while (true) {
52549
- var state_5 = _loop_19();
52393
+ var state_5 = _loop_18();
52550
52394
  if (typeof state_5 === "object")
52551
52395
  return state_5.value;
52552
52396
  if (state_5 === "break")
@@ -53147,7 +52991,7 @@ var ts;
53147
52991
  switch (mapper.kind) {
53148
52992
  case 0:
53149
52993
  return type === mapper.source ? mapper.target : type;
53150
- case 1: {
52994
+ case 1:
53151
52995
  var sources = mapper.sources;
53152
52996
  var targets = mapper.targets;
53153
52997
  for (var i = 0; i < sources.length; i++) {
@@ -53156,58 +53000,43 @@ var ts;
53156
53000
  }
53157
53001
  }
53158
53002
  return type;
53159
- }
53160
- case 2: {
53161
- var sources = mapper.sources;
53162
- var targets = mapper.targets;
53163
- for (var i = 0; i < sources.length; i++) {
53164
- if (type === sources[i]) {
53165
- return targets[i]();
53166
- }
53167
- }
53168
- return type;
53169
- }
53170
- case 3:
53003
+ case 2:
53171
53004
  return mapper.func(type);
53005
+ case 3:
53172
53006
  case 4:
53173
- case 5:
53174
53007
  var t1 = getMappedType(type, mapper.mapper1);
53175
- return t1 !== type && mapper.kind === 4 ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
53008
+ return t1 !== type && mapper.kind === 3 ? instantiateType(t1, mapper.mapper2) : getMappedType(t1, mapper.mapper2);
53176
53009
  }
53177
53010
  }
53178
53011
  function makeUnaryTypeMapper(source, target) {
53179
- return ts.Debug.attachDebugPrototypeIfDebug({ kind: 0, source: source, target: target });
53012
+ return { kind: 0, source: source, target: target };
53180
53013
  }
53181
53014
  function makeArrayTypeMapper(sources, targets) {
53182
- return ts.Debug.attachDebugPrototypeIfDebug({ kind: 1, sources: sources, targets: targets });
53015
+ return { kind: 1, sources: sources, targets: targets };
53183
53016
  }
53184
- function makeFunctionTypeMapper(func, debugInfo) {
53185
- return ts.Debug.attachDebugPrototypeIfDebug({ kind: 3, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
53186
- }
53187
- function makeDeferredTypeMapper(sources, targets) {
53188
- return ts.Debug.attachDebugPrototypeIfDebug({ kind: 2, sources: sources, targets: targets });
53017
+ function makeFunctionTypeMapper(func) {
53018
+ return { kind: 2, func: func };
53189
53019
  }
53190
53020
  function makeCompositeTypeMapper(kind, mapper1, mapper2) {
53191
- return ts.Debug.attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
53021
+ return { kind: kind, mapper1: mapper1, mapper2: mapper2 };
53192
53022
  }
53193
53023
  function createTypeEraser(sources) {
53194
53024
  return createTypeMapper(sources, undefined);
53195
53025
  }
53196
53026
  function createBackreferenceMapper(context, index) {
53197
- var forwardInferences = context.inferences.slice(index);
53198
- return createTypeMapper(ts.map(forwardInferences, function (i) { return i.typeParameter; }), ts.map(forwardInferences, function () { return unknownType; }));
53027
+ return makeFunctionTypeMapper(function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? unknownType : t; });
53199
53028
  }
53200
53029
  function combineTypeMappers(mapper1, mapper2) {
53201
- return mapper1 ? makeCompositeTypeMapper(4, mapper1, mapper2) : mapper2;
53030
+ return mapper1 ? makeCompositeTypeMapper(3, mapper1, mapper2) : mapper2;
53202
53031
  }
53203
53032
  function mergeTypeMappers(mapper1, mapper2) {
53204
- return mapper1 ? makeCompositeTypeMapper(5, mapper1, mapper2) : mapper2;
53033
+ return mapper1 ? makeCompositeTypeMapper(4, mapper1, mapper2) : mapper2;
53205
53034
  }
53206
53035
  function prependTypeMapping(source, target, mapper) {
53207
- return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5, makeUnaryTypeMapper(source, target), mapper);
53036
+ return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(4, makeUnaryTypeMapper(source, target), mapper);
53208
53037
  }
53209
53038
  function appendTypeMapping(mapper, source, target) {
53210
- return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5, mapper, makeUnaryTypeMapper(source, target));
53039
+ return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(4, mapper, makeUnaryTypeMapper(source, target));
53211
53040
  }
53212
53041
  function getRestrictiveTypeParameter(tp) {
53213
53042
  return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol),
@@ -53431,7 +53260,6 @@ var ts;
53431
53260
  result.mapper = mapper;
53432
53261
  result.aliasSymbol = aliasSymbol || type.aliasSymbol;
53433
53262
  result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
53434
- result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
53435
53263
  return result;
53436
53264
  }
53437
53265
  function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
@@ -54019,7 +53847,7 @@ var ts;
54019
53847
  });
54020
53848
  }
54021
53849
  function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
54022
- if (target.flags & (131068 | 131072))
53850
+ if (target.flags & 131068)
54023
53851
  return false;
54024
53852
  if (isTupleLikeType(source)) {
54025
53853
  return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
@@ -54084,7 +53912,7 @@ var ts;
54084
53912
  });
54085
53913
  }
54086
53914
  function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
54087
- if (target.flags & (131068 | 131072))
53915
+ if (target.flags & 131068)
54088
53916
  return false;
54089
53917
  return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
54090
53918
  }
@@ -54888,7 +54716,7 @@ var ts;
54888
54716
  reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
54889
54717
  checkTypes = reducedTarget.flags & 1048576 ? reducedTarget.types : [reducedTarget];
54890
54718
  }
54891
- var _loop_20 = function (prop) {
54719
+ var _loop_19 = function (prop) {
54892
54720
  if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
54893
54721
  if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
54894
54722
  if (reportErrors) {
@@ -54941,7 +54769,7 @@ var ts;
54941
54769
  };
54942
54770
  for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
54943
54771
  var prop = _b[_i];
54944
- var state_6 = _loop_20(prop);
54772
+ var state_6 = _loop_19(prop);
54945
54773
  if (typeof state_6 === "object")
54946
54774
  return state_6.value;
54947
54775
  }
@@ -55129,10 +54957,10 @@ var ts;
55129
54957
  if (outofbandVarianceMarkerHandler) {
55130
54958
  var saved = entry & 24;
55131
54959
  if (saved & 8) {
55132
- instantiateType(source, reportUnmeasurableMapper);
54960
+ instantiateType(source, makeFunctionTypeMapper(reportUnmeasurableMarkers));
55133
54961
  }
55134
54962
  if (saved & 16) {
55135
- instantiateType(source, reportUnreliableMapper);
54963
+ instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
55136
54964
  }
55137
54965
  }
55138
54966
  return entry & 1 ? -1 : 0;
@@ -55224,20 +55052,13 @@ var ts;
55224
55052
  return result;
55225
55053
  }
55226
55054
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
55227
- var saveErrorInfo = captureErrorCalculationState();
55228
- var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
55229
- if (result) {
55230
- resetErrorInfo(saveErrorInfo);
55231
- }
55232
- return result;
55233
- }
55234
- function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) {
55235
55055
  if (intersectionState & 4) {
55236
55056
  return propertiesRelatedTo(source, target, reportErrors, undefined, 0);
55237
55057
  }
55238
55058
  var result;
55239
55059
  var originalErrorInfo;
55240
55060
  var varianceCheckFailed = false;
55061
+ var saveErrorInfo = captureErrorCalculationState();
55241
55062
  var sourceFlags = source.flags;
55242
55063
  var targetFlags = target.flags;
55243
55064
  if (relation === identityRelation) {
@@ -55286,6 +55107,7 @@ var ts;
55286
55107
  var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
55287
55108
  if (constraint && everyType(constraint, function (c) { return c !== source; })) {
55288
55109
  if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
55110
+ resetErrorInfo(saveErrorInfo);
55289
55111
  return result;
55290
55112
  }
55291
55113
  }
@@ -55378,6 +55200,7 @@ var ts;
55378
55200
  result &= isRelatedTo(source.indexType, target.indexType, 3, reportErrors);
55379
55201
  }
55380
55202
  if (result) {
55203
+ resetErrorInfo(saveErrorInfo);
55381
55204
  return result;
55382
55205
  }
55383
55206
  if (reportErrors) {
@@ -55453,6 +55276,7 @@ var ts;
55453
55276
  }
55454
55277
  else if (targetFlags & 16777216) {
55455
55278
  if (isDeeplyNestedType(target, targetStack, targetDepth, 10)) {
55279
+ resetErrorInfo(saveErrorInfo);
55456
55280
  return 3;
55457
55281
  }
55458
55282
  var c = target;
@@ -55462,6 +55286,7 @@ var ts;
55462
55286
  if (result = skipTrue ? -1 : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2, false)) {
55463
55287
  result &= skipFalse ? -1 : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2, false);
55464
55288
  if (result) {
55289
+ resetErrorInfo(saveErrorInfo);
55465
55290
  return result;
55466
55291
  }
55467
55292
  }
@@ -55472,7 +55297,7 @@ var ts;
55472
55297
  if (relation === comparableRelation) {
55473
55298
  return templateLiteralTypesDefinitelyUnrelated(source, target) ? 0 : -1;
55474
55299
  }
55475
- instantiateType(source, reportUnreliableMapper);
55300
+ instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
55476
55301
  }
55477
55302
  if (isTypeMatchedByTemplateLiteralType(source, target)) {
55478
55303
  return -1;
@@ -55489,15 +55314,18 @@ var ts;
55489
55314
  if (!(sourceFlags & 8388608 && targetFlags & 8388608)) {
55490
55315
  var constraint = getConstraintOfType(source) || unknownType;
55491
55316
  if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
55317
+ resetErrorInfo(saveErrorInfo);
55492
55318
  return result;
55493
55319
  }
55494
55320
  else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144), undefined, intersectionState)) {
55321
+ resetErrorInfo(saveErrorInfo);
55495
55322
  return result;
55496
55323
  }
55497
55324
  if (isMappedTypeGenericIndexedAccess(source)) {
55498
55325
  var indexConstraint = getConstraintOfType(source.indexType);
55499
55326
  if (indexConstraint) {
55500
55327
  if (result = isRelatedTo(getIndexedAccessType(source.objectType, indexConstraint), target, 1, reportErrors)) {
55328
+ resetErrorInfo(saveErrorInfo);
55501
55329
  return result;
55502
55330
  }
55503
55331
  }
@@ -55506,6 +55334,7 @@ var ts;
55506
55334
  }
55507
55335
  else if (sourceFlags & 4194304) {
55508
55336
  if (result = isRelatedTo(keyofConstraintType, target, 1, reportErrors)) {
55337
+ resetErrorInfo(saveErrorInfo);
55509
55338
  return result;
55510
55339
  }
55511
55340
  }
@@ -55513,6 +55342,7 @@ var ts;
55513
55342
  if (!(targetFlags & 134217728)) {
55514
55343
  var constraint = getBaseConstraintOfType(source);
55515
55344
  if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
55345
+ resetErrorInfo(saveErrorInfo);
55516
55346
  return result;
55517
55347
  }
55518
55348
  }
@@ -55523,18 +55353,21 @@ var ts;
55523
55353
  return 0;
55524
55354
  }
55525
55355
  if (result = isRelatedTo(source.type, target.type, 3, reportErrors)) {
55356
+ resetErrorInfo(saveErrorInfo);
55526
55357
  return result;
55527
55358
  }
55528
55359
  }
55529
55360
  else {
55530
55361
  var constraint = getBaseConstraintOfType(source);
55531
55362
  if (constraint && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
55363
+ resetErrorInfo(saveErrorInfo);
55532
55364
  return result;
55533
55365
  }
55534
55366
  }
55535
55367
  }
55536
55368
  else if (sourceFlags & 16777216) {
55537
55369
  if (isDeeplyNestedType(source, sourceStack, sourceDepth, 10)) {
55370
+ resetErrorInfo(saveErrorInfo);
55538
55371
  return 3;
55539
55372
  }
55540
55373
  if (targetFlags & 16777216) {
@@ -55553,6 +55386,7 @@ var ts;
55553
55386
  result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3, reportErrors);
55554
55387
  }
55555
55388
  if (result) {
55389
+ resetErrorInfo(saveErrorInfo);
55556
55390
  return result;
55557
55391
  }
55558
55392
  }
@@ -55561,6 +55395,7 @@ var ts;
55561
55395
  var distributiveConstraint = hasNonCircularBaseConstraint(source) ? getConstraintOfDistributiveConditionalType(source) : undefined;
55562
55396
  if (distributiveConstraint) {
55563
55397
  if (result = isRelatedTo(distributiveConstraint, target, 1, reportErrors)) {
55398
+ resetErrorInfo(saveErrorInfo);
55564
55399
  return result;
55565
55400
  }
55566
55401
  }
@@ -55568,6 +55403,7 @@ var ts;
55568
55403
  var defaultConstraint = getDefaultConstraintOfConditionalType(source);
55569
55404
  if (defaultConstraint) {
55570
55405
  if (result = isRelatedTo(defaultConstraint, target, 1, reportErrors)) {
55406
+ resetErrorInfo(saveErrorInfo);
55571
55407
  return result;
55572
55408
  }
55573
55409
  }
@@ -55579,6 +55415,7 @@ var ts;
55579
55415
  if (isGenericMappedType(target)) {
55580
55416
  if (isGenericMappedType(source)) {
55581
55417
  if (result = mappedTypeRelatedTo(source, target, reportErrors)) {
55418
+ resetErrorInfo(saveErrorInfo);
55582
55419
  return result;
55583
55420
  }
55584
55421
  }
@@ -55672,13 +55509,25 @@ var ts;
55672
55509
  }
55673
55510
  }
55674
55511
  }
55512
+ function reportUnmeasurableMarkers(p) {
55513
+ if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
55514
+ outofbandVarianceMarkerHandler(false);
55515
+ }
55516
+ return p;
55517
+ }
55518
+ function reportUnreliableMarkers(p) {
55519
+ if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
55520
+ outofbandVarianceMarkerHandler(true);
55521
+ }
55522
+ return p;
55523
+ }
55675
55524
  function mappedTypeRelatedTo(source, target, reportErrors) {
55676
55525
  var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
55677
55526
  getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
55678
55527
  if (modifiersRelated) {
55679
55528
  var result_10;
55680
55529
  var targetConstraint = getConstraintTypeFromMappedType(target);
55681
- var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
55530
+ var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), makeFunctionTypeMapper(getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers));
55682
55531
  if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3, reportErrors)) {
55683
55532
  var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
55684
55533
  if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
@@ -55714,11 +55563,11 @@ var ts;
55714
55563
  }
55715
55564
  var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
55716
55565
  var matchingTypes = [];
55717
- var _loop_21 = function (combination) {
55566
+ var _loop_20 = function (combination) {
55718
55567
  var hasMatch = false;
55719
55568
  outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
55720
55569
  var type = _d[_c];
55721
- var _loop_22 = function (i) {
55570
+ var _loop_21 = function (i) {
55722
55571
  var sourceProperty = sourcePropertiesFiltered[i];
55723
55572
  var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
55724
55573
  if (!targetProperty)
@@ -55731,7 +55580,7 @@ var ts;
55731
55580
  }
55732
55581
  };
55733
55582
  for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
55734
- var state_8 = _loop_22(i);
55583
+ var state_8 = _loop_21(i);
55735
55584
  switch (state_8) {
55736
55585
  case "continue-outer": continue outer;
55737
55586
  }
@@ -55745,7 +55594,7 @@ var ts;
55745
55594
  };
55746
55595
  for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
55747
55596
  var combination = discriminantCombinations_1[_a];
55748
- var state_7 = _loop_21(combination);
55597
+ var state_7 = _loop_20(combination);
55749
55598
  if (typeof state_7 === "object")
55750
55599
  return state_7.value;
55751
55600
  }
@@ -56151,7 +56000,7 @@ var ts;
56151
56000
  return function (source, target) { return reportIncompatibleError(ts.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source), typeToString(target)); };
56152
56001
  }
56153
56002
  function signatureRelatedTo(source, target, erase, reportErrors, incompatibleReporter) {
56154
- return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker, reportUnreliableMapper);
56003
+ return compareSignaturesRelated(erase ? getErasedSignature(source) : source, erase ? getErasedSignature(target) : target, relation === strictSubtypeRelation ? 8 : 0, reportErrors, reportError, incompatibleReporter, isRelatedToWorker, makeFunctionTypeMapper(reportUnreliableMarkers));
56155
56004
  }
56156
56005
  function signaturesIdenticalTo(source, target, kind) {
56157
56006
  var sourceSignatures = getSignaturesOfType(source, kind);
@@ -56389,7 +56238,7 @@ var ts;
56389
56238
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
56390
56239
  links.variances = ts.emptyArray;
56391
56240
  var variances = [];
56392
- var _loop_23 = function (tp) {
56241
+ var _loop_22 = function (tp) {
56393
56242
  var modifiers = getVarianceModifiers(tp);
56394
56243
  var variance = modifiers & 65536 ?
56395
56244
  modifiers & 32768 ? 0 : 1 :
@@ -56418,12 +56267,12 @@ var ts;
56418
56267
  }
56419
56268
  variances.push(variance);
56420
56269
  };
56421
- for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
56422
- var tp = typeParameters_2[_i];
56423
- _loop_23(tp);
56270
+ for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
56271
+ var tp = typeParameters_1[_i];
56272
+ _loop_22(tp);
56424
56273
  }
56425
56274
  links.variances = variances;
56426
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
56275
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
56427
56276
  }
56428
56277
  return links.variances;
56429
56278
  }
@@ -56699,28 +56548,34 @@ var ts;
56699
56548
  var commonBaseType;
56700
56549
  for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
56701
56550
  var t = types_13[_i];
56702
- if (!(t.flags & 131072)) {
56703
- var baseType = getBaseTypeOfLiteralType(t);
56704
- commonBaseType !== null && commonBaseType !== void 0 ? commonBaseType : (commonBaseType = baseType);
56705
- if (baseType === t || baseType !== commonBaseType) {
56706
- return false;
56707
- }
56551
+ var baseType = getBaseTypeOfLiteralType(t);
56552
+ if (!commonBaseType) {
56553
+ commonBaseType = baseType;
56554
+ }
56555
+ if (baseType === t || baseType !== commonBaseType) {
56556
+ return false;
56708
56557
  }
56709
56558
  }
56710
56559
  return true;
56711
56560
  }
56712
- function getCombinedTypeFlags(types) {
56713
- return ts.reduceLeft(types, function (flags, t) { return flags | (t.flags & 1048576 ? getCombinedTypeFlags(t.types) : t.flags); }, 0);
56714
- }
56715
- function getCommonSupertype(types) {
56561
+ function getSupertypeOrUnion(types) {
56716
56562
  if (types.length === 1) {
56717
56563
  return types[0];
56718
56564
  }
56719
- var primaryTypes = strictNullChecks ? ts.sameMap(types, function (t) { return filterType(t, function (u) { return !(u.flags & 98304); }); }) : types;
56720
- var superTypeOrUnion = literalTypesWithSameBaseType(primaryTypes) ?
56721
- getUnionType(primaryTypes) :
56722
- ts.reduceLeft(primaryTypes, function (s, t) { return isTypeSubtypeOf(s, t) ? t : s; });
56723
- return primaryTypes === types ? superTypeOrUnion : getNullableType(superTypeOrUnion, getCombinedTypeFlags(types) & 98304);
56565
+ return literalTypesWithSameBaseType(types) ?
56566
+ getUnionType(types) :
56567
+ ts.reduceLeft(types, function (s, t) { return isTypeSubtypeOf(s, t) ? t : s; });
56568
+ }
56569
+ function getCommonSupertype(types) {
56570
+ if (!strictNullChecks) {
56571
+ return getSupertypeOrUnion(types);
56572
+ }
56573
+ var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 98304); });
56574
+ if (primaryTypes.length) {
56575
+ var supertypeOrUnion = getSupertypeOrUnion(primaryTypes);
56576
+ return primaryTypes === types ? supertypeOrUnion : getUnionType(__spreadArray([supertypeOrUnion], ts.filter(types, function (t) { return !!(t.flags & 98304); }), true));
56577
+ }
56578
+ return getUnionType(types, 2);
56724
56579
  }
56725
56580
  function getCommonSubtype(types) {
56726
56581
  return ts.reduceLeft(types, function (s, t) { return isTypeSubtypeOf(t, s) ? t : s; });
@@ -56743,6 +56598,42 @@ var ts;
56743
56598
  function isArrayLikeType(type) {
56744
56599
  return isArrayType(type) || !(type.flags & 98304) && isTypeAssignableTo(type, anyReadonlyArrayType);
56745
56600
  }
56601
+ function tryGetNonShadowedArrayOrTupleType(type) {
56602
+ if (isArrayOrTupleType(type)) {
56603
+ return type;
56604
+ }
56605
+ if (!(type.flags & 2097152)) {
56606
+ return undefined;
56607
+ }
56608
+ var arrayOrTupleConstituent;
56609
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
56610
+ var constituent = _a[_i];
56611
+ if (isArrayOrTupleType(constituent)) {
56612
+ if (arrayOrTupleConstituent) {
56613
+ return undefined;
56614
+ }
56615
+ arrayOrTupleConstituent = constituent;
56616
+ }
56617
+ }
56618
+ if (arrayOrTupleConstituent) {
56619
+ for (var _b = 0, _c = type.types; _b < _c.length; _b++) {
56620
+ var constituent = _c[_b];
56621
+ if (constituent !== arrayOrTupleConstituent) {
56622
+ var properties = getPropertiesOfType(constituent);
56623
+ for (var _d = 0, properties_2 = properties; _d < properties_2.length; _d++) {
56624
+ var property = properties_2[_d];
56625
+ if (ts.isNumericLiteralName(property.escapedName) || property.escapedName === "length") {
56626
+ return undefined;
56627
+ }
56628
+ }
56629
+ if (ts.some(getIndexInfosOfType(constituent))) {
56630
+ return undefined;
56631
+ }
56632
+ }
56633
+ }
56634
+ }
56635
+ return arrayOrTupleConstituent;
56636
+ }
56746
56637
  function getSingleBaseForNonAugmentingSubtype(type) {
56747
56638
  if (!(ts.getObjectFlags(type) & 4) || !(ts.getObjectFlags(type.target) & 3)) {
56748
56639
  return undefined;
@@ -56819,14 +56710,9 @@ var ts;
56819
56710
  type.flags & 256 ? numberType :
56820
56711
  type.flags & 2048 ? bigintType :
56821
56712
  type.flags & 512 ? booleanType :
56822
- type.flags & 1048576 ? getBaseTypeOfLiteralTypeUnion(type) :
56713
+ type.flags & 1048576 ? mapType(type, getBaseTypeOfLiteralType) :
56823
56714
  type;
56824
56715
  }
56825
- function getBaseTypeOfLiteralTypeUnion(type) {
56826
- var _a;
56827
- var key = "B" + getTypeId(type);
56828
- return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
56829
- }
56830
56716
  function getWidenedLiteralType(type) {
56831
56717
  return type.flags & 1024 && isFreshLiteralType(type) ? getBaseTypeOfEnumLiteralType(type) :
56832
56718
  type.flags & 128 && isFreshLiteralType(type) ? stringType :
@@ -57287,27 +57173,25 @@ var ts;
57287
57173
  signature: signature,
57288
57174
  flags: flags,
57289
57175
  compareTypes: compareTypes,
57290
- mapper: reportUnmeasurableMapper,
57291
- nonFixingMapper: reportUnmeasurableMapper,
57176
+ mapper: makeFunctionTypeMapper(function (t) { return mapToInferredType(context, t, true); }),
57177
+ nonFixingMapper: makeFunctionTypeMapper(function (t) { return mapToInferredType(context, t, false); }),
57292
57178
  };
57293
- context.mapper = makeFixingMapperForContext(context);
57294
- context.nonFixingMapper = makeNonFixingMapperForContext(context);
57295
57179
  return context;
57296
57180
  }
57297
- function makeFixingMapperForContext(context) {
57298
- return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (inference, i) { return function () {
57299
- if (!inference.isFixed) {
57300
- inferFromIntraExpressionSites(context);
57301
- clearCachedInferences(context.inferences);
57302
- inference.isFixed = true;
57181
+ function mapToInferredType(context, t, fix) {
57182
+ var inferences = context.inferences;
57183
+ for (var i = 0; i < inferences.length; i++) {
57184
+ var inference = inferences[i];
57185
+ if (t === inference.typeParameter) {
57186
+ if (fix && !inference.isFixed) {
57187
+ inferFromIntraExpressionSites(context);
57188
+ clearCachedInferences(inferences);
57189
+ inference.isFixed = true;
57190
+ }
57191
+ return getInferredType(context, i);
57303
57192
  }
57304
- return getInferredType(context, i);
57305
- }; }));
57306
- }
57307
- function makeNonFixingMapperForContext(context) {
57308
- return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (_, i) { return function () {
57309
- return getInferredType(context, i);
57310
- }; }));
57193
+ }
57194
+ return t;
57311
57195
  }
57312
57196
  function clearCachedInferences(inferences) {
57313
57197
  for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) {
@@ -57467,16 +57351,16 @@ var ts;
57467
57351
  return getTypeFromInference(inference) || unknownType;
57468
57352
  }
57469
57353
  function getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
57470
- var properties, _i, properties_2, targetProp, sourceProp, targetType, sourceType;
57354
+ var properties, _i, properties_3, targetProp, sourceProp, targetType, sourceType;
57471
57355
  return __generator(this, function (_a) {
57472
57356
  switch (_a.label) {
57473
57357
  case 0:
57474
57358
  properties = getPropertiesOfType(target);
57475
- _i = 0, properties_2 = properties;
57359
+ _i = 0, properties_3 = properties;
57476
57360
  _a.label = 1;
57477
57361
  case 1:
57478
- if (!(_i < properties_2.length)) return [3, 6];
57479
- targetProp = properties_2[_i];
57362
+ if (!(_i < properties_3.length)) return [3, 6];
57363
+ targetProp = properties_3[_i];
57480
57364
  if (isStaticPrivateIdentifierProperty(targetProp)) {
57481
57365
  return [3, 5];
57482
57366
  }
@@ -57694,10 +57578,8 @@ var ts;
57694
57578
  propagationType = savePropagationType;
57695
57579
  return;
57696
57580
  }
57697
- if (source.aliasSymbol && source.aliasSymbol === target.aliasSymbol) {
57698
- if (source.aliasTypeArguments) {
57699
- inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
57700
- }
57581
+ if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) {
57582
+ inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
57701
57583
  return;
57702
57584
  }
57703
57585
  if (source === target && source.flags & 3145728) {
@@ -57734,7 +57616,7 @@ var ts;
57734
57616
  target = getActualTypeVariable(target);
57735
57617
  }
57736
57618
  if (target.flags & 8650752) {
57737
- if (isFromInferenceBlockedSource(source)) {
57619
+ if (source === nonInferrableAnyType || source === silentNeverType || (priority & 128 && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
57738
57620
  return;
57739
57621
  }
57740
57622
  var inference = getInferenceInfoForType(target);
@@ -57789,11 +57671,15 @@ var ts;
57789
57671
  inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
57790
57672
  }
57791
57673
  else if (source.flags & 4194304 && target.flags & 4194304) {
57792
- inferFromContravariantTypes(source.type, target.type);
57674
+ contravariant = !contravariant;
57675
+ inferFromTypes(source.type, target.type);
57676
+ contravariant = !contravariant;
57793
57677
  }
57794
57678
  else if ((isLiteralType(source) || source.flags & 4) && target.flags & 4194304) {
57795
57679
  var empty = createEmptyObjectTypeFromStringLiteral(source);
57796
- inferFromContravariantTypesWithPriority(empty, target.type, 256);
57680
+ contravariant = !contravariant;
57681
+ inferWithPriority(empty, target.type, 256);
57682
+ contravariant = !contravariant;
57797
57683
  }
57798
57684
  else if (source.flags & 8388608 && target.flags & 8388608) {
57799
57685
  inferFromTypes(source.objectType, target.objectType);
@@ -57806,7 +57692,10 @@ var ts;
57806
57692
  }
57807
57693
  else if (source.flags & 33554432) {
57808
57694
  inferFromTypes(source.baseType, target);
57809
- inferWithPriority(source.substitute, target, 4);
57695
+ var oldPriority = priority;
57696
+ priority |= 4;
57697
+ inferFromTypes(source.substitute, target);
57698
+ priority = oldPriority;
57810
57699
  }
57811
57700
  else if (target.flags & 16777216) {
57812
57701
  invokeOnce(source, target, inferToConditionalType);
@@ -57845,18 +57734,6 @@ var ts;
57845
57734
  inferFromTypes(source, target);
57846
57735
  priority = savePriority;
57847
57736
  }
57848
- function inferFromContravariantTypesWithPriority(source, target, newPriority) {
57849
- var savePriority = priority;
57850
- priority |= newPriority;
57851
- inferFromContravariantTypes(source, target);
57852
- priority = savePriority;
57853
- }
57854
- function inferToMultipleTypesWithPriority(source, targets, targetFlags, newPriority) {
57855
- var savePriority = priority;
57856
- priority |= newPriority;
57857
- inferToMultipleTypes(source, targets, targetFlags);
57858
- priority = savePriority;
57859
- }
57860
57737
  function invokeOnce(source, target, action) {
57861
57738
  var key = source.id + "," + target.id;
57862
57739
  var status = visited && visited.get(key);
@@ -57919,13 +57796,10 @@ var ts;
57919
57796
  }
57920
57797
  }
57921
57798
  function inferFromContravariantTypes(source, target) {
57922
- contravariant = !contravariant;
57923
- inferFromTypes(source, target);
57924
- contravariant = !contravariant;
57925
- }
57926
- function inferFromContravariantTypesIfStrictFunctionTypes(source, target) {
57927
57799
  if (strictFunctionTypes || priority & 1024) {
57928
- inferFromContravariantTypes(source, target);
57800
+ contravariant = !contravariant;
57801
+ inferFromTypes(source, target);
57802
+ contravariant = !contravariant;
57929
57803
  }
57930
57804
  else {
57931
57805
  inferFromTypes(source, target);
@@ -58056,15 +57930,18 @@ var ts;
58056
57930
  inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
58057
57931
  }
58058
57932
  else {
57933
+ var savePriority = priority;
57934
+ priority |= contravariant ? 64 : 0;
58059
57935
  var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
58060
- inferToMultipleTypesWithPriority(source, targetTypes, target.flags, contravariant ? 64 : 0);
57936
+ inferToMultipleTypes(source, targetTypes, target.flags);
57937
+ priority = savePriority;
58061
57938
  }
58062
57939
  }
58063
57940
  function inferToTemplateLiteralType(source, target) {
58064
57941
  var matches = inferTypesFromTemplateLiteralType(source, target);
58065
57942
  var types = target.types;
58066
57943
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
58067
- var _loop_24 = function (i) {
57944
+ var _loop_23 = function (i) {
58068
57945
  var source_1 = matches ? matches[i] : neverType;
58069
57946
  var target_3 = types[i];
58070
57947
  if (source_1.flags & 128 && target_3.flags & 8650752) {
@@ -58108,7 +57985,7 @@ var ts;
58108
57985
  inferFromTypes(source_1, target_3);
58109
57986
  };
58110
57987
  for (var i = 0; i < types.length; i++) {
58111
- _loop_24(i);
57988
+ _loop_23(i);
58112
57989
  }
58113
57990
  }
58114
57991
  }
@@ -58132,57 +58009,58 @@ var ts;
58132
58009
  }
58133
58010
  }
58134
58011
  if (!typesDefinitelyUnrelated(source, target)) {
58135
- if (isArrayOrTupleType(source)) {
58012
+ var sourceArrayOrTuple = tryGetNonShadowedArrayOrTupleType(source);
58013
+ if (sourceArrayOrTuple) {
58136
58014
  if (isTupleType(target)) {
58137
- var sourceArity = getTypeReferenceArity(source);
58015
+ var sourceArity = getTypeReferenceArity(sourceArrayOrTuple);
58138
58016
  var targetArity = getTypeReferenceArity(target);
58139
58017
  var elementTypes = getTypeArguments(target);
58140
58018
  var elementFlags = target.target.elementFlags;
58141
- if (isTupleType(source) && isTupleTypeStructureMatching(source, target)) {
58019
+ if (isTupleType(sourceArrayOrTuple) && isTupleTypeStructureMatching(sourceArrayOrTuple, target)) {
58142
58020
  for (var i = 0; i < targetArity; i++) {
58143
- inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
58021
+ inferFromTypes(getTypeArguments(sourceArrayOrTuple)[i], elementTypes[i]);
58144
58022
  }
58145
58023
  return;
58146
58024
  }
58147
- var startLength = isTupleType(source) ? Math.min(source.target.fixedLength, target.target.fixedLength) : 0;
58148
- var endLength = Math.min(isTupleType(source) ? getEndElementCount(source.target, 3) : 0, target.target.hasRestElement ? getEndElementCount(target.target, 3) : 0);
58025
+ var startLength = isTupleType(sourceArrayOrTuple) ? Math.min(sourceArrayOrTuple.target.fixedLength, target.target.fixedLength) : 0;
58026
+ var endLength = Math.min(isTupleType(sourceArrayOrTuple) ? getEndElementCount(sourceArrayOrTuple.target, 3) : 0, target.target.hasRestElement ? getEndElementCount(target.target, 3) : 0);
58149
58027
  for (var i = 0; i < startLength; i++) {
58150
- inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
58028
+ inferFromTypes(getTypeArguments(sourceArrayOrTuple)[i], elementTypes[i]);
58151
58029
  }
58152
- if (!isTupleType(source) || sourceArity - startLength - endLength === 1 && source.target.elementFlags[startLength] & 4) {
58153
- var restType = getTypeArguments(source)[startLength];
58030
+ if (!isTupleType(sourceArrayOrTuple) || sourceArity - startLength - endLength === 1 && sourceArrayOrTuple.target.elementFlags[startLength] & 4) {
58031
+ var restType = getTypeArguments(sourceArrayOrTuple)[startLength];
58154
58032
  for (var i = startLength; i < targetArity - endLength; i++) {
58155
58033
  inferFromTypes(elementFlags[i] & 8 ? createArrayType(restType) : restType, elementTypes[i]);
58156
58034
  }
58157
58035
  }
58158
58036
  else {
58159
58037
  var middleLength = targetArity - startLength - endLength;
58160
- if (middleLength === 2 && elementFlags[startLength] & elementFlags[startLength + 1] & 8 && isTupleType(source)) {
58038
+ if (middleLength === 2 && elementFlags[startLength] & elementFlags[startLength + 1] & 8 && isTupleType(sourceArrayOrTuple)) {
58161
58039
  var targetInfo = getInferenceInfoForType(elementTypes[startLength]);
58162
58040
  if (targetInfo && targetInfo.impliedArity !== undefined) {
58163
- inferFromTypes(sliceTupleType(source, startLength, endLength + sourceArity - targetInfo.impliedArity), elementTypes[startLength]);
58164
- inferFromTypes(sliceTupleType(source, startLength + targetInfo.impliedArity, endLength), elementTypes[startLength + 1]);
58041
+ inferFromTypes(sliceTupleType(sourceArrayOrTuple, startLength, endLength + sourceArity - targetInfo.impliedArity), elementTypes[startLength]);
58042
+ inferFromTypes(sliceTupleType(sourceArrayOrTuple, startLength + targetInfo.impliedArity, endLength), elementTypes[startLength + 1]);
58165
58043
  }
58166
58044
  }
58167
58045
  else if (middleLength === 1 && elementFlags[startLength] & 8) {
58168
58046
  var endsInOptional = target.target.elementFlags[targetArity - 1] & 2;
58169
- var sourceSlice = isTupleType(source) ? sliceTupleType(source, startLength, endLength) : createArrayType(getTypeArguments(source)[0]);
58047
+ var sourceSlice = isTupleType(sourceArrayOrTuple) ? sliceTupleType(sourceArrayOrTuple, startLength, endLength) : createArrayType(getTypeArguments(sourceArrayOrTuple)[0]);
58170
58048
  inferWithPriority(sourceSlice, elementTypes[startLength], endsInOptional ? 2 : 0);
58171
58049
  }
58172
58050
  else if (middleLength === 1 && elementFlags[startLength] & 4) {
58173
- var restType = isTupleType(source) ? getElementTypeOfSliceOfTupleType(source, startLength, endLength) : getTypeArguments(source)[0];
58051
+ var restType = isTupleType(sourceArrayOrTuple) ? getElementTypeOfSliceOfTupleType(sourceArrayOrTuple, startLength, endLength) : getTypeArguments(sourceArrayOrTuple)[0];
58174
58052
  if (restType) {
58175
58053
  inferFromTypes(restType, elementTypes[startLength]);
58176
58054
  }
58177
58055
  }
58178
58056
  }
58179
58057
  for (var i = 0; i < endLength; i++) {
58180
- inferFromTypes(getTypeArguments(source)[sourceArity - i - 1], elementTypes[targetArity - i - 1]);
58058
+ inferFromTypes(getTypeArguments(sourceArrayOrTuple)[sourceArity - i - 1], elementTypes[targetArity - i - 1]);
58181
58059
  }
58182
58060
  return;
58183
58061
  }
58184
58062
  if (isArrayType(target)) {
58185
- inferFromIndexTypes(source, target);
58063
+ inferFromIndexTypes(sourceArrayOrTuple, target);
58186
58064
  return;
58187
58065
  }
58188
58066
  }
@@ -58194,8 +58072,8 @@ var ts;
58194
58072
  }
58195
58073
  function inferFromProperties(source, target) {
58196
58074
  var properties = getPropertiesOfObjectType(target);
58197
- for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {
58198
- var targetProp = properties_3[_i];
58075
+ for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
58076
+ var targetProp = properties_4[_i];
58199
58077
  var sourceProp = getPropertyOfType(source, targetProp.escapedName);
58200
58078
  if (sourceProp && !ts.some(sourceProp.declarations, hasSkipDirectInferenceFlag)) {
58201
58079
  inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
@@ -58208,16 +58086,19 @@ var ts;
58208
58086
  var sourceLen = sourceSignatures.length;
58209
58087
  var targetLen = targetSignatures.length;
58210
58088
  var len = sourceLen < targetLen ? sourceLen : targetLen;
58089
+ var skipParameters = !!(ts.getObjectFlags(source) & 262144);
58211
58090
  for (var i = 0; i < len; i++) {
58212
- inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]));
58091
+ inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]), skipParameters);
58213
58092
  }
58214
58093
  }
58215
- function inferFromSignature(source, target) {
58216
- var saveBivariant = bivariant;
58217
- var kind = target.declaration ? target.declaration.kind : 0;
58218
- bivariant = bivariant || kind === 169 || kind === 168 || kind === 171;
58219
- applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes);
58220
- bivariant = saveBivariant;
58094
+ function inferFromSignature(source, target, skipParameters) {
58095
+ if (!skipParameters) {
58096
+ var saveBivariant = bivariant;
58097
+ var kind = target.declaration ? target.declaration.kind : 0;
58098
+ bivariant = bivariant || kind === 169 || kind === 168 || kind === 171;
58099
+ applyToParameterTypes(source, target, inferFromContravariantTypes);
58100
+ bivariant = saveBivariant;
58101
+ }
58221
58102
  applyToReturnTypes(source, target, inferFromTypes);
58222
58103
  }
58223
58104
  function inferFromIndexTypes(source, target) {
@@ -58435,14 +58316,6 @@ var ts;
58435
58316
  var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
58436
58317
  return key && key + "." + propName;
58437
58318
  }
58438
- break;
58439
- case 201:
58440
- case 202:
58441
- case 256:
58442
- case 213:
58443
- case 214:
58444
- case 169:
58445
- return getNodeId(node) + "#" + getTypeId(declaredType);
58446
58319
  }
58447
58320
  return undefined;
58448
58321
  }
@@ -58583,7 +58456,7 @@ var ts;
58583
58456
  function mapTypesByKeyProperty(types, name) {
58584
58457
  var map = new ts.Map();
58585
58458
  var count = 0;
58586
- var _loop_25 = function (type) {
58459
+ var _loop_24 = function (type) {
58587
58460
  if (type.flags & (524288 | 2097152 | 58982400)) {
58588
58461
  var discriminant = getTypeOfPropertyOfType(type, name);
58589
58462
  if (discriminant) {
@@ -58609,7 +58482,7 @@ var ts;
58609
58482
  };
58610
58483
  for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
58611
58484
  var type = types_15[_i];
58612
- var state_9 = _loop_25(type);
58485
+ var state_9 = _loop_24(type);
58613
58486
  if (typeof state_9 === "object")
58614
58487
  return state_9.value;
58615
58488
  }
@@ -58688,20 +58561,19 @@ var ts;
58688
58561
  return false;
58689
58562
  }
58690
58563
  function getAssignmentReducedType(declaredType, assignedType) {
58691
- var _a;
58692
- if (declaredType === assignedType) {
58693
- return declaredType;
58694
- }
58695
- if (assignedType.flags & 131072) {
58696
- return assignedType;
58564
+ if (declaredType !== assignedType) {
58565
+ if (assignedType.flags & 131072) {
58566
+ return assignedType;
58567
+ }
58568
+ var reducedType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t); });
58569
+ if (assignedType.flags & 512 && isFreshLiteralType(assignedType)) {
58570
+ reducedType = mapType(reducedType, getFreshTypeOfLiteralType);
58571
+ }
58572
+ if (isTypeAssignableTo(assignedType, reducedType)) {
58573
+ return reducedType;
58574
+ }
58697
58575
  }
58698
- var key = "A" + getTypeId(declaredType) + "," + getTypeId(assignedType);
58699
- return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, getAssignmentReducedTypeWorker(declaredType, assignedType));
58700
- }
58701
- function getAssignmentReducedTypeWorker(declaredType, assignedType) {
58702
- var filteredType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t); });
58703
- var reducedType = assignedType.flags & 512 && isFreshLiteralType(assignedType) ? mapType(filteredType, getFreshTypeOfLiteralType) : filteredType;
58704
- return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType;
58576
+ return declaredType;
58705
58577
  }
58706
58578
  function isFunctionObjectType(type) {
58707
58579
  var resolved = resolveStructuredTypeMembers(type);
@@ -59543,7 +59415,7 @@ var ts;
59543
59415
  return declaredType;
59544
59416
  }
59545
59417
  if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 && isMatchingReference(reference, node.parent.parent.expression)) {
59546
- return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))));
59418
+ return getNonNullableTypeIfNeeded(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)));
59547
59419
  }
59548
59420
  return undefined;
59549
59421
  }
@@ -59970,7 +59842,7 @@ var ts;
59970
59842
  var targetType = ts.hasStaticModifier(ts.Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration"))
59971
59843
  ? getTypeOfSymbol(classSymbol)
59972
59844
  : getDeclaredTypeOfSymbol(classSymbol);
59973
- return getNarrowedType(type, targetType, assumeTrue, true);
59845
+ return getNarrowedType(type, targetType, assumeTrue, isTypeDerivedFrom);
59974
59846
  }
59975
59847
  function narrowTypeByOptionalChainContainment(type, operator, value, assumeTrue) {
59976
59848
  var equalsOperator = operator === 34 || operator === 36;
@@ -60179,37 +60051,22 @@ var ts;
60179
60051
  if (!nonConstructorTypeInUnion)
60180
60052
  return type;
60181
60053
  }
60182
- return getNarrowedType(type, targetType, assumeTrue, true);
60054
+ return getNarrowedType(type, targetType, assumeTrue, isTypeDerivedFrom);
60183
60055
  }
60184
- function getNarrowedType(type, candidate, assumeTrue, checkDerived) {
60185
- var _a;
60186
- var key = type.flags & 1048576 ? "N" + getTypeId(type) + "," + getTypeId(candidate) + "," + ((assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)) : undefined;
60187
- return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
60188
- }
60189
- function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
60190
- var isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
60056
+ function getNarrowedType(type, candidate, assumeTrue, isRelated) {
60191
60057
  if (!assumeTrue) {
60192
60058
  return filterType(type, function (t) { return !isRelated(t, candidate); });
60193
60059
  }
60194
- if (type.flags & 3) {
60195
- return candidate;
60060
+ if (type.flags & 1048576) {
60061
+ var assignableType = filterType(type, function (t) { return isRelated(t, candidate); });
60062
+ if (!(assignableType.flags & 131072)) {
60063
+ return assignableType;
60064
+ }
60196
60065
  }
60197
- var keyPropertyName = type.flags & 1048576 ? getKeyPropertyName(type) : undefined;
60198
- var narrowedType = mapType(candidate, function (c) {
60199
- var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
60200
- var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
60201
- var directlyRelated = mapType(matching || type, checkDerived ?
60202
- function (t) { return isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType; } :
60203
- function (t) { return isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType; });
60204
- return directlyRelated.flags & 131072 ?
60205
- mapType(type, function (t) { return maybeTypeOfKind(t, 465829888) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
60206
- directlyRelated;
60207
- });
60208
- return !(narrowedType.flags & 131072) ? narrowedType :
60209
- isTypeSubtypeOf(candidate, type) ? candidate :
60210
- isTypeAssignableTo(type, candidate) ? type :
60211
- isTypeAssignableTo(candidate, type) ? candidate :
60212
- getIntersectionType([type, candidate]);
60066
+ return isTypeSubtypeOf(candidate, type) ? candidate :
60067
+ isTypeAssignableTo(type, candidate) ? type :
60068
+ isTypeAssignableTo(candidate, type) ? candidate :
60069
+ getIntersectionType([type, candidate]);
60213
60070
  }
60214
60071
  function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
60215
60072
  if (hasMatchingArgument(callExpression, reference)) {
@@ -60236,7 +60093,7 @@ var ts;
60236
60093
  var predicateArgument = getTypePredicateArgument(predicate, callExpression);
60237
60094
  if (predicateArgument) {
60238
60095
  if (isMatchingReference(reference, predicateArgument)) {
60239
- return getNarrowedType(type, predicate.type, assumeTrue, false);
60096
+ return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
60240
60097
  }
60241
60098
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
60242
60099
  !(getTypeFacts(predicate.type) & 65536)) {
@@ -60244,7 +60101,7 @@ var ts;
60244
60101
  }
60245
60102
  var access = getDiscriminantPropertyAccess(predicateArgument, type);
60246
60103
  if (access) {
60247
- return narrowTypeByDiscriminant(type, access, function (t) { return getNarrowedType(t, predicate.type, assumeTrue, false); });
60104
+ return narrowTypeByDiscriminant(type, access, function (t) { return getNarrowedType(t, predicate.type, assumeTrue, isTypeSubtypeOf); });
60248
60105
  }
60249
60106
  }
60250
60107
  }
@@ -60397,7 +60254,7 @@ var ts;
60397
60254
  !((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
60398
60255
  (checkMode && checkMode & 64 ?
60399
60256
  getContextualType(node, 8)
60400
- : getContextualType(node, undefined));
60257
+ : getContextualType(node));
60401
60258
  return contextualType && !isGenericType(contextualType);
60402
60259
  }
60403
60260
  function getNarrowableTypeForReference(type, reference, checkMode) {
@@ -60500,7 +60357,7 @@ var ts;
60500
60357
  getNodeLinks(container).flags |= 8192;
60501
60358
  return getTypeOfSymbol(symbol);
60502
60359
  }
60503
- if (shouldMarkIdentifierAliasReferenced(node)) {
60360
+ if (!(node.parent && ts.isPropertyAccessExpression(node.parent) && node.parent.expression === node)) {
60504
60361
  markAliasReferenced(symbol, node);
60505
60362
  }
60506
60363
  var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
@@ -60613,23 +60470,6 @@ var ts;
60613
60470
  }
60614
60471
  return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
60615
60472
  }
60616
- function shouldMarkIdentifierAliasReferenced(node) {
60617
- var _a;
60618
- var parent = node.parent;
60619
- if (parent) {
60620
- if (ts.isPropertyAccessExpression(parent) && parent.expression === node) {
60621
- return false;
60622
- }
60623
- if (ts.isExportSpecifier(parent) && parent.isTypeOnly) {
60624
- return false;
60625
- }
60626
- var greatGrandparent = (_a = parent.parent) === null || _a === void 0 ? void 0 : _a.parent;
60627
- if (greatGrandparent && ts.isExportDeclaration(greatGrandparent) && greatGrandparent.isTypeOnly) {
60628
- return false;
60629
- }
60630
- }
60631
- return true;
60632
- }
60633
60473
  function isInsideFunctionOrInstancePropertyInitializer(node, threshold) {
60634
60474
  return !!ts.findAncestor(node, function (n) { return n === threshold ? "quit" : ts.isFunctionLike(n) || (n.parent && ts.isPropertyDeclaration(n.parent) && !ts.hasStaticModifier(n.parent) && n.parent.initializer === n); });
60635
60475
  }
@@ -61054,7 +60894,7 @@ var ts;
61054
60894
  if (noImplicitThis || inJs) {
61055
60895
  var containingLiteral = getContainingObjectLiteral(func);
61056
60896
  if (containingLiteral) {
61057
- var contextualType = getApparentTypeOfContextualType(containingLiteral, undefined);
60897
+ var contextualType = getApparentTypeOfContextualType(containingLiteral);
61058
60898
  var literal = containingLiteral;
61059
60899
  var type = contextualType;
61060
60900
  while (type) {
@@ -61066,7 +60906,7 @@ var ts;
61066
60906
  break;
61067
60907
  }
61068
60908
  literal = literal.parent.parent;
61069
- type = getApparentTypeOfContextualType(literal, undefined);
60909
+ type = getApparentTypeOfContextualType(literal);
61070
60910
  }
61071
60911
  return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral));
61072
60912
  }
@@ -61116,7 +60956,7 @@ var ts;
61116
60956
  tryGetTypeAtPosition(contextualSignature, index);
61117
60957
  }
61118
60958
  }
61119
- function getContextualTypeForVariableLikeDeclaration(declaration, contextFlags) {
60959
+ function getContextualTypeForVariableLikeDeclaration(declaration) {
61120
60960
  var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
61121
60961
  if (typeNode) {
61122
60962
  return getTypeFromTypeNode(typeNode);
@@ -61125,17 +60965,17 @@ var ts;
61125
60965
  case 164:
61126
60966
  return getContextuallyTypedParameterType(declaration);
61127
60967
  case 203:
61128
- return getContextualTypeForBindingElement(declaration, contextFlags);
60968
+ return getContextualTypeForBindingElement(declaration);
61129
60969
  case 167:
61130
60970
  if (ts.isStatic(declaration)) {
61131
- return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags);
60971
+ return getContextualTypeForStaticPropertyDeclaration(declaration);
61132
60972
  }
61133
60973
  }
61134
60974
  }
61135
- function getContextualTypeForBindingElement(declaration, contextFlags) {
60975
+ function getContextualTypeForBindingElement(declaration) {
61136
60976
  var parent = declaration.parent.parent;
61137
60977
  var name = declaration.propertyName || declaration.name;
61138
- var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) ||
60978
+ var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
61139
60979
  parent.kind !== 203 && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 : 0);
61140
60980
  if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
61141
60981
  return undefined;
@@ -61151,8 +60991,8 @@ var ts;
61151
60991
  return getTypeOfPropertyOfType(parentType, text);
61152
60992
  }
61153
60993
  }
61154
- function getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags) {
61155
- var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent, contextFlags);
60994
+ function getContextualTypeForStaticPropertyDeclaration(declaration) {
60995
+ var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent);
61156
60996
  if (!parentType)
61157
60997
  return undefined;
61158
60998
  return getTypeOfPropertyOfContextualType(parentType, getSymbolOfNode(declaration).escapedName);
@@ -61160,7 +61000,7 @@ var ts;
61160
61000
  function getContextualTypeForInitializerExpression(node, contextFlags) {
61161
61001
  var declaration = node.parent;
61162
61002
  if (ts.hasInitializer(declaration) && node === declaration.initializer) {
61163
- var result = getContextualTypeForVariableLikeDeclaration(declaration, contextFlags);
61003
+ var result = getContextualTypeForVariableLikeDeclaration(declaration);
61164
61004
  if (result) {
61165
61005
  return result;
61166
61006
  }
@@ -61170,10 +61010,10 @@ var ts;
61170
61010
  }
61171
61011
  return undefined;
61172
61012
  }
61173
- function getContextualTypeForReturnExpression(node, contextFlags) {
61013
+ function getContextualTypeForReturnExpression(node) {
61174
61014
  var func = ts.getContainingFunction(node);
61175
61015
  if (func) {
61176
- var contextualReturnType = getContextualReturnType(func, contextFlags);
61016
+ var contextualReturnType = getContextualReturnType(func);
61177
61017
  if (contextualReturnType) {
61178
61018
  var functionFlags = ts.getFunctionFlags(func);
61179
61019
  if (functionFlags & 1) {
@@ -61201,11 +61041,11 @@ var ts;
61201
61041
  }
61202
61042
  return undefined;
61203
61043
  }
61204
- function getContextualTypeForYieldOperand(node, contextFlags) {
61044
+ function getContextualTypeForYieldOperand(node) {
61205
61045
  var func = ts.getContainingFunction(node);
61206
61046
  if (func) {
61207
61047
  var functionFlags = ts.getFunctionFlags(func);
61208
- var contextualReturnType = getContextualReturnType(func, contextFlags);
61048
+ var contextualReturnType = getContextualReturnType(func);
61209
61049
  if (contextualReturnType) {
61210
61050
  return node.asteriskToken
61211
61051
  ? contextualReturnType
@@ -61229,14 +61069,14 @@ var ts;
61229
61069
  }
61230
61070
  function getContextualIterationType(kind, functionDecl) {
61231
61071
  var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2);
61232
- var contextualReturnType = getContextualReturnType(functionDecl, undefined);
61072
+ var contextualReturnType = getContextualReturnType(functionDecl);
61233
61073
  if (contextualReturnType) {
61234
61074
  return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
61235
61075
  || undefined;
61236
61076
  }
61237
61077
  return undefined;
61238
61078
  }
61239
- function getContextualReturnType(functionDecl, contextFlags) {
61079
+ function getContextualReturnType(functionDecl) {
61240
61080
  var returnType = getReturnTypeFromAnnotation(functionDecl);
61241
61081
  if (returnType) {
61242
61082
  return returnType;
@@ -61247,7 +61087,7 @@ var ts;
61247
61087
  }
61248
61088
  var iife = ts.getImmediatelyInvokedFunctionExpression(functionDecl);
61249
61089
  if (iife) {
61250
- return getContextualType(iife, contextFlags);
61090
+ return getContextualType(iife);
61251
61091
  }
61252
61092
  return undefined;
61253
61093
  }
@@ -61309,14 +61149,6 @@ var ts;
61309
61149
  var lhsType = getTypeOfExpression(e.expression);
61310
61150
  return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
61311
61151
  }
61312
- if (ts.isElementAccessExpression(e)) {
61313
- var propType = checkExpressionCached(e.argumentExpression);
61314
- if (!isTypeUsableAsPropertyName(propType)) {
61315
- return undefined;
61316
- }
61317
- var lhsType = getTypeOfExpression(e.expression);
61318
- return getPropertyOfType(lhsType, getPropertyNameFromType(propType));
61319
- }
61320
61152
  return undefined;
61321
61153
  function tryGetPrivateIdentifierPropertyOfType(type, id) {
61322
61154
  var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
@@ -61485,7 +61317,7 @@ var ts;
61485
61317
  }
61486
61318
  function getContextualTypeForObjectLiteralElement(element, contextFlags) {
61487
61319
  var objectLiteral = element.parent;
61488
- var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element, contextFlags);
61320
+ var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element);
61489
61321
  if (propertyAssignmentType) {
61490
61322
  return propertyAssignmentType;
61491
61323
  }
@@ -61510,8 +61342,8 @@ var ts;
61510
61342
  var conditional = node.parent;
61511
61343
  return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : undefined;
61512
61344
  }
61513
- function getContextualTypeForChildJsxExpression(node, child, contextFlags) {
61514
- var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName, contextFlags);
61345
+ function getContextualTypeForChildJsxExpression(node, child) {
61346
+ var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName);
61515
61347
  var jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
61516
61348
  if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
61517
61349
  return undefined;
@@ -61528,24 +61360,24 @@ var ts;
61528
61360
  }
61529
61361
  }, true));
61530
61362
  }
61531
- function getContextualTypeForJsxExpression(node, contextFlags) {
61363
+ function getContextualTypeForJsxExpression(node) {
61532
61364
  var exprParent = node.parent;
61533
61365
  return ts.isJsxAttributeLike(exprParent)
61534
- ? getContextualType(node, contextFlags)
61366
+ ? getContextualType(node)
61535
61367
  : ts.isJsxElement(exprParent)
61536
- ? getContextualTypeForChildJsxExpression(exprParent, node, contextFlags)
61368
+ ? getContextualTypeForChildJsxExpression(exprParent, node)
61537
61369
  : undefined;
61538
61370
  }
61539
- function getContextualTypeForJsxAttribute(attribute, contextFlags) {
61371
+ function getContextualTypeForJsxAttribute(attribute) {
61540
61372
  if (ts.isJsxAttribute(attribute)) {
61541
- var attributesType = getApparentTypeOfContextualType(attribute.parent, contextFlags);
61373
+ var attributesType = getApparentTypeOfContextualType(attribute.parent);
61542
61374
  if (!attributesType || isTypeAny(attributesType)) {
61543
61375
  return undefined;
61544
61376
  }
61545
61377
  return getTypeOfPropertyOfContextualType(attributesType, attribute.name.escapedText);
61546
61378
  }
61547
61379
  else {
61548
- return getContextualType(attribute.parent, contextFlags);
61380
+ return getContextualType(attribute.parent);
61549
61381
  }
61550
61382
  }
61551
61383
  function isPossiblyDiscriminantValue(node) {
@@ -61630,9 +61462,9 @@ var ts;
61630
61462
  return getContextualTypeForInitializerExpression(node, contextFlags);
61631
61463
  case 214:
61632
61464
  case 247:
61633
- return getContextualTypeForReturnExpression(node, contextFlags);
61465
+ return getContextualTypeForReturnExpression(node);
61634
61466
  case 224:
61635
- return getContextualTypeForYieldOperand(parent, contextFlags);
61467
+ return getContextualTypeForYieldOperand(parent);
61636
61468
  case 218:
61637
61469
  return getContextualTypeForAwaitOperand(parent, contextFlags);
61638
61470
  case 208:
@@ -61669,17 +61501,17 @@ var ts;
61669
61501
  case 271:
61670
61502
  return tryGetTypeFromEffectiveTypeNode(parent);
61671
61503
  case 288:
61672
- return getContextualTypeForJsxExpression(parent, contextFlags);
61504
+ return getContextualTypeForJsxExpression(parent);
61673
61505
  case 285:
61674
61506
  case 287:
61675
- return getContextualTypeForJsxAttribute(parent, contextFlags);
61507
+ return getContextualTypeForJsxAttribute(parent);
61676
61508
  case 280:
61677
61509
  case 279:
61678
61510
  return getContextualJsxElementAttributesType(parent, contextFlags);
61679
61511
  }
61680
61512
  return undefined;
61681
61513
  function tryFindWhenConstTypeReference(node) {
61682
- return getContextualType(node, contextFlags);
61514
+ return getContextualType(node);
61683
61515
  }
61684
61516
  }
61685
61517
  function getInferenceContext(node) {
@@ -61936,7 +61768,37 @@ var ts;
61936
61768
  var arrayOrIterableType = checkExpression(node.expression, checkMode);
61937
61769
  return checkIteratedTypeOrElementType(33, arrayOrIterableType, undefinedType, node.expression);
61938
61770
  }
61771
+ function getTemplateStringsArrayOf(cookedTypes, rawTypes) {
61772
+ var templateStringsArrayOfAlias = getGlobalTemplateStringsArrayOfSymbol();
61773
+ if (!templateStringsArrayOfAlias)
61774
+ return getGlobalTemplateStringsArrayType();
61775
+ var cookedType = createTupleType(cookedTypes, undefined, true);
61776
+ var rawType = createTupleType(rawTypes, undefined, true);
61777
+ return getTypeAliasInstantiation(templateStringsArrayOfAlias, [cookedType, rawType]);
61778
+ }
61779
+ function getRawLiteralType(node) {
61780
+ var text = ts.getRawTextOfTemplateLiteralLike(node, ts.getSourceFileOfNode(node));
61781
+ return getStringLiteralType(text);
61782
+ }
61939
61783
  function checkSyntheticExpression(node) {
61784
+ if (ts.isTemplateLiteral(node.parent) && node.type === getGlobalTemplateStringsArrayType()) {
61785
+ var cookedStrings = [];
61786
+ var rawStrings = [];
61787
+ if (ts.isNoSubstitutionTemplateLiteral(node.parent)) {
61788
+ cookedStrings.push(getStringLiteralType(node.parent.text));
61789
+ rawStrings.push(getRawLiteralType(node.parent));
61790
+ }
61791
+ else {
61792
+ cookedStrings.push(getStringLiteralType(node.parent.head.text));
61793
+ rawStrings.push(getRawLiteralType(node.parent.head));
61794
+ for (var _i = 0, _a = node.parent.templateSpans; _i < _a.length; _i++) {
61795
+ var templateSpan = _a[_i];
61796
+ cookedStrings.push(getStringLiteralType(templateSpan.literal.text));
61797
+ rawStrings.push(getRawLiteralType(templateSpan.literal));
61798
+ }
61799
+ }
61800
+ return getTemplateStringsArrayOf(cookedStrings, rawStrings);
61801
+ }
61940
61802
  return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type;
61941
61803
  }
61942
61804
  function hasDefaultValue(node) {
@@ -61948,7 +61810,7 @@ var ts;
61948
61810
  var elementCount = elements.length;
61949
61811
  var elementTypes = [];
61950
61812
  var elementFlags = [];
61951
- var contextualType = getApparentTypeOfContextualType(node, undefined);
61813
+ var contextualType = getApparentTypeOfContextualType(node);
61952
61814
  var inDestructuringPattern = ts.isAssignmentTarget(node);
61953
61815
  var inConstContext = isConstContext(node);
61954
61816
  var hasOmittedExpression = false;
@@ -62097,7 +61959,7 @@ var ts;
62097
61959
  var propertiesTable = ts.createSymbolTable();
62098
61960
  var propertiesArray = [];
62099
61961
  var spread = emptyObjectType;
62100
- var contextualType = getApparentTypeOfContextualType(node, undefined);
61962
+ var contextualType = getApparentTypeOfContextualType(node);
62101
61963
  var contextualTypeHasPattern = contextualType && contextualType.pattern &&
62102
61964
  (contextualType.pattern.kind === 201 || contextualType.pattern.kind === 205);
62103
61965
  var inConstContext = isConstContext(node);
@@ -62395,7 +62257,7 @@ var ts;
62395
62257
  if (explicitlySpecifyChildrenAttribute) {
62396
62258
  error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName));
62397
62259
  }
62398
- var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes, undefined);
62260
+ var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes);
62399
62261
  var childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName);
62400
62262
  var childrenPropSymbol = createSymbol(4, jsxChildrenPropertyName);
62401
62263
  childrenPropSymbol.type = childrenTypes.length === 1 ? childrenTypes[0] :
@@ -64059,7 +63921,7 @@ var ts;
64059
63921
  var spreadIndex = getSpreadArgumentIndex(args);
64060
63922
  if (spreadIndex >= 0) {
64061
63923
  var effectiveArgs_1 = args.slice(0, spreadIndex);
64062
- var _loop_26 = function (i) {
63924
+ var _loop_25 = function (i) {
64063
63925
  var arg = args[i];
64064
63926
  var spreadType = arg.kind === 225 && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
64065
63927
  if (spreadType && isTupleType(spreadType)) {
@@ -64075,7 +63937,7 @@ var ts;
64075
63937
  }
64076
63938
  };
64077
63939
  for (var i = spreadIndex; i < args.length; i++) {
64078
- _loop_26(i);
63940
+ _loop_25(i);
64079
63941
  }
64080
63942
  return effectiveArgs_1;
64081
63943
  }
@@ -64261,7 +64123,7 @@ var ts;
64261
64123
  var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
64262
64124
  var reportErrors = !candidatesOutArray;
64263
64125
  var typeArguments;
64264
- if (!isDecorator && !ts.isSuperCall(node)) {
64126
+ if (!isDecorator) {
64265
64127
  typeArguments = node.typeArguments;
64266
64128
  if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106) {
64267
64129
  ts.forEach(typeArguments, checkSourceElement);
@@ -64293,8 +64155,6 @@ var ts;
64293
64155
  if (result) {
64294
64156
  return result;
64295
64157
  }
64296
- result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
64297
- getNodeLinks(node).resolvedSignature = result;
64298
64158
  if (reportErrors) {
64299
64159
  if (candidatesForArgumentError) {
64300
64160
  if (candidatesForArgumentError.length === 1 || candidatesForArgumentError.length > 3) {
@@ -64325,7 +64185,7 @@ var ts;
64325
64185
  var min_3 = Number.MAX_VALUE;
64326
64186
  var minIndex = 0;
64327
64187
  var i_1 = 0;
64328
- var _loop_27 = function (c) {
64188
+ var _loop_26 = function (c) {
64329
64189
  var chain_2 = function () { return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
64330
64190
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0, true, chain_2);
64331
64191
  if (diags_2) {
@@ -64343,7 +64203,7 @@ var ts;
64343
64203
  };
64344
64204
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
64345
64205
  var c = candidatesForArgumentError_1[_a];
64346
- _loop_27(c);
64206
+ _loop_26(c);
64347
64207
  }
64348
64208
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
64349
64209
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -64380,7 +64240,7 @@ var ts;
64380
64240
  }
64381
64241
  }
64382
64242
  }
64383
- return result;
64243
+ return getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
64384
64244
  function addImplementationSuccessElaboration(failed, diagnostic) {
64385
64245
  var _a, _b;
64386
64246
  var oldCandidatesForArgumentError = candidatesForArgumentError;
@@ -64454,7 +64314,7 @@ var ts;
64454
64314
  argCheckMode = checkMode & 32;
64455
64315
  if (inferenceContext) {
64456
64316
  var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
64457
- checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
64317
+ checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
64458
64318
  if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma)) {
64459
64319
  candidateForArgumentArityError = checkCandidate;
64460
64320
  continue;
@@ -64486,7 +64346,7 @@ var ts;
64486
64346
  }
64487
64347
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
64488
64348
  var parameters = [];
64489
- var _loop_28 = function (i) {
64349
+ var _loop_27 = function (i) {
64490
64350
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
64491
64351
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
64492
64352
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -64494,7 +64354,7 @@ var ts;
64494
64354
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
64495
64355
  };
64496
64356
  for (var i = 0; i < maxNonRestParam; i++) {
64497
- _loop_28(i);
64357
+ _loop_27(i);
64498
64358
  }
64499
64359
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
64500
64360
  var flags = 0;
@@ -65093,7 +64953,7 @@ var ts;
65093
64953
  checkGrammarTypeArguments(node, node.typeArguments);
65094
64954
  var signature = getResolvedSignature(node, undefined, checkMode);
65095
64955
  if (signature === resolvingSignature) {
65096
- return silentNeverType;
64956
+ return nonInferrableType;
65097
64957
  }
65098
64958
  checkDeprecatedSignature(signature, node);
65099
64959
  if (node.expression.kind === 106) {
@@ -65683,6 +65543,13 @@ var ts;
65683
65543
  }
65684
65544
  }
65685
65545
  }
65546
+ var restType = getEffectiveRestType(context);
65547
+ if (restType && restType.flags & 262144) {
65548
+ var instantiatedContext = instantiateSignature(context, inferenceContext.nonFixingMapper);
65549
+ assignContextualParameterTypes(signature, instantiatedContext);
65550
+ var restPos = getParameterCount(context) - 1;
65551
+ inferTypes(inferenceContext.inferences, getRestTypeAtPosition(signature, restPos), restType);
65552
+ }
65686
65553
  }
65687
65554
  function assignContextualParameterTypes(signature, context) {
65688
65555
  if (context.typeParameters) {
@@ -65855,7 +65722,7 @@ var ts;
65855
65722
  var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
65856
65723
  var contextualType = !contextualSignature ? undefined :
65857
65724
  contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
65858
- instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func, undefined);
65725
+ instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
65859
65726
  if (isGenerator) {
65860
65727
  yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0, isAsync);
65861
65728
  returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1, isAsync);
@@ -65918,7 +65785,7 @@ var ts;
65918
65785
  nextType = iterationTypes && iterationTypes.nextType;
65919
65786
  }
65920
65787
  else {
65921
- nextType = getContextualType(yieldExpression, undefined);
65788
+ nextType = getContextualType(yieldExpression);
65922
65789
  }
65923
65790
  if (nextType)
65924
65791
  ts.pushIfUnique(nextTypes, nextType);
@@ -66091,16 +65958,11 @@ var ts;
66091
65958
  if (isContextSensitive(node)) {
66092
65959
  if (contextualSignature) {
66093
65960
  var inferenceContext = getInferenceContext(node);
66094
- var instantiatedContextualSignature = void 0;
66095
65961
  if (checkMode && checkMode & 2) {
66096
65962
  inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
66097
- var restType = getEffectiveRestType(contextualSignature);
66098
- if (restType && restType.flags & 262144) {
66099
- instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
66100
- }
66101
65963
  }
66102
- instantiatedContextualSignature || (instantiatedContextualSignature = inferenceContext ?
66103
- instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature);
65964
+ var instantiatedContextualSignature = inferenceContext ?
65965
+ instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature;
66104
65966
  assignContextualParameterTypes(signature, instantiatedContextualSignature);
66105
65967
  }
66106
65968
  else {
@@ -66369,7 +66231,7 @@ var ts;
66369
66231
  error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));
66370
66232
  }
66371
66233
  if (node.operator === 39) {
66372
- if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112)) {
66234
+ if (maybeTypeOfKind(operandType, 2112)) {
66373
66235
  error(node.operand, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1, ts.tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType)));
66374
66236
  }
66375
66237
  return numberType;
@@ -66759,11 +66621,7 @@ var ts;
66759
66621
  var operator = operatorToken.kind;
66760
66622
  if (operator === 55 || operator === 56 || operator === 60) {
66761
66623
  if (operator === 55) {
66762
- var parent = node.parent;
66763
- while (parent.kind === 212
66764
- || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 || parent.operatorToken.kind === 56)) {
66765
- parent = parent.parent;
66766
- }
66624
+ var parent = ts.walkUpParenthesizedExpressions(node.parent);
66767
66625
  checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
66768
66626
  }
66769
66627
  checkTruthinessOfType(leftType, node.left);
@@ -67219,7 +67077,7 @@ var ts;
67219
67077
  type = anyType;
67220
67078
  addLazyDiagnostic(function () {
67221
67079
  if (noImplicitAny && !ts.expressionResultIsUnused(node)) {
67222
- var contextualType = getContextualType(node, undefined);
67080
+ var contextualType = getContextualType(node);
67223
67081
  if (!contextualType || isTypeAny(contextualType)) {
67224
67082
  error(node, ts.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
67225
67083
  }
@@ -67260,7 +67118,7 @@ var ts;
67260
67118
  texts.push(span.literal.text);
67261
67119
  types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
67262
67120
  }
67263
- return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(node, undefined) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
67121
+ return isConstContext(node) || isTemplateLiteralContext(node) || someType(getContextualType(node) || unknownType, isTemplateLiteralContextualType) ? getTemplateLiteralType(texts, types) : stringType;
67264
67122
  }
67265
67123
  function isTemplateLiteralContextualType(type) {
67266
67124
  return !!(type.flags & (128 | 134217728) ||
@@ -67283,7 +67141,7 @@ var ts;
67283
67141
  if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
67284
67142
  inferenceContext.intraExpressionInferenceSites = undefined;
67285
67143
  }
67286
- var result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node, undefined)) ?
67144
+ var result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node)) ?
67287
67145
  getRegularTypeOfLiteralType(type) : type;
67288
67146
  return result;
67289
67147
  }
@@ -67387,7 +67245,7 @@ var ts;
67387
67245
  var type = checkExpression(node, checkMode, forceTuple);
67388
67246
  return isConstContext(node) || ts.isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) :
67389
67247
  isTypeAssertion(node) ? type :
67390
- getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node, undefined) : contextualType, node, undefined));
67248
+ getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node) : contextualType, node));
67391
67249
  }
67392
67250
  function checkPropertyAssignment(node, checkMode) {
67393
67251
  if (node.name.kind === 162) {
@@ -67473,8 +67331,8 @@ var ts;
67473
67331
  var result = [];
67474
67332
  var oldTypeParameters;
67475
67333
  var newTypeParameters;
67476
- for (var _i = 0, typeParameters_3 = typeParameters; _i < typeParameters_3.length; _i++) {
67477
- var tp = typeParameters_3[_i];
67334
+ for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
67335
+ var tp = typeParameters_2[_i];
67478
67336
  var name = tp.symbol.escapedName;
67479
67337
  if (hasTypeParameterByName(context.inferredTypeParameters, name) || hasTypeParameterByName(result, name)) {
67480
67338
  var newName = getUniqueTypeParameterName(ts.concatenate(context.inferredTypeParameters, result), name);
@@ -67767,14 +67625,12 @@ var ts;
67767
67625
  error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
67768
67626
  }
67769
67627
  else if (modifiers === 32768 || modifiers === 65536) {
67770
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
67771
67628
  var source = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSubTypeForCheck : markerSuperTypeForCheck);
67772
67629
  var target = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSuperTypeForCheck : markerSubTypeForCheck);
67773
67630
  var saveVarianceTypeParameter = typeParameter;
67774
67631
  varianceTypeParameter = typeParameter;
67775
67632
  checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
67776
67633
  varianceTypeParameter = saveVarianceTypeParameter;
67777
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
67778
67634
  }
67779
67635
  }
67780
67636
  }
@@ -67791,7 +67647,7 @@ var ts;
67791
67647
  error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name);
67792
67648
  }
67793
67649
  }
67794
- if ((node.questionToken || isJSDocOptionalParameter(node)) && ts.isBindingPattern(node.name) && func.body) {
67650
+ if (node.questionToken && ts.isBindingPattern(node.name) && func.body) {
67795
67651
  error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
67796
67652
  }
67797
67653
  if (node.name && ts.isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) {
@@ -68084,7 +67940,7 @@ var ts;
68084
67940
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
68085
67941
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
68086
67942
  var indexSignatureMap_1 = new ts.Map();
68087
- var _loop_29 = function (declaration) {
67943
+ var _loop_28 = function (declaration) {
68088
67944
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
68089
67945
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
68090
67946
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -68099,7 +67955,7 @@ var ts;
68099
67955
  };
68100
67956
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
68101
67957
  var declaration = _a[_i];
68102
- _loop_29(declaration);
67958
+ _loop_28(declaration);
68103
67959
  }
68104
67960
  indexSignatureMap_1.forEach(function (entry) {
68105
67961
  if (entry.declarations.length > 1) {
@@ -68291,12 +68147,6 @@ var ts;
68291
68147
  function checkMissingDeclaration(node) {
68292
68148
  checkDecorators(node);
68293
68149
  }
68294
- function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) {
68295
- if (index < typeParameters.length) {
68296
- return getTypeFromTypeNode(node.typeArguments[index]);
68297
- }
68298
- return getEffectiveTypeArguments(node, typeParameters)[index];
68299
- }
68300
68150
  function getEffectiveTypeArguments(node, typeParameters) {
68301
68151
  return fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(node));
68302
68152
  }
@@ -68954,30 +68804,20 @@ var ts;
68954
68804
  isAwaitedTypeInstantiation(type) ? type.aliasTypeArguments[0] :
68955
68805
  type;
68956
68806
  }
68957
- function isAwaitedTypeNeeded(type) {
68958
- if (isTypeAny(type) || isAwaitedTypeInstantiation(type)) {
68959
- return false;
68807
+ function createAwaitedTypeIfNeeded(type) {
68808
+ if (isTypeAny(type)) {
68809
+ return type;
68810
+ }
68811
+ if (isAwaitedTypeInstantiation(type)) {
68812
+ return type;
68960
68813
  }
68961
68814
  if (isGenericObjectType(type)) {
68962
68815
  var baseConstraint = getBaseConstraintOfType(type);
68963
68816
  if (!baseConstraint || (baseConstraint.flags & 3) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
68964
- return true;
68965
- }
68966
- }
68967
- return false;
68968
- }
68969
- function tryCreateAwaitedType(type) {
68970
- var awaitedSymbol = getGlobalAwaitedSymbol(true);
68971
- if (awaitedSymbol) {
68972
- return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
68973
- }
68974
- return undefined;
68975
- }
68976
- function createAwaitedTypeIfNeeded(type) {
68977
- if (isAwaitedTypeNeeded(type)) {
68978
- var awaitedType = tryCreateAwaitedType(type);
68979
- if (awaitedType) {
68980
- return awaitedType;
68817
+ var awaitedSymbol = getGlobalAwaitedSymbol(true);
68818
+ if (awaitedSymbol) {
68819
+ return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
68820
+ }
68981
68821
  }
68982
68822
  }
68983
68823
  ts.Debug.assert(getPromisedTypeOfPromise(type) === undefined, "type provided should not be a non-generic 'promise'-like.");
@@ -68999,20 +68839,8 @@ var ts;
68999
68839
  return typeAsAwaitable.awaitedTypeOfType;
69000
68840
  }
69001
68841
  if (type.flags & 1048576) {
69002
- if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
69003
- if (errorNode) {
69004
- error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
69005
- }
69006
- return undefined;
69007
- }
69008
68842
  var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
69009
- awaitedTypeStack.push(type.id);
69010
- var mapped = mapType(type, mapper);
69011
- awaitedTypeStack.pop();
69012
- return typeAsAwaitable.awaitedTypeOfType = mapped;
69013
- }
69014
- if (isAwaitedTypeNeeded(type)) {
69015
- return typeAsAwaitable.awaitedTypeOfType = type;
68843
+ return typeAsAwaitable.awaitedTypeOfType = mapType(type, mapper);
69016
68844
  }
69017
68845
  var thisTypeForErrorOut = { value: undefined };
69018
68846
  var promisedType = getPromisedTypeOfPromise(type, undefined, thisTypeForErrorOut);
@@ -69517,8 +69345,8 @@ var ts;
69517
69345
  return;
69518
69346
  var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
69519
69347
  var seenParentsWithEveryUnused = new ts.Set();
69520
- for (var _i = 0, typeParameters_4 = typeParameters; _i < typeParameters_4.length; _i++) {
69521
- var typeParameter = typeParameters_4[_i];
69348
+ for (var _i = 0, typeParameters_3 = typeParameters; _i < typeParameters_3.length; _i++) {
69349
+ var typeParameter = typeParameters_3[_i];
69522
69350
  if (!isTypeParameterUnused(typeParameter))
69523
69351
  continue;
69524
69352
  var name = ts.idText(typeParameter.name);
@@ -70777,14 +70605,9 @@ var ts;
70777
70605
  function unwrapReturnType(returnType, functionFlags) {
70778
70606
  var isGenerator = !!(functionFlags & 1);
70779
70607
  var isAsync = !!(functionFlags & 2);
70780
- if (isGenerator) {
70781
- var returnIterationType = getIterationTypeOfGeneratorFunctionReturnType(1, returnType, isAsync);
70782
- if (!returnIterationType) {
70783
- return errorType;
70784
- }
70785
- return isAsync ? getAwaitedTypeNoAlias(unwrapAwaitedType(returnIterationType)) : returnIterationType;
70786
- }
70787
- return isAsync ? getAwaitedTypeNoAlias(returnType) || errorType : returnType;
70608
+ return isGenerator ? getIterationTypeOfGeneratorFunctionReturnType(1, returnType, isAsync) || errorType :
70609
+ isAsync ? getAwaitedTypeNoAlias(returnType) || errorType :
70610
+ returnType;
70788
70611
  }
70789
70612
  function isUnwrappedReturnTypeVoidOrAny(func, returnType) {
70790
70613
  var unwrappedReturnType = unwrapReturnType(returnType, ts.getFunctionFlags(func));
@@ -70985,24 +70808,19 @@ var ts;
70985
70808
  }
70986
70809
  var indexInfos = getApplicableIndexInfos(type, propNameType);
70987
70810
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 258) : undefined;
70988
- var propDeclaration = declaration && declaration.kind === 221 ||
70989
- name && name.kind === 162 ? declaration : undefined;
70990
- var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
70991
- var _loop_30 = function (info) {
70811
+ var localPropDeclaration = declaration && declaration.kind === 221 ||
70812
+ name && name.kind === 162 || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
70813
+ var _loop_29 = function (info) {
70992
70814
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
70993
70815
  var errorNode = localPropDeclaration || localIndexDeclaration ||
70994
70816
  (interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined);
70995
70817
  if (errorNode && !isTypeAssignableTo(propType, info.type)) {
70996
- var diagnostic = createError(errorNode, ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3, symbolToString(prop), typeToString(propType), typeToString(info.keyType), typeToString(info.type));
70997
- if (propDeclaration && errorNode !== propDeclaration) {
70998
- ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(propDeclaration, ts.Diagnostics._0_is_declared_here, symbolToString(prop)));
70999
- }
71000
- diagnostics.add(diagnostic);
70818
+ error(errorNode, ts.Diagnostics.Property_0_of_type_1_is_not_assignable_to_2_index_type_3, symbolToString(prop), typeToString(propType), typeToString(info.keyType), typeToString(info.type));
71001
70819
  }
71002
70820
  };
71003
70821
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
71004
70822
  var info = indexInfos_9[_i];
71005
- _loop_30(info);
70823
+ _loop_29(info);
71006
70824
  }
71007
70825
  }
71008
70826
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -71010,7 +70828,7 @@ var ts;
71010
70828
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
71011
70829
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 258) : undefined;
71012
70830
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
71013
- var _loop_31 = function (info) {
70831
+ var _loop_30 = function (info) {
71014
70832
  if (info === checkInfo)
71015
70833
  return "continue";
71016
70834
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -71022,7 +70840,7 @@ var ts;
71022
70840
  };
71023
70841
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
71024
70842
  var info = indexInfos_10[_i];
71025
- _loop_31(info);
70843
+ _loop_30(info);
71026
70844
  }
71027
70845
  }
71028
70846
  function checkTypeNameIsReserved(name, message) {
@@ -71317,7 +71135,7 @@ var ts;
71317
71135
  var baseTypes = baseTypeNode && getBaseTypes(type);
71318
71136
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
71319
71137
  var baseStaticType = getBaseConstructorTypeOfClass(type);
71320
- var _loop_32 = function (member) {
71138
+ var _loop_31 = function (member) {
71321
71139
  if (ts.hasAmbientModifier(member)) {
71322
71140
  return "continue";
71323
71141
  }
@@ -71332,7 +71150,7 @@ var ts;
71332
71150
  };
71333
71151
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
71334
71152
  var member = _a[_i];
71335
- _loop_32(member);
71153
+ _loop_31(member);
71336
71154
  }
71337
71155
  }
71338
71156
  function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) {
@@ -71407,7 +71225,7 @@ var ts;
71407
71225
  }
71408
71226
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
71409
71227
  var issuedMemberError = false;
71410
- var _loop_33 = function (member) {
71228
+ var _loop_32 = function (member) {
71411
71229
  if (ts.isStatic(member)) {
71412
71230
  return "continue";
71413
71231
  }
@@ -71425,7 +71243,7 @@ var ts;
71425
71243
  };
71426
71244
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
71427
71245
  var member = _a[_i];
71428
- _loop_33(member);
71246
+ _loop_32(member);
71429
71247
  }
71430
71248
  if (!issuedMemberError) {
71431
71249
  checkTypeAssignableTo(typeWithThis, baseWithThis, node.name || node, broadDiag);
@@ -71472,7 +71290,7 @@ var ts;
71472
71290
  function checkKindsOfPropertyMemberOverrides(type, baseType) {
71473
71291
  var _a, _b, _c, _d;
71474
71292
  var baseProperties = getPropertiesOfType(baseType);
71475
- var _loop_34 = function (baseProperty) {
71293
+ var _loop_33 = function (baseProperty) {
71476
71294
  var base = getTargetSymbol(baseProperty);
71477
71295
  if (base.flags & 4194304) {
71478
71296
  return "continue";
@@ -71570,7 +71388,7 @@ var ts;
71570
71388
  };
71571
71389
  basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
71572
71390
  var baseProperty = baseProperties_1[_i];
71573
- var state_10 = _loop_34(baseProperty);
71391
+ var state_10 = _loop_33(baseProperty);
71574
71392
  switch (state_10) {
71575
71393
  case "continue-basePropertyCheck": continue basePropertyCheck;
71576
71394
  }
@@ -71590,9 +71408,9 @@ var ts;
71590
71408
  });
71591
71409
  for (var _i = 0, baseTypes_3 = baseTypes; _i < baseTypes_3.length; _i++) {
71592
71410
  var base = baseTypes_3[_i];
71593
- var properties_5 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
71594
- for (var _a = 0, properties_4 = properties_5; _a < properties_4.length; _a++) {
71595
- var prop = properties_4[_a];
71411
+ var properties_6 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
71412
+ for (var _a = 0, properties_5 = properties_6; _a < properties_5.length; _a++) {
71413
+ var prop = properties_5[_a];
71596
71414
  var existing = seen.get(prop.escapedName);
71597
71415
  if (existing && prop.parent === existing.parent) {
71598
71416
  seen.delete(prop.escapedName);
@@ -71614,8 +71432,8 @@ var ts;
71614
71432
  for (var _i = 0, baseTypes_4 = baseTypes; _i < baseTypes_4.length; _i++) {
71615
71433
  var base = baseTypes_4[_i];
71616
71434
  var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
71617
- for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) {
71618
- var prop = properties_6[_a];
71435
+ for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) {
71436
+ var prop = properties_7[_a];
71619
71437
  var existing = seen.get(prop.escapedName);
71620
71438
  if (!existing) {
71621
71439
  seen.set(prop.escapedName, { prop: prop, containingType: base });
@@ -72482,9 +72300,7 @@ var ts;
72482
72300
  error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.idText(exportedName));
72483
72301
  }
72484
72302
  else {
72485
- if (!node.isTypeOnly && !node.parent.parent.isTypeOnly) {
72486
- markExportAsReferenced(node);
72487
- }
72303
+ markExportAsReferenced(node);
72488
72304
  var target = symbol && (symbol.flags & 2097152 ? resolveAlias(symbol) : symbol);
72489
72305
  if (!target || target === unknownSymbol || target.flags & 111551) {
72490
72306
  checkExpressionCached(node.propertyName || node.name);
@@ -74216,16 +74032,10 @@ var ts;
74216
74032
  if (!fileToDirective) {
74217
74033
  return undefined;
74218
74034
  }
74219
- var meaning;
74220
- if (node.parent.kind === 162) {
74035
+ var meaning = 788968 | 1920;
74036
+ if ((node.kind === 79 && isInTypeQuery(node)) || (node.kind === 206 && !isInHeritageClause(node))) {
74221
74037
  meaning = 111551 | 1048576;
74222
74038
  }
74223
- else {
74224
- meaning = 788968 | 1920;
74225
- if ((node.kind === 79 && isInTypeQuery(node)) || (node.kind === 206 && !isInHeritageClause(node))) {
74226
- meaning = 111551 | 1048576;
74227
- }
74228
- }
74229
74039
  var symbol = resolveEntityName(node, meaning, true);
74230
74040
  return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;
74231
74041
  }
@@ -75541,6 +75351,9 @@ var ts;
75541
75351
  else {
75542
75352
  return grammarErrorOnNode(initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
75543
75353
  }
75354
+ if (!isConstOrReadonly || isInvalidInitializer) {
75355
+ return grammarErrorOnNode(initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
75356
+ }
75544
75357
  }
75545
75358
  }
75546
75359
  function checkGrammarVariableDeclaration(node) {
@@ -76331,13 +76144,13 @@ var ts;
76331
76144
  return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration));
76332
76145
  case 200:
76333
76146
  ts.Debug.type(node);
76334
- return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf);
76147
+ return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), visitNodes(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf);
76335
76148
  case 295:
76336
76149
  ts.Debug.type(node);
76337
76150
  return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine);
76338
76151
  case 197:
76339
76152
  ts.Debug.type(node);
76340
- return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode));
76153
+ return factory.updateNamedTupleMember(node, visitNode(node.dotDotDotToken, visitor, ts.isDotDotDotToken), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.questionToken, visitor, ts.isQuestionToken), visitNode(node.type, visitor, ts.isTypeNode));
76341
76154
  case 191:
76342
76155
  ts.Debug.type(node);
76343
76156
  return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode));
@@ -76400,7 +76213,7 @@ var ts;
76400
76213
  return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
76401
76214
  case 210:
76402
76215
  ts.Debug.type(node);
76403
- return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral));
76216
+ return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral));
76404
76217
  case 211:
76405
76218
  ts.Debug.type(node);
76406
76219
  return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression));
@@ -78049,14 +77862,7 @@ var ts;
78049
77862
  return template.templateFlags ? ts.factory.createVoidZero() : ts.factory.createStringLiteral(template.text);
78050
77863
  }
78051
77864
  function getRawLiteral(node, currentSourceFile) {
78052
- var text = node.rawText;
78053
- if (text === undefined) {
78054
- ts.Debug.assertIsDefined(currentSourceFile, "Template literal node is missing 'rawText' and does not have a source file. Possibly bad transform.");
78055
- text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
78056
- var isLast = node.kind === 14 || node.kind === 17;
78057
- text = text.substring(1, text.length - (isLast ? 1 : 2));
78058
- }
78059
- text = text.replace(/\r\n?/g, "\n");
77865
+ var text = ts.getRawTextOfTemplateLiteralLike(node, currentSourceFile);
78060
77866
  return ts.setTextRange(ts.factory.createStringLiteral(text), node);
78061
77867
  }
78062
77868
  })(ts || (ts = {}));
@@ -78671,8 +78477,7 @@ var ts;
78671
78477
  else {
78672
78478
  statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
78673
78479
  }
78674
- var start = superStatementIndex >= 0 ? superStatementIndex + 1 : prologueStatementCount;
78675
- ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, start));
78480
+ ts.addRange(statements, ts.visitNodes(body.statements, visitor, ts.isStatement, superStatementIndex + 1 + prologueStatementCount));
78676
78481
  statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
78677
78482
  var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), true);
78678
78483
  ts.setTextRange(block, body);
@@ -80110,8 +79915,8 @@ var ts;
80110
79915
  }
80111
79916
  }
80112
79917
  function addPropertyOrClassStaticBlockStatements(statements, properties, receiver) {
80113
- for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) {
80114
- var property = properties_7[_i];
79918
+ for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) {
79919
+ var property = properties_8[_i];
80115
79920
  if (ts.isStatic(property) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) {
80116
79921
  continue;
80117
79922
  }
@@ -81057,58 +80862,23 @@ var ts;
81057
80862
  function visitClassDeclaration(node) {
81058
80863
  if (!(ts.classOrConstructorParameterIsDecorated(node) || ts.childIsDecorated(node)))
81059
80864
  return ts.visitEachChild(node, visitor, context);
81060
- var statements = ts.hasDecorators(node) ?
81061
- transformClassDeclarationWithClassDecorators(node, node.name) :
81062
- transformClassDeclarationWithoutClassDecorators(node, node.name);
80865
+ var classStatement = ts.hasDecorators(node) ?
80866
+ createClassDeclarationHeadWithDecorators(node, node.name) :
80867
+ createClassDeclarationHeadWithoutDecorators(node, node.name);
80868
+ var statements = [classStatement];
80869
+ addClassElementDecorationStatements(statements, node, false);
80870
+ addClassElementDecorationStatements(statements, node, true);
80871
+ addConstructorDecorationStatement(statements, node);
81063
80872
  if (statements.length > 1) {
81064
80873
  statements.push(factory.createEndOfDeclarationMarker(node));
81065
- ts.setEmitFlags(statements[0], ts.getEmitFlags(statements[0]) | 4194304);
80874
+ ts.setEmitFlags(classStatement, ts.getEmitFlags(classStatement) | 4194304);
81066
80875
  }
81067
80876
  return ts.singleOrMany(statements);
81068
80877
  }
81069
- function decoratorContainsPrivateIdentifierInExpression(decorator) {
81070
- return !!(decorator.transformFlags & 536870912);
81071
- }
81072
- function parameterDecoratorsContainPrivateIdentifierInExpression(parameterDecorators) {
81073
- return ts.some(parameterDecorators, decoratorContainsPrivateIdentifierInExpression);
81074
- }
81075
- function hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node) {
81076
- for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
81077
- var member = _a[_i];
81078
- if (!ts.canHaveDecorators(member))
81079
- continue;
81080
- var allDecorators = ts.getAllDecoratorsOfClassElement(member, node);
81081
- if (ts.some(allDecorators === null || allDecorators === void 0 ? void 0 : allDecorators.decorators, decoratorContainsPrivateIdentifierInExpression))
81082
- return true;
81083
- if (ts.some(allDecorators === null || allDecorators === void 0 ? void 0 : allDecorators.parameters, parameterDecoratorsContainPrivateIdentifierInExpression))
81084
- return true;
81085
- }
81086
- return false;
81087
- }
81088
- function transformDecoratorsOfClassElements(node, members) {
81089
- var decorationStatements = [];
81090
- addClassElementDecorationStatements(decorationStatements, node, false);
81091
- addClassElementDecorationStatements(decorationStatements, node, true);
81092
- if (hasClassElementWithDecoratorContainingPrivateIdentifierInExpression(node)) {
81093
- members = ts.setTextRange(factory.createNodeArray(__spreadArray(__spreadArray([], members, true), [
81094
- factory.createClassStaticBlockDeclaration(factory.createBlock(decorationStatements, true))
81095
- ], false)), members);
81096
- decorationStatements = undefined;
81097
- }
81098
- return { decorationStatements: decorationStatements, members: members };
81099
- }
81100
- function transformClassDeclarationWithoutClassDecorators(node, name) {
81101
- var _a;
81102
- var modifiers = ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier);
81103
- var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
81104
- var members = ts.visitNodes(node.members, visitor, ts.isClassElement);
81105
- var decorationStatements = [];
81106
- (_a = transformDecoratorsOfClassElements(node, members), members = _a.members, decorationStatements = _a.decorationStatements);
81107
- var updated = factory.updateClassDeclaration(node, modifiers, name, undefined, heritageClauses, members);
81108
- return ts.addRange([updated], decorationStatements);
80878
+ function createClassDeclarationHeadWithoutDecorators(node, name) {
80879
+ return factory.updateClassDeclaration(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), ts.visitNodes(node.members, visitor, ts.isClassElement));
81109
80880
  }
81110
- function transformClassDeclarationWithClassDecorators(node, name) {
81111
- var _a;
80881
+ function createClassDeclarationHeadWithDecorators(node, name) {
81112
80882
  var location = ts.moveRangePastModifiers(node);
81113
80883
  var classAlias = getClassAliasIfNeeded(node);
81114
80884
  var declName = languageVersion <= 2 ?
@@ -81116,8 +80886,6 @@ var ts;
81116
80886
  factory.getLocalName(node, false, true);
81117
80887
  var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
81118
80888
  var members = ts.visitNodes(node.members, visitor, ts.isClassElement);
81119
- var decorationStatements = [];
81120
- (_a = transformDecoratorsOfClassElements(node, members), members = _a.members, decorationStatements = _a.decorationStatements);
81121
80889
  var classExpression = factory.createClassExpression(undefined, name, undefined, heritageClauses, members);
81122
80890
  ts.setOriginalNode(classExpression, node);
81123
80891
  ts.setTextRange(classExpression, location);
@@ -81127,10 +80895,7 @@ var ts;
81127
80895
  ts.setOriginalNode(statement, node);
81128
80896
  ts.setTextRange(statement, location);
81129
80897
  ts.setCommentRange(statement, node);
81130
- var statements = [statement];
81131
- ts.addRange(statements, decorationStatements);
81132
- addConstructorDecorationStatement(statements, node);
81133
- return statements;
80898
+ return statement;
81134
80899
  }
81135
80900
  function visitClassExpression(node) {
81136
80901
  return factory.updateClassExpression(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), node.name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), ts.visitNodes(node.members, visitor, ts.isClassElement));
@@ -91674,6 +91439,7 @@ var ts;
91674
91439
  var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit;
91675
91440
  var bundleBuildInfo;
91676
91441
  var emitSkipped = false;
91442
+ var exportedModulesFromDeclarationEmit;
91677
91443
  enter();
91678
91444
  forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit), forceDtsEmit, onlyBuildInfo, !targetSourceFile);
91679
91445
  exit();
@@ -91682,6 +91448,7 @@ var ts;
91682
91448
  diagnostics: emitterDiagnostics.getDiagnostics(),
91683
91449
  emittedFiles: emittedFilesList,
91684
91450
  sourceMaps: sourceMapDataList,
91451
+ exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit
91685
91452
  };
91686
91453
  function emitSourceFileOrBundle(_a, sourceFileOrBundle) {
91687
91454
  var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
@@ -91741,7 +91508,7 @@ var ts;
91741
91508
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
91742
91509
  return;
91743
91510
  }
91744
- if (host.isEmitBlocked(jsFilePath) || compilerOptions.noEmit) {
91511
+ if ((jsFilePath && host.isEmitBlocked(jsFilePath)) || compilerOptions.noEmit) {
91745
91512
  emitSkipped = true;
91746
91513
  return;
91747
91514
  }
@@ -91766,7 +91533,7 @@ var ts;
91766
91533
  substituteNode: transform.substituteNode,
91767
91534
  });
91768
91535
  ts.Debug.assert(transform.transformed.length === 1, "Should only see one output from the transform");
91769
- printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, compilerOptions);
91536
+ printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform.transformed[0], printer, compilerOptions);
91770
91537
  transform.dispose();
91771
91538
  if (bundleBuildInfo)
91772
91539
  bundleBuildInfo.js = printer.bundleFileInfo;
@@ -91798,7 +91565,7 @@ var ts;
91798
91565
  noEmitHelpers: true,
91799
91566
  module: compilerOptions.module,
91800
91567
  target: compilerOptions.target,
91801
- sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
91568
+ sourceMap: compilerOptions.sourceMap,
91802
91569
  inlineSourceMap: compilerOptions.inlineSourceMap,
91803
91570
  extendedDiagnostics: compilerOptions.extendedDiagnostics,
91804
91571
  onlyPrintJsDocStyle: true,
@@ -91816,12 +91583,16 @@ var ts;
91816
91583
  emitSkipped = emitSkipped || declBlocked;
91817
91584
  if (!declBlocked || forceDtsEmit) {
91818
91585
  ts.Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform");
91819
- printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform, declarationPrinter, {
91820
- sourceMap: printerOptions.sourceMap,
91586
+ printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform.transformed[0], declarationPrinter, {
91587
+ sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
91821
91588
  sourceRoot: compilerOptions.sourceRoot,
91822
91589
  mapRoot: compilerOptions.mapRoot,
91823
91590
  extendedDiagnostics: compilerOptions.extendedDiagnostics,
91824
91591
  });
91592
+ if (forceDtsEmit && declarationTransform.transformed[0].kind === 305) {
91593
+ var sourceFile = declarationTransform.transformed[0];
91594
+ exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit;
91595
+ }
91825
91596
  }
91826
91597
  declarationTransform.dispose();
91827
91598
  if (bundleBuildInfo)
@@ -91840,8 +91611,7 @@ var ts;
91840
91611
  }
91841
91612
  ts.forEachChild(node, collectLinkedAliases);
91842
91613
  }
91843
- function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) {
91844
- var sourceFileOrBundle = transform.transformed[0];
91614
+ function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapOptions) {
91845
91615
  var bundle = sourceFileOrBundle.kind === 306 ? sourceFileOrBundle : undefined;
91846
91616
  var sourceFile = sourceFileOrBundle.kind === 305 ? sourceFileOrBundle : undefined;
91847
91617
  var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
@@ -91874,16 +91644,16 @@ var ts;
91874
91644
  var sourceMap = sourceMapGenerator.toString();
91875
91645
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
91876
91646
  if (printer.bundleFileInfo)
91877
- printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
91647
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
91878
91648
  }
91879
91649
  }
91880
91650
  else {
91881
91651
  writer.writeLine();
91882
91652
  }
91883
91653
  var text = writer.getText();
91884
- ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos, diagnostics: transform.diagnostics });
91654
+ ts.writeFile(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, { sourceMapUrlPos: sourceMapUrlPos });
91885
91655
  if (printer.bundleFileInfo)
91886
- printer.bundleFileInfo.hash = ts.computeSignature(text, ts.maybeBind(host, host.createHash));
91656
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
91887
91657
  writer.clear();
91888
91658
  }
91889
91659
  function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
@@ -92028,22 +91798,22 @@ var ts;
92028
91798
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
92029
91799
  if (!jsFileText)
92030
91800
  return jsFilePath;
92031
- if (ts.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
91801
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
92032
91802
  return jsFilePath;
92033
91803
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
92034
91804
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
92035
91805
  return sourceMapFilePath || "inline sourcemap decoding";
92036
- if (sourceMapFilePath && ts.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
91806
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
92037
91807
  return sourceMapFilePath;
92038
91808
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
92039
91809
  if (declarationFilePath && !declarationText)
92040
91810
  return declarationFilePath;
92041
- if (declarationFilePath && ts.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
91811
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
92042
91812
  return declarationFilePath;
92043
91813
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
92044
91814
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
92045
91815
  return declarationMapPath || "inline sourcemap decoding";
92046
- if (declarationMapPath && ts.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
91816
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
92047
91817
  return declarationMapPath;
92048
91818
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
92049
91819
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo, true);
@@ -92081,7 +91851,8 @@ var ts;
92081
91851
  var newBuildInfo = data.buildInfo;
92082
91852
  newBuildInfo.program = buildInfo.program;
92083
91853
  if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
92084
- newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, createHash, changedDtsData);
91854
+ newBuildInfo.program.outSignature = ts.computeSignature(changedDtsText, changedDtsData, createHash);
91855
+ newBuildInfo.program.dtsChangeTime = ts.getCurrentTime(host).getTime();
92085
91856
  }
92086
91857
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
92087
91858
  newBuildInfo.bundle.js.sources = js.sources;
@@ -97336,11 +97107,6 @@ var ts;
97336
97107
  }
97337
97108
  ts.getConfigFileParsingDiagnostics = getConfigFileParsingDiagnostics;
97338
97109
  function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
97339
- var result = getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options);
97340
- return typeof result === "object" ? result.impliedNodeFormat : result;
97341
- }
97342
- ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
97343
- function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
97344
97110
  switch (ts.getEmitModuleResolutionKind(options)) {
97345
97111
  case ts.ModuleResolutionKind.Node16:
97346
97112
  case ts.ModuleResolutionKind.NodeNext:
@@ -97352,16 +97118,11 @@ var ts;
97352
97118
  return undefined;
97353
97119
  }
97354
97120
  function lookupFromPackageJson() {
97355
- var state = ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
97356
- var packageJsonLocations = [];
97357
- state.failedLookupLocations = packageJsonLocations;
97358
- state.affectingLocations = packageJsonLocations;
97359
- var packageJsonScope = ts.getPackageScopeForPath(fileName, state);
97360
- var impliedNodeFormat = (packageJsonScope === null || packageJsonScope === void 0 ? void 0 : packageJsonScope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
97361
- return { impliedNodeFormat: impliedNodeFormat, packageJsonLocations: packageJsonLocations, packageJsonScope: packageJsonScope };
97121
+ var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
97122
+ return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
97362
97123
  }
97363
97124
  }
97364
- ts.getImpliedNodeFormatForFileWorker = getImpliedNodeFormatForFileWorker;
97125
+ ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
97365
97126
  ts.plainJSErrors = new ts.Set([
97366
97127
  ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
97367
97128
  ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
@@ -97639,7 +97400,7 @@ var ts;
97639
97400
  for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) {
97640
97401
  var oldSourceFile = oldSourceFiles_1[_i];
97641
97402
  var newFile = getSourceFileByPath(oldSourceFile.resolvedPath);
97642
- if (shouldCreateNewSourceFile || !newFile || newFile.impliedNodeFormat !== oldSourceFile.impliedNodeFormat ||
97403
+ if (shouldCreateNewSourceFile || !newFile ||
97643
97404
  (oldSourceFile.resolvedPath === oldSourceFile.path && newFile.resolvedPath !== oldSourceFile.path)) {
97644
97405
  host.onReleaseOldSourceFile(oldSourceFile, oldProgram.getCompilerOptions(), !!getSourceFileByPath(oldSourceFile.path));
97645
97406
  }
@@ -97969,7 +97730,7 @@ var ts;
97969
97730
  });
97970
97731
  }
97971
97732
  function tryReuseStructureFromOldProgram() {
97972
- var _a, _b;
97733
+ var _a;
97973
97734
  if (!oldProgram) {
97974
97735
  return 0;
97975
97736
  }
@@ -97997,15 +97758,12 @@ var ts;
97997
97758
  var seenPackageNames = new ts.Map();
97998
97759
  for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) {
97999
97760
  var oldSourceFile = oldSourceFiles_2[_i];
98000
- var sourceFileOptions = getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options);
98001
97761
  var newSourceFile = host.getSourceFileByPath
98002
- ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, sourceFileOptions, undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat)
98003
- : host.getSourceFile(oldSourceFile.fileName, sourceFileOptions, undefined, shouldCreateNewSourceFile || sourceFileOptions.impliedNodeFormat !== oldSourceFile.impliedNodeFormat);
97762
+ ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.resolvedPath, getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options), undefined, shouldCreateNewSourceFile)
97763
+ : host.getSourceFile(oldSourceFile.fileName, getCreateSourceFileOptions(oldSourceFile.fileName, moduleResolutionCache, host, options), undefined, shouldCreateNewSourceFile);
98004
97764
  if (!newSourceFile) {
98005
97765
  return 0;
98006
97766
  }
98007
- newSourceFile.packageJsonLocations = ((_a = sourceFileOptions.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) ? sourceFileOptions.packageJsonLocations : undefined;
98008
- newSourceFile.packageJsonScope = sourceFileOptions.packageJsonScope;
98009
97767
  ts.Debug.assert(!newSourceFile.redirectInfo, "Host should not return a redirect source file from `getSourceFile`");
98010
97768
  var fileChanged = void 0;
98011
97769
  if (oldSourceFile.redirectInfo) {
@@ -98038,32 +97796,27 @@ var ts;
98038
97796
  seenPackageNames.set(packageName, newKind);
98039
97797
  }
98040
97798
  if (fileChanged) {
98041
- if (oldSourceFile.impliedNodeFormat !== newSourceFile.impliedNodeFormat) {
97799
+ if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
98042
97800
  structureIsReused = 1;
98043
97801
  }
98044
- else if (!ts.arrayIsEqualTo(oldSourceFile.libReferenceDirectives, newSourceFile.libReferenceDirectives, fileReferenceIsEqualTo)) {
97802
+ if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
98045
97803
  structureIsReused = 1;
98046
97804
  }
98047
- else if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) {
97805
+ if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
98048
97806
  structureIsReused = 1;
98049
97807
  }
98050
- else if (!ts.arrayIsEqualTo(oldSourceFile.referencedFiles, newSourceFile.referencedFiles, fileReferenceIsEqualTo)) {
97808
+ collectExternalModuleReferences(newSourceFile);
97809
+ if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
98051
97810
  structureIsReused = 1;
98052
97811
  }
98053
- else {
98054
- collectExternalModuleReferences(newSourceFile);
98055
- if (!ts.arrayIsEqualTo(oldSourceFile.imports, newSourceFile.imports, moduleNameIsEqualTo)) {
98056
- structureIsReused = 1;
98057
- }
98058
- else if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
98059
- structureIsReused = 1;
98060
- }
98061
- else if ((oldSourceFile.flags & 6291456) !== (newSourceFile.flags & 6291456)) {
98062
- structureIsReused = 1;
98063
- }
98064
- else if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
98065
- structureIsReused = 1;
98066
- }
97812
+ if (!ts.arrayIsEqualTo(oldSourceFile.moduleAugmentations, newSourceFile.moduleAugmentations, moduleNameIsEqualTo)) {
97813
+ structureIsReused = 1;
97814
+ }
97815
+ if ((oldSourceFile.flags & 6291456) !== (newSourceFile.flags & 6291456)) {
97816
+ structureIsReused = 1;
97817
+ }
97818
+ if (!ts.arrayIsEqualTo(oldSourceFile.typeReferenceDirectives, newSourceFile.typeReferenceDirectives, fileReferenceIsEqualTo)) {
97819
+ structureIsReused = 1;
98067
97820
  }
98068
97821
  modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
98069
97822
  }
@@ -98077,17 +97830,17 @@ var ts;
98077
97830
  return structureIsReused;
98078
97831
  }
98079
97832
  var modifiedFiles = modifiedSourceFiles.map(function (f) { return f.oldFile; });
98080
- for (var _c = 0, oldSourceFiles_3 = oldSourceFiles; _c < oldSourceFiles_3.length; _c++) {
98081
- var oldFile = oldSourceFiles_3[_c];
97833
+ for (var _b = 0, oldSourceFiles_3 = oldSourceFiles; _b < oldSourceFiles_3.length; _b++) {
97834
+ var oldFile = oldSourceFiles_3[_b];
98082
97835
  if (!ts.contains(modifiedFiles, oldFile)) {
98083
- for (var _d = 0, _e = oldFile.ambientModuleNames; _d < _e.length; _d++) {
98084
- var moduleName = _e[_d];
97836
+ for (var _c = 0, _d = oldFile.ambientModuleNames; _c < _d.length; _c++) {
97837
+ var moduleName = _d[_c];
98085
97838
  ambientModuleNameToUnmodifiedFileName.set(moduleName, oldFile.fileName);
98086
97839
  }
98087
97840
  }
98088
97841
  }
98089
- for (var _f = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _f < modifiedSourceFiles_1.length; _f++) {
98090
- var _g = modifiedSourceFiles_1[_f], oldSourceFile = _g.oldFile, newSourceFile = _g.newFile;
97842
+ for (var _e = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _e < modifiedSourceFiles_1.length; _e++) {
97843
+ var _f = modifiedSourceFiles_1[_e], oldSourceFile = _f.oldFile, newSourceFile = _f.newFile;
98091
97844
  var moduleNames = getModuleNames(newSourceFile);
98092
97845
  var resolutions = resolveModuleNamesReusingOldState(moduleNames, newSourceFile);
98093
97846
  var resolutionsChanged = ts.hasChangesInResolutions(moduleNames, resolutions, oldSourceFile.resolvedModules, oldSourceFile, ts.moduleResolutionIsEqualTo);
@@ -98112,13 +97865,13 @@ var ts;
98112
97865
  if (structureIsReused !== 2) {
98113
97866
  return structureIsReused;
98114
97867
  }
98115
- if (ts.changesAffectingProgramStructure(oldOptions, options) || ((_b = host.hasChangedAutomaticTypeDirectiveNames) === null || _b === void 0 ? void 0 : _b.call(host))) {
97868
+ if (ts.changesAffectingProgramStructure(oldOptions, options) || ((_a = host.hasChangedAutomaticTypeDirectiveNames) === null || _a === void 0 ? void 0 : _a.call(host))) {
98116
97869
  return 1;
98117
97870
  }
98118
97871
  missingFilePaths = oldProgram.getMissingFilePaths();
98119
97872
  ts.Debug.assert(newSourceFiles.length === oldProgram.getSourceFiles().length);
98120
- for (var _h = 0, newSourceFiles_1 = newSourceFiles; _h < newSourceFiles_1.length; _h++) {
98121
- var newSourceFile = newSourceFiles_1[_h];
97873
+ for (var _g = 0, newSourceFiles_1 = newSourceFiles; _g < newSourceFiles_1.length; _g++) {
97874
+ var newSourceFile = newSourceFiles_1[_g];
98122
97875
  filesByName.set(newSourceFile.path, newSourceFile);
98123
97876
  }
98124
97877
  var oldFilesByNameMap = oldProgram.getFilesByNameMap();
@@ -98849,14 +98602,14 @@ var ts;
98849
98602
  return result;
98850
98603
  }
98851
98604
  function getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options) {
98852
- var result = getImpliedNodeFormatForFileWorker(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
98853
- var languageVersion = ts.getEmitScriptTarget(options);
98854
- var setExternalModuleIndicator = ts.getSetExternalModuleIndicator(options);
98855
- return typeof result === "object" ? __assign(__assign({}, result), { languageVersion: languageVersion, setExternalModuleIndicator: setExternalModuleIndicator }) :
98856
- { languageVersion: languageVersion, impliedNodeFormat: result, setExternalModuleIndicator: setExternalModuleIndicator };
98605
+ var impliedNodeFormat = getImpliedNodeFormatForFile(toPath(fileName), moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache(), host, options);
98606
+ return {
98607
+ languageVersion: ts.getEmitScriptTarget(options),
98608
+ impliedNodeFormat: impliedNodeFormat,
98609
+ setExternalModuleIndicator: ts.getSetExternalModuleIndicator(options)
98610
+ };
98857
98611
  }
98858
98612
  function findSourceFileWorker(fileName, isDefaultLib, ignoreNoDefaultLib, reason, packageId) {
98859
- var _a, _b;
98860
98613
  var path = toPath(fileName);
98861
98614
  if (useSourceOfProjectReferenceRedirect) {
98862
98615
  var source = getSourceOfProjectReferenceRedirect(path);
@@ -98926,8 +98679,7 @@ var ts;
98926
98679
  redirectedPath = toPath(redirect);
98927
98680
  }
98928
98681
  }
98929
- var sourceFileOptions = getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options);
98930
- var file = host.getSourceFile(fileName, sourceFileOptions, function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(undefined, reason, ts.Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]); }, shouldCreateNewSourceFile || (((_a = oldProgram === null || oldProgram === void 0 ? void 0 : oldProgram.getSourceFileByPath(toPath(fileName))) === null || _a === void 0 ? void 0 : _a.impliedNodeFormat) !== sourceFileOptions.impliedNodeFormat));
98682
+ var file = host.getSourceFile(fileName, getCreateSourceFileOptions(fileName, moduleResolutionCache, host, options), function (hostErrorMessage) { return addFilePreprocessingFileExplainingDiagnostic(undefined, reason, ts.Diagnostics.Cannot_read_file_0_Colon_1, [fileName, hostErrorMessage]); }, shouldCreateNewSourceFile);
98931
98683
  if (packageId) {
98932
98684
  var packageIdKey = ts.packageIdToString(packageId);
98933
98685
  var fileFromPackageId = packageIdToSourceFile.get(packageIdKey);
@@ -98952,8 +98704,6 @@ var ts;
98952
98704
  file.path = path;
98953
98705
  file.resolvedPath = toPath(fileName);
98954
98706
  file.originalFileName = originalFileName;
98955
- file.packageJsonLocations = ((_b = sourceFileOptions.packageJsonLocations) === null || _b === void 0 ? void 0 : _b.length) ? sourceFileOptions.packageJsonLocations : undefined;
98956
- file.packageJsonScope = sourceFileOptions.packageJsonScope;
98957
98707
  addFileIncludeReason(file, reason);
98958
98708
  if (host.useCaseSensitiveFileNames()) {
98959
98709
  var pathLowerCase = ts.toFileNameLowerCase(path);
@@ -99086,7 +98836,7 @@ var ts;
99086
98836
  }
99087
98837
  }
99088
98838
  function processTypeReferenceDirective(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
99089
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolvedTypeReferenceDirective, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined });
98839
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("program", "processTypeReferenceDirective", { directive: typeReferenceDirective, hasResolved: !!resolveModuleNamesReusingOldState, refKind: reason.kind, refPath: isReferencedFile(reason) ? reason.file : undefined });
99090
98840
  processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason);
99091
98841
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
99092
98842
  }
@@ -99530,7 +99280,7 @@ var ts;
99530
99280
  fileIncludeReasons = undefined;
99531
99281
  var location = locationReason && getReferencedFileLocation(getSourceFileByPath, locationReason);
99532
99282
  var fileIncludeReasonDetails = fileIncludeReasons && ts.chainDiagnosticMessages(fileIncludeReasons, ts.Diagnostics.The_file_is_in_the_program_because_Colon);
99533
- var redirectInfo = file && ts.explainIfFileIsRedirectAndImpliedFormat(file);
99283
+ var redirectInfo = file && ts.explainIfFileIsRedirect(file);
99534
99284
  var chain = ts.chainDiagnosticMessages.apply(void 0, __spreadArray([redirectInfo ? fileIncludeReasonDetails ? __spreadArray([fileIncludeReasonDetails], redirectInfo, true) : redirectInfo : fileIncludeReasonDetails, diagnostic], args || ts.emptyArray, false));
99535
99285
  return location && isReferenceFileLocation(location) ?
99536
99286
  ts.createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) :
@@ -100075,8 +99825,8 @@ var ts;
100075
99825
  (function (ts) {
100076
99826
  function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers, forceDtsEmit) {
100077
99827
  var outputFiles = [];
100078
- var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics;
100079
- return { outputFiles: outputFiles, emitSkipped: emitSkipped, diagnostics: diagnostics };
99828
+ var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics, exportedModulesFromDeclarationEmit = _a.exportedModulesFromDeclarationEmit;
99829
+ return { outputFiles: outputFiles, emitSkipped: emitSkipped, diagnostics: diagnostics, exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit };
100080
99830
  function writeFile(fileName, text, writeByteOrderMark) {
100081
99831
  outputFiles.push({ name: fileName, writeByteOrderMark: writeByteOrderMark, text: text });
100082
99832
  }
@@ -100267,23 +100017,23 @@ var ts;
100267
100017
  state.allFileNames = undefined;
100268
100018
  }
100269
100019
  BuilderState.releaseCache = releaseCache;
100270
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
100020
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
100271
100021
  var _a, _b;
100272
- var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName);
100022
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
100273
100023
  (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
100274
100024
  (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
100275
100025
  return result;
100276
100026
  }
100277
100027
  BuilderState.getFilesAffectedBy = getFilesAffectedBy;
100278
- function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
100028
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
100279
100029
  var sourceFile = programOfThisState.getSourceFileByPath(path);
100280
100030
  if (!sourceFile) {
100281
100031
  return ts.emptyArray;
100282
100032
  }
100283
- if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
100033
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
100284
100034
  return [sourceFile];
100285
100035
  }
100286
- return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName);
100036
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
100287
100037
  }
100288
100038
  BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
100289
100039
  function updateSignatureOfFile(state, signature, path) {
@@ -100291,7 +100041,7 @@ var ts;
100291
100041
  (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
100292
100042
  }
100293
100043
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
100294
- function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName, useFileVersionAsSignature) {
100044
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
100295
100045
  var _a;
100296
100046
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
100297
100047
  if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
@@ -100300,13 +100050,15 @@ var ts;
100300
100050
  var prevSignature = info.signature;
100301
100051
  var latestSignature;
100302
100052
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
100303
- programOfThisState.emit(sourceFile, function (fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) {
100304
- ts.Debug.assert(ts.isDeclarationFileName(fileName), "File extension for signature expected to be dts: Got:: " + fileName);
100305
- latestSignature = ts.computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data);
100053
+ var emitOutput_1 = getFileEmitOutput(programOfThisState, sourceFile, true, cancellationToken, undefined, true);
100054
+ var firstDts_1 = ts.firstOrUndefined(emitOutput_1.outputFiles);
100055
+ if (firstDts_1) {
100056
+ ts.Debug.assert(ts.isDeclarationFileName(firstDts_1.name), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
100057
+ latestSignature = computeSignature(firstDts_1.text, computeHash);
100306
100058
  if (latestSignature !== prevSignature) {
100307
- updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
100059
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
100308
100060
  }
100309
- }, cancellationToken, true, undefined, true);
100061
+ }
100310
100062
  }
100311
100063
  if (latestSignature === undefined) {
100312
100064
  latestSignature = sourceFile.version;
@@ -100327,6 +100079,10 @@ var ts;
100327
100079
  return latestSignature !== prevSignature;
100328
100080
  }
100329
100081
  BuilderState.updateShapeSignature = updateShapeSignature;
100082
+ function computeSignature(text, computeHash) {
100083
+ return (computeHash || ts.generateDjb2Hash)(text);
100084
+ }
100085
+ BuilderState.computeSignature = computeSignature;
100330
100086
  function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
100331
100087
  if (!state.exportedModulesMap)
100332
100088
  return;
@@ -100436,7 +100192,7 @@ var ts;
100436
100192
  }
100437
100193
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
100438
100194
  }
100439
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash, getCanonicalFileName) {
100195
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
100440
100196
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
100441
100197
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
100442
100198
  }
@@ -100452,7 +100208,7 @@ var ts;
100452
100208
  if (!seenFileNamesMap.has(currentPath)) {
100453
100209
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
100454
100210
  seenFileNamesMap.set(currentPath, currentSourceFile);
100455
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
100211
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
100456
100212
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
100457
100213
  }
100458
100214
  }
@@ -100480,7 +100236,7 @@ var ts;
100480
100236
  state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
100481
100237
  }
100482
100238
  state.changedFilesSet = new ts.Set();
100483
- state.latestChangedDtsFile = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.latestChangedDtsFile : undefined;
100239
+ state.dtsChangeTime = compilerOptions.composite ? oldState === null || oldState === void 0 ? void 0 : oldState.dtsChangeTime : undefined;
100484
100240
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
100485
100241
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
100486
100242
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
@@ -100587,7 +100343,7 @@ var ts;
100587
100343
  programEmitComplete: state.programEmitComplete,
100588
100344
  emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
100589
100345
  outSignature: state.outSignature,
100590
- latestChangedDtsFile: state.latestChangedDtsFile,
100346
+ dtsChangeTime: state.dtsChangeTime,
100591
100347
  hasChangedEmitSignature: state.hasChangedEmitSignature,
100592
100348
  changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
100593
100349
  };
@@ -100600,7 +100356,7 @@ var ts;
100600
100356
  state.programEmitComplete = savedEmitState.programEmitComplete;
100601
100357
  state.emitSignatures = savedEmitState.emitSignatures;
100602
100358
  state.outSignature = savedEmitState.outSignature;
100603
- state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
100359
+ state.dtsChangeTime = savedEmitState.dtsChangeTime;
100604
100360
  state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
100605
100361
  if (savedEmitState.changedFilesSet)
100606
100362
  state.changedFilesSet = savedEmitState.changedFilesSet;
@@ -100608,7 +100364,7 @@ var ts;
100608
100364
  function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
100609
100365
  ts.Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
100610
100366
  }
100611
- function getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host) {
100367
+ function getNextAffectedFile(state, cancellationToken, computeHash, host) {
100612
100368
  var _a, _b;
100613
100369
  while (true) {
100614
100370
  var affectedFiles = state.affectedFiles;
@@ -100619,7 +100375,7 @@ var ts;
100619
100375
  var affectedFile = affectedFiles[affectedFilesIndex];
100620
100376
  if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
100621
100377
  state.affectedFilesIndex = affectedFilesIndex;
100622
- handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
100378
+ handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
100623
100379
  return affectedFile;
100624
100380
  }
100625
100381
  affectedFilesIndex++;
@@ -100640,7 +100396,7 @@ var ts;
100640
100396
  ts.Debug.assert(!state.semanticDiagnosticsPerFile);
100641
100397
  return program;
100642
100398
  }
100643
- state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash, getCanonicalFileName);
100399
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
100644
100400
  state.currentChangedFilePath = nextKey.value;
100645
100401
  state.affectedFilesIndex = 0;
100646
100402
  if (!state.seenAffectedFiles)
@@ -100683,24 +100439,24 @@ var ts;
100683
100439
  });
100684
100440
  }
100685
100441
  }
100686
- function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
100442
+ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
100687
100443
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
100688
100444
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
100689
100445
  removeDiagnosticsOfLibraryFiles(state);
100690
- ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash, getCanonicalFileName);
100446
+ ts.BuilderState.updateShapeSignature(state, ts.Debug.checkDefined(state.program), affectedFile, cancellationToken, computeHash);
100691
100447
  return;
100692
100448
  }
100693
100449
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
100694
100450
  return;
100695
- handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
100451
+ handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
100696
100452
  }
100697
- function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, getCanonicalFileName, host) {
100453
+ function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
100698
100454
  removeSemanticDiagnosticsOf(state, path);
100699
100455
  if (!state.changedFilesSet.has(path)) {
100700
100456
  var program = ts.Debug.checkDefined(state.program);
100701
100457
  var sourceFile = program.getSourceFileByPath(path);
100702
100458
  if (sourceFile) {
100703
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, getCanonicalFileName, !host.disableUseFileVersionAsSignature);
100459
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
100704
100460
  if (ts.getEmitDeclarations(state.compilerOptions)) {
100705
100461
  addToAffectedFilesPendingEmit(state, path, 0);
100706
100462
  }
@@ -100720,16 +100476,16 @@ var ts;
100720
100476
  var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
100721
100477
  return newSignature !== oldSignature;
100722
100478
  }
100723
- function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host) {
100479
+ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
100724
100480
  var _a;
100725
100481
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
100726
100482
  return false;
100727
100483
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, undefined)
100728
- .forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, getCanonicalFileName, host); });
100484
+ .forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
100729
100485
  removeDiagnosticsOfLibraryFiles(state);
100730
100486
  return true;
100731
100487
  }
100732
- function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
100488
+ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
100733
100489
  var _a;
100734
100490
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
100735
100491
  return;
@@ -100743,9 +100499,9 @@ var ts;
100743
100499
  var currentPath = queue.pop();
100744
100500
  if (!seenFileNamesMap.has(currentPath)) {
100745
100501
  seenFileNamesMap.set(currentPath, true);
100746
- if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host))
100502
+ if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
100747
100503
  return;
100748
- handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host);
100504
+ handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
100749
100505
  if (isChangedSignature(state, currentPath)) {
100750
100506
  var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
100751
100507
  queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
@@ -100755,27 +100511,27 @@ var ts;
100755
100511
  }
100756
100512
  var seenFileAndExportsOfFile = new ts.Set();
100757
100513
  (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
100758
- if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, getCanonicalFileName, host))
100514
+ if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
100759
100515
  return true;
100760
100516
  var references = state.referencedMap.getKeys(exportedFromPath);
100761
100517
  return references && ts.forEachKey(references, function (filePath) {
100762
- return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
100518
+ return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
100763
100519
  });
100764
100520
  });
100765
100521
  }
100766
- function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host) {
100522
+ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
100767
100523
  var _a, _b;
100768
100524
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
100769
100525
  return undefined;
100770
- if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host))
100526
+ if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
100771
100527
  return true;
100772
- handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host);
100528
+ handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
100773
100529
  (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
100774
- return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
100530
+ return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
100775
100531
  });
100776
100532
  (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
100777
100533
  return !seenFileAndExportsOfFile.has(referencingFilePath) &&
100778
- handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, computeHash, getCanonicalFileName, host);
100534
+ handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, computeHash, host);
100779
100535
  });
100780
100536
  return undefined;
100781
100537
  }
@@ -100830,13 +100586,13 @@ var ts;
100830
100586
  return !!ts.outFile(info.options || {});
100831
100587
  }
100832
100588
  ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
100833
- function getProgramBuildInfo(state, getCanonicalFileName) {
100589
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
100834
100590
  var outFilePath = ts.outFile(state.compilerOptions);
100835
100591
  if (outFilePath && !state.compilerOptions.composite)
100836
100592
  return;
100837
100593
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
100838
100594
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
100839
- var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
100595
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
100840
100596
  if (outFilePath) {
100841
100597
  var fileNames_1 = [];
100842
100598
  var fileInfos_1 = [];
@@ -100852,7 +100608,7 @@ var ts;
100852
100608
  fileInfos: fileInfos_1,
100853
100609
  options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
100854
100610
  outSignature: state.outSignature,
100855
- latestChangedDtsFile: latestChangedDtsFile,
100611
+ dtsChangeTime: state.dtsChangeTime,
100856
100612
  };
100857
100613
  return result_15;
100858
100614
  }
@@ -100947,7 +100703,7 @@ var ts;
100947
100703
  affectedFilesPendingEmit: affectedFilesPendingEmit,
100948
100704
  changeFileSet: changeFileSet,
100949
100705
  emitSignatures: emitSignatures,
100950
- latestChangedDtsFile: latestChangedDtsFile,
100706
+ dtsChangeTime: state.dtsChangeTime,
100951
100707
  };
100952
100708
  return result;
100953
100709
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
@@ -101059,39 +100815,8 @@ var ts;
101059
100815
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
101060
100816
  }
101061
100817
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
101062
- function getTextHandlingSourceMapForSignature(text, data) {
101063
- return (data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text;
101064
- }
101065
- function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data) {
101066
- var _a;
101067
- text = getTextHandlingSourceMapForSignature(text, data);
101068
- var sourceFileDirectory;
101069
- if ((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length) {
101070
- text += data.diagnostics.map(function (diagnostic) {
101071
- return "" + locationInfo(diagnostic) + ts.DiagnosticCategory[diagnostic.category] + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText);
101072
- }).join("\n");
101073
- }
101074
- return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(text);
101075
- function flattenDiagnosticMessageText(diagnostic) {
101076
- return ts.isString(diagnostic) ?
101077
- diagnostic :
101078
- diagnostic === undefined ?
101079
- "" :
101080
- !diagnostic.next ?
101081
- diagnostic.messageText :
101082
- diagnostic.messageText + diagnostic.next.map(flattenDiagnosticMessageText).join("\n");
101083
- }
101084
- function locationInfo(diagnostic) {
101085
- if (diagnostic.file.resolvedPath === sourceFile.resolvedPath)
101086
- return "(" + diagnostic.start + "," + diagnostic.length + ")";
101087
- if (sourceFileDirectory === undefined)
101088
- sourceFileDirectory = ts.getDirectoryPath(sourceFile.resolvedPath);
101089
- return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceFileDirectory, diagnostic.file.resolvedPath, getCanonicalFileName)) + "(" + diagnostic.start + "," + diagnostic.length + ")";
101090
- }
101091
- }
101092
- ts.computeSignatureWithDiagnostics = computeSignatureWithDiagnostics;
101093
- function computeSignature(text, computeHash, data) {
101094
- return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(getTextHandlingSourceMapForSignature(text, data));
100818
+ function computeSignature(text, data, computeHash) {
100819
+ return ts.BuilderState.computeSignature((data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text, computeHash);
101095
100820
  }
101096
100821
  ts.computeSignature = computeSignature;
101097
100822
  function createBuilderProgram(kind, _a) {
@@ -101105,7 +100830,7 @@ var ts;
101105
100830
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
101106
100831
  var computeHash = ts.maybeBind(host, host.createHash);
101107
100832
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
101108
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
100833
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
101109
100834
  newProgram = undefined;
101110
100835
  oldProgram = undefined;
101111
100836
  oldState = undefined;
@@ -101114,7 +100839,6 @@ var ts;
101114
100839
  builderProgram.getState = getState;
101115
100840
  builderProgram.saveEmitState = function () { return backupBuilderProgramEmitState(state); };
101116
100841
  builderProgram.restoreEmitState = function (saved) { return restoreBuilderProgramEmitState(state, saved); };
101117
- builderProgram.hasChangedEmitSignature = function () { return !!state.hasChangedEmitSignature; };
101118
100842
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
101119
100843
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
101120
100844
  builderProgram.emit = emit;
@@ -101140,7 +100864,7 @@ var ts;
101140
100864
  return ts.emitSkippedWithNoDiagnostics;
101141
100865
  }
101142
100866
  function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
101143
- var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
100867
+ var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
101144
100868
  var emitKind = 1;
101145
100869
  var isPendingEmitFile = false;
101146
100870
  if (!affected) {
@@ -101169,54 +100893,50 @@ var ts;
101169
100893
  }
101170
100894
  function getWriteFileCallback(writeFile, customTransformers) {
101171
100895
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
101172
- var _a, _b, _c, _d, _e, _f, _g;
100896
+ var _a, _b, _c;
101173
100897
  if (ts.isDeclarationFileName(fileName)) {
101174
100898
  if (!ts.outFile(state.compilerOptions)) {
101175
100899
  ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
101176
- var emitSignature = void 0;
100900
+ var newSignature = void 0;
101177
100901
  if (!customTransformers) {
101178
100902
  var file = sourceFiles[0];
101179
100903
  var info = state.fileInfos.get(file.resolvedPath);
101180
100904
  if (info.signature === file.version) {
101181
- var signature = computeSignatureWithDiagnostics(file, text, computeHash, getCanonicalFileName, data);
101182
- if (!((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length))
101183
- emitSignature = signature;
101184
- if (signature !== file.version) {
100905
+ newSignature = computeSignature(text, data, computeHash);
100906
+ if (newSignature !== file.version) {
101185
100907
  if (host.storeFilesChangingSignatureDuringEmit)
101186
- ((_b = state.filesChangingSignature) !== null && _b !== void 0 ? _b : (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
100908
+ (state.filesChangingSignature || (state.filesChangingSignature = new ts.Set())).add(file.resolvedPath);
101187
100909
  if (state.exportedModulesMap)
101188
100910
  ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
101189
100911
  if (state.affectedFiles) {
101190
- var existing = (_c = state.oldSignatures) === null || _c === void 0 ? void 0 : _c.get(file.resolvedPath);
100912
+ var existing = (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.get(file.resolvedPath);
101191
100913
  if (existing === undefined)
101192
- ((_d = state.oldSignatures) !== null && _d !== void 0 ? _d : (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
101193
- info.signature = signature;
100914
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
100915
+ info.signature = newSignature;
101194
100916
  }
101195
100917
  else {
101196
- info.signature = signature;
101197
- (_e = state.oldExportedModulesMap) === null || _e === void 0 ? void 0 : _e.clear();
100918
+ info.signature = newSignature;
100919
+ (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
101198
100920
  }
101199
100921
  }
101200
100922
  }
101201
100923
  }
101202
100924
  if (state.compilerOptions.composite) {
101203
100925
  var filePath = sourceFiles[0].resolvedPath;
101204
- var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
101205
- emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
101206
- if (emitSignature === oldSignature)
101207
- return;
101208
- ((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
101209
- state.hasChangedEmitSignature = true;
101210
- state.latestChangedDtsFile = fileName;
100926
+ var oldSignature = (_c = state.emitSignatures) === null || _c === void 0 ? void 0 : _c.get(filePath);
100927
+ newSignature || (newSignature = computeSignature(text, data, computeHash));
100928
+ if (newSignature !== oldSignature) {
100929
+ (state.emitSignatures || (state.emitSignatures = new ts.Map())).set(filePath, newSignature);
100930
+ state.hasChangedEmitSignature = true;
100931
+ }
101211
100932
  }
101212
100933
  }
101213
100934
  else if (state.compilerOptions.composite) {
101214
- var newSignature = computeSignature(text, computeHash, data);
101215
- if (newSignature === state.outSignature)
101216
- return;
101217
- state.outSignature = newSignature;
101218
- state.hasChangedEmitSignature = true;
101219
- state.latestChangedDtsFile = fileName;
100935
+ var newSignature = computeSignature(text, data, computeHash);
100936
+ if (newSignature !== state.outSignature) {
100937
+ state.outSignature = newSignature;
100938
+ state.hasChangedEmitSignature = true;
100939
+ }
101220
100940
  }
101221
100941
  }
101222
100942
  if (writeFile)
@@ -101272,7 +100992,7 @@ var ts;
101272
100992
  }
101273
100993
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
101274
100994
  while (true) {
101275
- var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
100995
+ var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
101276
100996
  if (!affected) {
101277
100997
  return undefined;
101278
100998
  }
@@ -101337,12 +101057,11 @@ var ts;
101337
101057
  var state;
101338
101058
  var filePaths;
101339
101059
  var filePathsSetList;
101340
- var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
101341
101060
  if (isProgramBundleEmitBuildInfo(program)) {
101342
101061
  state = {
101343
101062
  fileInfos: new ts.Map(),
101344
101063
  compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
101345
- latestChangedDtsFile: latestChangedDtsFile,
101064
+ dtsChangeTime: program.dtsChangeTime,
101346
101065
  outSignature: program.outSignature,
101347
101066
  };
101348
101067
  }
@@ -101375,7 +101094,7 @@ var ts;
101375
101094
  affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
101376
101095
  affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
101377
101096
  changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
101378
- latestChangedDtsFile: latestChangedDtsFile,
101097
+ dtsChangeTime: program.dtsChangeTime,
101379
101098
  emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
101380
101099
  };
101381
101100
  }
@@ -101402,7 +101121,6 @@ var ts;
101402
101121
  getSemanticDiagnosticsOfNextAffectedFile: ts.notImplemented,
101403
101122
  emitBuildInfo: ts.notImplemented,
101404
101123
  close: ts.noop,
101405
- hasChangedEmitSignature: ts.returnFalse,
101406
101124
  };
101407
101125
  function toPath(path) {
101408
101126
  return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
@@ -101497,7 +101215,7 @@ var ts;
101497
101215
  path;
101498
101216
  }
101499
101217
  ts.removeIgnoredPath = removeIgnoredPath;
101500
- function canWatchDirectoryOrFile(dirPath) {
101218
+ function canWatchDirectory(dirPath) {
101501
101219
  var rootLength = ts.getRootLength(dirPath);
101502
101220
  if (dirPath.length === rootLength) {
101503
101221
  return false;
@@ -101529,7 +101247,7 @@ var ts;
101529
101247
  }
101530
101248
  return true;
101531
101249
  }
101532
- ts.canWatchDirectoryOrFile = canWatchDirectoryOrFile;
101250
+ ts.canWatchDirectory = canWatchDirectory;
101533
101251
  function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
101534
101252
  var filesWithChangedSetOfUnresolvedImports;
101535
101253
  var filesWithInvalidatedResolutions;
@@ -101538,9 +101256,7 @@ var ts;
101538
101256
  var resolutionsWithFailedLookups = [];
101539
101257
  var resolutionsWithOnlyAffectingLocations = [];
101540
101258
  var resolvedFileToResolution = ts.createMultiMap();
101541
- var impliedFormatPackageJsons = new ts.Map();
101542
101259
  var hasChangedAutomaticTypeDirectiveNames = false;
101543
- var affectingPathChecksForFile;
101544
101260
  var affectingPathChecks;
101545
101261
  var failedLookupChecks;
101546
101262
  var startsWithPathChecks;
@@ -101566,7 +101282,7 @@ var ts;
101566
101282
  getModuleResolutionCache: function () { return moduleResolutionCache; },
101567
101283
  startRecordingFilesWithChangedResolutions: startRecordingFilesWithChangedResolutions,
101568
101284
  finishRecordingFilesWithChangedResolutions: finishRecordingFilesWithChangedResolutions,
101569
- startCachingPerDirectoryResolution: startCachingPerDirectoryResolution,
101285
+ startCachingPerDirectoryResolution: clearPerDirectoryResolutions,
101570
101286
  finishCachingPerDirectoryResolution: finishCachingPerDirectoryResolution,
101571
101287
  resolveModuleNames: resolveModuleNames,
101572
101288
  getResolvedModuleWithFailedLookupLocationsFromCache: getResolvedModuleWithFailedLookupLocationsFromCache,
@@ -101604,17 +101320,13 @@ var ts;
101604
101320
  resolvedModuleNames.clear();
101605
101321
  resolvedTypeReferenceDirectives.clear();
101606
101322
  resolvedFileToResolution.clear();
101607
- nonRelativeExternalModuleResolutions.clear();
101608
101323
  resolutionsWithFailedLookups.length = 0;
101609
101324
  resolutionsWithOnlyAffectingLocations.length = 0;
101610
101325
  failedLookupChecks = undefined;
101611
101326
  startsWithPathChecks = undefined;
101612
101327
  isInDirectoryChecks = undefined;
101613
101328
  affectingPathChecks = undefined;
101614
- affectingPathChecksForFile = undefined;
101615
- moduleResolutionCache.clear();
101616
- typeReferenceDirectiveResolutionCache.clear();
101617
- impliedFormatPackageJsons.clear();
101329
+ clearPerDirectoryResolutions();
101618
101330
  hasChangedAutomaticTypeDirectiveNames = false;
101619
101331
  }
101620
101332
  function startRecordingFilesWithChangedResolutions() {
@@ -101643,39 +101355,15 @@ var ts;
101643
101355
  return function (path) { return (!!collected && collected.has(path)) ||
101644
101356
  isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
101645
101357
  }
101646
- function startCachingPerDirectoryResolution() {
101647
- moduleResolutionCache.clearAllExceptPackageJsonInfoCache();
101648
- typeReferenceDirectiveResolutionCache.clearAllExceptPackageJsonInfoCache();
101649
- }
101650
- function finishCachingPerDirectoryResolution(newProgram, oldProgram) {
101651
- filesWithInvalidatedNonRelativeUnresolvedImports = undefined;
101358
+ function clearPerDirectoryResolutions() {
101359
+ moduleResolutionCache.clear();
101360
+ typeReferenceDirectiveResolutionCache.clear();
101652
101361
  nonRelativeExternalModuleResolutions.forEach(watchFailedLookupLocationOfNonRelativeModuleResolutions);
101653
101362
  nonRelativeExternalModuleResolutions.clear();
101654
- if (newProgram !== oldProgram) {
101655
- newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFiles().forEach(function (newFile) {
101656
- var _a, _b, _c;
101657
- var expected = ts.isExternalOrCommonJsModule(newFile) ? (_b = (_a = newFile.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0 : 0;
101658
- var existing = (_c = impliedFormatPackageJsons.get(newFile.path)) !== null && _c !== void 0 ? _c : ts.emptyArray;
101659
- for (var i = existing.length; i < expected; i++) {
101660
- createFileWatcherOfAffectingLocation(newFile.packageJsonLocations[i], false);
101661
- }
101662
- if (existing.length > expected) {
101663
- for (var i = expected; i < existing.length; i++) {
101664
- fileWatchesOfAffectingLocations.get(existing[i]).files--;
101665
- }
101666
- }
101667
- if (expected)
101668
- impliedFormatPackageJsons.set(newFile.path, newFile.packageJsonLocations);
101669
- else
101670
- impliedFormatPackageJsons.delete(newFile.path);
101671
- });
101672
- impliedFormatPackageJsons.forEach(function (existing, path) {
101673
- if (!(newProgram === null || newProgram === void 0 ? void 0 : newProgram.getSourceFileByPath(path))) {
101674
- existing.forEach(function (location) { return fileWatchesOfAffectingLocations.get(location).files--; });
101675
- impliedFormatPackageJsons.delete(path);
101676
- }
101677
- });
101678
- }
101363
+ }
101364
+ function finishCachingPerDirectoryResolution() {
101365
+ filesWithInvalidatedNonRelativeUnresolvedImports = undefined;
101366
+ clearPerDirectoryResolutions();
101679
101367
  directoryWatchesOfFailedLookups.forEach(function (watcher, path) {
101680
101368
  if (watcher.refCount === 0) {
101681
101369
  directoryWatchesOfFailedLookups.delete(path);
@@ -101683,7 +101371,7 @@ var ts;
101683
101371
  }
101684
101372
  });
101685
101373
  fileWatchesOfAffectingLocations.forEach(function (watcher, path) {
101686
- if (watcher.files === 0 && watcher.resolutions === 0) {
101374
+ if (watcher.refCount === 0) {
101687
101375
  fileWatchesOfAffectingLocations.delete(path);
101688
101376
  watcher.watcher.close();
101689
101377
  watcher.watcher = ts.noopFileWatcher;
@@ -101892,7 +101580,7 @@ var ts;
101892
101580
  dirPath = ts.getDirectoryPath(dirPath);
101893
101581
  }
101894
101582
  if (ts.isNodeModulesDirectory(dirPath)) {
101895
- return canWatchDirectoryOrFile(ts.getDirectoryPath(dirPath)) ? { dir: dir, dirPath: dirPath } : undefined;
101583
+ return canWatchDirectory(ts.getDirectoryPath(dirPath)) ? { dir: dir, dirPath: dirPath } : undefined;
101896
101584
  }
101897
101585
  var nonRecursive = true;
101898
101586
  var subDirectoryPath, subDirectory;
@@ -101909,7 +101597,7 @@ var ts;
101909
101597
  dir = ts.getDirectoryPath(dir);
101910
101598
  }
101911
101599
  }
101912
- return canWatchDirectoryOrFile(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive: nonRecursive } : undefined;
101600
+ return canWatchDirectory(dirPath) ? { dir: subDirectory || dir, dirPath: subDirectoryPath || dirPath, nonRecursive: nonRecursive } : undefined;
101913
101601
  }
101914
101602
  function isPathWithDefaultFailedLookupExtension(path) {
101915
101603
  return ts.fileExtensionIsOneOf(path, failedLookupDefaultExtensions);
@@ -101976,58 +101664,46 @@ var ts;
101976
101664
  resolutionsWithOnlyAffectingLocations.push(resolution);
101977
101665
  for (var _i = 0, affectingLocations_1 = affectingLocations; _i < affectingLocations_1.length; _i++) {
101978
101666
  var affectingLocation = affectingLocations_1[_i];
101979
- createFileWatcherOfAffectingLocation(affectingLocation, true);
101667
+ createFileWatcherOfAffectingLocation(affectingLocation);
101980
101668
  }
101981
101669
  }
101982
- function createFileWatcherOfAffectingLocation(affectingLocation, forResolution) {
101983
- var fileWatcher = fileWatchesOfAffectingLocations.get(affectingLocation);
101670
+ function createFileWatcherOfAffectingLocation(affectingLocation) {
101671
+ var path = resolutionHost.toPath(affectingLocation);
101672
+ var fileWatcher = fileWatchesOfAffectingLocations.get(path);
101984
101673
  if (fileWatcher) {
101985
- if (forResolution)
101986
- fileWatcher.resolutions++;
101987
- else
101988
- fileWatcher.files++;
101674
+ fileWatcher.refCount++;
101989
101675
  return;
101990
101676
  }
101991
101677
  var locationToWatch = affectingLocation;
101678
+ var locationToWatchPath = path;
101992
101679
  if (resolutionHost.realpath) {
101993
101680
  locationToWatch = resolutionHost.realpath(affectingLocation);
101994
- if (affectingLocation !== locationToWatch) {
101995
- var fileWatcher_1 = fileWatchesOfAffectingLocations.get(locationToWatch);
101681
+ locationToWatchPath = resolutionHost.toPath(locationToWatch);
101682
+ if (path !== locationToWatchPath) {
101683
+ var fileWatcher_1 = fileWatchesOfAffectingLocations.get(locationToWatchPath);
101996
101684
  if (fileWatcher_1) {
101997
- if (forResolution)
101998
- fileWatcher_1.resolutions++;
101999
- else
102000
- fileWatcher_1.files++;
102001
- fileWatcher_1.paths.add(affectingLocation);
102002
- fileWatchesOfAffectingLocations.set(affectingLocation, fileWatcher_1);
101685
+ fileWatcher_1.refCount++;
101686
+ fileWatcher_1.paths.add(path);
101687
+ fileWatchesOfAffectingLocations.set(path, fileWatcher_1);
102003
101688
  return;
102004
101689
  }
102005
101690
  }
102006
101691
  }
102007
101692
  var paths = new ts.Set();
102008
- paths.add(locationToWatch);
101693
+ paths.add(locationToWatchPath);
102009
101694
  var watcher = {
102010
- watcher: canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ?
102011
- resolutionHost.watchAffectingFileLocation(locationToWatch, function (fileName, eventKind) {
102012
- cachedDirectoryStructureHost === null || cachedDirectoryStructureHost === void 0 ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
102013
- paths.forEach(function (path) {
102014
- var _a;
102015
- if (watcher.resolutions)
102016
- (affectingPathChecks !== null && affectingPathChecks !== void 0 ? affectingPathChecks : (affectingPathChecks = new ts.Set())).add(path);
102017
- if (watcher.files)
102018
- (affectingPathChecksForFile !== null && affectingPathChecksForFile !== void 0 ? affectingPathChecksForFile : (affectingPathChecksForFile = new ts.Set())).add(path);
102019
- (_a = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap()) === null || _a === void 0 ? void 0 : _a.delete(resolutionHost.toPath(path));
102020
- });
102021
- resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
102022
- }) : ts.noopFileWatcher,
102023
- resolutions: forResolution ? 1 : 0,
102024
- files: forResolution ? 0 : 1,
101695
+ watcher: resolutionHost.watchAffectingFileLocation(locationToWatch, function (fileName, eventKind) {
101696
+ cachedDirectoryStructureHost === null || cachedDirectoryStructureHost === void 0 ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, path, eventKind);
101697
+ paths.forEach(function (path) { return (affectingPathChecks || (affectingPathChecks = new ts.Set())).add(path); });
101698
+ resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
101699
+ }),
101700
+ refCount: 1,
102025
101701
  paths: paths,
102026
101702
  };
102027
- fileWatchesOfAffectingLocations.set(locationToWatch, watcher);
102028
- if (affectingLocation !== locationToWatch) {
102029
- fileWatchesOfAffectingLocations.set(affectingLocation, watcher);
102030
- paths.add(affectingLocation);
101703
+ fileWatchesOfAffectingLocations.set(locationToWatchPath, watcher);
101704
+ if (path !== locationToWatchPath) {
101705
+ fileWatchesOfAffectingLocations.set(path, watcher);
101706
+ paths.add(path);
102031
101707
  }
102032
101708
  }
102033
101709
  function watchFailedLookupLocationOfNonRelativeModuleResolutions(resolutions, name) {
@@ -102095,8 +101771,8 @@ var ts;
102095
101771
  }
102096
101772
  for (var _a = 0, affectingLocations_2 = affectingLocations; _a < affectingLocations_2.length; _a++) {
102097
101773
  var affectingLocation = affectingLocations_2[_a];
102098
- var watcher = fileWatchesOfAffectingLocations.get(affectingLocation);
102099
- watcher.resolutions--;
101774
+ var watcher = fileWatchesOfAffectingLocations.get(resolutionHost.toPath(affectingLocation));
101775
+ watcher.refCount--;
102100
101776
  }
102101
101777
  }
102102
101778
  function removeDirectoryWatcher(dirPath) {
@@ -102145,7 +101821,7 @@ var ts;
102145
101821
  resolution.isInvalidated = invalidated = true;
102146
101822
  for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
102147
101823
  var containingFilePath = _b[_a];
102148
- (filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
101824
+ (filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
102149
101825
  hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames || ts.endsWith(containingFilePath, ts.inferredTypesContainingFile);
102150
101826
  }
102151
101827
  }
@@ -102198,25 +101874,10 @@ var ts;
102198
101874
  resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
102199
101875
  }
102200
101876
  function invalidateResolutionsOfFailedLookupLocations() {
102201
- var _a;
102202
- var invalidated = false;
102203
- if (affectingPathChecksForFile) {
102204
- (_a = resolutionHost.getCurrentProgram()) === null || _a === void 0 ? void 0 : _a.getSourceFiles().forEach(function (f) {
102205
- if (ts.some(f.packageJsonLocations, function (location) { return affectingPathChecksForFile.has(location); })) {
102206
- (filesWithInvalidatedResolutions !== null && filesWithInvalidatedResolutions !== void 0 ? filesWithInvalidatedResolutions : (filesWithInvalidatedResolutions = new ts.Set())).add(f.path);
102207
- invalidated = true;
102208
- }
102209
- });
102210
- affectingPathChecksForFile = undefined;
102211
- }
102212
101877
  if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks && !affectingPathChecks) {
102213
- return invalidated;
102214
- }
102215
- invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution) || invalidated;
102216
- var packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
102217
- if (packageJsonMap && (failedLookupChecks || startsWithPathChecks || isInDirectoryChecks)) {
102218
- packageJsonMap.forEach(function (_value, path) { return isInvalidatedFailedLookup(path) ? packageJsonMap.delete(path) : undefined; });
101878
+ return false;
102219
101879
  }
101880
+ var invalidated = invalidateResolutions(resolutionsWithFailedLookups, canInvalidateFailedLookupResolution);
102220
101881
  failedLookupChecks = undefined;
102221
101882
  startsWithPathChecks = undefined;
102222
101883
  isInDirectoryChecks = undefined;
@@ -102229,15 +101890,17 @@ var ts;
102229
101890
  return true;
102230
101891
  if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
102231
101892
  return false;
102232
- return resolution.failedLookupLocations.some(function (location) { return isInvalidatedFailedLookup(resolutionHost.toPath(location)); });
102233
- }
102234
- function isInvalidatedFailedLookup(locationPath) {
102235
- return (failedLookupChecks === null || failedLookupChecks === void 0 ? void 0 : failedLookupChecks.has(locationPath)) ||
102236
- ts.firstDefinedIterator((startsWithPathChecks === null || startsWithPathChecks === void 0 ? void 0 : startsWithPathChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return ts.startsWith(locationPath, fileOrDirectoryPath) ? true : undefined; }) ||
102237
- ts.firstDefinedIterator((isInDirectoryChecks === null || isInDirectoryChecks === void 0 ? void 0 : isInDirectoryChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : undefined; });
101893
+ return resolution.failedLookupLocations.some(function (location) {
101894
+ var locationPath = resolutionHost.toPath(location);
101895
+ return (failedLookupChecks === null || failedLookupChecks === void 0 ? void 0 : failedLookupChecks.has(locationPath)) ||
101896
+ ts.firstDefinedIterator((startsWithPathChecks === null || startsWithPathChecks === void 0 ? void 0 : startsWithPathChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return ts.startsWith(locationPath, fileOrDirectoryPath) ? true : undefined; }) ||
101897
+ ts.firstDefinedIterator((isInDirectoryChecks === null || isInDirectoryChecks === void 0 ? void 0 : isInDirectoryChecks.keys()) || ts.emptyIterator, function (fileOrDirectoryPath) { return isInDirectoryPath(fileOrDirectoryPath, locationPath) ? true : undefined; });
101898
+ });
102238
101899
  }
102239
101900
  function canInvalidatedFailedLookupResolutionWithAffectingLocation(resolution) {
102240
- return !!affectingPathChecks && resolution.affectingLocations.some(function (location) { return affectingPathChecks.has(location); });
101901
+ return !!affectingPathChecks && resolution.affectingLocations.some(function (location) {
101902
+ return affectingPathChecks.has(resolutionHost.toPath(location));
101903
+ });
102241
101904
  }
102242
101905
  function closeTypeRootsWatch() {
102243
101906
  ts.clearMap(typeRootsWatches, ts.closeFileWatcher);
@@ -102283,7 +101946,7 @@ var ts;
102283
101946
  function directoryExistsForTypeRootWatch(nodeTypesDirectory) {
102284
101947
  var dir = ts.getDirectoryPath(ts.getDirectoryPath(nodeTypesDirectory));
102285
101948
  var dirPath = resolutionHost.toPath(dir);
102286
- return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
101949
+ return dirPath === rootPath || canWatchDirectory(dirPath);
102287
101950
  }
102288
101951
  }
102289
101952
  ts.createResolutionCache = createResolutionCache;
@@ -102598,7 +102261,7 @@ var ts;
102598
102261
  importedFileFromNodeModules = importedFileFromNodeModules || isInNodeModules;
102599
102262
  });
102600
102263
  var sortedPaths = [];
102601
- var _loop_35 = function (directory) {
102264
+ var _loop_34 = function (directory) {
102602
102265
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
102603
102266
  var pathsInDirectory;
102604
102267
  allFileNames.forEach(function (_a, fileName) {
@@ -102622,7 +102285,7 @@ var ts;
102622
102285
  };
102623
102286
  var out_directory_1;
102624
102287
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
102625
- var state_11 = _loop_35(directory);
102288
+ var state_11 = _loop_34(directory);
102626
102289
  directory = out_directory_1;
102627
102290
  if (state_11 === "break")
102628
102291
  break;
@@ -103128,41 +102791,21 @@ var ts;
103128
102791
  var file = _c[_i];
103129
102792
  write("" + toFileName(file, relativeFileName));
103130
102793
  (_a = reasons.get(file.path)) === null || _a === void 0 ? void 0 : _a.forEach(function (reason) { return write(" " + fileIncludeReasonToDiagnostics(program, reason, relativeFileName).messageText); });
103131
- (_b = explainIfFileIsRedirectAndImpliedFormat(file, relativeFileName)) === null || _b === void 0 ? void 0 : _b.forEach(function (d) { return write(" " + d.messageText); });
102794
+ (_b = explainIfFileIsRedirect(file, relativeFileName)) === null || _b === void 0 ? void 0 : _b.forEach(function (d) { return write(" " + d.messageText); });
103132
102795
  }
103133
102796
  }
103134
102797
  ts.explainFiles = explainFiles;
103135
- function explainIfFileIsRedirectAndImpliedFormat(file, fileNameConvertor) {
103136
- var _a;
102798
+ function explainIfFileIsRedirect(file, fileNameConvertor) {
103137
102799
  var result;
103138
102800
  if (file.path !== file.resolvedPath) {
103139
- (result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_output_of_project_reference_source_0, toFileName(file.originalFileName, fileNameConvertor)));
102801
+ (result || (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_output_of_project_reference_source_0, toFileName(file.originalFileName, fileNameConvertor)));
103140
102802
  }
103141
102803
  if (file.redirectInfo) {
103142
- (result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_redirects_to_file_0, toFileName(file.redirectInfo.redirectTarget, fileNameConvertor)));
103143
- }
103144
- if (ts.isExternalOrCommonJsModule(file)) {
103145
- switch (file.impliedNodeFormat) {
103146
- case ts.ModuleKind.ESNext:
103147
- if (file.packageJsonScope) {
103148
- (result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_ECMAScript_module_because_0_has_field_type_with_value_module, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor)));
103149
- }
103150
- break;
103151
- case ts.ModuleKind.CommonJS:
103152
- if (file.packageJsonScope) {
103153
- (result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, file.packageJsonScope.packageJsonContent.type ?
103154
- ts.Diagnostics.File_is_CommonJS_module_because_0_has_field_type_whose_value_is_not_module :
103155
- ts.Diagnostics.File_is_CommonJS_module_because_0_does_not_have_field_type, toFileName(ts.last(file.packageJsonLocations), fileNameConvertor)));
103156
- }
103157
- else if ((_a = file.packageJsonLocations) === null || _a === void 0 ? void 0 : _a.length) {
103158
- (result !== null && result !== void 0 ? result : (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_is_CommonJS_module_because_package_json_was_not_found));
103159
- }
103160
- break;
103161
- }
102804
+ (result || (result = [])).push(ts.chainDiagnosticMessages(undefined, ts.Diagnostics.File_redirects_to_file_0, toFileName(file.redirectInfo.redirectTarget, fileNameConvertor)));
103162
102805
  }
103163
102806
  return result;
103164
102807
  }
103165
- ts.explainIfFileIsRedirectAndImpliedFormat = explainIfFileIsRedirectAndImpliedFormat;
102808
+ ts.explainIfFileIsRedirect = explainIfFileIsRedirect;
103166
102809
  function getMatchedFileSpec(program, fileName) {
103167
102810
  var _a;
103168
102811
  var configFile = program.getCompilerOptions().configFile;
@@ -103355,7 +102998,6 @@ var ts;
103355
102998
  MissingFile: "Missing file",
103356
102999
  WildcardDirectory: "Wild card directory",
103357
103000
  FailedLookupLocations: "Failed Lookup Locations",
103358
- AffectingFileLocation: "File location affecting resolution",
103359
103001
  TypeRoots: "Type roots",
103360
103002
  ConfigFileOfReferencedProject: "Config file of referened project",
103361
103003
  ExtendedConfigOfReferencedProject: "Extended config file of referenced project",
@@ -103416,6 +103058,7 @@ var ts;
103416
103058
  readDirectory: ts.maybeBind(host, host.readDirectory),
103417
103059
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
103418
103060
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
103061
+ now: ts.maybeBind(host, host.now),
103419
103062
  };
103420
103063
  function writeFile(fileName, text, writeByteOrderMark, onError) {
103421
103064
  try {
@@ -103554,6 +103197,7 @@ var ts;
103554
103197
  host.createHash = ts.maybeBind(system, system.createHash);
103555
103198
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
103556
103199
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
103200
+ host.now = ts.maybeBind(system, system.now);
103557
103201
  ts.setGetSourceFileAsHashVersioned(host, system);
103558
103202
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
103559
103203
  return host;
@@ -103604,6 +103248,7 @@ var ts;
103604
103248
  var parsedConfigs;
103605
103249
  var sharedExtendedConfigFileWatchers;
103606
103250
  var extendedConfigCache = host.extendedConfigCache;
103251
+ var changesAffectResolution = false;
103607
103252
  var reportFileChangeDetectedOnCreateProgram = false;
103608
103253
  var sourceFilesCache = new ts.Map();
103609
103254
  var missingFilePathsRequestedForRelease;
@@ -103657,7 +103302,7 @@ var ts;
103657
103302
  compilerHost.getCompilationSettings = function () { return compilerOptions; };
103658
103303
  compilerHost.useSourceOfProjectReferenceRedirect = ts.maybeBind(host, host.useSourceOfProjectReferenceRedirect);
103659
103304
  compilerHost.watchDirectoryOfFailedLookupLocation = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.FailedLookupLocations); };
103660
- compilerHost.watchAffectingFileLocation = function (file, cb) { return watchFile(file, cb, ts.PollingInterval.High, watchOptions, ts.WatchType.AffectingFileLocation); };
103305
+ compilerHost.watchAffectingFileLocation = function (file, cb) { return watchFile(file, cb, ts.PollingInterval.High, watchOptions, ts.WatchType.PackageJson); };
103661
103306
  compilerHost.watchTypeRootsDirectory = function (dir, cb, flags) { return watchDirectory(dir, cb, flags, watchOptions, ts.WatchType.TypeRoots); };
103662
103307
  compilerHost.getCachedDirectoryStructureHost = function () { return cachedDirectoryStructureHost; };
103663
103308
  compilerHost.scheduleInvalidateResolutionsOfFailedLookupLocations = scheduleInvalidateResolutionsOfFailedLookupLocations;
@@ -103688,9 +103333,6 @@ var ts;
103688
103333
  return host.resolveTypeReferenceDirectives.apply(host, args);
103689
103334
  }) :
103690
103335
  (function (typeDirectiveNames, containingFile, redirectedReference, _options, containingFileMode) { return resolutionCache.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile, redirectedReference, containingFileMode); });
103691
- compilerHost.getModuleResolutionCache = host.resolveModuleNames ?
103692
- ts.maybeBind(host, host.getModuleResolutionCache) :
103693
- (function () { return resolutionCache.getModuleResolutionCache(); });
103694
103336
  var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
103695
103337
  builderProgram = readBuilderProgram(compilerOptions, compilerHost);
103696
103338
  synchronizeProgram();
@@ -103751,11 +103393,11 @@ var ts;
103751
103393
  var program = getCurrentBuilderProgram();
103752
103394
  if (hasChangedCompilerOptions) {
103753
103395
  newLine = updateNewLine();
103754
- if (program && ts.changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
103396
+ if (program && (changesAffectResolution || ts.changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions))) {
103755
103397
  resolutionCache.clear();
103756
103398
  }
103757
103399
  }
103758
- var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
103400
+ var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution || changesAffectResolution);
103759
103401
  if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
103760
103402
  if (hasChangedConfigFileParsingErrors) {
103761
103403
  if (reportFileChangeDetectedOnCreateProgram) {
@@ -103771,6 +103413,7 @@ var ts;
103771
103413
  }
103772
103414
  createNewProgram(hasInvalidatedResolution);
103773
103415
  }
103416
+ changesAffectResolution = false;
103774
103417
  reportFileChangeDetectedOnCreateProgram = false;
103775
103418
  if (host.afterProgramCreate && program !== builderProgram) {
103776
103419
  host.afterProgramCreate(builderProgram);
@@ -103789,9 +103432,8 @@ var ts;
103789
103432
  resolutionCache.startCachingPerDirectoryResolution();
103790
103433
  compilerHost.hasInvalidatedResolution = hasInvalidatedResolution;
103791
103434
  compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
103792
- var oldProgram = getCurrentProgram();
103793
103435
  builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
103794
- resolutionCache.finishCachingPerDirectoryResolution(builderProgram.getProgram(), oldProgram);
103436
+ resolutionCache.finishCachingPerDirectoryResolution();
103795
103437
  ts.updateMissingFilePathsWatch(builderProgram.getProgram(), missingFilesMap || (missingFilesMap = new ts.Map()), watchMissingFilePath);
103796
103438
  if (needsUpdateInTypeRootWatch) {
103797
103439
  resolutionCache.updateTypeRootsWatch();
@@ -103861,6 +103503,9 @@ var ts;
103861
103503
  sourceFilesCache.set(path, false);
103862
103504
  }
103863
103505
  }
103506
+ if (sourceFile) {
103507
+ sourceFile.impliedNodeFormat = ts.getImpliedNodeFormatForFile(path, resolutionCache.getModuleResolutionCache().getPackageJsonInfoCache(), compilerHost, compilerHost.getCompilationSettings());
103508
+ }
103864
103509
  return sourceFile;
103865
103510
  }
103866
103511
  return hostSourceFile.sourceFile;
@@ -104313,7 +103958,6 @@ var ts;
104313
103958
  compilerHost.getParsedCommandLine = function (fileName) { return parseConfigFile(state, fileName, toResolvedConfigFilePath(state, fileName)); };
104314
103959
  compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
104315
103960
  compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
104316
- compilerHost.getModuleResolutionCache = ts.maybeBind(host, host.getModuleResolutionCache);
104317
103961
  var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
104318
103962
  var typeReferenceDirectiveResolutionCache = !compilerHost.resolveTypeReferenceDirectives ? ts.createTypeReferenceDirectiveResolutionCache(currentDirectory, getCanonicalFileName, undefined, moduleResolutionCache === null || moduleResolutionCache === void 0 ? void 0 : moduleResolutionCache.getPackageJsonInfoCache()) : undefined;
104319
103963
  if (!compilerHost.resolveModuleNames) {
@@ -104777,7 +104421,8 @@ var ts;
104777
104421
  };
104778
104422
  }
104779
104423
  var host = state.host, compilerHost = state.compilerHost;
104780
- var resultFlags = ((_d = program.hasChangedEmitSignature) === null || _d === void 0 ? void 0 : _d.call(program)) ? BuildResultFlags.None : BuildResultFlags.DeclarationOutputUnchanged;
104424
+ var resultFlags = BuildResultFlags.DeclarationOutputUnchanged;
104425
+ var existingBuildInfo = ((_d = state.buildInfoCache.get(projectPath)) === null || _d === void 0 ? void 0 : _d.buildInfo) || undefined;
104781
104426
  var emitterDiagnostics = ts.createDiagnosticCollection();
104782
104427
  var emittedOutputs = new ts.Map();
104783
104428
  var options = program.getCompilerOptions();
@@ -104785,11 +104430,16 @@ var ts;
104785
104430
  var outputTimeStampMap;
104786
104431
  var now;
104787
104432
  outputFiles.forEach(function (_a) {
104433
+ var _b, _c;
104788
104434
  var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
104789
104435
  var path = toPath(state, name);
104790
104436
  emittedOutputs.set(toPath(state, name), name);
104791
- if (buildInfo)
104792
- setBuildInfo(state, buildInfo, projectPath, options, resultFlags);
104437
+ if (buildInfo) {
104438
+ setBuildInfo(state, buildInfo, projectPath, options);
104439
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
104440
+ resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
104441
+ }
104442
+ }
104793
104443
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
104794
104444
  if (!isIncremental && state.watch) {
104795
104445
  (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
@@ -104803,7 +104453,7 @@ var ts;
104803
104453
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
104804
104454
  var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
104805
104455
  if (data === null || data === void 0 ? void 0 : data.buildInfo)
104806
- setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions(), BuildResultFlags.DeclarationOutputUnchanged);
104456
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
104807
104457
  if (writeFileCallback)
104808
104458
  writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
104809
104459
  else
@@ -104835,6 +104485,7 @@ var ts;
104835
104485
  state.diagnostics.delete(projectPath);
104836
104486
  state.projectStatus.set(projectPath, {
104837
104487
  type: ts.UpToDateStatusType.UpToDate,
104488
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
104838
104489
  oldestOutputFileName: oldestOutputFileName
104839
104490
  });
104840
104491
  afterProgramDone(state, program, config);
@@ -104874,10 +104525,10 @@ var ts;
104874
104525
  var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
104875
104526
  emittedOutputs.set(toPath(state, name), name);
104876
104527
  if (buildInfo) {
104877
- if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) {
104528
+ setBuildInfo(state, buildInfo, projectPath, config.options);
104529
+ if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.dtsChangeTime) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime)) {
104878
104530
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
104879
104531
  }
104880
- setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
104881
104532
  }
104882
104533
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
104883
104534
  });
@@ -105047,7 +104698,7 @@ var ts;
105047
104698
  }
105048
104699
  function afterProgramDone(state, program, config) {
105049
104700
  if (program) {
105050
- if (state.write)
104701
+ if (program && state.write)
105051
104702
  ts.listFiles(program, state.write);
105052
104703
  if (state.host.afterProgramEmitAndDiagnostics) {
105053
104704
  state.host.afterProgramEmitAndDiagnostics(program);
@@ -105126,23 +104777,15 @@ var ts;
105126
104777
  state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
105127
104778
  return result;
105128
104779
  }
105129
- function setBuildInfo(state, buildInfo, resolvedConfigPath, options, resultFlags) {
104780
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
105130
104781
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
105131
104782
  var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
105132
- var modifiedTime = getCurrentTime(state.host);
105133
104783
  if (existing) {
105134
104784
  existing.buildInfo = buildInfo;
105135
- existing.modifiedTime = modifiedTime;
105136
- if (!(resultFlags & BuildResultFlags.DeclarationOutputUnchanged))
105137
- existing.latestChangedDtsTime = modifiedTime;
104785
+ existing.modifiedTime = getCurrentTime(state.host);
105138
104786
  }
105139
104787
  else {
105140
- state.buildInfoCache.set(resolvedConfigPath, {
105141
- path: toPath(state, buildInfoPath),
105142
- buildInfo: buildInfo,
105143
- modifiedTime: modifiedTime,
105144
- latestChangedDtsTime: resultFlags & BuildResultFlags.DeclarationOutputUnchanged ? undefined : modifiedTime,
105145
- });
104788
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
105146
104789
  }
105147
104790
  }
105148
104791
  function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
@@ -105173,7 +104816,7 @@ var ts;
105173
104816
  }
105174
104817
  }
105175
104818
  function getUpToDateStatusWorker(state, project, resolvedPath) {
105176
- var _a, _b;
104819
+ var _a, _b, _c;
105177
104820
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
105178
104821
  return {
105179
104822
  type: ts.UpToDateStatusType.ContainerOnly
@@ -105183,8 +104826,8 @@ var ts;
105183
104826
  var force = !!state.options.force;
105184
104827
  if (project.projectReferences) {
105185
104828
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
105186
- for (var _i = 0, _c = project.projectReferences; _i < _c.length; _i++) {
105187
- var ref = _c[_i];
104829
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
104830
+ var ref = _d[_i];
105188
104831
  var resolvedRef = ts.resolveProjectReferencePath(ref);
105189
104832
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
105190
104833
  var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
@@ -105220,6 +104863,7 @@ var ts;
105220
104863
  var buildInfoTime;
105221
104864
  var buildInfoProgram;
105222
104865
  var buildInfoVersionMap;
104866
+ var newestDeclarationFileContentChangedTime;
105223
104867
  if (buildInfoPath) {
105224
104868
  var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
105225
104869
  buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
@@ -105255,12 +104899,13 @@ var ts;
105255
104899
  }
105256
104900
  oldestOutputFileTime = buildInfoTime;
105257
104901
  oldestOutputFileName = buildInfoPath;
104902
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
105258
104903
  }
105259
104904
  var newestInputFileName = undefined;
105260
104905
  var newestInputFileTime = minimumDate;
105261
104906
  var pseudoInputUpToDate = false;
105262
- for (var _d = 0, _e = project.fileNames; _d < _e.length; _d++) {
105263
- var inputFile = _e[_d];
104907
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
104908
+ var inputFile = _f[_e];
105264
104909
  var inputTime = getModifiedTime(state, inputFile);
105265
104910
  if (inputTime === ts.missingFileModifiedTime) {
105266
104911
  return {
@@ -105296,8 +104941,8 @@ var ts;
105296
104941
  if (!buildInfoPath) {
105297
104942
  var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
105298
104943
  var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
105299
- for (var _f = 0, outputs_1 = outputs; _f < outputs_1.length; _f++) {
105300
- var output = outputs_1[_f];
104944
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
104945
+ var output = outputs_1[_g];
105301
104946
  var path = toPath(state, output);
105302
104947
  var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
105303
104948
  if (!outputTime) {
@@ -105330,8 +104975,8 @@ var ts;
105330
104975
  var usesPrepend = false;
105331
104976
  var upstreamChangedProject;
105332
104977
  if (referenceStatuses) {
105333
- for (var _g = 0, referenceStatuses_1 = referenceStatuses; _g < referenceStatuses_1.length; _g++) {
105334
- var _h = referenceStatuses_1[_g], ref = _h.ref, refStatus = _h.refStatus, resolvedConfig = _h.resolvedConfig, resolvedRefPath = _h.resolvedRefPath;
104978
+ for (var _h = 0, referenceStatuses_1 = referenceStatuses; _h < referenceStatuses_1.length; _h++) {
104979
+ var _j = referenceStatuses_1[_h], ref = _j.ref, refStatus = _j.refStatus, resolvedConfig = _j.resolvedConfig, resolvedRefPath = _j.resolvedRefPath;
105335
104980
  usesPrepend = usesPrepend || !!(ref.prepend);
105336
104981
  if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
105337
104982
  continue;
@@ -105343,8 +104988,7 @@ var ts;
105343
104988
  newerProjectName: ref.path
105344
104989
  };
105345
104990
  }
105346
- var newestDeclarationFileContentChangedTime = getLatestChangedDtsTime(state, resolvedConfig.options, resolvedRefPath);
105347
- if (newestDeclarationFileContentChangedTime && newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
104991
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
105348
104992
  pseudoUpToDate = true;
105349
104993
  upstreamChangedProject = ref.path;
105350
104994
  continue;
@@ -105382,6 +105026,7 @@ var ts;
105382
105026
  pseudoInputUpToDate ?
105383
105027
  ts.UpToDateStatusType.UpToDateWithInputFileText :
105384
105028
  ts.UpToDateStatusType.UpToDate,
105029
+ newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
105385
105030
  newestInputFileTime: newestInputFileTime,
105386
105031
  newestInputFileName: newestInputFileName,
105387
105032
  oldestOutputFileName: oldestOutputFileName
@@ -105460,17 +105105,13 @@ var ts;
105460
105105
  outputTimeStampMap.delete(key);
105461
105106
  });
105462
105107
  }
105463
- function getLatestChangedDtsTime(state, options, resolvedConfigPath) {
105108
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
105109
+ var _a;
105464
105110
  if (!options.composite)
105465
105111
  return undefined;
105466
- var entry = ts.Debug.checkDefined(state.buildInfoCache.get(resolvedConfigPath));
105467
- if (entry.latestChangedDtsTime !== undefined)
105468
- return entry.latestChangedDtsTime || undefined;
105469
- var latestChangedDtsTime = entry.buildInfo && entry.buildInfo.program && entry.buildInfo.program.latestChangedDtsFile ?
105470
- state.host.getModifiedTime(ts.getNormalizedAbsolutePath(entry.buildInfo.program.latestChangedDtsFile, ts.getDirectoryPath(entry.path))) :
105471
- undefined;
105472
- entry.latestChangedDtsTime = latestChangedDtsTime || false;
105473
- return latestChangedDtsTime;
105112
+ var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
105113
+ var buildInfo = getBuildInfo(state, buildInfoPath, resolvedConfigPath, undefined);
105114
+ return ((_a = buildInfo === null || buildInfo === void 0 ? void 0 : buildInfo.program) === null || _a === void 0 ? void 0 : _a.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
105474
105115
  }
105475
105116
  function updateOutputTimestamps(state, proj, resolvedPath) {
105476
105117
  if (state.options.dry) {
@@ -105479,6 +105120,7 @@ var ts;
105479
105120
  updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
105480
105121
  state.projectStatus.set(resolvedPath, {
105481
105122
  type: ts.UpToDateStatusType.UpToDate,
105123
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
105482
105124
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
105483
105125
  });
105484
105126
  }