@typescript-deploys/pr-build 5.9.0-pr-61420-2 → 5.9.0-pr-61505-16

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,11 +18,15 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.9";
21
- var version = `${versionMajorMinor}.0-insiders.20250314`;
21
+ var version = `${versionMajorMinor}.0-insiders.20250401`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
25
25
  var emptyMap = /* @__PURE__ */ new Map();
26
+ var voidMap = /* @__PURE__ */ new Map();
27
+ voidMap.set = function() {
28
+ return this;
29
+ };
26
30
  function length(array) {
27
31
  return array !== void 0 ? array.length : 0;
28
32
  }
@@ -44902,6 +44906,8 @@ function getContainerFlags(node) {
44902
44906
  case 185 /* ConstructorType */:
44903
44907
  case 175 /* ClassStaticBlockDeclaration */:
44904
44908
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
44909
+ case 351 /* JSDocImportTag */:
44910
+ return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
44905
44911
  case 218 /* FunctionExpression */:
44906
44912
  case 219 /* ArrowFunction */:
44907
44913
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */;
@@ -46163,7 +46169,6 @@ function createTypeChecker(host) {
46163
46169
  };
46164
46170
  var cancellationToken;
46165
46171
  var scanner;
46166
- var fileIndexMap = new Map(host.getSourceFiles().map((file, i) => [file, i]));
46167
46172
  var Symbol13 = objectAllocator.getSymbolConstructor();
46168
46173
  var Type7 = objectAllocator.getTypeConstructor();
46169
46174
  var Signature5 = objectAllocator.getSignatureConstructor();
@@ -46817,6 +46822,7 @@ function createTypeChecker(host) {
46817
46822
  var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
46818
46823
  var numericStringType = getTemplateLiteralType(["", ""], [numberType]);
46819
46824
  var restrictiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t, () => "(restrictive mapper)");
46825
+ restrictiveMapper.instantiations = voidMap;
46820
46826
  var permissiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? wildcardType : t, () => "(permissive mapper)");
46821
46827
  var uniqueLiteralType = createIntrinsicType(
46822
46828
  131072 /* Never */,
@@ -46836,6 +46842,7 @@ function createTypeChecker(host) {
46836
46842
  }
46837
46843
  return t;
46838
46844
  }, () => "(unmeasurable reporter)");
46845
+ reportUnreliableMapper.instantiations = voidMap;
46839
46846
  var reportUnmeasurableMapper = makeFunctionTypeMapper((t) => {
46840
46847
  if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
46841
46848
  outofbandVarianceMarkerHandler(
@@ -46845,6 +46852,7 @@ function createTypeChecker(host) {
46845
46852
  }
46846
46853
  return t;
46847
46854
  }, () => "(unreliable reporter)");
46855
+ reportUnmeasurableMapper.instantiations = voidMap;
46848
46856
  var emptyObjectType = createAnonymousType(
46849
46857
  /*symbol*/
46850
46858
  void 0,
@@ -49802,7 +49810,6 @@ function createTypeChecker(host) {
49802
49810
  (result || (result = [])).push(symbol);
49803
49811
  }
49804
49812
  });
49805
- result == null ? void 0 : result.sort(compareSymbols);
49806
49813
  return result || emptyArray;
49807
49814
  }
