Closed builder7777 closed 5 years ago
Because you declare getMenuItems
as void
type. Please annotate actual function type.
@Action(...) private getMenuItems!: () => void
@ktsn Sorry for digging up old topic, how to use action that take a payload?
I'm gettting Expected 0 arguments, but got 1.
ERROR when declaring it just like that:
@Action private loginUser!: () => void
private authenticate (): void {
this.loginUser({email:this.email, password: this.password});
}
I believe you'd change it to:
@Action private loginUser!: (args: any) => void;
I am getting an error when trying to call an action from store:
The compiler is complaining about
this.getMenuItems()
method call:Cannot invoke an expression whose type lacks a call signature. Type 'void' has no compatible call signatures.
The MainMenu.ts has the following action signature:
I also tried using
@menuModule.Action private itemsFetch!: void;
instead of specifying namespace in the decorator - same result.Am I not using this right or something else is going on?