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

204
Vistas
Property does not exist on type String error

I'm trying to send a bug report via API, and have an authentication token in my apps metadata settings, which works usually. I refactored that logic out of my main.js and into it's own class, but now I'm receiving 403 errors, which I can only imagine is due to how I'm referencing the token.

  class Logger {

   constructor(settings) {
   // getting the settings here and assigning it to the constructor variable
     this.settings = settings;
   }
   static async logInfo(data = {}) {
     console.log('Hello!')
     const url = 'https://sampleUrl'
       const response = await fetch(url, {
       method: 'POST',
       headers: {
         "X-TrackerToken": `${metadata.settings.pivotal_token}`,
         "Content-Type": "application/json"
       },
       body: JSON.stringify(data)
     });
     return response.json();
   }
 }

 const metadata = {
   settings: ''
 }
 const logger = new Logger(metadata.settings);

How I call the Logger class in Main.js

Logger.logInfo(metadata.settings, bugInfo).then(console.log('print'))
      })

On mouse hover the tooltip returns the message 'Property does not exist on type String error.', before the move into it's own class I referenced it with the same syntax, so not sure how to proceed here.

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

0

You are passing the settings with the constructor, so you need to use this setting in the Logger class, but you are using another variable for X-TrackerToken that is not defined.

const metaData = {
  settings: ""
}

metadata.settings.pivotal_token // ---> undefined

You are trying to get pivotal_token from the settings which is a string and obviously, there is no pivotal_token method existing for your settings strings.

about 4 years ago · Juan Pablo Isaza Denunciar

0

You are doing metadta.settings.pivotal_token but metadta.settings is a string. It's not having any pivotal_token property.

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