Skip to content

Commit 5b50798

Browse files
yuanliu147liuyuan
andauthored
type: narrow onChange argument to React.Key[] (#352)
Co-authored-by: liuyuan <[email protected]>
1 parent d403776 commit 5b50798

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Collapse.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const Collapse = React.forwardRef<HTMLDivElement, CollapseProps>((props, ref) =>
3838

3939
const [activeKey, setActiveKey] = useMergedState<React.Key | React.Key[], React.Key[]>([], {
4040
value: rawActiveKey,
41-
onChange: (v) => onChange?.(v),
41+
onChange: (v) => onChange?.(v as React.Key[]),
4242
defaultValue: defaultActiveKey,
4343
postState: getActiveKeysArray,
4444
});

src/interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export interface CollapseProps {
2424
activeKey?: React.Key | React.Key[];
2525
defaultActiveKey?: React.Key | React.Key[];
2626
openMotion?: CSSMotionProps;
27-
onChange?: (key: React.Key | React.Key[]) => void;
27+
onChange?: (key: React.Key[]) => void;
2828
accordion?: boolean;
2929
className?: string;
3030
style?: object;

0 commit comments

Comments
 (0)