fix: support ES2020 TypeScript consumers#246
Closed
saripovdenis wants to merge 1 commit into
Closed
Conversation
Owner
|
Sorry, not interested in this. This package targets Node.js 20, which supports ES2022. So any consumer not having ES2022 have the incorrect TS config. |
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
Fixes TypeScript consumers that compile with
target: "ES2020"or"ES2021"andskipLibCheck: false.p-queuere-exportsTimeoutErrorfromp-timeout. That makes TypeScript loadp-timeoutdeclarations when checkingp-queue, even if the user never importsp-timeoutdirectly.p-timeoutusesErrorOptions, which comes fromES2022.Error. ES2020 projects may not have that lib loaded, so a plainimport PQueue from 'p-queue'can fail with:Why fix this here?
The root type is in p-timeout, so an upstream fix there would also be useful. But p-queue re-exports that type as part of its public declaration surface, so p-queue consumers can hit the error without depending on or importing p-timeout.
This local fix shields p-queue users now and remains harmless if p-timeout later adds the same reference.