@@ -464,29 +464,26 @@ const hasATag = (jsdoc, targetTagNames) => {
464464} ;
465465
466466/**
467- * Checks if the JSDoc comment declares an undefined type.
467+ * Checks if the JSDoc comment declares a defined type.
468468 *
469469 * @param {JsDocTag } tag
470470 * the tag which should be checked.
471471 * @param {"jsdoc"|"closure"|"typescript" } mode
472472 * @returns {boolean }
473- * true in case a defined type is undeclared ; otherwise false.
473+ * true in case a defined type is declared ; otherwise false.
474474 */
475- const mayBeUndefinedTypeTag = ( tag , mode ) => {
475+ const hasDefinedTypeTag = ( tag , mode ) => {
476476 // The function should not continue in the event the type is not defined...
477477 if ( typeof tag === 'undefined' || tag === null ) {
478- return true ;
478+ return false ;
479479 }
480480
481481 // .. same applies if it declares an `{undefined}` or `{void}` type
482482 const tagType = tag . type . trim ( ) ;
483483
484484 // Exit early if matching
485- if (
486- tagType === 'undefined' || tagType === 'void' ||
487- tagType === '*' || tagType === 'any'
488- ) {
489- return true ;
485+ if ( tagType === 'undefined' || tagType === 'void' ) {
486+ return false ;
490487 }
491488
492489 let parsedTypes ;
@@ -509,11 +506,11 @@ const mayBeUndefinedTypeTag = (tag, mode) => {
509506 return elem . type === 'JsdocTypeUndefined' ||
510507 elem . type === 'JsdocTypeName' && elem . value === 'void' ;
511508 } ) ) {
512- return true ;
509+ return false ;
513510 }
514511
515512 // In any other case, a type is present
516- return false ;
513+ return true ;
517514} ;
518515
519516/**
@@ -1242,6 +1239,7 @@ export default {
12421239 getTagsByType,
12431240 getTagStructureForMode,
12441241 hasATag,
1242+ hasDefinedTypeTag,
12451243 hasParams,
12461244 hasReturnValue,
12471245 hasTag,
@@ -1253,7 +1251,6 @@ export default {
12531251 isNamepathDefiningTag,
12541252 isSetter,
12551253 isValidTag,
1256- mayBeUndefinedTypeTag,
12571254 overrideTagStructure,
12581255 parseClosureTemplateTag,
12591256 pathDoesNotBeginWith,
0 commit comments