-
Notifications
You must be signed in to change notification settings - Fork 12.8k
How do I enable strict mode in TypeScript? #4270
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
Just add |
IIFE with 'use strict'; |
Doesn't it seem a tad obtuse to add "use strict"; to every file? Is there any way to enforce strict mode in every file? |
All ESM modules will automatically be interpreted in strict mode, as per the standard. If the code you are compiling is to CJS, AMD or UMD, TypeScript automatically emits the If it is a "plain" non-modular file, then TypeScript is like JavaScript, in that it is an opt-in feature. |
If anyone else finds this thread in a search, the latest status is that a compiler option to enable strict mode is planned (#10758). |
I can't found option in Visual Studio for enable strict mode when compiling typescript to JS. Without this option Ecmascript 6 code not working in chrome, because required strict mode.
The text was updated successfully, but these errors were encountered: