hono-rpc-examples
hono-rpc-examples copied to clipboard
Optimized examples
I learned that there's a way to optimize type inference during development. By compiling the types so that tsserver doesn't need to keep inferencing hono types.
Hono's doc for this is good, but feels very incomplete: https://hono.dev/docs/guides/rpc#compile-your-code-before-using-it-recommended
There's also a working example here that uses turborepo: https://github.com/m-shaka/hono-rpc-perf-tips-example
But that isn't the only way!! So I'll make some examples here.
- You can use plain old
tsc --watch- my opinion is way easier - You can use rollup dts - I actually already do this for my multirepo setup in this repo. Good thing about this is that it's just 1 file.
- You can use turborepo (as Hono does by example, tho not everyone has a monorepo)