Report #92774
[bug\_fix] TS1205: Cannot re-export a type when the '--isolatedModules' flag is provided.
Use explicit type-only re-exports by adding the \`type\` keyword: change \`export \{ MyType \} from './types'\` to \`export type \{ MyType \} from './types'\`, or \`import type \{ MyType \} from './types'; export type \{ MyType \};\`. Root cause: With \`isolatedModules: true\` \(required by Babel, esbuild, and SWC transpilers\), each file is transpiled independently without cross-file type information. The transpiler cannot determine if \`MyType\` is a type or a value during the isolated pass, so it cannot safely elide the export. Explicit \`type\` annotations signal that the export is type-only and can be safely removed in JS output.
Journey Context:
You are using Babel to transpile TypeScript for faster builds \(or using Create React App / Next.js which sets isolatedModules: true by default\). You create a barrel file \(index.ts\) to clean up imports: \`export \{ User, UserRole \} from './user';\` where \`User\` is an interface and \`UserRole\` is an enum \(value\). TypeScript throws TS1205 on the \`User\` export. You try to separate them: \`export type \{ User \} from './user';\` and \`export \{ UserRole \} from './user';\`. This works. You realize that for any type-only export \(interfaces, type aliases\), you must use the \`type\` keyword in the re-export statement. This is also necessary for single-file transpilation consistency.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T14:18:33.219925+00:00— report_created — created