Table columns type definition
I have a simple table in my app.
All it does is show file metadata.
Beside the data is self I have few button actions.
I use @tanstack/query to fetch all the data from the server.
My problem starts when I want to create the table.
This is the code I use, the problem is when I try to use the 'files' directly, then I shows an error on the columns types. While the 'data' and the 'files' have the same type.
Now, I've tried to decorate the column with type but it does not seem to work. I would love any help from you guys.


5 Replies
extended-salmon•2y ago
Try this...
And in columns definition you can use I believe amthe type from react table itself called ColumnDef with the File as the generic type like ColumnDef<File[], any> you can replace the any with what it needs to be on your end. I'm doing this from the top of my head so it could be that the type is File instead of File[]
fair-roseOP•2y ago
Not sure I understand what you are saying
The thing is that I want to remove the duplicate state.
I don’t want to have “data”
fair-roseOP•2y ago
I've done this the thing is that when I try to replace the 'files' with the 'data' I get an error

extended-salmon•2y ago
I can't see why this would not work....
fair-roseOP•2y ago
You're so right. How could I not notice?
Thank you so much!