documentationjs / documentationjs/documentation

Flow type imports syntax is not enough to have module documented

Abierto
#680 7 comentarios 4 reacciones 0 asignados Ver en GitHub
enhancement
Lenguaje dominante
JavaScript
Estrellas
5.8k
Forks
481
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Hi,

I'm trying to use `documentation.js` 4.0.0-beta.18 with `Flow` and it's working pretty well for infering types. However, my code is spread across several modules and I would like to use the [Flow type imports syntax](https://flowtype.org/docs/modules.html#type-imports--exports) like this:

```javascript
// index.js
// @flow
import type {MyNumber} from './types';

/**
* My number
*/
const myNumber: MyNumber = 1;
```

```javascript
// types.js
// @flow

/**
* My number type
*/
type MyNumber = number;

export type {
MyNumber
};
```

Here is the page generated by `documentation.js`:

![sad](https://cloud.githubusercontent.com/assets/6574550/23314562/c373ed44-fac2-11e6-886a-a19a8dfbea3e.png)

But instead I would expect:

![happy](https://cloud.githubusercontent.com/assets/6574550/23314602/f132a162-fac2-11e6-86eb-11cbc46d65d9.png)

Where `MyNumber` type is added to the documentation.

If I change `index.js` like this:

```diff
// @flow
+import './types';
import type {MyNumber} from './types';
```

Then I'll have the result of the second image.

So to me, it seems like an `import type` statement is not enough to have `documentation.js` look up the content of the imported module.

Can we add support for this `import type` syntax into `documentation.js` ? If yes, do you have an idea of where should I start if I wanted to change the actual behaviour and submit a PR ?

Thanks!

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Reproduce el problema con los ejemplos mostrados de index.js y types.js utilizando documentation.js y, a continuación, inspecciona cómo se gestionan los módulos importados y las importaciones de tipos de Flow. Confirma el cambio de comportamiento comprobando que la documentación generada incluye el tipo MyNumber sin añadir una importación de valor independiente.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript
Área
documentation
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
38/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.