From 0104bf87fe3a13f4884574fddbb6d90d2daa110d Mon Sep 17 00:00:00 2001 From: Francisco Pessano <76450203+FranP-code@users.noreply.github.com> Date: Thu, 14 Aug 2025 17:35:08 +0000 Subject: [PATCH] fix: add 'any' return type to socket creation functions for improved type safety --- src/Socket/business.ts | 4 ++-- src/Socket/groups.ts | 4 ++-- src/Socket/index.ts | 2 +- src/Socket/newsletter.ts | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Socket/business.ts b/src/Socket/business.ts index e3ea374..bd1e474 100644 --- a/src/Socket/business.ts +++ b/src/Socket/business.ts @@ -11,7 +11,7 @@ import { BinaryNode, jidNormalizedUser, S_WHATSAPP_NET } from '../WABinary' import { getBinaryNodeChild } from '../WABinary/generic-utils' import { makeMessagesRecvSocket } from './messages-recv' -export const makeBusinessSocket = (config: SocketConfig) => { +export const makeBusinessSocket = (config: SocketConfig): any => { const sock = makeMessagesRecvSocket(config) const { authState, query, waUploadToServer } = sock @@ -278,5 +278,5 @@ export const makeBusinessSocket = (config: SocketConfig) => { productCreate, productDelete, productUpdate - } as const + } } diff --git a/src/Socket/groups.ts b/src/Socket/groups.ts index 3fa34a4..e830527 100644 --- a/src/Socket/groups.ts +++ b/src/Socket/groups.ts @@ -20,7 +20,7 @@ import { } from '../WABinary' import { makeChatsSocket } from './chats' -export const makeGroupsSocket = (config: SocketConfig) => { +export const makeGroupsSocket = (config: SocketConfig): any => { const sock = makeChatsSocket(config) const { authState, ev, query, upsertMessage } = sock @@ -302,7 +302,7 @@ export const makeGroupsSocket = (config: SocketConfig) => { ]) }, groupFetchAllParticipating - } as const + } } export const extractGroupMetadata = (result: BinaryNode) => { diff --git a/src/Socket/index.ts b/src/Socket/index.ts index 6df924e..e4cf641 100644 --- a/src/Socket/index.ts +++ b/src/Socket/index.ts @@ -3,7 +3,7 @@ import { UserFacingSocketConfig } from '../Types' import { makeBusinessSocket } from './business' // export the last socket layer -const makeWASocket = (config: UserFacingSocketConfig) => { +const makeWASocket = (config: UserFacingSocketConfig): any => { return makeBusinessSocket({ ...DEFAULT_CONNECTION_CONFIG, ...config diff --git a/src/Socket/newsletter.ts b/src/Socket/newsletter.ts index 3592eec..8ede3b4 100644 --- a/src/Socket/newsletter.ts +++ b/src/Socket/newsletter.ts @@ -40,7 +40,7 @@ const parseNewsletterMetadata = (result: unknown): NewsletterMetadata | null => return null } -export const makeNewsletterSocket = (sock: GroupsSocket) => { +export const makeNewsletterSocket = (sock: GroupsSocket): any => { const { query, generateMessageTag } = sock const executeWMexQuery = (variables: Record, queryId: string, dataPath: string): Promise => { @@ -221,7 +221,7 @@ export const makeNewsletterSocket = (sock: GroupsSocket) => { newsletterDelete: async (jid: string) => { await executeWMexQuery({ newsletter_id: jid }, QueryIds.DELETE, XWAPaths.xwa2_newsletter_delete_v2) } - } as const + } } export type NewsletterSocket = ReturnType