TreeTable: selectionChange emitter type error #13254
Labels
Type: Bug
Issue contains a bug related to a specific component. Something about the component is not working
Milestone
Describe the bug
The type of the
selectionChange
emitter in the TreeTable component is currently defined asEventEmitter<TreeTableNode<any> | null>
. However, specifying it this way leads to a type error and prevents the two-way binding of theselection
property from working correctly. The correct type should beEventEmitter<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 typeTreeNode[]
. However, starting from version 16.x, it has been changed toEventEmitter<TreeTableNode<any> | null>
, transitioning from an array of objects to a single object. When attempting to pass a value of typeTreeTableNode
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 theselectionChange
emitter asEventEmitter<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
TreeTableNode | null
in the component class.Expected behavior
No response
The text was updated successfully, but these errors were encountered: