You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Argument of type '{ foo: <T>() => void; }' is not assignable to parameter of type '(() => void) & { foo: any; }'.
Type '{ foo: <T>() => void; }' is not assignable to type '() => void'.
Type '{ foo: <T>() => void; }' provides no match for the signature '(): void'.
This is an effect of #29847. Previously we'd only make inferences to single naked type parameters in unions and intersections. We now infer to each naked type parameter. That works well for union types, but not for intersection types as this example illustrates. I think we should revert to the previous behavior for intersection types and only infer to multiple naked type parameters in union types.
Activity
ark120202 commentedon Apr 2, 2019
Reproducible in 3.4.1
RyanCavanaugh commentedon Apr 9, 2019
Anders Hejlsberg (@ahejlsberg) contextual typing strikes again? Moving the initializer to its own expression resolves its problem
ahejlsberg commentedon Apr 10, 2019
This is an effect of #29847. Previously we'd only make inferences to single naked type parameters in unions and intersections. We now infer to each naked type parameter. That works well for union types, but not for intersection types as this example illustrates. I think we should revert to the previous behavior for intersection types and only infer to multiple naked type parameters in union types.