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

565
Views
getting error Parsing error: Expression expected

I am getting error:

Parsing error: Expression expected

Here is my code base:

    export interface TableRow {
      rowKey: string;
      rowCells: {[key: string]: any};
      rowExpanded?: React.ReactNode;
    }
class MvSortTable extends React.Component<Props, State> {
 ...
      toggleAllRows = () => {
        const shouldExpand = this.allRowsCollapsed(this.state.expandedRows);
        const expandedRows: {[key: string]: boolean} = {};
    
        this.props.rows?.forEach((row) => {
         expandedRows[row.rowKey] = shouldExpand;
        });
    
        this.setState({ expandedRows, allRowsCollapsed: !shouldExpand });
      }
...

Error come from when I add ? into this.props.rows...

How can I fix this error?????

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

It could be a problem related to:

  • your installed TypeScript compiler version (see Typescript optional chaining error: Expression expected.ts(1109))

OR

  • some Prettier/ESlint extensions related issue (see Angular: Expression expected in vscode)
about 4 years ago · Juan Pablo Isaza Report

0

If anyone else is facing this issue you might want to check the eslint-plugin-prettier in your package.json.

I recently stumbled upon this issue and I found that the project I was working on was on the older version.

Just upgrade eslint-plugin-prettier, at the time of writing this the latest version is 4.0.0

Cheers!!

about 4 years ago · Juan Pablo Isaza Report
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!