-
Notifications
You must be signed in to change notification settings - Fork 88
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
feat: handle defaultValue not undefined typing #508
feat: handle defaultValue not undefined typing #508
Conversation
Hello @Ostromecky Regarding your question about listening to storage events that may return undefined. It would be great if we document this part (in the docs, as it may lead to bugs in the future), and also let's always add undefined in the type if the synchronisation is enabled, this way, the user always will have to check for undefined in that case. What do you think? |
c2824f8
to
aa80de1
Compare
docs/src/content/docs/utilities/Injectors/inject-local-storage.md
Outdated
Show resolved
Hide resolved
@all-contributors please add @Ostromecky for code |
I've put up a pull request to add @Ostromecky! 🎉 |
Thanks @Ostromecky 💯 |
It was a pleasure to become a part of something bigger :) |
Link to the issue: #506
This is my first contribution to an Open Source project—the issue was labeled as a "Good First Issue."
This implementation aims to allow the compiler to differentiate between the provided arguments, ensuring that the correct code block is returned with the appropriate type. I used function overloading to handle different implementations.
My main concern is the interpretation of defaultValue. While it could be used as fallback data for initialValue, the issue is that we also listen for storage events, which might return an undefined value. I'm also unsure about the naming conventions.
I'm grateful for every remark and comment.