typescript 5.5.0-dev.20240523 → 5.5.0-dev.20240525

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.
Files changed (3) hide show
  1. package/lib/tsc.js +305 -188
  2. package/lib/typescript.js +320 -195
  3. package/package.json +2 -2
package/lib/typescript.js CHANGED
@@ -2370,7 +2370,7 @@ module.exports = __toCommonJS(typescript_exports);
2370
2370
 
2371
2371
  // src/compiler/corePublic.ts
2372
2372
  var versionMajorMinor = "5.5";
2373
- var version = `${versionMajorMinor}.0-dev.20240523`;
2373
+ var version = `${versionMajorMinor}.0-dev.20240525`;
2374
2374
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2375
2375
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2376
2376
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6200,7 +6200,7 @@ var RegularExpressionFlags = /* @__PURE__ */ ((RegularExpressionFlags2) => {
6200
6200
  RegularExpressionFlags2[RegularExpressionFlags2["Unicode"] = 32] = "Unicode";
6201
6201
  RegularExpressionFlags2[RegularExpressionFlags2["UnicodeSets"] = 64] = "UnicodeSets";
6202
6202
  RegularExpressionFlags2[RegularExpressionFlags2["Sticky"] = 128] = "Sticky";
6203
- RegularExpressionFlags2[RegularExpressionFlags2["UnicodeMode"] = 96] = "UnicodeMode";
6203
+ RegularExpressionFlags2[RegularExpressionFlags2["AnyUnicodeMode"] = 96] = "AnyUnicodeMode";
6204
6204
  RegularExpressionFlags2[RegularExpressionFlags2["Modifiers"] = 28] = "Modifiers";
6205
6205
  return RegularExpressionFlags2;
6206
6206
  })(RegularExpressionFlags || {});
@@ -6602,6 +6602,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
6602
6602
  TypeFlags2[TypeFlags2["TemplateLiteral"] = 134217728] = "TemplateLiteral";
6603
6603
  TypeFlags2[TypeFlags2["StringMapping"] = 268435456] = "StringMapping";
6604
6604
  TypeFlags2[TypeFlags2["Reserved1"] = 536870912] = "Reserved1";
6605
+ TypeFlags2[TypeFlags2["Reserved2"] = 1073741824] = "Reserved2";
6605
6606
  TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
6606
6607
  TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
6607
6608
  TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
@@ -6640,6 +6641,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
6640
6641
  TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
6641
6642
  TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
6642
6643
  TypeFlags2[TypeFlags2["IncludesConstrainedTypeVariable"] = 536870912 /* Reserved1 */] = "IncludesConstrainedTypeVariable";
6644
+ TypeFlags2[TypeFlags2["IncludesError"] = 1073741824 /* Reserved2 */] = "IncludesError";
6643
6645
  TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
6644
6646
  return TypeFlags2;
6645
6647
  })(TypeFlags || {});
@@ -13324,25 +13326,19 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13324
13326
  }
