You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hey i use "@tanstack/react-table": "^8.7.4",
i try to create a custom column def so that i can use it in the table , id did something like this import { AccessorKeyColumnDef, ColumnDef } from '@tanstack/react-table';
import { CSSProperties, ReactNode } from 'react';
i know that createColumnHelper must get a type so the i can enter string accesor key . but now i get error rgument of type '(string & {}) | keyof T' is not assignable to parameter of type 'AccessorFn | DeepKeys'.
Type 'string & {}' is not assignable to type 'AccessorFn | DeepKeys'.
Type 'string & {}' is not assignable to type 'DeepKeys'.ts(2345).
what can i do so the columnHelper.accessor accept string ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
hey i use "@tanstack/react-table": "^8.7.4",
i try to create a custom column def so that i can use it in the table , id did something like this import { AccessorKeyColumnDef, ColumnDef } from '@tanstack/react-table';
import { CSSProperties, ReactNode } from 'react';
export type ColumnDefinition = {
headerStyle?: CSSProperties;
header: string | ReactNode;
style?: CSSProperties;
disableSort?: boolean;
disableSearch?: boolean;
disableToggle?: boolean;
hidden?: boolean;
customHeader?: string;
columns?: ColumnDefinition[];
headerTooltip?: string;
disableResizing?: boolean;
tooltip?: string | ((context: any) => string);
} & ColumnDef<TData, unknown> &
AccessorKeyColumnDef<TData, unknown>;
now i try to create custom hook for generating columns .
import { createColumnHelper } from '@tanstack/react-table';
import { ColumnDefinition } from './types';
export default function useGenerateColumns(cols: ColumnDefinition[]) {
const columnHelper = createColumnHelper();
}
i know that createColumnHelper must get a type so the i can enter string accesor key . but now i get error rgument of type '(string & {}) | keyof T' is not assignable to parameter of type 'AccessorFn | DeepKeys'.
Type 'string & {}' is not assignable to type 'AccessorFn | DeepKeys'.
Type 'string & {}' is not assignable to type 'DeepKeys'.ts(2345).
what can i do so the columnHelper.accessor accept string ?
Beta Was this translation helpful? Give feedback.
All reactions