Skip to content

Commit e55d7ad

Browse files
authored
chore: export ActionFunctionArgs/LoaderFunctionArgs types (#8947)
1 parent e2b982b commit e55d7ad

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

packages/router/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ export * from "./router";
4040

4141
export type {
4242
ActionFunction,
43+
ActionFunctionArgs,
4344
DataRouteObject,
4445
FormEncType,
4546
FormMethod,
4647
JsonFunction,
4748
LoaderFunction,
49+
LoaderFunctionArgs,
4850
ParamParseKey,
4951
Params,
5052
PathMatch,

packages/router/utils.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,38 @@ export interface Submission {
1818
}
1919

2020
/**
21-
* Arguments passed to route loader/action functions
21+
* @private
22+
* Arguments passed to route loader/action functions. Same for now but we keep
23+
* this as a private implementation detail in case they diverge in the future.
2224
*/
23-
export interface DataFunctionArgs {
25+
interface DataFunctionArgs {
2426
request: Request;
2527
params: Params;
2628
signal: AbortSignal;
2729
}
2830

31+
/**
32+
* Arguments passed to loader functions
33+
*/
34+
export interface LoaderFunctionArgs extends DataFunctionArgs {}
35+
36+
/**
37+
* Arguments passed to action functions
38+
*/
39+
export interface ActionFunctionArgs extends DataFunctionArgs {}
40+
2941
/**
3042
* Route loader function signature
3143
*/
3244
export interface LoaderFunction {
33-
(args: DataFunctionArgs): Promise<Response> | Response | Promise<any> | any;
45+
(args: LoaderFunctionArgs): Promise<Response> | Response | Promise<any> | any;
3446
}
3547

3648
/**
3749
* Route action function signature
3850
*/
3951
export interface ActionFunction {
40-
(args: DataFunctionArgs): Promise<Response> | Response | Promise<any> | any;
52+
(args: ActionFunctionArgs): Promise<Response> | Response | Promise<any> | any;
4153
}
4254

4355
/**

0 commit comments

Comments
 (0)