diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 312ea42eefb..c998415a292 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3785,7 +3785,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(";"); } } - if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile) { + if (modulekind !== ModuleKind.ES6 && node.parent === currentSourceFile) { forEach(node.declarationList.declarations, emitExportVariableAssignments); } } @@ -4011,7 +4011,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } emitSignatureAndBody(node); - if (languageVersion < ScriptTarget.ES6 && node.kind === SyntaxKind.FunctionDeclaration && node.parent === currentSourceFile && node.name) { + if (modulekind !== ModuleKind.ES6 && node.kind === SyntaxKind.FunctionDeclaration && node.parent === currentSourceFile && node.name) { emitExportMemberAssignments((node).name); } @@ -4687,6 +4687,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi else { emitClassLikeDeclarationForES6AndHigher(node); } + if (modulekind !== ModuleKind.ES6 && node.parent === currentSourceFile && node.name) { + emitExportMemberAssignments(node.name); + } } function emitClassLikeDeclarationForES6AndHigher(node: ClassLikeDeclaration) { @@ -4934,10 +4937,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi if (node.kind === SyntaxKind.ClassDeclaration) { emitExportMemberAssignment(node); } - - if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile && node.name) { - emitExportMemberAssignments(node.name); - } } function emitClassMemberPrefix(node: ClassLikeDeclaration, member: Node) { @@ -5509,7 +5508,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitEnd(node); write(";"); } - if (languageVersion < ScriptTarget.ES6 && node.parent === currentSourceFile) { + if (modulekind !== ModuleKind.ES6 && node.parent === currentSourceFile) { if (modulekind === ModuleKind.System && (node.flags & NodeFlags.Export)) { // write the call to exporter for enum writeLine();