Yieldless

Yieldless

Native async/await primitives for tuple-based errors, structured concurrency, and Node/Electron workflows.

Yieldless is a TypeScript library with zero dependencies. It gives you tuple-based errors, structured concurrency, and resource management — built on Promise, AbortController, AsyncLocalStorage, and Symbol.asyncDispose.

Quick install

pnpm add yieldless

What it looks like

import { safeTry } from "yieldless/error";
import { runTaskGroup } from "yieldless/task";

const [repoError, repo] = await safeTry(loadRepository(repoId));

if (repoError) {
  return [repoError, null] as const;
}

return await runTaskGroup(async (group) => {
  const refs = group.spawn((signal) => loadRefs(repo.path, signal));
  const status = group.spawn((signal) => loadStatus(repo.path, signal));

  return {
    repo,
    refs: await refs,
    status: await status,
  };
});

What Yieldless covers

Yieldless is intentionally modular. You can adopt one boundary at a time:

  • error and result for tuple creation, folding, and composition
  • task, all, iterable, queue, pubsub, and limiter for async coordination and load control
  • retry, schedule, signal, timer, and breaker for resilient boundaries
  • cache, batcher, and singleflight for repeated, keyed, and duplicate work
  • fetch, node, event, and ipc for common platform boundaries
  • schema, env, and router for application edges
  • resource, di, context, and test for lifecycle, ergonomics, and deterministic tests

Start with Beginner Tutorial if you are new to Yieldless, Simple Recipes if you want a small copy-pasteable pattern, or Module Selection if you are deciding which piece to reach for first.

On this page