Skip to content

Conversation

@ravener
Copy link
Contributor

@ravener ravener commented Oct 15, 2025

I was following this guide on gjs.guide for setting up TypeScript which recommends using NodeNext module resolution and that requires explicit .js in 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:

node_modules/.pnpm/@girs+gnome-shell@49.0.2/node_modules/@girs/gnome-shell/dist/ui/extensionSystem.d.ts:7:38 - error TS2834: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.

7 import type { ExtensionObject } from '../types';
                                       ~~~~~~~~~~


Found 1 error in node_modules/.pnpm/@girs+gnome-shell@49.0.2/node_modules/@girs/gnome-shell/dist/ui/extensionSystem.d.ts:7

For the ./types import I decided to reference directly the extension-object.js file as I figured that'd look better than referencing index.js but I can change that if you disagree.

@schnz
Copy link
Member

schnz commented Oct 15, 2025

Thanks! This is an issue that occurs from time to time, mostly due to auto-imports from IDEs and lack of linting rules.

schnz
schnz previously approved these changes Oct 15, 2025
@schnz
Copy link
Member

schnz commented Oct 15, 2025

Can you add a version bump as well? (npm version patch). This way, we can release a new version of the package.

// Edit: Sorry, the correct way is yarn workspace @girs/gnome-shell version patch

@swsnr
Copy link
Collaborator

swsnr commented Oct 15, 2025

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?

@schnz
Copy link
Member

schnz commented Oct 15, 2025

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?)

@schnz schnz enabled auto-merge October 15, 2025 19:02
@schnz schnz merged commit 150634c into gjsify:main Oct 15, 2025
1 check passed
@swsnr
Copy link
Collaborator

swsnr commented Oct 18, 2025

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

swsnr added a commit that referenced this pull request Oct 19, 2025
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
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.

4 participants