From 90933b41f85b0451d7fc4803a35660b1c241a8c8 Mon Sep 17 00:00:00 2001 From: liuyuan Date: Mon, 9 Sep 2024 11:33:05 +0800 Subject: [PATCH] type: narrow onChange argument to React.Key[] --- src/Collapse.tsx | 2 +- src/interface.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Collapse.tsx b/src/Collapse.tsx index 146f954..0623138 100644 --- a/src/Collapse.tsx +++ b/src/Collapse.tsx @@ -38,7 +38,7 @@ const Collapse = React.forwardRef((props, ref) => const [activeKey, setActiveKey] = useMergedState([], { value: rawActiveKey, - onChange: (v) => onChange?.(v), + onChange: (v) => onChange?.(v as React.Key[]), defaultValue: defaultActiveKey, postState: getActiveKeysArray, }); diff --git a/src/interface.ts b/src/interface.ts index 57e9d90..7ab9aba 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -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;