Closed
Description
Bug Report
type ApplyFn<Fn extends (item: any) => any, T> =
Fn extends (item: T) => infer R ? R : never
type X = ApplyFn<(x: number) => string, number>
type X is string
type Fn = <T>(item: T) => {foo: T}
type Y = ApplyFn<Fn, string>
type Y is {foo: unknown}
but I have expected {foo: string}
🔎 Search Terms
infer generic function return type
⏯ Playground Link
Playground link with relevant code
Is there any workaround to solve this problem?
Metadata
Metadata
Assignees
Labels
No labels