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

TreeTable: selectionChange emitter type error #13254

Closed
ronozato opened this issue Jun 26, 2023 · 1 comment · Fixed by #13255
Closed

TreeTable: selectionChange emitter type error #13254

ronozato opened this issue Jun 26, 2023 · 1 comment · Fixed by #13255
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@ronozato
Copy link
Contributor

Describe the bug

The type of the selectionChange emitter in the TreeTable component is currently defined as EventEmitter<TreeTableNode<any> | null>. However, specifying it this way leads to a type error and prevents the two-way binding of the selection property from working correctly. The correct type should be EventEmitter<TreeTableNode<any>[] | null>.

In versions up to 15.x, the type of this emitter was EventEmitter<any>, and the sample code binds it to a variable of type TreeNode[]. However, starting from version 16.x, it has been changed to EventEmitter<TreeTableNode<any> | null>, transitioning from an array of objects to a single object. When attempting to pass a value of type TreeTableNode to the [(selection)] property according to this new specification, an error occurs: ERROR TypeError: (this.selection || []) is not iterable. On the other hand, if you modify the PrimeNG source code and specify the type of the selectionChange emitter as EventEmitter<TreeTableNode<any>[] | null>, it works without any issues.

Environment

Ubuntu 22.04.1 LTS (WSL)

Reproducer

No response

Angular version

16.1.2

PrimeNG version

16.0.2

Build / Runtime

Angular CLI App

Language

TypeScript

Node version (for AoT issues node --version)

18.15.0

Browser(s)

Chrome 114.0.5735.134

Steps to reproduce the behavior

  1. Create a TreeTable component and set the selectionMode to 'checkbox'.
  2. Create a property of type TreeTableNode | null in the component class.
  3. Bind the value of the previously created property to [(selection)].
  4. An error occurs when checking the checkbox.

Expected behavior

No response

@ronozato ronozato added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jun 26, 2023
ronozato added a commit to ronozato/primeng that referenced this issue Jun 26, 2023
mertsincan pushed a commit that referenced this issue Aug 21, 2023
@mertsincan mertsincan 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 Aug 21, 2023
@mertsincan mertsincan added this to the 16.2.1 milestone Aug 21, 2023
@dylansyoung
Copy link
Contributor

When is this bug fix slated to be released?

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

Successfully merging a pull request may close this issue.

3 participants