Microsoft/TypeScript

Some SVG types would benefit from stricter appendChild() overloads

Aperta

#4178 aperta il 6 ago 2015

 (0 commenti) (0 reazioni) (0 assegnatari)TypeScript (13.395 fork)batch import
Domain: lib.d.tsHelp WantedSuggestion

Metriche repository

Star
 (108.860 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

interface SVGFEComponentTransferElement {
    appendChild(newChild: SVGFEFuncAElement): SVGFEFuncAElement;
    appendChild(newChild: SVGFEFuncBElement): SVGFEFuncBElement;
    appendChild(newChild: SVGFEFuncGElement): SVGFEFuncGElement;
    appendChild(newChild: SVGFEFuncRElement): SVGFEFuncRElement;
    appendChild(newChild: Comment): Comment;
}

interface SVGFEMergeElement {
    appendChild(newChild: SVGFEMergeNodeElement): SVGFEMergeNodeElement;
    appendChild(newChild: Comment): Comment;
}

...

to override the generic appendChild(Node) inherited from Node, and so on. This would make it an error to append a <g> to a <feMerge> for example.

Guida contributor