documentationjs / documentationjs/documentation

Flow union types

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

Description

It would be super awesome if documentation.js understood union types. Example:

```JS
type Ratio =
| number
| 'minorSecond'
| 'majorSecond'
| 'minorThird'
| 'majorThird'
| 'perfectFourth'
| 'augFourth'
| 'perfectFifth'
| 'minorSixth'
| 'goldenSection'
| 'majorSixth'
| 'minorSeventh'
| 'majorSeventh'
| 'octave'
| 'majorTenth'
| 'majorEleventh'
| 'majorTwelfth'
| 'doubleOctave'

const scale = (steps: number, ratio?: Ratio = 'perfectFourth'): string { /* ... */ }
```

In the documentation, this will show this signature:

```
scale(steps: number, ratio: [Ratio])
```

and these parameters:

```
steps (number)
ratio ([Ratio] (default 'perfectFourth') )
```

It would be awesome if documentation.js could get the values this union can have and put them in the parameter description!

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.