我已经编写了无状态组件,并在组件外部声明了Props。当我尝试生成jsdoc
抛出错误时。
MyComponent.js
/**
*
* Custom Props for title and data array
*/
type Props = {
title: string,
data: Array<Object>
};
const MyComponent = ({ title, data }: Props) => {
const sortedData = data.sort((a, b) => a.value - b.value).reverse();
return (
<div>
//...
</div>
);
};
export default MyComponent;
jsdoc命令:
./node_modules/.bin/jsdoc ./src/MyComponent.js
错误:
意外的令牌,预期的; (19:5)
需要帮助,在此先感谢:)