fix TSC failure
All checks were successful
Build and push image for doorman-homeassistant / docker (push) Successful in 5s
Build and push Doorman UI / API / docker (push) Successful in 1m22s
Build and push image for doorman-homeassistant / deploy-gitainer (push) Successful in 2s

This commit is contained in:
Martin Dimitrov 2024-11-12 21:53:08 -08:00
parent 313322880e
commit 1c0f633553

View File

@ -1,14 +1,14 @@
import React from "react"; import React, { ReactElement } from "react";
import { ReactNode } from "react"; import { ReactNode } from "react";
import { useLocation, useSearchParams } from "react-router-dom"; import { useLocation, useSearchParams } from "react-router-dom";
export interface IQueryRouterProps { export interface IQueryRouterProps {
mapping: Record<string, ReactNode>; mapping: Record<string, ReactElement>;
}; };
export const QueryRouter = ({ mapping }: IQueryRouterProps) => { export const QueryRouter = ({ mapping }: IQueryRouterProps): ReactElement => {
const [params] = useSearchParams(); const [params] = useSearchParams();
let element = null; let element: ReactElement | null = null;
for (const key of params.keys()) { for (const key of params.keys()) {
if (mapping[key]) { if (mapping[key]) {
@ -16,6 +16,7 @@ export const QueryRouter = ({ mapping }: IQueryRouterProps) => {
break; break;
} }
} }
if (element === null) { if (element === null) {
throw new Error("missing mapping"); throw new Error("missing mapping");
} }