You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This would let stringifying data with c.json response.
Since hono simply provides typed Response.json(), hc helper would need to pass a modified instance of Response that would have a function defined to deserialize the payload with the same transformer. It probably could override json() method to accept an argument json({ useTransformer: true }) to use transformer to deserialize payload.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
There is an awesome helper
hc
to be used on client side to fetch routes and get typed responses (https://hono.dev/docs/guides/rpc#client).However, if your API endpoints return
bigint
s, typed responses won't work sincebigint
is not serializable.I suggest to add
transformer
property toHono
instance that would work similarly to how it works in trpc (https://trpc.io/docs/server/data-transformers).This would let stringifying data with
c.json
response.Since hono simply provides typed
Response.json()
,hc
helper would need to pass a modified instance ofResponse
that would have a function defined to deserialize the payload with the same transformer. It probably could overridejson()
method to accept an argumentjson({ useTransformer: true })
to use transformer to deserialize payload.Beta Was this translation helpful? Give feedback.
All reactions