Andrey (azangru) wrote,

Here was me happily using a type for a redux thunk action that I copy-pasted from somewhere many months ago:

The types passed to the ThunkAction generic type here aren't important. What is important is that I was using the ActionCreator type from the redux library. The reason this is important is that when, during refactoring, I changed the action creator so that instead of a single argument (x) it now requires two (x and y):

I fully expected typescript to complain in the places where someActionCreator was invoked with a single argument. When it didn't, I cussed, went to investigate, and found that the ActionCreator type is defined in the redux library as follows:

Bloody any! Now, I don't know whether there is a proper way to define the type of ActionCreator in typescript at all; but by using any we have just lost the information about how many and what kind of arguments someActionCreator will require.


P.S.: found the discussion of this problem in redux's github issues.

  • (no subject)

    A Google docs presentation file from a recent event. With a script in the bottom — at least, I assume that this is script; I doubt it's a transcript…

  • (no subject)

    Twitter is an unending fount of amusement today. The creator and former maintainer of Babel is attacking the current maintainer of Babel for slacking…

  • (no subject)

    This is interesting: the quotes from the article, cited in the tweets, are complimentary to the skeptics; the conclusion puts them in the camp of…

  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.