1
1
import {
2
2
CacheForOption ,
3
+ FormDataConvertible ,
3
4
LinkPrefetchOption ,
4
5
mergeDataIntoQueryString ,
5
6
Method ,
6
- PageProps ,
7
7
PendingVisit ,
8
+ PreserveStateOption ,
8
9
Progress ,
9
10
router ,
10
11
shouldIntercept ,
@@ -13,23 +14,24 @@ import { defineComponent, DefineComponent, h, onMounted, onUnmounted, PropType,
13
14
14
15
export interface InertiaLinkProps {
15
16
as ?: string
16
- data ?: object
17
+ data ?: Record < string , FormDataConvertible >
17
18
href : string
18
19
method ?: Method
19
- headers ?: object
20
+ headers ?: Record < string , string >
20
21
onClick ?: ( event : MouseEvent ) => void
21
- preserveScroll ?: boolean | ( ( props : PageProps ) => boolean )
22
- preserveState ?: boolean | ( ( props : PageProps ) => boolean ) | null
22
+ preserveScroll ?: PreserveStateOption
23
+ preserveState ?: PreserveStateOption
23
24
replace ?: boolean
24
25
only ?: string [ ]
25
26
except ?: string [ ]
26
27
onCancelToken ?: ( cancelToken : import ( 'axios' ) . CancelTokenSource ) => void
27
28
onBefore ?: ( ) => void
28
- onStart ?: ( ) => void
29
+ onStart ?: ( visit : PendingVisit ) => void
29
30
onProgress ?: ( progress : Progress ) => void
30
- onFinish ?: ( ) => void
31
+ onFinish ?: ( visit : PendingVisit ) => void
31
32
onCancel ?: ( ) => void
32
33
onSuccess ?: ( ) => void
34
+ onError ?: ( ) => void
33
35
queryStringArrayFormat ?: 'brackets' | 'indices'
34
36
async ?: boolean
35
37
prefetch ?: boolean | LinkPrefetchOption | LinkPrefetchOption [ ]
@@ -98,12 +100,9 @@ const Link: InertiaLink = defineComponent({
98
100
type : [ Number , String , Array ] as PropType < CacheForOption | CacheForOption [ ] > ,
99
101
default : 0 ,
100
102
} ,
101
- // @ts -ignore
102
103
onStart : {
103
- // @ts -ignore
104
104
type : Function as PropType < ( visit : PendingVisit ) => void > ,
105
- // @ts -ignore
106
- default : ( visit ) => { } ,
105
+ default : ( _visit : PendingVisit ) => { } ,
107
106
} ,
108
107
onProgress : {
109
108
type : Function as PropType < ( progress : Progress ) => void > ,
0 commit comments