Create a type as union of all column ids using columnHelper #4743
Unanswered
treasurely
asked this question in
Q&A
Replies: 1 comment 4 replies
-
Update: Got lost in the Typescript sauce -- for anyone finding this, turns out I could just use Ended up just using:
|
Beta Was this translation helpful? Give feedback.
4 replies
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.
Uh oh!
There was an error while loading. Please reload this page.
-
First off, thank you for this library, it is incredible. I'm working on something right now that's filtering a table's data server side using a filter that's configured by the end user in the app. I'm trying to make the filter's code typesafe (the idea is to pass a list of the column Ids to a generic
useFilters
hook), but I'm struggling to get a union of the column ids from a table's column definition.From the below helper, I'd ultimately want to be able to get a type
ColumnIds
that would be a unionname | country | updatedAt
, and ideally have a reusable generic I could pass anycolumnHelper
orcolumns
into - everything I've tried so far has returned me juststring | undefined
.Any help is much appreciated - thanks!
Beta Was this translation helpful? Give feedback.
All reactions