我正在尝试为 Mootools 创建一个类型定义文件,即 $('myid')
的别名用于 document.id('myid')
。我为Document
做了一个接口(interface),就是
interface Document {
id(el: string): Element;
...
}
在 JQuery.d.ts 中,$
是 JQuery 对象的别名,如何为对象方法起别名?
谢谢
最佳答案
“别名”由实现 执行。
在定义中,简单的声明你想要暴露的函数,例如
declare/export function $(el: string): Element;
关于typescript - 在定义中为类方法起别名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38867407/