fix(types): NodeNext-safe pem import in fxp.d.ts (fixes #808)#810
Open
tomquist wants to merge 4 commits intoNaturalIntelligence:masterfrom
Open
fix(types): NodeNext-safe pem import in fxp.d.ts (fixes #808)#810tomquist wants to merge 4 commits intoNaturalIntelligence:masterfrom
tomquist wants to merge 4 commits intoNaturalIntelligence:masterfrom
Conversation
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
Vulnerable Libraries (1)
More info on how to fix Vulnerable Libraries in JavaScript. 👉 Go to the dashboard for detailed results. 📥 Happy? Share your feedback with us. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose / Goal
Fix TS2834 when consumers use TypeScript with
moduleResolutionset to"node16"or"nodenext"(and oftenskipLibCheck: false). The ESM types entry (exports["."].import.types→./src/fxp.d.ts) imported./pemwithout a file extension; NodeNext requires an explicit extension (e.g../pem.js, which resolves topem.d.ts).This also adds a small regression check:
npm run test-types-nodenextplus 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 loadsfast-xml-parserESM 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
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.