3
Mit dem Javascript wie unten, gibt es ein entsprechendes TypeScript, um das Gleiche zu tun?Element-Prototyp mit TypeScript erweitern
Ich muss nur den HTML-DOM-Element-Prototyp zu erweitern, aber nicht ein richtiges TypeScript, um dies ohne Kompilierungsfehler zu tun.
Element.prototype.astyle = function actualStyle(props) {
var el = this;
var compStyle = window.getComputedStyle(el, null);
for (var i = 0; i < props.length; i++) {
var style = compStyle[props[i]];
if (style != null) {
return style;
}
}
return null;
};