@typescript-deploys/pr-build 4.8.0-pr-50085-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.20220728";
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) {
@@ -5734,8 +5634,6 @@ var ts;
5734
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."),
5735
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."),
5736
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."),
5737
- 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."),
5738
- Identifier_or_string_literal_expected: diag(1478, ts.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."),
5739
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."),
5740
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."),
5741
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),
@@ -5949,7 +5847,6 @@ var ts;
5949
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."),
5950
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."),
5951
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."),
5952
- 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."),
5953
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}'."),
5954
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."),
5955
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."),
@@ -6237,7 +6134,6 @@ var ts;
6237
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'."),
6238
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?"),
6239
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."),
6240
- 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."),
6241
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}'."),
6242
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}'."),
6243
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}'."),
@@ -11466,6 +11362,17 @@ var ts;
11466
11362
  return ts.Debug.fail("Literal kind '" + node.kind + "' not accounted for.");
11467
11363
  }
11468
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;
11469
11376
  function canUseOriginalText(node, flags) {
11470
11377
  if (nodeIsSynthesized(node) || !node.parent || (flags & 4 && node.isUnterminated)) {
11471
11378
  return false;
@@ -15432,8 +15339,7 @@ var ts;
15432
15339
  function getDeclarationModifierFlagsFromSymbol(s, isWrite) {
15433
15340
  if (isWrite === void 0) { isWrite = false; }
15434
15341
  if (s.valueDeclaration) {
15435
- var declaration = (isWrite && s.declarations && ts.find(s.declarations, ts.isSetAccessorDeclaration))
15436
- || (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;
15437
15343
  var flags = ts.getCombinedModifierFlags(declaration);
15438
15344
  return s.parent && s.parent.flags & 32 ? flags : flags & ~28;
15439
15345
  }
@@ -16055,7 +15961,7 @@ var ts;
16055
15961
  return !file.isDeclarationFile ? walkTreeForJSXTags(file) : undefined;
16056
15962
  }
16057
15963
  function isFileForcedToBeModuleByFormat(file) {
16058
- 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;
16059
15965
  }
16060
15966
  function getSetExternalModuleIndicator(options) {
16061
15967
  switch (getEmitModuleDetectionKind(options)) {
@@ -16072,7 +15978,10 @@ var ts;
16072
15978
  if (options.jsx === 4 || options.jsx === 5) {
16073
15979
  checks.push(isFileModuleFromUsingJSXTag);
16074
15980
  }
16075
- checks.push(isFileForcedToBeModuleByFormat);
15981
+ var moduleKind = getEmitModuleKind(options);
15982
+ if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
15983
+ checks.push(isFileForcedToBeModuleByFormat);
15984
+ }
16076
15985
  var combined_1 = ts.or.apply(void 0, checks);
16077
15986
  var callback = function (file) { return void (file.externalModuleIndicator = combined_1(file)); };
16078
15987
  return callback;
@@ -26684,11 +26593,11 @@ var ts;
26684
26593
  }
26685
26594
  return parseElement();
26686
26595
  }
26687
- function currentNode(parsingContext, pos) {
26596
+ function currentNode(parsingContext) {
26688
26597
  if (!syntaxCursor || !isReusableParsingContext(parsingContext) || parseErrorBeforeNextFinishedNode) {
26689
26598
  return undefined;
26690
26599
  }
26691
- var node = syntaxCursor.currentNode(pos !== null && pos !== void 0 ? pos : scanner.getStartPos());
26600
+ var node = syntaxCursor.currentNode(scanner.getStartPos());
26692
26601
  if (ts.nodeIsMissing(node) || node.intersectsChange || ts.containsParseError(node)) {
26693
26602
  return undefined;
26694
26603
  }
@@ -26886,9 +26795,7 @@ var ts;
26886
26795
  case 23: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
26887
26796
  case 13: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
26888
26797
  case 14: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_expected);
26889
- case 24: return parseErrorAtCurrentToken(ts.Diagnostics.Identifier_or_string_literal_expected);
26890
- case 25: return ts.Debug.fail("ParsingContext.Count used as a context");
26891
- default: ts.Debug.assertNever(context);
26798
+ default: return [undefined];
26892
26799
  }
26893
26800
  }
26894
26801
  function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) {
@@ -27234,7 +27141,7 @@ var ts;
27234
27141
  if (allowAmbiguity === void 0) { allowAmbiguity = true; }
27235
27142
  var pos = getNodePos();
27236
27143
  var hasJSDoc = hasPrecedingJSDocComment();
27237
- var decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : doOutsideOfAwaitContext(parseDecorators);
27144
+ var decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : parseDecorators();
27238
27145
  if (token() === 108) {
27239
27146
  var node_1 = factory.createParameterDeclaration(decorators, undefined, createIdentifier(true), undefined, parseTypeAnnotation(), undefined);
27240
27147
  if (decorators) {
@@ -27410,10 +27317,10 @@ var ts;
27410
27317
  var hasJSDoc = hasPrecedingJSDocComment();
27411
27318
  var modifiers = parseModifiers();
27412
27319
  if (parseContextualModifier(136)) {
27413
- return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 172, 4);
27320
+ return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 172);
27414
27321
  }
27415
27322
  if (parseContextualModifier(149)) {
27416
- return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 173, 4);
27323
+ return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 173);
27417
27324
  }
27418
27325
  if (isIndexSignature()) {
27419
27326
  return parseIndexSignatureDeclaration(pos, hasJSDoc, undefined, modifiers);
@@ -28496,9 +28403,6 @@ var ts;
28496
28403
  var typeArguments = tryParse(parseTypeArgumentsInExpression);
28497
28404
  if (typeArguments !== undefined) {
28498
28405
  parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
28499
- if (!isTemplateStartOfTaggedTemplate()) {
28500
- expression = factory.createExpressionWithTypeArguments(expression, typeArguments);
28501
- }
28502
28406
  }
28503
28407
  }
28504
28408
  if (token() === 20 || token() === 24 || token() === 22) {
@@ -28778,11 +28682,6 @@ var ts;
28778
28682
  if (isOptionalChain && ts.isPrivateIdentifier(propertyAccess.name)) {
28779
28683
  parseErrorAtRange(propertyAccess.name, ts.Diagnostics.An_optional_chain_cannot_contain_private_identifiers);
28780
28684
  }
28781
- if (ts.isExpressionWithTypeArguments(expression) && expression.typeArguments) {
28782
- var pos_2 = expression.typeArguments.pos - 1;
28783
- var end = ts.skipTrivia(sourceText, expression.typeArguments.end) + 1;
28784
- parseErrorAt(pos_2, end, ts.Diagnostics.An_instantiation_expression_cannot_be_followed_by_a_property_access);
28785
- }
28786
28685
  return finishNode(propertyAccess, pos);
28787
28686
  }
28788
28687
  function parseElementAccessExpressionRest(pos, expression, questionDotToken) {
@@ -29007,10 +28906,10 @@ var ts;
29007
28906
  var decorators = parseDecorators();
29008
28907
  var modifiers = parseModifiers();
29009
28908
  if (parseContextualModifier(136)) {
29010
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172, 0);
28909
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172);
29011
28910
  }
29012
28911
  if (parseContextualModifier(149)) {
29013
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173, 0);
28912
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173);
29014
28913
  }
29015
28914
  var asteriskToken = parseOptionalToken(41);
29016
28915
  var tokenIsIdentifier = isIdentifier();
@@ -29551,16 +29450,18 @@ var ts;
29551
29450
  return modifier.kind === 135;
29552
29451
  }
29553
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
+ }
29554
29460
  var pos = getNodePos();
29555
29461
  var hasJSDoc = hasPrecedingJSDocComment();
29556
29462
  var decorators = parseDecorators();
29557
29463
  var modifiers = parseModifiers();
29558
- var isAmbient = ts.some(modifiers, isDeclareModifier);
29559
29464
  if (isAmbient) {
29560
- var node = tryReuseAmbientDeclaration(pos);
29561
- if (node) {
29562
- return node;
29563
- }
29564
29465
  for (var _i = 0, _a = modifiers; _i < _a.length; _i++) {
29565
29466
  var m = _a[_i];
29566
29467
  m.flags |= 16777216;
@@ -29571,9 +29472,9 @@ var ts;
29571
29472
  return parseDeclarationWorker(pos, hasJSDoc, decorators, modifiers);
29572
29473
  }
29573
29474
  }
29574
- function tryReuseAmbientDeclaration(pos) {
29475
+ function tryReuseAmbientDeclaration() {
29575
29476
  return doInsideOfContext(16777216, function () {
29576
- var node = currentNode(parsingContext, pos);
29477
+ var node = currentNode(parsingContext);
29577
29478
  if (node) {
29578
29479
  return consumeNode(node);
29579
29480
  }
@@ -29628,15 +29529,9 @@ var ts;
29628
29529
  return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 10);
29629
29530
  }
29630
29531
  function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) {
29631
- if (token() !== 18) {
29632
- if (flags & 4) {
29633
- parseTypeMemberSemicolon();
29634
- return;
29635
- }
29636
- if (canParseSemicolon()) {
29637
- parseSemicolon();
29638
- return;
29639
- }
29532
+ if (token() !== 18 && canParseSemicolon()) {
29533
+ parseSemicolon();
29534
+ return;
29640
29535
  }
29641
29536
  return parseFunctionBlock(flags, diagnosticMessage);
29642
29537
  }
@@ -29824,12 +29719,12 @@ var ts;
29824
29719
  }
29825
29720
  return parsePropertyDeclaration(pos, hasJSDoc, decorators, modifiers, name, questionToken);
29826
29721
  }
29827
- function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind, flags) {
29722
+ function parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, kind) {
29828
29723
  var name = parsePropertyName();
29829
29724
  var typeParameters = parseTypeParameters();
29830
29725
  var parameters = parseParameters(0);
29831
29726
  var type = parseReturnType(58, false);
29832
- var body = parseFunctionBlockOrSemicolon(flags);
29727
+ var body = parseFunctionBlockOrSemicolon(0);
29833
29728
  var node = kind === 172
29834
29729
  ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body)
29835
29730
  : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body);
@@ -29985,10 +29880,10 @@ var ts;
29985
29880
  return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers);
29986
29881
  }
29987
29882
  if (parseContextualModifier(136)) {
29988
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172, 0);
29883
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172);
29989
29884
  }
29990
29885
  if (parseContextualModifier(149)) {
29991
- return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173, 0);
29886
+ return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173);
29992
29887
  }
29993
29888
  if (token() === 134 || token() === 10) {
29994
29889
  var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers);
@@ -31483,10 +31378,10 @@ var ts;
31483
31378
  }
31484
31379
  function checkNodePositions(node, aggressiveChecks) {
31485
31380
  if (aggressiveChecks) {
31486
- var pos_3 = node.pos;
31381
+ var pos_2 = node.pos;
31487
31382
  var visitNode_1 = function (child) {
31488
- ts.Debug.assert(child.pos >= pos_3);
31489
- pos_3 = child.end;
31383
+ ts.Debug.assert(child.pos >= pos_2);
31384
+ pos_2 = child.end;
31490
31385
  };
31491
31386
  if (ts.hasJSDocNodes(node)) {
31492
31387
  for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) {
@@ -31495,7 +31390,7 @@ var ts;
31495
31390
  }
31496
31391
  }
31497
31392
  forEachChild(node, visitNode_1);
31498
- ts.Debug.assert(pos_3 <= node.end);
31393
+ ts.Debug.assert(pos_2 <= node.end);
31499
31394
  }
31500
31395
  }
31501
31396
  function updateTokenPositionsAndMarkElements(sourceFile, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta, oldText, newText, aggressiveChecks) {
@@ -35251,7 +35146,18 @@ var ts;
35251
35146
  NodeResolutionFeatures.None;
35252
35147
  }
35253
35148
  function resolvePackageNameToPackageJson(packageName, containingDirectory, options, host, cache) {
35254
- 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
+ };
35255
35161
  return ts.forEachAncestorDirectory(containingDirectory, function (ancestorDirectory) {
35256
35162
  if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") {
35257
35163
  var nodeModulesFolder = ts.combinePaths(ancestorDirectory, "node_modules");
@@ -36051,9 +35957,18 @@ var ts;
36051
35957
  var entrypoints;
36052
35958
  var extensions = resolveJs ? Extensions.JavaScript : Extensions.TypeScript;
36053
35959
  var features = getDefaultNodeResolutionFeatures(options);
36054
- var requireState = getTemporaryModuleResolutionState(cache === null || cache === void 0 ? void 0 : cache.getPackageJsonInfoCache(), host, options);
36055
- requireState.conditions = ["node", "require", "types"];
36056
- 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
+ };
36057
35972
  var requireResolution = loadNodeModuleFromDirectoryWorker(extensions, packageJsonInfo.packageDirectory, false, requireState, packageJsonInfo.packageJsonContent, packageJsonInfo.versionPaths);
36058
35973
  entrypoints = ts.append(entrypoints, requireResolution === null || requireResolution === void 0 ? void 0 : requireResolution.path);
36059
35974
  if (features & NodeResolutionFeatures.Exports && packageJsonInfo.packageJsonContent.exports) {
@@ -36123,22 +36038,19 @@ var ts;
36123
36038
  }
36124
36039
  }
36125
36040
  }
36126
- function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options) {
36127
- return {
36041
+ function getPackageScopeForPath(fileName, packageJsonInfoCache, host, options) {
36042
+ var state = {
36128
36043
  host: host,
36129
36044
  compilerOptions: options,
36130
36045
  traceEnabled: isTraceEnabled(options, host),
36131
- failedLookupLocations: ts.noopPush,
36132
- affectingLocations: ts.noopPush,
36046
+ failedLookupLocations: [],
36047
+ affectingLocations: [],
36133
36048
  packageJsonInfoCache: packageJsonInfoCache,
36134
- features: NodeResolutionFeatures.None,
36135
- conditions: ts.emptyArray,
36049
+ features: 0,
36050
+ conditions: [],
36136
36051
  requestContainingDirectory: undefined,
36137
36052
  reportDiagnostic: ts.noop
36138
36053
  };
36139
- }
36140
- ts.getTemporaryModuleResolutionState = getTemporaryModuleResolutionState;
36141
- function getPackageScopeForPath(fileName, state) {
36142
36054
  var parts = ts.getPathComponents(fileName);
36143
36055
  parts.pop();
36144
36056
  while (parts.length > 0) {
@@ -36295,7 +36207,7 @@ var ts;
36295
36207
  var _a, _b;
36296
36208
  var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
36297
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));
36298
- var scope = getPackageScopeForPath(directoryPath, state);
36210
+ var scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions);
36299
36211
  if (!scope || !scope.packageJsonContent.exports) {
36300
36212
  return undefined;
36301
36213
  }
@@ -36354,7 +36266,7 @@ var ts;
36354
36266
  }
36355
36267
  var useCaseSensitiveFileNames = typeof state.host.useCaseSensitiveFileNames === "function" ? state.host.useCaseSensitiveFileNames() : state.host.useCaseSensitiveFileNames;
36356
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));
36357
- var scope = getPackageScopeForPath(directoryPath, state);
36269
+ var scope = getPackageScopeForPath(directoryPath, state.packageJsonInfoCache, state.host, state.compilerOptions);
36358
36270
  if (!scope) {
36359
36271
  if (state.traceEnabled) {
36360
36272
  trace(state.host, ts.Diagnostics.Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve, directoryPath);
@@ -36395,7 +36307,6 @@ var ts;
36395
36307
  return 1;
36396
36308
  return 0;
36397
36309
  }
36398
- ts.comparePatternKeys = comparePatternKeys;
36399
36310
  function loadModuleFromImportsOrExports(extensions, state, cache, redirectedReference, moduleName, lookupTable, scope, isImports) {
36400
36311
  var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
36401
36312
  if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
@@ -38453,6 +38364,24 @@ var ts;
38453
38364
  typeLiteralSymbol.members.set(symbol.escapedName, symbol);
38454
38365
  }
38455
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
+ }
38456
38385
  return bindAnonymousDeclaration(node, 4096, "__object");
38457
38386
  }
38458
38387
  function bindJsxAttributes(node) {
@@ -39580,11 +39509,10 @@ var ts;
39580
39509
  }
39581
39510
  function isExportsOrModuleExportsOrAlias(sourceFile, node) {
39582
39511
  var i = 0;
39583
- var q = ts.createQueue();
39584
- q.enqueue(node);
39585
- while (!q.isEmpty() && i < 100) {
39512
+ var q = [node];
39513
+ while (q.length && i < 100) {
39586
39514
  i++;
39587
- node = q.dequeue();
39515
+ node = q.shift();
39588
39516
  if (ts.isExportsIdentifier(node) || ts.isModuleExportsAccessExpression(node)) {
39589
39517
  return true;
39590
39518
  }
@@ -39592,10 +39520,10 @@ var ts;
39592
39520
  var symbol = lookupSymbolForName(sourceFile, node.escapedText);
39593
39521
  if (!!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) {
39594
39522
  var init = symbol.valueDeclaration.initializer;
39595
- q.enqueue(init);
39523
+ q.push(init);
39596
39524
  if (ts.isAssignmentExpression(init, true)) {
39597
- q.enqueue(init.left);
39598
- q.enqueue(init.right);
39525
+ q.push(init.left);
39526
+ q.push(init.right);
39599
39527
  }
39600
39528
  }
39601
39529
  }
@@ -40039,7 +39967,7 @@ var ts;
40039
39967
  },
40040
39968
  getContextualTypeForObjectLiteralElement: function (nodeIn) {
40041
39969
  var node = ts.getParseTreeNode(nodeIn, ts.isObjectLiteralElementLike);
40042
- return node ? getContextualTypeForObjectLiteralElement(node, undefined) : undefined;
39970
+ return node ? getContextualTypeForObjectLiteralElement(node) : undefined;
40043
39971
  },
40044
39972
  getContextualTypeForArgumentAtIndex: function (nodeIn, argIndex) {
40045
39973
  var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
@@ -40047,7 +39975,7 @@ var ts;
40047
39975
  },
40048
39976
  getContextualTypeForJsxAttribute: function (nodeIn) {
40049
39977
  var node = ts.getParseTreeNode(nodeIn, ts.isJsxAttributeLike);
40050
- return node && getContextualTypeForJsxAttribute(node, undefined);
39978
+ return node && getContextualTypeForJsxAttribute(node);
40051
39979
  },
40052
39980
  isContextSensitive: isContextSensitive,
40053
39981
  getTypeOfPropertyOfContextualType: getTypeOfPropertyOfContextualType,
@@ -40247,7 +40175,6 @@ var ts;
40247
40175
  var stringMappingTypes = new ts.Map();
40248
40176
  var substitutionTypes = new ts.Map();
40249
40177
  var subtypeReductionCache = new ts.Map();
40250
- var cachedTypes = new ts.Map();
40251
40178
  var evolvingArrayTypes = [];
40252
40179
  var undefinedProperties = new ts.Map();
40253
40180
  var markerTypes = new ts.Set();
@@ -40256,10 +40183,11 @@ var ts;
40256
40183
  var unresolvedSymbols = new ts.Map();
40257
40184
  var errorTypes = new ts.Map();
40258
40185
  var anyType = createIntrinsicType(1, "any");
40259
- var autoType = createIntrinsicType(1, "any", 262144);
40186
+ var autoType = createIntrinsicType(1, "any");
40260
40187
  var wildcardType = createIntrinsicType(1, "any");
40261
40188
  var errorType = createIntrinsicType(1, "error");
40262
40189
  var unresolvedType = createIntrinsicType(1, "unresolved");
40190
+ var nonInferrableAnyType = createIntrinsicType(1, "any", 65536);
40263
40191
  var intrinsicMarkerType = createIntrinsicType(1, "intrinsic");
40264
40192
  var unknownType = createIntrinsicType(2, "unknown");
40265
40193
  var nonNullUnknownType = createIntrinsicType(2, "unknown");
@@ -40288,7 +40216,8 @@ var ts;
40288
40216
  var esSymbolType = createIntrinsicType(4096, "symbol");
40289
40217
  var voidType = createIntrinsicType(16384, "void");
40290
40218
  var neverType = createIntrinsicType(131072, "never");
40291
- var silentNeverType = createIntrinsicType(131072, "never", 262144);
40219
+ var silentNeverType = createIntrinsicType(131072, "never");
40220
+ var nonInferrableType = createIntrinsicType(131072, "never", 262144);
40292
40221
  var implicitNeverType = createIntrinsicType(131072, "never");
40293
40222
  var unreachableNeverType = createIntrinsicType(131072, "never");
40294
40223
  var nonPrimitiveType = createIntrinsicType(67108864, "object");
@@ -40298,23 +40227,10 @@ var ts;
40298
40227
  var numberOrBigIntType = getUnionType([numberType, bigintType]);
40299
40228
  var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
40300
40229
  var numericStringType = getTemplateLiteralType(["", ""], [numberType]);
40301
- var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? getRestrictiveTypeParameter(t) : t; }, function () { return "(restrictive mapper)"; });
40302
- 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; });
40303
40232
  var uniqueLiteralType = createIntrinsicType(131072, "never");
40304
- var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? uniqueLiteralType : t; }, function () { return "(unique literal mapper)"; });
40305
- var outofbandVarianceMarkerHandler;
40306
- var reportUnreliableMapper = makeFunctionTypeMapper(function (t) {
40307
- if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
40308
- outofbandVarianceMarkerHandler(true);
40309
- }
40310
- return t;
40311
- }, function () { return "(unmeasurable reporter)"; });
40312
- var reportUnmeasurableMapper = makeFunctionTypeMapper(function (t) {
40313
- if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
40314
- outofbandVarianceMarkerHandler(false);
40315
- }
40316
- return t;
40317
- }, function () { return "(unreliable reporter)"; });
40233
+ var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 ? uniqueLiteralType : t; });
40318
40234
  var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
40319
40235
  var emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
40320
40236
  emptyJsxObjectType.objectFlags |= 2048;
@@ -40417,6 +40333,7 @@ var ts;
40417
40333
  var deferredGlobalAsyncIterableIteratorType;
40418
40334
  var deferredGlobalAsyncGeneratorType;
40419
40335
  var deferredGlobalTemplateStringsArrayType;
40336
+ var deferredGlobalTemplateStringsArrayOfSymbol;
40420
40337
  var deferredGlobalImportMetaType;
40421
40338
  var deferredGlobalImportMetaExpressionType;
40422
40339
  var deferredGlobalImportCallOptionsType;
@@ -40463,6 +40380,7 @@ var ts;
40463
40380
  var typeofType = createTypeofType();
