Skip to content

Commit 6901a98

Browse files
committed
Adding a bit more text to comments
1 parent ae9d93b commit 6901a98

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6089,15 +6089,17 @@ namespace ts {
60896089
source.flags & TypeFlags.Intersection && target.flags & TypeFlags.Intersection) {
60906090
// Source and target are both unions or both intersections. First, find each
60916091
// 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.
60936095
let matchingTypes: Type[];
60946096
for (const t of (<UnionOrIntersectionType>target).types) {
60956097
if (typeIdenticalToSomeType(t, (<UnionOrIntersectionType>source).types)) {
60966098
(matchingTypes || (matchingTypes = [])).push(t);
60976099
inferFromTypes(t, t);
60986100
}
60996101
}
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
61016103
// removing the identically matched constituents. For example, when inferring from
61026104
// 'string | string[]' to 'string | T' we reduce the types to 'string[]' and 'T'.
61036105
if (matchingTypes) {

0 commit comments

Comments
 (0)