Skip to content

Commit

Permalink
Slightly better types
Browse files Browse the repository at this point in the history
  • Loading branch information
delucis committed May 9, 2023
1 parent d256347 commit 0ddef61
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/starlight/components/SocialIcons.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@
import config from 'virtual:starlight/user-config';
import Icon from './Icon.astro';
const links = Object.entries(config.social || {}).filter(([, url]) =>
Boolean(url)
) as [platform: keyof NonNullable<typeof config.social>, url: string][];
type Platform = keyof NonNullable<typeof config.social>;
const labels = {
const labels: Record<Platform, string> = {
github: 'GitHub',
discord: 'Discord',
twitter: 'Twitter',
mastodon: 'Mastodon',
};
const links = Object.entries(config.social || {}).filter(([, url]) =>
Boolean(url)
) as [platform: Platform, url: string][];
---

{
Expand Down

0 comments on commit 0ddef61

Please sign in to comment.