Skip to content

Commit

Permalink
type: narrow onChange argument to React.Key[] (#352)
Browse files Browse the repository at this point in the history
Co-authored-by: liuyuan <[email protected]>
  • Loading branch information
yuanliu147 and liuyuan authored Oct 28, 2024
1 parent d403776 commit 5b50798
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Collapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Collapse = React.forwardRef<HTMLDivElement, CollapseProps>((props, ref) =>

const [activeKey, setActiveKey] = useMergedState<React.Key | React.Key[], React.Key[]>([], {
value: rawActiveKey,
onChange: (v) => onChange?.(v),
onChange: (v) => onChange?.(v as React.Key[]),
defaultValue: defaultActiveKey,
postState: getActiveKeysArray,
});
Expand Down
2 changes: 1 addition & 1 deletion src/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface CollapseProps {
activeKey?: React.Key | React.Key[];
defaultActiveKey?: React.Key | React.Key[];
openMotion?: CSSMotionProps;
onChange?: (key: React.Key | React.Key[]) => void;
onChange?: (key: React.Key[]) => void;
accordion?: boolean;
className?: string;
style?: object;
Expand Down

0 comments on commit 5b50798

Please sign in to comment.