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

Allow variadic dependencies as well as an array #27

Closed
ccapndave opened this issue Aug 17, 2015 · 5 comments
Closed

Allow variadic dependencies as well as an array #27

ccapndave opened this issue Aug 17, 2015 · 5 comments

Comments

@ccapndave
Copy link

As well as the current system of createSelector([a, b, c], (a, b, c) => ...) it would be great if it would also be possible to do createSelector(a, b, c, (a, b, c) => ...)

This would allow us to implement robust and strictly typed Typescript definitions on createSelector.

@ellbee
Copy link
Collaborator

ellbee commented Aug 17, 2015

Oh, very interesting. The issue is that all the values in the array have to have the same type?

@ccapndave
Copy link
Author

Exactly (or you can specify a union type, but not the order they come in). If they are separate arguments they can be individually typed. This is how Rx gets such good typing in Typescript for functions such as combineLatest.

@ellbee
Copy link
Collaborator

ellbee commented Aug 17, 2015

Ok, thanks. I don't see why we shouldn't do this. @faassen?

@speedskater
Copy link
Contributor

@ccapndave @ellbee Sounds interesting to me.
I think it has two more advantages:

  • it deals with a common mistake that array brackets are ommited.
  • ommiting the array brackets makes it imho more readable.

@ellbee
Copy link
Collaborator

ellbee commented Sep 9, 2015

Variadic dependencies added to the 1.0.0 release

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

3 participants