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

1.6K
Vistas
A class member cannot have the 'const' keyword

I am using ts and keep getting stuck when trying to create const that can be used by just changing a simple element.keep getting A class member cannot have the 'const' keyword

code:

const LINKS = {
  Summary: 82,
  Telephone: 83
};

itemLocator(ItemId): Locator {
  const navItemSelector = `'div[id="${ItemId}"]'`
  return page.locator(itemLocator)
}

tired doing const function, and const

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The duplicate answers that suggest using readonly in the comments are valid for simple properties.

In your case, because you're using an object property, you need an additional const assertion:

class Test {
  readonly LINKS = {
    Summary: 82,
    Telephone: 83
  } as const;
}

const test = new Test();
test.LINKS = {}; // error
test.LINKS.Summary = 83; // error

Without the const assertion, you would still be able to change the value Summary and Telephone values inside LINKS.

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