I have the type TableColumn and it has 3 generic arguments and I want the last 2 to be inferred by the valueAccessorFn and displayAccessorFn functions. for some reason the 2 arguments stay as "unknown".
help?
value: TProperty;
rowValues: TData;
error?: string;
onChange: (value: TProperty) => void;
onBlur: () => void;
}
interface RenderCellValueProps<TProperty> {
value: TProperty;
onClick: () => void;
}
export interface TableColumn<TData, TDisplayProp = unknown, TValueProp = unknown> {
name: string;
header: string;
valueAccessorFn: (value: TData) => TValueProp;
displayAccessorFn: (value: TData) => TDisplayProp;
renderEditableField?: (props: RenderEditableFieldProps<TData, TValueProp>) => ReactNode;
renderCellValue?: (props: RenderCellValueProps<TDisplayProp>) => ReactNode;
renderColumnValue?: (columnName: string) => void;
}
type Foo = {
name: string
details: {
id: number
str: string
}
}
const column: TableColumn<Foo> = {
displayAccessorFn: (value) => value.details.str,
valueAccessorFn: (value) => value.details.str
}