# TypeScript: error TS1259: Module '"express"' can only be default-imported using the 'esModuleInterop' flag

**Code:** `TS1259: Module can only be default-imported using the 'esModuleInterop' flag` · **Category:** TypeScript · **Seen on:** TypeScript, Node.js

You default-import a CommonJS module that uses `export =`, but `esModuleInterop` isn't enabled.

## Meaning

Enable `"esModuleInterop": true` (and `allowSyntheticDefaultImports`) in tsconfig, or import with `import express = require("express")` / `import * as express`. Modern templates enable it by default; also align the bundler/Node ESM interop behaviour.

## Common causes

- `esModuleInterop` false/missing
- CJS lib with `export =` default-imported
- Mixed module settings (`module: commonjs` vs `nodenext`)
- Old tsconfig
- ts-node using another config

## Quick fix

1. `"esModuleInterop": true` in compilerOptions
2. `import * as x from "x"` as an alternative
3. Check the tsconfig ts-node/ts-jest uses

## Detailed fix by platform

### TypeScript

1. `{ "compilerOptions": { "esModuleInterop": true, "allowSyntheticDefaultImports": true } }`

## How to diagnose

1. **Flag** — Enabled?
2. **Module** — export =?
3. **Tooling** — Same config?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/typescript/ts1259-module-can-only-be-default-imported-using-esmoduleinterop)
