typescript 4.7.0-dev.20220327 → 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/de/diagnosticMessages.generated.json +1 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +1 -0
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/protocol.d.ts +7 -0
- package/lib/ru/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +127 -134
- package/lib/tsserver.js +455 -271
- package/lib/tsserverlibrary.d.ts +8 -0
- package/lib/tsserverlibrary.js +455 -271
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +455 -271
- package/lib/typescriptServices.d.ts +1 -0
- package/lib/typescriptServices.js +455 -271
- package/lib/typingsInstaller.js +140 -147
- 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) {
|
|
@@ -13401,7 +13401,9 @@ var ts;
|
|
|
13401
13401
|
|| kind === 174 /* CallSignature */
|
|
13402
13402
|
|| kind === 166 /* PropertySignature */
|
|
13403
13403
|
|| kind === 168 /* MethodSignature */
|
|
13404
|
-
|| kind === 176 /* IndexSignature
|
|
13404
|
+
|| kind === 176 /* IndexSignature */
|
|
13405
|
+
|| kind === 172 /* GetAccessor */
|
|
13406
|
+
|| kind === 173 /* SetAccessor */;
|
|
13405
13407
|
}
|
|
13406
13408
|
ts.isTypeElement = isTypeElement;
|
|
13407
13409
|
function isClassOrTypeElement(node) {
|
|
@@ -47383,6 +47385,7 @@ var ts;
|
|
|
47383
47385
|
TypeSystemPropertyName[TypeSystemPropertyName["EnumTagType"] = 5] = "EnumTagType";
|
|
47384
47386
|
TypeSystemPropertyName[TypeSystemPropertyName["ResolvedTypeArguments"] = 6] = "ResolvedTypeArguments";
|
|
47385
47387
|
TypeSystemPropertyName[TypeSystemPropertyName["ResolvedBaseTypes"] = 7] = "ResolvedBaseTypes";
|
|
47388
|
+
TypeSystemPropertyName[TypeSystemPropertyName["WriteType"] = 8] = "WriteType";
|
|
47386
47389
|
})(TypeSystemPropertyName || (TypeSystemPropertyName = {}));
|
|
47387
47390
|
var CheckMode;
|
|
47388
47391
|
(function (CheckMode) {
|
|
@@ -47392,7 +47395,8 @@ var ts;
|
|
|
47392
47395
|
CheckMode[CheckMode["SkipContextSensitive"] = 4] = "SkipContextSensitive";
|
|
47393
47396
|
CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
|
|
47394
47397
|
CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
|
|
47395
|
-
CheckMode[CheckMode["
|
|
47398
|
+
CheckMode[CheckMode["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
|
|
47399
|
+
CheckMode[CheckMode["RestBindingElement"] = 64] = "RestBindingElement";
|
|
47396
47400
|
// e.g. in `const { a, ...rest } = foo`, when checking the type of `foo` to determine the type of `rest`,
|
|
47397
47401
|
// we need to preserve generic types instead of substituting them for constraints
|
|
47398
47402
|
})(CheckMode || (CheckMode = {}));
|
|
@@ -47730,26 +47734,10 @@ var ts;
|
|
|
47730
47734
|
if (!node) {
|
|
47731
47735
|
return undefined;
|
|
47732
47736
|
}
|
|
47733
|
-
|
|
47734
|
-
|
|
47735
|
-
if (contextFlags & 4 /* Completions */ && containingCall) {
|
|
47736
|
-
var toMarkSkip = node;
|
|
47737
|
-
do {
|
|
47738
|
-
getNodeLinks(toMarkSkip).skipDirectInference = true;
|
|
47739
|
-
toMarkSkip = toMarkSkip.parent;
|
|
47740
|
-
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
47741
|
-
getNodeLinks(containingCall).resolvedSignature = undefined;
|
|
47742
|
-
}
|
|
47743
|
-
var result = getContextualType(node, contextFlags);
|
|
47744
|
-
if (contextFlags & 4 /* Completions */ && containingCall) {
|
|
47745
|
-
var toMarkSkip = node;
|
|
47746
|
-
do {
|
|
47747
|
-
getNodeLinks(toMarkSkip).skipDirectInference = undefined;
|
|
47748
|
-
toMarkSkip = toMarkSkip.parent;
|
|
47749
|
-
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
47750
|
-
getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
|
|
47737
|
+
if (contextFlags & 4 /* Completions */) {
|
|
47738
|
+
return runWithInferenceBlockedFromSourceNode(node, function () { return getContextualType(node, contextFlags); });
|
|
47751
47739
|
}
|
|
47752
|
-
return
|
|
47740
|
+
return getContextualType(node, contextFlags);
|
|
47753
47741
|
},
|
|
47754
47742
|
getContextualTypeForObjectLiteralElement: function (nodeIn) {
|
|
47755
47743
|
var node = ts.getParseTreeNode(nodeIn, ts.isObjectLiteralElementLike);
|
|
@@ -47769,6 +47757,9 @@ var ts;
|
|
|
47769
47757
|
getResolvedSignature: function (node, candidatesOutArray, argumentCount) {
|
|
47770
47758
|
return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */);
|
|
47771
47759
|
},
|
|
47760
|
+
getResolvedSignatureForStringLiteralCompletions: function (call, editingArgument, candidatesOutArray) {
|
|
47761
|
+
return getResolvedSignatureWorker(call, candidatesOutArray, /*argumentCount*/ undefined, 32 /* IsForStringLiteralArgumentCompletions */, editingArgument);
|
|
47762
|
+
},
|
|
47772
47763
|
getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, argumentCount) {
|
|
47773
47764
|
return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */);
|
|
47774
47765
|
},
|
|
@@ -47921,10 +47912,34 @@ var ts;
|
|
|
47921
47912
|
getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration,
|
|
47922
47913
|
getMemberOverrideModifierStatus: getMemberOverrideModifierStatus,
|
|
47923
47914
|
};
|
|
47924
|
-
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) {
|
|
47925
47938
|
var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
|
|
47926
47939
|
apparentArgumentCount = argumentCount;
|
|
47927
|
-
var res = node ?
|
|
47940
|
+
var res = !node ? undefined :
|
|
47941
|
+
editingArgument ? runWithInferenceBlockedFromSourceNode(editingArgument, function () { return getResolvedSignature(node, candidatesOutArray, checkMode); }) :
|
|
47942
|
+
getResolvedSignature(node, candidatesOutArray, checkMode);
|
|
47928
47943
|
apparentArgumentCount = undefined;
|
|
47929
47944
|
return res;
|
|
47930
47945
|
}
|
|
@@ -48897,6 +48912,10 @@ var ts;
|
|
|
48897
48912
|
}
|
|
48898
48913
|
}
|
|
48899
48914
|
}
|
|
48915
|
+
function isConstAssertion(location) {
|
|
48916
|
+
return (ts.isAssertionExpression(location) && ts.isConstTypeReference(location.type))
|
|
48917
|
+
|| (ts.isJSDocTypeTag(location) && ts.isConstTypeReference(location.typeExpression));
|
|
48918
|
+
}
|
|
48900
48919
|
/**
|
|
48901
48920
|
* Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and
|
|
48902
48921
|
* the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with
|
|
@@ -48922,6 +48941,11 @@ var ts;
|
|
|
48922
48941
|
var grandparent;
|
|
48923
48942
|
var isInExternalModule = false;
|
|
48924
48943
|
loop: while (location) {
|
|
48944
|
+
if (name === "const" && isConstAssertion(location)) {
|
|
48945
|
+
// `const` in an `as const` has no symbol, but issues no error because there is no *actual* lookup of the type
|
|
48946
|
+
// (it refers to the constant type of the expression instead)
|
|
48947
|
+
return undefined;
|
|
48948
|
+
}
|
|
48925
48949
|
// Locals of a source file are not in scope (because they get merged into the global symbol table)
|
|
48926
48950
|
if (location.locals && !isGlobalSourceFile(location)) {
|
|
48927
48951
|
if (result = lookup(location.locals, name, meaning)) {
|
|
@@ -54870,6 +54894,8 @@ var ts;
|
|
|
54870
54894
|
return !!target.resolvedTypeArguments;
|
|
54871
54895
|
case 7 /* ResolvedBaseTypes */:
|
|
54872
54896
|
return !!target.baseTypesResolved;
|
|
54897
|
+
case 8 /* WriteType */:
|
|
54898
|
+
return !!getSymbolLinks(target).writeType;
|
|
54873
54899
|
}
|
|
54874
54900
|
return ts.Debug.assertNever(propertyName);
|
|
54875
54901
|
}
|
|
@@ -55047,7 +55073,7 @@ var ts;
|
|
|
55047
55073
|
}
|
|
55048
55074
|
/** Return the inferred type for a binding element */
|
|
55049
55075
|
function getTypeForBindingElement(declaration) {
|
|
55050
|
-
var checkMode = declaration.dotDotDotToken ?
|
|
55076
|
+
var checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
|
|
55051
55077
|
var parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
|
|
55052
55078
|
return parentType && getBindingElementTypeFromParentType(declaration, parentType);
|
|
55053
55079
|
}
|
|
@@ -55787,6 +55813,11 @@ var ts;
|
|
|
55787
55813
|
}
|
|
55788
55814
|
return getWidenedType(getWidenedLiteralType(checkExpression(declaration.statements[0].expression)));
|
|
55789
55815
|
}
|
|
55816
|
+
if (ts.isAccessor(declaration)) {
|
|
55817
|
+
// Binding of certain patterns in JS code will occasionally mark symbols as both properties
|
|
55818
|
+
// and accessors. Here we dispatch to accessor resolution if needed.
|
|
55819
|
+
return getTypeOfAccessors(symbol);
|
|
55820
|
+
}
|
|
55790
55821
|
// Handle variable, parameter or property
|
|
55791
55822
|
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
|
55792
55823
|
// Symbol is property of some kind that is merged with something - should use `getTypeOfFuncClassEnumModule` and not `getTypeOfVariableOrParameterOrProperty`
|
|
@@ -55850,9 +55881,6 @@ var ts;
|
|
|
55850
55881
|
else if (ts.isEnumMember(declaration)) {
|
|
55851
55882
|
type = getTypeOfEnumMember(symbol);
|
|
55852
55883
|
}
|
|
55853
|
-
else if (ts.isAccessor(declaration)) {
|
|
55854
|
-
type = resolveTypeOfAccessors(symbol) || ts.Debug.fail("Non-write accessor resolution must always produce a type");
|
|
55855
|
-
}
|
|
55856
55884
|
else {
|
|
55857
55885
|
return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.formatSyntaxKind(declaration.kind) + " for " + ts.Debug.formatSymbol(symbol));
|
|
55858
55886
|
}
|
|
@@ -55891,87 +55919,61 @@ var ts;
|
|
|
55891
55919
|
}
|
|
55892
55920
|
function getTypeOfAccessors(symbol) {
|
|
55893
55921
|
var links = getSymbolLinks(symbol);
|
|
55894
|
-
|
|
55895
|
-
|
|
55896
|
-
|
|
55897
|
-
|
|
55898
|
-
return links.writeType || (links.writeType = getTypeOfAccessorsWorker(symbol, /*writing*/ true));
|
|
55899
|
-
}
|
|
55900
|
-
function getTypeOfAccessorsWorker(symbol, writing) {
|
|
55901
|
-
if (writing === void 0) { writing = false; }
|
|
55902
|
-
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
|
55903
|
-
return errorType;
|
|
55904
|
-
}
|
|
55905
|
-
var type = resolveTypeOfAccessors(symbol, writing);
|
|
55906
|
-
if (!popTypeResolution()) {
|
|
55922
|
+
if (!links.type) {
|
|
55923
|
+
if (!pushTypeResolution(symbol, 0 /* Type */)) {
|
|
55924
|
+
return errorType;
|
|
55925
|
+
}
|
|
55907
55926
|
var getter = ts.getDeclarationOfKind(symbol, 172 /* GetAccessor */);
|
|
55908
|
-
|
|
55909
|
-
|
|
55910
|
-
|
|
55927
|
+
var setter = ts.getDeclarationOfKind(symbol, 173 /* SetAccessor */);
|
|
55928
|
+
// We try to resolve a getter type annotation, a setter type annotation, or a getter function
|
|
55929
|
+
// body return type inference, in that order.
|
|
55930
|
+
var type = getter && ts.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) ||
|
|
55931
|
+
getAnnotatedAccessorType(getter) ||
|
|
55932
|
+
getAnnotatedAccessorType(setter) ||
|
|
55933
|
+
getter && getter.body && getReturnTypeFromBody(getter);
|
|
55934
|
+
if (!type) {
|
|
55935
|
+
if (setter && !isPrivateWithinAmbient(setter)) {
|
|
55936
|
+
errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
|
|
55937
|
+
}
|
|
55938
|
+
else if (getter && !isPrivateWithinAmbient(getter)) {
|
|
55939
|
+
errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol));
|
|
55940
|
+
}
|
|
55941
|
+
type = anyType;
|
|
55942
|
+
}
|
|
55943
|
+
if (!popTypeResolution()) {
|
|
55944
|
+
if (getAnnotatedAccessorTypeNode(getter)) {
|
|
55945
|
+
error(getter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
55911
55946
|
}
|
|
55912
|
-
else if (
|
|
55947
|
+
else if (getAnnotatedAccessorTypeNode(setter)) {
|
|
55948
|
+
error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
55949
|
+
}
|
|
55950
|
+
else if (getter && noImplicitAny) {
|
|
55913
55951
|
error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
|
|
55914
55952
|
}
|
|
55953
|
+
type = anyType;
|
|
55915
55954
|
}
|
|
55916
|
-
type =
|
|
55955
|
+
links.type = type;
|
|
55917
55956
|
}
|
|
55918
|
-
return type;
|
|
55957
|
+
return links.type;
|
|
55919
55958
|
}
|
|
55920
|
-
function
|
|
55921
|
-
|
|
55922
|
-
|
|
55923
|
-
|
|
55924
|
-
|
|
55925
|
-
if (writing) {
|
|
55926
|
-
var setterType_1 = getAnnotatedAccessorType(setter);
|
|
55927
|
-
if (setterType_1) {
|
|
55928
|
-
return instantiateTypeIfNeeded(setterType_1, symbol);
|
|
55929
|
-
}
|
|
55930
|
-
}
|
|
55931
|
-
// Else defer to the getter type
|
|
55932
|
-
if (getter && ts.isInJSFile(getter)) {
|
|
55933
|
-
var jsDocType = getTypeForDeclarationFromJSDocComment(getter);
|
|
55934
|
-
if (jsDocType) {
|
|
55935
|
-
return instantiateTypeIfNeeded(jsDocType, symbol);
|
|
55936
|
-
}
|
|
55937
|
-
}
|
|
55938
|
-
// Try to see if the user specified a return type on the get-accessor.
|
|
55939
|
-
var getterType = getAnnotatedAccessorType(getter);
|
|
55940
|
-
if (getterType) {
|
|
55941
|
-
return instantiateTypeIfNeeded(getterType, symbol);
|
|
55942
|
-
}
|
|
55943
|
-
// If the user didn't specify a return type, try to use the set-accessor's parameter type.
|
|
55944
|
-
var setterType = getAnnotatedAccessorType(setter);
|
|
55945
|
-
if (setterType) {
|
|
55946
|
-
return setterType;
|
|
55947
|
-
}
|
|
55948
|
-
// If there are no specified types, try to infer it from the body of the get accessor if it exists.
|
|
55949
|
-
if (getter && getter.body) {
|
|
55950
|
-
var returnTypeFromBody = getReturnTypeFromBody(getter);
|
|
55951
|
-
return instantiateTypeIfNeeded(returnTypeFromBody, symbol);
|
|
55952
|
-
}
|
|
55953
|
-
// Otherwise, fall back to 'any'.
|
|
55954
|
-
if (setter) {
|
|
55955
|
-
if (!isPrivateWithinAmbient(setter)) {
|
|
55956
|
-
errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol));
|
|
55957
|
-
}
|
|
55958
|
-
return anyType;
|
|
55959
|
-
}
|
|
55960
|
-
else if (getter) {
|
|
55961
|
-
ts.Debug.assert(!!getter, "there must exist a getter as we are current checking either setter or getter in this function");
|
|
55962
|
-
if (!isPrivateWithinAmbient(getter)) {
|
|
55963
|
-
errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol));
|
|
55959
|
+
function getWriteTypeOfAccessors(symbol) {
|
|
55960
|
+
var links = getSymbolLinks(symbol);
|
|
55961
|
+
if (!links.writeType) {
|
|
55962
|
+
if (!pushTypeResolution(symbol, 8 /* WriteType */)) {
|
|
55963
|
+
return errorType;
|
|
55964
55964
|
}
|
|
55965
|
-
|
|
55966
|
-
|
|
55967
|
-
|
|
55968
|
-
|
|
55969
|
-
|
|
55970
|
-
|
|
55971
|
-
|
|
55965
|
+
var setter = ts.getDeclarationOfKind(symbol, 173 /* SetAccessor */);
|
|
55966
|
+
var writeType = getAnnotatedAccessorType(setter);
|
|
55967
|
+
if (!popTypeResolution()) {
|
|
55968
|
+
if (getAnnotatedAccessorTypeNode(setter)) {
|
|
55969
|
+
error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
|
55970
|
+
}
|
|
55971
|
+
writeType = anyType;
|
|
55972
55972
|
}
|
|
55973
|
-
|
|
55973
|
+
// Absent an explicit setter type annotation we use the read type of the accessor.
|
|
55974
|
+
links.writeType = writeType || getTypeOfAccessors(symbol);
|
|
55974
55975
|
}
|
|
55976
|
+
return links.writeType;
|
|
55975
55977
|
}
|
|
55976
55978
|
function getBaseTypeVariableOfClass(symbol) {
|
|
55977
55979
|
var baseConstructorType = getBaseConstructorTypeOfClass(getDeclaredTypeOfClassOrInterface(symbol));
|
|
@@ -56053,17 +56055,11 @@ var ts;
|
|
|
56053
56055
|
}
|
|
56054
56056
|
function getTypeOfInstantiatedSymbol(symbol) {
|
|
56055
56057
|
var links = getSymbolLinks(symbol);
|
|
56056
|
-
|
|
56057
|
-
|
|
56058
|
-
|
|
56059
|
-
|
|
56060
|
-
|
|
56061
|
-
if (!popTypeResolution()) {
|
|
56062
|
-
type = reportCircularityError(symbol);
|
|
56063
|
-
}
|
|
56064
|
-
links.type = type;
|
|
56065
|
-
}
|
|
56066
|
-
return links.type;
|
|
56058
|
+
return links.type || (links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper));
|
|
56059
|
+
}
|
|
56060
|
+
function getWriteTypeOfInstantiatedSymbol(symbol) {
|
|
56061
|
+
var links = getSymbolLinks(symbol);
|
|
56062
|
+
return links.writeType || (links.writeType = instantiateType(getWriteTypeOfSymbol(links.target), links.mapper));
|
|
56067
56063
|
}
|
|
56068
56064
|
function reportCircularityError(symbol) {
|
|
56069
56065
|
var declaration = symbol.valueDeclaration;
|
|
@@ -56100,35 +56096,23 @@ var ts;
|
|
|
56100
56096
|
return links.writeType;
|
|
56101
56097
|
}
|
|
56102
56098
|
/**
|
|
56103
|
-
* Distinct write types come only from set accessors, but union and intersection
|
|
56104
|
-
* properties deriving from set accessors will either pre-compute or defer the
|
|
56105
|
-
*
|
|
56106
|
-
* this, we will assume that any deferred type or transient symbol may have a
|
|
56107
|
-
* `writeType` (or a deferred write type ready to be computed) that should be
|
|
56108
|
-
* used before looking for set accessor declarations.
|
|
56099
|
+
* Distinct write types come only from set accessors, but synthetic union and intersection
|
|
56100
|
+
* properties deriving from set accessors will either pre-compute or defer the union or
|
|
56101
|
+
* intersection of the writeTypes of their constituents.
|
|
56109
56102
|
*/
|
|
56110
56103
|
function getWriteTypeOfSymbol(symbol) {
|
|
56111
56104
|
var checkFlags = ts.getCheckFlags(symbol);
|
|
56112
|
-
if (
|
|
56113
|
-
|
|
56114
|
-
|
|
56115
|
-
|
|
56116
|
-
|
|
56105
|
+
if (symbol.flags & 4 /* Property */) {
|
|
56106
|
+
return checkFlags & 2 /* SyntheticProperty */ ?
|
|
56107
|
+
checkFlags & 65536 /* DeferredType */ ?
|
|
56108
|
+
getWriteTypeOfSymbolWithDeferredType(symbol) || getTypeOfSymbolWithDeferredType(symbol) :
|
|
56109
|
+
symbol.writeType || symbol.type :
|
|
56110
|
+
getTypeOfSymbol(symbol);
|
|
56117
56111
|
}
|
|
56118
|
-
if (symbol.flags & 33554432 /* Transient */) {
|
|
56119
|
-
var writeType = symbol.writeType;
|
|
56120
|
-
if (writeType) {
|
|
56121
|
-
return writeType;
|
|
56122
|
-
}
|
|
56123
|
-
}
|
|
56124
|
-
return getSetAccessorTypeOfSymbol(symbol);
|
|
56125
|
-
}
|
|
56126
|
-
function getSetAccessorTypeOfSymbol(symbol) {
|
|
56127
56112
|
if (symbol.flags & 98304 /* Accessor */) {
|
|
56128
|
-
|
|
56129
|
-
|
|
56130
|
-
|
|
56131
|
-
}
|
|
56113
|
+
return checkFlags & 1 /* Instantiated */ ?
|
|
56114
|
+
getWriteTypeOfInstantiatedSymbol(symbol) :
|
|
56115
|
+
getWriteTypeOfAccessors(symbol);
|
|
56132
56116
|
}
|
|
56133
56117
|
return getTypeOfSymbol(symbol);
|
|
56134
56118
|
}
|
|
@@ -68217,7 +68201,7 @@ var ts;
|
|
|
68217
68201
|
for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {
|
|
68218
68202
|
var targetProp = properties_3[_i];
|
|
68219
68203
|
var sourceProp = getPropertyOfType(source, targetProp.escapedName);
|
|
68220
|
-
if (sourceProp) {
|
|
68204
|
+
if (sourceProp && !ts.some(sourceProp.declarations, hasSkipDirectInferenceFlag)) {
|
|
68221
68205
|
inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
|
|
68222
68206
|
}
|
|
68223
68207
|
}
|
|
@@ -70599,7 +70583,7 @@ var ts;
|
|
|
70599
70583
|
}
|
|
70600
70584
|
}
|
|
70601
70585
|
if (ts.isDeclarationName(location) && ts.isSetAccessor(location.parent) && getAnnotatedAccessorTypeNode(location.parent)) {
|
|
70602
|
-
return
|
|
70586
|
+
return getWriteTypeOfAccessors(location.parent.symbol);
|
|
70603
70587
|
}
|
|
70604
70588
|
// The location isn't a reference to the given symbol, meaning we're being asked
|
|
70605
70589
|
// a hypothetical question of what type the symbol would have if there was a reference
|
|
@@ -70691,7 +70675,7 @@ var ts;
|
|
|
70691
70675
|
// as we want the type of a rest element to be generic when possible.
|
|
70692
70676
|
var contextualType = (ts.isIdentifier(node) || ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) &&
|
|
70693
70677
|
!((ts.isJsxOpeningElement(node.parent) || ts.isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) &&
|
|
70694
|
-
(checkMode && checkMode &
|
|
70678
|
+
(checkMode && checkMode & 64 /* RestBindingElement */ ?
|
|
70695
70679
|
getContextualType(node, 8 /* SkipBindingPatterns */)
|
|
70696
70680
|
: getContextualType(node));
|
|
70697
70681
|
return contextualType && !isGenericType(contextualType);
|
|
@@ -71630,7 +71614,7 @@ var ts;
|
|
|
71630
71614
|
var parent = declaration.parent.parent;
|
|
71631
71615
|
var name = declaration.propertyName || declaration.name;
|
|
71632
71616
|
var parentType = getContextualTypeForVariableLikeDeclaration(parent) ||
|
|
71633
|
-
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 */);
|
|
71634
71618
|
if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name))
|
|
71635
71619
|
return undefined;
|
|
71636
71620
|
if (parent.name.kind === 202 /* ArrayBindingPattern */) {
|
|
@@ -74684,7 +74668,7 @@ var ts;
|
|
|
74684
74668
|
}
|
|
74685
74669
|
for (var i = 0; i < argCount; i++) {
|
|
74686
74670
|
var arg = args[i];
|
|
74687
|
-
if (arg.kind !== 227 /* OmittedExpression */) {
|
|
74671
|
+
if (arg.kind !== 227 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
|
|
74688
74672
|
var paramType = getTypeAtPosition(signature, i);
|
|
74689
74673
|
var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
|
|
74690
74674
|
inferTypes(context.inferences, argType, paramType);
|
|
@@ -75369,7 +75353,7 @@ var ts;
|
|
|
75369
75353
|
}
|
|
75370
75354
|
}
|
|
75371
75355
|
}
|
|
75372
|
-
return getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
|
|
75356
|
+
return getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray, checkMode);
|
|
75373
75357
|
function addImplementationSuccessElaboration(failed, diagnostic) {
|
|
75374
75358
|
var _a, _b;
|
|
75375
75359
|
var oldCandidatesForArgumentError = candidatesForArgumentError;
|
|
@@ -75470,14 +75454,14 @@ var ts;
|
|
|
75470
75454
|
}
|
|
75471
75455
|
}
|
|
75472
75456
|
// No signature was applicable. We have already reported the errors for the invalid signature.
|
|
75473
|
-
function getCandidateForOverloadFailure(node, candidates, args, hasCandidatesOutArray) {
|
|
75457
|
+
function getCandidateForOverloadFailure(node, candidates, args, hasCandidatesOutArray, checkMode) {
|
|
75474
75458
|
ts.Debug.assert(candidates.length > 0); // Else should not have called this.
|
|
75475
75459
|
checkNodeDeferred(node);
|
|
75476
75460
|
// Normally we will combine overloads. Skip this if they have type parameters since that's hard to combine.
|
|
75477
75461
|
// Don't do this if there is a `candidatesOutArray`,
|
|
75478
75462
|
// because then we want the chosen best candidate to be one of the overloads, not a combination.
|
|
75479
75463
|
return hasCandidatesOutArray || candidates.length === 1 || candidates.some(function (c) { return !!c.typeParameters; })
|
|
75480
|
-
? pickLongestCandidateSignature(node, candidates, args)
|
|
75464
|
+
? pickLongestCandidateSignature(node, candidates, args, checkMode)
|
|
75481
75465
|
: createUnionOfSignaturesForOverloadFailure(candidates);
|
|
75482
75466
|
}
|
|
75483
75467
|
function createUnionOfSignaturesForOverloadFailure(candidates) {
|
|
@@ -75525,7 +75509,7 @@ var ts;
|
|
|
75525
75509
|
// This function is currently only used for erroneous overloads, so it's good enough to just use the first source.
|
|
75526
75510
|
return createSymbolWithType(ts.first(sources), type);
|
|
75527
75511
|
}
|
|
75528
|
-
function pickLongestCandidateSignature(node, candidates, args) {
|
|
75512
|
+
function pickLongestCandidateSignature(node, candidates, args, checkMode) {
|
|
75529
75513
|
// Pick the longest signature. This way we can get a contextual type for cases like:
|
|
75530
75514
|
// declare function f(a: { xa: number; xb: number; }, b: number);
|
|
75531
75515
|
// f({ |
|
|
@@ -75541,7 +75525,7 @@ var ts;
|
|
|
75541
75525
|
var typeArgumentNodes = callLikeExpressionMayHaveTypeArguments(node) ? node.typeArguments : undefined;
|
|
75542
75526
|
var instantiated = typeArgumentNodes
|
|
75543
75527
|
? createSignatureInstantiation(candidate, getTypeArgumentsFromNodes(typeArgumentNodes, typeParameters, ts.isInJSFile(node)))
|
|
75544
|
-
: inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args);
|
|
75528
|
+
: inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args, checkMode);
|
|
75545
75529
|
candidates[bestIndex] = instantiated;
|
|
75546
75530
|
return instantiated;
|
|
75547
75531
|
}
|
|
@@ -75555,9 +75539,9 @@ var ts;
|
|
|
75555
75539
|
}
|
|
75556
75540
|
return typeArguments;
|
|
75557
75541
|
}
|
|
75558
|
-
function inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args) {
|
|
75542
|
+
function inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args, checkMode) {
|
|
75559
75543
|
var inferenceContext = createInferenceContext(typeParameters, candidate, /*flags*/ ts.isInJSFile(node) ? 2 /* AnyDefault */ : 0 /* None */);
|
|
75560
|
-
var typeArgumentTypes = inferTypeArguments(node, candidate, args, 4 /* SkipContextSensitive */ | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
75544
|
+
var typeArgumentTypes = inferTypeArguments(node, candidate, args, checkMode | 4 /* SkipContextSensitive */ | 8 /* SkipGenericFunctions */, inferenceContext);
|
|
75561
75545
|
return createSignatureInstantiation(candidate, typeArgumentTypes);
|
|
75562
75546
|
}
|
|
75563
75547
|
function getLongestCandidateIndex(candidates, argsCount) {
|
|
@@ -81623,7 +81607,7 @@ var ts;
|
|
|
81623
81607
|
}
|
|
81624
81608
|
// check private/protected variable access
|
|
81625
81609
|
var parent = node.parent.parent;
|
|
81626
|
-
var parentCheckMode = node.dotDotDotToken ?
|
|
81610
|
+
var parentCheckMode = node.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
|
|
81627
81611
|
var parentType = getTypeForBindingElementParent(parent, parentCheckMode);
|
|
81628
81612
|
var name = node.propertyName || node.name;
|
|
81629
81613
|
if (parentType && !ts.isBindingPattern(name)) {
|
|
@@ -81802,6 +81786,8 @@ var ts;
|
|
|
81802
81786
|
(condExpr.operatorToken.kind === 56 /* BarBarToken */ || condExpr.operatorToken.kind === 55 /* AmpersandAmpersandToken */)
|
|
81803
81787
|
? condExpr.right
|
|
81804
81788
|
: condExpr;
|
|
81789
|
+
if (ts.isModuleExportsAccessExpression(location))
|
|
81790
|
+
return;
|
|
81805
81791
|
var type = checkTruthinessExpression(location);
|
|
81806
81792
|
var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
81807
81793
|
if (getFalsyFlags(type) || isPropertyExpressionCast)
|
|
@@ -116719,6 +116705,13 @@ var ts;
|
|
|
116719
116705
|
return "skip";
|
|
116720
116706
|
}
|
|
116721
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;
|
|
116722
116715
|
case 265 /* ImportEqualsDeclaration */:
|
|
116723
116716
|
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files));
|
|
116724
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": [
|