mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-15 20:25:23 -06:00
Return doc comment template for interfaces and method signatures
This commit is contained in:
parent
b566480aaa
commit
7aeb11b41e
@ -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: {
|
||||
|
||||
23
tests/cases/fourslash/docCommentTemplateInterfaces.ts
Normal file
23
tests/cases/fourslash/docCommentTemplateInterfaces.ts
Normal 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
|
||||
*/`);
|
||||
Loading…
x
Reference in New Issue
Block a user