此错误通常在ngrx中引起,是因为可能导入了不存在的操作符或在导入代码行之前使用了某些操作符。例如:
import 'rxjs/add/operator/map';
// Other code omitted
export const getBooks = createSelector(
getBooksState,
state => state.books
).map(books => {
// Code omitted
});```
在上面的代码示例中,使用了“map”操作符,但没有从“rxjs/add/operator/map”导入它。解决此问题的方法是在使用操作符之前导入相应的操作符。将上面的示例更改如下:
```import { of } from 'rxjs/observable/of';
import { map } from 'rxjs/operators';
// Other code omitted
export const getBooks = createSelector(
getBooksState,
state => state.books
).pipe(
map(books => {
// Code omitted
})
);```