是否有可能将 jsdoc 子文档或渲染道具用作函数?

Is it possible document with jsdoc children or render props used as a function?

我正在尝试使用反应渲染模式创建包装器组件,但我也想记录通过 render/children 传递的参数,以便获得有用的智能感知。

我试图将自己的组件定义为 React.ExoticComponent<React.ConsumerProps<MYTYPE>>,但这样做意味着像 <Context.Consumer> 一样声明组件,隐藏输入道具。

const Wrapper = ({children}) => {

    const exampleFunction = () => {} 

    return (
        <div>
            {children({exampleFunction})}
        </div>
    )
}

const ImplementationComponent = () => {

    const exampleFunction = () => {} 

    return (
        <Wrapper>
            {({exampleFunction}) => (
                // <Components...>
            )}
        </Wrapper>
    )
}

我想要在实现中进行类型检查,以帮助使用包装器组件的人。

/** @param {{ children: JSX.Element}} [Props] */

const Wrapper = ({children}) => {...}