解决Angular12报错(resize-observer-polyfill) TS2717:Property contentRect must be of type DOMRectReadOnly
错误内容:
升级到Angular 12后,Angular UI 组件库 ng-zorro-antd 引用的 resize-observer-polyfill 库报错: Property contentRect must be of type DOMRectReadOnly, but here has type DOMRectReadOnly
具体报错如下:
$ ng serve
Error: node_modules/resize-observer-polyfill/src/index.d.ts:19:18 - error TS2717:
Subsequent property declarations must have the same type.
Property 'contentRect' must be of type 'DOMRectReadOnly', but here has type 'DOMRectReadOnly'.
19 readonly contentRect: DOMRectReadOnly;
~~~~~~~~~~~
node_modules/typescript/lib/lib.dom.d.ts:12696:14
12696 readonly contentRect: DOMRectReadOnly;
~~~~~~~~~~~
'contentRect' was also declared here.
解决办法:
(1) 由于报错的是第三方类库,只能等待第三方类库去修复该错误。</