import { IType, IAnyType, IAnyStateTreeNode, IAnyComplexType, IMaybe, ReferenceIdentifier, IStateTreeNode } from "../../internal"; export declare type OnReferenceInvalidatedEvent = { parent: IAnyStateTreeNode; invalidTarget: STN | undefined; invalidId: ReferenceIdentifier; replaceRef: (newRef: STN | null | undefined) => void; removeRef: () => void; cause: "detach" | "destroy" | "invalidSnapshotReference"; }; export declare type OnReferenceInvalidated = (event: OnReferenceInvalidatedEvent) => void; /** @hidden */ export declare type ReferenceT = IT["TypeWithoutSTN"] & IStateTreeNode>; export interface ReferenceOptionsGetSet { get(identifier: ReferenceIdentifier, parent: IAnyStateTreeNode | null): ReferenceT; set(value: ReferenceT, parent: IAnyStateTreeNode | null): ReferenceIdentifier; } export interface ReferenceOptionsOnInvalidated { onInvalidated: OnReferenceInvalidated>; } export declare type ReferenceOptions = ReferenceOptionsGetSet | ReferenceOptionsOnInvalidated | (ReferenceOptionsGetSet & ReferenceOptionsOnInvalidated); /** @hidden */ export interface IReferenceType extends IType { } /** * `types.reference` - Creates a reference to another type, which should have defined an identifier. * See also the [reference and identifiers](https://github.com/mobxjs/mobx-state-tree#references-and-identifiers) section. */ export declare function reference(subType: IT, options?: ReferenceOptions): IReferenceType; /** * Returns if a given value represents a reference type. * * @param type * @returns */ export declare function isReferenceType>(type: IT): type is IT; export declare function safeReference(subType: IT, options: (ReferenceOptionsGetSet | {}) & { acceptsUndefined: false; onInvalidated?: OnReferenceInvalidated>; }): IReferenceType; export declare function safeReference(subType: IT, options?: (ReferenceOptionsGetSet | {}) & { acceptsUndefined?: boolean; onInvalidated?: OnReferenceInvalidated>; }): IMaybe>;