documentation icon indicating copy to clipboard operation
documentation copied to clipboard

How do i document overloaded class constructor?

Open DigitalBrainJS opened this issue 5 years ago • 0 comments

Is there any particular way to document overloaded constructor? For example, I would like to document the following constructor:

class Pokemon{
    /**
     * @param {Object} options - some options
     *//**
     * @param {String} name - pokemon's name
     */
    constructor(arg0){
        const options = typeof arg0 === 'object' ? arg0 : {name: arg0};
        //do something with options
    };
}

I expect to get two entries in the documentation, ideally they should be grouped because they just overload the same constructor:

new Pokemon(options: Object)

Parameters

  • options (Object) some options
new Pokemon(name: String)

Parameters

  • name (String) pokemon's name

But currently i get something like this:

new Pokemon(arg0: any, name: String)

Parameters

  • arg0 (any)
  • name (String) pokemon's name

DigitalBrainJS avatar Feb 24 '20 00:02 DigitalBrainJS