From fe7783b86e6931201f9d33fc8c28d61398dd7c7c Mon Sep 17 00:00:00 2001 From: Patrick Roza Date: Fri, 29 Nov 2024 10:08:55 +0100 Subject: [PATCH] improve: TaggedUnion .is is now S.is, isA, is the old is --- .changeset/loud-queens-fail.md | 5 +++++ packages/effect-app/src/Schema.ts | 12 ++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 .changeset/loud-queens-fail.md diff --git a/.changeset/loud-queens-fail.md b/.changeset/loud-queens-fail.md new file mode 100644 index 000000000..57692ff47 --- /dev/null +++ b/.changeset/loud-queens-fail.md @@ -0,0 +1,5 @@ +--- +"effect-app": minor +--- + +improve: TaggedUnion .is is now S.is, isA, is the old is diff --git a/packages/effect-app/src/Schema.ts b/packages/effect-app/src/Schema.ts index 450c273c6..8b8f26ef2 100644 --- a/packages/effect-app/src/Schema.ts +++ b/packages/effect-app/src/Schema.ts @@ -151,7 +151,8 @@ export const tags = < > export const ExtendTaggedUnion = ( schema: S.Schema -) => extendM(schema, (_) => ({ is: makeIs(_), isAnyOf: makeIsAnyOf(_) /*, map: taggedUnionMap(a) */ })) +) => + extendM(schema, (_) => ({ is: S.is(schema), isA: makeIs(_), isAnyOf: makeIsAnyOf(_) /*, map: taggedUnionMap(a) */ })) export const TaggedUnion = < // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -159,7 +160,14 @@ export const TaggedUnion = < >(...a: Members) => pipe( S.Union(...a), - (_) => extendM(_, (_) => ({ is: makeIs(_), isAnyOf: makeIsAnyOf(_), tagMap: taggedUnionMap(a), tags: tags(a) })) + (_) => + extendM(_, (_) => ({ + is: S.is(_), + isA: makeIs(_), + isAnyOf: makeIsAnyOf(_), + tagMap: taggedUnionMap(a), + tags: tags(a) + })) ) export type PhoneNumber = PhoneNumberT