From 1b7fafbb54c28c9c3ec76069e0edab7d25743a37 Mon Sep 17 00:00:00 2001 From: Shintaro Jokagi Date: Thu, 29 May 2025 12:24:41 +1200 Subject: [PATCH] refactor(ModsList, ReleaseNoteListItem): update interface usage for better type safety --- src/components/ModsList.astro | 4 ++-- src/components/ReleaseNoteListItem.astro | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/ModsList.astro b/src/components/ModsList.astro index e38dee8..3134ce8 100644 --- a/src/components/ModsList.astro +++ b/src/components/ModsList.astro @@ -12,14 +12,14 @@ const defaultSortIcon = icon({ prefix: 'fas', iconName: 'sort' }) const ascSortIcon = icon({ prefix: 'fas', iconName: 'sort-up' }) const descSortIcon = icon({ prefix: 'fas', iconName: 'sort-down' }) -interface ModsListProps { +interface Props { allMods: ZenTheme[] locale: Locale // eslint-disable-next-line @typescript-eslint/no-explicit-any translations: any } -const { allMods, locale, translations } = Astro.props as ModsListProps +const { allMods, locale, translations } = Astro.props const getLocalePath = getPath(locale) diff --git a/src/components/ReleaseNoteListItem.astro b/src/components/ReleaseNoteListItem.astro index 18387ff..200a34e 100644 --- a/src/components/ReleaseNoteListItem.astro +++ b/src/components/ReleaseNoteListItem.astro @@ -1,7 +1,7 @@ --- import { getLocale, getUI } from '~/utils/i18n' -const { type, content, link } = Astro.props as { +interface Props { type: 'security' | 'feature' | 'fix' | 'theme' | 'break' | 'known' content: string link?: { @@ -10,6 +10,8 @@ const { type, content, link } = Astro.props as { } | null } +const { type, content, link } = Astro.props as Props + const locale = getLocale(Astro) const {