(TypeScript) Type definitions are incomplete for sortable tables.
See original GitHub issueDescribe the bug (required)
Some type definitions are incomplete – in the column for example.
Property 'getSortByToggleProps' does not exist on type 'HeaderGroup<object>'.ts(2339)
Property 'isSorted' does not exist on type 'HeaderGroup<object>'.ts(2339)
Property 'isSortedDesc' does not exist on type 'HeaderGroup<object>'.ts(2339)
Provide an example via Codesandbox! (required) https://codesandbox.io/s/react-table-incomplete-types-x1es6
Steps To Reproduce (required)
Try to use useSortBy
on react-table
and consume the getSortByToggleProps
function or isSorted
and isSortedDesc
properties on a TypeScript project.
Expected behavior (Recommended) The types shouldn’t error
Screenshots
This bug was reported without any information before and noticed they were also using TypeScript so I could only figure it was TypeScript specific. https://github.com/tannerlinsley/react-table/issues/1481
Issue Analytics
- State:
- Created 3 years ago
- Reactions:58
- Comments:25
I had a similar issue with another plugin. The solution i got, was creating folder called types in /src directory and then creating a file called react-table-config.d.ts. Then put the definitions that you can find in: types/react-table.
Now you can check:
Example: https://codesandbox.io/s/react-table-incomplete-types-fixed-2r4us
Regards.
In all fairness, the plugins don’t feel all that optional as they are included in base package.