T
TanStack3y ago
adverse-sapphire

table.options.meta Typescript definition

Is it possible to define meta Typescript definition only for one table and not on global level how it is shown in documentation? https://tanstack.com/table/v8/docs/api/core/table#meta
Table | TanStack Table Docs
useReactTable / createSolidTable / useVueTable / createSvelteTable `tsx
6 Replies
adverse-sapphire
adverse-sapphireOP3y ago
By defining like this in documentation is is only for that table or for all tables that we import from @tanstack/table-core ?
vicious-gold
vicious-gold3y ago
As far as I know, the definitions being made are only done globally. I generally go about making these properties optional on the interface.
fair-rose
fair-rose3y ago
In my codebase, I was declaring custom properties on the table meta like so:
declare module '@tanstack/react-table' {
interface TableMeta<TData extends RowData> {
customOption?: boolean
...etc
}
}
declare module '@tanstack/react-table' {
interface TableMeta<TData extends RowData> {
customOption?: boolean
...etc
}
}
After updating to latest versions, this doesn't seem to take any effect, and now meta?.customOption in my code gives me typescript errors Property customOption does not exist on TableMeta<TData> Does anyone know how I can get to the bottom of this?
vicious-gold
vicious-gold3y ago
For Tanstack Table v8, you need to make your declarations on the @tanstack/table-core package. You don't need to install it, its bundled with @tanstack/react-table.
vicious-gold
vicious-gold3y ago
GitHub
nv-rental-clone/src/tanstack-table.d.ts at master · SeanCassiere/nv...
Navotar with Tailwind and the Tanstack. Contribute to SeanCassiere/nv-rental-clone development by creating an account on GitHub.
fair-rose
fair-rose3y ago
@Sean Cassiere thanks for the reply, just updated to use @tanstack/table-core instead in the declaration, but still seeing the same error

Did you find this page helpful?