-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Describe the bug
Summary: I'm using a DataTable with grouped rows, it's working fine but eslint is giving an error.
In the DataTable component, the groupRowsBy property is defined as such:
/**
* One or more field names to use in row grouping.
*/
groupRowsBy?: ((field: NoInfer<T>) => object) | (keyof T)[] | keyof T | undefined;
What is this "object" in the function return value supposed to be?
The doc doesn't give an example other than passing a field name in the groupRowsBy property, and in the API it just says keyof T | Function | (keyof T)[]
https://primevue.org/datatable/#api.datatable.props.groupRowsBy
I've been passing a function with this signature: (field: any) => string and my linter is flagging it as incompatible because string cannot be assigned to object. But the table seems to be working properly.
Is this a typing problem or a lack of documentation problem?
(for some reason this has only started making my pipelines fail after upgrading several packages, but what I see from the code suggest this error should have been occurring from the start)
Pull Request Link
No response
Reason for not contributing a PR
- Lack of time
- Unsure how to implement the fix/feature
- Difficulty understanding the codebase
- Other
Other Reason
No response
Reproducer
https://stackblitz.com/edit/primevue-4-vite-issue-template-zrbz2qu5?file=src%2FApp.vue
Environment
Windows 11
Vue version
3.5.25
PrimeVue version
4.5.2
Node version
24.11.1
Browser(s)
No response
Steps to reproduce the behavior
- Have a DataTable
- Pass a function that returns a string to the
groupRowsByproperty. - Use eslint
Expected behavior
No linter error.
Edit: I have seen this other issue: #8318
I seem to be using version 3.1.5 of vue-tsc, so I'm not sure this is exactly the same.