import * as T from '@sinclair/typebox'; import { PatternNeverExact, PatternNumberExact, PatternStringExact } from '@sinclair/typebox/type'; import type * as t from '@traversable/registry'; import type { HKT } from '@traversable/registry'; export interface Index { path: (keyof any)[]; isOptional: boolean; isProperty: boolean; varName?: string; } export interface CompilerIndex extends Omit { dataPath: (string | number)[]; isOptional: boolean; isProperty: boolean; schemaPath: (keyof any)[]; varName: string; } export declare const defaultIndex: { path: never[]; isOptional: false; isProperty: false; }; export declare const defaultCompilerIndex: { dataPath: never[]; schemaPath: never[]; varName: string; path: never[]; isOptional: false; isProperty: false; }; export declare const isNullary: (x: unknown) => x is Type.Nullary; export type TypeName = typeof TypeName[keyof typeof TypeName]; export declare const TypeName: { readonly never: "Never"; readonly any: "Any"; readonly unknown: "Unknown"; readonly void: "Void"; readonly null: "Null"; readonly undefined: "Undefined"; readonly symbol: "Symbol"; readonly boolean: "Boolean"; readonly integer: "Integer"; readonly bigInt: "BigInt"; readonly number: "Number"; readonly string: "String"; readonly literal: "Literal"; readonly anyOf: "anyOf"; readonly allOf: "allOf"; readonly optional: "Optional"; readonly array: "Array"; readonly record: "Record"; readonly tuple: "Tuple"; readonly object: "Object"; readonly date: "Date"; }; export declare const TypeNames: ("string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "anyOf" | "allOf" | "never" | "any" | "unknown" | "void" | "null" | "integer" | "bigInt" | "literal" | "optional" | "array" | "record" | "tuple" | "date")[]; export declare function tagged(typeName: Name): (x: unknown) => x is Type.Catalog[Name]; export declare function isOptional(x: unknown): x is Type.Optional; export declare namespace Type { interface Never { [T.Kind]: 'Never'; } interface Any { [T.Kind]: 'Any'; } interface Unknown { [T.Kind]: 'Unknown'; } interface Void { [T.Kind]: 'Void'; } interface Null { [T.Kind]: 'Null'; } interface Undefined { [T.Kind]: 'Undefined'; } interface Symbol { [T.Kind]: 'Symbol'; } interface Boolean { [T.Kind]: 'Boolean'; } interface Date { [T.Kind]: 'Date'; } interface Literal { [T.Kind]: 'Literal'; const: string | number | boolean; } interface Integer extends Integer.Bounds { [T.Kind]: 'Integer'; } namespace Integer { interface Bounds { minimum?: number; maximum?: number; multipleOf?: number; } } interface BigInt extends BigInt.Bounds { [T.Kind]: 'BigInt'; } namespace BigInt { interface Bounds { minimum?: bigint; maximum?: bigint; multipleOf?: bigint; } } interface Number extends Number.Bounds { [T.Kind]: 'Number'; } namespace Number { interface Bounds { exclusiveMinimum?: number; exclusiveMaximum?: number; minimum?: number; maximum?: number; multipleOf?: number; } } interface String extends String.Bounds { [T.Kind]: 'String'; } namespace String { interface Bounds { minLength?: number; maxLength?: number; } } interface Array extends Array.Bounds { [T.Kind]: 'Array'; items: S; } namespace Array { interface Bounds { minItems?: number; maxItems?: number; } } interface Optional { [T.Kind]: 'Optional'; schema: S; } interface Record { [T.Kind]: 'Record'; patternProperties: Record.PatternProperties; } namespace Record { type PatternProperties = { [PatternStringExact]: S; [PatternNumberExact]: S; [PatternNeverExact]: S; }; } interface Tuple { [T.Kind]: 'Tuple'; items: S[]; } interface Object { [T.Kind]: 'Object'; properties: { [x: string]: S; }; required: string[]; } interface Union { [T.Kind]: 'Union'; anyOf: S[]; } interface Intersect { [T.Kind]: 'Intersect'; allOf: S[]; } type Nullary = Type.Never | Type.Any | Type.Unknown | Type.Void | Type.Null | Type.Undefined | Type.Symbol | Type.Boolean | Type.Integer | Type.BigInt | Type.Number | Type.String | Type.Literal | Type.Date; type Unary = Type.Array | Type.Record | Type.Optional | Type.Tuple | Type.Union | Type.Intersect | Type.Object; interface Free extends HKT { [-1]: F; } type F = Type.Nullary | Type.Unary; type Fixpoint = Type.Nullary | Type.Array | Type.Record | Type.Optional | Type.Tuple | Type.Union | Type.Intersect | Type.Object; type Catalog = { never: Type.Never; any: Type.Any; unknown: Type.Unknown; void: Type.Void; null: Type.Null; undefined: Type.Undefined; symbol: Type.Symbol; boolean: Type.Boolean; integer: Type.Integer; bigInt: Type.BigInt; number: Type.Number; string: Type.String; date: Type.Date; literal: Type.Literal; anyOf: Type.Union; allOf: Type.Intersect; optional: Type.Optional; array: Type.Array; record: Type.Record; tuple: Type.Tuple; object: Type.Object; }; } export declare const Functor: t.Functor.Ix; export declare const CompilerFunctor: t.Functor.Ix; export type Algebra = { (src: Type.F, ix?: Index): T; (src: Partial, ix?: Index): T; (src: Type.F, ix?: Index): T; }; export declare function fold(g: (src: Type.F, ix: Index, x: T.TSchema) => T): Algebra; export declare const compile: (g: (src: Type.F, ix: CompilerIndex, x: Type.F) => T) => (src: Type.F, ix?: CompilerIndex) => T; //# sourceMappingURL=functor.d.ts.map