File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -354,5 +354,13 @@ export default class <NumType> {
354354 * @callback
355355 * @returns {[Something | undefined]}
356356 */
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+ */
357365````
358366
Original file line number Diff line number Diff line change @@ -1495,7 +1495,7 @@ const parseClosureTemplateTag = (tag) => {
14951495 return tag . name
14961496 . split ( ',' )
14971497 . map ( ( type ) => {
1498- return type . trim ( ) . replace ( / ^ \[ (?< name > .* ?) = .* \] $ / u, '$<name>' ) ;
1498+ return type . trim ( ) . replace ( / ^ \[ ? (?< name > .* ?) = .* $ / u, '$<name>' ) ;
14991499 } ) ;
15001500} ;
15011501
Original file line number Diff line number Diff line change @@ -22,19 +22,19 @@ export default iterateJsdoc(({
2222
2323 const usedNames = new Set ( ) ;
2424 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 ) ;
2927 } ) ;
3028
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+ }
3838 }
3939 }
4040
Original file line number Diff line number Diff line change @@ -634,5 +634,16 @@ export default /** @type {import('../index.js').TestCases} */ ({
634634 */
635635 ` ,
636636 } ,
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+ } ,
637648 ] ,
638649} ) ;
You can’t perform that action at this time.
0 commit comments