From 0a52e7452c39e440d79605e80fa57e01b98be55f Mon Sep 17 00:00:00 2001 From: Gerrit Birkeland Date: Sun, 26 Feb 2023 14:22:20 -0700 Subject: [PATCH] Fix #2170 --- CHANGELOG.md | 3 ++- src/index.ts | 1 + .../output/themes/default/assets/typedoc/Application.ts | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01c061a54..5edef3908 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,8 @@ ### Bug Fixes -- Fix crash when converting `export default undefined`, #2175 +- Fix crash when converting `export default undefined`, #2175. +- Fix error in console when clicking on headings in the readme, #2170. ### Thanks! diff --git a/src/index.ts b/src/index.ts index d5b0fef5b..34cab7db7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -14,6 +14,7 @@ export { type Meaning, type MeaningKeyword, type ExternalResolveResult, + type ExternalSymbolResolver, } from "./lib/converter"; export { diff --git a/src/lib/output/themes/default/assets/typedoc/Application.ts b/src/lib/output/themes/default/assets/typedoc/Application.ts index e3f178f41..176cb8baf 100644 --- a/src/lib/output/themes/default/assets/typedoc/Application.ts +++ b/src/lib/output/themes/default/assets/typedoc/Application.ts @@ -76,10 +76,15 @@ export class Application { if (!reflAnchor) return; let reflContainer = reflAnchor.parentElement!; - while (reflContainer.tagName !== "SECTION") { + while (reflContainer && reflContainer.tagName !== "SECTION") { reflContainer = reflContainer.parentElement!; } + if (!reflContainer) { + // This is probably a link in the readme, doesn't have a containing section + return; + } + if (reflContainer.offsetParent == null) { this.alwaysVisibleMember = reflContainer;