如何使用jsdoc记录解构变量 [英] How to document destructured variable with jsdoc

查看:119
本文介绍了如何使用jsdoc记录解构变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的东西:

let { total } = settings;

如何记录总变量?我尝试过这样的事情:

How do I document the total variable? I tried something like this:

/**
 * @type {Object}
 * @property {String} total.test
 */
let { total } = settings;

但这似乎不是正确的方法.

but it doesn't seem to be the right way.

有什么建议吗?

推荐答案

@ Tommy-Pepsi Gaudreau 他对原始问题的评论是如此贴切.

@Tommy-Pepsi Gaudreau was so close in his comment on the original question.

这是一个警告数量:2

JSC_TYPE_MISMATCH: assignment
found   : string
required: boolean at line 15 character 4
    b='warn';
    ^
JSC_TYPE_MISMATCH: assignment
found   : boolean
required: string at line 16 character 4
    s=false;
    ^

Edit-2018年9月27日:我减少了初始键入的数量,以确保/澄清类型不会被忽略,并且警告来自破坏结构中的类型.

Edit - Sep 27, 2018: I've reduced the amount of initial typing to ensure/clarify the types weren't being ignored, and that the warnings were coming from the types in the destructuring.

这篇关于如何使用jsdoc记录解构变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