import { createProxy } from "../proxy/createProxy"; import { FreezeOnce, UnFreeze } from "../helpers/freeze"; import { JSONPatch, Patch } from "./patches"; import { Primitive } from "../helpers/types"; export declare type DraftableState = T | FreezeOnce; export declare type Producer = (draft: UnFreeze) => IS_ASYNC extends true ? Promise : Q | void; export declare type ProduceOptions = { proxify?: typeof createProxy; }; export declare type DiscardVoid = Q extends void ? T : Q; export declare type ProduceReturn = IS_ASYNC extends true ? Promise>> : DiscardVoid extends Promise ? never : FreezeOnce>; export declare type PatchCallback = T extends Primitive ? never : (patches: Patch[] | JSONPatch[], inversePatches: Patch[] | JSONPatch[]) => void; export declare const NOTHING: {}; export declare function produce(state: DraftableState, producer: Producer, patchCallback?: PatchCallback, { proxify }?: ProduceOptions): ProduceReturn; export declare function produceWithPatches(state: DraftableState, producer: Producer): readonly [ProduceReturn, Patch[], Patch[]]; export declare function asyncProduceWithPatches(state: DraftableState, producer: Producer): Promise>, Patch[], Patch[]]>; export declare const safeProduce: (...args: Parameters>) => ReturnType>; export declare const safeProduceWithPatches: (...args: Parameters>) => ReturnType>; export declare const asyncProduce: (...args: Parameters>) => ReturnType>; export declare const asyncSafeProduce: (...args: Parameters>) => ReturnType>; export declare const asyncSafeProduceWithPatches: (...args: Parameters>) => ReturnType>;