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
This is the behavior in every version I've tested including 4.7.4 up to 5.0.0-dev.20230215
(Before 4.7.4, the issue occurred regardless of whether JSX syntax was used)
interfaceProps<T>{a: (x: string)=>T;b: (arg: T)=>void;}functionFoo<T>(props: Props<T>){return<div/>;}// Works fine, T is inferred as 'number' through the return value of 'a'<Fooa={()=>10}b={(arg)=>{arg.toString();}}/>;// If 'a' takes any parameters, inference stops working and T becomes 'unknown'<Fooa={(x)=>10}b={(arg)=>{arg.toString();}}// ERROR: 'arg' is of type 'unknown'/>;// (since 4.7.4) Works fine if the object literal syntax is used instead<Foo{...{a: (x)=>10,b: (arg)=>{arg.toString();},}}/>;
🙁 Actual behavior
Foo<T>fails to inferT from the return value of a if the function provided for a accepts any parameters, and the JSX attribute syntax is used.
🙂 Expected behavior
Foo<T> should infer T from the return value of a regardless of whether its signature has parameters, and regardless of whether the JSX attribute syntax is used or not.
The text was updated successfully, but these errors were encountered:
Bug Report
🔎 Search Terms
🕗 Version & Regression Information
This is the behavior in every version I've tested including
4.7.4
up to5.0.0-dev.20230215
(Before
4.7.4
, the issue occurred regardless of whether JSX syntax was used)⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Foo<T>
fails to inferT
from the return value ofa
if the function provided fora
accepts any parameters, and the JSX attribute syntax is used.🙂 Expected behavior
Foo<T>
should inferT
from the return value ofa
regardless of whether its signature has parameters, and regardless of whether the JSX attribute syntax is used or not.The text was updated successfully, but these errors were encountered: