TypeScript: “value assigned but never used” when calling API inside forEach and using forkJoin
08:43 19 Nov 2025

I have a TypeScript/react project where I need to call an API for each item in an array and then wait for all API calls to finish using forkJoin. My current approach uses forEach, but I get a TypeScript warning: “value assigned but never used”.

here is a snippet of my forech:

data.shipmentLines.forEach((shipmentLine) => {
if (shipmentLine.AdditionalLineFinInfo?.LineFinInfo) {
    const map = shipmentLine.AdditionalLineFinInfo.LineFinInfo.map((info) => {
    
    let map = {
    amount: info.Amount,
    currency_code: info.CurrencyCode,
    type: info.InfoType,
    date: info.Date,
    description: info.Description,

    }
    return map
})

const shipmentLineFinInfo = api(
    'PUT',           `/purchaseorders/${orderId}/products/${quantityId}/fininfo`,
   map,
    ).pipe(pluck('response'))
  }
})

and here is my return forkjoin

return forkJoin([
  purchaseOrderRequest$,
  shipmentRequest$,
  finInfoRequest$,
  shipmentLineFinInfo,
  certificates$,
  ]).pipe(
  map(() => actions.saveInboundOrderFulfilled()),
  catchError(() => of(actions.saveInboundOrderRejected())),
   )
}),
reactjs typescript