Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

Fix Redux Store flow errors #975

Merged

Conversation

richardgirges
Copy link
Contributor

The fix

This should fix the Redux-related flowtype errors that are popping up in react-apollo due to incorrect usage of the Redux Store type in index.js.flow.

The error currently appears as:

node_modules/react-apollo/index.js.flow:30
 30:     store: Store,
                ^^^^^ Store. Application of polymorphic type needs <list of 2 arguments>. (Can use `*` for inferrable ones)

This fix is basically adding inferred types (*) as arguments to all references to the Redux Store type inside of index.js.flow. This should fix #898.

Additional Details

Generally you want to pass in your State and Actions as arguments to Store. i.e.:

type State = {
  // ...
}

type Actions = {
  // ...
}

const foo: Store<State, Actions> = // ...

... but seeing as how the usage of Store was incorrect to begin with, and in one area, there was a Store<any>, I figured this is a decent step forward in correctly typing this aspect of react-apollo.

If perhaps this is not the right approach to fixing this flow error (i.e. maybe we want to somehow be more explicit about the Redux State and Action arguments, feel free to toss this PR out.

Cheers,

rich

…Store. Application of polymorphic type needs <list of 2 arguments>.`. This fix is basically adding inferred types (`*`) as arguments to all references to the Redux `Store` flow type inside of `index.js.flow`. This should fix apollographql#898.
@apollo-cla
Copy link

@richardgirges: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

@mention-bot
Copy link

@richardgirges, thanks for your PR! By analyzing the history of the files in this pull request, we identified @jbaxleyiii and @dozoisch to be potential reviewers.

@jbaxleyiii
Copy link
Contributor

@richardgirges thank you for this! In an upcoming release react-apollo/apollo won't depend on redux anymore but I will cut a release with this for now! Thank you again!

@jbaxleyiii jbaxleyiii merged commit 83a74ed into apollographql:master Aug 13, 2017
@richardgirges
Copy link
Contributor Author

Non-redux dependence FTW! Thanks for merging in the meantime @jbaxleyiii :D

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flow errors about State type in combination with Redux and flow-typed
4 participants