I want to create an NgRx action creator factory. But I don't know how it is possible to pass in a generic type to the props method.
import { createAction, props } from "@ngrx/store";
function actionFactory<T>(name: string) {
return createAction(name, props<T>());
// ^^^^^^^^^^
}
It throws this error
Type 'Props<T>' provides no match for the signature '(...args: any[]): object'
How do I need to modify the factory method to pass a generic type into the props method like this?:
const action = actionFactory<{ id: string }>("sample");
You can try it yourself on Stackblitz