File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -284,18 +284,19 @@ export class Router {
284
284
return currentPage . resolve ( component )
285
285
}
286
286
287
- public replace ( params : ClientSideVisitOptions ) : void {
287
+ public replace < TProps = Page [ 'props' ] > ( params : ClientSideVisitOptions < TProps > ) : void {
288
288
this . clientVisit ( params , { replace : true } )
289
289
}
290
290
291
- public push ( params : ClientSideVisitOptions ) : void {
291
+ public push < TProps = Page [ 'props' ] > ( params : ClientSideVisitOptions < TProps > ) : void {
292
292
this . clientVisit ( params )
293
293
}
294
294
295
- protected clientVisit ( params : ClientSideVisitOptions , { replace = false } : { replace ?: boolean } = { } ) : void {
295
+ protected clientVisit < TProps = Page [ 'props' ] > ( params : ClientSideVisitOptions < TProps > , { replace = false } : { replace ?: boolean } = { } ) : void {
296
296
const current = currentPage . get ( )
297
297
298
- const props = typeof params . props === 'function' ? params . props ( current . props ) : ( params . props ?? current . props )
298
+ const props =
299
+ typeof params . props === 'function' ? params . props ( current . props as TProps ) : ( params . props ?? current . props )
299
300
300
301
const { onError, onFinish, onSuccess, ...pageParams } = params
301
302
Original file line number Diff line number Diff line change @@ -127,17 +127,17 @@ export type ScrollRegion = {
127
127
left : number
128
128
}
129
129
130
- export interface ClientSideVisitOptions {
130
+ export interface ClientSideVisitOptions < TProps = Page [ 'props' ] > {
131
131
component ?: Page [ 'component' ]
132
132
url ?: Page [ 'url' ]
133
- props ?: ( ( props : Page [ 'props' ] ) => PageProps ) | PageProps
133
+ props ?: ( ( props : TProps ) => PageProps ) | PageProps
134
134
clearHistory ?: Page [ 'clearHistory' ]
135
135
encryptHistory ?: Page [ 'encryptHistory' ]
136
136
preserveScroll ?: VisitOptions [ 'preserveScroll' ]
137
137
preserveState ?: VisitOptions [ 'preserveState' ]
138
138
errorBag ?: string | null
139
139
onError ?: ( errors : Errors ) => void
140
- onFinish ?: ( visit : ClientSideVisitOptions ) => void
140
+ onFinish ?: ( visit : ClientSideVisitOptions < TProps > ) => void
141
141
onSuccess ?: ( page : Page ) => void
142
142
}
143
143
You can’t perform that action at this time.
0 commit comments