Coding⏱️ 3 min read📅 2026-06-04

How to Fix: error TS1192: Module '" A.module"' has no default export

TS1192 error occurs when a module has no default export, fix by adding a default export statement or importing the module using its named export.

Quick Answer: Add a default export statement to your A.module file (e.g., `export default function A() { ... }`), or import it using its named export (`import { A } from './A.module';`) in B.module.

The error TS1192: Module 'A.module' has no default export occurs when you try to import a module in another module without specifying the exact export name. This issue can affect developers who are using TypeScript and are familiar with ES modules.

This error can be frustrating because it prevents your code from compiling, and you may not immediately understand why it's happening. However, by following these steps, you should be able to resolve the issue and get back to working on your project.

💡 Why You Are Getting This Error

  • The primary reason for this error is that the module 'A.module' does not have a default export. A default export is a value that is assigned to the top level of a module, making it available for import in other modules.
  • Alternatively, the issue may be caused by a typo in the module name or the export name. Make sure that you are using the correct module and export names in your code.

🔧 Proven Troubleshooting Steps

Specify the exact export name when importing

  1. Step 1: When trying to import 'A.module', specify the exact export name, for example: `import { foo } from 'A.module';`
  2. Step 2: If you want to import the entire module without specifying a specific export, use the following syntax: `import * as A from 'A.module';`
  3. Step 3: Make sure that the export name matches the actual name of the value in the module.

Use a wildcard import when importing

  1. Step 1: If you know that all exports are being used, you can use a wildcard import: `import * from 'A.module';`
  2. Step 2: However, this approach is not recommended as it can lead to naming conflicts and make your code harder to maintain.

✨ Wrapping Up

By following these steps, you should be able to resolve the error TS1192: Module 'A.module' has no default export. Remember to always specify the exact export name when importing a module, and use wildcard imports only when necessary.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions