Registry / devops / queue-ts

queue-ts

JSON →
library0.1.0jsnpmunverified

A lightweight, promise-based worker queue for TypeScript and JavaScript that limits concurrent task execution. Current stable version is 0.1.0. It offers a simple API for enqueuing async tasks with a configurable concurrency limit, making it suitable for throttling API calls or managing resource-intensive operations. Differentiator: minimal overhead with no external dependencies, designed specifically for TypeScript projects.

npm install queue-ts
INSTALL
IMPORT
SIG · QUEUE-TS
Q
queue-ts
devopsjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Queue
import { Queue } from 'queue-ts'
const Queue = require('queue-ts')
ESM-only module. Named export.
Queue (default)
import Queue from 'queue-ts'
const { default: Queue } = require('queue-ts')
Default export is also available, but named is recommended.
Queue (type)
import type { Queue } from 'queue-ts'
import { Queue } from 'queue-ts' // when only type needed
Use type import for TypeScript to avoid bundling the class.

Creates a queue with concurrency 2, enqueues three tasks, and waits for all to finish.

import { Queue } from 'queue-ts'; const queue = new Queue(2); // Limit concurrency to 2 const task = () => new Promise(resolve => setTimeout(resolve, 1000)); queue.enqueue(task); queue.enqueue(task); queue.enqueue(task); await queue.onEmpty(); // Resolves when all tasks complete
Debug
Known issues
gotchaTasks are not automatically retried on failure; the promise will reject and the queue continues.
fix
Implement retry logic within the task function.
affects: >=0.1.0
gotchaThe queue does not enforce an order of execution beyond first-in-first-out when concurrency allows.
fix
If strict FIFO is needed, ensure concurrency is 1.
affects: >=0.1.0
deprecatedThe 'max' option in constructor is deprecated; use 'concurrency' instead.
fix
Use new Queue(concurrency) or new Queue({ concurrency })
affects: >=0.1.0
gotchaCalling onEmpty() before enqueuing tasks may resolve immediately.
fix
Enqueue all tasks before calling onEmpty().
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: Class extends value undefined is not a constructor or null
Using CommonJS require instead of ESM import, or missing default export import.
fix
Use import { Queue } from 'queue-ts' (ESM).
Property 'onEmpty' does not exist on type 'Queue<unknown>'
Using an older version or TypeScript types not updated.
fix
Upgrade to queue-ts@0.1.0 and ensure TypeScript 3.8+.
Cannot find module 'queue-ts' or its corresponding type declarations.
Package not installed or missing tsconfig settings.
fix
npm install queue-ts and ensure 'moduleResolution' is 'node' in tsconfig.json.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
queue-ts — npm install queue-ts · libregistry