-
Notifications
You must be signed in to change notification settings - Fork 467
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
multiGet return type incorrect? #764
Comments
I agree it's a bit weird. const values = await AsyncStorage.multiGet([ KEY1, KEY2, KEY3 ]);
if (values) {
setSomething(values[0][1]);
} This will allow TypeScript to narrow the type to |
@tido64 thanks for your reply
Sure but is this really the case? Can this function not return anything? What I'm saying here is that the library should probably change Promise<readonly KeyValuePair[] | void> to Promise<readonly KeyValuePair[]> |
Ah… Yeah, I think you're right. I was thinking of the callback, which may return |
I created this #767 |
🎉 This issue has been resolved in version 1.16.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
What happened?
👋 while using the library I noticed that
multiGet
has this signature:I'm not sure the return type is correct
It seems like
void
doesn't make sense, if I understood correctly how it works when a value doesn't exist it will return[string null]
so theKeyValuePair[]
is always the return type, not sure in which scenario it would returnvoid
.I noticed it because Typescript is not happy when doing this
Showing this type error
Version
1.16.1
What platforms are you seeing this issue on?
System Information
Steps to Reproduce
n/a
The text was updated successfully, but these errors were encountered: