firebase-admin-node icon indicating copy to clipboard operation
firebase-admin-node copied to clipboard

Prototype for moving internally used types to dedicated internal classes in Auth

Open MathBunny opened this issue 5 years ago • 2 comments

When using autogenerated typing, some types/classes are exported but not intended to be used publicly. Formerly this was implemented by not including the types in the d.ts file, but now since they're autogenerated we have the option of either:

  1. Denoting the type using the undocumented strip-internal @internal annotation
  2. Split it off into another file that is not exported via the barrel export

This PR explores the second option for the Auth module. While the typings are still generated, users will not be able to import them regularly via the firebase-admin/auth import.

Edit: I still have yet to do user-record and tenant

MathBunny avatar Jul 06 '20 15:07 MathBunny

Finished the entire auth service. I didn't run into any issues when doing the conversion, except functions with default parameters. For those I wasn't able to set the default value inside the interface, and instead overloaded the function. I'm going to look into alternatives now.

MathBunny avatar Jul 09 '20 19:07 MathBunny

Okay, turns out in TypeScript you cannot have default parameter values for declared functions. Instead, I denoted the parameter as optional using ? which eliminates the need to overload.

Edit: On second thought, this is also consistent with the former d.ts file so I think this is the right approach.

MathBunny avatar Jul 09 '20 19:07 MathBunny