From 37a12365ce4d504182c7d37ae74e08ecd1b71ef5 Mon Sep 17 00:00:00 2001 From: Jacobo de Haro Date: Thu, 5 Sep 2024 14:48:14 +0200 Subject: [PATCH] fix: type definition for onSelect prop in TreeView component (#17153) --- packages/react/src/components/TreeView/TreeView.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/react/src/components/TreeView/TreeView.tsx b/packages/react/src/components/TreeView/TreeView.tsx index 56ad2dd84f5f..0c55ebf74781 100644 --- a/packages/react/src/components/TreeView/TreeView.tsx +++ b/packages/react/src/components/TreeView/TreeView.tsx @@ -49,7 +49,12 @@ export type TreeViewProps = { /** * Callback function that is called when any node is selected */ - onSelect?: (selected: Array, payload: any) => void; + onSelect?: ( + event: React.SyntheticEvent, + payload?: Partial & { + activeNodeId?: string | number; + } + ) => void; /** * Array representing all selected node IDs in the tree */ @@ -58,7 +63,7 @@ export type TreeViewProps = { * Specify the size of the tree from a list of available sizes. */ size?: 'xs' | 'sm'; -} & React.HTMLAttributes; +} & Omit, 'onSelect'>; type TreeViewComponent = { (props: TreeViewProps): JSX.Element;