How can I export and import a type definition independently from the module itself.
In flowtype this would look like this:
The file sub.js
export the type myType
using export type myType = {id: number};
and the file main.js
imports the type using import type {myType} from './sub.js';
You just import it normally and the compiler works out that you don't need the import statement emitted because no concrete code is used.
Here's an example:
component.ts
app.ts
The app.js file is simply (ES2015 version):
Or in older ES5 terms:
The important thing here is that the TypeScript compiler has worked out that the import is only needed at compile time, not runtime.