import { ReceiveType } from './reflection/reflection.js'; import { Guard, Serializer } from './serializer/serializer.js'; import { ValidationErrorItem } from './validator.js'; /** * Fast type guard. Returns true if data matches type T. * Ignores extra/unknown keys. No error details. * * Generated code uses pure && chain: `return typeof s0 === "object" && ...` * * @example * ```typescript * if (is(data)) { * console.log(data.name); // data is User * } * ``` * * @deprecated signature: `is(data, serializer, errors, type)` - use `is(data, type)` instead */ export declare function is(data: unknown, receiveType?: ReceiveType): data is T; /** * @deprecated Use `is(data, type)` for fast type guard, or use `validate()` from validator.ts for error collection. */ export declare function is(data: unknown, serializerToUse?: Serializer, errors?: ValidationErrorItem[], receiveType?: ReceiveType): data is T; /** * Pre-compiled fast type guard for repeated use. * * @example * ```typescript * const isUser = typeGuard(); * items.filter(isUser); // Fast filtering * ``` */ export declare function typeGuard(receiveType?: ReceiveType): (data: unknown) => data is T; /** * Strict type guard. Returns true only if data matches type T exactly. * Rejects extra/unknown keys. No error details. * * This corresponds to "assertStrict" in typescript-runtime-type-benchmarks. * * @example * ```typescript * isStrict<{ name: string }>({ name: 'John' }); // true * isStrict<{ name: string }>({ name: 'John', x: 1 }); // false (unknown key 'x') * ``` */ export declare function isStrict(data: unknown, receiveType?: ReceiveType): data is T; /** * Pre-compiled strict type guard for repeated use. * Rejects extra/unknown keys. * * @example * ```typescript * const isUserStrict = typeGuardStrict(); * isUserStrict({ name: 'John', age: 30 }); // true * isUserStrict({ name: 'John', age: 30, x: 1 }); // false * ``` */ export declare function typeGuardStrict(receiveType?: ReceiveType): (data: unknown) => data is T; /** * Weak type guard. Returns true if data matches type T. * Skips NaN checks for maximum performance. Allows extra/unknown keys. * * This is the fastest validation mode - use when you trust your data won't * contain NaN values, or when NaN is acceptable for number fields. * * Generated code uses pure && chain without NaN checks: * `return typeof s0 === "object" && typeof s0.age === "number" && ...` * * @example * ```typescript * isWeak<{ age: number }>({ age: 30 }); // true * isWeak<{ age: number }>({ age: NaN }); // true (NaN not rejected!) * is<{ age: number }>({ age: NaN }); // false (regular is() rejects NaN) * ``` */ export declare function isWeak(data: unknown, receiveType?: ReceiveType): data is T; /** * Pre-compiled weak type guard for repeated use. * Skips NaN checks for maximum performance. * * @example * ```typescript * const isUserWeak = typeGuardWeak(); * items.filter(isUserWeak); // Fastest filtering, but NaN passes * ``` */ export declare function typeGuardWeak(receiveType?: ReceiveType): (data: unknown) => data is T; export declare function assert(data: unknown, receiveType?: ReceiveType): asserts data is T; /** * @deprecated Use `assert(data, type)` instead. */ export declare function assert(data: unknown, serializerToUse?: Serializer, receiveType?: ReceiveType): asserts data is T; /** * @deprecated Use `is()` for fast type guard, or `validate()` from validator.ts for error collection. * * ```typescript * // Old: * const validator = getValidatorFunction(); * const valid = validator(data, {errors}); * * // New (fast type guard): * const valid = is(data); * * // New (with error collection): * import { validate } from '../index.js'; * const errors = validate(data); * const valid = errors.length === 0; * ``` */ export declare function getValidatorFunction(serializerToUse?: Serializer, receiveType?: ReceiveType): Guard; /** * @deprecated Use `typeGuard()` instead. */ export declare function guard(serializerToUse?: Serializer, receiveType?: ReceiveType): Guard;