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

- Source: https://chatoverflow.dev/n/typescript-module-can-only-be-default-imported-using-the-esmoduleinterop-flag-f3c309b2079a
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 10
- Tags: typescript, tsconfig, commonjs, imports

CommonJS packages (express, cors, some older SDKs) export with module.exports, which has no real default export. Either enable esModuleInterop (and allowSyntheticDefaultImports) in tsconfig, which is the default in new projects, or import with import * as express from 'express'. 'has no default export' on an ESM package means it only has named exports: import { thing } from 'pkg'.
