Recompose `compose` error if more than 8 HOCs
See original GitHub issueIf there are more than 8 HOCs used per one compose
, I get the following error:
Error: src/components/Checkout/index.js:68
v-------
68: compose(
69: setDisplayName('Checkout'),
70: withState('isLoading', 'setLoading', false),
...:
163: )(Component);
^ function call. Function cannot be called on any member of intersection type
68: compose(
^^^^^^^ intersection
Member 1:
v---------------------------
74: declare type Compose = (<A, B, C, D, E, F, G, H, I>(
75: hi: UnaryFn<H, I>,
76: gh: UnaryFn<G, H>,
...:
84: ) => UnaryFn<A, I>) &
-----------------^ polymorphic type: function type. See lib: flow-typed/npm/recompose_v0.24.x.js:74
Error:
81: withState('dimensions', 'setDimensions', { width: -1, height: -1 })
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function type. This type is incompatible with
83: ...rest: Array<void>
^^^^ undefined. See lib: flow-typed/npm/recompose_v0.24.x.js:83
...
I assume it’s because in type definitions of compose
there is Array<void>
used:
declare type Compose = (<A, B, C, D, E, F, G, H, I>(
hi: UnaryFn<H, I>,
gh: UnaryFn<G, H>,
fg: UnaryFn<F, G>,
ef: UnaryFn<E, F>,
de: UnaryFn<D, E>,
cd: UnaryFn<C, D>,
bc: UnaryFn<B, C>,
ab: UnaryFn<A, B>,
...rest: Array<void>
) => UnaryFn<A, I>) &
(<A, B, C, D, E, F, G, H>(
gh: UnaryFn<G, H>,
fg: UnaryFn<F, G>,
ef: UnaryFn<E, F>,
de: UnaryFn<D, E>,
cd: UnaryFn<C, D>,
bc: UnaryFn<B, C>,
ab: UnaryFn<A, B>,
...rest: Array<void>
) => UnaryFn<A, H>) &
(<A, B, C, D, E, F, G>(
fg: UnaryFn<F, G>,
ef: UnaryFn<E, F>,
de: UnaryFn<D, E>,
cd: UnaryFn<C, D>,
bc: UnaryFn<B, C>,
ab: UnaryFn<A, B>,
...rest: Array<void>
) => UnaryFn<A, G>) &
(<A, B, C, D, E, F>(
ef: UnaryFn<E, F>,
de: UnaryFn<D, E>,
cd: UnaryFn<C, D>,
bc: UnaryFn<B, C>,
ab: UnaryFn<A, B>,
...rest: Array<void>
) => UnaryFn<A, F>) &
(<A, B, C, D, E>(
de: UnaryFn<D, E>,
cd: UnaryFn<C, D>,
bc: UnaryFn<B, C>,
ab: UnaryFn<A, B>,
...rest: Array<void>
) => UnaryFn<A, E>) &
(<A, B, C, D>(
cd: UnaryFn<C, D>,
bc: UnaryFn<B, C>,
ab: UnaryFn<A, B>,
...rest: Array<void>
) => UnaryFn<A, D>) &
(<A, B, C>(
bc: UnaryFn<B, C>,
ab: UnaryFn<A, B>,
...rest: Array<void>
) => UnaryFn<A, C>) &
(<A, B>(ab: UnaryFn<A, B>, ...rest: Array<void>) => UnaryFn<A, B>)
If I replace void
with Function
, everything becomes fine.
If someone can clarify this issue? Perhaps I’m misunderstanding something? Thanks.
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (10 by maintainers)
Top Results From Across the Web
Recompose `compose` error if more than 8 HOCs · Issue #1115 ...
If there are more than 8 HOCs used per one compose, I get the following error: Error: src/components/Checkout/index.js:68 v------- 68: compose( 69: ...
Read more >Using Recompose to write clean higher-order components
Learn how Recompose methods can help create cleaner HOCs and how it simplifies the development and organization of React components.
Read more >reactjs - testing multiple HOC composed with recompose
testing this logic is proving difficult. The project I am working on is using react-test-renderer and utilising the shallow render method. So ...
Read more >Using Recompose to build higher-order components - BigBinary
Recompose allows us to write many smaller higher-order components and ... If the predicate evaluates to true then the left HOC is rendered ......
Read more >Replacing Recompose with React Hooks - Rainforest QA
After more than three years of working with it, we've identified a lot of ... shipped with React v16.8 and provided an alternative...
Read more >Top Related Medium Post
No results found
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
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep, correct. You can also nest composes within composes and extend unbounded.
Cover the whole alphabet if you think the use cases are there. 😛
https://github.com/flowtype/flow-typed/blob/master/definitions/npm/recompose_v0.24.x/flow_v0.47.x-/recompose_v0.24.x.js#L71