Given a type definition that is imported from another module, how do you re-export it?
/**
* @flow
*/
import type * as ExampleType from './ExampleType';
...
// What is the syntax for exporting the type?
// export { ExampleType };
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
.