mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-04-17 01:49:41 -05:00
fix(58259): getTextOfJSDocComment is stripping # from JSDoc comment (#58338)
This commit is contained in:
@@ -2123,7 +2123,7 @@ export function entityNameToString(name: EntityNameOrEntityNameExpression | JSDo
|
||||
return Debug.assertNever(name.name);
|
||||
}
|
||||
case SyntaxKind.JSDocMemberName:
|
||||
return entityNameToString(name.left) + entityNameToString(name.right);
|
||||
return entityNameToString(name.left) + "#" + entityNameToString(name.right);
|
||||
case SyntaxKind.JsxNamespacedName:
|
||||
return entityNameToString(name.namespace) + ":" + entityNameToString(name.name);
|
||||
default:
|
||||
|
||||
@@ -543,4 +543,21 @@ oh.no
|
||||
assert.equal((doc?.jsDoc.tags?.[0] as ts.JSDocTemplateTag).typeParameters.length, 0);
|
||||
});
|
||||
});
|
||||
describe("getTextOfJSDocComment", () => {
|
||||
it("should preserve hash in string representation of JsDocMemberName", () => {
|
||||
const sourceText = `
|
||||
/**
|
||||
*
|
||||
* @see {@link foo#bar label}
|
||||
*/
|
||||
class Foo {};
|
||||
`;
|
||||
|
||||
const root = ts.createSourceFile("foo.ts", sourceText, ts.ScriptTarget.ES5, /*setParentNodes*/ true);
|
||||
const [classDecl] = root.statements;
|
||||
const [seeTag] = ts.getJSDocTags(classDecl);
|
||||
|
||||
assert.equal(ts.getTextOfJSDocComment(seeTag.comment), "{@link foo#bar label}");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user