TypeScript Compiler Options
verbatimModuleSyntax — TypeScript compiler option
Preserves ordinary imports and exports while erasing explicit type-only syntax; requires type-only imports where applicable. Does not silently convert ECMAScript import syntax to CommonJS. Default (5.8.3): false. Create the labeled files in an isolated project and run tsc -p tsconfig.json. No diagnostics; output: main.js, dep.js. Local project fixture, not a single-file editor.
Formal Syntax & Structure
typescript syntaxtypescript
{ "compilerOptions": { "verbatimModuleSyntax": true }}Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| verbatimModuleSyntax | boolean | Set in compilerOptions; default: false. |
Working Example
Example Snippettypescript
// File: tsconfig.json (omit this label){ "compilerOptions": { "target": "ES2022", "module": "ESNext", "strict": true, "types": [], "noEmitOnError": true, "noEmit": false, "moduleResolution": "Bundler", "verbatimModuleSyntax": true }, "files": [ "main.ts", "dep.ts" ]}// File: main.tsimport type { Item } from "./dep";export const item: Item = { id: 1 };// File: dep.tsexport interface Item { id: number }