fix: add 'as const' assertion to socket return types for improved type safety

This commit is contained in:
Francisco Pessano
2025-08-14 17:26:49 +00:00
committed by GitHub
parent 16633c51ea
commit 8a9fec3281
4 changed files with 6 additions and 5 deletions

View File

@@ -278,5 +278,5 @@ export const makeBusinessSocket = (config: SocketConfig) => {
productCreate,
productDelete,
productUpdate
}
} as const
}

View File

@@ -302,7 +302,7 @@ export const makeGroupsSocket = (config: SocketConfig) => {
])
},
groupFetchAllParticipating
}
} as const
}
export const extractGroupMetadata = (result: BinaryNode) => {

View File

@@ -3,10 +3,11 @@ import { UserFacingSocketConfig } from '../Types'
import { makeBusinessSocket } from './business'
// export the last socket layer
const makeWASocket = (config: UserFacingSocketConfig) =>
makeBusinessSocket({
const makeWASocket = (config: UserFacingSocketConfig) => {
return makeBusinessSocket({
...DEFAULT_CONNECTION_CONFIG,
...config
})
}
export default makeWASocket

View File

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