How to create a package with the isolatedModules=true option enabled?

github.com/babel/babel-loader/issues/603 (thanks to @CollinD for the link) includes a workaround for how to re-export imported types. This comment on that issue has the best explanation of a workaround:

You can still do are-export if it's clear that you're exporting a type:

import { T as a_T } from "./a";
export type T = a_T;

You can also do export * from "./a";.

If I'm reading that GitHub issue correctly, only TS types can be re-exported, but values (e.g. classes) can't be re-exported. So if TS knows that you're importing a type (not a class) then you can re-export it.

Here's another example that's simpler:

import { T } from "./a";
export type T = T;

CRA v3.4.1 facilitates type re-exports under --isolatedModules. The contained @babel/preset-typescript in version v7.9.0+ (see corresponding Babel release and announcement) and TypeScript support TS 3.8 type-only imports and exports. You can now write:

export type { MyListType } from "./list/BoundList"

// or
import type { MyListType } from "./list/BoundList"
export type { MyListType }
// note additional "type" keyword

Take a look at this answer for more info on the import/export syntax.