Merge pull request #28718 from Microsoft/fixDefinitelyAssignableRelation

Fix definitely assignable relation
This commit is contained in:
Anders Hejlsberg
2018-11-28 17:38:51 -08:00
committed by GitHub
6 changed files with 97 additions and 1 deletions

View File

@@ -12259,7 +12259,8 @@ namespace ts {
else if (target.flags & TypeFlags.IndexedAccess) {
// A type S is related to a type T[K], where T and K aren't both type variables, if S is related to C,
// where C is the base constraint of T[K]
if (relation !== identityRelation && !(isGenericObjectType((<IndexedAccessType>target).objectType) && isGenericIndexType((<IndexedAccessType>target).indexType))) {
if (relation !== identityRelation && relation !== definitelyAssignableRelation &&
!(isGenericObjectType((<IndexedAccessType>target).objectType) && isGenericIndexType((<IndexedAccessType>target).indexType))) {
const constraint = getBaseConstraintOfType(target);
if (constraint && constraint !== target) {
if (result = isRelatedTo(source, constraint, reportErrors)) {