import { NEVER, Observable, of, Subscription, throwError } from "rxjs";
import { catchError, map, takeUntil } from "rxjs/operators";

const userland = <T>(selector: (t: T) => T) => map(selector);

class Something {
    deep = {
        catchError(error: any): Observable<never> { return throwError(error); },
        complete(): void {},
        error(error: any): void {},
        map<T>(t: T): T { return t; },
        next<T>(t: T): void {},
        tearDown(): void {}
    }
    someObservable = NEVER;
    constructor() {
        const ob = of(1).pipe(
            map(this.deep.map),
                ~~~~~~~~~~~~~                                                       [no-unbound-methods]
            userland(this.deep.map),
                     ~~~~~~~~~~~~~                                                  [no-unbound-methods]
            takeUntil(this.someObservable),
            catchError(this.deep.catchError)
                       ~~~~~~~~~~~~~~~~~~~~                                         [no-unbound-methods]
        ).subscribe(
            this.deep.next,
            ~~~~~~~~~~~~~~                                                          [no-unbound-methods]
            this.deep.error,
            ~~~~~~~~~~~~~~~                                                         [no-unbound-methods]
            this.deep.complete
            ~~~~~~~~~~~~~~~~~~                                                      [no-unbound-methods]
        );
        const subscription = new Subscription(this.deep.tearDown);
                                              ~~~~~~~~~~~~~~~~~~                    [no-unbound-methods]
        subscription.add(this.deep.tearDown);
                         ~~~~~~~~~~~~~~~~~~                                         [no-unbound-methods]
    }
}

[no-unbound-methods]: Unbound methods are forbidden
