Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

240
Views
javascript typescript, foreach loop error - x has no call signatures

I am getting an error on my forEach loop in javascript using typescript.

This expression is not callable. Type 'TradeData[]' has no call signatures.

using redux I call an api to download data in this format

export interface TradeData {
  id: number;
  filedate: Date;
  poffic: string;
  pacct: string;
  quantity: number;
  sector: string;
  psdsC1: string;
  name: string;
  bbsymbol: string;
  last_price: number;
  deltasettlement: number;
}

then I use reduce to group that data by a certain property

  React.useEffect(() => {
    const doGetTrades = async () => {
      const unansweredQuestions = await getTrades();
      dispatch(gotTradesAction(unansweredQuestions));

      const result = unansweredQuestions.reduce<Record<string, TradeData[]>>(
        (groupedAccounts, trade) => {
          const account = trade.bbsymbol;
          if (groupedAccounts[account] == null) {
            groupedAccounts[account] = [];
          }
          groupedAccounts[account].push(trade);
          return groupedAccounts;
        },
        {} as Record<string, TradeData[]>
      );
      console.log("result");
      console.log(result);

      console.log("foreach");
      result.forEach(function (value) {
        console.log(value);
      });
    };
    doGetTrades();

now I am trying to cycle through that returned array "result". First with a simple foreach loop, and logging to console window. I am getting an error which I believe is due to typescript but I do not know the proper way to define.

Can someone please assist to show me how to handle?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!