mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 20:51:43 -06: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:
parent
b7c399cbbc
commit
61594d893e
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user