-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
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
Improve typings for compose
function
#1868
Improve typings for compose
function
#1868
Conversation
@aikoven - this PR is a proof that React and Redux where designed for dynamically typed world… Anyway it looks GOOD 👍 |
@ulfryk Things will get better with support for variadic kinds in TS :) |
@@ -367,27 +372,54 @@ export function bindActionCreators< | |||
* to left. For example, `compose(f, g, h)` is identical to doing | |||
* `(...args) => f(g(h(...args)))`. | |||
*/ | |||
export function compose(): <R>(a: R, ...args: any[]) => R; | |||
export function compose(): <R>(a: R) => R; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This overload will hide the next one. Is it allowed for compose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! My bad, didn't notice it has no parameters.
Thank you for adding me as a reviewer. Besides of minor concern (see comment), it looks good to me. |
Will this have any backwards-compatibility concerns? Sounds like everyone who knows TS is in agreement on this. In she goes! (side note: I really need to learn TS...) |
I guess so, older versions of TS compiler won't be able to consume new typings. However, as far as I can see, new versions are adopted very fast by the community. If the problem get serious (e.g. there would be a lot of projects not being able to migrate quickly to the new TS compiler), there are some workarounds. For example, we can have a separate repo for older version typings. It's very easy to substitute official typings coming with NPM package by some external ones. |
Introduce more strict typings for
compose
function to allow smarter inference, e.g.:cc @ulfryk, @Igorbek