Open
Description
TanStack Table version
8.20.6
Framework/Library version
React 19.0.0
Describe the bug and the steps to reproduce it
When a column is created using the columnHelper.accessor()
utility within a column group columnHelper.group()
the type of getValue
is not correctly inferred.
CodeSandbox: https://codesandbox.io/p/devbox/funny-bush-lfv773
Example:
type Person = {
firstName: string
lastName: string
age: number
visits: number
status: string
progress: number
}
const defaultData: Person[] = [
{
firstName: 'tanner',
lastName: 'linsley',
age: 24,
visits: 100,
status: 'In Relationship',
progress: 50,
},
{
firstName: 'tandy',
lastName: 'miller',
age: 40,
visits: 40,
status: 'Single',
progress: 80,
},
{
firstName: 'joe',
lastName: 'dirte',
age: 45,
visits: 20,
status: 'Complicated',
progress: 10,
},
]
const columnHelper = createColumnHelper<Person>()
const columns = [
columnHelper.accessor('firstName', {
cell: info => info.getValue(),
footer: info => info.column.id,
}),
columnHelper.group({
id:'group',
columns:[
columnHelper.accessor(row => row.lastName, {
id: 'lastName',
// Unsafe return of a value of type `any`.
// eslint[@typescript-eslint/no-unsafe-return](https://typescript-eslint.io/rules/no-unsafe-return)
// CellContext<Person, any>.getValue: <any>() => any
cell: info => <i>{info.getValue()}</i>,
header: () => <span>Last Name</span>,
footer: info => info.column.id,
}),
]
})
]
Potentially related issue: #5065
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://codesandbox.io/p/devbox/funny-bush-lfv773
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
No, because I do not know how
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
Assignees
Labels
No labels