Skip to content

fix(types): NodeNext-safe pem import in fxp.d.ts (fixes #808)#810

Open
tomquist wants to merge 4 commits intoNaturalIntelligence:masterfrom
tomquist:fix/ts2834-nodenext-fxp-dts-import
Open

fix(types): NodeNext-safe pem import in fxp.d.ts (fixes #808)#810
tomquist wants to merge 4 commits intoNaturalIntelligence:masterfrom
tomquist:fix/ts2834-nodenext-fxp-dts-import

Conversation

@tomquist
Copy link

@tomquist tomquist commented Mar 23, 2026

Purpose / Goal

Fix TS2834 when consumers use TypeScript with moduleResolution set to "node16" or "nodenext" (and often skipLibCheck: false). The ESM types entry (exports["."].import.types./src/fxp.d.ts) imported ./pem without a file extension; NodeNext requires an explicit extension (e.g. ./pem.js, which resolves to pem.d.ts).

This also adds a small regression check: npm run test-types-nodenext plus a step in the existing Node.js CI workflow.

Issue: #808

This PR is similar to #809 but also adds a regression test.

Input: Any project with module: "NodeNext", moduleResolution: "NodeNext", skipLibCheck: false, and a dependency (direct or transitive) that loads fast-xml-parser ESM types.

Actual output (before fix): src/fxp.d.ts(1,50): error TS2834: Relative import paths need explicit file extensions...

Expected output: Typecheck succeeds without patching node_modules.

Type

Please mention the type of PR

  • Bug Fix
  • Refactoring / Technology upgrade
  • New Feature

Note : Please ensure that you've read contribution guidelines before raising this PR. If your PR is in progress, please prepend [WIP] in PR title. Your PR will be reviewed when [WIP] will be removed from the PR title.

Bookmark this repository for further updates.

Relative imports in declaration files must use explicit .js extensions
when consumers use moduleResolution node16/nodenext with skipLibCheck false.

Fixes NaturalIntelligence#808
Use ./pem.js in the ESM declaration so TypeScript with moduleResolution
node16/nodenext and skipLibCheck false does not report TS2834.

Adds test-types-nodenext and a CI step to guard against regression.

Fixes NaturalIntelligence#808
@guardrails
Copy link

guardrails bot commented Mar 23, 2026

⚠️ We detected 1 security issue in this pull request:

Vulnerable Libraries (1)
Severity Details
Medium pkg:npm/eslint@8.57.0 (t) upgrade to: 9.26.0

More info on how to fix Vulnerable Libraries in JavaScript.


👉 Go to the dashboard for detailed results.

📥 Happy? Share your feedback with us.

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