From 95e4a7839514c97f96a3e1c1b8ed1420df365494 Mon Sep 17 00:00:00 2001 From: Paul Munteanu Date: Sun, 23 May 2021 06:19:11 +0300 Subject: [PATCH 1/2] Fix compilation with strictNullChecks: true --- src/models/Event.ts | 2 +- src/models/User.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/models/Event.ts b/src/models/Event.ts index d4c00812..6f2a7444 100644 --- a/src/models/Event.ts +++ b/src/models/Event.ts @@ -53,7 +53,7 @@ export interface ReadyEventData { flags: bigint; mfa_enabled: boolean; nsfw_allowed: boolean; - phone: string; + phone: string | null; premium: boolean; premium_type: number; verified: boolean; diff --git a/src/models/User.ts b/src/models/User.ts index 8cec334b..6c69d589 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -16,7 +16,7 @@ export interface User { username: string; // username max length 32, min 2 discriminator: string; // #0001 4 digit long string from #0001 - #9999 avatar: string | null; // hash of the user avatar - phone?: string; // phone number of the user + phone: string | null; // phone number of the user desktop: boolean; // if the user has desktop app installed mobile: boolean; // if the user has mobile app installed premium: boolean; // if user bought nitro @@ -27,7 +27,7 @@ export interface User { mfa_enabled: boolean; // if multi factor authentication is enabled created_at: Date; // registration date verified: boolean; // if the user is offically verified - email?: string; // email of the user + email: string; // email of the user flags: bigint; // UserFlags public_flags: bigint; user_settings: UserSettings; @@ -57,7 +57,7 @@ export interface PublicUser { id: string; discriminator: string; username: string; - avatar?: string; + avatar: string | null; public_flags: bigint; } From a6e68abbdcc6d5df3fb8fdf95a5cb8de82213f2e Mon Sep 17 00:00:00 2001 From: Diego Magdaleno Date: Sun, 23 May 2021 11:41:36 -0500 Subject: [PATCH 2/2] Models: User can have a NULL email in case it is an unclaimed account --- src/models/User.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/User.ts b/src/models/User.ts index 6c69d589..2b4f43b9 100644 --- a/src/models/User.ts +++ b/src/models/User.ts @@ -27,7 +27,7 @@ export interface User { mfa_enabled: boolean; // if multi factor authentication is enabled created_at: Date; // registration date verified: boolean; // if the user is offically verified - email: string; // email of the user + email: string | null; // email of the user flags: bigint; // UserFlags public_flags: bigint; user_settings: UserSettings;