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

211
Visualizações
How to access child interface from parent Interface

Hi I have an interface say

export interface employeeRes {
resource? : employeData,
header?: header
}

export interface employeData {
name: string;
lastname: employeeSub;
}

export interface employeeSub {
middlename: string;
lastname: string;

}

I have these three interface(as example) and in my component file i am calling an api and getting response the response I am getting is of type employeeSub interface

so Is it correct to access the employeeSub interface by this way

employeeRes['resource']['lastname']

and my methods looks like this

getUpdateName() {
this.http.get(url).subscribe((res:employeeRes['resource']['lastname'])=>{
console.log(res);
} 
}

I just want to access interface and assign it to res to specify the type of the response Don't want to make new file for special interface.

thank's for helping

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