table icon indicating copy to clipboard operation
table copied to clipboard

(TypeScript) Type definitions are incomplete for sortable tables.

Open alexkvazos opened this issue 5 years ago • 29 comments

Describe 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 Screen Shot 2021-01-05 at 20 55 25

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

alexkvazos avatar Jan 06 '21 02:01 alexkvazos

This issue is being marked as stale (no activity in the last 14 days)

github-actions[bot] avatar Apr 08 '22 17:04 github-actions[bot]

This issue has been detected as stale and automatically closed. It's very likely that your issue has remained here this long because it would require breaking changes to v7. React Table v8 is currently in alpha (soon beta!) and already contains bug fixes, performance improvements and architectural changes that likely address this issue.

  • If your v7 issue has been previously labeled as requiring breaking changes, please try the new v8 alpha/beta releases
  • If your v7 issue has not already been labeled as a breaking change, open a new issue.
  • If this was a v8 issue and was closed by mistake, please reopen or leave a comment below.

github-actions[bot] avatar Apr 08 '22 17:04 github-actions[bot]

https://codesandbox.io/s/react-table-incomplete-types-forked-0hdd1

@samyan The sandbox link seems to be not working. I am facing the same issue with ts. After creating a type defination file also I am getting the below error Parameter 'headerGroup' implicitly has an 'any' type.ts(7006)

Updated:

https://codesandbox.io/s/react-table-incomplete-types-fixed-2r4us

@samyan Hi Bro, this codesandbox link is not working, can you post your code again pls?

oylp1988 avatar Oct 04 '22 14:10 oylp1988

https://codesandbox.io/s/react-table-incomplete-types-forked-0hdd1

@samyan The sandbox link seems to be not working. I am facing the same issue with ts. After creating a type defination file also I am getting the below error Parameter 'headerGroup' implicitly has an 'any' type.ts(7006)

Updated: https://codesandbox.io/s/react-table-incomplete-types-fixed-2r4us

@samyan Hi Bro, this codesandbox link is not working, can you post your code again pls?

Link restored. Check again pls.

samyan avatar Oct 04 '22 15:10 samyan

https://codesandbox.io/s/react-table-incomplete-types-forked-0hdd1

@samyan The sandbox link seems to be not working. I am facing the same issue with ts. After creating a type defination file also I am getting the below error Parameter 'headerGroup' implicitly has an 'any' type.ts(7006)

Updated: https://codesandbox.io/s/react-table-incomplete-types-fixed-2r4us

@samyan Hi Bro, this codesandbox link is not working, can you post your code again pls?

Link restored. Check again pls.

Thx dude.

oylp1988 avatar Oct 04 '22 17:10 oylp1988

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: image

Example: https://codesandbox.io/s/react-table-incomplete-types-fixed-2r4us

Regards.

thank you for your method, it was helpful me :))) how did you figure out it ???

Arthur-BV avatar Oct 17 '23 12:10 Arthur-BV

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: image Example: https://codesandbox.io/s/react-table-incomplete-types-fixed-2r4us Regards.

thank you for your method, it was helpful me :))) how did you figure out it ???

Going from javascript to typescript, the rest is experience.

Regards.

samyan avatar Oct 18 '23 16:10 samyan

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: image Example: https://codesandbox.io/s/react-table-incomplete-types-fixed-2r4us Regards.

thank you for your method, it was helpful me :))) how did you figure out it ???

Going from javascript to typescript, the rest is experience.

Regards.

You know, that it was only viewer issue, because runtime all code is work !

Arthur-BV avatar Oct 19 '23 11:10 Arthur-BV

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: image Example: https://codesandbox.io/s/react-table-incomplete-types-fixed-2r4us Regards.

thank you for your method, it was helpful me :))) how did you figure out it ???

Going from javascript to typescript, the rest is experience. Regards.

You know, that it was only viewer issue, because runtime all code is work !

Yes, It's right. It simply helps you to know the methods that the library itself has, in addition to visually making the code more elegant.

samyan avatar Oct 19 '23 11:10 samyan