export function updateAttributes(attributes: string[][], data: Object, element: HTMLElement): void {
attributes.forEach(([attr, value]) => {
let parsed = parseString(value, data)
if (value !== element.attributes[attr]) {
element.attributes[attr] = parsed
}
})
}
I came across an issue with the function above. I am struggling to set the attribute using element.attributes[attr]
.
An error message is displayed:
Element implicitly has an 'any' type because index expression is not of type 'number'.
I am confused as to why this error is occurring. Can someone please clarify why I am unable to simply set an attribute?