refactor(types): centralize type definitions in shared types file
Move all interface and type definitions to src/types/index.ts to reduce code duplication and improve maintainability. This includes types for components, blog posts, personal info, and localization.
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
// src/i18n/utils.ts
|
||||
import { ui, defaultLang, languages } from './ui';
|
||||
import { type Lang, type UiKeys } from '@/types';
|
||||
|
||||
export type Lang = keyof typeof languages;
|
||||
|
||||
// 简化类型定义,直接使用字符串类型
|
||||
// 这样可以兼容点符号键,同时避免复杂的类型推导问题
|
||||
export type UiKeys = string;
|
||||
// 重新导出类型,以保持向后兼容性
|
||||
export type { Lang, UiKeys };
|
||||
|
||||
|
||||
export function useTranslations(lang: Lang | undefined) {
|
||||
|
||||
Reference in New Issue
Block a user