-
Notifications
You must be signed in to change notification settings - Fork 875
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
Firebase storage UploadTask callback type requires all callbacks #3158
Labels
Comments
@nicholaschiang Thanks for this report. I will take a look and see if we can fix this without breaking the API. |
Pending review: #3224 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
Steps to reproduce:
The
UploadTask
callback type doesn't match what is documented here:But the
UploadTask
callback parameter type seems to require all three callbacks (i.e. it needs an object withnext
,complete
, anderror
fields).Relevant Code:
So I've called the
UploadTask
on()
method using an object containing theerror
andcomplete
callbacks as follows:But the
UploadTask.prototype.on()
type seems to require all three callbacks as I'm getting this Typescript error:And the relevant
UploadTask.prototype.on()
type is defined innode_modules/firebase/index.d.ts
as follows:Where a
firebase.Observer
is defined as:Recommended fix
The fix here should be pretty easy. Just change the parameter in line 7582 of
index.d.ts
to be aPartial
offirebase.Observer
as follows:This will make all of those callbacks optional. Though note that this is not a perfect solution, as your documentation specifies that at least one callback should be provided:
I'm sure that there's a way to do that with Typescript's built-in utility types though (I just don't want to try to figure it how right now because it's your job haha).
The text was updated successfully, but these errors were encountered: