admin管理员组文章数量:1023815
I want to write JSDoc for some React component:
/**
* Some Component
* @param {Object} props - props of the component
* @param {boolean} [props.active=false] - active
* @param {string} props.text - text
* ...
* @returns {React.ReactElement} Some Component
*/
How can I correctly add property named 'aria-label'
in JSDoc?
I can't find the necessary solution in the Net.
I want to write JSDoc for some React component:
/**
* Some Component
* @param {Object} props - props of the component
* @param {boolean} [props.active=false] - active
* @param {string} props.text - text
* ...
* @returns {React.ReactElement} Some Component
*/
How can I correctly add property named 'aria-label'
in JSDoc?
I can't find the necessary solution in the Net.
Share Improve this question asked Nov 28, 2024 at 10:09 Lazy_CatLazy_Cat 215 bronze badges 3 |1 Answer
Reset to default 0@param {string} props['aria-label'] - your description
or in case it is not a part of props object:
@param {string} ['aria-label'] - your description
I want to write JSDoc for some React component:
/**
* Some Component
* @param {Object} props - props of the component
* @param {boolean} [props.active=false] - active
* @param {string} props.text - text
* ...
* @returns {React.ReactElement} Some Component
*/
How can I correctly add property named 'aria-label'
in JSDoc?
I can't find the necessary solution in the Net.
I want to write JSDoc for some React component:
/**
* Some Component
* @param {Object} props - props of the component
* @param {boolean} [props.active=false] - active
* @param {string} props.text - text
* ...
* @returns {React.ReactElement} Some Component
*/
How can I correctly add property named 'aria-label'
in JSDoc?
I can't find the necessary solution in the Net.
Share Improve this question asked Nov 28, 2024 at 10:09 Lazy_CatLazy_Cat 215 bronze badges 3-
1
Object property names with hyphens doesn't seem to be well-supported by JSDoc. Maybe try
* @param {string} props.aria-label - an alternative label
? – evolutionxbox Commented Nov 28, 2024 at 10:51 - It does not work. – Lazy_Cat Commented Dec 2, 2024 at 16:21
- 1 After some investigation it appears that JSDoc doesn't support params with hyphens in their name. – evolutionxbox Commented Dec 2, 2024 at 19:56
1 Answer
Reset to default 0@param {string} props['aria-label'] - your description
or in case it is not a part of props object:
@param {string} ['aria-label'] - your description
本文标签: javascriptHow to write JSDoc if name of property is stringlike 39arialabel39Stack Overflow
版权声明:本文标题:javascript - How to write JSDoc if name of property is string, like 'aria-label' - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745516730a2154099.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
* @param {string} props.aria-label - an alternative label
? – evolutionxbox Commented Nov 28, 2024 at 10:51