export declare const Kind: unique symbol; export declare const Hint: unique symbol; export declare const Modifier: unique symbol; export declare type TModifier = TReadonlyOptional | TOptional | TReadonly; export declare type TReadonly = T & { [Modifier]: 'Readonly'; }; export declare type TOptional = T & { [Modifier]: 'Optional'; }; export declare type TReadonlyOptional = T & { [Modifier]: 'ReadonlyOptional'; }; export interface SchemaOptions { $schema?: string; /** Id for this schema */ $id?: string; /** Title of this schema */ title?: string; /** Description of this schema */ description?: string; /** Default value for this schema */ default?: any; /** Example values matching this schema. */ examples?: any; [prop: string]: any; } export interface TSchema extends SchemaOptions { [Kind]: string; [Hint]?: string; [Modifier]?: string; params: unknown[]; static: unknown; } export declare type TAnySchema = TSchema | TAny | TArray | TBoolean | TConstructor | TEnum | TFunction | TInteger | TLiteral | TNull | TNumber | TObject | TPromise | TRecord | TSelf | TRef | TString | TTuple | TUndefined | TUnion | TUint8Array | TUnknown | TVoid; export interface NumericOptions extends SchemaOptions { exclusiveMaximum?: number; exclusiveMinimum?: number; maximum?: number; minimum?: number; multipleOf?: number; } export declare type TNumeric = TInteger | TNumber; export interface TAny extends TSchema { [Kind]: 'Any'; static: any; } export interface ArrayOptions extends SchemaOptions { uniqueItems?: boolean; minItems?: number; maxItems?: number; } export interface TArray extends TSchema, ArrayOptions { [Kind]: 'Array'; static: Array>; type: 'array'; items: T; } export interface TBoolean extends TSchema { [Kind]: 'Boolean'; static: boolean; type: 'boolean'; } export declare type TConstructorParameters> = TTuple; export declare type TInstanceType> = T['returns']; export declare type StaticContructorParameters = [...{ [K in keyof T]: T[K] extends TSchema ? Static : never; }]; export interface TConstructor extends TSchema { [Kind]: 'Constructor'; static: new (...param: StaticContructorParameters) => Static; type: 'constructor'; parameters: T; returns: U; } export interface TEnumOption { type: 'number' | 'string'; const: T; } export interface TEnum = Record> extends TSchema { [Kind]: 'Union'; static: T[keyof T]; anyOf: TLiteral[]; } export declare type TParameters = TTuple; export declare type TReturnType = T['returns']; export declare type StaticFunctionParameters = [...{ [K in keyof T]: T[K] extends TSchema ? Static : never; }]; export interface TFunction extends TSchema { [Kind]: 'Function'; static: (...param: StaticFunctionParameters) => Static; type: 'function'; parameters: T; returns: U; } export interface TInteger extends TSchema, NumericOptions { [Kind]: 'Integer'; static: number; type: 'integer'; } export declare type IntersectEvaluate = { [K in keyof T]: T[K] extends TSchema ? Static : never; }; export declare type IntersectReduce = T extends [infer A, ...infer B] ? IntersectReduce : I extends object ? I : {}; export interface TIntersect extends TObject { static: IntersectReduce>; properties: Record>, TSchema>; } export declare type UnionToIntersect = (U extends unknown ? (arg: U) => 0 : never) extends (arg: infer I) => 0 ? I : never; export declare type UnionLast = UnionToIntersect 0 : never> extends (x: infer L) => 0 ? L : never; export declare type UnionToTuple> = [U] extends [never] ? [] : [...UnionToTuple>, L]; export declare type UnionStringLiteralToTuple = T extends TUnion ? { [I in keyof L]: L[I] extends TLiteral ? C : never; } : never; export declare type TKeyOf = { [K in ObjectPropertyKeys]: TLiteral; } extends infer R ? UnionToTuple : never; export declare type TLiteralValue = string | number | boolean; export interface TLiteral extends TSchema { [Kind]: 'Literal'; static: T; const: T; } export interface TNull extends TSchema { [Kind]: 'Null'; static: null; type: 'null'; } export interface TNumber extends TSchema, NumericOptions { [Kind]: 'Number'; static: number; type: 'number'; } export declare type ReadonlyOptionalPropertyKeys = { [K in keyof T]: T[K] extends TReadonlyOptional ? K : never; }[keyof T]; export declare type ReadonlyPropertyKeys = { [K in keyof T]: T[K] extends TReadonly ? K : never; }[keyof T]; export declare type OptionalPropertyKeys = { [K in keyof T]: T[K] extends TOptional ? K : never; }[keyof T]; export declare type RequiredPropertyKeys = keyof Omit | ReadonlyPropertyKeys | OptionalPropertyKeys>; export declare type PropertiesReduce = { readonly [K in ReadonlyOptionalPropertyKeys]?: Static; } & { readonly [K in ReadonlyPropertyKeys]: Static; } & { [K in OptionalPropertyKeys]?: Static; } & { [K in RequiredPropertyKeys]: Static; } extends infer R ? { [K in keyof R]: R[K]; } : never; export declare type TRecordProperties, T extends TSchema> = Static extends string ? { [X in Static]: T; } : never; export interface TProperties { [key: string]: TSchema; } export declare type ObjectProperties = T extends TObject ? U : never; export declare type ObjectPropertyKeys = T extends TObject ? keyof U : never; export interface ObjectOptions extends SchemaOptions { additionalProperties?: boolean; minProperties?: number; maxProperties?: number; } export interface TObject extends TSchema, ObjectOptions { [Kind]: 'Object'; static: PropertiesReduce; type: 'object'; properties: T; required?: string[]; } export interface TOmit[]> extends TObject, ObjectOptions { static: Omit, Properties[number]>; properties: T extends TObject ? Omit : never; } export interface TPartial extends TObject { static: Partial>; } export declare type TPick[]> = TObject<{ [K in Properties[number]]: T['properties'][K]; }>; export interface TPromise extends TSchema { [Kind]: 'Promise'; static: Promise>; type: 'promise'; item: TSchema; } export declare type TRecordKey = TString | TNumber | TUnion[]>; export interface TRecord extends TSchema { [Kind]: 'Record'; static: Record, Static>; type: 'object'; patternProperties: { [pattern: string]: T; }; additionalProperties: false; } export interface TSelf extends TSchema { [Kind]: 'Self'; static: this['params'][0]; $ref: string; } export declare type TRecursiveReduce = Static]>; export interface TRecursive extends TSchema { static: TRecursiveReduce; } export interface TRef extends TSchema { [Kind]: 'Ref'; static: Static; $ref: string; } export interface TRequired> extends TObject { static: Required>; } export declare type StringFormatOption = 'date-time' | 'time' | 'date' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'uuid' | 'iri-reference' | 'uri-template' | 'json-pointer' | 'relative-json-pointer' | 'regex'; export interface StringOptions extends SchemaOptions { minLength?: number; maxLength?: number; pattern?: string; format?: TFormat; contentEncoding?: '7bit' | '8bit' | 'binary' | 'quoted-printable' | 'base64'; contentMediaType?: string; } export interface TString extends TSchema, StringOptions { [Kind]: 'String'; static: string; type: 'string'; } export declare type TupleToArray> = T extends TTuple ? R : never; export interface TTuple extends TSchema { [Kind]: 'Tuple'; static: { [K in keyof T]: T[K] extends TSchema ? Static : T[K]; }; type: 'array'; items?: T; additionalItems?: false; minItems: number; maxItems: number; } export interface TUndefined extends TSchema { [Kind]: 'Undefined'; specialized: 'Undefined'; static: undefined; type: 'object'; } export interface TUnion extends TSchema { [Kind]: 'Union'; static: { [K in keyof T]: T[K] extends TSchema ? Static : never; }[number]; anyOf: T; } export interface Uint8ArrayOptions extends SchemaOptions { maxByteLength?: number; minByteLength?: number; } export interface TUint8Array extends TSchema, Uint8ArrayOptions { [Kind]: 'Uint8Array'; static: Uint8Array; specialized: 'Uint8Array'; type: 'object'; } export interface TUnknown extends TSchema { [Kind]: 'Unknown'; static: unknown; } export interface UnsafeOptions extends SchemaOptions { [Kind]?: string; } export interface TUnsafe extends TSchema { [Kind]: string; static: T; } export interface TVoid extends TSchema { [Kind]: 'Void'; static: void; type: 'null'; } /** Creates a static type from a TypeBox type */ export declare type Static = (T & { params: P; })['static']; export declare class TypeBuilder { /** Creates a readonly optional property */ ReadonlyOptional(item: T): TReadonlyOptional; /** Creates a readonly property */ Readonly(item: T): TReadonly; /** Creates a optional property */ Optional(item: T): TOptional; /** Creates a any type */ Any(options?: SchemaOptions): TAny; /** Creates a array type */ Array(items: T, options?: ArrayOptions): TArray; /** Creates a boolean type */ Boolean(options?: SchemaOptions): TBoolean; /** Creates a tuple type from this constructors parameters */ ConstructorParameters>(schema: T, options?: SchemaOptions): TConstructorParameters; /** Creates a constructor type */ Constructor, U extends TSchema>(parameters: T, returns: U, options?: SchemaOptions): TConstructor, U>; /** Creates a constructor type */ Constructor(parameters: [...T], returns: U, options?: SchemaOptions): TConstructor; /** Creates a enum type */ Enum>(item: T, options?: SchemaOptions): TEnum; /** Creates a function type */ Function, U extends TSchema>(parameters: T, returns: U, options?: SchemaOptions): TFunction, U>; /** Creates a function type */ Function(parameters: [...T], returns: U, options?: SchemaOptions): TFunction; /** Creates a type from this constructors instance type */ InstanceType>(schema: T, options?: SchemaOptions): TInstanceType; /** Creates a integer type */ Integer(options?: NumericOptions): TInteger; /** Creates a intersect type. */ Intersect(objects: [...T], options?: ObjectOptions): TIntersect; /** Creates a keyof type */ KeyOf(object: T, options?: SchemaOptions): TUnion>; /** Creates a literal type. */ Literal(value: T, options?: SchemaOptions): TLiteral; /** Creates a null type */ Null(options?: SchemaOptions): TNull; /** Creates a number type */ Number(options?: NumericOptions): TNumber; /** Creates an object type with the given properties */ Object(properties: T, options?: ObjectOptions): TObject; /** Creates a new object whose properties are omitted from the given object */ Omit[]>>(schema: T, keys: K, options?: ObjectOptions): TOmit>; /** Creates a new object whose properties are omitted from the given object */ Omit[]>(schema: T, keys: [...K], options?: ObjectOptions): TOmit; /** Creates a tuple type from this functions parameters */ Parameters>(schema: T, options?: SchemaOptions): TParameters; /** Creates an object type whose properties are all optional */ Partial(schema: T, options?: ObjectOptions): TPartial; /** Creates a object whose properties are picked from the given object */ Pick[]>>(schema: T, keys: K, options?: ObjectOptions): TPick>; /** Creates a object whose properties are picked from the given object */ Pick[]>(schema: T, keys: [...K], options?: ObjectOptions): TPick; /** Creates a promise type. This type cannot be represented in schema. */ Promise(item: T, options?: SchemaOptions): TPromise; /** Creates an object whose properties are derived from the given string literal union. */ Record, T extends TSchema>(key: K, schema: T, options?: ObjectOptions): TObject>; /** Creates a record type */ Record(key: K, schema: T, options?: ObjectOptions): TRecord; /** Creates a recursive object type */ Recursive(callback: (self: TSelf) => T, options?: SchemaOptions): TRecursive; /** Creates a reference schema */ Ref(schema: T, options?: SchemaOptions): TRef; /** Creates a string type from a regular expression */ RegEx(regex: RegExp, options?: SchemaOptions): TString; /** Creates an object type whose properties are all required */ Required(schema: T, options?: SchemaOptions): TRequired; /** Creates a type from this functions return type */ ReturnType>(schema: T, options?: SchemaOptions): TReturnType; /** Removes Kind and Modifier symbol property keys from this schema */ Strict(schema: T): T; /** Creates a string type */ String(options?: StringOptions): TString; /** Creates a tuple type */ Tuple(items: [...T], options?: SchemaOptions): TTuple; /** Creates a undefined type */ Undefined(options?: SchemaOptions): TUndefined; /** Creates a union type */ Union(items: [...T], options?: SchemaOptions): TUnion; /** Creates a Uint8Array type */ Uint8Array(options?: Uint8ArrayOptions): TUint8Array; /** Creates an unknown type */ Unknown(options?: SchemaOptions): TUnknown; /** Creates a user defined schema that infers as type T */ Unsafe(options?: UnsafeOptions): TUnsafe; /** Creates a void type */ Void(options?: SchemaOptions): TVoid; /** Use this function to return TSchema with static and params omitted */ protected Create(schema: Omit): T; /** Clones the given value */ protected Clone(value: any): any; } /** JSON Schema Type Builder with Static Type Resolution for TypeScript */ export declare const Type: TypeBuilder;