export declare const Transform: unique symbol; export declare const Readonly: unique symbol; export declare const Optional: unique symbol; export declare const Hint: unique symbol; export declare const Kind: unique symbol; export declare const PatternBoolean = "(true|false)"; export declare const PatternNumber = "(0|[1-9][0-9]*)"; export declare const PatternString = "(.*)"; export declare const PatternBooleanExact = "^(true|false)$"; export declare const PatternNumberExact = "^(0|[1-9][0-9]*)$"; export declare const PatternStringExact = "^(.*)$"; export type TupleToIntersect = T extends [infer I] ? I : T extends [infer I, ...infer R] ? I & TupleToIntersect : never; export type TupleToUnion = { [K in keyof T]: T[K]; }[number]; export type UnionToIntersect = (U extends unknown ? (arg: U) => 0 : never) extends (arg: infer I) => 0 ? I : never; export type UnionLast = UnionToIntersect 0 : never> extends (x: infer L) => 0 ? L : never; export type UnionToTuple> = [U] extends [never] ? [] : [...UnionToTuple>, L]; export type Discard = T extends [infer L, ...infer R] ? (L extends D ? Discard : [L, ...Discard]) : []; export type Flat = T extends [] ? [] : T extends [infer L] ? [...Flat] : T extends [infer L, ...infer R] ? [...Flat, ...Flat] : [T]; export type Trim = T extends `${' '}${infer U}` ? Trim : T extends `${infer U}${' '}` ? Trim : T; export type Assert = T extends E ? T : never; export type Evaluate = T extends infer O ? { [K in keyof O]: O[K]; } : never; export type Ensure = T extends infer U ? U : never; export type AssertProperties = T extends TProperties ? T : TProperties; export type AssertRest = T extends E ? T : []; export type AssertType = T extends E ? T : TNever; export type TReadonlyOptional = TOptional & TReadonly; export type TReadonly = T & { [Readonly]: 'Readonly'; }; export type TOptional = T & { [Optional]: 'Optional'; }; export type ReadonlyUnwrapType = T extends TReadonly ? ReadonlyUnwrapType : T extends TOptional ? TOptional> : T; export type ReadonlyUnwrapRest = T extends [infer L, ...infer R] ? L extends TReadonly ? [ReadonlyUnwrapType>, ...ReadonlyUnwrapRest>] : [L, ...ReadonlyUnwrapRest>] : []; export type OptionalUnwrapType = T extends TReadonly ? TReadonly> : T extends TOptional ? OptionalUnwrapType : T; export type OptionalUnwrapRest = T extends [infer L, ...infer R] ? L extends TOptional ? [OptionalUnwrapType>, ...OptionalUnwrapRest>] : [L, ...OptionalUnwrapRest>] : []; export type IntersectOptional = T extends [infer L, ...infer R] ? L extends TOptional> ? IntersectOptional> : false : true; export type IntersectResolve>> = IntersectOptional> extends true ? TOptional>> : TIntersect>; export type IntersectType = T extends [] ? TNever : T extends [TSchema] ? AssertType : IntersectResolve; export type UnionOptional = T extends [infer L, ...infer R] ? L extends (TOptional>) ? true : UnionOptional> : false; export type UnionResolve>> = UnionOptional> extends true ? TOptional>> : TUnion>; export type UnionType = T extends [] ? TNever : T extends [TSchema] ? AssertType : UnionResolve; 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; /** Optional annotation for readOnly */ readOnly?: boolean; /** Optional annotation for writeOnly */ writeOnly?: boolean; [prop: string]: any; } export interface TKind { [Kind]: string; } export interface TSchema extends SchemaOptions, TKind { [Readonly]?: string; [Optional]?: string; [Hint]?: string; params: unknown[]; static: unknown; } export type TAnySchema = TSchema | TAny | TArray | TAsyncIterator | TBigInt | TBoolean | TConstructor | TDate | TEnum | TFunction | TInteger | TIntersect | TIterator | TLiteral | TNot | TNull | TNumber | TObject | TPromise | TRecord | TRef | TString | TSymbol | TTemplateLiteral | TThis | TTuple | TUndefined | TUnion | TUint8Array | TUnknown | TVoid; export interface NumericOptions extends SchemaOptions { exclusiveMaximum?: N; exclusiveMinimum?: N; maximum?: N; minimum?: N; multipleOf?: N; } export interface TAny extends TSchema { [Kind]: 'Any'; static: any; } export interface ArrayOptions extends SchemaOptions { /** The minimum number of items in this array */ minItems?: number; /** The maximum number of items in this array */ maxItems?: number; /** Should this schema contain unique items */ uniqueItems?: boolean; /** A schema for which some elements should match */ contains?: TSchema; /** A minimum number of contains schema matches */ minContains?: number; /** A maximum number of contains schema matches */ maxContains?: number; } export interface TArray extends TSchema, ArrayOptions { [Kind]: 'Array'; static: Static[]; type: 'array'; items: T; } export interface TAsyncIterator extends TSchema { [Kind]: 'AsyncIterator'; static: AsyncIterableIterator>; type: 'AsyncIterator'; items: T; } export type TAwaitedRest = T extends [infer L, ...infer R] ? [TAwaited>, ...TAwaitedRest>] : []; export type TAwaited = T extends TIntersect ? TIntersect> : T extends TUnion ? TUnion> : T extends TPromise ? TAwaited : T; export interface TBigInt extends TSchema, NumericOptions { [Kind]: 'BigInt'; static: bigint; type: 'bigint'; } export interface TBoolean extends TSchema { [Kind]: 'Boolean'; static: boolean; type: 'boolean'; } export type TConstructorParameters> = Ensure>; export type TInstanceType> = T['returns']; export type TCompositeKeys = T extends [infer L, ...infer R] ? keyof Assert['properties'] | TCompositeKeys> : never; export type TCompositeIndex, K extends string[]> = K extends [infer L, ...infer R] ? { [_ in Assert]: TIndexType>; } & TCompositeIndex> : {}; export type TCompositeReduce = UnionToTuple> extends infer K ? Evaluate, Assert>> : {}; export type TComposite = TIntersect extends TIntersect ? TObject> : TObject<{}>; export type TConstructorReturnTypeResolve = Static; export type TConstructorParametersResolve = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [Static, ...TFunctionParametersResolve] : []; export type TConstructorResolve = Ensure) => TConstructorReturnTypeResolve>; export interface TConstructor extends TSchema { [Kind]: 'Constructor'; static: TConstructorResolve; type: 'Constructor'; parameters: T; returns: U; } export interface DateOptions extends SchemaOptions { /** The exclusive maximum timestamp value */ exclusiveMaximumTimestamp?: number; /** The exclusive minimum timestamp value */ exclusiveMinimumTimestamp?: number; /** The maximum timestamp value */ maximumTimestamp?: number; /** The minimum timestamp value */ minimumTimestamp?: number; /** The multiple of timestamp value */ multipleOfTimestamp?: number; } export interface TDate extends TSchema, DateOptions { [Kind]: 'Date'; static: Date; type: 'date'; } export type TEnumRecord = Record; export type TEnumValue = string | number; export type TEnumKey = string; export interface TEnum = Record> extends TSchema { [Kind]: 'Union'; [Hint]: 'Enum'; static: T[keyof T]; anyOf: TLiteral[]; } export type TExtends = (Static extends Static ? T : U) extends infer O ? UnionToTuple extends [infer X, infer Y] ? TUnion<[AssertType, AssertType]> : AssertType : never; export type TExcludeTemplateLiteralResult = UnionType; }[T]>>>; export type TExcludeTemplateLiteral = Exclude, Static> extends infer S ? TExcludeTemplateLiteralResult> : never; export type TExcludeArray = AssertRest> extends Static ? never : T[K]; }[number]>> extends infer R ? UnionType> : never; export type TExclude = T extends TTemplateLiteral ? TExcludeTemplateLiteral : T extends TUnion ? TExcludeArray : T extends U ? TNever : T; export type TExtractTemplateLiteralResult = UnionType; }[T]>>>; export type TExtractTemplateLiteral = Extract, Static> extends infer S ? TExtractTemplateLiteralResult> : never; export type TExtractArray = AssertRest> extends Static ? T[K] : never; }[number]>> extends infer R ? UnionType> : never; export type TExtract = T extends TTemplateLiteral ? TExtractTemplateLiteral : T extends TUnion ? TExtractArray : T extends U ? T : T; export type TFunctionReturnTypeResolve = Static; export type TFunctionParametersResolve = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [Static, ...TFunctionParametersResolve] : []; export type TFunctionResolve = Ensure<(...param: TFunctionParametersResolve) => TFunctionReturnTypeResolve>; export interface TFunction extends TSchema { [Kind]: 'Function'; static: TFunctionResolve; type: 'Function'; parameters: T; returns: U; } export type TIndexRest = T extends [infer L, ...infer R] ? [TIndexType, K>, ...TIndexRest, K>] : []; export type TIndexProperty = K extends keyof T ? [T[K]] : []; export type TIndexTuple = K extends keyof T ? [T[K]] : []; export type TIndexType = T extends TRecursive ? TIndexType : T extends TIntersect ? IntersectType>, TNever>>> : T extends TUnion ? UnionType>>> : T extends TObject ? UnionType>>> : T extends TTuple ? UnionType>>> : [ ]; export type TIndexRestMany = K extends [infer L, ...infer R] ? [TIndexType>, ...TIndexRestMany>] : [ ]; export type TIndex = T extends TRecursive ? TIndex : T extends TIntersect ? UnionType>> : T extends TUnion ? UnionType>> : T extends TObject ? UnionType>> : T extends TTuple ? UnionType>> : TNever; export type TIntrinsicMode = 'Uppercase' | 'Lowercase' | 'Capitalize' | 'Uncapitalize'; export type TIntrinsicTemplateLiteral = M extends ('Lowercase' | 'Uppercase') ? T extends [infer L, ...infer R] ? [TIntrinsic, M>, ...TIntrinsicTemplateLiteral, M>] : T : M extends ('Capitalize' | 'Uncapitalize') ? T extends [infer L, ...infer R] ? [TIntrinsic, M>, ...R] : T : T; export type TIntrinsicLiteral = T extends string ? M extends 'Uncapitalize' ? Uncapitalize : M extends 'Capitalize' ? Capitalize : M extends 'Uppercase' ? Uppercase : M extends 'Lowercase' ? Lowercase : string : T; export type TIntrinsicRest = T extends [infer L, ...infer R] ? [TIntrinsic, M>, ...TIntrinsicRest, M>] : []; export type TIntrinsic = T extends TTemplateLiteral ? TTemplateLiteral> : T extends TUnion ? TUnion> : T extends TLiteral ? TLiteral> : T; export interface TInteger extends TSchema, NumericOptions { [Kind]: 'Integer'; static: number; type: 'integer'; } export type TUnevaluatedProperties = undefined | TSchema | boolean; export interface IntersectOptions extends SchemaOptions { unevaluatedProperties?: TUnevaluatedProperties; } export interface TIntersect extends TSchema, IntersectOptions { [Kind]: 'Intersect'; static: TupleToIntersect<{ [K in keyof T]: Static, this['params']>; }>; type?: 'object'; allOf: [...T]; } export interface TIterator extends TSchema { [Kind]: 'Iterator'; static: IterableIterator>; type: 'Iterator'; items: T; } export type TKeyOfProperties = Discard extends infer S ? UnionToTuple<{ [K in keyof S]: TLiteral>; }[keyof S]> : [], undefined>; export type TKeyOfIndicesArray = UnionToTuple; export type TKeyOfIndices = AssertRest extends infer R ? { [K in keyof R]: TLiteral>; } : []>; export type TKeyOf = (T extends TRecursive ? TKeyOfProperties : T extends TIntersect ? TKeyOfProperties : T extends TUnion ? TKeyOfProperties : T extends TObject ? TKeyOfProperties : T extends TTuple ? TKeyOfIndices : T extends TArray ? [TNumber] : T extends TRecord ? [K] : [ ]) extends infer R ? UnionType> : never; export type TLiteralValue = boolean | number | string; export type TLiteralBoolean = TLiteral; export type TLiteralNumber = TLiteral; export type TLiteralString = TLiteral; export interface TLiteral extends TSchema { [Kind]: 'Literal'; static: T; const: T; } export interface TNever extends TSchema { [Kind]: 'Never'; static: never; not: {}; } export interface TNot extends TSchema { [Kind]: 'Not'; static: T extends TNot ? Static : unknown; not: 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 type ReadonlyOptionalPropertyKeys = { [K in keyof T]: T[K] extends TReadonly ? (T[K] extends TOptional ? K : never) : never; }[keyof T]; export type ReadonlyPropertyKeys = { [K in keyof T]: T[K] extends TReadonly ? (T[K] extends TOptional ? never : K) : never; }[keyof T]; export type OptionalPropertyKeys = { [K in keyof T]: T[K] extends TOptional ? (T[K] extends TReadonly ? never : K) : never; }[keyof T]; export type RequiredPropertyKeys = keyof Omit | ReadonlyPropertyKeys | OptionalPropertyKeys>; export type PropertiesReducer> = Evaluate<(Readonly>>> & Readonly>> & Partial>> & Required>>)>; export type PropertiesReduce = PropertiesReducer; }>; export type TPropertyKey = string | number; export type TProperties = Record; export type ObjectProperties = T extends TObject ? U : never; export type ObjectPropertyKeys = T extends TObject ? keyof U : never; export type TAdditionalProperties = undefined | TSchema | boolean; export interface ObjectOptions extends SchemaOptions { /** Additional property constraints for this object */ additionalProperties?: TAdditionalProperties; /** The minimum number of properties allowed on this object */ minProperties?: number; /** The maximum number of properties allowed on this object */ maxProperties?: number; } export interface TObject extends TSchema, ObjectOptions { [Kind]: 'Object'; static: PropertiesReduce; additionalProperties?: TAdditionalProperties; type: 'object'; properties: T; required?: string[]; } export type TOmitProperties = Evaluate>>; export type TOmitRest = AssertRest<{ [K2 in keyof T]: TOmit, K>; }>; export type TOmit = T extends TRecursive ? TRecursive> : T extends TIntersect ? TIntersect> : T extends TUnion ? TUnion> : T extends TObject ? TObject> : T; export type TParameters = Ensure>; export type TPartialObjectArray = AssertRest<{ [K in keyof T]: TPartial>; }, TObject[]>; export type TPartialRest = AssertRest<{ [K in keyof T]: TPartial>; }>; export type TPartialProperties = Evaluate) ? TReadonlyOptional : T[K] extends (TReadonly) ? TReadonlyOptional : T[K] extends (TOptional) ? TOptional : TOptional; }>>; export type TPartial = T extends TRecursive ? TRecursive> : T extends TIntersect ? TIntersect> : T extends TUnion ? TUnion> : T extends TObject ? TObject> : T; export type TPickProperties = Pick, keyof T>> extends infer R ? ({ [K in keyof R]: AssertType extends TSchema ? R[K] : never; }) : never; export type TPickRest = { [K2 in keyof T]: TPick, K>; }; export type TPick = T extends TRecursive ? TRecursive> : T extends TIntersect ? TIntersect> : T extends TUnion ? TUnion> : T extends TObject ? TObject> : T; export interface TPromise extends TSchema { [Kind]: 'Promise'; static: Promise>; type: 'Promise'; item: TSchema; } export type TRecordFromUnionLiteralString = { [_ in K['const']]: T; }; export type TRecordFromUnionLiteralNumber = { [_ in K['const']]: T; }; export type TRecordFromEnumKey, T extends TSchema> = Ensure>; export type TRecordFromUnionRest = K extends [infer L, ...infer R] ? (L extends TUnion ? TRecordFromUnionRest & TRecordFromUnionRest, T> : L extends TLiteralString ? TRecordFromUnionLiteralString & TRecordFromUnionRest, T> : L extends TLiteralNumber ? TRecordFromUnionLiteralNumber & TRecordFromUnionRest, T> : {}) : {}; export type TRecordFromUnion = Ensure>>>>; export type TRecordFromTemplateLiteralKeyInfinite = Ensure>; export type TRecordFromTemplateLiteralKeyFinite> = Ensure]: T; }>>>; export type TRecordFromTemplateLiteralKey = IsTemplateLiteralFinite extends false ? TRecordFromTemplateLiteralKeyInfinite : TRecordFromTemplateLiteralKeyFinite; export type TRecordFromLiteralStringKey = Ensure>; export type TRecordFromLiteralNumberKey = Ensure>; export type TRecordFromStringKey = Ensure>; export type TRecordFromNumberKey = Ensure>; export type TRecordFromIntegerKey = Ensure>; export type TRecordResolve = K extends TEnum ? TRecordFromEnumKey : K extends TUnion ? TRecordFromUnion : K extends TTemplateLiteral ? TRecordFromTemplateLiteralKey : K extends TLiteralString ? TRecordFromLiteralStringKey : K extends TLiteralNumber ? TRecordFromLiteralNumberKey : K extends TString ? TRecordFromStringKey : K extends TNumber ? TRecordFromNumberKey : K extends TInteger ? TRecordFromIntegerKey : TNever; export interface TRecord extends TSchema { [Kind]: 'Record'; static: Record, string | number>, Static>; type: 'object'; patternProperties: { [pattern: string]: T; }; additionalProperties: TAdditionalProperties; } export interface TThis extends TSchema { [Kind]: 'This'; static: this['params'][0]; $ref: string; } export type TRecursiveReduce = Static]>; export interface TRecursive extends TSchema { [Hint]: 'Recursive'; static: TRecursiveReduce; } export interface TRef extends TSchema { [Kind]: 'Ref'; static: Static; $ref: string; } export type TRest = T extends TIntersect ? R : T extends TUnion ? R : T extends TTuple ? R : []; export type TReturnType = T['returns']; export type TRequiredRest = AssertRest<{ [K in keyof T]: TRequired>; }>; export type TRequiredProperties = Evaluate) ? TReadonly : T[K] extends (TReadonly) ? TReadonly : T[K] extends (TOptional) ? S : T[K]; }>>; export type TRequired = T extends TRecursive ? TRecursive> : T extends TIntersect ? TIntersect> : T extends TUnion ? TUnion> : T extends TObject ? TObject> : T; export 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' | ({} & string); export type StringContentEncodingOption = '7bit' | '8bit' | 'binary' | 'quoted-printable' | 'base64' | ({} & string); export interface StringOptions extends SchemaOptions { /** The maximum string length */ maxLength?: number; /** The minimum string length */ minLength?: number; /** A regular expression pattern this string should match */ pattern?: string; /** A format this string should match */ format?: StringFormatOption; /** The content encoding for this string */ contentEncoding?: StringContentEncodingOption; /** The content media type for this string */ contentMediaType?: string; } export interface TString extends TSchema, StringOptions { [Kind]: 'String'; static: string; type: 'string'; } export type SymbolValue = string | number | undefined; export interface TSymbol extends TSchema, SchemaOptions { [Kind]: 'Symbol'; static: symbol; type: 'symbol'; } export type TTemplateLiteralDslParserUnionLiteral = T extends `${infer L}|${infer R}` ? [TLiteral>, ...TTemplateLiteralDslParserUnionLiteral] : T extends `${infer L}` ? [TLiteral>] : [ ]; export type TTemplateLiteralDslParserUnion = UnionType>; export type TTemplateLiteralDslParserTerminal = T extends 'boolean' ? TBoolean : T extends 'bigint' ? TBigInt : T extends 'number' ? TNumber : T extends 'string' ? TString : TTemplateLiteralDslParserUnion; export type TTemplateLiteralDslParserTemplate = T extends `{${infer L}}${infer R}` ? [TTemplateLiteralDslParserTerminal, ...TTemplateLiteralDslParserTemplate] : T extends `${infer L}$${infer R}` ? [TLiteral, ...TTemplateLiteralDslParserTemplate] : T extends `${infer L}` ? [TLiteral] : [ ]; export type TTemplateLiteralDslParser = Ensure, TTemplateLiteralKind[]>>>; export type IsTemplateLiteralFiniteCheck = T extends TTemplateLiteral ? IsTemplateLiteralFiniteArray> : T extends TUnion ? IsTemplateLiteralFiniteArray> : T extends TString ? false : T extends TBoolean ? false : T extends TNumber ? false : T extends TInteger ? false : T extends TBigInt ? false : T extends TLiteral ? true : false; export type IsTemplateLiteralFiniteArray = T extends [infer L, ...infer R] ? IsTemplateLiteralFiniteCheck extends false ? false : IsTemplateLiteralFiniteArray> : true; export type IsTemplateLiteralFinite = T extends TTemplateLiteral ? IsTemplateLiteralFiniteArray : false; export type TTemplateLiteralKind = TUnion | TLiteral | TInteger | TTemplateLiteral | TNumber | TBigInt | TString | TBoolean | TNever; export type TTemplateLiteralConst = T extends TUnion ? { [K in keyof U]: TTemplateLiteralUnion, Acc>; }[number] : T extends TTemplateLiteral ? `${Static}` : T extends TLiteral ? `${U}` : T extends TString ? `${string}` : T extends TNumber ? `${number}` : T extends TBigInt ? `${bigint}` : T extends TBoolean ? `${boolean}` : never; export type TTemplateLiteralUnion = T extends [infer L, ...infer R] ? `${TTemplateLiteralConst}${TTemplateLiteralUnion, Acc>}` : Acc; export type TTemplateLiteralKeyRest = Assert>, TPropertyKey[]>; export interface TTemplateLiteral extends TSchema { [Kind]: 'TemplateLiteral'; static: TTemplateLiteralUnion; type: 'string'; pattern: string; } export type DecodeProperties = { [K in keyof T]: DecodeType; }; export type DecodeRest = T extends [infer L extends TSchema, ...infer R extends TSchema[]] ? [DecodeType, ...DecodeRest] : []; export type DecodeType = (T extends TOptional ? TOptional> : T extends TReadonly ? TReadonly> : T extends TTransform ? TUnsafe : T extends TArray ? TArray> : T extends TAsyncIterator ? TAsyncIterator> : T extends TConstructor ? TConstructor, DecodeType> : T extends TEnum ? TEnum : T extends TFunction ? TFunction, DecodeType> : T extends TIntersect ? TIntersect> : T extends TIterator ? TIterator> : T extends TNot ? TNot> : T extends TObject ? TObject>> : T extends TPromise ? TPromise> : T extends TRecord ? TRecord> : T extends TRecursive ? TRecursive> : T extends TRef ? TRef> : T extends TTuple ? TTuple> : T extends TUnion ? TUnion> : T); export type TransformFunction = (value: T) => U; export interface TransformOptions { Decode: TransformFunction, O>; Encode: TransformFunction>; } export type TTransformResolve = T extends TTransform ? S : Static; export interface TTransform extends TSchema { static: TTransformResolve; [Transform]: TransformOptions; [key: string]: any; } export type TTupleRest = T extends [infer L, ...infer R] ? [Static, P>, ...TTupleRest, P>] : []; export interface TTuple extends TSchema { [Kind]: 'Tuple'; static: TTupleRest; type: 'array'; items?: T; additionalItems?: false; minItems: number; maxItems: number; } export interface TUndefined extends TSchema { [Kind]: 'Undefined'; static: undefined; type: 'undefined'; } export type TLiteralUnionReduce[]> = T extends [infer L, ...infer R] ? [Assert>['const'], ...TLiteralUnionReduce[]>>] : [ ]; export type TUnionLiteralKeyRest[]>> = T extends TUnion ? TLiteralUnionReduce[]>> : [ ]; export type TUnionTemplateLiteral> = Ensure; }[S]>, TLiteral[]>>>; 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; type: 'uint8array'; } 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: 'void'; } /** Creates an decoded static type from a TypeBox type */ export type StaticDecode = Static, P>; /** Creates an encoded static type from a TypeBox type */ export type StaticEncode = Static; /** Creates a static type from a TypeBox type */ export type Static = (T & { params: P; })['static']; export type TypeRegistryValidationFunction = (schema: TSchema, value: unknown) => boolean; /** A registry for user defined types */ export declare namespace TypeRegistry { /** Returns the entries in this registry */ function Entries(): Map>; /** Clears all user defined types */ function Clear(): void; /** Deletes a registered type */ function Delete(kind: string): boolean; /** Returns true if this registry contains this kind */ function Has(kind: string): boolean; /** Sets a validation function for a user defined type */ function Set(kind: string, func: TypeRegistryValidationFunction): void; /** Gets a custom validation function for a user defined type */ function Get(kind: string): TypeRegistryValidationFunction | undefined; } export declare class TypeBoxError extends Error { constructor(message: string); } export type FormatRegistryValidationFunction = (value: string) => boolean; /** A registry for user defined string formats */ export declare namespace FormatRegistry { /** Returns the entries in this registry */ function Entries(): Map; /** Clears all user defined string formats */ function Clear(): void; /** Deletes a registered format */ function Delete(format: string): boolean; /** Returns true if the user defined string format exists */ function Has(format: string): boolean; /** Sets a validation function for a user defined string format */ function Set(format: string, func: FormatRegistryValidationFunction): void; /** Gets a validation function for a user defined string format */ function Get(format: string): FormatRegistryValidationFunction | undefined; } /** Provides functions to type guard raw JavaScript values */ export declare namespace ValueGuard { /** Returns true if this value is an array */ function IsArray(value: unknown): value is unknown[]; /** Returns true if this value is bigint */ function IsBigInt(value: unknown): value is bigint; /** Returns true if this value is a boolean */ function IsBoolean(value: unknown): value is boolean; /** Returns true if this value is a Date object */ function IsDate(value: unknown): value is Date; /** Returns true if this value is null */ function IsNull(value: unknown): value is null; /** Returns true if this value is number */ function IsNumber(value: unknown): value is number; /** Returns true if this value is an object */ function IsObject(value: unknown): value is Record; /** Returns true if this value is string */ function IsString(value: unknown): value is string; /** Returns true if this value is a Uint8Array */ function IsUint8Array(value: unknown): value is Uint8Array; /** Returns true if this value is undefined */ function IsUndefined(value: unknown): value is undefined; } export declare class TypeGuardUnknownTypeError extends TypeBoxError { } /** Provides functions to test if JavaScript values are TypeBox types */ export declare namespace TypeGuard { /** Returns true if the given value is TAny */ function TAny(schema: unknown): schema is TAny; /** Returns true if the given value is TArray */ function TArray(schema: unknown): schema is TArray; /** Returns true if the given value is TAsyncIterator */ function TAsyncIterator(schema: unknown): schema is TAsyncIterator; /** Returns true if the given value is TBigInt */ function TBigInt(schema: unknown): schema is TBigInt; /** Returns true if the given value is TBoolean */ function TBoolean(schema: unknown): schema is TBoolean; /** Returns true if the given value is TConstructor */ function TConstructor(schema: unknown): schema is TConstructor; /** Returns true if the given value is TDate */ function TDate(schema: unknown): schema is TDate; /** Returns true if the given value is TFunction */ function TFunction(schema: unknown): schema is TFunction; /** Returns true if the given value is TInteger */ function TInteger(schema: unknown): schema is TInteger; /** Returns true if the given value is TIntersect */ function TIntersect(schema: unknown): schema is TIntersect; /** Returns true if the given value is TIterator */ function TIterator(schema: unknown): schema is TIterator; /** Returns true if the given value is a TKind with the given name. */ function TKindOf(schema: unknown, kind: T): schema is Record & { [Kind]: T; }; /** Returns true if the given value is TKind */ function TKind(schema: unknown): schema is Record & { [Kind]: string; }; /** Returns true if the given value is TLiteral */ function TLiteralString(schema: unknown): schema is TLiteral; /** Returns true if the given value is TLiteral */ function TLiteralNumber(schema: unknown): schema is TLiteral; /** Returns true if the given value is TLiteral */ function TLiteralBoolean(schema: unknown): schema is TLiteral; /** Returns true if the given value is TLiteral */ function TLiteral(schema: unknown): schema is TLiteral; /** Returns true if the given value is TNever */ function TNever(schema: unknown): schema is TNever; /** Returns true if the given value is TNot */ function TNot(schema: unknown): schema is TNot; /** Returns true if the given value is TNull */ function TNull(schema: unknown): schema is TNull; /** Returns true if the given value is TNumber */ function TNumber(schema: unknown): schema is TNumber; /** Returns true if the given value is TObject */ function TObject(schema: unknown): schema is TObject; /** Returns true if the given value is TPromise */ function TPromise(schema: unknown): schema is TPromise; /** Returns true if the given value is TRecord */ function TRecord(schema: unknown): schema is TRecord; /** Returns true if this value is TRecursive */ function TRecursive(schema: unknown): schema is { [Hint]: 'Recursive'; }; /** Returns true if the given value is TRef */ function TRef(schema: unknown): schema is TRef; /** Returns true if the given value is TString */ function TString(schema: unknown): schema is TString; /** Returns true if the given value is TSymbol */ function TSymbol(schema: unknown): schema is TSymbol; /** Returns true if the given value is TTemplateLiteral */ function TTemplateLiteral(schema: unknown): schema is TTemplateLiteral; /** Returns true if the given value is TThis */ function TThis(schema: unknown): schema is TThis; /** Returns true of this value is TTransform */ function TTransform(schema: unknown): schema is { [Transform]: TransformOptions; }; /** Returns true if the given value is TTuple */ function TTuple(schema: unknown): schema is TTuple; /** Returns true if the given value is TUndefined */ function TUndefined(schema: unknown): schema is TUndefined; /** Returns true if the given value is TUnion[]> */ function TUnionLiteral(schema: unknown): schema is TUnion; /** Returns true if the given value is TUnion */ function TUnion(schema: unknown): schema is TUnion; /** Returns true if the given value is TUint8Array */ function TUint8Array(schema: unknown): schema is TUint8Array; /** Returns true if the given value is TUnknown */ function TUnknown(schema: unknown): schema is TUnknown; /** Returns true if the given value is a raw TUnsafe */ function TUnsafe(schema: unknown): schema is TUnsafe; /** Returns true if the given value is TVoid */ function TVoid(schema: unknown): schema is TVoid; /** Returns true if this value has a Readonly symbol */ function TReadonly(schema: T): schema is TReadonly; /** Returns true if this value has a Optional symbol */ function TOptional(schema: T): schema is TOptional; /** Returns true if the given value is TSchema */ function TSchema(schema: unknown): schema is TSchema; } /** Fast undefined check used for properties of type undefined */ export declare namespace ExtendsUndefined { function Check(schema: TSchema): boolean; } export declare class TypeExtendsError extends TypeBoxError { } export declare enum TypeExtendsResult { Union = 0, True = 1, False = 2 } export declare namespace TypeExtends { function Extends(left: TSchema, right: TSchema): TypeExtendsResult; } /** Specialized Clone for Types */ export declare namespace TypeClone { /** Clones a Rest */ function Rest(schemas: [...T]): T; /** Clones a Type */ function Type(schema: T, options?: SchemaOptions): T; } export declare namespace IndexedAccessor { function Resolve(schema: TSchema, keys: TPropertyKey[], options?: SchemaOptions): TSchema; } export declare namespace Intrinsic { /** Applies an intrinsic string manipulation to the given type. */ function Map(schema: T, mode: M): TIntrinsic; } export declare namespace ObjectMap { function Map(schema: TSchema, callback: (object: TObject) => TObject, options: SchemaOptions): T; } export interface KeyResolverOptions { includePatterns: boolean; } export declare namespace KeyResolver { /** Resolves an array of keys in this schema */ function ResolveKeys(schema: TSchema, options: KeyResolverOptions): string[]; /** Resolves a regular expression pattern matching all keys in this schema */ function ResolvePattern(schema: TSchema): string; } export declare class KeyArrayResolverError extends TypeBoxError { } export declare namespace KeyArrayResolver { /** Resolves an array of string[] keys from the given schema or array type. */ function Resolve(schema: TSchema | string[]): string[]; } export declare namespace UnionResolver { /** Returns a resolved union with interior unions flattened */ function Resolve(union: TUnion): TUnion; } export declare class TemplateLiteralPatternError extends TypeBoxError { } export declare namespace TemplateLiteralPattern { function Create(kinds: TTemplateLiteralKind[]): string; } export declare namespace TemplateLiteralResolver { /** Resolves a template literal as a TUnion */ function Resolve(template: TTemplateLiteral): TString | TUnion | TLiteral; } export declare class TemplateLiteralParserError extends TypeBoxError { } export declare namespace TemplateLiteralParser { type Expression = And | Or | Const; type Const = { type: 'const'; const: string; }; type And = { type: 'and'; expr: Expression[]; }; type Or = { type: 'or'; expr: Expression[]; }; /** Parses a pattern and returns an expression tree */ function Parse(pattern: string): Expression; /** Parses a pattern and strips forward and trailing ^ and $ */ function ParseExact(pattern: string): Expression; } export declare class TemplateLiteralFiniteError extends TypeBoxError { } export declare namespace TemplateLiteralFinite { function Check(expression: TemplateLiteralParser.Expression): boolean; } export declare class TemplateLiteralGeneratorError extends TypeBoxError { } export declare namespace TemplateLiteralGenerator { function Generate(expression: TemplateLiteralParser.Expression): IterableIterator; } export declare namespace TemplateLiteralDslParser { function Parse(template_dsl: string): TTemplateLiteralKind[]; } export declare class TransformDecodeBuilder { private readonly schema; constructor(schema: T); Decode, U>>(decode: D): TransformEncodeBuilder; } export declare class TransformEncodeBuilder { private readonly schema; private readonly decode; constructor(schema: T, decode: D); Encode, StaticDecode>>(encode: E): TTransform>; } export declare class TypeBuilderError extends TypeBoxError { } export declare class TypeBuilder { /** `[Internal]` Creates a schema without `static` and `params` types */ protected Create(schema: Omit): T; /** `[Internal]` Throws a TypeBuilder error with the given message */ protected Throw(message: string): never; /** `[Internal]` Discards property keys from the given record type */ protected Discard(record: Record, keys: PropertyKey[]): any; /** `[Json]` Omits compositing symbols from this schema */ Strict(schema: T): T; } export declare class JsonTypeBuilder extends TypeBuilder { /** `[Json]` Creates a Readonly and Optional property */ ReadonlyOptional(schema: T): TReadonly>; /** `[Json]` Creates a Readonly property */ Readonly(schema: T): TReadonly; /** `[Json]` Creates an Optional property */ Optional(schema: T): TOptional; /** `[Json]` Creates an Any type */ Any(options?: SchemaOptions): TAny; /** `[Json]` Creates an Array type */ Array(schema: T, options?: ArrayOptions): TArray; /** `[Json]` Creates a Boolean type */ Boolean(options?: SchemaOptions): TBoolean; /** `[Json]` Intrinsic function to Capitalize LiteralString types */ Capitalize(schema: T, options?: SchemaOptions): TIntrinsic; /** `[Json]` Creates a Composite object type */ Composite(objects: [...T], options?: ObjectOptions): TComposite; /** `[Json]` Creates a Enum type */ Enum>(item: T, options?: SchemaOptions): TEnum; /** `[Json]` Creates a Conditional type */ Extends(left: L, right: R, trueType: T, falseType: U, options?: SchemaOptions): TExtends; /** `[Json]` Constructs a type by excluding from unionType all union members that are assignable to excludedMembers */ Exclude(unionType: L, excludedMembers: R, options?: SchemaOptions): TExclude; /** `[Json]` Constructs a type by extracting from type all union members that are assignable to union */ Extract(type: L, union: R, options?: SchemaOptions): TExtract; /** `[Json]` Returns an Indexed property type for the given keys */ Index(schema: T, keys: K, options?: SchemaOptions): AssertType; /** `[Json]` Returns an Indexed property type for the given keys */ Index)[]>(schema: T, keys: [...K], options?: SchemaOptions): TIndex>; /** `[Json]` Returns an Indexed property type for the given keys */ Index(schema: T, keys: K, options?: SchemaOptions): UnionType>; /** `[Json]` Returns an Indexed property type for the given keys */ Index(schema: T, keys: K, options?: SchemaOptions): TIndex>; /** `[Json]` Returns an Indexed property type for the given keys */ Index>(schema: T, keys: K, options?: SchemaOptions): TIndex; /** `[Json]` Returns an Indexed property type for the given keys */ Index)[]>(schema: T, keys: [...K], options?: SchemaOptions): TIndex>; /** `[Json]` Returns an Indexed property type for the given keys */ Index[]>>(schema: T, keys: K, options?: SchemaOptions): TIndex>; /** `[Json]` Returns an Indexed property type for the given keys */ Index(schema: T, key: K, options?: SchemaOptions): TSchema; /** `[Json]` Creates an Integer type */ Integer(options?: NumericOptions): TInteger; /** `[Json]` Creates an Intersect type */ Intersect(allOf: [], options?: SchemaOptions): TNever; /** `[Json]` Creates an Intersect type */ Intersect(allOf: [...T], options?: SchemaOptions): T[0]; /** `[Json]` Creates an Intersect type */ Intersect(allOf: [...T], options?: IntersectOptions): TIntersect; /** `[Json]` Creates a KeyOf type */ KeyOf(schema: T, options?: SchemaOptions): TKeyOf; /** `[Json]` Creates a Literal type */ Literal(value: T, options?: SchemaOptions): TLiteral; /** `[Json]` Intrinsic function to Lowercase LiteralString types */ Lowercase(schema: T, options?: SchemaOptions): TIntrinsic; /** `[Json]` Creates a Never type */ Never(options?: SchemaOptions): TNever; /** `[Json]` Creates a Not type */ Not(schema: T, options?: SchemaOptions): TNot; /** `[Json]` Creates a Null type */ Null(options?: SchemaOptions): TNull; /** `[Json]` Creates a Number type */ Number(options?: NumericOptions): TNumber; /** `[Json]` Creates an Object type */ Object(properties: T, options?: ObjectOptions): TObject; /** `[Json]` Constructs a type whose keys are omitted from the given type */ Omit)[]>(schema: T, keys: readonly [...K], options?: SchemaOptions): TOmit; /** `[Json]` Constructs a type whose keys are omitted from the given type */ Omit[]>>(schema: T, keys: K, options?: SchemaOptions): TOmit[number]>; /** `[Json]` Constructs a type whose keys are omitted from the given type */ Omit>(schema: T, key: K, options?: SchemaOptions): TOmit; /** `[Json]` Constructs a type whose keys are omitted from the given type */ Omit(schema: T, key: K, options?: SchemaOptions): TOmit[number]>; /** `[Json]` Constructs a type whose keys are omitted from the given type */ Omit(schema: T, key: K, options?: SchemaOptions): TOmit; /** `[Json]` Constructs a type where all properties are optional */ Partial(schema: T, options?: ObjectOptions): TPartial; /** `[Json]` Constructs a type whose keys are picked from the given type */ Pick)[]>(schema: T, keys: readonly [...K], options?: SchemaOptions): TPick; /** `[Json]` Constructs a type whose keys are picked from the given type */ Pick[]>>(schema: T, keys: K, options?: SchemaOptions): TPick[number]>; /** `[Json]` Constructs a type whose keys are picked from the given type */ Pick>(schema: T, key: K, options?: SchemaOptions): TPick; /** `[Json]` Constructs a type whose keys are picked from the given type */ Pick(schema: T, key: K, options?: SchemaOptions): TPick[number]>; /** `[Json]` Constructs a type whose keys are picked from the given type */ Pick(schema: T, key: K, options?: SchemaOptions): TPick; /** `[Json]` Creates a Record type */ Record(key: K, schema: T, options?: ObjectOptions): TRecordResolve; /** `[Json]` Creates a Recursive type */ Recursive(callback: (thisType: TThis) => T, options?: SchemaOptions): TRecursive; /** `[Json]` Creates a Ref type. The referenced type must contain a $id */ Ref(schema: T, options?: SchemaOptions): TRef; /** `[Json]` Creates a Ref type. */ Ref($ref: string, options?: SchemaOptions): TRef; /** `[Json]` Constructs a type where all properties are required */ Required(schema: T, options?: SchemaOptions): TRequired; /** `[Json]` Extracts interior Rest elements from Tuple, Intersect and Union types */ Rest(schema: T): TRest; /** `[Json]` Creates a String type */ String(options?: StringOptions): TString; /** `[Json]` Creates a TemplateLiteral type from template dsl string */ TemplateLiteral(templateDsl: T, options?: SchemaOptions): TTemplateLiteralDslParser; /** `[Json]` Creates a TemplateLiteral type */ TemplateLiteral(kinds: [...T], options?: SchemaOptions): TTemplateLiteral; /** `[Json]` Creates a Transform type */ Transform(schema: I): TransformDecodeBuilder; /** `[Json]` Creates a Tuple type */ Tuple(items: [...T], options?: SchemaOptions): TTuple; /** `[Json]` Intrinsic function to Uncapitalize LiteralString types */ Uncapitalize(schema: T, options?: SchemaOptions): TIntrinsic; /** `[Json]` Creates a Union type */ Union(anyOf: [], options?: SchemaOptions): TNever; /** `[Json]` Creates a Union type */ Union(anyOf: [...T], options?: SchemaOptions): T[0]; /** `[Json]` Creates a Union type */ Union(anyOf: [...T], options?: SchemaOptions): TUnion; /** `[Json-Experimental]` Converts a TemplateLiteral into a Union */ Union(template: T): TUnionTemplateLiteral; /** `[Json]` Creates an Unknown type */ Unknown(options?: SchemaOptions): TUnknown; /** `[Json]` Creates a Unsafe type that will infers as the generic argument T */ Unsafe(options?: UnsafeOptions): TUnsafe; /** `[Json]` Intrinsic function to Uppercase LiteralString types */ Uppercase(schema: T, options?: SchemaOptions): TIntrinsic; } export declare class JavaScriptTypeBuilder extends JsonTypeBuilder { /** `[JavaScript]` Creates a AsyncIterator type */ AsyncIterator(items: T, options?: SchemaOptions): TAsyncIterator; /** `[JavaScript]` Constructs a type by recursively unwrapping Promise types */ Awaited(schema: T, options?: SchemaOptions): TAwaited; /** `[JavaScript]` Creates a BigInt type */ BigInt(options?: NumericOptions): TBigInt; /** `[JavaScript]` Extracts the ConstructorParameters from the given Constructor type */ ConstructorParameters>(schema: T, options?: SchemaOptions): TConstructorParameters; /** `[JavaScript]` Creates a Constructor type */ Constructor(parameters: [...T], returns: U, options?: SchemaOptions): TConstructor; /** `[JavaScript]` Creates a Date type */ Date(options?: DateOptions): TDate; /** `[JavaScript]` Creates a Function type */ Function(parameters: [...T], returns: U, options?: SchemaOptions): TFunction; /** `[JavaScript]` Extracts the InstanceType from the given Constructor type */ InstanceType>(schema: T, options?: SchemaOptions): TInstanceType; /** `[JavaScript]` Creates an Iterator type */ Iterator(items: T, options?: SchemaOptions): TIterator; /** `[JavaScript]` Extracts the Parameters from the given Function type */ Parameters>(schema: T, options?: SchemaOptions): TParameters; /** `[JavaScript]` Creates a Promise type */ Promise(item: T, options?: SchemaOptions): TPromise; /** `[JavaScript]` Creates a String type from a Regular Expression pattern */ RegExp(pattern: string, options?: SchemaOptions): TString; /** `[JavaScript]` Creates a String type from a Regular Expression */ RegExp(regex: RegExp, options?: SchemaOptions): TString; /** * @deprecated Use `Type.RegExp` */ RegEx(regex: RegExp, options?: SchemaOptions): TString; /** `[JavaScript]` Extracts the ReturnType from the given Function type */ ReturnType>(schema: T, options?: SchemaOptions): TReturnType; /** `[JavaScript]` Creates a Symbol type */ Symbol(options?: SchemaOptions): TSymbol; /** `[JavaScript]` Creates a Undefined type */ Undefined(options?: SchemaOptions): TUndefined; /** `[JavaScript]` Creates a Uint8Array type */ Uint8Array(options?: Uint8ArrayOptions): TUint8Array; /** `[JavaScript]` Creates a Void type */ Void(options?: SchemaOptions): TVoid; } /** Json Type Builder with Static Resolution for TypeScript */ export declare const JsonType: JsonTypeBuilder; /** JavaScript Type Builder with Static Resolution for TypeScript */ export declare const Type: JavaScriptTypeBuilder;