Commit 520a453 1 parent 0efd95e commit 520a453 Copy full SHA for 520a453
File tree 2 files changed +14
-7
lines changed
2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @hono/trpc-server ' : patch
3
+ ---
4
+
5
+ ` trpcServer ` options extends FetchHandlerRequestOptions
Original file line number Diff line number Diff line change 1
1
import type { AnyRouter } from '@trpc/server'
2
+ import type { FetchHandlerRequestOptions } from '@trpc/server/adapters/fetch'
2
3
import { fetchRequestHandler } from '@trpc/server/adapters/fetch'
3
4
import type { MiddlewareHandler } from 'hono'
4
5
5
- type tRPCOptions = {
6
- endpoint ?: string
7
- router : AnyRouter
8
- }
6
+ type tRPCOptions =
7
+ Omit <
8
+ FetchHandlerRequestOptions < AnyRouter > ,
9
+ 'req' | 'endpoint'
10
+ > & Partial < Pick < FetchHandlerRequestOptions < AnyRouter > , 'endpoint' > >
9
11
10
- export const trpcServer = ( { router , endpoint = '/trpc' } : tRPCOptions ) : MiddlewareHandler => {
12
+ export const trpcServer = ( { endpoint = '/trpc' , ... rest } : tRPCOptions ) : MiddlewareHandler => {
11
13
return async ( c ) => {
12
14
const res = fetchRequestHandler ( {
13
- endpoint : endpoint ,
15
+ ...rest ,
16
+ endpoint,
14
17
req : c . req ,
15
- router : router ,
16
18
} )
17
19
return res
18
20
}
You can’t perform that action at this time.
0 commit comments