@@ -147,7 +147,7 @@ export interface Router {
147
147
key : string ,
148
148
routeId : string ,
149
149
href : string | null ,
150
- opts ?: RouterNavigateOptions
150
+ opts ?: RouterFetchOptions
151
151
) : void ;
152
152
153
153
/**
@@ -418,14 +418,26 @@ export interface GetScrollPositionFunction {
418
418
419
419
export type RelativeRoutingType = "route" | "path" ;
420
420
421
- type BaseNavigateOptions = {
422
- replace ?: boolean ;
423
- state ?: any ;
421
+ type BaseNavigateOrFetchOptions = {
422
+ fromRouteId ?: string ;
424
423
preventScrollReset ?: boolean ;
425
424
relative ?: RelativeRoutingType ;
426
- fromRouteId ?: string ;
427
425
} ;
428
426
427
+ type BaseNavigateOptions = BaseNavigateOrFetchOptions & {
428
+ replace ?: boolean ;
429
+ state ?: any ;
430
+ } ;
431
+
432
+ type BaseSubmissionOptions = {
433
+ formMethod ?: HTMLFormMethod ;
434
+ formEncType ?: FormEncType ;
435
+ action ?: ActionFunction ;
436
+ } & (
437
+ | { formData : FormData ; payload ?: undefined }
438
+ | { formData ?: undefined ; payload : any }
439
+ ) ;
440
+
429
441
/**
430
442
* Options for a navigate() call for a Link navigation
431
443
*/
@@ -434,13 +446,7 @@ type LinkNavigateOptions = BaseNavigateOptions;
434
446
/**
435
447
* Options for a navigate() call for a Form navigation
436
448
*/
437
- type SubmissionNavigateOptions = BaseNavigateOptions & {
438
- formMethod ?: HTMLFormMethod ;
439
- formEncType ?: FormEncType ;
440
- } & (
441
- | { formData : FormData ; payload ?: undefined }
442
- | { formData ?: undefined ; payload : any }
443
- ) ;
449
+ type SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions ;
444
450
445
451
/**
446
452
* Options to pass to navigate() for either a Link or Form navigation
@@ -449,12 +455,20 @@ export type RouterNavigateOptions =
449
455
| LinkNavigateOptions
450
456
| SubmissionNavigateOptions ;
451
457
458
+ /**
459
+ * Options for a navigate() call for a Link navigation
460
+ */
461
+ type LoadFetchOptions = BaseNavigateOrFetchOptions ;
462
+
463
+ /**
464
+ * Options for a navigate() call for a Form navigation
465
+ */
466
+ type SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions ;
467
+
452
468
/**
453
469
* Options to pass to fetch()
454
470
*/
455
- export type RouterFetchOptions =
456
- | Omit < LinkNavigateOptions , "replace" >
457
- | Omit < SubmissionNavigateOptions , "replace" > ;
471
+ export type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions ;
458
472
459
473
/**
460
474
* Potential states for state.navigation
0 commit comments