Skip to content

Commit 5bb8d2a

Browse files
committed
Properly handle contravariant inferences in inferReverseMappedType
1 parent ebbb3a4 commit 5bb8d2a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/compiler/checker.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11029,7 +11029,9 @@ namespace ts {
1102911029
const templateType = getTemplateTypeFromMappedType(target);
1103011030
const inference = createInferenceInfo(typeParameter);
1103111031
inferTypes([inference], sourceType, templateType);
11032-
return inference.candidates ? getUnionType(inference.candidates, UnionReduction.Subtype) : emptyObjectType;
11032+
return inference.candidates ? getUnionType(inference.candidates, UnionReduction.Subtype) :
11033+
inference.contraCandidates ? getCommonSubtype(inference.contraCandidates) :
11034+
emptyObjectType;
1103311035
}
1103411036

1103511037
function getUnmatchedProperty(source: Type, target: Type, requireOptionalProperties: boolean) {

0 commit comments

Comments
 (0)