Properly make inferences from partial source type (#42038)

* Slightly less picky check in typesDefinitelyUnrelated

* Accept new baselines

* Add regression test
This commit is contained in:
Anders Hejlsberg
2020-12-19 07:18:44 -10:00
committed by GitHub
parent 777eb8459b
commit 22bee779d7
8 changed files with 130 additions and 11 deletions

View File

@@ -20045,7 +20045,7 @@ namespace ts {
// Two object types that each have a property that is unmatched in the other are definitely unrelated.
return isTupleType(source) && isTupleType(target) ? tupleTypesDefinitelyUnrelated(source, target) :
!!getUnmatchedProperty(source, target, /*requireOptionalProperties*/ false, /*matchDiscriminantProperties*/ true) &&
!!getUnmatchedProperty(target, source, /*requireOptionalProperties*/ false, /*matchDiscriminantProperties*/ true);
!!getUnmatchedProperty(target, source, /*requireOptionalProperties*/ false, /*matchDiscriminantProperties*/ false);
}
function getTypeFromInference(inference: InferenceInfo) {