Skip to content

gunshi / combinators / string

Function: string()

ts
function string(opts?): CombinatorSchema<string>;

Experimental

Create a string argument schema with optional validation.

Parameters

ParameterTypeDescription
opts?StringOptionsValidation options.

Returns

CombinatorSchema<string>

A combinator schema that resolves to string.

Example

ts
const args = {
  name: string({ minLength: 1, maxLength: 50 })
}

Released under the MIT License.