Skip to content

Export * of empty module leads to TS2306 (not a module). #46343

@floitsch

Description

@floitsch

Bug Report

When using export * from './empty' where empty is an empty module I get an error that the file is not a module.

// index.ts
export * from './empty';

and two empty files empty.d.ts and empty.js next to it.

🔎 Search Terms

  • "TS2306"
  • export * with empty module
  • "is not a module"

🕗 Version & Regression Information

Happens in 4.4.4, and on all workbench versions.

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about "'export *' with empty modules".

⏯ Playground Link

Workbench link with relevant code

💻 Code

// @filename: index.ts
export * from './empty'

// @filename: empty.d.ts
// Comment.

// @filename: empty.js
// Comment.

🙁 Actual behavior

Error:

error TS2306: File 'empty.d.ts' is not a module

I can import empty modules, so why can't I export * from empty files?

🙂 Expected behavior

The export * should just be ignored, since the empty module doesn't export anything.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Working as IntendedThe behavior described is the intended behavior; this is not a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions