TypeOf<S>

Types can be inferred based on validators:

import { nonEmpty, minLength, nil,, object, string } from '@typeofweb/schema';
import type { TypeOf } from '@typeofweb/schema';
const blogSchema = object({
title: (string, minLength(10)),
description: (string, nil),
href: (string, nil, nonEmpty),
rssUrl: (string, nil, nonEmpty),
})();
type Blog = TypeOf<typeof blogSchema>;
// type Blog = {
// readonly title: string;
// readonly description?: string | null | undefined;
// readonly href?: string | null | undefined;
// readonly rssUrl?: string | null | undefined;
// }
Last updated on by Micha艂 Miszczyszyn