TypeScript, how to extend ColumnMeta type?
Hi. I would like to add new properties to the type od
ColumnMeta. Is it somehow possible to do so without TS error?
7 Replies
rare-sapphireOP•4y ago
Err:
Property 'chakra' does not exist on type 'ColumnMeta<T, unknown>'.crude-lavender•4y ago
Hi, just create react-table.d.ts file and append your keys like this
deep-jade•2y ago
Thank you! How can I make ColumMeta mandatory?
rare-sapphire•2y ago
I don't think you can, since it's used in
ColumnDef which has meta as optional.deep-jade•2y ago
In typescript, declaring an interface extends existing ones with the same name. But which one should be extended to have the desired effect? Or is it not possible with interface extension to make optional properties mandatory?
rare-sapphire•2y ago
Well, that's the thing.
ColumnDef is a type, not an interface.
So we can't use interface merging to change it.deep-jade•2y ago
Ah I see. Thank you!