Closed as not planned
Description
π Search Terms
automatically infer
π Version & Regression Information
- This is NOT a crash
β― Playground Link
No response
π» Code
There is no issue
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')
}))
}

Function custom
correctly inffered
There is issue
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')
})
})
}

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