Current Behavior
Consider an Angular project with the following code:
app.component.ts:
import { Router } from '@angular/router';
import { merge, of } from 'rxjs';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
})
export class AppComponent {
constructor(router: Router) {
merge(
of(null),
router.events
);
}
}
Running the linter within the Angular CLI project with the command ng lint, the following warning is thrown:
WARNING: /code/src/app/app.component.ts:13:5 - merge is deprecated: use {@link scheduled} and {@link mergeAll} (e.g. `scheduled([ob1, ob2, ob3], scheduled).pipe(mergeAll())
Reproduction
app.component.ts.ng lintExpected behavior
No deprecation warning for static merge function with two argument Observables.
Environment
> ng "version"
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ â–³ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 8.3.6
Node: 10.16.0
OS: linux x64
Angular: 8.2.8
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
------------------------------------------------------------
@angular-devkit/architect 0.802.2
@angular-devkit/build-angular 0.802.2
@angular-devkit/build-ng-packagr 0.802.2
@angular-devkit/build-optimizer 0.802.2
@angular-devkit/build-webpack 0.802.2
@angular-devkit/core 8.2.2
@angular-devkit/schematics 8.3.6
@angular/cli 8.3.6
@ngtools/webpack 8.2.2
@schematics/angular 8.3.6
@schematics/update 0.803.6
ng-packagr 5.5.1
rxjs 6.5.3
typescript 3.5.3
webpack 4.38.0
Additional context/Screenshots
I noticed that if I make the router.events the first argument, then no deprecation warning is thrown while linting:
merge(
router.events,
of(null) );
)
I just discovered the same issue with the following code snippet:
import { FormControl } from '@angular/forms';
import { merge } from 'rxjs';
const control = new FormControl();
merge(
control.statusChanges,
control.valueChanges
);
Workaround:
const control = new FormControl();
merge(...[
control.statusChanges,
control.valueChanges
]);
Same here... Seems kind of weird resolving the problem with a workaround @samherrmann suggested (however it works, thanks).
Even with @samherrmann workaround I still get the deprecated symbol in Webstorm
Most helpful comment
I just discovered the same issue with the following code snippet:
Workaround: