remove unnecessary casts

This commit is contained in:
Peter Clement 2025-01-06 12:43:15 +00:00
parent 428df339c4
commit a09caf52d8
2 changed files with 5 additions and 14 deletions

View File

@ -19,10 +19,7 @@ export class ThemeStore extends BudiStore<ThemeState> {
syncAppTheme = (app: App) => {
this.update(state => {
const theme = ensureValidTheme(
app.theme as Theme | undefined,
DefaultAppTheme
) as Theme
const theme = ensureValidTheme(app.theme, DefaultAppTheme)
return {
...state,
theme,
@ -35,10 +32,7 @@ export class ThemeStore extends BudiStore<ThemeState> {
const app = await API.saveAppMetadata(appId, { theme })
this.update(state => ({
...state,
theme: ensureValidTheme(
app.theme as Theme | undefined,
DefaultAppTheme
) as Theme,
theme: ensureValidTheme(app.theme, DefaultAppTheme),
}))
}
@ -55,10 +49,7 @@ export class ThemeStore extends BudiStore<ThemeState> {
const { theme, customTheme } = metadata
this.update(state => ({
...state,
theme: ensureValidTheme(
theme as Theme | undefined,
DefaultAppTheme
) as Theme,
theme: ensureValidTheme(theme, DefaultAppTheme),
customTheme: customTheme || {},
}))
}

View File

@ -1,4 +1,4 @@
import { User, Document, Plugin, Snippet } from "../"
import { User, Document, Plugin, Snippet, Theme } from "../"
import { SocketSession } from "../../sdk"
export type AppMetadataErrors = { [key: string]: string[] }
@ -14,7 +14,7 @@ export interface App extends Document {
instance: AppInstance
tenantId: string
status: string
theme?: string
theme?: Theme
customTheme?: AppCustomTheme
revertableVersion?: string
lockedBy?: User