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: onSelectionChange - TreeTableSelectionEvent has wrong type #6845

Closed
schlangguru opened this issue Jul 5, 2024 · 2 comments · Fixed by #6847, leoo1992/GeradorQRCode#80 or leoo1992/GeradorQRCode#85 · May be fixed by mtech-31-quemistry/quemistry_client_web#20
Assignees
Labels
Typescript Issue or pull request is *only* related to TypeScript definition
Milestone

Comments

@schlangguru
Copy link

Describe the bug

TreeTable's onSelectionChange callback is defined as (event: TreeTableSelectionEvent) => void whereas the TreeTableSelectionEvent is defined as

interface TreeTableSelectionEvent {
    originalEvent: React.SyntheticEvent;
    value: TreeTableSelectionKeysType; // <--- this type should be TreeTableSelecitonKeysType | string
}

in case of selectionMode === "single" the value of the event is a string instead of TreeTableSelectionKeysType. Therefore the value should be defined as TreeTableSelectionKeysType | string.

Reproducer

No response

PrimeReact version

10.3.1

React version

18.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

@schlangguru schlangguru added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jul 5, 2024
@melloware melloware added Typescript Issue or pull request is *only* related to TypeScript definition and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jul 5, 2024
@melloware melloware self-assigned this Jul 5, 2024
@melloware melloware added this to the 10.7.1 milestone Jul 5, 2024
melloware added a commit to melloware/primereact that referenced this issue Jul 5, 2024
@melloware
Copy link
Member

I fixed it slightly differently. Check out my PR.

melloware added a commit to melloware/primereact that referenced this issue Jul 5, 2024
@melloware
Copy link
Member

@schlangguru no you were right your fix is correct.

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