import { Trie } from "@wry/trie"; import { CommonCache } from "@wry/caches"; import { Entry } from "./entry.js"; import type { NoInfer } from "./helpers.js"; export { bindContext, noContext, nonReactive, setTimeout, asyncFromGen, Slot, } from "./context.js"; export { dep, OptimisticDependencyFunction } from "./dep.js"; export declare function defaultMakeCacheKey(...args: any[]): object; export { Trie as KeyTrie }; export type OptimisticWrapperFunction = ((...args: TArgs) => TResult) & { readonly size: number; options: OptionsWithCacheInstance; dirty: (...args: TKeyArgs) => void; dirtyKey: (key: TCacheKey | undefined) => void; peek: (...args: TKeyArgs) => TResult | undefined; peekKey: (key: TCacheKey | undefined) => TResult | undefined; forget: (...args: TKeyArgs) => boolean; forgetKey: (key: TCacheKey | undefined) => boolean; getKey: (...args: TArgs) => TCacheKey | undefined; makeCacheKey: (...args: TKeyArgs) => TCacheKey | undefined; }; export { CommonCache }; export interface CommonCacheConstructor extends Function { new >(max?: number, dispose?: (value: V, key?: K) => void): CommonCache; } export type OptimisticWrapOptions = { max?: number; keyArgs?: (...args: TArgs) => TKeyArgs; makeCacheKey?: (...args: NoInfer) => TCacheKey | undefined; normalizeResult?: (newer: TResult, older: TResult) => TResult; subscribe?: (...args: TArgs) => void | (() => any); cache?: CommonCache, Entry, NoInfer>> | CommonCacheConstructor, NoInfer, NoInfer>; }; export interface OptionsWithCacheInstance extends OptimisticWrapOptions { cache: CommonCache, Entry, NoInfer>>; } export declare function wrap(originalFunction: (...args: TArgs) => TResult, { max, keyArgs, makeCacheKey, normalizeResult, subscribe, cache: cacheOption, }?: OptimisticWrapOptions): OptimisticWrapperFunction;