diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 344ad57de33..106d6391a91 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -11416,7 +11416,7 @@ namespace ts { return; } } - else if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (source).target === (target).target) { + if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (source).target === (target).target) { // If source and target are references to the same generic type, infer from type arguments const sourceTypes = (source).typeArguments || emptyArray; const targetTypes = (target).typeArguments || emptyArray; @@ -11446,6 +11446,15 @@ namespace ts { inferFromTypes((source).objectType, (target).objectType); inferFromTypes((source).indexType, (target).indexType); } + else if (source.flags & TypeFlags.Conditional && target.flags & TypeFlags.Conditional) { + inferFromTypes((source).conditionType, (target).conditionType); + inferFromTypes((source).trueType, (target).trueType); + inferFromTypes((source).falseType, (target).falseType); + } + else if (source.flags & TypeFlags.Extends && target.flags & TypeFlags.Extends) { + inferFromTypes((source).checkType, (target).checkType); + inferFromTypes((source).extendsType, (target).extendsType); + } else if (target.flags & TypeFlags.UnionOrIntersection) { const targetTypes = (target).types; let typeVariableCount = 0;