@@ -2,8 +2,6 @@ import type { type } from 'arktype';
2
2
import {
3
3
type ValidationAdapter ,
4
4
type RequiredDefaultsOptions ,
5
- type Infer ,
6
- type InferIn ,
7
5
createAdapter ,
8
6
type ClientValidationAdapter ,
9
7
type ValidationResult ,
@@ -21,12 +19,12 @@ const fetchModule = /* @__PURE__ */ memoize(modules);
21
19
async function _validate < T extends type . Any > (
22
20
schema : T ,
23
21
data : unknown
24
- ) : Promise < ValidationResult < Infer < T > > > {
22
+ ) : Promise < ValidationResult < T [ 'infer' ] > > {
25
23
const { type } = await fetchModule ( ) ;
26
24
const result = schema ( data ) ;
27
25
if ( ! ( result instanceof type . errors ) ) {
28
26
return {
29
- data : result as Infer < T > ,
27
+ data : result as T [ 'infer' ] ,
30
28
success : true
31
29
} ;
32
30
}
@@ -42,22 +40,22 @@ async function _validate<T extends type.Any>(
42
40
43
41
function _arktype < T extends type . Any > (
44
42
schema : T ,
45
- options : RequiredDefaultsOptions < Infer < T > >
46
- ) : ValidationAdapter < Infer < T > , InferIn < T > > {
43
+ options : RequiredDefaultsOptions < T [ 'infer' ] >
44
+ ) : ValidationAdapter < T [ 'infer' ] , T [ 'inferIn' ] > {
47
45
return createAdapter ( {
48
46
superFormValidationLibrary : 'arktype' ,
49
47
defaults : options . defaults ,
50
48
jsonSchema : createJsonSchema ( options ) ,
51
- validate : async ( data ) => _validate ( schema , data )
49
+ validate : async ( data ) => _validate < T > ( schema , data )
52
50
} ) ;
53
51
}
54
52
55
53
function _arktypeClient < T extends type . Any > (
56
54
schema : T
57
- ) : ClientValidationAdapter < Infer < T > , InferIn < T > > {
55
+ ) : ClientValidationAdapter < T [ 'infer' ] , T [ 'inferIn' ] > {
58
56
return {
59
57
superFormValidationLibrary : 'arktype' ,
60
- validate : async ( data ) => _validate ( schema , data )
58
+ validate : async ( data ) => _validate < T > ( schema , data )
61
59
} ;
62
60
}
63
61
0 commit comments