49808
49815
  function isNamedMember(member, escapedName) {
@@ -50408,10 +50415,11 @@ function createTypeChecker(host) {
50408
50415
  serializeExistingTypeNode(context, typeNode, addUndefined) {
50409
50416
  return serializeExistingTypeNode(context, typeNode, !!addUndefined);
50410
50417
  },
50411
- serializeReturnTypeForSignature(syntacticContext, signatureDeclaration) {
50418
+ serializeReturnTypeForSignature(syntacticContext, signatureDeclaration, symbol) {
50412
50419
  const context = syntacticContext;
50413
50420
  const signature = getSignatureFromDeclaration(signatureDeclaration);
50414
- const returnType = context.enclosingSymbolTypes.get(getSymbolId(getSymbolOfDeclaration(signatureDeclaration))) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
50421
+ symbol ?? (symbol = getSymbolOfDeclaration(signatureDeclaration));
50422
+ const returnType = context.enclosingSymbolTypes.get(getSymbolId(symbol)) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
50415
50423
  return serializeInferredReturnTypeForSignature(context, signature, returnType);
50416
50424
  },
50417
50425
  serializeTypeOfExpression(syntacticContext, expr) {
@@ -50425,7 +50433,7 @@ function createTypeChecker(host) {
50425
50433
  symbol ?? (symbol = getSymbolOfDeclaration(declaration));
50426
50434
  let type = (_a = context.enclosingSymbolTypes) == null ? void 0 : _a.get(getSymbolId(symbol));
50427
50435
  if (type === void 0) {
50428
- type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
50436
+ type = symbol.flags & 98304 /* Accessor */ && declaration.kind === 178 /* SetAccessor */ ? instantiateType(getWriteTypeOfSymbol(symbol), context.mapper) : symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
50429
50437
  }
50430
50438
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
50431
50439
  if (addUndefinedForParameter) {
@@ -51574,12 +51582,13 @@ function createTypeChecker(host) {
51574
51582
  if (propertySymbol.flags & 98304 /* Accessor */) {
51575
51583
  const writeType = getWriteTypeOfSymbol(propertySymbol);
51576
51584
  if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
51585
+ const symbolMapper = getSymbolLinks(propertySymbol).mapper;
51577
51586
  const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
51578
51587
  const getterSignature = getSignatureFromDeclaration(getterDeclaration);
51579
51588
  typeElements.push(
51580
51589
  setCommentRange2(
51581
51590
  context,
51582
- signatureToSignatureDeclarationHelper(getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
51591
+ signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(getterSignature, symbolMapper) : getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
51583
51592
  getterDeclaration
51584
51593
  )
51585
51594
  );
@@ -51588,7 +51597,7 @@ function createTypeChecker(host) {
51588
51597
  typeElements.push(
51589
51598
  setCommentRange2(
51590
51599
  context,
51591
- signatureToSignatureDeclarationHelper(setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
51600
+ signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(setterSignature, symbolMapper) : setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
51592
51601
  setterDeclaration
51593
51602
  )
51594
51603
  );
@@ -52731,13 +52740,13 @@ function createTypeChecker(host) {
52731
52740
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
52732
52741
  const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
52733
52742
  if (decl) {
52743
+ const restore = addSymbolTypeToContext(context, symbol, type);
52734
52744
  if (isAccessor(decl)) {
52735
52745
  result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
52736
52746
  } else if (hasInferredType(decl) && !nodeIsSynthesized(decl) && !(getObjectFlags(type) & 196608 /* RequiresWidening */)) {
52737
- const restore = addSymbolTypeToContext(context, symbol, type);
52738
52747
  result = syntacticNodeBuilder.serializeTypeOfDeclaration(decl, symbol, context);
52739
- restore();
52740
52748
  }
52749
+ restore();
52741
52750
  }
52742
52751
  if (!result) {
52743
52752
  if (addUndefinedForParameter) {
@@ -61689,7 +61698,7 @@ function createTypeChecker(host) {
61689
61698
  context.nonFixingMapper = combineTypeMappers(context.nonFixingMapper, mapper);
61690
61699
  }
61691
61700
  if (!checkTypeDeferred) {
61692
- inferTypes(context.inferences, checkType, extendsType, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
61701
+ inferTypes(context, context.inferences, checkType, extendsType, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
61693
61702
  }
61694
61703
  combinedMapper = mapper ? combineTypeMappers(context.mapper, mapper) : context.mapper;
61695
61704
  }
@@ -62698,7 +62707,7 @@ function createTypeChecker(host) {
62698
62707
  ) : type;
62699
62708
  }
62700
62709
  function instantiateTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
62701
- var _a;
62710
+ var _a, _b;
62702
62711
  if (!couldContainTypeVariables(type)) {
62703
62712
  return type;
62704
62713
  }
@@ -62707,10 +62716,16 @@ function createTypeChecker(host) {
62707
62716
  error(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
62708
62717
  return errorType;
62709
62718
  }
62719
+ const key = type.id + getAliasId(aliasSymbol, aliasTypeArguments);
62720
+ const cached = (mapper.instantiations ?? (mapper.instantiations = /* @__PURE__ */ new Map())).get(key);
62721
+ if (cached) {
62722
+ return cached;
62723
+ }
62710
62724
  totalInstantiationCount++;
62711
62725
  instantiationCount++;
62712
62726
  instantiationDepth++;
62713
62727
  const result = instantiateTypeWorker(type, mapper, aliasSymbol, aliasTypeArguments);
62728
+ (_b = mapper.instantiations) == null ? void 0 : _b.set(key, result);
62714
62729
  instantiationDepth--;
62715
62730
  return result;
62716
62731
  }
@@ -65333,7 +65348,7 @@ function createTypeChecker(host) {
65333
65348
  0 /* None */,
65334
65349
  isRelatedToWorker
65335
65350
  );
65336
- inferTypes(ctx.inferences, target2.extendsType, sourceExtends, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
65351
+ inferTypes(ctx, ctx.inferences, target2.extendsType, sourceExtends, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
65337
65352
  sourceExtends = instantiateType(sourceExtends, ctx.mapper);
65338
65353
  mapper = ctx.mapper;
65339
65354
  }
@@ -67213,7 +67228,7 @@ function createTypeChecker(host) {
67213
67228
  map(context.inferences, (inference, i) => () => {
67214
67229
  if (!inference.isFixed) {
67215
67230
  inferFromIntraExpressionSites(context);
67216
- clearCachedInferences(context.inferences);
67231
+ clearCachedInferences(context, context.inferences);
67217
67232
  inference.isFixed = true;
67218
67233
  }
67219
67234
  return getInferredType(context, i);
@@ -67228,7 +67243,10 @@ function createTypeChecker(host) {
67228
67243
  })
67229
67244
  );
67230
67245
  }
67231
- function clearCachedInferences(inferences) {
67246
+ function clearCachedInferences(context, inferences) {
67247
+ if (context) {
67248
+ context.nonFixingMapper.instantiations = void 0;
67249
+ }
67232
67250
  for (const inference of inferences) {
67233
67251
  if (!inference.isFixed) {
67234
67252
  inference.inferredType = void 0;
@@ -67243,7 +67261,7 @@ function createTypeChecker(host) {
67243
67261
  for (const { node, type } of context.intraExpressionInferenceSites) {
67244
67262
  const contextualType = node.kind === 174 /* MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* NoConstraints */) : getContextualType(node, 2 /* NoConstraints */);
67245
67263
  if (contextualType) {
67246
- inferTypes(context.inferences, type, contextualType);
67264
+ inferTypes(context, context.inferences, type, contextualType);
67247
67265
  }
67248
67266
  }
67249
67267
  context.intraExpressionInferenceSites = void 0;
@@ -67387,7 +67405,13 @@ function createTypeChecker(host) {
67387
67405
  const typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
67388
67406
  const templateType = getTemplateTypeFromMappedType(target);
67389
67407
  const inference = createInferenceInfo(typeParameter);
67390
- inferTypes([inference], sourceType, templateType);
67408
+ inferTypes(
67409
+ /*context*/
67410
+ void 0,
67411
+ [inference],
67412
+ sourceType,
67413
+ templateType
67414
+ );
67391
67415
  return getTypeFromInference(inference) || unknownType;
67392
67416
  }
67393
67417
  function inferReverseMappedType(source, target, constraint) {
@@ -67589,7 +67613,7 @@ function createTypeChecker(host) {
67589
67613
  function isTupleOfSelf(typeParameter, type) {
67590
67614
  return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
67591
67615
  }
67592
- function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
67616
+ function inferTypes(context, inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
67593
67617
  let bivariant = false;
67594
67618
  let propagationType;
67595
67619
  let inferencePriority = 2048 /* MaxValue */;
@@ -67680,16 +67704,16 @@ function createTypeChecker(host) {
67680
67704
  if (contravariant && !bivariant) {
67681
67705
  if (!contains(inference.contraCandidates, candidate)) {
67682
67706
  inference.contraCandidates = append(inference.contraCandidates, candidate);
67683
- clearCachedInferences(inferences);
67707
+ clearCachedInferences(context, inferences);
67684
67708
  }
67685
67709
  } else if (!contains(inference.candidates, candidate)) {
67686
67710
  inference.candidates = append(inference.candidates, candidate);
67687
- clearCachedInferences(inferences);
67711
+ clearCachedInferences(context, inferences);
67688
67712
  }
67689
67713
  }
67690
67714
  if (!(priority & 128 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
67691
67715
  inference.topLevel = false;
67692
- clearCachedInferences(inferences);
67716
+ clearCachedInferences(context, inferences);
67693
67717
  }
67694
67718
  }
67695
67719
  inferencePriority = Math.min(inferencePriority, priority);
@@ -68255,6 +68279,7 @@ function createTypeChecker(host) {
68255
68279
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
68256
68280
  if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
68257
68281
  inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
68282
+ context.nonFixingMapper.instantiations = void 0;
68258
68283
  }
68259
68284
  }
68260
68285
  }
@@ -74382,7 +74407,7 @@ function createTypeChecker(host) {
74382
74407
  addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
74383
74408
  }
74384
74409
  function containerSeemsToBeEmptyDomElement(containingType) {
74385
- return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(?:EventTarget|Node|(?:HTML[a-zA-Z]*)?Element)$/.test(unescapeLeadingUnderscores(type.symbol.escapedName))) && isEmptyObjectType(containingType);
74410
+ return compilerOptions.lib && !compilerOptions.lib.includes("lib.dom.d.ts") && everyContainedType(containingType, (type) => type.symbol && /^(?:EventTarget|Node|(?:HTML[a-zA-Z]*)?Element)$/.test(unescapeLeadingUnderscores(type.symbol.escapedName))) && isEmptyObjectType(containingType);
74386
74411
  }
74387
74412
  function typeHasStaticProperty(propName, containingType) {
74388
74413
  const prop = containingType.symbol && getPropertyOfType(getTypeOfSymbol(containingType.symbol), propName);
@@ -74437,13 +74462,15 @@ function createTypeChecker(host) {
74437
74462
  function getSuggestionForSymbolNameLookup(symbols, name, meaning) {
74438
74463
  const symbol = getSymbol(symbols, name, meaning);
74439
74464
  if (symbol) return symbol;
74440
- let candidates = arrayFrom(symbols.values()).sort(compareSymbols);
74465
+ let candidates;
74441
74466
  if (symbols === globals) {
74442
74467
  const primitives = mapDefined(
74443
74468
  ["string", "number", "boolean", "object", "bigint", "symbol"],
74444
74469
  (s) => symbols.has(s.charAt(0).toUpperCase() + s.slice(1)) ? createSymbol(524288 /* TypeAlias */, s) : void 0
74445
74470
  );
74446
- candidates = concatenate(candidates, primitives);
74471
+ candidates = primitives.concat(arrayFrom(symbols.values()));
74472
+ } else {
74473
+ candidates = arrayFrom(symbols.values());
74447
74474
  }
74448
74475
  return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning);
74449
74476
  }
@@ -74463,7 +74490,7 @@ function createTypeChecker(host) {
74463
74490
  return result;
74464
74491
  }
74465
74492
  function getSuggestedSymbolForNonexistentModule(name, targetModule) {
74466
- return targetModule.exports && getSpellingSuggestionForName(idText(name), getExportsOfModuleAsArray(targetModule).sort(compareSymbols), 2623475 /* ModuleMember */);
74493
+ return targetModule.exports && getSpellingSuggestionForName(idText(name), getExportsOfModuleAsArray(targetModule), 2623475 /* ModuleMember */);
74467
74494
  }
74468
74495
  function getSuggestionForNonexistentIndexSignature(objectType, expr, keyedType) {
74469
74496
  function hasProp(name) {
@@ -74827,11 +74854,11 @@ function createTypeChecker(host) {
74827
74854
  const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper : inferenceContext.mapper);
74828
74855
  const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
74829
74856
  applyToParameterTypes(sourceSignature, signature, (source, target) => {
74830
- inferTypes(context.inferences, source, target);
74857
+ inferTypes(context, context.inferences, source, target);
74831
74858
  });
74832
74859
  if (!inferenceContext) {
74833
74860
  applyToReturnTypes(contextualSignature, signature, (source, target) => {
74834
- inferTypes(context.inferences, source, target, 128 /* ReturnType */);
74861
+ inferTypes(context, context.inferences, source, target, 128 /* ReturnType */);
74835
74862
  });
74836
74863
  }
74837
74864
  return getSignatureInstantiation(signature, getInferredTypes(context), isInJSFile(contextualSignature.declaration));
@@ -74839,7 +74866,7 @@ function createTypeChecker(host) {
74839
74866
  function inferJsxTypeArguments(node, signature, checkMode, context) {
74840
74867
  const paramType = getEffectiveFirstArgumentForJsxSignature(signature, node);
74841
74868
  const checkAttrType = checkExpressionWithContextualType(node.attributes, paramType, context, checkMode);
74842
- inferTypes(context.inferences, checkAttrType, paramType);
74869
+ inferTypes(context, context.inferences, checkAttrType, paramType);
74843
74870
  return getInferredTypes(context);
74844
74871
  }
74845
74872
  function getThisArgumentType(thisArgumentNode) {
@@ -74866,11 +74893,11 @@ function createTypeChecker(host) {
74866
74893
  const instantiatedType = instantiateType(contextualType, outerMapper);
74867
74894
  const contextualSignature = getSingleCallSignature(instantiatedType);
74868
74895
  const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType;
74869
- inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
74896
+ inferTypes(context, context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
74870
74897
  }
74871
74898
  const returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
74872
74899
  const returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
74873
- inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
74900
+ inferTypes(returnContext, returnContext.inferences, returnSourceType, inferenceTargetType);
74874
74901
  context.returnMapper = some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : void 0;
74875
74902
  }
74876
74903
  }
@@ -74886,7 +74913,7 @@ function createTypeChecker(host) {
74886
74913
  const thisType = getThisTypeOfSignature(signature);
74887
74914
  if (thisType && couldContainTypeVariables(thisType)) {
74888
74915
  const thisArgumentNode = getThisArgumentOfCall(node);
74889
- inferTypes(context.inferences, getThisArgumentType(thisArgumentNode), thisType);
74916
+ inferTypes(context, context.inferences, getThisArgumentType(thisArgumentNode), thisType);
74890
74917
  }
74891
74918
  for (let i = 0; i < argCount; i++) {
74892
74919
  const arg = args[i];
@@ -74894,13 +74921,13 @@ function createTypeChecker(host) {
74894
74921
  const paramType = getTypeAtPosition(signature, i);
74895
74922
  if (couldContainTypeVariables(paramType)) {
74896
74923
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
74897
- inferTypes(context.inferences, argType, paramType);
74924
+ inferTypes(context, context.inferences, argType, paramType);
74898
74925
  }
74899
74926
  }
74900
74927
  }
74901
74928
  if (restType && couldContainTypeVariables(restType)) {
74902
74929
  const spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context, checkMode);
74903
- inferTypes(context.inferences, spreadType, restType);
74930
+ inferTypes(context, context.inferences, spreadType, restType);
74904
74931
  }
74905
74932
  return getInferredTypes(context);
74906
74933
  }
@@ -76783,8 +76810,8 @@ function createTypeChecker(host) {
76783
76810
  grammarErrorOnNode(node, Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
76784
76811
  }
76785
76812
  if (compilerOptions.erasableSyntaxOnly) {
76786
- const start = node.type.pos - "<".length;
76787
- const end = skipTrivia(file.text, node.type.end) + ">".length;
76813
+ const start = skipTrivia(file.text, node.pos);
76814
+ const end = node.expression.pos;
76788
76815
  diagnostics.add(createFileDiagnostic(file, start, end - start, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled));
76789
76816
  }
76790
76817
  }
@@ -77273,14 +77300,14 @@ function createTypeChecker(host) {
77273
77300
  isOptionalDeclaration(declaration)
77274
77301
  );
77275
77302
  const target = getTypeAtPosition(context, i);
77276
- inferTypes(inferenceContext.inferences, source, target);
77303
+ inferTypes(inferenceContext, inferenceContext.inferences, source, target);
77277
77304
  }
77278
77305
  }
77279
77306
  const typeNode = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
77280
77307
  if (typeNode) {
77281
77308
  const source = getTypeFromTypeNode(typeNode);
77282
77309
  const target = getReturnTypeOfSignature(context);
77283
- inferTypes(inferenceContext.inferences, source, target);
77310
+ inferTypes(inferenceContext, inferenceContext.inferences, source, target);
77284
77311
  }
77285
77312
  }
77286
77313
  function assignContextualParameterTypes(signature, context) {
@@ -79696,6 +79723,7 @@ function createTypeChecker(host) {
79696
79723
  const inferences = map(context.inferences, (info) => createInferenceInfo(info.typeParameter));
79697
79724
  applyToParameterTypes(instantiatedSignature, contextualSignature, (source, target) => {
79698
79725
  inferTypes(
79726
+ context,
79699
79727
  inferences,
79700
79728
  source,
79701
79729
  target,
@@ -79707,7 +79735,7 @@ function createTypeChecker(host) {
79707
79735
  });
79708
79736
  if (some(inferences, hasInferenceCandidates)) {
79709
79737
  applyToReturnTypes(instantiatedSignature, contextualSignature, (source, target) => {
79710
- inferTypes(inferences, source, target);
79738
+ inferTypes(context, inferences, source, target);
79711
79739
  });
79712
79740
  if (!hasOverlappingInferences(context.inferences, inferences)) {
79713
79741
  mergeInferences(context.inferences, inferences);
@@ -89276,33 +89304,6 @@ function createTypeChecker(host) {
89276
89304
  Debug.assert(specifier && nodeIsSynthesized(specifier) && specifier.text === "tslib", `Expected sourceFile.imports[0] to be the synthesized tslib import`);
89277
89305
  return specifier;
89278
89306
  }
89279
- function compareSymbols(s1, s2) {
89280
- if (s1 === s2) return 0;
89281
- if (s1 === void 0) return 1;
89282
- if (s2 === void 0) return -1;
89283
- if (length(s1.declarations) !== 0 && length(s2.declarations) !== 0) {
89284
- const r2 = compareNodes(s1.declarations[0], s2.declarations[0]);
89285
- if (r2 !== 0) return r2;
89286
- } else if (length(s1.declarations) !== 0) {
89287
- return -1;
89288
- } else if (length(s2.declarations) !== 0) {
89289
- return 1;
89290
- }
89291
- const r = compareComparableValues(s1.escapedName, s2.escapedName);
89292
- if (r !== 0) return r;
89293
- return getSymbolId(s1) - getSymbolId(s2);
89294
- }
89295
- function compareNodes(n1, n2) {
89296
- if (n1 === n2) return 0;
89297
- if (n1 === void 0) return 1;
89298
- if (n2 === void 0) return -1;
89299
- const f1 = fileIndexMap.get(getSourceFileOfNode(n1));
89300
- const f2 = fileIndexMap.get(getSourceFileOfNode(n2));
89301
- if (f1 !== f2) {
89302
- return f1 - f2;
89303
- }
89304
- return n1.pos - n2.pos;
89305
- }
89306
89307
  }
89307
89308
  function isNotAccessor(declaration) {
89308
89309
  return !isAccessor(declaration);
@@ -132244,12 +132245,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
132244
132245
  return withNewScope(context, node, () => serializeTypeAnnotationOfDeclaration(accessorType, context, node, symbol) ?? inferTypeOfDeclaration(node, symbol, context));
132245
132246
  }
132246
132247
  if (accessorDeclarations.getAccessor) {
132247
- return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(
132248
- accessorDeclarations.getAccessor,
132249
- /*symbol*/
132250
- void 0,
132251
- context
132252
- ));
132248
+ return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(accessorDeclarations.getAccessor, symbol, context));
132253
132249
  }
132254
132250
  return void 0;
132255
132251
  }
@@ -132359,14 +132355,14 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
132359
132355
  }
132360
132356
  return resolver.serializeTypeOfExpression(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
132361
132357
  }
132362
- function inferReturnTypeOfSignatureSignature(node, context, reportFallback) {
132358
+ function inferReturnTypeOfSignatureSignature(node, context, symbol, reportFallback) {
132363
132359
  if (reportFallback) {
132364
132360
  context.tracker.reportInferenceFallback(node);
132365
132361
  }
132366
132362
  if (context.noInferenceFallback === true) {
132367
132363
  return factory.createKeywordTypeNode(133 /* AnyKeyword */);
132368
132364
  }
132369
- return resolver.serializeReturnTypeForSignature(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
132365
+ return resolver.serializeReturnTypeForSignature(context, node, symbol) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
132370
132366
  }
132371
132367
  function inferAccessorType(node, allAccessors, context, symbol, reportFallback = true) {
132372
132368
  if (node.kind === 177 /* GetAccessor */) {
@@ -132801,7 +132797,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
132801
132797
  } else if (isValueSignatureDeclaration(fn)) {
132802
132798
  returnType = typeFromSingleReturnExpression(fn, context);
132803
132799
  }
132804
- return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, reportFallback && returnType.reportFallback && !returnTypeNode);
132800
+ return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, symbol, reportFallback && returnType.reportFallback && !returnTypeNode);
132805
132801
  }
132806
132802
  function typeFromSingleReturnExpression(declaration, context) {
132807
132803
  let candidateExpr;
package/lib/typescript.js CHANGED
@@ -298,7 +298,6 @@ __export(typescript_exports, {
298
298
  commonOptionsWithBuild: () => commonOptionsWithBuild,
299
299
  compact: () => compact,
300
300
  compareBooleans: () => compareBooleans,
301
- compareComparableValues: () => compareComparableValues,
302
301
  compareDataObjects: () => compareDataObjects,
303
302
  compareDiagnostics: () => compareDiagnostics,
304
303
  compareEmitHelpers: () => compareEmitHelpers,
@@ -2271,6 +2270,7 @@ __export(typescript_exports, {
2271
2270
  visitNode: () => visitNode,
2272
2271
  visitNodes: () => visitNodes2,
2273
2272
  visitParameterList: () => visitParameterList,
2273
+ voidMap: () => voidMap,
2274
2274
  walkUpBindingElementsAndPatterns: () => walkUpBindingElementsAndPatterns,
2275
2275
  walkUpOuterExpressions: () => walkUpOuterExpressions,
2276
2276
  walkUpParenthesizedExpressions: () => walkUpParenthesizedExpressions,
@@ -2286,7 +2286,7 @@ module.exports = __toCommonJS(typescript_exports);
2286
2286
 
2287
2287
  // src/compiler/corePublic.ts
2288
2288
  var versionMajorMinor = "5.9";
2289
- var version = `${versionMajorMinor}.0-insiders.20250314`;
2289
+ var version = `${versionMajorMinor}.0-insiders.20250401`;
2290
2290
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2291
2291
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2292
2292
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -2297,6 +2297,10 @@ var Comparison = /* @__PURE__ */ ((Comparison3) => {
2297
2297
  // src/compiler/core.ts
2298
2298
  var emptyArray = [];
2299
2299
  var emptyMap = /* @__PURE__ */ new Map();
2300
+ var voidMap = /* @__PURE__ */ new Map();
2301
+ voidMap.set = function() {
2302
+ return this;
2303
+ };
2300
2304
  function length(array) {
2301
2305
  return array !== void 0 ? array.length : 0;
2302
2306
  }
@@ -49413,6 +49417,8 @@ function getContainerFlags(node) {
49413
49417
  case 185 /* ConstructorType */:
49414
49418
  case 175 /* ClassStaticBlockDeclaration */:
49415
49419
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
49420
+ case 351 /* JSDocImportTag */:
49421
+ return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
49416
49422
  case 218 /* FunctionExpression */:
49417
49423
  case 219 /* ArrowFunction */:
49418
49424
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */;
@@ -50774,7 +50780,6 @@ function createTypeChecker(host) {
50774
50780
  };
50775
50781
  var cancellationToken;
50776
50782
  var scanner2;
50777
- var fileIndexMap = new Map(host.getSourceFiles().map((file, i) => [file, i]));
50778
50783
  var Symbol48 = objectAllocator.getSymbolConstructor();
50779
50784
  var Type29 = objectAllocator.getTypeConstructor();
50780
50785
  var Signature13 = objectAllocator.getSignatureConstructor();
@@ -51428,6 +51433,7 @@ function createTypeChecker(host) {
51428
51433
  var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
51429
51434
  var numericStringType = getTemplateLiteralType(["", ""], [numberType]);
51430
51435
  var restrictiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t, () => "(restrictive mapper)");
51436
+ restrictiveMapper.instantiations = voidMap;
51431
51437
  var permissiveMapper = makeFunctionTypeMapper((t) => t.flags & 262144 /* TypeParameter */ ? wildcardType : t, () => "(permissive mapper)");
51432
51438
  var uniqueLiteralType = createIntrinsicType(
51433
51439
  131072 /* Never */,
@@ -51447,6 +51453,7 @@ function createTypeChecker(host) {
51447
51453
  }
51448
51454
  return t;
51449
51455
  }, () => "(unmeasurable reporter)");
51456
+ reportUnreliableMapper.instantiations = voidMap;
51450
51457
  var reportUnmeasurableMapper = makeFunctionTypeMapper((t) => {
51451
51458
  if (outofbandVarianceMarkerHandler && (t === markerSuperType || t === markerSubType || t === markerOtherType)) {
51452
51459
  outofbandVarianceMarkerHandler(
@@ -51456,6 +51463,7 @@ function createTypeChecker(host) {
51456
51463
  }
51457
51464
  return t;
51458
51465
  }, () => "(unreliable reporter)");
51466
+ reportUnmeasurableMapper.instantiations = voidMap;
51459
51467
  var emptyObjectType = createAnonymousType(
51460
51468
  /*symbol*/
51461
51469
  void 0,
@@ -54413,7 +54421,6 @@ function createTypeChecker(host) {
54413
54421
  (result || (result = [])).push(symbol);
54414
54422
  }
54415
54423
  });
54416
- result == null ? void 0 : result.sort(compareSymbols);
54417
54424
  return result || emptyArray;
54418
54425
  }
54419
54426
  function isNamedMember(member, escapedName) {
@@ -55019,10 +55026,11 @@ function createTypeChecker(host) {
55019
55026
  serializeExistingTypeNode(context, typeNode, addUndefined) {
55020
55027
  return serializeExistingTypeNode(context, typeNode, !!addUndefined);
55021
55028
  },
55022
- serializeReturnTypeForSignature(syntacticContext, signatureDeclaration) {
55029
+ serializeReturnTypeForSignature(syntacticContext, signatureDeclaration, symbol) {
55023
55030
  const context = syntacticContext;
55024
55031
  const signature = getSignatureFromDeclaration(signatureDeclaration);
55025
- const returnType = context.enclosingSymbolTypes.get(getSymbolId(getSymbolOfDeclaration(signatureDeclaration))) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
55032
+ symbol ?? (symbol = getSymbolOfDeclaration(signatureDeclaration));
55033
+ const returnType = context.enclosingSymbolTypes.get(getSymbolId(symbol)) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
55026
55034
  return serializeInferredReturnTypeForSignature(context, signature, returnType);
55027
55035
  },
55028
55036
  serializeTypeOfExpression(syntacticContext, expr) {
@@ -55036,7 +55044,7 @@ function createTypeChecker(host) {
55036
55044
  symbol ?? (symbol = getSymbolOfDeclaration(declaration));
55037
55045
  let type = (_a = context.enclosingSymbolTypes) == null ? void 0 : _a.get(getSymbolId(symbol));
55038
55046
  if (type === void 0) {
55039
- type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
55047
+ type = symbol.flags & 98304 /* Accessor */ && declaration.kind === 178 /* SetAccessor */ ? instantiateType(getWriteTypeOfSymbol(symbol), context.mapper) : symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
55040
55048
  }
55041
55049
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
55042
55050
  if (addUndefinedForParameter) {
@@ -56185,12 +56193,13 @@ function createTypeChecker(host) {
56185
56193
  if (propertySymbol.flags & 98304 /* Accessor */) {
56186
56194
  const writeType = getWriteTypeOfSymbol(propertySymbol);
56187
56195
  if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
56196
+ const symbolMapper = getSymbolLinks(propertySymbol).mapper;
56188
56197
  const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
56189
56198
  const getterSignature = getSignatureFromDeclaration(getterDeclaration);
56190
56199
  typeElements.push(
56191
56200
  setCommentRange2(
56192
56201
  context,
56193
- signatureToSignatureDeclarationHelper(getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
56202
+ signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(getterSignature, symbolMapper) : getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
56194
56203
  getterDeclaration
56195
56204
  )
56196
56205
  );
@@ -56199,7 +56208,7 @@ function createTypeChecker(host) {
56199
56208
  typeElements.push(
56200
56209
  setCommentRange2(
56201
56210
  context,
56202
- signatureToSignatureDeclarationHelper(setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
56211
+ signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(setterSignature, symbolMapper) : setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
56203
56212
  setterDeclaration
56204
56213
  )
56205
56214
  );
@@ -57342,13 +57351,13 @@ function createTypeChecker(host) {
57342
57351
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
57343
57352
  const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
57344
57353
  if (decl) {
57354
+ const restore = addSymbolTypeToContext(context, symbol, type);
57345
57355
  if (isAccessor(decl)) {
57346
57356
  result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
57347
57357
  } else if (hasInferredType(decl) && !nodeIsSynthesized(decl) && !(getObjectFlags(type) & 196608 /* RequiresWidening */)) {
57348
- const restore = addSymbolTypeToContext(context, symbol, type);
57349
57358
  result = syntacticNodeBuilder.serializeTypeOfDeclaration(decl, symbol, context);
57350
- restore();
57351
57359
  }
57360
+ restore();
57352
57361
  }
57353
57362
  if (!result) {
57354
57363
  if (addUndefinedForParameter) {
@@ -66300,7 +66309,7 @@ function createTypeChecker(host) {
66300
66309
  context.nonFixingMapper = combineTypeMappers(context.nonFixingMapper, mapper);
66301
66310
  }
66302
66311
  if (!checkTypeDeferred) {
66303
- inferTypes(context.inferences, checkType, extendsType, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
66312
+ inferTypes(context, context.inferences, checkType, extendsType, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
66304
66313
  }
66305
66314
  combinedMapper = mapper ? combineTypeMappers(context.mapper, mapper) : context.mapper;
66306
66315
  }
@@ -67309,7 +67318,7 @@ function createTypeChecker(host) {
67309
67318
  ) : type;
67310
67319
  }
67311
67320
  function instantiateTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
67312
- var _a;
67321
+ var _a, _b;
67313
67322
  if (!couldContainTypeVariables(type)) {
67314
67323
  return type;
67315
67324
  }
@@ -67318,10 +67327,16 @@ function createTypeChecker(host) {
67318
67327
  error2(currentNode, Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
67319
67328
  return errorType;
67320
67329
  }
67330
+ const key = type.id + getAliasId(aliasSymbol, aliasTypeArguments);
67331
+ const cached = (mapper.instantiations ?? (mapper.instantiations = /* @__PURE__ */ new Map())).get(key);
67332
+ if (cached) {
67333
+ return cached;
67334
+ }
67321
67335
  totalInstantiationCount++;
67322
67336
  instantiationCount++;
67323
67337
  instantiationDepth++;
67324
67338
  const result = instantiateTypeWorker(type, mapper, aliasSymbol, aliasTypeArguments);
67339
+ (_b = mapper.instantiations) == null ? void 0 : _b.set(key, result);
67325
67340
  instantiationDepth--;
67326
67341
  return result;
67327
67342
  }
@@ -69944,7 +69959,7 @@ function createTypeChecker(host) {
69944
69959
  0 /* None */,
69945
69960
  isRelatedToWorker
69946
69961
  );
69947
- inferTypes(ctx.inferences, target2.extendsType, sourceExtends, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
69962
+ inferTypes(ctx, ctx.inferences, target2.extendsType, sourceExtends, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
69948
69963
  sourceExtends = instantiateType(sourceExtends, ctx.mapper);
69949
69964
  mapper = ctx.mapper;
69950
69965
  }
@@ -71824,7 +71839,7 @@ function createTypeChecker(host) {
71824
71839
  map(context.inferences, (inference, i) => () => {
71825
71840
  if (!inference.isFixed) {
71826
71841
  inferFromIntraExpressionSites(context);
71827
- clearCachedInferences(context.inferences);
71842
+ clearCachedInferences(context, context.inferences);
71828
71843
  inference.isFixed = true;
71829
71844
  }
71830
71845
  return getInferredType(context, i);
@@ -71839,7 +71854,10 @@ function createTypeChecker(host) {
71839
71854
  })
71840
71855
  );
71841
71856
  }
71842
- function clearCachedInferences(inferences) {
71857
+ function clearCachedInferences(context, inferences) {
71858
+ if (context) {
71859
+ context.nonFixingMapper.instantiations = void 0;
71860
+ }
71843
71861
  for (const inference of inferences) {
71844
71862
  if (!inference.isFixed) {
71845
71863
  inference.inferredType = void 0;
@@ -71854,7 +71872,7 @@ function createTypeChecker(host) {
71854
71872
  for (const { node, type } of context.intraExpressionInferenceSites) {
71855
71873
  const contextualType = node.kind === 174 /* MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* NoConstraints */) : getContextualType2(node, 2 /* NoConstraints */);
71856
71874
  if (contextualType) {
71857
- inferTypes(context.inferences, type, contextualType);
71875
+ inferTypes(context, context.inferences, type, contextualType);
71858
71876
  }
71859
71877
  }
71860
71878
  context.intraExpressionInferenceSites = void 0;
@@ -71998,7 +72016,13 @@ function createTypeChecker(host) {
71998
72016
  const typeParameter = getIndexedAccessType(constraint.type, getTypeParameterFromMappedType(target));
71999
72017
  const templateType = getTemplateTypeFromMappedType(target);
72000
72018
  const inference = createInferenceInfo(typeParameter);
72001
- inferTypes([inference], sourceType, templateType);
72019
+ inferTypes(
72020
+ /*context*/
72021
+ void 0,
72022
+ [inference],
72023
+ sourceType,
72024
+ templateType
72025
+ );
72002
72026
  return getTypeFromInference(inference) || unknownType;
72003
72027
  }
72004
72028
  function inferReverseMappedType(source, target, constraint) {
@@ -72200,7 +72224,7 @@ function createTypeChecker(host) {
72200
72224
  function isTupleOfSelf(typeParameter, type) {
72201
72225
  return isTupleType(type) && getTupleElementType(type, 0) === getIndexedAccessType(typeParameter, getNumberLiteralType(0)) && !getTypeOfPropertyOfType(type, "1");
72202
72226
  }
72203
- function inferTypes(inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
72227
+ function inferTypes(context, inferences, originalSource, originalTarget, priority = 0 /* None */, contravariant = false) {
72204
72228
  let bivariant = false;
72205
72229
  let propagationType;
72206
72230
  let inferencePriority = 2048 /* MaxValue */;
@@ -72291,16 +72315,16 @@ function createTypeChecker(host) {
72291
72315
  if (contravariant && !bivariant) {
72292
72316
  if (!contains(inference.contraCandidates, candidate)) {
72293
72317
  inference.contraCandidates = append(inference.contraCandidates, candidate);
72294
- clearCachedInferences(inferences);
72318
+ clearCachedInferences(context, inferences);
72295
72319
  }
72296
72320
  } else if (!contains(inference.candidates, candidate)) {
72297
72321
  inference.candidates = append(inference.candidates, candidate);
72298
- clearCachedInferences(inferences);
72322
+ clearCachedInferences(context, inferences);
72299
72323
  }
72300
72324
  }
72301
72325
  if (!(priority & 128 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
72302
72326
  inference.topLevel = false;
72303
- clearCachedInferences(inferences);
72327
+ clearCachedInferences(context, inferences);
72304
72328
  }
72305
72329
  }
72306
72330
  inferencePriority = Math.min(inferencePriority, priority);
@@ -72866,6 +72890,7 @@ function createTypeChecker(host) {
72866
72890
  const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
72867
72891
  if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
72868
72892
  inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
72893
+ context.nonFixingMapper.instantiations = void 0;
72869
72894
  }
72870
72895
  }
72871
72896
  }
@@ -78993,7 +79018,7 @@ function createTypeChecker(host) {
78993
79018
  addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
78994
79019
  }
78995
79020
  function containerSeemsToBeEmptyDomElement(containingType) {
78996
- return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(?:EventTarget|Node|(?:HTML[a-zA-Z]*)?Element)$/.test(unescapeLeadingUnderscores(type.symbol.escapedName))) && isEmptyObjectType(containingType);
79021
+ return compilerOptions.lib && !compilerOptions.lib.includes("lib.dom.d.ts") && everyContainedType(containingType, (type) => type.symbol && /^(?:EventTarget|Node|(?:HTML[a-zA-Z]*)?Element)$/.test(unescapeLeadingUnderscores(type.symbol.escapedName))) && isEmptyObjectType(containingType);
78997
79022
  }
78998
79023
  function typeHasStaticProperty(propName, containingType) {
78999
79024
  const prop = containingType.symbol && getPropertyOfType(getTypeOfSymbol(containingType.symbol), propName);
@@ -79048,13 +79073,15 @@ function createTypeChecker(host) {
79048
79073
  function getSuggestionForSymbolNameLookup(symbols, name, meaning) {
79049
79074
  const symbol = getSymbol2(symbols, name, meaning);
79050
79075
  if (symbol) return symbol;
79051
- let candidates = arrayFrom(symbols.values()).sort(compareSymbols);
79076
+ let candidates;
79052
79077
  if (symbols === globals) {
79053
79078
  const primitives = mapDefined(
79054
79079
  ["string", "number", "boolean", "object", "bigint", "symbol"],
79055
79080
  (s) => symbols.has(s.charAt(0).toUpperCase() + s.slice(1)) ? createSymbol(524288 /* TypeAlias */, s) : void 0
79056
79081
  );
79057
- candidates = concatenate(candidates, primitives);
79082
+ candidates = primitives.concat(arrayFrom(symbols.values()));
79083
+ } else {
79084
+ candidates = arrayFrom(symbols.values());
79058
79085
  }
79059
79086
  return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning);
79060
79087
  }
@@ -79074,7 +79101,7 @@ function createTypeChecker(host) {
79074
79101
  return result;
79075
79102
  }
79076
79103
  function getSuggestedSymbolForNonexistentModule(name, targetModule) {
79077
- return targetModule.exports && getSpellingSuggestionForName(idText(name), getExportsOfModuleAsArray(targetModule).sort(compareSymbols), 2623475 /* ModuleMember */);
79104
+ return targetModule.exports && getSpellingSuggestionForName(idText(name), getExportsOfModuleAsArray(targetModule), 2623475 /* ModuleMember */);
79078
79105
  }
79079
79106
  function getSuggestionForNonexistentIndexSignature(objectType, expr, keyedType) {
79080
79107
  function hasProp(name) {
@@ -79438,11 +79465,11 @@ function createTypeChecker(host) {
79438
79465
  const mapper = inferenceContext && (restType && restType.flags & 262144 /* TypeParameter */ ? inferenceContext.nonFixingMapper : inferenceContext.mapper);
79439
79466
  const sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
79440
79467
  applyToParameterTypes(sourceSignature, signature, (source, target) => {
79441
- inferTypes(context.inferences, source, target);
79468
+ inferTypes(context, context.inferences, source, target);
79442
79469
  });
79443
79470
  if (!inferenceContext) {
79444
79471
  applyToReturnTypes(contextualSignature, signature, (source, target) => {
79445
- inferTypes(context.inferences, source, target, 128 /* ReturnType */);
79472
+ inferTypes(context, context.inferences, source, target, 128 /* ReturnType */);
79446
79473
  });
79447
79474
  }
79448
79475
  return getSignatureInstantiation(signature, getInferredTypes(context), isInJSFile(contextualSignature.declaration));
@@ -79450,7 +79477,7 @@ function createTypeChecker(host) {
79450
79477
  function inferJsxTypeArguments(node, signature, checkMode, context) {
79451
79478
  const paramType = getEffectiveFirstArgumentForJsxSignature(signature, node);
79452
79479
  const checkAttrType = checkExpressionWithContextualType(node.attributes, paramType, context, checkMode);
79453
- inferTypes(context.inferences, checkAttrType, paramType);
79480
+ inferTypes(context, context.inferences, checkAttrType, paramType);
79454
79481
  return getInferredTypes(context);
79455
79482
  }
79456
79483
  function getThisArgumentType(thisArgumentNode) {
@@ -79477,11 +79504,11 @@ function createTypeChecker(host) {
79477
79504
  const instantiatedType = instantiateType(contextualType, outerMapper);
79478
79505
  const contextualSignature = getSingleCallSignature(instantiatedType);
79479
79506
  const inferenceSourceType = contextualSignature && contextualSignature.typeParameters ? getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) : instantiatedType;
79480
- inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
79507
+ inferTypes(context, context.inferences, inferenceSourceType, inferenceTargetType, 128 /* ReturnType */);
79481
79508
  }
79482
79509
  const returnContext = createInferenceContext(signature.typeParameters, signature, context.flags);
79483
79510
  const returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
79484
- inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);
79511
+ inferTypes(returnContext, returnContext.inferences, returnSourceType, inferenceTargetType);
79485
79512
  context.returnMapper = some(returnContext.inferences, hasInferenceCandidates) ? getMapperFromContext(cloneInferredPartOfContext(returnContext)) : void 0;
79486
79513
  }
79487
79514
  }
@@ -79497,7 +79524,7 @@ function createTypeChecker(host) {
79497
79524
  const thisType = getThisTypeOfSignature(signature);
79498
79525
  if (thisType && couldContainTypeVariables(thisType)) {
79499
79526
  const thisArgumentNode = getThisArgumentOfCall(node);
79500
- inferTypes(context.inferences, getThisArgumentType(thisArgumentNode), thisType);
79527
+ inferTypes(context, context.inferences, getThisArgumentType(thisArgumentNode), thisType);
79501
79528
  }
79502
79529
  for (let i = 0; i < argCount; i++) {
79503
79530
  const arg = args[i];
@@ -79505,13 +79532,13 @@ function createTypeChecker(host) {
79505
79532
  const paramType = getTypeAtPosition(signature, i);
79506
79533
  if (couldContainTypeVariables(paramType)) {
79507
79534
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
79508
- inferTypes(context.inferences, argType, paramType);
79535
+ inferTypes(context, context.inferences, argType, paramType);
79509
79536
  }
79510
79537
  }
79511
79538
  }
79512
79539
  if (restType && couldContainTypeVariables(restType)) {
79513
79540
  const spreadType = getSpreadArgumentType(args, argCount, args.length, restType, context, checkMode);
79514
- inferTypes(context.inferences, spreadType, restType);
79541
+ inferTypes(context, context.inferences, spreadType, restType);
79515
79542
  }
79516
79543
  return getInferredTypes(context);
79517
79544
  }
@@ -81394,8 +81421,8 @@ function createTypeChecker(host) {
81394
81421
  grammarErrorOnNode(node, Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
81395
81422
  }
81396
81423
  if (compilerOptions.erasableSyntaxOnly) {
81397
- const start = node.type.pos - "<".length;
81398
- const end = skipTrivia(file.text, node.type.end) + ">".length;
81424
+ const start = skipTrivia(file.text, node.pos);
81425
+ const end = node.expression.pos;
81399
81426
  diagnostics.add(createFileDiagnostic(file, start, end - start, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled));
81400
81427
  }
81401
81428
  }
@@ -81884,14 +81911,14 @@ function createTypeChecker(host) {
81884
81911
  isOptionalDeclaration(declaration)
81885
81912
  );
81886
81913
  const target = getTypeAtPosition(context, i);
81887
- inferTypes(inferenceContext.inferences, source, target);
81914
+ inferTypes(inferenceContext, inferenceContext.inferences, source, target);
81888
81915
  }
81889
81916
  }
81890
81917
  const typeNode = signature.declaration && getEffectiveReturnTypeNode(signature.declaration);
81891
81918
  if (typeNode) {
81892
81919
  const source = getTypeFromTypeNode(typeNode);
81893
81920
  const target = getReturnTypeOfSignature(context);
81894
- inferTypes(inferenceContext.inferences, source, target);
81921
+ inferTypes(inferenceContext, inferenceContext.inferences, source, target);
81895
81922
  }
81896
81923
  }
81897
81924
  function assignContextualParameterTypes(signature, context) {
@@ -84307,6 +84334,7 @@ function createTypeChecker(host) {
84307
84334
  const inferences = map(context.inferences, (info) => createInferenceInfo(info.typeParameter));
84308
84335
  applyToParameterTypes(instantiatedSignature, contextualSignature, (source, target) => {
84309
84336
  inferTypes(
84337
+ context,
84310
84338
  inferences,
84311
84339
  source,
84312
84340
  target,
@@ -84318,7 +84346,7 @@ function createTypeChecker(host) {
84318
84346
  });
84319
84347
  if (some(inferences, hasInferenceCandidates)) {
84320
84348
  applyToReturnTypes(instantiatedSignature, contextualSignature, (source, target) => {
84321
- inferTypes(inferences, source, target);
84349
+ inferTypes(context, inferences, source, target);
84322
84350
  });
84323
84351
  if (!hasOverlappingInferences(context.inferences, inferences)) {
84324
84352
  mergeInferences(context.inferences, inferences);
@@ -93887,33 +93915,6 @@ function createTypeChecker(host) {
93887
93915
  Debug.assert(specifier && nodeIsSynthesized(specifier) && specifier.text === "tslib", `Expected sourceFile.imports[0] to be the synthesized tslib import`);
93888
93916
  return specifier;
93889
93917
  }
93890
- function compareSymbols(s1, s2) {
93891
- if (s1 === s2) return 0;
93892
- if (s1 === void 0) return 1;
93893
- if (s2 === void 0) return -1;
93894
- if (length(s1.declarations) !== 0 && length(s2.declarations) !== 0) {
93895
- const r2 = compareNodes(s1.declarations[0], s2.declarations[0]);
93896
- if (r2 !== 0) return r2;
93897
- } else if (length(s1.declarations) !== 0) {
93898
- return -1;
93899
- } else if (length(s2.declarations) !== 0) {
93900
- return 1;
93901
- }
93902
- const r = compareComparableValues(s1.escapedName, s2.escapedName);
93903
- if (r !== 0) return r;
93904
- return getSymbolId(s1) - getSymbolId(s2);
93905
- }
93906
- function compareNodes(n1, n2) {
93907
- if (n1 === n2) return 0;
93908
- if (n1 === void 0) return 1;
93909
- if (n2 === void 0) return -1;
93910
- const f1 = fileIndexMap.get(getSourceFileOfNode(n1));
93911
- const f2 = fileIndexMap.get(getSourceFileOfNode(n2));
93912
- if (f1 !== f2) {
93913
- return f1 - f2;
93914
- }
93915
- return n1.pos - n2.pos;
93916
- }
93917
93918
  }
93918
93919
  function isNotAccessor(declaration) {
93919
93920
  return !isAccessor(declaration);
@@ -137212,12 +137213,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
137212
137213
  return withNewScope(context, node, () => serializeTypeAnnotationOfDeclaration(accessorType, context, node, symbol) ?? inferTypeOfDeclaration(node, symbol, context));
137213
137214
  }
137214
137215
  if (accessorDeclarations.getAccessor) {
137215
- return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(
137216
- accessorDeclarations.getAccessor,
137217
- /*symbol*/
137218
- void 0,
137219
- context
137220
- ));
137216
+ return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(accessorDeclarations.getAccessor, symbol, context));
137221
137217
  }
137222
137218
  return void 0;
137223
137219
  }
@@ -137327,14 +137323,14 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
137327
137323
  }
137328
137324
  return resolver.serializeTypeOfExpression(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
137329
137325
  }
137330
- function inferReturnTypeOfSignatureSignature(node, context, reportFallback) {
137326
+ function inferReturnTypeOfSignatureSignature(node, context, symbol, reportFallback) {
137331
137327
  if (reportFallback) {
137332
137328
  context.tracker.reportInferenceFallback(node);
137333
137329
  }
137334
137330
  if (context.noInferenceFallback === true) {
137335
137331
  return factory.createKeywordTypeNode(133 /* AnyKeyword */);
137336
137332
  }
137337
- return resolver.serializeReturnTypeForSignature(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
137333
+ return resolver.serializeReturnTypeForSignature(context, node, symbol) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
137338
137334
  }
137339
137335
  function inferAccessorType(node, allAccessors, context, symbol, reportFallback = true) {
137340
137336
  if (node.kind === 177 /* GetAccessor */) {
@@ -137769,7 +137765,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
137769
137765
  } else if (isValueSignatureDeclaration(fn)) {
137770
137766
  returnType = typeFromSingleReturnExpression(fn, context);
137771
137767
  }
137772
- return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, reportFallback && returnType.reportFallback && !returnTypeNode);
137768
+ return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, symbol, reportFallback && returnType.reportFallback && !returnTypeNode);
137773
137769
  }
137774
137770
  function typeFromSingleReturnExpression(declaration, context) {
137775
137771
  let candidateExpr;
@@ -177413,7 +177409,10 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
177413
177409
  }
177414
177410
  if (symbolKind !== "" /* unknown */ || symbolFlags & 32 /* Class */ || symbolFlags & 2097152 /* Alias */) {
177415
177411
  if (symbolKind === "getter" /* memberGetAccessorElement */ || symbolKind === "setter" /* memberSetAccessorElement */) {
177416
- const declaration = find(symbol.declarations, (declaration2) => declaration2.name === location);
177412
+ const declaration = find(
177413
+ symbol.declarations,
177414
+ (declaration2) => declaration2.name === location && declaration2.kind !== 211 /* PropertyAccessExpression */
177415
+ );
177417
177416
  if (declaration) {
177418
177417
  switch (declaration.kind) {
177419
177418
  case 177 /* GetAccessor */:
@@ -182456,7 +182455,6 @@ __export(ts_exports2, {
182456
182455
  commonOptionsWithBuild: () => commonOptionsWithBuild,
182457
182456
  compact: () => compact,
182458
182457
  compareBooleans: () => compareBooleans,
182459
- compareComparableValues: () => compareComparableValues,
182460
182458
  compareDataObjects: () => compareDataObjects,
182461
182459
  compareDiagnostics: () => compareDiagnostics,
182462
182460
  compareEmitHelpers: () => compareEmitHelpers,
@@ -184429,6 +184427,7 @@ __export(ts_exports2, {
184429
184427
  visitNode: () => visitNode,
184430
184428
  visitNodes: () => visitNodes2,
184431
184429
  visitParameterList: () => visitParameterList,
184430
+ voidMap: () => voidMap,
184432
184431
  walkUpBindingElementsAndPatterns: () => walkUpBindingElementsAndPatterns,
184433
184432
  walkUpOuterExpressions: () => walkUpOuterExpressions,
184434
184433
  walkUpParenthesizedExpressions: () => walkUpParenthesizedExpressions,
@@ -197210,7 +197209,6 @@ if (typeof console !== "undefined") {
197210
197209
  commonOptionsWithBuild,
197211
197210
  compact,
197212
197211
  compareBooleans,
197213
- compareComparableValues,
197214
197212
  compareDataObjects,
197215
197213
  compareDiagnostics,
197216
197214
  compareEmitHelpers,
@@ -199183,6 +199181,7 @@ if (typeof console !== "undefined") {
199183
199181
  visitNode,
199184
199182
  visitNodes,
199185
199183
  visitParameterList,
199184
+ voidMap,
199186
199185
  walkUpBindingElementsAndPatterns,
199187
199186
  walkUpOuterExpressions,
199188
199187
  walkUpParenthesizedExpressions,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.9.0-pr-61420-2",
5
+ "version": "5.9.0-pr-61505-16",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [