feat(typings): Enhance typing support with withAppTypes and custom services throughout OHIF (#4090)

This commit is contained in:
Ibrahim authored and GitHub committed 2024-05-08 12:12:49 -04:00
1 parent b2cd0172d6
commit 374065bc3b
153 files changed
+842 -657

No files matched your search

+4 -5
View File
@@ -1,7 +1,7 @@
import React, { useEffect, useState, useRef } from 'react';
import { useParams, useLocation, useNavigate } from 'react-router';
import PropTypes from 'prop-types';
import { ServicesManager, utils } from '@ohif/core';
import { utils } from '@ohif/core';
import { DragAndDropProvider, ImageViewerProvider } from '@ohif/ui';
import { useSearchParams } from '@hooks';
import { useAppConfig } from '@state';
@@ -21,7 +21,7 @@ export default function ModeRoute({
servicesManager,
commandsManager,
hotkeysManager,
}) {
}: withAppTypes) {
const [appConfig] = useAppConfig();
// Parse route params/querystring
@@ -60,9 +60,8 @@ export default function ModeRoute({
locationRef.current = location;
}
const { displaySetService, panelService, hangingProtocolService, userAuthenticationService } = (
servicesManager as ServicesManager
).services;
const { displaySetService, panelService, hangingProtocolService, userAuthenticationService } =
servicesManager.services;
const { extensions, sopClassHandlers, hotkeys: hotkeyObj, hangingProtocol } = mode;
@@ -16,7 +16,7 @@ const { sortingCriteria, getSplitParam } = utils;
* @returns array of subscriptions to cancel
*/
export async function defaultRouteInit(
{ servicesManager, studyInstanceUIDs, dataSource, filters, appConfig },
{ servicesManager, studyInstanceUIDs, dataSource, filters, appConfig }: withAppTypes,
hangingProtocolId
) {
const { displaySetService, hangingProtocolService, uiNotificationService, customizationService } =