In a TypeScript project, verbatimModuleSyntax makes tsc write every import and export as written, dropping only those marked type. That is about output, and a JavaScript project with noEmit has none. It also cannot change how you import types: JavaScript has no import type syntax, and type imports in JSDoc (@import, import("./x.js").T) never reach the output anyway.
What it does do in a .js file: under module: "nodenext", it reports ESM export syntax in a file TypeScript treats as CommonJS (TS1287): a .cjs file, or a .js file whose package.json says "type": "commonjs" or has no type field. Without the option, TypeScript checks such a file quietly. Node.js refuses export in a file it loads as CommonJS; recent Node.js versions run a .js file without a type field as an ES module when it uses ES module syntax, so the error matters most where "type": "commonjs" is set. It arrived with TypeScript 5.0, and tsc --init writes it in 5.9.
At a glance
| Write | Optional in a .js project. Turn it on if some files are CommonJS: it reports export syntax in files TypeScript treats as CommonJS |
|---|---|
| On the command line | --verbatimModuleSyntax |
| Type | boolean |
| Default in TypeScript 5.9 | false |
| TypeScript's description | Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. |
The description is quoted from TypeScript's own option list (Apache-2.0); see the notices.
Examples
export const port = 8080;error TS1287: A top-level 'export' modifier cannot be used on value declarations in a CommonJS module when 'verbatimModuleSyntax' is enabled.jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": [],
"verbatimModuleSyntax": true
},
"include": [
"*.js"
]
} export const port = 8080;jsconfig.json for this example
{
"compilerOptions": {
"checkJs": true,
"noEmit": true,
"strict": true,
"target": "es2022",
"module": "nodenext",
"types": []
},
"include": [
"*.js"
]
} Importing a type in JavaScript
With or without this option, import { Config } from "./types.js" for a name that is only a @typedef is an error in a .js file (TS18042): JavaScript imports are values. Use @import (TypeScript 5.5 and later) or an import() type in JSDoc.
Gotchas
- In TypeScript 5.9 an
importstatement in a CommonJS.jsfile is not reported under this option, onlyexport; Node.js rejects both.
Sources
- TSConfig Reference: verbatimModuleSyntax · TypeScript
- TypeScript 5.0 release notes · TypeScript handbook
- TypeScript 5.9 release notes · TypeScript handbook
Last reviewed 20 October 2026.