40464
40381
  var _jsxNamespace;
40465
40382
  var _jsxFactoryEntity;
40383
+ var outofbandVarianceMarkerHandler;
40466
40384
  var subtypeRelation = new ts.Map();
40467
40385
  var strictSubtypeRelation = new ts.Map();
40468
40386
  var assignableRelation = new ts.Map();
@@ -40484,14 +40402,6 @@ var ts;
40484
40402
  ];
40485
40403
  initializeTypeChecker();
40486
40404
  return checker;
40487
- function getCachedType(key) {
40488
- return key ? cachedTypes.get(key) : undefined;
40489
- }
40490
- function setCachedType(key, type) {
40491
- if (key)
40492
- cachedTypes.set(key, type);
40493
- return type;
40494
- }
40495
40405
  function getJsxNamespace(location) {
40496
40406
  if (location) {
40497
40407
  var file = ts.getSourceFileOfNode(location);
@@ -41231,7 +41141,6 @@ var ts;
41231
41141
  var ctor = findConstructorDeclaration(location.parent);
41232
41142
  if (ctor && ctor.locals) {
41233
41143
  if (lookup(ctor.locals, name, meaning & 111551)) {
41234
- ts.Debug.assertNode(location, ts.isPropertyDeclaration);
41235
41144
  propertyWithInvalidInitializer = location;
41236
41145
  }
41237
41146
  }
@@ -41377,21 +41286,11 @@ var ts;
41377
41286
  }
41378
41287
  }
41379
41288
  }
41380
- function checkAndReportErrorForInvalidInitializer() {
41381
- if (propertyWithInvalidInitializer && !(useDefineForClassFields && ts.getEmitScriptTarget(compilerOptions) >= 9)) {
41382
- error(errorLocation, errorLocation && propertyWithInvalidInitializer.type && ts.textRangeContainsPositionInclusive(propertyWithInvalidInitializer.type, errorLocation.pos)
41383
- ? ts.Diagnostics.Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor
41384
- : ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyWithInvalidInitializer.name), diagnosticName(nameArg));
41385
- return true;
41386
- }
41387
- return false;
41388
- }
41389
41289
  if (!result) {
41390
41290
  if (nameNotFoundMessage) {
41391
41291
  addLazyDiagnostic(function () {
41392
41292
  if (!errorLocation ||
41393
41293
  !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) &&
41394
- !checkAndReportErrorForInvalidInitializer() &&
41395
41294
  !checkAndReportErrorForExtendingInterface(errorLocation) &&
41396
41295
  !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) &&
41397
41296
  !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) &&
@@ -41399,14 +41298,7 @@ var ts;
41399
41298
  !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) &&
41400
41299
  !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
41401
41300
  var suggestion = void 0;
41402
- var suggestedLib = void 0;
41403
- if (nameArg) {
41404
- suggestedLib = getSuggestedLibForNonExistentName(nameArg);
41405
- if (suggestedLib) {
41406
- error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg), suggestedLib);
41407
- }
41408
- }
41409
- if (!suggestedLib && getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
41301
+ if (getSpellingSuggestions && suggestionCount < maximumSuggestionCount) {
41410
41302
  suggestion = getSuggestedSymbolForNonexistentSymbol(originalLocation, name, meaning);
41411
41303
  var isGlobalScopeAugmentationDeclaration = (suggestion === null || suggestion === void 0 ? void 0 : suggestion.valueDeclaration) && ts.isAmbientModule(suggestion.valueDeclaration) && ts.isGlobalScopeAugmentation(suggestion.valueDeclaration);
41412
41304
  if (isGlobalScopeAugmentationDeclaration) {
@@ -41425,8 +41317,16 @@ var ts;
41425
41317
  }
41426
41318
  }
41427
41319
  }
41428
- if (!suggestion && !suggestedLib && nameArg) {
41429
- 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
+ }
41430
41330
  }
41431
41331
  suggestionCount++;
41432
41332
  }
@@ -41434,7 +41334,9 @@ var ts;
41434
41334
  }
41435
41335
  return undefined;
41436
41336
  }
41437
- 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));
41438
41340
  return undefined;
41439
41341
  }
41440
41342
  if (nameNotFoundMessage) {
@@ -43308,25 +43210,13 @@ var ts;
43308
43210
  && isDeclarationVisible(declaration.parent)) {
43309
43211
  return addVisibleAlias(declaration, declaration);
43310
43212
  }
43311
- else if (ts.isBindingElement(declaration)) {
43312
- if (symbol.flags & 2097152 && ts.isInJSFile(declaration) && ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.parent)
43313
- && ts.isVariableDeclaration(declaration.parent.parent)
43314
- && ((_b = declaration.parent.parent.parent) === null || _b === void 0 ? void 0 : _b.parent) && ts.isVariableStatement(declaration.parent.parent.parent.parent)
43315
- && !ts.hasSyntacticModifier(declaration.parent.parent.parent.parent, 1)
43316
- && declaration.parent.parent.parent.parent.parent
43317
- && isDeclarationVisible(declaration.parent.parent.parent.parent.parent)) {
43318
- return addVisibleAlias(declaration, declaration.parent.parent.parent.parent);
43319
- }
43320
- else if (symbol.flags & 2) {
43321
- var variableStatement = ts.findAncestor(declaration, ts.isVariableStatement);
43322
- if (ts.hasSyntacticModifier(variableStatement, 1)) {
43323
- return true;
43324
- }
43325
- if (!isDeclarationVisible(variableStatement.parent)) {
43326
- return false;
43327
- }
43328
- return addVisibleAlias(declaration, variableStatement);
43329
- }
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);
43330
43220
  }
43331
43221
  return false;
43332
43222
  }
@@ -43446,7 +43336,7 @@ var ts;
43446
43336
  }
43447
43337
  function toNodeBuilderFlags(flags) {
43448
43338
  if (flags === void 0) { flags = 0; }
43449
- return flags & 848330091;
43339
+ return flags & 814775659;
43450
43340
  }
43451
43341
  function isClassInstanceSide(type) {
43452
43342
  return !!type.symbol && !!(type.symbol.flags & 32) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || (!!(type.flags & 524288) && !!(ts.getObjectFlags(type) & 16777216)));
@@ -43786,7 +43676,7 @@ var ts;
43786
43676
  var name = typeParameterToName(newParam, context);
43787
43677
  var newTypeVariable = ts.factory.createTypeReferenceNode(name);
43788
43678
  context.approximateLength += 37;
43789
- var newMapper = prependTypeMapping(type.root.checkType, newParam, type.mapper);
43679
+ var newMapper = prependTypeMapping(type.root.checkType, newParam, type.combinedMapper || type.mapper);
43790
43680
  var saveInferTypeParameters_1 = context.inferTypeParameters;
43791
43681
  context.inferTypeParameters = type.root.inferTypeParameters;
43792
43682
  var extendsTypeNode_1 = typeToTypeNodeHelper(instantiateType(type.root.extendsType, newMapper), context);
@@ -43817,10 +43707,6 @@ var ts;
43817
43707
  }
43818
43708
  return typeToTypeNodeHelper(type, context);
43819
43709
  }
43820
- function isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) {
43821
- return isMappedTypeWithKeyofConstraintDeclaration(type)
43822
- && !(getModifiersTypeFromMappedType(type).flags & 262144);
43823
- }
43824
43710
  function createMappedTypeNodeFromType(type) {
43825
43711
  ts.Debug.assert(!!(type.flags & 524288));
43826
43712
  var readonlyToken = type.declaration.readonlyToken ? ts.factory.createToken(type.declaration.readonlyToken.kind) : undefined;
@@ -43828,7 +43714,7 @@ var ts;
43828
43714
  var appropriateConstraintTypeNode;
43829
43715
  var newTypeVariable;
43830
43716
  if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
43831
- if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4) {
43717
+ if (!(getModifiersTypeFromMappedType(type).flags & 262144) && context.flags & 4) {
43832
43718
  var newParam = createTypeParameter(createSymbol(262144, "T"));
43833
43719
  var name = typeParameterToName(newParam, context);
43834
43720
  newTypeVariable = ts.factory.createTypeReferenceNode(name);
@@ -43844,9 +43730,8 @@ var ts;
43844
43730
  var mappedTypeNode = ts.factory.createMappedTypeNode(readonlyToken, typeParameterNode, nameTypeNode, questionToken, templateTypeNode, undefined);
43845
43731
  context.approximateLength += 10;
43846
43732
  var result = ts.setEmitFlags(mappedTypeNode, 1);
43847
- if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4) {
43848
- var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper);
43849
- 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));
43850
43735
  }
43851
43736
  return result;
43852
43737
  }
@@ -44364,7 +44249,7 @@ var ts;
44364
44249
  }
44365
44250
  var expandedParams = getExpandedParameters(signature, true)[0];
44366
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); });
44367
- var thisParameter = context.flags & 33554432 ? undefined : tryGetThisParameterDeclaration(signature, context);
44252
+ var thisParameter = tryGetThisParameterDeclaration(signature, context);
44368
44253
  if (thisParameter) {
44369
44254
  parameters.unshift(thisParameter);
44370
44255
  }
@@ -45317,11 +45202,12 @@ var ts;
45317
45202
  if (skipMembershipCheck || (!!ts.length(symbol.declarations) && ts.some(symbol.declarations, function (d) { return !!ts.findAncestor(d, function (n) { return n === enclosingDeclaration; }); }))) {
45318
45203
  var oldContext = context;
45319
45204
  context = cloneNodeBuilderContext(context);
45320
- serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
45205
+ var result = serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
45321
45206
  if (context.reportedDiagnostic) {
45322
45207
  oldcontext.reportedDiagnostic = context.reportedDiagnostic;
45323
45208
  }
45324
45209
  context = oldContext;
45210
+ return result;
45325
45211
  }
45326
45212
  }
45327
45213
  function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias) {
@@ -47019,7 +46905,7 @@ var ts;
47019
46905
  if (reportErrors && !declarationBelongsToPrivateAmbientMember(element)) {
47020
46906
  reportImplicitAny(element, anyType);
47021
46907
  }
47022
- return anyType;
46908
+ return includePatternInType ? nonInferrableAnyType : anyType;
47023
46909
  }
47024
46910
  function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) {
47025
46911
  var members = ts.createSymbolTable();
@@ -47906,7 +47792,7 @@ var ts;
47906
47792
  error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol));
47907
47793
  }
47908
47794
  else {
47909
- 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));
47910
47796
  }
47911
47797
  }
47912
47798
  links.declaredType = type;
@@ -49030,9 +48916,6 @@ var ts;
49030
48916
  else if (type.objectFlags & 32) {
49031
48917
  resolveMappedTypeMembers(type);
49032
48918
  }
49033
- else {
49034
- ts.Debug.fail("Unhandled object type " + ts.Debug.formatObjectFlags(type.objectFlags));
49035
- }
49036
48919
  }
49037
48920
  else if (type.flags & 1048576) {
49038
48921
  resolveUnionTypeMembers(type);
@@ -49040,9 +48923,6 @@ var ts;
49040
48923
  else if (type.flags & 2097152) {
49041
48924
  resolveIntersectionTypeMembers(type);
49042
48925
  }
49043
- else {
49044
- ts.Debug.fail("Unhandled type " + ts.Debug.formatTypeFlags(type.flags));
49045
- }
49046
48926
  }
49047
48927
  return type;
49048
48928
  }
@@ -49217,7 +49097,7 @@ var ts;
49217
49097
  }
49218
49098
  }
49219
49099
  }
49220
- return getNormalizedType(getIntersectionType(constraints), false);
49100
+ return getIntersectionType(constraints);
49221
49101
  }
49222
49102
  return undefined;
49223
49103
  }
@@ -49712,15 +49592,12 @@ var ts;
49712
49592
  return getApplicableIndexInfo(type, isLateBoundName(name) ? esSymbolType : getStringLiteralType(ts.unescapeLeadingUnderscores(name)));
49713
49593
  }
49714
49594
  function getTypeParametersFromDeclaration(declaration) {
49715
- var _a;
49716
49595
  var result;
49717
- for (var _i = 0, _b = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _b.length; _i++) {
49718
- var node = _b[_i];
49596
+ for (var _i = 0, _a = ts.getEffectiveTypeParameterDeclarations(declaration); _i < _a.length; _i++) {
49597
+ var node = _a[_i];
49719
49598
  result = ts.appendIfUnique(result, getDeclaredTypeOfTypeParameter(node.symbol));
49720
49599
  }
49721
- return (result === null || result === void 0 ? void 0 : result.length) ? result
49722
- : ts.isFunctionDeclaration(declaration) ? (_a = getSignatureOfTypeTag(declaration)) === null || _a === void 0 ? void 0 : _a.typeParameters
49723
- : undefined;
49600
+ return result;
49724
49601
  }
49725
49602
  function symbolsToArray(symbols) {
49726
49603
  var result = [];
@@ -50223,20 +50100,19 @@ var ts;
50223
50100
  var _a;
50224
50101
  var inferences;
50225
50102
  if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) {
50226
- var _loop_15 = function (declaration) {
50103
+ for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
50104
+ var declaration = _b[_i];
50227
50105
  if (declaration.parent.kind === 190) {
50228
50106
  var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1];
50229
50107
  if (grandParent.kind === 178 && !omitTypeReferences) {
50230
- var typeReference_1 = grandParent;
50231
- var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1);
50232
- if (typeParameters_1) {
50233
- var index = typeReference_1.typeArguments.indexOf(childTypeParameter);
50234
- if (index < typeParameters_1.length) {
50235
- 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]);
50236
50114
  if (declaredConstraint) {
50237
- var mapper = makeDeferredTypeMapper(typeParameters_1, typeParameters_1.map(function (_, index) { return function () {
50238
- return getEffectiveTypeArgumentAtIndex(typeReference_1, typeParameters_1, index);
50239
- }; }));
50115
+ var mapper = createTypeMapper(typeParameters, getEffectiveTypeArguments(typeReference, typeParameters));
50240
50116
  var constraint = instantiateType(declaredConstraint, mapper);
50241
50117
  if (constraint !== typeParameter) {
50242
50118
  inferences = ts.append(inferences, constraint);
@@ -50265,10 +50141,6 @@ var ts;
50265
50141
  inferences = ts.append(inferences, instantiateType(nodeType, makeUnaryTypeMapper(getDeclaredTypeOfTypeParameter(getSymbolOfNode(checkMappedType_1.typeParameter)), checkMappedType_1.typeParameter.constraint ? getTypeFromTypeNode(checkMappedType_1.typeParameter.constraint) : keyofConstraintType)));
50266
50142
  }
50267
50143
  }
50268
- };
50269
- for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) {
50270
- var declaration = _b[_i];
50271
- _loop_15(declaration);
50272
50144
  }
50273
50145
  }
50274
50146
  return inferences && getIntersectionType(inferences);
@@ -50330,7 +50202,7 @@ var ts;
50330
50202
  var result = 0;
50331
50203
  for (var _i = 0, types_8 = types; _i < types_8.length; _i++) {
50332
50204
  var type = types_8[_i];
50333
- if (excludeKinds === undefined || !(type.flags & excludeKinds)) {
50205
+ if (!(type.flags & excludeKinds)) {
50334
50206
  result |= ts.getObjectFlags(type);
50335
50207
  }
50336
50208
  }
@@ -50342,7 +50214,7 @@ var ts;
50342
50214
  if (!type) {
50343
50215
  type = createObjectType(4, target.symbol);
50344
50216
  target.instantiations.set(id, type);
50345
- type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments) : 0;
50217
+ type.objectFlags |= typeArguments ? getPropagatingFlagsOfTypes(typeArguments, 0) : 0;
50346
50218
  type.target = target;
50347
50219
  type.resolvedTypeArguments = typeArguments;
50348
50220
  }
@@ -50865,6 +50737,10 @@ var ts;
50865
50737
  function getGlobalBigIntType() {
50866
50738
  return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", 0, false))) || emptyObjectType;
50867
50739
  }
50740
+ function getGlobalTemplateStringsArrayOfSymbol() {
50741
+ deferredGlobalTemplateStringsArrayOfSymbol || (deferredGlobalTemplateStringsArrayOfSymbol = getGlobalTypeAliasSymbol("TemplateStringsArrayOf", 2, true) || unknownSymbol);
50742
+ return deferredGlobalTemplateStringsArrayOfSymbol === unknownSymbol ? undefined : deferredGlobalTemplateStringsArrayOfSymbol;
50743
+ }
50868
50744
  function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) {
50869
50745
  return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType;
50870
50746
  }
@@ -51076,7 +50952,7 @@ var ts;
51076
50952
  var lastRequiredIndex = -1;
51077
50953
  var firstRestIndex = -1;
51078
50954
  var lastOptionalOrRestIndex = -1;
51079
- var _loop_16 = function (i) {
50955
+ var _loop_15 = function (i) {
51080
50956
  var type = elementTypes[i];
51081
50957
  var flags = target.elementFlags[i];
51082
50958
  if (flags & 8) {
@@ -51102,7 +50978,7 @@ var ts;
51102
50978
  }
51103
50979
  };
51104
50980
  for (var i = 0; i < elementTypes.length; i++) {
51105
- var state_4 = _loop_16(i);
50981
+ var state_4 = _loop_15(i);
51106
50982
  if (typeof state_4 === "object")
51107
50983
  return state_4.value;
51108
50984
  }
@@ -51279,7 +51155,7 @@ var ts;
51279
51155
  var templates = ts.filter(types, isPatternLiteralType);
51280
51156
  if (templates.length) {
51281
51157
  var i = types.length;
51282
- var _loop_17 = function () {
51158
+ var _loop_16 = function () {
51283
51159
  i--;
51284
51160
  var t = types[i];
51285
51161
  if (t.flags & 128 && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) {
@@ -51287,7 +51163,7 @@ var ts;
51287
51163
  }
51288
51164
  };
51289
51165
  while (i > 0) {
51290
- _loop_17();
51166
+ _loop_16();
51291
51167
  }
51292
51168
  }
51293
51169
  }
@@ -51357,14 +51233,14 @@ var ts;
51357
51233
  var namedUnions = [];
51358
51234
  addNamedUnions(namedUnions, types);
51359
51235
  var reducedTypes = [];
51360
- var _loop_18 = function (t) {
51236
+ var _loop_17 = function (t) {
51361
51237
  if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) {
51362
51238
  reducedTypes.push(t);
51363
51239
  }
51364
51240
  };
51365
51241
  for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) {
51366
51242
  var t = typeSet_1[_i];
51367
- _loop_18(t);
51243
+ _loop_17(t);
51368
51244
  }
51369
51245
  if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) {
51370
51246
  return namedUnions[0];
@@ -51814,22 +51690,19 @@ var ts;
51814
51690
  return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1, undefined, undefined, origin);
51815
51691
  }
51816
51692
  function isPossiblyReducibleByInstantiation(type) {
51817
- var uniqueFilled = getUniqueLiteralFilledInstantiation(type);
51818
- return getReducedType(uniqueFilled) !== uniqueFilled;
51819
- }
51820
- function shouldDeferIndexType(type) {
51821
- return !!(type.flags & 58982400 ||
51822
- isGenericTupleType(type) ||
51823
- isGenericMappedType(type) && !hasDistributiveNameType(type) ||
51824
- type.flags & 1048576 && ts.some(type.types, isPossiblyReducibleByInstantiation) ||
51825
- 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
+ });
51826
51697
  }
51827
51698
  function getIndexType(type, stringsOnly, noIndexSignatures) {
51828
51699
  if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
51829
51700
  type = getReducedType(type);
51830
- return shouldDeferIndexType(type) ? getIndexTypeForGenericType(type, stringsOnly) :
51831
- type.flags & 1048576 ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
51832
- 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) :
51833
51706
  ts.getObjectFlags(type) & 32 ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) :
51834
51707
  type === wildcardType ? wildcardType :
51835
51708
  type.flags & 2 ? neverType :
@@ -52070,28 +51943,21 @@ var ts;
52070
51943
  getFlowTypeOfReference(accessExpression, propType) :
52071
51944
  propType;
52072
51945
  }
52073
- if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName)) {
52074
- var index = +propName;
51946
+ if (everyType(objectType, isTupleType) && ts.isNumericLiteralName(propName) && +propName >= 0) {
52075
51947
  if (accessNode && everyType(objectType, function (t) { return !t.target.hasRestElement; }) && !(accessFlags & 16)) {
52076
51948
  var indexNode = getIndexNodeForAccessExpression(accessNode);
52077
51949
  if (isTupleType(objectType)) {
52078
- if (index < 0) {
52079
- error(indexNode, ts.Diagnostics.A_tuple_type_cannot_be_indexed_with_a_negative_value);
52080
- return undefinedType;
52081
- }
52082
51950
  error(indexNode, ts.Diagnostics.Tuple_type_0_of_length_1_has_no_element_at_index_2, typeToString(objectType), getTypeReferenceArity(objectType), ts.unescapeLeadingUnderscores(propName));
52083
51951
  }
52084
51952
  else {
52085
51953
  error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
52086
51954
  }
52087
51955
  }
52088
- if (index >= 0) {
52089
- errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, numberType));
52090
- return mapType(objectType, function (t) {
52091
- var restType = getRestTypeOfTupleType(t) || undefinedType;
52092
- return accessFlags & 1 ? getUnionType([restType, undefinedType]) : restType;
52093
- });
52094
- }
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
+ });
52095
51961
  }
52096
51962
  }
