Skip to main content
On this pageFunctions

Schema

Functions

ts

functionsource
/**
 * 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>

Types

CallableTaggedStruct

typesource
/** 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) => Types.Simplify<S.Struct.Type<{
    _tag: S.tag<Tag>
  } & Fields>>
  : (value: Parameters<S.TaggedStruct<Tag, Fields>["make"]>[0]) => Types.Simplify<S.Struct.Type<{
    _tag: S.tag<Tag>
  } & Fields>>

Stay in the update loop.

New releases, patterns, and the occasional deep dive.


Built with Foldkit.

© 2026 Devin Jameson