【发布时间】:2018-08-14 16:26:12
【问题描述】:
我有一个 Aurelia CLI (0.33) 应用程序(Webpack 4,Typescript)并使用 aurelia-store。
main.ts 包含
import { initialState } from './state';
...
aurelia.use.plugin(PLATFORM.moduleName('aurelia-store'), { initialState });
我的状态.ts
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 时,我得到一个编译器错误提示“TS2339:“可观察”类型上不存在属性“pluck”。
我尝试过: - 删除节点模块 - 纱线安装 - npm 安装
错误仍然存在。
package.json
...
"aurelia-store": "^1.0.0",
"rxjs": "^6.2.2",
...
有什么想法可能是错的吗?
【问题讨论】:
标签: aurelia aurelia-store