in angular application when defining actions and using props, I get "No overload matches this call ..." on props
import { createAction, props } from "@ngrx/store";
export const storeCurrentDashboard = createAction(
"[effect] store current dashboard in state",
props<Dashboard>()// here i get the error
);
and the Dashboard class is like below
export class Dashboard {
id: number;
title: string;
type: DashboardType; // the problem is this property
blocks?: any[];
}
export enum DashboardType {
Private = "Private",
Shared = "Shared",
...
}
and if i remove "type" property which is an enum every thing is ok. why props have problem with enum types?
compiler error:
ERROR in ...: error TS2345: Argument of type '"type property is not allowed in action creators"'
is not assignable to parameter of type 'FunctionWithParametersType<any[], object>'.
and if i remove "type" property which is an enum every thing is ok. why props have problem with enum types?
Yes type
is like a reserved word for NgRx
, in the createAction
call, it matches the first param.