From 919fbc653190b050c4f3d6ad577c27f5555adbdb Mon Sep 17 00:00:00 2001 From: Leo Singer Date: Thu, 13 Apr 2023 12:09:12 -0400 Subject: [PATCH] Fix types for RouteData Since remix-run/remix#5679 and remix v1.15.0, RouteData is no longer exported by Remix. The type is now provided by `@remix-run/router`. --- package-lock.json | 2 ++ package.json | 2 ++ src/react/handle-conventions.ts | 4 +++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 55ca1759..604e5064 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "@jest/types": "^27.2.5", "@remix-run/node": "^1.10.0", "@remix-run/react": "^1.10.0", + "@remix-run/router": "^1.0.0", "@remix-run/server-runtime": "^1.10.0", "@testing-library/jest-dom": "^5.15.0", "@testing-library/react": "^12.1.2", @@ -60,6 +61,7 @@ }, "peerDependencies": { "@remix-run/react": "^1.10.0", + "@remix-run/router": "^1.0.0", "@remix-run/server-runtime": "^1.10.0", "react": "^16.8.0 || ^17.0.0 || ^18.0.0", "zod": "^3.19.1" diff --git a/package.json b/package.json index ad5a7304..aa319e5c 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ ], "peerDependencies": { "@remix-run/react": "^1.10.0", + "@remix-run/router": "^1.0.0", "@remix-run/server-runtime": "^1.10.0", "react": "^16.8.0 || ^17.0.0 || ^18.0.0", "zod": "^3.19.1" @@ -54,6 +55,7 @@ "@jest/types": "^27.2.5", "@remix-run/node": "^1.10.0", "@remix-run/react": "^1.10.0", + "@remix-run/router": "^1.0.0", "@remix-run/server-runtime": "^1.10.0", "@testing-library/jest-dom": "^5.15.0", "@testing-library/react": "^12.1.2", diff --git a/src/react/handle-conventions.ts b/src/react/handle-conventions.ts index ccaa31e9..27f35be4 100644 --- a/src/react/handle-conventions.ts +++ b/src/react/handle-conventions.ts @@ -1,8 +1,10 @@ -import { RouteData } from "@remix-run/react/dist/routeData"; +import type { RouterState } from "@remix-run/router"; import type { AppData } from "@remix-run/server-runtime"; import type { Location, Params } from "react-router-dom"; import { Matches } from "./matches-type"; +type RouteData = RouterState["loaderData"]; + export type HandleConventionArguments = { id: string; data: Data;