简体   繁体   中英

Which TypeScript class does SVG's beginElement() method belong to?

SVG has a beginElement() method . But I cant seem to locate it in lib.d.ts. Currently I have to cast the variable to 'any' to call it from TypeScript without any errors.

Can someone point me to the exact TypeScript class that contains that method?

The definition for that is not present. However you can quite easily add it yourself as typescript interfaces are open-ended:

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

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

If you use animationTransform you should extend SVGAnimationElement:

interface SVGAnimateTransformElement extends SVGAnimationElement {
      beginElement(): SVGAnimateTransformElement;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM