Struct
Public struct contract: input and output types, modifier methods, and the _struct type brand.
@defjs/core · Type
Signature
type Struct< Input = unknown, Output = Input, OptionalOut extends boolean = false, > = StructMethods<Input, Output, OptionalOut> & StructLike<Input, Output, OptionalOut>;
A parseable shape. Input is what it accepts (StructInput), Output is what a successful parse returns (Infer), and OptionalOut marks a field that may be absent from object output.
Build structs with the struct facade (struct.string(), struct.object(), …). Every modifier in StructMethods returns a new struct and leaves the original unchanged.
Members
Prop
Type
alias (name: string) => Struct<Input, Output, OptionalOut>Override the external wire name for this field without changing the TypeScript property name.
null () => Struct<Input | null, Output | null, OptionalOut>Allow null in addition to the current input and output types.
nullable () => Struct<Input | null, Output | null, OptionalOut>Alias for StructMethods.null.
nullish () => Struct<Input | null | undefined, Output | null | undefined, true>Allow null or undefined, marking the field optional in object output.
optional () => Struct<Input | undefined, Output | undefined, true>Allow undefined, marking the field optional in object shapes.
_struct StructTypes<Input, Output, OptionalOut>Phantom payload. optionalOut is true only when this struct's output fields may be absent.