T
TanStack•3y ago
stormy-gold

TS errors using ColumnMeta - All declarations of 'ColumnMeta' must have identical type parameters

What do I put in the ColumnMeta interface to fix the error?
declare module '@tanstack/table-core' {
interface ColumnMeta<PartialContact extends RowData, TValue> {
columnName: string
}
}

const columns = useMemo<ColumnDef<PartialContact>[]>(
() => [
{
accessorKey: "contact_name",
header: () => <span>Contact Name</span>,
cell: props => <Cell {...props} />,
meta: { columnName: "Name" },
},

....
return <div>{column.columnDef.meta?.columnName}</div>
declare module '@tanstack/table-core' {
interface ColumnMeta<PartialContact extends RowData, TValue> {
columnName: string
}
}

const columns = useMemo<ColumnDef<PartialContact>[]>(
() => [
{
accessorKey: "contact_name",
header: () => <span>Contact Name</span>,
cell: props => <Cell {...props} />,
meta: { columnName: "Name" },
},

....
return <div>{column.columnDef.meta?.columnName}</div>
export type Contact = {
id: string;
account_name: string;
address_city: string;
address_country: string;
address_line1: string;
address_line2: string;
address_state: string;
address_zip: string;
birthday: string;
company_name: string;
created_at: string;
email: string;
first_name: string;
job_title: string;
last_name: string;
middle_name: string;
notes: string;
phone: string;
status: string;
suffix: string;
title: string;
updated_at: string;
url: string;
website: string;
};

export type PartialContact = Omit<
Contact,
| "first_name"
| "last_name"
| "address_line1"
| "address_line2"
| "birthday"
| "company_name"
| "created_at"
| "updated_at"
| "middle_name"
| "notes"
| "suffix"
| "title"
| "website"
> & {
contact_name: string;
address_full: string;
};
export type Contact = {
id: string;
account_name: string;
address_city: string;
address_country: string;
address_line1: string;
address_line2: string;
address_state: string;
address_zip: string;
birthday: string;
company_name: string;
created_at: string;
email: string;
first_name: string;
job_title: string;
last_name: string;
middle_name: string;
notes: string;
phone: string;
status: string;
suffix: string;
title: string;
updated_at: string;
url: string;
website: string;
};

export type PartialContact = Omit<
Contact,
| "first_name"
| "last_name"
| "address_line1"
| "address_line2"
| "birthday"
| "company_name"
| "created_at"
| "updated_at"
| "middle_name"
| "notes"
| "suffix"
| "title"
| "website"
> & {
contact_name: string;
address_full: string;
};
1 Reply
equal-jade
equal-jade•3y ago
wrong forum 😑

Did you find this page helpful?