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
What runtime/platform is your app running on? (with version if possible)
Node
What steps can reproduce the bug?
When using middleware created with factory.createMiddleware() in .use, the client's type inference stops working.
Previously, an issue was reported regarding createMiddleware() at #3122, which seems to have been fixed. However, it appears a similar issue is occurring with factory.createMiddleware().
import{Hono,typeEnv}from'hono';import{hc}from'hono/client';import{createFactory,createMiddleware}from'hono/factory';constfactory=createFactory<Env>();constmiddleware=factory.createMiddleware(async(_,next)=>{console.log('Middleware');awaitnext();});// There will be no type errors when creating middleware with createMiddleware()// const middleware = createMiddleware(async (_, next) => {// console.log('Middleware');// await next();// });constapp=newHono().use('*',middleware).get('/users',(c)=>c.text('GET /users'));constclient=hc<typeofapp>('');console.log(client.users.$get());// This should typecheck
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered:
What version of Hono are you using?
4.6.17
What runtime/platform is your app running on? (with version if possible)
Node
What steps can reproduce the bug?
When using middleware created with
factory.createMiddleware()
in.use
, the client's type inference stops working.Previously, an issue was reported regarding
createMiddleware()
at #3122, which seems to have been fixed. However, it appears a similar issue is occurring withfactory.createMiddleware()
.Below is a code example for reproduction:
TypeScript playground
What is the expected behavior?
No response
What do you see instead?
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: