Closed JustGreg closed 1 month ago
We do not have a utility type for this yet, but this should work. Check it out in our playground.
import * as v from 'valibot';
const UserSchema = v.pipe(
v.object({
email: v.pipe(v.string(), v.email()),
password: v.pipe(v.string(), v.minLength(8)),
}),
v.title('user'),
);
type UserTitle = Extract<
(typeof UserSchema)['pipe'][number],
{ type: 'title' }
>['title'];
I want to do something like this: