diff --git a/src/parsers/typescript.service.ts b/src/parsers/typescript.service.ts index efa9cd25..1a223621 100644 --- a/src/parsers/typescript.service.ts +++ b/src/parsers/typescript.service.ts @@ -34,18 +34,18 @@ export class TypeScriptParserService ) { switch (node.type) { case NodeType.MEMBER_EXPRESSION: { - this.result = { - functionName: null, - propertyName: null, - generator: false, - async: false, - typeParameters: [], - parameters: [], - returnType: null, - exceptions: [], - }; const prototypeIdentifier = node.child(0)?.children.pop(); - if (prototypeIdentifier && prototypeIdentifier.text === 'prototype') { + if (prototypeIdentifier?.text === 'prototype') { + this.result = { + functionName: null, + propertyName: null, + generator: false, + async: false, + typeParameters: [], + parameters: [], + returnType: null, + exceptions: [], + }; this.runNodeParser(this.parsePrototypeFunction, node); } break; diff --git a/test/filetypes/javascript/functions.vader b/test/filetypes/javascript/functions.vader index d4c379c7..0c599af1 100644 --- a/test/filetypes/javascript/functions.vader +++ b/test/filetypes/javascript/functions.vader @@ -372,3 +372,16 @@ Expect javascript (generated comments with a description, @param and @return tag * @return {[TODO:type]} [TODO:description] */ function foo({ a, b: str, c = 3, d: int = 5 }) {} + +# ============================================================================== +# Function calls that should not generate documentation +# ============================================================================== +Given javascript (function call): + AdminPermissionModel.create(item); + + +Do (trigger doge): + \ + +Expect javascript (to not have generated a docblock): + AdminPermissionModel.create(item);