Skip to content

Function: multiple()

WARNING

This API is experimental and may change in future versions.

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
declare function multiple<S extends CombinatorSchema<unknown>>(schema: S): WithFlag<S, CombinatorMultiple>

Type Parameters

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

Parameters

NameTypeDescription
schemaSThe base combinator schema.

Returns

WithFlag<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.