2017-01-31 21 views
1

JsDocのドキュメントに従ってクラス、プロパティ、メソッドを定義しましたが、 "/ somePath"を解析できません:予期しないトークン。私のクラス定義は次のようになります: -エラー: ""を解析できません:予期しないトークン(JSDoc)

/** 
* class representing Lab testResults 
* @param {object} props: contain all the property 
*/ 
class LabTestResult extends Component { 
    constructor(props) { 
     super(props); 
     this.state = { 
      loading: true, 
     } 
     this.collapseButton = this.collapseButton.bind(this); 
    } 
    state = { 
     open: false, 
    }; 
} 

なぜこのエラーが発生しますか?これをどうすれば解決できますか?私を助けてください。

+0

'状態は= {開く:偽};'そこES6では有効ではありません。私はjsdocがすべての実験的な機能をサポートするとは思っていません。 –

答えて

2

これはバニラ2015クラスの場合、次のサンプルがあります(ドキュメントから)。私は "クラス"注釈がパラメータを取るとは思わない。とにかく、これは「簡単なes2015クラスを文書化する」と言う方法です。 paramsはクラスではなくコンストラクタの上にあることに注意してください。私はJSDocウィザードではありませんでしたが、それは間違って見えました。ここから

http://usejsdoc.org/howto-es2015-classes.html

/** 
* Class representing a dot. 
* @extends Point 
*/ 
class Dot extends Point { 
    /** 
    * Create a dot. 
    * @param {number} x - The x value. 
    * @param {number} y - The y value. 
    * @param {number} width - The width of the dot, in pixels. 
    */ 
    constructor(x, y, width) { 
     // ... 
    } 

    /** 
    * Get the dot's width. 
    * @return {number} The dot's width, in pixels. 
    */ 
    getWidth() { 
     // ... 
    } 
} 
関連する問題