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

140
Visualizações
How to extend a parent's property in child

I have the following code:

class Table {
    get pagination () {
        return {
            get item () {
                return {
                    log (s : string) {
                        console.log(s);
                    }
                }
            }
        }
    }
}
class TableWithFirst extends Table {
    get pagination () {
        return {
            ...super.pagination,
            get first () {
                this.item.log("first");
                return "first";
            }
        }
    }
}
const t = new TableWithFirst();
t.pagination.first

and with this code, I get the error below:

[ERR]: "Executed JavaScript Failed:" 
[ERR]: Cannot read properties of undefined (reading 'log') 

How do I add first getter to pagination? Is moving that logic into a class the only way?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

If you don't need to support older browsers you can change compilation target to ES2018 (or higher) so spread syntax won't be transpiled.

Playground


Regarding TestCafe, here you can find how to customize typescript compiler options used by its runner (it won't pick up standard tsconfig file).

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