Open
Description
Bug Report
π Search Terms
Nested inference, function call
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about nested function call inference
β― Playground Link
With libraries
Minimal reproduction
π» Code
type NoInfer<T> = [T][T extends any ? 0 : never]
type ErrorFn = (error: unknown) => void
declare const genericFn: <T>(args: {
parser: (p: unknown, errorFn: ErrorFn) => T
handler: (data: { body: NoInfer<T> }) => unknown
}) => T
declare const createParser: <T>(arg: T) => (p: unknown, errorFn: ErrorFn) => NoInfer<T>;
genericFn({
parser: createParser(1 as const),
handler: ({ body: _ }) => {
// ^?
// unknown, should be 1
}
})
π Actual behavior
Handler body is not inferred, becomes default of unknown.
π Expected behavior
Handler body should be inferred from parser, and be 1
.