mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Expose getJSDocCommentsAndTags (#53627)
This commit is contained in:
@@ -4198,7 +4198,29 @@ export function canHaveJSDoc(node: Node): node is HasJSDoc {
|
||||
}
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
/**
|
||||
* This function checks multiple locations for JSDoc comments that apply to a host node.
|
||||
* At each location, the whole comment may apply to the node, or only a specific tag in
|
||||
* the comment. In the first case, location adds the entire {@link JSDoc} object. In the
|
||||
* second case, it adds the applicable {@link JSDocTag}.
|
||||
*
|
||||
* For example, a JSDoc comment before a parameter adds the entire {@link JSDoc}. But a
|
||||
* `@param` tag on the parent function only adds the {@link JSDocTag} for the `@param`.
|
||||
*
|
||||
* ```ts
|
||||
* /** JSDoc will be returned for `a` *\/
|
||||
* const a = 0
|
||||
* /**
|
||||
* * Entire JSDoc will be returned for `b`
|
||||
* * @param c JSDocTag will be returned for `c`
|
||||
* *\/
|
||||
* function b(/** JSDoc will be returned for `c` *\/ c) {}
|
||||
* ```
|
||||
*/
|
||||
export function getJSDocCommentsAndTags(hostNode: Node): readonly (JSDoc | JSDocTag)[];
|
||||
/** @internal separate signature so that stripInternal can remove noCache from the public API */
|
||||
// eslint-disable-next-line @typescript-eslint/unified-signatures
|
||||
export function getJSDocCommentsAndTags(hostNode: Node, noCache?: boolean): readonly (JSDoc | JSDocTag)[];
|
||||
export function getJSDocCommentsAndTags(hostNode: Node, noCache?: boolean): readonly (JSDoc | JSDocTag)[] {
|
||||
let result: (JSDoc | JSDocTag)[] | undefined;
|
||||
// Pull parameter comments from declaring function as well
|
||||
|
||||
@@ -8817,6 +8817,26 @@ declare namespace ts {
|
||||
parent: ConstructorDeclaration;
|
||||
name: Identifier;
|
||||
};
|
||||
/**
|
||||
* This function checks multiple locations for JSDoc comments that apply to a host node.
|
||||
* At each location, the whole comment may apply to the node, or only a specific tag in
|
||||
* the comment. In the first case, location adds the entire {@link JSDoc} object. In the
|
||||
* second case, it adds the applicable {@link JSDocTag}.
|
||||
*
|
||||
* For example, a JSDoc comment before a parameter adds the entire {@link JSDoc}. But a
|
||||
* `@param` tag on the parent function only adds the {@link JSDocTag} for the `@param`.
|
||||
*
|
||||
* ```ts
|
||||
* /** JSDoc will be returned for `a` *\/
|
||||
* const a = 0
|
||||
* /**
|
||||
* * Entire JSDoc will be returned for `b`
|
||||
* * @param c JSDocTag will be returned for `c`
|
||||
* *\/
|
||||
* function b(/** JSDoc will be returned for `c` *\/ c) {}
|
||||
* ```
|
||||
*/
|
||||
function getJSDocCommentsAndTags(hostNode: Node): readonly (JSDoc | JSDocTag)[];
|
||||
/** @deprecated */
|
||||
function createUnparsedSourceFile(text: string): UnparsedSource;
|
||||
/** @deprecated */
|
||||
|
||||
+20
@@ -4771,6 +4771,26 @@ declare namespace ts {
|
||||
parent: ConstructorDeclaration;
|
||||
name: Identifier;
|
||||
};
|
||||
/**
|
||||
* This function checks multiple locations for JSDoc comments that apply to a host node.
|
||||
* At each location, the whole comment may apply to the node, or only a specific tag in
|
||||
* the comment. In the first case, location adds the entire {@link JSDoc} object. In the
|
||||
* second case, it adds the applicable {@link JSDocTag}.
|
||||
*
|
||||
* For example, a JSDoc comment before a parameter adds the entire {@link JSDoc}. But a
|
||||
* `@param` tag on the parent function only adds the {@link JSDocTag} for the `@param`.
|
||||
*
|
||||
* ```ts
|
||||
* /** JSDoc will be returned for `a` *\/
|
||||
* const a = 0
|
||||
* /**
|
||||
* * Entire JSDoc will be returned for `b`
|
||||
* * @param c JSDocTag will be returned for `c`
|
||||
* *\/
|
||||
* function b(/** JSDoc will be returned for `c` *\/ c) {}
|
||||
* ```
|
||||
*/
|
||||
function getJSDocCommentsAndTags(hostNode: Node): readonly (JSDoc | JSDocTag)[];
|
||||
/** @deprecated */
|
||||
function createUnparsedSourceFile(text: string): UnparsedSource;
|
||||
/** @deprecated */
|
||||
|
||||
Reference in New Issue
Block a user