effect
4.1.4 · 11 Nov 2026MIT67.1M / weekRepositoryHomepagenpmAtom feed
3.22.5 is the newest release of 3.x.
In short
5 fixed
Security
2 advisories affect 3.11.3; 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
Fix the
Schema.TemplateLiteraloutput type when the arguments include a branded type.Before
import { Schema } from "effect" const schema = Schema.TemplateLiteral( "a ", Schema.String.pipe(Schema.brand("MyBrand")) ) // type Type = `a ${Schema.brand<typeof Schema.String, "MyBrand"> & string}` // | `a ${Schema.brand<typeof Schema.String, "MyBrand"> & number}` // | `a ${Schema.brand<typeof Schema.String, "MyBrand"> & bigint}` // | `a ${Schema.brand<...> & false}` // | `a ${Schema.brand<...> & true}` type Type = typeof schema.TypeAfter
import { Schema } from "effect" const schema = Schema.TemplateLiteral( "a ", Schema.String.pipe(Schema.brand("MyBrand")) ) // type Type = `a ${string & Brand<"MyBrand">}` type Type = typeof schema.TypeSchema: Fix bug in
Schema.TemplateLiteralParserresulting in a runtime error.Before
import { Schema } from "effect" const schema = Schema.TemplateLiteralParser("a", "b") // throws TypeError: Cannot read properties of undefined (reading 'replace')After
import { Schema } from "effect" const schema = Schema.TemplateLiteralParser("a", "b") console.log(Schema.decodeUnknownSync(schema)("ab")) // Output: [ 'a', 'b' ]SchemaAST: Fix
TemplateLiteralmodel.Added
LiteralandUnionas valid types.Preserve
MissingMessageAnnotations on property signature declarations when another field is a property signature transformation.Before
import { Console, Effect, ParseResult, Schema } from "effect" const schema = Schema.Struct({ a: Schema.propertySignature(Schema.String).annotations({ missingMessage: () => "message1" }), b: Schema.propertySignature(Schema.String) .annotations({ missingMessage: () => "message2" }) .pipe(Schema.fromKey("c")), // <= transformation d: Schema.propertySignature(Schema.String).annotations({ missingMessage: () => "message3" }) }) Effect.runPromiseExit( Schema.decodeUnknown(schema, { errors: "all" })({}).pipe( Effect.tapError((error) => Console.log(ParseResult.ArrayFormatter.formatErrorSync(error)) ) ) ) /* Output: [ { _tag: 'Missing', path: [ 'a' ], message: 'is missing' }, // <= wrong { _tag: 'Missing', path: [ 'c' ], message: 'message2' }, { _tag: 'Missing', path: [ 'd' ], message: 'is missing' } // <= wrong ] */After
import { Console, Effect, ParseResult, Schema } from "effect" const schema = Schema.Struct({ a: Schema.propertySignature(Schema.String).annotations({ missingMessage: () => "message1" }), b: Schema.propertySignature(Schema.String) .annotations({ missingMessage: () => "message2" }) .pipe(Schema.fromKey("c")), // <= transformation d: Schema.propertySignature(Schema.String).annotations({ missingMessage: () => "message3" }) }) Effect.runPromiseExit( Schema.decodeUnknown(schema, { errors: "all" })({}).pipe( Effect.tapError((error) => Console.log(ParseResult.ArrayFormatter.formatErrorSync(error)) ) ) ) /* Output: [ { _tag: 'Missing', path: [ 'a' ], message: 'message1' }, { _tag: 'Missing', path: [ 'c' ], message: 'message2' }, { _tag: 'Missing', path: [ 'd' ], message: 'message3' } ] */Fix the behavior of
Schema.TemplateLiteralParserwhen the arguments include literals other than string literals.Before
import { Schema } from "effect" const schema = Schema.TemplateLiteralParser(Schema.String, 1) console.log(Schema.decodeUnknownSync(schema)("a1")) /* throws ParseError: (`${string}1` <-> readonly [string, 1]) └─ Type side transformation failure └─ readonly [string, 1] └─ [1] └─ Expected 1, actual "1" */After
import { Schema } from "effect" const schema = Schema.TemplateLiteralParser(Schema.String, 1) console.log(Schema.decodeUnknownSync(schema)("a1")) // Output: [ 'a', 1 ]
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.