52097
51963
  if (!(indexType.flags & 98304) && isTypeAssignableToKind(indexType, 402653316 | 296 | 12288)) {
@@ -52450,7 +52316,7 @@ var ts;
52450
52316
  var result;
52451
52317
  var extraTypes;
52452
52318
  var tailCount = 0;
52453
- var _loop_19 = function () {
52319
+ var _loop_18 = function () {
52454
52320
  if (tailCount === 1000) {
52455
52321
  error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
52456
52322
  result = errorType;
@@ -52524,7 +52390,7 @@ var ts;
52524
52390
  return "break";
52525
52391
  };
52526
52392
  while (true) {
52527
- var state_5 = _loop_19();
52393
+ var state_5 = _loop_18();
52528
52394
  if (typeof state_5 === "object")
52529
52395
  return state_5.value;
52530
52396
  if (state_5 === "break")
@@ -53125,7 +52991,7 @@ var ts;
53125
52991
  switch (mapper.kind) {
53126
52992
  case 0:
53127
52993
  return type === mapper.source ? mapper.target : type;
53128
- case 1: {
52994
+ case 1:
53129
52995
  var sources = mapper.sources;
53130
52996
  var targets = mapper.targets;
53131
52997
  for (var i = 0; i < sources.length; i++) {
@@ -53134,58 +53000,43 @@ var ts;
53134
53000
  }
53135
53001
  }
53136
53002
  return type;
53137
- }
53138
- case 2: {
53139
- var sources = mapper.sources;
53140
- var targets = mapper.targets;
53141
- for (var i = 0; i < sources.length; i++) {
53142
- if (type === sources[i]) {
53143
- return targets[i]();
53144
- }
53145
- }
53146
- return type;
53147
- }
53148
- case 3:
53003
+ case 2:
53149
53004
  return mapper.func(type);
53005
+ case 3:
53150
53006
  case 4:
53151
- case 5:
53152
53007
  var t1 = getMappedType(type, mapper.mapper1);
53153
- 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);
53154
53009
  }
53155
53010
  }
53156
53011
  function makeUnaryTypeMapper(source, target) {
53157
- return ts.Debug.attachDebugPrototypeIfDebug({ kind: 0, source: source, target: target });
53012
+ return { kind: 0, source: source, target: target };
53158
53013
  }
53159
53014
  function makeArrayTypeMapper(sources, targets) {
53160
- return ts.Debug.attachDebugPrototypeIfDebug({ kind: 1, sources: sources, targets: targets });
53161
- }
53162
- function makeFunctionTypeMapper(func, debugInfo) {
53163
- return ts.Debug.attachDebugPrototypeIfDebug({ kind: 3, func: func, debugInfo: ts.Debug.isDebugging ? debugInfo : undefined });
53015
+ return { kind: 1, sources: sources, targets: targets };
53164
53016
  }
53165
- function makeDeferredTypeMapper(sources, targets) {
53166
- return ts.Debug.attachDebugPrototypeIfDebug({ kind: 2, sources: sources, targets: targets });
53017
+ function makeFunctionTypeMapper(func) {
53018
+ return { kind: 2, func: func };
53167
53019
  }
53168
53020
  function makeCompositeTypeMapper(kind, mapper1, mapper2) {
53169
- return ts.Debug.attachDebugPrototypeIfDebug({ kind: kind, mapper1: mapper1, mapper2: mapper2 });
53021
+ return { kind: kind, mapper1: mapper1, mapper2: mapper2 };
53170
53022
  }
53171
53023
  function createTypeEraser(sources) {
53172
53024
  return createTypeMapper(sources, undefined);
53173
53025
  }
53174
53026
  function createBackreferenceMapper(context, index) {
53175
- var forwardInferences = context.inferences.slice(index);
53176
- 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; });
53177
53028
  }
53178
53029
  function combineTypeMappers(mapper1, mapper2) {
53179
- return mapper1 ? makeCompositeTypeMapper(4, mapper1, mapper2) : mapper2;
53030
+ return mapper1 ? makeCompositeTypeMapper(3, mapper1, mapper2) : mapper2;
53180
53031
  }
53181
53032
  function mergeTypeMappers(mapper1, mapper2) {
53182
- return mapper1 ? makeCompositeTypeMapper(5, mapper1, mapper2) : mapper2;
53033
+ return mapper1 ? makeCompositeTypeMapper(4, mapper1, mapper2) : mapper2;
53183
53034
  }
53184
53035
  function prependTypeMapping(source, target, mapper) {
53185
- return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5, makeUnaryTypeMapper(source, target), mapper);
53036
+ return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(4, makeUnaryTypeMapper(source, target), mapper);
53186
53037
  }
53187
53038
  function appendTypeMapping(mapper, source, target) {
53188
- return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5, mapper, makeUnaryTypeMapper(source, target));
53039
+ return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(4, mapper, makeUnaryTypeMapper(source, target));
53189
53040
  }
53190
53041
  function getRestrictiveTypeParameter(tp) {
53191
53042
  return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol),
@@ -53409,7 +53260,6 @@ var ts;
53409
53260
  result.mapper = mapper;
53410
53261
  result.aliasSymbol = aliasSymbol || type.aliasSymbol;
53411
53262
  result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
53412
- result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
53413
53263
  return result;
53414
53264
  }
53415
53265
  function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
@@ -53997,7 +53847,7 @@ var ts;
53997
53847
  });
53998
53848
  }
53999
53849
  function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
54000
- if (target.flags & (131068 | 131072))
53850
+ if (target.flags & 131068)
54001
53851
  return false;
54002
53852
  if (isTupleLikeType(source)) {
54003
53853
  return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
@@ -54062,7 +53912,7 @@ var ts;
54062
53912
  });
54063
53913
  }
54064
53914
  function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
54065
- if (target.flags & (131068 | 131072))
53915
+ if (target.flags & 131068)
54066
53916
  return false;
54067
53917
  return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
54068
53918
  }
@@ -54866,7 +54716,7 @@ var ts;
54866
54716
  reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
54867
54717
  checkTypes = reducedTarget.flags & 1048576 ? reducedTarget.types : [reducedTarget];
54868
54718
  }
54869
- var _loop_20 = function (prop) {
54719
+ var _loop_19 = function (prop) {
54870
54720
  if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
54871
54721
  if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
54872
54722
  if (reportErrors) {
@@ -54919,7 +54769,7 @@ var ts;
54919
54769
  };
54920
54770
  for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
54921
54771
  var prop = _b[_i];
54922
- var state_6 = _loop_20(prop);
54772
+ var state_6 = _loop_19(prop);
54923
54773
  if (typeof state_6 === "object")
54924
54774
  return state_6.value;
54925
54775
  }
@@ -55107,10 +54957,10 @@ var ts;
55107
54957
  if (outofbandVarianceMarkerHandler) {
55108
54958
  var saved = entry & 24;
55109
54959
  if (saved & 8) {
55110
- instantiateType(source, reportUnmeasurableMapper);
54960
+ instantiateType(source, makeFunctionTypeMapper(reportUnmeasurableMarkers));
55111
54961
  }
55112
54962
  if (saved & 16) {
55113
- instantiateType(source, reportUnreliableMapper);
54963
+ instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
55114
54964
  }
55115
54965
  }
55116
54966
  return entry & 1 ? -1 : 0;
@@ -55202,20 +55052,13 @@ var ts;
55202
55052
  return result;
55203
55053
  }
55204
55054
  function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
55205
- var saveErrorInfo = captureErrorCalculationState();
55206
- var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
55207
- if (result) {
55208
- resetErrorInfo(saveErrorInfo);
55209
- }
55210
- return result;
55211
- }
55212
- function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) {
55213
55055
  if (intersectionState & 4) {
55214
55056
  return propertiesRelatedTo(source, target, reportErrors, undefined, 0);
55215
55057
  }
55216
55058
  var result;
55217
55059
  var originalErrorInfo;
55218
55060
  var varianceCheckFailed = false;
55061
+ var saveErrorInfo = captureErrorCalculationState();
55219
55062
  var sourceFlags = source.flags;
55220
55063
  var targetFlags = target.flags;
55221
55064
  if (relation === identityRelation) {
@@ -55264,6 +55107,7 @@ var ts;
55264
55107
  var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
55265
55108
  if (constraint && everyType(constraint, function (c) { return c !== source; })) {
55266
55109
  if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
55110
+ resetErrorInfo(saveErrorInfo);
55267
55111
  return result;
55268
55112
  }
55269
55113
  }
@@ -55356,6 +55200,7 @@ var ts;
55356
55200
  result &= isRelatedTo(source.indexType, target.indexType, 3, reportErrors);
55357
55201
  }
55358
55202
  if (result) {
55203
+ resetErrorInfo(saveErrorInfo);
55359
55204
  return result;
55360
55205
  }
55361
55206
  if (reportErrors) {
@@ -55431,6 +55276,7 @@ var ts;
55431
55276
  }
55432
55277
  else if (targetFlags & 16777216) {
55433
55278
  if (isDeeplyNestedType(target, targetStack, targetDepth, 10)) {
55279
+ resetErrorInfo(saveErrorInfo);
55434
55280
  return 3;
55435
55281
  }
55436
55282
  var c = target;
@@ -55440,6 +55286,7 @@ var ts;
55440
55286
  if (result = skipTrue ? -1 : isRelatedTo(source, getTrueTypeFromConditionalType(c), 2, false)) {
55441
55287
  result &= skipFalse ? -1 : isRelatedTo(source, getFalseTypeFromConditionalType(c), 2, false);
55442
55288
  if (result) {
55289
+ resetErrorInfo(saveErrorInfo);
55443
55290
  return result;
55444
55291
  }
55445
55292
  }
@@ -55450,7 +55297,7 @@ var ts;
55450
55297
  if (relation === comparableRelation) {
55451
55298
  return templateLiteralTypesDefinitelyUnrelated(source, target) ? 0 : -1;
55452
55299
  }
55453
- instantiateType(source, reportUnreliableMapper);
55300
+ instantiateType(source, makeFunctionTypeMapper(reportUnreliableMarkers));
55454
55301
  }
55455
55302
  if (isTypeMatchedByTemplateLiteralType(source, target)) {
55456
55303
  return -1;
@@ -55467,15 +55314,18 @@ var ts;
55467
55314
  if (!(sourceFlags & 8388608 && targetFlags & 8388608)) {
55468
55315
  var constraint = getConstraintOfType(source) || unknownType;
55469
55316
  if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
55317
+ resetErrorInfo(saveErrorInfo);
55470
55318
  return result;
55471
55319
  }
55472
55320
  else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && constraint !== unknownType && !(targetFlags & sourceFlags & 262144), undefined, intersectionState)) {
55321
+ resetErrorInfo(saveErrorInfo);
55473
55322
  return result;
55474
55323
  }
55475
55324
  if (isMappedTypeGenericIndexedAccess(source)) {
55476
55325
  var indexConstraint = getConstraintOfType(source.indexType);
55477
55326
  if (indexConstraint) {
55478
55327
  if (result = isRelatedTo(getIndexedAccessType(source.objectType, indexConstraint), target, 1, reportErrors)) {
55328
+ resetErrorInfo(saveErrorInfo);
55479
55329
  return result;
55480
55330
  }
55481
55331
  }
@@ -55484,6 +55334,7 @@ var ts;
55484
55334
  }
55485
55335
  else if (sourceFlags & 4194304) {
55486
55336
  if (result = isRelatedTo(keyofConstraintType, target, 1, reportErrors)) {
55337
+ resetErrorInfo(saveErrorInfo);
55487
55338
  return result;
55488
55339
  }
55489
55340
  }
@@ -55491,6 +55342,7 @@ var ts;
55491
55342
  if (!(targetFlags & 134217728)) {
55492
55343
  var constraint = getBaseConstraintOfType(source);
55493
55344
  if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
55345
+ resetErrorInfo(saveErrorInfo);
55494
55346
  return result;
55495
55347
  }
55496
55348
  }
@@ -55501,18 +55353,21 @@ var ts;
55501
55353
  return 0;
55502
55354
  }
55503
55355
  if (result = isRelatedTo(source.type, target.type, 3, reportErrors)) {
55356
+ resetErrorInfo(saveErrorInfo);
55504
55357
  return result;
55505
55358
  }
55506
55359
  }
55507
55360
  else {
55508
55361
  var constraint = getBaseConstraintOfType(source);
55509
55362
  if (constraint && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
55363
+ resetErrorInfo(saveErrorInfo);
55510
55364
  return result;
55511
55365
  }
55512
55366
  }
55513
55367
  }
55514
55368
  else if (sourceFlags & 16777216) {
55515
55369
  if (isDeeplyNestedType(source, sourceStack, sourceDepth, 10)) {
55370
+ resetErrorInfo(saveErrorInfo);
55516
55371
  return 3;
55517
55372
  }
55518
55373
  if (targetFlags & 16777216) {
@@ -55531,6 +55386,7 @@ var ts;
55531
55386
  result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3, reportErrors);
55532
55387
  }
55533
55388
  if (result) {
55389
+ resetErrorInfo(saveErrorInfo);
55534
55390
  return result;
55535
55391
  }
55536
55392
  }
@@ -55539,6 +55395,7 @@ var ts;
55539
55395
  var distributiveConstraint = hasNonCircularBaseConstraint(source) ? getConstraintOfDistributiveConditionalType(source) : undefined;
55540
55396
  if (distributiveConstraint) {
55541
55397
  if (result = isRelatedTo(distributiveConstraint, target, 1, reportErrors)) {
55398
+ resetErrorInfo(saveErrorInfo);
55542
55399
  return result;
55543
55400
  }
55544
55401
  }
@@ -55546,6 +55403,7 @@ var ts;
55546
55403
  var defaultConstraint = getDefaultConstraintOfConditionalType(source);
55547
55404
  if (defaultConstraint) {
55548
55405
  if (result = isRelatedTo(defaultConstraint, target, 1, reportErrors)) {
55406
+ resetErrorInfo(saveErrorInfo);
55549
55407
  return result;
55550
55408
  }
55551
55409
  }
@@ -55557,6 +55415,7 @@ var ts;
55557
55415
  if (isGenericMappedType(target)) {
55558
55416
  if (isGenericMappedType(source)) {
55559
55417
  if (result = mappedTypeRelatedTo(source, target, reportErrors)) {
55418
+ resetErrorInfo(saveErrorInfo);
55560
55419
  return result;
55561
55420
  }
55562
55421
  }
@@ -55650,13 +55509,25 @@ var ts;
55650
55509
  }
55651
55510
  }
55652
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
+ }
55653
55524
  function mappedTypeRelatedTo(source, target, reportErrors) {
55654
55525
  var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
55655
55526
  getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
55656
55527
  if (modifiersRelated) {
55657
55528
  var result_10;
55658
55529
  var targetConstraint = getConstraintTypeFromMappedType(target);
55659
- var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMapper : reportUnreliableMapper);
55530
+ var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), makeFunctionTypeMapper(getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers));
55660
55531
  if (result_10 = isRelatedTo(targetConstraint, sourceConstraint, 3, reportErrors)) {
55661
55532
  var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
55662
55533
  if (instantiateType(getNameTypeFromMappedType(source), mapper) === instantiateType(getNameTypeFromMappedType(target), mapper)) {
@@ -55692,11 +55563,11 @@ var ts;
55692
55563
  }
55693
55564
  var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
55694
55565
  var matchingTypes = [];
55695
- var _loop_21 = function (combination) {
55566
+ var _loop_20 = function (combination) {
55696
55567
  var hasMatch = false;
55697
55568
  outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
55698
55569
  var type = _d[_c];
55699
- var _loop_22 = function (i) {
55570
+ var _loop_21 = function (i) {
55700
55571
  var sourceProperty = sourcePropertiesFiltered[i];
55701
55572
  var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
55702
55573
  if (!targetProperty)
@@ -55709,7 +55580,7 @@ var ts;
55709
55580
  }
55710
55581
  };
55711
55582
  for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
55712
- var state_8 = _loop_22(i);
55583
+ var state_8 = _loop_21(i);
55713
55584
  switch (state_8) {
55714
55585
  case "continue-outer": continue outer;
55715
55586
  }
@@ -55723,7 +55594,7 @@ var ts;
55723
55594
  };
55724
55595
  for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
55725
55596
  var combination = discriminantCombinations_1[_a];
55726
- var state_7 = _loop_21(combination);
55597
+ var state_7 = _loop_20(combination);
55727
55598
  if (typeof state_7 === "object")
55728
55599
  return state_7.value;
55729
55600
  }
@@ -56129,7 +56000,7 @@ var ts;
56129
56000
  return function (source, target) { return reportIncompatibleError(ts.Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source), typeToString(target)); };
56130
56001
  }
56131
56002
  function signatureRelatedTo(source, target, erase, reportErrors, incompatibleReporter) {
56132
- 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));
56133
56004
  }
56134
56005
  function signaturesIdenticalTo(source, target, kind) {
56135
56006
  var sourceSignatures = getSignaturesOfType(source, kind);
@@ -56367,7 +56238,7 @@ var ts;
56367
56238
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
56368
56239
  links.variances = ts.emptyArray;
56369
56240
  var variances = [];
56370
- var _loop_23 = function (tp) {
56241
+ var _loop_22 = function (tp) {
56371
56242
  var modifiers = getVarianceModifiers(tp);
56372
56243
  var variance = modifiers & 65536 ?
56373
56244
  modifiers & 32768 ? 0 : 1 :
@@ -56396,12 +56267,12 @@ var ts;
56396
56267
  }
56397
56268
  variances.push(variance);
56398
56269
  };
56399
- for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
56400
- var tp = typeParameters_2[_i];
56401
- _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);
56402
56273
  }
56403
56274
  links.variances = variances;
56404
- 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();
56405
56276
  }
56406
56277
  return links.variances;
56407
56278
  }
@@ -56677,28 +56548,34 @@ var ts;
56677
56548
  var commonBaseType;
56678
56549
  for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
56679
56550
  var t = types_13[_i];
56680
- if (!(t.flags & 131072)) {
56681
- var baseType = getBaseTypeOfLiteralType(t);
56682
- commonBaseType !== null && commonBaseType !== void 0 ? commonBaseType : (commonBaseType = baseType);
56683
- if (baseType === t || baseType !== commonBaseType) {
56684
- return false;
56685
- }
56551
+ var baseType = getBaseTypeOfLiteralType(t);
56552
+ if (!commonBaseType) {
56553
+ commonBaseType = baseType;
56554
+ }
56555
+ if (baseType === t || baseType !== commonBaseType) {
56556
+ return false;
56686
56557
  }
56687
56558
  }
56688
56559
  return true;
56689
56560
  }
56690
- function getCombinedTypeFlags(types) {
56691
- return ts.reduceLeft(types, function (flags, t) { return flags | (t.flags & 1048576 ? getCombinedTypeFlags(t.types) : t.flags); }, 0);
56692
- }
56693
- function getCommonSupertype(types) {
56561
+ function getSupertypeOrUnion(types) {
56694
56562
  if (types.length === 1) {
56695
56563
  return types[0];
56696
56564
  }
56697
- var primaryTypes = strictNullChecks ? ts.sameMap(types, function (t) { return filterType(t, function (u) { return !(u.flags & 98304); }); }) : types;
56698
- var superTypeOrUnion = literalTypesWithSameBaseType(primaryTypes) ?
56699
- getUnionType(primaryTypes) :
56700
- ts.reduceLeft(primaryTypes, function (s, t) { return isTypeSubtypeOf(s, t) ? t : s; });
56701
- 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);
56702
56579
  }
56703
56580
  function getCommonSubtype(types) {
56704
56581
  return ts.reduceLeft(types, function (s, t) { return isTypeSubtypeOf(t, s) ? t : s; });
@@ -56721,6 +56598,42 @@ var ts;
56721
56598
  function isArrayLikeType(type) {
56722
56599
  return isArrayType(type) || !(type.flags & 98304) && isTypeAssignableTo(type, anyReadonlyArrayType);
56723
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
+ }
56724
56637
  function getSingleBaseForNonAugmentingSubtype(type) {
56725
56638
  if (!(ts.getObjectFlags(type) & 4) || !(ts.getObjectFlags(type.target) & 3)) {
56726
56639
  return undefined;
@@ -56797,14 +56710,9 @@ var ts;
56797
56710
  type.flags & 256 ? numberType :
56798
56711
  type.flags & 2048 ? bigintType :
56799
56712
  type.flags & 512 ? booleanType :
56800
- type.flags & 1048576 ? getBaseTypeOfLiteralTypeUnion(type) :
56713
+ type.flags & 1048576 ? mapType(type, getBaseTypeOfLiteralType) :
56801
56714
  type;
56802
56715
  }
56803
- function getBaseTypeOfLiteralTypeUnion(type) {
56804
- var _a;
56805
- var key = "B" + getTypeId(type);
56806
- return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
56807
- }
56808
56716
  function getWidenedLiteralType(type) {
56809
56717
  return type.flags & 1024 && isFreshLiteralType(type) ? getBaseTypeOfEnumLiteralType(type) :
56810
56718
  type.flags & 128 && isFreshLiteralType(type) ? stringType :
@@ -57265,27 +57173,25 @@ var ts;
57265
57173
  signature: signature,
57266
57174
  flags: flags,
57267
57175
  compareTypes: compareTypes,
57268
- mapper: reportUnmeasurableMapper,
57269
- nonFixingMapper: reportUnmeasurableMapper,
57176
+ mapper: makeFunctionTypeMapper(function (t) { return mapToInferredType(context, t, true); }),
57177
+ nonFixingMapper: makeFunctionTypeMapper(function (t) { return mapToInferredType(context, t, false); }),
57270
57178
  };
57271
- context.mapper = makeFixingMapperForContext(context);
57272
- context.nonFixingMapper = makeNonFixingMapperForContext(context);
57273
57179
  return context;
57274
57180
  }
57275
- function makeFixingMapperForContext(context) {
57276
- return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (inference, i) { return function () {
57277
- if (!inference.isFixed) {
57278
- inferFromIntraExpressionSites(context);
57279
- clearCachedInferences(context.inferences);
57280
- 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);
57281
57192
  }
57282
- return getInferredType(context, i);
57283
- }; }));
57284
- }
57285
- function makeNonFixingMapperForContext(context) {
57286
- return makeDeferredTypeMapper(ts.map(context.inferences, function (i) { return i.typeParameter; }), ts.map(context.inferences, function (_, i) { return function () {
57287
- return getInferredType(context, i);
57288
- }; }));
57193
+ }
57194
+ return t;
57289
57195
  }
