@typescript-deploys/pr-build 5.9.0-pr-61420-2 → 5.9.0-pr-61359-4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/lib/_tsc.js +479 -67
  2. package/lib/typescript.js +479 -70
  3. package/package.json +1 -1
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,
@@ -2286,7 +2285,7 @@ module.exports = __toCommonJS(typescript_exports);
2286
2285
 
2287
2286
  // src/compiler/corePublic.ts
2288
2287
  var versionMajorMinor = "5.9";
2289
- var version = `${versionMajorMinor}.0-insiders.20250314`;
2288
+ var version = `${versionMajorMinor}.0-insiders.20250320`;
2290
2289
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2291
2290
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2292
2291
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6539,6 +6538,7 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
6539
6538
  ObjectFlags3[ObjectFlags3["IsGenericObjectType"] = 4194304] = "IsGenericObjectType";
6540
6539
  ObjectFlags3[ObjectFlags3["IsGenericIndexType"] = 8388608] = "IsGenericIndexType";
6541
6540
  ObjectFlags3[ObjectFlags3["IsGenericType"] = 12582912] = "IsGenericType";
6541
+ ObjectFlags3[ObjectFlags3["IsNarrowingType"] = 16777216] = "IsNarrowingType";
6542
6542
  ObjectFlags3[ObjectFlags3["ContainsIntersections"] = 16777216] = "ContainsIntersections";
6543
6543
  ObjectFlags3[ObjectFlags3["IsUnknownLikeUnionComputed"] = 33554432] = "IsUnknownLikeUnionComputed";
6544
6544
  ObjectFlags3[ObjectFlags3["IsUnknownLikeUnion"] = 67108864] = "IsUnknownLikeUnion";
@@ -49413,6 +49413,8 @@ function getContainerFlags(node) {
49413
49413
  case 185 /* ConstructorType */:
49414
49414
  case 175 /* ClassStaticBlockDeclaration */:
49415
49415
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
49416
+ case 351 /* JSDocImportTag */:
49417
+ return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
49416
49418
  case 218 /* FunctionExpression */:
49417
49419
  case 219 /* ArrowFunction */:
49418
49420
  return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */;
@@ -50774,7 +50776,6 @@ function createTypeChecker(host) {
50774
50776
  };
50775
50777
  var cancellationToken;
50776
50778
  var scanner2;
50777
- var fileIndexMap = new Map(host.getSourceFiles().map((file, i) => [file, i]));
50778
50779
  var Symbol48 = objectAllocator.getSymbolConstructor();
50779
50780
  var Type29 = objectAllocator.getTypeConstructor();
50780
50781
  var Signature13 = objectAllocator.getSignatureConstructor();
@@ -51788,6 +51789,7 @@ function createTypeChecker(host) {
51788
51789
  [".jsx", ".jsx"],
51789
51790
  [".json", ".json"]
51790
51791
  ];
51792
+ var narrowableReturnTypeCache = /* @__PURE__ */ new Map();
51791
51793
  initializeTypeChecker();
51792
51794
  return checker;
51793
51795
  function isDefinitelyReferenceToGlobalSymbolObject(node) {
@@ -54413,7 +54415,6 @@ function createTypeChecker(host) {
54413
54415
  (result || (result = [])).push(symbol);
54414
54416
  }
54415
54417
  });
54416
- result == null ? void 0 : result.sort(compareSymbols);
54417
54418
  return result || emptyArray;
54418
54419
  }
