-
Notifications
You must be signed in to change notification settings - Fork 341
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
Fix add listener types #246
Conversation
README.md
Outdated
@@ -313,7 +313,7 @@ Why should I use this file uploader instead of others that I've Googled like [re | |||
|
|||
# Contributing | |||
|
|||
See [CONTRIBUTING.md](https://github.com/Vydia/react-native-background-upload/CONTRIBUTING.md). | |||
See [CONTRIBUTING.md](https://github.com/Vydia/react-native-background-upload/blob/master/CONTRIBUTING.md). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just (./CONTRIBUTING.md)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 changed to ./CONTRIBUTING.md
7f29727
to
353cc6e
Compare
Update the types to account for the following 1: Can be called with `null` to include all uploads 2: Returns an `EventSubscription` instead of void Adds "@types/react-native": "^0.64.0" as a devDependency to get the correct type for `EventSubscription`
353cc6e
to
ae59f42
Compare
## [6.2.2](v6.2.1...v6.2.2) (2021-05-05) ### Bug Fixes * add listener types ([#246](#246)) ([dc67c76](dc67c76))
🎉 This PR is included in version 6.2.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
## [6.2.2](Vydia/react-native-background-upload@v6.2.1...v6.2.2) (2021-05-05) ### Bug Fixes * add listener types ([#246](Vydia/react-native-background-upload#246)) ([dc67c76](Vydia/react-native-background-upload@dc67c76))
Summary
Fix TypeScript types for the
addListener
method for two scenarios:1:
addListener
supports a nulluploadId
to include all uploads.2: return type is
EventSubscription
not voidAdds
"@types/react-native": "^0.64.x"
as a devDependency to get correct types forEventSubscription
.Examples of where these incorrect types causes issues:
1: Want to call addListener with
null
but get a typescript error2: In an instance where a reference to the returned
EventSubscription
is desired a unsafe typecast workaround is required to get to the correct typing.Current situation:
After fix:
Also fixes link to the contributing doc from readme.
Test Plan
Verify
addListener
works as expected with updated typesCompatibility
Checklist
README.md