## API Report File for "@tldraw/validate" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts import { IndexKey } from '@tldraw/utils'; import { JsonValue } from '@tldraw/utils'; // @public const any: Validator; // @public const array: Validator; // @public function arrayOf(itemValidator: Validatable): ArrayOfValidator; // @public (undocumented) export class ArrayOfValidator extends Validator { constructor(itemValidator: Validatable); // (undocumented) readonly itemValidator: Validatable; // (undocumented) lengthGreaterThan1(): Validator; // (undocumented) nonEmpty(): Validator; } // @public const bigint: Validator; // @public const boolean: Validator; // @public function dict(keyValidator: Validatable, valueValidator: Validatable): DictValidator; // @public (undocumented) export class DictValidator extends Validator> { constructor(keyValidator: Validatable, valueValidator: Validatable); // (undocumented) readonly keyValidator: Validatable; // (undocumented) readonly valueValidator: Validatable; } // @public const indexKey: Validator; // @public const integer: Validator; // @public function jsonDict(): DictValidator; // @public const jsonValue: Validator; // @public const linkUrl: Validator; // @public function literal(expectedValue: T): Validator; // @public (undocumented) function literalEnum(...values: Values): Validator; // @public function model(name: string, validator: Validatable): Validator; // @public const nonZeroInteger: Validator; // @public const nonZeroNumber: Validator; // @public (undocumented) function nullable(validator: Validatable): Validator; // @public const number: Validator; // @internal (undocumented) function numberUnion>(key: Key, config: Config): UnionValidator; // @public function object(config: { readonly [K in keyof Shape]: Validatable; }): ObjectValidator<{ [P in ExtractRequiredKeys]: Shape[P]; } & { [P in ExtractOptionalKeys]?: Shape[P]; }>; // @public (undocumented) export class ObjectValidator extends Validator { constructor(config: { readonly [K in keyof Shape]: Validatable; }, shouldAllowUnknownProperties?: boolean); // (undocumented) allowUnknownProperties(): ObjectValidator; // (undocumented) readonly config: { readonly [K in keyof Shape]: Validatable; }; extend>(extension: { readonly [K in keyof Extension]: Validatable; }): ObjectValidator; } // @public (undocumented) function optional(validator: Validatable): Validator; // @public const positiveInteger: Validator; // @public const positiveNumber: Validator; // @public (undocumented) function setEnum(values: ReadonlySet): Validator; // @public const srcUrl: Validator; // @public const string: Validator; declare namespace T { export { literal, arrayOf, object, jsonDict, dict, union, numberUnion, model, setEnum, optional, nullable, literalEnum, ValidatorFn, ValidatorUsingKnownGoodVersionFn, Validatable, ValidationError, TypeOf, Validator, ArrayOfValidator, ObjectValidator, UnionValidator, DictValidator, unknown, any, string, number, positiveNumber, nonZeroNumber, integer, positiveInteger, nonZeroInteger, boolean, bigint, array, unknownObject, jsonValue, linkUrl, srcUrl, indexKey } } export { T } // @public (undocumented) type TypeOf> = V extends Validatable ? T : never; // @public function union>(key: Key, config: Config): UnionValidator; // @public (undocumented) export class UnionValidator, UnknownValue = never> extends Validator | UnknownValue> { constructor(key: Key, config: Config, unknownValueValidation: (value: object, variant: string) => UnknownValue, useNumberKeys: boolean); // (undocumented) validateUnknownVariants(unknownValueValidation: (value: object, variant: string) => Unknown): UnionValidator; } // @public const unknown: Validator; // @public (undocumented) const unknownObject: Validator>; // @public (undocumented) interface Validatable { // (undocumented) validate: (value: unknown) => T; validateUsingKnownGoodVersion?: (knownGoodValue: T, newValue: unknown) => T; } // @public (undocumented) class ValidationError extends Error { constructor(rawMessage: string, path?: ReadonlyArray); // (undocumented) name: string; // (undocumented) readonly path: ReadonlyArray; // (undocumented) readonly rawMessage: string; } // @public (undocumented) export class Validator implements Validatable { constructor(validationFn: ValidatorFn, validateUsingKnownGoodVersionFn?: undefined | ValidatorUsingKnownGoodVersionFn); check(name: string, checkFn: (value: T) => void): Validator; // (undocumented) check(checkFn: (value: T) => void): Validator; isValid(value: unknown): value is T; nullable(): Validator; optional(): Validator; refine(otherValidationFn: (value: T) => U): Validator; validate(value: unknown): T; // (undocumented) validateUsingKnownGoodVersion(knownGoodValue: T, newValue: unknown): T; // (undocumented) readonly validateUsingKnownGoodVersionFn?: undefined | ValidatorUsingKnownGoodVersionFn; // (undocumented) readonly validationFn: ValidatorFn; } // @public (undocumented) type ValidatorFn = (value: unknown) => T; // @public (undocumented) type ValidatorUsingKnownGoodVersionFn = (knownGoodValue: In, value: unknown) => Out; // (No @packageDocumentation comment for this package) ```