UNPKG

typizator

Version:

Runtime types and metadata schemas for Typescript

66 lines (65 loc) 1.99 kB
import { ExtendedSchema } from "./schemas"; /** * Type for the bigint schema. */ export type BigintS = ExtendedSchema<bigint, bigint | number | string>; /** * Primitive type schema representing a bigint */ export declare const bigintS: BigintS; /** * Type for the string schema. */ export type StringS = ExtendedSchema<string, string | bigint | number>; /** * Primitive type schema representing a string */ export declare const stringS: StringS; export type LiteralS<T extends keyof any> = ExtendedSchema<T, T>; /** * Primitive type schema representing a string */ export declare const literalS: <T extends string | number | symbol>(...values: T[]) => LiteralS<T>; /** * Type for the int schema. */ export type IntS = ExtendedSchema<number, bigint | number | string>; /** * Primitive type schema representing an integer number * * When unboxing, drops the part of the number after the decimal point. * If the source of unboxing cannot be converted into a number, throws an error. * If the converted number is out of the simple number's bounds, throw an error */ export declare const intS: IntS; /** * Type for the float schema. */ export type FloatS = ExtendedSchema<number, bigint | number | string>; /** * Primitive type schema representing a floating point number * * If the source of unboxing cannot be converted into a number, throws an error. */ export declare const floatS: FloatS; /** * Type for the date schema. */ export type DateS = ExtendedSchema<Date, Date | string>; /** * Primitive type representing a Javascript/typescript date * * If the source is the "now" string, unboxes to the actual date/time */ export declare const dateS: DateS; /** * Type for the boolean schema. */ export type BoolS = ExtendedSchema<boolean, boolean | string | number>; /** * Primitive type representing a boolean * * Source 0 or "false" is unboxed, to false, source 1 or "true" to true * Illegal values throw an error */ export declare const boolS: BoolS;