57290
57196
  function clearCachedInferences(inferences) {
57291
57197
  for (var _i = 0, inferences_1 = inferences; _i < inferences_1.length; _i++) {
@@ -57445,16 +57351,16 @@ var ts;
57445
57351
  return getTypeFromInference(inference) || unknownType;
57446
57352
  }
57447
57353
  function getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
57448
- var properties, _i, properties_2, targetProp, sourceProp, targetType, sourceType;
57354
+ var properties, _i, properties_3, targetProp, sourceProp, targetType, sourceType;
57449
57355
  return __generator(this, function (_a) {
57450
57356
  switch (_a.label) {
57451
57357
  case 0:
57452
57358
  properties = getPropertiesOfType(target);
57453
- _i = 0, properties_2 = properties;
57359
+ _i = 0, properties_3 = properties;
57454
57360
  _a.label = 1;
57455
57361
  case 1:
57456
- if (!(_i < properties_2.length)) return [3, 6];
57457
- targetProp = properties_2[_i];
57362
+ if (!(_i < properties_3.length)) return [3, 6];
57363
+ targetProp = properties_3[_i];
57458
57364
  if (isStaticPrivateIdentifierProperty(targetProp)) {
57459
57365
  return [3, 5];
57460
57366
  }
@@ -57672,10 +57578,8 @@ var ts;
57672
57578
  propagationType = savePropagationType;
57673
57579
  return;
57674
57580
  }
57675
- if (source.aliasSymbol && source.aliasSymbol === target.aliasSymbol) {
57676
- if (source.aliasTypeArguments) {
57677
- inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
57678
- }
57581
+ if (source.aliasSymbol && source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) {
57582
+ inferFromTypeArguments(source.aliasTypeArguments, target.aliasTypeArguments, getAliasVariances(source.aliasSymbol));
57679
57583
  return;
57680
57584
  }
57681
57585
  if (source === target && source.flags & 3145728) {
@@ -57712,7 +57616,7 @@ var ts;
57712
57616
  target = getActualTypeVariable(target);
57713
57617
  }
57714
57618
  if (target.flags & 8650752) {
57715
- if (isFromInferenceBlockedSource(source)) {
57619
+ if (source === nonInferrableAnyType || source === silentNeverType || (priority & 128 && (source === autoType || source === autoArrayType)) || isFromInferenceBlockedSource(source)) {
57716
57620
  return;
57717
57621
  }
57718
57622
  var inference = getInferenceInfoForType(target);
@@ -57767,11 +57671,15 @@ var ts;
57767
57671
  inferFromTypeArguments(getTypeArguments(source), getTypeArguments(target), getVariances(source.target));
57768
57672
  }
57769
57673
  else if (source.flags & 4194304 && target.flags & 4194304) {
57770
- inferFromContravariantTypes(source.type, target.type);
57674
+ contravariant = !contravariant;
57675
+ inferFromTypes(source.type, target.type);
57676
+ contravariant = !contravariant;
57771
57677
  }
57772
57678
  else if ((isLiteralType(source) || source.flags & 4) && target.flags & 4194304) {
57773
57679
  var empty = createEmptyObjectTypeFromStringLiteral(source);
57774
- inferFromContravariantTypesWithPriority(empty, target.type, 256);
57680
+ contravariant = !contravariant;
57681
+ inferWithPriority(empty, target.type, 256);
57682
+ contravariant = !contravariant;
57775
57683
  }
57776
57684
  else if (source.flags & 8388608 && target.flags & 8388608) {
57777
57685
  inferFromTypes(source.objectType, target.objectType);
@@ -57784,7 +57692,10 @@ var ts;
57784
57692
  }
57785
57693
  else if (source.flags & 33554432) {
57786
57694
  inferFromTypes(source.baseType, target);
57787
- inferWithPriority(source.substitute, target, 4);
57695
+ var oldPriority = priority;
57696
+ priority |= 4;
57697
+ inferFromTypes(source.substitute, target);
57698
+ priority = oldPriority;
57788
57699
  }
57789
57700
  else if (target.flags & 16777216) {
57790
57701
  invokeOnce(source, target, inferToConditionalType);
@@ -57823,18 +57734,6 @@ var ts;
57823
57734
  inferFromTypes(source, target);
57824
57735
  priority = savePriority;
57825
57736
  }
57826
- function inferFromContravariantTypesWithPriority(source, target, newPriority) {
57827
- var savePriority = priority;
57828
- priority |= newPriority;
57829
- inferFromContravariantTypes(source, target);
57830
- priority = savePriority;
57831
- }
57832
- function inferToMultipleTypesWithPriority(source, targets, targetFlags, newPriority) {
57833
- var savePriority = priority;
57834
- priority |= newPriority;
57835
- inferToMultipleTypes(source, targets, targetFlags);
57836
- priority = savePriority;
57837
- }
57838
57737
  function invokeOnce(source, target, action) {
57839
57738
  var key = source.id + "," + target.id;
57840
57739
  var status = visited && visited.get(key);
@@ -57897,13 +57796,10 @@ var ts;
57897
57796
  }
57898
57797
  }
57899
57798
  function inferFromContravariantTypes(source, target) {
57900
- contravariant = !contravariant;
57901
- inferFromTypes(source, target);
57902
- contravariant = !contravariant;
57903
- }
57904
- function inferFromContravariantTypesIfStrictFunctionTypes(source, target) {
57905
57799
  if (strictFunctionTypes || priority & 1024) {
57906
- inferFromContravariantTypes(source, target);
57800
+ contravariant = !contravariant;
57801
+ inferFromTypes(source, target);
57802
+ contravariant = !contravariant;
57907
57803
  }
57908
57804
  else {
57909
57805
  inferFromTypes(source, target);
@@ -58034,15 +57930,18 @@ var ts;
58034
57930
  inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
58035
57931
  }
58036
57932
  else {
57933
+ var savePriority = priority;
57934
+ priority |= contravariant ? 64 : 0;
58037
57935
  var targetTypes = [getTrueTypeFromConditionalType(target), getFalseTypeFromConditionalType(target)];
58038
- inferToMultipleTypesWithPriority(source, targetTypes, target.flags, contravariant ? 64 : 0);
57936
+ inferToMultipleTypes(source, targetTypes, target.flags);
57937
+ priority = savePriority;
58039
57938
  }
58040
57939
  }
58041
57940
  function inferToTemplateLiteralType(source, target) {
58042
57941
  var matches = inferTypesFromTemplateLiteralType(source, target);
58043
57942
  var types = target.types;
58044
57943
  if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
58045
- var _loop_24 = function (i) {
57944
+ var _loop_23 = function (i) {
58046
57945
  var source_1 = matches ? matches[i] : neverType;
58047
57946
  var target_3 = types[i];
58048
57947
  if (source_1.flags & 128 && target_3.flags & 8650752) {
@@ -58086,7 +57985,7 @@ var ts;
58086
57985
  inferFromTypes(source_1, target_3);
58087
57986
  };
58088
57987
  for (var i = 0; i < types.length; i++) {
58089
- _loop_24(i);
57988
+ _loop_23(i);
58090
57989
  }
58091
57990
  }
58092
57991
  }
@@ -58110,57 +58009,58 @@ var ts;
58110
58009
  }
58111
58010
  }
58112
58011
  if (!typesDefinitelyUnrelated(source, target)) {
58113
- if (isArrayOrTupleType(source)) {
58012
+ var sourceArrayOrTuple = tryGetNonShadowedArrayOrTupleType(source);
58013
+ if (sourceArrayOrTuple) {
58114
58014
  if (isTupleType(target)) {
58115
- var sourceArity = getTypeReferenceArity(source);
58015
+ var sourceArity = getTypeReferenceArity(sourceArrayOrTuple);
58116
58016
  var targetArity = getTypeReferenceArity(target);
58117
58017
  var elementTypes = getTypeArguments(target);
58118
58018
  var elementFlags = target.target.elementFlags;
58119
- if (isTupleType(source) && isTupleTypeStructureMatching(source, target)) {
58019
+ if (isTupleType(sourceArrayOrTuple) && isTupleTypeStructureMatching(sourceArrayOrTuple, target)) {
58120
58020
  for (var i = 0; i < targetArity; i++) {
58121
- inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
58021
+ inferFromTypes(getTypeArguments(sourceArrayOrTuple)[i], elementTypes[i]);
58122
58022
  }
58123
58023
  return;
58124
58024
  }
58125
- var startLength = isTupleType(source) ? Math.min(source.target.fixedLength, target.target.fixedLength) : 0;
58126
- 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);
58127
58027
  for (var i = 0; i < startLength; i++) {
58128
- inferFromTypes(getTypeArguments(source)[i], elementTypes[i]);
58028
+ inferFromTypes(getTypeArguments(sourceArrayOrTuple)[i], elementTypes[i]);
58129
58029
  }
58130
- if (!isTupleType(source) || sourceArity - startLength - endLength === 1 && source.target.elementFlags[startLength] & 4) {
58131
- var restType = getTypeArguments(source)[startLength];
58030
+ if (!isTupleType(sourceArrayOrTuple) || sourceArity - startLength - endLength === 1 && sourceArrayOrTuple.target.elementFlags[startLength] & 4) {
58031
+ var restType = getTypeArguments(sourceArrayOrTuple)[startLength];
58132
58032
  for (var i = startLength; i < targetArity - endLength; i++) {
58133
58033
  inferFromTypes(elementFlags[i] & 8 ? createArrayType(restType) : restType, elementTypes[i]);
58134
58034
  }
58135
58035
  }
58136
58036
  else {
58137
58037
  var middleLength = targetArity - startLength - endLength;
58138
- if (middleLength === 2 && elementFlags[startLength] & elementFlags[startLength + 1] & 8 && isTupleType(source)) {
58038
+ if (middleLength === 2 && elementFlags[startLength] & elementFlags[startLength + 1] & 8 && isTupleType(sourceArrayOrTuple)) {
58139
58039
  var targetInfo = getInferenceInfoForType(elementTypes[startLength]);
58140
58040
  if (targetInfo && targetInfo.impliedArity !== undefined) {
58141
- inferFromTypes(sliceTupleType(source, startLength, endLength + sourceArity - targetInfo.impliedArity), elementTypes[startLength]);
58142
- 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]);
58143
58043
  }
58144
58044
  }
58145
58045
  else if (middleLength === 1 && elementFlags[startLength] & 8) {
58146
58046
  var endsInOptional = target.target.elementFlags[targetArity - 1] & 2;
58147
- 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]);
58148
58048
  inferWithPriority(sourceSlice, elementTypes[startLength], endsInOptional ? 2 : 0);
58149
58049
  }
58150
58050
  else if (middleLength === 1 && elementFlags[startLength] & 4) {
58151
- var restType = isTupleType(source) ? getElementTypeOfSliceOfTupleType(source, startLength, endLength) : getTypeArguments(source)[0];
58051
+ var restType = isTupleType(sourceArrayOrTuple) ? getElementTypeOfSliceOfTupleType(sourceArrayOrTuple, startLength, endLength) : getTypeArguments(sourceArrayOrTuple)[0];
58152
58052
  if (restType) {
58153
58053
  inferFromTypes(restType, elementTypes[startLength]);
58154
58054
  }
58155
58055
  }
58156
58056
  }
58157
58057
  for (var i = 0; i < endLength; i++) {
58158
- inferFromTypes(getTypeArguments(source)[sourceArity - i - 1], elementTypes[targetArity - i - 1]);
58058
+ inferFromTypes(getTypeArguments(sourceArrayOrTuple)[sourceArity - i - 1], elementTypes[targetArity - i - 1]);
58159
58059
  }
58160
58060
  return;
58161
58061
  }
58162
58062
  if (isArrayType(target)) {
58163
- inferFromIndexTypes(source, target);
58063
+ inferFromIndexTypes(sourceArrayOrTuple, target);
58164
58064
  return;
58165
58065
  }
58166
58066
  }
@@ -58172,8 +58072,8 @@ var ts;
58172
58072
  }
58173
58073
  function inferFromProperties(source, target) {
58174
58074
  var properties = getPropertiesOfObjectType(target);
58175
- for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {
58176
- var targetProp = properties_3[_i];
58075
+ for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
58076
+ var targetProp = properties_4[_i];
58177
58077
  var sourceProp = getPropertyOfType(source, targetProp.escapedName);
58178
58078
  if (sourceProp && !ts.some(sourceProp.declarations, hasSkipDirectInferenceFlag)) {
58179
58079
  inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
@@ -58186,16 +58086,19 @@ var ts;
58186
58086
  var sourceLen = sourceSignatures.length;
58187
58087
  var targetLen = targetSignatures.length;
58188
58088
  var len = sourceLen < targetLen ? sourceLen : targetLen;
58089
+ var skipParameters = !!(ts.getObjectFlags(source) & 262144);
58189
58090
  for (var i = 0; i < len; i++) {
58190
- inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]));
58091
+ inferFromSignature(getBaseSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i]), skipParameters);
58191
58092
  }
58192
58093
  }
58193
- function inferFromSignature(source, target) {
58194
- var saveBivariant = bivariant;
58195
- var kind = target.declaration ? target.declaration.kind : 0;
58196
- bivariant = bivariant || kind === 169 || kind === 168 || kind === 171;
58197
- applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes);
58198
- 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
+ }
58199
58102
  applyToReturnTypes(source, target, inferFromTypes);
58200
58103
  }
58201
58104
  function inferFromIndexTypes(source, target) {
@@ -58413,14 +58316,6 @@ var ts;
58413
58316
  var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
58414
58317
  return key && key + "." + propName;
58415
58318
  }
58416
- break;
58417
- case 201:
58418
- case 202:
58419
- case 256:
58420
- case 213:
58421
- case 214:
58422
- case 169:
58423
- return getNodeId(node) + "#" + getTypeId(declaredType);
58424
58319
  }
58425
58320
  return undefined;
58426
58321
  }
@@ -58561,7 +58456,7 @@ var ts;
58561
58456
  function mapTypesByKeyProperty(types, name) {
58562
58457
  var map = new ts.Map();
58563
58458
  var count = 0;
58564
- var _loop_25 = function (type) {
58459
+ var _loop_24 = function (type) {
58565
58460
  if (type.flags & (524288 | 2097152 | 58982400)) {
58566
58461
  var discriminant = getTypeOfPropertyOfType(type, name);
58567
58462
  if (discriminant) {
@@ -58587,7 +58482,7 @@ var ts;
58587
58482
  };
58588
58483
  for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
58589
58484
  var type = types_15[_i];
58590
- var state_9 = _loop_25(type);
58485
+ var state_9 = _loop_24(type);
58591
58486
  if (typeof state_9 === "object")
58592
58487
  return state_9.value;
58593
58488
  }
@@ -58666,20 +58561,19 @@ var ts;
58666
58561
  return false;
58667
58562
  }
58668
58563
  function getAssignmentReducedType(declaredType, assignedType) {
58669
- var _a;
58670
- if (declaredType === assignedType) {
58671
- return declaredType;
58672
- }
58673
- if (assignedType.flags & 131072) {
58674
- 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
+ }
58675
58575
  }
58676
- var key = "A" + getTypeId(declaredType) + "," + getTypeId(assignedType);
58677
- return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, getAssignmentReducedTypeWorker(declaredType, assignedType));
58678
- }
58679
- function getAssignmentReducedTypeWorker(declaredType, assignedType) {
58680
- var filteredType = filterType(declaredType, function (t) { return typeMaybeAssignableTo(assignedType, t); });
58681
- var reducedType = assignedType.flags & 512 && isFreshLiteralType(assignedType) ? mapType(filteredType, getFreshTypeOfLiteralType) : filteredType;
58682
- return isTypeAssignableTo(assignedType, reducedType) ? reducedType : declaredType;
58576
+ return declaredType;
58683
58577
  }
58684
58578
  function isFunctionObjectType(type) {
58685
58579
  var resolved = resolveStructuredTypeMembers(type);
@@ -59521,7 +59415,7 @@ var ts;
59521
59415
  return declaredType;
59522
59416
  }
59523
59417
  if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 && isMatchingReference(reference, node.parent.parent.expression)) {
59524
- return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent))));
59418
+ return getNonNullableTypeIfNeeded(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)));
59525
59419
  }
59526
59420
  return undefined;
59527
59421
  }
@@ -59948,7 +59842,7 @@ var ts;
59948
59842
  var targetType = ts.hasStaticModifier(ts.Debug.checkDefined(symbol.valueDeclaration, "should always have a declaration"))
59949
59843
  ? getTypeOfSymbol(classSymbol)
59950
59844
  : getDeclaredTypeOfSymbol(classSymbol);
59951
- return getNarrowedType(type, targetType, assumeTrue, true);
59845
+ return getNarrowedType(type, targetType, assumeTrue, isTypeDerivedFrom);
59952
59846
  }
59953
59847
  function narrowTypeByOptionalChainContainment(type, operator, value, assumeTrue) {
59954
59848
  var equalsOperator = operator === 34 || operator === 36;
@@ -60157,37 +60051,22 @@ var ts;
60157
60051
  if (!nonConstructorTypeInUnion)
60158
60052
  return type;
60159
60053
  }
60160
- return getNarrowedType(type, targetType, assumeTrue, true);
60054
+ return getNarrowedType(type, targetType, assumeTrue, isTypeDerivedFrom);
60161
60055
  }
60162
- function getNarrowedType(type, candidate, assumeTrue, checkDerived) {
60163
- var _a;
60164
- var key = type.flags & 1048576 ? "N" + getTypeId(type) + "," + getTypeId(candidate) + "," + ((assumeTrue ? 1 : 0) | (checkDerived ? 2 : 0)) : undefined;
60165
- return (_a = getCachedType(key)) !== null && _a !== void 0 ? _a : setCachedType(key, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
60166
- }
60167
- function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
60168
- var isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
60056
+ function getNarrowedType(type, candidate, assumeTrue, isRelated) {
60169
60057
  if (!assumeTrue) {
60170
60058
  return filterType(type, function (t) { return !isRelated(t, candidate); });
60171
60059
  }
60172
- if (type.flags & 3) {
60173
- 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
+ }
60174
60065
  }
60175
- var keyPropertyName = type.flags & 1048576 ? getKeyPropertyName(type) : undefined;
60176
- var narrowedType = mapType(candidate, function (c) {
60177
- var discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
60178
- var matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
60179
- var directlyRelated = mapType(matching || type, checkDerived ?
60180
- function (t) { return isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType; } :
60181
- function (t) { return isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType; });
60182
- return directlyRelated.flags & 131072 ?
60183
- mapType(type, function (t) { return maybeTypeOfKind(t, 465829888) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
60184
- directlyRelated;
60185
- });
60186
- return !(narrowedType.flags & 131072) ? narrowedType :
60187
- isTypeSubtypeOf(candidate, type) ? candidate :
60188
- isTypeAssignableTo(type, candidate) ? type :
60189
- isTypeAssignableTo(candidate, type) ? candidate :
60190
- getIntersectionType([type, candidate]);
60066
+ return isTypeSubtypeOf(candidate, type) ? candidate :
60067
+ isTypeAssignableTo(type, candidate) ? type :
60068
+ isTypeAssignableTo(candidate, type) ? candidate :
60069
+ getIntersectionType([type, candidate]);
60191
60070
  }
60192
60071
  function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
60193
60072
  if (hasMatchingArgument(callExpression, reference)) {
@@ -60214,7 +60093,7 @@ var ts;
60214
60093
  var predicateArgument = getTypePredicateArgument(predicate, callExpression);
60215
60094
  if (predicateArgument) {
60216
60095
  if (isMatchingReference(reference, predicateArgument)) {
60217
- return getNarrowedType(type, predicate.type, assumeTrue, false);
60096
+ return getNarrowedType(type, predicate.type, assumeTrue, isTypeSubtypeOf);
60218
60097
  }
60219
60098
  if (strictNullChecks && assumeTrue && optionalChainContainsReference(predicateArgument, reference) &&
60220
60099
  !(getTypeFacts(predicate.type) & 65536)) {
@@ -60222,7 +60101,7 @@ var ts;
60222
60101
  }
60223
60102
  var access = getDiscriminantPropertyAccess(predicateArgument, type);
60224
60103
  if (access) {
60225
- 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); });
60226
60105
  }
60227
60106
  }
60228
60107
  }
@@ -60375,7 +60254,7 @@ var ts;
60375
60254
  !((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
60376
60255
  (checkMode && checkMode & 64 ?
60377
60256
  getContextualType(node, 8)
60378
- : getContextualType(node, undefined));
60257
+ : getContextualType(node));
60379
60258
  return contextualType && !isGenericType(contextualType);
60380
60259
  }
60381
60260
  function getNarrowableTypeForReference(type, reference, checkMode) {
@@ -60478,7 +60357,7 @@ var ts;
60478
60357
  getNodeLinks(container).flags |= 8192;
60479
60358
  return getTypeOfSymbol(symbol);
60480
60359
  }
60481
- if (shouldMarkIdentifierAliasReferenced(node)) {
60360
+ if (!(node.parent && ts.isPropertyAccessExpression(node.parent) && node.parent.expression === node)) {
60482
60361
  markAliasReferenced(symbol, node);
60483
60362
  }
60484
60363
  var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
@@ -60591,23 +60470,6 @@ var ts;
60591
60470
  }
60592
60471
  return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType;
60593
60472
  }
60594
- function shouldMarkIdentifierAliasReferenced(node) {
60595
- var _a;
60596
- var parent = node.parent;
60597
- if (parent) {
60598
- if (ts.isPropertyAccessExpression(parent) && parent.expression === node) {
60599
- return false;
60600
- }
60601
- if (ts.isExportSpecifier(parent) && parent.isTypeOnly) {
60602
- return false;
60603
- }
60604
- var greatGrandparent = (_a = parent.parent) === null || _a === void 0 ? void 0 : _a.parent;
60605
- if (greatGrandparent && ts.isExportDeclaration(greatGrandparent) && greatGrandparent.isTypeOnly) {
60606
- return false;
60607
- }
60608
- }
60609
- return true;
60610
- }
60611
60473
  function isInsideFunctionOrInstancePropertyInitializer(node, threshold) {
60612
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); });
60613
60475
  }
@@ -61032,7 +60894,7 @@ var ts;
61032
60894
  if (noImplicitThis || inJs) {
61033
60895
  var containingLiteral = getContainingObjectLiteral(func);
61034
60896
  if (containingLiteral) {
61035
- var contextualType = getApparentTypeOfContextualType(containingLiteral, undefined);
60897
+ var contextualType = getApparentTypeOfContextualType(containingLiteral);
61036
60898
  var literal = containingLiteral;
61037
60899
  var type = contextualType;
61038
60900
  while (type) {
@@ -61044,7 +60906,7 @@ var ts;
61044
60906
  break;
61045
60907
  }
61046
60908
  literal = literal.parent.parent;
61047
- type = getApparentTypeOfContextualType(literal, undefined);
60909
+ type = getApparentTypeOfContextualType(literal);
61048
60910
  }
61049
60911
  return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral));
61050
60912
  }
@@ -61094,7 +60956,7 @@ var ts;
61094
60956
  tryGetTypeAtPosition(contextualSignature, index);
61095
60957
  }
61096
60958
  }
