Don't assume the class declaration will occur first, and that it is *only* a class declaration.

This commit is contained in:
Daniel Rosenwasser
2015-08-26 16:19:55 -07:00
parent 9eef4b8f47
commit 9f3c99e392
2 changed files with 14 additions and 5 deletions

View File

@@ -611,11 +611,11 @@ namespace ts {
return false;
}
export function isAccessor(node: Node): boolean {
export function isAccessor(node: Node): node is AccessorDeclaration {
return node && (node.kind === SyntaxKind.GetAccessor || node.kind === SyntaxKind.SetAccessor);
}
export function isClassLike(node: Node): boolean {
export function isClassLike(node: Node): node is ClassLikeDeclaration {
return node && (node.kind === SyntaxKind.ClassDeclaration || node.kind === SyntaxKind.ClassExpression);
}