54419
54420
  function isNamedMember(member, escapedName) {
@@ -55019,10 +55020,11 @@ function createTypeChecker(host) {
55019
55020
  serializeExistingTypeNode(context, typeNode, addUndefined) {
55020
55021
  return serializeExistingTypeNode(context, typeNode, !!addUndefined);
55021
55022
  },
55022
- serializeReturnTypeForSignature(syntacticContext, signatureDeclaration) {
55023
+ serializeReturnTypeForSignature(syntacticContext, signatureDeclaration, symbol) {
55023
55024
  const context = syntacticContext;
55024
55025
  const signature = getSignatureFromDeclaration(signatureDeclaration);
55025
- const returnType = context.enclosingSymbolTypes.get(getSymbolId(getSymbolOfDeclaration(signatureDeclaration))) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
55026
+ symbol ?? (symbol = getSymbolOfDeclaration(signatureDeclaration));
55027
+ const returnType = context.enclosingSymbolTypes.get(getSymbolId(symbol)) ?? instantiateType(getReturnTypeOfSignature(signature), context.mapper);
55026
55028
  return serializeInferredReturnTypeForSignature(context, signature, returnType);
55027
55029
  },
55028
55030
  serializeTypeOfExpression(syntacticContext, expr) {
@@ -55036,7 +55038,7 @@ function createTypeChecker(host) {
55036
55038
  symbol ?? (symbol = getSymbolOfDeclaration(declaration));
55037
55039
  let type = (_a = context.enclosingSymbolTypes) == null ? void 0 : _a.get(getSymbolId(symbol));
55038
55040
  if (type === void 0) {
55039
- type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? instantiateType(getWidenedLiteralType(getTypeOfSymbol(symbol)), context.mapper) : errorType;
55041
+ 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
55042
  }
55041
55043
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
55042
55044
  if (addUndefinedForParameter) {
@@ -56185,12 +56187,13 @@ function createTypeChecker(host) {
56185
56187
  if (propertySymbol.flags & 98304 /* Accessor */) {
56186
56188
  const writeType = getWriteTypeOfSymbol(propertySymbol);
56187
56189
  if (propertyType !== writeType && !isErrorType(propertyType) && !isErrorType(writeType)) {
56190
+ const symbolMapper = getSymbolLinks(propertySymbol).mapper;
56188
56191
  const getterDeclaration = getDeclarationOfKind(propertySymbol, 177 /* GetAccessor */);
56189
56192
  const getterSignature = getSignatureFromDeclaration(getterDeclaration);
56190
56193
  typeElements.push(
56191
56194
  setCommentRange2(
56192
56195
  context,
56193
- signatureToSignatureDeclarationHelper(getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
56196
+ signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(getterSignature, symbolMapper) : getterSignature, 177 /* GetAccessor */, context, { name: propertyName }),
56194
56197
  getterDeclaration
56195
56198
  )
56196
56199
  );
@@ -56199,7 +56202,7 @@ function createTypeChecker(host) {
56199
56202
  typeElements.push(
56200
56203
  setCommentRange2(
56201
56204
  context,
56202
- signatureToSignatureDeclarationHelper(setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
56205
+ signatureToSignatureDeclarationHelper(symbolMapper ? instantiateSignature(setterSignature, symbolMapper) : setterSignature, 178 /* SetAccessor */, context, { name: propertyName }),
56203
56206
  setterDeclaration
56204
56207
  )
56205
56208
  );
@@ -57342,13 +57345,13 @@ function createTypeChecker(host) {
57342
57345
  const addUndefinedForParameter = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration, context.enclosingDeclaration);
57343
57346
  const decl = declaration ?? symbol.valueDeclaration ?? getDeclarationWithTypeAnnotation(symbol) ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
57344
57347
  if (decl) {
57348
+ const restore = addSymbolTypeToContext(context, symbol, type);
57345
57349
  if (isAccessor(decl)) {
57346
57350
  result = syntacticNodeBuilder.serializeTypeOfAccessor(decl, symbol, context);
57347
57351
  } else if (hasInferredType(decl) && !nodeIsSynthesized(decl) && !(getObjectFlags(type) & 196608 /* RequiresWidening */)) {
57348
- const restore = addSymbolTypeToContext(context, symbol, type);
57349
57352
  result = syntacticNodeBuilder.serializeTypeOfDeclaration(decl, symbol, context);
57350
- restore();
57351
57353
  }
57354
+ restore();
57352
57355
  }
57353
57356
  if (!result) {
57354
57357
  if (addUndefinedForParameter) {
@@ -64050,11 +64053,14 @@ function createTypeChecker(host) {
64050
64053
  function isNoInferType(type) {
64051
64054
  return !!(type.flags & 33554432 /* Substitution */ && type.constraint.flags & 2 /* Unknown */);
64052
64055
  }
64053
- function getSubstitutionType(baseType, constraint) {
64054
- return constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */ ? baseType : getOrCreateSubstitutionType(baseType, constraint);
64056
+ function isNarrowingSubstitutionType(type) {
64057
+ return !!(type.flags & 33554432 /* Substitution */ && type.objectFlags & 16777216 /* IsNarrowingType */);
64055
64058
  }
64056
- function getOrCreateSubstitutionType(baseType, constraint) {
64057
- const id = `${getTypeId(baseType)}>${getTypeId(constraint)}`;
64059
+ function getSubstitutionType(baseType, constraint, isNarrowed) {
64060
+ return constraint.flags & 3 /* AnyOrUnknown */ || constraint === baseType || baseType.flags & 1 /* Any */ ? baseType : getOrCreateSubstitutionType(baseType, constraint, isNarrowed);
64061
+ }
64062
+ function getOrCreateSubstitutionType(baseType, constraint, isNarrowed) {
64063
+ const id = `${getTypeId(baseType)}>${getTypeId(constraint)}${isNarrowed ? ">N" : ""}`;
64058
64064
  const cached = substitutionTypes.get(id);
64059
64065
  if (cached) {
64060
64066
  return cached;
@@ -64062,6 +64068,9 @@ function createTypeChecker(host) {
64062
64068
  const result = createType(33554432 /* Substitution */);
64063
64069
  result.baseType = baseType;
64064
64070
  result.constraint = constraint;
64071
+ if (isNarrowed) {
64072
+ result.objectFlags |= 16777216 /* IsNarrowingType */;
64073
+ }
64065
64074
  substitutionTypes.set(id, result);
64066
64075
  return result;
64067
64076
  }
@@ -66267,7 +66276,7 @@ function createTypeChecker(host) {
66267
66276
  function isDeferredType(type, checkTuples) {
66268
66277
  return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
66269
66278
  }
66270
- function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments) {
66279
+ function getConditionalType(root, mapper, forConstraint, aliasSymbol, aliasTypeArguments, forNarrowing) {
66271
66280
  let result;
66272
66281
  let extraTypes;
66273
66282
  let tailCount = 0;
@@ -66284,10 +66293,11 @@ function createTypeChecker(host) {
66284
66293
  if (checkType === wildcardType || extendsType === wildcardType) {
66285
66294
  return wildcardType;
66286
66295
  }
66296
+ const effectiveCheckType = forNarrowing && isNarrowingSubstitutionType(checkType) ? checkType.constraint : checkType;
66287
66297
  const checkTypeNode = skipTypeParentheses(root.node.checkType);
66288
66298
  const extendsTypeNode = skipTypeParentheses(root.node.extendsType);
66289
66299
  const checkTuples = isSimpleTupleType(checkTypeNode) && isSimpleTupleType(extendsTypeNode) && length(checkTypeNode.elements) === length(extendsTypeNode.elements);
66290
- const checkTypeDeferred = isDeferredType(checkType, checkTuples);
66300
+ const checkTypeDeferred = isDeferredType(effectiveCheckType, checkTuples);
66291
66301
  let combinedMapper;
66292
66302
  if (root.inferTypeParameters) {
66293
66303
  const context = createInferenceContext(
@@ -66306,8 +66316,8 @@ function createTypeChecker(host) {
66306
66316
  }
66307
66317
  const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
66308
66318
  if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
66309
- if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
66310
- if (checkType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(checkType)))) {
66319
+ if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (effectiveCheckType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(effectiveCheckType), getPermissiveInstantiation(inferredExtendsType)))) {
66320
+ if (effectiveCheckType.flags & 1 /* Any */ || forConstraint && !(inferredExtendsType.flags & 131072 /* Never */) && someType(getPermissiveInstantiation(inferredExtendsType), (t) => isTypeAssignableTo(t, getPermissiveInstantiation(effectiveCheckType)))) {
66311
66321
  (extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
66312
66322
  }
66313
66323
  const falseType2 = getTypeFromTypeNode(root.node.falseType);
@@ -66324,7 +66334,7 @@ function createTypeChecker(host) {
66324
66334
  result = instantiateType(falseType2, mapper);
66325
66335
  break;
66326
66336
  }
66327
- if (inferredExtendsType.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(inferredExtendsType))) {
66337
+ if (inferredExtendsType.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(effectiveCheckType), getRestrictiveInstantiation(inferredExtendsType))) {
66328
66338
  const trueType2 = getTypeFromTypeNode(root.node.trueType);
66329
66339
  const trueMapper = combinedMapper || mapper;
66330
66340
  if (canTailRecurse(trueType2, trueMapper)) {
@@ -67290,8 +67300,44 @@ function createTypeChecker(host) {
67290
67300
  if (!result) {
67291
67301
  const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
67292
67302
  const checkType = root.checkType;
67293
- const distributionType = root.isDistributive ? getReducedType(getMappedType(checkType, newMapper)) : void 0;
67294
- result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(distributionType, (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments);
67303
+ let distributionType = root.isDistributive ? getReducedType(getMappedType(checkType, newMapper)) : void 0;
67304
+ let narrowingBaseType;
67305
+ const forNarrowing = distributionType && isNarrowingSubstitutionType(distributionType) && isNarrowableConditionalType(
67306
+ type,
67307
+ /*hadNonPrimitiveExtendsType*/
67308
+ [],
67309
+ mapper
67310
+ );
67311
+ if (forNarrowing) {
67312
+ narrowingBaseType = distributionType.baseType;
67313
+ distributionType = getReducedType(distributionType.constraint);
67314
+ }
67315
+ if (distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */)) {
67316
+ if (narrowingBaseType) {
67317
+ result = mapTypeToIntersection(
67318
+ distributionType,
67319
+ (t) => getConditionalType(
67320
+ root,
67321
+ prependTypeMapping(checkType, getSubstitutionType(
67322
+ narrowingBaseType,
67323
+ t,
67324
+ /*isNarrowed*/
67325
+ true
67326
+ ), newMapper),
67327
+ forConstraint,
67328
+ /*aliasSymbol*/
67329
+ void 0,
67330
+ /*aliasTypeArguments*/
67331
+ void 0,
67332
+ forNarrowing
67333
+ )
67334
+ );
67335
+ } else {
67336
+ result = mapTypeWithAlias(distributionType, (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper), forConstraint), aliasSymbol, aliasTypeArguments);
67337
+ }
67338
+ } else {
67339
+ result = getConditionalType(root, newMapper, forConstraint, aliasSymbol, aliasTypeArguments, forNarrowing);
67340
+ }
67295
67341
  root.instantiations.set(id, result);
67296
67342
  }
67297
67343
  return result;
@@ -68434,10 +68480,12 @@ function createTypeChecker(host) {
68434
68480
  function shouldNormalizeIntersection(type) {
68435
68481
  let hasInstantiable = false;
68436
68482
  let hasNullableOrEmpty = false;
68483
+ let hasSubstitution = false;
68437
68484
  for (const t of type.types) {
68438
68485
  hasInstantiable || (hasInstantiable = !!(t.flags & 465829888 /* Instantiable */));
68439
68486
  hasNullableOrEmpty || (hasNullableOrEmpty = !!(t.flags & 98304 /* Nullable */) || isEmptyAnonymousObjectType(t));
68440
- if (hasInstantiable && hasNullableOrEmpty) return true;
68487
+ hasSubstitution || (hasSubstitution = isNarrowingSubstitutionType(t));
68488
+ if (hasInstantiable && hasNullableOrEmpty || hasSubstitution) return true;
68441
68489
  }
68442
68490
  return false;
68443
68491
  }
@@ -73597,6 +73645,18 @@ function createTypeChecker(host) {
73597
73645
  }
73598
73646
  return changed ? mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : type;
73599
73647
  }
73648
+ function mapTypeToIntersection(type, mapper) {
73649
+ if (type.flags & 131072 /* Never */) {
73650
+ return type;
73651
+ }
73652
+ if (!(type.flags & 1048576 /* Union */)) {
73653
+ return mapper(type);
73654
+ }
73655
+ const origin = type.origin;
73656
+ const types = origin && origin.flags & 1048576 /* Union */ ? origin.types : type.types;
73657
+ const mappedTypes = types.map((t) => t.flags & 1048576 /* Union */ ? mapTypeToIntersection(t, mapper) : mapper(t));
73658
+ return getIntersectionType(mappedTypes);
73659
+ }
73600
73660
  function mapTypeWithAlias(type, mapper, aliasSymbol, aliasTypeArguments) {
73601
73661
  return type.flags & 1048576 /* Union */ && aliasSymbol ? getUnionType(map(type.types, mapper), 1 /* Literal */, aliasSymbol, aliasTypeArguments) : mapType(type, mapper);
73602
73662
  }
@@ -75181,11 +75241,11 @@ function createTypeChecker(host) {
75181
75241
  ));
75182
75242
  return contextualType && !isGenericType(contextualType);
75183
75243
  }
75184
- function getNarrowableTypeForReference(type, reference, checkMode) {
75244
+ function getNarrowableTypeForReference(type, reference, checkMode, forReturnTypeNarrowing) {
75185
75245
  if (isNoInferType(type)) {
75186
75246
  type = type.baseType;
75187
75247
  }
75188
- const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
75248
+ const substituteConstraints = !(checkMode && checkMode & 2 /* Inferential */) && someType(type, isGenericTypeWithUnionConstraint) && (forReturnTypeNarrowing || isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
75189
75249
  return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
75190
75250
  }
75191
75251
  function isExportOrExportExpression(location) {
@@ -76312,9 +76372,16 @@ function createTypeChecker(host) {
76312
76372
  function getContextualTypeForReturnExpression(node, contextFlags) {
76313
76373
  const func = getContainingFunction(node);
76314
76374
  if (func) {
76375
+ const functionFlags = getFunctionFlags(func);
76376
+ const links = getNodeLinks(node);
76377
+ if (links.contextualReturnType) {
76378
+ if (functionFlags & 2 /* Async */) {
76379
+ return getUnionType([links.contextualReturnType, createPromiseLikeType(links.contextualReturnType)]);
76380
+ }
76381
+ return links.contextualReturnType;
76382
+ }
76315
76383
  let contextualReturnType = getContextualReturnType(func, contextFlags);
76316
76384
  if (contextualReturnType) {
76317
- const functionFlags = getFunctionFlags(func);
76318
76385
  if (functionFlags & 1 /* Generator */) {
76319
76386
  const isAsyncGenerator = (functionFlags & 2 /* Async */) !== 0;
76320
76387
  if (contextualReturnType.flags & 1048576 /* Union */) {
@@ -77012,6 +77079,13 @@ function createTypeChecker(host) {
77012
77079
  if (index >= 0) {
77013
77080
  return contextualTypes[index];
77014
77081
  }
77082
+ const links = getNodeLinks(node);
77083
+ if (links.contextualReturnType) {
77084
+ if (node.flags & 65536 /* AwaitContext */) {
77085
+ return getUnionType([links.contextualReturnType, createPromiseLikeType(links.contextualReturnType)]);
77086
+ }
77087
+ return links.contextualReturnType;
77088
+ }
77015
77089
  const { parent: parent2 } = node;
77016
77090
  switch (parent2.kind) {
77017
77091
  case 260 /* VariableDeclaration */:
@@ -79048,13 +79122,15 @@ function createTypeChecker(host) {
79048
79122
  function getSuggestionForSymbolNameLookup(symbols, name, meaning) {
79049
79123
  const symbol = getSymbol2(symbols, name, meaning);
79050
79124
  if (symbol) return symbol;
79051
- let candidates = arrayFrom(symbols.values()).sort(compareSymbols);
79125
+ let candidates;
79052
79126
  if (symbols === globals) {
79053
79127
  const primitives = mapDefined(
79054
79128
  ["string", "number", "boolean", "object", "bigint", "symbol"],
79055
79129
  (s) => symbols.has(s.charAt(0).toUpperCase() + s.slice(1)) ? createSymbol(524288 /* TypeAlias */, s) : void 0
79056
79130
  );
79057
- candidates = concatenate(candidates, primitives);
79131
+ candidates = primitives.concat(arrayFrom(symbols.values()));
79132
+ } else {
79133
+ candidates = arrayFrom(symbols.values());
79058
79134
  }
79059
79135
  return getSpellingSuggestionForName(unescapeLeadingUnderscores(name), candidates, meaning);
79060
79136
  }
@@ -79074,7 +79150,7 @@ function createTypeChecker(host) {
79074
79150
  return result;
79075
79151
  }
79076
79152
  function getSuggestedSymbolForNonexistentModule(name, targetModule) {
79077
- return targetModule.exports && getSpellingSuggestionForName(idText(name), getExportsOfModuleAsArray(targetModule).sort(compareSymbols), 2623475 /* ModuleMember */);
79153
+ return targetModule.exports && getSpellingSuggestionForName(idText(name), getExportsOfModuleAsArray(targetModule), 2623475 /* ModuleMember */);
79078
79154
  }
79079
79155
  function getSuggestionForNonexistentIndexSignature(objectType, expr, keyedType) {
79080
79156
  function hasProp(name) {
@@ -81394,8 +81470,8 @@ function createTypeChecker(host) {
81394
81470
  grammarErrorOnNode(node, Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead);
81395
81471
  }
81396
81472
  if (compilerOptions.erasableSyntaxOnly) {
81397
- const start = node.type.pos - "<".length;
81398
- const end = skipTrivia(file.text, node.type.end) + ">".length;
81473
+ const start = skipTrivia(file.text, node.pos);
81474
+ const end = node.expression.pos;
81399
81475
  diagnostics.add(createFileDiagnostic(file, start, end - start, Diagnostics.This_syntax_is_not_allowed_when_erasableSyntaxOnly_is_enabled));
81400
81476
  }
81401
81477
  }
@@ -88024,7 +88100,374 @@ function createTypeChecker(host) {
88024
88100
  ) : exprType;
88025
88101
  const effectiveExpr = expr && getEffectiveCheckNode(expr);
88026
88102
  const errorNode = inReturnStatement && !inConditionalExpression ? node : effectiveExpr;
88027
- checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
88103
+ if (!(unwrappedReturnType.flags & (8388608 /* IndexedAccess */ | 16777216 /* Conditional */)) || !couldContainTypeVariables(unwrappedReturnType)) {
88104
+ checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
88105
+ return;
88106
+ }
88107
+ if (checkTypeAssignableTo(
88108
+ unwrappedExprType,
88109
+ unwrappedReturnType,
88110
+ /*errorNode*/
88111
+ void 0
88112
+ )) {
88113
+ return;
88114
+ }
88115
+ let narrowPosition = node;
88116
+ let narrowFlowNode = inReturnStatement && node.flowNode;
88117
+ if (expr && isConditionalExpression(expr.parent)) {
88118
+ narrowFlowNode = expr.parent.whenTrue === expr ? expr.parent.flowNodeWhenTrue : expr.parent.flowNodeWhenFalse;
88119
+ narrowPosition = expr;
88120
+ }
88121
+ if (!narrowFlowNode) {
88122
+ checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
88123
+ return;
88124
+ }
88125
+ const allTypeParameters = appendTypeParameters(getOuterTypeParameters(
88126
+ container,
88127
+ /*includeThisTypes*/
88128
+ false
88129
+ ), getEffectiveTypeParameterDeclarations(container));
88130
+ const narrowableTypeParameters = allTypeParameters && getNarrowableTypeParameters(allTypeParameters);
88131
+ if (!narrowableTypeParameters || !narrowableTypeParameters.length || !isNarrowableReturnType(unwrappedReturnType)) {
88132
+ checkTypeAssignableToAndOptionallyElaborate(unwrappedExprType, unwrappedReturnType, errorNode, effectiveExpr);
88133
+ return;
88134
+ }
88135
+ const narrowedTypeParameters = [];
88136
+ const narrowedTypes = [];
88137
+ for (const [typeParam, symbol, narrowReference] of narrowableTypeParameters) {
88138
+ resetNodeId(narrowReference);
88139
+ let baseReference = narrowReference;
88140
+ while (isAccessExpression(baseReference)) {
88141
+ baseReference = baseReference.expression;
88142
+ }
88143
+ getNodeLinks(baseReference).resolvedSymbol = symbol;
88144
+ setParent(narrowReference, narrowPosition.parent);
88145
+ narrowReference.flowNode = narrowFlowNode;
88146
+ const initialType = getNarrowableTypeForReference(
88147
+ typeParam,
88148
+ narrowReference,
88149
+ /*checkMode*/
88150
+ void 0,
88151
+ /*forReturnTypeNarrowing*/
88152
+ true
88153
+ );
88154
+ if (initialType === typeParam) {
88155
+ continue;
88156
+ }
88157
+ const flowType = getFlowTypeOfReference(narrowReference, initialType);
88158
+ const exprType2 = getTypeFromFlowType(flowType);
88159
+ if (exprType2.flags & 3 /* AnyOrUnknown */ || isErrorType(exprType2) || exprType2 === typeParam || exprType2 === mapType(typeParam, getBaseConstraintOrType)) {
88160
+ continue;
88161
+ }
88162
+ const narrowedType = getSubstitutionType(
88163
+ typeParam,
88164
+ exprType2,
88165
+ /*isNarrowed*/
88166
+ true
88167
+ );
88168
+ narrowedTypeParameters.push(typeParam);
88169
+ narrowedTypes.push(narrowedType);
88170
+ }
88171
+ const narrowMapper = createTypeMapper(narrowedTypeParameters, narrowedTypes);
88172
+ const narrowedReturnType = instantiateType(
88173
+ unwrappedReturnType,
88174
+ narrowMapper
88175
+ );
88176
+ if (expr) {
88177
+ const links = getNodeLinks(expr);
88178
+ if (!links.contextualReturnType) {
88179
+ links.contextualReturnType = narrowedReturnType;
88180
+ }
88181
+ }
88182
+ const narrowedExprType = expr ? checkExpression(expr) : undefinedType;
88183
+ const narrowedUnwrappedExprType = functionFlags & 2 /* Async */ ? checkAwaitedType(
88184
+ narrowedExprType,
88185
+ /*withAlias*/
88186
+ false,
88187
+ node,
88188
+ Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
88189
+ ) : narrowedExprType;
88190
+ checkTypeAssignableToAndOptionallyElaborate(narrowedUnwrappedExprType, narrowedReturnType, errorNode, effectiveExpr);
88191
+ }
88192
+ function resetNodeId(node) {
88193
+ node.id = void 0;
88194
+ forEachChildRecursively(node, resetNodeId);
88195
+ }
88196
+ function getNarrowableTypeParameters(candidates) {
88197
+ const narrowableParams = [];
88198
+ for (const typeParam of candidates) {
88199
+ const constraint = getConstraintOfTypeParameter(typeParam);
88200
+ if (!constraint || !(constraint.flags & 1048576 /* Union */)) continue;
88201
+ if (typeParam.symbol && typeParam.symbol.declarations && typeParam.symbol.declarations.length === 1) {
88202
+ const declaration = typeParam.symbol.declarations[0];
88203
+ const container = isJSDocTemplateTag(declaration.parent) ? getJSDocHost(declaration.parent) : declaration.parent;
88204
+ if (!isFunctionLike(container)) continue;
88205
+ let paramReference;
88206
+ let referencePath;
88207
+ let hasInvalidReference = false;
88208
+ for (const paramDecl of container.parameters) {
88209
+ const typeNode = getEffectiveTypeAnnotationNode(paramDecl);
88210
+ if (!typeNode) continue;
88211
+ const result = getValidTypeParameterReference(typeNode, typeParam, []);
88212
+ if (!result) {
88213
+ hasInvalidReference = true;
88214
+ break;
88215
+ }
88216
+ if (isArray(result)) {
88217
+ if (referencePath) {
88218
+ hasInvalidReference = true;
88219
+ break;
88220
+ }
88221
+ referencePath = result;
88222
+ paramReference = paramDecl;
88223
+ }
88224
+ }
88225
+ if (!hasInvalidReference && referencePath && validateOptionality(paramReference, constraint, referencePath)) {
88226
+ const symbolAndReference = constructNarrowableReference(paramReference, referencePath);
88227
+ if (symbolAndReference) {
88228
+ if (symbolAndReference[0] && symbolAndReference[0] !== unknownSymbol) {
88229
+ narrowableParams.push([typeParam, symbolAndReference[0], symbolAndReference[1]]);
88230
+ }
88231
+ }
88232
+ }
88233
+ }
88234
+ }
88235
+ return narrowableParams;
88236
+ function isReferenceToTypeParameter(typeParam, node) {
88237
+ return getTypeFromTypeReference(node) === typeParam;
88238
+ }
88239
+ function isTypeParameterReferenced(typeParam, node) {
88240
+ return isReferenced(node);
88241
+ function isReferenced(node2) {
88242
+ if (isTypeReferenceNode(node2)) {
88243
+ return isReferenceToTypeParameter(typeParam, node2) || some(node2.typeArguments, isReferenced);
88244
+ }
88245
+ if (isTypeQueryNode(node2)) {
88246
+ return isTypeParameterPossiblyReferenced(typeParam, node2);
88247
+ }
88248
+ return !!forEachChild(node2, isReferenced);
88249
+ }
88250
+ }
88251
+ function getValidTypeParameterReference(typeNode, typeParam, path) {
88252
+ var _a;
88253
+ switch (typeNode.kind) {
88254
+ case 183 /* TypeReference */:
88255
+ const type = getTypeFromTypeReference(typeNode);
88256
+ if (type === typeParam) {
88257
+ return path;
88258
+ }
88259
+ const typeArgs = typeNode.typeArguments;
88260
+ const typeArgsReferencingT = typeArgs == null ? void 0 : typeArgs.filter((node) => isTypeParameterReferenced(typeParam, node));
88261
+ if (!typeArgsReferencingT || typeArgsReferencingT.length === 0) return true;
88262
+ if (typeArgsReferencingT && typeArgsReferencingT.length > 1) return false;
88263
+ const typeArg = typeArgsReferencingT[0];
88264
+ if (!(typeArg.kind & 183 /* TypeReference */)) return false;
88265
+ if (!type.symbol || !type.symbol.declarations || type.symbol.declarations.length !== 1) return false;
88266
+ const typeDeclaration = type.symbol.declarations[0];
88267
+ let aliasDeclaration;
88268
+ if (isTypeLiteralNode(typeDeclaration)) {
88269
+ aliasDeclaration = walkUpParenthesizedTypes(typeDeclaration.parent);
88270
+ if (!isTypeAliasDeclaration(aliasDeclaration)) return false;
88271
+ } else if (isInterfaceDeclaration(typeDeclaration)) {
88272
+ aliasDeclaration = typeDeclaration;
88273
+ } else {
88274
+ return false;
88275
+ }
88276
+ const typeArgIndex = typeArgs.findIndex((arg) => arg === typeArg);
88277
+ const matchingTypeParamDecl = (_a = aliasDeclaration.typeParameters) == null ? void 0 : _a[typeArgIndex];
88278
+ if (!matchingTypeParamDecl) return false;
88279
+ const matchingTypeParam = getDeclaredTypeOfTypeParameter(matchingTypeParamDecl.symbol);
88280
+ return getValidTypeParameterReference(typeDeclaration, matchingTypeParam, path);
88281
+ case 264 /* InterfaceDeclaration */:
88282
+ const extendsTypes = flatMap(typeNode.heritageClauses, (clause) => clause.types);
88283
+ const relevantExtendsTypes = extendsTypes.filter((node) => isTypeParameterReferenced(typeParam, node));
88284
+ if (relevantExtendsTypes && relevantExtendsTypes.length > 1) {
88285
+ return false;
88286
+ }
88287
+ const result = getValidTypeParameterReferenceFromTypeElements(typeNode.members, typeParam, path);
88288
+ if (relevantExtendsTypes && relevantExtendsTypes.length === 1) {
88289
+ if (result !== true) {
88290
+ return false;
88291
+ }
88292
+ return getValidTypeParameterReference(relevantExtendsTypes[0], typeParam, path);
88293
+ }
88294
+ return result;
88295
+ case 187 /* TypeLiteral */:
88296
+ return getValidTypeParameterReferenceFromTypeElements(typeNode.members, typeParam, path);
88297
+ case 193 /* IntersectionType */:
88298
+ let validPath;
88299
+ for (const type2 of typeNode.types) {
88300
+ const result2 = getValidTypeParameterReference(type2, typeParam, path);
88301
+ if (!result2) {
88302
+ return false;
88303
+ }
88304
+ if (isArray(result2)) {
88305
+ if (validPath) {
88306
+ return false;
88307
+ }
88308
+ validPath = result2;
88309
+ }
88310
+ }
88311
+ return validPath ?? true;
88312
+ default:
88313
+ return !isTypeParameterReferenced(typeParam, typeNode);
88314
+ }
88315
+ }
88316
+ function getValidTypeParameterReferenceFromTypeElements(members, typeParam, path) {
88317
+ let validPath;
88318
+ for (const member of members) {
88319
+ if (!isTypeParameterReferenced(typeParam, member)) {
88320
+ continue;
88321
+ }
88322
+ if (!isPropertySignature(member)) {
88323
+ return false;
88324
+ }
88325
+ if (!isIdentifier(member.name) && !isStringLiteral(member.name)) {
88326
+ return false;
88327
+ }
88328
+ const result = getValidTypeParameterReference(member.type, typeParam, [...path, member]);
88329
+ if (!result) {
88330
+ return false;
88331
+ }
88332
+ if (isArray(result)) {
88333
+ if (validPath) {
88334
+ return false;
88335
+ }
88336
+ validPath = result;
88337
+ }
88338
+ }
88339
+ return validPath ?? true;
88340
+ }
88341
+ function validateOptionality(paramDecl, constraint, path) {
88342
+ for (let i = 0; i < path.length - 1; i++) {
88343
+ if (path[i].questionToken) {
88344
+ return false;
88345
+ }
88346
+ }
88347
+ const paramIsOptional = !!paramDecl.questionToken || isJSDocOptionalParameter(paramDecl);
88348
+ if (paramIsOptional && path.length > 0) {
88349
+ return false;
88350
+ }
88351
+ const isOptional = paramIsOptional || path.length > 0 && path[path.length - 1].questionToken;
88352
+ if (isOptional && strictNullChecks && !containsUndefinedType(constraint)) {
88353
+ return false;
88354
+ }
88355
+ return true;
88356
+ }
88357
+ function constructNarrowableReference(paramDecl, path) {
88358
+ let currentName = paramDecl.name;
88359
+ let i = 0;
88360
+ for (; i < path.length; i++) {
88361
+ if (isIdentifier(currentName)) {
88362
+ break;
88363
+ } else if (isObjectBindingPattern(currentName)) {
88364
+ const name = path[i].name;
88365
+ let nameText;
88366
+ if (isIdentifier(name)) nameText = name.escapedText;
88367
+ else {
88368
+ const rawText = getLiteralPropertyNameText(name);
88369
+ if (rawText) nameText = escapeLeadingUnderscores(rawText);
88370
+ }
88371
+ const element = currentName.elements.find((element2) => {
88372
+ const propertyName = getDestructuringPropertyName(element2);
88373
+ const propertyNameText = propertyName && escapeLeadingUnderscores(propertyName);
88374
+ return nameText && propertyNameText && nameText === propertyNameText;
88375
+ });
88376
+ if (!element) {
88377
+ return void 0;
88378
+ }
88379
+ currentName = element.name;
88380
+ } else {
88381
+ return void 0;
88382
+ }
88383
+ }
88384
+ if (!isIdentifier(currentName)) {
88385
+ return void 0;
88386
+ }
88387
+ let result = factory.cloneNode(currentName);
88388
+ const initialSymbol = getSymbolOfDeclaration(currentName.parent);
88389
+ for (let j = i; j < path.length; j++) {
88390
+ result = addName(result, path[j].name);
88391
+ }
88392
+ return [initialSymbol, result];
88393
+ }
88394
+ function addName(exp, name) {
88395
+ name = factory.cloneNode(name);
88396
+ if (isIdentifier(name)) {
88397
+ const accessExp = factory.createPropertyAccessExpression(exp, name);
88398
+ setParent(name, accessExp);
88399
+ setParent(exp, accessExp);
88400
+ return accessExp;
88401
+ } else {
88402
+ const accessExp = factory.createElementAccessExpression(exp, name);
88403
+ setParent(name, accessExp);
88404
+ setParent(exp, accessExp);
88405
+ return accessExp;
88406
+ }
88407
+ }
88408
+ }
88409
+ function isNarrowableReturnType(returnType) {
88410
+ return isConditionalType(returnType) ? isNarrowableConditionalType(
88411
+ returnType,
88412
+ /*hadNonPrimitiveExtendsType*/
88413
+ []
88414
+ ) : !!(returnType.indexType.flags & 262144 /* TypeParameter */);
88415
+ }
88416
+ function isNarrowableConditionalType(type, hadNonPrimitiveExtendsType, mapper) {
88417
+ const typeArguments = mapper && map(type.root.outerTypeParameters, (t) => {
88418
+ const mapped = getMappedType(t, mapper);
88419
+ if (isNarrowingSubstitutionType(mapped)) {
88420
+ return mapped.baseType;
88421
+ }
88422
+ return mapped;
88423
+ });
88424
+ const id = `${type.id}:${getTypeListId(typeArguments)}:${getTypeListId(hadNonPrimitiveExtendsType)}`;
88425
+ let result = narrowableReturnTypeCache.get(id);
88426
+ if (result === void 0) {
88427
+ const nonNarrowingMapper = type.root.outerTypeParameters && typeArguments && createTypeMapper(type.root.outerTypeParameters, typeArguments);
88428
+ const instantiatedType = instantiateType(type, nonNarrowingMapper);
88429
+ result = isConditionalType(instantiatedType) && isNarrowableConditionalTypeWorker(instantiatedType, hadNonPrimitiveExtendsType);
88430
+ narrowableReturnTypeCache.set(id, result);
88431
+ }
88432
+ return result;
88433
+ }
88434
+ function isNarrowableConditionalTypeWorker(type, hadNonPrimitiveExtendsType) {
88435
+ if (!type.root.isDistributive) {
88436
+ return false;
88437
+ }
88438
+ if (type.root.inferTypeParameters) {
88439
+ return false;
88440
+ }
88441
+ if (!(type.checkType.flags & 262144 /* TypeParameter */)) {
88442
+ return false;
88443
+ }
88444
+ const constraintType = getConstraintOfTypeParameter(type.checkType);
88445
+ if (!constraintType || !(constraintType.flags & 1048576 /* Union */)) {
88446
+ return false;
88447
+ }
88448
+ if (!everyType(type.extendsType, (extendsType) => some(
88449
+ constraintType.types,
88450
+ (constraintType2) => isTypeAssignableTo(constraintType2, extendsType)
88451
+ ))) {
88452
+ return false;
88453
+ }
88454
+ const hasNonPrimitive = someType(type.extendsType, (type2) => (type2.flags & 402784252 /* Primitive */) === 0);
88455
+ if (hasNonPrimitive && hadNonPrimitiveExtendsType.includes(type.checkType)) {
88456
+ return false;
88457
+ }
88458
+ if (hasNonPrimitive) {
88459
+ hadNonPrimitiveExtendsType = hadNonPrimitiveExtendsType.slice();
88460
+ hadNonPrimitiveExtendsType.push(type.checkType);
88461
+ }
88462
+ const trueType2 = getTrueTypeFromConditionalType(type);
88463
+ const isValidTrueType = isConditionalType(trueType2) ? isNarrowableConditionalType(trueType2, hadNonPrimitiveExtendsType) : true;
88464
+ if (!isValidTrueType) return false;
88465
+ const falseType2 = getFalseTypeFromConditionalType(type);
88466
+ const isValidFalseType = isConditionalType(falseType2) ? isNarrowableConditionalType(falseType2, hadNonPrimitiveExtendsType) : falseType2 === neverType;
88467
+ return isValidFalseType;
88468
+ }
88469
+ function isConditionalType(type) {
88470
+ return !!(type.flags & 16777216 /* Conditional */);
88028
88471
  }
88029
88472
  function checkWithStatement(node) {
88030
88473
  if (!checkGrammarStatementInAmbientContext(node)) {
@@ -93887,33 +94330,6 @@ function createTypeChecker(host) {
93887
94330
  Debug.assert(specifier && nodeIsSynthesized(specifier) && specifier.text === "tslib", `Expected sourceFile.imports[0] to be the synthesized tslib import`);
93888
94331
  return specifier;
93889
94332
  }
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
94333
  }
93918
94334
  function isNotAccessor(declaration) {
93919
94335
  return !isAccessor(declaration);
@@ -137212,12 +137628,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
137212
137628
  return withNewScope(context, node, () => serializeTypeAnnotationOfDeclaration(accessorType, context, node, symbol) ?? inferTypeOfDeclaration(node, symbol, context));
137213
137629
  }
137214
137630
  if (accessorDeclarations.getAccessor) {
137215
- return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(
137216
- accessorDeclarations.getAccessor,
137217
- /*symbol*/
137218
- void 0,
137219
- context
137220
- ));
137631
+ return withNewScope(context, accessorDeclarations.getAccessor, () => createReturnFromSignature(accessorDeclarations.getAccessor, symbol, context));
137221
137632
  }
137222
137633
  return void 0;
137223
137634
  }
@@ -137327,14 +137738,14 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
137327
137738
  }
137328
137739
  return resolver.serializeTypeOfExpression(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
137329
137740
  }
137330
- function inferReturnTypeOfSignatureSignature(node, context, reportFallback) {
137741
+ function inferReturnTypeOfSignatureSignature(node, context, symbol, reportFallback) {
137331
137742
  if (reportFallback) {
137332
137743
  context.tracker.reportInferenceFallback(node);
137333
137744
  }
137334
137745
  if (context.noInferenceFallback === true) {
137335
137746
  return factory.createKeywordTypeNode(133 /* AnyKeyword */);
137336
137747
  }
137337
- return resolver.serializeReturnTypeForSignature(context, node) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
137748
+ return resolver.serializeReturnTypeForSignature(context, node, symbol) ?? factory.createKeywordTypeNode(133 /* AnyKeyword */);
137338
137749
  }
137339
137750
  function inferAccessorType(node, allAccessors, context, symbol, reportFallback = true) {
137340
137751
  if (node.kind === 177 /* GetAccessor */) {
@@ -137769,7 +138180,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
137769
138180
  } else if (isValueSignatureDeclaration(fn)) {
137770
138181
  returnType = typeFromSingleReturnExpression(fn, context);
137771
138182
  }
137772
- return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, reportFallback && returnType.reportFallback && !returnTypeNode);
138183
+ return returnType.type !== void 0 ? returnType.type : inferReturnTypeOfSignatureSignature(fn, context, symbol, reportFallback && returnType.reportFallback && !returnTypeNode);
137773
138184
  }
137774
138185
  function typeFromSingleReturnExpression(declaration, context) {
137775
138186
  let candidateExpr;
@@ -182456,7 +182867,6 @@ __export(ts_exports2, {
182456
182867
  commonOptionsWithBuild: () => commonOptionsWithBuild,
182457
182868
  compact: () => compact,
182458
182869
  compareBooleans: () => compareBooleans,
182459
- compareComparableValues: () => compareComparableValues,
182460
182870
  compareDataObjects: () => compareDataObjects,
182461
182871
  compareDiagnostics: () => compareDiagnostics,
182462
182872
  compareEmitHelpers: () => compareEmitHelpers,
@@ -197210,7 +197620,6 @@ if (typeof console !== "undefined") {
197210
197620
  commonOptionsWithBuild,
197211
197621
  compact,
197212
197622
  compareBooleans,
197213
- compareComparableValues,
197214
197623
  compareDataObjects,
197215
197624
  compareDiagnostics,
197216
197625
  compareEmitHelpers,