fix: make type declarations compatible with nodenext module resolution#1983
Closed
tomquist wants to merge 1 commit into
Closed
fix: make type declarations compatible with nodenext module resolution#1983tomquist wants to merge 1 commit into
tomquist wants to merge 1 commit into
Conversation
8d27cd6 to
60db48b
Compare
- Add file extensions to relative imports in openpgp.d.ts (TS2834) - Add @openpgp/web-stream-tools as optional peerDependency so consumers using moduleResolution "node16"/"nodenext" can resolve the type import in openpgp.d.ts (TS2307) The published openpgp.d.ts imports types from @openpgp/web-stream-tools, but it was only listed as a devDependency, so it wasn't installed for consumers. This caused TS2307 when TypeScript tried to resolve the import. Additionally, the relative imports of ./src/enums and ./src/config lacked file extensions, which is required under --moduleResolution node16/nodenext (TS2834). Fixes openpgpjs/web-stream-tools#10 (partially)
60db48b to
f233557
Compare
Collaborator
|
Thanks for reporting and proposing a fix; closing in favor of a more general solution (#1987) |
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.
Summary
The published
openpgp.d.tshas two issues that prevent it from working with TypeScript's--moduleResolution node16/nodenext:TS2307:
openpgp.d.tsimports types from@openpgp/web-stream-tools, but it's only adevDependency, so it's not installed for consumers. This PR adds it as an optionalpeerDependency.TS2834: The relative imports
./src/enumsand./src/configlack file extensions, which are required undernode16/nodenextmodule resolution. This PR adds the.jsextensions.Changes
openpgp.d.ts: Add.jsextensions to relative imports (./src/enums→./src/enums.js,./src/config→./src/config/index.js)package.json: Add@openpgp/web-stream-toolsas an optionalpeerDependency(kept indevDependenciesas well for development)Reproduction
Partially addresses openpgpjs/web-stream-tools#10.