Skip to content

API reference > @kontsedal/olas-zod > zodValidatorAsync

zodValidatorAsync() function ​

Async variant for schemas with .refine(async ...) or .transform(async ...). Returns a Promise<string | null>.

Zod has no native cancellation surface, so we race safeParseAsync against the supplied signal and throw an AbortError if the signal fires. The validator runner filters AbortError via isAbortError, so a superseded pass never writes its result back.

Signature:

typescript
export declare function zodValidatorAsync<T>(schema: z.ZodType<T>): Validator<T>;

Parameters ​

Parameter

Type

Description

schema

z.ZodType<T>

Returns:

Validator<T>

Released under the MIT License.