Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use correct imports in the documentation examples #579

Open
IcyFoxe opened this issue Feb 3, 2025 · 0 comments
Open

Use correct imports in the documentation examples #579

IcyFoxe opened this issue Feb 3, 2025 · 0 comments

Comments

@IcyFoxe
Copy link

IcyFoxe commented Feb 3, 2025

Imports without an extension

All examples in the documentation have relative imports without a file extension.
However freshly initialized app uses "module": "NodeNext" in tsconfig.json which requires these imports to have an extension.

If you try to use a relative import without an extension you get this error:

Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'.

I think it should be fixed, to show correct examples that won't need to be fixed after copying by the user.

Imports without a type keyword

There are also some examples that import types without the type keyboard.
For example import { AppType } from './server' in the "Hono Stacks" page should've been import type { AppType } from './server', otherwise it will throw this error:

'AppType' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.

Again, this is using the default configuration of the initialized app, so these examples should adhere to that configuration.


I'm new to Hono, and I just want to say that I really like it so far, and appreciate all the work you guys have put into it. I believe that the documentation is the most important part of any framework, so making sure that it is nicely categorized, has lots of examples and correct code is extremely helpful to every newcomer.

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

No branches or pull requests

1 participant