File tree Expand file tree Collapse file tree 4 files changed +31
-12
lines changed Expand file tree Collapse file tree 4 files changed +31
-12
lines changed Original file line number Diff line number Diff line change @@ -354,5 +354,13 @@ export default class <NumType> {
354
354
* @callback
355
355
* @returns {[Something | undefined]}
356
356
*/
357
+
358
+ /**
359
+ * @template {string | Buffer} [T =string, U=number]
360
+ * @typedef {object} Dirent
361
+ * @property {T} name name
362
+ * @property {U} aNumber number
363
+ * @property {string} parentPath path
364
+ */
357
365
````
358
366
Original file line number Diff line number Diff line change @@ -1495,7 +1495,7 @@ const parseClosureTemplateTag = (tag) => {
1495
1495
return tag . name
1496
1496
. split ( ',' )
1497
1497
. map ( ( type ) => {
1498
- return type . trim ( ) . replace ( / ^ \[ (?< name > .* ?) = .* \] $ / u, '$<name>' ) ;
1498
+ return type . trim ( ) . replace ( / ^ \[ ? (?< name > .* ?) = .* $ / u, '$<name>' ) ;
1499
1499
} ) ;
1500
1500
} ;
1501
1501
Original file line number Diff line number Diff line change @@ -22,19 +22,19 @@ export default iterateJsdoc(({
22
22
23
23
const usedNames = new Set ( ) ;
24
24
const templateTags = utils . getTags ( 'template' ) ;
25
- const templateNames = templateTags . flatMap ( ( {
26
- name,
27
- } ) => {
28
- return name . split ( / , \s * / u) ;
25
+ const templateNames = templateTags . flatMap ( ( tag ) => {
26
+ return utils . parseClosureTemplateTag ( tag ) ;
29
27
} ) ;
30
28
31
- for ( const tag of templateTags ) {
32
- const {
33
- name,
34
- } = tag ;
35
- const names = name . split ( / , \s * / u) ;
36
- if ( requireSeparateTemplates && names . length > 1 ) {
37
- report ( `Missing separate @template for ${ names [ 1 ] } ` , null , tag ) ;
29
+ if ( requireSeparateTemplates ) {
30
+ for ( const tag of templateTags ) {
31
+ const {
32
+ name,
33
+ } = tag ;
34
+ const names = name . split ( / , \s * / u) ;
35
+ if ( names . length > 1 ) {
36
+ report ( `Missing separate @template for ${ names [ 1 ] } ` , null , tag ) ;
37
+ }
38
38
}
39
39
}
40
40
Original file line number Diff line number Diff line change @@ -634,5 +634,16 @@ export default /** @type {import('../index.js').TestCases} */ ({
634
634
*/
635
635
` ,
636
636
} ,
637
+ {
638
+ code : `
639
+ /**
640
+ * @template {string | Buffer} [T=string, U=number]
641
+ * @typedef {object} Dirent
642
+ * @property {T} name name
643
+ * @property {U} aNumber number
644
+ * @property {string} parentPath path
645
+ */
646
+ ` ,
647
+ } ,
637
648
] ,
638
649
} ) ;
You can’t perform that action at this time.
0 commit comments