Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Commit

Permalink
Fix false positive in typedef rule for catch clause (#1887)
Browse files Browse the repository at this point in the history
  • Loading branch information
nchen63 authored Dec 16, 2016
1 parent 2218cfc commit 0b15029
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/rules/typedefRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class TypedefWalker extends Lint.RuleWalker {
// catch statements will be the parent of the variable declaration
// for-in/for-of loops will be the gradparent of the variable declaration
if (node.parent != null && node.parent.parent != null
&& node.parent.parent.kind !== ts.SyntaxKind.CatchClause
&& (node as ts.Node).parent.kind !== ts.SyntaxKind.CatchClause
&& node.parent.parent.kind !== ts.SyntaxKind.ForInStatement
&& node.parent.parent.kind !== ts.SyntaxKind.ForOfStatement) {
this.checkTypeAnnotation("variable-declaration", node.name.getEnd(), node.type, node.name);
Expand Down
5 changes: 5 additions & 0 deletions test/rules/typedef/all/test.ts.lint
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// should not error with missing exception type
try {
} catch (e) {
}

var NoTypeObjectLiteralWithPropertyGetter = {
~ [expected variable-declaration: 'NoTypeObjectLiteralWithPropertyGetter' to have a typedef]
Prop: "some property",
Expand Down

0 comments on commit 0b15029

Please sign in to comment.