typescript 5.5.0-dev.20240318 → 5.5.0-dev.20240319
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/lib.es2022.regexp.d.ts +1 -1
- package/lib/lib.esnext.d.ts +1 -0
- package/lib/lib.esnext.regexp.d.ts +25 -0
- package/lib/tsc.js +222 -154
- package/lib/typescript.d.ts +13 -0
- package/lib/typescript.js +281 -176
- package/package.json +2 -2
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.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240319`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -33758,6 +33758,7 @@ var libEntries = [
|
|
|
33758
33758
|
["esnext.weakref", "lib.es2021.weakref.d.ts"],
|
|
33759
33759
|
["esnext.decorators", "lib.esnext.decorators.d.ts"],
|
|
33760
33760
|
["esnext.object", "lib.esnext.object.d.ts"],
|
|
33761
|
+
["esnext.regexp", "lib.esnext.regexp.d.ts"],
|
|
33761
33762
|
["decorators", "lib.decorators.d.ts"],
|
|
33762
33763
|
["decorators.legacy", "lib.decorators.legacy.d.ts"]
|
|
33763
33764
|
];
|
|
@@ -47781,6 +47782,18 @@ function createTypeChecker(host) {
|
|
|
47781
47782
|
return {
|
|
47782
47783
|
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
47783
47784
|
typePredicateToTypePredicateNode: (typePredicate, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typePredicateToTypePredicateNodeHelper(typePredicate, context)),
|
|
47785
|
+
expressionOrTypeToTypeNode: (expr, type, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
47786
|
+
serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(
|
|
47787
|
+
context,
|
|
47788
|
+
type,
|
|
47789
|
+
symbol,
|
|
47790
|
+
enclosingDeclaration,
|
|
47791
|
+
/*includePrivateSymbol*/
|
|
47792
|
+
void 0,
|
|
47793
|
+
/*bundled*/
|
|
47794
|
+
void 0,
|
|
47795
|
+
addUndefined
|
|
47796
|
+
)),
|
|
47784
47797
|
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
47785
47798
|
indexInfo,
|
|
47786
47799
|
context,
|
|
@@ -47802,6 +47815,50 @@ function createTypeChecker(host) {
|
|
|
47802
47815
|
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker, bundled) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context, bundled)),
|
|
47803
47816
|
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
47804
47817
|
};
|
|
47818
|
+
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
47819
|
+
if (expr) {
|
|
47820
|
+
const typeNode = isAssertionExpression(expr) ? expr.type : isJSDocTypeAssertion(expr) ? getJSDocTypeAssertionType(expr) : void 0;
|
|
47821
|
+
if (typeNode && !isConstTypeReference(typeNode)) {
|
|
47822
|
+
const result = tryReuseExistingTypeNode(context, typeNode, type, expr.parent, addUndefined);
|
|
47823
|
+
if (result) {
|
|
47824
|
+
return result;
|
|
47825
|
+
}
|
|
47826
|
+
}
|
|
47827
|
+
}
|
|
47828
|
+
if (addUndefined) {
|
|
47829
|
+
type = getOptionalType(type);
|
|
47830
|
+
}
|
|
47831
|
+
return typeToTypeNodeHelper(type, context);
|
|
47832
|
+
}
|
|
47833
|
+
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined, includePrivateSymbol, bundled) {
|
|
47834
|
+
const originalType = type;
|
|
47835
|
+
if (addUndefined) {
|
|
47836
|
+
type = getOptionalType(type);
|
|
47837
|
+
}
|
|
47838
|
+
const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2, includePrivateSymbol, bundled);
|
|
47839
|
+
if (clone) {
|
|
47840
|
+
if (addUndefined && !someType(getTypeFromTypeNode(typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
|
|
47841
|
+
return factory.createUnionTypeNode([clone, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
47842
|
+
}
|
|
47843
|
+
return clone;
|
|
47844
|
+
}
|
|
47845
|
+
if (addUndefined && originalType !== type) {
|
|
47846
|
+
const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host2, includePrivateSymbol, bundled);
|
|
47847
|
+
if (cloneMissingUndefined) {
|
|
47848
|
+
return factory.createUnionTypeNode([cloneMissingUndefined, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
47849
|
+
}
|
|
47850
|
+
}
|
|
47851
|
+
return void 0;
|
|
47852
|
+
}
|
|
47853
|
+
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, includePrivateSymbol, bundled, annotationType) {
|
|
47854
|
+
if (typeNodeIsEquivalentToType(existing, host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
47855
|
+
const result = tryReuseExistingTypeNodeHelper(context, existing, includePrivateSymbol, bundled);
|
|
47856
|
+
if (result) {
|
|
47857
|
+
return result;
|
|
47858
|
+
}
|
|
47859
|
+
}
|
|
47860
|
+
return void 0;
|
|
47861
|
+
}
|
|
47805
47862
|
function symbolToNode(symbol, context, meaning) {
|
|
47806
47863
|
if (context.flags & 1073741824 /* WriteComputedProps */) {
|
|
47807
47864
|
if (symbol.valueDeclaration) {
|
|
@@ -48243,8 +48300,8 @@ function createTypeChecker(host) {
|
|
|
48243
48300
|
if (isInstantiationExpressionType) {
|
|
48244
48301
|
const instantiationExpressionType = type2;
|
|
48245
48302
|
const existing = instantiationExpressionType.node;
|
|
48246
|
-
if (isTypeQueryNode(existing)
|
|
48247
|
-
const typeNode =
|
|
48303
|
+
if (isTypeQueryNode(existing)) {
|
|
48304
|
+
const typeNode = tryReuseExistingNonParameterTypeNode(context, existing, type2);
|
|
48248
48305
|
if (typeNode) {
|
|
48249
48306
|
return typeNode;
|
|
48250
48307
|
}
|
|
@@ -49050,11 +49107,9 @@ function createTypeChecker(host) {
|
|
|
49050
49107
|
}
|
|
49051
49108
|
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) {
|
|
49052
49109
|
const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
|
|
49053
|
-
|
|
49054
|
-
|
|
49055
|
-
|
|
49056
|
-
}
|
|
49057
|
-
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
|
|
49110
|
+
const parameterType = getTypeOfSymbol(parameterSymbol);
|
|
49111
|
+
const addUndefined = parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration);
|
|
49112
|
+
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports, addUndefined);
|
|
49058
49113
|
const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
|
|
49059
49114
|
const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
49060
49115
|
const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
|
|
@@ -49644,16 +49699,15 @@ function createTypeChecker(host) {
|
|
|
49644
49699
|
}
|
|
49645
49700
|
return enclosingDeclaration;
|
|
49646
49701
|
}
|
|
49647
|
-
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
49702
|
+
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled, addUndefined) {
|
|
49703
|
+
var _a;
|
|
49648
49704
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
49649
49705
|
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
49650
49706
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
49651
49707
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
49652
|
-
|
|
49653
|
-
|
|
49654
|
-
|
|
49655
|
-
return result2;
|
|
49656
|
-
}
|
|
49708
|
+
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined, includePrivateSymbol, bundled);
|
|
49709
|
+
if (result2) {
|
|
49710
|
+
return result2;
|
|
49657
49711
|
}
|
|
49658
49712
|
}
|
|
49659
49713
|
}
|
|
@@ -49661,16 +49715,17 @@ function createTypeChecker(host) {
|
|
|
49661
49715
|
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
|
|
49662
49716
|
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
|
|
49663
49717
|
}
|
|
49664
|
-
const
|
|
49718
|
+
const decl = symbol.valueDeclaration ?? ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
|
49719
|
+
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
49720
|
+
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
|
|
49665
49721
|
context.flags = oldFlags;
|
|
49666
49722
|
return result;
|
|
49667
49723
|
}
|
|
49668
|
-
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
|
|
49669
|
-
const typeFromTypeNode = getTypeFromTypeNode(typeNode);
|
|
49724
|
+
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type, typeFromTypeNode = getTypeFromTypeNode(typeNode)) {
|
|
49670
49725
|
if (typeFromTypeNode === type) {
|
|
49671
49726
|
return true;
|
|
49672
49727
|
}
|
|
49673
|
-
if (isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
|
|
49728
|
+
if (annotatedDeclaration && (isParameter(annotatedDeclaration) || isPropertyDeclaration(annotatedDeclaration)) && annotatedDeclaration.questionToken) {
|
|
49674
49729
|
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
49675
49730
|
}
|
|
49676
49731
|
return false;
|
|
@@ -49682,11 +49737,9 @@ function createTypeChecker(host) {
|
|
|
49682
49737
|
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
49683
49738
|
const annotated = getTypeFromTypeNode(annotation);
|
|
49684
49739
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
49685
|
-
|
|
49686
|
-
|
|
49687
|
-
|
|
49688
|
-
return result;
|
|
49689
|
-
}
|
|
49740
|
+
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, includePrivateSymbol, bundled, thisInstantiated);
|
|
49741
|
+
if (result) {
|
|
49742
|
+
return result;
|
|
49690
49743
|
}
|
|
49691
49744
|
}
|
|
49692
49745
|
}
|
|
@@ -49715,7 +49768,9 @@ function createTypeChecker(host) {
|
|
|
49715
49768
|
/*shouldComputeAliasesToMakeVisible*/
|
|
49716
49769
|
false
|
|
49717
49770
|
).accessibility !== 0 /* Accessible */) {
|
|
49718
|
-
|
|
49771
|
+
if (!isDeclarationName(node)) {
|
|
49772
|
+
introducesError = true;
|
|
49773
|
+
}
|
|
49719
49774
|
} else {
|
|
49720
49775
|
context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
|
|
49721
49776
|
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
|
|
@@ -49729,7 +49784,7 @@ function createTypeChecker(host) {
|
|
|
49729
49784
|
}
|
|
49730
49785
|
return { introducesError, node };
|
|
49731
49786
|
}
|
|
49732
|
-
function
|
|
49787
|
+
function tryReuseExistingTypeNodeHelper(context, existing, includePrivateSymbol, bundled) {
|
|
49733
49788
|
if (cancellationToken && cancellationToken.throwIfCancellationRequested) {
|
|
49734
49789
|
cancellationToken.throwIfCancellationRequested();
|
|
49735
49790
|
}
|
|
@@ -49853,6 +49908,31 @@ function createTypeChecker(host) {
|
|
|
49853
49908
|
node.isTypeOf
|
|
49854
49909
|
);
|
|
49855
49910
|
}
|
|
49911
|
+
if (isParameter(node)) {
|
|
49912
|
+
if (!node.type && !node.initializer) {
|
|
49913
|
+
return factory.updateParameterDeclaration(
|
|
49914
|
+
node,
|
|
49915
|
+
/*modifiers*/
|
|
49916
|
+
void 0,
|
|
49917
|
+
node.dotDotDotToken,
|
|
49918
|
+
visitEachChild(
|
|
49919
|
+
node.name,
|
|
49920
|
+
visitExistingNodeTreeSymbols,
|
|
49921
|
+
/*context*/
|
|
49922
|
+
void 0
|
|
49923
|
+
),
|
|
49924
|
+
node.questionToken,
|
|
49925
|
+
factory.createKeywordTypeNode(133 /* AnyKeyword */),
|
|
49926
|
+
/*initializer*/
|
|
49927
|
+
void 0
|
|
49928
|
+
);
|
|
49929
|
+
}
|
|
49930
|
+
}
|
|
49931
|
+
if (isPropertySignature(node)) {
|
|
49932
|
+
if (!node.type && !node.initializer) {
|
|
49933
|
+
return factory.updatePropertySignature(node, node.modifiers, node.name, node.questionToken, factory.createKeywordTypeNode(133 /* AnyKeyword */));
|
|
49934
|
+
}
|
|
49935
|
+
}
|
|
49856
49936
|
if (isEntityName(node) || isEntityNameExpression(node)) {
|
|
49857
49937
|
const { introducesError, node: result } = trackExistingEntityName(node, context, includePrivateSymbol);
|
|
49858
49938
|
hadError = hadError || introducesError;
|
|
@@ -49860,7 +49940,7 @@ function createTypeChecker(host) {
|
|
|
49860
49940
|
return result;
|
|
49861
49941
|
}
|
|
49862
49942
|
}
|
|
49863
|
-
if (file && isTupleTypeNode(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
|
|
49943
|
+
if (file && isTupleTypeNode(node) && !nodeIsSynthesized(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
|
|
49864
49944
|
setEmitFlags(node, 1 /* SingleLine */);
|
|
49865
49945
|
}
|
|
49866
49946
|
return visitEachChild(
|
|
@@ -50384,7 +50464,15 @@ function createTypeChecker(host) {
|
|
|
50384
50464
|
context.flags |= 8388608 /* InTypeAlias */;
|
|
50385
50465
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
50386
50466
|
context.enclosingDeclaration = jsdocAliasDecl;
|
|
50387
|
-
const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) &&
|
|
50467
|
+
const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && tryReuseExistingNonParameterTypeNode(
|
|
50468
|
+
context,
|
|
50469
|
+
jsdocAliasDecl.typeExpression.type,
|
|
50470
|
+
aliasType,
|
|
50471
|
+
/*host*/
|
|
50472
|
+
void 0,
|
|
50473
|
+
includePrivateSymbol,
|
|
50474
|
+
bundled
|
|
50475
|
+
) || typeToTypeNodeHelper(aliasType, context);
|
|
50388
50476
|
addResult(
|
|
50389
50477
|
setSyntheticLeadingComments(
|
|
50390
50478
|
factory.createTypeAliasDeclaration(
|
|
@@ -50617,7 +50705,15 @@ function createTypeChecker(host) {
|
|
|
50617
50705
|
}
|
|
50618
50706
|
return cleanup(factory.createExpressionWithTypeArguments(
|
|
50619
50707
|
expr,
|
|
50620
|
-
map(e.typeArguments, (a) =>
|
|
50708
|
+
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(
|
|
50709
|
+
context,
|
|
50710
|
+
a,
|
|
50711
|
+
getTypeFromTypeNode(a),
|
|
50712
|
+
/*host*/
|
|
50713
|
+
void 0,
|
|
50714
|
+
includePrivateSymbol,
|
|
50715
|
+
bundled
|
|
50716
|
+
) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
|
|
50621
50717
|
));
|
|
50622
50718
|
function cleanup(result2) {
|
|
50623
50719
|
context.enclosingDeclaration = oldEnclosing;
|
|
@@ -51076,8 +51172,10 @@ function createTypeChecker(host) {
|
|
|
51076
51172
|
}
|
|
51077
51173
|
}
|
|
51078
51174
|
function isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, hostSymbol) {
|
|
51175
|
+
var _a2;
|
|
51079
51176
|
const ctxSrc = getSourceFileOfNode(context.enclosingDeclaration);
|
|
51080
|
-
return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !
|
|
51177
|
+
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
|
|
51178
|
+
!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
51179
|
!!(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
51180
|
!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
51181
|
if (!isIdentifierText(symbolName(p), languageVersion)) {
|
|
@@ -54951,13 +55049,16 @@ function createTypeChecker(host) {
|
|
|
54951
55049
|
const constraint = getConstraintTypeFromMappedType(type);
|
|
54952
55050
|
if (constraint.flags & 4194304 /* Index */) {
|
|
54953
55051
|
const baseConstraint = getBaseConstraintOfType(constraint.type);
|
|
54954
|
-
if (baseConstraint && everyType(baseConstraint, isArrayOrTupleType)) {
|
|
55052
|
+
if (baseConstraint && everyType(baseConstraint, (t) => isArrayOrTupleType(t) || isArrayOrTupleOrIntersection(t))) {
|
|
54955
55053
|
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
|
|
54956
55054
|
}
|
|
54957
55055
|
}
|
|
54958
55056
|
}
|
|
54959
55057
|
return type;
|
|
54960
55058
|
}
|
|
55059
|
+
function isArrayOrTupleOrIntersection(type) {
|
|
55060
|
+
return !!(type.flags & 2097152 /* Intersection */) && every(type.types, isArrayOrTupleType);
|
|
55061
|
+
}
|
|
54961
55062
|
function isMappedTypeGenericIndexedAccess(type) {
|
|
54962
55063
|
let objectType;
|
|
54963
55064
|
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 +59450,28 @@ function createTypeChecker(host) {
|
|
|
59349
59450
|
if (typeVariable) {
|
|
59350
59451
|
const mappedTypeVariable = instantiateType(typeVariable, mapper);
|
|
59351
59452
|
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
|
-
);
|
|
59453
|
+
return mapTypeWithAlias(getReducedType(mappedTypeVariable), instantiateConstituent, aliasSymbol, aliasTypeArguments);
|
|
59372
59454
|
}
|
|
59373
59455
|
}
|
|
59374
59456
|
return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments);
|
|
59457
|
+
function instantiateConstituent(t) {
|
|
59458
|
+
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
59459
|
+
if (!type.declaration.nameType) {
|
|
59460
|
+
let constraint;
|
|
59461
|
+
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
59462
|
+
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
59463
|
+
}
|
|
59464
|
+
if (isTupleType(t)) {
|
|
59465
|
+
return instantiateMappedTupleType(t, type, typeVariable, mapper);
|
|
59466
|
+
}
|
|
59467
|
+
if (isArrayOrTupleOrIntersection(t)) {
|
|
59468
|
+
return getIntersectionType(map(t.types, instantiateConstituent));
|
|
59469
|
+
}
|
|
59470
|
+
}
|
|
59471
|
+
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
59472
|
+
}
|
|
59473
|
+
return t;
|
|
59474
|
+
}
|
|
59375
59475
|
}
|
|
59376
59476
|
function getModifiedReadonlyState(state, modifiers) {
|
|
59377
59477
|
return modifiers & 1 /* IncludeReadonly */ ? true : modifiers & 2 /* ExcludeReadonly */ ? false : state;
|
|
@@ -64274,7 +64374,9 @@ function createTypeChecker(host) {
|
|
|
64274
64374
|
return false;
|
|
64275
64375
|
}
|
|
64276
64376
|
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,
|
|
64377
|
+
return source.flags & 128 /* StringLiteral */ ? inferFromLiteralPartsToTemplateLiteral([source.value], emptyArray, target) : source.flags & 134217728 /* TemplateLiteral */ ? arraysEqual(source.texts, target.texts) ? map(source.types, (s, i) => {
|
|
64378
|
+
return isTypeAssignableTo(getBaseConstraintOrType(s), getBaseConstraintOrType(target.types[i])) ? s : getStringLikeTypeForType(s);
|
|
64379
|
+
}) : inferFromLiteralPartsToTemplateLiteral(source.texts, source.types, target) : void 0;
|
|
64278
64380
|
}
|
|
64279
64381
|
function isTypeMatchedByTemplateLiteralType(source, target) {
|
|
64280
64382
|
const inferences = inferTypesFromTemplateLiteralType(source, target);
|
|
@@ -82907,14 +83009,34 @@ function createTypeChecker(host) {
|
|
|
82907
83009
|
return factory.createToken(133 /* AnyKeyword */);
|
|
82908
83010
|
}
|
|
82909
83011
|
const symbol = getSymbolOfDeclaration(declaration);
|
|
82910
|
-
|
|
82911
|
-
|
|
82912
|
-
|
|
82913
|
-
|
|
82914
|
-
|
|
82915
|
-
|
|
83012
|
+
const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
|
|
83013
|
+
return nodeBuilder.serializeTypeForDeclaration(type, symbol, addUndefined, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
83014
|
+
}
|
|
83015
|
+
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
83016
|
+
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
83017
|
+
}
|
|
83018
|
+
function getPossibleTypeNodeReuseExpression(declaration) {
|
|
83019
|
+
var _a;
|
|
83020
|
+
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;
|
|
83021
|
+
}
|
|
83022
|
+
function getSingleReturnExpression(declaration) {
|
|
83023
|
+
let candidateExpr;
|
|
83024
|
+
if (declaration && !nodeIsMissing(declaration.body)) {
|
|
83025
|
+
const body = declaration.body;
|
|
83026
|
+
if (body && isBlock(body)) {
|
|
83027
|
+
forEachReturnStatement(body, (s) => {
|
|
83028
|
+
if (!candidateExpr) {
|
|
83029
|
+
candidateExpr = s.expression;
|
|
83030
|
+
} else {
|
|
83031
|
+
candidateExpr = void 0;
|
|
83032
|
+
return true;
|
|
83033
|
+
}
|
|
83034
|
+
});
|
|
83035
|
+
} else {
|
|
83036
|
+
candidateExpr = body;
|
|
83037
|
+
}
|
|
82916
83038
|
}
|
|
82917
|
-
return
|
|
83039
|
+
return candidateExpr;
|
|
82918
83040
|
}
|
|
82919
83041
|
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
|
|
82920
83042
|
const signatureDeclaration = getParseTreeNode(signatureDeclarationIn, isFunctionLike);
|
|
@@ -82926,7 +83048,15 @@ function createTypeChecker(host) {
|
|
|
82926
83048
|
if (typePredicate) {
|
|
82927
83049
|
return nodeBuilder.typePredicateToTypePredicateNode(typePredicate, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
82928
83050
|
}
|
|
82929
|
-
return nodeBuilder.
|
|
83051
|
+
return nodeBuilder.expressionOrTypeToTypeNode(
|
|
83052
|
+
getPossibleTypeNodeReuseExpression(signatureDeclaration),
|
|
83053
|
+
getReturnTypeOfSignature(signature),
|
|
83054
|
+
/*addUndefined*/
|
|
83055
|
+
void 0,
|
|
83056
|
+
enclosingDeclaration,
|
|
83057
|
+
flags | 1024 /* MultilineObjectLiterals */,
|
|
83058
|
+
tracker
|
|
83059
|
+
);
|
|
82930
83060
|
}
|
|
82931
83061
|
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
|
|
82932
83062
|
const expr = getParseTreeNode(exprIn, isExpression);
|
|
@@ -82934,7 +83064,15 @@ function createTypeChecker(host) {
|
|
|
82934
83064
|
return factory.createToken(133 /* AnyKeyword */);
|
|
82935
83065
|
}
|
|
82936
83066
|
const type = getWidenedType(getRegularTypeOfExpression(expr));
|
|
82937
|
-
return nodeBuilder.
|
|
83067
|
+
return nodeBuilder.expressionOrTypeToTypeNode(
|
|
83068
|
+
expr,
|
|
83069
|
+
type,
|
|
83070
|
+
/*addUndefined*/
|
|
83071
|
+
void 0,
|
|
83072
|
+
enclosingDeclaration,
|
|
83073
|
+
flags | 1024 /* MultilineObjectLiterals */,
|
|
83074
|
+
tracker
|
|
83075
|
+
);
|
|
82938
83076
|
}
|
|
82939
83077
|
function hasGlobalName(name) {
|
|
82940
83078
|
return globals.has(escapeLeadingUnderscores(name));
|
|
@@ -108454,10 +108592,10 @@ function transformDeclarations(context) {
|
|
|
108454
108592
|
return newFile;
|
|
108455
108593
|
}
|
|
108456
108594
|
needsDeclare = true;
|
|
108457
|
-
const
|
|
108595
|
+
const updated = isSourceFileJS(sourceFile) ? factory2.createNodeArray(transformDeclarationsForJS(sourceFile)) : visitNodes2(sourceFile.statements, visitDeclarationStatements, isStatement);
|
|
108458
108596
|
return factory2.updateSourceFile(
|
|
108459
108597
|
sourceFile,
|
|
108460
|
-
transformAndReplaceLatePaintedStatements(
|
|
108598
|
+
transformAndReplaceLatePaintedStatements(updated),
|
|
108461
108599
|
/*isDeclarationFile*/
|
|
108462
108600
|
true,
|
|
108463
108601
|
/*referencedFiles*/
|
|
@@ -108521,7 +108659,7 @@ function transformDeclarations(context) {
|
|
|
108521
108659
|
combinedStatements = setTextRange(factory2.createNodeArray([...combinedStatements, createEmptyExports(factory2)]), combinedStatements);
|
|
108522
108660
|
}
|
|
108523
108661
|
}
|
|
108524
|
-
|
|
108662
|
+
return factory2.updateSourceFile(
|
|
108525
108663
|
node,
|
|
108526
108664
|
combinedStatements,
|
|
108527
108665
|
/*isDeclarationFile*/
|
|
@@ -108531,8 +108669,6 @@ function transformDeclarations(context) {
|
|
|
108531
108669
|
node.hasNoDefaultLib,
|
|
108532
108670
|
getLibReferences()
|
|
108533
108671
|
);
|
|
108534
|
-
updated.exportedModulesFromDeclarationEmit = exportedModulesFromDeclarationEmit;
|
|
108535
|
-
return updated;
|
|
108536
108672
|
function getLibReferences() {
|
|
108537
108673
|
return arrayFrom(libs2.keys(), (lib) => ({ fileName: lib, pos: -1, end: -1 }));
|
|
108538
108674
|
}
|
|
@@ -119977,12 +120113,11 @@ var BuilderState;
|
|
|
119977
120113
|
}
|
|
119978
120114
|
BuilderState2.canReuseOldState = canReuseOldState;
|
|
119979
120115
|
function create(newProgram, oldState, disableUseFileVersionAsSignature) {
|
|
119980
|
-
var _a, _b
|
|
120116
|
+
var _a, _b;
|
|
119981
120117
|
const fileInfos = /* @__PURE__ */ new Map();
|
|
119982
120118
|
const options = newProgram.getCompilerOptions();
|
|
119983
120119
|
const isOutFile = options.outFile;
|
|
119984
120120
|
const referencedMap = options.module !== 0 /* None */ && !isOutFile ? createManyToManyPathMap() : void 0;
|
|
119985
|
-
const exportedModulesMap = referencedMap ? createManyToManyPathMap() : void 0;
|
|
119986
120121
|
const useOldState = canReuseOldState(referencedMap, oldState);
|
|
119987
120122
|
newProgram.getTypeChecker();
|
|
119988
120123
|
for (const sourceFile of newProgram.getSourceFiles()) {
|
|
@@ -119994,13 +120129,6 @@ var BuilderState;
|
|
|
119994
120129
|
if (newReferences) {
|
|
119995
120130
|
referencedMap.set(sourceFile.resolvedPath, newReferences);
|
|
119996
120131
|
}
|
|
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
120132
|
}
|
|
120005
120133
|
fileInfos.set(sourceFile.resolvedPath, {
|
|
120006
120134
|
version: version2,
|
|
@@ -120013,7 +120141,6 @@ var BuilderState;
|
|
|
120013
120141
|
return {
|
|
120014
120142
|
fileInfos,
|
|
120015
120143
|
referencedMap,
|
|
120016
|
-
exportedModulesMap,
|
|
120017
120144
|
useFileVersionAsSignature: !disableUseFileVersionAsSignature && !useOldState
|
|
120018
120145
|
};
|
|
120019
120146
|
}
|
|
@@ -120024,7 +120151,7 @@ var BuilderState;
|
|
|
120024
120151
|
}
|
|
120025
120152
|
BuilderState2.releaseCache = releaseCache2;
|
|
120026
120153
|
function getFilesAffectedBy(state, programOfThisState, path, cancellationToken, host) {
|
|
120027
|
-
var _a
|
|
120154
|
+
var _a;
|
|
120028
120155
|
const result = getFilesAffectedByWithOldState(
|
|
120029
120156
|
state,
|
|
120030
120157
|
programOfThisState,
|
|
@@ -120033,7 +120160,6 @@ var BuilderState;
|
|
|
120033
120160
|
host
|
|
120034
120161
|
);
|
|
120035
120162
|
(_a = state.oldSignatures) == null ? void 0 : _a.clear();
|
|
120036
|
-
(_b = state.oldExportedModulesMap) == null ? void 0 : _b.clear();
|
|
120037
120163
|
return result;
|
|
120038
120164
|
}
|
|
120039
120165
|
BuilderState2.getFilesAffectedBy = getFilesAffectedBy;
|
|
@@ -120087,24 +120213,16 @@ var BuilderState;
|
|
|
120087
120213
|
const prevSignature = info.signature;
|
|
120088
120214
|
let latestSignature;
|
|
120089
120215
|
if (!sourceFile.isDeclarationFile && !useFileVersionAsSignature) {
|
|
120090
|
-
computeDtsSignature(programOfThisState, sourceFile, cancellationToken, host, (signature
|
|
120216
|
+
computeDtsSignature(programOfThisState, sourceFile, cancellationToken, host, (signature) => {
|
|
120091
120217
|
latestSignature = signature;
|
|
120092
|
-
if (
|
|
120093
|
-
|
|
120094
|
-
}
|
|
120218
|
+
if (host.storeSignatureInfo)
|
|
120219
|
+
(state.signatureInfo ?? (state.signatureInfo = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, 0 /* ComputedDts */);
|
|
120095
120220
|
});
|
|
120096
120221
|
}
|
|
120097
120222
|
if (latestSignature === void 0) {
|
|
120098
120223
|
latestSignature = sourceFile.version;
|
|
120099
|
-
if (
|
|
120100
|
-
(state.
|
|
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
|
-
}
|
|
120224
|
+
if (host.storeSignatureInfo)
|
|
120225
|
+
(state.signatureInfo ?? (state.signatureInfo = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, 2 /* UsedVersion */);
|
|
120108
120226
|
}
|
|
120109
120227
|
(state.oldSignatures || (state.oldSignatures = /* @__PURE__ */ new Map())).set(sourceFile.resolvedPath, prevSignature || false);
|
|
120110
120228
|
(state.hasCalledUpdateShapeSignature || (state.hasCalledUpdateShapeSignature = /* @__PURE__ */ new Set())).add(sourceFile.resolvedPath);
|
|
@@ -120112,28 +120230,6 @@ var BuilderState;
|
|
|
120112
120230
|
return latestSignature !== prevSignature;
|
|
120113
120231
|
}
|
|
120114
120232
|
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
120233
|
function getAllDependencies(state, programOfThisState, sourceFile) {
|
|
120138
120234
|
const compilerOptions = programOfThisState.getCompilerOptions();
|
|
120139
120235
|
if (compilerOptions.outFile) {
|
|
@@ -120496,7 +120592,7 @@ function assertSourceFileOkWithoutNextAffectedCall(state, sourceFile) {
|
|
|
120496
120592
|
Debug.assert(!sourceFile || !state.affectedFiles || state.affectedFiles[state.affectedFilesIndex - 1] !== sourceFile || !state.semanticDiagnosticsPerFile.has(sourceFile.resolvedPath));
|
|
120497
120593
|
}
|
|
120498
120594
|
function getNextAffectedFile(state, cancellationToken, host) {
|
|
120499
|
-
var _a
|
|
120595
|
+
var _a;
|
|
120500
120596
|
while (true) {
|
|
120501
120597
|
const { affectedFiles } = state;
|
|
120502
120598
|
if (affectedFiles) {
|
|
@@ -120520,7 +120616,6 @@ function getNextAffectedFile(state, cancellationToken, host) {
|
|
|
120520
120616
|
state.changedFilesSet.delete(state.currentChangedFilePath);
|
|
120521
120617
|
state.currentChangedFilePath = void 0;
|
|
120522
120618
|
(_a = state.oldSignatures) == null ? void 0 : _a.clear();
|
|
120523
|
-
(_b = state.oldExportedModulesMap) == null ? void 0 : _b.clear();
|
|
120524
120619
|
state.affectedFiles = void 0;
|
|
120525
120620
|
}
|
|
120526
120621
|
const nextKey = state.changedFilesSet.keys().next();
|
|
@@ -120681,7 +120776,7 @@ function handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, hos
|
|
|
120681
120776
|
}
|
|
120682
120777
|
function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile, cancellationToken, host) {
|
|
120683
120778
|
var _a;
|
|
120684
|
-
if (!state.
|
|
120779
|
+
if (!state.referencedMap || !state.changedFilesSet.has(affectedFile.resolvedPath))
|
|
120685
120780
|
return;
|
|
120686
120781
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
120687
120782
|
return;
|
|
@@ -120704,7 +120799,7 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
|
|
|
120704
120799
|
}
|
|
120705
120800
|
}
|
|
120706
120801
|
const seenFileAndExportsOfFile = /* @__PURE__ */ new Set();
|
|
120707
|
-
(_a = state.
|
|
120802
|
+
(_a = state.referencedMap.getKeys(affectedFile.resolvedPath)) == null ? void 0 : _a.forEach((exportedFromPath) => {
|
|
120708
120803
|
if (handleDtsMayChangeOfGlobalScope(state, exportedFromPath, cancellationToken, host))
|
|
120709
120804
|
return true;
|
|
120710
120805
|
const references = state.referencedMap.getKeys(exportedFromPath);
|
|
@@ -120718,27 +120813,17 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
|
|
|
120718
120813
|
});
|
|
120719
120814
|
}
|
|
120720
120815
|
function handleDtsMayChangeOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, cancellationToken, host) {
|
|
120721
|
-
var _a
|
|
120816
|
+
var _a;
|
|
120722
120817
|
if (!tryAddToSet(seenFileAndExportsOfFile, filePath))
|
|
120723
120818
|
return void 0;
|
|
120724
120819
|
if (handleDtsMayChangeOfGlobalScope(state, filePath, cancellationToken, host))
|
|
120725
120820
|
return true;
|
|
120726
120821
|
handleDtsMayChangeOf(state, filePath, cancellationToken, host);
|
|
120727
|
-
(_a = state.
|
|
120728
|
-
(
|
|
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
|
|
120822
|
+
(_a = state.referencedMap.getKeys(filePath)) == null ? void 0 : _a.forEach(
|
|
120823
|
+
(referencingFilePath) => handleDtsMayChangeOfFileAndExportsOfFile(
|
|
120740
120824
|
state,
|
|
120741
120825
|
referencingFilePath,
|
|
120826
|
+
seenFileAndExportsOfFile,
|
|
120742
120827
|
cancellationToken,
|
|
120743
120828
|
host
|
|
120744
120829
|
)
|
|
@@ -120853,18 +120938,6 @@ function getBuildInfo2(state) {
|
|
|
120853
120938
|
toFileIdListId(state.referencedMap.getValues(key))
|
|
120854
120939
|
]);
|
|
120855
120940
|
}
|
|
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
120941
|
const semanticDiagnosticsPerFile = convertToProgramBuildInfoDiagnostics(state.semanticDiagnosticsPerFile);
|
|
120869
120942
|
let affectedFilesPendingEmit;
|
|
120870
120943
|
if ((_a = state.affectedFilesPendingEmit) == null ? void 0 : _a.size) {
|
|
@@ -120903,7 +120976,6 @@ function getBuildInfo2(state) {
|
|
|
120903
120976
|
options: convertToProgramBuildInfoCompilerOptions(state.compilerOptions),
|
|
120904
120977
|
fileIdsList,
|
|
120905
120978
|
referencedMap,
|
|
120906
|
-
exportedModulesMap,
|
|
120907
120979
|
semanticDiagnosticsPerFile,
|
|
120908
120980
|
emitDiagnosticsPerFile,
|
|
120909
120981
|
affectedFilesPendingEmit,
|
|
@@ -121218,7 +121290,7 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
121218
121290
|
if (!getEmitDeclarations(state.compilerOptions))
|
|
121219
121291
|
return writeFile2 || maybeBind(host, host.writeFile);
|
|
121220
121292
|
return (fileName, text, writeByteOrderMark, onError, sourceFiles, data) => {
|
|
121221
|
-
var _a, _b, _c
|
|
121293
|
+
var _a, _b, _c;
|
|
121222
121294
|
if (isDeclarationFileName(fileName)) {
|
|
121223
121295
|
if (!state.compilerOptions.outFile) {
|
|
121224
121296
|
Debug.assert((sourceFiles == null ? void 0 : sourceFiles.length) === 1);
|
|
@@ -121237,10 +121309,8 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
121237
121309
|
if (!((_a = data == null ? void 0 : data.diagnostics) == null ? void 0 : _a.length))
|
|
121238
121310
|
emitSignature = signature;
|
|
121239
121311
|
if (signature !== file.version) {
|
|
121240
|
-
if (host.
|
|
121241
|
-
(state.
|
|
121242
|
-
if (state.exportedModulesMap)
|
|
121243
|
-
BuilderState.updateExportedModules(state, file, file.exportedModulesFromDeclarationEmit);
|
|
121312
|
+
if (host.storeSignatureInfo)
|
|
121313
|
+
(state.signatureInfo ?? (state.signatureInfo = /* @__PURE__ */ new Map())).set(file.resolvedPath, 1 /* StoredSignatureAtEmit */);
|
|
121244
121314
|
if (state.affectedFiles) {
|
|
121245
121315
|
const existing = (_b = state.oldSignatures) == null ? void 0 : _b.get(file.resolvedPath);
|
|
121246
121316
|
if (existing === void 0)
|
|
@@ -121248,14 +121318,13 @@ function createBuilderProgram(kind, { newProgram, host, oldProgram, configFilePa
|
|
|
121248
121318
|
info.signature = signature;
|
|
121249
121319
|
} else {
|
|
121250
121320
|
info.signature = signature;
|
|
121251
|
-
(_c = state.oldExportedModulesMap) == null ? void 0 : _c.clear();
|
|
121252
121321
|
}
|
|
121253
121322
|
}
|
|
121254
121323
|
}
|
|
121255
121324
|
}
|
|
121256
121325
|
if (state.compilerOptions.composite) {
|
|
121257
121326
|
const filePath = sourceFiles[0].resolvedPath;
|
|
121258
|
-
emitSignature = handleNewSignature((
|
|
121327
|
+
emitSignature = handleNewSignature((_c = state.emitSignatures) == null ? void 0 : _c.get(filePath), emitSignature);
|
|
121259
121328
|
if (!emitSignature)
|
|
121260
121329
|
return;
|
|
121261
121330
|
(state.emitSignatures ?? (state.emitSignatures = /* @__PURE__ */ new Map())).set(filePath, emitSignature);
|
|
@@ -121447,7 +121516,6 @@ function createBuilderProgramUsingProgramBuildInfo(buildInfo, buildInfoPath, hos
|
|
|
121447
121516
|
fileInfos,
|
|
121448
121517
|
compilerOptions: program.options ? convertToOptionsWithAbsolutePaths(program.options, toAbsolutePath) : {},
|
|
121449
121518
|
referencedMap: toManyToManyPathMap(program.referencedMap),
|
|
121450
|
-
exportedModulesMap: toManyToManyPathMap(program.exportedModulesMap),
|
|
121451
121519
|
semanticDiagnosticsPerFile: toPerFileDiagnostics(program.semanticDiagnosticsPerFile),
|
|
121452
121520
|
emitDiagnosticsPerFile: toPerFileDiagnostics(program.emitDiagnosticsPerFile),
|
|
121453
121521
|
hasReusableDiagnostic: true,
|
|
@@ -123107,7 +123175,7 @@ function createCompilerHostFromProgramHost(host, getCompilerOptions, directorySt
|
|
|
123107
123175
|
getEnvironmentVariable: maybeBind(host, host.getEnvironmentVariable) || (() => ""),
|
|
123108
123176
|
createHash: maybeBind(host, host.createHash),
|
|
123109
123177
|
readDirectory: maybeBind(host, host.readDirectory),
|
|
123110
|
-
|
|
123178
|
+
storeSignatureInfo: host.storeSignatureInfo,
|
|
123111
123179
|
jsDocParsingMode: host.jsDocParsingMode
|
|
123112
123180
|
};
|
|
123113
123181
|
return compilerHost;
|
|
@@ -123174,7 +123242,7 @@ function createProgramHost(system, createProgram2) {
|
|
|
123174
123242
|
writeFile: (path, data, writeByteOrderMark) => system.writeFile(path, data, writeByteOrderMark),
|
|
123175
123243
|
createHash: maybeBind(system, system.createHash),
|
|
123176
123244
|
createProgram: createProgram2 || createEmitAndSemanticDiagnosticsBuilderProgram,
|
|
123177
|
-
|
|
123245
|
+
storeSignatureInfo: system.storeSignatureInfo,
|
|
123178
123246
|
now: maybeBind(system, system.now)
|
|
123179
123247
|
};
|
|
123180
123248
|
}
|
|
@@ -123280,7 +123348,7 @@ function createIncrementalCompilerHost(options, system = sys) {
|
|
|
123280
123348
|
system
|
|
123281
123349
|
);
|
|
123282
123350
|
host.createHash = maybeBind(system, system.createHash);
|
|
123283
|
-
host.
|
|
123351
|
+
host.storeSignatureInfo = system.storeSignatureInfo;
|
|
123284
123352
|
setGetSourceFileAsHashVersioned(host);
|
|
123285
123353
|
changeCompilerHostLikeToUseCache(host, (fileName) => toPath(fileName, host.getCurrentDirectory(), host.getCanonicalFileName));
|
|
123286
123354
|
return host;
|