TS1484Compiler Error
Since TS 5.0

Fix TS1484: Type Must Use a Type-Only Import

Learn why TypeScript throws TS1484 when verbatimModuleSyntax is enabled and an import names a type, and how to fix it with import type.

error TS1484: 'X' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled

What This Error Means

TS1484 means one of your imports named something that only exists in the type system — an interface, a type alias, or a type-only export — and the project has verbatimModuleSyntax switched on. With that flag, TypeScript refuses to guess: an import that has no runtime value behind it has to say so, with the type keyword.

The flag exists because of import elision. Before verbatimModuleSyntax (TypeScript 5.0), the compiler quietly deleted any import binding it decided was used only in type positions, and it needed the whole program to make that call. Single-file transpilers — esbuild, swc, Babel, Node's built-in type stripping — see one file at a time and cannot make it. verbatimModuleSyntax fixes that by emitting imports exactly as written, and the price is that you must label the type-only ones yourself.

error TS1484: 'User' is a type and must be imported using a type-only import
              when 'verbatimModuleSyntax' is enabled.
 
  import { User, createUser } from "./types"
           ~~~~
           interface — erased at compile time, so the emitted import would
           reference a name that does not exist at runtime

Every sample on this page is compiled with "verbatimModuleSyntax": true and an ES module setting ("module": "esnext" or "nodenext"). None of them produce an error without that flag, which is why this error tends to arrive all at once: somebody scaffolds a Vite React or Vue project, inherits a shared base config, or bumps to TypeScript 5, and two hundred perfectly good imports light up on the same afternoon.

Common Causes

1. An Interface Or Type Alias Imported Like A Value

The plain case. A module exports a mix of types and values, and the import statement treats them all the same.

// ❌ Broken — src/userProfile.ts
import { User, Role } from "./types"
//       ~~~~  ~~~~
// Error: 'User' is a type and must be imported using a type-only import
//        when 'verbatimModuleSyntax' is enabled.
 
export function describeUser(user: User, role: Role): string {
  return `${user.email} (${role})`
}

Both names are flagged, and nothing is wrong with the code itself — User is an interface and Role is a type alias, so neither survives compilation. A class, enum, const or function imported from the same module would pass without complaint, because those still exist when the program runs.

// ✅ Fixed — the whole import is type-only, so the compiler erases it
import type { User, Role } from "./types"
 
export function describeUser(user: User, role: Role): string {
  return `${user.email} (${role})`
}

import type is the right tool when every name in the statement is a type. It also documents intent: a reader (and a bundler) can see at a glance that this line disappears from the output.

2. Types Mixed With Values In One Import

Far more common in React code, where the type and the thing you actually call ship from the same package.

// ❌ Broken — src/components/OrderBadge.tsx
import { FC, useState } from "react"
//       ~~
// Error: 'FC' is a type and must be imported using a type-only import
//        when 'verbatimModuleSyntax' is enabled.
 
export const OrderBadge: FC<{ label: string }> = ({ label }) => {
  const [open, setOpen] = useState(false)
  return <button onClick={() => setOpen(!open)}>{label}</button>
}

Only FC is flagged. useState is a real function and must stay in the emitted import, so moving the whole statement to import type would break the component at runtime. That is what the inline type modifier (TypeScript 4.5+) is for.

// ✅ Fixed — inline modifier erases FC, keeps useState
import { type FC, useState } from "react"
 
export const OrderBadge: FC<{ label: string }> = ({ label }) => {
  const [open, setOpen] = useState(false)
  return <button onClick={() => setOpen(!open)}>{label}</button>
}

Two separate statements — import type { FC } from "react" next to import { useState } from "react" — work just as well and some teams prefer them for grepability. Pick one convention and let a lint rule hold the line; mixing both styles across a codebase is the thing that makes these imports churn in every review.

3. Re-Exporting A Type Through A Barrel File

Barrel files hit this twice, because verbatimModuleSyntax polices the export side too.

// ❌ Broken — src/domain/index.ts
import { User, Session } from "./types"
//       ~~~~
// Error: 'User' is a type and must be imported using a type-only import
//        when 'verbatimModuleSyntax' is enabled.
 
export { User, Session }
//       ~~~~
// Error: Re-exporting a type when 'verbatimModuleSyntax' is enabled
//        requires using 'export type'. (TS1205)

User is an interface and Session is a class, so the compiler complains about the first name on both lines and leaves the second alone. Seeing TS1484 and TS1205 together is a reliable signal that you are looking at a barrel: fix only the import and the export error stays.

// ✅ Fixed — split the re-export by what survives compilation
export type { User } from "./types"
export { Session } from "./types"

Re-exporting straight from the source module is shorter than importing and then exporting, and it keeps the two halves of the rule in one place. If you need the import as well — because the barrel also uses User locally — mark both ends: import { type User, Session } from "./types" followed by export { type User, Session }.

4. Generated Or Vendored Files Inside Your Own Program

