ThenableReference returning PromiseLike - should be Promise?
See original GitHub issueIt looks like when the RTDB were put back in with pr: https://github.com/firebase/firebase-admin-node/pull/140 the interface of ThenableReference changed form extending Promise<any>
to PromiseLike<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<any> ?
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
typescript - firebase thenable reference return handling
interface ThenableReference extends firebase.database. ... @returns A Promise for the completion of which ever callback is executed.
Read more >ThenableReference returning PromiseLike - should be Promise?
Coming soon: A brand new website interface for an even better experience!
Read more >ThenableReference | Firebase JavaScript API reference
Reference for ThenableReference. ... of the remove to the Firebase servers will also be started, and the returned Promise will resolve when complete....
Read more >https://unpkg.com/firebase@5.0.2/index.d.ts
Reference, PromiseLike<any> {} function enableLogging( logger?: boolean | ((a: ... If this fails, enablePersistence() will reject the promise it returns.
Read more >PromiseLike | typescript - v3.7.7
Optional onrejected: function | undefined | null. The callback to execute when the Promise is rejected. Returns PromiseLike<TResult1 | TResult2>.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
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?