@typescript-deploys/pr-build 4.8.0-pr-49619-2 → 4.8.0-pr-49627-10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lib.es5.d.ts +12 -0
- package/lib/tsc.js +26 -9
- package/lib/tsserver.js +49 -9
- package/lib/tsserverlibrary.js +49 -9
- package/lib/typescript.js +49 -9
- package/lib/typescriptServices.js +49 -9
- package/lib/typingsInstaller.js +49 -9
- package/package.json +1 -1
package/lib/lib.es5.d.ts
CHANGED
|
@@ -933,12 +933,24 @@ interface DateConstructor {
|
|
|
933
933
|
declare var Date: DateConstructor;
|
|
934
934
|
|
|
935
935
|
interface RegExpMatchArray extends Array<string> {
|
|
936
|
+
/**
|
|
937
|
+
* The index of the search at which the result was found.
|
|
938
|
+
*/
|
|
936
939
|
index?: number;
|
|
940
|
+
/**
|
|
941
|
+
* A copy of the search string.
|
|
942
|
+
*/
|
|
937
943
|
input?: string;
|
|
938
944
|
}
|
|
939
945
|
|
|
940
946
|
interface RegExpExecArray extends Array<string> {
|
|
947
|
+
/**
|
|
948
|
+
* The index of the search at which the result was found.
|
|
949
|
+
*/
|
|
941
950
|
index: number;
|
|
951
|
+
/**
|
|
952
|
+
* A copy of the search string.
|
|
953
|
+
*/
|
|
942
954
|
input: string;
|
|
943
955
|
}
|
|
944
956
|
|
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220622";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -43590,7 +43590,7 @@ var ts;
|
|
|
43590
43590
|
}
|
|
43591
43591
|
if (context.flags & 4 &&
|
|
43592
43592
|
type.flags & 262144 &&
|
|
43593
|
-
|
|
43593
|
+
typeParameterIsCachedOrNotAccessible(type, context)) {
|
|
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,6 +44235,10 @@ 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
|
+
}
|
|
44238
44242
|
var expandedParams = getExpandedParameters(signature, true)[0];
|
|
44239
44243
|
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); });
|
|
44240
44244
|
var thisParameter = tryGetThisParameterDeclaration(signature, context);
|
|
@@ -44285,6 +44289,7 @@ var ts;
|
|
|
44285
44289
|
if (typeArguments) {
|
|
44286
44290
|
node.typeArguments = ts.factory.createNodeArray(typeArguments);
|
|
44287
44291
|
}
|
|
44292
|
+
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
44288
44293
|
return node;
|
|
44289
44294
|
}
|
|
44290
44295
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -44678,14 +44683,24 @@ var ts;
|
|
|
44678
44683
|
}
|
|
44679
44684
|
return false;
|
|
44680
44685
|
}
|
|
44681
|
-
function
|
|
44682
|
-
|
|
44686
|
+
function typeParameterIsCachedOrNotAccessible(type, context) {
|
|
44687
|
+
return !!getCachedTypeParameterName(type, context) || !isTypeSymbolAccessible(type.symbol, context.enclosingDeclaration);
|
|
44688
|
+
}
|
|
44689
|
+
function getCachedTypeParameterName(type, context) {
|
|
44683
44690
|
if (context.flags & 4 && context.typeParameterNames) {
|
|
44684
44691
|
var cached = context.typeParameterNames.get(getTypeId(type));
|
|
44685
44692
|
if (cached) {
|
|
44686
44693
|
return cached;
|
|
44687
44694
|
}
|
|
44688
44695
|
}
|
|
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
|
+
}
|
|
44689
44704
|
var result = symbolToName(type.symbol, context, 788968, true);
|
|
44690
44705
|
if (!(result.kind & 79)) {
|
|
44691
44706
|
return ts.factory.createIdentifier("(Missing type parameter)");
|
|
@@ -44898,7 +44913,7 @@ var ts;
|
|
|
44898
44913
|
}
|
|
44899
44914
|
if (ts.isIdentifier(node)) {
|
|
44900
44915
|
var type = getDeclaredTypeOfSymbol(sym);
|
|
44901
|
-
var name = sym.flags & 262144 &&
|
|
44916
|
+
var name = sym.flags & 262144 && typeParameterIsCachedOrNotAccessible(type, context) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
|
|
44902
44917
|
name.symbol = sym;
|
|
44903
44918
|
return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216) };
|
|
44904
44919
|
}
|
|
@@ -53831,7 +53846,7 @@ var ts;
|
|
|
53831
53846
|
});
|
|
53832
53847
|
}
|
|
53833
53848
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
53834
|
-
if (target.flags & 131068)
|
|
53849
|
+
if (target.flags & (131068 | 131072))
|
|
53835
53850
|
return false;
|
|
53836
53851
|
if (isTupleLikeType(source)) {
|
|
53837
53852
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
@@ -53896,7 +53911,7 @@ var ts;
|
|
|
53896
53911
|
});
|
|
53897
53912
|
}
|
|
53898
53913
|
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
53899
|
-
if (target.flags & 131068)
|
|
53914
|
+
if (target.flags & (131068 | 131072))
|
|
53900
53915
|
return false;
|
|
53901
53916
|
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
53902
53917
|
}
|
|
@@ -58335,7 +58350,7 @@ var ts;
|
|
|
58335
58350
|
}
|
|
58336
58351
|
if (ts.isEntityNameExpression(node.argumentExpression)) {
|
|
58337
58352
|
var symbol = resolveEntityName(node.argumentExpression, 111551, true);
|
|
58338
|
-
if (!symbol || !
|
|
58353
|
+
if (!symbol || !isConstVariable(symbol))
|
|
58339
58354
|
return undefined;
|
|
58340
58355
|
var declaration = symbol.valueDeclaration;
|
|
58341
58356
|
if (declaration === undefined)
|
|
@@ -64072,6 +64087,8 @@ var ts;
|
|
|
64072
64087
|
if (result) {
|
|
64073
64088
|
return result;
|
|
64074
64089
|
}
|
|
64090
|
+
result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
|
|
64091
|
+
getNodeLinks(node).resolvedSignature = result;
|
|
64075
64092
|
if (reportErrors) {
|
|
64076
64093
|
if (candidatesForArgumentError) {
|
|
64077
64094
|
if (candidatesForArgumentError.length === 1 || candidatesForArgumentError.length > 3) {
|
|
@@ -64157,7 +64174,7 @@ var ts;
|
|
|
64157
64174
|
}
|
|
64158
64175
|
}
|
|
64159
64176
|
}
|
|
64160
|
-
return
|
|
64177
|
+
return result;
|
|
64161
64178
|
function addImplementationSuccessElaboration(failed, diagnostic) {
|
|
64162
64179
|
var _a, _b;
|
|
64163
64180
|
var oldCandidatesForArgumentError = candidatesForArgumentError;
|
package/lib/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
112
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220622";
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -52939,7 +52939,7 @@ var ts;
|
|
|
52939
52939
|
}
|
|
52940
52940
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ &&
|
|
52941
52941
|
type.flags & 262144 /* TypeParameter */ &&
|
|
52942
|
-
|
|
52942
|
+
typeParameterIsCachedOrNotAccessible(type, context)) {
|
|
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,6 +53644,23 @@ 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
|
+
}
|
|
53647
53664
|
var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
|
|
53648
53665
|
// If the expanded parameter list had a variadic in a non-trailing position, don't expand it
|
|
53649
53666
|
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); });
|
|
@@ -53695,6 +53712,7 @@ var ts;
|
|
|
53695
53712
|
if (typeArguments) {
|
|
53696
53713
|
node.typeArguments = ts.factory.createNodeArray(typeArguments);
|
|
53697
53714
|
}
|
|
53715
|
+
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
53698
53716
|
return node;
|
|
53699
53717
|
}
|
|
53700
53718
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -54124,14 +54142,27 @@ var ts;
|
|
|
54124
54142
|
}
|
|
54125
54143
|
return false;
|
|
54126
54144
|
}
|
|
54127
|
-
|
|
54128
|
-
|
|
54145
|
+
// Returns true if this type parameter should be converted to a name via typeParameterToName,
|
|
54146
|
+
// either because it is not accessible, or because it's a use of a type variable that has
|
|
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) {
|
|
54129
54152
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
54130
54153
|
var cached = context.typeParameterNames.get(getTypeId(type));
|
|
54131
54154
|
if (cached) {
|
|
54132
54155
|
return cached;
|
|
54133
54156
|
}
|
|
54134
54157
|
}
|
|
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
|
+
}
|
|
54135
54166
|
var result = symbolToName(type.symbol, context, 788968 /* Type */, /*expectsIdentifier*/ true);
|
|
54136
54167
|
if (!(result.kind & 79 /* Identifier */)) {
|
|
54137
54168
|
return ts.factory.createIdentifier("(Missing type parameter)");
|
|
@@ -54364,7 +54395,7 @@ var ts;
|
|
|
54364
54395
|
}
|
|
54365
54396
|
if (ts.isIdentifier(node)) {
|
|
54366
54397
|
var type = getDeclaredTypeOfSymbol(sym);
|
|
54367
|
-
var name = sym.flags & 262144 /* TypeParameter */ &&
|
|
54398
|
+
var name = sym.flags & 262144 /* TypeParameter */ && typeParameterIsCachedOrNotAccessible(type, context) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
|
|
54368
54399
|
name.symbol = sym; // for quickinfo, which uses identifier symbol information
|
|
54369
54400
|
return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
|
|
54370
54401
|
}
|
|
@@ -64630,7 +64661,7 @@ var ts;
|
|
|
64630
64661
|
});
|
|
64631
64662
|
}
|
|
64632
64663
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
64633
|
-
if (target.flags & 131068 /* Primitive */)
|
|
64664
|
+
if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
|
|
64634
64665
|
return false;
|
|
64635
64666
|
if (isTupleLikeType(source)) {
|
|
64636
64667
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
@@ -64697,7 +64728,7 @@ var ts;
|
|
|
64697
64728
|
});
|
|
64698
64729
|
}
|
|
64699
64730
|
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
64700
|
-
if (target.flags & 131068 /* Primitive */)
|
|
64731
|
+
if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
|
|
64701
64732
|
return false;
|
|
64702
64733
|
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
64703
64734
|
}
|
|
@@ -69893,7 +69924,7 @@ var ts;
|
|
|
69893
69924
|
}
|
|
69894
69925
|
if (ts.isEntityNameExpression(node.argumentExpression)) {
|
|
69895
69926
|
var symbol = resolveEntityName(node.argumentExpression, 111551 /* Value */, /*ignoreErrors*/ true);
|
|
69896
|
-
if (!symbol || !
|
|
69927
|
+
if (!symbol || !isConstVariable(symbol))
|
|
69897
69928
|
return undefined;
|
|
69898
69929
|
var declaration = symbol.valueDeclaration;
|
|
69899
69930
|
if (declaration === undefined)
|
|
@@ -76643,6 +76674,15 @@ var ts;
|
|
|
76643
76674
|
if (result) {
|
|
76644
76675
|
return result;
|
|
76645
76676
|
}
|
|
76677
|
+
result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
|
|
76678
|
+
// Preemptively cache the result; getResolvedSignature will do this after we return, but
|
|
76679
|
+
// we need to ensure that the result is present for the error checks below so that if
|
|
76680
|
+
// this signature is encountered again, we handle the circularity (rather than producing a
|
|
76681
|
+
// different result which may produce no errors and assert). Callers of getResolvedSignature
|
|
76682
|
+
// don't hit this issue because they only observe this result after it's had a chance to
|
|
76683
|
+
// be cached, but the error reporting code below executes before getResolvedSignature sets
|
|
76684
|
+
// resolvedSignature.
|
|
76685
|
+
getNodeLinks(node).resolvedSignature = result;
|
|
76646
76686
|
// No signatures were applicable. Now report errors based on the last applicable signature with
|
|
76647
76687
|
// no arguments excluded from assignability checks.
|
|
76648
76688
|
// If candidate is undefined, it means that no candidates had a suitable arity. In that case,
|
|
@@ -76734,7 +76774,7 @@ var ts;
|
|
|
76734
76774
|
}
|
|
76735
76775
|
}
|
|
76736
76776
|
}
|
|
76737
|
-
return
|
|
76777
|
+
return result;
|
|
76738
76778
|
function addImplementationSuccessElaboration(failed, diagnostic) {
|
|
76739
76779
|
var _a, _b;
|
|
76740
76780
|
var oldCandidatesForArgumentError = candidatesForArgumentError;
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -303,7 +303,7 @@ var ts;
|
|
|
303
303
|
// The following is baselined as a literal template type without intervention
|
|
304
304
|
/** The version of the TypeScript compiler release */
|
|
305
305
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
306
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
306
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220622";
|
|
307
307
|
/* @internal */
|
|
308
308
|
var Comparison;
|
|
309
309
|
(function (Comparison) {
|
|
@@ -53133,7 +53133,7 @@ var ts;
|
|
|
53133
53133
|
}
|
|
53134
53134
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ &&
|
|
53135
53135
|
type.flags & 262144 /* TypeParameter */ &&
|
|
53136
|
-
|
|
53136
|
+
typeParameterIsCachedOrNotAccessible(type, context)) {
|
|
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,6 +53838,23 @@ 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
|
+
}
|
|
53841
53858
|
var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
|
|
53842
53859
|
// If the expanded parameter list had a variadic in a non-trailing position, don't expand it
|
|
53843
53860
|
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); });
|
|
@@ -53889,6 +53906,7 @@ var ts;
|
|
|
53889
53906
|
if (typeArguments) {
|
|
53890
53907
|
node.typeArguments = ts.factory.createNodeArray(typeArguments);
|
|
53891
53908
|
}
|
|
53909
|
+
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
53892
53910
|
return node;
|
|
53893
53911
|
}
|
|
53894
53912
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -54318,14 +54336,27 @@ var ts;
|
|
|
54318
54336
|
}
|
|
54319
54337
|
return false;
|
|
54320
54338
|
}
|
|
54321
|
-
|
|
54322
|
-
|
|
54339
|
+
// Returns true if this type parameter should be converted to a name via typeParameterToName,
|
|
54340
|
+
// either because it is not accessible, or because it's a use of a type variable that has
|
|
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) {
|
|
54323
54346
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
54324
54347
|
var cached = context.typeParameterNames.get(getTypeId(type));
|
|
54325
54348
|
if (cached) {
|
|
54326
54349
|
return cached;
|
|
54327
54350
|
}
|
|
54328
54351
|
}
|
|
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
|
+
}
|
|
54329
54360
|
var result = symbolToName(type.symbol, context, 788968 /* Type */, /*expectsIdentifier*/ true);
|
|
54330
54361
|
if (!(result.kind & 79 /* Identifier */)) {
|
|
54331
54362
|
return ts.factory.createIdentifier("(Missing type parameter)");
|
|
@@ -54558,7 +54589,7 @@ var ts;
|
|
|
54558
54589
|
}
|
|
54559
54590
|
if (ts.isIdentifier(node)) {
|
|
54560
54591
|
var type = getDeclaredTypeOfSymbol(sym);
|
|
54561
|
-
var name = sym.flags & 262144 /* TypeParameter */ &&
|
|
54592
|
+
var name = sym.flags & 262144 /* TypeParameter */ && typeParameterIsCachedOrNotAccessible(type, context) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
|
|
54562
54593
|
name.symbol = sym; // for quickinfo, which uses identifier symbol information
|
|
54563
54594
|
return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
|
|
54564
54595
|
}
|
|
@@ -64824,7 +64855,7 @@ var ts;
|
|
|
64824
64855
|
});
|
|
64825
64856
|
}
|
|
64826
64857
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
64827
|
-
if (target.flags & 131068 /* Primitive */)
|
|
64858
|
+
if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
|
|
64828
64859
|
return false;
|
|
64829
64860
|
if (isTupleLikeType(source)) {
|
|
64830
64861
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
@@ -64891,7 +64922,7 @@ var ts;
|
|
|
64891
64922
|
});
|
|
64892
64923
|
}
|
|
64893
64924
|
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
64894
|
-
if (target.flags & 131068 /* Primitive */)
|
|
64925
|
+
if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
|
|
64895
64926
|
return false;
|
|
64896
64927
|
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
64897
64928
|
}
|
|
@@ -70087,7 +70118,7 @@ var ts;
|
|
|
70087
70118
|
}
|
|
70088
70119
|
if (ts.isEntityNameExpression(node.argumentExpression)) {
|
|
70089
70120
|
var symbol = resolveEntityName(node.argumentExpression, 111551 /* Value */, /*ignoreErrors*/ true);
|
|
70090
|
-
if (!symbol || !
|
|
70121
|
+
if (!symbol || !isConstVariable(symbol))
|
|
70091
70122
|
return undefined;
|
|
70092
70123
|
var declaration = symbol.valueDeclaration;
|
|
70093
70124
|
if (declaration === undefined)
|
|
@@ -76837,6 +76868,15 @@ var ts;
|
|
|
76837
76868
|
if (result) {
|
|
76838
76869
|
return result;
|
|
76839
76870
|
}
|
|
76871
|
+
result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
|
|
76872
|
+
// Preemptively cache the result; getResolvedSignature will do this after we return, but
|
|
76873
|
+
// we need to ensure that the result is present for the error checks below so that if
|
|
76874
|
+
// this signature is encountered again, we handle the circularity (rather than producing a
|
|
76875
|
+
// different result which may produce no errors and assert). Callers of getResolvedSignature
|
|
76876
|
+
// don't hit this issue because they only observe this result after it's had a chance to
|
|
76877
|
+
// be cached, but the error reporting code below executes before getResolvedSignature sets
|
|
76878
|
+
// resolvedSignature.
|
|
76879
|
+
getNodeLinks(node).resolvedSignature = result;
|
|
76840
76880
|
// No signatures were applicable. Now report errors based on the last applicable signature with
|
|
76841
76881
|
// no arguments excluded from assignability checks.
|
|
76842
76882
|
// If candidate is undefined, it means that no candidates had a suitable arity. In that case,
|
|
@@ -76928,7 +76968,7 @@ var ts;
|
|
|
76928
76968
|
}
|
|
76929
76969
|
}
|
|
76930
76970
|
}
|
|
76931
|
-
return
|
|
76971
|
+
return result;
|
|
76932
76972
|
function addImplementationSuccessElaboration(failed, diagnostic) {
|
|
76933
76973
|
var _a, _b;
|
|
76934
76974
|
var oldCandidatesForArgumentError = candidatesForArgumentError;
|
package/lib/typescript.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220622";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -53124,7 +53124,7 @@ var ts;
|
|
|
53124
53124
|
}
|
|
53125
53125
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ &&
|
|
53126
53126
|
type.flags & 262144 /* TypeParameter */ &&
|
|
53127
|
-
|
|
53127
|
+
typeParameterIsCachedOrNotAccessible(type, context)) {
|
|
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,6 +53829,23 @@ 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
|
+
}
|
|
53832
53849
|
var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
|
|
53833
53850
|
// If the expanded parameter list had a variadic in a non-trailing position, don't expand it
|
|
53834
53851
|
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); });
|
|
@@ -53880,6 +53897,7 @@ var ts;
|
|
|
53880
53897
|
if (typeArguments) {
|
|
53881
53898
|
node.typeArguments = ts.factory.createNodeArray(typeArguments);
|
|
53882
53899
|
}
|
|
53900
|
+
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
53883
53901
|
return node;
|
|
53884
53902
|
}
|
|
53885
53903
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -54309,14 +54327,27 @@ var ts;
|
|
|
54309
54327
|
}
|
|
54310
54328
|
return false;
|
|
54311
54329
|
}
|
|
54312
|
-
|
|
54313
|
-
|
|
54330
|
+
// Returns true if this type parameter should be converted to a name via typeParameterToName,
|
|
54331
|
+
// either because it is not accessible, or because it's a use of a type variable that has
|
|
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) {
|
|
54314
54337
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
54315
54338
|
var cached = context.typeParameterNames.get(getTypeId(type));
|
|
54316
54339
|
if (cached) {
|
|
54317
54340
|
return cached;
|
|
54318
54341
|
}
|
|
54319
54342
|
}
|
|
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
|
+
}
|
|
54320
54351
|
var result = symbolToName(type.symbol, context, 788968 /* Type */, /*expectsIdentifier*/ true);
|
|
54321
54352
|
if (!(result.kind & 79 /* Identifier */)) {
|
|
54322
54353
|
return ts.factory.createIdentifier("(Missing type parameter)");
|
|
@@ -54549,7 +54580,7 @@ var ts;
|
|
|
54549
54580
|
}
|
|
54550
54581
|
if (ts.isIdentifier(node)) {
|
|
54551
54582
|
var type = getDeclaredTypeOfSymbol(sym);
|
|
54552
|
-
var name = sym.flags & 262144 /* TypeParameter */ &&
|
|
54583
|
+
var name = sym.flags & 262144 /* TypeParameter */ && typeParameterIsCachedOrNotAccessible(type, context) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
|
|
54553
54584
|
name.symbol = sym; // for quickinfo, which uses identifier symbol information
|
|
54554
54585
|
return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
|
|
54555
54586
|
}
|
|
@@ -64815,7 +64846,7 @@ var ts;
|
|
|
64815
64846
|
});
|
|
64816
64847
|
}
|
|
64817
64848
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
64818
|
-
if (target.flags & 131068 /* Primitive */)
|
|
64849
|
+
if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
|
|
64819
64850
|
return false;
|
|
64820
64851
|
if (isTupleLikeType(source)) {
|
|
64821
64852
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
@@ -64882,7 +64913,7 @@ var ts;
|
|
|
64882
64913
|
});
|
|
64883
64914
|
}
|
|
64884
64915
|
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
64885
|
-
if (target.flags & 131068 /* Primitive */)
|
|
64916
|
+
if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
|
|
64886
64917
|
return false;
|
|
64887
64918
|
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
64888
64919
|
}
|
|
@@ -70078,7 +70109,7 @@ var ts;
|
|
|
70078
70109
|
}
|
|
70079
70110
|
if (ts.isEntityNameExpression(node.argumentExpression)) {
|
|
70080
70111
|
var symbol = resolveEntityName(node.argumentExpression, 111551 /* Value */, /*ignoreErrors*/ true);
|
|
70081
|
-
if (!symbol || !
|
|
70112
|
+
if (!symbol || !isConstVariable(symbol))
|
|
70082
70113
|
return undefined;
|
|
70083
70114
|
var declaration = symbol.valueDeclaration;
|
|
70084
70115
|
if (declaration === undefined)
|
|
@@ -76828,6 +76859,15 @@ var ts;
|
|
|
76828
76859
|
if (result) {
|
|
76829
76860
|
return result;
|
|
76830
76861
|
}
|
|
76862
|
+
result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
|
|
76863
|
+
// Preemptively cache the result; getResolvedSignature will do this after we return, but
|
|
76864
|
+
// we need to ensure that the result is present for the error checks below so that if
|
|
76865
|
+
// this signature is encountered again, we handle the circularity (rather than producing a
|
|
76866
|
+
// different result which may produce no errors and assert). Callers of getResolvedSignature
|
|
76867
|
+
// don't hit this issue because they only observe this result after it's had a chance to
|
|
76868
|
+
// be cached, but the error reporting code below executes before getResolvedSignature sets
|
|
76869
|
+
// resolvedSignature.
|
|
76870
|
+
getNodeLinks(node).resolvedSignature = result;
|
|
76831
76871
|
// No signatures were applicable. Now report errors based on the last applicable signature with
|
|
76832
76872
|
// no arguments excluded from assignability checks.
|
|
76833
76873
|
// If candidate is undefined, it means that no candidates had a suitable arity. In that case,
|
|
@@ -76919,7 +76959,7 @@ var ts;
|
|
|
76919
76959
|
}
|
|
76920
76960
|
}
|
|
76921
76961
|
}
|
|
76922
|
-
return
|
|
76962
|
+
return result;
|
|
76923
76963
|
function addImplementationSuccessElaboration(failed, diagnostic) {
|
|
76924
76964
|
var _a, _b;
|
|
76925
76965
|
var oldCandidatesForArgumentError = candidatesForArgumentError;
|
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220622";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -53124,7 +53124,7 @@ var ts;
|
|
|
53124
53124
|
}
|
|
53125
53125
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ &&
|
|
53126
53126
|
type.flags & 262144 /* TypeParameter */ &&
|
|
53127
|
-
|
|
53127
|
+
typeParameterIsCachedOrNotAccessible(type, context)) {
|
|
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,6 +53829,23 @@ 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
|
+
}
|
|
53832
53849
|
var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
|
|
53833
53850
|
// If the expanded parameter list had a variadic in a non-trailing position, don't expand it
|
|
53834
53851
|
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); });
|
|
@@ -53880,6 +53897,7 @@ var ts;
|
|
|
53880
53897
|
if (typeArguments) {
|
|
53881
53898
|
node.typeArguments = ts.factory.createNodeArray(typeArguments);
|
|
53882
53899
|
}
|
|
53900
|
+
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
53883
53901
|
return node;
|
|
53884
53902
|
}
|
|
53885
53903
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -54309,14 +54327,27 @@ var ts;
|
|
|
54309
54327
|
}
|
|
54310
54328
|
return false;
|
|
54311
54329
|
}
|
|
54312
|
-
|
|
54313
|
-
|
|
54330
|
+
// Returns true if this type parameter should be converted to a name via typeParameterToName,
|
|
54331
|
+
// either because it is not accessible, or because it's a use of a type variable that has
|
|
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) {
|
|
54314
54337
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
54315
54338
|
var cached = context.typeParameterNames.get(getTypeId(type));
|
|
54316
54339
|
if (cached) {
|
|
54317
54340
|
return cached;
|
|
54318
54341
|
}
|
|
54319
54342
|
}
|
|
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
|
+
}
|
|
54320
54351
|
var result = symbolToName(type.symbol, context, 788968 /* Type */, /*expectsIdentifier*/ true);
|
|
54321
54352
|
if (!(result.kind & 79 /* Identifier */)) {
|
|
54322
54353
|
return ts.factory.createIdentifier("(Missing type parameter)");
|
|
@@ -54549,7 +54580,7 @@ var ts;
|
|
|
54549
54580
|
}
|
|
54550
54581
|
if (ts.isIdentifier(node)) {
|
|
54551
54582
|
var type = getDeclaredTypeOfSymbol(sym);
|
|
54552
|
-
var name = sym.flags & 262144 /* TypeParameter */ &&
|
|
54583
|
+
var name = sym.flags & 262144 /* TypeParameter */ && typeParameterIsCachedOrNotAccessible(type, context) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
|
|
54553
54584
|
name.symbol = sym; // for quickinfo, which uses identifier symbol information
|
|
54554
54585
|
return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
|
|
54555
54586
|
}
|
|
@@ -64815,7 +64846,7 @@ var ts;
|
|
|
64815
64846
|
});
|
|
64816
64847
|
}
|
|
64817
64848
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
64818
|
-
if (target.flags & 131068 /* Primitive */)
|
|
64849
|
+
if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
|
|
64819
64850
|
return false;
|
|
64820
64851
|
if (isTupleLikeType(source)) {
|
|
64821
64852
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
@@ -64882,7 +64913,7 @@ var ts;
|
|
|
64882
64913
|
});
|
|
64883
64914
|
}
|
|
64884
64915
|
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
64885
|
-
if (target.flags & 131068 /* Primitive */)
|
|
64916
|
+
if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
|
|
64886
64917
|
return false;
|
|
64887
64918
|
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
64888
64919
|
}
|
|
@@ -70078,7 +70109,7 @@ var ts;
|
|
|
70078
70109
|
}
|
|
70079
70110
|
if (ts.isEntityNameExpression(node.argumentExpression)) {
|
|
70080
70111
|
var symbol = resolveEntityName(node.argumentExpression, 111551 /* Value */, /*ignoreErrors*/ true);
|
|
70081
|
-
if (!symbol || !
|
|
70112
|
+
if (!symbol || !isConstVariable(symbol))
|
|
70082
70113
|
return undefined;
|
|
70083
70114
|
var declaration = symbol.valueDeclaration;
|
|
70084
70115
|
if (declaration === undefined)
|
|
@@ -76828,6 +76859,15 @@ var ts;
|
|
|
76828
76859
|
if (result) {
|
|
76829
76860
|
return result;
|
|
76830
76861
|
}
|
|
76862
|
+
result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
|
|
76863
|
+
// Preemptively cache the result; getResolvedSignature will do this after we return, but
|
|
76864
|
+
// we need to ensure that the result is present for the error checks below so that if
|
|
76865
|
+
// this signature is encountered again, we handle the circularity (rather than producing a
|
|
76866
|
+
// different result which may produce no errors and assert). Callers of getResolvedSignature
|
|
76867
|
+
// don't hit this issue because they only observe this result after it's had a chance to
|
|
76868
|
+
// be cached, but the error reporting code below executes before getResolvedSignature sets
|
|
76869
|
+
// resolvedSignature.
|
|
76870
|
+
getNodeLinks(node).resolvedSignature = result;
|
|
76831
76871
|
// No signatures were applicable. Now report errors based on the last applicable signature with
|
|
76832
76872
|
// no arguments excluded from assignability checks.
|
|
76833
76873
|
// If candidate is undefined, it means that no candidates had a suitable arity. In that case,
|
|
@@ -76919,7 +76959,7 @@ var ts;
|
|
|
76919
76959
|
}
|
|
76920
76960
|
}
|
|
76921
76961
|
}
|
|
76922
|
-
return
|
|
76962
|
+
return result;
|
|
76923
76963
|
function addImplementationSuccessElaboration(failed, diagnostic) {
|
|
76924
76964
|
var _a, _b;
|
|
76925
76965
|
var oldCandidatesForArgumentError = candidatesForArgumentError;
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-insiders.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-insiders.20220622";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -52919,7 +52919,7 @@ var ts;
|
|
|
52919
52919
|
}
|
|
52920
52920
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ &&
|
|
52921
52921
|
type.flags & 262144 /* TypeParameter */ &&
|
|
52922
|
-
|
|
52922
|
+
typeParameterIsCachedOrNotAccessible(type, context)) {
|
|
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,6 +53624,23 @@ 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
|
+
}
|
|
53627
53644
|
var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
|
|
53628
53645
|
// If the expanded parameter list had a variadic in a non-trailing position, don't expand it
|
|
53629
53646
|
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); });
|
|
@@ -53675,6 +53692,7 @@ var ts;
|
|
|
53675
53692
|
if (typeArguments) {
|
|
53676
53693
|
node.typeArguments = ts.factory.createNodeArray(typeArguments);
|
|
53677
53694
|
}
|
|
53695
|
+
context.enclosingDeclaration = saveEnclosingDeclaration;
|
|
53678
53696
|
return node;
|
|
53679
53697
|
}
|
|
53680
53698
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -54104,14 +54122,27 @@ var ts;
|
|
|
54104
54122
|
}
|
|
54105
54123
|
return false;
|
|
54106
54124
|
}
|
|
54107
|
-
|
|
54108
|
-
|
|
54125
|
+
// Returns true if this type parameter should be converted to a name via typeParameterToName,
|
|
54126
|
+
// either because it is not accessible, or because it's a use of a type variable that has
|
|
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) {
|
|
54109
54132
|
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && context.typeParameterNames) {
|
|
54110
54133
|
var cached = context.typeParameterNames.get(getTypeId(type));
|
|
54111
54134
|
if (cached) {
|
|
54112
54135
|
return cached;
|
|
54113
54136
|
}
|
|
54114
54137
|
}
|
|
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
|
+
}
|
|
54115
54146
|
var result = symbolToName(type.symbol, context, 788968 /* Type */, /*expectsIdentifier*/ true);
|
|
54116
54147
|
if (!(result.kind & 79 /* Identifier */)) {
|
|
54117
54148
|
return ts.factory.createIdentifier("(Missing type parameter)");
|
|
@@ -54344,7 +54375,7 @@ var ts;
|
|
|
54344
54375
|
}
|
|
54345
54376
|
if (ts.isIdentifier(node)) {
|
|
54346
54377
|
var type = getDeclaredTypeOfSymbol(sym);
|
|
54347
|
-
var name = sym.flags & 262144 /* TypeParameter */ &&
|
|
54378
|
+
var name = sym.flags & 262144 /* TypeParameter */ && typeParameterIsCachedOrNotAccessible(type, context) ? typeParameterToName(type, context) : ts.factory.cloneNode(node);
|
|
54348
54379
|
name.symbol = sym; // for quickinfo, which uses identifier symbol information
|
|
54349
54380
|
return { introducesError: introducesError, node: ts.setEmitFlags(ts.setOriginalNode(name, node), 16777216 /* NoAsciiEscaping */) };
|
|
54350
54381
|
}
|
|
@@ -64610,7 +64641,7 @@ var ts;
|
|
|
64610
64641
|
});
|
|
64611
64642
|
}
|
|
64612
64643
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
64613
|
-
if (target.flags & 131068 /* Primitive */)
|
|
64644
|
+
if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
|
|
64614
64645
|
return false;
|
|
64615
64646
|
if (isTupleLikeType(source)) {
|
|
64616
64647
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
@@ -64677,7 +64708,7 @@ var ts;
|
|
|
64677
64708
|
});
|
|
64678
64709
|
}
|
|
64679
64710
|
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
64680
|
-
if (target.flags & 131068 /* Primitive */)
|
|
64711
|
+
if (target.flags & (131068 /* Primitive */ | 131072 /* Never */))
|
|
64681
64712
|
return false;
|
|
64682
64713
|
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
64683
64714
|
}
|
|
@@ -69873,7 +69904,7 @@ var ts;
|
|
|
69873
69904
|
}
|
|
69874
69905
|
if (ts.isEntityNameExpression(node.argumentExpression)) {
|
|
69875
69906
|
var symbol = resolveEntityName(node.argumentExpression, 111551 /* Value */, /*ignoreErrors*/ true);
|
|
69876
|
-
if (!symbol || !
|
|
69907
|
+
if (!symbol || !isConstVariable(symbol))
|
|
69877
69908
|
return undefined;
|
|
69878
69909
|
var declaration = symbol.valueDeclaration;
|
|
69879
69910
|
if (declaration === undefined)
|
|
@@ -76623,6 +76654,15 @@ var ts;
|
|
|
76623
76654
|
if (result) {
|
|
76624
76655
|
return result;
|
|
76625
76656
|
}
|
|
76657
|
+
result = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
|
|
76658
|
+
// Preemptively cache the result; getResolvedSignature will do this after we return, but
|
|
76659
|
+
// we need to ensure that the result is present for the error checks below so that if
|
|
76660
|
+
// this signature is encountered again, we handle the circularity (rather than producing a
|
|
76661
|
+
// different result which may produce no errors and assert). Callers of getResolvedSignature
|
|
76662
|
+
// don't hit this issue because they only observe this result after it's had a chance to
|
|
76663
|
+
// be cached, but the error reporting code below executes before getResolvedSignature sets
|
|
76664
|
+
// resolvedSignature.
|
|
76665
|
+
getNodeLinks(node).resolvedSignature = result;
|
|
76626
76666
|
// No signatures were applicable. Now report errors based on the last applicable signature with
|
|
76627
76667
|
// no arguments excluded from assignability checks.
|
|
76628
76668
|
// If candidate is undefined, it means that no candidates had a suitable arity. In that case,
|
|
@@ -76714,7 +76754,7 @@ var ts;
|
|
|
76714
76754
|
}
|
|
76715
76755
|
}
|
|
76716
76756
|
}
|
|
76717
|
-
return
|
|
76757
|
+
return result;
|
|
76718
76758
|
function addImplementationSuccessElaboration(failed, diagnostic) {
|
|
76719
76759
|
var _a, _b;
|
|
76720
76760
|
var oldCandidatesForArgumentError = candidatesForArgumentError;
|
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-49627-10",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|