Packages

effect

4.1.4 · 11 Nov 2026MIT67.1M / weekRepositoryHomepagenpmAtom feed

Your version

3.13.12

17 Mar 2025Where it was published

3.22.5 is the newest release of 3.x.

In short

1 new1 fixed

Security

2 advisories affect 3.13.12; 3.22.1 fixes them

Release note

Patch Changes

  • Preserve specific annotations (e.g., arbitrary) when using Schema.typeSchema, closes #4609.

    Previously, annotations such as arbitrary were lost when calling Schema.typeSchema on a transformation. This update ensures that certain annotations, which depend only on the "to" side of the transformation, are preserved.

    Annotations that are now retained:

    • examples

    • default

    • jsonSchema

    • arbitrary

    • pretty

    • equivalence

    Example

    Before

    import { Arbitrary, FastCheck, Schema } from "effect"
    
    const schema = Schema.NumberFromString.annotations({
      arbitrary: () => (fc) => fc.constant(1)
    })
    
    const to = Schema.typeSchema(schema) // ❌ Annotation is lost
    
    console.log(FastCheck.sample(Arbitrary.make(to), 5))
    /*
    [
      2.5223372357846707e-44,
      -2.145443957806771e+25,
      -3.4028179901346956e+38,
      5.278086259208735e+29,
      1.8216880036222622e-44
    ]
    */

    After

    import { Arbitrary, FastCheck, Schema } from "effect"
    
    const schema = Schema.NumberFromString.annotations({
      arbitrary: () => (fc) => fc.constant(1)
    })
    
    const to = Schema.typeSchema(schema) // ✅ Annotation is now preserved
    
    console.log(FastCheck.sample(Arbitrary.make(to), 5))
    /*
    [ 1, 1, 1, 1, 1 ]
    */
  • Add support for jsonSchema annotations on SymbolFromSelf index signatures.

    Before

    import { JSONSchema, Schema } from "effect"
    
    const schema = Schema.Record({
      key: Schema.SymbolFromSelf.annotations({ jsonSchema: { type: "string" } }),
      value: Schema.Number
    })
    
    JSONSchema.make(schema)
    /*
    throws:
    Error: Unsupported index signature parameter
    schema (SymbolKeyword): symbol
    */

    After

    import { JSONSchema, Schema } from "effect"
    
    const schema = Schema.Record({
      key: Schema.SymbolFromSelf.annotations({ jsonSchema: { type: "string" } }),
      value: Schema.Number
    })
    
    console.log(JSON.stringify(JSONSchema.make(schema), null, 2))
    /*
    Output:
    {
      "$schema": "http://json-schema.org/draft-07/schema#",
      "type": "object",
      "required": [],
      "properties": {},
      "additionalProperties": {
        "type": "number"
      },
      "propertyNames": {
        "type": "string"
      }
    }
    */

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.