Closed nbhat000 closed 3 years ago
Hi
Thank you for the PR and for thinking of others.
Not using the return keyword with effects is very common to keep them more readable and concise. I am unsure why you needed to do this to make it work but encourage you to experiment with your local code to make it work. Likely in other effects, we make in the course it is working for you?
This is more a JavaScript question as using an unbraced fat arrow function like this very common.
I would prefer not to change this for everyone as it is not the real solution for everyone.
@duncanhunter thanks for the reply! I actually had to add this within all the concatMap
's on mine to get rid of the error (add, update, delete). Not sure why that is. If it isn't a more common issue for others then feel free to close the PR. Thanks!
Interesting that you ran into this issue.
According to the JavaScript documentation on Arrow function expressions here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
The return
statement is only required for multi-line arrow functions. The return
should not be necessary in these examples.
Is it possible you have an eslint rule set for explicit-function-return-type
that could be causing this?
I'm closing this for now, but will reopen later if necessary.
When using the updateProducts method, I got the below error:
Argument of type '(action: { product: Product; } & TypedAction<"[Product] Update Product">) => void' is not assignable to parameter of type '(value: { product: Product; } & TypedAction<"[Product] Update Product">, index: number) => ObservableInput<any>'.Type 'void' is not assignable to type 'ObservableInput<any>'.ts(2345)
Adding a
return
statement as shown in code fixed this