Created
September 14, 2018 08:15
-
-
Save muuki88/690c4b6c6b76fc22d737ed7d9e2b72b8 to your computer and use it in GitHub Desktop.
KeyValue Storage - Typed Keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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