Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using groupBy with path always fails typecheck #434

Open
wbusby88 opened this issue Apr 6, 2019 · 0 comments
Open

Using groupBy with path always fails typecheck #434

wbusby88 opened this issue Apr 6, 2019 · 0 comments

Comments

@wbusby88
Copy link

wbusby88 commented Apr 6, 2019

Hi,

I come across this issue where using groupBy(path(['some', 'path']) will always fail the typechecking as the path definition of path is to return T | undefined. You get the "Type string | undefined does not match....".

I'm not entirely sure of the best way you could handle this as the typing is correct to how path works, but thought it was worth opening an issue to see your thoughts.

For anyone who is stuck on how to make the typechecking pass, you can do something like the below:

groupBy<MyType>(path(['some', 'deep', 'prop']) as (a: MyType) => string);

You can always use as any but that's not always an ideal solution. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant