mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: add 'as const' assertion to socket return types for improved type safety
This commit is contained in:
committed by
GitHub
parent
16633c51ea
commit
8a9fec3281
@@ -278,5 +278,5 @@ export const makeBusinessSocket = (config: SocketConfig) => {
|
|||||||
productCreate,
|
productCreate,
|
||||||
productDelete,
|
productDelete,
|
||||||
productUpdate
|
productUpdate
|
||||||
}
|
} as const
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ export const makeGroupsSocket = (config: SocketConfig) => {
|
|||||||
])
|
])
|
||||||
},
|
},
|
||||||
groupFetchAllParticipating
|
groupFetchAllParticipating
|
||||||
}
|
} as const
|
||||||
}
|
}
|
||||||
|
|
||||||
export const extractGroupMetadata = (result: BinaryNode) => {
|
export const extractGroupMetadata = (result: BinaryNode) => {
|
||||||
|
|||||||
@@ -3,10 +3,11 @@ import { UserFacingSocketConfig } from '../Types'
|
|||||||
import { makeBusinessSocket } from './business'
|
import { makeBusinessSocket } from './business'
|
||||||
|
|
||||||
// export the last socket layer
|
// export the last socket layer
|
||||||
const makeWASocket = (config: UserFacingSocketConfig) =>
|
const makeWASocket = (config: UserFacingSocketConfig) => {
|
||||||
makeBusinessSocket({
|
return makeBusinessSocket({
|
||||||
...DEFAULT_CONNECTION_CONFIG,
|
...DEFAULT_CONNECTION_CONFIG,
|
||||||
...config
|
...config
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export default makeWASocket
|
export default makeWASocket
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ export const makeNewsletterSocket = (sock: GroupsSocket) => {
|
|||||||
newsletterDelete: async (jid: string) => {
|
newsletterDelete: async (jid: string) => {
|
||||||
await executeWMexQuery({ newsletter_id: jid }, QueryIds.DELETE, XWAPaths.xwa2_newsletter_delete_v2)
|
await executeWMexQuery({ newsletter_id: jid }, QueryIds.DELETE, XWAPaths.xwa2_newsletter_delete_v2)
|
||||||
}
|
}
|
||||||
}
|
} as const
|
||||||
}
|
}
|
||||||
|
|
||||||
export type NewsletterSocket = ReturnType<typeof makeNewsletterSocket>
|
export type NewsletterSocket = ReturnType<typeof makeNewsletterSocket>
|
||||||
|
|||||||
Reference in New Issue
Block a user