@@ -10,15 +10,10 @@ import {
1010import type { Struct } from 'superstruct' ;
1111import { memoize } from '$lib/memoize.js' ;
1212
13- // async function modules() {
14- // const { validate } = await import(/* webpackIgnore: true */ 'superstruct');
15- // return { validate };
16- // }
17-
18- // const fetchModule = /* @__PURE__ */ memoize(modules);
19-
2013// eslint-disable-next-line @typescript-eslint/no-explicit-any
21- async function validate < T extends Struct < any , any > > (
14+ type StructObject < T extends Record < string , unknown > > = Struct < T , any > ;
15+
16+ async function validate < T extends StructObject < Infer < T > > > (
2217 schema : T ,
2318 data : unknown
2419) : Promise < ValidationResult < Infer < T > > > {
@@ -39,8 +34,7 @@ async function validate<T extends Struct<any, any>>(
3934 } ;
4035}
4136
42- // eslint-disable-next-line @typescript-eslint/no-explicit-any
43- function _superstruct < T extends Struct < any , any > > (
37+ function _superstruct < T extends StructObject < Infer < T > > > (
4438 schema : T ,
4539 options : RequiredDefaultsOptions < Infer < T > >
4640) : ValidationAdapter < Infer < T > > {
@@ -52,7 +46,9 @@ function _superstruct<T extends Struct<any, any>>(
5246 } ) ;
5347}
5448
55- function _superstructClient < T extends Struct > ( schema : T ) : ClientValidationAdapter < Infer < T > > {
49+ function _superstructClient < T extends StructObject < Infer < T > > > (
50+ schema : T
51+ ) : ClientValidationAdapter < Infer < T > > {
5652 return {
5753 superFormValidationLibrary : 'superstruct' ,
5854 validate : async ( data ) => validate ( schema , data )
0 commit comments