Open
Description
Describe the bug
Looking at the examples and docs I expect this to correctly type my columns for me. Instead I get a large error with this code:
type Example = {
name: string
age: number
}
const columnHelper = createColumnHelper<Example>()
const columns = useMemo<ColumnDef<Example>[]>(
() => [
columnHelper.accessor("name", {
cell: (info) => info.getValue(),
}),
columnHelper.accessor("age", {
cell: (info) => info.getValue(),
}),
],
[columnHelper],
)
Am I doing something wrong here?
Regards Jonathan
Your minimal, reproducible example
https://codesandbox.io/s/typescript-playground-export-forked-iqm265?file=/index.tsx
Steps to reproduce
- Create a type with two different types, string and name for example.
- Use the createColumnHelper with the type
- Define columns with columnHelper and type them with ColumnDef
Expected behavior
I expected the Columdef to correctly type my columns.
How often does this bug happen?
Every time
Screenshots or Videos
Platform
Mac OS
react-table version
v8.5.13
TypeScript version
v4.8.2
Additional context
No response
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
Metadata
Metadata
Assignees
Labels
No labels