Skip to content

Instantly share code, notes, and snippets.

@muuki88
Created September 14, 2018 08:15
Show Gist options
  • Save muuki88/690c4b6c6b76fc22d737ed7d9e2b72b8 to your computer and use it in GitHub Desktop.
Save muuki88/690c4b6c6b76fc22d737ed7d9e2b72b8 to your computer and use it in GitHub Desktop.
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