zod-form-data
Advanced tools
Comparing version 1.3.0 to 1.3.1
import { ZodString, ZodNumber, z, ZodArray, ZodTypeAny, ZodEffects, ZodObject } from 'zod'; | ||
type InputType<DefaultType extends ZodTypeAny> = { | ||
(): ZodEffects<DefaultType, DefaultType["_output"], unknown>; | ||
<ProvidedType extends ZodTypeAny>(schema: ProvidedType): ZodEffects<ProvidedType, ProvidedType["_output"], unknown>; | ||
(): ZodEffects<DefaultType>; | ||
<ProvidedType extends ZodTypeAny>(schema: ProvidedType): ZodEffects<ProvidedType>; | ||
}; | ||
@@ -55,6 +55,6 @@ /** | ||
*/ | ||
declare const repeatableOfType: <T extends z.ZodTypeAny>(schema: T) => z.ZodEffects<z.ZodArray<T, "many">, T["_output"], unknown>; | ||
declare const repeatableOfType: <T extends z.ZodTypeAny>(schema: T) => z.ZodEffects<z.ZodArray<T, "many">, T["_output"][], T["_input"][]>; | ||
type FormDataType = { | ||
<T extends z.ZodRawShape>(shape: T): ZodEffects<ZodObject<T>, ZodObject<T>["_output"], unknown>; | ||
<T extends z.ZodTypeAny>(schema: T): ZodEffects<T, T["_output"], unknown>; | ||
<T extends z.ZodRawShape>(shape: T): ZodEffects<ZodObject<T>>; | ||
<T extends z.ZodTypeAny>(schema: T): ZodEffects<T>; | ||
}; | ||
@@ -61,0 +61,0 @@ declare const json: <T extends z.ZodTypeAny>(schema: T) => z.ZodEffects<T, T["_output"], T["_input"]>; |
{ | ||
"name": "zod-form-data", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"main": "./dist/index.cjs.js", | ||
@@ -5,0 +5,0 @@ "module": "./dist/index.esm.js", |
@@ -14,8 +14,6 @@ import { setPath } from "set-get"; | ||
type InputType<DefaultType extends ZodTypeAny> = { | ||
(): ZodEffects<DefaultType, DefaultType["_output"], unknown>; | ||
<ProvidedType extends ZodTypeAny>(schema: ProvidedType): ZodEffects< | ||
ProvidedType, | ||
ProvidedType["_output"], | ||
unknown | ||
>; | ||
(): ZodEffects<DefaultType>; | ||
<ProvidedType extends ZodTypeAny>( | ||
schema: ProvidedType | ||
): ZodEffects<ProvidedType>; | ||
}; | ||
@@ -39,3 +37,3 @@ | ||
export const text: InputType<ZodString> = (schema = z.string()) => | ||
z.preprocess(preprocessIfValid(stripEmpty), schema); | ||
z.preprocess(preprocessIfValid(stripEmpty), schema) as any; | ||
@@ -60,3 +58,3 @@ /** | ||
schema | ||
); | ||
) as any; | ||
@@ -94,3 +92,3 @@ type CheckboxOpts = { | ||
return val instanceof File && val.size === 0 ? undefined : val; | ||
}, schema); | ||
}, schema) as any; | ||
@@ -110,3 +108,3 @@ /** | ||
return [val]; | ||
}, schema); | ||
}, schema) as any; | ||
}; | ||
@@ -120,4 +118,3 @@ | ||
schema: T | ||
): ZodEffects<ZodArray<T>, T["_output"], unknown> => | ||
repeatable(z.array(schema)); | ||
): ZodEffects<ZodArray<T>> => repeatable(z.array(schema)); | ||
@@ -127,8 +124,4 @@ const entries = z.array(z.tuple([z.string(), z.any()])); | ||
type FormDataType = { | ||
<T extends z.ZodRawShape>(shape: T): ZodEffects< | ||
ZodObject<T>, | ||
ZodObject<T>["_output"], | ||
unknown | ||
>; | ||
<T extends z.ZodTypeAny>(schema: T): ZodEffects<T, T["_output"], unknown>; | ||
<T extends z.ZodRawShape>(shape: T): ZodEffects<ZodObject<T>>; | ||
<T extends z.ZodTypeAny>(schema: T): ZodEffects<T>; | ||
}; | ||
@@ -189,5 +182,3 @@ | ||
*/ | ||
export const formData: FormDataType = <T extends z.ZodRawShape | z.ZodTypeAny>( | ||
shapeOrSchema: T | ||
) => | ||
export const formData: FormDataType = (shapeOrSchema: any): any => | ||
z.preprocess( | ||
@@ -194,0 +185,0 @@ processFormData, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
307341
1705