[react-redux] libdef incompatible with flow v0.85
See original GitHub issueThe todos-flow example just works with flow v0.78 and the current flow-typed react-redux types, but after upgrading to flow v0.85 there are a lot of flow errors I am not able to fix.
Full repo here and full error log here.
> todos-flow@0.0.1 flow
> flow
Error ------------------------------------------------------------------------------- src/containers/FilterLink.js:29:19
Missing type annotation for `CP`. `CP` is a type parameter declared in function type [1] and was implicitly instantiated
at call of `connect` [2].
src/containers/FilterLink.js:29:19
v-------
29| const connector = connect(
30| mapStateToProps,
31| mapDispatchToProps
32| );
^ [2]
References:
flow-typed/npm/react-redux_v5.x.x.js:133:34
v
133| declare export function connect<
134| Com: ComponentType<*>,
135| A,
136| S: Object,
137| DP: Object,
138| SP: Object,
139| RSP: Object,
140| RDP: Object,
141| CP: $Diff<$Diff<ElementConfig<Com>, RSP>, RDP>,
142| ST: $Subtype<{[_: $Keys<Com>]: any}>
143| >(
144| mapStateToProps: MapStateToProps<S, SP, RSP>,
145| mapDispatchToProps: MapDispatchToProps<A, DP, RDP>
146| ): (component: Com) => ComponentType<CP & SP & DP> & $Shape<ST>;
--------------------------------------------------------------^ [1]
Error ------------------------------------------------------------------------------- src/containers/FilterLink.js:29:19
Missing type annotation for `DP`. `DP` is a type parameter declared in function type [1] and was implicitly instantiated
at call of `connect` [2].
src/containers/FilterLink.js:29:19
v-------
29| const connector = connect(
30| mapStateToProps,
31| mapDispatchToProps
32| );
^ [2]
References:
flow-typed/npm/react-redux_v5.x.x.js:133:34
v
133| declare export function connect<
134| Com: ComponentType<*>,
135| A,
136| S: Object,
137| DP: Object,
138| SP: Object,
139| RSP: Object,
140| RDP: Object,
141| CP: $Diff<$Diff<ElementConfig<Com>, RSP>, RDP>,
142| ST: $Subtype<{[_: $Keys<Com>]: any}>
143| >(
144| mapStateToProps: MapStateToProps<S, SP, RSP>,
145| mapDispatchToProps: MapDispatchToProps<A, DP, RDP>
146| ): (component: Com) => ComponentType<CP & SP & DP> & $Shape<ST>;
--------------------------------------------------------------^ [1]
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (11 by maintainers)
Top Results From Across the Web
Errors encountered upgrading Flow v0.85, and how we solved ...
Issue: [react-redux] libdef incompatible with flow v0.85 #2946 · Tweet: It's so hard to make flow happily get past 0.85 with our codebase ......
Read more >reactjs - Flow error "props is incompatible with empty" when ...
I have a component that is wrapped in a react-redux "connect". All the props of the component ...
Read more >Adventures in Static Typing: React, Redux, Flow, Oh My
Adding end-to-end static typing to a React/Redux app is a lot of work — you'll run into issues with Flow, third-party annotations, ...
Read more >.flowconfig [options] | Flow
How to configure Flow's various options. ... The default value for autoimports is true as of Flow v0.155.0. babel_loose_array_spread (boolean).
Read more >Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
Top Related Hashnode Post
No results found
Top GitHub Comments
@zanettin @villesau here is a promised PR #3012 😅
I’d say the adapted typings are production ready now. They support
options
andmergeProps
arguments toconnect()
with proper connection to the component props andmapStateToProps
, own props, etc. Most of the type arguments can be requested to be inferred with the new_
type placeholder.I think @peter-leonov did a really good job with https://gist.github.com/peter-leonov/e1fac25b6ade9b28c03c213e8a9d7121.
With these types, you should have OwnProps, StateProps, and DispatchProps (OP, SP, and DP) all be exact object types. In your component that combines all three of these types, use:
It’s important that you don’t use intersection with exact objects, since that will produce an empty type.