Add explicit file extensions to imports#82
Conversation
|
Thanks! This is an issue that occurs from time to time, mostly due to auto-imports from IDEs and lack of linting rules. |
|
Can you add a version bump as well? ( // Edit: Sorry, the correct way is |
|
I think this one's on me in my last PR; I wonder why CI didn't catch it 🤔 I guess that's something we might want to look at? |
I suppose its because not every setup is affected by this issue (only ESM projects?) |
Perhaps. I'll see whether I can figure this out. Created #86 to remind me |
Use nodenext as module and module resolution options. I'm not sure why bundler was picked here, but I don't think it's the correct choice for a library which may or may not be bundled. Using nodenext enables stricter module resolution, and in particular enforces the use of file extensions for relative imports, thus avoiding regressions like those fixed in #82 Closes #86
I was following this guide on gjs.guide for setting up TypeScript which recommends using
NodeNextmodule resolution and that requires explicit.jsin imports, since I saw that the rest of the repository follows that format, I decided to add it to the remaining ones.This fixes errors like this from happening:
For the
./typesimport I decided to reference directly theextension-object.jsfile as I figured that'd look better than referencingindex.jsbut I can change that if you disagree.