Skip to content

Function: string() ​

WARNING

This API is experimental and may change in future versions.

Create a string argument schema with optional validation.

Signature ​

ts
declare function string(opts?: StringOptions): CombinatorSchema<string>

Parameters ​

NameTypeDescription
optsStringOptionsValidation options. (optional)

Returns ​

CombinatorSchema<string> — A combinator schema that resolves to string.

Examples ​

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

Released under the MIT License.