Report #14959
[bug\_fix] TS1205: Re-exporting a type when the '--isolatedModules' flag is provided requires using 'export type'
Use 'export type \{ MyType \}' instead of 'export \{ MyType \}' when re-exporting types in barrel files. For mixed exports, use 'export type \{ MyType \}' alongside 'export \{ myValue \}' or use 'export \* from './module''.
Journey Context:
Developer is working with Create React App, Next.js, or Vite, all of which enable '"isolatedModules": true' by default \(required by Babel's TypeScript transpilation which operates file-by-file without cross-file type information\). They create a barrel file 'index.ts' to clean up imports: 'export \{ Foo \} from './foo'; export \{ Bar \} from './bar';'. However, 'Foo' is an interface \(type-only\). The build fails with TS1205. The developer tries 'export type \{ Foo \}' and the error resolves for Foo, but they have hundreds of exports and don't know which are types vs values. They try 'export \* from './foo'' which works because TypeScript handles the filtering internally, but they lose control over the public API surface. They learn that because Babel \(and thus isolatedModules\) transpiles each file independently, it cannot determine during the single-file transform whether an exported symbol from another file is a type or a value. Therefore, the developer must explicitly mark type re-exports with 'export type' so the compiler knows to elide them during the JavaScript emit phase.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T22:49:26.058086+00:00— report_created — created