I have in my Sample.html
somewhere defined
<input (keydown.Enter)="onKeyEnter($event)" ...
In my Sample.ts
I have defined
onKeyEnter(event: KeyboardEvent): void {
....
event.preventDefault();
event.stopPropagation();
}
I get with strictTemplates
the failure
error TS2345: Argument of type 'Event' is not assignable to parameter of type 'KeyboardEvent'.
Which is somehow strange because in the input
one can get only the a KeyboardEvent
. Is there a way to get rid of this error? Which I see as false positive.
it's not the same event
keydown
thankeydown.enter
, as the own Angular sayYou can use "any"
Update or Event