Deprecation warning on a complete callback without any complete callback

Current Behavior

When I subscribe to an observable, I get the deprecation warning subscribe is deprecated: Use an observer instead of a complete callback even though I’m not using any complete callback.

Expected behavior

There should be no deprecation warning

Reproduction

import { Observable, Subject } from 'rxjs';

const somethingHappened: Subject<void> = new Subject();
const somethingHappened$: Observable<void> = somethingHappened.asObservable();

// Deprecation warning on the next line
somethingHappened$.subscribe(() => {
  console.log('something happened');
});

somethingHappened.next();

Environment

  • Node v15.10.0
  • RxJS v6.6.6
  • TypeScript 4.2.2

Additional context

I don’t really know if this is an issue from RxJS or TypeScript, I didn’t had this issue before, but I recently upgraded to TypeScript 4.2.2 (I was using TypeScript 4.1.5 before).

2 thoughts on “Deprecation warning on a complete callback without any complete callback

  1. I tried with tslint v6.1.3, but I got the same problem using eslint v7.21.0 and eslint-plugin-deprecation v1.2.0.

    I think we should open an issue on TypeScript.