Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTable: rowClass, rowStyle typing defects #5498

Closed
ajon88 opened this issue Apr 1, 2024 · 3 comments
Closed

DataTable: rowClass, rowStyle typing defects #5498

ajon88 opened this issue Apr 1, 2024 · 3 comments
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@ajon88
Copy link

ajon88 commented Apr 1, 2024

Describe the bug

3.49.1 => rowClass?: (data: any) => object | string | undefined;
TypeScript threw an error in version 3.50.0.
The expected type comes from property 'rowClass' which is declared here on type 'DataTableProps & VNodeProps & AllowedComponentProps & ComponentCustomProps & Record<string, unknown>'

Reproducer

npx vue-tsc --noEmit --skipLibCheck

PrimeVue version

3.50.0

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

Chrome/Edge

Steps to reproduce the behavior

npx vue-tsc --noEmit --skipLibCheck

Expected behavior

no such error

@ajon88 ajon88 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 1, 2024
@ZiadJ
Copy link

ZiadJ commented Apr 1, 2024

Potential duplicate: #5414

@TQ-Benji
Copy link

TQ-Benji commented Apr 8, 2024

Also getting the error from typescript when setting rowClass to a function

Type '(data: Item) => string' is not assignable to type '(data: any) => object | undefined'.ts-plugin(2322)
DataTable.d.ts(1070, 5): The expected type comes from property 'rowClass' which is declared here on type 'DataTableProps & VNodeProps & AllowedComponentProps & ComponentCustomProps & Record<string, unknown>'
(property) DataTableProps.rowClass?: ((data: any) => object | undefined) | undefined
A function that takes the row data as a parameter and returns a string to apply a particular class for the row.

@slavco86
Copy link

I have the same issue
Looking into DataTable.d.ts

rowClass?: (data: any) => object | undefined;

Isn't particularly helpful as it doesn't provide any idea of what shape object should the function return 🤔

@tugcekucukoglu tugcekucukoglu added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Apr 26, 2024
@tugcekucukoglu tugcekucukoglu added this to the 3.52.0 milestone Apr 26, 2024
tugcekucukoglu added a commit that referenced this issue Apr 26, 2024
fix(DataTable): fix rowClass type definition and improve usage documentation for rowClass and rowStyle. Fixes #5498
@tugcekucukoglu tugcekucukoglu changed the title PrimeVue 3.50.0 DataTable.d.ts => rowClass?: (data: any) => object | undefined; DataTable: rowClass, rowStyle typing defects Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

5 participants