import * as schema from '../schema'; import * as classes from './classes'; import type { Type, TypeOfAlias } from './types'; type UnionToIntersection = (U extends never ? never : (arg: U) => never) extends (arg: infer I) => void ? I : never; type UnionToTuple = UnionToIntersection T> extends (_: never) => infer W ? [...UnionToTuple>, W] : []; type ObjValueTuple, R extends any[] = []> = KS extends [ infer K, ...infer KT ] ? ObjValueTuple : R; type RecordToFields> = ObjValueTuple<{ [K in keyof O]: classes.KeyType; }>; export declare class TypeBuilder { system?: classes.ModuleType | undefined; constructor(system?: classes.ModuleType | undefined); get any(): classes.AnyType; get undef(): classes.ConType; get nil(): classes.ConType; get bool(): classes.BoolType; get num(): classes.NumType; get str(): classes.StrType; get bin(): classes.BinType; get arr(): classes.ArrType; get obj(): classes.ObjType<[]>; get map(): classes.MapType; get fn(): classes.FnType, classes.ConType, unknown>; get fn$(): classes.FnRxType, classes.ConType, unknown>; readonly or: (...types: F) => classes.OrType; readonly undefined: () => classes.ConType; readonly null: () => classes.ConType; readonly boolean: () => classes.BoolType; readonly number: () => classes.NumType; readonly string: () => classes.StrType; readonly binary: () => classes.BinType; readonly con: (value: schema.Narrow, options?: schema.Optional) => classes.ConType; readonly literal: (value: schema.Narrow, options?: schema.Optional) => classes.ConType; readonly array: (type?: T, options?: schema.Optional) => classes.ArrType; readonly tuple: (...types: F) => classes.ArrType; /** * Creates an object type with the specified properties. This is a shorthand for * `t.Object(t.prop(key, value), ...)`. * * Importantly, this method does not allow to specify object field order, * so the order of properties in the resulting type is not guaranteed. * * Example: * * ```ts * t.object({ * id: t.str, * name: t.string(), * age: t.num, * verified: t.bool, * }); * ``` * * @param record A mapping of property names to types. * @returns An object type. */ readonly object: >(record: R) => classes.ObjType>; /** * Creates a type that represents a value that may be present or absent. The * value is `undefined` if absent. This is a shorthand for `t.Or(type, t.undef)`. */ readonly maybe: (type: T) => classes.OrType<[T, classes.ConType]>; /** * Creates a union type from a list of values. This is a shorthand for * `t.Or(t.Const(value1), t.Const(value2), ...)`. For example, the below * are equivalent: * * ```ts * t.enum('red', 'green', 'blue'); * t.Or(t.Const('red'), t.Const('green'), t.Const('blue')); * ``` * * @param values The values to include in the union. * @returns A union type representing the values. */ readonly enum: (...values: T) => classes.OrType<{ [K in keyof T]: classes.ConType>; }>; Any(options?: schema.Optional): classes.AnyType; Const(value: schema.Narrow, options?: schema.Optional): classes.ConType; Boolean(options?: schema.Optional): classes.BoolType; Number(options?: schema.Optional): classes.NumType; String(options?: schema.Optional): classes.StrType; Binary(type: T, options?: schema.Optional): classes.BinType; Array(type: T, options?: schema.Optional): classes.ArrType; Tuple(head: Head, item?: Item, tail?: Tail, options?: schema.Optional): classes.ArrType; Object | classes.KeyOptType)[]>(...keys: F): classes.ObjType; Key(key: K, value: V): classes.KeyType; KeyOpt(key: K, value: V): classes.KeyOptType; Map(val: T, key?: Type, options?: schema.Optional): classes.MapType; Or(...types: F): classes.OrType; Ref>(ref: string): classes.RefType>; Function(req: Req, res: Res, options?: schema.Optional): classes.FnType; Function$(req: Req, res: Res, options?: schema.Optional): classes.FnRxType; import(node: schema.Schema): Type; from(value: unknown): Type; } export {}; //# sourceMappingURL=TypeBuilder.d.ts.map