Interface ErrorsPlugin<Error>

The plugin that enables a field errors.

interface ErrorsPlugin<Error> {
    errors: readonly Error[];
    isInvalid: boolean;
    addError(error: Error): void;
    clearErrors(options?: ClearErrorsOptions): void;
    deleteError(error: Error): void;
    getInvalidFields(): BareField<any, any>[];
    on(eventType: "change:errors", subscriber: Subscriber<Error[], any>): Unsubscribe;
}

Type Parameters

  • Error = any

    The error associated with the field.

Properties

errors: readonly Error[]

The array of errors associated with this field.

isInvalid: boolean

true if this field has associated errors, or false otherwise.

Methods

  • Associates an error with the field.

    Parameters

    • error: Error

      The error to add.

    Returns void

  • Deletes all errors associated with this field.

    Parameters

    Returns void

  • Deletes an error associated with this field. No-op if an error isn't associated with this field.

    Parameters

    • error: Error

      The error to delete.

    Returns void

  • Returns all fields that have associated errors.

    Returns BareField<any, any>[]