@@ -1502,16 +1502,7 @@ namespace ts {
1502
1502
return getJSDocCommentsAndTags ( node ) ;
1503
1503
}
1504
1504
1505
- export function getJSDocTags ( node : Node ) : ReadonlyArray < JSDocTag > | undefined {
1506
- let tags = node . jsDocCache ;
1507
- // If cache is 'null', that means we did the work of searching for JSDoc tags and came up with nothing.
1508
- if ( tags === undefined ) {
1509
- node . jsDocCache = tags = flatMap ( getJSDocCommentsAndTags ( node ) , j => isJSDoc ( j ) ? j . tags : j ) ;
1510
- }
1511
- return tags ;
1512
- }
1513
-
1514
- function getJSDocCommentsAndTags ( node : Node ) : ( JSDoc | JSDocTag ) [ ] {
1505
+ export function getJSDocCommentsAndTags ( node : Node ) : ( JSDoc | JSDocTag ) [ ] {
1515
1506
let result : Array < JSDoc | JSDocTag > | undefined ;
1516
1507
getJSDocCommentsAndTagsWorker ( node ) ;
1517
1508
return result || emptyArray ;
@@ -4023,11 +4014,22 @@ namespace ts {
4023
4014
return returnTag && returnTag . typeExpression && returnTag . typeExpression . type ;
4024
4015
}
4025
4016
4026
- /* Get the first JSDoc tag of a specified kind, or undefined if not present. */
4017
+ /** Get all JSDoc tags related to a node, including those on parent nodes. */
4018
+ export function getJSDocTags ( node : Node ) : ReadonlyArray < JSDocTag > | undefined {
4019
+ let tags = node . jsDocCache ;
4020
+ // If cache is 'null', that means we did the work of searching for JSDoc tags and came up with nothing.
4021
+ if ( tags === undefined ) {
4022
+ node . jsDocCache = tags = flatMap ( getJSDocCommentsAndTags ( node ) , j => isJSDoc ( j ) ? j . tags : j ) ;
4023
+ }
4024
+ return tags ;
4025
+ }
4026
+
4027
+ /** Get the first JSDoc tag of a specified kind, or undefined if not present. */
4027
4028
function getFirstJSDocTag ( node : Node , kind : SyntaxKind ) : JSDocTag | undefined {
4028
4029
const tags = getJSDocTags ( node ) ;
4029
4030
return find ( tags , doc => doc . kind === kind ) ;
4030
4031
}
4032
+
4031
4033
}
4032
4034
4033
4035
// Simple node tests of the form `node.kind === SyntaxKind.Foo`.
0 commit comments