You need to use the more specialised event type KeyboardEvent
, as shown below:
myFunc(data : string, evt : KeyboardEvent)
If you want to also remove errors for evt.enterKey
you'll need to add it by extending the interface - although I'm not aware that this is a real property as it isn't technical a control key, like CTRL
, SHIFT
or ALT
, which all have properties on the event:
interface KeyboardEvent {
enterKey: boolean;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…