-
Notifications
You must be signed in to change notification settings - Fork 127
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
Add type safe curry
function
#561
Comments
This still requires the user to use a lot of manual typing that can't be inferred. I tried using it with this example and got typing issues. const mapped = pipe(
['a', 'aa', 'aaa'],
curry(map)((x) => x.length),
); The main use for currying is to get inference from Typescript automatically in pipes and as functors. If typing needs to be done manually, it just doesn't provide a lot of additional value over the existing solution. I do think there's room for a const mapped = pipe(
['a', 'aa', 'aaa'],
($) => map($, (x) => x.length),
); which is typed correctly and doesn't require any manual typing. |
Sorry, it was broken codes... I finally made it with |
hm, that still doesn't deal with the previous example const mapped = pipe(
['a', 'aa', 'aaa'],
curry(map)((x) => x.length),
); |
@cjquines It requires type parameters for generic functions... const mapped = pipe(
['a', 'aa', 'aaa'],
curry(map<string, number>)((x) => x.length),
); |
ah... i think this goes against the remeda philosophy though, which is to not have type annotations if possible... |
Related to #560.
I finally found that curry is enough for most users. This worked well with generic-typed functions.
The text was updated successfully, but these errors were encountered: