Typings for Firebase Admin Node.js SDK

2,113 views
Skip to first unread message

Simon Heinzle

unread,
Nov 17, 2016, 8:02:00 AM11/17/16
to Firebase Google Group
I have trouble getting the TypeScript typings for Firebase Admin Node.js SDK (NPM firebase-admin).

Typings for some parts such as FirebaseApp work, but I cannot get admin.database() to return the correct type. Looking into "lib/firebase-app.d.ts" it seems like auth() and database() both return a FirebaseServiceInterface type, which does not reflect the methods that are actually included in auth and database JS.

As workaround, I am using "any" for these return types - but it would be nice to have the correct typings. 

Does anybody has pointers to how get the correct typings?

Jacob Wenger

unread,
Nov 17, 2016, 2:29:02 PM11/17/16
to fireba...@googlegroups.com
Hey Simon,

Sorry for the troubles! This is actually a known issue. I am having some issues getting the typings for the Database SDK together properly due to the way we include the code for it. I am working on it though and hope to have a solution for it in one of our upcoming weekly releases.

Please keep an eye on the release notes for the Firebase Admin Node.js SDK. I'll make sure to make a note of it when I get the typings working properly.

Sorry for the inconvenience.

Cheers,
Jacob

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/ee1e6493-8b6d-430c-bbc1-6e5bf3820f65%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon Heinzle

unread,
Nov 18, 2016, 8:17:55 AM11/18/16
to Firebase Google Group
Hi Jacob,

Thanks for the quick response! Keep up your great work, I really appreciate it.

Cheers,
Simon


On Thursday, November 17, 2016 at 8:29:02 PM UTC+1, Jacob Wenger wrote:
Hey Simon,

Sorry for the troubles! This is actually a known issue. I am having some issues getting the typings for the Database SDK together properly due to the way we include the code for it. I am working on it though and hope to have a solution for it in one of our upcoming weekly releases.

Please keep an eye on the release notes for the Firebase Admin Node.js SDK. I'll make sure to make a note of it when I get the typings working properly.

Sorry for the inconvenience.

Cheers,
Jacob
On Thu, Nov 17, 2016 at 2:55 AM, Simon Heinzle <si...@gimalon.com> wrote:
I have trouble getting the TypeScript typings for Firebase Admin Node.js SDK (NPM firebase-admin).

Typings for some parts such as FirebaseApp work, but I cannot get admin.database() to return the correct type. Looking into "lib/firebase-app.d.ts" it seems like auth() and database() both return a FirebaseServiceInterface type, which does not reflect the methods that are actually included in auth and database JS.

As workaround, I am using "any" for these return types - but it would be nice to have the correct typings. 

Does anybody has pointers to how get the correct typings?

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.

Morgan O'Neal

unread,
Dec 12, 2016, 2:41:53 PM12/12/16
to Firebase Google Group
Any update on when the typings are going to be available?

Jacob Wenger

unread,
Dec 12, 2016, 4:32:12 PM12/12/16
to fireba...@googlegroups.com
Hey Morgan, no updates, sorry. This has been lower priority than some other work that is going on with the Admin SDKs. It is on our radar though but I wouldn't expect to see this before the end of year. Sorry I don't have better news!

Cheers,
Jacob

To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.

To post to this group, send email to fireba...@googlegroups.com.

Jacob Wenger

unread,
Jan 17, 2017, 6:20:28 PM1/17/17
to Jacob Wenger, fireba...@googlegroups.com
Hey Morgan, Simon, and others,

We published version 4.0.5 of the Firebase Admin Node.js SDK earlier today which includes a bunch of improvements to our TypeScript typings, including full typings for the Realtime Database API as well as a handful of other fixes for incorrect or incomplete typings. As far as I'm aware, we've addressed every known issue. Please give them a shot and let us know how they work!

Cheers,
Jacob

David Vorriccelli

unread,
Jan 27, 2017, 4:02:43 PM1/27/17
to Firebase Google Group, ja...@firebase.com
Hey Jacob, Thanks for getting the type definitions for us. I think there may be some missing bits: 

Seems the `admin.auth.UserRecord` doesn't believe that it implements `.toJson()`. Here's a screenshot of the sig that I'm getting for admin.auth.UserRecord. 



Thanks for checking in on this :) 

Jacob Wenger

unread,
Jan 27, 2017, 4:49:19 PM1/27/17
to Firebase Google Group, ja...@firebase.com
Hey David,

Yup, looks like there is a missing method in the typings. The method is called toJSON() (with all capitals). It also looks like it is missing from the UserRecord reference documentation. I'll get both of those things fixed ASAP. Updated typings should go out with next week's release. In the meantime, you should be able to use the as any trick to get TypeScript to stop complaining:

(user as any).toJSON();

Thanks for brining this to our attention!

Cheers,
Jacob
Reply all
Reply to author
Forward
0 new messages