TypeScript Compiler Options
importsNotUsedAsValues — Removed compiler option
Historically selected import-elision behavior for imports used only as types. Use verbatimModuleSyntax with an appropriate ESM module setting, explicit import type for erased bindings, and an explicit side-effect import when module evaluation is needed. This is not a one-to-one flag replacement. Deprecated in 5.0; no longer functional from 5.5. On the tested 5.8.3 compiler, enabling this option reports TS5102 even with ignoreDeprecations set to "5.0". Remove the entry rather than suppressing the error. The first example is intentionally invalid; the second is a separate migration project. Baseline: TypeScript 5.8.3. File labels are explanatory, not source text.
Formal Syntax & Structure
typescript syntaxtypescript
"importsNotUsedAsValues": "preserve" (historical, invalid on 5.8.3)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| importsNotUsedAsValues | "remove" | "preserve" | "error" | Historical setting only; do not set in new projects. |
Working Example
Example Snippettypescript
// File: tsconfig.json (omit this label){ "compilerOptions": { "target": "ES2022", "module": "CommonJS", "strict": true, "types": [], "skipLibCheck": true, "outDir": "dist", "noEmitOnError": true, "importsNotUsedAsValues": "preserve" }, "files": [ "index.ts" ]}// File: index.ts (omit this label)export const count: number = 7;// Run in a temporary project:// tsc -p . --pretty false// Expected: TS5102. The following separate project demonstrates migration.// File: tsconfig.json (omit this label){ "compilerOptions": { "target": "ES2022", "module": "ESNext", "strict": true, "types": [], "skipLibCheck": true, "outDir": "dist", "noEmitOnError": true, "verbatimModuleSyntax": true }, "files": [ "index.ts" ]}// File: index.ts (omit this label)import type { Item } from "./dep";import "./dep";export const item: Item = { id: 1 };// File: dep.ts (omit this label)export interface Item { id: number }console.log("loaded");// Run: tsc -p . --pretty false