documentationjs / documentationjs/documentation

How do i document overloaded class constructor?

Open
#1,307 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.8k
Forks
481
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.