-
Notifications
You must be signed in to change notification settings - Fork 885
use-strict
is (partially?) obsolete
#678
Comments
cool, looks like we can deprecate the |
IMO The fact that the compiler parses some code applying strict mode constraints has little to do with the runtime strict mode and this is what the Parsing and runtime is only equivalent when compiler output is ES6 and the code is in a module or class. In all other cases (ES5, ES3, "global" code) these are two different things and we still need a rule to enforce |
@ArturDorochowicz the compiler will output |
@tsvetomir Yes, that is correct now, but wasn't when I commented on the issue. This has been introduced in TypeScript 1.8, see: |
Resolves #678. This rule is obsolete as of TypeScript v1.8.
Resolves #678. This rule is obsolete as of TypeScript v1.8.
I'm not sure why this rule was removed. When compiling with internal modules (namespaces) use strict is not generated in the output. If the developer forgets it, then browser JIT optimizations do not occur. For example this source: // tslint:disable use-strict
namespace app.precache {
angular.module('app.precache', ['ngResource', 'app.config']);
}
// tslint:enable use-strict Becomes // tslint:disable use-strict
var app;
(function (app) {
var precache;
(function (precache) {
angular.module('app.precache', ['ngResource', 'app.config']);
})(precache = app.precache || (app.precache = {}));
})(app || (app = {}));
// tslint:enable use-strict There is no auto-generated 'use strict'; statement in this case and none is assumed by the browser. I could be wrong, but that is my current understanding. |
The TypeScript release notes says it should be generated, so this may be a regression or oversight on their side |
@nchen63 the release notes say it is generated for modules, not scripts. @rcollette seems to be right here, but at this point I would just suggest using |
actually, TS 2.1+ now has a |
Fair enough. We're dealing with a pre web pack app. Starting new I would be using external modules. —You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread. |
Due to https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#module-bodies-are-parsed-in-strict-mode
The text was updated successfully, but these errors were encountered: