Skip to main content

ObserverLike

Minimal observer contract accepted from an asynchronous validation source.

Import

import type { ObserverLike } from '@ngblocks/form-nodes';

When to use it

Use when implementing an observable-like validator source. Deliver values and completion or errors according to the observer contract.

Declaration

type ObserverLike<TValue> = {
next(value: TValue): void;
error(error: unknown): void;
complete(): void;
};

Type parameters

ParameterConstraintDefault
TValueUnconstrainedRequired

Declared members

The declaration above also includes inherited contracts and overloads where applicable.

MemberMeaning
nextEmits the validation result for the current run. Only the first emission is used.
errorReports a source failure to the validator's configured onError handler.
completeCompletes the source. Completing before an emission is treated as successful validation.