Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

566
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda