mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 11:35:42 -06:00
Do not emit "use strict" when targeting es6 or higher or module kind is es2015 and the file is external module
This commit is contained in:
parent
34d41de06f
commit
afea1105c3
@ -457,7 +457,11 @@ namespace ts {
|
||||
currentSourceFile = node;
|
||||
|
||||
// ensure "use strict" is emitted in all scenarios in alwaysStrict mode
|
||||
if (compilerOptions.alwaysStrict) {
|
||||
// There is no need to emit "use strict" in the following cases:
|
||||
// 1. The file is an external module and target is es2015 or higher
|
||||
// or 2. The file is an external module and module-kind is es6 or es2015 as such value is not allowed when targeting es5 or lower
|
||||
if (compilerOptions.alwaysStrict &&
|
||||
!(isExternalModule(node) && (compilerOptions.target >= ScriptTarget.ES2015 || compilerOptions.module === ModuleKind.ES2015))) {
|
||||
node = ensureUseStrict(node);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user