1

Im trying to use object-fit for an element in my app. My IDE doesnt recognize this:

child.style.objectFit = 'cover';

For some reason. It has squigly lines under objectFit. And when i do this:

child.style.setProperty( 'object-fit', 'cover', '!important' );

It wont show up in the Inspector of my browser. So it doesnt apply the code.

Why does it behaves so strangely?

Martijn van den Bergh
  • 1,434
  • 1
  • 20
  • 40

1 Answers1

2

Apparently your IDE (and environment) can't recognize the typings properly. To overcome that you can try casting it before using:

(child.style as any).objectFit = 'cover';
acdcjunior
  • 132,397
  • 37
  • 331
  • 304