From 5e746e3588e13af3deccfdc18d7782cbd417ab9c Mon Sep 17 00:00:00 2001 From: Rich Hodgkins Date: Mon, 9 Aug 2021 09:41:40 +0100 Subject: [PATCH] Better types for auth.makeUserRecord --- src/providers/auth.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/providers/auth.ts b/src/providers/auth.ts index 3261597..c29068a 100644 --- a/src/providers/auth.ts +++ b/src/providers/auth.ts @@ -22,10 +22,19 @@ import { auth } from 'firebase-functions'; +type PartialWithoutToJSON = Partial>; +type PartialUserRecord = Omit< + PartialWithoutToJSON, + 'metadata' | 'providerData' +> & { + metadata?: PartialWithoutToJSON; + providerData?: Array>; +}; + /** Create a UserRecord. */ export function makeUserRecord( /** Fields of AuthRecord that you'd like to specify. */ - fields: { [key: string]: string | boolean } + fields: PartialUserRecord ): auth.UserRecord { return auth.userRecordConstructor(Object.assign({ uid: '' }, fields)); }