import type { CBORSchemaType } from "./type.js"; /** * Creates a lazy schema that defers schema resolution until runtime. * This is useful for recursive type definitions. * Unfortunately, type inference is hard for recursive schemas, * so an explicit type annotation is recommended. * * @template T The type of the schema * @param schemaFn A function that returns the schema * @returns A schema that will resolve the actual schema at runtime * * @example * ```typescript * import { cs, type valueOf } from "../cbor_schema.ts"; * import { type ExtendableMapSchema } from "./type.ts"; * // Define a recursive schema for a tree structure * type Tree = { * value: string; * children: Tree[]; * } * let treeSchema : ExtendableMapSchema = cs.map([ * cs.field("value", cs.string), * cs.field("children", cs.array(cs.lazy(() => treeSchema))) * ]); * ``` */ export declare function lazy(schemaFn: () => CBORSchemaType): CBORSchemaType; //# sourceMappingURL=lazy.d.ts.map