typescript 5.5.0-dev.20240318 → 5.5.0-dev.20240320

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-dev.20240318`;
21
+ var version = `${versionMajorMinor}.0-dev.20240320`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -11850,6 +11850,9 @@ var getScriptTargetFeatures = /* @__PURE__ */ memoize(
11850
11850
  es2015: [
11851
11851
  "from",
11852
11852
  "of"
11853
+ ],
11854
+ esnext: [
11855
+ "fromAsync"
11853
11856
  ]
11854
11857
  })),
11855
11858
  ObjectConstructor: new Map(Object.entries({
@@ -33758,6 +33761,8 @@ var libEntries = [
33758
33761
  ["esnext.weakref", "lib.es2021.weakref.d.ts"],
33759
33762
  ["esnext.decorators", "lib.esnext.decorators.d.ts"],
33760
33763
  ["esnext.object", "lib.esnext.object.d.ts"],
33764
+ ["esnext.array", "lib.esnext.array.d.ts"],
33765
+ ["esnext.regexp", "lib.esnext.regexp.d.ts"],
33761
33766
  ["decorators", "lib.decorators.d.ts"],
33762
33767
  ["decorators.legacy", "lib.decorators.legacy.d.ts"]
33763
33768
  ];
@@ -47140,13 +47145,6 @@ function createTypeChecker(host) {
47140
47145
  });
47141
47146
  }
47142
47147
  function getSymbolIfSameReference(s1, s2) {
47143
- var _a, _b;
47144
- if (s1.flags & 524288 /* TypeAlias */ && ((_a = s2.declarations) == null ? void 0 : _a.find(isTypeAlias))) {
47145
- s2 = getDeclaredTypeOfTypeAlias(s2).aliasSymbol || s2;
47146
- }
47147
- if (s2.flags & 524288 /* TypeAlias */ && ((_b = s1.declarations) == null ? void 0 : _b.find(isTypeAlias))) {
47148
- s1 = getDeclaredTypeOfTypeAlias(s1).aliasSymbol || s1;
47149
- }
47150
47148
  if (getMergedSymbol(resolveSymbol(getMergedSymbol(s1))) === getMergedSymbol(resolveSymbol(getMergedSymbol(s2)))) {
47151
47149
  return s1;
47152
47150
  }
@@ -47781,6 +47779,18 @@ function createTypeChecker(host) {
47781
47779
  return {
47782
47780
  typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
47783
47781
  typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
47782
+ expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
47783
+ serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(
47784
+ context,
47785
+ type,
47786
+ symbol,
47787
+ enclosingDeclaration,
47788
+ /*includePrivateSymbol*/
47789
+ void 0,
47790
+ /*bundled*/
47791
+ void 0,
47792
+ addUndefined
47793
+ )),
47784
47794
  indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
47785
47795
  indexInfo,
47786
47796
  context,
@@ -47802,6 +47812,50 @@ function createTypeChecker(host) {
47802
47812
  symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker, bundled) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context, bundled)),
47803
47813
  symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
47804
47814
  };
47815
+ function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
47816
+ if (expr) {
47817
+ const typeNode = isAssertionExpression(expr) ? expr.type : isJSDocTypeAssertion(expr) ? getJSDocTypeAssertionType(expr) : void 0;
47818
+ if (typeNode && !isConstTypeReference(typeNode)) {
47819
+ const result = tryReuseExistingTypeNode(context, typeNode, type, expr.parent, addUndefined);
47820
+ if (result) {
47821
+ return result;
47822
+ }
47823
+ }
47824
+ }
47825
+ if (addUndefined) {
47826
+ type = getOptionalType(type);
47827
+ }
47828
+ return typeToTypeNodeHelper(type, context);
47829
+ }
47830
+ function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined, includePrivateSymbol, bundled) {
47831
+ const originalType = type;
47832
+ if (addUndefined) {
47833
+ type = getOptionalType(type);
47834
+ }
47835
+ const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2, includePrivateSymbol, bundled);
47836
+ if (clone) {
47837
+ if (addUndefined && !someType(getTypeFromTypeNode(typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
47838
+ return factory.createUnionTypeNode([clone, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
47839
+ }
47840
+ return clone;
47841
+ }
47842
+ if (addUndefined && originalType !== type) {
47843
+ const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host2, includePrivateSymbol, bundled);
47844
+ if (cloneMissingUndefined) {
47845
+ return factory.createUnionTypeNode([cloneMissingUndefined, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
47846
+ }
47847
+ }
47848
+ return void 0;
47849
+ }
47850
+ function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, includePrivateSymbol, bundled, annotationType) {
47851
+ if (typeNodeIsEquivalentToType(existing, host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
47852
+ const result = tryReuseExistingTypeNodeHelper(context, existing, includePrivateSymbol, bundled);
47853
+ if (result) {
47854
+ return result;
47855
+ }
47856
+ }
47857
+ return void 0;
47858
+ }
47805
47859
  function symbolToNode(symbol, context, meaning) {
47806
47860
  if (context.flags & 1073741824 /* WriteComputedProps */) {
47807
47861
  if (symbol.valueDeclaration) {
@@ -48243,8 +48297,8 @@ function createTypeChecker(host) {
48243
48297
  if (isInstantiationExpressionType) {
48244
48298
  const instantiationExpressionType = type2;
48245
48299
  const existing = instantiationExpressionType.node;
48246
- if (isTypeQueryNode(existing) && getTypeFromTypeNode(existing) === type2) {
48247
- const typeNode = serializeExistingTypeNode(context, existing);
48300
+ if (isTypeQueryNode(existing)) {
48301
+ const typeNode = tryReuseExistingNonParameterTypeNode(context, existing, type2);
48248
48302
  if (typeNode) {
48249
48303
  return typeNode;
48250
48304
  }
@@ -49050,11 +49104,9 @@ function createTypeChecker(host) {
49050
49104
  }
49051
49105
  function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) {
49052
49106
  const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
49053
- let parameterType = getTypeOfSymbol(parameterSymbol);
49054
- if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
49055
- parameterType = getOptionalType(parameterType);
49056
- }
49057
- const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
49107
+ const parameterType = getTypeOfSymbol(parameterSymbol);
49108
+ const addUndefined = parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration);
49109
+ const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports, addUndefined);
49058
49110
  const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
49059
49111
  const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
49060
49112
  const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
@@ -49644,16 +49696,15 @@ function createTypeChecker(host) {
49644
49696
  }
49645
49697
  return enclosingDeclaration;
49646
49698
  }
49647
- function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
49699
+ function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled, addUndefined) {
49700
+ var _a;
49648
49701
  if (!isErrorType(type) && enclosingDeclaration) {
49649
49702
  const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
49650
49703
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
49651
49704
  const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
49652
- if (typeNodeIsEquivalentToType(existing, declWithExistingAnnotation, type) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
49653
- const result2 = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
49654
- if (result2) {
49655
- return result2;
49656
- }
49705
+ const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined, includePrivateSymbol, bundled);
49706
+ if (result2) {
49707
+ return result2;
49657
49708
  }
49658
49709
  }
49659
49710
  }
@@ -49661,16 +49712,17 @@ function createTypeChecker(host) {
49661
49712
  if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
49662
49713
  context.flags |= 1048576 /* AllowUniqueESSymbolType */;
49663
49714
  }
49664
- const result = typeToTypeNodeHelper(type, context);
49715
+ const decl = symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
49716
+ const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
49717
+ const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
49665
49718
  context.flags = oldFlags;
49666
49719
  return result;
49667
49720
  }
49668
- function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
49669
- const typeFromTypeNode = getTypeFromTypeNode(typeNode);
49721
+ function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type, typeFromTypeNode = getTypeFromTypeNode(typeNode)) {
49670
49722
  if (typeFromTypeNode === type) {
49671
49723
  return true;
49672
49724
  }
49673
- if (isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
49725
+ if (annotatedDeclaration && (isParameter(annotatedDeclaration) || isPropertyDeclaration(annotatedDeclaration)) && annotatedDeclaration.questionToken) {
49674
49726
  return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
49675
49727
  }
49676
49728
  return false;
@@ -49682,11 +49734,9 @@ function createTypeChecker(host) {
49682
49734
  if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
49683
49735
  const annotated = getTypeFromTypeNode(annotation);
49684
49736
  const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
49685
- if (thisInstantiated === type && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(annotation, type)) {
49686
- const result = serializeExistingTypeNode(context, annotation, includePrivateSymbol, bundled);
49687
- if (result) {
49688
- return result;
49689
- }
49737
+ const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, includePrivateSymbol, bundled, thisInstantiated);
49738
+ if (result) {
49739
+ return result;
49690
49740
  }
49691
49741
  }
49692
49742
  }
@@ -49715,7 +49765,9 @@ function createTypeChecker(host) {
49715
49765
  /*shouldComputeAliasesToMakeVisible*/
49716
49766
  false
49717
49767
  ).accessibility !== 0 /* Accessible */) {
49718
- introducesError = true;
49768
+ if (!isDeclarationName(node)) {
49769
+ introducesError = true;
49770
+ }
49719
49771
  } else {
49720
49772
  context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
49721
49773
  includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
@@ -49729,7 +49781,7 @@ function createTypeChecker(host) {
49729
49781
  }
49730
49782
  return { introducesError, node };
49731
49783
  }
49732
- function serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled) {
49784
+ function tryReuseExistingTypeNodeHelper(context, existing, includePrivateSymbol, bundled) {
49733
49785
  if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
49734
49786
  cancellationToken.throwIfCancellationRequested();
49735
49787
  }
@@ -49853,6 +49905,31 @@ function createTypeChecker(host) {
49853
49905
  node.isTypeOf
49854
49906
  );
49855
49907
  }
49908
+ if (isParameter(node)) {
49909
+ if (!node.type && !node.initializer) {
49910
+ return factory.updateParameterDeclaration(
49911
+ node,
49912
+ /*modifiers*/
49913
+ void 0,
49914
+ node.dotDotDotToken,
49915
+ visitEachChild(
49916
+ node.name,
49917
+ visitExistingNodeTreeSymbols,
49918
+ /*context*/
49919
+ void 0
49920
+ ),
49921
+ node.questionToken,
49922
+ factory.createKeywordTypeNode(133 /* AnyKeyword */),
49923
+ /*initializer*/
49924
+ void 0
49925
+ );
49926
+ }
49927
+ }
49928
+ if (isPropertySignature(node)) {
49929
+ if (!node.type && !node.initializer) {
49930
+ return factory.updatePropertySignature(node, node.modifiers, node.name, node.questionToken, factory.createKeywordTypeNode(133 /* AnyKeyword */));
49931
+ }
49932
+ }
49856
49933
  if (isEntityName(node) || isEntityNameExpression(node)) {
49857
49934
  const { introducesError, node: result } = trackExistingEntityName(node, context, includePrivateSymbol);
49858
49935
  hadError = hadError || introducesError;
@@ -49860,7 +49937,7 @@ function createTypeChecker(host) {
49860
49937
  return result;
49861
49938
  }
49862
49939
  }
49863
- if (file && isTupleTypeNode(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
49940
+ if (file && isTupleTypeNode(node) && !nodeIsSynthesized(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
49864
49941
  setEmitFlags(node, 1 /* SingleLine */);
49865
49942
  }
49866
49943
  return visitEachChild(
@@ -50384,7 +50461,15 @@ function createTypeChecker(host) {
50384
50461
  context.flags |= 8388608 /* InTypeAlias */;
50385
50462
  const oldEnclosingDecl = context.enclosingDeclaration;
50386
50463
  context.enclosingDeclaration = jsdocAliasDecl;
50387
- const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && serializeExistingTypeNode(context, jsdocAliasDecl.typeExpression.type, includePrivateSymbol, bundled) || typeToTypeNodeHelper(aliasType, context);
50464
+ const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && tryReuseExistingNonParameterTypeNode(
50465
+ context,
50466
+ jsdocAliasDecl.typeExpression.type,
50467
+ aliasType,
50468
+ /*host*/
50469
+ void 0,
50470
+ includePrivateSymbol,
50471
+ bundled
50472
+ ) || typeToTypeNodeHelper(aliasType, context);
50388
50473
  addResult(
50389
50474
  setSyntheticLeadingComments(
50390
50475
  factory.createTypeAliasDeclaration(
@@ -50617,7 +50702,15 @@ function createTypeChecker(host) {
50617
50702
  }
50618
50703
  return cleanup(factory.createExpressionWithTypeArguments(
50619
50704
  expr,
50620
- map(e.typeArguments, (a) => serializeExistingTypeNode(context, a, includePrivateSymbol, bundled) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
50705
+ map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(
50706
+ context,
50707
+ a,
50708
+ getTypeFromTypeNode(a),
50709
+ /*host*/
50710
+ void 0,
50711
+ includePrivateSymbol,
50712
+ bundled
50713
+ ) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
50621
50714
  ));
50622
50715
  function cleanup(result2) {
50623
50716
  context.enclosingDeclaration = oldEnclosing;
@@ -51076,8 +51169,10 @@ function createTypeChecker(host) {
51076
51169
  }
51077
51170
  }
51078
51171
  function isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, hostSymbol) {
51172
+ var _a2;
51079
51173
  const ctxSrc = getSourceFileOfNode(context.enclosingDeclaration);
51080
- return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !length(getIndexInfosOfType(typeToSerialize)) && !isClassInstanceSide(typeToSerialize) && // While a class instance is potentially representable as a NS, prefer printing a reference to the instance type and serializing the class
51174
+ return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !some((_a2 = typeToSerialize.symbol) == null ? void 0 : _a2.declarations, isTypeNode) && // If the type comes straight from a type node, we shouldn't try to break it up
51175
+ !length(getIndexInfosOfType(typeToSerialize)) && !isClassInstanceSide(typeToSerialize) && // While a class instance is potentially representable as a NS, prefer printing a reference to the instance type and serializing the class
51081
51176
  !!(length(filter(getPropertiesOfType(typeToSerialize), isNamespaceMember)) || length(getSignaturesOfType(typeToSerialize, 0 /* Call */))) && !length(getSignaturesOfType(typeToSerialize, 1 /* Construct */)) && // TODO: could probably serialize as function + ns + class, now that that's OK
51082
51177
  !getDeclarationWithTypeAnnotation(hostSymbol, enclosingDeclaration) && !(typeToSerialize.symbol && some(typeToSerialize.symbol.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && !some(getPropertiesOfType(typeToSerialize), (p) => isLateBoundName(p.escapedName)) && !some(getPropertiesOfType(typeToSerialize), (p) => some(p.declarations, (d) => getSourceFileOfNode(d) !== ctxSrc)) && every(getPropertiesOfType(typeToSerialize), (p) => {
51083
51178
  if (!isIdentifierText(symbolName(p), languageVersion)) {
@@ -54951,13 +55046,16 @@ function createTypeChecker(host) {
54951
55046
  const constraint = getConstraintTypeFromMappedType(type);
54952
55047
  if (constraint.flags & 4194304 /* Index */) {
54953
55048
  const baseConstraint = getBaseConstraintOfType(constraint.type);
54954
- if (baseConstraint && everyType(baseConstraint, isArrayOrTupleType)) {
55049
+ if (baseConstraint && everyType(baseConstraint, (t) => isArrayOrTupleType(t) || isArrayOrTupleOrIntersection(t))) {
54955
55050
  return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
54956
55051
  }
54957
55052
  }
54958
55053
  }
54959
55054
  return type;
54960
55055
  }
55056
+ function isArrayOrTupleOrIntersection(type) {
55057
+ return !!(type.flags & 2097152 /* Intersection */) && every(type.types, isArrayOrTupleType);
55058
+ }
54961
55059
  function isMappedTypeGenericIndexedAccess(type) {
54962
55060
  let objectType;
54963
55061
  return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
@@ -59349,29 +59447,28 @@ function createTypeChecker(host) {
59349
59447
  if (typeVariable) {
59350
59448
  const mappedTypeVariable = instantiateType(typeVariable, mapper);
59351
59449
  if (typeVariable !== mappedTypeVariable) {
59352
- return mapTypeWithAlias(
59353
- getReducedType(mappedTypeVariable),
59354
- (t) => {
59355
- if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
59356
- if (!type.declaration.nameType) {
59357
- let constraint;
59358
- if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
59359
- return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
59360
- }
59361
- if (isTupleType(t)) {
59362
- return instantiateMappedTupleType(t, type, typeVariable, mapper);
59363
- }
59364
- }
59365
- return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
59366
- }
59367
- return t;
59368
- },
59369
- aliasSymbol,
59370
- aliasTypeArguments
59371
- );
59450
+ return mapTypeWithAlias(getReducedType(mappedTypeVariable), instantiateConstituent, aliasSymbol, aliasTypeArguments);
59372
59451
  }
59373
59452
  }
59374
59453
  return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments);
59454
+ function instantiateConstituent(t) {
59455
+ if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
59456
+ if (!type.declaration.nameType) {
59457
+ let constraint;
59458
+ if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
59459
+ return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
59460
+ }
59461
+ if (isTupleType(t)) {
59462
+ return instantiateMappedTupleType(t, type, typeVariable, mapper);
59463
+ }
59464
+ if (isArrayOrTupleOrIntersection(t)) {
59465
+ return getIntersectionType(map(t.types, instantiateConstituent));
59466
+ }
59467
+ }
59468
+ return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
59469
+ }
59470
+ return t;
59471
+ }
59375
59472
  }
59376
59473
  function getModifiedReadonlyState(state, modifiers) {
59377
59474
  return modifiers & 1 /* IncludeReadonly */ ? true : modifiers & 2 /* ExcludeReadonly */ ? false : state;
@@ -64274,7 +64371,9 @@ function createTypeChecker(host) {
64274
64371
  return false;
64275
64372
  }
64276
64373
  function inferTypesFromTemplateLiteralType(source, target) {
64277
- return source.flags & 128 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arraysEqual(source.texts, target.texts) ? map(source.types, getStringLikeTypeForType) : inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) : void 0;
64374
+ return source.flags & 128 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arraysEqual(source.texts, target.texts) ? map(source.types, (s, i) => {
64375
+ return isTypeAssignableTo(getBaseConstraintOrType(s), getBaseConstraintOrType(target.types[i])) ? s : getStringLikeTypeForType(s);
64376
+ }) : inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) : void 0;
64278
64377
  }
64279
64378
  function isTypeMatchedByTemplateLiteralType(source, target) {
64280
64379
  const inferences = inferTypesFromTemplateLiteralType(source, target);
@@ -80456,7 +80555,7 @@ function createTypeChecker(host) {
80456
80555
  error(member.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums);
80457
80556
  } else {
80458
80557
  const text = getTextOfPropertyName(member.name);
80459
- if (isNumericLiteralName(text)) {
80558
+ if (isNumericLiteralName(text) && !isInfinityOrNaNString(text)) {
80460
80559
  error(member.name, Diagnostics.An_enum_member_cannot_have_a_numeric_name);
80461
80560
  }
80462
80561
  }
@@ -82907,14 +83006,34 @@ function createTypeChecker(host) {
82907
83006
  return factory.createToken(133 /* AnyKeyword */);
82908
83007
  }
82909
83008
  const symbol = getSymbolOfDeclaration(declaration);
82910
- let type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
82911
- if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol) {
82912
- flags |= 1048576 /* AllowUniqueESSymbolType */;
82913
- }
82914
- if (addUndefined) {
82915
- type = getOptionalType(type);
83009
+ const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
83010
+ return nodeBuilder.serializeTypeForDeclaration(type, symbol, addUndefined, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
83011
+ }
83012
+ function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
83013
+ return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
83014
+ }
83015
+ function getPossibleTypeNodeReuseExpression(declaration) {
83016
+ var _a;
83017
+ return isFunctionLike(declaration) && !isSetAccessor(declaration) ? getSingleReturnExpression(declaration) : isExportAssignment(declaration) ? declaration.expression : !!declaration.initializer ? declaration.initializer : isParameter(declaration) && isSetAccessor(declaration.parent) ? getSingleReturnExpression(getAllAccessorDeclarations((_a = getSymbolOfDeclaration(declaration.parent)) == null ? void 0 : _a.declarations, declaration.parent).getAccessor) : void 0;
83018
+ }
83019
+ function getSingleReturnExpression(declaration) {
83020
+ let candidateExpr;
83021
+ if (declaration && !nodeIsMissing(declaration.body)) {
83022
+ const body = declaration.body;
83023
+ if (body && isBlock(body)) {
83024
+ forEachReturnStatement(body, (s) => {
83025
+ if (!candidateExpr) {
83026
+ candidateExpr = s.expression;
83027
+ } else {
83028
+ candidateExpr = void 0;
83029
+ return true;
83030
+ }
83031
+ });
83032
+ } else {
83033
+ candidateExpr = body;
83034
+ }
82916
83035
  }
82917
- return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
83036
+ return candidateExpr;
82918
83037
  }
82919
83038
  function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
82920
83039
  const signatureDeclaration = getParseTreeNode(signatureDeclarationIn, isFunctionLike);
@@ -82926,7 +83045,15 @@ function createTypeChecker(host) {
82926
83045
  if (typePredicate) {
82927
83046
  return nodeBuilder.typePredicateToTypePredicateNode(typePredicate, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
82928
83047
  }
82929
- return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
83048
+ return nodeBuilder.expressionOrTypeToTypeNode(
83049
+ getPossibleTypeNodeReuseExpression(signatureDeclaration),
83050
+ getReturnTypeOfSignature(signature),
83051
+ /*addUndefined*/
83052
+ void 0,
83053
+ enclosingDeclaration,
83054
+ flags | 1024 /* MultilineObjectLiterals */,
83055
+ tracker
83056
+ );
82930
83057
  }
82931
83058
  function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
82932
83059
  const expr = getParseTreeNode(exprIn, isExpression);
@@ -82934,7 +83061,15 @@ function createTypeChecker(host) {
82934
83061
  return factory.createToken(133 /* AnyKeyword */);
82935
83062
  }
82936
83063
  const type = getWidenedType(getRegularTypeOfExpression(expr));
82937
- return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
83064
+ return nodeBuilder.expressionOrTypeToTypeNode(
83065
+ expr,
83066
+ type,
83067
+ /*addUndefined*/
83068
+ void 0,
83069
+ enclosingDeclaration,
83070
+ flags | 1024 /* MultilineObjectLiterals */,
83071
+ tracker
83072
+ );
82938
83073
  }
82939
83074
  function hasGlobalName(name) {
82940
83075
  return globals.has(escapeLeadingUnderscores(name));
@@ -108454,10 +108589,10 @@ function transformDeclarations(context) {
108454
108589
  return newFile;
108455
108590
  }
108456
108591
  needsDeclare = true;
108457
- const updated2 = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(sourceFile)) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
108592
+ const updated = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(sourceFile)) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
108458
108593
  return factory2.updateSourceFile(
108459
108594
  sourceFile,
108460
- transformAndReplaceLatePaintedStatements(updated2),
108595
+ transformAndReplaceLatePaintedStatements(updated),
108461
108596
  /*isDeclarationFile*/
108462
108597
  true,
108463
108598
  /*referencedFiles*/
@@ -108521,7 +108656,7 @@ function transformDeclarations(context) {
108521
108656
  combinedStatements = setTextRange(factory2.createNodeArray([...combinedStatements, createEmptyExports(factory2)]), combinedStatements);
108522
108657
  }
108523
108658
  }
108524
- const updated = factory2.updateSourceFile(
108659
+ return factory2.updateSourceFile(
108525
108660
  node,
108526
108661
  combinedStatements,
108527
108662
  /*isDeclarationFile*/
@@ -108531,8 +108666,6 @@ function transformDeclarations(context) {
108531
108666
  node.hasNoDefaultLib,
108532
108667
  getLibReferences()
108533
108668
  );
108534
- updated.exportedModulesFromDeclarationEmit = exportedModulesFromDeclarationEmit;
108535
- return updated;
108536
108669
  function getLibReferences() {
108537
108670
  return arrayFrom(libs2.keys(), (lib) => ({ fileName: lib, pos: -1, end: -1 }));
108538
108671
  }
@@ -119977,12 +120110,11 @@ var BuilderState;
119977
120110
  }
119978
120111
  BuilderState2.canReuseOldState = canReuseOldState;
119979
120112
  function create(newProgram, oldState, disableUseFileVersionAsSignature) {
119980
- var _a, _b, _c;
120113
+ var _a, _b;
119981
120114
  const fileInfos = /* @__PURE__ */ new Map();
119982
120115
  const options = newProgram.getCompilerOptions();
119983
120116
  const isOutFile = options.outFile;
119984
120117
  const referencedMap = options.module !== 0 /* None */ && !isOutFile ? createManyToManyPathMap() : void 0;
119985
- const exportedModulesMap = referencedMap ? createManyToManyPathMap() : void 0;
119986
120118
  const useOldState = canReuseOldState(referencedMap, oldState);
119987
120119
  newProgram.getTypeChecker();
119988
120120
  for (const sourceFile of newProgram.getSourceFiles()) {
@@ -119994,13 +120126,6 @@ var BuilderState;
119994
120126
  if (newReferences) {
119995
120127
  referencedMap.set(sourceFile.resolvedPath, newReferences);
119996
120128
  }
119997
- if (useOldState) {
119998
- const oldUncommittedExportedModules = (_c = oldState.oldExportedModulesMap) == null ? void 0 : _c.get(sourceFile.resolvedPath);
119999
- const exportedModules = oldUncommittedExportedModules === void 0 ? oldState.exportedModulesMap.getValues(sourceFile.resolvedPath) : oldUncommittedExportedModules || void 0;
120000
- if (exportedModules) {
120001
- exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
120002
- }
120003
- }
120004
120129
  }
120005
120130
  fileInfos.set(sourceFile.resolvedPath, {
120006
120131
  version: version2,
@@ -120013,7 +120138,6 @@ var BuilderState;
120013
120138
  return {
120014
120139
  fileInfos,
120015
120140
  referencedMap,
120016
- exportedModulesMap,
120017
120141
  useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
120018
120142
  };
120019
120143
  }
@@ -120024,7 +120148,7 @@ var BuilderState;
120024
120148
  }
120025
120149
  BuilderState2.releaseCache = releaseCache2;
120026
120150
  function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, host) {
120027
- var _a, _b;
120151
+ var _a;
120028
120152
  const result = getFilesAffectedByWithOldState(
120029
120153
  state,
120030
120154
  programOfThisState,
@@ -120033,7 +120157,6 @@ var BuilderState;
120033
120157
  host
120034
120158
  );
120035
120159
  (_a = state.oldSignatures) == null ? void 0 : _a.clear();
120036
- (_b = state.oldExportedModulesMap) == null ? void 0 : _b.clear();
120037
120160
  return result;
120038
120161
  }
120039
120162
  BuilderState2.getFilesAffectedBy = getFilesAffectedBy;
@@ -120087,24 +120210,16 @@ var BuilderState;
120087
120210
  const prevSignature = info.signature;
120088
120211
  let latestSignature;
120089
120212
  if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
120090
- computeDtsSignature(programOfThisState, sourceFile, cancellationToken, host, (signature, sourceFiles) => {
120213
+ computeDtsSignature(programOfThisState, sourceFile, cancellationToken, host, (signature) => {
120091
120214
  latestSignature = signature;
120092
- if (latestSignature !== prevSignature) {
120093
- updateExportedModules(state, sourceFile, sourceFiles[0].exportedModulesFromDeclarationEmit);
120094
- }
120215
+ if (host.storeSignatureInfo)
120216
+ (state.signatureInfo ?? (state.signatureInfo = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, 0 /* ComputedDts */);
120095
120217
  });
120096
120218
  }
120097
120219
  if (latestSignature === void 0) {
120098
120220
  latestSignature = sourceFile.version;
120099
- if (state.exportedModulesMap && latestSignature !== prevSignature) {
120100
- (state.oldExportedModulesMap || (state.oldExportedModulesMap = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
120101
- const references = state.referencedMap ? state.referencedMap.getValues(sourceFile.resolvedPath) : void 0;
120102
- if (references) {
120103
- state.exportedModulesMap.set(sourceFile.resolvedPath, references);
120104
- } else {
120105
- state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
120106
- }
120107
- }
120221
+ if (host.storeSignatureInfo)
120222
+ (state.signatureInfo ?? (state.signatureInfo = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, 2 /* UsedVersion */);
120108
120223
  }
120109
120224
  (state.oldSignatures || (state.oldSignatures = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, prevSignature || false);
120110
120225
  (state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = /* @__PURE__ */ new Set())).add(sourceFile.resolvedPath);
@@ -120112,28 +120227,6 @@ var BuilderState;
120112
120227
  return latestSignature !== prevSignature;
120113
120228
  }
120114
120229
  BuilderState2.updateShapeSignature = updateShapeSignature;
120115
- function updateExportedModules(state, sourceFile, exportedModulesFromDeclarationEmit) {
120116
- if (!state.exportedModulesMap)
120117
- return;
120118
- (state.oldExportedModulesMap || (state.oldExportedModulesMap = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, state.exportedModulesMap.getValues(sourceFile.resolvedPath) || false);
120119
- const exportedModules = getExportedModules(exportedModulesFromDeclarationEmit);
120120
- if (exportedModules) {
120121
- state.exportedModulesMap.set(sourceFile.resolvedPath, exportedModules);
120122
- } else {
120123
- state.exportedModulesMap.deleteKey(sourceFile.resolvedPath);
120124
- }
120125
- }
120126
- BuilderState2.updateExportedModules = updateExportedModules;
120127
- function getExportedModules(exportedModulesFromDeclarationEmit) {
120128
- let exportedModules;
120129
- exportedModulesFromDeclarationEmit == null ? void 0 : exportedModulesFromDeclarationEmit.forEach(
120130
- (symbol) => getReferencedFilesFromImportedModuleSymbol(symbol).forEach(
120131
- (path) => (exportedModules ?? (exportedModules = /* @__PURE__ */ new Set())).add(path)
120132
- )
120133
- );
120134
- return exportedModules;
120135
- }
120136
- BuilderState2.getExportedModules = getExportedModules;
120137
120230
  function getAllDependencies(state, programOfThisState, sourceFile) {
120138
120231
  const compilerOptions = programOfThisState.getCompilerOptions();
120139
120232
  if (compilerOptions.outFile) {
@@ -120496,7 +120589,7 @@ function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
120496
120589
  Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
120497
120590
  }
120498
120591
  function getNextAffectedFile(state, cancellationToken, host) {
120499
- var _a, _b;
120592
+ var _a;
120500
120593
  while (true) {
120501
120594
  const { affectedFiles } = state;
120502
120595
  if (affectedFiles) {
@@ -120520,7 +120613,6 @@ function getNextAffectedFile(state, cancellationToken, host) {
120520
120613
  state.changedFilesSet.delete(state.currentChangedFilePath);
120521
120614
  state.currentChangedFilePath = void 0;
120522
120615
  (_a = state.oldSignatures) == null ? void 0 : _a.clear();
120523
- (_b = state.oldExportedModulesMap) == null ? void 0 : _b.clear();
120524
120616
  state.affectedFiles = void 0;
120525
120617
  }
120526
120618
  const nextKey = state.changedFilesSet.keys().next();
@@ -120681,7 +120773,7 @@ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, hos
120681
120773
  }
120682
120774
  function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host) {
120683
120775
  var _a;
120684
- if (!state.exportedModulesMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
120776
+ if (!state.referencedMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
120685
120777
  return;
120686
120778
  if (!isChangedSignature(state, affectedFile.resolvedPath))
120687
120779
  return;
@@ -120704,7 +120796,7 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
120704
120796
  }
120705
120797
  }
120706
120798
  const seenFileAndExportsOfFile = /* @__PURE__ */ new Set();
120707
- (_a = state.exportedModulesMap.getKeys(affectedFile.resolvedPath)) == null ? void 0 : _a.forEach((exportedFromPath) => {
120799
+ (_a = state.referencedMap.getKeys(affectedFile.resolvedPath)) == null ? void 0 : _a.forEach((exportedFromPath) => {
120708
120800
  if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host))
120709
120801
  return true;
120710
120802
  const references = state.referencedMap.getKeys(exportedFromPath);
@@ -120718,27 +120810,17 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
120718
120810
  });
120719
120811
  }
120720
120812
  function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
120721
- var _a, _b;
120813
+ var _a;
120722
120814
  if (!tryAddToSet(seenFileAndExportsOfFile, filePath))
120723
120815
  return void 0;
120724
120816
  if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host))
120725
120817
  return true;
120726
120818
  handleDtsMayChangeOf(state, filePath, cancellationToken, host);
120727
- (_a = state.exportedModulesMap.getKeys(filePath)) == null ? void 0 : _a.forEach(
120728
- (exportedFromPath) => handleDtsMayChangeOfFileAndExportsOfFile(
120729
- state,
120730
- exportedFromPath,
120731
- seenFileAndExportsOfFile,
120732
- cancellationToken,
120733
- host
120734
- )
120735
- );
120736
- (_b = state.referencedMap.getKeys(filePath)) == null ? void 0 : _b.forEach(
120737
- (referencingFilePath) => !seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
120738
- handleDtsMayChangeOf(
120739
- // Dont add to seen since this is not yet done with the export removal
120819
+ (_a = state.referencedMap.getKeys(filePath)) == null ? void 0 : _a.forEach(
120820
+ (referencingFilePath) => handleDtsMayChangeOfFileAndExportsOfFile(
120740
120821
  state,
120741
120822
  referencingFilePath,
120823
+ seenFileAndExportsOfFile,
120742
120824
  cancellationToken,
120743
120825
  host
120744
120826
  )
@@ -120853,18 +120935,6 @@ function getBuildInfo2(state) {
120853
120935
  toFileIdListId(state.referencedMap.getValues(key))
120854
120936
  ]);
120855
120937
  }
120856
- let exportedModulesMap;
120857
- if (state.exportedModulesMap) {
120858
- exportedModulesMap = mapDefined(arrayFrom(state.exportedModulesMap.keys()).sort(compareStringsCaseSensitive), (key) => {
120859
- var _a2;
120860
- const oldValue = (_a2 = state.oldExportedModulesMap) == null ? void 0 : _a2.get(key);
120861
- if (oldValue === void 0)
120862
- return [toFileId(key), toFileIdListId(state.exportedModulesMap.getValues(key))];
120863
- if (oldValue)
120864
- return [toFileId(key), toFileIdListId(oldValue)];
120865
- return void 0;
120866
- });
120867
- }
120868
120938
  const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.semanticDiagnosticsPerFile);
120869
120939
  let affectedFilesPendingEmit;
120870
120940
  if ((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size) {
@@ -120903,7 +120973,6 @@ function getBuildInfo2(state) {
120903
120973
  options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
120904
120974
  fileIdsList,
120905
120975
  referencedMap,
120906
- exportedModulesMap,
120907
120976
  semanticDiagnosticsPerFile,
120908
120977
  emitDiagnosticsPerFile,
120909
120978
  affectedFilesPendingEmit,
@@ -121218,7 +121287,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
121218
121287
  if (!getEmitDeclarations(state.compilerOptions))
121219
121288
  return writeFile2 || maybeBind(host, host.writeFile);
121220
121289
  return (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
121221
- var _a, _b, _c, _d;
121290
+ var _a, _b, _c;
121222
121291
  if (isDeclarationFileName(fileName)) {
121223
121292
  if (!state.compilerOptions.outFile) {
121224
121293
  Debug.assert((sourceFiles == null ? void 0 : sourceFiles.length) === 1);
@@ -121237,10 +121306,8 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
121237
121306
  if (!((_a = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a.length))
121238
121307
  emitSignature = signature;
121239
121308
  if (signature !== file.version) {
121240
- if (host.storeFilesChangingSignatureDuringEmit)
121241
- (state.filesChangingSignature ?? (state.filesChangingSignature = /* @__PURE__ */ new Set())).add(file.resolvedPath);
121242
- if (state.exportedModulesMap)
121243
- BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
121309
+ if (host.storeSignatureInfo)
121310
+ (state.signatureInfo ?? (state.signatureInfo = /* @__PURE__ */ new Map())).set(file.resolvedPath, 1 /* StoredSignatureAtEmit */);
121244
121311
  if (state.affectedFiles) {
121245
121312
  const existing = (_b = state.oldSignatures) == null ? void 0 : _b.get(file.resolvedPath);
121246
121313
  if (existing === void 0)
@@ -121248,14 +121315,13 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
121248
121315
  info.signature = signature;
121249
121316
  } else {
121250
121317
  info.signature = signature;
121251
- (_c = state.oldExportedModulesMap) == null ? void 0 : _c.clear();
121252
121318
  }
121253
121319
  }
121254
121320
  }
121255
121321
  }
121256
121322
  if (state.compilerOptions.composite) {
121257
121323
  const filePath = sourceFiles[0].resolvedPath;
121258
- emitSignature = handleNewSignature((_d = state.emitSignatures) == null ? void 0 : _d.get(filePath), emitSignature);
121324
+ emitSignature = handleNewSignature((_c = state.emitSignatures) == null ? void 0 : _c.get(filePath), emitSignature);
121259
121325
  if (!emitSignature)
121260
121326
  return;
121261
121327
  (state.emitSignatures ?? (state.emitSignatures = /* @__PURE__ */ new Map())).set(filePath, emitSignature);
@@ -121447,7 +121513,6 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
121447
121513
  fileInfos,
121448
121514
  compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
121449
121515
  referencedMap: toManyToManyPathMap(program.referencedMap),
121450
- exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
121451
121516
  semanticDiagnosticsPerFile: toPerFileDiagnostics(program.semanticDiagnosticsPerFile),
121452
121517
  emitDiagnosticsPerFile: toPerFileDiagnostics(program.emitDiagnosticsPerFile),
121453
121518
  hasReusableDiagnostic: true,
@@ -123107,7 +123172,7 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
123107
123172
  getEnvironmentVariable: maybeBind(host, host.getEnvironmentVariable) || (() => ""),
123108
123173
  createHash: maybeBind(host, host.createHash),
123109
123174
  readDirectory: maybeBind(host, host.readDirectory),
123110
- storeFilesChangingSignatureDuringEmit: host.storeFilesChangingSignatureDuringEmit,
123175
+ storeSignatureInfo: host.storeSignatureInfo,
123111
123176
  jsDocParsingMode: host.jsDocParsingMode
123112
123177
  };
123113
123178
  return compilerHost;
@@ -123174,7 +123239,7 @@ function createProgramHost(system, createProgram2) {
123174
123239
  writeFile: (path, data, writeByteOrderMark) => system.writeFile(path, data, writeByteOrderMark),
123175
123240
  createHash: maybeBind(system, system.createHash),
123176
123241
  createProgram: createProgram2 || createEmitAndSemanticDiagnosticsBuilderProgram,
123177
- storeFilesChangingSignatureDuringEmit: system.storeFilesChangingSignatureDuringEmit,
123242
+ storeSignatureInfo: system.storeSignatureInfo,
123178
123243
  now: maybeBind(system, system.now)
123179
123244
  };
123180
123245
  }
@@ -123280,7 +123345,7 @@ function createIncrementalCompilerHost(options, system = sys) {
123280
123345
  system
123281
123346
  );
123282
123347
  host.createHash = maybeBind(system, system.createHash);
123283
- host.storeFilesChangingSignatureDuringEmit = system.storeFilesChangingSignatureDuringEmit;
123348
+ host.storeSignatureInfo = system.storeSignatureInfo;
123284
123349
  setGetSourceFileAsHashVersioned(host);
123285
123350
  changeCompilerHostLikeToUseCache(host, (fileName) => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName));
123286
123351
  return host;