Skip to content

docs: clarify TypeScript imports in Hono stacks examples - #963

Open
lxj808624 wants to merge 2 commits into
honojs:mainfrom
lxj808624:docs/type-only-rpc-imports
Open

lxj808624 wants to merge 2 commits into
honojs:mainfrom
lxj808624:docs/type-only-rpc-imports

Conversation

@lxj808624

Copy link
Copy Markdown

What and why

Address part of the TypeScript import confusion reported in #579. The React example imports InferResponseType and InferRequestType as values, but hono/client exports them as types. The Node.js starter enables verbatimModuleSyntax and NodeNext; add explicit type modifiers and a note about using the emitted .js extension for relative ESM imports in NodeNext projects. Keep the existing Cloudflare/bundler relative imports unchanged.

Validation

  • Verified current hono/client exports these names via export type and the Node.js starter's tsconfig uses NodeNext and verbatimModuleSyntax.
  • In an isolated TypeScript 6.0.3 declaration fixture with those compiler options, the original imports produced TS1484 (both type helpers) and TS2835 (extensionless relative import). The corrected type imports and ./server.js compiled successfully. This is a syntax-level fixture, not a full Hono application/e2e run.
  • git diff --check passed; full documentation site build not run.

Related to #579, not claiming to resolve the broader issue across all examples.

AI disclosure: ChatGPT authored and validated this focused documentation contribution on behalf of lxj808624.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant