rxjs 7 update – Subject – Expected 1 arguments, but got 0

tl;dr:

Either indicate the type explicitly with void:

new Subject<void>();

or pass a fake value:

this.destroy$.next(true);

Rxjs 7 changes

After checking the changelog and several github issues about this situation,

Subject: resolve issue where Subject constructor errantly allowed an argument (#5476) (e1d35dc)

Subject: no default generic (e678e81)

Changelog 7.0.0-beta.1 and the commit where empty value is removed from the tests

enter image description here

I realized that the solution was to either provide a value or simply typecast the Subject with <void> as in destroy$ = new Subject<void>() if you want to next it with an empty value.

Leave a Comment