Type Alias Observer<T>

Observer: (NextObserver<T> | ErrorObserver | CompleteObserver) & {
    complete(value?: unknown): void;
    error(error: Error): void;
    next(value: T): void;
    start(subscription: Subscription): void;
}

Observer interface type. It is constructed as a union type to ensure that at least one of the next/error/complete properties is set.

Type Parameters

  • T = unknown

Type declaration

  • complete?:function
    • Receives a completion notification.

      Parameters

      • Optionalvalue: unknown

        Optional completion value. This is not documented in the spec but used in the specs unit tests.

      Returns void

  • error?:function
    • Receives the sequence error.

      Parameters

      • error: Error

        The error.

      Returns void

  • next?:function
    • Receives the next value in the sequence.

      Parameters

      • value: T

        The next value in the sequence. Undefined when observable doesn't have a value type.

      Returns void

  • start?:function
    • Receives the subscription object when subscribe is called.

      Parameters

      Returns void