feat: add "strictNullChecks"

This commit is contained in:
Adhiraj Singh
2022-07-08 10:38:25 +05:30
parent 7426b7aa2f
commit 40a1e268aa
42 changed files with 350 additions and 339 deletions

View File

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