sindresorhus / p-queue

Promise queue with concurrency control
MIT License
3.39k stars 182 forks source link

EventEmitter import breaks TypeScript #195

Closed AhmedToInfinity closed 12 months ago

AhmedToInfinity commented 12 months ago

I left a similar comment on a previously opened issue from a couple years ago: https://github.com/sindresorhus/p-queue/issues/146#issuecomment-1699462212

Since this has not been addressed, I'm opening another issue.

The problem is that EventEmitter v4 (currently used version here) does not have an export default, causing this to break when using TypeScript without the esModuleInterop or allowSyntheticDefaultImports set to true. This should not be required, and this import can be handled correctly.

There are 2 options:

  1. Stay on the current EventEmitter v4 and in source\index.ts, update the first line to import * as EventEmitter from 'eventemitter3';
  2. Upgrade to EventEmitter v5 (note: the breaking changes will not affect this repo), and either:
    • keep the import as is
    • OR, update it to import { EventEmitter } from 'eventemitter3' (preferred syntax)
    • NOTE: either way works since v5 supports both here

Please make either of these very quick changes, or I cannot upgrade p-queue to v7 from v6. Thank you!