UNPKG

@tsed/schema

Version:
18 lines (17 loc) 564 B
import { from } from "./from.js"; export function array(item) { const schema = from(Array); return (item ? schema.items(item) : schema); } export function map(value) { const schema = from(Map).unknown(true); return (value ? schema.additionalProperties(value) : schema); } export function set(item) { const schema = from(Array).uniqueItems(true); return (item ? schema.items(item) : schema); } export function record(value) { const schema = from(Object).unknown(true); return (value ? schema.additionalProperties(value) : schema); }