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

latest releases: @effect/rpc@0.44.22, @effect/vitest@0.13.15, @effect/typeclass@0.29.15...
8 months ago

Patch Changes

  • #2209 5d30853 Thanks @steffanek! - Add pickLiteral to Schema so that we can pick values from a Schema literal as follows:

    import * as S from "@effect/schema/Schema";
    
    const schema = S.literal("a", "b", "c").pipe(S.pickLiteral("a", "b")); // same as S.literal("a", "b")
    
    S.decodeUnknownSync(schema)("a"); // ok
    S.decodeUnknownSync(schema)("b"); // ok
    S.decodeUnknownSync(schema)("c");
    /*
    Error: "a" | "b"
    ├─ Union member
    │  └─ Expected "a", actual "c"
    └─ Union member
       └─ Expected "b", actual "c"
    */
  • #2217 6e350ed Thanks @gcanti! - JSONSchema: prune UndefinedKeyword if the property signature is marked as optional and contains a union that includes UndefinedKeyword, closes #2068

Don't miss a new effect release

NewReleases is sending notifications on new releases.