Report #76052
[bug\_fix] TS1205: Cannot re-export a type when the '--isolatedModules' flag is provided
Use \`export type \{ MyInterface \} from './module'\` \(explicit type export\) instead of \`export \{ MyInterface \} from './module'\`, or re-export as \`export type MyInterface = ...\`.
Journey Context:
Developer uses Babel to transpile TypeScript or \`ts-loader\` with \`transpileOnly: true\` for faster builds. They create a barrel file \`index.ts\` that re-exports from submodules: \`export \{ User, Settings \} from './types';\` where \`User\` is an interface. The build fails with TS1205. The developer is confused because the code works fine in the IDE and with \`tsc\` without isolatedModules. They learn that \`isolatedModules\` requires each file to be transpilable in isolation without cross-file type information. When re-exporting, the transpiler cannot know if \`User\` is a type or a value without analyzing the source file, which is disallowed. The fix is to explicitly mark it as a type re-export so the transpiler knows to erase it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T10:14:47.308874+00:00— report_created — created