My Hono PR

Why Developer Experience Trumps Technical Equivalence.

By: Mr Uprizing

My PRlink in Hono.js changed literally 3 lines of documentation. Technically unnecessary. Functionally identical. But it improved DX, and that was enough.

The Real Problem

When working with RPC in Hono, you need the server type on the client. Two ways:

code-editor

index.ts

// Option 1: Import the entire instance
import { app } from './server'
const client = hc<typeof app>('/api')

// Option 2: Import only the type
import type { AppType } from './server'
const client = hc<AppType>('/api')

Both work the same. But the second is better DX.

Why It Matters

Safety by default: With import type, the bundler eliminates the import. Impossible to bundle your server by mistake. With import { app }, you depend on tree-shaking. One accidental app.fetch() and you bundled your database.

Clear intent: AppType screams "this is a type contract". typeof app screams "I'm not sure if I need the instance or the type".

Less friction to scale: Multiple clients? Onetype.ts file with exports. No repeating typeof app everywhere.

The Lesson

Technical equivalence isn't the only criterion. If two solutions do the same thing but one reduces potential errors and makes the code more obvious, that's the better solution. DX isn't luxury. It's choosing the path that makes it hard to mess up.