From c5d68cfcaa28187015b893865cf060834e17b428 Mon Sep 17 00:00:00 2001 From: Kim Biesbjerg Date: Mon, 20 Mar 2017 15:17:46 +0100 Subject: [PATCH] Check if parameter has a type before attempting to access. Should fix #26 --- src/parsers/ast-service.parser.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/parsers/ast-service.parser.ts b/src/parsers/ast-service.parser.ts index ec92c71..85d4bc8 100644 --- a/src/parsers/ast-service.parser.ts +++ b/src/parsers/ast-service.parser.ts @@ -54,7 +54,11 @@ export class AstServiceParser implements ParserInterface { } // Make sure className is of the correct type - const className: string = ((parameter.type as ts.TypeReferenceNode).typeName as ts.Identifier).text; + const parameterType: ts.Identifier = (parameter.type as ts.TypeReferenceNode).typeName as ts.Identifier; + if (!parameterType) { + return false; + } + const className: string = parameterType.text; if (className !== this._serviceClassName) { return false; }