react-sortable-hoc icon indicating copy to clipboard operation
react-sortable-hoc copied to clipboard

Unable to wrap react-virtualized Table with TypeScript.

Open laceymwes opened this issue 7 years ago • 2 comments

When I attempt to create a sortable table following this example, I receive the following TypeScript error: TS2345: Argument of type 'typeof Table' is not assignable to parameter of type 'WrappedComponent<TableProps<{}>>'.   Type 'typeof Table' is not assignable to type 'WrappedComponentFactory<TableProps<{}>>'.     Type 'typeof Table' provides no match for the signature '(props: TableProps<{}>): Element'.

example:

 import { Table } from 'react-virtualized';
 const SortableTable = SortableContainer(Table);

This also happens with Ant Design's Table component as well.

react: 16.6.3 react-virtualized: 9.21.0 @types/react-vritualized: 9.18.9 react-sortable-hoc: 0.8.3 @types/react-sortable-hoc: 0.6.4

laceymwes avatar Nov 21 '18 16:11 laceymwes

I too was having the same error. For now casting the return instance type to any as below removes the build error.

const SortableTable = SortableContainer(Table) as any;

opavader avatar Dec 04 '18 08:12 opavader

Any way to avoid using any here?

ealemda2 avatar Sep 23 '21 15:09 ealemda2