Run tsc --noEmit in a project that uses react-apollo with skipLibCheck to false using typescript 3.0.1
node_modules/react-apollo/graphql.d.ts:4:395 - error TS2707: Generic type 'ComponentClass<P>' requires between 0 and 1 type arguments.
4 export declare function graphql<TProps extends TGraphQLVariables | {} = {}, TData = {}, TGraphQLVariables = {}, TChildProps = Partial<DataProps<TData, TGraphQLVariables>> & Partial<MutateProps<TData, TGraphQLVariables>>>(document: DocumentNode, operationOptions?: OperationOption<TProps, TData, TGraphQLVariables, TChildProps>): (WrappedComponent: React.ComponentType<TChildProps & TProps>) => React.ComponentClass<TProps, React.ComponentState>;
Versions
Node 8.11.3
Npm 6.30
react-apollo 2.1.11
@zamiang I recently ran into this as well. Looks like the types for react-apollo are correct.
There was a recent change in the @types/react package (see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/27417/files) that added a second generic to the React.ComponentClass type definition.
I fixed this issue by upgrading my @types/react to the most recent version (16.4.9).
Notes:
react-dom to 16.0.7prop-types to 15.5.5yarn and had to remove yarn.lock to handle nested dependencies. This issue (https://github.com/DefinitelyTyped/DefinitelyTyped/issues/20350#issuecomment-352409487) explains this situation pretty well.Please update your dependencies and you should be good to go. I just merged a PR which reenabled lib checking and it was all green.
Most helpful comment
@zamiang I recently ran into this as well. Looks like the types for
react-apolloare correct.There was a recent change in the
@types/reactpackage (see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/27417/files) that added a second generic to theReact.ComponentClasstype definition.I fixed this issue by upgrading my
@types/reactto the most recent version (16.4.9).Notes:
react-domto16.0.7prop-typesto15.5.5yarnand had to removeyarn.lockto handle nested dependencies. This issue (https://github.com/DefinitelyTyped/DefinitelyTyped/issues/20350#issuecomment-352409487) explains this situation pretty well.