How do you export a Flow type definition that is imported from another file?

The simplest form of this question is "how do I export a type alias?" and the simple answer is "with export type!"

For your example, you can write

/**
 * @flow
 */

import type * as ExampleType from './ExampleType';
export type { ExampleType };

You may ask "why is ExampleType a type alias?" Well, when you write

type MyTypeAlias = number;

You are explicitly creating the type alias MyTypeAlias which aliases number. And when you write

import type { YourTypeAlias } from './YourModule';

You are implicitly creating the type alias YourTypeAlias which aliases the YourTypeAlias export of YourModule.js.


The following works nicely

export type { Type } from './types';