On this pageFunctions
Schema
Wraps Schema.TaggedStruct to create a callable tagged struct you can call directly as a constructor.
Use ts for non-message, non-route tagged structs — enabling Loading()
instead of Loading.make().
<Tag extends string>(tag: Tag): CallableTaggedStruct<Tag, {}>
<Tag extends string, Fields extends Fields>(
tag: Tag,
fields: Fields
): CallableTaggedStruct<Tag, Fields>A TaggedStruct schema that can be called directly as a constructor: Foo({ count: 1 }) instead of Foo.make({ count: 1 }).
type CallableTaggedStruct = S.TaggedStruct<Tag, Fields> & keyof Fields extends never
? (value?: Parameters<S.TaggedStruct<Tag, Fields>["make"]>[0] | void) => S.Simplify<S.Struct.Type<{
_tag: S.tag<Tag>
} & Fields>>
: (value: Parameters<S.TaggedStruct<Tag, Fields>["make"]>[0]) => S.Simplify<S.Struct.Type<{
_tag: S.tag<Tag>
} & Fields>>