Skip to content

gunshi / combinators / multiple

Function: multiple()

ts
function multiple<T>(schema): ArgSchema & Combinator<T> & CombinatorMultiple;

Experimental

Mark a combinator schema as accepting multiple values.

The resolved value becomes an array. The original schema is not modified.

Type Parameters

Type ParameterDescription
TThe schema's parsed type.

Parameters

ParameterTypeDescription
schemaCombinatorSchema<T>The base combinator schema.

Returns

ArgSchema & Combinator<T> & CombinatorMultiple

A new schema with multiple: true.

Example

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

Released under the MIT License.