import { AnyDocumentId } from '@automerge/automerge-repo/slim'; import { ChangeFn, ChangeOptions, Doc } from '@automerge/automerge/slim'; /** * A hook which returns a document and a function to change it. * Uses React Suspense for loading states, returning a tuple matching useState pattern. * * @example * ```tsx * function Counter() { * const [doc, changeDoc] = useDocument<{ count: number }>(docUrl) * return ( * * ) * } * * // Must be wrapped in Suspense boundary * }> * * * ``` */ interface UseDocumentSuspendingParams { suspense: true; } interface UseDocumentSynchronousParams { suspense: false; } export type UseDocumentReturn = [ Doc, (changeFn: ChangeFn, options?: ChangeOptions) => void ]; export declare function useDocument(id: AnyDocumentId, params: UseDocumentSuspendingParams): UseDocumentReturn; export declare function useDocument(id: AnyDocumentId | undefined, params?: UseDocumentSynchronousParams): UseDocumentReturn | [undefined, () => void]; export {}; //# sourceMappingURL=useDocument.d.ts.map