![](/img/trans.png)
[英]Closure compiler source map = empty (Chrome) or wrong (Firefox) code window
[英]Closure Compiler JsDoc annotations to replace tests in source code?
JSDoc注释是否足以测试参数的有效性?
示例:在以下“添加”方法中,参数(点对象)被定义为非空点类型。 然后,在这种方法中并使用Closure Compiler,我可以跳过测试该参数值所需的代码:
if (!point) {...
if (!(point instanceof Point)) {...
谢谢
class Point{
/**
* Add x/y values to the Point object
*
* @param {!Point} point The x/y values to add.
*
*/
add(point) {
this.x += point.x;
this.y += point.y;
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.