次のエラーI'have型のパラメータに割り当て可能ではありませんKeyboardEventのために、私は次のようなエラーがあります。活字体キーボードイベントは:</p> <p>私はイベントタイプを定義しようとしました:コードは完璧に実行してもタイプ「イベント」の引数は「KeyboardEventの」
window.addEventListener(eventName, (e:KeyboardEvent) => {
this.handleEvent(e); // <- error here
});
TS2345: Argument of type '(event: KeyboardEvent) => void' is not assignable to parameter of type 'EventListenerOrEventListenerObject'.
Type '(event: KeyboardEvent) => void' is not assignable to type 'EventListenerObject'.
Property 'handleEvent' is missing in type '(event: KeyboardEvent) => void'.
を問題に通過または解決する方法はありますか?
完璧な説明、ありがとう! – Fabrice