Revision 0.8.6 (#15)

* Parameterized Compile Types

* Documentation | Tests

* Infer Validator via Static

* Version
This commit is contained in:
sinclairzx81
2025-01-28 18:14:33 +09:00
committed by GitHub
parent 85f38f4b2b
commit be5a202ad1
9 changed files with 189 additions and 97 deletions

View File

@@ -26,6 +26,7 @@ THE SOFTWARE.
---------------------------------------------------------------------------*/
import { Validator } from './compile/validator'
import * as s from '@sinclair/typebox/syntax'
import * as t from '@sinclair/typebox'
import * as v from 'valibot'
@@ -37,6 +38,7 @@ type BaseSchema = v.BaseSchema<unknown, unknown, v.BaseIssue<unknown>>
// prettier-ignore
export type Static<Type extends object | string> = (
Type extends string ? s.StaticParseAsType<{}, Type> :
Type extends Validator<infer Type extends t.TSchema> ? t.Static<Type> :
Type extends t.TSchema ? t.Static<Type> :
Type extends BaseSchema ? v.InferInput<Type> :
Type extends z.ZodTypeAny ? z.infer<Type> :