Code you did not write by hand is checked exactly like code you did. API clients from an OpenAPI or GraphQL generator, Supabase and Prisma output, a vendored snapshot of a small library — any .ts file inside include has to satisfy the flag.

// ❌ Broken — src/generated/apiClient.ts (regenerated on every build)
import { OrderDto } from "./models"
//       ~~~~~~~~
// Error: 'OrderDto' is a type and must be imported using a type-only import
//        when 'verbatimModuleSyntax' is enabled.
 
export const parseOrder = (raw: unknown): OrderDto => raw as OrderDto

Editing the file is pointless — the next npm run codegen undoes it. Note that this only bites for .ts sources: a .d.ts file is exempt, so a dependency shipping declarations with unmarked type imports never triggers TS1484, no matter what skipLibCheck is set to.

// ✅ Fixed — tsconfig.json: keep the flag, exclude what you cannot edit
{
  "compilerOptions": {
    "module": "esnext",
    "verbatimModuleSyntax": true
  },
  "include": ["src"],
  "exclude": ["src/generated"]
}

Better still, configure the generator to emit import type — most modern ones have a flag for it — and keep the directory type-checked. Excluding it buys silence at the cost of never checking that code again, so treat it as the fallback, and leave a comment saying why the directory is listed.

How to Fix It

  1. Add the type keyword where the compiler points. If every name in the statement is a type, put it on the whole import: import type { User, Role } from "./types". If the statement mixes types and values, mark the individual bindings instead: import { type FC, useState } from "react". The column in the error message tells you which binding is at fault, so you never have to guess which one of five names is the interface.

  2. Let a codemod do the bulk of it. Nobody should hand-edit two hundred imports. Enable @typescript-eslint/consistent-type-imports with fixStyle: 'inline-type-imports' and run eslint --fix, or run npx fix-verbatim-module-syntax, which also rewrites the export side that raises TS1205. Keeping the lint rule on afterwards is what stops the errors coming back on the next pull request.

  3. Use export type for re-exports. A barrel file that imports a type and re-exports it needs both halves fixed, so TS1484 and TS1205 arrive together; re-exporting directly with export type { User } from "./types" collapses them into one line, and export { type User, Session } from "./types" does the same when the module exports a mix.

  4. Do not reach for import type on an enum. Enums and classes exist at runtime, so marking them type-only compiles but then fails the moment you use the value — import type { OrderStatus } followed by OrderStatus.Pending is TS1361, 'OrderStatus' cannot be used as a value because it was imported using 'import type'. Only interfaces, type aliases and type-only exports belong behind the keyword.

  5. Keep the flag on. Turning off verbatimModuleSyntax makes the error disappear and quietly re-introduces the hazard it was added to prevent: Vite, esbuild, swc and Node's type stripping all compile file by file and will emit an import to a type that does not exist, or drop one with a side effect you needed. If a large legacy codebase cannot adopt it yet, step down to "isolatedModules": true — a weaker but still transpiler-safe check — and schedule the codemod rather than removing both.

FAQ

What causes TypeScript error TS1484?

An import named something that only exists at compile time — an interface, a type alias, or a member another module re-exported with export type — in a project with "verbatimModuleSyntax": true. That option, added in TypeScript 5.0, turns off import elision: the compiler now emits your import statements verbatim instead of deleting the bindings it believes are type-only. Since it can no longer silently drop User from the output, it asks you to say so yourself with the type keyword. The same file compiles without a word of complaint once the flag is off, which is why the error usually shows up with a tsconfig change rather than a code change.

How do I fix TS1484 across a whole project at once?

Automate it. The ESLint rule does the work in place:

{
  "rules": {
    "@typescript-eslint/consistent-type-imports": [
      "error",
      { "prefer": "type-imports", "fixStyle": "inline-type-imports" }
    ]
  }
}

Run eslint --fix and every offending import is rewritten. For the export side as well, npx fix-verbatim-module-syntax makes one pass over the project and handles both TS1484 and TS1205. Land the flag, the codemod output and the lint rule in a single commit — the rule is what keeps the next contributor from reintroducing the error on their first file.

Should I disable verbatimModuleSyntax to fix TS1484?

No, in almost every project. The flag is not a style preference: it is the thing that makes your TypeScript safe to compile one file at a time, which is exactly what Vite, esbuild, swc, Babel and Node's built-in type stripping do. Without it, those tools either keep an import to a name that was erased, or drop an import whose side effect you depended on, and both failures show up at runtime rather than in your editor. The honest alternatives are to run the codemod, or — for a codebase that cannot absorb the change yet — to set "isolatedModules": true, which catches a narrower set of the same problems and leaves a clear upgrade path. Switching both off to clear a build is the one option that trades a compile error for a production bug.

Practice This

Browse all TypeScript practice challenges to keep sharpening your type-level skills.

Related Concepts

Share this reference

Become a TypeScript Pro

Track your progress through 200+ hands-on challenges. Free, sign in with GitHub.

Or start solving right away: explore all TypeScript challenges