File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed
test/query-tests/Declarations/SuspiciousMethodNameDeclaration Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ In TypeScript the keywords <code>constructor</code> and <code>new</code> for
88member declarations are used to declare constructors in classes and interfaces
99respectively.
1010However, a member declaration with the name <code >new</code > in an interface
11- or <code >constructor</code > in a class, will declare ordinary methods named
12- <code >new</code > or <code >constructor</code > rather than constructors .
11+ or <code >constructor</code > in a class, will declare an ordinary method named
12+ <code >new</code > or <code >constructor</code > rather than a constructor .
1313Similarly, the keyword <code >function</code > is used to declare functions in
14- some contexts, however , using the name <code >function</code > for a class
14+ some contexts. However , using the name <code >function</code > for a class
1515or interface member declaration declares a method named <code >function</code >.
1616</p >
1717
@@ -48,8 +48,8 @@ in the first place.
4848</example >
4949<references >
5050
51- <li >TypeScript specification: <a href =" https://github.com/microsoft/TypeScript/blob/master/doc/spec.md#3.8.9" >Constructor Type Literals</a ></li >
52- <li >TypeScript specification: <a href =" https://github.com/microsoft/TypeScript/blob/master/doc/spec.md#8.3.1" >Constructor Parameters</a ></li >
51+ <li >TypeScript specification: <a href =" https://github.com/microsoft/TypeScript/blob/master/doc/spec.md#3.8.9" >Constructor Type Literals</a >. </li >
52+ <li >TypeScript specification: <a href =" https://github.com/microsoft/TypeScript/blob/master/doc/spec.md#8.3.1" >Constructor Parameters</a >. </li >
5353
5454</references >
5555</qhelp >
Original file line number Diff line number Diff line change 11/**
22 * @name Suspicious method name declaration
3- * @description A method declaration with a name that would be a special keyword in another
3+ * @description A method declaration with a name that is a special keyword in another
44 * context is suspicious.
55 * @kind problem
66 * @problem.severity warning
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ var foo: MyInterface = 123 as any;
22
33interface MyInterface {
44 function ( ) : number ; // OK. Highly unlikely that it is an accident when there are other named methods in the interface.
5- ( ) : number ; // OK: What was probaly meant above.
5+ ( ) : number ; // OK: What was probably meant above.
66 new :( ) => void ; // OK! This is a property, not a method, we ignore those.
77 constructor ( ) : string ; // NOT OK! This a called "constructor"
88 new ( ) : Date ; // OK! This a constructor signature.
@@ -49,4 +49,4 @@ declare class Quz {
4949}
5050
5151var bla = new Foo ( ) ;
52- var blab = new Baz ( ) ;
52+ var blab = new Baz ( ) ;
You can’t perform that action at this time.
0 commit comments