Core
StructInput
Type helper that extracts the accepted input type of a struct.
@defjs/core · Type
Signature
type StructInput<T> = T extends { readonly _struct: { readonly input: unknown }; } ? T["_struct"]["input"] : never;
The type a struct accepts, as opposed to Infer, which is what a successful parse returns. T is a struct, or any StructLike. Anything else gives never.
The two differ when a struct converts its input:
const Created = struct.date();
type In = StructInput<typeof Created>; // Date | number | string
type Out = Infer<typeof Created>; // Date