HonoH
Hono4mo ago
Gauts

Can not get the Types in route fn

Hi,
I am trying to learn this framework.
But I am having some difficulty here, and I think you can help me.

This way I can get the Types from the valid() fn.
users.get("/author", authGuard, zValidator("query", schema), (c) => {
    const data = c.req.valid("query");  <--- Types Available
});


But like this I can't, why?
const fn = async (c) => {
    const data = c.req.valid("query"); <--- Types Unavailable
}; 
users.get("/author", authGuard, zValidator("query", schema), fn;
Was this page helpful?