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

Composition and generics #86

Open
wclr opened this issue Aug 27, 2016 · 3 comments
Open

Composition and generics #86

wclr opened this issue Aug 27, 2016 · 3 comments
Assignees

Comments

@wclr
Copy link
Contributor

wclr commented Aug 27, 2016

This errors:

R.compose(R.fromPairs)([['1','A'], ['2','B'], ['3','C']])
[ts] Argument of type '[string, string][]' is not assignable to parameter of type 'KeyValuePair<number, any>[]'.
  Type '[string, string]' is not assignable to type 'KeyValuePair<number, any>'.
    Types of property '0' are incompatible.
      Type 'string' is not assignable to type 'number'.

Though this works as it should (without compose and with numbered index)

R.fromPairs([['1','A'], ['2','B'], ['3','C']])

R.compose(R.fromPairs)([[1,'A'], [2,'B'], [3,'C']])
@KiaraGrouwstra
Copy link
Member

Thank you for posting this.
From what I can see, this issue relates to interaction between composition and functions with generics. The more recent thread #92 appeared to be about the same problem. I currently intend to track this issue in #78, about currying rather than composition but otherwise seemingly the same issue. I've integrated your example into the test suite, so we won't forget.
I agree inference failing here is a significant issue, and I hope we can find a solution.

@KiaraGrouwstra
Copy link
Member

Minimum reproduction: R.pipe(R.identity) kills generics, degenerating to {} => {}.

@KiaraGrouwstra KiaraGrouwstra changed the title Issue with compose and fromPairs Composition and generics Dec 11, 2016
@KiaraGrouwstra
Copy link
Member

Comes down to microsoft/TypeScript#16072 (comment). May get viable after microsoft/TypeScript#6606.

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

2 participants