mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
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:
1 parent
c9f5f3d67e
commit
a91cdccfc5
7 files changed
+95
-1
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
},
|
||||
|
||||
@@ -2395,6 +2395,7 @@ namespace ts {
|
||||
noEmitOnError?: boolean;
|
||||
noErrorTruncation?: boolean;
|
||||
noImplicitAny?: boolean;
|
||||
noImplicitThis?: boolean;
|
||||
noLib?: boolean;
|
||||
noResolve?: boolean;
|
||||
out?: string;
|
||||
|
||||
Reference in new issue
Block a user