Columns created by columnHelper.accessor has type ColumnDef, which is a union of AccessorColumnDef, DisplayColumnDef, and GroupColumnDef. As a result, they don't know that the accessorFn or accessorKey property exists.
Typing them as narrower types like AccessorFnColumnDef or AccessorKeyColumnDef would allow access to these properties. This is helpful for our current use case where we want to directly call the accessorFn on fake data in unit tests.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
See above
Screenshots or Videos (Optional)
Do you intend to try to help solve this bug with your own PR?
Yes, I am also opening a PR that solves the problem along side this issue
Terms & Code of Conduct
[X] I agree to follow this project's Code of Conduct
[X] 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.
TanStack Table version
8.14.0
Framework/Library version
18
Describe the bug and the steps to reproduce it
Columns created by columnHelper.accessor has type ColumnDef, which is a union of AccessorColumnDef, DisplayColumnDef, and GroupColumnDef. As a result, they don't know that the accessorFn or accessorKey property exists.
Typing them as narrower types like AccessorFnColumnDef or AccessorKeyColumnDef would allow access to these properties. This is helpful for our current use case where we want to directly call the accessorFn on fake data in unit tests.
Example at the bottom of TS Playground
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
See above
Screenshots or Videos (Optional)
Do you intend to try to help solve this bug with your own PR?
Yes, I am also opening a PR that solves the problem along side this issue
Terms & Code of Conduct