如何找到实现某些接口的函数的参数类型? [英] How do I find the parameter type of a function implementing certain interface?
本文介绍了如何找到实现某些接口的函数的参数类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如,我有一个
<form onSubmit={this.handleSubmit}>
</form>
我需要实现handleSubmit功能.因此,我做
I need to implement the handdleSubmit funciton. Therefore, I do
handleSubmit(event:any) {
this.setState({ password: event.target.value });
}
对于我不知道的参数类型,我总是将其放在上面.有没有一种方法可以找到传递参数的类型,而不是放置任何参数?
For the type of a parameter I do not know, I always put any on it. Is there a way to find the type of the passing parameter instead of putting any?
推荐答案
Dom events are defined in lib.dom.d.ts, see WindowEventMap, GlobalEventHandlersEventMap, WindowEventHandlersEventMap
interface GlobalEventHandlersEventMap {
"abort": UIEvent;
"animationcancel": AnimationEvent;
.....
"submit": Event;
.....
"waiting": Event;
"wheel": WheelEvent;
}
这篇关于如何找到实现某些接口的函数的参数类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文