Skip to content

Commit 42a5853

Browse files
committed
rename DefaultProps to ComponentProps
and favor `type * as Route` imports
1 parent 92d4a70 commit 42a5853

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

packages/react-router-dev/typescript/typegen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ function getModule(routes: RouteManifest, route: RouteManifestEntry): string {
124124
export type ClientActionArgs = T.CreateClientActionArgs<Params, Route>
125125
126126
export type HydrateFallbackProps = T.CreateHydrateFallbackProps<Params>
127-
export type DefaultProps = T.CreateDefaultProps<Params, LoaderData, ActionData>
127+
export type ComponentProps = T.CreateComponentProps<Params, LoaderData, ActionData>
128128
export type ErrorBoundaryProps = T.CreateErrorBoundaryProps<Params, LoaderData, ActionData>
129129
`;
130130
}

packages/react-router/lib/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export type CreateHydrateFallbackProps<Params> = {
132132
params: Params;
133133
};
134134

135-
export type CreateDefaultProps<Params, LoaderData, ActionData> = {
135+
export type CreateComponentProps<Params, LoaderData, ActionData> = {
136136
params: Params;
137137
loaderData: LoaderData;
138138
actionData?: ActionData;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import { DefaultProps, LoaderArgs } from "./+types._index";
1+
import type * as Route from "./+types._index";
22

3-
export function loader({ params }: LoaderArgs) {
3+
export function loader({ params }: Route.LoaderArgs) {
44
return { planet: "world", date: new Date(), fn: () => 1 };
55
}
66

7-
export default function Index({ loaderData }: DefaultProps) {
7+
export default function Index({ loaderData }: Route.ComponentProps) {
88
return <h1>Hello, {loaderData.planet}!</h1>;
99
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type { DefaultProps, LoaderArgs } from "./+types.product";
1+
import type * as Route from "./+types.product";
22

3-
export function loader({ params }: LoaderArgs) {
3+
export function loader({ params }: Route.LoaderArgs) {
44
return { name: `Super cool product #${params.id}` };
55
}
66

7-
export default function Component({ loaderData }: DefaultProps) {
7+
export default function Component({ loaderData }: Route.ComponentProps) {
88
return <h1>{loaderData.name}</h1>;
99
}

0 commit comments

Comments
 (0)