Add --noImplicitThis flag

It's basically another --noImplicitAny error, but one that would break
large amount of JavaScript-style code.
This commit is contained in:
Nathan Shively-Sanders committed 2016-03-25 16:37:28 -07:00
1 parent c9f5f3d67e
commit a91cdccfc5
7 files changed
+95 -1

No files matched your search

+4
View File
@@ -7707,6 +7707,10 @@ namespace ts {
}
}
if (compilerOptions.noImplicitThis && isFunctionLike(container)) {
// With noImplicitThis, functions may not reference 'this' if it has type 'any'
error(node, Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation);
}
return anyType;
}
+4
View File
@@ -125,6 +125,10 @@ namespace ts {
type: "boolean",
description: Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type,
},
{
name: "noImplicitThis",
type: "boolean",
},
{
name: "noLib",
type: "boolean",
+5 -1
View File
@@ -1863,7 +1863,11 @@
"category": "Error",
"code": 2680
},
"Import declaration '{0}' is using private name '{1}'.": {
"'this' implicitly has type 'any' because it does not have a type annotation.": {
"category": "Error",
"code": 2681
},
"Import declaration '{0}' is using private name '{1}'.": {
"category": "Error",
"code": 4000
},
+1
View File
@@ -2395,6 +2395,7 @@ namespace ts {
noEmitOnError?: boolean;
noErrorTruncation?: boolean;
noImplicitAny?: boolean;
noImplicitThis?: boolean;
noLib?: boolean;
noResolve?: boolean;
out?: string;