Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using TypeScript the docs don´t work #304

Open
ViniDevBR opened this issue Jan 5, 2023 · 1 comment
Open

Using TypeScript the docs don´t work #304

ViniDevBR opened this issue Jan 5, 2023 · 1 comment

Comments

@ViniDevBR
Copy link

ViniDevBR commented Jan 5, 2023

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
image

THIS WORKS
image
image

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.
image

Platform Information:

  • OS: [e.g. iOS/Android]
  • React Native Version [e.g. 0.64]
  • Library Version [e.g. 0.8]
@Mookiies
Copy link
Contributor

Mookiies commented Jul 6, 2023

For issue the first issue MMKVLoader().initialize() returns type MMKVInstance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants