TanStackT
TanStack4y ago
2 replies
wet-aqua

Typechecking overwritten ColumnMeta

I have extended the ColumnMeta type as described in https://tanstack.com/table/v8/docs/api/core/column-def#meta, which seems to give me correct autocompletion and typechecking when using column defs, but not when creating them.

See: https://codesandbox.io/s/react-table-v8-forked-j74p00?file=/src/columns.tsx

In this codesandbox, I have overwritten the types in extend-table-core.ts, and am creating a column definition using columnHelper in columns.tsx.
When creating a column, I would expect meta: { foo: "bar" } to error because:
a) foo is not part of the type that i'm using to overwrite ColumnMeta, and
b)
meta
is missing multiple non-optional properties from my overwriting type
But TypeScript does not throw an error about either of these issues.

Is there a way to get TS to typecheck meta like this when creating columnDefs?
Was this page helpful?