import { Schema, type SchemaBase } from "../schema.js"; type WithOptionalKeys = { [K in keyof T as unknown extends T[K] ? K : [undefined] extends [T[K]] ? never : K]: T[K]; } & { [K in keyof T as unknown extends T[K] ? never : [undefined] extends [T[K]] ? K : never]?: T[K]; }; /** * Matches any non-primitive, non-null, non-undefined, value. Equivalent to `object` in TypeScript. * @example * ```ts * guard({}, $object); // ok * guard({ a: 1, b: 2 }, $object); // ok * guard(1, $object); // will throw a `TypeError`, because `1` is a `number` * guard(new Date(), $object); // ok * guard(null, $object); // will throw a `TypeError`, because `null` is not an object * ``` */ export declare const $object: Schema; /** * @param template an object with the same keys that a valid object should have, whose * values should be schemas which correspond to the values of a valid object. * @example * ```ts * guard({}, $interface({})); // ok * guard({ a: 1 }, $interface({ a: $number })); // ok * guard({ a: 1, b: 2 }, $interface({ a: $number })); // ok * guard({ a: 1 }, $interface({ a: $number, b: $number })); // throw a `TypeError`, because `b` is missing * guard({ a: 1, b: 2 }, $interface({ a: $number, b: $number })); // ok * ``` */ export declare function $interface(template: { [K in keyof T]: SchemaBase; }): Schema>; export { $interface as $type }; /** * The same as `$interface`, but will reject any object which has properties that are * unspecified by the template. * @param template an object with the same keys that a valid object should have, whose * values should be schemas which correspond to the values of a valid object. * @example * ```ts * guard({ a: 1, b: 2 }, $Exact({ a: $number })); // throws a `TypeError`; property `b` is not allowed by the schema * * // These behave the same as if we used `$interface` * guard({}, $Exact({})); // ok * guard({ a: 1 }, $Exact({ a: $number })); // ok * guard({ a: 1 }, $Exact({ a: $number, b: $number })); // throw a `TypeError`, because `b` is missing * guard({ a: 1, b: 2 }, $Exact({ a: $number, b: $number })); // ok * ``` */ export declare function $Exact(template: { [K in keyof T]: SchemaBase; }): Schema>;