From b62840e63b1abf4bdcbcf63533a2b9a966685180 Mon Sep 17 00:00:00 2001
From: Gigin George <mail.gigin@gmail.com>
Date: Sun, 29 Sep 2024 22:12:10 +0700
Subject: [PATCH] Rewrite types for all Routes

---
 src/Routers/AppRouter.tsx                     | 26 +++++--
 src/Routers/routes/AssetRoutes.tsx            | 25 ++++---
 src/Routers/routes/ConsultationRoutes.tsx     | 68 ++++++++++---------
 src/Routers/routes/ExternalResultRoutes.tsx   | 12 ++--
 .../routes/FacilityInventoryRoutes.tsx        | 19 +++---
 src/Routers/routes/FacilityLocationRoutes.tsx | 25 +++----
 src/Routers/routes/FacilityRoutes.tsx         | 27 ++++----
 src/Routers/routes/HCXRoutes.tsx              | 17 +++--
 src/Routers/routes/PatientRoutes.tsx          | 26 +++----
 src/Routers/routes/ResourceRoutes.tsx         | 12 ++--
 src/Routers/routes/SampleRoutes.tsx           | 20 +++---
 src/Routers/routes/ShiftingRoutes.tsx         | 11 +--
 src/Routers/routes/UserRoutes.tsx             |  5 +-
 13 files changed, 162 insertions(+), 131 deletions(-)

diff --git a/src/Routers/AppRouter.tsx b/src/Routers/AppRouter.tsx
index 4030238eb3f..abf351764d7 100644
--- a/src/Routers/AppRouter.tsx
+++ b/src/Routers/AppRouter.tsx
@@ -25,11 +25,25 @@ import ShiftingRoutes from "./routes/ShiftingRoutes";
 import AssetRoutes from "./routes/AssetRoutes";
 import ResourceRoutes from "./routes/ResourceRoutes";
 import ExternalResultRoutes from "./routes/ExternalResultRoutes";
-import { DetailRoute } from "./types";
 import useAuthUser from "../Common/hooks/useAuthUser";
 import careConfig from "@careConfig";
 
