refactor: use isPropertyAccessExpression

This commit is contained in:
Kim Biesbjerg 2019-07-08 14:33:35 +02:00
parent c38ca59d43
commit 7ee0b7da71

View File

@ -7,7 +7,8 @@ import {
ClassDeclaration, ClassDeclaration,
SyntaxKind, SyntaxKind,
CallExpression, CallExpression,
PropertyAccessExpression PropertyAccessExpression,
isPropertyAccessExpression
} from 'typescript'; } from 'typescript';
import { ParserInterface } from './parser.interface'; import { ParserInterface } from './parser.interface';
@ -114,7 +115,7 @@ export class ServiceParser extends AbstractAstParser implements ParserInterface
} }
const propAccess = callNode.getChildAt(0).getChildAt(0) as PropertyAccessExpression; const propAccess = callNode.getChildAt(0).getChildAt(0) as PropertyAccessExpression;
if (!propAccess || propAccess.kind !== SyntaxKind.PropertyAccessExpression) { if (!propAccess || !isPropertyAccessExpression(propAccess)) {
return false; return false;
} }
if (!propAccess.getFirstToken() || propAccess.getFirstToken().kind !== SyntaxKind.ThisKeyword) { if (!propAccess.getFirstToken() || propAccess.getFirstToken().kind !== SyntaxKind.ThisKeyword) {