0.1.14 (#15)
Co-authored-by: Julien Valverdé <julien.valverde@mailo.com> Reviewed-on: #15
This commit was merged in pull request #15.
This commit is contained in:
@@ -2,7 +2,14 @@ import { Schema } from "@effect/schema"
|
||||
|
||||
|
||||
export const Kind = <Kind extends string>(kind: Kind) =>
|
||||
Schema.withConstructorDefault(
|
||||
Schema.propertySignature(Schema.Literal(kind)),
|
||||
() => kind,
|
||||
Schema.Literal(kind).pipe(
|
||||
Schema.propertySignature,
|
||||
Schema.withConstructorDefault(() => kind),
|
||||
)
|
||||
|
||||
export const KindWithDecodingDefault = <Kind extends string>(kind: Kind) =>
|
||||
Schema.Literal(kind).pipe(
|
||||
Schema.optional,
|
||||
Schema.withConstructorDefault(() => kind),
|
||||
Schema.withDecodingDefault(() => kind),
|
||||
)
|
||||
|
||||
@@ -2,7 +2,14 @@ import { Schema } from "@effect/schema"
|
||||
|
||||
|
||||
export const Tag = <Tag extends string>(tag: Tag) =>
|
||||
Schema.withConstructorDefault(
|
||||
Schema.propertySignature(Schema.Literal(tag)),
|
||||
() => tag,
|
||||
Schema.Literal(tag).pipe(
|
||||
Schema.propertySignature,
|
||||
Schema.withConstructorDefault(() => tag),
|
||||
)
|
||||
|
||||
export const TagWithDecodingDefault = <Tag extends string>(tag: Tag) =>
|
||||
Schema.Literal(tag).pipe(
|
||||
Schema.optional,
|
||||
Schema.withConstructorDefault(() => tag),
|
||||
Schema.withDecodingDefault(() => tag),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user