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

126
Visualizações
Getter is not present for class setter ***

I developed sample Dto as follows. But it generated some errors.

import { Shop } from "@post-pricing/library/lib/src/orm/typeorm/entity";
import { parse } from "@post-pricing/library/lib/src/utility/date"

export class ShopTransactionsDto {
    private event;
    private shopInfo:Shop;
    private transaction;

    constructor(){
        this.event = null;
        this.shopInfo = null;
        this.transaction = null;
    }

    set setEvent(event) {
        this.event = event
    }

    get getEvent() {
        return this.event
    }

    set setShopInfo(shopInfo:Shop){
        this.shopInfo = shopInfo
    }

    get getShopInfo() {
        return this.shopInfo
    }

    set setTransaction(transaction) {
        this.transaction = transaction
    }

}

One of errors is follows. I set getter in my class. what it the root cause of this?

  15:5  error  Getter is not present for class setter 'setEvent'        accessor-pairs
  23:5  error  Getter is not present for class setter 'setShopInfo'     accessor-pairs
  31:5  error  Getter is not present for class setter 'setTransaction'

If someone has opinion,please let me know. Thanks

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

0

accessor-pairs linter you use requires a getter and a setter to have the same name, eg:

    set event(event) {
        this._event = event // note the field was renamed
    }

    get event() {
        return this._event
    }

References:

  • https://eslint.org/docs/latest/rules/accessor-pairs#enforceforclassmembers
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