## 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'; import { MakeUndefinedOptional } from '@tldraw/utils'; // @public const any: Validator; // @public const array: Validator; // @public function arrayOf(itemValidator: Validatable): ArrayOfValidator; // @public export class ArrayOfValidator extends Validator { constructor(itemValidator: Validatable); // (undocumented) readonly itemValidator: Validatable; lengthGreaterThan1(): Validator; nonEmpty(): Validator; } // @public const bigint: Validator; // @public const boolean: Validator; // @public function dict(keyValidator: Validatable, valueValidator: Validatable): DictValidator; // @public export class DictValidator extends Validator> { constructor(keyValidator: Validatable, valueValidator: Validatable); // (undocumented) readonly keyValidator: Validatable; // (undocumented) readonly valueValidator: Validatable; } // @public const httpUrl: Validator; // @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 function literalEnum(...values: Values): Validator; // @public function model(name: string, validator: Validatable): Validator; // @public const nonZeroFiniteNumber: Validator; // @public const nonZeroInteger: Validator; // @public const nonZeroNumber: Validator; // @public function nullable(validator: Validatable): Validator; // @public const number: Validator; // @internal function numberUnion>(key: Key, config: Config): UnionValidator; // @public function object(config: { readonly [K in keyof Shape]: Validatable; }): ObjectValidator>; // @public export class ObjectValidator extends Validator { constructor(config: { readonly [K in keyof Shape]: Validatable; }, shouldAllowUnknownProperties?: boolean); allowUnknownProperties(): ObjectValidator; // (undocumented) readonly config: { readonly [K in keyof Shape]: Validatable; }; extend>(extension: { readonly [K in keyof Extension]: Validatable; }): ObjectValidator; } // @public function optional(validator: Validatable): Validator; // @public function or(v1: Validatable, v2: Validatable): Validator; // @public const positiveInteger: Validator; // @public const positiveNumber: Validator; // @public 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, or, ValidatorFn, ValidatorUsingKnownGoodVersionFn, Validatable, ValidationError, TypeOf, Validator, ArrayOfValidator, ObjectValidator, UnionValidatorConfig, UnionValidator, DictValidator, unknown, any, string, number, positiveNumber, nonZeroNumber, nonZeroFiniteNumber, unitInterval, integer, positiveInteger, nonZeroInteger, boolean, bigint, array, unknownObject, jsonValue, linkUrl, srcUrl, httpUrl, indexKey } } export { T } // @public type TypeOf> = V extends Validatable ? T : never; // @public function union>(key: Key, config: Config): UnionValidator; // @public export class UnionValidator, UnknownValue = never> extends Validator | UnknownValue> { constructor(key: Key, config: Config, unknownValueValidation: (value: object, variant: string) => UnknownValue, useNumberKeys: boolean); validateUnknownVariants(unknownValueValidation: (value: object, variant: string) => Unknown): UnionValidator; } // @public export type UnionValidatorConfig = { readonly [Variant in keyof Config]: Validatable & { validate(input: any): { readonly [K in Key]: Variant; }; }; }; // @public const unitInterval: Validator; // @public const unknown: Validator; // @public const unknownObject: Validator>; // @public interface Validatable { validate(value: unknown): T; validateUsingKnownGoodVersion?(knownGoodValue: T, newValue: unknown): T; } // @public class ValidationError extends Error { constructor(rawMessage: string, path?: ReadonlyArray); // (undocumented) name: string; // (undocumented) readonly path: ReadonlyArray; // (undocumented) readonly rawMessage: string; } // @public export class Validator implements Validatable { constructor(validationFn: ValidatorFn, validateUsingKnownGoodVersionFn?: undefined | ValidatorUsingKnownGoodVersionFn, skipSameValueCheck?: boolean); check(name: string, checkFn: (value: T) => void): Validator; check(checkFn: (value: T) => void): Validator; isValid(value: unknown): value is T; nullable(): Validator; optional(): Validator; refine(otherValidationFn: (value: T) => U): Validator; // @internal (undocumented) readonly skipSameValueCheck: boolean; validate(value: unknown): T; validateUsingKnownGoodVersion(knownGoodValue: T, newValue: unknown): T; // (undocumented) readonly validateUsingKnownGoodVersionFn?: undefined | ValidatorUsingKnownGoodVersionFn; // (undocumented) readonly validationFn: ValidatorFn; } // @public type ValidatorFn = (value: unknown) => T; // @public type ValidatorUsingKnownGoodVersionFn = (knownGoodValue: In, value: unknown) => Out; // (No @packageDocumentation comment for this package) ```