@typescript-deploys/pr-build 5.5.0-pr-58610-9 → 5.5.0-pr-58650-7

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
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-insiders.20240522`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240524`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -7511,6 +7511,7 @@ var Diagnostics = {
7511
7511
  Move_the_expression_in_default_export_to_a_variable_and_add_a_type_annotation_to_it: diag(9036, 1 /* Error */, "Move_the_expression_in_default_export_to_a_variable_and_add_a_type_annotation_to_it_9036", "Move the expression in default export to a variable and add a type annotation to it."),
7512
7512
  Default_exports_can_t_be_inferred_with_isolatedDeclarations: diag(9037, 1 /* Error */, "Default_exports_can_t_be_inferred_with_isolatedDeclarations_9037", "Default exports can't be inferred with --isolatedDeclarations."),
7513
7513
  Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations: diag(9038, 1 /* Error */, "Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations_9038", "Computed property names on class or object literals cannot be inferred with --isolatedDeclarations."),
7514
+ Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations: diag(9039, 1 /* Error */, "Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations_9039", "Type containing private name '{0}' can't be used with --isolatedDeclarations."),
7514
7515
  JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17e3, 1 /* Error */, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."),
7515
7516
  JSX_elements_cannot_have_multiple_attributes_with_the_same_name: diag(17001, 1 /* Error */, "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", "JSX elements cannot have multiple attributes with the same name."),
7516
7517
  Expected_corresponding_JSX_closing_tag_for_0: diag(17002, 1 /* Error */, "Expected_corresponding_JSX_closing_tag_for_0_17002", "Expected corresponding JSX closing tag for '{0}'."),
@@ -46241,7 +46242,12 @@ function createTypeChecker(host) {
46241
46242
  if (resolvedTarget === unknownSymbol) {
46242
46243
  return source;
46243
46244
  }
46244
- target = cloneSymbol(resolvedTarget);
46245
+ if (!(resolvedTarget.flags & getExcludedSymbolFlags(source.flags)) || (source.flags | resolvedTarget.flags) & 67108864 /* Assignment */) {
46246
+ target = cloneSymbol(resolvedTarget);
46247
+ } else {
46248
+ reportMergeSymbolError(target, source);
46249
+ return source;
46250
+ }
46245
46251
  }
46246
46252
  if (source.flags & 512 /* ValueModule */ && target.flags & 512 /* ValueModule */ && target.constEnumOnlyModule && !source.constEnumOnlyModule) {
46247
46253
  target.constEnumOnlyModule = false;
@@ -46271,27 +46277,30 @@ function createTypeChecker(host) {
46271
46277
  );
46272
46278
  }
46273
46279
  } else {
46274
- const isEitherEnum = !!(target.flags & 384 /* Enum */ || source.flags & 384 /* Enum */);
46275
- const isEitherBlockScoped = !!(target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */);
46280
+ reportMergeSymbolError(target, source);
46281
+ }
46282
+ return target;
46283
+ function reportMergeSymbolError(target2, source2) {
46284
+ const isEitherEnum = !!(target2.flags & 384 /* Enum */ || source2.flags & 384 /* Enum */);
46285
+ const isEitherBlockScoped = !!(target2.flags & 2 /* BlockScopedVariable */ || source2.flags & 2 /* BlockScopedVariable */);
46276
46286
  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;
46277
- const sourceSymbolFile = source.declarations && getSourceFileOfNode(source.declarations[0]);
46278
- const targetSymbolFile = target.declarations && getSourceFileOfNode(target.declarations[0]);
46287
+ const sourceSymbolFile = source2.declarations && getSourceFileOfNode(source2.declarations[0]);
46288
+ const targetSymbolFile = target2.declarations && getSourceFileOfNode(target2.declarations[0]);
46279
46289
  const isSourcePlainJs = isPlainJsFile(sourceSymbolFile, compilerOptions.checkJs);
46280
46290
  const isTargetPlainJs = isPlainJsFile(targetSymbolFile, compilerOptions.checkJs);
46281
- const symbolName2 = symbolToString(source);
46291
+ const symbolName2 = symbolToString(source2);
46282
46292
  if (sourceSymbolFile && targetSymbolFile && amalgamatedDuplicates && !isEitherEnum && sourceSymbolFile !== targetSymbolFile) {
46283
46293
  const firstFile = comparePaths(sourceSymbolFile.path, targetSymbolFile.path) === -1 /* LessThan */ ? sourceSymbolFile : targetSymbolFile;
46284
46294
  const secondFile = firstFile === sourceSymbolFile ? targetSymbolFile : sourceSymbolFile;
46285
46295
  const filesDuplicates = getOrUpdate(amalgamatedDuplicates, `${firstFile.path}|${secondFile.path}`, () => ({ firstFile, secondFile, conflictingSymbols: /* @__PURE__ */ new Map() }));
46286
46296
  const conflictingSymbolInfo = getOrUpdate(filesDuplicates.conflictingSymbols, symbolName2, () => ({ isBlockScoped: isEitherBlockScoped, firstFileLocations: [], secondFileLocations: [] }));
46287
- if (!isSourcePlainJs) addDuplicateLocations(conflictingSymbolInfo.firstFileLocations, source);
46288
- if (!isTargetPlainJs) addDuplicateLocations(conflictingSymbolInfo.secondFileLocations, target);
46297
+ if (!isSourcePlainJs) addDuplicateLocations(conflictingSymbolInfo.firstFileLocations, source2);
46298
+ if (!isTargetPlainJs) addDuplicateLocations(conflictingSymbolInfo.secondFileLocations, target2);
46289
46299
  } else {
46290
- if (!isSourcePlainJs) addDuplicateDeclarationErrorsForSymbols(source, message, symbolName2, target);
46291
- if (!isTargetPlainJs) addDuplicateDeclarationErrorsForSymbols(target, message, symbolName2, source);
46300
+ if (!isSourcePlainJs) addDuplicateDeclarationErrorsForSymbols(source2, message, symbolName2, target2);
46301
+ if (!isTargetPlainJs) addDuplicateDeclarationErrorsForSymbols(target2, message, symbolName2, source2);
46292
46302
  }
46293
46303
  }
