feat(normalize): use type UnifiedFontVariant instead of string

This commit is contained in:
Ilia Mashkov
2026-02-05 11:39:56 +03:00
parent 9a794b626b
commit 0554fcada7

View File

@@ -12,6 +12,7 @@ import type {
FontshareFont, FontshareFont,
GoogleFontItem, GoogleFontItem,
UnifiedFont, UnifiedFont,
UnifiedFontVariant,
} from '../../model/types'; } from '../../model/types';
/** /**
@@ -186,7 +187,7 @@ export function normalizeFontshareFont(apiFont: FontshareFont): UnifiedFont {
const variants = apiFont.styles.map(style => { const variants = apiFont.styles.map(style => {
const weightLabel = style.weight.label; const weightLabel = style.weight.label;
const isItalic = style.is_italic; const isItalic = style.is_italic;
return isItalic ? `${weightLabel}italic` : weightLabel; return (isItalic ? `${weightLabel}italic` : weightLabel) as UnifiedFontVariant;
}); });
// Map styles to URLs // Map styles to URLs