How to properly type columns when using createColumnHelper? #5218
Unanswered
ronaldruzicka
asked this question in
Q&A
Replies: 2 comments 7 replies
-
|
If you're using the columnHelper to define your columns, in your case const columnHelper = createColumnHelper<Person>()you can afford to be more lax with the types in your columns type Props = {
columns: ColumnDef<Person, any>[];
data: Person[];
} |
Beta Was this translation helpful? Give feedback.
6 replies
-
|
I'm experiencing this issue. Is there any update on it? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, does anyone know how to properly type
columnswhen table is extracted into it's own component? The type should beColumnDefwhich is a union type where isAccessorColumnDefwhich is a union type ofAccessorKeyColumnDef | AccessorFnColumnDef..but in the end TS is showing an error, thataccessorKeyFnis not used, because I'm usingaccessorKey.The
Propstype for myTableThe error:
Here is CodeSandbox
I don't want to use type assertion for
columns, but I don't see any other way.Any help appreciated🙏, thanks!
Beta Was this translation helpful? Give feedback.
All reactions