-
Notifications
You must be signed in to change notification settings - Fork 239
Open
Labels
Description
Which middleware has the bug?
@hono/trpc-server
What version of the middleware?
^0.3.4
What version of Hono are you using?
^4.6.15
What runtime/platform is your app running on? (with version if possible)
node 20
What steps can reproduce the bug?
I'm using trpcServer like so
app.use(
"/trpc/*",
trpcServer({
router: appRouter,
createContext: (opts, c) => createContext(opts),
onError({ error }) {
console.error(error);
},
}),
);
I have the trpc createContext function defined like so
export const createContext = async (c: CreateNextContextOptions) => {
///stuff
}
It seems that the opts
passed in from the trpc-server package is of type incompatible with the CreateNextContextOptions
param as documented here
What is the expected behavior?
I expect the types for opts
to match the types for the createContext
of trpc.
What do you see instead?
Type types do not match
src/main.ts:36:47 - error TS2345: Argument of type 'FetchCreateContextFnOptions' is not assignable to parameter of type 'CreateNextContextOptions'.
Property 'res' is missing in type 'FetchCreateContextFnOptions' but required in type 'CreateNextContextOptions'.
36 createContext: (opts, c) => createContext(opts),
~~~~
../node_modules/.pnpm/@[email protected]/node_modules/@trpc/server/dist/adapters/node-http/types.d.ts:68:5
68 res: TResponse;
~~~
'res' is declared here.
Additional information
I'm using trpc v10