File tree 5 files changed +11
-13
lines changed
5 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -18090,7 +18090,7 @@ var ts;
18090
18090
inferFromTypes(source, t);
18091
18091
}
18092
18092
}
18093
- if (target.flags & 16384 && typeParameterCount === 1) {
18093
+ if (typeParameterCount === 1) {
18094
18094
inferiority++;
18095
18095
inferFromTypes(source, typeParameter);
18096
18096
inferiority--;
Original file line number Diff line number Diff line change @@ -18854,7 +18854,7 @@ var ts;
18854
18854
inferFromTypes(source, t);
18855
18855
}
18856
18856
}
18857
- if (target.flags & 16384 && typeParameterCount === 1) {
18857
+ if (typeParameterCount === 1) {
18858
18858
inferiority++;
18859
18859
inferFromTypes(source, typeParameter);
18860
18860
inferiority--;
Original file line number Diff line number Diff line change @@ -18854,7 +18854,7 @@ var ts;
18854
18854
inferFromTypes(source, t);
18855
18855
}
18856
18856
}
18857
- if (target.flags & 16384 && typeParameterCount === 1) {
18857
+ if (typeParameterCount === 1) {
18858
18858
inferiority++;
18859
18859
inferFromTypes(source, typeParameter);
18860
18860
inferiority--;
Original file line number Diff line number Diff line change @@ -21958,11 +21958,10 @@ var ts;
21958
21958
inferFromTypes(source, t);
21959
21959
}
21960
21960
}
21961
- // Next, if target is a union type containing a single naked type parameter, make a
21962
- // secondary inference to that type parameter. We don't do this for intersection types
21963
- // because in a target type like Foo & T we don't know how which parts of the source type
21964
- // should be matched by Foo and which should be inferred to T.
21965
- if (target.flags & 16384 /* Union */ && typeParameterCount === 1) {
21961
+ // Next, if target containings a single naked type parameter, make a secondary inference to that type
21962
+ // parameter. This gives meaningful results for union types in co-variant positions and intersection
21963
+ // types in contra-variant positions (such as callback parameters).
21964
+ if (typeParameterCount === 1) {
21966
21965
inferiority++;
21967
21966
inferFromTypes(source, typeParameter);
21968
21967
inferiority--;
Original file line number Diff line number Diff line change @@ -21958,11 +21958,10 @@ var ts;
21958
21958
inferFromTypes(source, t);
21959
21959
}
21960
21960
}
21961
- // Next, if target is a union type containing a single naked type parameter, make a
21962
- // secondary inference to that type parameter. We don't do this for intersection types
21963
- // because in a target type like Foo & T we don't know how which parts of the source type
21964
- // should be matched by Foo and which should be inferred to T.
21965
- if (target.flags & 16384 /* Union */ && typeParameterCount === 1) {
21961
+ // Next, if target containings a single naked type parameter, make a secondary inference to that type
21962
+ // parameter. This gives meaningful results for union types in co-variant positions and intersection
21963
+ // types in contra-variant positions (such as callback parameters).
21964
+ if (typeParameterCount === 1) {
21966
21965
inferiority++;
21967
21966
inferFromTypes(source, typeParameter);
21968
21967
inferiority--;
You can’t perform that action at this time.
0 commit comments