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}[]}> ?
Was this page helpful?