npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

effection-typed-context

v0.1.0

Published

Type-aware context helpers for Effection operations.

Downloads

83

Readme

effection-typed-context

Type-aware context helpers for Effection.

effection-typed-context wraps Effection's context utilities so yielded operations keep track of which context values are required and which providers satisfy them.

Install

pnpm add effection-typed-context effection

Usage

effection-typed-context supports two integration styles:

  1. Import from effection-typed-context as a drop-in replacement for the relevant Effection APIs.
  2. Keep importing from effection and add the effection-typed-context ambient type augmentation.

Drop-in replacement

Import the typed APIs directly from effection-typed-context:

import { type Effect } from "effection";
import {
  createContext,
  provide,
  run,
  strip,
  type Provider,
  type Requirement,
} from "effection-typed-context";

const APIBaseUrl = createContext<string>("apiBaseUrl");

function* program() {
  return yield* APIBaseUrl.expect();
}

// Before requirements are provided:
// Generator<Effect<unknown> | Requirement<string>, string, unknown>

const providedProgram = provide(program, function* () {
  yield* APIBaseUrl.set("https://example.com");
});

// After requirements are provided:
// Generator<Effect<unknown> | Provider<string>, string, unknown>

const rootProgram = strip(() => providedProgram);

// At the root, strip removes all Provider types once context has been provided:
// Generator<Effect<unknown>, string, unknown>

const value = await run(() => rootProgram);

Effection augmentation

If you want to keep existing imports from effection, add the ambient types in your project:

/// <reference types="effection-typed-context/types" />

This is typically added in a project-level .d.ts file such as env.d.ts. After that, the typed signatures are available from effection directly:

import { createContext, run } from "effection";
import { provide } from "effection-typed-context";

const apiBaseUrl = createContext<string>("apiBaseUrl");

function* program() {
  return yield* apiBaseUrl.expect();
}

const value = await run(() =>
  provide(program, function* () {
    yield* apiBaseUrl.set("https://example.com");
  }),
);

When you use the module augmentation, run() and main() accept the typed operations directly, so you typically do not need strip() at the root.

API

  • createContext(name, defaultValue?)
  • provide(operation, provider)
  • spawn(operation)
  • resource(operation) With Effection alone, this is often written as resource<Type>(function* (provide) {}). With typed-context, prefer putting the type on provide instead: resource(function* (provide: Provide<Type>) {}).
  • run(operation)
  • main(operation)
  • all(operations)
  • strip(operation) Removes all Provider types from an operation. Use it at the root after all required context has been provided. This is mainly useful when importing the drop-in API from effection-typed-context; with the effection module augmentation, run() and main() can consume the typed operation directly.