diff --git a/src/lib/adapters/arktype.ts b/src/lib/adapters/arktype.ts index 5a982372..63ef3115 100644 --- a/src/lib/adapters/arktype.ts +++ b/src/lib/adapters/arktype.ts @@ -2,8 +2,6 @@ import type { type } from 'arktype'; import { type ValidationAdapter, type RequiredDefaultsOptions, - type Infer, - type InferIn, createAdapter, type ClientValidationAdapter, type ValidationResult, @@ -21,12 +19,12 @@ const fetchModule = /* @__PURE__ */ memoize(modules); async function _validate( schema: T, data: unknown -): Promise>> { +): Promise> { const { type } = await fetchModule(); const result = schema(data); if (!(result instanceof type.errors)) { return { - data: result as Infer, + data: result as T['infer'], success: true }; } @@ -42,22 +40,22 @@ async function _validate( function _arktype( schema: T, - options: RequiredDefaultsOptions> -): ValidationAdapter, InferIn> { + options: RequiredDefaultsOptions +): ValidationAdapter { return createAdapter({ superFormValidationLibrary: 'arktype', defaults: options.defaults, jsonSchema: createJsonSchema(options), - validate: async (data) => _validate(schema, data) + validate: async (data) => _validate(schema, data) }); } function _arktypeClient( schema: T -): ClientValidationAdapter, InferIn> { +): ClientValidationAdapter { return { superFormValidationLibrary: 'arktype', - validate: async (data) => _validate(schema, data) + validate: async (data) => _validate(schema, data) }; } diff --git a/src/lib/adapters/valibot.ts b/src/lib/adapters/valibot.ts index 05945dec..147b8dcf 100644 --- a/src/lib/adapters/valibot.ts +++ b/src/lib/adapters/valibot.ts @@ -42,7 +42,7 @@ export const valibotToJSONSchema = (options: ToJSONSchemaOptions) => { return valibotToJSON({ ...defaultOptions, ...options }) as JSONSchema; }; -async function validate( +async function _validate( schema: T, data: unknown, config?: Config> @@ -72,7 +72,7 @@ function _valibot( ): ValidationAdapter, InferIn> { return createAdapter({ superFormValidationLibrary: 'valibot', - validate: async (data) => validate(schema, data, options?.config), + validate: async (data) => _validate(schema, data, options?.config), // eslint-disable-next-line @typescript-eslint/no-explicit-any jsonSchema: options?.jsonSchema ?? valibotToJSONSchema({ schema: schema as any, ...options }), defaults: 'defaults' in options ? options.defaults : undefined @@ -84,7 +84,7 @@ function _valibotClient( ): ClientValidationAdapter, InferIn> { return { superFormValidationLibrary: 'valibot', - validate: async (data) => validate(schema, data) + validate: async (data) => _validate(schema, data) }; }