Skip to content

Commit 871e2d6

Browse files
committed
[zod] Make async factory option optional
1 parent 9fc04f5 commit 871e2d6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { Validator, type ValidatorOptions } from "./validator.js";
22

3-
export function createValidator<Async extends boolean>(options: ValidatorOptions<Async>) {
4-
return new Validator(options);
3+
export type ValidatorFactoryOptions<Async extends boolean> = Omit<ValidatorOptions<Async>, "async"> & {
4+
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+
});
512
}

0 commit comments

Comments
 (0)