From c0b38d4762979c79cab318aef7fc5c7324719b81 Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Mon, 31 Jul 2023 10:43:37 +0200 Subject: [PATCH] store: use return type over a type cast --- client/js/store.ts | 49 +++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/client/js/store.ts b/client/js/store.ts index d536389f..41968e66 100644 --- a/client/js/store.ts +++ b/client/js/store.ts @@ -90,31 +90,30 @@ export type State = { searchEnabled: boolean; }; -const state = () => - ({ - appLoaded: false, - activeChannel: undefined, - currentUserVisibleError: null, - desktopNotificationState: detectDesktopNotificationState(), - isAutoCompleting: false, - isConnected: false, - networks: [], - mentions: [], - hasServiceWorker: false, - pushNotificationState: "unsupported", - serverConfiguration: null, - sessions: [], - sidebarOpen: false, - sidebarDragging: false, - userlistOpen: storage.get("thelounge.state.userlist") !== "false", - versionData: null, - versionStatus: "loading", - versionDataExpired: false, - serverHasSettings: false, - messageSearchResults: null, - messageSearchPendingQuery: null, - searchEnabled: false, - } as State); +const state = (): State => ({ + appLoaded: false, + activeChannel: undefined, + currentUserVisibleError: null, + desktopNotificationState: detectDesktopNotificationState(), + isAutoCompleting: false, + isConnected: false, + networks: [], + mentions: [], + hasServiceWorker: false, + pushNotificationState: "unsupported", + serverConfiguration: null, + sessions: [], + sidebarOpen: false, + sidebarDragging: false, + userlistOpen: storage.get("thelounge.state.userlist") !== "false", + versionData: null, + versionStatus: "loading", + versionDataExpired: false, + serverHasSettings: false, + messageSearchResults: null, + messageSearchPendingQuery: null, + searchEnabled: false, +}); type Getters = { findChannelOnCurrentNetwork: (state: State) => (name: string) => ClientChan | undefined;