diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index 49f13d0b4c3..0443a950e94 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -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: { diff --git a/tests/cases/fourslash/docCommentTemplateInterfaces.ts b/tests/cases/fourslash/docCommentTemplateInterfaces.ts new file mode 100644 index 00000000000..2faf49351f2 --- /dev/null +++ b/tests/cases/fourslash/docCommentTemplateInterfaces.ts @@ -0,0 +1,23 @@ +/// + +/////*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 + */`); \ No newline at end of file