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

Fix false positive in typedef rule for catch clause #1887

Merged
merged 1 commit into from
Dec 16, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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