diff --git a/typebox/src/typebox.ts b/typebox/src/typebox.ts
index 220dc794..c161f033 100644
--- a/typebox/src/typebox.ts
+++ b/typebox/src/typebox.ts
@@ -1,14 +1,8 @@
import { toNestErrors, validateFieldsNatively } from '@hookform/resolvers';
-import { Static, StaticDecode, Type } from '@sinclair/typebox';
+import { Static, StaticDecode, TObject } from '@sinclair/typebox';
import { TypeCheck } from '@sinclair/typebox/compiler';
import { Value, type ValueError } from '@sinclair/typebox/value';
-import {
- FieldError,
- FieldErrors,
- FieldValues,
- Resolver,
- appendErrors,
-} from 'react-hook-form';
+import { FieldError, Resolver, appendErrors } from 'react-hook-form';
function parseErrorSchema(
_errors: ValueError[],
@@ -45,22 +39,6 @@ function parseErrorSchema(
return errors;
}
-export function typeboxResolver(
- typecheck: TypeCheck>>,
-): Resolver<
- Static>,
- Context,
- StaticDecode>
->;
-
-export function typeboxResolver(
- schema: ReturnType>,
-): Resolver, Context, StaticDecode>;
-
-export function typeboxResolver(
- schema: ReturnType>,
-): Resolver, Context, Output>;
-
/**
* Creates a resolver for react-hook-form using Typebox schema validation
* @param {Schema | TypeCheck} schema - The Typebox schema to validate against
@@ -77,10 +55,10 @@ export function typeboxResolver(
* resolver: typeboxResolver(schema)
* });
*/
-export function typeboxResolver(
- schema: ReturnType>,
-): Resolver, Context, Output | Static> {
- return async (values: Static, _, options) => {
+export function typeboxResolver(
+ schema: Schema | TypeCheck,
+): Resolver, Context, StaticDecode> {
+ return async (values: Static, _, options) => {
const errors = Array.from(
schema instanceof TypeCheck
? schema.Errors(values)
@@ -91,7 +69,7 @@ export function typeboxResolver(
if (!errors.length) {
return {
- errors: {} as FieldErrors,
+ errors: {},
values,
};
}