zod-error
Version:
Utilities to format and customize Zod error messages
15 lines (14 loc) • 571 B
TypeScript
import { ErrorMessageOptions, SafeParseReturnType } from '../../types';
import { z } from 'zod';
/**
* Asynchronously safe parses a Zod schema.
* Only required if schema contains async
* .refine() or .transform() functions.
* @export
* @template T
* @param {T} schema
* @param {unknown} data
* @param {ErrorMessageOptions} [options]
* @return {*} {Promise<SafeParseReturnType<T['_output']>>}
*/
export declare function safeParseAsync<T extends z.ZodTypeAny>(schema: T, data: unknown, options?: ErrorMessageOptions): Promise<SafeParseReturnType<T['_output']>>;