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

168
Visualizações
Angular: How to Implicitly infer types when assigning function to an output of a child component

I would like to know if it is possible to implicitly infer the type from the given example of components below :

@Component({
selector:'child',
template:`<button (click)="triggerChange()">Click Me</button>`
})
export class ChildComponent {
   @Output() inputchange = new EventEmitter<string>();

   triggerChange(){
      this.inputchange.emit('Hello!');
   }
}

while reading this output in the parent component

@Component({
template:`<child (inputchange)="childChanged($event)"></child>`
})
export class ParentComponent {

   childChanged(event){
      console.log(event);
   }

}

Currently there is no possible way to implicitly know the type of the output parameter, except if we explicitly define it ( childChanged(event: string){ ... })

So the my question is is there any way to implicitly infer, or know the type of the incoming parameter (or variable) in this case?

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