Skip to content

Commit

Permalink
fix: fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
Ernxst committed Dec 20, 2023
1 parent f46cac6 commit 224d5f1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/core/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import type {
QuerySchema,
ValibotValidator,
Validator,
ValueValidator,
ZodValidator,
inferShape,
} from "./types.ts";

function parseObject(schemas: Record<string, Validator>, input: object) {
function parseObject(schemas: Record<string, ValueValidator>, input: object) {
const clone: any = {};
const keys = new Set([...Object.keys(input), ...Object.keys(schemas)]);

Expand All @@ -24,7 +25,11 @@ function parseObject(schemas: Record<string, Validator>, input: object) {
return clone;
}

function parseValue(key: string, schema: Validator, value?: string) {
function parseValue(
key: string,
schema: ValueValidator | Validator,
value?: string
) {
if (typeof schema === "function") return schema(value);
if (isZodSchema(schema)) return schema.parse(value);
if (isValibotSchema(schema)) return parse(schema, value);
Expand Down

0 comments on commit 224d5f1

Please sign in to comment.