Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
KeyValue Storage - Typed Keys
type UserStorageKey = 'setting1' | 'setting2' | 'setting3';
interface UserStorage {
/** set a value for a specific key */
set(key: UserStorageKey, value: string): void;
/** get the value for a specific key. If not present return null*/
get(key: UserStorageKey): string | null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment