import type { Fn } from '@toolbox-ts/types'; import type { CheckGuard, CheckNotGuard, ExclusiveTypeGuard, IsGuard, IsNotGuard, TypeGuard } from '@toolbox-ts/types/defs/function'; export declare const createNames: (typeName: N) => { check: `checkIs${Capitalize}`; is: `is${Capitalize}`; type: Capitalize; }; export declare const createTypeNames: (domain: D, names: N[]) => { [K in N]: `${Capitalize}${Capitalize}`; } & { _: D; }; export declare const createGuard: (name: Name, typeName: TypeName, fn: F) => { readonly name: Name; readonly typeName: TypeName; } & F; export declare const createCheckGuard: (typeName: TypeName, fn: F) => { readonly typeName: Capitalize; readonly name: `checkIs${Capitalize}`; } & F; export declare const createGenericIsGuards: (typeName: TypeName, fn: F) => { is: { readonly name: `is${Capitalize}`; readonly typeName: TypeName; } & F; check: { readonly name: `checkIs${Capitalize}`; readonly typeName: TypeName; } & (F extends (v: unknown, ...args: infer A) => v is unknown ? (v: unknown, ...args: A) => boolean : never); }; export type IsGuardPair = { is: TypeGuard, N>; check: TypeGuard, N>; }; /** * Creates a pair of type guards: `isX` and `checkIsX`. * * @param name - The base name for the type guards. * @param is - The implementation of the `isX` guard. * @returns An object containing the `isX` and `checkIsX` guards. * * @example * ```ts * const { isString, checkIsString } = createIsGuards('string', (v): v is string => typeof v === 'string'); * * isString('hello'); // true * checkIsString(123); // false * ``` */ export declare function createIsGuards(name: Name, is: IsGuard): IsGuardPair; export type NotGuardPair = { not: ExclusiveTypeGuard, N>; checkNot: ExclusiveTypeGuard, N>; }; /** * Creates a pair of negated type guards: `isNotX` and `checkIsNotX`. * * @param name - The base name for the type guards. Exclude the "Not" prefix, it is added automatically. * @param isNot - The implementation of the `isNotX` guard. * @returns An object containing the `isNotX` and `checkIsNotX` guards. * @example * ```ts * const { isNotString, checkIsNotString } = createIsNotGuards('string', (v): v is not string => typeof v !== 'string'); * * isNotString(123); // true * checkIsNotString('hello'); // false * ``` * */ export declare function createIsNotGuards(name: Name, isNot: (v: V, ...args: A) => v is Exclude): NotGuardPair; export declare const createIsAndIsNotGuards: (name: Name, is: IsGuard, isNot?: IsNotGuard) => NotGuardPair & IsGuardPair;