We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
async
1 parent 9fc04f5 commit 871e2d6Copy full SHA for 871e2d6
packages/zod-validator/src/factory.ts
@@ -1,5 +1,12 @@
1
import { Validator, type ValidatorOptions } from "./validator.js";
2
3
-export function createValidator<Async extends boolean>(options: ValidatorOptions<Async>) {
4
- return new Validator(options);
+export type ValidatorFactoryOptions<Async extends boolean> = Omit<ValidatorOptions<Async>, "async"> & {
+ async?: Async
5
+}
6
+
7
+export function createValidator<Async extends boolean = false>(options: ValidatorFactoryOptions<Async>) {
8
+ return new Validator({
9
+ ...options,
10
+ async: options.async ?? false
11
+ });
12
}
0 commit comments