Environment
Node: 22.16.0
Nitro: 2.12.4
Reproduction
https://github.com/dword-design/demo-nitro-fetch-type-with-generics
Describe the bug
When I have an event handler, and call that one via $fetch, normally $fetch would detect the event handler type:
But when I pass a generic type param to the event handler (e.g. for query or body type), it will only have any as a type.
// server/api/foo.get.ts
export default eventHandler<{ query: { foo: string } }>(() => 'foo');
It looks like it will take the default Response any type if a generic is passed and otherwise take the type from the actual result.
I was asking myself, is it recommended to pass that type or should sth. like zod be used instead?
Additional context
No response
Logs