@epic-web/cachified
Version:
neat wrapper for various caches
12 lines (11 loc) • 875 B
TypeScript
import { CachifiedOptions, CachifiedOptionsWithSchema } from './common';
import { CreateReporter } from './reporter';
type PartialOptions<Options extends CachifiedOptions<any>, OptionalKeys extends string | number | symbol> = Omit<Options, OptionalKeys> & Partial<Pick<Options, Extract<OptionalKeys, keyof Options>>>;
/**
* create a pre-configured version of cachified
*/
export declare function configure<ConfigureValue extends unknown, Opts extends Partial<CachifiedOptions<ConfigureValue>>>(defaultOptions: Opts, defaultReporter?: CreateReporter<ConfigureValue>): {
<Value, InternalValue>(options: PartialOptions<CachifiedOptionsWithSchema<Value, InternalValue>, keyof Opts>, reporter?: CreateReporter<Value>): Promise<Value>;
<Value>(options: PartialOptions<CachifiedOptions<Value>, keyof Opts>, reporter?: CreateReporter<Value>): Promise<Value>;
};
export {};