13325
13327
  function reScanSlashToken(reportErrors2) {
13326
13328
  if (token === 44 /* SlashToken */ || token === 69 /* SlashEqualsToken */) {
13327
- let p = tokenStart + 1;
13329
+ const startOfRegExpBody = tokenStart + 1;
13330
+ pos = startOfRegExpBody;
13328
13331
  let inEscape = false;
13329
13332
  let inCharacterClass = false;
13330
13333
  while (true) {
13331
- if (p >= end) {
13332
- tokenFlags |= 4 /* Unterminated */;
13333
- error2(Diagnostics.Unterminated_regular_expression_literal);
13334
- break;
13335
- }
13336
- const ch = charCodeUnchecked(p);
13337
- if (isLineBreak(ch)) {
13334
+ const ch = charCodeChecked(pos);
13335
+ if (ch === -1 /* EOF */ || isLineBreak(ch)) {
13338
13336
  tokenFlags |= 4 /* Unterminated */;
13339
- error2(Diagnostics.Unterminated_regular_expression_literal);
13340
13337
  break;
13341
13338
  }
13342
13339
  if (inEscape) {
13343
13340
  inEscape = false;
13344
13341
  } else if (ch === 47 /* slash */ && !inCharacterClass) {
13345
- p++;
13346
13342
  break;
13347
13343
  } else if (ch === 91 /* openBracket */) {
13348
13344
  inCharacterClass = true;
@@ -13351,59 +13347,86 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13351
13347
  } else if (ch === 93 /* closeBracket */) {
13352
13348
  inCharacterClass = false;
13353
13349
  }
13354
- p++;
13350
+ pos++;
13355
13351
  }
13356
- const isUnterminated = !!(tokenFlags & 4 /* Unterminated */);
13357
- const endOfBody = p - (isUnterminated ? 0 : 1);
13358
- let regExpFlags = 0 /* None */;
13359
- while (p < end) {
13360
- const ch = charCodeUnchecked(p);
13361
- if (!isIdentifierPart(ch, languageVersion)) {
13362
- break;
13352
+ const endOfRegExpBody = pos;
13353
+ if (tokenFlags & 4 /* Unterminated */) {
13354
+ pos = startOfRegExpBody;
13355
+ inEscape = false;
13356
+ let characterClassDepth = 0;
13357
+ let inDecimalQuantifier = false;
13358
+ let groupDepth = 0;
13359
+ while (pos < endOfRegExpBody) {
13360
+ const ch = charCodeUnchecked(pos);
13361
+ if (inEscape) {
13362
+ inEscape = false;
13363
+ } else if (ch === 92 /* backslash */) {
13364
+ inEscape = true;
13365
+ } else if (ch === 91 /* openBracket */) {
13366
+ characterClassDepth++;
13367
+ } else if (ch === 93 /* closeBracket */ && characterClassDepth) {
13368
+ characterClassDepth--;
13369
+ } else if (!characterClassDepth) {
13370
+ if (ch === 123 /* openBrace */) {
13371
+ inDecimalQuantifier = true;
13372
+ } else if (ch === 125 /* closeBrace */ && inDecimalQuantifier) {
13373
+ inDecimalQuantifier = false;
13374
+ } else if (!inDecimalQuantifier) {
13375
+ if (ch === 40 /* openParen */) {
13376
+ groupDepth++;
13377
+ } else if (ch === 41 /* closeParen */ && groupDepth) {
13378
+ groupDepth--;
13379
+ } else if (ch === 41 /* closeParen */ || ch === 93 /* closeBracket */ || ch === 125 /* closeBrace */) {
13380
+ break;
13381
+ }
13382
+ }
13383
+ }
13384
+ pos++;
13363
13385
  }
13364
- if (reportErrors2) {
13365
- const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
13366
- if (flag === void 0) {
13367
- error2(Diagnostics.Unknown_regular_expression_flag, p, 1);
13368
- } else if (regExpFlags & flag) {
13369
- error2(Diagnostics.Duplicate_regular_expression_flag, p, 1);
13370
- } else if (((regExpFlags | flag) & 96 /* UnicodeMode */) === 96 /* UnicodeMode */) {
13371
- error2(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, p, 1);
13372
- } else {
13373
- regExpFlags |= flag;
13374
- checkRegularExpressionFlagAvailable(flag, p);
13386
+ while (isWhiteSpaceLike(charCodeChecked(pos - 1)) || charCodeChecked(pos - 1) === 59 /* semicolon */) pos--;
13387
+ error2(Diagnostics.Unterminated_regular_expression_literal, tokenStart, pos - tokenStart);
13388
+ } else {
13389
+ pos++;
13390
+ let regExpFlags = 0 /* None */;
13391
+ while (true) {
13392
+ const ch = codePointChecked(pos);
13393
+ if (ch === -1 /* EOF */ || !isIdentifierPart(ch, languageVersion)) {
13394
+ break;
13395
+ }
13396
+ if (reportErrors2) {
13397
+ const flag = characterToRegularExpressionFlag(String.fromCharCode(ch));
13398
+ if (flag === void 0) {
13399
+ error2(Diagnostics.Unknown_regular_expression_flag, pos, 1);
13400
+ } else if (regExpFlags & flag) {
13401
+ error2(Diagnostics.Duplicate_regular_expression_flag, pos, 1);
13402
+ } else if (((regExpFlags | flag) & 96 /* AnyUnicodeMode */) === 96 /* AnyUnicodeMode */) {
13403
+ error2(Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously, pos, 1);
13404
+ } else {
13405
+ regExpFlags |= flag;
13406
+ checkRegularExpressionFlagAvailable(flag, pos);
13407
+ }
13375
13408
  }
13409
+ pos++;
13410
+ }
13411
+ if (reportErrors2) {
13412
+ scanRange(startOfRegExpBody, endOfRegExpBody - startOfRegExpBody, () => {
13413
+ scanRegularExpressionWorker(
13414
+ regExpFlags,
13415
+ /*annexB*/
13416
+ true
13417
+ );
13418
+ });
13376
13419
  }
13377
- p++;
13378
- }
13379
- pos = p;
13380
- if (reportErrors2) {
13381
- const saveTokenStart = tokenStart;
13382
- const saveTokenFlags = tokenFlags;
13383
- const savePos = pos;
13384
- const saveEnd = end;
13385
- pos = tokenStart + 1;
13386
- end = endOfBody;
13387
- scanRegularExpressionWorker(
13388
- regExpFlags,
13389
- isUnterminated,
13390
- /*annexB*/
13391
- true
13392
- );
13393
- tokenStart = saveTokenStart;
13394
- tokenFlags = saveTokenFlags;
13395
- pos = savePos;
13396
- end = saveEnd;
13397
13420
  }
13398
13421
  tokenValue = text.substring(tokenStart, pos);
13399
13422
  token = 14 /* RegularExpressionLiteral */;
13400
13423
  }
13401
13424
  return token;
13402
13425
  }
13403
- function scanRegularExpressionWorker(regExpFlags, isUnterminated, annexB) {
13426
+ function scanRegularExpressionWorker(regExpFlags, annexB) {
13404
13427
  var unicodeSetsMode = !!(regExpFlags & 64 /* UnicodeSets */);
13405
- var unicodeMode = !!(regExpFlags & 96 /* UnicodeMode */);
13406
- if (unicodeMode) {
13428
+ var anyUnicodeMode = !!(regExpFlags & 96 /* AnyUnicodeMode */);
13429
+ if (anyUnicodeMode) {
13407
13430
  annexB = false;
13408
13431
  }
13409
13432
  var mayContainStrings = false;
@@ -13522,7 +13545,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13522
13545
  if (max || charCodeChecked(pos) === 125 /* closeBrace */) {
13523
13546
  error2(Diagnostics.Incomplete_quantifier_Digit_expected, digitsStart, 0);
13524
13547
  } else {
13525
- if (unicodeMode) {
13548
+ if (anyUnicodeMode) {
13526
13549
  error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
13527
13550
  }
13528
13551
  isPreviousTermQuantifiable = true;
@@ -13533,7 +13556,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13533
13556
  error2(Diagnostics.Numbers_out_of_order_in_quantifier, digitsStart, pos - digitsStart);
13534
13557
  }
13535
13558
  } else if (!min2) {
13536
- if (unicodeMode) {
13559
+ if (anyUnicodeMode) {
13537
13560
  error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, start2, 1, String.fromCharCode(ch));
13538
13561
  }
13539
13562
  isPreviousTermQuantifiable = true;
@@ -13573,10 +13596,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13573
13596
  }
13574
13597
  case 93 /* closeBracket */:
13575
13598
  case 125 /* closeBrace */:
13576
- if (isUnterminated && !isInGroup) {
13577
- return;
13578
- }
13579
- if (unicodeMode || ch === 41 /* closeParen */) {
13599
+ if (anyUnicodeMode || ch === 41 /* closeParen */) {
13580
13600
  error2(Diagnostics.Unexpected_0_Did_you_mean_to_escape_it_with_backslash, pos, 1, String.fromCharCode(ch));
13581
13601
  }
13582
13602
  pos++;
@@ -13625,7 +13645,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13625
13645
  true
13626
13646
  );
13627
13647
  scanExpectedChar(62 /* greaterThan */);
13628
- } else if (unicodeMode) {
13648
+ } else if (anyUnicodeMode) {
13629
13649
  error2(Diagnostics.k_must_be_followed_by_a_capturing_group_name_enclosed_in_angle_brackets, pos - 2, 2);
13630
13650
  }
13631
13651
  break;
@@ -13658,6 +13678,9 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13658
13678
  Debug.assertEqual(charCodeUnchecked(pos - 1), 92 /* backslash */);
13659
13679
  let ch = charCodeChecked(pos);
13660
13680
  switch (ch) {
13681
+ case -1 /* EOF */:
13682
+ error2(Diagnostics.Undetermined_character_escape, pos - 1, 1);
13683
+ return "\\";
13661
13684
  case 99 /* c */:
13662
13685
  pos++;
13663
13686
  ch = charCodeChecked(pos);
@@ -13665,7 +13688,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13665
13688
  pos++;
13666
13689
  return String.fromCharCode(ch & 31);
13667
13690
  }
13668
- if (unicodeMode) {
13691
+ if (anyUnicodeMode) {
13669
13692
  error2(Diagnostics.c_must_be_followed_by_an_ASCII_letter, pos - 2, 2);
13670
13693
  } else if (atomEscape && annexB) {
13671
13694
  pos--;
@@ -13690,14 +13713,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
13690
13713
  pos++;
13691
13714
  return String.fromCharCode(ch);
13692
13715
  default:
13693
- if (pos >= end) {
13694
- error2(Diagnostics.Undetermined_character_escape, pos - 1, 1);
13695
- return "\\";
13696
- }
13697
13716
  pos--;
13698
13717
  return scanEscapeSequence(
13699
13718
  /*shouldEmitInvalidEscapeError*/
13700
- unicodeMode,
13719
+ anyUnicodeMode,
13701
13720
  /*isRegularExpression*/
13702
13721
  annexB ? "annex-b" : true
13703
13722
  );
@@ -14173,10 +14192,10 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14173
14192
  }
14174
14193
  }
14175
14194
  scanExpectedChar(125 /* closeBrace */);
14176
- if (!unicodeMode) {
14195
+ if (!anyUnicodeMode) {
14177
14196
  error2(Diagnostics.Unicode_property_value_expressions_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set, start2, pos - start2);
14178
14197
  }
14179
- } else if (unicodeMode) {
14198
+ } else if (anyUnicodeMode) {
14180
14199
  error2(Diagnostics._0_must_be_followed_by_a_Unicode_property_value_expression_enclosed_in_braces, pos - 2, 2, String.fromCharCode(ch));
14181
14200
  }
14182
14201
  return true;
@@ -14196,7 +14215,7 @@ function createScanner(languageVersion, skipTrivia2, languageVariant = 0 /* Stan
14196
14215
  return value;
14197
14216
  }
14198
14217
  function scanSourceCharacter() {
14199
- const size = unicodeMode ? charSize(charCodeChecked(pos)) : 1;
14218
+ const size = anyUnicodeMode ? charSize(charCodeChecked(pos)) : 1;
14200
14219
  pos += size;
14201
14220
  return size > 0 ? text.substring(pos - size, pos) : "";
14202
14221
  }
@@ -32859,10 +32878,7 @@ var Parser;
32859
32878
  function parseErrorAtPosition(start, length2, message, ...args) {
32860
32879
  const lastError = lastOrUndefined(parseDiagnostics);
32861
32880
  let result;
32862
- if (message.category === 3 /* Message */ && lastError && start === lastError.start && length2 === lastError.length) {
32863
- result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
32864
- addRelatedInfo(lastError, result);
32865
- } else if (!lastError || start !== lastError.start) {
32881
+ if (!lastError || start !== lastError.start) {
32866
32882
  result = createDetachedDiagnostic(fileName, sourceText, start, length2, message, ...args);
32867
32883
  parseDiagnostics.push(result);
32868
32884
  }
@@ -51035,7 +51051,12 @@ function createTypeChecker(host) {
51035
51051
  if (resolvedTarget === unknownSymbol) {
51036
51052
  return source;
51037
51053
  }
51038
- target = cloneSymbol(resolvedTarget);
51054
+ if (!(resolvedTarget.flags & getExcludedSymbolFlags(source.flags)) || (source.flags | resolvedTarget.flags) & 67108864 /* Assignment */) {
51055
+ target = cloneSymbol(resolvedTarget);
51056
+ } else {
51057
+ reportMergeSymbolError(target, source);
51058
+ return source;
51059
+ }
51039
51060
  }
51040
51061
  if (source.flags & 512 /* ValueModule */ && target.flags & 512 /* ValueModule */ && target.constEnumOnlyModule && !source.constEnumOnlyModule) {
51041
51062
  target.constEnumOnlyModule = false;
@@ -51065,27 +51086,30 @@ function createTypeChecker(host) {
51065
51086
  );
51066
51087
  }
51067
51088
  } else {
51068
- const isEitherEnum = !!(target.flags & 384 /* Enum */ || source.flags & 384 /* Enum */);
51069
- const isEitherBlockScoped = !!(target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */);
51089
+ reportMergeSymbolError(target, source);
51090
+ }
51091
+ return target;
51092
+ function reportMergeSymbolError(target2, source2) {
51093
+ const isEitherEnum = !!(target2.flags & 384 /* Enum */ || source2.flags & 384 /* Enum */);
51094
+ const isEitherBlockScoped = !!(target2.flags & 2 /* BlockScopedVariable */ || source2.flags & 2 /* BlockScopedVariable */);
51070
51095
  const message = isEitherEnum ? Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations : isEitherBlockScoped ? Diagnostics.Cannot_redeclare_block_scoped_variable_0 : Diagnostics.Duplicate_identifier_0;
51071
- const sourceSymbolFile = source.declarations && getSourceFileOfNode(source.declarations[0]);
51072
- const targetSymbolFile = target.declarations && getSourceFileOfNode(target.declarations[0]);
51096
+ const sourceSymbolFile = source2.declarations && getSourceFileOfNode(source2.declarations[0]);
51097
+ const targetSymbolFile = target2.declarations && getSourceFileOfNode(target2.declarations[0]);
51073
51098
  const isSourcePlainJs = isPlainJsFile(sourceSymbolFile, compilerOptions.checkJs);
51074
51099
  const isTargetPlainJs = isPlainJsFile(targetSymbolFile, compilerOptions.checkJs);
51075
- const symbolName2 = symbolToString(source);
51100
+ const symbolName2 = symbolToString(source2);
51076
51101
  if (sourceSymbolFile && targetSymbolFile && amalgamatedDuplicates && !isEitherEnum && sourceSymbolFile !== targetSymbolFile) {
51077
51102
  const firstFile = comparePaths(sourceSymbolFile.path, targetSymbolFile.path) === -1 /* LessThan */ ? sourceSymbolFile : targetSymbolFile;
51078
51103
  const secondFile = firstFile === sourceSymbolFile ? targetSymbolFile : sourceSymbolFile;
51079
51104
  const filesDuplicates = getOrUpdate(amalgamatedDuplicates, `${firstFile.path}|${secondFile.path}`, () => ({ firstFile, secondFile, conflictingSymbols: /* @__PURE__ */ new Map() }));
51080
51105
  const conflictingSymbolInfo = getOrUpdate(filesDuplicates.conflictingSymbols, symbolName2, () => ({ isBlockScoped: isEitherBlockScoped, firstFileLocations: [], secondFileLocations: [] }));
51081
- if (!isSourcePlainJs) addDuplicateLocations(conflictingSymbolInfo.firstFileLocations, source);
51082
- if (!isTargetPlainJs) addDuplicateLocations(conflictingSymbolInfo.secondFileLocations, target);
51106
+ if (!isSourcePlainJs) addDuplicateLocations(conflictingSymbolInfo.firstFileLocations, source2);
51107
+ if (!isTargetPlainJs) addDuplicateLocations(conflictingSymbolInfo.secondFileLocations, target2);
51083
51108
  } else {
51084
- if (!isSourcePlainJs) addDuplicateDeclarationErrorsForSymbols(source, message, symbolName2, target);
51085
- if (!isTargetPlainJs) addDuplicateDeclarationErrorsForSymbols(target, message, symbolName2, source);
51109
+ if (!isSourcePlainJs) addDuplicateDeclarationErrorsForSymbols(source2, message, symbolName2, target2);
51110
+ if (!isTargetPlainJs) addDuplicateDeclarationErrorsForSymbols(target2, message, symbolName2, source2);
51086
51111
  }
51087
51112
  }
51088
- return target;
51089
51113
  function addDuplicateLocations(locs, symbol) {
51090
51114
  if (symbol.declarations) {
51091
51115
  for (const decl of symbol.declarations) {
@@ -53931,6 +53955,9 @@ function createTypeChecker(host) {
53931
53955
  function isClassInstanceSide(type) {
53932
53956
  return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || !!(type.flags & 524288 /* Object */) && !!(getObjectFlags(type) & 16777216 /* IsClassInstanceClone */));
53933
53957
  }
53958
+ function getTypeFromTypeNodeWithoutContext(node) {
53959
+ return getTypeFromTypeNode(node);
53960
+ }
53934
53961
  function createNodeBuilder() {
53935
53962
  return {
53936
53963
  typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
@@ -53959,6 +53986,12 @@ function createTypeChecker(host) {
53959
53986
  symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
53960
53987
  symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
53961
53988
  };
53989
+ function getTypeFromTypeNode2(context, node, noMappedTypes) {
53990
+ const type = getTypeFromTypeNodeWithoutContext(node);
53991
+ if (!context.mapper) return type;
53992
+ const mappedType = instantiateType(type, context.mapper);
53993
+ return noMappedTypes && mappedType !== type ? void 0 : mappedType;
53994
+ }
53962
53995
  function setTextRange2(context, range, location) {
53963
53996
  if (!nodeIsSynthesized(range) && !(range.flags & 16 /* Synthesized */) && (!context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(range))) {
53964
53997
  range = factory.cloneNode(range);
@@ -54004,7 +54037,7 @@ function createTypeChecker(host) {
54004
54037
  }
54005
54038
  const clone2 = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
54006
54039
  if (clone2) {
54007
- if (addUndefined && !someType(getTypeFromTypeNode(typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
54040
+ if (addUndefined && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
54008
54041
  return factory.createUnionTypeNode([clone2, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
54009
54042
  }
54010
54043
  return clone2;
@@ -54017,14 +54050,18 @@ function createTypeChecker(host) {
54017
54050
  }
54018
54051
  return void 0;
54019
54052
  }
54020
- function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, annotationType) {
54021
- if (typeNodeIsEquivalentToType(existing, host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
54053
+ function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, annotationType = getTypeFromTypeNode2(
54054
+ context,
54055
+ existing,
54056
+ /*noMappedTypes*/
54057
+ true
54058
+ )) {
54059
+ if (annotationType && typeNodeIsEquivalentToType(host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
54022
54060
  const result = tryReuseExistingTypeNodeHelper(context, existing);
54023
54061
  if (result) {
54024
54062
  return result;
54025
54063
  }
54026
54064
  }
54027
- context.tracker.reportInferenceFallback(existing);
54028
54065
  return void 0;
54029
54066
  }
54030
54067
  function symbolToNode(symbol, context, meaning) {
@@ -54066,7 +54103,8 @@ function createTypeChecker(host) {
54066
54103
  mustCreateTypeParametersNamesLookups: true,
54067
54104
  typeParameterNames: void 0,
54068
54105
  typeParameterNamesByText: void 0,
54069
- typeParameterNamesByTextNextNameCount: void 0
54106
+ typeParameterNamesByTextNextNameCount: void 0,
54107
+ mapper: void 0
54070
54108
  };
54071
54109
  context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
54072
54110
  const resultingNode = cb(context);
@@ -54357,8 +54395,8 @@ function createTypeChecker(host) {
54357
54395
  context.inferTypeParameters = type2.root.inferTypeParameters;
54358
54396
  const extendsTypeNode2 = typeToTypeNodeHelper(instantiateType(type2.root.extendsType, newMapper), context);
54359
54397
  context.inferTypeParameters = saveInferTypeParameters2;
54360
- const trueTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type2.root.node.trueType), newMapper));
54361
- const falseTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type2.root.node.falseType), newMapper));
54398
+ const trueTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode2(context, type2.root.node.trueType), newMapper));
54399
+ const falseTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode2(context, type2.root.node.falseType), newMapper));
54362
54400
  return factory.createConditionalTypeNode(
54363
54401
  checkTypeNode,
54364
54402
  factory.createInferTypeNode(factory.createTypeParameterDeclaration(
@@ -54441,7 +54479,7 @@ function createTypeChecker(host) {
54441
54479
  context.approximateLength += 10;
54442
54480
  const result = setEmitFlags(mappedTypeNode, 1 /* SingleLine */);
54443
54481
  if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
54444
- const originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type2.declaration.typeParameter.constraint.type)) || unknownType, type2.mapper);
54482
+ const originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode2(context, type2.declaration.typeParameter.constraint.type)) || unknownType, type2.mapper);
54445
54483
  return factory.createConditionalTypeNode(
54446
54484
  typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context),
54447
54485
  factory.createInferTypeNode(factory.createTypeParameterDeclaration(
@@ -55068,7 +55106,7 @@ function createTypeChecker(host) {
55068
55106
  /*skipUnionExpanding*/
55069
55107
  true
55070
55108
  )[0];
55071
- const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters, signature.parameters);
55109
+ const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters, signature.parameters, signature.mapper);
55072
55110
  context.approximateLength += 3;
55073
55111
  if (context.flags & 32 /* WriteTypeArgumentsOfSignature */ && signature.target && signature.mapper && signature.target.typeParameters) {
55074
55112
  typeArguments = signature.target.typeParameters.map((parameter) => typeToTypeNodeHelper(instantiateType(parameter, signature.mapper), context));
@@ -55176,11 +55214,15 @@ function createTypeChecker(host) {
55176
55214
  function getParametersInScope(node) {
55177
55215
  return isFunctionLike(node) || isJSDocSignature(node) ? getSignatureFromDeclaration(node).parameters : void 0;
55178
55216
  }
55179
- function enterNewScope(context, declaration, expandedParams, typeParameters, originalParameters) {
55217
+ function enterNewScope(context, declaration, expandedParams, typeParameters, originalParameters, mapper) {
55180
55218
  const cleanupContext = cloneNodeBuilderContext(context);
55181
55219
  let cleanupParams;
55182
55220
  let cleanupTypeParams;
55183
55221
  const oldEnclosingDecl = context.enclosingDeclaration;
55222
+ const oldMapper = context.mapper;
55223
+ if (mapper) {
55224
+ context.mapper = mapper;
55225
+ }
55184
55226
  if (context.enclosingDeclaration && declaration) {
55185
55227
  let pushFakeScope2 = function(kind, addAll) {
55186
55228
  Debug.assert(context.enclosingDeclaration);
@@ -55279,6 +55321,7 @@ function createTypeChecker(host) {
55279
55321
  cleanupTypeParams == null ? void 0 : cleanupTypeParams();
55280
55322
  cleanupContext();
55281
55323
  context.enclosingDeclaration = oldEnclosingDecl;
55324
+ context.mapper = oldMapper;
55282
55325
  };
55283
55326
  }
55284
55327
  function tryGetThisParameterDeclaration(signature, context) {
@@ -55296,7 +55339,7 @@ function createTypeChecker(host) {
55296
55339
  "this",
55297
55340
  /*questionToken*/
55298
55341
  void 0,
55299
- typeToTypeNodeHelper(getTypeFromTypeNode(thisTag.typeExpression), context)
55342
+ typeToTypeNodeHelper(getTypeFromTypeNode2(context, thisTag.typeExpression), context)
55300
55343
  );
55301
55344
  }
55302
55345
  }
@@ -55934,31 +55977,32 @@ function createTypeChecker(host) {
55934
55977
  var _a;
55935
55978
  const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
55936
55979
  const enclosingDeclaration = context.enclosingDeclaration;
55980
+ const oldFlags = context.flags;
55981
+ if (declaration && hasInferredType(declaration) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
55982
+ syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, context);
55983
+ }
55984
+ context.flags |= -2147483648 /* NoSyntacticPrinter */;
55937
55985
  if (enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
55938
- const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
55986
+ const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
55939
55987
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
55940
55988
  const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
55941
- const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
55989
+ const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
55942
55990
  if (result2) {
55991
+ context.flags = oldFlags;
55943
55992
  return result2;
55944
55993
  }
55945
55994
  }
55946
55995
  }
55947
- const oldFlags = context.flags;
55948
55996
  if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
55949
55997
  context.flags |= 1048576 /* AllowUniqueESSymbolType */;
55950
55998
  }
55951
55999
  const decl = declaration ?? symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
55952
56000
  const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
55953
- if (decl && hasInferredType(decl) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
55954
- syntacticNodeBuilder.serializeTypeOfDeclaration(decl, context);
55955
- }
55956
- context.flags |= -2147483648 /* NoSyntacticPrinter */;
55957
56001
  const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
55958
56002
  context.flags = oldFlags;
55959
56003
  return result;
55960
56004
  }
55961
- function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type, typeFromTypeNode = getTypeFromTypeNode(typeNode)) {
56005
+ function typeNodeIsEquivalentToType(annotatedDeclaration, type, typeFromTypeNode) {
55962
56006
  if (typeFromTypeNode === type) {
55963
56007
  return true;
55964
56008
  }
@@ -55988,13 +56032,10 @@ function createTypeChecker(host) {
55988
56032
  function serializeReturnTypeForSignatureWorker(context, signature) {
55989
56033
  const typePredicate = getTypePredicateOfSignature(signature);
55990
56034
  const type = getReturnTypeOfSignature(signature);
55991
- if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
56035
+ if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
55992
56036
  const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
55993
- const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
55994
- if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
55995
- const annotated = getTypeFromTypeNode(annotation);
55996
- const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
55997
- const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, thisInstantiated);
56037
+ if (annotation && getTypeFromTypeNode2(context, annotation) === type) {
56038
+ const result = tryReuseExistingTypeNodeHelper(context, annotation);
55998
56039
  if (result) {
55999
56040
  return result;
56000
56041
  }
@@ -56137,13 +56178,26 @@ function createTypeChecker(host) {
56137
56178
  !(length(existing.typeArguments) >= getMinTypeArgumentCount(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(nodeSymbol))));
56138
56179
  }
56139
56180
  }
56181
+ if (isThisTypeNode(existing)) {
56182
+ if (context.mapper === void 0) return true;
56183
+ const type = getTypeFromTypeNode2(
56184
+ context,
56185
+ existing,
56186
+ /*noMappedTypes*/
56187
+ true
56188
+ );
56189
+ return !!type;
56190
+ }
56140
56191
  if (isTypeReferenceNode(existing)) {
56141
56192
  if (isConstTypeReference(existing)) return false;
56142
56193
  const type = getTypeFromTypeReference(existing);
56143
56194
  const symbol = getNodeLinks(existing).resolvedSymbol;
56144
56195
  if (!symbol) return false;
56145
56196
  if (symbol.flags & 262144 /* TypeParameter */) {
56146
- return true;
56197
+ const type2 = getDeclaredTypeOfSymbol(symbol);
56198
+ if (context.mapper && getMappedType(type2, context.mapper) !== type2) {
56199
+ return false;
56200
+ }
56147
56201
  }
56148
56202
  if (isInJSDoc(existing)) {
56149
56203
  return existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) && !getIntendedTypeFromJSDocTypeReference(existing) && symbol.flags & 788968 /* Type */;
@@ -56156,7 +56210,7 @@ function createTypeChecker(host) {
56156
56210
  return true;
56157
56211
  }
56158
56212
  function serializeExistingTypeNode(context, typeNode) {
56159
- const type = getTypeFromTypeNode(typeNode);
56213
+ const type = getTypeFromTypeNode2(context, typeNode);
56160
56214
  return typeToTypeNodeHelper(type, context);
56161
56215
  }
56162
56216
  function tryReuseExistingTypeNodeHelper(context, existing) {
@@ -56204,8 +56258,8 @@ function createTypeChecker(host) {
56204
56258
  if (isJSDocTypeLiteral(node)) {
56205
56259
  return factory.createTypeLiteralNode(map(node.jsDocPropertyTags, (t) => {
56206
56260
  const name = isIdentifier(t.name) ? t.name : t.name.right;
56207
- const typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText);
56208
- const overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : void 0;
56261
+ const typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode2(context, node), name.escapedText);
56262
+ const overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode2(context, t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : void 0;
56209
56263
  return factory.createPropertySignature(
56210
56264
  /*modifiers*/
56211
56265
  void 0,
@@ -56246,7 +56300,7 @@ function createTypeChecker(host) {
56246
56300
  /*modifiers*/
56247
56301
  void 0,
56248
56302
  getEffectiveDotDotDotForParameter(p),
56249
- getNameForJSDocFunctionParameter(p, i),
56303
+ setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
56250
56304
  p.questionToken,
56251
56305
  visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
56252
56306
  /*initializer*/
@@ -56261,7 +56315,7 @@ function createTypeChecker(host) {
56261
56315
  /*modifiers*/
56262
56316
  void 0,
56263
56317
  getEffectiveDotDotDotForParameter(p),
56264
- getNameForJSDocFunctionParameter(p, i),
56318
+ setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
56265
56319
  p.questionToken,
56266
56320
  visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
56267
56321
  /*initializer*/
@@ -56271,6 +56325,21 @@ function createTypeChecker(host) {
56271
56325
  );
56272
56326
  }
56273
56327
  }
56328
+ if (isThisTypeNode(node)) {
56329
+ if (canReuseTypeNode(context, node)) {
56330
+ return node;
56331
+ }
56332
+ return serializeExistingTypeNode(context, node);
56333
+ }
56334
+ if (isTypeParameterDeclaration(node)) {
56335
+ return factory.updateTypeParameterDeclaration(
56336
+ node,
56337
+ node.modifiers,
56338
+ setTextRange2(context, typeParameterToName(getDeclaredTypeOfSymbol(getSymbolOfDeclaration(node)), context), node),
56339
+ visitNode(node.constraint, visitExistingNodeTreeSymbols, isTypeNode),
56340
+ visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
56341
+ );
56342
+ }
56274
56343
  if (isTypeReferenceNode(node)) {
56275
56344
  if (canReuseTypeNode(context, node)) {
56276
56345
  const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
@@ -56302,7 +56371,7 @@ function createTypeChecker(host) {
56302
56371
  if (isInJSDoc(node) && nodeSymbol && // The import type resolved using jsdoc fallback logic
56303
56372
  (!node.isTypeOf && !(nodeSymbol.flags & 788968 /* Type */) || // The import type had type arguments autofilled by js fallback logic
56304
56373
  !(length(node.typeArguments) >= getMinTypeArgumentCount(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(nodeSymbol))))) {
56305
- return setTextRange2(context, typeToTypeNodeHelper(getTypeFromTypeNode(node), context), node);
56374
+ return setTextRange2(context, typeToTypeNodeHelper(getTypeFromTypeNode2(context, node), context), node);
56306
56375
  }
56307
56376
  return factory.updateImportTypeNode(
56308
56377
  node,
@@ -56372,10 +56441,16 @@ function createTypeChecker(host) {
56372
56441
  return factory.updateComputedPropertyName(node, literal);
56373
56442
  }
56374
56443
  }
56375
- if (isTypePredicateNode(node) && isIdentifier(node.parameterName)) {
56376
- const { node: result, introducesError } = trackExistingEntityName(node.parameterName, context);
56377
- hadError = hadError || introducesError;
56378
- return factory.updateTypePredicateNode(node, node.assertsModifier, result, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
56444
+ if (isTypePredicateNode(node)) {
56445
+ let parameterName;
56446
+ if (isIdentifier(node.parameterName)) {
56447
+ const { node: result, introducesError } = trackExistingEntityName(node.parameterName, context);
56448
+ hadError = hadError || introducesError;
56449
+ parameterName = result;
56450
+ } else {
56451
+ parameterName = node.parameterName;
56452
+ }
56453
+ return factory.updateTypePredicateNode(node, node.assertsModifier, parameterName, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
56379
56454
  }
56380
56455
  if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
56381
56456
  const visited = visitEachChild(
@@ -57151,7 +57226,7 @@ function createTypeChecker(host) {
57151
57226
  }
57152
57227
  return cleanup(factory.createExpressionWithTypeArguments(
57153
57228
  expr,
57154
- map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(context, a, getTypeFromTypeNode(a)) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
57229
+ map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(context, a, getTypeFromTypeNode2(context, a)) || typeToTypeNodeHelper(getTypeFromTypeNode2(context, a), context))
57155
57230
  ));
57156
57231
  function cleanup(result2) {
57157
57232
  context.enclosingDeclaration = oldEnclosing;
@@ -63695,6 +63770,7 @@ function createTypeChecker(host) {
63695
63770
  if (flags & 465829888 /* Instantiable */) includes |= 33554432 /* IncludesInstantiable */;
63696
63771
  if (flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) includes |= 536870912 /* IncludesConstrainedTypeVariable */;
63697
63772
  if (type === wildcardType) includes |= 8388608 /* IncludesWildcard */;
63773
+ if (isErrorType(type)) includes |= 1073741824 /* IncludesError */;
63698
63774
  if (!strictNullChecks && flags & 98304 /* Nullable */) {
63699
63775
  if (!(getObjectFlags(type) & 65536 /* ContainsWideningType */)) includes |= 4194304 /* IncludesNonWideningType */;
63700
63776
  } else {
@@ -63886,7 +63962,7 @@ function createTypeChecker(host) {
63886
63962
  const includes = addTypesToUnion(typeSet, 0, types);
63887
63963
  if (unionReduction !== 0 /* None */) {
63888
63964
  if (includes & 3 /* AnyOrUnknown */) {
63889
- return includes & 1 /* Any */ ? includes & 8388608 /* IncludesWildcard */ ? wildcardType : anyType : unknownType;
63965
+ return includes & 1 /* Any */ ? includes & 8388608 /* IncludesWildcard */ ? wildcardType : includes & 1073741824 /* IncludesError */ ? errorType : anyType : unknownType;
63890
63966
  }
63891
63967
  if (includes & 32768 /* Undefined */) {
63892
63968
  if (typeSet.length >= 2 && typeSet[0] === undefinedType && typeSet[1] === missingType) {
@@ -64012,6 +64088,7 @@ function createTypeChecker(host) {
64012
64088
  } else {
64013
64089
  if (flags & 3 /* AnyOrUnknown */) {
64014
64090
  if (type === wildcardType) includes |= 8388608 /* IncludesWildcard */;
64091
+ if (isErrorType(type)) includes |= 1073741824 /* IncludesError */;
64015
64092
  } else if (strictNullChecks || !(flags & 98304 /* Nullable */)) {
64016
64093
  if (type === missingType) {
64017
64094
  includes |= 262144 /* IncludesMissingType */;
@@ -64139,7 +64216,7 @@ function createTypeChecker(host) {
64139
64216
  return neverType;
64140
64217
  }
64141
64218
  if (includes & 1 /* Any */) {
64142
- return includes & 8388608 /* IncludesWildcard */ ? wildcardType : anyType;
64219
+ return includes & 8388608 /* IncludesWildcard */ ? wildcardType : includes & 1073741824 /* IncludesError */ ? errorType : anyType;
64143
64220
  }
64144
64221
  if (!strictNullChecks && includes & 98304 /* Nullable */) {
64145
64222
  return includes & 16777216 /* IncludesEmptyObject */ ? neverType : includes & 32768 /* Undefined */ ? undefinedType : nullType;
@@ -89642,6 +89719,7 @@ function createTypeChecker(host) {
89642
89719
  function getSingleReturnExpression(declaration) {
89643
89720
  let candidateExpr;
89644
89721
  if (declaration && !nodeIsMissing(declaration.body)) {
89722
+ if (getFunctionFlags(declaration) & 3 /* AsyncGenerator */) return void 0;
89645
89723
  const body = declaration.body;
89646
89724
  if (body && isBlock(body)) {
89647
89725
  forEachReturnStatement(body, (s) => {
@@ -97225,10 +97303,9 @@ function transformClassFields(context) {
97225
97303
  }
97226
97304
  }
97227
97305
  }
97228
- function getClassThis() {
97306
+ function tryGetClassThis() {
97229
97307
  const lex = getClassLexicalEnvironment();
97230
- const classThis = lex.classThis ?? lex.classConstructor ?? (currentClassContainer == null ? void 0 : currentClassContainer.name);
97231
- return Debug.checkDefined(classThis);
97308
+ return lex.classThis ?? lex.classConstructor ?? (currentClassContainer == null ? void 0 : currentClassContainer.name);
97232
97309
  }
97233
97310
  function transformAutoAccessor(node) {
97234
97311
  const commentRange = getCommentRange(node);
@@ -97256,7 +97333,7 @@ function transformClassFields(context) {
97256
97333
  setOriginalNode(backingField, node);
97257
97334
  setEmitFlags(backingField, 3072 /* NoComments */);
97258
97335
  setSourceMapRange(backingField, sourceMapRange);
97259
- const receiver = isStatic(node) ? getClassThis() : factory2.createThis();
97336
+ const receiver = isStatic(node) ? tryGetClassThis() ?? factory2.createThis() : factory2.createThis();
97260
97337
  const getter = createAccessorPropertyGetRedirector(factory2, node, modifiers, getterName, receiver);
97261
97338
  setOriginalNode(getter, node);
97262
97339
  setCommentRange(getter, commentRange);
@@ -97822,7 +97899,7 @@ function transformClassFields(context) {
97822
97899
  var _a;
97823
97900
  let facts = 0 /* None */;
97824
97901
  const original = getOriginalNode(node);
97825
- if (isClassDeclaration(original) && classOrConstructorParameterIsDecorated(legacyDecorators, original)) {
97902
+ if (isClassLike(original) && classOrConstructorParameterIsDecorated(legacyDecorators, original)) {
97826
97903
  facts |= 1 /* ClassWasDecorated */;
97827
97904
  }
97828
97905
  if (shouldTransformPrivateElementsOrClassStaticBlocks && (classHasClassThisAssignment(node) || classHasExplicitlyAssignedName(node))) {
@@ -115867,13 +115944,18 @@ function transformDeclarations(context) {
115867
115944
  if (isDeclaration(input)) {
115868
115945
  if (isDeclarationAndNotVisible(input)) return;
115869
115946
  if (hasDynamicName(input)) {
115870
- if (isolatedDeclarations && (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent))) {
115871
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
115872
- }
115873
- if (isolatedDeclarations && (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)) {
115874
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
115875
- }
115876
- if (!isEntityNameExpression(input.name.expression)) {
115947
+ if (isolatedDeclarations) {
115948
+ if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
115949
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
115950
+ return;
115951
+ } else if (
115952
+ // Type declarations just need to double-check that the input computed name is an entity name expression
115953
+ (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
115954
+ ) {
115955
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
115956
+ return;
115957
+ }
115958
+ } else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
115877
115959
  return;
115878
115960
  }
115879
115961
  }
@@ -126836,6 +126918,7 @@ var BuilderState;
126836
126918
  getKeys: (v) => reverse.get(v),
126837
126919
  getValues: (k) => forward.get(k),
126838
126920
  keys: () => forward.keys(),
126921
+ size: () => forward.size,
126839
126922
  deleteKey: (k) => {
126840
126923
  (deleted || (deleted = /* @__PURE__ */ new Set())).add(k);
126841
126924
  const set = forward.get(k);
@@ -126962,12 +127045,15 @@ var BuilderState;
126962
127045
  return oldState && !oldState.referencedMap === !newReferencedMap;
126963
127046
  }
126964
127047
  BuilderState2.canReuseOldState = canReuseOldState;
127048
+ function createReferencedMap(options) {
127049
+ return options.module !== 0 /* None */ && !options.outFile ? createManyToManyPathMap() : void 0;
127050
+ }
127051
+ BuilderState2.createReferencedMap = createReferencedMap;
126965
127052
  function create(newProgram, oldState, disableUseFileVersionAsSignature) {
126966
127053
  var _a, _b;
126967
127054
  const fileInfos = /* @__PURE__ */ new Map();
126968
127055
  const options = newProgram.getCompilerOptions();
126969
- const isOutFile = options.outFile;
126970
- const referencedMap = options.module !== 0 /* None */ && !isOutFile ? createManyToManyPathMap() : void 0;
127056
+ const referencedMap = createReferencedMap(options);
126971
127057
  const useOldState = canReuseOldState(referencedMap, oldState);
126972
127058
  newProgram.getTypeChecker();
126973
127059
  for (const sourceFile of newProgram.getSourceFiles()) {
@@ -126984,7 +127070,7 @@ var BuilderState;
126984
127070
  version: version2,
126985
127071
  signature,
126986
127072
  // No need to calculate affectsGlobalScope with --out since its not used at all
126987
- affectsGlobalScope: !isOutFile ? isFileAffectingGlobalScope(sourceFile) || void 0 : void 0,
127073
+ affectsGlobalScope: !options.outFile ? isFileAffectingGlobalScope(sourceFile) || void 0 : void 0,
126988
127074
  impliedFormat: sourceFile.impliedNodeFormat
126989
127075
  });
126990
127076
  }
@@ -127273,7 +127359,7 @@ function createBuilderProgramState(newProgram, oldState) {
127273
127359
  if (emitDiagnostics) {
127274
127360
  (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(
127275
127361
  sourceFilePath,
127276
- oldState.hasReusableDiagnostic ? convertToDiagnostics(emitDiagnostics, newProgram) : repopulateDiagnostics(emitDiagnostics, newProgram)
127362
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(emitDiagnostics, sourceFilePath, newProgram) : repopulateDiagnostics(emitDiagnostics, newProgram)
127277
127363
  );
127278
127364
  }
127279
127365
  if (canCopySemanticDiagnostics) {
@@ -127283,7 +127369,7 @@ function createBuilderProgramState(newProgram, oldState) {
127283
127369
  if (diagnostics) {
127284
127370
  state.semanticDiagnosticsPerFile.set(
127285
127371
  sourceFilePath,
127286
- oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
127372
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, sourceFilePath, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
127287
127373
  );
127288
127374
  (state.semanticDiagnosticsFromOldState ?? (state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set())).add(sourceFilePath);
127289
127375
  }
@@ -127370,17 +127456,17 @@ function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram
127370
127456
  function convertOrRepopulateDiagnosticMessageChainArray(array, sourceFile, newProgram, repopulateInfo) {
127371
127457
  return sameMap(array, (chain) => convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo));
127372
127458
  }
127373
- function convertToDiagnostics(diagnostics, newProgram) {
127459
+ function convertToDiagnostics(diagnostics, diagnosticFilePath, newProgram) {
127374
127460
  if (!diagnostics.length) return emptyArray;
127375
127461
  let buildInfoDirectory;
127376
127462
  return diagnostics.map((diagnostic) => {
127377
- const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPathInBuildInfoDirectory);
127463
+ const result = convertToDiagnosticRelatedInformation(diagnostic, diagnosticFilePath, newProgram, toPathInBuildInfoDirectory);
127378
127464
  result.reportsUnnecessary = diagnostic.reportsUnnecessary;
127379
127465
  result.reportsDeprecated = diagnostic.reportDeprecated;
127380
127466
  result.source = diagnostic.source;
127381
127467
  result.skippedOn = diagnostic.skippedOn;
127382
127468
  const { relatedInformation } = diagnostic;
127383
- result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram, toPathInBuildInfoDirectory)) : [] : void 0;
127469
+ result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, diagnosticFilePath, newProgram, toPathInBuildInfoDirectory)) : [] : void 0;
127384
127470
  return result;
127385
127471
  });
127386
127472
  function toPathInBuildInfoDirectory(path) {
@@ -127388,9 +127474,9 @@ function convertToDiagnostics(diagnostics, newProgram) {
127388
127474
  return toPath(path, buildInfoDirectory, newProgram.getCanonicalFileName);
127389
127475
  }
127390
127476
  }
127391
- function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3) {
127477
+ function convertToDiagnosticRelatedInformation(diagnostic, diagnosticFilePath, newProgram, toPath3) {
127392
127478
  const { file } = diagnostic;
127393
- const sourceFile = file ? newProgram.getSourceFileByPath(toPath3(file)) : void 0;
127479
+ const sourceFile = file !== false ? newProgram.getSourceFileByPath(file ? toPath3(file) : diagnosticFilePath) : void 0;
127394
127480
  return {
127395
127481
  ...diagnostic,
127396
127482
  file: sourceFile,
@@ -127706,7 +127792,7 @@ function isProgramBundleEmitBuildInfo(info) {
127706
127792
  return !!((_a = info.options) == null ? void 0 : _a.outFile);
127707
127793
  }
127708
127794
  function getBuildInfo2(state) {
127709
- var _a;
127795
+ var _a, _b;
127710
127796
  const currentDirectory = Debug.checkDefined(state.program).getCurrentDirectory();
127711
127797
  const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
127712
127798
  const latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0;
@@ -127743,7 +127829,7 @@ function getBuildInfo2(state) {
127743
127829
  let fileNamesToFileIdListId;
127744
127830
  let emitSignatures;
127745
127831
  const fileInfos = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
127746
- var _a2, _b;
127832
+ var _a2, _b2;
127747
127833
  const fileId = toFileId(key);
127748
127834
  tryAddRoot(key, fileId);
127749
127835
  Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
@@ -127752,7 +127838,7 @@ function getBuildInfo2(state) {
127752
127838
  if (state.compilerOptions.composite) {
127753
127839
  const file = state.program.getSourceFileByPath(key);
127754
127840
  if (!isJsonSourceFile(file) && sourceFileMayBeEmitted(file, state.program)) {
127755
- const emitSignature = (_b = state.emitSignatures) == null ? void 0 : _b.get(key);
127841
+ const emitSignature = (_b2 = state.emitSignatures) == null ? void 0 : _b2.get(key);
127756
127842
  if (emitSignature !== actualSignature) {
127757
127843
  emitSignatures = append(
127758
127844
  emitSignatures,
@@ -127786,15 +127872,15 @@ function getBuildInfo2(state) {
127786
127872
  );
127787
127873
  });
127788
127874
  let referencedMap;
127789
- if (state.referencedMap) {
127875
+ if ((_a = state.referencedMap) == null ? void 0 : _a.size()) {
127790
127876
  referencedMap = arrayFrom(state.referencedMap.keys()).sort(compareStringsCaseSensitive).map((key) => [
127791
127877
  toFileId(key),
127792
127878
  toFileIdListId(state.referencedMap.getValues(key))
127793
127879
  ]);
127794
127880
  }
127795
- const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.semanticDiagnosticsPerFile);
127881
+ const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics();
127796
127882
  let affectedFilesPendingEmit;
127797
- if ((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size) {
127883
+ if ((_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.size) {
127798
127884
  const fullEmitForOptions = getBuilderFileEmit(state.compilerOptions);
127799
127885
  const seenFiles = /* @__PURE__ */ new Set();
127800
127886
  for (const path of arrayFrom(state.affectedFilesPendingEmit.keys()).sort(compareStringsCaseSensitive)) {
@@ -127822,7 +127908,7 @@ function getBuildInfo2(state) {
127822
127908
  changeFileSet = append(changeFileSet, toFileId(path));
127823
127909
  }
127824
127910
  }
127825
- const emitDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.emitDiagnosticsPerFile);
127911
+ const emitDiagnosticsPerFile = convertToProgramBuildInfoEmitDiagnostics();
127826
127912
  const program = {
127827
127913
  fileNames,
127828
127914
  fileInfos,
@@ -127914,40 +128000,53 @@ function getBuildInfo2(state) {
127914
128000
  }
127915
128001
  return value;
127916
128002
  }
127917
- function convertToProgramBuildInfoDiagnostics(diagnostics) {
128003
+ function convertToProgramBuildInfoDiagnostics() {
127918
128004
  let result;
127919
- if (diagnostics) {
127920
- for (const key of arrayFrom(diagnostics.keys()).sort(compareStringsCaseSensitive)) {
127921
- const value = diagnostics.get(key);
127922
- result = append(
127923
- result,
127924
- value.length ? [
127925
- toFileId(key),
127926
- convertToReusableDiagnostics(value)
127927
- ] : toFileId(key)
127928
- );
128005
+ state.fileInfos.forEach((_value, key) => {
128006
+ var _a2;
128007
+ const value = (_a2 = state.semanticDiagnosticsPerFile) == null ? void 0 : _a2.get(key);
128008
+ if (!value) {
128009
+ if (!state.changedFilesSet.has(key)) result = append(result, toFileId(key));
128010
+ } else if (value.length) {
128011
+ result = append(result, [
128012
+ toFileId(key),
128013
+ convertToReusableDiagnostics(value, key)
128014
+ ]);
127929
128015
  }
128016
+ });
128017
+ return result;
128018
+ }
128019
+ function convertToProgramBuildInfoEmitDiagnostics() {
128020
+ var _a2;
128021
+ let result;
128022
+ if (!((_a2 = state.emitDiagnosticsPerFile) == null ? void 0 : _a2.size)) return result;
128023
+ for (const key of arrayFrom(state.emitDiagnosticsPerFile.keys()).sort(compareStringsCaseSensitive)) {
128024
+ const value = state.emitDiagnosticsPerFile.get(key);
128025
+ result = append(result, [
128026
+ toFileId(key),
128027
+ convertToReusableDiagnostics(value, key)
128028
+ ]);
127930
128029
  }
127931
128030
  return result;
127932
128031
  }
127933
- function convertToReusableDiagnostics(diagnostics) {
128032
+ function convertToReusableDiagnostics(diagnostics, diagnosticFilePath) {
127934
128033
  Debug.assert(!!diagnostics.length);
127935
128034
  return diagnostics.map((diagnostic) => {
127936
- const result = convertToReusableDiagnosticRelatedInformation(diagnostic);
128035
+ const result = convertToReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath);
127937
128036
  result.reportsUnnecessary = diagnostic.reportsUnnecessary;
127938
128037
  result.reportDeprecated = diagnostic.reportsDeprecated;
127939
128038
  result.source = diagnostic.source;
127940
128039
  result.skippedOn = diagnostic.skippedOn;
127941
128040
  const { relatedInformation } = diagnostic;
127942
- result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r)) : [] : void 0;
128041
+ result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r, diagnosticFilePath)) : [] : void 0;
127943
128042
  return result;
127944
128043
  });
127945
128044
  }
127946
- function convertToReusableDiagnosticRelatedInformation(diagnostic) {
128045
+ function convertToReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath) {
127947
128046
  const { file } = diagnostic;
127948
128047
  return {
127949
128048
  ...diagnostic,
127950
- file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
128049
+ file: file ? file.resolvedPath === diagnosticFilePath ? void 0 : relativeToBuildInfo(file.resolvedPath) : false,
127951
128050
  messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
127952
128051
  };
127953
128052
  }
@@ -128346,16 +128445,17 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
128346
128445
  );
128347
128446
  }
128348
128447
  });
128448
+ const changedFilesSet = new Set(map(program.changeFileSet, toFilePath));
128349
128449
  const fullEmitForOptions = program.affectedFilesPendingEmit ? getBuilderFileEmit(program.options || {}) : void 0;
128350
128450
  state = {
128351
128451
  fileInfos,
128352
128452
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
128353
- referencedMap: toManyToManyPathMap(program.referencedMap),
128354
- semanticDiagnosticsPerFile: toPerFileDiagnostics(program.semanticDiagnosticsPerFile),
128355
- emitDiagnosticsPerFile: toPerFileDiagnostics(program.emitDiagnosticsPerFile),
128453
+ referencedMap: toManyToManyPathMap(program.referencedMap, program.options ?? {}),
128454
+ semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile, fileInfos, changedFilesSet),
128455
+ emitDiagnosticsPerFile: toPerFileEmitDiagnostics(program.emitDiagnosticsPerFile),
128356
128456
  hasReusableDiagnostic: true,
128357
128457
  affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
128358
- changedFilesSet: new Set(map(program.changeFileSet, toFilePath)),
128458
+ changedFilesSet,
128359
128459
  latestChangedDtsFile,
128360
128460
  emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0
128361
128461
  };
@@ -128397,16 +128497,27 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
128397
128497
  function toFilePathsSet(fileIdsListId) {
128398
128498
  return filePathsSetList[fileIdsListId - 1];
128399
128499
  }
128400
- function toManyToManyPathMap(referenceMap) {
128401
- if (!referenceMap) {
128402
- return void 0;
128403
- }
128404
- const map2 = BuilderState.createManyToManyPathMap();
128500
+ function toManyToManyPathMap(referenceMap, options) {
128501
+ const map2 = BuilderState.createReferencedMap(options);
128502
+ if (!map2 || !referenceMap) return map2;
128405
128503
  referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
128406
128504
  return map2;
128407
128505
  }
128408
- function toPerFileDiagnostics(diagnostics) {
128409
- return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => isNumber(value) ? emptyArray : value[1]);
128506
+ function toPerFileSemanticDiagnostics(diagnostics, fileInfos, changedFilesSet) {
128507
+ const semanticDiagnostics = new Map(
128508
+ mapDefinedIterator(
128509
+ fileInfos.keys(),
128510
+ (key) => !changedFilesSet.has(key) ? [key, emptyArray] : void 0
128511
+ )
128512
+ );
128513
+ diagnostics == null ? void 0 : diagnostics.forEach((value) => {
128514
+ if (isNumber(value)) semanticDiagnostics.delete(toFilePath(value));
128515
+ else semanticDiagnostics.set(toFilePath(value[0]), value[1]);
128516
+ });
128517
+ return semanticDiagnostics.size ? semanticDiagnostics : void 0;
128518
+ }
128519
+ function toPerFileEmitDiagnostics(diagnostics) {
128520
+ return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(value[0]), (value) => value[1]);
128410
128521
  }
128411
128522
  }
128412
128523
  function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
@@ -131997,7 +132108,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
131997
132108
  }
131998
132109
  }
131999
132110
  function getUpToDateStatusWorker(state, project, resolvedPath) {
132000
- var _a, _b, _c;
132111
+ var _a, _b, _c, _d;
132001
132112
  if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
132002
132113
  return {
132003
132114
  type: 15 /* ContainerOnly */
@@ -132069,7 +132180,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
132069
132180
  };
132070
132181
  }
132071
132182
  if (buildInfo.program) {
132072
- if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? ((_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length) || ((_c = buildInfo.program.emitDiagnosticsPerFile) == null ? void 0 : _c.length) : some(buildInfo.program.semanticDiagnosticsPerFile, isArray))) {
132183
+ if (((_a = buildInfo.program.changeFileSet) == null ? void 0 : _a.length) || (!project.options.noEmit ? ((_b = buildInfo.program.affectedFilesPendingEmit) == null ? void 0 : _b.length) || ((_c = buildInfo.program.emitDiagnosticsPerFile) == null ? void 0 : _c.length) : (_d = buildInfo.program.semanticDiagnosticsPerFile) == null ? void 0 : _d.length)) {
132073
132184
  return {
132074
132185
  type: 7 /* OutOfDateBuildInfo */,
132075
132186
  buildInfoFile: buildInfoPath
@@ -133941,8 +134052,8 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
133941
134052
  serializeReturnTypeForSignature,
133942
134053
  serializeTypeOfExpression
133943
134054
  };
133944
- function serializeExistingTypeAnnotation(type) {
133945
- return type === void 0 ? void 0 : !type.parent || !isParameter(type.parent) || !resolver.requiresAddingImplicitUndefined(type.parent) || canAddUndefined(type);
134055
+ function serializeExistingTypeAnnotation(type, addUndefined) {
134056
+ return type !== void 0 && (!addUndefined || type && canAddUndefined(type)) ? true : void 0;
133946
134057
  }
133947
134058
  function serializeTypeOfExpression(expr, context, addUndefined, preserveLiterals) {
133948
134059
  return typeFromExpression(
@@ -134063,12 +134174,17 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
134063
134174
  const declaredType = getEffectiveTypeAnnotationNode(node);
134064
134175
  const addUndefined = resolver.requiresAddingImplicitUndefined(node);
134065
134176
  let resultType;
134066
- if (!addUndefined) {
134067
- if (declaredType) {
134068
- return serializeExistingTypeAnnotation(declaredType);
134069
- }
134177
+ if (declaredType) {
134178
+ resultType = serializeExistingTypeAnnotation(declaredType, addUndefined);
134179
+ } else {
134070
134180
  if (node.initializer && isIdentifier(node.name)) {
134071
- resultType = typeFromExpression(node.initializer, context);
134181
+ resultType = typeFromExpression(
134182
+ node.initializer,
134183
+ context,
134184
+ /*isConstContext*/
134185
+ void 0,
134186
+ addUndefined
134187
+ );
134072
134188
  }
134073
134189
  }
134074
134190
  return resultType ?? inferTypeOfDeclaration(node, context);
@@ -134331,6 +134447,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
134331
134447
  function typeFromSingleReturnExpression(declaration, context) {
134332
134448
  let candidateExpr;
134333
134449
  if (declaration && !nodeIsMissing(declaration.body)) {
134450
+ if (getFunctionFlags(declaration) & 3 /* AsyncGenerator */) return void 0;
134334
134451
  const body = declaration.body;
134335
134452
  if (body && isBlock(body)) {
134336
134453
  forEachReturnStatement(body, (s) => {
@@ -142906,7 +143023,7 @@ registerRefactor(refactorNameForMoveToFile, {
142906
143023
  if (!interactiveRefactorArguments) {
142907
143024
  return emptyArray;
142908
143025
  }
142909
- if (context.endPosition !== void 0) {
143026
+ if (context.triggerReason === "implicit" && context.endPosition !== void 0) {
142910
143027
  const startNodeAncestor = findAncestor(getTokenAtPosition(file, context.startPosition), isBlockLike);
142911
143028
  const endNodeAncestor = findAncestor(getTokenAtPosition(file, context.endPosition), isBlockLike);
142912
143029
  if (startNodeAncestor && !isSourceFile(startNodeAncestor) && endNodeAncestor && !isSourceFile(endNodeAncestor)) {
@@ -143897,11 +144014,19 @@ registerRefactor(refactorName5, {
143897
144014
  kinds: [moveToNewFileAction.kind],
143898
144015
  getAvailableActions: function getRefactorActionsToMoveToNewFile(context) {
143899
144016
  const statements = getStatementsToMove(context);
144017
+ const file = context.file;
144018
+ if (context.triggerReason === "implicit" && context.endPosition !== void 0) {
144019
+ const startNodeAncestor = findAncestor(getTokenAtPosition(file, context.startPosition), isBlockLike);
144020
+ const endNodeAncestor = findAncestor(getTokenAtPosition(file, context.endPosition), isBlockLike);
144021
+ if (startNodeAncestor && !isSourceFile(startNodeAncestor) && endNodeAncestor && !isSourceFile(endNodeAncestor)) {
144022
+ return emptyArray;
144023
+ }
144024
+ }
143900
144025
  if (context.preferences.allowTextChangesInNewFiles && statements) {
143901
- const file = context.file;
144026
+ const file2 = context.file;
143902
144027
  const affectedTextRange = {
143903
- start: { line: getLineAndCharacterOfPosition(file, statements.all[0].getStart(file)).line, offset: getLineAndCharacterOfPosition(file, statements.all[0].getStart(file)).character },
143904
- end: { line: getLineAndCharacterOfPosition(file, last(statements.all).end).line, offset: getLineAndCharacterOfPosition(file, last(statements.all).end).character }
144028
+ start: { line: getLineAndCharacterOfPosition(file2, statements.all[0].getStart(file2)).line, offset: getLineAndCharacterOfPosition(file2, statements.all[0].getStart(file2)).character },
144029
+ end: { line: getLineAndCharacterOfPosition(file2, last(statements.all).end).line, offset: getLineAndCharacterOfPosition(file2, last(statements.all).end).character }
143905
144030
  };
143906
144031
  return [{ name: refactorName5, description: description2, actions: [{ ...moveToNewFileAction, range: affectedTextRange }] }];
143907
144032
  }
@@ -167490,7 +167615,7 @@ function entryToDocumentSpan(entry) {
167490
167615
  }
167491
167616
  }
167492
167617
  function getPrefixAndSuffixText(entry, originalNode, checker, quotePreference) {
167493
- if (entry.kind !== 0 /* Span */ && isIdentifier(originalNode)) {
167618
+ if (entry.kind !== 0 /* Span */ && (isIdentifier(originalNode) || isStringLiteralLike(originalNode))) {
167494
167619
  const { node, kind } = entry;
167495
167620
  const parent2 = node.parent;
167496
167621
  const name = originalNode.text;
@@ -173273,7 +173398,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
173273
173398
  typeChecker,
173274
173399
  resolvedSymbol,
173275
173400
  getSourceFileOfNode(resolvedNode),
173276
- resolvedNode,
173401
+ enclosingDeclaration,
173277
173402
  declarationName,
173278
173403
  type,
173279
173404
  semanticMeaning,