Closed
Description
TypeScript Version: 2.0.3
Code
const propName: string = 'position';
const div = document.getElementsByTagName('div')[0];
div.style[propName] = 'absolute';
Expected behavior:
Styles are dynamically settable with dictionary access; the above snippet should set position: absolute
on div
Actual behavior:
Throws
ERROR(4,1): : Element implicitly has an 'any' type because index expression is not of type 'number'.
Must use format style.setProperty(key, value);