Skip to content

Function: multiple() ​

Mark a combinator schema as accepting multiple values.

The resolved value becomes an array. The original schema is not modified. Other modifiers on schema (for example required) are kept.

Signature ​

ts
export declare function multiple<S extends CombinatorSchema<unknown>>(schema: S): Modified<S, CombinatorMultiple>

Type Parameters ​

NameDescription
S extends CombinatorSchema<unknown>The input combinator schema.

Parameters ​

NameTypeDescription
schemaSThe base combinator schema.

Returns ​

Modified<S, CombinatorMultiple> — A copy of schema with multiple: true.

Examples ​

ts
const args = {
  tags: multiple(string())
}
// typeof values.tags === string[]

Released under the MIT License.