documentationjs / documentationjs/documentation

Support for Flow $Keys utility type

Open
#920 4 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

(I've had a look through the flow-related issues and I don't think this has been reported before.)

I'm using the flow [`$Keys`](https://flow.org/en/docs/types/utilities/#toc-keys) utility type as follows:
```js
export const FaceAxisInfo = {
R: Axes.X,
L: Axes.X,
U: Axes.Y,
D: Axes.Y,
F: Axes.Z,
B: Axes.Z
};

/**
* The face of the cube to turn is represented by a single-character string
*/
export type Face = $Keys;
```

When I generate documentation for this type, I get the following markdown:

```
Face

The face of the cube to turn is represented by a single-character string

Type: $Keys
```

Since $Keys is equivalent to declaring a union type, I'd hope to instead see:

```
...
Type: 'R' | 'L' | 'U' | 'D' | 'B' | 'F'
```

But the current output suggests to me that $Keys isn't currently supported. Additionally, adding JSDoc to `FaceAxisInfo` (so that it gets added to the docs as well) doesn't change the output.

Version:
```
$ npm ls documentation
└── documentation@5.2.2
```
Command used: `documentation readme index.js --section=API`

I'd be interested in contributing to add support for $Keys.

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.