@typescript-deploys/pr-build 4.8.0-pr-49627-10 → 4.8.0-pr-49625-17
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 +16 -29
- package/lib/tsserver.js +25 -53
- package/lib/tsserverlibrary.js +25 -53
- package/lib/typescript.js +25 -53
- package/lib/typescriptServices.js +25 -53
- package/lib/typingsInstaller.js +24 -52
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -43590,7 +43590,7 @@ var ts;
|
|
|
43590
43590
|
}
|
|
43591
43591
|
if (context.flags & 4 &&
|
|
43592
43592
|
type.flags & 262144 &&
|
|
43593
|
-
|
|
43593
|
+
!isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
|
|
43594
43594
|
var name_2 = typeParameterToName(type, context);
|
|
43595
43595
|
context.approximateLength += ts.idText(name_2).length;
|
|
43596
43596
|
return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(ts.idText(name_2)), undefined);
|
|
@@ -44235,10 +44235,6 @@ var ts;
|
|
|
44235
44235
|
else {
|
|
44236
44236
|
typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); });
|
|
44237
44237
|
}
|
|
44238
|
-
var saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
44239
|
-
if (signature.declaration && !ts.isInJSFile(signature.declaration) && saveEnclosingDeclaration && ts.findAncestor(signature.declaration, function (n) { return n === saveEnclosingDeclaration; })) {
|
|
44240
|
-
context.enclosingDeclaration = signature.declaration;
|
|
44241
|
-
}
|
|
44242
44238
|
var expandedParams = getExpandedParameters(signature, true)[0];
|
|
44243
44239
|
var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
|
|
44244
44240
|
var thisParameter = tryGetThisParameterDeclaration(signature, context);
|
|
@@ -44289,7 +44285,6 @@ var ts;
|
|
|
44289
44285
|
if (typeArguments) {
|
|
44290
44286
|
node.typeArguments = ts.factory.createNodeArray(typeArguments);
|
|
44291
44287
|
}
|
|
44292
|
-
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
44293
44288
|
return node;
|
|
44294
44289
|
}
|
|
44295
44290
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -44683,24 +44678,14 @@ var ts;
|
|
|
44683
44678
|
}
|
|
44684
44679
|
return false;
|
|
44685
44680
|
}
|
|
44686
|
-
function
|
|
44687
|
-
|
|
44688
|
-
}
|
|
44689
|
-
function getCachedTypeParameterName(type, context) {
|
|
44681
|
+
function typeParameterToName(type, context) {
|
|
44682
|
+
var _a, _b;
|
|
44690
44683
|
if (context.flags & 4 && context.typeParameterNames) {
|
|
44691
44684
|
var cached = context.typeParameterNames.get(getTypeId(type));
|
|
44692
44685
|
if (cached) {
|
|
44693
44686
|
return cached;
|
|
44694
44687
|
}
|
|
44695
44688
|
}
|
|
44696
|
-
return undefined;
|
|
44697
|
-
}
|
|
44698
|
-
function typeParameterToName(type, context) {
|
|
44699
|
-
var _a, _b;
|
|
44700
|
-
var cached = getCachedTypeParameterName(type, context);
|
|
44701
|
-
if (cached) {
|
|
44702
|
-
return cached;
|
|
44703
|
-
}
|
|
44704
44689
|
var result = symbolToName(type.symbol, context, 788968, true);
|
|
44705
44690
|
if (!(result.kind & 79)) {
|
|
44706
44691
|
return ts.factory.createIdentifier("(Missing type parameter)");
|
|
@@ -44913,7 +44898,7 @@ var ts;
|
|
|
44913
44898
|
}
|
|
44914
44899
|
if (ts.isIdentifier(node)) {
|
|
44915
44900
|
var type = getDeclaredTypeOfSymbol(sym);
|
|
44916
|
-
var name = sym.flags & 262144 &&
|
|
44901
|
+
var name = sym.flags & 262144 && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
|
|
44917
44902
|
name.symbol = sym;
|
|
44918
44903
|
return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216) };
|
|
44919
44904
|
}
|
|
@@ -60019,16 +60004,18 @@ var ts;
|
|
|
60019
60004
|
if (!assumeTrue) {
|
|
60020
60005
|
return filterType(type, function (t) { return !isRelated(t, candidate); });
|
|
60021
60006
|
}
|
|
60022
|
-
|
|
60023
|
-
|
|
60024
|
-
|
|
60025
|
-
return
|
|
60026
|
-
|
|
60027
|
-
|
|
60028
|
-
|
|
60029
|
-
|
|
60030
|
-
|
|
60031
|
-
|
|
60007
|
+
var narrowedType = type.flags & 3 ? candidate :
|
|
60008
|
+
mapType(candidate, function (c) {
|
|
60009
|
+
var directlyRelated = mapType(type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
|
|
60010
|
+
return directlyRelated.flags & 131072 ?
|
|
60011
|
+
mapType(type, function (t) { return maybeTypeOfKind(t, 465829888) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
|
|
60012
|
+
directlyRelated;
|
|
60013
|
+
});
|
|
60014
|
+
return !(narrowedType.flags & 131072) ? narrowedType :
|
|
60015
|
+
isTypeSubtypeOf(candidate, type) ? candidate :
|
|
60016
|
+
isTypeAssignableTo(type, candidate) ? type :
|
|
60017
|
+
isTypeAssignableTo(candidate, type) ? candidate :
|
|
60018
|
+
getIntersectionType([type, candidate]);
|
|
60032
60019
|
}
|
|
60033
60020
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
60034
60021
|
if (hasMatchingArgument(callExpression, reference)) {
|
package/lib/tsserver.js
CHANGED
|
@@ -52939,7 +52939,7 @@ var ts;
|
|
|
52939
52939
|
}
|
|
52940
52940
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ &&
|
|
52941
52941
|
type.flags & 262144 /* TypeParameter */ &&
|
|
52942
|
-
|
|
52942
|
+
!isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
|
|
52943
52943
|
var name_2 = typeParameterToName(type, context);
|
|
52944
52944
|
context.approximateLength += ts.idText(name_2).length;
|
|
52945
52945
|
return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(ts.idText(name_2)), /*typeArguments*/ undefined);
|
|
@@ -53644,23 +53644,6 @@ var ts;
|
|
|
53644
53644
|
else {
|
|
53645
53645
|
typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); });
|
|
53646
53646
|
}
|
|
53647
|
-
// For regular function/method declarations, the enclosing declaration will already be signature.declaration,
|
|
53648
|
-
// so this is a no-op, but for arrow functions and function expressions, the enclosing declaration will be
|
|
53649
|
-
// the declaration that the arrow function / function expression is assigned to, which is not the right scope.
|
|
53650
|
-
//
|
|
53651
|
-
// If the parameters or return type include "typeof globalThis.paramName", using the wrong scope will lead
|
|
53652
|
-
// us to believe that we can emit "typeof paramName" instead, even though that would refer to the parameter,
|
|
53653
|
-
// not the global. Make sure we are in the right scope by changing the enclosingDeclaration to the function.
|
|
53654
|
-
//
|
|
53655
|
-
// We check that this signature's declaration is within the existing enclosing declaration so we don't pull
|
|
53656
|
-
// in types from other files; if it is outside of the enclosing declaration, then we shouldn't be able to
|
|
53657
|
-
// access those parameter types via typeof anyway. The declaration should also not be in a JS file; those can
|
|
53658
|
-
// only be typed via JSDoc, but JSDoc annotations appear outside of the function and therefore are not in
|
|
53659
|
-
// the function's scope, unlike true type annotations.
|
|
53660
|
-
var saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
53661
|
-
if (signature.declaration && !ts.isInJSFile(signature.declaration) && saveEnclosingDeclaration && ts.findAncestor(signature.declaration, function (n) { return n === saveEnclosingDeclaration; })) {
|
|
53662
|
-
context.enclosingDeclaration = signature.declaration;
|
|
53663
|
-
}
|
|
53664
53647
|
var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
|
|
53665
53648
|
// If the expanded parameter list had a variadic in a non-trailing position, don't expand it
|
|
53666
53649
|
var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
|
|
@@ -53712,7 +53695,6 @@ var ts;
|
|
|
53712
53695
|
if (typeArguments) {
|
|
53713
53696
|
node.typeArguments = ts.factory.createNodeArray(typeArguments);
|
|
53714
53697
|
}
|
|
53715
|
-
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
53716
53698
|
return node;
|
|
53717
53699
|
}
|
|
53718
53700
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -54142,27 +54124,14 @@ var ts;
|
|
|
54142
54124
|
}
|
|
54143
54125
|
return false;
|
|
54144
54126
|
}
|
|
54145
|
-
|
|
54146
|
-
|
|
54147
|
-
// already been rewritten by typeParameterToName and so needs that rewritten name.
|
|
54148
|
-
function typeParameterIsCachedOrNotAccessible(type, context) {
|
|
54149
|
-
return !!getCachedTypeParameterName(type, context) || !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration);
|
|
54150
|
-
}
|
|
54151
|
-
function getCachedTypeParameterName(type, context) {
|
|
54127
|
+
function typeParameterToName(type, context) {
|
|
54128
|
+
var _a, _b;
|
|
54152
54129
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
54153
54130
|
var cached = context.typeParameterNames.get(getTypeId(type));
|
|
54154
54131
|
if (cached) {
|
|
54155
54132
|
return cached;
|
|
54156
54133
|
}
|
|
54157
54134
|
}
|
|
54158
|
-
return undefined;
|
|
54159
|
-
}
|
|
54160
|
-
function typeParameterToName(type, context) {
|
|
54161
|
-
var _a, _b;
|
|
54162
|
-
var cached = getCachedTypeParameterName(type, context);
|
|
54163
|
-
if (cached) {
|
|
54164
|
-
return cached;
|
|
54165
|
-
}
|
|
54166
54135
|
var result = symbolToName(type.symbol, context, 788968 /* Type */, /*expectsIdentifier*/ true);
|
|
54167
54136
|
if (!(result.kind & 79 /* Identifier */)) {
|
|
54168
54137
|
return ts.factory.createIdentifier("(Missing type parameter)");
|
|
@@ -54395,7 +54364,7 @@ var ts;
|
|
|
54395
54364
|
}
|
|
54396
54365
|
if (ts.isIdentifier(node)) {
|
|
54397
54366
|
var type = getDeclaredTypeOfSymbol(sym);
|
|
54398
|
-
var name = sym.flags & 262144 /* TypeParameter */ &&
|
|
54367
|
+
var name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
|
|
54399
54368
|
name.symbol = sym; // for quickinfo, which uses identifier symbol information
|
|
54400
54369
|
return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
|
|
54401
54370
|
}
|
|
@@ -71790,23 +71759,26 @@ var ts;
|
|
|
71790
71759
|
if (!assumeTrue) {
|
|
71791
71760
|
return filterType(type, function (t) { return !isRelated(t, candidate); });
|
|
71792
71761
|
}
|
|
71793
|
-
//
|
|
71794
|
-
//
|
|
71795
|
-
|
|
71796
|
-
|
|
71797
|
-
|
|
71798
|
-
|
|
71799
|
-
|
|
71800
|
-
|
|
71801
|
-
|
|
71802
|
-
|
|
71803
|
-
|
|
71804
|
-
|
|
71805
|
-
|
|
71806
|
-
return
|
|
71807
|
-
|
|
71808
|
-
|
|
71809
|
-
|
|
71762
|
+
// We first attempt to filter the current type, narrowing constituents as appropriate and removing
|
|
71763
|
+
// constituents that are unrelated to the candidate.
|
|
71764
|
+
var narrowedType = type.flags & 3 /* AnyOrUnknown */ ? candidate :
|
|
71765
|
+
mapType(candidate, function (c) {
|
|
71766
|
+
// For each constituent t in the current type, if t and and c are directly related, pick the most
|
|
71767
|
+
// specific of the two.
|
|
71768
|
+
var directlyRelated = mapType(type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
|
|
71769
|
+
// If no constituents are directly related, create intersections for any generic constituents that
|
|
71770
|
+
// are related by constraint.
|
|
71771
|
+
return directlyRelated.flags & 131072 /* Never */ ?
|
|
71772
|
+
mapType(type, function (t) { return maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
|
|
71773
|
+
directlyRelated;
|
|
71774
|
+
});
|
|
71775
|
+
// If filtering produced a non-empty type, return that. Otherwise, pick the most specific of the two
|
|
71776
|
+
// based on assignability, or as a last resort produce an intersection.
|
|
71777
|
+
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType :
|
|
71778
|
+
isTypeSubtypeOf(candidate, type) ? candidate :
|
|
71779
|
+
isTypeAssignableTo(type, candidate) ? type :
|
|
71780
|
+
isTypeAssignableTo(candidate, type) ? candidate :
|
|
71781
|
+
getIntersectionType([type, candidate]);
|
|
71810
71782
|
}
|
|
71811
71783
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
71812
71784
|
if (hasMatchingArgument(callExpression, reference)) {
|
|
@@ -129812,7 +129784,7 @@ var ts;
|
|
|
129812
129784
|
for (var _b = 0, textChanges_1 = textChanges_2; _b < textChanges_1.length; _b++) {
|
|
129813
129785
|
var change = textChanges_1[_b];
|
|
129814
129786
|
var span = change.span, newText = change.newText;
|
|
129815
|
-
var index = indexInTextChange(newText, name);
|
|
129787
|
+
var index = indexInTextChange(newText, ts.escapeString(name));
|
|
129816
129788
|
if (index !== -1) {
|
|
129817
129789
|
lastPos = span.start + delta + index;
|
|
129818
129790
|
// If the reference comes first, return immediately.
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -53133,7 +53133,7 @@ var ts;
|
|
|
53133
53133
|
}
|
|
53134
53134
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ &&
|
|
53135
53135
|
type.flags & 262144 /* TypeParameter */ &&
|
|
53136
|
-
|
|
53136
|
+
!isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
|
|
53137
53137
|
var name_2 = typeParameterToName(type, context);
|
|
53138
53138
|
context.approximateLength += ts.idText(name_2).length;
|
|
53139
53139
|
return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(ts.idText(name_2)), /*typeArguments*/ undefined);
|
|
@@ -53838,23 +53838,6 @@ var ts;
|
|
|
53838
53838
|
else {
|
|
53839
53839
|
typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); });
|
|
53840
53840
|
}
|
|
53841
|
-
// For regular function/method declarations, the enclosing declaration will already be signature.declaration,
|
|
53842
|
-
// so this is a no-op, but for arrow functions and function expressions, the enclosing declaration will be
|
|
53843
|
-
// the declaration that the arrow function / function expression is assigned to, which is not the right scope.
|
|
53844
|
-
//
|
|
53845
|
-
// If the parameters or return type include "typeof globalThis.paramName", using the wrong scope will lead
|
|
53846
|
-
// us to believe that we can emit "typeof paramName" instead, even though that would refer to the parameter,
|
|
53847
|
-
// not the global. Make sure we are in the right scope by changing the enclosingDeclaration to the function.
|
|
53848
|
-
//
|
|
53849
|
-
// We check that this signature's declaration is within the existing enclosing declaration so we don't pull
|
|
53850
|
-
// in types from other files; if it is outside of the enclosing declaration, then we shouldn't be able to
|
|
53851
|
-
// access those parameter types via typeof anyway. The declaration should also not be in a JS file; those can
|
|
53852
|
-
// only be typed via JSDoc, but JSDoc annotations appear outside of the function and therefore are not in
|
|
53853
|
-
// the function's scope, unlike true type annotations.
|
|
53854
|
-
var saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
53855
|
-
if (signature.declaration && !ts.isInJSFile(signature.declaration) && saveEnclosingDeclaration && ts.findAncestor(signature.declaration, function (n) { return n === saveEnclosingDeclaration; })) {
|
|
53856
|
-
context.enclosingDeclaration = signature.declaration;
|
|
53857
|
-
}
|
|
53858
53841
|
var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
|
|
53859
53842
|
// If the expanded parameter list had a variadic in a non-trailing position, don't expand it
|
|
53860
53843
|
var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
|
|
@@ -53906,7 +53889,6 @@ var ts;
|
|
|
53906
53889
|
if (typeArguments) {
|
|
53907
53890
|
node.typeArguments = ts.factory.createNodeArray(typeArguments);
|
|
53908
53891
|
}
|
|
53909
|
-
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
53910
53892
|
return node;
|
|
53911
53893
|
}
|
|
53912
53894
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -54336,27 +54318,14 @@ var ts;
|
|
|
54336
54318
|
}
|
|
54337
54319
|
return false;
|
|
54338
54320
|
}
|
|
54339
|
-
|
|
54340
|
-
|
|
54341
|
-
// already been rewritten by typeParameterToName and so needs that rewritten name.
|
|
54342
|
-
function typeParameterIsCachedOrNotAccessible(type, context) {
|
|
54343
|
-
return !!getCachedTypeParameterName(type, context) || !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration);
|
|
54344
|
-
}
|
|
54345
|
-
function getCachedTypeParameterName(type, context) {
|
|
54321
|
+
function typeParameterToName(type, context) {
|
|
54322
|
+
var _a, _b;
|
|
54346
54323
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
54347
54324
|
var cached = context.typeParameterNames.get(getTypeId(type));
|
|
54348
54325
|
if (cached) {
|
|
54349
54326
|
return cached;
|
|
54350
54327
|
}
|
|
54351
54328
|
}
|
|
54352
|
-
return undefined;
|
|
54353
|
-
}
|
|
54354
|
-
function typeParameterToName(type, context) {
|
|
54355
|
-
var _a, _b;
|
|
54356
|
-
var cached = getCachedTypeParameterName(type, context);
|
|
54357
|
-
if (cached) {
|
|
54358
|
-
return cached;
|
|
54359
|
-
}
|
|
54360
54329
|
var result = symbolToName(type.symbol, context, 788968 /* Type */, /*expectsIdentifier*/ true);
|
|
54361
54330
|
if (!(result.kind & 79 /* Identifier */)) {
|
|
54362
54331
|
return ts.factory.createIdentifier("(Missing type parameter)");
|
|
@@ -54589,7 +54558,7 @@ var ts;
|
|
|
54589
54558
|
}
|
|
54590
54559
|
if (ts.isIdentifier(node)) {
|
|
54591
54560
|
var type = getDeclaredTypeOfSymbol(sym);
|
|
54592
|
-
var name = sym.flags & 262144 /* TypeParameter */ &&
|
|
54561
|
+
var name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
|
|
54593
54562
|
name.symbol = sym; // for quickinfo, which uses identifier symbol information
|
|
54594
54563
|
return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
|
|
54595
54564
|
}
|
|
@@ -71984,23 +71953,26 @@ var ts;
|
|
|
71984
71953
|
if (!assumeTrue) {
|
|
71985
71954
|
return filterType(type, function (t) { return !isRelated(t, candidate); });
|
|
71986
71955
|
}
|
|
71987
|
-
//
|
|
71988
|
-
//
|
|
71989
|
-
|
|
71990
|
-
|
|
71991
|
-
|
|
71992
|
-
|
|
71993
|
-
|
|
71994
|
-
|
|
71995
|
-
|
|
71996
|
-
|
|
71997
|
-
|
|
71998
|
-
|
|
71999
|
-
|
|
72000
|
-
return
|
|
72001
|
-
|
|
72002
|
-
|
|
72003
|
-
|
|
71956
|
+
// We first attempt to filter the current type, narrowing constituents as appropriate and removing
|
|
71957
|
+
// constituents that are unrelated to the candidate.
|
|
71958
|
+
var narrowedType = type.flags & 3 /* AnyOrUnknown */ ? candidate :
|
|
71959
|
+
mapType(candidate, function (c) {
|
|
71960
|
+
// For each constituent t in the current type, if t and and c are directly related, pick the most
|
|
71961
|
+
// specific of the two.
|
|
71962
|
+
var directlyRelated = mapType(type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
|
|
71963
|
+
// If no constituents are directly related, create intersections for any generic constituents that
|
|
71964
|
+
// are related by constraint.
|
|
71965
|
+
return directlyRelated.flags & 131072 /* Never */ ?
|
|
71966
|
+
mapType(type, function (t) { return maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
|
|
71967
|
+
directlyRelated;
|
|
71968
|
+
});
|
|
71969
|
+
// If filtering produced a non-empty type, return that. Otherwise, pick the most specific of the two
|
|
71970
|
+
// based on assignability, or as a last resort produce an intersection.
|
|
71971
|
+
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType :
|
|
71972
|
+
isTypeSubtypeOf(candidate, type) ? candidate :
|
|
71973
|
+
isTypeAssignableTo(type, candidate) ? type :
|
|
71974
|
+
isTypeAssignableTo(candidate, type) ? candidate :
|
|
71975
|
+
getIntersectionType([type, candidate]);
|
|
72004
71976
|
}
|
|
72005
71977
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
72006
71978
|
if (hasMatchingArgument(callExpression, reference)) {
|
|
@@ -130425,7 +130397,7 @@ var ts;
|
|
|
130425
130397
|
for (var _b = 0, textChanges_1 = textChanges_2; _b < textChanges_1.length; _b++) {
|
|
130426
130398
|
var change = textChanges_1[_b];
|
|
130427
130399
|
var span = change.span, newText = change.newText;
|
|
130428
|
-
var index = indexInTextChange(newText, name);
|
|
130400
|
+
var index = indexInTextChange(newText, ts.escapeString(name));
|
|
130429
130401
|
if (index !== -1) {
|
|
130430
130402
|
lastPos = span.start + delta + index;
|
|
130431
130403
|
// If the reference comes first, return immediately.
|
package/lib/typescript.js
CHANGED
|
@@ -53124,7 +53124,7 @@ var ts;
|
|
|
53124
53124
|
}
|
|
53125
53125
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ &&
|
|
53126
53126
|
type.flags & 262144 /* TypeParameter */ &&
|
|
53127
|
-
|
|
53127
|
+
!isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
|
|
53128
53128
|
var name_2 = typeParameterToName(type, context);
|
|
53129
53129
|
context.approximateLength += ts.idText(name_2).length;
|
|
53130
53130
|
return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(ts.idText(name_2)), /*typeArguments*/ undefined);
|
|
@@ -53829,23 +53829,6 @@ var ts;
|
|
|
53829
53829
|
else {
|
|
53830
53830
|
typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); });
|
|
53831
53831
|
}
|
|
53832
|
-
// For regular function/method declarations, the enclosing declaration will already be signature.declaration,
|
|
53833
|
-
// so this is a no-op, but for arrow functions and function expressions, the enclosing declaration will be
|
|
53834
|
-
// the declaration that the arrow function / function expression is assigned to, which is not the right scope.
|
|
53835
|
-
//
|
|
53836
|
-
// If the parameters or return type include "typeof globalThis.paramName", using the wrong scope will lead
|
|
53837
|
-
// us to believe that we can emit "typeof paramName" instead, even though that would refer to the parameter,
|
|
53838
|
-
// not the global. Make sure we are in the right scope by changing the enclosingDeclaration to the function.
|
|
53839
|
-
//
|
|
53840
|
-
// We check that this signature's declaration is within the existing enclosing declaration so we don't pull
|
|
53841
|
-
// in types from other files; if it is outside of the enclosing declaration, then we shouldn't be able to
|
|
53842
|
-
// access those parameter types via typeof anyway. The declaration should also not be in a JS file; those can
|
|
53843
|
-
// only be typed via JSDoc, but JSDoc annotations appear outside of the function and therefore are not in
|
|
53844
|
-
// the function's scope, unlike true type annotations.
|
|
53845
|
-
var saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
53846
|
-
if (signature.declaration && !ts.isInJSFile(signature.declaration) && saveEnclosingDeclaration && ts.findAncestor(signature.declaration, function (n) { return n === saveEnclosingDeclaration; })) {
|
|
53847
|
-
context.enclosingDeclaration = signature.declaration;
|
|
53848
|
-
}
|
|
53849
53832
|
var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
|
|
53850
53833
|
// If the expanded parameter list had a variadic in a non-trailing position, don't expand it
|
|
53851
53834
|
var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
|
|
@@ -53897,7 +53880,6 @@ var ts;
|
|
|
53897
53880
|
if (typeArguments) {
|
|
53898
53881
|
node.typeArguments = ts.factory.createNodeArray(typeArguments);
|
|
53899
53882
|
}
|
|
53900
|
-
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
53901
53883
|
return node;
|
|
53902
53884
|
}
|
|
53903
53885
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -54327,27 +54309,14 @@ var ts;
|
|
|
54327
54309
|
}
|
|
54328
54310
|
return false;
|
|
54329
54311
|
}
|
|
54330
|
-
|
|
54331
|
-
|
|
54332
|
-
// already been rewritten by typeParameterToName and so needs that rewritten name.
|
|
54333
|
-
function typeParameterIsCachedOrNotAccessible(type, context) {
|
|
54334
|
-
return !!getCachedTypeParameterName(type, context) || !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration);
|
|
54335
|
-
}
|
|
54336
|
-
function getCachedTypeParameterName(type, context) {
|
|
54312
|
+
function typeParameterToName(type, context) {
|
|
54313
|
+
var _a, _b;
|
|
54337
54314
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
54338
54315
|
var cached = context.typeParameterNames.get(getTypeId(type));
|
|
54339
54316
|
if (cached) {
|
|
54340
54317
|
return cached;
|
|
54341
54318
|
}
|
|
54342
54319
|
}
|
|
54343
|
-
return undefined;
|
|
54344
|
-
}
|
|
54345
|
-
function typeParameterToName(type, context) {
|
|
54346
|
-
var _a, _b;
|
|
54347
|
-
var cached = getCachedTypeParameterName(type, context);
|
|
54348
|
-
if (cached) {
|
|
54349
|
-
return cached;
|
|
54350
|
-
}
|
|
54351
54320
|
var result = symbolToName(type.symbol, context, 788968 /* Type */, /*expectsIdentifier*/ true);
|
|
54352
54321
|
if (!(result.kind & 79 /* Identifier */)) {
|
|
54353
54322
|
return ts.factory.createIdentifier("(Missing type parameter)");
|
|
@@ -54580,7 +54549,7 @@ var ts;
|
|
|
54580
54549
|
}
|
|
54581
54550
|
if (ts.isIdentifier(node)) {
|
|
54582
54551
|
var type = getDeclaredTypeOfSymbol(sym);
|
|
54583
|
-
var name = sym.flags & 262144 /* TypeParameter */ &&
|
|
54552
|
+
var name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
|
|
54584
54553
|
name.symbol = sym; // for quickinfo, which uses identifier symbol information
|
|
54585
54554
|
return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
|
|
54586
54555
|
}
|
|
@@ -71975,23 +71944,26 @@ var ts;
|
|
|
71975
71944
|
if (!assumeTrue) {
|
|
71976
71945
|
return filterType(type, function (t) { return !isRelated(t, candidate); });
|
|
71977
71946
|
}
|
|
71978
|
-
//
|
|
71979
|
-
//
|
|
71980
|
-
|
|
71981
|
-
|
|
71982
|
-
|
|
71983
|
-
|
|
71984
|
-
|
|
71985
|
-
|
|
71986
|
-
|
|
71987
|
-
|
|
71988
|
-
|
|
71989
|
-
|
|
71990
|
-
|
|
71991
|
-
return
|
|
71992
|
-
|
|
71993
|
-
|
|
71994
|
-
|
|
71947
|
+
// We first attempt to filter the current type, narrowing constituents as appropriate and removing
|
|
71948
|
+
// constituents that are unrelated to the candidate.
|
|
71949
|
+
var narrowedType = type.flags & 3 /* AnyOrUnknown */ ? candidate :
|
|
71950
|
+
mapType(candidate, function (c) {
|
|
71951
|
+
// For each constituent t in the current type, if t and and c are directly related, pick the most
|
|
71952
|
+
// specific of the two.
|
|
71953
|
+
var directlyRelated = mapType(type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
|
|
71954
|
+
// If no constituents are directly related, create intersections for any generic constituents that
|
|
71955
|
+
// are related by constraint.
|
|
71956
|
+
return directlyRelated.flags & 131072 /* Never */ ?
|
|
71957
|
+
mapType(type, function (t) { return maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
|
|
71958
|
+
directlyRelated;
|
|
71959
|
+
});
|
|
71960
|
+
// If filtering produced a non-empty type, return that. Otherwise, pick the most specific of the two
|
|
71961
|
+
// based on assignability, or as a last resort produce an intersection.
|
|
71962
|
+
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType :
|
|
71963
|
+
isTypeSubtypeOf(candidate, type) ? candidate :
|
|
71964
|
+
isTypeAssignableTo(type, candidate) ? type :
|
|
71965
|
+
isTypeAssignableTo(candidate, type) ? candidate :
|
|
71966
|
+
getIntersectionType([type, candidate]);
|
|
71995
71967
|
}
|
|
71996
71968
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
71997
71969
|
if (hasMatchingArgument(callExpression, reference)) {
|
|
@@ -130416,7 +130388,7 @@ var ts;
|
|
|
130416
130388
|
for (var _b = 0, textChanges_1 = textChanges_2; _b < textChanges_1.length; _b++) {
|
|
130417
130389
|
var change = textChanges_1[_b];
|
|
130418
130390
|
var span = change.span, newText = change.newText;
|
|
130419
|
-
var index = indexInTextChange(newText, name);
|
|
130391
|
+
var index = indexInTextChange(newText, ts.escapeString(name));
|
|
130420
130392
|
if (index !== -1) {
|
|
130421
130393
|
lastPos = span.start + delta + index;
|
|
130422
130394
|
// If the reference comes first, return immediately.
|
|
@@ -53124,7 +53124,7 @@ var ts;
|
|
|
53124
53124
|
}
|
|
53125
53125
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ &&
|
|
53126
53126
|
type.flags & 262144 /* TypeParameter */ &&
|
|
53127
|
-
|
|
53127
|
+
!isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
|
|
53128
53128
|
var name_2 = typeParameterToName(type, context);
|
|
53129
53129
|
context.approximateLength += ts.idText(name_2).length;
|
|
53130
53130
|
return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(ts.idText(name_2)), /*typeArguments*/ undefined);
|
|
@@ -53829,23 +53829,6 @@ var ts;
|
|
|
53829
53829
|
else {
|
|
53830
53830
|
typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); });
|
|
53831
53831
|
}
|
|
53832
|
-
// For regular function/method declarations, the enclosing declaration will already be signature.declaration,
|
|
53833
|
-
// so this is a no-op, but for arrow functions and function expressions, the enclosing declaration will be
|
|
53834
|
-
// the declaration that the arrow function / function expression is assigned to, which is not the right scope.
|
|
53835
|
-
//
|
|
53836
|
-
// If the parameters or return type include "typeof globalThis.paramName", using the wrong scope will lead
|
|
53837
|
-
// us to believe that we can emit "typeof paramName" instead, even though that would refer to the parameter,
|
|
53838
|
-
// not the global. Make sure we are in the right scope by changing the enclosingDeclaration to the function.
|
|
53839
|
-
//
|
|
53840
|
-
// We check that this signature's declaration is within the existing enclosing declaration so we don't pull
|
|
53841
|
-
// in types from other files; if it is outside of the enclosing declaration, then we shouldn't be able to
|
|
53842
|
-
// access those parameter types via typeof anyway. The declaration should also not be in a JS file; those can
|
|
53843
|
-
// only be typed via JSDoc, but JSDoc annotations appear outside of the function and therefore are not in
|
|
53844
|
-
// the function's scope, unlike true type annotations.
|
|
53845
|
-
var saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
53846
|
-
if (signature.declaration && !ts.isInJSFile(signature.declaration) && saveEnclosingDeclaration && ts.findAncestor(signature.declaration, function (n) { return n === saveEnclosingDeclaration; })) {
|
|
53847
|
-
context.enclosingDeclaration = signature.declaration;
|
|
53848
|
-
}
|
|
53849
53832
|
var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
|
|
53850
53833
|
// If the expanded parameter list had a variadic in a non-trailing position, don't expand it
|
|
53851
53834
|
var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
|
|
@@ -53897,7 +53880,6 @@ var ts;
|
|
|
53897
53880
|
if (typeArguments) {
|
|
53898
53881
|
node.typeArguments = ts.factory.createNodeArray(typeArguments);
|
|
53899
53882
|
}
|
|
53900
|
-
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
53901
53883
|
return node;
|
|
53902
53884
|
}
|
|
53903
53885
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -54327,27 +54309,14 @@ var ts;
|
|
|
54327
54309
|
}
|
|
54328
54310
|
return false;
|
|
54329
54311
|
}
|
|
54330
|
-
|
|
54331
|
-
|
|
54332
|
-
// already been rewritten by typeParameterToName and so needs that rewritten name.
|
|
54333
|
-
function typeParameterIsCachedOrNotAccessible(type, context) {
|
|
54334
|
-
return !!getCachedTypeParameterName(type, context) || !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration);
|
|
54335
|
-
}
|
|
54336
|
-
function getCachedTypeParameterName(type, context) {
|
|
54312
|
+
function typeParameterToName(type, context) {
|
|
54313
|
+
var _a, _b;
|
|
54337
54314
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
54338
54315
|
var cached = context.typeParameterNames.get(getTypeId(type));
|
|
54339
54316
|
if (cached) {
|
|
54340
54317
|
return cached;
|
|
54341
54318
|
}
|
|
54342
54319
|
}
|
|
54343
|
-
return undefined;
|
|
54344
|
-
}
|
|
54345
|
-
function typeParameterToName(type, context) {
|
|
54346
|
-
var _a, _b;
|
|
54347
|
-
var cached = getCachedTypeParameterName(type, context);
|
|
54348
|
-
if (cached) {
|
|
54349
|
-
return cached;
|
|
54350
|
-
}
|
|
54351
54320
|
var result = symbolToName(type.symbol, context, 788968 /* Type */, /*expectsIdentifier*/ true);
|
|
54352
54321
|
if (!(result.kind & 79 /* Identifier */)) {
|
|
54353
54322
|
return ts.factory.createIdentifier("(Missing type parameter)");
|
|
@@ -54580,7 +54549,7 @@ var ts;
|
|
|
54580
54549
|
}
|
|
54581
54550
|
if (ts.isIdentifier(node)) {
|
|
54582
54551
|
var type = getDeclaredTypeOfSymbol(sym);
|
|
54583
|
-
var name = sym.flags & 262144 /* TypeParameter */ &&
|
|
54552
|
+
var name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
|
|
54584
54553
|
name.symbol = sym; // for quickinfo, which uses identifier symbol information
|
|
54585
54554
|
return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
|
|
54586
54555
|
}
|
|
@@ -71975,23 +71944,26 @@ var ts;
|
|
|
71975
71944
|
if (!assumeTrue) {
|
|
71976
71945
|
return filterType(type, function (t) { return !isRelated(t, candidate); });
|
|
71977
71946
|
}
|
|
71978
|
-
//
|
|
71979
|
-
//
|
|
71980
|
-
|
|
71981
|
-
|
|
71982
|
-
|
|
71983
|
-
|
|
71984
|
-
|
|
71985
|
-
|
|
71986
|
-
|
|
71987
|
-
|
|
71988
|
-
|
|
71989
|
-
|
|
71990
|
-
|
|
71991
|
-
return
|
|
71992
|
-
|
|
71993
|
-
|
|
71994
|
-
|
|
71947
|
+
// We first attempt to filter the current type, narrowing constituents as appropriate and removing
|
|
71948
|
+
// constituents that are unrelated to the candidate.
|
|
71949
|
+
var narrowedType = type.flags & 3 /* AnyOrUnknown */ ? candidate :
|
|
71950
|
+
mapType(candidate, function (c) {
|
|
71951
|
+
// For each constituent t in the current type, if t and and c are directly related, pick the most
|
|
71952
|
+
// specific of the two.
|
|
71953
|
+
var directlyRelated = mapType(type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
|
|
71954
|
+
// If no constituents are directly related, create intersections for any generic constituents that
|
|
71955
|
+
// are related by constraint.
|
|
71956
|
+
return directlyRelated.flags & 131072 /* Never */ ?
|
|
71957
|
+
mapType(type, function (t) { return maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
|
|
71958
|
+
directlyRelated;
|
|
71959
|
+
});
|
|
71960
|
+
// If filtering produced a non-empty type, return that. Otherwise, pick the most specific of the two
|
|
71961
|
+
// based on assignability, or as a last resort produce an intersection.
|
|
71962
|
+
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType :
|
|
71963
|
+
isTypeSubtypeOf(candidate, type) ? candidate :
|
|
71964
|
+
isTypeAssignableTo(type, candidate) ? type :
|
|
71965
|
+
isTypeAssignableTo(candidate, type) ? candidate :
|
|
71966
|
+
getIntersectionType([type, candidate]);
|
|
71995
71967
|
}
|
|
71996
71968
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
71997
71969
|
if (hasMatchingArgument(callExpression, reference)) {
|
|
@@ -130416,7 +130388,7 @@ var ts;
|
|
|
130416
130388
|
for (var _b = 0, textChanges_1 = textChanges_2; _b < textChanges_1.length; _b++) {
|
|
130417
130389
|
var change = textChanges_1[_b];
|
|
130418
130390
|
var span = change.span, newText = change.newText;
|
|
130419
|
-
var index = indexInTextChange(newText, name);
|
|
130391
|
+
var index = indexInTextChange(newText, ts.escapeString(name));
|
|
130420
130392
|
if (index !== -1) {
|
|
130421
130393
|
lastPos = span.start + delta + index;
|
|
130422
130394
|
// If the reference comes first, return immediately.
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -52919,7 +52919,7 @@ var ts;
|
|
|
52919
52919
|
}
|
|
52920
52920
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ &&
|
|
52921
52921
|
type.flags & 262144 /* TypeParameter */ &&
|
|
52922
|
-
|
|
52922
|
+
!isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration)) {
|
|
52923
52923
|
var name_2 = typeParameterToName(type, context);
|
|
52924
52924
|
context.approximateLength += ts.idText(name_2).length;
|
|
52925
52925
|
return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(ts.idText(name_2)), /*typeArguments*/ undefined);
|
|
@@ -53624,23 +53624,6 @@ var ts;
|
|
|
53624
53624
|
else {
|
|
53625
53625
|
typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); });
|
|
53626
53626
|
}
|
|
53627
|
-
// For regular function/method declarations, the enclosing declaration will already be signature.declaration,
|
|
53628
|
-
// so this is a no-op, but for arrow functions and function expressions, the enclosing declaration will be
|
|
53629
|
-
// the declaration that the arrow function / function expression is assigned to, which is not the right scope.
|
|
53630
|
-
//
|
|
53631
|
-
// If the parameters or return type include "typeof globalThis.paramName", using the wrong scope will lead
|
|
53632
|
-
// us to believe that we can emit "typeof paramName" instead, even though that would refer to the parameter,
|
|
53633
|
-
// not the global. Make sure we are in the right scope by changing the enclosingDeclaration to the function.
|
|
53634
|
-
//
|
|
53635
|
-
// We check that this signature's declaration is within the existing enclosing declaration so we don't pull
|
|
53636
|
-
// in types from other files; if it is outside of the enclosing declaration, then we shouldn't be able to
|
|
53637
|
-
// access those parameter types via typeof anyway. The declaration should also not be in a JS file; those can
|
|
53638
|
-
// only be typed via JSDoc, but JSDoc annotations appear outside of the function and therefore are not in
|
|
53639
|
-
// the function's scope, unlike true type annotations.
|
|
53640
|
-
var saveEnclosingDeclaration = context.enclosingDeclaration;
|
|
53641
|
-
if (signature.declaration && !ts.isInJSFile(signature.declaration) && saveEnclosingDeclaration && ts.findAncestor(signature.declaration, function (n) { return n === saveEnclosingDeclaration; })) {
|
|
53642
|
-
context.enclosingDeclaration = signature.declaration;
|
|
53643
|
-
}
|
|
53644
53627
|
var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
|
|
53645
53628
|
// If the expanded parameter list had a variadic in a non-trailing position, don't expand it
|
|
53646
53629
|
var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
|
|
@@ -53692,7 +53675,6 @@ var ts;
|
|
|
53692
53675
|
if (typeArguments) {
|
|
53693
53676
|
node.typeArguments = ts.factory.createNodeArray(typeArguments);
|
|
53694
53677
|
}
|
|
53695
|
-
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
53696
53678
|
return node;
|
|
53697
53679
|
}
|
|
53698
53680
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -54122,27 +54104,14 @@ var ts;
|
|
|
54122
54104
|
}
|
|
54123
54105
|
return false;
|
|
54124
54106
|
}
|
|
54125
|
-
|
|
54126
|
-
|
|
54127
|
-
// already been rewritten by typeParameterToName and so needs that rewritten name.
|
|
54128
|
-
function typeParameterIsCachedOrNotAccessible(type, context) {
|
|
54129
|
-
return !!getCachedTypeParameterName(type, context) || !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration);
|
|
54130
|
-
}
|
|
54131
|
-
function getCachedTypeParameterName(type, context) {
|
|
54107
|
+
function typeParameterToName(type, context) {
|
|
54108
|
+
var _a, _b;
|
|
54132
54109
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
54133
54110
|
var cached = context.typeParameterNames.get(getTypeId(type));
|
|
54134
54111
|
if (cached) {
|
|
54135
54112
|
return cached;
|
|
54136
54113
|
}
|
|
54137
54114
|
}
|
|
54138
|
-
return undefined;
|
|
54139
|
-
}
|
|
54140
|
-
function typeParameterToName(type, context) {
|
|
54141
|
-
var _a, _b;
|
|
54142
|
-
var cached = getCachedTypeParameterName(type, context);
|
|
54143
|
-
if (cached) {
|
|
54144
|
-
return cached;
|
|
54145
|
-
}
|
|
54146
54115
|
var result = symbolToName(type.symbol, context, 788968 /* Type */, /*expectsIdentifier*/ true);
|
|
54147
54116
|
if (!(result.kind & 79 /* Identifier */)) {
|
|
54148
54117
|
return ts.factory.createIdentifier("(Missing type parameter)");
|
|
@@ -54375,7 +54344,7 @@ var ts;
|
|
|
54375
54344
|
}
|
|
54376
54345
|
if (ts.isIdentifier(node)) {
|
|
54377
54346
|
var type = getDeclaredTypeOfSymbol(sym);
|
|
54378
|
-
var name = sym.flags & 262144 /* TypeParameter */ &&
|
|
54347
|
+
var name = sym.flags & 262144 /* TypeParameter */ && !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
|
|
54379
54348
|
name.symbol = sym; // for quickinfo, which uses identifier symbol information
|
|
54380
54349
|
return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
|
|
54381
54350
|
}
|
|
@@ -71770,23 +71739,26 @@ var ts;
|
|
|
71770
71739
|
if (!assumeTrue) {
|
|
71771
71740
|
return filterType(type, function (t) { return !isRelated(t, candidate); });
|
|
71772
71741
|
}
|
|
71773
|
-
//
|
|
71774
|
-
//
|
|
71775
|
-
|
|
71776
|
-
|
|
71777
|
-
|
|
71778
|
-
|
|
71779
|
-
|
|
71780
|
-
|
|
71781
|
-
|
|
71782
|
-
|
|
71783
|
-
|
|
71784
|
-
|
|
71785
|
-
|
|
71786
|
-
return
|
|
71787
|
-
|
|
71788
|
-
|
|
71789
|
-
|
|
71742
|
+
// We first attempt to filter the current type, narrowing constituents as appropriate and removing
|
|
71743
|
+
// constituents that are unrelated to the candidate.
|
|
71744
|
+
var narrowedType = type.flags & 3 /* AnyOrUnknown */ ? candidate :
|
|
71745
|
+
mapType(candidate, function (c) {
|
|
71746
|
+
// For each constituent t in the current type, if t and and c are directly related, pick the most
|
|
71747
|
+
// specific of the two.
|
|
71748
|
+
var directlyRelated = mapType(type, function (t) { return isRelated(t, c) ? t : isRelated(c, t) ? c : neverType; });
|
|
71749
|
+
// If no constituents are directly related, create intersections for any generic constituents that
|
|
71750
|
+
// are related by constraint.
|
|
71751
|
+
return directlyRelated.flags & 131072 /* Never */ ?
|
|
71752
|
+
mapType(type, function (t) { return maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType; }) :
|
|
71753
|
+
directlyRelated;
|
|
71754
|
+
});
|
|
71755
|
+
// If filtering produced a non-empty type, return that. Otherwise, pick the most specific of the two
|
|
71756
|
+
// based on assignability, or as a last resort produce an intersection.
|
|
71757
|
+
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType :
|
|
71758
|
+
isTypeSubtypeOf(candidate, type) ? candidate :
|
|
71759
|
+
isTypeAssignableTo(type, candidate) ? type :
|
|
71760
|
+
isTypeAssignableTo(candidate, type) ? candidate :
|
|
71761
|
+
getIntersectionType([type, candidate]);
|
|
71790
71762
|
}
|
|
71791
71763
|
function narrowTypeByCallExpression(type, callExpression, assumeTrue) {
|
|
71792
71764
|
if (hasMatchingArgument(callExpression, reference)) {
|
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": "4.8.0-pr-
|
|
5
|
+
"version": "4.8.0-pr-49625-17",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|