Return doc comment template for interfaces and method signatures

This commit is contained in:
uniqueiniquity 2017-10-27 16:46:39 -07:00
parent b566480aaa
commit 7aeb11b41e
2 changed files with 26 additions and 1 deletions

View File

@ -266,10 +266,12 @@ namespace ts.JsDoc {
case SyntaxKind.FunctionDeclaration:
case SyntaxKind.MethodDeclaration:
case SyntaxKind.Constructor:
const { parameters } = commentOwner as FunctionDeclaration | MethodDeclaration | ConstructorDeclaration;
case SyntaxKind.MethodSignature:
const { parameters } = commentOwner as FunctionDeclaration | MethodDeclaration | ConstructorDeclaration | MethodSignature;
return { commentOwner, parameters };
case SyntaxKind.ClassDeclaration:
case SyntaxKind.InterfaceDeclaration:
return { commentOwner };
case SyntaxKind.VariableStatement: {

View File

@ -0,0 +1,23 @@
/// <reference path='fourslash.ts' />
/////*interfaceFoo*/
////interface Foo {
//// /*propertybar*/
//// bar: any;
////
//// /*methodbaz*/
//// baz(message: any): void;
////}
verify.docCommentTemplateAt("interfaceFoo", /*expectedOffset*/ 8,
`/**
*
*/`);
verify.emptyDocCommentTemplateAt("propertybar");
verify.docCommentTemplateAt("methodbaz", /*expectedOffset*/ 12,
`/**
*
* @param message
*/`);