Closed dotlouis closed 6 years ago
@dotlouis did you find a solution for this other than the workaround?
@nathanmarks Actually no, I'm still using the workaround, but this is the least bad solution I have found.
Now that ngrx@4 is out, we don't really have a use for the compose function since the StoreModule will take a map of reducers and an array meta-reducers. https://github.com/ngrx/platform/blob/master/docs/store/api.md#meta-reducers
I now do:
StoreModule.forRoot({
state: someReducer
}, {
metaReducers: myMetaReducerArray,
}),
Hi, I just ran into an issue: When I call the compose function like this:
Typescript compiles but throws on execution because it fails at destructuring the array of functions thus register the argument as an array. But the compose signature says that i could use an array:
Alright, you could say that I can destructure the array by myself or NOT put functions into any array in the first place like this:
But it causes Typescript >= 2.4 to throw on compile:
Cannot invoke an expression whose type lacks a call signature. Type '{}' has no compatible call signatures.
I found a workaround by doing so but it feels wrong to "cast" as any
The problem I think does not comes from your code because you do destructure functions: https://github.com/ngrx/core/blob/master/src/compose.ts#L12 So maybe the issue comes from the typscript compiler or maybe there is something I don't understand. Do you have any idea on what causes the array of function in the compose function not to work ?