adding generic error output type to App type
Hey all, I am using the typed RPC feature of hono and got it working, except for the errors
I have an .onError that consstruct a json from error thrown and I would like that error type to be unioned with each of the output type of all path
Is there a way to do this ?
Like is there some type generic magic I could add to my exported App type to add an extra type for all outputs
Something like
export type App = AddErrorType<typeof app, {success: false, errors: {message: string, code: number}[]}>
?1 Reply
I got something working with
you can then do
but maybe hono should handle it automatically somehow ?
Got it simplified to
wanted to have the error happen only when response is not ok, but did not managed