如果存在,我如何设置Typescript以使用JSDoc类型?
我的函数注释了参数和返回类型,但typescript仍然是any。如果存在JSDoc,我如何设置Typescript来定义我的参数和返回类型?(Visual Studio Code error)
/**
* Creates arrow icon's class name to rotate it upon its x axis.
*
* Arrow icon communicates to the user that they can expand or collapse the filter.
*
* @param {boolean} isOpen If the filter is open so that it can be viewed.
* @returns {string} The class name for the arrow icon.
*/
const arrowClassName = (isOpen) =>
isOpen ? styles.arrowIcon : `${styles.arrowIcon} ${styles.expanded}`;
isOpen
:Parameter 'isOpen' implicitly has an 'any' type.ts(7006)
显示错误
打印稿需要在Javascript文件(*.js
)支持大多数JSDoc注释。