Fix dom on for TS's strict function mode (#37748)
**background** TS 2.6 introduces a new strict function checking mode. This can catch many common mistakes such as patterns like this: ```js function on(callback: (Base) => void) { ... } on((e: Sub) => {...}); ``` This does an implicit cast in the call to `on`. With strict function checking, this is now flagged as an error **Change** This change fixes dom.on so that it works with strict function checking. This done by making it generic so that the type of the event taken in the callback can be inferred from the callback itself.
Showing
想要评论请 注册 或 登录