TypeScript Compiler Options
isolatedModules — TypeScript compiler option
Reports constructs that single-file transpilers cannot reliably interpret. Does not disable whole-program checking or switch tsc to transpile-only mode. Prefer explicit type-only re-exports. Default (5.8.3): false. Create the labeled files in an isolated project and run tsc -p tsconfig.json. No diagnostics; output: none. Local project fixture, not a single-file editor.
Formal Syntax & Structure
typescript syntaxtypescript
{ "compilerOptions": { "isolatedModules": true }}Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| isolatedModules | boolean | Set in compilerOptions; default: false. |
Working Example
Example Snippettypescript
// File: tsconfig.json (omit this label){ "compilerOptions": { "target": "ES2022", "module": "CommonJS", "strict": true, "types": [], "noEmitOnError": true, "noEmit": true, "isolatedModules": true }, "files": [ "main.ts", "dep.ts" ]}// File: main.tsexport type { Item } from "./dep";// File: dep.tsexport interface Item { id: number }