运行 rxjs 迁移工具后使用
rxjs-5-to-6-migrate -p src/tsconfig.app.json
我现在收到一个 linting 错误:
不推荐使用 combineLatest:不推荐使用静态 combineLatest。
这是我在运行迁移命令之前的代码:
this.store.combineLatest(
this.store.select(lang.getCurrent),
this.store.select(lang.getCurrentLocale)
).subscribe(([state, currentLang, locale]) => {
this._language = session.language === currentLang ? '' : currentLang;
this._locale = session.locale === locale ? '' : locale;
});
运行迁移命令后我的代码:(当前出现 linting 错误)
import {map, combineLatest} from 'rxjs/operators';
this.store.combineLatest(
this.store.select(lang.getCurrent),
this.store.select(lang.getCurrentLocale)
).subscribe(([state, currentLang, locale]) => {
this._language = session.language === currentLang ? '' : currentLang;
this._locale = session.locale === locale ? '' : locale;
});
这个问题是在这个stackoverflow问题中提出的,但它不够具体:Angular 6 ng lint duplicate errors and warnings, combineLatest is deprecated 。