0

I've got an Aurelia CLI (0.33) application (Webpack 4, Typescript) and using aurelia-store.

main.ts includes

import { initialState } from './state';

...

aurelia.use.plugin(PLATFORM.moduleName('aurelia-store'), { initialState });

My state.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: []
};

My view class:

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;
}

If I don't use PLUCK (@connectTo() only), I can use store.meals in my view and all works fine, but when I try to use pluck, I get an error in compiler saying 'TS2339: Property 'pluck' does not exist on type 'Observable<{}>'.'

I have tried: - remove node_modules - yarn install - npm install

and the error is still there.

package.json

...
"aurelia-store": "^1.0.0",
"rxjs": "^6.2.2",
...

Any ideas what could be wrong?

vidriduch
  • 4,753
  • 8
  • 41
  • 63

1 Answers1

1

The syntax for pluck is new with RxJs 6. You need the pipe operator and pass in pluck there. There is also a GitHub issue for your question in the official repo https://github.com/aurelia/store/issues/25

zewa666
  • 2,593
  • 17
  • 20