Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How do I set up Typescript to use the JSDoc types if it exists

How do I set up Typescript to use the JSDoc types if it exists?

I have my function annotating the parameter and return type but typescript still as any. How can I set up Typescript to define my parameter and return types by its JSDoc if a JSDoc exists? (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}`;

Error displayed on isOpen: Parameter 'isOpen' implicitly has an 'any' type.ts(7006)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Typescript requires files to be in Javascript (*.js) to support most the of JSDoc annotations.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading