type-conversion - SVG 的 beginElement() 方法属于哪个 TypeScript 类?

标签 type-conversion typescript

SVG 有一个 beginElement() method .但我似乎无法在 lib.d.ts 中找到它。 目前,我必须将变量转换为“any”才能从 TypeScript 调用它而不会出现任何错误。

谁能指出包含该方法的确切 TypeScript 类?

最佳答案

该定义不存在。然而,你可以很容易地自己添加它,因为 typescript 接口(interface)是开放式的:

interface SVGElement extends Element {
    beginElement(): SVGElement;
}

var foo = new SVGElement();
foo.beginElement();

关于type-conversion - SVG 的 beginElement() 方法属于哪个 TypeScript 类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19679215/

相关文章:

多个 __extends 声明的 Typescript 代码覆盖率

javascript - 为 JSON 属性抛出 Nan 消息

python - 在 python 3.5 中构建位字符串时出错 : the datatype is being set to U32 without my control

swift - 如何将 UInt8 转换为可以连接到字符串的数据类型?

c++ - 转换为索引和指针并引用容器的类

javascript - 如何取消选中 Angular 6 中所有选中的复选框

typescript 错误 : A private property is missing?

regex - 流畅地将字段转换为整数

从 32 位地址转换为 64 位整数会产生意外结果

angular - 如何将可观察值传递给@Input() Angular 4