61097
- function getContextualTypeForVariableLikeDeclaration(declaration, contextFlags) {
60959
+ function getContextualTypeForVariableLikeDeclaration(declaration) {
61098
60960
  var typeNode = ts.getEffectiveTypeAnnotationNode(declaration);
61099
60961
  if (typeNode) {
61100
60962
  return getTypeFromTypeNode(typeNode);
@@ -61103,17 +60965,17 @@ var ts;
61103
60965
  case 164:
61104
60966
  return getContextuallyTypedParameterType(declaration);
61105
60967
  case 203:
61106
- return getContextualTypeForBindingElement(declaration, contextFlags);
60968
+ return getContextualTypeForBindingElement(declaration);
61107
60969
  case 167:
61108
60970
  if (ts.isStatic(declaration)) {
61109
- return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags);
60971
+ return getContextualTypeForStaticPropertyDeclaration(declaration);
61110
60972
  }
61111
60973
  }
61112
60974
  }
61113
- function getContextualTypeForBindingElement(declaration, contextFlags) {
60975
+ function getContextualTypeForBindingElement(declaration) {
61114
60976
  var parent = declaration.parent.parent;
61115
60977
  var name = declaration.propertyName || declaration.name;
61116
- var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) ||
60978
+ var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
61117
60979
  parent.kind !== 203 && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 : 0);
61118
60980
  if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
61119
60981
  return undefined;
@@ -61129,8 +60991,8 @@ var ts;
61129
60991
  return getTypeOfPropertyOfType(parentType, text);
61130
60992
  }
61131
60993
  }
61132
- function getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags) {
61133
- var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent, contextFlags);
60994
+ function getContextualTypeForStaticPropertyDeclaration(declaration) {
60995
+ var parentType = ts.isExpression(declaration.parent) && getContextualType(declaration.parent);
61134
60996
  if (!parentType)
61135
60997
  return undefined;
61136
60998
  return getTypeOfPropertyOfContextualType(parentType, getSymbolOfNode(declaration).escapedName);
@@ -61138,7 +61000,7 @@ var ts;
61138
61000
  function getContextualTypeForInitializerExpression(node, contextFlags) {
61139
61001
  var declaration = node.parent;
61140
61002
  if (ts.hasInitializer(declaration) && node === declaration.initializer) {
61141
- var result = getContextualTypeForVariableLikeDeclaration(declaration, contextFlags);
61003
+ var result = getContextualTypeForVariableLikeDeclaration(declaration);
61142
61004
  if (result) {
61143
61005
  return result;
61144
61006
  }
@@ -61148,10 +61010,10 @@ var ts;
61148
61010
  }
61149
61011
  return undefined;
61150
61012
  }
61151
- function getContextualTypeForReturnExpression(node, contextFlags) {
61013
+ function getContextualTypeForReturnExpression(node) {
61152
61014
  var func = ts.getContainingFunction(node);
61153
61015
  if (func) {
61154
- var contextualReturnType = getContextualReturnType(func, contextFlags);
61016
+ var contextualReturnType = getContextualReturnType(func);
61155
61017
  if (contextualReturnType) {
61156
61018
  var functionFlags = ts.getFunctionFlags(func);
61157
61019
  if (functionFlags & 1) {
@@ -61179,11 +61041,11 @@ var ts;
61179
61041
  }
61180
61042
  return undefined;
61181
61043
  }
61182
- function getContextualTypeForYieldOperand(node, contextFlags) {
61044
+ function getContextualTypeForYieldOperand(node) {
61183
61045
  var func = ts.getContainingFunction(node);
61184
61046
  if (func) {
61185
61047
  var functionFlags = ts.getFunctionFlags(func);
61186
- var contextualReturnType = getContextualReturnType(func, contextFlags);
61048
+ var contextualReturnType = getContextualReturnType(func);
61187
61049
  if (contextualReturnType) {
61188
61050
  return node.asteriskToken
61189
61051
  ? contextualReturnType
@@ -61207,14 +61069,14 @@ var ts;
61207
61069
  }
61208
61070
  function getContextualIterationType(kind, functionDecl) {
61209
61071
  var isAsync = !!(ts.getFunctionFlags(functionDecl) & 2);
61210
- var contextualReturnType = getContextualReturnType(functionDecl, undefined);
61072
+ var contextualReturnType = getContextualReturnType(functionDecl);
61211
61073
  if (contextualReturnType) {
61212
61074
  return getIterationTypeOfGeneratorFunctionReturnType(kind, contextualReturnType, isAsync)
61213
61075
  || undefined;
61214
61076
  }
61215
61077
  return undefined;
61216
61078
  }
61217
- function getContextualReturnType(functionDecl, contextFlags) {
61079
+ function getContextualReturnType(functionDecl) {
61218
61080
  var returnType = getReturnTypeFromAnnotation(functionDecl);
61219
61081
  if (returnType) {
61220
61082
  return returnType;
@@ -61225,7 +61087,7 @@ var ts;
61225
61087
  }
61226
61088
  var iife = ts.getImmediatelyInvokedFunctionExpression(functionDecl);
61227
61089
  if (iife) {
61228
- return getContextualType(iife, contextFlags);
61090
+ return getContextualType(iife);
61229
61091
  }
61230
61092
  return undefined;
61231
61093
  }
@@ -61287,14 +61149,6 @@ var ts;
61287
61149
  var lhsType = getTypeOfExpression(e.expression);
61288
61150
  return ts.isPrivateIdentifier(e.name) ? tryGetPrivateIdentifierPropertyOfType(lhsType, e.name) : getPropertyOfType(lhsType, e.name.escapedText);
61289
61151
  }
61290
- if (ts.isElementAccessExpression(e)) {
61291
- var propType = checkExpressionCached(e.argumentExpression);
61292
- if (!isTypeUsableAsPropertyName(propType)) {
61293
- return undefined;
61294
- }
61295
- var lhsType = getTypeOfExpression(e.expression);
61296
- return getPropertyOfType(lhsType, getPropertyNameFromType(propType));
61297
- }
61298
61152
  return undefined;
61299
61153
  function tryGetPrivateIdentifierPropertyOfType(type, id) {
61300
61154
  var lexicallyScopedSymbol = lookupSymbolForPrivateIdentifierDeclaration(id.escapedText, id);
@@ -61463,7 +61317,7 @@ var ts;
61463
61317
  }
61464
61318
  function getContextualTypeForObjectLiteralElement(element, contextFlags) {
61465
61319
  var objectLiteral = element.parent;
61466
- var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element, contextFlags);
61320
+ var propertyAssignmentType = ts.isPropertyAssignment(element) && getContextualTypeForVariableLikeDeclaration(element);
61467
61321
  if (propertyAssignmentType) {
61468
61322
  return propertyAssignmentType;
61469
61323
  }
@@ -61488,8 +61342,8 @@ var ts;
61488
61342
  var conditional = node.parent;
61489
61343
  return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : undefined;
61490
61344
  }
61491
- function getContextualTypeForChildJsxExpression(node, child, contextFlags) {
61492
- var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName, contextFlags);
61345
+ function getContextualTypeForChildJsxExpression(node, child) {
61346
+ var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName);
61493
61347
  var jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
61494
61348
  if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
61495
61349
  return undefined;
@@ -61506,24 +61360,24 @@ var ts;
61506
61360
  }
61507
61361
  }, true));
61508
61362
  }
61509
- function getContextualTypeForJsxExpression(node, contextFlags) {
61363
+ function getContextualTypeForJsxExpression(node) {
61510
61364
  var exprParent = node.parent;
61511
61365
  return ts.isJsxAttributeLike(exprParent)
61512
- ? getContextualType(node, contextFlags)
61366
+ ? getContextualType(node)
61513
61367
  : ts.isJsxElement(exprParent)
61514
- ? getContextualTypeForChildJsxExpression(exprParent, node, contextFlags)
61368
+ ? getContextualTypeForChildJsxExpression(exprParent, node)
61515
61369
  : undefined;
61516
61370
  }
61517
- function getContextualTypeForJsxAttribute(attribute, contextFlags) {
61371
+ function getContextualTypeForJsxAttribute(attribute) {
61518
61372
  if (ts.isJsxAttribute(attribute)) {
61519
- var attributesType = getApparentTypeOfContextualType(attribute.parent, contextFlags);
61373
+ var attributesType = getApparentTypeOfContextualType(attribute.parent);
61520
61374
  if (!attributesType || isTypeAny(attributesType)) {
61521
61375
  return undefined;
61522
61376
  }
61523
61377
  return getTypeOfPropertyOfContextualType(attributesType, attribute.name.escapedText);
61524
61378
  }
61525
61379
  else {
61526
- return getContextualType(attribute.parent, contextFlags);
61380
+ return getContextualType(attribute.parent);
61527
61381
  }
61528
61382
  }
61529
61383
  function isPossiblyDiscriminantValue(node) {
@@ -61608,9 +61462,9 @@ var ts;
61608
61462
  return getContextualTypeForInitializerExpression(node, contextFlags);
61609
61463
  case 214:
61610
61464
  case 247:
61611
- return getContextualTypeForReturnExpression(node, contextFlags);
61465
+ return getContextualTypeForReturnExpression(node);
61612
61466
  case 224:
61613
- return getContextualTypeForYieldOperand(parent, contextFlags);
61467
+ return getContextualTypeForYieldOperand(parent);
61614
61468
  case 218:
61615
61469
  return getContextualTypeForAwaitOperand(parent, contextFlags);
61616
61470
  case 208:
@@ -61647,17 +61501,17 @@ var ts;
61647
61501
  case 271:
61648
61502
  return tryGetTypeFromEffectiveTypeNode(parent);
61649
61503
  case 288:
61650
- return getContextualTypeForJsxExpression(parent, contextFlags);
61504
+ return getContextualTypeForJsxExpression(parent);
61651
61505
  case 285:
61652
61506
  case 287:
61653
- return getContextualTypeForJsxAttribute(parent, contextFlags);
61507
+ return getContextualTypeForJsxAttribute(parent);
61654
61508
  case 280:
61655
61509
  case 279:
61656
61510
  return getContextualJsxElementAttributesType(parent, contextFlags);
61657
61511
  }
61658
61512
  return undefined;
61659
61513
  function tryFindWhenConstTypeReference(node) {
61660
- return getContextualType(node, contextFlags);
61514
+ return getContextualType(node);
61661
61515
  }
61662
61516
  }
61663
61517
  function getInferenceContext(node) {
@@ -61914,7 +61768,37 @@ var ts;
61914
61768
  var arrayOrIterableType = checkExpression(node.expression, checkMode);
61915
61769
  return checkIteratedTypeOrElementType(33, arrayOrIterableType, undefinedType, node.expression);
61916
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
+ }
61917
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
+ }
61918
61802
  return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type;
61919
61803
  }
61920
61804
  function hasDefaultValue(node) {
@@ -61926,7 +61810,7 @@ var ts;
61926
61810
  var elementCount = elements.length;
61927
61811
  var elementTypes = [];
61928
61812
  var elementFlags = [];
61929
- var contextualType = getApparentTypeOfContextualType(node, undefined);
61813
+ var contextualType = getApparentTypeOfContextualType(node);
61930
61814
  var inDestructuringPattern = ts.isAssignmentTarget(node);
61931
61815
  var inConstContext = isConstContext(node);
61932
61816
  var hasOmittedExpression = false;
@@ -62075,7 +61959,7 @@ var ts;
62075
61959
  var propertiesTable = ts.createSymbolTable();
62076
61960
  var propertiesArray = [];
62077
61961
  var spread = emptyObjectType;
62078
- var contextualType = getApparentTypeOfContextualType(node, undefined);
61962
+ var contextualType = getApparentTypeOfContextualType(node);
62079
61963
  var contextualTypeHasPattern = contextualType && contextualType.pattern &&
62080
61964
  (contextualType.pattern.kind === 201 || contextualType.pattern.kind === 205);
62081
61965
  var inConstContext = isConstContext(node);
@@ -62373,7 +62257,7 @@ var ts;
62373
62257
  if (explicitlySpecifyChildrenAttribute) {
62374
62258
  error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName));
62375
62259
  }
62376
- var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes, undefined);
62260
+ var contextualType = getApparentTypeOfContextualType(openingLikeElement.attributes);
62377
62261
  var childrenContextualType = contextualType && getTypeOfPropertyOfContextualType(contextualType, jsxChildrenPropertyName);
62378
62262
  var childrenPropSymbol = createSymbol(4, jsxChildrenPropertyName);
62379
62263
  childrenPropSymbol.type = childrenTypes.length === 1 ? childrenTypes[0] :
@@ -64037,7 +63921,7 @@ var ts;
64037
63921
  var spreadIndex = getSpreadArgumentIndex(args);
64038
63922
  if (spreadIndex >= 0) {
64039
63923
  var effectiveArgs_1 = args.slice(0, spreadIndex);
64040
- var _loop_26 = function (i) {
63924
+ var _loop_25 = function (i) {
64041
63925
  var arg = args[i];
64042
63926
  var spreadType = arg.kind === 225 && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
64043
63927
  if (spreadType && isTupleType(spreadType)) {
@@ -64053,7 +63937,7 @@ var ts;
64053
63937
  }
64054
63938
  };
64055
63939
  for (var i = spreadIndex; i < args.length; i++) {
64056
- _loop_26(i);
63940
+ _loop_25(i);
64057
63941
  }
64058
63942
  return effectiveArgs_1;
64059
63943
  }
@@ -64239,7 +64123,7 @@ var ts;
64239
64123
  var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
64240
64124
  var reportErrors = !candidatesOutArray;
64241
64125
  var typeArguments;
64242
- if (!isDecorator && !ts.isSuperCall(node)) {
64126
+ if (!isDecorator) {
64243
64127
  typeArguments = node.typeArguments;
64244
64128
  if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 106) {
64245
64129
  ts.forEach(typeArguments, checkSourceElement);
@@ -64271,8 +64155,6 @@ var ts;
64271
64155
  if (result) {
64272
64156
  return result;
64273
64157
  }
64274
- result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
64275
- getNodeLinks(node).resolvedSignature = result;
64276
64158
  if (reportErrors) {
64277
64159
  if (candidatesForArgumentError) {
64278
64160
  if (candidatesForArgumentError.length === 1 || candidatesForArgumentError.length > 3) {
@@ -64303,7 +64185,7 @@ var ts;
64303
64185
  var min_3 = Number.MAX_VALUE;
64304
64186
  var minIndex = 0;
64305
64187
  var i_1 = 0;
64306
- var _loop_27 = function (c) {
64188
+ var _loop_26 = function (c) {
64307
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)); };
64308
64190
  var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0, true, chain_2);
64309
64191
  if (diags_2) {
@@ -64321,7 +64203,7 @@ var ts;
64321
64203
  };
64322
64204
  for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
64323
64205
  var c = candidatesForArgumentError_1[_a];
64324
- _loop_27(c);
64206
+ _loop_26(c);
64325
64207
  }
64326
64208
  var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
64327
64209
  ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
@@ -64358,7 +64240,7 @@ var ts;
64358
64240
  }
64359
64241
  }
64360
64242
  }
64361
- return result;
64243
+ return getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
64362
64244
  function addImplementationSuccessElaboration(failed, diagnostic) {
64363
64245
  var _a, _b;
64364
64246
  var oldCandidatesForArgumentError = candidatesForArgumentError;
@@ -64432,7 +64314,7 @@ var ts;
64432
64314
  argCheckMode = checkMode & 32;
64433
64315
  if (inferenceContext) {
64434
64316
  var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
64435
- checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
64317
+ checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
64436
64318
  if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma)) {
64437
64319
  candidateForArgumentArityError = checkCandidate;
64438
64320
  continue;
@@ -64464,7 +64346,7 @@ var ts;
64464
64346
  }
64465
64347
  var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
64466
64348
  var parameters = [];
64467
- var _loop_28 = function (i) {
64349
+ var _loop_27 = function (i) {
64468
64350
  var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
64469
64351
  i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
64470
64352
  i < s.parameters.length ? s.parameters[i] : undefined; });
@@ -64472,7 +64354,7 @@ var ts;
64472
64354
  parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
64473
64355
  };
64474
64356
  for (var i = 0; i < maxNonRestParam; i++) {
64475
- _loop_28(i);
64357
+ _loop_27(i);
64476
64358
  }
64477
64359
  var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
64478
64360
  var flags = 0;
@@ -65071,7 +64953,7 @@ var ts;
65071
64953
  checkGrammarTypeArguments(node, node.typeArguments);
65072
64954
  var signature = getResolvedSignature(node, undefined, checkMode);
65073
64955
  if (signature === resolvingSignature) {
65074
- return silentNeverType;
64956
+ return nonInferrableType;
65075
64957
  }
65076
64958
  checkDeprecatedSignature(signature, node);
65077
64959
  if (node.expression.kind === 106) {
@@ -65661,6 +65543,13 @@ var ts;
65661
65543
  }
65662
65544
  }
65663
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
+ }
65664
65553
  }
65665
65554
  function assignContextualParameterTypes(signature, context) {
65666
65555
  if (context.typeParameters) {
@@ -65833,7 +65722,7 @@ var ts;
65833
65722
  var contextualSignature = getContextualSignatureForFunctionLikeDeclaration(func);
65834
65723
  var contextualType = !contextualSignature ? undefined :
65835
65724
  contextualSignature === getSignatureFromDeclaration(func) ? isGenerator ? undefined : returnType :
65836
- instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func, undefined);
65725
+ instantiateContextualType(getReturnTypeOfSignature(contextualSignature), func);
65837
65726
  if (isGenerator) {
65838
65727
  yieldType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(yieldType, contextualType, 0, isAsync);
65839
65728
  returnType = getWidenedLiteralLikeTypeForContextualIterationTypeIfNeeded(returnType, contextualType, 1, isAsync);
@@ -65896,7 +65785,7 @@ var ts;
65896
65785
  nextType = iterationTypes && iterationTypes.nextType;
65897
65786
  }
65898
65787
  else {
65899
- nextType = getContextualType(yieldExpression, undefined);
65788
+ nextType = getContextualType(yieldExpression);
65900
65789
  }
65901
65790
  if (nextType)
65902
65791
  ts.pushIfUnique(nextTypes, nextType);
@@ -66069,16 +65958,11 @@ var ts;
66069
65958
  if (isContextSensitive(node)) {
66070
65959
  if (contextualSignature) {
66071
65960
  var inferenceContext = getInferenceContext(node);
66072
- var instantiatedContextualSignature = void 0;
66073
65961
  if (checkMode && checkMode & 2) {
66074
65962
  inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext);
66075
- var restType = getEffectiveRestType(contextualSignature);
66076
- if (restType && restType.flags & 262144) {
66077
- instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext.nonFixingMapper);
66078
- }
66079
65963
  }
66080
- instantiatedContextualSignature || (instantiatedContextualSignature = inferenceContext ?
66081
- instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature);
65964
+ var instantiatedContextualSignature = inferenceContext ?
65965
+ instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature;
66082
65966
  assignContextualParameterTypes(signature, instantiatedContextualSignature);
66083
65967
  }
66084
65968
  else {
@@ -66347,7 +66231,7 @@ var ts;
66347
66231
  error(node.operand, ts.Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, ts.tokenToString(node.operator));
66348
66232
  }
66349
66233
  if (node.operator === 39) {
66350
- if (maybeTypeOfKindConsideringBaseConstraint(operandType, 2112)) {
66234
+ if (maybeTypeOfKind(operandType, 2112)) {
66351
66235
  error(node.operand, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1, ts.tokenToString(node.operator), typeToString(getBaseTypeOfLiteralType(operandType)));
66352
66236
  }
66353
66237
  return numberType;
@@ -66737,11 +66621,7 @@ var ts;
66737
66621
  var operator = operatorToken.kind;
66738
66622
  if (operator === 55 || operator === 56 || operator === 60) {
66739
66623
  if (operator === 55) {
66740
- var parent = node.parent;
66741
- while (parent.kind === 212
66742
- || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 || parent.operatorToken.kind === 56)) {
66743
- parent = parent.parent;
66744
- }
66624
+ var parent = ts.walkUpParenthesizedExpressions(node.parent);
66745
66625
  checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined);
66746
66626
  }
66747
66627
  checkTruthinessOfType(leftType, node.left);
@@ -67197,7 +67077,7 @@ var ts;
67197
67077
  type = anyType;
67198
67078
  addLazyDiagnostic(function () {
67199
67079
  if (noImplicitAny && !ts.expressionResultIsUnused(node)) {
67200
- var contextualType = getContextualType(node, undefined);
67080
+ var contextualType = getContextualType(node);
67201
67081
  if (!contextualType || isTypeAny(contextualType)) {
67202
67082
  error(node, ts.Diagnostics.yield_expression_implicitly_results_in_an_any_type_because_its_containing_generator_lacks_a_return_type_annotation);
67203
67083
  }
@@ -67238,7 +67118,7 @@ var ts;
67238
67118
  texts.push(span.literal.text);
67239
67119
  types.push(isTypeAssignableTo(type, templateConstraintType) ? type : stringType);
67240
67120
  }
67241
- 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;
67242
67122
  }
67243
67123
  function isTemplateLiteralContextualType(type) {
67244
67124
  return !!(type.flags & (128 | 134217728) ||
@@ -67261,7 +67141,7 @@ var ts;
67261
67141
  if (inferenceContext && inferenceContext.intraExpressionInferenceSites) {
67262
67142
  inferenceContext.intraExpressionInferenceSites = undefined;
67263
67143
  }
67264
- var result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node, undefined)) ?
67144
+ var result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node)) ?
67265
67145
  getRegularTypeOfLiteralType(type) : type;
67266
67146
  return result;
67267
67147
  }
@@ -67365,7 +67245,7 @@ var ts;
67365
67245
  var type = checkExpression(node, checkMode, forceTuple);
67366
67246
  return isConstContext(node) || ts.isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) :
67367
67247
  isTypeAssertion(node) ? type :
67368
- getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node, undefined) : contextualType, node, undefined));
67248
+ getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node) : contextualType, node));
67369
67249
  }
