Skip to content

Flow type imports syntax is not enough to have module documented #680

Open
@tibdex

Description

@tibdex

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 like this:

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

/**
 * My number
 */
const myNumber: MyNumber = 1;
// types.js
// @flow

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

export type {
  MyNumber
};

Here is the page generated by documentation.js:

sad

But instead I would expect:

happy

Where MyNumber type is added to the documentation.

If I change index.js like this:

 // @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!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions