如何使用JsDoc进行“混合"类型? [英] How to JsDoc a "mixed" type?

查看:252
本文介绍了如何使用JsDoc进行“混合"类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一个简单的问题,如何记录混合类型"?我知道我可以列出所有可能的类型,例如{null|undefined|String|Number|Object}并最终发现自己缺少一种,并使它过于复杂.我尝试使用Mixed关键字,但是它在许多IDE(例如WebStorm)中弹出错误.

Simple question, how do I document that "Mixed-type"? I know I could just list all possible types like {null|undefined|String|Number|Object} and end up finding myself missing one and making it overly complex. I tried using the Mixed keyword, but it popups errors in many IDEs such as WebStorm.

推荐答案

我找到了解决方法:

/**
 * @param {*} foo
 */
function bar(foo) {}

这篇关于如何使用JsDoc进行“混合"类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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