67370
67250
  function checkPropertyAssignment(node, checkMode) {
67371
67251
  if (node.name.kind === 162) {
@@ -67451,8 +67331,8 @@ var ts;
67451
67331
  var result = [];
67452
67332
  var oldTypeParameters;
67453
67333
  var newTypeParameters;
67454
- for (var _i = 0, typeParameters_3 = typeParameters; _i < typeParameters_3.length; _i++) {
67455
- var tp = typeParameters_3[_i];
67334
+ for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
67335
+ var tp = typeParameters_2[_i];
67456
67336
  var name = tp.symbol.escapedName;
67457
67337
  if (hasTypeParameterByName(context.inferredTypeParameters, name) || hasTypeParameterByName(result, name)) {
67458
67338
  var newName = getUniqueTypeParameterName(ts.concatenate(context.inferredTypeParameters, result), name);
@@ -67745,14 +67625,12 @@ var ts;
67745
67625
  error(node, ts.Diagnostics.Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types);
67746
67626
  }
67747
67627
  else if (modifiers === 32768 || modifiers === 65536) {
67748
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "checkTypeParameterDeferred", { parent: getTypeId(getDeclaredTypeOfSymbol(symbol)), id: getTypeId(typeParameter) });
67749
67628
  var source = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSubTypeForCheck : markerSuperTypeForCheck);
67750
67629
  var target = createMarkerType(symbol, typeParameter, modifiers === 65536 ? markerSuperTypeForCheck : markerSubTypeForCheck);
67751
67630
  var saveVarianceTypeParameter = typeParameter;
67752
67631
  varianceTypeParameter = typeParameter;
67753
67632
  checkTypeAssignableTo(source, target, node, ts.Diagnostics.Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation);
67754
67633
  varianceTypeParameter = saveVarianceTypeParameter;
67755
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
67756
67634
  }
67757
67635
  }
67758
67636
  }
@@ -68062,7 +67940,7 @@ var ts;
68062
67940
  var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
68063
67941
  if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
68064
67942
  var indexSignatureMap_1 = new ts.Map();
68065
- var _loop_29 = function (declaration) {
67943
+ var _loop_28 = function (declaration) {
68066
67944
  if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
68067
67945
  forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
68068
67946
  var entry = indexSignatureMap_1.get(getTypeId(type));
@@ -68077,7 +67955,7 @@ var ts;
68077
67955
  };
68078
67956
  for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
68079
67957
  var declaration = _a[_i];
68080
- _loop_29(declaration);
67958
+ _loop_28(declaration);
68081
67959
  }
68082
67960
  indexSignatureMap_1.forEach(function (entry) {
68083
67961
  if (entry.declarations.length > 1) {
@@ -68269,12 +68147,6 @@ var ts;
68269
68147
  function checkMissingDeclaration(node) {
68270
68148
  checkDecorators(node);
68271
68149
  }
68272
- function getEffectiveTypeArgumentAtIndex(node, typeParameters, index) {
68273
- if (index < typeParameters.length) {
68274
- return getTypeFromTypeNode(node.typeArguments[index]);
68275
- }
68276
- return getEffectiveTypeArguments(node, typeParameters)[index];
68277
- }
68278
68150
  function getEffectiveTypeArguments(node, typeParameters) {
68279
68151
  return fillMissingTypeArguments(ts.map(node.typeArguments, getTypeFromTypeNode), typeParameters, getMinTypeArgumentCount(typeParameters), ts.isInJSFile(node));
68280
68152
  }
@@ -68932,30 +68804,20 @@ var ts;
68932
68804
  isAwaitedTypeInstantiation(type) ? type.aliasTypeArguments[0] :
68933
68805
  type;
68934
68806
  }
68935
- function isAwaitedTypeNeeded(type) {
68936
- if (isTypeAny(type) || isAwaitedTypeInstantiation(type)) {
68937
- return false;
68807
+ function createAwaitedTypeIfNeeded(type) {
68808
+ if (isTypeAny(type)) {
68809
+ return type;
68810
+ }
68811
+ if (isAwaitedTypeInstantiation(type)) {
68812
+ return type;
68938
68813
  }
68939
68814
  if (isGenericObjectType(type)) {
68940
68815
  var baseConstraint = getBaseConstraintOfType(type);
68941
68816
  if (!baseConstraint || (baseConstraint.flags & 3) || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint)) {
68942
- return true;
68943
- }
68944
- }
68945
- return false;
68946
- }
68947
- function tryCreateAwaitedType(type) {
68948
- var awaitedSymbol = getGlobalAwaitedSymbol(true);
68949
- if (awaitedSymbol) {
68950
- return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
68951
- }
68952
- return undefined;
68953
- }
68954
- function createAwaitedTypeIfNeeded(type) {
68955
- if (isAwaitedTypeNeeded(type)) {
68956
- var awaitedType = tryCreateAwaitedType(type);
68957
- if (awaitedType) {
68958
- return awaitedType;
68817
+ var awaitedSymbol = getGlobalAwaitedSymbol(true);
68818
+ if (awaitedSymbol) {
68819
+ return getTypeAliasInstantiation(awaitedSymbol, [unwrapAwaitedType(type)]);
68820
+ }
68959
68821
  }
68960
68822
  }
68961
68823
  ts.Debug.assert(getPromisedTypeOfPromise(type) === undefined, "type provided should not be a non-generic 'promise'-like.");
@@ -68977,20 +68839,8 @@ var ts;
68977
68839
  return typeAsAwaitable.awaitedTypeOfType;
68978
68840
  }
68979
68841
  if (type.flags & 1048576) {
68980
- if (awaitedTypeStack.lastIndexOf(type.id) >= 0) {
68981
- if (errorNode) {
68982
- error(errorNode, ts.Diagnostics.Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method);
68983
- }
68984
- return undefined;
68985
- }
68986
68842
  var mapper = errorNode ? function (constituentType) { return getAwaitedTypeNoAlias(constituentType, errorNode, diagnosticMessage, arg0); } : getAwaitedTypeNoAlias;
68987
- awaitedTypeStack.push(type.id);
68988
- var mapped = mapType(type, mapper);
68989
- awaitedTypeStack.pop();
68990
- return typeAsAwaitable.awaitedTypeOfType = mapped;
68991
- }
68992
- if (isAwaitedTypeNeeded(type)) {
68993
- return typeAsAwaitable.awaitedTypeOfType = type;
68843
+ return typeAsAwaitable.awaitedTypeOfType = mapType(type, mapper);
68994
68844
  }
68995
68845
  var thisTypeForErrorOut = { value: undefined };
68996
68846
  var promisedType = getPromisedTypeOfPromise(type, undefined, thisTypeForErrorOut);
@@ -69495,8 +69345,8 @@ var ts;
69495
69345
  return;
69496
69346
  var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
69497
69347
  var seenParentsWithEveryUnused = new ts.Set();
69498
- for (var _i = 0, typeParameters_4 = typeParameters; _i < typeParameters_4.length; _i++) {
69499
- var typeParameter = typeParameters_4[_i];
69348
+ for (var _i = 0, typeParameters_3 = typeParameters; _i < typeParameters_3.length; _i++) {
69349
+ var typeParameter = typeParameters_3[_i];
69500
69350
  if (!isTypeParameterUnused(typeParameter))
69501
69351
  continue;
69502
69352
  var name = ts.idText(typeParameter.name);
@@ -70755,14 +70605,9 @@ var ts;
70755
70605
  function unwrapReturnType(returnType, functionFlags) {
70756
70606
  var isGenerator = !!(functionFlags & 1);
70757
70607
  var isAsync = !!(functionFlags & 2);
70758
- if (isGenerator) {
70759
- var returnIterationType = getIterationTypeOfGeneratorFunctionReturnType(1, returnType, isAsync);
70760
- if (!returnIterationType) {
70761
- return errorType;
70762
- }
70763
- return isAsync ? getAwaitedTypeNoAlias(unwrapAwaitedType(returnIterationType)) : returnIterationType;
70764
- }
70765
- return isAsync ? getAwaitedTypeNoAlias(returnType) || errorType : returnType;
70608
+ return isGenerator ? getIterationTypeOfGeneratorFunctionReturnType(1, returnType, isAsync) || errorType :
70609
+ isAsync ? getAwaitedTypeNoAlias(returnType) || errorType :
70610
+ returnType;
70766
70611
  }
70767
70612
  function isUnwrappedReturnTypeVoidOrAny(func, returnType) {
70768
70613
  var unwrappedReturnType = unwrapReturnType(returnType, ts.getFunctionFlags(func));
@@ -70963,24 +70808,19 @@ var ts;
70963
70808
  }
70964
70809
  var indexInfos = getApplicableIndexInfos(type, propNameType);
70965
70810
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 258) : undefined;
70966
- var propDeclaration = declaration && declaration.kind === 221 ||
70967
- name && name.kind === 162 ? declaration : undefined;
70968
- var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
70969
- 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) {
70970
70814
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
70971
70815
  var errorNode = localPropDeclaration || localIndexDeclaration ||
70972
70816
  (interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined);
70973
70817
  if (errorNode && !isTypeAssignableTo(propType, info.type)) {
70974
- 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));
70975
- if (propDeclaration && errorNode !== propDeclaration) {
70976
- ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(propDeclaration, ts.Diagnostics._0_is_declared_here, symbolToString(prop)));
70977
- }
70978
- 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));
70979
70819
  }
70980
70820
  };
70981
70821
  for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
70982
70822
  var info = indexInfos_9[_i];
70983
- _loop_30(info);
70823
+ _loop_29(info);
70984
70824
  }
70985
70825
  }
70986
70826
  function checkIndexConstraintForIndexSignature(type, checkInfo) {
@@ -70988,7 +70828,7 @@ var ts;
70988
70828
  var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
70989
70829
  var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 258) : undefined;
70990
70830
  var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
70991
- var _loop_31 = function (info) {
70831
+ var _loop_30 = function (info) {
70992
70832
  if (info === checkInfo)
70993
70833
  return "continue";
70994
70834
  var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
@@ -71000,7 +70840,7 @@ var ts;
71000
70840
  };
71001
70841
  for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
71002
70842
  var info = indexInfos_10[_i];
71003
- _loop_31(info);
70843
+ _loop_30(info);
71004
70844
  }
71005
70845
  }
71006
70846
  function checkTypeNameIsReserved(name, message) {
@@ -71295,7 +71135,7 @@ var ts;
71295
71135
  var baseTypes = baseTypeNode && getBaseTypes(type);
71296
71136
  var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
71297
71137
  var baseStaticType = getBaseConstructorTypeOfClass(type);
71298
- var _loop_32 = function (member) {
71138
+ var _loop_31 = function (member) {
71299
71139
  if (ts.hasAmbientModifier(member)) {
71300
71140
  return "continue";
71301
71141
  }
@@ -71310,7 +71150,7 @@ var ts;
71310
71150
  };
71311
71151
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
71312
71152
  var member = _a[_i];
71313
- _loop_32(member);
71153
+ _loop_31(member);
71314
71154
  }
71315
71155
  }
71316
71156
  function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) {
@@ -71385,7 +71225,7 @@ var ts;
71385
71225
  }
71386
71226
  function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
71387
71227
  var issuedMemberError = false;
71388
- var _loop_33 = function (member) {
71228
+ var _loop_32 = function (member) {
71389
71229
  if (ts.isStatic(member)) {
71390
71230
  return "continue";
71391
71231
  }
@@ -71403,7 +71243,7 @@ var ts;
71403
71243
  };
71404
71244
  for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
71405
71245
  var member = _a[_i];
71406
- _loop_33(member);
71246
+ _loop_32(member);
71407
71247
  }
71408
71248
  if (!issuedMemberError) {
71409
71249
  checkTypeAssignableTo(typeWithThis, baseWithThis, node.name || node, broadDiag);
@@ -71450,7 +71290,7 @@ var ts;
71450
71290
  function checkKindsOfPropertyMemberOverrides(type, baseType) {
71451
71291
  var _a, _b, _c, _d;
71452
71292
  var baseProperties = getPropertiesOfType(baseType);
71453
- var _loop_34 = function (baseProperty) {
71293
+ var _loop_33 = function (baseProperty) {
71454
71294
  var base = getTargetSymbol(baseProperty);
71455
71295
  if (base.flags & 4194304) {
71456
71296
  return "continue";
@@ -71548,7 +71388,7 @@ var ts;
71548
71388
  };
71549
71389
  basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
71550
71390
  var baseProperty = baseProperties_1[_i];
71551
- var state_10 = _loop_34(baseProperty);
71391
+ var state_10 = _loop_33(baseProperty);
71552
71392
  switch (state_10) {
71553
71393
  case "continue-basePropertyCheck": continue basePropertyCheck;
71554
71394
  }
@@ -71568,9 +71408,9 @@ var ts;
71568
71408
  });
71569
71409
  for (var _i = 0, baseTypes_3 = baseTypes; _i < baseTypes_3.length; _i++) {
71570
71410
  var base = baseTypes_3[_i];
71571
- var properties_5 = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
71572
- for (var _a = 0, properties_4 = properties_5; _a < properties_4.length; _a++) {
71573
- 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];
71574
71414
  var existing = seen.get(prop.escapedName);
71575
71415
  if (existing && prop.parent === existing.parent) {
71576
71416
  seen.delete(prop.escapedName);
@@ -71592,8 +71432,8 @@ var ts;
71592
71432
  for (var _i = 0, baseTypes_4 = baseTypes; _i < baseTypes_4.length; _i++) {
71593
71433
  var base = baseTypes_4[_i];
71594
71434
  var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
71595
- for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) {
71596
- var prop = properties_6[_a];
71435
+ for (var _a = 0, properties_7 = properties; _a < properties_7.length; _a++) {
71436
+ var prop = properties_7[_a];
71597
71437
  var existing = seen.get(prop.escapedName);
71598
71438
  if (!existing) {
71599
71439
  seen.set(prop.escapedName, { prop: prop, containingType: base });
@@ -72460,9 +72300,7 @@ var ts;
72460
72300
  error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.idText(exportedName));
72461
72301
  }
72462
72302
  else {
72463
- if (!node.isTypeOnly && !node.parent.parent.isTypeOnly) {
72464
- markExportAsReferenced(node);
72465
- }
72303
+ markExportAsReferenced(node);
72466
72304
  var target = symbol && (symbol.flags & 2097152 ? resolveAlias(symbol) : symbol);
72467
72305
  if (!target || target === unknownSymbol || target.flags & 111551) {
72468
72306
  checkExpressionCached(node.propertyName || node.name);
@@ -74194,16 +74032,10 @@ var ts;
74194
74032
  if (!fileToDirective) {
74195
74033
  return undefined;
74196
74034
  }
74197
- var meaning;
74198
- if (node.parent.kind === 162) {
74035
+ var meaning = 788968 | 1920;
74036
+ if ((node.kind === 79 && isInTypeQuery(node)) || (node.kind === 206 && !isInHeritageClause(node))) {
74199
74037
  meaning = 111551 | 1048576;
74200
74038
  }
74201
- else {
74202
- meaning = 788968 | 1920;
74203
- if ((node.kind === 79 && isInTypeQuery(node)) || (node.kind === 206 && !isInHeritageClause(node))) {
74204
- meaning = 111551 | 1048576;
74205
- }
74206
- }
74207
74039
  var symbol = resolveEntityName(node, meaning, true);
74208
74040
  return symbol && symbol !== unknownSymbol ? getTypeReferenceDirectivesForSymbol(symbol, meaning) : undefined;
74209
74041
  }
@@ -75519,6 +75351,9 @@ var ts;
75519
75351
  else {
75520
75352
  return grammarErrorOnNode(initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
75521
75353
  }
75354
+ if (!isConstOrReadonly || isInvalidInitializer) {
75355
+ return grammarErrorOnNode(initializer, ts.Diagnostics.Initializers_are_not_allowed_in_ambient_contexts);
75356
+ }
75522
75357
  }
75523
75358
  }
75524
75359
  function checkGrammarVariableDeclaration(node) {
@@ -76309,13 +76144,13 @@ var ts;
76309
76144
  return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration));
76310
76145
  case 200:
76311
76146
  ts.Debug.type(node);
76312
- 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);
76313
76148
  case 295:
76314
76149
  ts.Debug.type(node);
76315
76150
  return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine);
76316
76151
  case 197:
76317
76152
  ts.Debug.type(node);
76318
- 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));
76319
76154
  case 191:
76320
76155
  ts.Debug.type(node);
76321
76156
  return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode));
@@ -76378,7 +76213,7 @@ var ts;
76378
76213
  return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
76379
76214
  case 210:
76380
76215
  ts.Debug.type(node);
76381
- 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));
76382
76217
  case 211:
76383
76218
  ts.Debug.type(node);
76384
76219
  return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression));
@@ -78027,14 +77862,7 @@ var ts;
78027
77862
  return template.templateFlags ? ts.factory.createVoidZero() : ts.factory.createStringLiteral(template.text);
78028
77863
  }
78029
77864
  function getRawLiteral(node, currentSourceFile) {
78030
- var text = node.rawText;
78031
- if (text === undefined) {
78032
- ts.Debug.assertIsDefined(currentSourceFile, "Template literal node is missing 'rawText' and does not have a source file. Possibly bad transform.");
78033
- text = ts.getSourceTextOfNodeFromSourceFile(currentSourceFile, node);
78034
- var isLast = node.kind === 14 || node.kind === 17;
78035
- text = text.substring(1, text.length - (isLast ? 1 : 2));
78036
- }
78037
- text = text.replace(/\r\n?/g, "\n");
77865
+ var text = ts.getRawTextOfTemplateLiteralLike(node, currentSourceFile);
78038
77866
  return ts.setTextRange(ts.factory.createStringLiteral(text), node);
78039
77867
  }
78040
77868
  })(ts || (ts = {}));
@@ -78649,8 +78477,7 @@ var ts;
78649
78477
  else {
78650
78478
  statements = __spreadArray(__spreadArray(__spreadArray([], statements.slice(0, prologueStatementCount), true), parameterPropertyAssignments, true), statements.slice(prologueStatementCount), true);
78651
78479
  }
78652
- var start = superStatementIndex >= 0 ? superStatementIndex + 1 : prologueStatementCount;
78653
- 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));
78654
78481
  statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment());
78655
78482
  var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), body.statements), true);
78656
78483
  ts.setTextRange(block, body);
@@ -80088,8 +79915,8 @@ var ts;
80088
79915
  }
80089
79916
  }
80090
79917
  function addPropertyOrClassStaticBlockStatements(statements, properties, receiver) {
80091
- for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) {
80092
- var property = properties_7[_i];
79918
+ for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) {
79919
+ var property = properties_8[_i];
80093
79920
  if (ts.isStatic(property) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) {
80094
79921
  continue;
80095
79922
  }
@@ -91612,6 +91439,7 @@ var ts;
91612
91439
  var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit;
91613
91440
  var bundleBuildInfo;
91614
91441
  var emitSkipped = false;
91442
+ var exportedModulesFromDeclarationEmit;
91615
91443
  enter();
91616
91444
  forEachEmittedFile(host, emitSourceFileOrBundle, ts.getSourceFilesToEmit(host, targetSourceFile, forceDtsEmit), forceDtsEmit, onlyBuildInfo, !targetSourceFile);
91617
91445
  exit();
@@ -91620,6 +91448,7 @@ var ts;
91620
91448
  diagnostics: emitterDiagnostics.getDiagnostics(),
91621
91449
  emittedFiles: emittedFilesList,
91622
91450
  sourceMaps: sourceMapDataList,
91451
+ exportedModulesFromDeclarationEmit: exportedModulesFromDeclarationEmit
91623
91452
  };
91624
91453
  function emitSourceFileOrBundle(_a, sourceFileOrBundle) {
91625
91454
  var jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath, buildInfoPath = _a.buildInfoPath;
@@ -91679,7 +91508,7 @@ var ts;
91679
91508
  if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
91680
91509
  return;
91681
91510
  }
91682
- if (host.isEmitBlocked(jsFilePath) || compilerOptions.noEmit) {
91511
+ if ((jsFilePath && host.isEmitBlocked(jsFilePath)) || compilerOptions.noEmit) {
91683
91512
  emitSkipped = true;
91684
91513
  return;
91685
91514
  }
@@ -91704,7 +91533,7 @@ var ts;
91704
91533
  substituteNode: transform.substituteNode,
91705
91534
  });
91706
91535
  ts.Debug.assert(transform.transformed.length === 1, "Should only see one output from the transform");
91707
- printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, compilerOptions);
91536
+ printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform.transformed[0], printer, compilerOptions);
91708
91537
  transform.dispose();
91709
91538
  if (bundleBuildInfo)
91710
91539
  bundleBuildInfo.js = printer.bundleFileInfo;
@@ -91736,7 +91565,7 @@ var ts;
91736
91565
  noEmitHelpers: true,
91737
91566
  module: compilerOptions.module,
91738
91567
  target: compilerOptions.target,
91739
- sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
91568
+ sourceMap: compilerOptions.sourceMap,
91740
91569
  inlineSourceMap: compilerOptions.inlineSourceMap,
91741
91570
  extendedDiagnostics: compilerOptions.extendedDiagnostics,
91742
91571
  onlyPrintJsDocStyle: true,
@@ -91754,12 +91583,16 @@ var ts;
91754
91583
  emitSkipped = emitSkipped || declBlocked;
91755
91584
  if (!declBlocked || forceDtsEmit) {
91756
91585
  ts.Debug.assert(declarationTransform.transformed.length === 1, "Should only see one output from the decl transform");
91757
- printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform, declarationPrinter, {
91758
- sourceMap: printerOptions.sourceMap,
91586
+ printSourceFileOrBundle(declarationFilePath, declarationMapPath, declarationTransform.transformed[0], declarationPrinter, {
91587
+ sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
91759
91588
  sourceRoot: compilerOptions.sourceRoot,
91760
91589
  mapRoot: compilerOptions.mapRoot,
91761
91590
  extendedDiagnostics: compilerOptions.extendedDiagnostics,
91762
91591
  });
91592
+ if (forceDtsEmit && declarationTransform.transformed[0].kind === 305) {
91593
+ var sourceFile = declarationTransform.transformed[0];
91594
+ exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit;
91595
+ }
91763
91596
  }
91764
91597
  declarationTransform.dispose();
91765
91598
  if (bundleBuildInfo)
@@ -91778,8 +91611,7 @@ var ts;
91778
91611
  }
91779
91612
  ts.forEachChild(node, collectLinkedAliases);
91780
91613
  }
91781
- function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) {
91782
- var sourceFileOrBundle = transform.transformed[0];
91614
+ function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapOptions) {
91783
91615
  var bundle = sourceFileOrBundle.kind === 306 ? sourceFileOrBundle : undefined;
91784
91616
  var sourceFile = sourceFileOrBundle.kind === 305 ? sourceFileOrBundle : undefined;
91785
91617
  var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
@@ -91812,16 +91644,16 @@ var ts;
91812
91644
  var sourceMap = sourceMapGenerator.toString();
91813
91645
  ts.writeFile(host, emitterDiagnostics, sourceMapFilePath, sourceMap, false, sourceFiles);
91814
91646
  if (printer.bundleFileInfo)
91815
- printer.bundleFileInfo.mapHash = ts.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
91647
+ printer.bundleFileInfo.mapHash = ts.BuilderState.computeSignature(sourceMap, ts.maybeBind(host, host.createHash));
91816
91648
  }
