mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 11:24:49 -05:00
Emit @overload comments on generated overloads in.d.ts (#54846)
This commit is contained in:
committed by
GitHub
parent
b1a96a37b5
commit
a05699c9b9
@@ -7440,6 +7440,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
if (typeArguments) {
|
||||
node.typeArguments = factory.createNodeArray(typeArguments);
|
||||
}
|
||||
if (signature.declaration?.kind === SyntaxKind.JSDocSignature && signature.declaration.parent.kind === SyntaxKind.JSDocOverloadTag) {
|
||||
const comment = getTextOfNode(signature.declaration.parent.parent, /*includeTrivia*/ true).slice(2, -2).split(/\r\n|\n|\r/).map(line => line.replace(/^\s+/, " ")).join("\n");
|
||||
addSyntheticLeadingComment(node, SyntaxKind.MultiLineCommentTrivia, comment, /*hasTrailingNewLine*/ true);
|
||||
}
|
||||
|
||||
cleanup?.();
|
||||
return node;
|
||||
|
||||
Reference in New Issue
Block a user