-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
TypeScript Version: 2.3.2
Code
function fn(): void {}
export type MyType = number;when compiled with a default tsconfig.json emits
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
function fn() {
}Expected behavior:
It should not emit
Object.defineProperty(exports, "__esModule", { value: true });if exports is not emitted in the compiled module.
Actual behavior:
Object.defineProperty(...) is emitted even if exports is not defined for the compiled module. When this code is loaded in a browser, it will throw an exception: Uncaught ReferenceError: exports is not defined.
If the MyType type declaration in the above code is not exported, then Object.defineProperty(...) is not emitted.
dlo, btoo, elldritch and ezra100
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug