diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 998c954092..e4d685597e 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -7383,6 +7383,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi write(`], function(${exportFunctionForFile}) {`); writeLine(); increaseIndent(); + emitUseStrictPrologueDirective(); const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); emitEmitHelpers(node); emitCaptureThisForNodeIfNecessary(node); @@ -7493,6 +7494,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi writeModuleName(node, emitRelativePathAsModuleName); emitAMDDependencies(node, /*includeNonAmdDependencies*/ true, emitRelativePathAsModuleName); increaseIndent(); + emitUseStrictPrologueDirective(); const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node); @@ -7505,6 +7507,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi } function emitCommonJSModule(node: SourceFile) { + emitUseStrictPrologueDirective(); const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ false); emitEmitHelpers(node); collectExternalModuleInfo(node); @@ -7515,6 +7518,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi emitExportEquals(/*emitAsReturn*/ false); } + function emitUseStrictPrologueDirective() { + writeLine(); + write("\"use strict\";"); + } + function emitUMDModule(node: SourceFile) { emitEmitHelpers(node); collectExternalModuleInfo(node); @@ -7534,6 +7542,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi })(`); emitAMDFactoryHeader(dependencyNames); increaseIndent(); + emitUseStrictPrologueDirective(); const startIndex = emitDirectivePrologues(node.statements, /*startWithNewLine*/ true); emitExportStarHelper(); emitCaptureThisForNodeIfNecessary(node);