-
Notifications
You must be signed in to change notification settings - Fork 12.8k
'--alwaysStrict' option should not 'use strict' declaration if setting with module=es2015 #11806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
relate: #10758 |
I agree it is invalid with |
|
Modules in the ES2015 module format do not have to be loaded by the native module loader (since there is yet to be a production ready one). Having a valid module format does not always imply the code will be interpreted in strict mode. While SystemJS will load modules in strict mode when their source module format is ES2015, other bundlers may or may not do the same. Since there is no issue extra emits of the prolog, I would say it is still best to emit code targeted at ES5 to provide the |
I am definitely in favor of leaving this as is. |
Specification mentioned by @saneyuki stays that modules are interpreted in strict mode. Specification means ES6 modules, so following conditions must be met to make TypeScript generate ES6 module:
On the other hand adding |
Env
--alwaysStrict
&--module=es2015
optionCode
Compile the below code with the above options.
Actual behavior
Expected behavior
I think
"use strict"
declareation is needless for ES2015 module because "Module code is always strict mode code" by the spec.The text was updated successfully, but these errors were encountered: