mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Amend signature relation for when two signatures both return predicate types.
Consider signatures related if they are type predicates where the predicate's type in the source is a subtype of the predicate's type in the target.
This commit is contained in:
@@ -5200,7 +5200,7 @@ namespace ts {
|
||||
let hasDifferentParameterIndex = source.typePredicate.parameterIndex !== target.typePredicate.parameterIndex;
|
||||
let hasDifferentTypes: boolean;
|
||||
if (hasDifferentParameterIndex ||
|
||||
(hasDifferentTypes = !isTypeIdenticalTo(source.typePredicate.type, target.typePredicate.type))) {
|
||||
(hasDifferentTypes = !isTypeSubtypeOf(source.typePredicate.type, target.typePredicate.type))) {
|
||||
|
||||
if (reportErrors) {
|
||||
let sourceParamText = source.typePredicate.parameterName;
|
||||
@@ -5234,7 +5234,9 @@ namespace ts {
|
||||
}
|
||||
|
||||
let targetReturnType = getReturnTypeOfSignature(target);
|
||||
if (targetReturnType === voidType) return result;
|
||||
if (targetReturnType === voidType) {
|
||||
return result;
|
||||
}
|
||||
let sourceReturnType = getReturnTypeOfSignature(source);
|
||||
|
||||
return result & isRelatedTo(sourceReturnType, targetReturnType, reportErrors);
|
||||
|
||||
Reference in New Issue
Block a user