Core
struct.array
Struct that parses an array with one item struct.
@defjs/core · Function
Signature
function array< S extends StructLike<unknown, unknown, boolean>, >(item: S): ArrayStruct<S>;
-
Parses every element with
itemand outputs a new array. A non-array fails withinvalid_type(expectedarray). -
Parsing stops at the first failing element, and
issue.pathholds its index. -
Throws
TypeErrorwhenitemis not a struct.
ArrayStruct<S> is not exported. It is a Struct<StructInput<S>[], Infer<S>[]>.
Parameters
Prop
Type
item S