定义Type类型 /** * @typedef {Object} AccordionProps * @property {React.ReactNode} children * @property {string} [className] * @property {boolean} [allowMultiple] - 是否允许同时展开多个 * @property {React.Ref} ref * @property {Array<string | number> | string | number} value - 当前展开的索引 * @property {Function} onChange - 当展开的索引发生变化时的回调 * @property {Array<string | number> | string | number} defaultValue - 默认展开 */ 设置组件JSDoc /** * @type React.ForwardRefRenderFunction<HTMLDivElement, AccordionProps> */ const AccordionRoot = React.forwardRef() 动态 ref 定义 /** * @type React.ForwardRefRenderFunction<?, ButtonPropTypes> */