### π Search Terms automatically infer ### π Version & Regression Information - This is NOT a crash ### β― Playground Link _No response_ ### π» Code ## There is no issue ```ts function test<T>(t1: T, t2: T): never { throw Error('todo'); } function custom<T>(f: (data: T) => T): T { throw Error('todo'); } async function main() { test(10, custom((data) => { throw Error('todo') })) } ``` <img width="487" alt="no-issue" src="https://github.com/microsoft/TypeScript/assets/95295094/625c11cf-7f6f-46f7-ba59-8ebc44d17022"> Function `custom` correctly inffered ## There is issue ```ts function test<T>(options: { t1: T, t2: T }): never { throw Error('todo'); } function custom<T>(f: (data: T) => T): T { throw Error('todo'); } async function main() { test({ t1: 10, t2: custom((data) => { throw Error('todo') }) }) } ``` <img width="467" alt="issue" src="https://github.com/microsoft/TypeScript/assets/95295094/d02c01ea-f5b4-49fd-b203-aa5793c2eb8f"> Function `custom` incorrectly inffered, the `T` should be `number` instead of `unknown` ### π Actual behavior Function `custom` incorrectly infered, the `T` infered as `unknown` ### π Expected behavior Function `custom` correctly infered, the `T` infered as `number` ### Additional information about the issue _No response_
Activity
RyanCavanaugh commentedon Mar 25, 2024
#47599
typescript-bot commentedon Mar 28, 2024
This issue has been marked as "Duplicate" and has seen no recent activity. It has been automatically closed for house-keeping purposes.