Expected 0 arguments, but got 1. Using typescript and compose from react-apollo

12k Views Asked by At

I'm using typescript and react-apollo

my code is the following: enter image description here

If I remove the last (Index) the error will go away but I have no idea on how then export the container/component.

Basically, the code works but typescript is not happy with this.

2

There are 2 best solutions below

0
On BEST ANSWER

Imprecisely defining compose parameters as any will satisfy the compiler.

export default compose<any>(
  ...
)(Index)
0
On

For others struggling with a similar issue.

Defining a separate generic compose function also will work and can then just be invoked immediately without issue.

const invokableCompose = <any>compose;

export default invokeableCompose(fn1, fn2)(Index);