Skip to content
Latchkey

TypeScript "TS1484: ... is a type and must be imported using a type-only import"

verbatimModuleSyntax makes TypeScript emit imports/exports verbatim, eliding nothing. A name used only as a type must be imported with import type, otherwise tsc would emit a runtime import of something that has no runtime value - TS1484.

What this error means

tsc (or the framework build) fails with TS1484: '<Name>' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled. It appears after enabling the option, naming each value-imported type.

tsc output
src/api.ts:1:10 - error TS1484: 'User' is a type and must be imported using
a type-only import when 'verbatimModuleSyntax' is enabled.

1 import { User, fetchUser } from './user'
           ~~~~

Diagnose it: which tsconfig and which compiler?

A TypeScript error that appears only in CI usually means the runner is compiling with a different config or a different compiler version than your editor. Your editor uses the workspace TypeScript and the nearest tsconfig.json; CI uses whatever the lockfile resolved and whatever config the build script names.

Terminal
# what CI will actually use
npx tsc --version
npx tsc --showConfig | head -40

# which files are in the program (a missing include is a common cause)
npx tsc --listFiles | wc -l

# type-check only, no emit, same as most CI gates
npx tsc --noEmit

Common causes

A type imported as a value

Under verbatimModuleSyntax the compiler does not strip type-only imports automatically. Importing a type with a plain import { Type } would generate a runtime import of a nonexistent value, so tsc requires import type.

Mixed type/value imports from one module

A single import { Type, value } mixes a type and a runtime value; the type part must be marked type (inline or in a separate statement).

How to fix it

Use import type (or inline type)

Mark type-only imports so nothing runtime is emitted for them.

TypeScript
import type { User } from './user'
import { fetchUser } from './user'
// or inline:
import { type User, fetchUser } from './user'

Autofix across the codebase

Terminal
# typescript-eslint can rewrite these automatically
npx eslint . --fix --rule '{"@typescript-eslint/consistent-type-imports":"error"}'

Pin the compiler so unrelated updates cannot break the gate

TypeScript adds errors in minor releases. An unpinned compiler turns a routine dependency update into a red build on code nobody touched, which is the most common false alarm in a TypeScript CI pipeline.

package.json
// package.json
{
  "devDependencies": {
    "typescript": "5.6.3"   // exact, not ^5.6.3
  }
}

How to prevent it

  • Use import type for type-only imports.
  • Enable @typescript-eslint/consistent-type-imports with autofix.
  • Turn on verbatimModuleSyntax early so import-style issues surface in dev.

Frequently asked questions

What causes TypeScript "TS1484: ... is a type and must be imported using a type-only import"?
There are 2 common causes: a type imported as a value and mixed type/value imports from one module. Under verbatimModuleSyntax the compiler does not strip type-only imports automatically.
How do I fix TypeScript "TS1484: ... is a type and must be imported using a type-only import"?
There are 2 fixes depending on which cause you have: use import type (or inline type) and autofix across the codebase. Work through them in order, since the first is the most common.
What does TypeScript "TS1484: ... is a type and must be imported using a type-only import" actually mean?
tsc (or the framework build) fails with TS1484: '<Name>' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.
How do I stop TypeScript "TS1484: ... is a type and must be imported using a type-only import" happening again?
Use import type for type-only imports. The prevention section lists 3 changes that keep it from recurring.

Related guides

References

Not every red build is your code. Latchkey repairs the ones that are not, on the runner. Start free → 30-day trial · No credit card