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

471
Visualizações
TS7006: Parameter 'event' implicitly has an 'any' type

In angular,

This is script

<button (click)="onClick($event)"> Greet </button>
     <button (click)="greeting='welcome' "> Greet </button> 
     {{greeting}}

This is event Logic

public greeting =""; 
 onClick(event) {
    console.log(event);
   this.greeting ='welcome';
  }
about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

Some alternatives you can use:

onClick(event: Event) {}

onClick(event: MouseEvent) {}

Also, if you are not using the parameter event for anything, you can remove it.

onClick() { ... }
about 4 years ago · Juan Pablo Isaza Relatório

0

Reason: If you have any chance to use Angular in previous versions when you create a new project you might see some question like this. And this question is very important. enter image description here

Fix: You can either follow the stricter type checking rule or manually switch the stricter type checking to false. It worked for me. enter image description here

about 4 years ago · Juan Pablo Isaza Relatório

0

On click of that button on console, we can see PoinerEvent { isTrusted": true }

So in addition to MouseEvent or Event you can also use:

onClick(event: PointerEvent) {}

Check the docs at PointerEvent MDN. "This interface inherits properties from MouseEvent and Event."

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