Class StringType<TRequired>

String type definition with common helpers.

Type Parameters

  • TRequired extends boolean = false

Hierarchy (View Summary)

Constructors

Properties

_required: boolean
defaultValue?:
    | TypeOutput<string, TRequired>
    | () => TypeOutput<string, TRequired>
enumValues: string[]
hasDefault: boolean
isSensitive: boolean
isVirtual: boolean
maxLength: number
minLength: number
options: Record<string, unknown>
validators: ValidatorFunction<string>[]

Methods

  • Configure a default value (or factory) for the field.

    Parameters

    Returns this

  • Parameters

    • values: string | string[]

    Returns this

  • Flag the field as sensitive so joins/exposures can omit it by default.

    Parameters

    • isSensitive: boolean = true

    Returns this

  • Parameters

    • _version: number = 4

    Returns this

  • Validate the supplied value and return the normalized result.

    Parameters

    • value: unknown
    • fieldName: string = 'field'

    Returns TypeOutput<string, TRequired>