TanStackT
TanStack4y ago
8 replies
foolish-indigo

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?

// Example of usage
columns: [
  {
    header: "ID",
    accessorKey: "id",
    meta: { chakra: { fontFamily: "mono" } },
  }
]

interface ExtendedColumnMeta<T> extends ColumnMeta<T, unknown> {
  style?: React.CSSProperties;
  truncate?: boolean;
  chakra?: TableCellProps;
}
Was this page helpful?