91817
91649
  }
91818
91650
  else {
91819
91651
  writer.writeLine();
91820
91652
  }
91821
91653
  var text = writer.getText();
91822
- 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 });
91823
91655
  if (printer.bundleFileInfo)
91824
- printer.bundleFileInfo.hash = ts.computeSignature(text, ts.maybeBind(host, host.createHash));
91656
+ printer.bundleFileInfo.hash = ts.BuilderState.computeSignature(text, ts.maybeBind(host, host.createHash));
91825
91657
  writer.clear();
91826
91658
  }
91827
91659
  function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
@@ -91966,22 +91798,22 @@ var ts;
91966
91798
  var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath));
91967
91799
  if (!jsFileText)
91968
91800
  return jsFilePath;
91969
- if (ts.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
91801
+ if (ts.BuilderState.computeSignature(jsFileText, createHash) !== buildInfo.bundle.js.hash)
91970
91802
  return jsFilePath;
91971
91803
  var sourceMapText = sourceMapFilePath && host.readFile(sourceMapFilePath);
91972
91804
  if ((sourceMapFilePath && !sourceMapText) || config.options.inlineSourceMap)
91973
91805
  return sourceMapFilePath || "inline sourcemap decoding";
91974
- if (sourceMapFilePath && ts.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
91806
+ if (sourceMapFilePath && ts.BuilderState.computeSignature(sourceMapText, createHash) !== buildInfo.bundle.js.mapHash)
91975
91807
  return sourceMapFilePath;
91976
91808
  var declarationText = declarationFilePath && host.readFile(declarationFilePath);
91977
91809
  if (declarationFilePath && !declarationText)
91978
91810
  return declarationFilePath;
91979
- if (declarationFilePath && ts.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
91811
+ if (declarationFilePath && ts.BuilderState.computeSignature(declarationText, createHash) !== buildInfo.bundle.dts.hash)
91980
91812
  return declarationFilePath;
91981
91813
  var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
91982
91814
  if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
91983
91815
  return declarationMapPath || "inline sourcemap decoding";
91984
- if (declarationMapPath && ts.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
91816
+ if (declarationMapPath && ts.BuilderState.computeSignature(declarationMapText, createHash) !== buildInfo.bundle.dts.mapHash)
91985
91817
  return declarationMapPath;
91986
91818
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(buildInfoPath, host.getCurrentDirectory()));
91987
91819
  var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo, true);
@@ -92019,7 +91851,8 @@ var ts;
92019
91851
  var newBuildInfo = data.buildInfo;
92020
91852
  newBuildInfo.program = buildInfo.program;
92021
91853
  if (newBuildInfo.program && changedDtsText !== undefined && config.options.composite) {
92022
- 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();
92023
91856
  }
92024
91857
  var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
92025
91858
  newBuildInfo.bundle.js.sources = js.sources;
@@ -97285,7 +97118,7 @@ var ts;
97285
97118
  return undefined;
97286
97119
  }
97287
97120
  function lookupFromPackageJson() {
97288
- var scope = ts.getPackageScopeForPath(fileName, ts.getTemporaryModuleResolutionState(packageJsonInfoCache, host, options));
97121
+ var scope = ts.getPackageScopeForPath(fileName, packageJsonInfoCache, host, options);
97289
97122
  return (scope === null || scope === void 0 ? void 0 : scope.packageJsonContent.type) === "module" ? ts.ModuleKind.ESNext : ts.ModuleKind.CommonJS;
97290
97123
  }
97291
97124
  }
@@ -99003,7 +98836,7 @@ var ts;
99003
98836
  }
99004
98837
  }
99005
98838
  function processTypeReferenceDirective(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason) {
99006
- 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 });
99007
98840
  processTypeReferenceDirectiveWorker(typeReferenceDirective, mode, resolvedTypeReferenceDirective, reason);
99008
98841
  ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
99009
98842
  }
@@ -99992,8 +99825,8 @@ var ts;
99992
99825
  (function (ts) {
99993
99826
  function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers, forceDtsEmit) {
99994
99827
  var outputFiles = [];
99995
- var _a = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers, forceDtsEmit), emitSkipped = _a.emitSkipped, diagnostics = _a.diagnostics;
99996
- 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 };
99997
99830
  function writeFile(fileName, text, writeByteOrderMark) {
99998
99831
  outputFiles.push({ name: fileName, writeByteOrderMark: writeByteOrderMark, text: text });
99999
99832
  }
@@ -100184,23 +100017,23 @@ var ts;
100184
100017
  state.allFileNames = undefined;
100185
100018
  }
100186
100019
  BuilderState.releaseCache = releaseCache;
100187
- function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
100020
+ function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, computeHash) {
100188
100021
  var _a, _b;
100189
- var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName);
100022
+ var result = getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash);
100190
100023
  (_a = state.oldSignatures) === null || _a === void 0 ? void 0 : _a.clear();
100191
100024
  (_b = state.oldExportedModulesMap) === null || _b === void 0 ? void 0 : _b.clear();
100192
100025
  return result;
100193
100026
  }
100194
100027
  BuilderState.getFilesAffectedBy = getFilesAffectedBy;
100195
- function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash, getCanonicalFileName) {
100028
+ function getFilesAffectedByWithOldState(state, programOfThisState, path, cancellationToken, computeHash) {
100196
100029
  var sourceFile = programOfThisState.getSourceFileByPath(path);
100197
100030
  if (!sourceFile) {
100198
100031
  return ts.emptyArray;
100199
100032
  }
100200
- if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
100033
+ if (!updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash)) {
100201
100034
  return [sourceFile];
100202
100035
  }
100203
- return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName);
100036
+ return (state.referencedMap ? getFilesAffectedByUpdatedShapeWhenModuleEmit : getFilesAffectedByUpdatedShapeWhenNonModuleEmit)(state, programOfThisState, sourceFile, cancellationToken, computeHash);
100204
100037
  }
100205
100038
  BuilderState.getFilesAffectedByWithOldState = getFilesAffectedByWithOldState;
100206
100039
  function updateSignatureOfFile(state, signature, path) {
@@ -100208,7 +100041,7 @@ var ts;
100208
100041
  (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = new ts.Set())).add(path);
100209
100042
  }
100210
100043
  BuilderState.updateSignatureOfFile = updateSignatureOfFile;
100211
- function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, getCanonicalFileName, useFileVersionAsSignature) {
100044
+ function updateShapeSignature(state, programOfThisState, sourceFile, cancellationToken, computeHash, useFileVersionAsSignature) {
100212
100045
  var _a;
100213
100046
  if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; }
100214
100047
  if ((_a = state.hasCalledUpdateShapeSignature) === null || _a === void 0 ? void 0 : _a.has(sourceFile.resolvedPath))
@@ -100217,13 +100050,15 @@ var ts;
100217
100050
  var prevSignature = info.signature;
100218
100051
  var latestSignature;
100219
100052
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
100220
- programOfThisState.emit(sourceFile, function (fileName, text, _writeByteOrderMark, _onError, sourceFiles, data) {
100221
- ts.Debug.assert(ts.isDeclarationFileName(fileName), "File extension for signature expected to be dts: Got:: " + fileName);
100222
- 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);
100223
100058
  if (latestSignature !== prevSignature) {
100224
- updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
100059
+ updateExportedModules(state, sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit);
100225
100060
  }
100226
- }, cancellationToken, true, undefined, true);
100061
+ }
100227
100062
  }
100228
100063
  if (latestSignature === undefined) {
100229
100064
  latestSignature = sourceFile.version;
@@ -100244,6 +100079,10 @@ var ts;
100244
100079
  return latestSignature !== prevSignature;
100245
100080
  }
100246
100081
  BuilderState.updateShapeSignature = updateShapeSignature;
100082
+ function computeSignature(text, computeHash) {
100083
+ return (computeHash || ts.generateDjb2Hash)(text);
100084
+ }
100085
+ BuilderState.computeSignature = computeSignature;
100247
100086
  function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
100248
100087
  if (!state.exportedModulesMap)
100249
100088
  return;
@@ -100353,7 +100192,7 @@ var ts;
100353
100192
  }
100354
100193
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
100355
100194
  }
100356
- function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash, getCanonicalFileName) {
100195
+ function getFilesAffectedByUpdatedShapeWhenModuleEmit(state, programOfThisState, sourceFileWithUpdatedShape, cancellationToken, computeHash) {
100357
100196
  if (isFileAffectingGlobalScope(sourceFileWithUpdatedShape)) {
100358
100197
  return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
100359
100198
  }
@@ -100369,7 +100208,7 @@ var ts;
100369
100208
  if (!seenFileNamesMap.has(currentPath)) {
100370
100209
  var currentSourceFile = programOfThisState.getSourceFileByPath(currentPath);
100371
100210
  seenFileNamesMap.set(currentPath, currentSourceFile);
100372
- if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash, getCanonicalFileName)) {
100211
+ if (currentSourceFile && updateShapeSignature(state, programOfThisState, currentSourceFile, cancellationToken, computeHash)) {
100373
100212
  queue.push.apply(queue, getReferencedByPaths(state, currentSourceFile.resolvedPath));
100374
100213
  }
100375
100214
  }
@@ -100397,7 +100236,7 @@ var ts;
100397
100236
  state.outSignature = oldState === null || oldState === void 0 ? void 0 : oldState.outSignature;
100398
100237
  }
100399
100238
  state.changedFilesSet = new ts.Set();
100400
- 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;
100401
100240
  var useOldState = ts.BuilderState.canReuseOldState(state.referencedMap, oldState);
100402
100241
  var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
100403
100242
  var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
@@ -100504,7 +100343,7 @@ var ts;
100504
100343
  programEmitComplete: state.programEmitComplete,
100505
100344
  emitSignatures: state.emitSignatures && new ts.Map(state.emitSignatures),
100506
100345
  outSignature: state.outSignature,
100507
- latestChangedDtsFile: state.latestChangedDtsFile,
100346
+ dtsChangeTime: state.dtsChangeTime,
100508
100347
  hasChangedEmitSignature: state.hasChangedEmitSignature,
100509
100348
  changedFilesSet: outFilePath ? new ts.Set(state.changedFilesSet) : undefined,
100510
100349
  };
@@ -100517,7 +100356,7 @@ var ts;
100517
100356
  state.programEmitComplete = savedEmitState.programEmitComplete;
100518
100357
  state.emitSignatures = savedEmitState.emitSignatures;
100519
100358
  state.outSignature = savedEmitState.outSignature;
100520
- state.latestChangedDtsFile = savedEmitState.latestChangedDtsFile;
100359
+ state.dtsChangeTime = savedEmitState.dtsChangeTime;
100521
100360
  state.hasChangedEmitSignature = savedEmitState.hasChangedEmitSignature;
100522
100361
  if (savedEmitState.changedFilesSet)
100523
100362
  state.changedFilesSet = savedEmitState.changedFilesSet;
@@ -100525,7 +100364,7 @@ var ts;
100525
100364
  function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
100526
100365
  ts.Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
100527
100366
  }
100528
- function getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host) {
100367
+ function getNextAffectedFile(state, cancellationToken, computeHash, host) {
100529
100368
  var _a, _b;
100530
100369
  while (true) {
100531
100370
  var affectedFiles = state.affectedFiles;
@@ -100536,7 +100375,7 @@ var ts;
100536
100375
  var affectedFile = affectedFiles[affectedFilesIndex];
100537
100376
  if (!seenAffectedFiles.has(affectedFile.resolvedPath)) {
100538
100377
  state.affectedFilesIndex = affectedFilesIndex;
100539
- handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
100378
+ handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
100540
100379
  return affectedFile;
100541
100380
  }
100542
100381
  affectedFilesIndex++;
@@ -100557,7 +100396,7 @@ var ts;
100557
100396
  ts.Debug.assert(!state.semanticDiagnosticsPerFile);
100558
100397
  return program;
100559
100398
  }
100560
- state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash, getCanonicalFileName);
100399
+ state.affectedFiles = ts.BuilderState.getFilesAffectedByWithOldState(state, program, nextKey.value, cancellationToken, computeHash);
100561
100400
  state.currentChangedFilePath = nextKey.value;
100562
100401
  state.affectedFilesIndex = 0;
100563
100402
  if (!state.seenAffectedFiles)
@@ -100600,24 +100439,24 @@ var ts;
100600
100439
  });
100601
100440
  }
100602
100441
  }
100603
- function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
100442
+ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
100604
100443
  removeSemanticDiagnosticsOf(state, affectedFile.resolvedPath);
100605
100444
  if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
100606
100445
  removeDiagnosticsOfLibraryFiles(state);
100607
- 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);
100608
100447
  return;
100609
100448
  }
100610
100449
  if (state.compilerOptions.assumeChangesOnlyAffectDirectDependencies)
100611
100450
  return;
100612
- handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host);
100451
+ handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host);
100613
100452
  }
100614
- function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, getCanonicalFileName, host) {
100453
+ function handleDtsMayChangeOf(state, path, cancellationToken, computeHash, host) {
100615
100454
  removeSemanticDiagnosticsOf(state, path);
100616
100455
  if (!state.changedFilesSet.has(path)) {
100617
100456
  var program = ts.Debug.checkDefined(state.program);
100618
100457
  var sourceFile = program.getSourceFileByPath(path);
100619
100458
  if (sourceFile) {
100620
- ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, getCanonicalFileName, !host.disableUseFileVersionAsSignature);
100459
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, cancellationToken, computeHash, !host.disableUseFileVersionAsSignature);
100621
100460
  if (ts.getEmitDeclarations(state.compilerOptions)) {
100622
100461
  addToAffectedFilesPendingEmit(state, path, 0);
100623
100462
  }
@@ -100637,16 +100476,16 @@ var ts;
100637
100476
  var newSignature = ts.Debug.checkDefined(state.fileInfos.get(path)).signature;
100638
100477
  return newSignature !== oldSignature;
100639
100478
  }
100640
- function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host) {
100479
+ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host) {
100641
100480
  var _a;
100642
100481
  if (!((_a = state.fileInfos.get(filePath)) === null || _a === void 0 ? void 0 : _a.affectsGlobalScope))
100643
100482
  return false;
100644
100483
  ts.BuilderState.getAllFilesExcludingDefaultLibraryFile(state, state.program, undefined)
100645
- .forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, getCanonicalFileName, host); });
100484
+ .forEach(function (file) { return handleDtsMayChangeOf(state, file.resolvedPath, cancellationToken, computeHash, host); });
100646
100485
  removeDiagnosticsOfLibraryFiles(state);
100647
100486
  return true;
100648
100487
  }
100649
- function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, getCanonicalFileName, host) {
100488
+ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, computeHash, host) {
100650
100489
  var _a;
100651
100490
  if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
100652
100491
  return;
@@ -100660,9 +100499,9 @@ var ts;
100660
100499
  var currentPath = queue.pop();
100661
100500
  if (!seenFileNamesMap.has(currentPath)) {
100662
100501
  seenFileNamesMap.set(currentPath, true);
100663
- if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host))
100502
+ if (handleDtsMayChangeOfGlobalScope(state, currentPath, cancellationToken, computeHash, host))
100664
100503
  return;
100665
- handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, getCanonicalFileName, host);
100504
+ handleDtsMayChangeOf(state, currentPath, cancellationToken, computeHash, host);
100666
100505
  if (isChangedSignature(state, currentPath)) {
100667
100506
  var currentSourceFile = ts.Debug.checkDefined(state.program).getSourceFileByPath(currentPath);
100668
100507
  queue.push.apply(queue, ts.BuilderState.getReferencedByPaths(state, currentSourceFile.resolvedPath));
@@ -100672,27 +100511,27 @@ var ts;
100672
100511
  }
100673
100512
  var seenFileAndExportsOfFile = new ts.Set();
100674
100513
  (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
100675
- if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, getCanonicalFileName, host))
100514
+ if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, computeHash, host))
100676
100515
  return true;
100677
100516
  var references = state.referencedMap.getKeys(exportedFromPath);
100678
100517
  return references && ts.forEachKey(references, function (filePath) {
100679
- return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
100518
+ return handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
100680
100519
  });
100681
100520
  });
100682
100521
  }
100683
- function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host) {
100522
+ function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, computeHash, host) {
100684
100523
  var _a, _b;
100685
100524
  if (!ts.tryAddToSet(seenFileAndExportsOfFile, filePath))
100686
100525
  return undefined;
100687
- if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host))
100526
+ if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, computeHash, host))
100688
100527
  return true;
100689
- handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, getCanonicalFileName, host);
100528
+ handleDtsMayChangeOf(state, filePath, cancellationToken, computeHash, host);
100690
100529
  (_a = state.exportedModulesMap.getKeys(filePath)) === null || _a === void 0 ? void 0 : _a.forEach(function (exportedFromPath) {
100691
- return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, getCanonicalFileName, host);
100530
+ return handleDtsMayChangeOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, cancellationToken, computeHash, host);
100692
100531
  });
100693
100532
  (_b = state.referencedMap.getKeys(filePath)) === null || _b === void 0 ? void 0 : _b.forEach(function (referencingFilePath) {
100694
100533
  return !seenFileAndExportsOfFile.has(referencingFilePath) &&
100695
- handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, computeHash, getCanonicalFileName, host);
100534
+ handleDtsMayChangeOf(state, referencingFilePath, cancellationToken, computeHash, host);
100696
100535
  });
100697
100536
  return undefined;
100698
100537
  }
@@ -100747,13 +100586,13 @@ var ts;
100747
100586
  return !!ts.outFile(info.options || {});
100748
100587
  }
100749
100588
  ts.isProgramBundleEmitBuildInfo = isProgramBundleEmitBuildInfo;
100750
- function getProgramBuildInfo(state, getCanonicalFileName) {
100589
+ function getProgramBuildInfo(state, getCanonicalFileName, host) {
100751
100590
  var outFilePath = ts.outFile(state.compilerOptions);
100752
100591
  if (outFilePath && !state.compilerOptions.composite)
100753
100592
  return;
100754
100593
  var currentDirectory = ts.Debug.checkDefined(state.program).getCurrentDirectory();
100755
100594
  var buildInfoDirectory = ts.getDirectoryPath(ts.getNormalizedAbsolutePath(ts.getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
100756
- var latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : undefined;
100595
+ state.dtsChangeTime = state.hasChangedEmitSignature ? ts.getCurrentTime(host).getTime() : state.dtsChangeTime;
100757
100596
  if (outFilePath) {
100758
100597
  var fileNames_1 = [];
100759
100598
  var fileInfos_1 = [];
@@ -100769,7 +100608,7 @@ var ts;
100769
100608
  fileInfos: fileInfos_1,
100770
100609
  options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions, "affectsBundleEmitBuildInfo"),
100771
100610
  outSignature: state.outSignature,
100772
- latestChangedDtsFile: latestChangedDtsFile,
100611
+ dtsChangeTime: state.dtsChangeTime,
100773
100612
  };
100774
100613
  return result_15;
100775
100614
  }
@@ -100864,7 +100703,7 @@ var ts;
100864
100703
  affectedFilesPendingEmit: affectedFilesPendingEmit,
100865
100704
  changeFileSet: changeFileSet,
100866
100705
  emitSignatures: emitSignatures,
100867
- latestChangedDtsFile: latestChangedDtsFile,
100706
+ dtsChangeTime: state.dtsChangeTime,
100868
100707
  };
100869
100708
  return result;
100870
100709
  function relativeToBuildInfoEnsuringAbsolutePath(path) {
@@ -100976,39 +100815,8 @@ var ts;
100976
100815
  return { host: host, newProgram: newProgram, oldProgram: oldProgram, configFileParsingDiagnostics: configFileParsingDiagnostics || ts.emptyArray };
100977
100816
  }
100978
100817
  ts.getBuilderCreationParameters = getBuilderCreationParameters;
100979
- function getTextHandlingSourceMapForSignature(text, data) {
100980
- return (data === null || data === void 0 ? void 0 : data.sourceMapUrlPos) !== undefined ? text.substring(0, data.sourceMapUrlPos) : text;
100981
- }
100982
- function computeSignatureWithDiagnostics(sourceFile, text, computeHash, getCanonicalFileName, data) {
100983
- var _a;
100984
- text = getTextHandlingSourceMapForSignature(text, data);
100985
- var sourceFileDirectory;
100986
- if ((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length) {
100987
- text += data.diagnostics.map(function (diagnostic) {
100988
- return "" + locationInfo(diagnostic) + ts.DiagnosticCategory[diagnostic.category] + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText);
100989
- }).join("\n");
100990
- }
100991
- return (computeHash !== null && computeHash !== void 0 ? computeHash : ts.generateDjb2Hash)(text);
100992
- function flattenDiagnosticMessageText(diagnostic) {
100993
- return ts.isString(diagnostic) ?
100994
- diagnostic :
100995
- diagnostic === undefined ?
100996
- "" :
100997
- !diagnostic.next ?
100998
- diagnostic.messageText :
100999
- diagnostic.messageText + diagnostic.next.map(flattenDiagnosticMessageText).join("\n");
101000
- }
101001
- function locationInfo(diagnostic) {
101002
- if (diagnostic.file.resolvedPath === sourceFile.resolvedPath)
101003
- return "(" + diagnostic.start + "," + diagnostic.length + ")";
101004
- if (sourceFileDirectory === undefined)
101005
- sourceFileDirectory = ts.getDirectoryPath(sourceFile.resolvedPath);
101006
- return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourceFileDirectory, diagnostic.file.resolvedPath, getCanonicalFileName)) + "(" + diagnostic.start + "," + diagnostic.length + ")";
101007
- }
101008
- }
101009
- ts.computeSignatureWithDiagnostics = computeSignatureWithDiagnostics;
101010
- function computeSignature(text, computeHash, data) {
101011
- 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);
101012
100820
  }
101013
100821
  ts.computeSignature = computeSignature;
101014
100822
  function createBuilderProgram(kind, _a) {
@@ -101022,7 +100830,7 @@ var ts;
101022
100830
  var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames());
101023
100831
  var computeHash = ts.maybeBind(host, host.createHash);
101024
100832
  var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState, host.disableUseFileVersionAsSignature);
101025
- newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName); };
100833
+ newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state, getCanonicalFileName, host); };
101026
100834
  newProgram = undefined;
101027
100835
  oldProgram = undefined;
101028
100836
  oldState = undefined;
@@ -101031,7 +100839,6 @@ var ts;
101031
100839
  builderProgram.getState = getState;
