`PQueue.on` does not exist
AzureFlow opened this issue · 7 comments
It appears like on
isn't working, at least on ^7.3.4
. I saw #153 but it doesn't appear like there a resolution to the problem.
Given the following example:
import PQueue from "p-queue";
const queue = new PQueue({concurrency: 1});
queue.on("add", () => {
console.log(`Task is added. Size: ${queue.size} Pending: ${queue.pending}`);
});
let count = 0;
(async () => {
await queue.add(() => {
console.log("Start #1");
return new Promise((resolve) => setTimeout(resolve, 5 * 1000));
});
console.log("Done #1");
})();
It results in:
TS2339: Property 'on' does not exist on type 'PQueue '.
Thanks.
We have tests that confirm it's working:
Line 844 in c12ec2e
I am also facing the same issue on v7 (queue.on doesnot exists);
Apparently this is caused by not having the script included in your tsconfig.json
's include
array.
Still facing the same issue, I have includes in my tsconfig.json.
Still facing the same issue, I have includes in my tsconfig.json.
It worked for me, just make sure you are using the d.ts file
"include": ["node_modules/p-queue/dist/index.d.ts"]
Yes but we don't have to do this, this is the package.json of this project that have to do this