@@ -225,8 +225,16 @@ export abstract class ZodType<
225225 /** The .check method has been removed in Zod 3. For details see https://github.com/colinhacks/zod/tree/v3. */
226226 check ! : never ;
227227
228- refine < Func extends ( arg : Output ) => any > (
229- check : Func ,
228+ refine < RefinedOutput extends Output > (
229+ check : ( arg : Output ) => arg is RefinedOutput ,
230+ message ?: string | CustomErrorParams | ( ( arg : Output ) => CustomErrorParams )
231+ ) : ZodEffects < this, RefinedOutput , RefinedOutput > ;
232+ refine (
233+ check : ( arg : Output ) => unknown | Promise < unknown > ,
234+ message ?: string | CustomErrorParams | ( ( arg : Output ) => CustomErrorParams )
235+ ) : ZodEffects < this, Output , Input > ;
236+ refine (
237+ check : ( arg : Output ) => unknown ,
230238 message ?: string | CustomErrorParams | ( ( arg : Output ) => CustomErrorParams )
231239 ) : ZodEffects < this, Output , Input > {
232240 const getIssueProperties : any = ( val : Output ) => {
@@ -264,8 +272,16 @@ export abstract class ZodType<
264272 } ) ;
265273 }
266274
275+ refinement < RefinedOutput extends Output > (
276+ check : ( arg : Output ) => arg is RefinedOutput ,
277+ refinementData : IssueData | ( ( arg : Output , ctx : RefinementCtx ) => IssueData )
278+ ) : ZodEffects < this, RefinedOutput , RefinedOutput > ;
267279 refinement (
268- check : ( arg : Output ) => any ,
280+ check : ( arg : Output ) => boolean ,
281+ refinementData : IssueData | ( ( arg : Output , ctx : RefinementCtx ) => IssueData )
282+ ) : ZodEffects < this, Output , Input > ;
283+ refinement (
284+ check : ( arg : Output ) => unknown ,
269285 refinementData : IssueData | ( ( arg : Output , ctx : RefinementCtx ) => IssueData )
270286 ) : ZodEffects < this, Output , Input > {
271287 return this . _refinement ( ( val , ctx ) => {
@@ -289,7 +305,7 @@ export abstract class ZodType<
289305 schema : this ,
290306 typeName : ZodFirstPartyTypeKind . ZodEffects ,
291307 effect : { type : "refinement" , refinement } ,
292- } ) as any ;
308+ } ) ;
293309 }
294310 superRefine = this . _refinement ;
295311
0 commit comments