Q72: What does the `isolatedModules` tsconfig flag enforce and why is it needed for single-file transpilers (Babel/SWC/esbuild)?

Difficulty:MediumTopic:Compiler Options

Single-file transpilers (like Babel, SWC, or esbuild) process source files individually without building a full cross-file type graph.

Enabling isolatedModules: true instructs TypeScript to raise warnings if you use syntax features that single-file transpilers cannot process safely (such as re-exporting non-type-only types or using un-inlined const enums).

Key Takeaways
  • Ensures code can be safely transpiled by single-file build tools like Babel or esbuild.