File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -13638,10 +13638,11 @@ namespace ts {
13638
13638
if (!inferredType) {
13639
13639
const signature = context.signature;
13640
13640
if (signature) {
13641
- if (inference.contraCandidates) {
13642
- // If we have contravariant inferences we find the best common subtype and treat
13643
- // that as a single covariant candidate.
13644
- inference.candidates = append(inference.candidates, getContravariantInference(inference));
13641
+ if (inference.contraCandidates && (!inference.candidates || inference.candidates.length === 1 && inference.candidates[0].flags & TypeFlags.Never)) {
13642
+ // If we have contravariant inferences, but no covariant inferences or a single
13643
+ // covariant inference of 'never', we find the best common subtype and treat that
13644
+ // as a single covariant candidate.
13645
+ inference.candidates = [getContravariantInference(inference)];
13645
13646
inference.contraCandidates = undefined;
13646
13647
}
13647
13648
if (inference.candidates) {
You can’t perform that action at this time.
0 commit comments