Skip to content

Commit

Permalink
Fixes type error with Astro 4.15.x (#2273)
Browse files Browse the repository at this point in the history
  • Loading branch information
delucis committed Sep 2, 2024
1 parent 239262a commit 746e0cd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/fifty-gorillas-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/starlight': patch
---

Fixes type error when using Starlight with Astro v4.15
2 changes: 1 addition & 1 deletion packages/starlight/__tests__/basics/i18n.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ function getAstroI18nTestConfig(i18nConfig: AstroUserConfig['i18n']): AstroConfi
...i18nConfig,
routing:
typeof i18nConfig?.routing !== 'string'
? { prefixDefaultLocale: false, ...i18nConfig?.routing }
? { prefixDefaultLocale: false, fallbackType: 'redirect', ...i18nConfig?.routing }
: i18nConfig.routing,
} as AstroConfig['i18n'];
}
3 changes: 3 additions & 0 deletions packages/starlight/utils/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ function getAstroI18nConfig(config: StarlightConfig): NonNullable<AstroConfig['i
// Sites with a single non-root language different from the built-in default locale.
(!config.isMultilingual && config.locales !== undefined),
redirectToDefaultLocale: false,
// TODO: remove this ignore comment for Astro v5
// @ts-ignore — Only used in Astro >=4.15.0, but Starlight supports ^4.8.6
fallbackType: 'redirect',
},
};
}
Expand Down

0 comments on commit 746e0cd

Please sign in to comment.