Zero-dependency, tree-shakeable, fully typed TypeScript utility primitives.
A typed reactive container that holds a single value: call `get()` to read it, `set()` to update it and synchronously notify all subscribers, and `subscribe()` to register a listener — receiving an unsubscribe handle in return. `Atom.fn()` extends this model to plain functions, wrapping any callable so that every invocation fans out to subscribers, making it easy to build observable event emitters without a class. Zero dependencies.
Replacer for use with native `JSON.stringify`. Encodes special types (Map, Set, Date, etc.).
A typed FIFO queue built around a lifecycle event system. Subscribe to `push`, `pop`, `drain`, `empty`, `idle`, and `error` events via `on()`, which returns an unsubscribe handle. Use `drain()` to pull all items at once or `front()` to peek without removing. Designed for ordered processing pipelines where visibility into queue state matters.
A collection of global ambient type augmentations that close long-standing gaps in TypeScript's standard library. It patches `Array.isArray` narrowing for readonly arrays, changes `JSON.parse` and `fetch` `Body.json()` to return `unknown` instead of `any`, and tightens callback inference for `Array.prototype.filter`, `Array.prototype.map`, and `Set`. Import once at your entry point and the stricter types apply project-wide with zero runtime cost.
Rust-inspired `Result<T, E>` type with `Ok` and `Err` variants that replaces throw/catch with explicit return types, making errors part of the function signature. Ships with `ok()`, `err()`, `isOk()`, `isErr()`, `unwrap()`, and `unwrapOr()` utilities for ergonomic handling.
Retries any sync or async operation up to a configurable number of attempts, with optional fixed or exponentially increasing delays between each try. A `transform` option lets you map raw thrown values into typed errors, and a single overloaded `retry()` function handles both plain functions and Promises transparently.
Wraps any throwable sync or async operation and returns a `Result` instead of throwing. Smart overload detection handles raw Promises, async functions, and sync functions uniformly through a single `attempt` entry point. An optional `transform` parameter lets you shape caught errors into typed `Err` values before they reach the caller.
Compile-time numeric range utilities: `Enumerate<N>` produces a union of `0` through `N-1`, and `Range<F, T>` produces `F` through `T-1`. Useful for constraining numeric literals in APIs — port numbers, indices, pagination limits — without any runtime overhead. Both are pure type-level constructs; zero runtime code is emitted.