fix: add 'any' return type to socket creation functions for improved type safety

This commit is contained in:
Francisco Pessano
2025-08-14 17:35:08 +00:00
committed by GitHub
parent 8a9fec3281
commit 0104bf87fe
4 changed files with 7 additions and 7 deletions

View File

@@ -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
}
}

View File

@@ -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) => {

View File

@@ -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

View File

@@ -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 = <T>(variables: Record<string, unknown>, queryId: string, dataPath: string): Promise<T> => {
@@ -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<typeof makeNewsletterSocket>