import {Schema as S} from "@effect/schema"const A = S.Struct({ name: S.Literal("a"), other: S.NullOr(S.String)})const B = S.Struct({ name: S.Literal("b"), other: S.NullOr(S.String)})type AB = typeof AB.Typeconst AB = S.Union(A, B)const C = S.Struct({ id: AB.pipe(S.pick("name")) // Here's the problem: id should be "a" | "b" and not {name: "a" | "b"} // ...other fields})
import {Schema as S} from "@effect/schema"const A = S.Struct({ name: S.Literal("a"), other: S.NullOr(S.String)})const B = S.Struct({ name: S.Literal("b"), other: S.NullOr(S.String)})type AB = typeof AB.Typeconst AB = S.Union(A, B)const C = S.Struct({ id: AB.pipe(S.pick("name")) // Here's the problem: id should be "a" | "b" and not {name: "a" | "b"} // ...other fields})