Sam Goldman
Oct 30, 2018 · 1 min read

Ville Saukkonen Thanks! And thanks for your thoughtful questions.

Like I wrote in the post, the S, D, and OP type parameters seem to be the only ones that truly appear in input positions. I spent some time working on new typings for the connect function which would only require annotations for those types.

I came up with something fairly simple, but not 100% complete. From reading the react-redux source as well as the various type definitions around, I think the definitions in that playground link do capture the essential complexity of the API.

I think we need to add a few language features to make this 100%. I spent a couple weeks in fact working on this, but ultimately decided to move forward with this change anyway.

When Jordan Brown’s work to support _ in explicit type arguments, it will be more convenient to provide these annotations. You would be able to write something like this:

module.exports = connect<State, Dispatch, OwnProps, _, _>(mapStateToProps, mapDispatchToProps)(MyComponent);

As far as migrating our codebase internally, there are a lot of new errors. We are suppressing them and communicating to individual teams how to best remove the suppressions and provide the necessary annotations. In most cases, adding explicit type arguments to function and constructor calls is the most convenient solution.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store