TanStackT
TanStack3y ago
5 replies
worthy-azure

Making a rusable table column generic

Hello guys, I am trying to make a reusable table, but having a hard time making the columns props it takes a generic i've tried something like this
type TableProps<
  TData extends Record<string, unknown>,
  TValue extends Record<string, unknown>
> = {
  data: TData[];
  columns: ColumnDef<TData, TValue>[];
  pageSizeOptions?: string[];
  initialPageSize?: number;
  isLoading: boolean;
};
` and no luck have also tried other alternatives, but keep getting errors, any ideas, how this should actually look?
Was this page helpful?