Skip to content

Commit 97d7c83

Browse files
committed
Better types for auth.makeUserRecord
1 parent db5f2d3 commit 97d7c83

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/providers/auth.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,19 @@
2222

2323
import { auth } from 'firebase-functions';
2424

25+
type PartialWithoutToJSON<T> = Partial<Omit<T, 'toJSON'>>;
26+
type PartialUserRecord = Omit<
27+
PartialWithoutToJSON<auth.UserRecord>,
28+
'metadata' | 'providerData'
29+
> & {
30+
metadata?: PartialWithoutToJSON<auth.UserRecordMetadata>;
31+
providerData?: Array<PartialWithoutToJSON<auth.UserInfo>>;
32+
};
33+
2534
/** Create a UserRecord. */
2635
export function makeUserRecord(
2736
/** Fields of AuthRecord that you'd like to specify. */
28-
fields: { [key: string]: string | boolean }
37+
fields: PartialUserRecord
2938
): auth.UserRecord {
3039
return auth.userRecordConstructor(Object.assign({ uid: '' }, fields));
3140
}

0 commit comments

Comments
 (0)