我有一个Aurelia CLI(0.33)应用程序(Webpack 4,Typescript)并使用aurelia-store。
main.ts包括
import { initialState } from './state';
...
aurelia.use.plugin(PLATFORM.moduleName('aurelia-store'), { initialState });
我的状态。
import { Meal } from './models/Meal';
export interface State {
meals: Meal[],
numbers: number[]
}
export const initialState: State = {
meals: [{key: '', name: 'EMPTY', description: '', vegetarian: false}],
numbers: []
};
我的视图类:
import { connectTo } from 'aurelia-store';
import { pluck } from 'rxjs/operators';
import { State } from './../../state';
@connectTo((store) => store.state.pluck("meals"))
export class BookMeals {
public state: State;
}
如果我不使用PLUCK(仅 @connectTo()),则可以在视图中使用store.meals,并且一切正常,但是当我尝试使用pluck时,
在类型为“ Observable <{}>”上的编译器中显示“ TS2339:属性'pluck'不存在”的错误。我尝试过: -删除node_modules -纱线安装 -npm安装
并且错误仍然存在。
package.json
...
"aurelia-store": "^1.0.0",
"rxjs": "^6.2.2",
...
任何想法可能有什么问题吗?
答案 0 :(得分:1)
RxJs 6中pluck的语法是新的。您需要管道运算符并在其中传递pluck。官方存储库https://github.com/aurelia/store/issues/25
中还有一个关于您问题的GitHub问题。