On this pageFunctions
Message
/**
* Declares every Message variant in one object. Each key is a tag, and its
* value lists that Message's fields.
*
* The result is both a Schema and a namespace. Construct a Message with a
* variant such as `Message.ClickedReset()`, and handle every variant with
* `Message.match`. Each constructor is also a Schema, so it can appear in a
* `Command.define` `messages` list.
*
* Message unions intentionally expose only constructors and exhaustive
* `match`. Use Effect `Match` when only some tags need handling or several tags
* share one handler.
*
* Declare a Block's OutMessages in their own `defineMessageUnion`. Messages
* are facts the Block handles; OutMessages are facts it reports to its
* parent. Keep the two unions separate even when two variants carry the same
* fields.
*
* A tag cannot use a name already owned by the union, such as `make`, `match`,
* `matchOrElse`, `cases`, `ast`, `members`, or `subset`. TypeScript rejects
* these names, and untyped calls throw an error.
*/
<CasesByTag extends Record<string, Fields>>(casesByTag: CasesByTag & ValidateVariantNames<CasesByTag>): MessageUnion<CasesByTag>/**
* The Schema returned by `defineMessageUnion`. Each variant is a callable
* property on the union, and `match` handles the union exhaustively. With no
* output type argument, `match` returns the union of the handler results. Pass
* an output type argument when every handler must return that type. Pass a
* structurally refined union as `match`'s optional second type argument to
* preserve narrower payload fields in each handler.
*/
type MessageUnion = UnionSchema<CasesByTag> & {
readonly [Tag in keyof CasesByTag & string]: CallableTaggedStruct<Tag, CasesByTag[Tag]>
}/** A `TaggedStruct` schema that can be called directly as a constructor: `Foo({ count: 1 })` instead of `Foo.make({ count: 1 })`. */
interface CallableTaggedStruct {
constructor: unknown
~effect/Schema/Schema: "~effect/Schema/Schema"
~encoded.mutability: "readonly"
~encoded.optionality: "required"
~type.constructor.default: "no-default"
~type.make: MakeInView<{
[K in string | number | symbol]: {
_tag: tag<Tag>
} & Fields[K]
}>
~type.make.in: MakeInView<{
[K in string | number | symbol]: {
_tag: tag<Tag>
} & Fields[K]
}>
~type.mutability: "readonly"
~type.optionality: "required"
~type.parameters: readonly []
ast: Objects
DecodingServices: DecodingServices<{
[K in string | number | symbol]: {
_tag: tag<Tag>
} & Fields[K]
}>
Encoded: View<{
[K in string | number | symbol]: {
_tag: tag<Tag>
} & Fields[K]
}>
EncodingServices: EncodingServices<{
[K in string | number | symbol]: {
_tag: tag<Tag>
} & Fields[K]
}>
fields: {
[K in string | number | symbol]: {
_tag: tag<Tag>
} & Fields[K]
}
Iso: View<{
[K in string | number | symbol]: {
_tag: tag<Tag>
} & Fields[K]
}>
Rebuild: Struct<{
[K in string | number | symbol]: {
_tag: tag<Tag>
} & Fields[K]
}>
Type: View<{
[K in string | number | symbol]: {
_tag: tag<Tag>
} & Fields[K]
}>
annotate: unknown
annotateKey: unknown
check: unknown
make: unknown
makeEffect: unknown
makeOption: unknown
mapFields: unknown
pipe: unknown
rebuild: unknown
}