46294
- return target;
46295
46304
  function addDuplicateLocations(locs, symbol) {
46296
46305
  if (symbol.declarations) {
46297
46306
  for (const decl of symbol.declarations) {
@@ -49137,6 +49146,9 @@ function createTypeChecker(host) {
49137
49146
  function isClassInstanceSide(type) {
49138
49147
  return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || !!(type.flags & 524288 /* Object */) && !!(getObjectFlags(type) & 16777216 /* IsClassInstanceClone */));
49139
49148
  }
49149
+ function getTypeFromTypeNodeWithoutContext(node) {
49150
+ return getTypeFromTypeNode(node);
49151
+ }
49140
49152
  function createNodeBuilder() {
49141
49153
  return {
49142
49154
  typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
@@ -49165,6 +49177,12 @@ function createTypeChecker(host) {
49165
49177
  symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
49166
49178
  symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
49167
49179
  };
49180
+ function getTypeFromTypeNode2(context, node, noMappedTypes) {
49181
+ const type = getTypeFromTypeNodeWithoutContext(node);
49182
+ if (!context.mapper) return type;
49183
+ const mappedType = instantiateType(type, context.mapper);
49184
+ return noMappedTypes && mappedType !== type ? void 0 : mappedType;
49185
+ }
49168
49186
  function setTextRange2(context, range, location) {
49169
49187
  if (!nodeIsSynthesized(range) && !(range.flags & 16 /* Synthesized */) && (!context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(range))) {
49170
49188
  range = factory.cloneNode(range);
@@ -49210,7 +49228,7 @@ function createTypeChecker(host) {
49210
49228
  }
49211
49229
  const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
49212
49230
  if (clone) {
49213
- if (addUndefined && !someType(getTypeFromTypeNode(typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
49231
+ if (addUndefined && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
49214
49232
  return factory.createUnionTypeNode([clone, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
49215
49233
  }
49216
49234
  return clone;
@@ -49223,8 +49241,13 @@ function createTypeChecker(host) {
49223
49241
  }
49224
49242
  return void 0;
49225
49243
  }
49226
- function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, annotationType) {
49227
- if (typeNodeIsEquivalentToType(existing, host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
49244
+ function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, annotationType = getTypeFromTypeNode2(
49245
+ context,
49246
+ existing,
49247
+ /*noMappedTypes*/
49248
+ true
49249
+ )) {
49250
+ if (annotationType && typeNodeIsEquivalentToType(host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
49228
49251
  const result = tryReuseExistingTypeNodeHelper(context, existing);
49229
49252
  if (result) {
49230
49253
  return result;
@@ -49271,7 +49294,8 @@ function createTypeChecker(host) {
49271
49294
  mustCreateTypeParametersNamesLookups: true,
49272
49295
  typeParameterNames: void 0,
49273
49296
  typeParameterNamesByText: void 0,
49274
- typeParameterNamesByTextNextNameCount: void 0
49297
+ typeParameterNamesByTextNextNameCount: void 0,
49298
+ mapper: void 0
49275
49299
  };
49276
49300
  context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
49277
49301
  const resultingNode = cb(context);
@@ -49562,8 +49586,8 @@ function createTypeChecker(host) {
49562
49586
  context.inferTypeParameters = type2.root.inferTypeParameters;
49563
49587
  const extendsTypeNode2 = typeToTypeNodeHelper(instantiateType(type2.root.extendsType, newMapper), context);
49564
49588
  context.inferTypeParameters = saveInferTypeParameters2;
49565
- const trueTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type2.root.node.trueType), newMapper));
49566
- const falseTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type2.root.node.falseType), newMapper));
49589
+ const trueTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode2(context, type2.root.node.trueType), newMapper));
49590
+ const falseTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode2(context, type2.root.node.falseType), newMapper));
49567
49591
  return factory.createConditionalTypeNode(
49568
49592
  checkTypeNode,
49569
49593
  factory.createInferTypeNode(factory.createTypeParameterDeclaration(
@@ -49646,7 +49670,7 @@ function createTypeChecker(host) {
49646
49670
  context.approximateLength += 10;
49647
49671
  const result = setEmitFlags(mappedTypeNode, 1 /* SingleLine */);
49648
49672
  if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
49649
- const originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type2.declaration.typeParameter.constraint.type)) || unknownType, type2.mapper);
49673
+ const originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode2(context, type2.declaration.typeParameter.constraint.type)) || unknownType, type2.mapper);
49650
49674
  return factory.createConditionalTypeNode(
49651
49675
  typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context),
49652
49676
  factory.createInferTypeNode(factory.createTypeParameterDeclaration(
@@ -50273,7 +50297,7 @@ function createTypeChecker(host) {
50273
50297
  /*skipUnionExpanding*/
50274
50298
  true
50275
50299
  )[0];
50276
- const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters, signature.parameters);
50300
+ const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters, signature.parameters, signature.mapper);
50277
50301
  context.approximateLength += 3;
50278
50302
  if (context.flags & 32 /* WriteTypeArgumentsOfSignature */ && signature.target && signature.mapper && signature.target.typeParameters) {
50279
50303
  typeArguments = signature.target.typeParameters.map((parameter) => typeToTypeNodeHelper(instantiateType(parameter, signature.mapper), context));
@@ -50381,11 +50405,15 @@ function createTypeChecker(host) {
50381
50405
  function getParametersInScope(node) {
50382
50406
  return isFunctionLike(node) || isJSDocSignature(node) ? getSignatureFromDeclaration(node).parameters : void 0;
50383
50407
  }
50384
- function enterNewScope(context, declaration, expandedParams, typeParameters, originalParameters) {
50408
+ function enterNewScope(context, declaration, expandedParams, typeParameters, originalParameters, mapper) {
50385
50409
  const cleanupContext = cloneNodeBuilderContext(context);
50386
50410
  let cleanupParams;
50387
50411
  let cleanupTypeParams;
50388
50412
  const oldEnclosingDecl = context.enclosingDeclaration;
50413
+ const oldMapper = context.mapper;
50414
+ if (mapper) {
50415
+ context.mapper = mapper;
50416
+ }
50389
50417
  if (context.enclosingDeclaration && declaration) {
50390
50418
  let pushFakeScope2 = function(kind, addAll) {
50391
50419
  Debug.assert(context.enclosingDeclaration);
@@ -50484,6 +50512,7 @@ function createTypeChecker(host) {
50484
50512
  cleanupTypeParams == null ? void 0 : cleanupTypeParams();
50485
50513
  cleanupContext();
50486
50514
  context.enclosingDeclaration = oldEnclosingDecl;
50515
+ context.mapper = oldMapper;
50487
50516
  };
50488
50517
  }
50489
50518
  function tryGetThisParameterDeclaration(signature, context) {
@@ -50501,7 +50530,7 @@ function createTypeChecker(host) {
50501
50530
  "this",
50502
50531
  /*questionToken*/
50503
50532
  void 0,
50504
- typeToTypeNodeHelper(getTypeFromTypeNode(thisTag.typeExpression), context)
50533
+ typeToTypeNodeHelper(getTypeFromTypeNode2(context, thisTag.typeExpression), context)
50505
50534
  );
50506
50535
  }
50507
50536
  }
@@ -51139,31 +51168,32 @@ function createTypeChecker(host) {
51139
51168
  var _a;
51140
51169
  const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
51141
51170
  const enclosingDeclaration = context.enclosingDeclaration;
51171
+ const oldFlags = context.flags;
51172
+ if (declaration && hasInferredType(declaration) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
51173
+ syntacticNodeBuilder.serializeTypeOfDeclaration(declaration, context);
51174
+ }
51175
+ context.flags |= -2147483648 /* NoSyntacticPrinter */;
51142
51176
  if (enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
51143
- const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
51177
+ const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
51144
51178
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
51145
51179
  const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
51146
- const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
51180
+ const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
51147
51181
  if (result2) {
51182
+ context.flags = oldFlags;
51148
51183
  return result2;
51149
51184
  }
51150
51185
  }
51151
51186
  }
51152
- const oldFlags = context.flags;
51153
51187
  if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
51154
51188
  context.flags |= 1048576 /* AllowUniqueESSymbolType */;
51155
51189
  }
51156
51190
  const decl = declaration ?? symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
51157
51191
  const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
51158
- if (decl && hasInferredType(decl) && !(context.flags & -2147483648 /* NoSyntacticPrinter */)) {
51159
- syntacticNodeBuilder.serializeTypeOfDeclaration(decl, context);
51160
- }
51161
- context.flags |= -2147483648 /* NoSyntacticPrinter */;
51162
51192
  const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
51163
51193
  context.flags = oldFlags;
51164
51194
  return result;
51165
51195
  }
51166
- function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type, typeFromTypeNode = getTypeFromTypeNode(typeNode)) {
51196
+ function typeNodeIsEquivalentToType(annotatedDeclaration, type, typeFromTypeNode) {
51167
51197
  if (typeFromTypeNode === type) {
51168
51198
  return true;
51169
51199
  }
@@ -51193,13 +51223,10 @@ function createTypeChecker(host) {
51193
51223
  function serializeReturnTypeForSignatureWorker(context, signature) {
51194
51224
  const typePredicate = getTypePredicateOfSignature(signature);
51195
51225
  const type = getReturnTypeOfSignature(signature);
51196
- if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
51226
+ if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
51197
51227
  const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
51198
- const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
51199
- if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
51200
- const annotated = getTypeFromTypeNode(annotation);
51201
- const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
51202
- const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, thisInstantiated);
51228
+ if (annotation && getTypeFromTypeNode2(context, annotation) === type) {
51229
+ const result = tryReuseExistingTypeNodeHelper(context, annotation);
51203
51230
  if (result) {
51204
51231
  return result;
51205
51232
  }
@@ -51265,6 +51292,9 @@ function createTypeChecker(host) {
51265
51292
  symAtLocation === void 0 && sym !== void 0 || // If the symbol is found both in declaration scope and in current scope then it shoudl point to the same reference
51266
51293
  symAtLocation && sym && !getSymbolIfSameReference(getExportSymbolOfValueSymbolIfExported(symAtLocation), sym)
51267
51294
  ) {
51295
+ if (symAtLocation !== unknownSymbol) {
51296
+ context.tracker.reportInferenceFallback(node);
51297
+ }
51268
51298
  introducesError = true;
51269
51299
  return { introducesError, node, sym };
51270
51300
  }
@@ -51283,6 +51313,7 @@ function createTypeChecker(host) {
51283
51313
  /*shouldComputeAliasesToMakeVisible*/
51284
51314
  false
51285
51315
  ).accessibility !== 0 /* Accessible */) {
51316
+ context.tracker.reportInferenceFallback(node);
51286
51317
  introducesError = true;
51287
51318
  } else {
51288
51319
  context.tracker.trackSymbol(sym, context.enclosingDeclaration, meaning);
@@ -51338,13 +51369,26 @@ function createTypeChecker(host) {
51338
51369
  !(length(existing.typeArguments) >= getMinTypeArgumentCount(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(nodeSymbol))));
51339
51370
  }
51340
51371
  }
51372
+ if (isThisTypeNode(existing)) {
51373
+ if (context.mapper === void 0) return true;
51374
+ const type = getTypeFromTypeNode2(
51375
+ context,
51376
+ existing,
51377
+ /*noMappedTypes*/
51378
+ true
51379
+ );
51380
+ return !!type;
51381
+ }
51341
51382
  if (isTypeReferenceNode(existing)) {
51342
51383
  if (isConstTypeReference(existing)) return false;
51343
51384
  const type = getTypeFromTypeReference(existing);
51344
51385
  const symbol = getNodeLinks(existing).resolvedSymbol;
51345
51386
  if (!symbol) return false;
51346
51387
  if (symbol.flags & 262144 /* TypeParameter */) {
51347
- return true;
51388
+ const type2 = getDeclaredTypeOfSymbol(symbol);
51389
+ if (context.mapper && getMappedType(type2, context.mapper) !== type2) {
51390
+ return false;
51391
+ }
51348
51392
  }
51349
51393
  if (isInJSDoc(existing)) {
51350
51394
  return existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) && !getIntendedTypeFromJSDocTypeReference(existing) && symbol.flags & 788968 /* Type */;
@@ -51357,7 +51401,7 @@ function createTypeChecker(host) {
51357
51401
  return true;
51358
51402
  }
51359
51403
  function serializeExistingTypeNode(context, typeNode) {
51360
- const type = getTypeFromTypeNode(typeNode);
51404
+ const type = getTypeFromTypeNode2(context, typeNode);
51361
51405
  return typeToTypeNodeHelper(type, context);
51362
51406
  }
51363
51407
  function tryReuseExistingTypeNodeHelper(context, existing) {
@@ -51405,8 +51449,8 @@ function createTypeChecker(host) {
51405
51449
  if (isJSDocTypeLiteral(node)) {
51406
51450
  return factory.createTypeLiteralNode(map(node.jsDocPropertyTags, (t) => {
51407
51451
  const name = isIdentifier(t.name) ? t.name : t.name.right;
51408
- const typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText);
51409
- const overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : void 0;
51452
+ const typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode2(context, node), name.escapedText);
51453
+ const overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode2(context, t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : void 0;
51410
51454
  return factory.createPropertySignature(
51411
51455
  /*modifiers*/
51412
51456
  void 0,
@@ -51447,7 +51491,7 @@ function createTypeChecker(host) {
51447
51491
  /*modifiers*/
51448
51492
  void 0,
51449
51493
  getEffectiveDotDotDotForParameter(p),
51450
- getNameForJSDocFunctionParameter(p, i),
51494
+ setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
51451
51495
  p.questionToken,
51452
51496
  visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
51453
51497
  /*initializer*/
@@ -51462,7 +51506,7 @@ function createTypeChecker(host) {
51462
51506
  /*modifiers*/
51463
51507
  void 0,
51464
51508
  getEffectiveDotDotDotForParameter(p),
51465
- getNameForJSDocFunctionParameter(p, i),
51509
+ setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
51466
51510
  p.questionToken,
51467
51511
  visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
51468
51512
  /*initializer*/
@@ -51472,6 +51516,21 @@ function createTypeChecker(host) {
51472
51516
  );
51473
51517
  }
51474
51518
  }
51519
+ if (isThisTypeNode(node)) {
51520
+ if (canReuseTypeNode(context, node)) {
51521
+ return node;
51522
+ }
51523
+ return serializeExistingTypeNode(context, node);
51524
+ }
51525
+ if (isTypeParameterDeclaration(node)) {
51526
+ return factory.updateTypeParameterDeclaration(
51527
+ node,
51528
+ node.modifiers,
51529
+ setTextRange2(context, typeParameterToName(getDeclaredTypeOfSymbol(getSymbolOfDeclaration(node)), context), node),
51530
+ visitNode(node.constraint, visitExistingNodeTreeSymbols, isTypeNode),
51531
+ visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
51532
+ );
51533
+ }
51475
51534
  if (isTypeReferenceNode(node)) {
51476
51535
  if (canReuseTypeNode(context, node)) {
51477
51536
  const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
@@ -51503,7 +51562,7 @@ function createTypeChecker(host) {
51503
51562
  if (isInJSDoc(node) && nodeSymbol && // The import type resolved using jsdoc fallback logic
51504
51563
  (!node.isTypeOf && !(nodeSymbol.flags & 788968 /* Type */) || // The import type had type arguments autofilled by js fallback logic
51505
51564
  !(length(node.typeArguments) >= getMinTypeArgumentCount(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(nodeSymbol))))) {
51506
- return setTextRange2(context, typeToTypeNodeHelper(getTypeFromTypeNode(node), context), node);
51565
+ return setTextRange2(context, typeToTypeNodeHelper(getTypeFromTypeNode2(context, node), context), node);
51507
51566
  }
51508
51567
  return factory.updateImportTypeNode(
51509
51568
  node,
@@ -51573,10 +51632,16 @@ function createTypeChecker(host) {
51573
51632
  return factory.updateComputedPropertyName(node, literal);
51574
51633
  }
51575
51634
  }
51576
- if (isTypePredicateNode(node) && isIdentifier(node.parameterName)) {
51577
- const { node: result, introducesError } = trackExistingEntityName(node.parameterName, context);
51578
- hadError = hadError || introducesError;
51579
- return factory.updateTypePredicateNode(node, node.assertsModifier, result, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
51635
+ if (isTypePredicateNode(node)) {
51636
+ let parameterName;
51637
+ if (isIdentifier(node.parameterName)) {
51638
+ const { node: result, introducesError } = trackExistingEntityName(node.parameterName, context);
51639
+ hadError = hadError || introducesError;
51640
+ parameterName = result;
51641
+ } else {
51642
+ parameterName = node.parameterName;
51643
+ }
51644
+ return factory.updateTypePredicateNode(node, node.assertsModifier, parameterName, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
51580
51645
  }
51581
51646
  if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
51582
51647
  const visited = visitEachChild(
@@ -52352,7 +52417,7 @@ function createTypeChecker(host) {
52352
52417
  }
52353
52418
  return cleanup(factory.createExpressionWithTypeArguments(
52354
52419
  expr,
52355
- map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(context, a, getTypeFromTypeNode(a)) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
52420
+ map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(context, a, getTypeFromTypeNode2(context, a)) || typeToTypeNodeHelper(getTypeFromTypeNode2(context, a), context))
52356
52421
  ));
52357
52422
  function cleanup(result2) {
52358
52423
  context.enclosingDeclaration = oldEnclosing;
@@ -65668,12 +65733,17 @@ function createTypeChecker(host) {
65668
65733
  }
65669
65734
  }
65670
65735
  function applyToReturnTypes(source, target, callback) {
65671
- const sourceTypePredicate = getTypePredicateOfSignature(source);
65672
65736
  const targetTypePredicate = getTypePredicateOfSignature(target);
65673
- if (sourceTypePredicate && targetTypePredicate && typePredicateKindsMatch(sourceTypePredicate, targetTypePredicate) && sourceTypePredicate.type && targetTypePredicate.type) {
65674
- callback(sourceTypePredicate.type, targetTypePredicate.type);
65675
- } else {
65676
- callback(getReturnTypeOfSignature(source), getReturnTypeOfSignature(target));
65737
+ if (targetTypePredicate) {
65738
+ const sourceTypePredicate = getTypePredicateOfSignature(source);
65739
+ if (sourceTypePredicate && typePredicateKindsMatch(sourceTypePredicate, targetTypePredicate) && sourceTypePredicate.type && targetTypePredicate.type) {
65740
+ callback(sourceTypePredicate.type, targetTypePredicate.type);
65741
+ return;
65742
+ }
65743
+ }
65744
+ const targetReturnType = getReturnTypeOfSignature(target);
65745
+ if (couldContainTypeVariables(targetReturnType)) {
65746
+ callback(getReturnTypeOfSignature(source), targetReturnType);
65677
65747
  }
65678
65748
  }
65679
65749
  function createInferenceContext(typeParameters, signature, flags, compareTypes) {
@@ -84845,6 +84915,7 @@ function createTypeChecker(host) {
84845
84915
  function getSingleReturnExpression(declaration) {
84846
84916
  let candidateExpr;
84847
84917
  if (declaration && !nodeIsMissing(declaration.body)) {
84918
+ if (getFunctionFlags(declaration) & 3 /* AsyncGenerator */) return void 0;
84848
84919
  const body = declaration.body;
84849
84920
  if (body && isBlock(body)) {
84850
84921
  forEachReturnStatement(body, (s) => {
@@ -92246,10 +92317,9 @@ function transformClassFields(context) {
92246
92317
  }
92247
92318
  }
92248
92319
  }
92249
- function getClassThis() {
92320
+ function tryGetClassThis() {
92250
92321
  const lex = getClassLexicalEnvironment();
92251
- const classThis = lex.classThis ?? lex.classConstructor ?? (currentClassContainer == null ? void 0 : currentClassContainer.name);
92252
- return Debug.checkDefined(classThis);
92322
+ return lex.classThis ?? lex.classConstructor ?? (currentClassContainer == null ? void 0 : currentClassContainer.name);
92253
92323
  }
92254
92324
  function transformAutoAccessor(node) {
92255
92325
  const commentRange = getCommentRange(node);
@@ -92277,7 +92347,7 @@ function transformClassFields(context) {
92277
92347
  setOriginalNode(backingField, node);
92278
92348
  setEmitFlags(backingField, 3072 /* NoComments */);
92279
92349
  setSourceMapRange(backingField, sourceMapRange);
92280
- const receiver = isStatic(node) ? getClassThis() : factory2.createThis();
92350
+ const receiver = isStatic(node) ? tryGetClassThis() ?? factory2.createThis() : factory2.createThis();
92281
92351
  const getter = createAccessorPropertyGetRedirector(factory2, node, modifiers, getterName, receiver);
92282
92352
  setOriginalNode(getter, node);
92283
92353
  setCommentRange(getter, commentRange);
@@ -92843,7 +92913,7 @@ function transformClassFields(context) {
92843
92913
  var _a;
92844
92914
  let facts = 0 /* None */;
92845
92915
  const original = getOriginalNode(node);
92846
- if (isClassDeclaration(original) && classOrConstructorParameterIsDecorated(legacyDecorators, original)) {
92916
+ if (isClassLike(original) && classOrConstructorParameterIsDecorated(legacyDecorators, original)) {
92847
92917
  facts |= 1 /* ClassWasDecorated */;
92848
92918
  }
92849
92919
  if (shouldTransformPrivateElementsOrClassStaticBlocks && (classHasClassThisAssignment(node) || classHasExplicitlyAssignedName(node))) {
@@ -110029,6 +110099,9 @@ function createGetIsolatedDeclarationErrors(resolver) {
110029
110099
  if (heritageClause) {
110030
110100
  return createDiagnosticForNode(node, Diagnostics.Extends_clause_can_t_contain_an_expression_with_isolatedDeclarations);
110031
110101
  }
110102
+ if ((isPartOfTypeNode(node) || isTypeQueryNode(node.parent)) && (isEntityName(node) || isEntityNameExpression(node))) {
110103
+ return createEntityInTypeNodeError(node);
110104
+ }
110032
110105
  Debug.type(node);
110033
110106
  switch (node.kind) {
110034
110107
  case 177 /* GetAccessor */:
@@ -110064,8 +110137,13 @@ function createGetIsolatedDeclarationErrors(resolver) {
110064
110137
  }
110065
110138
  }
110066
110139
  function findNearestDeclaration(node) {
110067
- const result = findAncestor(node, (n) => isExportAssignment(n) || (isStatement(n) ? "quit" : isVariableDeclaration(n) || isPropertyDeclaration(n) || isParameter(n)));
110068
- return result;
110140
+ const result = findAncestor(node, (n) => isExportAssignment(n) || isStatement(n) || isVariableDeclaration(n) || isPropertyDeclaration(n) || isParameter(n));
110141
+ if (!result) return void 0;
110142
+ if (isExportAssignment(result)) return result;
110143
+ if (isReturnStatement(result)) {
110144
+ return findAncestor(result, (n) => isFunctionLikeDeclaration(n) && !isConstructorDeclaration(n));
110145
+ }
110146
+ return isStatement(result) ? void 0 : result;
110069
110147
  }
110070
110148
  function createAccessorTypeError(node) {
110071
110149
  const { getAccessor, setAccessor } = getAllAccessorDeclarations(node.symbol.declarations, node);
@@ -110079,11 +110157,10 @@ function createGetIsolatedDeclarationErrors(resolver) {
110079
110157
  }
110080
110158
  return diag2;
110081
110159
  }
110082
- function createObjectLiteralError(node) {
110083
- const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
110160
+ function addParentDeclarationRelatedInfo(node, diag2) {
110084
110161
  const parentDeclaration = findNearestDeclaration(node);
110085
110162
  if (parentDeclaration) {
110086
- const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
110163
+ const targetStr = isExportAssignment(parentDeclaration) || !parentDeclaration.name ? "" : getTextOfNode(
110087
110164
  parentDeclaration.name,
110088
110165
  /*includeTrivia*/
110089
110166
  false
@@ -110092,30 +110169,19 @@ function createGetIsolatedDeclarationErrors(resolver) {
110092
110169
  }
110093
110170
  return diag2;
110094
110171
  }
110172
+ function createObjectLiteralError(node) {
110173
+ const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
110174
+ addParentDeclarationRelatedInfo(node, diag2);
110175
+ return diag2;
110176
+ }
110095
110177
  function createArrayLiteralError(node) {
110096
110178
  const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
110097
- const parentDeclaration = findNearestDeclaration(node);
110098
- if (parentDeclaration) {
110099
- const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
110100
- parentDeclaration.name,
110101
- /*includeTrivia*/
110102
- false
110103
- );
110104
- addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
110105
- }
110179
+ addParentDeclarationRelatedInfo(node, diag2);
110106
110180
  return diag2;
110107
110181
  }
110108
110182
  function createReturnTypeError(node) {
110109
110183
  const diag2 = createDiagnosticForNode(node, errorByDeclarationKind[node.kind]);
110110
- const parentDeclaration = findNearestDeclaration(node);
110111
- if (parentDeclaration) {
110112
- const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
110113
- parentDeclaration.name,
110114
- /*includeTrivia*/
110115
- false
110116
- );
110117
- addRelatedInfo(diag2, createDiagnosticForNode(parentDeclaration, relatedSuggestionByDeclarationKind[parentDeclaration.kind], targetStr));
110118
- }
110184
+ addParentDeclarationRelatedInfo(node, diag2);
110119
110185
  addRelatedInfo(diag2, createDiagnosticForNode(node, relatedSuggestionByDeclarationKind[node.kind]));
110120
110186
  return diag2;
110121
110187
  }
@@ -110153,11 +110219,20 @@ function createGetIsolatedDeclarationErrors(resolver) {
110153
110219
  function createClassExpressionError(node) {
110154
110220
  return createExpressionError(node, Diagnostics.Inference_from_class_expressions_is_not_supported_with_isolatedDeclarations);
110155
110221
  }
110222
+ function createEntityInTypeNodeError(node) {
110223
+ const diag2 = createDiagnosticForNode(node, Diagnostics.Type_containing_private_name_0_can_t_be_used_with_isolatedDeclarations, getTextOfNode(
110224
+ node,
110225
+ /*includeTrivia*/
110226
+ false
110227
+ ));
110228
+ addParentDeclarationRelatedInfo(node, diag2);
110229
+ return diag2;
110230
+ }
110156
110231
  function createExpressionError(node, diagnosticMessage) {
110157
110232
  const parentDeclaration = findNearestDeclaration(node);
110158
110233
  let diag2;
110159
110234
  if (parentDeclaration) {
110160
- const targetStr = isExportAssignment(parentDeclaration) ? "" : getTextOfNode(
110235
+ const targetStr = isExportAssignment(parentDeclaration) || !parentDeclaration.name ? "" : getTextOfNode(
110161
110236
  parentDeclaration.name,
110162
110237
  /*includeTrivia*/
110163
110238
  false
@@ -110883,13 +110958,18 @@ function transformDeclarations(context) {
110883
110958
  if (isDeclaration(input)) {
110884
110959
  if (isDeclarationAndNotVisible(input)) return;
110885
110960
  if (hasDynamicName(input)) {
110886
- if (isolatedDeclarations && (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent))) {
110887
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
110888
- }
110889
- if (isolatedDeclarations && (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)) {
110890
- context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
110891
- }
110892
- if (!isEntityNameExpression(input.name.expression)) {
110961
+ if (isolatedDeclarations) {
110962
+ if (isClassDeclaration(input.parent) || isObjectLiteralExpression(input.parent)) {
110963
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_property_names_on_class_or_object_literals_cannot_be_inferred_with_isolatedDeclarations));
110964
+ return;
110965
+ } else if (
110966
+ // Type declarations just need to double-check that the input computed name is an entity name expression
110967
+ (isInterfaceDeclaration(input.parent) || isTypeLiteralNode(input.parent)) && !isEntityNameExpression(input.name.expression)
110968
+ ) {
110969
+ context.addDiagnostic(createDiagnosticForNode(input, Diagnostics.Computed_properties_must_be_number_or_string_literals_variables_or_dotted_expressions_with_isolatedDeclarations));
110970
+ return;
110971
+ }
110972
+ } else if (!resolver.isLateBound(getParseTreeNode(input)) || !isEntityNameExpression(input.name.expression)) {
110893
110973
  return;
110894
110974
  }
110895
110975
  }
@@ -121781,6 +121861,7 @@ var BuilderState;
121781
121861
  getKeys: (v) => reverse.get(v),
121782
121862
  getValues: (k) => forward.get(k),
121783
121863
  keys: () => forward.keys(),
121864
+ size: () => forward.size,
121784
121865
  deleteKey: (k) => {
121785
121866
  (deleted || (deleted = /* @__PURE__ */ new Set())).add(k);
121786
121867
  const set = forward.get(k);
@@ -121907,12 +121988,15 @@ var BuilderState;
121907
121988
  return oldState && !oldState.referencedMap === !newReferencedMap;
121908
121989
  }
121909
121990
  BuilderState2.canReuseOldState = canReuseOldState;
121991
+ function createReferencedMap(options) {
121992
+ return options.module !== 0 /* None */ && !options.outFile ? createManyToManyPathMap() : void 0;
121993
+ }
121994
+ BuilderState2.createReferencedMap = createReferencedMap;
121910
121995
  function create(newProgram, oldState, disableUseFileVersionAsSignature) {
121911
121996
  var _a, _b;
121912
121997
  const fileInfos = /* @__PURE__ */ new Map();
121913
121998
  const options = newProgram.getCompilerOptions();
121914
- const isOutFile = options.outFile;
121915
- const referencedMap = options.module !== 0 /* None */ && !isOutFile ? createManyToManyPathMap() : void 0;
121999
+ const referencedMap = createReferencedMap(options);
121916
122000
  const useOldState = canReuseOldState(referencedMap, oldState);
121917
122001
  newProgram.getTypeChecker();
121918
122002
  for (const sourceFile of newProgram.getSourceFiles()) {
@@ -121929,7 +122013,7 @@ var BuilderState;
121929
122013
  version: version2,
121930
122014
  signature,
121931
122015
  // No need to calculate affectsGlobalScope with --out since its not used at all
121932
- affectsGlobalScope: !isOutFile ? isFileAffectingGlobalScope(sourceFile) || void 0 : void 0,
122016
+ affectsGlobalScope: !options.outFile ? isFileAffectingGlobalScope(sourceFile) || void 0 : void 0,
121933
122017
  impliedFormat: sourceFile.impliedNodeFormat
121934
122018
  });
121935
122019
  }
@@ -122206,7 +122290,7 @@ function createBuilderProgramState(newProgram, oldState) {
122206
122290
  if (emitDiagnostics) {
122207
122291
  (state.emitDiagnosticsPerFile ?? (state.emitDiagnosticsPerFile = /* @__PURE__ */ new Map())).set(
122208
122292
  sourceFilePath,
122209
- oldState.hasReusableDiagnostic ? convertToDiagnostics(emitDiagnostics, newProgram) : repopulateDiagnostics(emitDiagnostics, newProgram)
122293
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(emitDiagnostics, sourceFilePath, newProgram) : repopulateDiagnostics(emitDiagnostics, newProgram)
122210
122294
  );
122211
122295
  }
122212
122296
  if (canCopySemanticDiagnostics) {
@@ -122216,7 +122300,7 @@ function createBuilderProgramState(newProgram, oldState) {
122216
122300
  if (diagnostics) {
122217
122301
  state.semanticDiagnosticsPerFile.set(
122218
122302
  sourceFilePath,
122219
- oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
122303
+ oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, sourceFilePath, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
122220
122304
  );
122221
122305
  (state.semanticDiagnosticsFromOldState ?? (state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set())).add(sourceFilePath);
122222
122306
  }
@@ -122303,17 +122387,17 @@ function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram
122303
122387
  function convertOrRepopulateDiagnosticMessageChainArray(array, sourceFile, newProgram, repopulateInfo) {
122304
122388
  return sameMap(array, (chain) => convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo));
122305
122389
  }
122306
- function convertToDiagnostics(diagnostics, newProgram) {
122390
+ function convertToDiagnostics(diagnostics, diagnosticFilePath, newProgram) {
122307
122391
  if (!diagnostics.length) return emptyArray;
122308
122392
  let buildInfoDirectory;
122309
122393
  return diagnostics.map((diagnostic) => {
122310
- const result = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPathInBuildInfoDirectory);
122394
+ const result = convertToDiagnosticRelatedInformation(diagnostic, diagnosticFilePath, newProgram, toPathInBuildInfoDirectory);
122311
122395
  result.reportsUnnecessary = diagnostic.reportsUnnecessary;
122312
122396
  result.reportsDeprecated = diagnostic.reportDeprecated;
122313
122397
  result.source = diagnostic.source;
122314
122398
  result.skippedOn = diagnostic.skippedOn;
122315
122399
  const { relatedInformation } = diagnostic;
122316
- result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, newProgram, toPathInBuildInfoDirectory)) : [] : void 0;
122400
+ result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToDiagnosticRelatedInformation(r, diagnosticFilePath, newProgram, toPathInBuildInfoDirectory)) : [] : void 0;
122317
122401
  return result;
122318
122402
  });
122319
122403
  function toPathInBuildInfoDirectory(path) {
@@ -122321,9 +122405,9 @@ function convertToDiagnostics(diagnostics, newProgram) {
122321
122405
  return toPath(path, buildInfoDirectory, newProgram.getCanonicalFileName);
122322
122406
  }
122323
122407
  }
122324
- function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3) {
122408
+ function convertToDiagnosticRelatedInformation(diagnostic, diagnosticFilePath, newProgram, toPath3) {
122325
122409
  const { file } = diagnostic;
122326
- const sourceFile = file ? newProgram.getSourceFileByPath(toPath3(file)) : void 0;
122410
+ const sourceFile = file !== false ? newProgram.getSourceFileByPath(file ? toPath3(file) : diagnosticFilePath) : void 0;
122327
122411
  return {
122328
122412
  ...diagnostic,
122329
122413
  file: sourceFile,
@@ -122639,7 +122723,7 @@ function isProgramBundleEmitBuildInfo(info) {
122639
122723
  return !!((_a = info.options) == null ? void 0 : _a.outFile);
122640
122724
  }
122641
122725
  function getBuildInfo2(state) {
122642
- var _a;
122726
+ var _a, _b;
122643
122727
  const currentDirectory = Debug.checkDefined(state.program).getCurrentDirectory();
122644
122728
  const buildInfoDirectory = getDirectoryPath(getNormalizedAbsolutePath(getTsBuildInfoEmitOutputFilePath(state.compilerOptions), currentDirectory));
122645
122729
  const latestChangedDtsFile = state.latestChangedDtsFile ? relativeToBuildInfoEnsuringAbsolutePath(state.latestChangedDtsFile) : void 0;
@@ -122676,7 +122760,7 @@ function getBuildInfo2(state) {
122676
122760
  let fileNamesToFileIdListId;
122677
122761
  let emitSignatures;
122678
122762
  const fileInfos = arrayFrom(state.fileInfos.entries(), ([key, value]) => {
122679
- var _a2, _b;
122763
+ var _a2, _b2;
122680
122764
  const fileId = toFileId(key);
122681
122765
  tryAddRoot(key, fileId);
122682
122766
  Debug.assert(fileNames[fileId - 1] === relativeToBuildInfo(key));
@@ -122685,7 +122769,7 @@ function getBuildInfo2(state) {
122685
122769
  if (state.compilerOptions.composite) {
122686
122770
  const file = state.program.getSourceFileByPath(key);
122687
122771
  if (!isJsonSourceFile(file) && sourceFileMayBeEmitted(file, state.program)) {
122688
- const emitSignature = (_b = state.emitSignatures) == null ? void 0 : _b.get(key);
122772
+ const emitSignature = (_b2 = state.emitSignatures) == null ? void 0 : _b2.get(key);
122689
122773
  if (emitSignature !== actualSignature) {
122690
122774
  emitSignatures = append(
122691
122775
  emitSignatures,
@@ -122719,15 +122803,15 @@ function getBuildInfo2(state) {
122719
122803
  );
122720
122804
  });
122721
122805
  let referencedMap;
122722
- if (state.referencedMap) {
122806
+ if ((_a = state.referencedMap) == null ? void 0 : _a.size()) {
122723
122807
  referencedMap = arrayFrom(state.referencedMap.keys()).sort(compareStringsCaseSensitive).map((key) => [
122724
122808
  toFileId(key),
122725
122809
  toFileIdListId(state.referencedMap.getValues(key))
122726
122810
  ]);
122727
122811
  }
122728
- const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.semanticDiagnosticsPerFile);
122812
+ const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics();
122729
122813
  let affectedFilesPendingEmit;
122730
- if ((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size) {
122814
+ if ((_b = state.affectedFilesPendingEmit) == null ? void 0 : _b.size) {
122731
122815
  const fullEmitForOptions = getBuilderFileEmit(state.compilerOptions);
122732
122816
  const seenFiles = /* @__PURE__ */ new Set();
122733
122817
  for (const path of arrayFrom(state.affectedFilesPendingEmit.keys()).sort(compareStringsCaseSensitive)) {
@@ -122755,7 +122839,7 @@ function getBuildInfo2(state) {
122755
122839
  changeFileSet = append(changeFileSet, toFileId(path));
122756
122840
  }
122757
122841
  }
122758
- const emitDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.emitDiagnosticsPerFile);
122842
+ const emitDiagnosticsPerFile = convertToProgramBuildInfoEmitDiagnostics();
122759
122843
  const program = {
122760
122844
  fileNames,
122761
122845
  fileInfos,
@@ -122847,40 +122931,53 @@ function getBuildInfo2(state) {
122847
122931
  }
122848
122932
  return value;
122849
122933
  }
122850
- function convertToProgramBuildInfoDiagnostics(diagnostics) {
122934
+ function convertToProgramBuildInfoDiagnostics() {
122851
122935
  let result;
122852
- if (diagnostics) {
122853
- for (const key of arrayFrom(diagnostics.keys()).sort(compareStringsCaseSensitive)) {
122854
- const value = diagnostics.get(key);
122855
- result = append(
122856
- result,
122857
- value.length ? [
122858
- toFileId(key),
122859
- convertToReusableDiagnostics(value)
122860
- ] : toFileId(key)
122861
- );
122936
+ state.fileInfos.forEach((_value, key) => {
122937
+ var _a2;
122938
+ const value = (_a2 = state.semanticDiagnosticsPerFile) == null ? void 0 : _a2.get(key);
122939
+ if (!value) {
122940
+ if (!state.changedFilesSet.has(key)) result = append(result, toFileId(key));
122941
+ } else if (value.length) {
122942
+ result = append(result, [
122943
+ toFileId(key),
122944
+ convertToReusableDiagnostics(value, key)
122945
+ ]);
122862
122946
  }
122947
+ });
122948
+ return result;
122949
+ }
122950
+ function convertToProgramBuildInfoEmitDiagnostics() {
122951
+ var _a2;
122952
+ let result;
122953
+ if (!((_a2 = state.emitDiagnosticsPerFile) == null ? void 0 : _a2.size)) return result;
122954
+ for (const key of arrayFrom(state.emitDiagnosticsPerFile.keys()).sort(compareStringsCaseSensitive)) {
122955
+ const value = state.emitDiagnosticsPerFile.get(key);
122956
+ result = append(result, [
122957
+ toFileId(key),
122958
+ convertToReusableDiagnostics(value, key)
122959
+ ]);
122863
122960
  }
122864
122961
  return result;
122865
122962
  }
122866
- function convertToReusableDiagnostics(diagnostics) {
122963
+ function convertToReusableDiagnostics(diagnostics, diagnosticFilePath) {
122867
122964
  Debug.assert(!!diagnostics.length);
122868
122965
  return diagnostics.map((diagnostic) => {
122869
- const result = convertToReusableDiagnosticRelatedInformation(diagnostic);
122966
+ const result = convertToReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath);
122870
122967
  result.reportsUnnecessary = diagnostic.reportsUnnecessary;
122871
122968
  result.reportDeprecated = diagnostic.reportsDeprecated;
122872
122969
  result.source = diagnostic.source;
122873
122970
  result.skippedOn = diagnostic.skippedOn;
122874
122971
  const { relatedInformation } = diagnostic;
122875
- result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r)) : [] : void 0;
122972
+ result.relatedInformation = relatedInformation ? relatedInformation.length ? relatedInformation.map((r) => convertToReusableDiagnosticRelatedInformation(r, diagnosticFilePath)) : [] : void 0;
122876
122973
  return result;
122877
122974
  });
122878
122975
  }
122879
- function convertToReusableDiagnosticRelatedInformation(diagnostic) {
122976
+ function convertToReusableDiagnosticRelatedInformation(diagnostic, diagnosticFilePath) {
122880
122977
  const { file } = diagnostic;
122881
122978
  return {
122882
122979
  ...diagnostic,
122883
- file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
122980
+ file: file ? file.resolvedPath === diagnosticFilePath ? void 0 : relativeToBuildInfo(file.resolvedPath) : false,
122884
122981
  messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
122885
122982
  };
122886
122983
  }
@@ -123274,16 +123371,17 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
123274
123371
  );
123275
123372
  }
123276
123373
  });
123374
+ const changedFilesSet = new Set(map(program.changeFileSet, toFilePath));
123277
123375
  const fullEmitForOptions = program.affectedFilesPendingEmit ? getBuilderFileEmit(program.options || {}) : void 0;
123278
123376
  state = {
123279
123377
  fileInfos,
123280
123378
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
123281
- referencedMap: toManyToManyPathMap(program.referencedMap),
123282
- semanticDiagnosticsPerFile: toPerFileDiagnostics(program.semanticDiagnosticsPerFile),
123283
- emitDiagnosticsPerFile: toPerFileDiagnostics(program.emitDiagnosticsPerFile),
123379
+ referencedMap: toManyToManyPathMap(program.referencedMap, program.options ?? {}),
123380
+ semanticDiagnosticsPerFile: toPerFileSemanticDiagnostics(program.semanticDiagnosticsPerFile, fileInfos, changedFilesSet),
123381
+ emitDiagnosticsPerFile: toPerFileEmitDiagnostics(program.emitDiagnosticsPerFile),
123284
123382
  hasReusableDiagnostic: true,
123285
123383
  affectedFilesPendingEmit: program.affectedFilesPendingEmit && arrayToMap(program.affectedFilesPendingEmit, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => toBuilderFileEmit(value, fullEmitForOptions)),
123286
- changedFilesSet: new Set(map(program.changeFileSet, toFilePath)),
123384
+ changedFilesSet,
123287
123385
  latestChangedDtsFile,
123288
123386
  emitSignatures: (emitSignatures == null ? void 0 : emitSignatures.size) ? emitSignatures : void 0
123289
123387
  };
@@ -123325,16 +123423,27 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
123325
123423
  function toFilePathsSet(fileIdsListId) {
123326
123424
  return filePathsSetList[fileIdsListId - 1];
123327
123425
  }
123328
- function toManyToManyPathMap(referenceMap) {
123329
- if (!referenceMap) {
123330
- return void 0;
123331
- }
123332
- const map2 = BuilderState.createManyToManyPathMap();
123426
+ function toManyToManyPathMap(referenceMap, options) {
123427
+ const map2 = BuilderState.createReferencedMap(options);
123428
+ if (!map2 || !referenceMap) return map2;
123333
123429
  referenceMap.forEach(([fileId, fileIdListId]) => map2.set(toFilePath(fileId), toFilePathsSet(fileIdListId)));
123334
123430
  return map2;
123335
123431
  }
123336
- function toPerFileDiagnostics(diagnostics) {
123337
- return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(isNumber(value) ? value : value[0]), (value) => isNumber(value) ? emptyArray : value[1]);
123432
+ function toPerFileSemanticDiagnostics(diagnostics, fileInfos, changedFilesSet) {
123433
+ const semanticDiagnostics = new Map(
123434
+ mapDefinedIterator(
123435
+ fileInfos.keys(),
123436
+ (key) => !changedFilesSet.has(key) ? [key, emptyArray] : void 0
123437
+ )
123438
+ );
123439
+ diagnostics == null ? void 0 : diagnostics.forEach((value) => {
123440
+ if (isNumber(value)) semanticDiagnostics.delete(toFilePath(value));
123441
+ else semanticDiagnostics.set(toFilePath(value[0]), value[1]);
123442
+ });
123443
+ return semanticDiagnostics.size ? semanticDiagnostics : void 0;
123444
+ }
123445
+ function toPerFileEmitDiagnostics(diagnostics) {
123446
+ return diagnostics && arrayToMap(diagnostics, (value) => toFilePath(value[0]), (value) => value[1]);
123338
123447
  }
123339
123448
  }
123340
123449
  function getBuildInfoFileVersionMap(program, buildInfoPath, host) {
@@ -126865,7 +126974,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
126865
126974
  }
126866
126975
  }
126867
126976
  function getUpToDateStatusWorker(state, project, resolvedPath) {
126868
- var _a, _b, _c;
126977
+ var _a, _b, _c, _d;
126869
126978
  if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
126870
126979
  return {
126871
126980
  type: 15 /* ContainerOnly */
@@ -126937,7 +127046,7 @@ function getUpToDateStatusWorker(state, project, resolvedPath) {
126937
127046
  };
126938
127047
  }
126939
127048
  if (buildInfo.program) {
126940
- 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))) {
127049
+ 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)) {
126941
127050
  return {
126942
127051
  type: 7 /* OutOfDateBuildInfo */,
126943
127052
  buildInfoFile: buildInfoPath
@@ -128803,8 +128912,8 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
128803
128912
  serializeReturnTypeForSignature,
128804
128913
  serializeTypeOfExpression
128805
128914
  };
128806
- function serializeExistingTypeAnnotation(type) {
128807
- return type === void 0 ? void 0 : !type.parent || !isParameter(type.parent) || !resolver.requiresAddingImplicitUndefined(type.parent) || canAddUndefined(type);
128915
+ function serializeExistingTypeAnnotation(type, addUndefined) {
128916
+ return type !== void 0 && (!addUndefined || type && canAddUndefined(type)) ? true : void 0;
128808
128917
  }
128809
128918
  function serializeTypeOfExpression(expr, context, addUndefined, preserveLiterals) {
128810
128919
  return typeFromExpression(
@@ -128925,12 +129034,17 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
128925
129034
  const declaredType = getEffectiveTypeAnnotationNode(node);
128926
129035
  const addUndefined = resolver.requiresAddingImplicitUndefined(node);
128927
129036
  let resultType;
128928
- if (!addUndefined) {
128929
- if (declaredType) {
128930
- return serializeExistingTypeAnnotation(declaredType);
128931
- }
129037
+ if (declaredType) {
129038
+ resultType = serializeExistingTypeAnnotation(declaredType, addUndefined);
129039
+ } else {
128932
129040
  if (node.initializer && isIdentifier(node.name)) {
128933
- resultType = typeFromExpression(node.initializer, context);
129041
+ resultType = typeFromExpression(
129042
+ node.initializer,
129043
+ context,
129044
+ /*isConstContext*/
129045
+ void 0,
129046
+ addUndefined
129047
+ );
128934
129048
  }
128935
129049
  }
128936
129050
  return resultType ?? inferTypeOfDeclaration(node, context);
@@ -129193,6 +129307,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
129193
129307
  function typeFromSingleReturnExpression(declaration, context) {
129194
129308
  let candidateExpr;
129195
129309
  if (declaration && !nodeIsMissing(declaration.body)) {
129310
+ if (getFunctionFlags(declaration) & 3 /* AsyncGenerator */) return void 0;
129196
129311
  const body = declaration.body;
129197
129312
  if (body && isBlock(body)) {
129198
129313
  forEachReturnStatement(body, (s) => {