Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ValidationState<TValue>

represents state for a value which is validated

useful for user facing components

Type parameters

  • TValue

Hierarchy

  • ValidationState

Implements

Index

Constructors

Properties

Methods

Constructors

Properties

errors: ValidationErrors<TValue>

validation errors

invalid: boolean = false

state is invalid

validate: IValidate<TValue> | IValidateAsync<TValue>
value: TValue = null

Methods

  • if there are changes calls validation and sets errors and invalid properites

    Parameters

    • value: TValue

      value to validate if changed

    • Optional onChange: (newState: ValidationState<TValue>) => void

      a function called when change is made

    Returns Promise<ValidationState<TValue>>

    a new state object if there is change, same if not

Generated using TypeDoc