Skip to content

Commit c49433c

Browse files
committed
Fix formatting
1 parent 7f4c35a commit c49433c

File tree

3 files changed

+23
-20
lines changed

3 files changed

+23
-20
lines changed

src/lib/adapters/adapters.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@ import { simpleSchema } from './simple-schema/index.js';
1616

1717
export type { Schema, ValidationIssue, ValidationResult } from './typeSchema.js';
1818

19-
export type Infer<T extends Schema, K extends keyof Registry = keyof Registry> = NonNullable<InferSchema<T, K>>;
20-
export type InferIn<T extends Schema, K extends keyof Registry = keyof Registry> = NonNullable<InferInSchema<T, K>>;
19+
export type Infer<T extends Schema, K extends keyof Registry = keyof Registry> = NonNullable<
20+
InferSchema<T, K>
21+
>;
22+
export type InferIn<T extends Schema, K extends keyof Registry = keyof Registry> = NonNullable<
23+
InferInSchema<T, K>
24+
>;
2125

2226
export type ValidationLibrary =
2327
| 'arktype'

src/lib/adapters/typeSchema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ interface YupResolver extends Resolver {
129129

130130
interface ZodResolver extends Resolver {
131131
base: ZodTypeAny;
132-
input: this['schema'] extends ZodType<any, any, infer I> ? I : never;
133-
output: this['schema'] extends ZodType<infer O, any,any> ? O : never;
132+
input: this['schema'] extends ZodType<any, any, infer I> ? I : never;
133+
output: this['schema'] extends ZodType<infer O, any, any> ? O : never;
134134
}
135135

136136
interface VineResolver extends Resolver {

src/lib/adapters/zod.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
type ZodErrorMap,
3-
type ZodType,
4-
type ZodTypeDef,
5-
} from 'zod';
1+
import { type ZodErrorMap, type ZodType, type ZodTypeDef } from 'zod';
62
import type { JSONSchema7 } from 'json-schema';
73
import {
84
type AdapterOptions,
@@ -28,10 +24,13 @@ export const zodToJSONSchema = (...params: Parameters<typeof zodToJson>) => {
2824
return zodToJson(...params) as JSONSchema7;
2925
};
3026

31-
3227
// allows for any object schema
3328
// allows `undefined` in the input type to account for ZodDefault
34-
export type ZodObjectType = ZodType<Record<string, unknown>, ZodTypeDef, Record<string, unknown> | undefined>;
29+
export type ZodObjectType = ZodType<
30+
Record<string, unknown>,
31+
ZodTypeDef,
32+
Record<string, unknown> | undefined
33+
>;
3534
export type ZodObjectTypes = ZodObjectType;
3635

3736
// left in for compatibility reasons
@@ -43,11 +42,11 @@ async function validate<T extends ZodValidation>(
4342
schema: T,
4443
data: unknown,
4544
errorMap: ZodErrorMap | undefined
46-
): Promise<ValidationResult<Infer<T, "zod">>> {
45+
): Promise<ValidationResult<Infer<T, 'zod'>>> {
4746
const result = await schema.safeParseAsync(data, { errorMap });
4847
if (result.success) {
4948
return {
50-
data: result.data as Infer<T, "zod">,
49+
data: result.data as Infer<T, 'zod'>,
5150
success: true
5251
};
5352
}
@@ -60,23 +59,23 @@ async function validate<T extends ZodValidation>(
6059

6160
function _zod<T extends ZodValidation>(
6261
schema: T,
63-
options?: AdapterOptions<Infer<T, "zod">> & { errorMap?: ZodErrorMap; config?: Partial<Options> }
64-
): ValidationAdapter<Infer<T, "zod">, InferIn<T, "zod">> {
62+
options?: AdapterOptions<Infer<T, 'zod'>> & { errorMap?: ZodErrorMap; config?: Partial<Options> }
63+
): ValidationAdapter<Infer<T, 'zod'>, InferIn<T, 'zod'>> {
6564
return createAdapter({
66-
superFormValidationLibrary: "zod",
67-
async validate (data){
65+
superFormValidationLibrary: 'zod',
66+
async validate(data) {
6867
// options?.defaults
69-
return validate(schema, data, options?.errorMap)
68+
return validate(schema, data, options?.errorMap);
7069
},
7170
jsonSchema: options?.jsonSchema ?? zodToJSONSchema(schema, options?.config),
72-
defaults: options?.defaults,
71+
defaults: options?.defaults
7372
});
7473
}
7574

7675
function _zodClient<T extends ZodValidation>(
7776
schema: T,
7877
options?: { errorMap?: ZodErrorMap }
79-
): ClientValidationAdapter<Infer<T, "zod">, InferIn<T, "zod">> {
78+
): ClientValidationAdapter<Infer<T, 'zod'>, InferIn<T, 'zod'>> {
8079
return {
8180
superFormValidationLibrary: 'zod',
8281
validate: async (data) => validate(schema, data, options?.errorMap)

0 commit comments

Comments
 (0)