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

latest releases: @effect/sql-sqlite-node@0.21.7, @effect/sql-sqlite-wasm@0.21.0, @effect/sql-sqlite-bun@0.21.7...
8 months ago

Minor Changes

  • #2101 54ddbb7 Thanks @github-actions! - Updated the MessageAnnotation type to accept a ParseIssue; it's now (issue: ParseResult.ParseIssue) => string to support custom error messages, which can be triggered under any circumstances.

    You can retrieve the actual value by accessing the actual property of the issue object:

    import * as S from "@effect/schema/Schema";
    
    const schema = S.string.pipe(
      S.filter((s): s is string => s.length === 1, {
    -    message: (actual) => `invalid value ${actual}`,
    +    message: (issue) => `invalid value ${issue.actual}`,
      })
    );
  • #2101 a025b12 Thanks @github-actions! - Swap type params of Either from Either<E, A> to Either<R, L = never>.

    Along the same line of the other changes this allows to shorten the most common types such as:

    import { Either } from "effect";
    
    const right: Either.Either<string> = Either.right("ok");

Patch Changes

Don't miss a new effect release

NewReleases is sending notifications on new releases.