Packages

effect

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

Your version

3.9.0

7 Oct 2024Where it was published

3.22.5 is the newest release of 3.x.

In short

13 new2 fixed

Security

2 advisories affect 3.9.0; 3.22.1 fixes them

Release note

Minor Changes

  • Adds HashMap.HashMap.Entry type helper

  • Add deno support to Inspectable

  • Latch implements Effect<void> with .await semantic

  • Effect.mapAccum & Array.mapAccum preserve non-emptiness

  • Pool is now a subtype of Effect, equivalent to Pool.get

  • Support providing an array of layers via Effect.provide and Layer.provide

  • Support ManagedRuntime in Effect.provide

  • ManagedRuntime<R, E> is subtype of Effect<Runtime<R>, E, never>

  • Tuple.map transforms each element of tuple using the given function, treating tuple homomorphically

    import { pipe, Tuple } from "effect"
    
    const result = pipe(
      //  ^? [string, string, string]
      ["a", 1, false] as const,
      T.map((el) => {
        //^? "a" | 1 | false
        return el.toString().toUppercase()
      })
    )
    assert.deepStrictEqual(result, ["A", "1", "FALSE"])
  • Add Array.pad function

  • Add an isRegExp type guard

  • Implement Effect.Service as a Tag and Layer with Opaque Type.

    Namely the following is now possible:

    class Prefix extends Effect.Service<Prefix>()("Prefix", {
      sync: () => ({
        prefix: "PRE"
      })
    }) {}
    
    class Postfix extends Effect.Service<Postfix>()("Postfix", {
      sync: () => ({
        postfix: "POST"
      })
    }) {}
    
    const messages: Array<string> = []
    
    class Logger extends Effect.Service<Logger>()("Logger", {
      accessors: true,
      effect: Effect.gen(function* () {
        const { prefix } = yield* Prefix
        const { postfix } = yield* Postfix
        return {
          info: (message: string) =>
            Effect.sync(() => {
              messages.push(`[${prefix}][${message}][${postfix}]`)
            })
        }
      }),
      dependencies: [Prefix.Default, Postfix.Default]
    }) {}
    
    describe("Effect", () => {
      it.effect("Service correctly wires dependencies", () =>
        Effect.gen(function* () {
          const { _tag } = yield* Logger
          expect(_tag).toEqual("Logger")
          yield* Logger.info("Ok")
          expect(messages).toEqual(["[PRE][Ok][POST]"])
          const { prefix } = yield* Prefix
          expect(prefix).toEqual("PRE")
          const { postfix } = yield* Postfix
          expect(postfix).toEqual("POST")
        }).pipe(Effect.provide([Logger.Default, Prefix.Default, Postfix.Default]))
      )
    })
  • Resource<A, E> is subtype of Effect<A, E>.
    ScopedRed<A> is subtype of Effect<A>.

Patch Changes

  • Fix Unify for Deferred

  • Move ManagedRuntime.TypeId to fix circular imports

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.