fix types

Co-authored-by: Petter Sæterøy <potetmos1@users.noreply.github.com>
This commit is contained in:
2025-07-02 23:49:36 +02:00
parent 42a8e1a737
commit a2e9f5ef6f
8 changed files with 28 additions and 19 deletions

View File

@@ -1,12 +1,11 @@
---
import NavLink from '@components/NavLink.astro';
import { translations } from '@data/i18n.js';
const { lang = 'no' } = Astro.props;
import { translations, type Lang } from '@data/i18n';
const { lang = 'no' } = Astro.props as { lang?: Lang };
const t = translations[lang].nav;
const { pathname } = Astro.url;
function getLangSwitchPath(path, lang) {
function getLangSwitchPath(path: string, lang: string) {
if (lang === 'no') {
if (path === '/') return '/en/';
if (path.startsWith('/en/')) return path.replace('/en/', '/');