-
Notifications
You must be signed in to change notification settings - Fork 408
Closed
Labels
Description
- Operating System version: Mac OS 11.2.3
- Firebase SDK version: 9.7.0
- Firebase Product: auth
- Node.js version: 12.21.0
- NPM version: 7.7.0
[REQUIRED] Step 3: Describe the problem
Typescript types are incorrect for CreateMultiFactorInfoRequest and CreatePhoneMultiFactorInfoRequest in admin.auth.createUser. I expect to be able to pass in a phone number but am not allowed by the type system. Instead, I have to cast the type as any.
Steps to reproduce:
admin.auth.createUser({
displayName: 'somebody',
email: '[email protected]'
emailVerified: true,
multiFactor: { enrolledFactors: [{ factorId: 'phone', phoneNumber: request.phoneNumber }] }
}
This yields the error
You can work around this by casting the object to an any, but the type system is still wrong here.
This was also raised in #1048 but for some reason that ticket was closed by the OP.
As a side-note, it feels like the code was written by someone who thought that extending a typescript interface would mean that instances of the derived class can be passed in instead of the base class, but with structural typing, this is not allowed.
