File tree Expand file tree Collapse file tree 5 files changed +12
-12
lines changed Expand file tree Collapse file tree 5 files changed +12
-12
lines changed Original file line number Diff line number Diff line change 1
1
# Unreleased
2
2
3
- -
3
+ - [ fixed ] Fixed optional fields in UserRecord types to be optional.
4
4
5
5
# v6.4.0
6
6
Original file line number Diff line number Diff line change @@ -186,7 +186,7 @@ export class UserRecord {
186
186
if ( typeof response . validSince !== 'undefined' ) {
187
187
validAfterTime = parseDate ( response . validSince * 1000 ) ;
188
188
}
189
- utils . addReadonlyGetter ( this , 'tokensValidAfterTime' , validAfterTime ) ;
189
+ utils . addReadonlyGetter ( this , 'tokensValidAfterTime' , validAfterTime || undefined ) ;
190
190
}
191
191
192
192
/** @return {object } The plain object representation of the user record. */
Original file line number Diff line number Diff line change @@ -104,11 +104,11 @@ declare namespace admin.auth {
104
104
105
105
interface UserRecord {
106
106
uid : string ;
107
- email : string ;
107
+ email ? : string ;
108
108
emailVerified : boolean ;
109
- displayName : string ;
110
- phoneNumber : string ;
111
- photoURL : string ;
109
+ displayName ? : string ;
110
+ phoneNumber ? : string ;
111
+ photoURL ? : string ;
112
112
disabled : boolean ;
113
113
metadata : admin . auth . UserMetadata ;
114
114
providerData : admin . auth . UserInfo [ ] ;
Original file line number Diff line number Diff line change @@ -456,7 +456,7 @@ describe('Auth', () => {
456
456
const noValidSinceExpectedUserRecord =
457
457
getValidUserRecord ( noValidSinceGetAccountInfoResponse ) ;
458
458
// Confirm null tokensValidAfterTime on user.
459
- expect ( noValidSinceExpectedUserRecord . tokensValidAfterTime ) . to . be . null ;
459
+ expect ( noValidSinceExpectedUserRecord . tokensValidAfterTime ) . to . be . undefined ;
460
460
// Simulate getUser returns the expected user with no validSince.
461
461
const getUserStub = sinon . stub ( Auth . prototype , 'getUser' )
462
462
. returns ( Promise . resolve ( noValidSinceExpectedUserRecord ) ) ;
@@ -660,7 +660,7 @@ describe('Auth', () => {
660
660
const noValidSinceExpectedUserRecord =
661
661
getValidUserRecord ( noValidSinceGetAccountInfoResponse ) ;
662
662
// Confirm null tokensValidAfterTime on user.
663
- expect ( noValidSinceExpectedUserRecord . tokensValidAfterTime ) . to . be . null ;
663
+ expect ( noValidSinceExpectedUserRecord . tokensValidAfterTime ) . to . be . undefined ;
664
664
// Simulate getUser returns the expected user with no validSince.
665
665
const getUserStub = sinon . stub ( Auth . prototype , 'getUser' )
666
666
. returns ( Promise . resolve ( noValidSinceExpectedUserRecord ) ) ;
Original file line number Diff line number Diff line change @@ -546,8 +546,8 @@ describe('UserRecord', () => {
546
546
} ) . to . throw ( Error ) ;
547
547
} ) ;
548
548
549
- it ( 'should return null tokensValidAfterTime when not available' , ( ) => {
550
- expect ( userRecordNoValidSince . tokensValidAfterTime ) . to . be . null ;
549
+ it ( 'should return undefined tokensValidAfterTime when not available' , ( ) => {
550
+ expect ( userRecordNoValidSince . tokensValidAfterTime ) . to . be . undefined ;
551
551
} ) ;
552
552
553
553
it ( 'should return expected metadata' , ( ) => {
@@ -637,8 +637,8 @@ describe('UserRecord', () => {
637
637
expect ( userRecord . toJSON ( ) ) . to . deep . equal ( getUserJSON ( ) ) ;
638
638
} ) ;
639
639
640
- it ( 'should return null tokensValidAfterTime when not available' , ( ) => {
641
- expect ( ( userRecordNoValidSince . toJSON ( ) as any ) . tokensValidAfterTime ) . to . be . null ;
640
+ it ( 'should return undefined tokensValidAfterTime when not available' , ( ) => {
641
+ expect ( ( userRecordNoValidSince . toJSON ( ) as any ) . tokensValidAfterTime ) . to . be . undefined ;
642
642
} ) ;
643
643
} ) ;
644
644
} ) ;
You can’t perform that action at this time.
0 commit comments