【发布时间】:2014-07-29 06:43:33
【问题描述】:
typescript 中与 javascript 中的以下行在语义上等效的语法是什么
//Some knockout event handler.
myFunc(data : string, evt : Event) {
//If enter or tab key up were detected add the excuse to the collection.
if(evt.enterKey || evt.which == 9)
//Do Something
}
我在这里遇到的麻烦与常规的 javascript 事件不同,typescript Event 类没有属性enterKey 或which。那么如何在不出现打字稿编译错误和丑陋的红色摆动下划线的情况下检测正在按下哪个键?
【问题讨论】:
标签: javascript knockout.js typescript