Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

568
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda