Finding ResizeObserver with Typescript in Angular 9

I suggest using resize-observer-polyfill it has types (in d.ts file) and if the browser support Resize Observer it just uses native implementation, but it has larger support because it uses Mutation Observer as a fallback that has a much bigger support.

So just use:

import ResizeObserver from 'resize-observer-polyfill';

Browser supports to compare:

  • Resize Observer
  • Mutation Observer

as you can see Mutation Observer even work in IE 11.


I had the same problem because I of the empty "types" array in my tsconfig file. Solved by adding "resize-observer-browser" to the types array:

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "typeRoots": ["node_modules/@types"],
    "types": ["resize-observer-browser"],
  }
}