import type { CBORSchemaType } from "./type.js"; /** * Creates a schema for optional values that might be undefined * * @template T The type when the value is present * @param schema Schema for the value when present * * @example * ```typescript * import { cs } from "../cbor_schema.ts"; * const optionalNumberSchema = cs.optional(cs.float); * const encoded1 = cs.toCBOR(optionalNumberSchema, 42); * const encoded2 = cs.toCBOR(optionalNumberSchema, undefined); * const decoded1 = cs.fromCBOR(optionalNumberSchema, encoded1); // 42 * const decoded2 = cs.fromCBOR(optionalNumberSchema, encoded2); // undefined * ``` */ export declare function optional(schema: CBORSchemaType): CBORSchemaType; //# sourceMappingURL=optional.d.ts.map