Skip to content

Commit

Permalink
fix: Add type safety to serviceItems
Browse files Browse the repository at this point in the history
  • Loading branch information
harshthakkr committed Jan 9, 2025
1 parent ac35818 commit 9f50776
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ import MetricsCard from './metrics-card.component';
import MetricsHeader from './metrics-header.component';
import useQueueServices from '../hooks/useQueueService';
import styles from './clinic-metrics.scss';
import { type Concept } from '../types';

export interface Service {
uuid: string;
display: string;
}

type ServiceListItem = Service | Concept;

function ClinicMetrics() {
const { t } = useTranslation();
const layout = useLayoutType();
Expand All @@ -35,12 +38,12 @@ function ClinicMetrics() {
const { activeVisitsCount, isLoading: loading } = useActiveVisits();
const { waitTime } = useAverageWaitTime(currentService?.serviceUuid, '');

const defaultServiceItem = {
const defaultServiceItem: Service = {
display: `${t('all', 'All')}`,
uuid: '',
};

const serviceItems = [defaultServiceItem, ...(services ?? [])];
const serviceItems: ServiceListItem[] = [defaultServiceItem, ...(services ?? [])];

const handleServiceChange = ({ selectedItem }) => {
updateSelectedService(selectedItem.uuid, selectedItem.display);
Expand Down

0 comments on commit 9f50776

Please sign in to comment.