mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 20:43:36 +00:00
chore: Enhance type safety and improve code consistency across components
- Added a new `typecheck` script in `package.json` for better type checking in the UI workspace. - Refactored several components to remove unnecessary type assertions and improve type safety, particularly in `new-project-modal.tsx`, `edit-project-dialog.tsx`, and `task-progress-panel.tsx`. - Updated event handling in `git-diff-panel.tsx` to use async functions for better error handling. - Improved type definitions in various files, including `setup-view` and `electron.ts`, to ensure consistent usage of types across the codebase. - Cleaned up global type definitions for better clarity and maintainability. These changes aim to streamline the development process and reduce potential runtime errors.
This commit is contained in:
@@ -153,8 +153,12 @@ export function getStoredTheme(): ThemeMode | null {
|
||||
try {
|
||||
const legacy = getItem('automaker-storage');
|
||||
if (!legacy) return null;
|
||||
const parsed = JSON.parse(legacy) as { state?: { theme?: unknown } } | { theme?: unknown };
|
||||
const theme = (parsed as any)?.state?.theme ?? (parsed as any)?.theme;
|
||||
interface LegacyStorageFormat {
|
||||
state?: { theme?: string };
|
||||
theme?: string;
|
||||
}
|
||||
const parsed = JSON.parse(legacy) as LegacyStorageFormat;
|
||||
const theme = parsed.state?.theme ?? parsed.theme;
|
||||
if (typeof theme === 'string' && theme.length > 0) {
|
||||
return theme as ThemeMode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user