Specifically test for 'void' to permit implementations to return more than what was guaranteed.

This commit is contained in:
Daniel Rosenwasser 2015-12-11 15:08:30 -08:00
parent 069fada0ce
commit 9b507b7512

View file

@ -4987,7 +4987,8 @@ namespace ts {
const sourceReturnType = getReturnTypeOfSignature(erasedSource);
const targetReturnType = getReturnTypeOfSignature(erasedTarget);
if (checkTypeRelatedTo(sourceReturnType, targetReturnType, assignableRelation, /*errorNode*/ undefined)
if (targetReturnType === voidType
|| checkTypeRelatedTo(sourceReturnType, targetReturnType, assignableRelation, /*errorNode*/ undefined)
|| checkTypeRelatedTo(targetReturnType, sourceReturnType, assignableRelation, /*errorNode*/ undefined)) {
const anyReturningSource = cloneSignature(erasedSource);
const anyReturningTarget = cloneSignature(erasedTarget);