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

latest releases: @effect/sql-sqlite-wasm@0.21.1, @effect/sql-sqlite-bun@0.21.8, @effect/sql-libsql@0.9.8...
7 months ago

Patch Changes

  • #2446 62a7f23 Thanks @gcanti! - ParseResult: Add output field to TupleType and TypeLiteral. While the operation may not be entirely successful, it still provides some useful output or information.

    Examples (Tuple)

    import * as S from "@effect/schema/Schema";
    import * as Either from "effect/Either";
    
    const schema = S.array(S.number);
    const result = S.decodeUnknownEither(schema)([1, "a", 2, "b"], {
      errors: "all",
    });
    if (Either.isLeft(result)) {
      const issue = result.left.error;
      if (issue._tag === "TupleType") {
        console.log(issue.output); // [1, 2]
      }
    }

    Examples (TypeLiteral)

    import * as S from "@effect/schema/Schema";
    import * as Either from "effect/Either";
    
    const schema = S.record(S.string, S.number);
    const result = S.decodeUnknownEither(schema)(
      { a: 1, b: "b", c: 2, d: "d" },
      { errors: "all" },
    );
    if (Either.isLeft(result)) {
      const issue = result.left.error;
      if (issue._tag === "TypeLiteral") {
        console.log(issue.output); // { a: 1, c: 2 }
      }
    }
  • #2453 7cc2b41 Thanks @jessekelly881! - added Schema.BooleanFromUnknown

  • #2456 8b46fde Thanks @gcanti! - add set, setFromSelf, map, mapFromSelf

  • Updated dependencies [5170ce7]:

    • effect@2.4.16

Don't miss a new effect release

NewReleases is sending notifications on new releases.