How to get strict inference with RPC
Here's an example I found online
https://x.com/honojs/status/1953608853654057157
In this example, the RPC infers the response as a "string" rather than the literal
I fixed that by doing
https://x.com/honojs/status/1953608853654057157
In this example, the RPC infers the response as a "string" rather than the literal
Hi!. I somewhat got around this by adding as const at the end of { message: "Hi!"} so it looked like { message: "Hi!"} as const but then I couldn't assign variables to the response of that API call because the API calls response is infered as readonlyI fixed that by doing
{ message: "Hi!" as const} but is that the "proper" way to achieve strict inference? And why isn't there an example in the docs about this?