mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
feat: add "strictNullChecks"
This commit is contained in:
@@ -13,7 +13,8 @@ export const makeBusinessSocket = (config: SocketConfig) => {
|
||||
} = sock
|
||||
|
||||
const getCatalog = async(jid?: string, limit = 10) => {
|
||||
jid = jidNormalizedUser(jid || authState.creds.me?.id)
|
||||
jid = jid || authState.creds.me?.id
|
||||
jid = jidNormalizedUser(jid!)
|
||||
const result = await query({
|
||||
tag: 'iq',
|
||||
attrs: {
|
||||
@@ -52,7 +53,8 @@ export const makeBusinessSocket = (config: SocketConfig) => {
|
||||
}
|
||||
|
||||
const getCollections = async(jid?: string, limit = 51) => {
|
||||
jid = jidNormalizedUser(jid || authState.creds.me?.id)
|
||||
jid = jid || authState.creds.me?.id
|
||||
jid = jidNormalizedUser(jid!)
|
||||
const result = await query({
|
||||
tag: 'iq',
|
||||
attrs: {
|
||||
@@ -165,7 +167,7 @@ export const makeBusinessSocket = (config: SocketConfig) => {
|
||||
const productCatalogEditNode = getBinaryNodeChild(result, 'product_catalog_edit')
|
||||
const productNode = getBinaryNodeChild(productCatalogEditNode, 'product')
|
||||
|
||||
return parseProductNode(productNode)
|
||||
return parseProductNode(productNode!)
|
||||
}
|
||||
|
||||
const productCreate = async(create: ProductCreate) => {
|
||||
@@ -191,7 +193,7 @@ export const makeBusinessSocket = (config: SocketConfig) => {
|
||||
const productCatalogAddNode = getBinaryNodeChild(result, 'product_catalog_add')
|
||||
const productNode = getBinaryNodeChild(productCatalogAddNode, 'product')
|
||||
|
||||
return parseProductNode(productNode)
|
||||
return parseProductNode(productNode!)
|
||||
}
|
||||
|
||||
const productDelete = async(productIds: string[]) => {
|
||||
@@ -225,7 +227,7 @@ export const makeBusinessSocket = (config: SocketConfig) => {
|
||||
|
||||
const productCatalogDelNode = getBinaryNodeChild(result, 'product_catalog_delete')
|
||||
return {
|
||||
deleted: +productCatalogDelNode.attrs.deleted_count
|
||||
deleted: +(productCatalogDelNode?.attrs.deleted_count || 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user