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

Addendum to ErrorResponse type export #10812

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .changeset/error-response-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"@remix-run/router": patch
---

Move the `@private` class export `ErrorResponse` to an `UNSAFE_ErrorResponse` export since it is an implementation detail and there should be no construction of `ErrorResponse` instances in userland. This frees us up to export a `type ErrorResponse` which correlates to an instance of the class via `InstanceType`. Userland code should only ever be using `ErrorResponse` as a type and should be type-narrowing via `isRouteErrorResponse`.
Move the `@private` class export `ErrorResponse` to an `UNSAFE_ErrorResponseImpl` export since it is an implementation detail and there should be no construction of `ErrorResponse` instances in userland. This frees us up to export a `type ErrorResponse` which correlates to an instance of the class via `InstanceType`. Userland code should only ever be using `ErrorResponse` as a type and should be type-narrowing via `isRouteErrorResponse`.
2 changes: 1 addition & 1 deletion packages/react-router-dom/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ import {
createHashHistory,
joinPaths,
stripBasename,
UNSAFE_ErrorResponse as ErrorResponseImpl,
UNSAFE_ErrorResponseImpl as ErrorResponseImpl,
UNSAFE_invariant as invariant,
UNSAFE_warning as warning,
} from "@remix-run/router";
Expand Down
2 changes: 1 addition & 1 deletion packages/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export * from "./router";
export type { RouteManifest as UNSAFE_RouteManifest } from "./utils";
export {
DeferredData as UNSAFE_DeferredData,
ErrorResponseImpl as UNSAFE_ErrorResponse,
ErrorResponseImpl as UNSAFE_ErrorResponseImpl,
convertRoutesToDataRoutes as UNSAFE_convertRoutesToDataRoutes,
getPathContributingMatches as UNSAFE_getPathContributingMatches,
} from "./utils";
Expand Down