effect
4.1.4 · 11 Nov 2026MIT67.1M / weekRepositoryHomepagenpmAtom feed
3.22.5 is the newest release of 3.x.
In short
16 new1 fixed
Security
2 advisories affect 3.13.0; 3.22.1 fixes them
- HighEffect: ReDoS in Schema.TemplateLiteral compiled regexGHSA-7589-6fvf-x4pw · 19 Nov 2026Fixed in 3.22.1
- HighEffect `AsyncLocalStorage` context lost/contaminated inside Effect fibers under concurrent load with RPCGHSA-38f7-945m-qr2g · 20 Mar 2026Fixed in 3.20.0
Release note
Minor Changes
Add Promise based apis to Fiber{Handle,Set,Map} modules
Add
Effect.transposeOption, closes #3142.Converts an
Optionof anEffectinto anEffectof anOption.Details
This function transforms an
Option<Effect<A, E, R>>into anEffect<Option<A>, E, R>. If theOptionisNone, the resultingEffect
will immediately succeed with aNonevalue. If theOptionisSome, the
innerEffectwill be executed, and its result wrapped in aSome.Example
import { Effect, Option } from "effect" // ┌─── Option<Effect<number, never, never>> // ▼ const maybe = Option.some(Effect.succeed(42)) // ┌─── Effect<Option<number>, never, never> // ▼ const result = Effect.transposeOption(maybe) console.log(Effect.runSync(result)) // Output: { _id: 'Option', _tag: 'Some', value: 42 }Add
Effect.whenLogLevel, which conditionally executes an effect if the specified log level is enabledAdd RcMap.touch, for reseting the idle timeout for an item
Add HashMap.some
Allow accessing args in Effect.fn pipe
Add RcMap.invalidate api, for removing a resource from an RcMap
Add Layer.updateService mirroring Effect.updateService
DifferimplementsPipeableMake it easy to convert a DateTime.Zoned to a DateTime.Utc
Add missing
Either.voidconstructor.Add
HashMap.toValuesandHashSet.toValuesgettersAdd {FiberHandle,FiberSet,FiberMap}.awaitEmpty apis
Schema: Add
standardSchemaV1API to Generate a Standard Schema v1.Example
import { Schema } from "effect" const schema = Schema.Struct({ name: Schema.String }) // ┌─── StandardSchemaV1<{ readonly name: string; }> // ▼ const standardSchema = Schema.standardSchemaV1(schema)Added
Duration.formatIsoandDuration.fromIsofor formatting and parsing ISO8601 durations.Add Effect.filterEffect* apis
Effect.filterEffectOrElse
Filters an effect with an effectful predicate, falling back to an alternative
effect if the predicate fails.
```ts
import { Effect, pipe } from "effect"
// Define a user interface
interface User {
readonly name: string
}
// Simulate an asynchronous authentication function
declare const auth: () => Promise<User | null>
const program = pipe(
Effect.promise(() => auth()),
// Use filterEffectOrElse with an effectful predicate
Effect.filterEffectOrElse({
predicate: (user) => Effect.succeed(user !== null),
orElse: (user) => Effect.fail(new Error(`Unauthorized user: ${user}`))
})
)
```Effect.filterEffectOrFail
Filters an effect with an effectful predicate, failing with a custom error if the predicate fails.
```ts
import { Effect, pipe } from "effect"
// Define a user interface
interface User {
readonly name: string
}
// Simulate an asynchronous authentication function
declare const auth: () => Promise<User | null>
const program = pipe(
Effect.promise(() => auth()),
// Use filterEffectOrFail with an effectful predicate
Effect.filterEffectOrFail({
predicate: (user) => Effect.succeed(user !== null),
orFailWith: (user) => Effect.fail(new Error(`Unauthorized user: ${user}`))
})
)
```Patch Changes
Trie<out A>type annotations have been aligned. The type parameter was made covariant because the structure is immutable.
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.