Skip to content

Commit 08d8f97

Browse files
committed
Add comment
1 parent c3ef035 commit 08d8f97

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
@@ -20857,7 +20857,9 @@ namespace ts {
2085720857
// Inferences made from return types have lower priority than all other inferences.
2085820858
inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, InferencePriority.ReturnType);
2085920859
// Create a type mapper for instantiating generic contextual types using the inferences made
20860-
// from the return type.
20860+
// from the return type. We need a separate inference pass here because (a) instantiation of
20861+
// the source type uses the outer context's return mapper (which excludes inferences made from
20862+
// outer arguments), and (b) we don't want any further inferences going into this context.
2086120863
const returnContext = createInferenceContext(signature.typeParameters!, signature, context.flags);
2086220864
const returnSourceType = instantiateType(contextualType, outerContext && outerContext.returnMapper);
2086320865
inferTypes(returnContext.inferences, returnSourceType, inferenceTargetType);

0 commit comments

Comments
 (0)