From e705c58ebb3caa580e80430bccbf6ea727957c6a Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sat, 22 Oct 2022 12:40:36 +0300 Subject: [PATCH] More type safety to SendouRouteHandle.navItemName --- app/utils/remix.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/utils/remix.ts b/app/utils/remix.ts index 3bf68b402..f54507633 100644 --- a/app/utils/remix.ts +++ b/app/utils/remix.ts @@ -1,6 +1,7 @@ import { z } from "zod"; import { type TFunction, type Namespace } from "react-i18next"; import { type RouteMatch } from "@remix-run/react"; +import type navItems from "~/components/layout/nav-items.json"; export function notFoundIfFalsy(value: T | null | undefined): T { if (!value) throw new Response(null, { status: 404 }); @@ -113,5 +114,5 @@ export type SendouRouteHandle = { }) => string | undefined; /** The name of a navItem that is active on this route. See nav-items.json */ - navItemName?: string; + navItemName?: typeof navItems[number]["name"]; };