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
interfaceProps<Data,Render>{data: Data;extract: (data: Data)=>Render;renderItem: (item: Render)=>null;}functionfn<Data,Render>(_props: Props<Data,Render>){returnnull;}fn({data: [1,2,3,4],renderItem: i=>{// This is unknownreturnnull;},extract: (res)=>res[0],});// ----- below is working -------interfaceProps2<Data,Render>{extract: (data: Data)=>Render;renderItem: (item: Render)=>null;}functionfn2<Data,Render>(_props: Props2<Data,Render>){returnnull;}fn2({renderItem: i=>{// This is numberreturnnull;},extract: ()=>1,});
🙁 Actual behavior
in function fn1, parameter -> renderItem(i), " i " is inferred as unknown
🙂 Expected behavior
in function fn1, parameter -> renderItem(i), " i " should be inferred as number, as in fn2
The text was updated successfully, but these errors were encountered:
mfleungac
changed the title
Not able to infer parameter type in a function thats inside a function param
Not able to infer parameter type in a function (Due to: input parameter order)
Apr 15, 2022
Bug Report
🔎 Search Terms
infer function unknown
🕗 Version & Regression Information
Checked #48538, not sure if related.
Tested with nightly build v4.7.0-dev.20220415, which should have fixed #48538, still not bugged.
⏯ Playground Link
[Playground link with relevant code
](https://www.typescriptlang.org/play?ts=4.7.0-dev.20220415#code/JYOwLgpgTgZghgYwgAgApQPYAcDOAeAETjDgBpkAlCEAE2gD5kBvAKGWRuLgC5kiSA3G2QQAHmCiIwvABScSvfnACUyALyMqtaEPZRqdKAElIAW1nAzvLYdUbkIAK4AbZ0IC+LFjEcgEYYAwQZEgcMEIuckoDBmQZAH0sTFxedGx8JXIbBlVWPQgwRyhgp1cPL1CwGTyOLl4AbQBGUgAmUgBmUgAWAF1SYX1tYytkYHVGJmQAeinkABUAC2AcUZXfAGsQDAB3EGF8wuKHFzdhd372MQkpWX0cO0Y7+oAGPpZ3ZSEvGeQAWn--sgAEYQZw7VbIbYYKDrUAAcz+AIBXlAkFgiBQaVwLQiJCyMSgE2EV0k-lk8h4fC4D2iQ10yEGhhMEHMcUsLOsBJppVOnm8vn8gWClRxmXY2UJcUSyRwqRlositMM9FyAwKRRKJ3KLBF1TVQ2ZrLG9kmP0WywhTlMIKg+wZ6qOPPp52J4lJ0jiNOa70+XiAA)](https://www.typescriptlang.org/play?ts=4.7.0-dev.20220415&ssl=37&ssc=1&pln=1&pc=1#code/JYOwLgpgTgZghgYwgAgApQPYAcDOAeAETjDgBpkAlCEAE2gD5kBvAKGWRuLgC5kiSA3G2QQAHmCiIwvABScSvfnACUyALyMqtaEPZRqdKAElIAW1nAzvLYdUbkIAK4AbZ0IC+LFjEcgEYYAwQZBgQQi5ySgMGZBkAfSxMXF50bHwlchsGVVY9CDBHKGCnVw8vUJlcji5eAG0ARlIAJlIAZlIAFgBdUmF9bWMrZGB1RiZkAHoJ5AAVAAtgHGGl3wBrEAwAdxBhPIKihxc3YXde9jEJKVl9HDtGG9qABh6Wd2UhLynkAFpf3+QAEYQZxbZbITYYKCrUAAcx+fz+XlAkFgiBQqVwTXCJEy0SgY2EF0k-lk8h4fC4dyiA10yH6hhMEHMsUsTOseKpJWOnm8vn8gWCoSxGXYWXxsQSSRwKSlwoi1MM9ByfXyhWKRzK3hATUqKoGjOZI3s4y+80WYKcpiBUF2dNVBy5tNOhPExOksSpjVe7y8QA)
💻 Code
🙁 Actual behavior
in function fn1, parameter -> renderItem(i), " i " is inferred as unknown
🙂 Expected behavior
in function fn1, parameter -> renderItem(i), " i " should be inferred as number, as in fn2
The text was updated successfully, but these errors were encountered: