fix types
Co-authored-by: Petter Sæterøy <potetmos1@users.noreply.github.com>
This commit is contained in:
@@ -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/', '/');
|
||||
|
Reference in New Issue
Block a user