This repository was archived by the owner on May 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -196,7 +196,11 @@ class Annotator {
196196 }
197197
198198 private visitProperty ( p : ts . PropertyDeclaration | ts . ParameterDeclaration ) {
199- this . maybeVisitType ( p . type , this . existingClosureAnnotation ( p ) + '@type' ) ;
199+ let existingAnnotation = this . existingClosureAnnotation ( p ) . trim ( ) ;
200+ if ( existingAnnotation ) {
201+ existingAnnotation += '\n' ;
202+ }
203+ this . maybeVisitType ( p . type , existingAnnotation + '@type' ) ;
200204 this . emit ( '\nthis.' ) ;
201205 this . emit ( p . name . getText ( ) ) ;
202206 this . emit ( ';' ) ;
Original file line number Diff line number Diff line change 1- class A {
1+ class Comments {
22 /** @export */
3- foo : string ;
3+ export1 : string ;
4+ // Note: the below @export doesn't make it into the output because it
5+ // it isn't in a JSDoc comment.
6+ /// @export
7+ export2 : string ;
48 /* non js-doc comment */
5- bar : number ;
9+ nodoc1 : number ;
610 // non js-doc comment
7- buz : number ;
11+ nodoc2 : number ;
12+ /// non js-doc comment
13+ nodoc3 : number ;
14+ /** inline jsdoc comment without type annotation */
15+ jsdoc1 : number ;
16+ /**
17+ * multi-line jsdoc comment without
18+ * type annotation.
19+ */
20+ jsdoc2 : number ;
821}
Original file line number Diff line number Diff line change 1- class A {
1+ class Comments {
22 // Sickle: begin synthetic ctor.
33 constructor ( ) {
44 // Sickle: begin stub declarations.
5- /** @export @type { string } */
6- this . foo ;
5+ /** @export
6+ @type { string } */
7+ this . export1 ;
8+ /** @type { string } */
9+ this . export2 ;
710 /** @type { number } */
8- this . bar ;
11+ this . nodoc1 ;
912 /** @type { number } */
10- this . buz ;
13+ this . nodoc2 ;
14+ /** @type { number } */
15+ this . nodoc3 ;
16+ /** inline jsdoc comment without type annotation
17+ @type { number } */
18+ this . jsdoc1 ;
19+ /** * multi-line jsdoc comment without
20+ * type annotation.
21+ @type { number } */
22+ this . jsdoc2 ;
1123 // Sickle: end stub declarations.
1224 }
1325}
Original file line number Diff line number Diff line change @@ -4,7 +4,8 @@ class ParamProps {
44 // Sickle: begin stub declarations.
55 this . bar = bar ;
66 this . bar2 = bar2 ;
7- /** @export @type { string } */
7+ /** @export
8+ @type { string } */
89 this . bar ;
910 /** @type { string } */
1011 this . bar2 ;
Original file line number Diff line number Diff line change 1- class A {
1+ class Comments {
22 /** @export */
3- foo : string ;
3+ export1 : string ;
4+ // Note: the below @export doesn't make it into the output because it
5+ // it isn't in a JSDoc comment.
6+ /// @export
7+ export2 : string ;
48 /* non js-doc comment */
5- bar : number ;
9+ nodoc1 : number ;
610 // non js-doc comment
7- buz : number ;
11+ nodoc2 : number ;
12+ /// non js-doc comment
13+ nodoc3 : number ;
14+ /** inline jsdoc comment without type annotation */
15+ jsdoc1 : number ;
16+ /**
17+ * multi-line jsdoc comment without
18+ * type annotation.
19+ */
20+ jsdoc2 : number ;
821// Sickle: begin synthetic ctor.
922constructor ( ) {
1023
1124
1225// Sickle: begin stub declarations.
1326
14- /** @export @type { string } */
15- this . foo ;
27+ /** @export
28+ @type { string } */
29+ this . export1 ;
30+ /** @type { string } */
31+ this . export2 ;
1632 /** @type { number } */
17- this . bar ;
33+ this . nodoc1 ;
1834 /** @type { number } */
19- this . buz ;
35+ this . nodoc2 ;
36+ /** @type { number } */
37+ this . nodoc3 ;
38+ /** inline jsdoc comment without type annotation
39+ @type { number } */
40+ this . jsdoc1 ;
41+ /** * multi-line jsdoc comment without
42+ * type annotation.
43+ @type { number } */
44+ this . jsdoc2 ;
2045// Sickle: end stub declarations.
2146}
2247
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ public bar2: string) {
66
77// Sickle: begin stub declarations.
88
9- /** @export @type { string } */
9+ /** @export
10+ @type { string } */
1011this . bar ;
1112 /** @type { string } */
1213this . bar2 ;
You can’t perform that action at this time.
0 commit comments