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)

    Someone's comment on Twitter reminded me how differently we interpret what we experience: My impression from that interview was that Yuri was…

  • (no subject)

    Via Twitter. From the book The Gray Lady Winked, photographed by Michael Shermer: Here's the tweet that the paragraph references (took a while…

  • (no subject)

    To unscramble an egg, by the way, would be a closer idiomatic parallel to ungrinding ground meat, and in spite of Julia Ioffe, is just as dark, blunt…

  • 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.