![](/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.