Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: align types with React Router #7319

Merged
merged 10 commits into from
Sep 6, 2023
Prev Previous commit
Next Next commit
Update exports
  • Loading branch information
brophdawg11 committed Sep 5, 2023
commit 5532a3db7c1d71adb3dd9ccc44cda865fb6d1eb1
3 changes: 1 addition & 2 deletions .changeset/align-rr-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,5 @@ Remove/align Remix types with those used in React Router
* `MetaMatch.handle`
* `useMatches()[i].handle` type changed from `{ [k: string]: any }` to `unknown`
* `AppLoadContext` type changed from `{ [k: string]: unknown }` to `unknown`
* Make `LoaderFunctionArgs`/`ActionFunctionArgs` generic to accept a `context` type
* Rename `LoaderArgs`/`ActionArgs` to `LoaderFunctionArgs`/`ActionFunctionArgs`
* Rename the `useMatches()` return type from `RouteMatch` to `UIMatch`
* Rename `LoaderArgs`/`ActionArgs` to `LoaderFunctionArgs`/`ActionFunctionArgs` and add a generic to accept a `context` type
12 changes: 5 additions & 7 deletions packages/remix-server-runtime/reexport.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
export type {
ActionFunction,
ActionFunctionArgs,
ErrorResponse,
LoaderFunction,
LoaderFunctionArgs,
} from "@remix-run/router";
export type { ErrorResponse } from "@remix-run/router";

export type {
HandleDataRequestFunction,
Expand Down Expand Up @@ -43,10 +37,14 @@ export type {
export type { TypedDeferredData, TypedResponse } from "./responses";

export type {
ActionFunction,
ActionFunctionArgs,
DataFunctionArgs,
HeadersArgs,
HeadersFunction,
LinksFunction,
LoaderFunction,
LoaderFunctionArgs,
RouteHandle,
ServerRuntimeMetaArgs,
ServerRuntimeMetaDescriptor,
Expand Down
12 changes: 6 additions & 6 deletions packages/remix-server-runtime/routes.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type {
AgnosticDataRouteObject,
ActionFunctionArgs,
LoaderFunctionArgs,
} from "@remix-run/router";
import type { AgnosticDataRouteObject } from "@remix-run/router";

import { callRouteActionRR, callRouteLoaderRR } from "./data";
import type { FutureConfig } from "./entry";
import type { ServerRouteModule } from "./routeModules";
import type {
ServerRouteModule,
ActionFunctionArgs,
LoaderFunctionArgs,
} from "./routeModules";

export interface RouteManifest<Route> {
[routeId: string]: Route;
Expand Down
4 changes: 2 additions & 2 deletions packages/remix-testing/create-remix-stub.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import * as React from "react";
import {
UNSAFE_convertRoutesToDataRoutes,
type ActionFunctionArgs,
type HydrationState,
type InitialEntry,
type LoaderFunctionArgs,
type Router,
} from "@remix-run/router";
import { UNSAFE_RemixContext as RemixContext } from "@remix-run/react";
Expand All @@ -24,9 +22,11 @@ import type {
import { createMemoryRouter, Outlet, RouterProvider } from "react-router-dom";
import type {
ActionFunction,
ActionFunctionArgs,
AppLoadContext,
LinksFunction,
LoaderFunction,
LoaderFunctionArgs,
} from "@remix-run/server-runtime";

interface StubIndexRouteObject
Expand Down
Loading