From dff885ca3d185db405509a5e1c8d29e9b4483654 Mon Sep 17 00:00:00 2001 From: Sage Abdullah Date: Mon, 7 Jul 2025 12:37:45 +0100 Subject: [PATCH 1/2] Handle Symbols with no declarations --- sphinx_js/js/redirectPrivateAliases.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sphinx_js/js/redirectPrivateAliases.ts b/sphinx_js/js/redirectPrivateAliases.ts index 08c92f0..59db0ce 100644 --- a/sphinx_js/js/redirectPrivateAliases.ts +++ b/sphinx_js/js/redirectPrivateAliases.ts @@ -167,7 +167,11 @@ export function redirectPrivateTypes(app: Application): ReadonlySymbolToType { const missing = discoverMissingExports(mod, context); for (const name of missing) { - const decl = name.declarations![0]; + // Some symbols e.g. JSX.LibraryManagedAttributes have no declarations + if (!name.declarations || name.declarations.length === 0) { + continue; + } + const decl = name.declarations[0]; if (decl.getSourceFile().fileName.includes("node_modules")) { continue; } From 64848947e976b7bded91ec2d31f4006e9bb399fd Mon Sep 17 00:00:00 2001 From: Sage Abdullah Date: Mon, 7 Jul 2025 12:32:43 +0100 Subject: [PATCH 2/2] Handle inline-tag and relative-link CommentDisplayParts --- sphinx_js/js/convertTopLevel.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sphinx_js/js/convertTopLevel.ts b/sphinx_js/js/convertTopLevel.ts index a9a9fbc..6cb1fbe 100644 --- a/sphinx_js/js/convertTopLevel.ts +++ b/sphinx_js/js/convertTopLevel.ts @@ -254,13 +254,19 @@ class PathComputer implements ReflectionVisitor { */ function renderCommentContent(content: CommentDisplayPart[]): Description { return content.map((x): DescriptionItem => { - if (x.kind === "code") { - return { type: "code", code: x.text }; + switch (x.kind) { + case "code": + return { type: "code", code: x.text }; + case "text": + return { type: "text", text: x.text }; + // TODO: Add to DescriptionItem + case "inline-tag": + return { type: "text", text: x.text }; + case "relative-link": + return { type: "text", text: x.text }; + default: + throw new Error("Not implemented"); } - if (x.kind === "text") { - return { type: "text", text: x.text }; - } - throw new Error("Not implemented"); }); }