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

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

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

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 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