chore: add type distinguisher for sockets

This commit is contained in:
Adhiraj Singh
2021-12-18 19:54:08 +05:30
parent 0057deb658
commit a723b50741
3 changed files with 4 additions and 0 deletions

View File

@@ -363,6 +363,7 @@ export const makeSocket = ({
}) })
return { return {
type: 'legacy',
ws, ws,
updateKeys: (info: { encKey: Buffer, macKey: Buffer }) => authInfo = info, updateKeys: (info: { encKey: Buffer, macKey: Buffer }) => authInfo = info,
waitForSocketOpen, waitForSocketOpen,

View File

@@ -540,6 +540,7 @@ export const makeSocket = ({
ev.on('creds.update', update => Object.assign(creds, update)) ev.on('creds.update', update => Object.assign(creds, update))
return { return {
type: 'md',
ws, ws,
ev, ev,
authState: { authState: {

View File

@@ -14,4 +14,6 @@ export { makeWALegacySocket }
export type WASocket = ReturnType<typeof makeWASocket> export type WASocket = ReturnType<typeof makeWASocket>
export type AnyWASocket = WASocket | WALegacySocket
export default makeWASocket export default makeWASocket