react-native-mmkv-storage
react-native-mmkv-storage copied to clipboard
Using TypeScript the docs don´t work
Describe the bug Just giving a copy and paste in the code in the cods using the hook useMMKVStorage() 1° - const MMKV: MMKVStorage.API = new MMKVLoader().initialize() TS say: 'MMKVStorage' refers to a value, but is being used as a type here. Did you mean 'typeof MMKVStorage' but using typeof MMKVStorage.API this returns error 2° - const [value, setValue] = useStorage(' ') - When i press CTRL+SPACE, to see the options, this returns nothing
Hacks When i just use ----> key: 'clientList' | 'totalDay' | 'totalMonth' ------ Without the LiteralUnion the TS returns my 3 options
Screenshots
THIS WORKS
FIX
Doing this, will work, but keeping the (U =string), if i put any string inside my hook this wont send error because U accepts string too.
Platform Information:
- OS: [e.g. iOS/Android]
- React Native Version [e.g. 0.64]
- Library Version [e.g. 0.8]
For issue the first issue MMKVLoader().initialize()
returns type MMKVInstance