@@ -42,7 +42,10 @@ export interface PartialCheckActionAsync<
42
42
/**
43
43
* The validation function.
44
44
*/
45
- readonly requirement : ( input : TSelection ) => MaybePromise < boolean > ;
45
+ readonly requirement : (
46
+ input : TSelection ,
47
+ signal ?: AbortSignal
48
+ ) => MaybePromise < boolean > ;
46
49
/**
47
50
* The error message.
48
51
*/
@@ -63,7 +66,10 @@ export function partialCheckAsync<
63
66
const TSelection extends DeepPickN < TInput , TPaths > ,
64
67
> (
65
68
paths : ValidPaths < TInput , TPaths > ,
66
- requirement : ( input : TSelection ) => MaybePromise < boolean >
69
+ requirement : (
70
+ input : TSelection ,
71
+ signal ?: AbortSignal
72
+ ) => MaybePromise < boolean >
67
73
) : PartialCheckActionAsync < TInput , TPaths , TSelection , undefined > ;
68
74
69
75
/**
@@ -84,14 +90,20 @@ export function partialCheckAsync<
84
90
| undefined ,
85
91
> (
86
92
paths : ValidPaths < TInput , TPaths > ,
87
- requirement : ( input : TSelection ) => MaybePromise < boolean > ,
93
+ requirement : (
94
+ input : TSelection ,
95
+ signal ?: AbortSignal
96
+ ) => MaybePromise < boolean > ,
88
97
message : TMessage
89
98
) : PartialCheckActionAsync < TInput , TPaths , TSelection , TMessage > ;
90
99
91
100
// @__NO_SIDE_EFFECTS__
92
101
export function partialCheckAsync (
93
102
paths : Paths ,
94
- requirement : ( input : PartialInput ) => MaybePromise < boolean > ,
103
+ requirement : (
104
+ input : PartialInput ,
105
+ signal ?: AbortSignal
106
+ ) => MaybePromise < boolean > ,
95
107
message ?: ErrorMessage < PartialCheckIssue < PartialInput > >
96
108
) : PartialCheckActionAsync <
97
109
PartialInput ,
@@ -112,7 +124,7 @@ export function partialCheckAsync(
112
124
if (
113
125
( dataset . typed || _isPartiallyTyped ( dataset , paths ) ) &&
114
126
// @ts -expect-error
115
- ! ( await this . requirement ( dataset . value ) )
127
+ ! ( await this . requirement ( dataset . value , config . signal ) )
116
128
) {
117
129
_addIssue ( this , 'input' , dataset , config ) ;
118
130
}
0 commit comments