balda 0.0.43 → 0.0.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.cts +6 -2
- package/lib/index.d.ts +6 -2
- package/package.json +1 -1
package/lib/index.d.cts
CHANGED
|
@@ -24,8 +24,12 @@ import { Transporter } from 'nodemailer';
|
|
|
24
24
|
type AjvInstance = InstanceType<typeof Ajv>;
|
|
25
25
|
type AjvCompileParams = Parameters<AjvInstance["compile"]>;
|
|
26
26
|
|
|
27
|
-
type
|
|
28
|
-
type
|
|
27
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
28
|
+
type SafeTSchema = IsAny<TSchema> extends true ? never : TSchema;
|
|
29
|
+
type SafeJSONSchema = IsAny<JSONSchema$1> extends true ? never : JSONSchema$1;
|
|
30
|
+
type SafeZodType = IsAny<ZodType> extends true ? never : ZodType;
|
|
31
|
+
type RequestSchema = SafeZodType | SafeTSchema | AjvCompileParams[0];
|
|
32
|
+
type ValidatedData<T extends RequestSchema> = T extends SafeZodType ? z.infer<T> : T extends SafeTSchema ? Static<T> : T extends SafeJSONSchema ? SafeJSONSchema extends T ? Record<string, unknown> : FromSchema<T> : unknown;
|
|
29
33
|
interface CustomValidationError {
|
|
30
34
|
status?: number;
|
|
31
35
|
message?: string;
|
package/lib/index.d.ts
CHANGED
|
@@ -24,8 +24,12 @@ import { Transporter } from 'nodemailer';
|
|
|
24
24
|
type AjvInstance = InstanceType<typeof Ajv>;
|
|
25
25
|
type AjvCompileParams = Parameters<AjvInstance["compile"]>;
|
|
26
26
|
|
|
27
|
-
type
|
|
28
|
-
type
|
|
27
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
28
|
+
type SafeTSchema = IsAny<TSchema> extends true ? never : TSchema;
|
|
29
|
+
type SafeJSONSchema = IsAny<JSONSchema$1> extends true ? never : JSONSchema$1;
|
|
30
|
+
type SafeZodType = IsAny<ZodType> extends true ? never : ZodType;
|
|
31
|
+
type RequestSchema = SafeZodType | SafeTSchema | AjvCompileParams[0];
|
|
32
|
+
type ValidatedData<T extends RequestSchema> = T extends SafeZodType ? z.infer<T> : T extends SafeTSchema ? Static<T> : T extends SafeJSONSchema ? SafeJSONSchema extends T ? Record<string, unknown> : FromSchema<T> : unknown;
|
|
29
33
|
interface CustomValidationError {
|
|
30
34
|
status?: number;
|
|
31
35
|
message?: string;
|