import { Jsonifiable } from "type-fest"; /** * The shape of the {@link save} namespace. * * Declared rather than left as a bare index signature: typed as * `Record` every member was swallowed by the index, so * `save.add` came out as `unknown` and could not be CALLED at all under * `strict` — the namespace's own documented example did not typecheck — while * every registered key read back as `unknown` and needed a cast to compare or * assign. * * The index signature stays, so anything registered elsewhere is still * reachable; declared members simply take precedence over it. */ export interface SaveAPI { /** * Add new keys to localStorage and set them to the given default values if * they do not exist. * @param props - key and corresponding values * @returns this namespace, typed with the keys just registered, so they can * be read back without a cast * @example * // Initialize "score" and "lives" with default values * me.save.add({ score : 0, lives : 3 }); * // get or set the value through me.save * me.save.score = 1000; * @example * // or keep the returned view, and read the keys with their real types * const store = me.save.add({ score : 0, lives : 3 }); * store.lives -= 1; */ add>(props: T): this & T; /** * Remove a key from localStorage * @param key - key to be removed * @example * // Remove the "score" key from localStorage * me.save.remove("score"); */ remove(key: string): void; /** keys registered through {@link SaveAPI.add} */ [key: string]: unknown; } declare const save: SaveAPI; export default save; //# sourceMappingURL=save.d.ts.map