hono-rpc-examples icon indicating copy to clipboard operation
hono-rpc-examples copied to clipboard

Optimized examples

Open Blankeos opened this issue 1 year ago • 0 comments

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.

  1. You can use plain old tsc --watch - my opinion is way easier
  2. 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.
  3. You can use turborepo (as Hono does by example, tho not everyone has a monorepo)

Blankeos avatar Dec 20 '24 08:12 Blankeos