From 7c6ae14710f8932f99babd0e63751fb77acb223c Mon Sep 17 00:00:00 2001 From: alina sireneva Date: Fri, 6 Dec 2024 04:27:31 +0300 Subject: [PATCH] fix(core): FullChat#bio is now non-nullable --- packages/core/src/highlevel/types/peers/chat.ts | 5 ++++- packages/core/src/highlevel/types/peers/full-chat.ts | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/core/src/highlevel/types/peers/chat.ts b/packages/core/src/highlevel/types/peers/chat.ts index 09b29afb..a3badd2f 100644 --- a/packages/core/src/highlevel/types/peers/chat.ts +++ b/packages/core/src/highlevel/types/peers/chat.ts @@ -291,13 +291,14 @@ export class Chat { /** * Title, for supergroups, channels and groups + * (`null` for private chats) */ get title(): string | null { return this.peer._ !== 'user' ? this.peer.title ?? null : null } /** - * Username, for private chats, bots, supergroups and channels if available + * Username, for private chats, bots, supergroups and channels (if available) */ get username(): string | null { if (!('username' in this.peer)) return null @@ -320,6 +321,7 @@ export class Chat { /** * First name of the other party in a private chat, * for private chats and bots + * (`null` for supergroups and channels) */ get firstName(): string | null { return this.peer._ === 'user' ? this.peer.firstName ?? null : null @@ -327,6 +329,7 @@ export class Chat { /** * Last name of the other party in a private chat, for private chats + * (`null` for supergroups and channels) */ get lastName(): string | null { return this.peer._ === 'user' ? this.peer.lastName ?? null : null diff --git a/packages/core/src/highlevel/types/peers/full-chat.ts b/packages/core/src/highlevel/types/peers/full-chat.ts index 87d0cdcc..a84a6485 100644 --- a/packages/core/src/highlevel/types/peers/full-chat.ts +++ b/packages/core/src/highlevel/types/peers/full-chat.ts @@ -138,8 +138,8 @@ export class FullChat extends Chat { * Bio of the other party in a private chat, or description of a * group, supergroup or channel. */ - get bio(): string | null { - return this.fullPeer?.about ?? null + get bio(): string { + return this.fullPeer.about ?? '' } /**