javascriptwebstormjsdocjsdoc3

How to document field with dash with JSDoc


Given an object definition that I'm not allowed to modify:

let a = {"a-b" : 5};

How can I add JSDoc over it ?

I tried

/**
* @type {{"a-b": number}}
*/

But WebStorm tells me that this is not valid JSDoc.


Solution

  • At the moment it's a topic which hasn't been resolved yet and still is in-progress.

    I'd suggest to use class comments:

    /**
     * @typedef {Object}
     * @property {number} a-b
     */