github Effect-TS/effect @effect/schema@0.68.18

latest releases: @effect/typeclass@0.29.14, @effect/vitest@0.13.14, @effect/sql-sqlite-wasm@0.20.5...
4 months ago

Patch Changes

  • #3192 5d5cc6c Thanks @KhraksMamtsov! - Support Capitalize Uncapitalize filters and schemas

  • #3148 359ff8a Thanks @gcanti! - add Serializable.Serializable.Type and Serializable.Serializable.Encoded

  • #3198 f7534b9 Thanks @gcanti! - Add toString to AST.PropertySignature and AST.IndexSignature and fix type display for IndexSignature.

    Before the Change

    Previously, when a type mismatch occurred in Schema.decodeUnknownSync, the error message displayed for IndexSignature was not accurately representing the type used. For example:

    import { Schema } from "@effect/schema";
    
    const schema = Schema.Record(Schema.Char, Schema.String);
    
    Schema.decodeUnknownSync(schema)({ a: 1 });
    /*
    throws
    ParseError: { readonly [x: string]: string }
    └─ ["a"]
       └─ Expected string, actual 1
    */

    This output incorrectly indicated [x: string] when the actual index type was Char.

    After the Change

    The toString implementation now correctly reflects the type used in IndexSignature, providing more accurate and informative error messages:

    import { Schema } from "@effect/schema";
    
    const schema = Schema.Record(Schema.Char, Schema.String);
    
    Schema.decodeUnknownSync(schema)({ a: 1 });
    /*
    throws
    ParseError: { readonly [x: Char]: string }
    └─ ["a"]
       └─ Expected string, actual 1
    */

    The updated output now correctly displays { readonly [x: Char]: string }, aligning the error messages with the actual data types used in the schema.

  • Updated dependencies [a435e0f, b5554db, a9c4fb3]:

    • effect@3.4.8

Don't miss a new effect release

NewReleases is sending notifications on new releases.