Packages

effect

4.1.4 · 11 Nov 2026MIT66.6M / weekRepositoryHomepagenpmAtom feed

Your version

2.4.19

15 Apr 2024Where it was published

In short

5 new5 fixed

Security

2 advisories affect 2.4.19; 3.22.1 fixes them

Release note

Patch Changes

  • Centralize error messages for bugs

  • Add a RegExp module to packages/effect, closes #2488

  • Ensure FIFO ordering when a Deferred is resolved

  • Make tracing spans cheaper to construct

  • Add Subscribable trait / module

    Subscribable represents a resource that has a current value and can be subscribed to for updates.

    The following data types are subscribable:

    • A SubscriptionRef

    • An Actor from the experimental Machine module

  • Simplify scope internals

  • Ensure correct value is passed to mapping function in mapAccum loop, closes #2506

  • Add Readable module / trait

    Readable is a common interface for objects that can be read from using a get
    Effect.

    For example, Ref's implement Readable:

    import { Effect, Readable, Ref } from "effect";
    import assert from "assert";
    
    Effect.gen(function* (_) {
      const ref = yield* _(Ref.make(123));
      assert(Readable.isReadable(ref));
    
      const result = yield* _(ref.get);
      assert(result === 123);
    });
  • Added {Readable, Subscribable}.unwrap

  • Add Duration.divide and Duration.unsafeDivide.

    import { Duration, Option } from "effect";
    import assert from "assert";
    
    assert.deepStrictEqual(
      Duration.divide("10 seconds", 2),
      Option.some(Duration.decode("5 seconds")),
    );
    assert.deepStrictEqual(Duration.divide("10 seconds", 0), Option.none());
    assert.deepStrictEqual(Duration.divide("1 nano", 1.5), Option.none());
    
    assert.deepStrictEqual(
      Duration.unsafeDivide("10 seconds", 2),
      Duration.decode("5 seconds"),
    );
    assert.deepStrictEqual(
      Duration.unsafeDivide("10 seconds", 0),
      Duration.infinity,
    );
    assert.throws(() => Duration.unsafeDivide("1 nano", 1.5));

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.