queue-typescript is a minimalist TypeScript library that provides a generic queue data structure. Currently at version 1.0.1, it offers a stable and lightweight solution for managing queues in TypeScript and JavaScript projects. The library distinguishes itself by its full support for TypeScript generics, allowing developers to create type-safe queues for any data type, including primitive types, objects, or custom classes, ensuring compile-time type checking. It also adheres to both the JavaScript iterator and iterable protocols, enabling seamless integration with modern JavaScript features such as `for...of` loops, the spread operator (`...`), and array deconstruction. Internally, `queue-typescript` relies on the `linked-list-typescript` package for its underlying data storage, contributing to efficient enqueue and dequeue operations. This package focuses on core queue functionality, delivering a straightforward, performant, and type-safe queue implementation without unnecessary overhead or additional utilities. Given its singular purpose and stable API, a rapid release cadence is not expected.
Verified import paths — ran on the pinned version, not inferred.
This is the standard ESM import for TypeScript projects.
While CommonJS `require` works, modern TypeScript projects typically use ESM imports. The `Queue` class is a named export, not a default export.
Always specify the generic type parameter (e.g., `<string>`) when declaring or instantiating a `Queue` to leverage TypeScript's type safety features fully.
This example demonstrates how to create, initialize, enqueue items into, and iterate through a generic TypeScript Queue, showcasing its iterable protocol support.
Breaking-change detection hasn't run for this library yet.
CVE tracking and dependency tree are planned for a later release.