From 16f931b9b5b4ddb345554ea620da98c07380ff28 Mon Sep 17 00:00:00 2001 From: HiDeoo <494699+HiDeoo@users.noreply.github.com> Date: Fri, 8 Nov 2024 14:26:13 +0100 Subject: [PATCH] fix: fixes compatibility issue with Starlight `0.25.0` new sidebar links syntax --- example/astro.config.ts | 2 +- packages/starlight-typedoc/libs/starlight.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/example/astro.config.ts b/example/astro.config.ts index 12cdc0e..9a76218 100644 --- a/example/astro.config.ts +++ b/example/astro.config.ts @@ -24,7 +24,7 @@ export default defineConfig({ sidebar: [ { label: 'Guides', - items: [{ label: 'Example Guide', link: '/guides/example/' }], + items: ['guides/example'], }, typeDocSidebarGroup, ], diff --git a/packages/starlight-typedoc/libs/starlight.ts b/packages/starlight-typedoc/libs/starlight.ts index 83de259..e3ab3fe 100644 --- a/packages/starlight-typedoc/libs/starlight.ts +++ b/packages/starlight-typedoc/libs/starlight.ts @@ -111,7 +111,7 @@ function getSidebarGroupFromReflections( .flatMap((group) => { if (group.title === 'Modules') { return group.children.map((child) => { - if (!child.url) { + if (!child.url || child.variant === 'document') { return undefined } @@ -230,7 +230,7 @@ export function getStarlightTypeDocOutputDirectory(outputDirectory: string, base } function isSidebarManualGroup(item: NonNullable[number]): item is SidebarManualGroup { - return 'items' in item + return typeof item === 'object' && 'items' in item } function isReferenceReflectionGroup(group: ReflectionGroup) {