-const Routes = {
+export type RouteParams<T extends string> =
+  T extends `${string}:${infer Param}/${infer Rest}`
+    ? { [K in Param | keyof RouteParams<Rest>]: string }
+    : T extends `${string}:${infer Param}`
+      ? { [K in Param]: string }
+      : Record<string, never>;
+
+export type RouteFunction<T extends string> = (
+  params: RouteParams<T>,
+) => JSX.Element;
+
+export type AppRoutes = {
+  [K in string]: RouteFunction<K>;
+};
+
+const Routes: AppRoutes = {
   "/": () => <Redirect to="/facility" />,
 
   ...AssetRoutes,
@@ -41,15 +55,13 @@ const Routes = {
   ...ShiftingRoutes,
   ...UserRoutes,
 
-  "/notifications/:id": ({ id }: DetailRoute) => (
-    <ShowPushNotification id={id} />
-  ),
+  "/notifications/:id": ({ id }) => <ShowPushNotification id={id} />,
   "/notice_board": () => <NoticeBoard />,
 
-  "/abdm/health-information/:id": ({ id }: { id: string }) => (
+  "/abdm/health-information/:id": ({ id }) => (
     <HealthInformation artefactId={id} />
   ),
-  "/facility/:facilityId/abdm": ({ facilityId }: any) => (
+  "/facility/:facilityId/abdm": ({ facilityId }) => (
     <ABDMFacilityRecords facilityId={facilityId} />
   ),
 
diff --git a/src/Routers/routes/AssetRoutes.tsx b/src/Routers/routes/AssetRoutes.tsx
index d3bd96ca437..ee0537d6c58 100644
--- a/src/Routers/routes/AssetRoutes.tsx
+++ b/src/Routers/routes/AssetRoutes.tsx
@@ -2,20 +2,23 @@ import AssetConfigure from "../../Components/Assets/AssetConfigure";
 import AssetManage from "../../Components/Assets/AssetManage";
 import AssetsList from "../../Components/Assets/AssetsList";
 import AssetCreate from "../../Components/Facility/AssetCreate";
+import { AppRoutes } from "../AppRouter";
 
-export default {
+const AssetRoutes: AppRoutes = {
   "/assets": () => <AssetsList />,
-
-  "/facility/:facilityId/assets/new": (params: any) => (
-    <AssetCreate {...params} />
-  ),
-  "/facility/:facilityId/assets/:assetId/update": (params: any) => (
-    <AssetCreate {...params} />
+  "/facility/:facilityId/assets/new": ({ facilityId }) => (
+    <AssetCreate facilityId={facilityId} />
   ),
-  "/facility/:facilityId/assets/:assetId": (params: any) => (
-    <AssetManage {...params} />
+  "/facility/:facilityId/assets/:assetId/update": ({ facilityId, assetId }) => (
+    <AssetCreate facilityId={facilityId} assetId={assetId} />
   ),
-  "/facility/:facilityId/assets/:assetId/configure": (params: any) => (
-    <AssetConfigure {...params} />
+  "/facility/:facilityId/assets/:assetId": ({ facilityId, assetId }) => (
+    <AssetManage facilityId={facilityId} assetId={assetId} />
   ),
+  "/facility/:facilityId/assets/:assetId/configure": ({
+    facilityId,
+    assetId,
+  }) => <AssetConfigure facilityId={facilityId} assetId={assetId} />,
 };
+
+export default AssetRoutes;
diff --git a/src/Routers/routes/ConsultationRoutes.tsx b/src/Routers/routes/ConsultationRoutes.tsx
index 598fd06adc3..77efe1081bc 100644
--- a/src/Routers/routes/ConsultationRoutes.tsx
+++ b/src/Routers/routes/ConsultationRoutes.tsx
@@ -5,30 +5,29 @@ import ManagePrescriptions from "../../Components/Medicine/ManagePrescriptions";
 import { DailyRoundListDetails } from "../../Components/Patient/DailyRoundListDetails";
 import { DailyRounds } from "../../Components/Patient/DailyRounds";
 import { ConsultationDetails } from "../../Components/Facility/ConsultationDetails";
-import TreatmentSummary, {
-  ITreatmentSummaryProps,
-} from "../../Components/Facility/TreatmentSummary";
+import TreatmentSummary from "../../Components/Facility/TreatmentSummary";
 import ConsultationDoctorNotes from "../../Components/Facility/ConsultationDoctorNotes";
 import PatientConsentRecords from "../../Components/Patient/PatientConsentRecords";
 import CriticalCareEditor from "../../Components/LogUpdate/CriticalCareEditor";
 import PrescriptionsPrintPreview from "../../Components/Medicine/PrintPreview";
 import CriticalCarePreview from "../../Components/LogUpdate/CriticalCarePreview";
 import FileUploadPage from "../../Components/Patient/FileUploadPage";
+import { AppRoutes } from "../AppRouter";
 
-export default {
+const consultationRoutes: AppRoutes = {
   "/facility/:facilityId/patient/:patientId/consultation": ({
     facilityId,
     patientId,
-  }: any) => <ConsultationForm facilityId={facilityId} patientId={patientId} />,
+  }) => <ConsultationForm facilityId={facilityId} patientId={patientId} />,
   "/facility/:facilityId/patient/:patientId/consultation/:id/update": ({
     facilityId,
     patientId,
     id,
-  }: any) => (
+  }) => (
     <ConsultationForm facilityId={facilityId} patientId={patientId} id={id} />
   ),
   "/facility/:facilityId/patient/:patientId/consultation/:id/consent-records":
-    ({ facilityId, patientId, id }: any) => (
+    ({ facilityId, patientId, id }) => (
       <PatientConsentRecords
         facilityId={facilityId}
         patientId={patientId}
@@ -39,7 +38,7 @@ export default {
     facilityId,
     patientId,
     id,
-  }: any) => (
+  }) => (
     <FileUploadPage
       facilityId={facilityId}
       patientId={patientId}
@@ -48,14 +47,14 @@ export default {
     />
   ),
   "/facility/:facilityId/patient/:patientId/consultation/:consultationId/prescriptions":
-    (path: any) => <ManagePrescriptions {...path} />,
+    (path) => <ManagePrescriptions {...path} />,
   "/facility/:facilityId/patient/:patientId/consultation/:consultationId/prescriptions/print":
     () => <PrescriptionsPrintPreview />,
   "/facility/:facilityId/patient/:patientId/consultation/:id/investigation": ({
     facilityId,
     patientId,
     id,
-  }: any) => (
+  }) => (
     <Investigation
       consultationId={id}
       facilityId={facilityId}
@@ -63,7 +62,7 @@ export default {
     />
   ),
   "/facility/:facilityId/patient/:patientId/consultation/:id/investigation/:sessionId":
-    ({ facilityId, patientId, id, sessionId }: any) => (
+    ({ facilityId, patientId, id, sessionId }) => (
       <ShowInvestigation
         consultationId={id}
         facilityId={facilityId}
@@ -75,7 +74,7 @@ export default {
     facilityId,
     patientId,
     id,
-  }: any) => (
+  }) => (
     <DailyRounds
       facilityId={facilityId}
       patientId={patientId}
@@ -83,7 +82,7 @@ export default {
     />
   ),
   "/facility/:facilityId/patient/:patientId/consultation/:consultationId/daily-rounds/:id/update":
-    ({ facilityId, patientId, consultationId, id }: any) => (
+    ({ facilityId, patientId, consultationId, id }) => (
       <DailyRounds
         facilityId={facilityId}
         patientId={patientId}
@@ -92,7 +91,7 @@ export default {
       />
     ),
   "/facility/:facilityId/patient/:patientId/consultation/:consultationId/daily-rounds/:id":
-    ({ facilityId, patientId, consultationId, id }: any) => (
+    ({ facilityId, patientId, consultationId, id }) => (
       <DailyRoundListDetails
         facilityId={facilityId}
         patientId={patientId}
@@ -100,26 +99,29 @@ export default {
         id={id}
       />
     ),
-
   "/facility/:facilityId/patient/:patientId/consultation/:consultationId/daily_rounds/:id":
-    (params: {
-      facilityId: string;
-      patientId: string;
-      consultationId: string;
-      id: string;
-    }) => <CriticalCarePreview {...params} />,
+    ({ facilityId, patientId, consultationId, id }) => (
+      <CriticalCarePreview
+        facilityId={facilityId}
+        patientId={patientId}
+        consultationId={consultationId}
+        id={id}
+      />
+    ),
   "/facility/:facilityId/patient/:patientId/consultation/:consultationId/daily_rounds/:id/update":
-    (params: {
-      facilityId: string;
-      patientId: string;
-      consultationId: string;
-      id: string;
-    }) => <CriticalCareEditor {...params} />,
+    ({ facilityId, patientId, consultationId, id }) => (
+      <CriticalCareEditor
+        facilityId={facilityId}
+        patientId={patientId}
+        consultationId={consultationId}
+        id={id}
+      />
+    ),
   "/facility/:facilityId/patient/:patientId/consultation/:consultationId": ({
     facilityId,
     patientId,
     consultationId,
-  }: any) => (
+  }) => (
     <ConsultationDetails
       facilityId={facilityId}
       patientId={patientId}
@@ -127,11 +129,11 @@ export default {
       tab={"updates"}
     />
   ),
-  "/consultation/:consultationId": ({ consultationId }: any) => (
+  "/consultation/:consultationId": ({ consultationId }) => (
     <ConsultationDetails consultationId={consultationId} tab={"updates"} />
   ),
   "/facility/:facilityId/patient/:patientId/consultation/:consultationId/treatment-summary":
-    ({ facilityId, patientId, consultationId }: ITreatmentSummaryProps) => (
+    ({ facilityId, patientId, consultationId }) => (
       <TreatmentSummary
         facilityId={facilityId}
         consultationId={consultationId}
@@ -139,7 +141,7 @@ export default {
       />
     ),
   "/facility/:facilityId/patient/:patientId/consultation/:consultationId/notes":
-    ({ facilityId, patientId, consultationId }: any) => (
+    ({ facilityId, patientId, consultationId }) => (
       <ConsultationDoctorNotes
         facilityId={facilityId}
         patientId={patientId}
@@ -147,7 +149,7 @@ export default {
       />
     ),
   "/facility/:facilityId/patient/:patientId/consultation/:consultationId/:tab":
-    ({ facilityId, patientId, consultationId, tab }: any) => (
+    ({ facilityId, patientId, consultationId, tab }) => (
       <ConsultationDetails
         facilityId={facilityId}
         patientId={patientId}
@@ -156,3 +158,5 @@ export default {
       />
     ),
 };
+
+export default consultationRoutes;
diff --git a/src/Routers/routes/ExternalResultRoutes.tsx b/src/Routers/routes/ExternalResultRoutes.tsx
index b6bc71a2808..1932f48ad66 100644
--- a/src/Routers/routes/ExternalResultRoutes.tsx
+++ b/src/Routers/routes/ExternalResultRoutes.tsx
@@ -1,12 +1,12 @@
 import ResultItem from "../../Components/ExternalResult/ResultItem";
 import ResultList from "../../Components/ExternalResult/ResultList";
 import ResultUpdate from "../../Components/ExternalResult/ResultUpdate";
-import { DetailRoute } from "../types";
+import { AppRoutes } from "../AppRouter";
 
-export default {
+const ExternalResultRoutes: AppRoutes = {
   "/external_results": () => <ResultList />,
-  "/external_results/:id": ({ id }: DetailRoute) => <ResultItem id={id} />,
-  "/external_results/:id/update": ({ id }: DetailRoute) => (
-    <ResultUpdate id={id} />
-  ),
+  "/external_results/:id": ({ id }) => <ResultItem id={id} />,
+  "/external_results/:id/update": ({ id }) => <ResultUpdate id={id} />,
 };
+
+export default ExternalResultRoutes;
diff --git a/src/Routers/routes/FacilityInventoryRoutes.tsx b/src/Routers/routes/FacilityInventoryRoutes.tsx
index 17e93b2bc60..99123d8f737 100644
--- a/src/Routers/routes/FacilityInventoryRoutes.tsx
+++ b/src/Routers/routes/FacilityInventoryRoutes.tsx
@@ -3,22 +3,25 @@ import InventoryList from "../../Components/Facility/InventoryList";
 import InventoryLog from "../../Components/Facility/InventoryLog";
 import MinQuantityList from "../../Components/Facility/MinQuantityList";
 import { SetInventoryForm } from "../../Components/Facility/SetInventoryForm";
+import { AppRoutes } from "../AppRouter";
 
-export default {
-  "/facility/:facilityId/inventory": ({ facilityId }: any) => (
+const FacilityInventoryRoutes: AppRoutes = {
+  "/facility/:facilityId/inventory": ({ facilityId }) => (
     <InventoryList facilityId={facilityId} />
   ),
-  "/facility/:facilityId/inventory/min_quantity/set": ({ facilityId }: any) => (
+  "/facility/:facilityId/inventory/min_quantity/set": ({ facilityId }) => (
     <SetInventoryForm facilityId={facilityId} />
   ),
-  "/facility/:facilityId/inventory/min_quantity/list": ({
-    facilityId,
-  }: any) => <MinQuantityList facilityId={facilityId} />,
-  "/facility/:facilityId/inventory/min_quantity": ({ facilityId }: any) => (
+  "/facility/:facilityId/inventory/min_quantity/list": ({ facilityId }) => (
+    <MinQuantityList facilityId={facilityId} />
+  ),
+  "/facility/:facilityId/inventory/min_quantity": ({ facilityId }) => (
     <Redirect to={`/facility/${facilityId}/inventory/min_quantity/list`} />
   ),
   "/facility/:facilityId/inventory/:inventoryId": ({
     facilityId,
     inventoryId,
-  }: any) => <InventoryLog facilityId={facilityId} inventoryId={inventoryId} />,
+  }) => <InventoryLog facilityId={facilityId} inventoryId={inventoryId} />,
 };
+
+export default FacilityInventoryRoutes;
diff --git a/src/Routers/routes/FacilityLocationRoutes.tsx b/src/Routers/routes/FacilityLocationRoutes.tsx
index 5d547ebd466..c2e1add4b10 100644
--- a/src/Routers/routes/FacilityLocationRoutes.tsx
+++ b/src/Routers/routes/FacilityLocationRoutes.tsx
@@ -6,41 +6,42 @@ import LocationManagement from "../../Components/Facility/LocationManagement";
 import CentralLiveMonitoring from "../../Components/CameraFeed/CentralLiveMonitoring";
 import { AuthorizeUserRoute } from "../../Utils/AuthorizeFor";
 import { CameraFeedPermittedUserTypes } from "../../Utils/permissions";
+import { AppRoutes } from "../AppRouter";
 
-export default {
-  "/facility/:facilityId/location": ({ facilityId }: any) => (
+const FacilityLocationRoutes: AppRoutes = {
+  "/facility/:facilityId/location": ({ facilityId }) => (
     <LocationManagement facilityId={facilityId} />
   ),
   "/facility/:facilityId/location/:locationId/beds": ({
     facilityId,
     locationId,
-  }: any) => <BedManagement facilityId={facilityId} locationId={locationId} />,
-  "/facility/:facilityId/inventory/add": ({ facilityId }: any) => (
+  }) => <BedManagement facilityId={facilityId} locationId={locationId} />,
+  "/facility/:facilityId/inventory/add": ({ facilityId }) => (
     <AddInventoryForm facilityId={facilityId} />
   ),
-  "/facility/:facilityId/location/add": ({ facilityId }: any) => (
+  "/facility/:facilityId/location/add": ({ facilityId }) => (
     <AddLocationForm facilityId={facilityId} />
   ),
   "/facility/:facilityId/location/:locationId/update": ({
     facilityId,
     locationId,
-  }: any) => (
-    <AddLocationForm facilityId={facilityId} locationId={locationId} />
-  ),
+  }) => <AddLocationForm facilityId={facilityId} locationId={locationId} />,
   "/facility/:facilityId/location/:locationId/beds/add": ({
     facilityId,
     locationId,
-  }: any) => <AddBedForm facilityId={facilityId} locationId={locationId} />,
+  }) => <AddBedForm facilityId={facilityId} locationId={locationId} />,
   "/facility/:facilityId/location/:locationId/beds/:bedId/update": ({
     facilityId,
     locationId,
     bedId,
-  }: any) => (
+  }) => (
     <AddBedForm facilityId={facilityId} locationId={locationId} bedId={bedId} />
   ),
-  "/facility/:facilityId/live-monitoring": (props: any) => (
+  "/facility/:facilityId/live-monitoring": ({ facilityId }) => (
     <AuthorizeUserRoute userTypes={CameraFeedPermittedUserTypes}>
-      <CentralLiveMonitoring {...props} />
+      <CentralLiveMonitoring facilityId={facilityId} />
     </AuthorizeUserRoute>
   ),
 };
+
+export default FacilityLocationRoutes;
diff --git a/src/Routers/routes/FacilityRoutes.tsx b/src/Routers/routes/FacilityRoutes.tsx
index 2c711cf48cb..220a90a65ed 100644
--- a/src/Routers/routes/FacilityRoutes.tsx
+++ b/src/Routers/routes/FacilityRoutes.tsx
@@ -9,41 +9,40 @@ import CentralNursingStation from "../../Components/Facility/CentralNursingStati
 import FacilityLocationRoutes from "./FacilityLocationRoutes";
 import FacilityInventoryRoutes from "./FacilityInventoryRoutes";
 import DischargedPatientsList from "../../Components/Facility/DischargedPatientsList";
+import { AppRoutes } from "../AppRouter";
 
-export default {
+const FacilityRoutes: AppRoutes = {
   "/facility": () => <HospitalList />,
   "/facility/create": () => <FacilityCreate />,
-  "/facility/:facilityId/update": ({ facilityId }: any) => (
+  "/facility/:facilityId/update": ({ facilityId }) => (
     <FacilityCreate facilityId={facilityId} />
   ),
-  "/facility/:facilityId/configure": ({ facilityId }: any) => (
+  "/facility/:facilityId/configure": ({ facilityId }) => (
     <FacilityConfigure facilityId={facilityId} />
   ),
-  "/facility/:facilityId/cns": ({ facilityId }: any) => (
+  "/facility/:facilityId/cns": ({ facilityId }) => (
     <CentralNursingStation facilityId={facilityId} />
   ),
-  "/facility/:facilityId": ({ facilityId }: any) => (
+  "/facility/:facilityId": ({ facilityId }) => (
     <FacilityHome facilityId={facilityId} />
   ),
-  "/facility/:id/discharged-patients": ({ id }: any) => (
+  "/facility/:id/discharged-patients": ({ id }) => (
     <DischargedPatientsList facility_external_id={id} />
   ),
-
-  "/facility/:facilityId/users": ({ facilityId }: any) => (
+  "/facility/:facilityId/users": ({ facilityId }) => (
     <FacilityUsers facilityId={facilityId} />
   ),
-  "/facility/:facilityId/resource/new": ({ facilityId }: any) => (
+  "/facility/:facilityId/resource/new": ({ facilityId }) => (
     <ResourceCreate facilityId={facilityId} />
   ),
-
-  // Triage related routes
-  "/facility/:facilityId/triage": ({ facilityId }: any) => (
+  "/facility/:facilityId/triage": ({ facilityId }) => (
     <TriageForm facilityId={facilityId} />
   ),
-  "/facility/:facilityId/triage/:id": ({ facilityId, id }: any) => (
+  "/facility/:facilityId/triage/:id": ({ facilityId, id }) => (
     <TriageForm facilityId={facilityId} id={id} />
   ),
-
   ...FacilityLocationRoutes,
   ...FacilityInventoryRoutes,
 };
+
+export default FacilityRoutes;
diff --git a/src/Routers/routes/HCXRoutes.tsx b/src/Routers/routes/HCXRoutes.tsx
index 80378b24621..929cc3f12bb 100644
--- a/src/Routers/routes/HCXRoutes.tsx
+++ b/src/Routers/routes/HCXRoutes.tsx
@@ -1,10 +1,15 @@
-import ConsultationClaims, {
-  IConsultationClaimsProps,
-} from "../../Components/Facility/ConsultationClaims";
+import ConsultationClaims from "../../Components/Facility/ConsultationClaims";
+import { AppRoutes } from "../AppRouter";
 
-export default {
+const HCXRoutes: AppRoutes = {
   "/facility/:facilityId/patient/:patientId/consultation/:consultationId/claims":
-    (pathParams: IConsultationClaimsProps) => (
-      <ConsultationClaims {...pathParams} />
+    ({ facilityId, patientId, consultationId }) => (
+      <ConsultationClaims
+        facilityId={facilityId}
+        patientId={patientId}
+        consultationId={consultationId}
+      />
     ),
 };
+
+export default HCXRoutes;
diff --git a/src/Routers/routes/PatientRoutes.tsx b/src/Routers/routes/PatientRoutes.tsx
index fcfc9b04e37..45ff044e4d2 100644
--- a/src/Routers/routes/PatientRoutes.tsx
+++ b/src/Routers/routes/PatientRoutes.tsx
@@ -3,44 +3,44 @@ import { PatientManager } from "../../Components/Patient/ManagePatients";
 import { PatientHome } from "../../Components/Patient/PatientHome";
 import PatientNotes from "../../Components/Patient/PatientNotes";
 import { PatientRegister } from "../../Components/Patient/PatientRegister";
-import { DetailRoute } from "../types";
 import DeathReport from "../../Components/DeathReport/DeathReport";
 import { InsuranceDetails } from "../../Components/Patient/InsuranceDetails";
 import FileUploadPage from "../../Components/Patient/FileUploadPage";
+import { AppRoutes } from "../AppRouter";
 
-export default {
+const PatientRoutes: AppRoutes = {
   "/patients": () => <PatientManager />,
-  "/patient/:id": ({ id }: DetailRoute) => <PatientHome id={id} />,
-  "/patient/:id/investigation_reports": ({ id }: DetailRoute) => (
+  "/patient/:id": ({ id }) => <PatientHome id={id} />,
+  "/patient/:id/investigation_reports": ({ id }) => (
     <InvestigationReports id={id} />
   ),
-
-  // Facility Scoped Routes
-  "/facility/:facilityId/patient": ({ facilityId }: any) => (
+  "/facility/:facilityId/patient": ({ facilityId }) => (
     <PatientRegister facilityId={facilityId} />
   ),
-  "/facility/:facilityId/patient/:id": ({ facilityId, id }: any) => (
+  "/facility/:facilityId/patient/:id": ({ facilityId, id }) => (
     <PatientHome facilityId={facilityId} id={id} />
   ),
-  "/facility/:facilityId/patient/:id/insurance": ({ facilityId, id }: any) => (
+  "/facility/:facilityId/patient/:id/insurance": ({ facilityId, id }) => (
     <InsuranceDetails facilityId={facilityId} id={id} />
   ),
-  "/facility/:facilityId/patient/:id/update": ({ facilityId, id }: any) => (
+  "/facility/:facilityId/patient/:id/update": ({ facilityId, id }) => (
     <PatientRegister facilityId={facilityId} id={id} />
   ),
   "/facility/:facilityId/patient/:patientId/notes": ({
     facilityId,
     patientId,
-  }: any) => <PatientNotes patientId={patientId} facilityId={facilityId} />,
+  }) => <PatientNotes patientId={patientId} facilityId={facilityId} />,
   "/facility/:facilityId/patient/:patientId/files": ({
     facilityId,
     patientId,
-  }: any) => (
+  }) => (
     <FileUploadPage
       facilityId={facilityId}
       patientId={patientId}
       type="PATIENT"
     />
   ),
-  "/death_report/:id": ({ id }: any) => <DeathReport id={id} />,
+  "/death_report/:id": ({ id }) => <DeathReport id={id} />,
 };
+
+export default PatientRoutes;
diff --git a/src/Routers/routes/ResourceRoutes.tsx b/src/Routers/routes/ResourceRoutes.tsx
index 8408ab4d79d..4ffa5bd94ad 100644
--- a/src/Routers/routes/ResourceRoutes.tsx
+++ b/src/Routers/routes/ResourceRoutes.tsx
@@ -5,12 +5,12 @@ import { ResourceDetailsUpdate } from "../../Components/Resource/ResourceDetails
 import ListView from "../../Components/Resource/ListView";
 import BoardView from "../../Components/Resource/ResourceBoardView";
 import { Redirect } from "raviger";
-import { DetailRoute } from "../types";
+import { AppRoutes } from "../AppRouter";
 
 const getDefaultView = () =>
   localStorage.getItem("defaultResourceView") === "list" ? "list" : "board";
 
-export default {
+const ResourceRoutes: AppRoutes = {
   "/resource": () => <Redirect to={`/resource/${getDefaultView()}`} />,
   "/resource/board": () => (
     <DndProvider backend={HTML5Backend}>
@@ -18,8 +18,8 @@ export default {
     </DndProvider>
   ),
   "/resource/list": () => <ListView />,
-  "/resource/:id": ({ id }: DetailRoute) => <ResourceDetails id={id} />,
-  "/resource/:id/update": ({ id }: DetailRoute) => (
-    <ResourceDetailsUpdate id={id} />
-  ),
+  "/resource/:id": ({ id }) => <ResourceDetails id={id} />,
+  "/resource/:id/update": ({ id }) => <ResourceDetailsUpdate id={id} />,
 };
+
+export default ResourceRoutes;
diff --git a/src/Routers/routes/SampleRoutes.tsx b/src/Routers/routes/SampleRoutes.tsx
index 290a34fd4eb..cf296790a81 100644
--- a/src/Routers/routes/SampleRoutes.tsx
+++ b/src/Routers/routes/SampleRoutes.tsx
@@ -2,24 +2,22 @@ import { SampleDetails } from "../../Components/Patient/SampleDetails";
 import SampleReport from "../../Components/Patient/SamplePreview";
 import { SampleTest } from "../../Components/Patient/SampleTest";
 import SampleViewAdmin from "../../Components/Patient/SampleViewAdmin";
-import { DetailRoute, RouteParams } from "../types";
+import { AppRoutes } from "../AppRouter";
 
-export default {
+const SampleRoutes: AppRoutes = {
   "/sample": () => <SampleViewAdmin />,
-  "/sample/:id": ({ id }: DetailRoute) => <SampleDetails id={id} />,
+  "/sample/:id": ({ id }) => <SampleDetails id={id} />,
   "/patient/:patientId/test_sample/:sampleId/icmr_sample": ({
     patientId,
     sampleId,
-  }: RouteParams<"patientId" | "sampleId">) => (
-    <SampleReport id={patientId} sampleId={sampleId} />
-  ),
+  }) => <SampleReport id={patientId} sampleId={sampleId} />,
   "/facility/:facilityId/patient/:patientId/sample-test": ({
     facilityId,
     patientId,
-  }: RouteParams<"facilityId" | "patientId">) => (
-    <SampleTest facilityId={facilityId} patientId={patientId} />
+  }) => <SampleTest facilityId={facilityId} patientId={patientId} />,
+  "/facility/:facilityId/patient/:patientId/sample/:id": ({ id }) => (
+    <SampleDetails id={id} />
   ),
-  "/facility/:facilityId/patient/:patientId/sample/:id": ({
-    id,
-  }: DetailRoute) => <SampleDetails id={id} />,
 };
+
+export default SampleRoutes;
diff --git a/src/Routers/routes/ShiftingRoutes.tsx b/src/Routers/routes/ShiftingRoutes.tsx
index 9b20b4a1a0b..5118b246430 100644
--- a/src/Routers/routes/ShiftingRoutes.tsx
+++ b/src/Routers/routes/ShiftingRoutes.tsx
@@ -6,11 +6,12 @@ import { ShiftDetailsUpdate } from "../../Components/Shifting/ShiftDetailsUpdate
 import ListView from "../../Components/Shifting/ListView";
 import BoardView from "../../Components/Shifting/BoardView";
 import { Redirect } from "raviger";
+import { AppRoutes } from "../AppRouter";
 
 const getDefaultView = () =>
   localStorage.getItem("defaultShiftView") === "list" ? "list" : "board";
 
-export default {
+const ShiftingRoutes: AppRoutes = {
   "/shifting": () => <Redirect to={`/shifting/${getDefaultView()}`} />,
   "/shifting/board": () => (
     <DndProvider backend={HTML5Backend}>
@@ -18,10 +19,12 @@ export default {
     </DndProvider>
   ),
   "/shifting/list": () => <ListView />,
-  "/shifting/:id": ({ id }: any) => <ShiftDetails id={id} />,
-  "/shifting/:id/update": ({ id }: any) => <ShiftDetailsUpdate id={id} />,
+  "/shifting/:id": ({ id }) => <ShiftDetails id={id} />,
+  "/shifting/:id/update": ({ id }) => <ShiftDetailsUpdate id={id} />,
   "/facility/:facilityId/patient/:patientId/shift/new": ({
     facilityId,
     patientId,
-  }: any) => <ShiftCreate facilityId={facilityId} patientId={patientId} />,
+  }) => <ShiftCreate facilityId={facilityId} patientId={patientId} />,
 };
+
+export default ShiftingRoutes;
diff --git a/src/Routers/routes/UserRoutes.tsx b/src/Routers/routes/UserRoutes.tsx
index 56877ca4c78..24f355b201b 100644
--- a/src/Routers/routes/UserRoutes.tsx
+++ b/src/Routers/routes/UserRoutes.tsx
@@ -1,9 +1,12 @@
 import ManageUsers from "../../Components/Users/ManageUsers";
 import { UserAdd } from "../../Components/Users/UserAdd";
 import UserProfile from "../../Components/Users/UserProfile";
+import { AppRoutes } from "../AppRouter";
 
-export default {
+const UserRoutes: AppRoutes = {
   "/users": () => <ManageUsers />,
   "/users/add": () => <UserAdd />,
   "/user/profile": () => <UserProfile />,
 };
+
+export default UserRoutes;