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. :)
Hi,
I come across this issue where using
groupBy(path(['some', 'path'])
will always fail the typechecking as the path definition ofpath
is to returnT | 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:
You can always use
as any
but that's not always an ideal solution. :)