-
Notifications
You must be signed in to change notification settings - Fork 378
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
ThenableReference returning PromiseLike - should be Promise? #144
Comments
Hey there! I couldn't figure out what this issue is about, so I've labeled it for a human to triage. Hang tight. |
Hmmm this issue does not seem to follow the issue template. Make sure you provide all the required information. |
@jshcrowthe wdyt? |
Just following up on this, @jshcrowthe - push() seems to return a ThenableReference rather than a Promise. Is there a reason for this? ThenableReference doesn't have declarations for catch, so not totally sure why it wouldn't be a Promise too? |
I am probably the wrong guy for the "why?" question here. I'll reassign to @schmidt-sebastian who can probably give us a better clue of what is going on. |
@stevejcox |
When we use .catch() for .push() - SDK tells we're wrong! |
The ES6 type definition for PromiseLike is as follows:
This is a little hard to read, but it basically states that you can register an error callback as the second argument to your .then() callback. You can try something like this:
Note that the RTDB JS SDK uses PromiseLike in some cases to keep backwards compatibility. |
Thanks a lot, my bad to not following a reference. |
Yeah This is the Solution (y) Happy! |
It looks like when the RTDB were put back in with pr: #140 the interface of ThenableReference changed form extending
Promise<any>
toPromiseLike<any>
.Is there a reason for this?
PromiseLike does not include a catch declaration for typescript - and so is causing an error. I believe this should be Promise ?
The text was updated successfully, but these errors were encountered: