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

latest releases: @effect/sql-sqlite-wasm@0.20.4, @effect/typeclass@0.29.13, @effect/vitest@0.13.13...
3 months ago

Patch Changes

  • #3359 7c0da50 Thanks @gcanti! - Add Context field to Schema interface, closes #3356

  • #3363 2fc0ff4 Thanks @gcanti! - export isPropertySignature guard

  • #3357 f262665 Thanks @gcanti! - Improve annotation retrieval from Class APIs, closes #3348.

    Previously, accessing annotations such as identifier and title required explicit casting of the ast field to AST.Transformation.
    This update refines the type definitions to reflect that ast is always an AST.Transformation, eliminating the need for casting and simplifying client code.

    import { AST, Schema } from "@effect/schema";
    
    class Person extends Schema.Class<Person>("Person")(
      {
        name: Schema.String,
        age: Schema.Number,
      },
      { description: "my description" },
    ) {}
    
    console.log(AST.getDescriptionAnnotation(Person.ast.to));
    // { _id: 'Option', _tag: 'Some', value: 'my description' }
  • #3343 9bbe7a6 Thanks @gcanti! - - add NonEmptyTrimmedString

    Example

    import { Schema } from "@effect/schema";
    
    console.log(Schema.decodeOption(Schema.NonEmptyTrimmedString)("")); // Option.none()
    console.log(Schema.decodeOption(Schema.NonEmptyTrimmedString)(" a ")); // Option.none()
    console.log(Schema.decodeOption(Schema.NonEmptyTrimmedString)("a")); // Option.some("a")
    • add OptionFromNonEmptyTrimmedString, closes #3335

      Example

      import { Schema } from "@effect/schema";
      
      console.log(Schema.decodeSync(Schema.OptionFromNonEmptyTrimmedString)("")); // Option.none()
      console.log(
        Schema.decodeSync(Schema.OptionFromNonEmptyTrimmedString)(" a "),
      ); // Option.some("a")
      console.log(Schema.decodeSync(Schema.OptionFromNonEmptyTrimmedString)("a")); // Option.some("a")
  • Updated dependencies [6359644, 7f41e42, f566fd1]:

    • effect@3.5.9

Don't miss a new effect release

NewReleases is sending notifications on new releases.