Skip to content

Commit cdb27d1

Browse files
committed
Remove some casts
1 parent 56851e2 commit cdb27d1

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

webviews/dashboardView/app.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,11 @@ function Dashboard() {
140140
}, [dashboardState]);
141141

142142
// Derived state from discriminated union
143-
const isGlobal = dashboardState && (dashboardState as any).isGlobal === true;
144-
const issueQuery = !isGlobal && dashboardState ? (dashboardState as any).issueQuery || '' : '';
145-
const milestoneIssues = !isGlobal && dashboardState?.state === 'ready' ? (dashboardState as any).milestoneIssues : [];
143+
const isGlobal = dashboardState?.isGlobal;
144+
const issueQuery = !isGlobal && dashboardState ? dashboardState.issueQuery || '' : '';
145+
const milestoneIssues = !isGlobal && dashboardState?.state === 'ready' && !dashboardState.isGlobal ? dashboardState.milestoneIssues : [];
146146
const activeSessions = dashboardState?.state === 'ready' ? dashboardState.activeSessions : [];
147-
const recentProjects = isGlobal && dashboardState?.state === 'ready' ? (dashboardState as any).recentProjects : [];
147+
const recentProjects = isGlobal && dashboardState?.state === 'ready' && dashboardState.isGlobal ? dashboardState.recentProjects : [];
148148

149149
// For global dashboards, create a mixed array of sessions and projects
150150
const mixedItems = isGlobal ? (() => {

webviews/dashboardView/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ export type DashboardState = DashboardLoading | DashboardReady | GlobalDashboard
4141

4242
export interface DashboardLoading {
4343
readonly state: 'loading';
44+
readonly isGlobal: false;
4445
readonly issueQuery: string;
4546
}
4647

4748
export interface DashboardReady {
4849
readonly state: 'ready';
50+
readonly isGlobal: false;
4951
readonly issueQuery: string;
5052
readonly activeSessions: readonly SessionData[];
5153
readonly milestoneIssues: readonly IssueData[];

0 commit comments

Comments
 (0)