TanStackT
TanStack2y ago
3 replies
faint-white

GetValue type lost

Hi
I'm trying to define columns using ColumnDef, but for some reason the type on "getValue" in cell is unknown.
type Char = {
  id: number;
  name: string;
  rankId: number;
  rank: {
    id: number;
    name: string;
    shortname: string;
    value: number;
  };
  user: string;
  joinedAt: Date;
  rankChangedAt: Date;
};

export const columns: ColumnDef<Char>[] = [
  {
    id: "rank",
    accessorKey: "rank",
    header: "Rank",
    cell: ({ getValue}) => {
      const rank = getValue();
      console.log(rank.shortname);
      return "test";
    },
  },
  {
    accessorKey: "id",
    header: "ID",
  },
  {
    accessorKey: "name",
    header: "Name",
  },
];
image.png
Was this page helpful?