Valibot Pipe Inference (#31)

- Fixes Pipe inference on Valibot 1.x, noting additional `readonly` constraint added post 1.0.
This commit is contained in:
Kavishka Ganganatha
2025-06-03 13:39:31 +05:30
committed by GitHub
parent 978cb5d962
commit d428962694

View File

@@ -743,7 +743,7 @@ function FromVoid(type: BaseSchema): t.TSchema {
// prettier-ignore
type TFromType<Type extends BaseSchema> = (
// Pipes - Extract First Type And Remap
Type extends { pipe: [infer Type extends BaseSchema, ...any[]] } ? TFromType<Type> :
Type extends { pipe: readonly [infer Type extends BaseSchema, ...any[]] } ? TFromType<Type> :
// Types
Type extends v.AnySchema ? TFromAny<Type> :
Type extends v.ArraySchema<infer Type extends BaseSchema, any> ? TFromArray<Type> :