File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
packages/internal/src/core Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,12 @@ type ExtractStepMethods<Instance extends Valchecker> = ResolveStepMethodDefs<Ins
114114 }
115115 : never
116116
117- interface ValcheckerMehods < Instance extends Valchecker > {
117+ interface OnlyInitialValcheckerMethods {
118+ isSuccess : ( result : ExecutionResult ) => result is ExecutionSuccessResult < any >
119+ isFailure : ( result : ExecutionResult ) => result is ExecutionFailureResult < any >
120+ }
121+
122+ interface OnlyNotInitialValcheckerMethods < Instance extends Valchecker > {
118123 execute : ( value : InferInput < Instance > ) => [
119124 ExecutionResult < InferOutput < Instance > , InferIssue < Instance > > ,
120125 InferAsync < Instance > ,
@@ -125,13 +130,20 @@ interface ValcheckerMehods<Instance extends Valchecker> {
125130 ? Promise < Result >
126131 : MaybePromise < Result >
127132 : never
128- isSuccess : ( result : ExecutionResult ) => result is ExecutionSuccessResult < any >
129- isFailure : ( result : ExecutionResult ) => result is ExecutionFailureResult < any >
130133}
131134
132135export type Use < Instance extends Valchecker > = Instance
133136 & ExtractStepMethods < Instance >
134- & ValcheckerMehods < Instance >
137+ & (
138+ InferExecutionContext < Instance > [ 'initial' ] extends false
139+ ? OnlyNotInitialValcheckerMethods < Instance >
140+ : unknown
141+ )
142+ & (
143+ InferExecutionContext < Instance > [ 'initial' ] extends true
144+ ? OnlyInitialValcheckerMethods
145+ : unknown
146+ )
135147
136148export type Next <
137149 Patch extends TExecutionContextPatch | undefined ,
You can’t perform that action at this time.
0 commit comments