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

properly handle currying #122

Closed
KiaraGrouwstra opened this issue Dec 19, 2016 · 1 comment
Closed

properly handle currying #122

KiaraGrouwstra opened this issue Dec 19, 2016 · 1 comment

Comments

@KiaraGrouwstra
Copy link
Member

Earlier mentioned here.

We've been using CurriedFunction interfaces, and the current approach had kind of been to, e.g. for an arity-4 function, do the type definition at least 4 times:

  • (a,b,c,d) => Res
  • (a,b,c): (d) => Res
  • (a,b): CurriedFunction2<c,d,Res>
  • (a): CurriedFunction3<b,c,d,Res>
    ... simplifying for brevity.
    In case there would be two distinct definitions for a function (e.g. string and array versions), this would further multiply.

This is a bit of a pain point currently, and I hope we could just do one definition in a single CurriedFunction4 definition for cases like that, although currently it appeared parameterized functions (-> using generics) failed to parse for me that way.

Moreover, TypeScript also does not seem to like the idea of having regular 'function' versions side-by-side as well (needed if definitions using generics have to go the traditional route), while I suppose this curried route would currently also lose parameter names (hopefully improved on in the WIP variadic kinds?).

KiaraGrouwstra added a commit that referenced this issue Dec 19, 2016
Tackling this properly requires proper handling of currying, see #122.
This is not a proper fix, since it doesn't yet understand the
placeholder. But right now the best we could do here is not error right
away.
@KiaraGrouwstra
Copy link
Member Author

See #78 (comment)

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

No branches or pull requests

1 participant