@@ -3,7 +3,7 @@ import { expectTypeOf } from 'vitest'
33import { hc } from '../../client'
44import type { ClientRequest } from '../../client/types'
55import { Hono } from '../../index'
6- import type { ExtractSchema , ToSchema , TypedResponse } from '../../types'
6+ import type { Env , ExtractSchema , MiddlewareHandler , ToSchema , TypedResponse } from '../../types'
77import type { ContentfulStatusCode } from '../../utils/http-status'
88import type { Equal , Expect } from '../../utils/types'
99import { validator } from '../../validator'
@@ -63,6 +63,14 @@ describe('createMiddleware', () => {
6363 }
6464 )
6565 } )
66+
67+ it ( 'Should default to MiddlewareHandler<E, P, I, Response>' , async ( ) => {
68+ const middleware = createMiddleware ( async ( c , next ) => {
69+ await next ( )
70+ } )
71+ type Expected = MiddlewareHandler < any , string , { } , Response >
72+ type _verify = Expect < Equal < Expected , typeof middleware > >
73+ } )
6674} )
6775
6876describe ( 'createHandler' , ( ) => {
@@ -366,6 +374,16 @@ describe('createFactory', () => {
366374 }
367375 type verify = Expect < Equal < Expected , Actual > >
368376 } )
377+
378+ it ( 'Should default to MiddlewareHandler<E, P, I, Response>' , async ( ) => {
379+ const factory = createFactory ( )
380+
381+ const middleware = factory . createMiddleware ( async ( c , next ) => {
382+ await next ( )
383+ } )
384+ type Expected = MiddlewareHandler < Env , string , { } , Response >
385+ type _verify = Expect < Equal < Expected , typeof middleware > >
386+ } )
369387 } )
370388
371389 it ( 'Should use the default app options' , async ( ) => {
0 commit comments