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.

Signature

ts
declare function multiple<T>(schema: CombinatorSchema<T>): CombinatorSchema<T> & CombinatorMultiple

Type Parameters

NameDescription
TThe schema's parsed type.

Parameters

NameTypeDescription
schemaCombinatorSchema<T>The base combinator schema.

Returns

CombinatorSchema<T> & CombinatorMultiple — A new schema with multiple: true.

Examples

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

Released under the MIT License.