typescript 4.7.0-dev.20220329 → 4.7.0-dev.20220330
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/protocol.d.ts +7 -0
- package/lib/tsc.js +53 -35
- package/lib/tsserver.js +364 -152
- package/lib/tsserverlibrary.d.ts +8 -0
- package/lib/tsserverlibrary.js +364 -152
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +364 -152
- package/lib/typescriptServices.d.ts +1 -0
- package/lib/typescriptServices.js +364 -152
- package/lib/typingsInstaller.js +55 -36
- package/package.json +1 -1
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-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220330";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -47395,7 +47395,8 @@ var ts;
|
|
|
47395
47395
|
CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
47396
47396
|
CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
47397
47397
|
CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
|
|
47398
|
-
CheckMode[CheckMode["
|
|
47398
|
+
CheckMode[CheckMode["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
|
|
47399
|
+
CheckMode[CheckMode["RestBindingElement"] = 64] = "RestBindingElement";
|
|
47399
47400
|
// e.g. in `const { a, ...rest } = foo`, when checking the type of `foo` to determine the type of `rest`,
|
|
47400
47401
|
// we need to preserve generic types instead of substituting them for constraints
|
|
47401
47402
|
})(CheckMode || (CheckMode = {}));
|
|
@@ -47733,26 +47734,10 @@ var ts;
|
|
|
47733
47734
|
if (!node) {
|
|
47734
47735
|
return undefined;
|
|
47735
47736
|
}
|
|
47736
|
-
|
|
47737
|
-
|
|
47738
|
-
if (contextFlags & 4 /* Completions */ && containingCall) {
|
|
47739
|
-
var toMarkSkip = node;
|
|
47740
|
-
do {
|
|
47741
|
-
getNodeLinks(toMarkSkip).skipDirectInference = true;
|
|
47742
|
-
toMarkSkip = toMarkSkip.parent;
|
|
47743
|
-
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
47744
|
-
getNodeLinks(containingCall).resolvedSignature = undefined;
|
|
47745
|
-
}
|
|
47746
|
-
var result = getContextualType(node, contextFlags);
|
|
47747
|
-
if (contextFlags & 4 /* Completions */ && containingCall) {
|
|
47748
|
-
var toMarkSkip = node;
|
|
47749
|
-
do {
|
|
47750
|
-
getNodeLinks(toMarkSkip).skipDirectInference = undefined;
|
|
47751
|
-
toMarkSkip = toMarkSkip.parent;
|
|
47752
|
-
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
47753
|
-
getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
|
|
47737
|
+
if (contextFlags & 4 /* Completions */) {
|
|
47738
|
+
return runWithInferenceBlockedFromSourceNode(node, function () { return getContextualType(node, contextFlags); });
|
|
47754
47739
|
}
|
|
47755
|
-
return
|
|
47740
|
+
return getContextualType(node, contextFlags);
|
|
47756
47741
|
},
|
|
47757
47742
|
getContextualTypeForObjectLiteralElement: function (nodeIn) {
|
|
47758
47743
|
var node = ts.getParseTreeNode(nodeIn, ts.isObjectLiteralElementLike);
|
|
@@ -47772,6 +47757,9 @@ var ts;
|
|
|
47772
47757
|
getResolvedSignature: function (node, candidatesOutArray, argumentCount) {
|
|
47773
47758
|
return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */);
|
|
47774
47759
|
},
|
|
47760
|
+
getResolvedSignatureForStringLiteralCompletions: function (call, editingArgument, candidatesOutArray) {
|
|
47761
|
+
return getResolvedSignatureWorker(call, candidatesOutArray, /*argumentCount*/ undefined, 32 /* IsForStringLiteralArgumentCompletions */, editingArgument);
|
|
47762
|
+
},
|
|
47775
47763
|
getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, argumentCount) {
|
|
47776
47764
|
return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */);
|
|
47777
47765
|
},
|
|
@@ -47924,10 +47912,34 @@ var ts;
|
|
|
47924
47912
|
getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration,
|
|
47925
47913
|
getMemberOverrideModifierStatus: getMemberOverrideModifierStatus,
|
|
47926
47914
|
};
|
|
47927
|
-
function
|
|
47915
|
+
function runWithInferenceBlockedFromSourceNode(node, fn) {
|
|
47916
|
+
var containingCall = ts.findAncestor(node, ts.isCallLikeExpression);
|
|
47917
|
+
var containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
|
|
47918
|
+
if (containingCall) {
|
|
47919
|
+
var toMarkSkip = node;
|
|
47920
|
+
do {
|
|
47921
|
+
getNodeLinks(toMarkSkip).skipDirectInference = true;
|
|
47922
|
+
toMarkSkip = toMarkSkip.parent;
|
|
47923
|
+
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
47924
|
+
getNodeLinks(containingCall).resolvedSignature = undefined;
|
|
47925
|
+
}
|
|
47926
|
+
var result = fn();
|
|
47927
|
+
if (containingCall) {
|
|
47928
|
+
var toMarkSkip = node;
|
|
47929
|
+
do {
|
|
47930
|
+
getNodeLinks(toMarkSkip).skipDirectInference = undefined;
|
|
47931
|
+
toMarkSkip = toMarkSkip.parent;
|
|
47932
|
+
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
47933
|
+
getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
|
|
47934
|
+
}
|
|
47935
|
+
return result;
|
|
47936
|
+
}
|
|
47937
|
+
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode, editingArgument) {
|
|
47928
47938
|
var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
|
|
47929
47939
|
apparentArgumentCount = argumentCount;
|
|
47930
|
-
var res = node ?
|
|
47940
|
+
var res = !node ? undefined :
|
|
47941
|
+
editingArgument ? runWithInferenceBlockedFromSourceNode(editingArgument, function () { return getResolvedSignature(node, candidatesOutArray, checkMode); }) :
|
|
47942
|
+
getResolvedSignature(node, candidatesOutArray, checkMode);
|
|
47931
47943
|
apparentArgumentCount = undefined;
|
|
47932
47944
|
return res;
|
|
47933
47945
|
}
|
|
@@ -55061,7 +55073,7 @@ var ts;
|
|
|
55061
55073
|
}
|
|
55062
55074
|
/** Return the inferred type for a binding element */
|
|
55063
55075
|
function getTypeForBindingElement(declaration) {
|
|
55064
|
-
var checkMode = declaration.dotDotDotToken ?
|
|
55076
|
+
var checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
|
|
55065
55077
|
var parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
55066
55078
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
55067
55079
|
}
|
|
@@ -68189,7 +68201,7 @@ var ts;
|
|
|
68189
68201
|
for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {
|
|
68190
68202
|
var targetProp = properties_3[_i];
|
|
68191
68203
|
var sourceProp = getPropertyOfType(source, targetProp.escapedName);
|
|
68192
|
-
if (sourceProp) {
|
|
68204
|
+
if (sourceProp && !ts.some(sourceProp.declarations, hasSkipDirectInferenceFlag)) {
|
|
68193
68205
|
inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
|
|
68194
68206
|
}
|
|
68195
68207
|
}
|
|
@@ -70663,7 +70675,7 @@ var ts;
|
|
|
70663
70675
|
// as we want the type of a rest element to be generic when possible.
|
|
70664
70676
|
var contextualType = (ts.isIdentifier(node) || ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) &&
|
|
70665
70677
|
!((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
|
|
70666
|
-
(checkMode && checkMode &
|
|
70678
|
+
(checkMode && checkMode & 64 /* RestBindingElement */ ?
|
|
70667
70679
|
getContextualType(node, 8 /* SkipBindingPatterns */)
|
|
70668
70680
|
: getContextualType(node));
|
|
70669
70681
|
return contextualType && !isGenericType(contextualType);
|
|
@@ -71602,7 +71614,7 @@ var ts;
|
|
|
71602
71614
|
var parent = declaration.parent.parent;
|
|
71603
71615
|
var name = declaration.propertyName || declaration.name;
|
|
71604
71616
|
var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
|
|
71605
|
-
parent.kind !== 203 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ?
|
|
71617
|
+
parent.kind !== 203 /* BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
|
|
71606
71618
|
if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
|
|
71607
71619
|
return undefined;
|
|
71608
71620
|
if (parent.name.kind === 202 /* ArrayBindingPattern */) {
|
|
@@ -74656,7 +74668,7 @@ var ts;
|
|
|
74656
74668
|
}
|
|
74657
74669
|
for (var i = 0; i < argCount; i++) {
|
|
74658
74670
|
var arg = args[i];
|
|
74659
|
-
if (arg.kind !== 227 /* OmittedExpression */) {
|
|
74671
|
+
if (arg.kind !== 227 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
74660
74672
|
var paramType = getTypeAtPosition(signature, i);
|
|
74661
74673
|
var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
74662
74674
|
inferTypes(context.inferences, argType, paramType);
|
|
@@ -75341,7 +75353,7 @@ var ts;
|
|
|
75341
75353
|
}
|
|
75342
75354
|
}
|
|
75343
75355
|
}
|
|
75344
|
-
return getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
|
|
75356
|
+
return getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
|
|
75345
75357
|
function addImplementationSuccessElaboration(failed, diagnostic) {
|
|
75346
75358
|
var _a, _b;
|
|
75347
75359
|
var oldCandidatesForArgumentError = candidatesForArgumentError;
|
|
@@ -75442,14 +75454,14 @@ var ts;
|
|
|
75442
75454
|
}
|
|
75443
75455
|
}
|
|
75444
75456
|
// No signature was applicable. We have already reported the errors for the invalid signature.
|
|
75445
|
-
function getCandidateForOverloadFailure(node, candidates, args, hasCandidatesOutArray) {
|
|
75457
|
+
function getCandidateForOverloadFailure(node, candidates, args, hasCandidatesOutArray, checkMode) {
|
|
75446
75458
|
ts.Debug.assert(candidates.length > 0); // Else should not have called this.
|
|
75447
75459
|
checkNodeDeferred(node);
|
|
75448
75460
|
// Normally we will combine overloads. Skip this if they have type parameters since that's hard to combine.
|
|
75449
75461
|
// Don't do this if there is a `candidatesOutArray`,
|
|
75450
75462
|
// because then we want the chosen best candidate to be one of the overloads, not a combination.
|
|
75451
75463
|
return hasCandidatesOutArray || candidates.length === 1 || candidates.some(function (c) { return !!c.typeParameters; })
|
|
75452
|
-
? pickLongestCandidateSignature(node, candidates, args)
|
|
75464
|
+
? pickLongestCandidateSignature(node, candidates, args, checkMode)
|
|
75453
75465
|
: createUnionOfSignaturesForOverloadFailure(candidates);
|
|
75454
75466
|
}
|
|
75455
75467
|
function createUnionOfSignaturesForOverloadFailure(candidates) {
|
|
@@ -75497,7 +75509,7 @@ var ts;
|
|
|
75497
75509
|
// This function is currently only used for erroneous overloads, so it's good enough to just use the first source.
|
|
75498
75510
|
return createSymbolWithType(ts.first(sources), type);
|
|
75499
75511
|
}
|
|
75500
|
-
function pickLongestCandidateSignature(node, candidates, args) {
|
|
75512
|
+
function pickLongestCandidateSignature(node, candidates, args, checkMode) {
|
|
75501
75513
|
// Pick the longest signature. This way we can get a contextual type for cases like:
|
|
75502
75514
|
// declare function f(a: { xa: number; xb: number; }, b: number);
|
|
75503
75515
|
// f({ |
|
|
@@ -75513,7 +75525,7 @@ var ts;
|
|
|
75513
75525
|
var typeArgumentNodes = callLikeExpressionMayHaveTypeArguments(node) ? node.typeArguments : undefined;
|
|
75514
75526
|
var instantiated = typeArgumentNodes
|
|
75515
75527
|
? createSignatureInstantiation(candidate, getTypeArgumentsFromNodes(typeArgumentNodes, typeParameters, ts.isInJSFile(node)))
|
|
75516
|
-
: inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args);
|
|
75528
|
+
: inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args, checkMode);
|
|
75517
75529
|
candidates[bestIndex] = instantiated;
|
|
75518
75530
|
return instantiated;
|
|
75519
75531
|
}
|
|
@@ -75527,9 +75539,9 @@ var ts;
|
|
|
75527
75539
|
}
|
|
75528
75540
|
return typeArguments;
|
|
75529
75541
|
}
|
|
75530
|
-
function inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args) {
|
|
75542
|
+
function inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args, checkMode) {
|
|
75531
75543
|
var inferenceContext = createInferenceContext(typeParameters, candidate, /*flags*/ ts.isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */);
|
|
75532
|
-
var typeArgumentTypes = inferTypeArguments(node, candidate, args, 4 /* SkipContextSensitive */ | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
75544
|
+
var typeArgumentTypes = inferTypeArguments(node, candidate, args, checkMode | 4 /* SkipContextSensitive */ | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
75533
75545
|
return createSignatureInstantiation(candidate, typeArgumentTypes);
|
|
75534
75546
|
}
|
|
75535
75547
|
function getLongestCandidateIndex(candidates, argsCount) {
|
|
@@ -81595,7 +81607,7 @@ var ts;
|
|
|
81595
81607
|
}
|
|
81596
81608
|
// check private/protected variable access
|
|
81597
81609
|
var parent = node.parent.parent;
|
|
81598
|
-
var parentCheckMode = node.dotDotDotToken ?
|
|
81610
|
+
var parentCheckMode = node.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
|
|
81599
81611
|
var parentType = getTypeForBindingElementParent(parent, parentCheckMode);
|
|
81600
81612
|
var name = node.propertyName || node.name;
|
|
81601
81613
|
if (parentType && !ts.isBindingPattern(name)) {
|
|
@@ -116693,6 +116705,13 @@ var ts;
|
|
|
116693
116705
|
return "skip";
|
|
116694
116706
|
}
|
|
116695
116707
|
break;
|
|
116708
|
+
case 270 /* ImportSpecifier */:
|
|
116709
|
+
case 275 /* ExportSpecifier */:
|
|
116710
|
+
if (node.isTypeOnly) {
|
|
116711
|
+
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts.isImportSpecifier(node) ? "import...type" : "export...type"));
|
|
116712
|
+
return "skip";
|
|
116713
|
+
}
|
|
116714
|
+
break;
|
|
116696
116715
|
case 265 /* ImportEqualsDeclaration */:
|
|
116697
116716
|
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files));
|
|
116698
116717
|
return "skip";
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.7.0-dev.
|
|
5
|
+
"version": "4.7.0-dev.20220330",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|