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

latest releases: @effect/schema@0.68.12, @effect/typeclass@0.24.37, @effect/vitest@0.5.21...
2 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.