You need a typecast:
Array.from(document.getElementsByClassName('mat-form-field-infix') as HTMLCollectionOf<HTMLElement>)
That’s because getElementsByClassName
only returns HTMLCollection<Element>
, and Element
does not have a style
property. The HTMLElement
however does implement it via it’s ElementCSSInlineStyle
extended interface.
Note that this typecast is typesafe in the way that every Element
is either a HTMLElement
or an SVGElement
, and I hope that your SVG Elements don’t have a class.