/** * Casts types down to be less specific and also allow missing keys in Objects * CastDown<12> -> number */ declare type CastDown = T extends number ? number : T extends string ? string : T extends boolean ? boolean : T extends Record ? T & Record : T; /** * Settings React Hook. Will automatically rerender your component and * save to settings on set() */ export declare function useSettings(settings: Settings): { get(key: K, defaultValue: V): CastDown; set(key: K_1, value: V_1): void; }; /** * SettingsAPI. * For technical reasons, this class must be constructed using Settings.make, * and NOT via new. */ export declare class Settings { readonly module: string; readonly snapshot: Schema; private constructor(); /** * Construct a new Settings instance. * Accepts a Schema as generic argument which will be used to validate * and type calls to get and set * @param module Name of your module. Choose something meaningful as this will be used to * identify your settings * @returns Settings Instance */ static make(module: string): Promise>; /** * Get a settings item * @param key Key * @param defaultValue Default value to return in case no such setting exists * @returns Setting if found, otherwise the default value */ get(key: K, defaultValue: T): CastDown; /** * Set a settings item * @param key Key * @param value New value */ set(key: K, value: Schema[K]): Promise; /** * Delete a setting * @param key Key */ delete(key: K): Promise; private _persist; } export {};