Defjs
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 item and outputs a new array. A non-array fails with invalid_type (expected array).

  • Parsing stops at the first failing element, and issue.path holds its index.

  • Throws TypeError when item is not a struct.

ArrayStruct<S> is not exported. It is a Struct<StructInput<S>[], Infer<S>[]>.

Parameters

Prop

Type

item S
Edit this page on GitHub
Released under the MIT License. · Copyright © 2026 MunMunMiao