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

186
Visualizações
Property 'this' does not exist on type '{ type: string | null; location: string | null; }'. while Destructuring assignment

In my angular app, i have a function that basically returns an object.

private getTypeAndLocation() {
    const type = sessionStorage.getItem('type');
    const location = sessionStorage.getItem('location');
    return {type, location};
  }

Now I am calling this function from ngOnint like this:

({this.MyObjectVariable.type, this.MyObjectVariable.location} = this.getWorkClearanceTypeAndLocation());

But unfortunately its not working. I am getting this error:
Property 'this' does not exist on type '{ type: string | null; location: string | null; }'.

It could be possible that getTypeAndLocation will return undefined if the type and location are not set.

In that case, how can i do the object Destructuring?

about 4 years ago · Juan Pablo Isaza
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