@typescript-deploys/pr-build 5.5.0-pr-57465-103 → 5.5.0-pr-57772-2
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 +172 -108
- package/lib/tsserver.js +172 -108
- package/lib/typescript.js +172 -108
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -39813,7 +39813,7 @@ function createBinder() {
|
|
|
39813
39813
|
inAssignmentPattern = saveInAssignmentPattern;
|
|
39814
39814
|
return;
|
|
39815
39815
|
}
|
|
39816
|
-
if (node.kind >= 243 /* FirstStatement */ && node.kind <= 259 /* LastStatement */ &&
|
|
39816
|
+
if (node.kind >= 243 /* FirstStatement */ && node.kind <= 259 /* LastStatement */ && !options.allowUnreachableCode) {
|
|
39817
39817
|
node.flowNode = currentFlow;
|
|
39818
39818
|
}
|
|
39819
39819
|
switch (node.kind) {
|
|
@@ -47787,6 +47787,18 @@ function createTypeChecker(host) {
|
|
|
47787
47787
|
function createNodeBuilder() {
|
|
47788
47788
|
return {
|
|
47789
47789
|
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
47790
|
+
expressionOrTypeToTypeNode: (type, expr, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
47791
|
+
serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(
|
|
47792
|
+
context,
|
|
47793
|
+
type,
|
|
47794
|
+
symbol,
|
|
47795
|
+
enclosingDeclaration,
|
|
47796
|
+
/*includePrivateSymbol*/
|
|
47797
|
+
void 0,
|
|
47798
|
+
/*bundled*/
|
|
47799
|
+
void 0,
|
|
47800
|
+
addUndefined
|
|
47801
|
+
)),
|
|
47790
47802
|
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
47791
47803
|
indexInfo,
|
|
47792
47804
|
context,
|
|
@@ -47808,6 +47820,47 @@ function createTypeChecker(host) {
|
|
|
47808
47820
|
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker, bundled) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context, bundled)),
|
|
47809
47821
|
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
47810
47822
|
};
|
|
47823
|
+
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
47824
|
+
if (expr) {
|
|
47825
|
+
const typeNode = isAssertionExpression(expr) ? expr.type : isJSDocTypeAssertion(expr) ? getJSDocTypeAssertionType(expr) : void 0;
|
|
47826
|
+
if (typeNode && !isConstTypeReference(typeNode)) {
|
|
47827
|
+
const result = tryReuseExistingTypeNode(context, typeNode, type, expr.parent, addUndefined);
|
|
47828
|
+
if (result) {
|
|
47829
|
+
return result;
|
|
47830
|
+
}
|
|
47831
|
+
}
|
|
47832
|
+
}
|
|
47833
|
+
if (addUndefined) {
|
|
47834
|
+
type = getOptionalType(type);
|
|
47835
|
+
}
|
|
47836
|
+
return typeToTypeNodeHelper(type, context);
|
|
47837
|
+
}
|
|
47838
|
+
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined, includePrivateSymbol, bundled) {
|
|
47839
|
+
const originalType = type;
|
|
47840
|
+
if (addUndefined) {
|
|
47841
|
+
type = getOptionalType(type);
|
|
47842
|
+
}
|
|
47843
|
+
const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2, includePrivateSymbol, bundled);
|
|
47844
|
+
if (clone) {
|
|
47845
|
+
return clone;
|
|
47846
|
+
}
|
|
47847
|
+
if (addUndefined && originalType !== type) {
|
|
47848
|
+
const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host2, includePrivateSymbol, bundled);
|
|
47849
|
+
if (cloneMissingUndefined) {
|
|
47850
|
+
return factory.createUnionTypeNode([cloneMissingUndefined, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
47851
|
+
}
|
|
47852
|
+
}
|
|
47853
|
+
return void 0;
|
|
47854
|
+
}
|
|
47855
|
+
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, includePrivateSymbol, bundled, annotationType) {
|
|
47856
|
+
if (typeNodeIsEquivalentToType(existing, host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
47857
|
+
const result = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
|
|
47858
|
+
if (result) {
|
|
47859
|
+
return result;
|
|
47860
|
+
}
|
|
47861
|
+
}
|
|
47862
|
+
return void 0;
|
|
47863
|
+
}
|
|
47811
47864
|
function symbolToNode(symbol, context, meaning) {
|
|
47812
47865
|
if (context.flags & 1073741824 /* WriteComputedProps */) {
|
|
47813
47866
|
if (symbol.valueDeclaration) {
|
|
@@ -48249,8 +48302,8 @@ function createTypeChecker(host) {
|
|
|
48249
48302
|
if (isInstantiationExpressionType) {
|
|
48250
48303
|
const instantiationExpressionType = type2;
|
|
48251
48304
|
const existing = instantiationExpressionType.node;
|
|
48252
|
-
if (isTypeQueryNode(existing)
|
|
48253
|
-
const typeNode =
|
|
48305
|
+
if (isTypeQueryNode(existing)) {
|
|
48306
|
+
const typeNode = tryReuseExistingNonParameterTypeNode(context, existing, type2);
|
|
48254
48307
|
if (typeNode) {
|
|
48255
48308
|
return typeNode;
|
|
48256
48309
|
}
|
|
@@ -49053,11 +49106,9 @@ function createTypeChecker(host) {
|
|
|
49053
49106
|
}
|
|
49054
49107
|
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) {
|
|
49055
49108
|
const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
|
|
49056
|
-
|
|
49057
|
-
|
|
49058
|
-
|
|
49059
|
-
}
|
|
49060
|
-
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
|
|
49109
|
+
const parameterType = getTypeOfSymbol(parameterSymbol);
|
|
49110
|
+
const addUndefined = parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration);
|
|
49111
|
+
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports, addUndefined);
|
|
49061
49112
|
const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
|
|
49062
49113
|
const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
49063
49114
|
const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
|
|
@@ -49647,16 +49698,15 @@ function createTypeChecker(host) {
|
|
|
49647
49698
|
}
|
|
49648
49699
|
return enclosingDeclaration;
|
|
49649
49700
|
}
|
|
49650
|
-
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
49701
|
+
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled, addUndefined) {
|
|
49702
|
+
var _a;
|
|
49651
49703
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
49652
49704
|
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
49653
49705
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
49654
49706
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
49655
|
-
|
|
49656
|
-
|
|
49657
|
-
|
|
49658
|
-
return result2;
|
|
49659
|
-
}
|
|
49707
|
+
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined, includePrivateSymbol, bundled);
|
|
49708
|
+
if (result2) {
|
|
49709
|
+
return result2;
|
|
49660
49710
|
}
|
|
49661
49711
|
}
|
|
49662
49712
|
}
|
|
@@ -49664,16 +49714,17 @@ function createTypeChecker(host) {
|
|
|
49664
49714
|
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
|
|
49665
49715
|
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
|
|
49666
49716
|
}
|
|
49667
|
-
const
|
|
49717
|
+
const decl = symbol.valueDeclaration || ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
|
49718
|
+
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
49719
|
+
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
|
|
49668
49720
|
context.flags = oldFlags;
|
|
49669
49721
|
return result;
|
|
49670
49722
|
}
|
|
49671
|
-
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
|
|
49672
|
-
const typeFromTypeNode = getTypeFromTypeNode(typeNode);
|
|
49723
|
+
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type, typeFromTypeNode = getTypeFromTypeNode(typeNode)) {
|
|
49673
49724
|
if (typeFromTypeNode === type) {
|
|
49674
49725
|
return true;
|
|
49675
49726
|
}
|
|
49676
|
-
if (isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
|
|
49727
|
+
if (annotatedDeclaration && (isParameter(annotatedDeclaration) || isPropertyDeclaration(annotatedDeclaration)) && annotatedDeclaration.questionToken) {
|
|
49677
49728
|
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
49678
49729
|
}
|
|
49679
49730
|
return false;
|
|
@@ -49685,11 +49736,9 @@ function createTypeChecker(host) {
|
|
|
49685
49736
|
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
49686
49737
|
const annotated = getTypeFromTypeNode(annotation);
|
|
49687
49738
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
49688
|
-
|
|
49689
|
-
|
|
49690
|
-
|
|
49691
|
-
return result;
|
|
49692
|
-
}
|
|
49739
|
+
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, includePrivateSymbol, bundled, thisInstantiated);
|
|
49740
|
+
if (result) {
|
|
49741
|
+
return result;
|
|
49693
49742
|
}
|
|
49694
49743
|
}
|
|
49695
49744
|
}
|
|
@@ -49718,7 +49767,9 @@ function createTypeChecker(host) {
|
|
|
49718
49767
|
/*shouldComputeAliasesToMakeVisible*/
|
|
49719
49768
|
false
|
|
49720
49769
|
).accessibility !== 0 /* Accessible */) {
|
|
49721
|
-
|
|
49770
|
+
if (!isDeclarationName(node)) {
|
|
49771
|
+
introducesError = true;
|
|
49772
|
+
}
|
|
49722
49773
|
} else {
|
|
49723
49774
|
context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
|
|
49724
49775
|
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
|
|
@@ -49856,6 +49907,31 @@ function createTypeChecker(host) {
|
|
|
49856
49907
|
node.isTypeOf
|
|
49857
49908
|
);
|
|
49858
49909
|
}
|
|
49910
|
+
if (isParameter(node)) {
|
|
49911
|
+
if (!node.type && !node.initializer) {
|
|
49912
|
+
return factory.updateParameterDeclaration(
|
|
49913
|
+
node,
|
|
49914
|
+
/*modifiers*/
|
|
49915
|
+
void 0,
|
|
49916
|
+
node.dotDotDotToken,
|
|
49917
|
+
visitEachChild(
|
|
49918
|
+
node.name,
|
|
49919
|
+
visitExistingNodeTreeSymbols,
|
|
49920
|
+
/*context*/
|
|
49921
|
+
void 0
|
|
49922
|
+
),
|
|
49923
|
+
node.questionToken,
|
|
49924
|
+
factory.createKeywordTypeNode(133 /* AnyKeyword */),
|
|
49925
|
+
/*initializer*/
|
|
49926
|
+
void 0
|
|
49927
|
+
);
|
|
49928
|
+
}
|
|
49929
|
+
}
|
|
49930
|
+
if (isPropertySignature(node)) {
|
|
49931
|
+
if (!node.type && !node.initializer) {
|
|
49932
|
+
return factory.updatePropertySignature(node, node.modifiers, node.name, node.questionToken, factory.createKeywordTypeNode(133 /* AnyKeyword */));
|
|
49933
|
+
}
|
|
49934
|
+
}
|
|
49859
49935
|
if (isEntityName(node) || isEntityNameExpression(node)) {
|
|
49860
49936
|
const { introducesError, node: result } = trackExistingEntityName(node, context, includePrivateSymbol);
|
|
49861
49937
|
hadError = hadError || introducesError;
|
|
@@ -49863,7 +49939,7 @@ function createTypeChecker(host) {
|
|
|
49863
49939
|
return result;
|
|
49864
49940
|
}
|
|
49865
49941
|
}
|
|
49866
|
-
if (file && isTupleTypeNode(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
|
|
49942
|
+
if (file && isTupleTypeNode(node) && !nodeIsSynthesized(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
|
|
49867
49943
|
setEmitFlags(node, 1 /* SingleLine */);
|
|
49868
49944
|
}
|
|
49869
49945
|
return visitEachChild(
|
|
@@ -50387,7 +50463,15 @@ function createTypeChecker(host) {
|
|
|
50387
50463
|
context.flags |= 8388608 /* InTypeAlias */;
|
|
50388
50464
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
50389
50465
|
context.enclosingDeclaration = jsdocAliasDecl;
|
|
50390
|
-
const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) &&
|
|
50466
|
+
const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && tryReuseExistingNonParameterTypeNode(
|
|
50467
|
+
context,
|
|
50468
|
+
jsdocAliasDecl.typeExpression.type,
|
|
50469
|
+
aliasType,
|
|
50470
|
+
/*host*/
|
|
50471
|
+
void 0,
|
|
50472
|
+
includePrivateSymbol,
|
|
50473
|
+
bundled
|
|
50474
|
+
) || typeToTypeNodeHelper(aliasType, context);
|
|
50391
50475
|
addResult(
|
|
50392
50476
|
setSyntheticLeadingComments(
|
|
50393
50477
|
factory.createTypeAliasDeclaration(
|
|
@@ -50620,7 +50704,15 @@ function createTypeChecker(host) {
|
|
|
50620
50704
|
}
|
|
50621
50705
|
return cleanup(factory.createExpressionWithTypeArguments(
|
|
50622
50706
|
expr,
|
|
50623
|
-
map(e.typeArguments, (a) =>
|
|
50707
|
+
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(
|
|
50708
|
+
context,
|
|
50709
|
+
a,
|
|
50710
|
+
getTypeFromTypeNode(a),
|
|
50711
|
+
/*host*/
|
|
50712
|
+
void 0,
|
|
50713
|
+
includePrivateSymbol,
|
|
50714
|
+
bundled
|
|
50715
|
+
) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
|
|
50624
50716
|
));
|
|
50625
50717
|
function cleanup(result2) {
|
|
50626
50718
|
context.enclosingDeclaration = oldEnclosing;
|
|
@@ -51079,8 +51171,10 @@ function createTypeChecker(host) {
|
|
|
51079
51171
|
}
|
|
51080
51172
|
}
|
|
51081
51173
|
function isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, hostSymbol) {
|
|
51174
|
+
var _a2;
|
|
51082
51175
|
const ctxSrc = getSourceFileOfNode(context.enclosingDeclaration);
|
|
51083
|
-
return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !
|
|
51176
|
+
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
|
|
51177
|
+
!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
|
|
51084
51178
|
!!(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
|
|
51085
51179
|
!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) => {
|
|
51086
51180
|
if (!isIdentifierText(symbolName(p), languageVersion)) {
|
|
@@ -55659,15 +55753,7 @@ function createTypeChecker(host) {
|
|
|
55659
55753
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
55660
55754
|
}
|
|
55661
55755
|
}
|
|
55662
|
-
|
|
55663
|
-
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
55664
|
-
} else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType.flags & 16 /* Boolean */) && getParameterCount(signature) > 0) {
|
|
55665
|
-
const { declaration } = signature;
|
|
55666
|
-
signature.resolvedTypePredicate = noTypePredicate;
|
|
55667
|
-
signature.resolvedTypePredicate = getTypePredicateFromBody(declaration) || noTypePredicate;
|
|
55668
|
-
} else {
|
|
55669
|
-
signature.resolvedTypePredicate = noTypePredicate;
|
|
55670
|
-
}
|
|
55756
|
+
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
55671
55757
|
}
|
|
55672
55758
|
Debug.assert(!!signature.resolvedTypePredicate);
|
|
55673
55759
|
}
|
|
@@ -71514,7 +71600,10 @@ function createTypeChecker(host) {
|
|
|
71514
71600
|
return Debug.fail();
|
|
71515
71601
|
}
|
|
71516
71602
|
function getDecoratorArgumentCount(node, signature) {
|
|
71517
|
-
return compilerOptions.experimentalDecorators ? getLegacyDecoratorArgumentCount(node, signature) :
|
|
71603
|
+
return compilerOptions.experimentalDecorators ? getLegacyDecoratorArgumentCount(node, signature) : (
|
|
71604
|
+
// Allow the runtime to oversupply arguments to an ES decorator as long as there's at least one parameter.
|
|
71605
|
+
Math.min(Math.max(getParameterCount(signature), 1), 2)
|
|
71606
|
+
);
|
|
71518
71607
|
}
|
|
71519
71608
|
function getLegacyDecoratorArgumentCount(node, signature) {
|
|
71520
71609
|
switch (node.parent.kind) {
|
|
@@ -74094,67 +74183,6 @@ function createTypeChecker(host) {
|
|
|
74094
74183
|
return false;
|
|
74095
74184
|
}
|
|
74096
74185
|
}
|
|
74097
|
-
function getTypePredicateFromBody(func) {
|
|
74098
|
-
switch (func.kind) {
|
|
74099
|
-
case 176 /* Constructor */:
|
|
74100
|
-
case 177 /* GetAccessor */:
|
|
74101
|
-
case 178 /* SetAccessor */:
|
|
74102
|
-
return void 0;
|
|
74103
|
-
}
|
|
74104
|
-
const functionFlags = getFunctionFlags(func);
|
|
74105
|
-
if (functionFlags !== 0 /* Normal */)
|
|
74106
|
-
return void 0;
|
|
74107
|
-
let singleReturn;
|
|
74108
|
-
if (func.body && func.body.kind !== 241 /* Block */) {
|
|
74109
|
-
singleReturn = func.body;
|
|
74110
|
-
} else {
|
|
74111
|
-
const bailedEarly = forEachReturnStatement(func.body, (returnStatement) => {
|
|
74112
|
-
if (singleReturn || !returnStatement.expression)
|
|
74113
|
-
return true;
|
|
74114
|
-
singleReturn = returnStatement.expression;
|
|
74115
|
-
});
|
|
74116
|
-
if (bailedEarly || !singleReturn || functionHasImplicitReturn(func))
|
|
74117
|
-
return void 0;
|
|
74118
|
-
}
|
|
74119
|
-
return checkIfExpressionRefinesAnyParameter(func, singleReturn);
|
|
74120
|
-
}
|
|
74121
|
-
function checkIfExpressionRefinesAnyParameter(func, expr) {
|
|
74122
|
-
expr = skipParentheses(
|
|
74123
|
-
expr,
|
|
74124
|
-
/*excludeJSDocTypeAssertions*/
|
|
74125
|
-
true
|
|
74126
|
-
);
|
|
74127
|
-
const returnType = checkExpressionCached(expr);
|
|
74128
|
-
if (!(returnType.flags & 16 /* Boolean */))
|
|
74129
|
-
return void 0;
|
|
74130
|
-
return forEach(func.parameters, (param, i) => {
|
|
74131
|
-
const initType = getTypeOfSymbol(param.symbol);
|
|
74132
|
-
if (!initType || initType.flags & 16 /* Boolean */ || !isIdentifier(param.name) || isSymbolAssigned(param.symbol) || isRestParameter(param)) {
|
|
74133
|
-
return;
|
|
74134
|
-
}
|
|
74135
|
-
const trueType2 = checkIfExpressionRefinesParameter(func, expr, param, initType);
|
|
74136
|
-
if (trueType2) {
|
|
74137
|
-
return createTypePredicate(1 /* Identifier */, unescapeLeadingUnderscores(param.name.escapedText), i, trueType2);
|
|
74138
|
-
}
|
|
74139
|
-
});
|
|
74140
|
-
}
|
|
74141
|
-
function checkIfExpressionRefinesParameter(func, expr, param, initType) {
|
|
74142
|
-
const antecedent = expr.flowNode || expr.parent.kind === 253 /* ReturnStatement */ && expr.parent.flowNode || { flags: 2 /* Start */ };
|
|
74143
|
-
const trueCondition = {
|
|
74144
|
-
flags: 32 /* TrueCondition */,
|
|
74145
|
-
node: expr,
|
|
74146
|
-
antecedent
|
|
74147
|
-
};
|
|
74148
|
-
const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
|
|
74149
|
-
if (trueType2 === initType)
|
|
74150
|
-
return void 0;
|
|
74151
|
-
const falseCondition = {
|
|
74152
|
-
...trueCondition,
|
|
74153
|
-
flags: 64 /* FalseCondition */
|
|
74154
|
-
};
|
|
74155
|
-
const falseSubtype = getFlowTypeOfReference(param.name, trueType2, trueType2, func, falseCondition);
|
|
74156
|
-
return falseSubtype.flags & 131072 /* Never */ ? trueType2 : void 0;
|
|
74157
|
-
}
|
|
74158
74186
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
|
|
74159
74187
|
addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
|
|
74160
74188
|
return;
|
|
@@ -82907,14 +82935,34 @@ function createTypeChecker(host) {
|
|
|
82907
82935
|
return factory.createToken(133 /* AnyKeyword */);
|
|
82908
82936
|
}
|
|
82909
82937
|
const symbol = getSymbolOfDeclaration(declaration);
|
|
82910
|
-
|
|
82911
|
-
|
|
82912
|
-
|
|
82913
|
-
|
|
82914
|
-
|
|
82915
|
-
|
|
82938
|
+
const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
|
|
82939
|
+
return nodeBuilder.serializeTypeForDeclaration(type, symbol, addUndefined, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
82940
|
+
}
|
|
82941
|
+
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
82942
|
+
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
82943
|
+
}
|
|
82944
|
+
function getPossibleTypeNodeReuseExpression(declaration) {
|
|
82945
|
+
var _a;
|
|
82946
|
+
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;
|
|
82947
|
+
}
|
|
82948
|
+
function getSingleReturnExpression(declaration) {
|
|
82949
|
+
let candidateExpr;
|
|
82950
|
+
if (declaration && !nodeIsMissing(declaration.body)) {
|
|
82951
|
+
const body = declaration.body;
|
|
82952
|
+
if (body && isBlock(body)) {
|
|
82953
|
+
forEachReturnStatement(body, (s) => {
|
|
82954
|
+
if (!candidateExpr) {
|
|
82955
|
+
candidateExpr = s.expression;
|
|
82956
|
+
} else {
|
|
82957
|
+
candidateExpr = void 0;
|
|
82958
|
+
return true;
|
|
82959
|
+
}
|
|
82960
|
+
});
|
|
82961
|
+
} else {
|
|
82962
|
+
candidateExpr = body;
|
|
82963
|
+
}
|
|
82916
82964
|
}
|
|
82917
|
-
return
|
|
82965
|
+
return candidateExpr;
|
|
82918
82966
|
}
|
|
82919
82967
|
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
|
|
82920
82968
|
const signatureDeclaration = getParseTreeNode(signatureDeclarationIn, isFunctionLike);
|
|
@@ -82922,7 +82970,15 @@ function createTypeChecker(host) {
|
|
|
82922
82970
|
return factory.createToken(133 /* AnyKeyword */);
|
|
82923
82971
|
}
|
|
82924
82972
|
const signature = getSignatureFromDeclaration(signatureDeclaration);
|
|
82925
|
-
return nodeBuilder.
|
|
82973
|
+
return nodeBuilder.expressionOrTypeToTypeNode(
|
|
82974
|
+
getReturnTypeOfSignature(signature),
|
|
82975
|
+
getPossibleTypeNodeReuseExpression(signatureDeclaration),
|
|
82976
|
+
/*addUndefined*/
|
|
82977
|
+
void 0,
|
|
82978
|
+
enclosingDeclaration,
|
|
82979
|
+
flags | 1024 /* MultilineObjectLiterals */,
|
|
82980
|
+
tracker
|
|
82981
|
+
);
|
|
82926
82982
|
}
|
|
82927
82983
|
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
|
|
82928
82984
|
const expr = getParseTreeNode(exprIn, isExpression);
|
|
@@ -82930,7 +82986,15 @@ function createTypeChecker(host) {
|
|
|
82930
82986
|
return factory.createToken(133 /* AnyKeyword */);
|
|
82931
82987
|
}
|
|
82932
82988
|
const type = getWidenedType(getRegularTypeOfExpression(expr));
|
|
82933
|
-
return nodeBuilder.
|
|
82989
|
+
return nodeBuilder.expressionOrTypeToTypeNode(
|
|
82990
|
+
type,
|
|
82991
|
+
expr,
|
|
82992
|
+
/*addUndefined*/
|
|
82993
|
+
void 0,
|
|
82994
|
+
enclosingDeclaration,
|
|
82995
|
+
flags | 1024 /* MultilineObjectLiterals */,
|
|
82996
|
+
tracker
|
|
82997
|
+
);
|
|
82934
82998
|
}
|
|
82935
82999
|
function hasGlobalName(name) {
|
|
82936
83000
|
return globals.has(escapeLeadingUnderscores(name));
|
package/lib/tsserver.js
CHANGED
|
@@ -44512,7 +44512,7 @@ function createBinder() {
|
|
|
44512
44512
|
inAssignmentPattern = saveInAssignmentPattern;
|
|
44513
44513
|
return;
|
|
44514
44514
|
}
|
|
44515
|
-
if (node.kind >= 243 /* FirstStatement */ && node.kind <= 259 /* LastStatement */ &&
|
|
44515
|
+
if (node.kind >= 243 /* FirstStatement */ && node.kind <= 259 /* LastStatement */ && !options.allowUnreachableCode) {
|
|
44516
44516
|
node.flowNode = currentFlow;
|
|
44517
44517
|
}
|
|
44518
44518
|
switch (node.kind) {
|
|
@@ -52540,6 +52540,18 @@ function createTypeChecker(host) {
|
|
|
52540
52540
|
function createNodeBuilder() {
|
|
52541
52541
|
return {
|
|
52542
52542
|
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
52543
|
+
expressionOrTypeToTypeNode: (type, expr, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
52544
|
+
serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(
|
|
52545
|
+
context,
|
|
52546
|
+
type,
|
|
52547
|
+
symbol,
|
|
52548
|
+
enclosingDeclaration,
|
|
52549
|
+
/*includePrivateSymbol*/
|
|
52550
|
+
void 0,
|
|
52551
|
+
/*bundled*/
|
|
52552
|
+
void 0,
|
|
52553
|
+
addUndefined
|
|
52554
|
+
)),
|
|
52543
52555
|
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
52544
52556
|
indexInfo,
|
|
52545
52557
|
context,
|
|
@@ -52561,6 +52573,47 @@ function createTypeChecker(host) {
|
|
|
52561
52573
|
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker, bundled) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context, bundled)),
|
|
52562
52574
|
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
52563
52575
|
};
|
|
52576
|
+
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
52577
|
+
if (expr) {
|
|
52578
|
+
const typeNode = isAssertionExpression(expr) ? expr.type : isJSDocTypeAssertion(expr) ? getJSDocTypeAssertionType(expr) : void 0;
|
|
52579
|
+
if (typeNode && !isConstTypeReference(typeNode)) {
|
|
52580
|
+
const result = tryReuseExistingTypeNode(context, typeNode, type, expr.parent, addUndefined);
|
|
52581
|
+
if (result) {
|
|
52582
|
+
return result;
|
|
52583
|
+
}
|
|
52584
|
+
}
|
|
52585
|
+
}
|
|
52586
|
+
if (addUndefined) {
|
|
52587
|
+
type = getOptionalType(type);
|
|
52588
|
+
}
|
|
52589
|
+
return typeToTypeNodeHelper(type, context);
|
|
52590
|
+
}
|
|
52591
|
+
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined, includePrivateSymbol, bundled) {
|
|
52592
|
+
const originalType = type;
|
|
52593
|
+
if (addUndefined) {
|
|
52594
|
+
type = getOptionalType(type);
|
|
52595
|
+
}
|
|
52596
|
+
const clone2 = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2, includePrivateSymbol, bundled);
|
|
52597
|
+
if (clone2) {
|
|
52598
|
+
return clone2;
|
|
52599
|
+
}
|
|
52600
|
+
if (addUndefined && originalType !== type) {
|
|
52601
|
+
const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host2, includePrivateSymbol, bundled);
|
|
52602
|
+
if (cloneMissingUndefined) {
|
|
52603
|
+
return factory.createUnionTypeNode([cloneMissingUndefined, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
52604
|
+
}
|
|
52605
|
+
}
|
|
52606
|
+
return void 0;
|
|
52607
|
+
}
|
|
52608
|
+
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, includePrivateSymbol, bundled, annotationType) {
|
|
52609
|
+
if (typeNodeIsEquivalentToType(existing, host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
52610
|
+
const result = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
|
|
52611
|
+
if (result) {
|
|
52612
|
+
return result;
|
|
52613
|
+
}
|
|
52614
|
+
}
|
|
52615
|
+
return void 0;
|
|
52616
|
+
}
|
|
52564
52617
|
function symbolToNode(symbol, context, meaning) {
|
|
52565
52618
|
if (context.flags & 1073741824 /* WriteComputedProps */) {
|
|
52566
52619
|
if (symbol.valueDeclaration) {
|
|
@@ -53002,8 +53055,8 @@ function createTypeChecker(host) {
|
|
|
53002
53055
|
if (isInstantiationExpressionType) {
|
|
53003
53056
|
const instantiationExpressionType = type2;
|
|
53004
53057
|
const existing = instantiationExpressionType.node;
|
|
53005
|
-
if (isTypeQueryNode(existing)
|
|
53006
|
-
const typeNode =
|
|
53058
|
+
if (isTypeQueryNode(existing)) {
|
|
53059
|
+
const typeNode = tryReuseExistingNonParameterTypeNode(context, existing, type2);
|
|
53007
53060
|
if (typeNode) {
|
|
53008
53061
|
return typeNode;
|
|
53009
53062
|
}
|
|
@@ -53806,11 +53859,9 @@ function createTypeChecker(host) {
|
|
|
53806
53859
|
}
|
|
53807
53860
|
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) {
|
|
53808
53861
|
const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
|
|
53809
|
-
|
|
53810
|
-
|
|
53811
|
-
|
|
53812
|
-
}
|
|
53813
|
-
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
|
|
53862
|
+
const parameterType = getTypeOfSymbol(parameterSymbol);
|
|
53863
|
+
const addUndefined = parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration);
|
|
53864
|
+
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports, addUndefined);
|
|
53814
53865
|
const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
|
|
53815
53866
|
const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
53816
53867
|
const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
|
|
@@ -54400,16 +54451,15 @@ function createTypeChecker(host) {
|
|
|
54400
54451
|
}
|
|
54401
54452
|
return enclosingDeclaration;
|
|
54402
54453
|
}
|
|
54403
|
-
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
54454
|
+
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled, addUndefined) {
|
|
54455
|
+
var _a;
|
|
54404
54456
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
54405
54457
|
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
54406
54458
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
54407
54459
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
54408
|
-
|
|
54409
|
-
|
|
54410
|
-
|
|
54411
|
-
return result2;
|
|
54412
|
-
}
|
|
54460
|
+
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined, includePrivateSymbol, bundled);
|
|
54461
|
+
if (result2) {
|
|
54462
|
+
return result2;
|
|
54413
54463
|
}
|
|
54414
54464
|
}
|
|
54415
54465
|
}
|
|
@@ -54417,16 +54467,17 @@ function createTypeChecker(host) {
|
|
|
54417
54467
|
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
|
|
54418
54468
|
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
|
|
54419
54469
|
}
|
|
54420
|
-
const
|
|
54470
|
+
const decl = symbol.valueDeclaration || ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
|
54471
|
+
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
54472
|
+
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
|
|
54421
54473
|
context.flags = oldFlags;
|
|
54422
54474
|
return result;
|
|
54423
54475
|
}
|
|
54424
|
-
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
|
|
54425
|
-
const typeFromTypeNode = getTypeFromTypeNode(typeNode);
|
|
54476
|
+
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type, typeFromTypeNode = getTypeFromTypeNode(typeNode)) {
|
|
54426
54477
|
if (typeFromTypeNode === type) {
|
|
54427
54478
|
return true;
|
|
54428
54479
|
}
|
|
54429
|
-
if (isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
|
|
54480
|
+
if (annotatedDeclaration && (isParameter(annotatedDeclaration) || isPropertyDeclaration(annotatedDeclaration)) && annotatedDeclaration.questionToken) {
|
|
54430
54481
|
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
54431
54482
|
}
|
|
54432
54483
|
return false;
|
|
@@ -54438,11 +54489,9 @@ function createTypeChecker(host) {
|
|
|
54438
54489
|
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
54439
54490
|
const annotated = getTypeFromTypeNode(annotation);
|
|
54440
54491
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
54441
|
-
|
|
54442
|
-
|
|
54443
|
-
|
|
54444
|
-
return result;
|
|
54445
|
-
}
|
|
54492
|
+
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, includePrivateSymbol, bundled, thisInstantiated);
|
|
54493
|
+
if (result) {
|
|
54494
|
+
return result;
|
|
54446
54495
|
}
|
|
54447
54496
|
}
|
|
54448
54497
|
}
|
|
@@ -54471,7 +54520,9 @@ function createTypeChecker(host) {
|
|
|
54471
54520
|
/*shouldComputeAliasesToMakeVisible*/
|
|
54472
54521
|
false
|
|
54473
54522
|
).accessibility !== 0 /* Accessible */) {
|
|
54474
|
-
|
|
54523
|
+
if (!isDeclarationName(node)) {
|
|
54524
|
+
introducesError = true;
|
|
54525
|
+
}
|
|
54475
54526
|
} else {
|
|
54476
54527
|
context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
|
|
54477
54528
|
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
|
|
@@ -54609,6 +54660,31 @@ function createTypeChecker(host) {
|
|
|
54609
54660
|
node.isTypeOf
|
|
54610
54661
|
);
|
|
54611
54662
|
}
|
|
54663
|
+
if (isParameter(node)) {
|
|
54664
|
+
if (!node.type && !node.initializer) {
|
|
54665
|
+
return factory.updateParameterDeclaration(
|
|
54666
|
+
node,
|
|
54667
|
+
/*modifiers*/
|
|
54668
|
+
void 0,
|
|
54669
|
+
node.dotDotDotToken,
|
|
54670
|
+
visitEachChild(
|
|
54671
|
+
node.name,
|
|
54672
|
+
visitExistingNodeTreeSymbols,
|
|
54673
|
+
/*context*/
|
|
54674
|
+
void 0
|
|
54675
|
+
),
|
|
54676
|
+
node.questionToken,
|
|
54677
|
+
factory.createKeywordTypeNode(133 /* AnyKeyword */),
|
|
54678
|
+
/*initializer*/
|
|
54679
|
+
void 0
|
|
54680
|
+
);
|
|
54681
|
+
}
|
|
54682
|
+
}
|
|
54683
|
+
if (isPropertySignature(node)) {
|
|
54684
|
+
if (!node.type && !node.initializer) {
|
|
54685
|
+
return factory.updatePropertySignature(node, node.modifiers, node.name, node.questionToken, factory.createKeywordTypeNode(133 /* AnyKeyword */));
|
|
54686
|
+
}
|
|
54687
|
+
}
|
|
54612
54688
|
if (isEntityName(node) || isEntityNameExpression(node)) {
|
|
54613
54689
|
const { introducesError, node: result } = trackExistingEntityName(node, context, includePrivateSymbol);
|
|
54614
54690
|
hadError = hadError || introducesError;
|
|
@@ -54616,7 +54692,7 @@ function createTypeChecker(host) {
|
|
|
54616
54692
|
return result;
|
|
54617
54693
|
}
|
|
54618
54694
|
}
|
|
54619
|
-
if (file && isTupleTypeNode(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
|
|
54695
|
+
if (file && isTupleTypeNode(node) && !nodeIsSynthesized(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
|
|
54620
54696
|
setEmitFlags(node, 1 /* SingleLine */);
|
|
54621
54697
|
}
|
|
54622
54698
|
return visitEachChild(
|
|
@@ -55140,7 +55216,15 @@ function createTypeChecker(host) {
|
|
|
55140
55216
|
context.flags |= 8388608 /* InTypeAlias */;
|
|
55141
55217
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
55142
55218
|
context.enclosingDeclaration = jsdocAliasDecl;
|
|
55143
|
-
const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) &&
|
|
55219
|
+
const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && tryReuseExistingNonParameterTypeNode(
|
|
55220
|
+
context,
|
|
55221
|
+
jsdocAliasDecl.typeExpression.type,
|
|
55222
|
+
aliasType,
|
|
55223
|
+
/*host*/
|
|
55224
|
+
void 0,
|
|
55225
|
+
includePrivateSymbol,
|
|
55226
|
+
bundled
|
|
55227
|
+
) || typeToTypeNodeHelper(aliasType, context);
|
|
55144
55228
|
addResult(
|
|
55145
55229
|
setSyntheticLeadingComments(
|
|
55146
55230
|
factory.createTypeAliasDeclaration(
|
|
@@ -55373,7 +55457,15 @@ function createTypeChecker(host) {
|
|
|
55373
55457
|
}
|
|
55374
55458
|
return cleanup(factory.createExpressionWithTypeArguments(
|
|
55375
55459
|
expr,
|
|
55376
|
-
map(e.typeArguments, (a) =>
|
|
55460
|
+
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(
|
|
55461
|
+
context,
|
|
55462
|
+
a,
|
|
55463
|
+
getTypeFromTypeNode(a),
|
|
55464
|
+
/*host*/
|
|
55465
|
+
void 0,
|
|
55466
|
+
includePrivateSymbol,
|
|
55467
|
+
bundled
|
|
55468
|
+
) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
|
|
55377
55469
|
));
|
|
55378
55470
|
function cleanup(result2) {
|
|
55379
55471
|
context.enclosingDeclaration = oldEnclosing;
|
|
@@ -55832,8 +55924,10 @@ function createTypeChecker(host) {
|
|
|
55832
55924
|
}
|
|
55833
55925
|
}
|
|
55834
55926
|
function isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, hostSymbol) {
|
|
55927
|
+
var _a2;
|
|
55835
55928
|
const ctxSrc = getSourceFileOfNode(context.enclosingDeclaration);
|
|
55836
|
-
return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !
|
|
55929
|
+
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
|
|
55930
|
+
!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
|
|
55837
55931
|
!!(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
|
|
55838
55932
|
!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) => {
|
|
55839
55933
|
if (!isIdentifierText(symbolName(p), languageVersion)) {
|
|
@@ -60412,15 +60506,7 @@ function createTypeChecker(host) {
|
|
|
60412
60506
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
60413
60507
|
}
|
|
60414
60508
|
}
|
|
60415
|
-
|
|
60416
|
-
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
60417
|
-
} else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType.flags & 16 /* Boolean */) && getParameterCount(signature) > 0) {
|
|
60418
|
-
const { declaration } = signature;
|
|
60419
|
-
signature.resolvedTypePredicate = noTypePredicate;
|
|
60420
|
-
signature.resolvedTypePredicate = getTypePredicateFromBody(declaration) || noTypePredicate;
|
|
60421
|
-
} else {
|
|
60422
|
-
signature.resolvedTypePredicate = noTypePredicate;
|
|
60423
|
-
}
|
|
60509
|
+
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
60424
60510
|
}
|
|
60425
60511
|
Debug.assert(!!signature.resolvedTypePredicate);
|
|
60426
60512
|
}
|
|
@@ -76267,7 +76353,10 @@ function createTypeChecker(host) {
|
|
|
76267
76353
|
return Debug.fail();
|
|
76268
76354
|
}
|
|
76269
76355
|
function getDecoratorArgumentCount(node, signature) {
|
|
76270
|
-
return compilerOptions.experimentalDecorators ? getLegacyDecoratorArgumentCount(node, signature) :
|
|
76356
|
+
return compilerOptions.experimentalDecorators ? getLegacyDecoratorArgumentCount(node, signature) : (
|
|
76357
|
+
// Allow the runtime to oversupply arguments to an ES decorator as long as there's at least one parameter.
|
|
76358
|
+
Math.min(Math.max(getParameterCount(signature), 1), 2)
|
|
76359
|
+
);
|
|
76271
76360
|
}
|
|
76272
76361
|
function getLegacyDecoratorArgumentCount(node, signature) {
|
|
76273
76362
|
switch (node.parent.kind) {
|
|
@@ -78847,67 +78936,6 @@ function createTypeChecker(host) {
|
|
|
78847
78936
|
return false;
|
|
78848
78937
|
}
|
|
78849
78938
|
}
|
|
78850
|
-
function getTypePredicateFromBody(func) {
|
|
78851
|
-
switch (func.kind) {
|
|
78852
|
-
case 176 /* Constructor */:
|
|
78853
|
-
case 177 /* GetAccessor */:
|
|
78854
|
-
case 178 /* SetAccessor */:
|
|
78855
|
-
return void 0;
|
|
78856
|
-
}
|
|
78857
|
-
const functionFlags = getFunctionFlags(func);
|
|
78858
|
-
if (functionFlags !== 0 /* Normal */)
|
|
78859
|
-
return void 0;
|
|
78860
|
-
let singleReturn;
|
|
78861
|
-
if (func.body && func.body.kind !== 241 /* Block */) {
|
|
78862
|
-
singleReturn = func.body;
|
|
78863
|
-
} else {
|
|
78864
|
-
const bailedEarly = forEachReturnStatement(func.body, (returnStatement) => {
|
|
78865
|
-
if (singleReturn || !returnStatement.expression)
|
|
78866
|
-
return true;
|
|
78867
|
-
singleReturn = returnStatement.expression;
|
|
78868
|
-
});
|
|
78869
|
-
if (bailedEarly || !singleReturn || functionHasImplicitReturn(func))
|
|
78870
|
-
return void 0;
|
|
78871
|
-
}
|
|
78872
|
-
return checkIfExpressionRefinesAnyParameter(func, singleReturn);
|
|
78873
|
-
}
|
|
78874
|
-
function checkIfExpressionRefinesAnyParameter(func, expr) {
|
|
78875
|
-
expr = skipParentheses(
|
|
78876
|
-
expr,
|
|
78877
|
-
/*excludeJSDocTypeAssertions*/
|
|
78878
|
-
true
|
|
78879
|
-
);
|
|
78880
|
-
const returnType = checkExpressionCached(expr);
|
|
78881
|
-
if (!(returnType.flags & 16 /* Boolean */))
|
|
78882
|
-
return void 0;
|
|
78883
|
-
return forEach(func.parameters, (param, i) => {
|
|
78884
|
-
const initType = getTypeOfSymbol(param.symbol);
|
|
78885
|
-
if (!initType || initType.flags & 16 /* Boolean */ || !isIdentifier(param.name) || isSymbolAssigned(param.symbol) || isRestParameter(param)) {
|
|
78886
|
-
return;
|
|
78887
|
-
}
|
|
78888
|
-
const trueType2 = checkIfExpressionRefinesParameter(func, expr, param, initType);
|
|
78889
|
-
if (trueType2) {
|
|
78890
|
-
return createTypePredicate(1 /* Identifier */, unescapeLeadingUnderscores(param.name.escapedText), i, trueType2);
|
|
78891
|
-
}
|
|
78892
|
-
});
|
|
78893
|
-
}
|
|
78894
|
-
function checkIfExpressionRefinesParameter(func, expr, param, initType) {
|
|
78895
|
-
const antecedent = expr.flowNode || expr.parent.kind === 253 /* ReturnStatement */ && expr.parent.flowNode || { flags: 2 /* Start */ };
|
|
78896
|
-
const trueCondition = {
|
|
78897
|
-
flags: 32 /* TrueCondition */,
|
|
78898
|
-
node: expr,
|
|
78899
|
-
antecedent
|
|
78900
|
-
};
|
|
78901
|
-
const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
|
|
78902
|
-
if (trueType2 === initType)
|
|
78903
|
-
return void 0;
|
|
78904
|
-
const falseCondition = {
|
|
78905
|
-
...trueCondition,
|
|
78906
|
-
flags: 64 /* FalseCondition */
|
|
78907
|
-
};
|
|
78908
|
-
const falseSubtype = getFlowTypeOfReference(param.name, trueType2, trueType2, func, falseCondition);
|
|
78909
|
-
return falseSubtype.flags & 131072 /* Never */ ? trueType2 : void 0;
|
|
78910
|
-
}
|
|
78911
78939
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
|
|
78912
78940
|
addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
|
|
78913
78941
|
return;
|
|
@@ -87660,14 +87688,34 @@ function createTypeChecker(host) {
|
|
|
87660
87688
|
return factory.createToken(133 /* AnyKeyword */);
|
|
87661
87689
|
}
|
|
87662
87690
|
const symbol = getSymbolOfDeclaration(declaration);
|
|
87663
|
-
|
|
87664
|
-
|
|
87665
|
-
|
|
87666
|
-
|
|
87667
|
-
|
|
87668
|
-
|
|
87691
|
+
const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
|
|
87692
|
+
return nodeBuilder.serializeTypeForDeclaration(type, symbol, addUndefined, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
87693
|
+
}
|
|
87694
|
+
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
87695
|
+
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
87696
|
+
}
|
|
87697
|
+
function getPossibleTypeNodeReuseExpression(declaration) {
|
|
87698
|
+
var _a;
|
|
87699
|
+
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;
|
|
87700
|
+
}
|
|
87701
|
+
function getSingleReturnExpression(declaration) {
|
|
87702
|
+
let candidateExpr;
|
|
87703
|
+
if (declaration && !nodeIsMissing(declaration.body)) {
|
|
87704
|
+
const body = declaration.body;
|
|
87705
|
+
if (body && isBlock(body)) {
|
|
87706
|
+
forEachReturnStatement(body, (s) => {
|
|
87707
|
+
if (!candidateExpr) {
|
|
87708
|
+
candidateExpr = s.expression;
|
|
87709
|
+
} else {
|
|
87710
|
+
candidateExpr = void 0;
|
|
87711
|
+
return true;
|
|
87712
|
+
}
|
|
87713
|
+
});
|
|
87714
|
+
} else {
|
|
87715
|
+
candidateExpr = body;
|
|
87716
|
+
}
|
|
87669
87717
|
}
|
|
87670
|
-
return
|
|
87718
|
+
return candidateExpr;
|
|
87671
87719
|
}
|
|
87672
87720
|
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
|
|
87673
87721
|
const signatureDeclaration = getParseTreeNode(signatureDeclarationIn, isFunctionLike);
|
|
@@ -87675,7 +87723,15 @@ function createTypeChecker(host) {
|
|
|
87675
87723
|
return factory.createToken(133 /* AnyKeyword */);
|
|
87676
87724
|
}
|
|
87677
87725
|
const signature = getSignatureFromDeclaration(signatureDeclaration);
|
|
87678
|
-
return nodeBuilder.
|
|
87726
|
+
return nodeBuilder.expressionOrTypeToTypeNode(
|
|
87727
|
+
getReturnTypeOfSignature(signature),
|
|
87728
|
+
getPossibleTypeNodeReuseExpression(signatureDeclaration),
|
|
87729
|
+
/*addUndefined*/
|
|
87730
|
+
void 0,
|
|
87731
|
+
enclosingDeclaration,
|
|
87732
|
+
flags | 1024 /* MultilineObjectLiterals */,
|
|
87733
|
+
tracker
|
|
87734
|
+
);
|
|
87679
87735
|
}
|
|
87680
87736
|
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
|
|
87681
87737
|
const expr = getParseTreeNode(exprIn, isExpression);
|
|
@@ -87683,7 +87739,15 @@ function createTypeChecker(host) {
|
|
|
87683
87739
|
return factory.createToken(133 /* AnyKeyword */);
|
|
87684
87740
|
}
|
|
87685
87741
|
const type = getWidenedType(getRegularTypeOfExpression(expr));
|
|
87686
|
-
return nodeBuilder.
|
|
87742
|
+
return nodeBuilder.expressionOrTypeToTypeNode(
|
|
87743
|
+
type,
|
|
87744
|
+
expr,
|
|
87745
|
+
/*addUndefined*/
|
|
87746
|
+
void 0,
|
|
87747
|
+
enclosingDeclaration,
|
|
87748
|
+
flags | 1024 /* MultilineObjectLiterals */,
|
|
87749
|
+
tracker
|
|
87750
|
+
);
|
|
87687
87751
|
}
|
|
87688
87752
|
function hasGlobalName(name) {
|
|
87689
87753
|
return globals.has(escapeLeadingUnderscores(name));
|
package/lib/typescript.js
CHANGED
|
@@ -44512,7 +44512,7 @@ function createBinder() {
|
|
|
44512
44512
|
inAssignmentPattern = saveInAssignmentPattern;
|
|
44513
44513
|
return;
|
|
44514
44514
|
}
|
|
44515
|
-
if (node.kind >= 243 /* FirstStatement */ && node.kind <= 259 /* LastStatement */ &&
|
|
44515
|
+
if (node.kind >= 243 /* FirstStatement */ && node.kind <= 259 /* LastStatement */ && !options.allowUnreachableCode) {
|
|
44516
44516
|
node.flowNode = currentFlow;
|
|
44517
44517
|
}
|
|
44518
44518
|
switch (node.kind) {
|
|
@@ -52540,6 +52540,18 @@ function createTypeChecker(host) {
|
|
|
52540
52540
|
function createNodeBuilder() {
|
|
52541
52541
|
return {
|
|
52542
52542
|
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
52543
|
+
expressionOrTypeToTypeNode: (type, expr, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => expressionOrTypeToTypeNode(context, expr, type, addUndefined)),
|
|
52544
|
+
serializeTypeForDeclaration: (type, symbol, addUndefined, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeTypeForDeclaration(
|
|
52545
|
+
context,
|
|
52546
|
+
type,
|
|
52547
|
+
symbol,
|
|
52548
|
+
enclosingDeclaration,
|
|
52549
|
+
/*includePrivateSymbol*/
|
|
52550
|
+
void 0,
|
|
52551
|
+
/*bundled*/
|
|
52552
|
+
void 0,
|
|
52553
|
+
addUndefined
|
|
52554
|
+
)),
|
|
52543
52555
|
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
52544
52556
|
indexInfo,
|
|
52545
52557
|
context,
|
|
@@ -52561,6 +52573,47 @@ function createTypeChecker(host) {
|
|
|
52561
52573
|
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker, bundled) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context, bundled)),
|
|
52562
52574
|
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
52563
52575
|
};
|
|
52576
|
+
function expressionOrTypeToTypeNode(context, expr, type, addUndefined) {
|
|
52577
|
+
if (expr) {
|
|
52578
|
+
const typeNode = isAssertionExpression(expr) ? expr.type : isJSDocTypeAssertion(expr) ? getJSDocTypeAssertionType(expr) : void 0;
|
|
52579
|
+
if (typeNode && !isConstTypeReference(typeNode)) {
|
|
52580
|
+
const result = tryReuseExistingTypeNode(context, typeNode, type, expr.parent, addUndefined);
|
|
52581
|
+
if (result) {
|
|
52582
|
+
return result;
|
|
52583
|
+
}
|
|
52584
|
+
}
|
|
52585
|
+
}
|
|
52586
|
+
if (addUndefined) {
|
|
52587
|
+
type = getOptionalType(type);
|
|
52588
|
+
}
|
|
52589
|
+
return typeToTypeNodeHelper(type, context);
|
|
52590
|
+
}
|
|
52591
|
+
function tryReuseExistingTypeNode(context, typeNode, type, host2, addUndefined, includePrivateSymbol, bundled) {
|
|
52592
|
+
const originalType = type;
|
|
52593
|
+
if (addUndefined) {
|
|
52594
|
+
type = getOptionalType(type);
|
|
52595
|
+
}
|
|
52596
|
+
const clone2 = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2, includePrivateSymbol, bundled);
|
|
52597
|
+
if (clone2) {
|
|
52598
|
+
return clone2;
|
|
52599
|
+
}
|
|
52600
|
+
if (addUndefined && originalType !== type) {
|
|
52601
|
+
const cloneMissingUndefined = tryReuseExistingNonParameterTypeNode(context, typeNode, originalType, host2, includePrivateSymbol, bundled);
|
|
52602
|
+
if (cloneMissingUndefined) {
|
|
52603
|
+
return factory.createUnionTypeNode([cloneMissingUndefined, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
52604
|
+
}
|
|
52605
|
+
}
|
|
52606
|
+
return void 0;
|
|
52607
|
+
}
|
|
52608
|
+
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, includePrivateSymbol, bundled, annotationType) {
|
|
52609
|
+
if (typeNodeIsEquivalentToType(existing, host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
52610
|
+
const result = serializeExistingTypeNode(context, existing, includePrivateSymbol, bundled);
|
|
52611
|
+
if (result) {
|
|
52612
|
+
return result;
|
|
52613
|
+
}
|
|
52614
|
+
}
|
|
52615
|
+
return void 0;
|
|
52616
|
+
}
|
|
52564
52617
|
function symbolToNode(symbol, context, meaning) {
|
|
52565
52618
|
if (context.flags & 1073741824 /* WriteComputedProps */) {
|
|
52566
52619
|
if (symbol.valueDeclaration) {
|
|
@@ -53002,8 +53055,8 @@ function createTypeChecker(host) {
|
|
|
53002
53055
|
if (isInstantiationExpressionType) {
|
|
53003
53056
|
const instantiationExpressionType = type2;
|
|
53004
53057
|
const existing = instantiationExpressionType.node;
|
|
53005
|
-
if (isTypeQueryNode(existing)
|
|
53006
|
-
const typeNode =
|
|
53058
|
+
if (isTypeQueryNode(existing)) {
|
|
53059
|
+
const typeNode = tryReuseExistingNonParameterTypeNode(context, existing, type2);
|
|
53007
53060
|
if (typeNode) {
|
|
53008
53061
|
return typeNode;
|
|
53009
53062
|
}
|
|
@@ -53806,11 +53859,9 @@ function createTypeChecker(host) {
|
|
|
53806
53859
|
}
|
|
53807
53860
|
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) {
|
|
53808
53861
|
const parameterDeclaration = getEffectiveParameterDeclaration(parameterSymbol);
|
|
53809
|
-
|
|
53810
|
-
|
|
53811
|
-
|
|
53812
|
-
}
|
|
53813
|
-
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports);
|
|
53862
|
+
const parameterType = getTypeOfSymbol(parameterSymbol);
|
|
53863
|
+
const addUndefined = parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration);
|
|
53864
|
+
const parameterTypeNode = serializeTypeForDeclaration(context, parameterType, parameterSymbol, context.enclosingDeclaration, privateSymbolVisitor, bundledImports, addUndefined);
|
|
53814
53865
|
const modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && canHaveModifiers(parameterDeclaration) ? map(getModifiers(parameterDeclaration), factory.cloneNode) : void 0;
|
|
53815
53866
|
const isRest = parameterDeclaration && isRestParameter(parameterDeclaration) || getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
|
|
53816
53867
|
const dotDotDotToken = isRest ? factory.createToken(26 /* DotDotDotToken */) : void 0;
|
|
@@ -54400,16 +54451,15 @@ function createTypeChecker(host) {
|
|
|
54400
54451
|
}
|
|
54401
54452
|
return enclosingDeclaration;
|
|
54402
54453
|
}
|
|
54403
|
-
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled) {
|
|
54454
|
+
function serializeTypeForDeclaration(context, type, symbol, enclosingDeclaration, includePrivateSymbol, bundled, addUndefined) {
|
|
54455
|
+
var _a;
|
|
54404
54456
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
54405
54457
|
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
54406
54458
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
54407
54459
|
const existing = getEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
54408
|
-
|
|
54409
|
-
|
|
54410
|
-
|
|
54411
|
-
return result2;
|
|
54412
|
-
}
|
|
54460
|
+
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined, includePrivateSymbol, bundled);
|
|
54461
|
+
if (result2) {
|
|
54462
|
+
return result2;
|
|
54413
54463
|
}
|
|
54414
54464
|
}
|
|
54415
54465
|
}
|
|
@@ -54417,16 +54467,17 @@ function createTypeChecker(host) {
|
|
|
54417
54467
|
if (type.flags & 8192 /* UniqueESSymbol */ && type.symbol === symbol && (!context.enclosingDeclaration || some(symbol.declarations, (d) => getSourceFileOfNode(d) === getSourceFileOfNode(context.enclosingDeclaration)))) {
|
|
54418
54468
|
context.flags |= 1048576 /* AllowUniqueESSymbolType */;
|
|
54419
54469
|
}
|
|
54420
|
-
const
|
|
54470
|
+
const decl = symbol.valueDeclaration || ((_a = symbol.declarations) == null ? void 0 : _a[0]);
|
|
54471
|
+
const expr = decl && isDeclarationWithPossibleInnerTypeNodeReuse(decl) ? getPossibleTypeNodeReuseExpression(decl) : void 0;
|
|
54472
|
+
const result = expressionOrTypeToTypeNode(context, expr, type, addUndefined);
|
|
54421
54473
|
context.flags = oldFlags;
|
|
54422
54474
|
return result;
|
|
54423
54475
|
}
|
|
54424
|
-
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type) {
|
|
54425
|
-
const typeFromTypeNode = getTypeFromTypeNode(typeNode);
|
|
54476
|
+
function typeNodeIsEquivalentToType(typeNode, annotatedDeclaration, type, typeFromTypeNode = getTypeFromTypeNode(typeNode)) {
|
|
54426
54477
|
if (typeFromTypeNode === type) {
|
|
54427
54478
|
return true;
|
|
54428
54479
|
}
|
|
54429
|
-
if (isParameter(annotatedDeclaration) && annotatedDeclaration.questionToken) {
|
|
54480
|
+
if (annotatedDeclaration && (isParameter(annotatedDeclaration) || isPropertyDeclaration(annotatedDeclaration)) && annotatedDeclaration.questionToken) {
|
|
54430
54481
|
return getTypeWithFacts(type, 524288 /* NEUndefined */) === typeFromTypeNode;
|
|
54431
54482
|
}
|
|
54432
54483
|
return false;
|
|
@@ -54438,11 +54489,9 @@ function createTypeChecker(host) {
|
|
|
54438
54489
|
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
54439
54490
|
const annotated = getTypeFromTypeNode(annotation);
|
|
54440
54491
|
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
54441
|
-
|
|
54442
|
-
|
|
54443
|
-
|
|
54444
|
-
return result;
|
|
54445
|
-
}
|
|
54492
|
+
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, includePrivateSymbol, bundled, thisInstantiated);
|
|
54493
|
+
if (result) {
|
|
54494
|
+
return result;
|
|
54446
54495
|
}
|
|
54447
54496
|
}
|
|
54448
54497
|
}
|
|
@@ -54471,7 +54520,9 @@ function createTypeChecker(host) {
|
|
|
54471
54520
|
/*shouldComputeAliasesToMakeVisible*/
|
|
54472
54521
|
false
|
|
54473
54522
|
).accessibility !== 0 /* Accessible */) {
|
|
54474
|
-
|
|
54523
|
+
if (!isDeclarationName(node)) {
|
|
54524
|
+
introducesError = true;
|
|
54525
|
+
}
|
|
54475
54526
|
} else {
|
|
54476
54527
|
context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
|
|
54477
54528
|
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
|
|
@@ -54609,6 +54660,31 @@ function createTypeChecker(host) {
|
|
|
54609
54660
|
node.isTypeOf
|
|
54610
54661
|
);
|
|
54611
54662
|
}
|
|
54663
|
+
if (isParameter(node)) {
|
|
54664
|
+
if (!node.type && !node.initializer) {
|
|
54665
|
+
return factory.updateParameterDeclaration(
|
|
54666
|
+
node,
|
|
54667
|
+
/*modifiers*/
|
|
54668
|
+
void 0,
|
|
54669
|
+
node.dotDotDotToken,
|
|
54670
|
+
visitEachChild(
|
|
54671
|
+
node.name,
|
|
54672
|
+
visitExistingNodeTreeSymbols,
|
|
54673
|
+
/*context*/
|
|
54674
|
+
void 0
|
|
54675
|
+
),
|
|
54676
|
+
node.questionToken,
|
|
54677
|
+
factory.createKeywordTypeNode(133 /* AnyKeyword */),
|
|
54678
|
+
/*initializer*/
|
|
54679
|
+
void 0
|
|
54680
|
+
);
|
|
54681
|
+
}
|
|
54682
|
+
}
|
|
54683
|
+
if (isPropertySignature(node)) {
|
|
54684
|
+
if (!node.type && !node.initializer) {
|
|
54685
|
+
return factory.updatePropertySignature(node, node.modifiers, node.name, node.questionToken, factory.createKeywordTypeNode(133 /* AnyKeyword */));
|
|
54686
|
+
}
|
|
54687
|
+
}
|
|
54612
54688
|
if (isEntityName(node) || isEntityNameExpression(node)) {
|
|
54613
54689
|
const { introducesError, node: result } = trackExistingEntityName(node, context, includePrivateSymbol);
|
|
54614
54690
|
hadError = hadError || introducesError;
|
|
@@ -54616,7 +54692,7 @@ function createTypeChecker(host) {
|
|
|
54616
54692
|
return result;
|
|
54617
54693
|
}
|
|
54618
54694
|
}
|
|
54619
|
-
if (file && isTupleTypeNode(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
|
|
54695
|
+
if (file && isTupleTypeNode(node) && !nodeIsSynthesized(node) && getLineAndCharacterOfPosition(file, node.pos).line === getLineAndCharacterOfPosition(file, node.end).line) {
|
|
54620
54696
|
setEmitFlags(node, 1 /* SingleLine */);
|
|
54621
54697
|
}
|
|
54622
54698
|
return visitEachChild(
|
|
@@ -55140,7 +55216,15 @@ function createTypeChecker(host) {
|
|
|
55140
55216
|
context.flags |= 8388608 /* InTypeAlias */;
|
|
55141
55217
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
55142
55218
|
context.enclosingDeclaration = jsdocAliasDecl;
|
|
55143
|
-
const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) &&
|
|
55219
|
+
const typeNode = jsdocAliasDecl && jsdocAliasDecl.typeExpression && isJSDocTypeExpression(jsdocAliasDecl.typeExpression) && tryReuseExistingNonParameterTypeNode(
|
|
55220
|
+
context,
|
|
55221
|
+
jsdocAliasDecl.typeExpression.type,
|
|
55222
|
+
aliasType,
|
|
55223
|
+
/*host*/
|
|
55224
|
+
void 0,
|
|
55225
|
+
includePrivateSymbol,
|
|
55226
|
+
bundled
|
|
55227
|
+
) || typeToTypeNodeHelper(aliasType, context);
|
|
55144
55228
|
addResult(
|
|
55145
55229
|
setSyntheticLeadingComments(
|
|
55146
55230
|
factory.createTypeAliasDeclaration(
|
|
@@ -55373,7 +55457,15 @@ function createTypeChecker(host) {
|
|
|
55373
55457
|
}
|
|
55374
55458
|
return cleanup(factory.createExpressionWithTypeArguments(
|
|
55375
55459
|
expr,
|
|
55376
|
-
map(e.typeArguments, (a) =>
|
|
55460
|
+
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(
|
|
55461
|
+
context,
|
|
55462
|
+
a,
|
|
55463
|
+
getTypeFromTypeNode(a),
|
|
55464
|
+
/*host*/
|
|
55465
|
+
void 0,
|
|
55466
|
+
includePrivateSymbol,
|
|
55467
|
+
bundled
|
|
55468
|
+
) || typeToTypeNodeHelper(getTypeFromTypeNode(a), context))
|
|
55377
55469
|
));
|
|
55378
55470
|
function cleanup(result2) {
|
|
55379
55471
|
context.enclosingDeclaration = oldEnclosing;
|
|
@@ -55832,8 +55924,10 @@ function createTypeChecker(host) {
|
|
|
55832
55924
|
}
|
|
55833
55925
|
}
|
|
55834
55926
|
function isTypeRepresentableAsFunctionNamespaceMerge(typeToSerialize, hostSymbol) {
|
|
55927
|
+
var _a2;
|
|
55835
55928
|
const ctxSrc = getSourceFileOfNode(context.enclosingDeclaration);
|
|
55836
|
-
return getObjectFlags(typeToSerialize) & (16 /* Anonymous */ | 32 /* Mapped */) && !
|
|
55929
|
+
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
|
|
55930
|
+
!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
|
|
55837
55931
|
!!(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
|
|
55838
55932
|
!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) => {
|
|
55839
55933
|
if (!isIdentifierText(symbolName(p), languageVersion)) {
|
|
@@ -60412,15 +60506,7 @@ function createTypeChecker(host) {
|
|
|
60412
60506
|
jsdocPredicate = getTypePredicateOfSignature(jsdocSignature);
|
|
60413
60507
|
}
|
|
60414
60508
|
}
|
|
60415
|
-
|
|
60416
|
-
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
60417
|
-
} else if (signature.declaration && isFunctionLikeDeclaration(signature.declaration) && (!signature.resolvedReturnType || signature.resolvedReturnType.flags & 16 /* Boolean */) && getParameterCount(signature) > 0) {
|
|
60418
|
-
const { declaration } = signature;
|
|
60419
|
-
signature.resolvedTypePredicate = noTypePredicate;
|
|
60420
|
-
signature.resolvedTypePredicate = getTypePredicateFromBody(declaration) || noTypePredicate;
|
|
60421
|
-
} else {
|
|
60422
|
-
signature.resolvedTypePredicate = noTypePredicate;
|
|
60423
|
-
}
|
|
60509
|
+
signature.resolvedTypePredicate = type && isTypePredicateNode(type) ? createTypePredicateFromTypePredicateNode(type, signature) : jsdocPredicate || noTypePredicate;
|
|
60424
60510
|
}
|
|
60425
60511
|
Debug.assert(!!signature.resolvedTypePredicate);
|
|
60426
60512
|
}
|
|
@@ -76267,7 +76353,10 @@ function createTypeChecker(host) {
|
|
|
76267
76353
|
return Debug.fail();
|
|
76268
76354
|
}
|
|
76269
76355
|
function getDecoratorArgumentCount(node, signature) {
|
|
76270
|
-
return compilerOptions.experimentalDecorators ? getLegacyDecoratorArgumentCount(node, signature) :
|
|
76356
|
+
return compilerOptions.experimentalDecorators ? getLegacyDecoratorArgumentCount(node, signature) : (
|
|
76357
|
+
// Allow the runtime to oversupply arguments to an ES decorator as long as there's at least one parameter.
|
|
76358
|
+
Math.min(Math.max(getParameterCount(signature), 1), 2)
|
|
76359
|
+
);
|
|
76271
76360
|
}
|
|
76272
76361
|
function getLegacyDecoratorArgumentCount(node, signature) {
|
|
76273
76362
|
switch (node.parent.kind) {
|
|
@@ -78847,67 +78936,6 @@ function createTypeChecker(host) {
|
|
|
78847
78936
|
return false;
|
|
78848
78937
|
}
|
|
78849
78938
|
}
|
|
78850
|
-
function getTypePredicateFromBody(func) {
|
|
78851
|
-
switch (func.kind) {
|
|
78852
|
-
case 176 /* Constructor */:
|
|
78853
|
-
case 177 /* GetAccessor */:
|
|
78854
|
-
case 178 /* SetAccessor */:
|
|
78855
|
-
return void 0;
|
|
78856
|
-
}
|
|
78857
|
-
const functionFlags = getFunctionFlags(func);
|
|
78858
|
-
if (functionFlags !== 0 /* Normal */)
|
|
78859
|
-
return void 0;
|
|
78860
|
-
let singleReturn;
|
|
78861
|
-
if (func.body && func.body.kind !== 241 /* Block */) {
|
|
78862
|
-
singleReturn = func.body;
|
|
78863
|
-
} else {
|
|
78864
|
-
const bailedEarly = forEachReturnStatement(func.body, (returnStatement) => {
|
|
78865
|
-
if (singleReturn || !returnStatement.expression)
|
|
78866
|
-
return true;
|
|
78867
|
-
singleReturn = returnStatement.expression;
|
|
78868
|
-
});
|
|
78869
|
-
if (bailedEarly || !singleReturn || functionHasImplicitReturn(func))
|
|
78870
|
-
return void 0;
|
|
78871
|
-
}
|
|
78872
|
-
return checkIfExpressionRefinesAnyParameter(func, singleReturn);
|
|
78873
|
-
}
|
|
78874
|
-
function checkIfExpressionRefinesAnyParameter(func, expr) {
|
|
78875
|
-
expr = skipParentheses(
|
|
78876
|
-
expr,
|
|
78877
|
-
/*excludeJSDocTypeAssertions*/
|
|
78878
|
-
true
|
|
78879
|
-
);
|
|
78880
|
-
const returnType = checkExpressionCached(expr);
|
|
78881
|
-
if (!(returnType.flags & 16 /* Boolean */))
|
|
78882
|
-
return void 0;
|
|
78883
|
-
return forEach(func.parameters, (param, i) => {
|
|
78884
|
-
const initType = getTypeOfSymbol(param.symbol);
|
|
78885
|
-
if (!initType || initType.flags & 16 /* Boolean */ || !isIdentifier(param.name) || isSymbolAssigned(param.symbol) || isRestParameter(param)) {
|
|
78886
|
-
return;
|
|
78887
|
-
}
|
|
78888
|
-
const trueType2 = checkIfExpressionRefinesParameter(func, expr, param, initType);
|
|
78889
|
-
if (trueType2) {
|
|
78890
|
-
return createTypePredicate(1 /* Identifier */, unescapeLeadingUnderscores(param.name.escapedText), i, trueType2);
|
|
78891
|
-
}
|
|
78892
|
-
});
|
|
78893
|
-
}
|
|
78894
|
-
function checkIfExpressionRefinesParameter(func, expr, param, initType) {
|
|
78895
|
-
const antecedent = expr.flowNode || expr.parent.kind === 253 /* ReturnStatement */ && expr.parent.flowNode || { flags: 2 /* Start */ };
|
|
78896
|
-
const trueCondition = {
|
|
78897
|
-
flags: 32 /* TrueCondition */,
|
|
78898
|
-
node: expr,
|
|
78899
|
-
antecedent
|
|
78900
|
-
};
|
|
78901
|
-
const trueType2 = getFlowTypeOfReference(param.name, initType, initType, func, trueCondition);
|
|
78902
|
-
if (trueType2 === initType)
|
|
78903
|
-
return void 0;
|
|
78904
|
-
const falseCondition = {
|
|
78905
|
-
...trueCondition,
|
|
78906
|
-
flags: 64 /* FalseCondition */
|
|
78907
|
-
};
|
|
78908
|
-
const falseSubtype = getFlowTypeOfReference(param.name, trueType2, trueType2, func, falseCondition);
|
|
78909
|
-
return falseSubtype.flags & 131072 /* Never */ ? trueType2 : void 0;
|
|
78910
|
-
}
|
|
78911
78939
|
function checkAllCodePathsInNonVoidFunctionReturnOrThrow(func, returnType) {
|
|
78912
78940
|
addLazyDiagnostic(checkAllCodePathsInNonVoidFunctionReturnOrThrowDiagnostics);
|
|
78913
78941
|
return;
|
|
@@ -87660,14 +87688,34 @@ function createTypeChecker(host) {
|
|
|
87660
87688
|
return factory.createToken(133 /* AnyKeyword */);
|
|
87661
87689
|
}
|
|
87662
87690
|
const symbol = getSymbolOfDeclaration(declaration);
|
|
87663
|
-
|
|
87664
|
-
|
|
87665
|
-
|
|
87666
|
-
|
|
87667
|
-
|
|
87668
|
-
|
|
87691
|
+
const type = symbol && !(symbol.flags & (2048 /* TypeLiteral */ | 131072 /* Signature */)) ? getWidenedLiteralType(getTypeOfSymbol(symbol)) : errorType;
|
|
87692
|
+
return nodeBuilder.serializeTypeForDeclaration(type, symbol, addUndefined, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
87693
|
+
}
|
|
87694
|
+
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
87695
|
+
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
87696
|
+
}
|
|
87697
|
+
function getPossibleTypeNodeReuseExpression(declaration) {
|
|
87698
|
+
var _a;
|
|
87699
|
+
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;
|
|
87700
|
+
}
|
|
87701
|
+
function getSingleReturnExpression(declaration) {
|
|
87702
|
+
let candidateExpr;
|
|
87703
|
+
if (declaration && !nodeIsMissing(declaration.body)) {
|
|
87704
|
+
const body = declaration.body;
|
|
87705
|
+
if (body && isBlock(body)) {
|
|
87706
|
+
forEachReturnStatement(body, (s) => {
|
|
87707
|
+
if (!candidateExpr) {
|
|
87708
|
+
candidateExpr = s.expression;
|
|
87709
|
+
} else {
|
|
87710
|
+
candidateExpr = void 0;
|
|
87711
|
+
return true;
|
|
87712
|
+
}
|
|
87713
|
+
});
|
|
87714
|
+
} else {
|
|
87715
|
+
candidateExpr = body;
|
|
87716
|
+
}
|
|
87669
87717
|
}
|
|
87670
|
-
return
|
|
87718
|
+
return candidateExpr;
|
|
87671
87719
|
}
|
|
87672
87720
|
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
|
|
87673
87721
|
const signatureDeclaration = getParseTreeNode(signatureDeclarationIn, isFunctionLike);
|
|
@@ -87675,7 +87723,15 @@ function createTypeChecker(host) {
|
|
|
87675
87723
|
return factory.createToken(133 /* AnyKeyword */);
|
|
87676
87724
|
}
|
|
87677
87725
|
const signature = getSignatureFromDeclaration(signatureDeclaration);
|
|
87678
|
-
return nodeBuilder.
|
|
87726
|
+
return nodeBuilder.expressionOrTypeToTypeNode(
|
|
87727
|
+
getReturnTypeOfSignature(signature),
|
|
87728
|
+
getPossibleTypeNodeReuseExpression(signatureDeclaration),
|
|
87729
|
+
/*addUndefined*/
|
|
87730
|
+
void 0,
|
|
87731
|
+
enclosingDeclaration,
|
|
87732
|
+
flags | 1024 /* MultilineObjectLiterals */,
|
|
87733
|
+
tracker
|
|
87734
|
+
);
|
|
87679
87735
|
}
|
|
87680
87736
|
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
|
|
87681
87737
|
const expr = getParseTreeNode(exprIn, isExpression);
|
|
@@ -87683,7 +87739,15 @@ function createTypeChecker(host) {
|
|
|
87683
87739
|
return factory.createToken(133 /* AnyKeyword */);
|
|
87684
87740
|
}
|
|
87685
87741
|
const type = getWidenedType(getRegularTypeOfExpression(expr));
|
|
87686
|
-
return nodeBuilder.
|
|
87742
|
+
return nodeBuilder.expressionOrTypeToTypeNode(
|
|
87743
|
+
type,
|
|
87744
|
+
expr,
|
|
87745
|
+
/*addUndefined*/
|
|
87746
|
+
void 0,
|
|
87747
|
+
enclosingDeclaration,
|
|
87748
|
+
flags | 1024 /* MultilineObjectLiterals */,
|
|
87749
|
+
tracker
|
|
87750
|
+
);
|
|
87687
87751
|
}
|
|
87688
87752
|
function hasGlobalName(name) {
|
|
87689
87753
|
return globals.has(escapeLeadingUnderscores(name));
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.5.0-pr-
|
|
5
|
+
"version": "5.5.0-pr-57772-2",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "20.1.0",
|
|
114
114
|
"npm": "8.19.4"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "ef00e6003ed20e409ba5204f8bc4409419ab8670"
|
|
117
117
|
}
|