import { ColumnDef, CellContext } from '@tanstack/react-table'; import { Link } from '@@/Link'; export function buildNameColumn>( nameKey: keyof T, idKey: string, path: string, idParam = 'id' ): ColumnDef { const cell = createCell(); return { header: 'Name', accessorKey: nameKey, id: 'name', cell, enableSorting: true, enableHiding: false, sortingFn: 'text', }; function createCell>() { return function NameCell({ renderValue, row }: CellContext) { const name = renderValue() || ''; if (typeof name !== 'string') { return null; } return ( {name} ); }; } }