import { Schema } from "../schema.js"; /** * lazy allows you to reference identifiers that may not exist yet when you're * defining your schema by constructing it at validation time. Use this whenever * a schema needs to reference itself, participate in a cycle of schemas, or * when a type might not be available (ie. checking for a Node/browser specific * constructor). * * Recursive schemas built with `lazy` are safe against self-referential values. * * @example * ```ts * type Friend = { name: string; friends: Friend[] }; * const $Friend = $interface({ * name: $string, * friends: $Array(lazy(() => $Friend)), * }); * * const me = { name: "me", friends: [] }; * me.friends.push(me); // circular references are fine * is(me, $Friend); // true * ``` * * @remarks * Cycle protection only applies to recursion that goes through `lazy`. Raw * user-defined predicates (`new Schema((x) => $X.check(x))`) that re-enter * themselves without going through `lazy` will certainly stack-overflow. Use * `Schema` directly at your own risk. */ export declare function lazy(func: () => Schema): Schema;