Skip to content

es6 modules without imports or nontrivial exports compile to ambiguous output #28890

Closed
@dgoldstein0

Description

@dgoldstein0

TypeScript Version: 3.2.2

Search Terms:
ambiguous es6 modules

Code

// asdf.ts
export {};

compile with tsc --module ES6 asdf.ts

Expected behavior:

compiles to something that is obviously a module, e.g. preserves the export {}.

Actual behavior:

output is an empty file which could be a script instead of a module.

This causes issues in complex build pipelines - e.g. if we then try to put the output through tsc --module amd, the output differs from if we had only done tsc --module amd in the first place.

Playground Link: http://www.typescriptlang.org/play/#src=export%20%7B%20%7D%3B

I can't get es6 output in the playground for this

Related Issues: n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: ES ModulesThe issue relates to import/export style module behavior

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions