Skip to content

Commit

Permalink
fix: type definition for onSelect prop in TreeView component (#17153)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobodeharo authored Sep 5, 2024
1 parent 4fbe220 commit 37a1236
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/react/src/components/TreeView/TreeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ export type TreeViewProps = {
/**
* Callback function that is called when any node is selected
*/
onSelect?: (selected: Array<string | number>, payload: any) => void;
onSelect?: (
event: React.SyntheticEvent<HTMLUListElement>,
payload?: Partial<TreeNodeProps> & {
activeNodeId?: string | number;
}
) => void;
/**
* Array representing all selected node IDs in the tree
*/
Expand All @@ -58,7 +63,7 @@ export type TreeViewProps = {
* Specify the size of the tree from a list of available sizes.
*/
size?: 'xs' | 'sm';
} & React.HTMLAttributes<HTMLUListElement>;
} & Omit<React.HTMLAttributes<HTMLUListElement>, 'onSelect'>;

type TreeViewComponent = {
(props: TreeViewProps): JSX.Element;
Expand Down

0 comments on commit 37a1236

Please sign in to comment.