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

Commit

Permalink
completed-docs: Handle undefined symbol (#2230)
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-hanson authored and adidahiya committed Feb 27, 2017
1 parent ba3cfa0 commit 12435bf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/rules/completedDocsRule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,12 @@ class CompletedDocsWalker extends Lint.ProgramAwareRuleWalker {
return;
}

const comments = this.getTypeChecker().getSymbolAtLocation(node.name).getDocumentationComment();
const symbol = this.getTypeChecker().getSymbolAtLocation(node.name);
if (!symbol) {
return;
}

const comments = symbol.getDocumentationComment();
this.checkComments(node, nodeType, comments);
}

Expand Down
4 changes: 4 additions & 0 deletions test/rules/completed-docs/defaults/test.ts.lint
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ export class Aaa {

public ccc() { }
~~~~~~~~~~~~~~~~ [Documentation must exist for public methods.]

// TODO: TypeScript API doesn't give us a symbol for this, so we must ignore it.
// https://github.com/Microsoft/TypeScript/issues/14257
[Symbol.iterator]() {}
}

export enum Ddd { }
Expand Down

0 comments on commit 12435bf

Please sign in to comment.