summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoren Broekema2024-04-09 13:10:36 +0200
committerGitHub2024-04-09 13:10:36 +0200
commitf171ac4d6396eb2538598d85957670df50938b6a (patch)
tree45d6655587ef5c4fbb2e8e7d81410b1b1c1605fd
parentc5cd181186b42422f3e47052bf8182cb490bda6b (diff)
downloadIT.starlight-f171ac4d6396eb2538598d85957670df50938b6a.tar.gz
IT.starlight-f171ac4d6396eb2538598d85957670df50938b6a.tar.bz2
IT.starlight-f171ac4d6396eb2538598d85957670df50938b6a.zip
fix: minor type issues in starlight (#1706)
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
-rw-r--r--.changeset/shaggy-crabs-press.md5
-rw-r--r--packages/starlight/integrations/shared/pathToLocale.ts3
-rw-r--r--packages/starlight/user-components/rehype-file-tree.ts2
3 files changed, 8 insertions, 2 deletions
diff --git a/.changeset/shaggy-crabs-press.md b/.changeset/shaggy-crabs-press.md
new file mode 100644
index 00000000..4172a8ef
--- /dev/null
+++ b/.changeset/shaggy-crabs-press.md
@@ -0,0 +1,5 @@
+---
+'@astrojs/starlight': patch
+---
+
+Fixes some minor type errors
diff --git a/packages/starlight/integrations/shared/pathToLocale.ts b/packages/starlight/integrations/shared/pathToLocale.ts
index aa8748cd..5c229a47 100644
--- a/packages/starlight/integrations/shared/pathToLocale.ts
+++ b/packages/starlight/integrations/shared/pathToLocale.ts
@@ -1,3 +1,4 @@
+import type { AstroConfig } from 'astro';
import type { StarlightConfig } from '../../types';
function slugToLocale(
@@ -17,7 +18,7 @@ export function pathToLocale(
astroConfig,
}: {
starlightConfig: { locales: StarlightConfig['locales'] };
- astroConfig: { root: URL; srcDir: URL };
+ astroConfig: { root: AstroConfig['root']; srcDir: AstroConfig['srcDir'] };
}
): string | undefined {
const srcDir = new URL(astroConfig.srcDir, astroConfig.root);
diff --git a/packages/starlight/user-components/rehype-file-tree.ts b/packages/starlight/user-components/rehype-file-tree.ts
index 5af454fe..2f96d5c5 100644
--- a/packages/starlight/user-components/rehype-file-tree.ts
+++ b/packages/starlight/user-components/rehype-file-tree.ts
@@ -168,7 +168,7 @@ function getFileIcon(fileName: string) {
/** Return the icon name for a file based on its file name. */
function getFileIconName(fileName: string) {
- let icon = definitions.files[fileName];
+ let icon: string | undefined = definitions.files[fileName];
if (icon) return icon;
icon = getFileIconTypeFromExtension(fileName);
if (icon) return icon;