101032
100840
  builderProgram.saveEmitState = function () { return backupBuilderProgramEmitState(state); };
101033
100841
  builderProgram.restoreEmitState = function (saved) { return restoreBuilderProgramEmitState(state, saved); };
101034
- builderProgram.hasChangedEmitSignature = function () { return !!state.hasChangedEmitSignature; };
101035
100842
  builderProgram.getAllDependencies = function (sourceFile) { return ts.BuilderState.getAllDependencies(state, ts.Debug.checkDefined(state.program), sourceFile); };
101036
100843
  builderProgram.getSemanticDiagnostics = getSemanticDiagnostics;
101037
100844
  builderProgram.emit = emit;
@@ -101057,7 +100864,7 @@ var ts;
101057
100864
  return ts.emitSkippedWithNoDiagnostics;
101058
100865
  }
101059
100866
  function emitNextAffectedFile(writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
101060
- var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
100867
+ var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
101061
100868
  var emitKind = 1;
101062
100869
  var isPendingEmitFile = false;
101063
100870
  if (!affected) {
@@ -101086,54 +100893,50 @@ var ts;
101086
100893
  }
101087
100894
  function getWriteFileCallback(writeFile, customTransformers) {
101088
100895
  return function (fileName, text, writeByteOrderMark, onError, sourceFiles, data) {
101089
- var _a, _b, _c, _d, _e, _f, _g;
100896
+ var _a, _b, _c;
101090
100897
  if (ts.isDeclarationFileName(fileName)) {
101091
100898
  if (!ts.outFile(state.compilerOptions)) {
101092
100899
  ts.Debug.assert((sourceFiles === null || sourceFiles === void 0 ? void 0 : sourceFiles.length) === 1);
101093
- var emitSignature = void 0;
100900
+ var newSignature = void 0;
101094
100901
  if (!customTransformers) {
101095
100902
  var file = sourceFiles[0];
101096
100903
  var info = state.fileInfos.get(file.resolvedPath);
101097
100904
  if (info.signature === file.version) {
101098
- var signature = computeSignatureWithDiagnostics(file, text, computeHash, getCanonicalFileName, data);
101099
- if (!((_a = data === null || data === void 0 ? void 0 : data.diagnostics) === null || _a === void 0 ? void 0 : _a.length))
101100
- emitSignature = signature;
101101
- if (signature !== file.version) {
100905
+ newSignature = computeSignature(text, data, computeHash);
100906
+ if (newSignature !== file.version) {
101102
100907
  if (host.storeFilesChangingSignatureDuringEmit)
101103
- ((_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);
101104
100909
  if (state.exportedModulesMap)
101105
100910
  ts.BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
101106
100911
  if (state.affectedFiles) {
101107
- 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);
101108
100913
  if (existing === undefined)
101109
- ((_d = state.oldSignatures) !== null && _d !== void 0 ? _d : (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
101110
- info.signature = signature;
100914
+ (state.oldSignatures || (state.oldSignatures = new ts.Map())).set(file.resolvedPath, info.signature || false);
100915
+ info.signature = newSignature;
101111
100916
  }
101112
100917
  else {
101113
- info.signature = signature;
101114
- (_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();
101115
100920
  }
101116
100921
  }
101117
100922
  }
101118
100923
  }
101119
100924
  if (state.compilerOptions.composite) {
101120
100925
  var filePath = sourceFiles[0].resolvedPath;
101121
- var oldSignature = (_f = state.emitSignatures) === null || _f === void 0 ? void 0 : _f.get(filePath);
101122
- emitSignature !== null && emitSignature !== void 0 ? emitSignature : (emitSignature = computeSignature(text, computeHash, data));
101123
- if (emitSignature === oldSignature)
101124
- return;
101125
- ((_g = state.emitSignatures) !== null && _g !== void 0 ? _g : (state.emitSignatures = new ts.Map())).set(filePath, emitSignature);
101126
- state.hasChangedEmitSignature = true;
101127
- 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
+ }
101128
100932
  }
101129
100933
  }
101130
100934
  else if (state.compilerOptions.composite) {
101131
- var newSignature = computeSignature(text, computeHash, data);
101132
- if (newSignature === state.outSignature)
101133
- return;
101134
- state.outSignature = newSignature;
101135
- state.hasChangedEmitSignature = true;
101136
- state.latestChangedDtsFile = fileName;
100935
+ var newSignature = computeSignature(text, data, computeHash);
100936
+ if (newSignature !== state.outSignature) {
100937
+ state.outSignature = newSignature;
100938
+ state.hasChangedEmitSignature = true;
100939
+ }
101137
100940
  }
101138
100941
  }
101139
100942
  if (writeFile)
@@ -101189,7 +100992,7 @@ var ts;
101189
100992
  }
101190
100993
  function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
101191
100994
  while (true) {
101192
- var affected = getNextAffectedFile(state, cancellationToken, computeHash, getCanonicalFileName, host);
100995
+ var affected = getNextAffectedFile(state, cancellationToken, computeHash, host);
101193
100996
  if (!affected) {
101194
100997
  return undefined;
101195
100998
  }
@@ -101254,12 +101057,11 @@ var ts;
101254
101057
  var state;
101255
101058
  var filePaths;
101256
101059
  var filePathsSetList;
101257
- var latestChangedDtsFile = program.latestChangedDtsFile ? toAbsolutePath(program.latestChangedDtsFile) : undefined;
101258
101060
  if (isProgramBundleEmitBuildInfo(program)) {
101259
101061
  state = {
101260
101062
  fileInfos: new ts.Map(),
101261
101063
  compilerOptions: program.options ? ts.convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
101262
- latestChangedDtsFile: latestChangedDtsFile,
101064
+ dtsChangeTime: program.dtsChangeTime,
101263
101065
  outSignature: program.outSignature,
101264
101066
  };
101265
101067
  }
@@ -101292,7 +101094,7 @@ var ts;
101292
101094
  affectedFilesPendingEmitKind: program.affectedFilesPendingEmit && ts.arrayToMap(program.affectedFilesPendingEmit, function (value) { return toFilePath(value[0]); }, function (value) { return value[1]; }),
101293
101095
  affectedFilesPendingEmitIndex: program.affectedFilesPendingEmit && 0,
101294
101096
  changedFilesSet: new ts.Set(ts.map(program.changeFileSet, toFilePath)),
101295
- latestChangedDtsFile: latestChangedDtsFile,
101097
+ dtsChangeTime: program.dtsChangeTime,
101296
101098
  emitSignatures: (emitSignatures_1 === null || emitSignatures_1 === void 0 ? void 0 : emitSignatures_1.size) ? emitSignatures_1 : undefined,
101297
101099
  };
101298
101100
  }
@@ -101319,7 +101121,6 @@ var ts;
101319
101121
  getSemanticDiagnosticsOfNextAffectedFile: ts.notImplemented,
101320
101122
  emitBuildInfo: ts.notImplemented,
101321
101123
  close: ts.noop,
101322
- hasChangedEmitSignature: ts.returnFalse,
101323
101124
  };
101324
101125
  function toPath(path) {
101325
101126
  return ts.toPath(path, buildInfoDirectory, getCanonicalFileName);
@@ -102460,7 +102261,7 @@ var ts;
102460
102261
  importedFileFromNodeModules = importedFileFromNodeModules || isInNodeModules;
102461
102262
  });
102462
102263
  var sortedPaths = [];
102463
- var _loop_35 = function (directory) {
102264
+ var _loop_34 = function (directory) {
102464
102265
  var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
102465
102266
  var pathsInDirectory;
102466
102267
  allFileNames.forEach(function (_a, fileName) {
@@ -102484,7 +102285,7 @@ var ts;
102484
102285
  };
102485
102286
  var out_directory_1;
102486
102287
  for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
102487
- var state_11 = _loop_35(directory);
102288
+ var state_11 = _loop_34(directory);
102488
102289
  directory = out_directory_1;
102489
102290
  if (state_11 === "break")
102490
102291
  break;
@@ -103257,6 +103058,7 @@ var ts;
103257
103058
  readDirectory: ts.maybeBind(host, host.readDirectory),
103258
103059
  disableUseFileVersionAsSignature: host.disableUseFileVersionAsSignature,
103259
103060
  storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
103061
+ now: ts.maybeBind(host, host.now),
103260
103062
  };
103261
103063
  function writeFile(fileName, text, writeByteOrderMark, onError) {
103262
103064
  try {
@@ -103395,6 +103197,7 @@ var ts;
103395
103197
  host.createHash = ts.maybeBind(system, system.createHash);
103396
103198
  host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature;
103397
103199
  host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
103200
+ host.now = ts.maybeBind(system, system.now);
103398
103201
  ts.setGetSourceFileAsHashVersioned(host, system);
103399
103202
  ts.changeCompilerHostLikeToUseCache(host, function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName); });
103400
103203
  return host;
@@ -103445,6 +103248,7 @@ var ts;
103445
103248
  var parsedConfigs;
103446
103249
  var sharedExtendedConfigFileWatchers;
103447
103250
  var extendedConfigCache = host.extendedConfigCache;
103251
+ var changesAffectResolution = false;
103448
103252
  var reportFileChangeDetectedOnCreateProgram = false;
103449
103253
  var sourceFilesCache = new ts.Map();
103450
103254
  var missingFilePathsRequestedForRelease;
@@ -103589,11 +103393,11 @@ var ts;
103589
103393
  var program = getCurrentBuilderProgram();
103590
103394
  if (hasChangedCompilerOptions) {
103591
103395
  newLine = updateNewLine();
103592
- if (program && ts.changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions)) {
103396
+ if (program && (changesAffectResolution || ts.changesAffectModuleResolution(program.getCompilerOptions(), compilerOptions))) {
103593
103397
  resolutionCache.clear();
103594
103398
  }
103595
103399
  }
103596
- var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
103400
+ var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution || changesAffectResolution);
103597
103401
  if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
103598
103402
  if (hasChangedConfigFileParsingErrors) {
103599
103403
  if (reportFileChangeDetectedOnCreateProgram) {
@@ -103609,6 +103413,7 @@ var ts;
103609
103413
  }
103610
103414
  createNewProgram(hasInvalidatedResolution);
103611
103415
  }
103416
+ changesAffectResolution = false;
103612
103417
  reportFileChangeDetectedOnCreateProgram = false;
103613
103418
  if (host.afterProgramCreate && program !== builderProgram) {
103614
103419
  host.afterProgramCreate(builderProgram);
@@ -104616,7 +104421,8 @@ var ts;
104616
104421
  };
104617
104422
  }
104618
104423
  var host = state.host, compilerHost = state.compilerHost;
104619
- 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;
104620
104426
  var emitterDiagnostics = ts.createDiagnosticCollection();
104621
104427
  var emittedOutputs = new ts.Map();
104622
104428
  var options = program.getCompilerOptions();
@@ -104624,11 +104430,16 @@ var ts;
104624
104430
  var outputTimeStampMap;
104625
104431
  var now;
104626
104432
  outputFiles.forEach(function (_a) {
104433
+ var _b, _c;
104627
104434
  var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
104628
104435
  var path = toPath(state, name);
104629
104436
  emittedOutputs.set(toPath(state, name), name);
104630
- if (buildInfo)
104631
- 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
+ }
104632
104443
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
104633
104444
  if (!isIncremental && state.watch) {
104634
104445
  (outputTimeStampMap || (outputTimeStampMap = getOutputTimeStampMap(state, projectPath))).set(path, now || (now = getCurrentTime(state.host)));
@@ -104642,7 +104453,7 @@ var ts;
104642
104453
  ts.Debug.assert(step === BuildStep.EmitBuildInfo);
104643
104454
  var emitResult = program.emitBuildInfo(function (name, text, writeByteOrderMark, onError, sourceFiles, data) {
104644
104455
  if (data === null || data === void 0 ? void 0 : data.buildInfo)
104645
- setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions(), BuildResultFlags.DeclarationOutputUnchanged);
104456
+ setBuildInfo(state, data.buildInfo, projectPath, program.getCompilerOptions());
104646
104457
  if (writeFileCallback)
104647
104458
  writeFileCallback(name, text, writeByteOrderMark, onError, sourceFiles, data);
104648
104459
  else
@@ -104674,6 +104485,7 @@ var ts;
104674
104485
  state.diagnostics.delete(projectPath);
104675
104486
  state.projectStatus.set(projectPath, {
104676
104487
  type: ts.UpToDateStatusType.UpToDate,
104488
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, config.options, projectPath),
104677
104489
  oldestOutputFileName: oldestOutputFileName
104678
104490
  });
104679
104491
  afterProgramDone(state, program, config);
@@ -104713,10 +104525,10 @@ var ts;
104713
104525
  var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo;
104714
104526
  emittedOutputs.set(toPath(state, name), name);
104715
104527
  if (buildInfo) {
104716
- 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)) {
104717
104530
  resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged;
104718
104531
  }
104719
- setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags);
104720
104532
  }
104721
104533
  ts.writeFile(writeFileCallback ? { writeFile: writeFileCallback } : compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
104722
104534
  });
@@ -104886,7 +104698,7 @@ var ts;
104886
104698
  }
104887
104699
  function afterProgramDone(state, program, config) {
104888
104700
  if (program) {
104889
- if (state.write)
104701
+ if (program && state.write)
104890
104702
  ts.listFiles(program, state.write);
104891
104703
  if (state.host.afterProgramEmitAndDiagnostics) {
104892
104704
  state.host.afterProgramEmitAndDiagnostics(program);
@@ -104965,23 +104777,15 @@ var ts;
104965
104777
  state.outputTimeStamps.set(resolvedConfigFilePath, result = new ts.Map());
104966
104778
  return result;
104967
104779
  }
104968
- function setBuildInfo(state, buildInfo, resolvedConfigPath, options, resultFlags) {
104780
+ function setBuildInfo(state, buildInfo, resolvedConfigPath, options) {
104969
104781
  var buildInfoPath = ts.getTsBuildInfoEmitOutputFilePath(options);
104970
104782
  var existing = getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath);
104971
- var modifiedTime = getCurrentTime(state.host);
104972
104783
  if (existing) {
104973
104784
  existing.buildInfo = buildInfo;
104974
- existing.modifiedTime = modifiedTime;
104975
- if (!(resultFlags & BuildResultFlags.DeclarationOutputUnchanged))
104976
- existing.latestChangedDtsTime = modifiedTime;
104785
+ existing.modifiedTime = getCurrentTime(state.host);
104977
104786
  }
104978
104787
  else {
104979
- state.buildInfoCache.set(resolvedConfigPath, {
104980
- path: toPath(state, buildInfoPath),
104981
- buildInfo: buildInfo,
104982
- modifiedTime: modifiedTime,
104983
- latestChangedDtsTime: resultFlags & BuildResultFlags.DeclarationOutputUnchanged ? undefined : modifiedTime,
104984
- });
104788
+ state.buildInfoCache.set(resolvedConfigPath, { path: toPath(state, buildInfoPath), buildInfo: buildInfo, modifiedTime: getCurrentTime(state.host) });
104985
104789
  }
104986
104790
  }
104987
104791
  function getBuildInfoCacheEntry(state, buildInfoPath, resolvedConfigPath) {
@@ -105012,7 +104816,7 @@ var ts;
105012
104816
  }
105013
104817
  }
105014
104818
  function getUpToDateStatusWorker(state, project, resolvedPath) {
105015
- var _a, _b;
104819
+ var _a, _b, _c;
105016
104820
  if (!project.fileNames.length && !ts.canJsonReportNoInputFiles(project.raw)) {
105017
104821
  return {
105018
104822
  type: ts.UpToDateStatusType.ContainerOnly
@@ -105022,8 +104826,8 @@ var ts;
105022
104826
  var force = !!state.options.force;
105023
104827
  if (project.projectReferences) {
105024
104828
  state.projectStatus.set(resolvedPath, { type: ts.UpToDateStatusType.ComputingUpstream });
105025
- for (var _i = 0, _c = project.projectReferences; _i < _c.length; _i++) {
105026
- var ref = _c[_i];
104829
+ for (var _i = 0, _d = project.projectReferences; _i < _d.length; _i++) {
104830
+ var ref = _d[_i];
105027
104831
  var resolvedRef = ts.resolveProjectReferencePath(ref);
105028
104832
  var resolvedRefPath = toResolvedConfigFilePath(state, resolvedRef);
105029
104833
  var resolvedConfig = parseConfigFile(state, resolvedRef, resolvedRefPath);
@@ -105059,6 +104863,7 @@ var ts;
105059
104863
  var buildInfoTime;
105060
104864
  var buildInfoProgram;
105061
104865
  var buildInfoVersionMap;
104866
+ var newestDeclarationFileContentChangedTime;
105062
104867
  if (buildInfoPath) {
105063
104868
  var buildInfoCacheEntry_1 = getBuildInfoCacheEntry(state, buildInfoPath, resolvedPath);
105064
104869
  buildInfoTime = (buildInfoCacheEntry_1 === null || buildInfoCacheEntry_1 === void 0 ? void 0 : buildInfoCacheEntry_1.modifiedTime) || ts.getModifiedTime(host, buildInfoPath);
@@ -105094,12 +104899,13 @@ var ts;
105094
104899
  }
105095
104900
  oldestOutputFileTime = buildInfoTime;
105096
104901
  oldestOutputFileName = buildInfoPath;
104902
+ newestDeclarationFileContentChangedTime = ((_c = buildInfo.program) === null || _c === void 0 ? void 0 : _c.dtsChangeTime) ? new Date(buildInfo.program.dtsChangeTime) : undefined;
105097
104903
  }
105098
104904
  var newestInputFileName = undefined;
105099
104905
  var newestInputFileTime = minimumDate;
105100
104906
  var pseudoInputUpToDate = false;
105101
- for (var _d = 0, _e = project.fileNames; _d < _e.length; _d++) {
105102
- var inputFile = _e[_d];
104907
+ for (var _e = 0, _f = project.fileNames; _e < _f.length; _e++) {
104908
+ var inputFile = _f[_e];
105103
104909
  var inputTime = getModifiedTime(state, inputFile);
105104
104910
  if (inputTime === ts.missingFileModifiedTime) {
105105
104911
  return {
@@ -105135,8 +104941,8 @@ var ts;
105135
104941
  if (!buildInfoPath) {
105136
104942
  var outputs = ts.getAllProjectOutputs(project, !host.useCaseSensitiveFileNames());
105137
104943
  var outputTimeStampMap = getOutputTimeStampMap(state, resolvedPath);
105138
- for (var _f = 0, outputs_1 = outputs; _f < outputs_1.length; _f++) {
105139
- var output = outputs_1[_f];
104944
+ for (var _g = 0, outputs_1 = outputs; _g < outputs_1.length; _g++) {
104945
+ var output = outputs_1[_g];
105140
104946
  var path = toPath(state, output);
105141
104947
  var outputTime = outputTimeStampMap === null || outputTimeStampMap === void 0 ? void 0 : outputTimeStampMap.get(path);
105142
104948
  if (!outputTime) {
@@ -105169,8 +104975,8 @@ var ts;
105169
104975
  var usesPrepend = false;
105170
104976
  var upstreamChangedProject;
105171
104977
  if (referenceStatuses) {
105172
- for (var _g = 0, referenceStatuses_1 = referenceStatuses; _g < referenceStatuses_1.length; _g++) {
105173
- 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;
105174
104980
  usesPrepend = usesPrepend || !!(ref.prepend);
105175
104981
  if (refStatus.newestInputFileTime && refStatus.newestInputFileTime <= oldestOutputFileTime) {
105176
104982
  continue;
@@ -105182,8 +104988,7 @@ var ts;
105182
104988
  newerProjectName: ref.path
105183
104989
  };
105184
104990
  }
105185
- var newestDeclarationFileContentChangedTime = getLatestChangedDtsTime(state, resolvedConfig.options, resolvedRefPath);
105186
- if (newestDeclarationFileContentChangedTime && newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
104991
+ if (refStatus.newestDeclarationFileContentChangedTime && refStatus.newestDeclarationFileContentChangedTime <= oldestOutputFileTime) {
105187
104992
  pseudoUpToDate = true;
105188
104993
  upstreamChangedProject = ref.path;
105189
104994
  continue;
@@ -105221,6 +105026,7 @@ var ts;
105221
105026
  pseudoInputUpToDate ?
105222
105027
  ts.UpToDateStatusType.UpToDateWithInputFileText :
105223
105028
  ts.UpToDateStatusType.UpToDate,
105029
+ newestDeclarationFileContentChangedTime: newestDeclarationFileContentChangedTime,
105224
105030
  newestInputFileTime: newestInputFileTime,
105225
105031
  newestInputFileName: newestInputFileName,
105226
105032
  oldestOutputFileName: oldestOutputFileName
@@ -105299,17 +105105,13 @@ var ts;
105299
105105
  outputTimeStampMap.delete(key);
105300
105106
  });
105301
105107
  }
105302
- function getLatestChangedDtsTime(state, options, resolvedConfigPath) {
105108
+ function getDtsChangeTime(state, options, resolvedConfigPath) {
105109
+ var _a;
105303
105110
  if (!options.composite)
105304
105111
  return undefined;
105305
- var entry = ts.Debug.checkDefined(state.buildInfoCache.get(resolvedConfigPath));
105306
- if (entry.latestChangedDtsTime !== undefined)
105307
- return entry.latestChangedDtsTime || undefined;
105308
- var latestChangedDtsTime = entry.buildInfo && entry.buildInfo.program && entry.buildInfo.program.latestChangedDtsFile ?
105309
- state.host.getModifiedTime(ts.getNormalizedAbsolutePath(entry.buildInfo.program.latestChangedDtsFile, ts.getDirectoryPath(entry.path))) :
105310
- undefined;
105311
- entry.latestChangedDtsTime = latestChangedDtsTime || false;
105312
- 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;
105313
105115
  }
105314
105116
  function updateOutputTimestamps(state, proj, resolvedPath) {
105315
105117
  if (state.options.dry) {
@@ -105318,6 +105120,7 @@ var ts;
105318
105120
  updateOutputTimestampsWorker(state, proj, resolvedPath, ts.Diagnostics.Updating_output_timestamps_of_project_0);
105319
105121
  state.projectStatus.set(resolvedPath, {
105320
105122
  type: ts.UpToDateStatusType.UpToDate,
105123
+ newestDeclarationFileContentChangedTime: getDtsChangeTime(state, proj.options, resolvedPath),
105321
105124
  oldestOutputFileName: ts.getFirstProjectOutput(proj, !state.host.useCaseSensitiveFileNames())
105322
105125
  });
105323
105126
  }