typescript 4.6.1-rc → 4.6.2-insiders.20220225
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +252 -238
- package/lib/tsserver.js +316 -312
- package/lib/tsserverlibrary.js +316 -312
- package/lib/typescript.js +316 -312
- package/lib/typescriptServices.js +316 -312
- package/lib/typingsInstaller.js +315 -311
- package/package.json +2 -2
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.6";
|
|
72
|
-
ts.version = "".concat(ts.versionMajorMinor, ".
|
|
72
|
+
ts.version = "".concat(ts.versionMajorMinor, ".2-insiders.20220225");
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -5295,6 +5295,8 @@ var ts;
|
|
|
5295
5295
|
Property_0_cannot_have_an_initializer_because_it_is_marked_abstract: diag(1267, ts.DiagnosticCategory.Error, "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267", "Property '{0}' cannot have an initializer because it is marked abstract."),
|
|
5296
5296
|
An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type: diag(1268, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_must_be_string_number_symbol_or_a_template_literal_type_1268", "An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type."),
|
|
5297
5297
|
Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided: diag(1269, ts.DiagnosticCategory.Error, "Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided_1269", "Cannot use 'export import' on a type or type-only namespace when the '--isolatedModules' flag is provided."),
|
|
5298
|
+
Decorator_function_return_type_0_is_not_assignable_to_type_1: diag(1270, ts.DiagnosticCategory.Error, "Decorator_function_return_type_0_is_not_assignable_to_type_1_1270", "Decorator function return type '{0}' is not assignable to type '{1}'."),
|
|
5299
|
+
Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any: diag(1271, ts.DiagnosticCategory.Error, "Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any_1271", "Decorator function return type is '{0}' but is expected to be 'void' or 'any'."),
|
|
5298
5300
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
5299
5301
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
|
5300
5302
|
Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern: diag(1312, ts.DiagnosticCategory.Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),
|
|
@@ -52669,11 +52671,11 @@ var ts;
|
|
|
52669
52671
|
var overflow = false;
|
|
52670
52672
|
var overrideNextErrorInfo = 0;
|
|
52671
52673
|
var lastSkippedInfo;
|
|
52672
|
-
var incompatibleStack
|
|
52674
|
+
var incompatibleStack;
|
|
52673
52675
|
var inPropertyCheck = false;
|
|
52674
52676
|
ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
|
|
52675
52677
|
var result = isRelatedTo(source, target, 3, !!errorNode, headMessage);
|
|
52676
|
-
if (incompatibleStack
|
|
52678
|
+
if (incompatibleStack) {
|
|
52677
52679
|
reportIncompatibleStack();
|
|
52678
52680
|
}
|
|
52679
52681
|
if (overflow) {
|
|
@@ -52728,19 +52730,19 @@ var ts;
|
|
|
52728
52730
|
return {
|
|
52729
52731
|
errorInfo: errorInfo,
|
|
52730
52732
|
lastSkippedInfo: lastSkippedInfo,
|
|
52731
|
-
incompatibleStack: incompatibleStack.slice(),
|
|
52733
|
+
incompatibleStack: incompatibleStack === null || incompatibleStack === void 0 ? void 0 : incompatibleStack.slice(),
|
|
52732
52734
|
overrideNextErrorInfo: overrideNextErrorInfo,
|
|
52733
|
-
relatedInfo:
|
|
52735
|
+
relatedInfo: relatedInfo === null || relatedInfo === void 0 ? void 0 : relatedInfo.slice(),
|
|
52734
52736
|
};
|
|
52735
52737
|
}
|
|
52736
52738
|
function reportIncompatibleError(message, arg0, arg1, arg2, arg3) {
|
|
52737
52739
|
overrideNextErrorInfo++;
|
|
52738
52740
|
lastSkippedInfo = undefined;
|
|
52739
|
-
incompatibleStack.push([message, arg0, arg1, arg2, arg3]);
|
|
52741
|
+
(incompatibleStack || (incompatibleStack = [])).push([message, arg0, arg1, arg2, arg3]);
|
|
52740
52742
|
}
|
|
52741
52743
|
function reportIncompatibleStack() {
|
|
52742
|
-
var stack = incompatibleStack;
|
|
52743
|
-
incompatibleStack =
|
|
52744
|
+
var stack = incompatibleStack || [];
|
|
52745
|
+
incompatibleStack = undefined;
|
|
52744
52746
|
var info = lastSkippedInfo;
|
|
52745
52747
|
lastSkippedInfo = undefined;
|
|
52746
52748
|
if (stack.length === 1) {
|
|
@@ -52834,7 +52836,7 @@ var ts;
|
|
|
52834
52836
|
}
|
|
52835
52837
|
function reportError(message, arg0, arg1, arg2, arg3) {
|
|
52836
52838
|
ts.Debug.assert(!!errorNode);
|
|
52837
|
-
if (incompatibleStack
|
|
52839
|
+
if (incompatibleStack)
|
|
52838
52840
|
reportIncompatibleStack();
|
|
52839
52841
|
if (message.elidedInCompatabilityPyramid)
|
|
52840
52842
|
return;
|
|
@@ -52850,7 +52852,7 @@ var ts;
|
|
|
52850
52852
|
}
|
|
52851
52853
|
}
|
|
52852
52854
|
function reportRelationError(message, source, target) {
|
|
52853
|
-
if (incompatibleStack
|
|
52855
|
+
if (incompatibleStack)
|
|
52854
52856
|
reportIncompatibleStack();
|
|
52855
52857
|
var _a = getTypeNamesForErrorDisplay(source, target), sourceType = _a[0], targetType = _a[1];
|
|
52856
52858
|
var generalizedSource = source;
|
|
@@ -52941,7 +52943,9 @@ var ts;
|
|
|
52941
52943
|
if (isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors ? reportError : undefined)) {
|
|
52942
52944
|
return -1;
|
|
52943
52945
|
}
|
|
52944
|
-
|
|
52946
|
+
if (reportErrors) {
|
|
52947
|
+
reportErrorResults(originalSource, originalTarget, originalSource, originalTarget, headMessage);
|
|
52948
|
+
}
|
|
52945
52949
|
return 0;
|
|
52946
52950
|
}
|
|
52947
52951
|
var source = getNormalizedType(originalSource, false);
|
|
@@ -52949,127 +52953,121 @@ var ts;
|
|
|
52949
52953
|
if (source === target)
|
|
52950
52954
|
return -1;
|
|
52951
52955
|
if (relation === identityRelation) {
|
|
52952
|
-
|
|
52956
|
+
if (source.flags !== target.flags)
|
|
52957
|
+
return 0;
|
|
52958
|
+
if (source.flags & 67358815)
|
|
52959
|
+
return -1;
|
|
52960
|
+
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
52961
|
+
return recursiveTypeRelatedTo(source, target, false, 0, recursionFlags);
|
|
52953
52962
|
}
|
|
52954
52963
|
if (source.flags & 262144 && getConstraintOfType(source) === target) {
|
|
52955
52964
|
return -1;
|
|
52956
52965
|
}
|
|
52957
|
-
if (
|
|
52958
|
-
|
|
52959
|
-
var
|
|
52960
|
-
|
|
52961
|
-
|
|
52966
|
+
if (source.flags & 470302716 && target.flags & 1048576) {
|
|
52967
|
+
var types = target.types;
|
|
52968
|
+
var candidate = types.length === 2 && types[0].flags & 98304 ? types[1] :
|
|
52969
|
+
types.length === 3 && types[0].flags & 98304 && types[1].flags & 98304 ? types[2] :
|
|
52970
|
+
undefined;
|
|
52971
|
+
if (candidate && !(candidate.flags & 98304)) {
|
|
52972
|
+
target = getNormalizedType(candidate, true);
|
|
52973
|
+
if (source === target)
|
|
52974
|
+
return -1;
|
|
52962
52975
|
}
|
|
52963
|
-
if (source === nullStrippedTarget)
|
|
52964
|
-
return -1;
|
|
52965
52976
|
}
|
|
52966
52977
|
if (relation === comparableRelation && !(target.flags & 131072) && isSimpleTypeRelatedTo(target, source, relation) ||
|
|
52967
52978
|
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
|
|
52968
52979
|
return -1;
|
|
52969
|
-
|
|
52970
|
-
|
|
52971
|
-
|
|
52972
|
-
|
|
52980
|
+
if (source.flags & 469499904 || target.flags & 469499904) {
|
|
52981
|
+
var isPerformingExcessPropertyChecks = !(intersectionState & 2) && (isObjectLiteralType(source) && ts.getObjectFlags(source) & 16384);
|
|
52982
|
+
if (isPerformingExcessPropertyChecks) {
|
|
52983
|
+
if (hasExcessProperties(source, target, reportErrors)) {
|
|
52984
|
+
if (reportErrors) {
|
|
52985
|
+
reportRelationError(headMessage, source, originalTarget.aliasSymbol ? originalTarget : target);
|
|
52986
|
+
}
|
|
52987
|
+
return 0;
|
|
52988
|
+
}
|
|
52989
|
+
}
|
|
52990
|
+
var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2) &&
|
|
52991
|
+
source.flags & (131068 | 524288 | 2097152) && source !== globalObjectType &&
|
|
52992
|
+
target.flags & (524288 | 2097152) && isWeakType(target) &&
|
|
52993
|
+
(getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source));
|
|
52994
|
+
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 2048);
|
|
52995
|
+
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source, target, isComparingJsxAttributes)) {
|
|
52973
52996
|
if (reportErrors) {
|
|
52974
|
-
|
|
52997
|
+
var sourceString = typeToString(originalSource.aliasSymbol ? originalSource : source);
|
|
52998
|
+
var targetString = typeToString(originalTarget.aliasSymbol ? originalTarget : target);
|
|
52999
|
+
var calls = getSignaturesOfType(source, 0);
|
|
53000
|
+
var constructs = getSignaturesOfType(source, 1);
|
|
53001
|
+
if (calls.length > 0 && isRelatedTo(getReturnTypeOfSignature(calls[0]), target, 1, false) ||
|
|
53002
|
+
constructs.length > 0 && isRelatedTo(getReturnTypeOfSignature(constructs[0]), target, 1, false)) {
|
|
53003
|
+
reportError(ts.Diagnostics.Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it, sourceString, targetString);
|
|
53004
|
+
}
|
|
53005
|
+
else {
|
|
53006
|
+
reportError(ts.Diagnostics.Type_0_has_no_properties_in_common_with_type_1, sourceString, targetString);
|
|
53007
|
+
}
|
|
52975
53008
|
}
|
|
52976
53009
|
return 0;
|
|
52977
53010
|
}
|
|
52978
|
-
|
|
52979
|
-
|
|
52980
|
-
|
|
52981
|
-
|
|
52982
|
-
|
|
52983
|
-
|
|
52984
|
-
if (
|
|
52985
|
-
|
|
52986
|
-
|
|
52987
|
-
|
|
52988
|
-
|
|
52989
|
-
if (calls.length > 0 && isRelatedTo(getReturnTypeOfSignature(calls[0]), target, 1, false) ||
|
|
52990
|
-
constructs.length > 0 && isRelatedTo(getReturnTypeOfSignature(constructs[0]), target, 1, false)) {
|
|
52991
|
-
reportError(ts.Diagnostics.Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it, sourceString, targetString);
|
|
52992
|
-
}
|
|
52993
|
-
else {
|
|
52994
|
-
reportError(ts.Diagnostics.Type_0_has_no_properties_in_common_with_type_1, sourceString, targetString);
|
|
52995
|
-
}
|
|
53011
|
+
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
53012
|
+
var skipCaching = source.flags & 1048576 && source.types.length < 4 && !(target.flags & 1048576) ||
|
|
53013
|
+
target.flags & 1048576 && target.types.length < 4 && !(source.flags & 469499904);
|
|
53014
|
+
var result_7 = skipCaching ?
|
|
53015
|
+
unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) :
|
|
53016
|
+
recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags);
|
|
53017
|
+
if (result_7 && !inPropertyCheck && (target.flags & 2097152 && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
|
|
53018
|
+
isNonGenericObjectType(target) && !isArrayType(target) && !isTupleType(target) && source.flags & 2097152 && getApparentType(source).flags & 3670016 && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 524288); }))) {
|
|
53019
|
+
inPropertyCheck = true;
|
|
53020
|
+
result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4, recursionFlags);
|
|
53021
|
+
inPropertyCheck = false;
|
|
52996
53022
|
}
|
|
52997
|
-
|
|
52998
|
-
|
|
52999
|
-
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
53000
|
-
var result = 0;
|
|
53001
|
-
var saveErrorInfo = captureErrorCalculationState();
|
|
53002
|
-
if ((source.flags & 1048576 || target.flags & 1048576) && getConstituentCount(source) * getConstituentCount(target) < 4) {
|
|
53003
|
-
result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState | 8);
|
|
53004
|
-
}
|
|
53005
|
-
else if (source.flags & 3145728 || target.flags & 3145728) {
|
|
53006
|
-
result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState | 8, recursionFlags);
|
|
53007
|
-
}
|
|
53008
|
-
if (!result && !(source.flags & 1048576) && (source.flags & (469499904) || target.flags & 469499904)) {
|
|
53009
|
-
if (result = recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags)) {
|
|
53010
|
-
resetErrorInfo(saveErrorInfo);
|
|
53023
|
+
if (result_7) {
|
|
53024
|
+
return result_7;
|
|
53011
53025
|
}
|
|
53012
53026
|
}
|
|
53013
|
-
if (
|
|
53014
|
-
|
|
53015
|
-
|
|
53016
|
-
|
|
53017
|
-
|
|
53018
|
-
|
|
53019
|
-
|
|
53020
|
-
|
|
53027
|
+
if (reportErrors) {
|
|
53028
|
+
reportErrorResults(originalSource, originalTarget, source, target, headMessage);
|
|
53029
|
+
}
|
|
53030
|
+
return 0;
|
|
53031
|
+
}
|
|
53032
|
+
function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
|
|
53033
|
+
var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
|
|
53034
|
+
var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
|
|
53035
|
+
source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
|
|
53036
|
+
target = (originalTarget.aliasSymbol || targetHasBase) ? originalTarget : target;
|
|
53037
|
+
var maybeSuppress = overrideNextErrorInfo > 0;
|
|
53038
|
+
if (maybeSuppress) {
|
|
53039
|
+
overrideNextErrorInfo--;
|
|
53040
|
+
}
|
|
53041
|
+
if (source.flags & 524288 && target.flags & 524288) {
|
|
53042
|
+
var currentError = errorInfo;
|
|
53043
|
+
tryElaborateArrayLikeErrors(source, target, true);
|
|
53044
|
+
if (errorInfo !== currentError) {
|
|
53045
|
+
maybeSuppress = !!errorInfo;
|
|
53046
|
+
}
|
|
53047
|
+
}
|
|
53048
|
+
if (source.flags & 524288 && target.flags & 131068) {
|
|
53049
|
+
tryElaborateErrorsForPrimitivesAndObjects(source, target);
|
|
53050
|
+
}
|
|
53051
|
+
else if (source.symbol && source.flags & 524288 && globalObjectType === source) {
|
|
53052
|
+
reportError(ts.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
|
|
53053
|
+
}
|
|
53054
|
+
else if (ts.getObjectFlags(source) & 2048 && target.flags & 2097152) {
|
|
53055
|
+
var targetTypes = target.types;
|
|
53056
|
+
var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, errorNode);
|
|
53057
|
+
var intrinsicClassAttributes = getJsxType(JsxNames.IntrinsicClassAttributes, errorNode);
|
|
53058
|
+
if (!isErrorType(intrinsicAttributes) && !isErrorType(intrinsicClassAttributes) &&
|
|
53059
|
+
(ts.contains(targetTypes, intrinsicAttributes) || ts.contains(targetTypes, intrinsicClassAttributes))) {
|
|
53060
|
+
return;
|
|
53021
53061
|
}
|
|
53022
53062
|
}
|
|
53023
|
-
|
|
53024
|
-
|
|
53025
|
-
inPropertyCheck = true;
|
|
53026
|
-
result &= recursiveTypeRelatedTo(source, target, reportErrors, 4, recursionFlags);
|
|
53027
|
-
inPropertyCheck = false;
|
|
53063
|
+
else {
|
|
53064
|
+
errorInfo = elaborateNeverIntersection(errorInfo, originalTarget);
|
|
53028
53065
|
}
|
|
53029
|
-
|
|
53030
|
-
|
|
53031
|
-
|
|
53032
|
-
if (!result && reportErrors) {
|
|
53033
|
-
var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
|
|
53034
|
-
var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
|
|
53035
|
-
source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
|
|
53036
|
-
target = (originalTarget.aliasSymbol || targetHasBase) ? originalTarget : target;
|
|
53037
|
-
var maybeSuppress = overrideNextErrorInfo > 0;
|
|
53038
|
-
if (maybeSuppress) {
|
|
53039
|
-
overrideNextErrorInfo--;
|
|
53040
|
-
}
|
|
53041
|
-
if (source.flags & 524288 && target.flags & 524288) {
|
|
53042
|
-
var currentError = errorInfo;
|
|
53043
|
-
tryElaborateArrayLikeErrors(source, target, reportErrors);
|
|
53044
|
-
if (errorInfo !== currentError) {
|
|
53045
|
-
maybeSuppress = !!errorInfo;
|
|
53046
|
-
}
|
|
53047
|
-
}
|
|
53048
|
-
if (source.flags & 524288 && target.flags & 131068) {
|
|
53049
|
-
tryElaborateErrorsForPrimitivesAndObjects(source, target);
|
|
53050
|
-
}
|
|
53051
|
-
else if (source.symbol && source.flags & 524288 && globalObjectType === source) {
|
|
53052
|
-
reportError(ts.Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
|
|
53053
|
-
}
|
|
53054
|
-
else if (isComparingJsxAttributes && target.flags & 2097152) {
|
|
53055
|
-
var targetTypes = target.types;
|
|
53056
|
-
var intrinsicAttributes = getJsxType(JsxNames.IntrinsicAttributes, errorNode);
|
|
53057
|
-
var intrinsicClassAttributes = getJsxType(JsxNames.IntrinsicClassAttributes, errorNode);
|
|
53058
|
-
if (!isErrorType(intrinsicAttributes) && !isErrorType(intrinsicClassAttributes) &&
|
|
53059
|
-
(ts.contains(targetTypes, intrinsicAttributes) || ts.contains(targetTypes, intrinsicClassAttributes))) {
|
|
53060
|
-
return result;
|
|
53061
|
-
}
|
|
53062
|
-
}
|
|
53063
|
-
else {
|
|
53064
|
-
errorInfo = elaborateNeverIntersection(errorInfo, originalTarget);
|
|
53065
|
-
}
|
|
53066
|
-
if (!headMessage && maybeSuppress) {
|
|
53067
|
-
lastSkippedInfo = [source, target];
|
|
53068
|
-
return result;
|
|
53069
|
-
}
|
|
53070
|
-
reportRelationError(headMessage, source, target);
|
|
53071
|
-
}
|
|
53066
|
+
if (!headMessage && maybeSuppress) {
|
|
53067
|
+
lastSkippedInfo = [source, target];
|
|
53068
|
+
return;
|
|
53072
53069
|
}
|
|
53070
|
+
reportRelationError(headMessage, source, target);
|
|
53073
53071
|
}
|
|
53074
53072
|
function traceUnionsOrIntersectionsTooLarge(source, target) {
|
|
53075
53073
|
if (!ts.tracing) {
|
|
@@ -53095,21 +53093,6 @@ var ts;
|
|
|
53095
53093
|
}
|
|
53096
53094
|
}
|
|
53097
53095
|
}
|
|
53098
|
-
function isIdenticalTo(source, target, recursionFlags) {
|
|
53099
|
-
if (source.flags !== target.flags)
|
|
53100
|
-
return 0;
|
|
53101
|
-
if (source.flags & 67358815)
|
|
53102
|
-
return -1;
|
|
53103
|
-
traceUnionsOrIntersectionsTooLarge(source, target);
|
|
53104
|
-
if (source.flags & 3145728) {
|
|
53105
|
-
var result_7 = eachTypeRelatedToSomeType(source, target);
|
|
53106
|
-
if (result_7) {
|
|
53107
|
-
result_7 &= eachTypeRelatedToSomeType(target, source);
|
|
53108
|
-
}
|
|
53109
|
-
return result_7;
|
|
53110
|
-
}
|
|
53111
|
-
return recursiveTypeRelatedTo(source, target, false, 0, recursionFlags);
|
|
53112
|
-
}
|
|
53113
53096
|
function getTypeOfPropertyInTypes(types, name) {
|
|
53114
53097
|
var appendPropType = function (propTypes, type) {
|
|
53115
53098
|
var _a;
|
|
@@ -53198,6 +53181,29 @@ var ts;
|
|
|
53198
53181
|
function shouldCheckAsExcessProperty(prop, container) {
|
|
53199
53182
|
return prop.valueDeclaration && container.valueDeclaration && prop.valueDeclaration.parent === container.valueDeclaration;
|
|
53200
53183
|
}
|
|
53184
|
+
function unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) {
|
|
53185
|
+
if (source.flags & 1048576) {
|
|
53186
|
+
return relation === comparableRelation ?
|
|
53187
|
+
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068), intersectionState) :
|
|
53188
|
+
eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068), intersectionState);
|
|
53189
|
+
}
|
|
53190
|
+
if (target.flags & 1048576) {
|
|
53191
|
+
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068) && !(target.flags & 131068));
|
|
53192
|
+
}
|
|
53193
|
+
if (target.flags & 2097152) {
|
|
53194
|
+
return typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors, 2);
|
|
53195
|
+
}
|
|
53196
|
+
if (relation === comparableRelation && target.flags & 131068) {
|
|
53197
|
+
var constraints = ts.sameMap(source.types, getBaseConstraintOrType);
|
|
53198
|
+
if (constraints !== source.types) {
|
|
53199
|
+
source = getIntersectionType(constraints);
|
|
53200
|
+
if (!(source.flags & 2097152)) {
|
|
53201
|
+
return isRelatedTo(source, target, 1, false);
|
|
53202
|
+
}
|
|
53203
|
+
}
|
|
53204
|
+
}
|
|
53205
|
+
return someTypeRelatedToType(source, target, false, 1);
|
|
53206
|
+
}
|
|
53201
53207
|
function eachTypeRelatedToSomeType(source, target) {
|
|
53202
53208
|
var result = -1;
|
|
53203
53209
|
var sourceTypes = source.types;
|
|
@@ -53234,7 +53240,9 @@ var ts;
|
|
|
53234
53240
|
}
|
|
53235
53241
|
if (reportErrors) {
|
|
53236
53242
|
var bestMatchingType = getBestMatchingType(source, target, isRelatedTo);
|
|
53237
|
-
|
|
53243
|
+
if (bestMatchingType) {
|
|
53244
|
+
isRelatedTo(source, bestMatchingType, 2, true);
|
|
53245
|
+
}
|
|
53238
53246
|
}
|
|
53239
53247
|
return 0;
|
|
53240
53248
|
}
|
|
@@ -53342,7 +53350,7 @@ var ts;
|
|
|
53342
53350
|
if (overflow) {
|
|
53343
53351
|
return 0;
|
|
53344
53352
|
}
|
|
53345
|
-
var keyIntersectionState = intersectionState | (inPropertyCheck ?
|
|
53353
|
+
var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 : 0);
|
|
53346
53354
|
var id = getRelationKey(source, target, keyIntersectionState, relation, false);
|
|
53347
53355
|
var entry = relation.get(id);
|
|
53348
53356
|
if (entry !== undefined) {
|
|
@@ -53403,6 +53411,7 @@ var ts;
|
|
|
53403
53411
|
return originalHandler(onlyUnreliable);
|
|
53404
53412
|
};
|
|
53405
53413
|
}
|
|
53414
|
+
var result;
|
|
53406
53415
|
if (expandingFlags === 3) {
|
|
53407
53416
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.instant("checkTypes", "recursiveTypeRelatedTo_DepthLimit", {
|
|
53408
53417
|
sourceId: source.id,
|
|
@@ -53412,8 +53421,13 @@ var ts;
|
|
|
53412
53421
|
depth: sourceDepth,
|
|
53413
53422
|
targetDepth: targetDepth
|
|
53414
53423
|
});
|
|
53424
|
+
result = 3;
|
|
53425
|
+
}
|
|
53426
|
+
else {
|
|
53427
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "structuredTypeRelatedTo", { sourceId: source.id, targetId: target.id });
|
|
53428
|
+
result = structuredTypeRelatedTo(source, target, reportErrors, intersectionState);
|
|
53429
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
53415
53430
|
}
|
|
53416
|
-
var result = expandingFlags !== 3 ? structuredTypeRelatedTo(source, target, reportErrors, intersectionState) : 3;
|
|
53417
53431
|
if (outofbandVarianceMarkerHandler) {
|
|
53418
53432
|
outofbandVarianceMarkerHandler = originalHandler;
|
|
53419
53433
|
}
|
|
@@ -53441,74 +53455,73 @@ var ts;
|
|
|
53441
53455
|
return result;
|
|
53442
53456
|
}
|
|
53443
53457
|
function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
|
|
53444
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes", "structuredTypeRelatedTo", { sourceId: source.id, targetId: target.id });
|
|
53445
|
-
var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState);
|
|
53446
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
53447
|
-
return result;
|
|
53448
|
-
}
|
|
53449
|
-
function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState) {
|
|
53450
53458
|
if (intersectionState & 4) {
|
|
53451
53459
|
return propertiesRelatedTo(source, target, reportErrors, undefined, 0);
|
|
53452
53460
|
}
|
|
53453
|
-
|
|
53454
|
-
|
|
53455
|
-
|
|
53456
|
-
|
|
53457
|
-
|
|
53458
|
-
|
|
53459
|
-
|
|
53460
|
-
|
|
53461
|
-
|
|
53462
|
-
|
|
53463
|
-
|
|
53464
|
-
}
|
|
53465
|
-
if (relation === comparableRelation && target.flags & 131068) {
|
|
53466
|
-
var constraints = ts.sameMap(source.types, getBaseConstraintOrType);
|
|
53467
|
-
if (constraints !== source.types) {
|
|
53468
|
-
source = getIntersectionType(constraints);
|
|
53469
|
-
if (!(source.flags & 2097152)) {
|
|
53470
|
-
return isRelatedTo(source, target, 1, false);
|
|
53471
|
-
}
|
|
53461
|
+
var result;
|
|
53462
|
+
var originalErrorInfo;
|
|
53463
|
+
var varianceCheckFailed = false;
|
|
53464
|
+
var saveErrorInfo = captureErrorCalculationState();
|
|
53465
|
+
var sourceFlags = source.flags;
|
|
53466
|
+
var targetFlags = target.flags;
|
|
53467
|
+
if (relation === identityRelation) {
|
|
53468
|
+
if (sourceFlags & 3145728) {
|
|
53469
|
+
var result_8 = eachTypeRelatedToSomeType(source, target);
|
|
53470
|
+
if (result_8) {
|
|
53471
|
+
result_8 &= eachTypeRelatedToSomeType(target, source);
|
|
53472
53472
|
}
|
|
53473
|
+
return result_8;
|
|
53473
53474
|
}
|
|
53474
|
-
|
|
53475
|
-
}
|
|
53476
|
-
var flags = source.flags & target.flags;
|
|
53477
|
-
if (relation === identityRelation && !(flags & 524288)) {
|
|
53478
|
-
if (flags & 4194304) {
|
|
53475
|
+
if (sourceFlags & 4194304) {
|
|
53479
53476
|
return isRelatedTo(source.type, target.type, 3, false);
|
|
53480
53477
|
}
|
|
53481
|
-
|
|
53482
|
-
|
|
53483
|
-
|
|
53484
|
-
|
|
53485
|
-
return result_8;
|
|
53478
|
+
if (sourceFlags & 8388608) {
|
|
53479
|
+
if (result = isRelatedTo(source.objectType, target.objectType, 3, false)) {
|
|
53480
|
+
if (result &= isRelatedTo(source.indexType, target.indexType, 3, false)) {
|
|
53481
|
+
return result;
|
|
53486
53482
|
}
|
|
53487
53483
|
}
|
|
53488
53484
|
}
|
|
53489
|
-
if (
|
|
53485
|
+
if (sourceFlags & 16777216) {
|
|
53490
53486
|
if (source.root.isDistributive === target.root.isDistributive) {
|
|
53491
|
-
if (
|
|
53492
|
-
if (
|
|
53493
|
-
if (
|
|
53494
|
-
if (
|
|
53495
|
-
return
|
|
53487
|
+
if (result = isRelatedTo(source.checkType, target.checkType, 3, false)) {
|
|
53488
|
+
if (result &= isRelatedTo(source.extendsType, target.extendsType, 3, false)) {
|
|
53489
|
+
if (result &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), 3, false)) {
|
|
53490
|
+
if (result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), 3, false)) {
|
|
53491
|
+
return result;
|
|
53496
53492
|
}
|
|
53497
53493
|
}
|
|
53498
53494
|
}
|
|
53499
53495
|
}
|
|
53500
53496
|
}
|
|
53501
53497
|
}
|
|
53502
|
-
if (
|
|
53498
|
+
if (sourceFlags & 33554432) {
|
|
53503
53499
|
return isRelatedTo(source.substitute, target.substitute, 3, false);
|
|
53504
53500
|
}
|
|
53505
|
-
|
|
53501
|
+
if (!(sourceFlags & 524288)) {
|
|
53502
|
+
return 0;
|
|
53503
|
+
}
|
|
53506
53504
|
}
|
|
53507
|
-
|
|
53508
|
-
|
|
53509
|
-
|
|
53510
|
-
|
|
53511
|
-
|
|
53505
|
+
else if (sourceFlags & 3145728 || targetFlags & 3145728) {
|
|
53506
|
+
if (result = unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState)) {
|
|
53507
|
+
return result;
|
|
53508
|
+
}
|
|
53509
|
+
if (source.flags & 2097152 || source.flags & 262144 && target.flags & 1048576) {
|
|
53510
|
+
var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576));
|
|
53511
|
+
if (constraint && everyType(constraint, function (c) { return c !== source; })) {
|
|
53512
|
+
if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
|
|
53513
|
+
resetErrorInfo(saveErrorInfo);
|
|
53514
|
+
return result;
|
|
53515
|
+
}
|
|
53516
|
+
}
|
|
53517
|
+
}
|
|
53518
|
+
if (!(sourceFlags & 465829888 ||
|
|
53519
|
+
sourceFlags & 524288 && targetFlags & 1048576 ||
|
|
53520
|
+
sourceFlags & 2097152 && targetFlags & (524288 | 1048576 | 465829888))) {
|
|
53521
|
+
return 0;
|
|
53522
|
+
}
|
|
53523
|
+
}
|
|
53524
|
+
if (sourceFlags & (524288 | 16777216) && source.aliasSymbol &&
|
|
53512
53525
|
source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol &&
|
|
53513
53526
|
!(source.aliasTypeArgumentsContainsMarker || target.aliasTypeArgumentsContainsMarker)) {
|
|
53514
53527
|
var variances = getAliasVariances(source.aliasSymbol);
|
|
@@ -53524,7 +53537,7 @@ var ts;
|
|
|
53524
53537
|
isSingleElementGenericTupleType(target) && (target.target.readonly || isMutableArrayOrTuple(getBaseConstraintOfType(source) || source)) && (result = isRelatedTo(source, getTypeArguments(target)[0], 2))) {
|
|
53525
53538
|
return result;
|
|
53526
53539
|
}
|
|
53527
|
-
if (
|
|
53540
|
+
if (targetFlags & 262144) {
|
|
53528
53541
|
if (ts.getObjectFlags(source) & 32 && !source.declaration.nameType && isRelatedTo(getIndexType(target), getConstraintTypeFromMappedType(source), 3)) {
|
|
53529
53542
|
if (!(getMappedTypeModifiers(source) & 4)) {
|
|
53530
53543
|
var templateType = getTemplateTypeFromMappedType(source);
|
|
@@ -53535,9 +53548,9 @@ var ts;
|
|
|
53535
53548
|
}
|
|
53536
53549
|
}
|
|
53537
53550
|
}
|
|
53538
|
-
else if (
|
|
53551
|
+
else if (targetFlags & 4194304) {
|
|
53539
53552
|
var targetType_1 = target.type;
|
|
53540
|
-
if (
|
|
53553
|
+
if (sourceFlags & 4194304) {
|
|
53541
53554
|
if (result = isRelatedTo(targetType_1, source.type, 3, false)) {
|
|
53542
53555
|
return result;
|
|
53543
53556
|
}
|
|
@@ -53573,8 +53586,8 @@ var ts;
|
|
|
53573
53586
|
}
|
|
53574
53587
|
}
|
|
53575
53588
|
}
|
|
53576
|
-
else if (
|
|
53577
|
-
if (
|
|
53589
|
+
else if (targetFlags & 8388608) {
|
|
53590
|
+
if (sourceFlags & 8388608) {
|
|
53578
53591
|
if (result = isRelatedTo(source.objectType, target.objectType, 3, reportErrors)) {
|
|
53579
53592
|
result &= isRelatedTo(source.indexType, target.indexType, 3, reportErrors);
|
|
53580
53593
|
}
|
|
@@ -53653,7 +53666,7 @@ var ts;
|
|
|
53653
53666
|
}
|
|
53654
53667
|
}
|
|
53655
53668
|
}
|
|
53656
|
-
else if (
|
|
53669
|
+
else if (targetFlags & 16777216) {
|
|
53657
53670
|
if (isDeeplyNestedType(target, targetStack, targetDepth, 10)) {
|
|
53658
53671
|
resetErrorInfo(saveErrorInfo);
|
|
53659
53672
|
return 3;
|
|
@@ -53671,8 +53684,8 @@ var ts;
|
|
|
53671
53684
|
}
|
|
53672
53685
|
}
|
|
53673
53686
|
}
|
|
53674
|
-
else if (
|
|
53675
|
-
if (
|
|
53687
|
+
else if (targetFlags & 134217728) {
|
|
53688
|
+
if (sourceFlags & 134217728) {
|
|
53676
53689
|
if (relation === comparableRelation) {
|
|
53677
53690
|
return templateLiteralTypesDefinitelyUnrelated(source, target) ? 0 : -1;
|
|
53678
53691
|
}
|
|
@@ -53682,10 +53695,10 @@ var ts;
|
|
|
53682
53695
|
return -1;
|
|
53683
53696
|
}
|
|
53684
53697
|
}
|
|
53685
|
-
if (
|
|
53686
|
-
if (!(
|
|
53698
|
+
if (sourceFlags & 8650752) {
|
|
53699
|
+
if (!(sourceFlags & 8388608 && targetFlags & 8388608)) {
|
|
53687
53700
|
var constraint = getConstraintOfType(source);
|
|
53688
|
-
if (!constraint || (
|
|
53701
|
+
if (!constraint || (sourceFlags & 262144 && constraint.flags & 1)) {
|
|
53689
53702
|
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864), 3)) {
|
|
53690
53703
|
resetErrorInfo(saveErrorInfo);
|
|
53691
53704
|
return result;
|
|
@@ -53695,7 +53708,7 @@ var ts;
|
|
|
53695
53708
|
resetErrorInfo(saveErrorInfo);
|
|
53696
53709
|
return result;
|
|
53697
53710
|
}
|
|
53698
|
-
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && !(
|
|
53711
|
+
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1, reportErrors && !(targetFlags & sourceFlags & 262144), undefined, intersectionState)) {
|
|
53699
53712
|
resetErrorInfo(saveErrorInfo);
|
|
53700
53713
|
return result;
|
|
53701
53714
|
}
|
|
@@ -53710,14 +53723,14 @@ var ts;
|
|
|
53710
53723
|
}
|
|
53711
53724
|
}
|
|
53712
53725
|
}
|
|
53713
|
-
else if (
|
|
53726
|
+
else if (sourceFlags & 4194304) {
|
|
53714
53727
|
if (result = isRelatedTo(keyofConstraintType, target, 1, reportErrors)) {
|
|
53715
53728
|
resetErrorInfo(saveErrorInfo);
|
|
53716
53729
|
return result;
|
|
53717
53730
|
}
|
|
53718
53731
|
}
|
|
53719
|
-
else if (
|
|
53720
|
-
if (!(
|
|
53732
|
+
else if (sourceFlags & 134217728 && !(targetFlags & 524288)) {
|
|
53733
|
+
if (!(targetFlags & 134217728)) {
|
|
53721
53734
|
var constraint = getBaseConstraintOfType(source);
|
|
53722
53735
|
if (constraint && constraint !== source && (result = isRelatedTo(constraint, target, 1, reportErrors))) {
|
|
53723
53736
|
resetErrorInfo(saveErrorInfo);
|
|
@@ -53725,8 +53738,8 @@ var ts;
|
|
|
53725
53738
|
}
|
|
53726
53739
|
}
|
|
53727
53740
|
}
|
|
53728
|
-
else if (
|
|
53729
|
-
if (
|
|
53741
|
+
else if (sourceFlags & 268435456) {
|
|
53742
|
+
if (targetFlags & 268435456 && source.symbol === target.symbol) {
|
|
53730
53743
|
if (result = isRelatedTo(source.type, target.type, 3, reportErrors)) {
|
|
53731
53744
|
resetErrorInfo(saveErrorInfo);
|
|
53732
53745
|
return result;
|
|
@@ -53740,12 +53753,12 @@ var ts;
|
|
|
53740
53753
|
}
|
|
53741
53754
|
}
|
|
53742
53755
|
}
|
|
53743
|
-
else if (
|
|
53756
|
+
else if (sourceFlags & 16777216) {
|
|
53744
53757
|
if (isDeeplyNestedType(source, sourceStack, sourceDepth, 10)) {
|
|
53745
53758
|
resetErrorInfo(saveErrorInfo);
|
|
53746
53759
|
return 3;
|
|
53747
53760
|
}
|
|
53748
|
-
if (
|
|
53761
|
+
if (targetFlags & 16777216) {
|
|
53749
53762
|
var sourceParams = source.root.inferTypeParameters;
|
|
53750
53763
|
var sourceExtends = source.extendsType;
|
|
53751
53764
|
var mapper = void 0;
|
|
@@ -53796,9 +53809,10 @@ var ts;
|
|
|
53796
53809
|
}
|
|
53797
53810
|
return 0;
|
|
53798
53811
|
}
|
|
53799
|
-
var sourceIsPrimitive = !!(
|
|
53812
|
+
var sourceIsPrimitive = !!(sourceFlags & 131068);
|
|
53800
53813
|
if (relation !== identityRelation) {
|
|
53801
53814
|
source = getApparentType(source);
|
|
53815
|
+
sourceFlags = source.flags;
|
|
53802
53816
|
}
|
|
53803
53817
|
else if (isGenericMappedType(source)) {
|
|
53804
53818
|
return 0;
|
|
@@ -53825,7 +53839,7 @@ var ts;
|
|
|
53825
53839
|
else if ((relation === subtypeRelation || relation === strictSubtypeRelation) && isEmptyObjectType(target) && ts.getObjectFlags(target) & 16384 && !isEmptyObjectType(source)) {
|
|
53826
53840
|
return 0;
|
|
53827
53841
|
}
|
|
53828
|
-
if (
|
|
53842
|
+
if (sourceFlags & (524288 | 2097152) && targetFlags & 524288) {
|
|
53829
53843
|
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo.errorInfo && !sourceIsPrimitive;
|
|
53830
53844
|
result = propertiesRelatedTo(source, target, reportStructuralErrors, undefined, intersectionState);
|
|
53831
53845
|
if (result) {
|
|
@@ -53844,7 +53858,7 @@ var ts;
|
|
|
53844
53858
|
return result;
|
|
53845
53859
|
}
|
|
53846
53860
|
}
|
|
53847
|
-
if (
|
|
53861
|
+
if (sourceFlags & (524288 | 2097152) && targetFlags & 1048576) {
|
|
53848
53862
|
var objectOnlyTarget = extractTypesOfKind(target, 524288 | 2097152 | 33554432);
|
|
53849
53863
|
if (objectOnlyTarget.flags & 1048576) {
|
|
53850
53864
|
var result_9 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
|
|
@@ -54290,7 +54304,6 @@ var ts;
|
|
|
54290
54304
|
}
|
|
54291
54305
|
}
|
|
54292
54306
|
var result = -1;
|
|
54293
|
-
var saveErrorInfo = captureErrorCalculationState();
|
|
54294
54307
|
var incompatibleReporter = kind === 1 ? reportIncompatibleConstructSignatureReturn : reportIncompatibleCallSignatureReturn;
|
|
54295
54308
|
var sourceObjectFlags = ts.getObjectFlags(source);
|
|
54296
54309
|
var targetObjectFlags = ts.getObjectFlags(target);
|
|
@@ -54322,6 +54335,7 @@ var ts;
|
|
|
54322
54335
|
else {
|
|
54323
54336
|
outer: for (var _i = 0, targetSignatures_1 = targetSignatures; _i < targetSignatures_1.length; _i++) {
|
|
54324
54337
|
var t = targetSignatures_1[_i];
|
|
54338
|
+
var saveErrorInfo = captureErrorCalculationState();
|
|
54325
54339
|
var shouldElaborateErrors = reportErrors;
|
|
54326
54340
|
for (var _c = 0, sourceSignatures_1 = sourceSignatures; _c < sourceSignatures_1.length; _c++) {
|
|
54327
54341
|
var s = sourceSignatures_1[_c];
|
|
@@ -57110,9 +57124,6 @@ var ts;
|
|
|
57110
57124
|
getUnionType(ts.map(type.types, mapper), 1, aliasSymbol, aliasTypeArguments) :
|
|
57111
57125
|
mapType(type, mapper);
|
|
57112
57126
|
}
|
|
57113
|
-
function getConstituentCount(type) {
|
|
57114
|
-
return type.flags & 1048576 ? type.types.length : 1;
|
|
57115
|
-
}
|
|
57116
57127
|
function extractTypesOfKind(type, kind) {
|
|
57117
57128
|
return filterType(type, function (t) { return (t.flags & kind) !== 0; });
|
|
57118
57129
|
}
|
|
@@ -58457,7 +58468,7 @@ var ts;
|
|
|
58457
58468
|
var substituteConstraints = !(checkMode && checkMode & 2) &&
|
|
58458
58469
|
someType(type, isGenericTypeWithUnionConstraint) &&
|
|
58459
58470
|
(isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
58460
|
-
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888
|
|
58471
|
+
return substituteConstraints ? mapType(type, function (t) { return t.flags & 465829888 ? getBaseConstraintOrType(t) : t; }) : type;
|
|
58461
58472
|
}
|
|
58462
58473
|
function isExportOrExportExpression(location) {
|
|
58463
58474
|
return !!ts.findAncestor(location, function (n) {
|
|
@@ -58503,6 +58514,9 @@ var ts;
|
|
|
58503
58514
|
if (parentType && parentType.flags & 1048576 && !(parent.kind === 163 && isSymbolAssigned(symbol))) {
|
|
58504
58515
|
var pattern = declaration.parent;
|
|
58505
58516
|
var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, undefined, location.flowNode);
|
|
58517
|
+
if (narrowedType.flags & 131072) {
|
|
58518
|
+
return neverType;
|
|
58519
|
+
}
|
|
58506
58520
|
return getBindingElementTypeFromParentType(declaration, narrowedType);
|
|
58507
58521
|
}
|
|
58508
58522
|
}
|
|
@@ -63621,19 +63635,20 @@ var ts;
|
|
|
63621
63635
|
if (links.type === unknownType) {
|
|
63622
63636
|
links.type = getTypeFromBindingPattern(declaration.name);
|
|
63623
63637
|
}
|
|
63624
|
-
assignBindingElementTypes(declaration.name);
|
|
63638
|
+
assignBindingElementTypes(declaration.name, links.type);
|
|
63625
63639
|
}
|
|
63626
63640
|
}
|
|
63627
63641
|
}
|
|
63628
|
-
function assignBindingElementTypes(pattern) {
|
|
63642
|
+
function assignBindingElementTypes(pattern, parentType) {
|
|
63629
63643
|
for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
|
|
63630
63644
|
var element = _a[_i];
|
|
63631
63645
|
if (!ts.isOmittedExpression(element)) {
|
|
63646
|
+
var type = getBindingElementTypeFromParentType(element, parentType);
|
|
63632
63647
|
if (element.name.kind === 79) {
|
|
63633
|
-
getSymbolLinks(getSymbolOfNode(element)).type =
|
|
63648
|
+
getSymbolLinks(getSymbolOfNode(element)).type = type;
|
|
63634
63649
|
}
|
|
63635
63650
|
else {
|
|
63636
|
-
assignBindingElementTypes(element.name);
|
|
63651
|
+
assignBindingElementTypes(element.name, type);
|
|
63637
63652
|
}
|
|
63638
63653
|
}
|
|
63639
63654
|
}
|
|
@@ -66828,26 +66843,24 @@ var ts;
|
|
|
66828
66843
|
if (returnType.flags & 1) {
|
|
66829
66844
|
return;
|
|
66830
66845
|
}
|
|
66846
|
+
var headMessage;
|
|
66831
66847
|
var expectedReturnType;
|
|
66832
|
-
var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
|
|
66833
|
-
var errorInfo;
|
|
66834
66848
|
switch (node.parent.kind) {
|
|
66835
66849
|
case 256:
|
|
66850
|
+
headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1;
|
|
66836
66851
|
var classSymbol = getSymbolOfNode(node.parent);
|
|
66837
66852
|
var classConstructorType = getTypeOfSymbol(classSymbol);
|
|
66838
66853
|
expectedReturnType = getUnionType([classConstructorType, voidType]);
|
|
66839
66854
|
break;
|
|
66840
|
-
case 163:
|
|
66841
|
-
expectedReturnType = voidType;
|
|
66842
|
-
errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);
|
|
66843
|
-
break;
|
|
66844
66855
|
case 166:
|
|
66856
|
+
case 163:
|
|
66857
|
+
headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any;
|
|
66845
66858
|
expectedReturnType = voidType;
|
|
66846
|
-
errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);
|
|
66847
66859
|
break;
|
|
66848
66860
|
case 168:
|
|
66849
66861
|
case 171:
|
|
66850
66862
|
case 172:
|
|
66863
|
+
headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1;
|
|
66851
66864
|
var methodType = getTypeOfNode(node.parent);
|
|
66852
66865
|
var descriptorType = createTypedPropertyDescriptorType(methodType);
|
|
66853
66866
|
expectedReturnType = getUnionType([descriptorType, voidType]);
|
|
@@ -66855,7 +66868,7 @@ var ts;
|
|
|
66855
66868
|
default:
|
|
66856
66869
|
return ts.Debug.fail();
|
|
66857
66870
|
}
|
|
66858
|
-
checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage
|
|
66871
|
+
checkTypeAssignableTo(returnType, expectedReturnType, node, headMessage);
|
|
66859
66872
|
}
|
|
66860
66873
|
function markTypeNodeAsReferenced(node) {
|
|
66861
66874
|
markEntityNameOrEntityExpressionAsReference(node && ts.getEntityNameFromTypeNode(node));
|
|
@@ -68716,9 +68729,9 @@ var ts;
|
|
|
68716
68729
|
var containsArguments = containsArgumentsReference(node);
|
|
68717
68730
|
if (containsArguments) {
|
|
68718
68731
|
var lastJSDocParam = ts.lastOrUndefined(jsdocParameters);
|
|
68719
|
-
if (lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
|
|
68732
|
+
if (isJs && lastJSDocParam && ts.isIdentifier(lastJSDocParam.name) && lastJSDocParam.typeExpression &&
|
|
68720
68733
|
lastJSDocParam.typeExpression.type && !parameters.has(lastJSDocParam.name.escapedText) && !isArrayType(getTypeFromTypeNode(lastJSDocParam.typeExpression.type))) {
|
|
68721
|
-
|
|
68734
|
+
error(lastJSDocParam.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(lastJSDocParam.name));
|
|
68722
68735
|
}
|
|
68723
68736
|
}
|
|
68724
68737
|
else {
|
|
@@ -68728,7 +68741,9 @@ var ts;
|
|
|
68728
68741
|
return;
|
|
68729
68742
|
}
|
|
68730
68743
|
if (ts.isQualifiedName(name)) {
|
|
68731
|
-
|
|
68744
|
+
if (isJs) {
|
|
68745
|
+
error(name, ts.Diagnostics.Qualified_name_0_is_not_allowed_without_a_leading_param_object_1, ts.entityNameToString(name), ts.entityNameToString(name.left));
|
|
68746
|
+
}
|
|
68732
68747
|
}
|
|
68733
68748
|
else {
|
|
68734
68749
|
errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
|
|
@@ -73424,25 +73439,24 @@ var ts;
|
|
|
73424
73439
|
}
|
|
73425
73440
|
function findMostOverlappyType(source, unionTarget) {
|
|
73426
73441
|
var bestMatch;
|
|
73427
|
-
|
|
73428
|
-
|
|
73429
|
-
var
|
|
73430
|
-
|
|
73431
|
-
|
|
73432
|
-
|
|
73433
|
-
|
|
73434
|
-
|
|
73435
|
-
|
|
73436
|
-
|
|
73437
|
-
|
|
73438
|
-
|
|
73439
|
-
|
|
73442
|
+
if (!(source.flags & (131068 | 406847488))) {
|
|
73443
|
+
var matchingCount = 0;
|
|
73444
|
+
for (var _i = 0, _a = unionTarget.types; _i < _a.length; _i++) {
|
|
73445
|
+
var target = _a[_i];
|
|
73446
|
+
if (!(target.flags & (131068 | 406847488))) {
|
|
73447
|
+
var overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
|
|
73448
|
+
if (overlap.flags & 4194304) {
|
|
73449
|
+
return target;
|
|
73450
|
+
}
|
|
73451
|
+
else if (isUnitType(overlap) || overlap.flags & 1048576) {
|
|
73452
|
+
var len = overlap.flags & 1048576 ? ts.countWhere(overlap.types, isUnitType) : 1;
|
|
73453
|
+
if (len >= matchingCount) {
|
|
73454
|
+
bestMatch = target;
|
|
73455
|
+
matchingCount = len;
|
|
73456
|
+
}
|
|
73457
|
+
}
|
|
73440
73458
|
}
|
|
73441
73459
|
}
|
|
73442
|
-
else if (isUnitType(overlap) && 1 >= matchingCount) {
|
|
73443
|
-
bestMatch = target;
|
|
73444
|
-
matchingCount = 1;
|
|
73445
|
-
}
|
|
73446
73460
|
}
|
|
73447
73461
|
return bestMatch;
|
|
73448
73462
|
}
|
|
@@ -96212,7 +96226,7 @@ var ts;
|
|
|
96212
96226
|
return resolvedRef;
|
|
96213
96227
|
}
|
|
96214
96228
|
function verifyCompilerOptions() {
|
|
96215
|
-
var isNightly = ts.stringContains(ts.version, "-dev")
|
|
96229
|
+
var isNightly = ts.stringContains(ts.version, "-dev");
|
|
96216
96230
|
if (!isNightly) {
|
|
96217
96231
|
if (ts.getEmitModuleKind(options) === ts.ModuleKind.Node12) {
|
|
96218
96232
|
createOptionValueDiagnostic("module", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "node12");
|