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
{{ message }}
Repository navigation
InferProps is unknown for a defineHandler loader with middleware #489
Same kind of issue as #478. InferProps gives unknown when defineHandler gets middleware:
exportconstloader=defineHandler(auth,async(c)=>{constbook=awaitfindBook(c.req.param('id'));if(!book)returnc.notFound();return{ book };});typeProps=InferProps<typeofloader>;// expected: { book: Book }// actual: unknown
The middleware overloads return TypedHandler without type arguments, so __output is unknown. The runtime already unwraps the return value as props, so only the type is wrong.
Returning TypedHandler<{}, Exclude<Awaited<R>, Response>> from the middleware overloads too, like the single-handler one, fixes it. Fix and type tests: ashunar0@61f7401
Activity
cpojer commentedon Oct 19, 2026
Please send a PR!
fix(handler): infer output type for defineHandler with middleware (vo…