Skip to content

StringSchema

  • Methods<Native.String, StringSchema>

readonly is: (input) => input is string

unknown

input is string

Methods.is


readonly parse: (input) => Effect<string, ParseError, never>

Checks input and returns it typed, with defaults filled in and unknown object keys removed.

unknown

Effect<string, ParseError, never>

const config = yield* Config.parse(JSON.parse(text));

Methods.parse


readonly schema: String

The Effect schema underneath, for use with effect/Schema.

Methods.schema

default(value): Field<withDecodingDefaultType<String, never>>

Uses value when the input is undefined or an object leaves the key out.

string

Field<withDecodingDefaultType<String, never>>

Methods.default


max(length, message?): StringSchema

number

string

StringSchema


min(length, message?): StringSchema

number

string

StringSchema


nullable(): Schema<NullOr<String>>

Schema<NullOr<String>>

Methods.nullable


optional(): Field<optional<String>>

Allows undefined, and lets an object leave the key out.

Field<optional<String>>

Methods.optional


refine(predicate, message?): StringSchema

(value) => boolean

string

StringSchema

Methods.refine


regex(pattern, message?): StringSchema

RegExp

string

StringSchema