Get constraint with this argument of the type parameter for comparisons (#21210)

* Get constraint with this argument of the type parameter for comparisons

* Also instantiate indexed accesses

* Add much simpler test
This commit is contained in:
Wesley Wigham
2018-05-18 18:30:23 -07:00
committed by GitHub
parent 4c22bf786e
commit 02fe840732
10 changed files with 455 additions and 5 deletions

View File

@@ -10954,9 +10954,12 @@ namespace ts {
return result;
}
}
else if (result = isRelatedTo(constraint, target, reportErrors)) {
errorInfo = saveErrorInfo;
return result;
else {
const instantiated = getTypeWithThisArgument(constraint, source);
if (result = isRelatedTo(instantiated, target, reportErrors)) {
errorInfo = saveErrorInfo;
return result;
}
}
}
else if (source.flags & TypeFlags.Index) {