effect
4.1.4 · 11 Nov 2026MIT67.1M / weekRepositoryHomepagenpmAtom feed
3.22.5 is the newest release of 3.x.
In short
2 new1 faster7 fixed
Security
2 advisories affect 3.12.8; 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
Patch Changes
Improve
Duration.decodeHandling of High-Resolution TimeEnsured Immutability: Added the
readonlymodifier to[seconds: number, nanos: number]inDurationInputto prevent accidental modifications.Better Edge Case Handling: Now correctly processes special values like
-InfinityandNaNwhen they appear in the tuple representation of duration.
Cron:
unsafeParsenow throws a more informative error instead of a generic oneA more precise signature has been applied for
Effect.scheduleFix Layer.scope types to correctly use the Scope tag identifier
Expose
Schedule.isScheduleSchema: Update
DurationEncoding to a Tagged Union Format.This changeset fixes the
Durationschema to support all possible duration types, including finite, infinite, and nanosecond durations. The encoding format has been updated from a tuple (readonly [seconds: number, nanos: number]) to a tagged union.This update introduces a change to the encoding format. The previous tuple representation is replaced with a more expressive tagged union, which accommodates all duration types:
type DurationEncoded = | { readonly _tag: "Millis" readonly millis: number } | { readonly _tag: "Nanos" readonly nanos: string } | { readonly _tag: "Infinity" }Rationale
The
Durationschema is primarily used to encode durations for transmission. The new tagged union format ensures clear and precise encoding for:Finite durations, such as milliseconds.
Infinite durations, such as
Duration.infinity.Nanosecond durations.
Example
import { Duration, Schema } from "effect" // Encoding a finite duration in milliseconds console.log(Schema.encodeSync(Schema.Duration)(Duration.millis(1000))) // Output: { _tag: 'Millis', millis: 1000 } // Encoding an infinite duration console.log(Schema.encodeSync(Schema.Duration)(Duration.infinity)) // Output: { _tag: 'Infinity' } // Encoding a duration in nanoseconds console.log(Schema.encodeSync(Schema.Duration)(Duration.nanos(1000n))) // Output: { _tag: 'Nanos', nanos: '1000' }Schema: Improve encoding in
Defectand add test for array-based defects.Schema: Update
itemsCountto allow0as a valid argument, closes #4328.Add missing overload for
Option.as.Optimize Stream.toReadableStream
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.