Skip to content

DataTable wrong TypeScript definition for row click events #1715

Closed
@tft7000

Description

@tft7000
[ x ] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primevue/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=110

Current behavior
DataTable row-click event is defined as Dom Event in https://github.com/primefaces/primevue/blob/master/src/components/datatable/DataTable.d.ts#L109
However in the Documentation and in the code (https://github.com/primefaces/primevue/blob/master/src/components/datatable/TableBody.vue#L396) the event is an Object in the form:

{
  originalEvent: Event;
  data: any; // or T if that can be made available somehow
  index: number;
}

Expected behavior
correct definition of row-click.

Note
If I compare the 'Events' listing under https://primefaces.org/primevue/showcase/#/datatable with the type definitions at https://github.com/primefaces/primevue/blob/master/src/components/datatable/DataTable.d.ts#L94, I think that most event definitions are not correct.

What is the motivation / use case for changing the behavior?
I get typescript errors because the types are not correct:
error TS2322: Type '(event: { originalEvent: MouseEvent; data: MyModel; index: number; }) => void' is not assignable to type '(event: Event) => void'.

Please tell us about your environment:

  • Vue version: 3.2.20

  • PrimeVue version: 3.8.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type: BugIssue contains a bug related to a specific component. Something about the component is not workingvue2-portable

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions