From 05da90db84104fd67541f644407d5d41974b05bd Mon Sep 17 00:00:00 2001 From: Alec Jacobs Date: Fri, 3 Jun 2022 10:56:29 -0700 Subject: [PATCH] feat(plugins/pagerduty): enforce PagerDutyEntity type from usePagerdutyEntity Signed-off-by: Alec Jacobs --- plugins/pagerduty/src/components/PagerDutyCard/index.tsx | 2 +- plugins/pagerduty/src/hooks/index.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/pagerduty/src/components/PagerDutyCard/index.tsx b/plugins/pagerduty/src/components/PagerDutyCard/index.tsx index 2edc8cbd44..e089cf817c 100644 --- a/plugins/pagerduty/src/components/PagerDutyCard/index.tsx +++ b/plugins/pagerduty/src/components/PagerDutyCard/index.tsx @@ -86,7 +86,7 @@ export const PagerDutyCard = () => { foundService = services[0]; if (!foundService) throw new NotFoundError(); } else { - foundService = await api.getServiceByServiceId(serviceId); + foundService = await api.getServiceByServiceId(serviceId!); } return { diff --git a/plugins/pagerduty/src/hooks/index.ts b/plugins/pagerduty/src/hooks/index.ts index a5fa462e02..503597a69e 100644 --- a/plugins/pagerduty/src/hooks/index.ts +++ b/plugins/pagerduty/src/hooks/index.ts @@ -15,13 +15,14 @@ */ import { useEntity } from '@backstage/plugin-catalog-react'; +import { PagerDutyEntity } from '../types'; import { PAGERDUTY_INTEGRATION_KEY, PAGERDUTY_SERVICE_ID, } from '../components/constants'; -export function usePagerdutyEntity() { +export function usePagerdutyEntity(): PagerDutyEntity { const { entity } = useEntity(); const { [PAGERDUTY_INTEGRATION_KEY]: integrationKey,