File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -6089,15 +6089,17 @@ namespace ts {
6089
6089
source.flags & TypeFlags.Intersection && target.flags & TypeFlags.Intersection) {
6090
6090
// Source and target are both unions or both intersections. First, find each
6091
6091
// target constituent type that has an identically matching source constituent
6092
- // type, and for each such target constituent type, infer from the type to itself.
6092
+ // type, and for each such target constituent type infer from the type to itself.
6093
+ // When inferring from a type to itself we effectively find all type parameter
6094
+ // occurrences within that type and infer themselves as their type arguments.
6093
6095
let matchingTypes: Type[];
6094
6096
for (const t of (<UnionOrIntersectionType>target).types) {
6095
6097
if (typeIdenticalToSomeType(t, (<UnionOrIntersectionType>source).types)) {
6096
6098
(matchingTypes || (matchingTypes = [])).push(t);
6097
6099
inferFromTypes(t, t);
6098
6100
}
6099
6101
}
6100
- // To improve the quality of inferences, reduce the source and target types by
6102
+ // Next, to improve the quality of inferences, reduce the source and target types by
6101
6103
// removing the identically matched constituents. For example, when inferring from
6102
6104
// 'string | string[]' to 'string | T' we reduce the types to 'string[]' and 'T'.
6103
6105
if (matchingTypes) {
You can’t perform that action at this time.
0 commit comments