-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when compiling: Property 'contentRect' must be of type 'DOMRectReadOnly' #80
Comments
I think this happens when "@types/resize-observer-browser" is also installed. |
We don't have |
The issue is because the latest version of TypeScript ships with an official type definition, which this library conflicts with. |
How do we resolve? I'm getting this package because another one I install depends on it. |
We've quick-fixed it by just using: const ResizeObserverPolyfill = require('resize-observer-polyfill');
const observer: ResizeObserver = new ResizeObserverPolyfill(); But that obviously only works if you have a direct dependency on it. I guess you'd have to reach out to whichever library is using it, and ask them to do something about it? |
Is there any ETA on this getting officially fixed? |
When this fix will be merged into master? |
- fix npm vulnerabilities #62 - change ResizeObserver polyfill dependency que-etc/resize-observer-polyfill#80 - bump typescript to 4.2.x and add tslib for importing helpers - update electron to v12.x and set contextIsolation to false (nklayman/vue-cli-plugin-electron-builder#1285, electron/electron#11608) to reach node APIs as it's now disabled by default (electron/electron#27949)
This allows ignoring the error that is thrown due to the incompatibility of the typings in `resize-observer-polyfill` version <=1.5.1 with TypeScript version >=4.2 (see que-etc/resize-observer-polyfill#80). Besides that, setting `skipLibCheck` to `true` is a recommended setting and will avoid unnecessary work.
This allows ignoring the error that is thrown due to the incompatibility of the typings in `resize-observer-polyfill` version <=1.5.1 with TypeScript version >=4.2. See also: - https://circleci.com/gh/angular/ngcc-validation/28399 - que-etc/resize-observer-polyfill#80 Besides that, setting `skipLibCheck` to `true` is a recommended setting and will avoid unnecessary work.
This allows ignoring the error that is thrown due to the incompatibility of the typings in `resize-observer-polyfill` version <=1.5.1 with TypeScript version >=4.2. See also: - https://circleci.com/gh/angular/ngcc-validation/28399 - que-etc/resize-observer-polyfill#80 Besides that, setting `skipLibCheck` to `true` is a recommended setting and will avoid unnecessary work.
This allows ignoring the error that is thrown due to the incompatibility of the typings in `resize-observer-polyfill` version <=1.5.1 with TypeScript version >=4.2. See also: - https://circleci.com/gh/angular/ngcc-validation/28399 - que-etc/resize-observer-polyfill#80 Besides that, setting `skipLibCheck` to `true` is a recommended setting and will avoid unnecessary work.
This allows ignoring the error that is thrown due to the incompatibility of the typings in `resize-observer-polyfill` version <=1.5.1 with TypeScript version >=4.2. See also: - https://circleci.com/gh/angular/ngcc-validation/28399 - que-etc/resize-observer-polyfill#80 Besides that, setting `skipLibCheck` to `true` is a recommended setting and will avoid unnecessary work.
This allows ignoring the error that is thrown due to the incompatibility of the typings in `resize-observer-polyfill` version <=1.5.1 with TypeScript version >=4.2. See also: - https://circleci.com/gh/angular/ngcc-validation/28399 - que-etc/resize-observer-polyfill#80 Besides that, setting `skipLibCheck` to `true` is a recommended setting and will avoid unnecessary work.
I guess a resolution for this issue is to change the resize observer. We switched it with @juggle/resize-observer with small additional changes and this resolved the issue. |
@HristoP96 thank you for pointing this out!! 👊 |
@HristoP96 thank you too ! Just had the problem after switching to angular 12 using typescript 4.2.4. |
Guys there is fix for this "skipLibCheck": true," in your tsconfig.json and recompile the applicaiton |
@BenLune any luck? have the same issue when upgrading to Angular 12. |
Angular 12 supports and actually requires typescript 4.2. As option you can just remove resize-observer-polyfill module at all. You can use ResizeObserver definition exactly from typescript package. |
You can try adding "skipLibCheck" option in |
thank you.worked for me. |
bonsoir l équipe j ai eu le même problème que faire |
This unique line solves the following error when updating for newer TS versions: 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'. It is related with issues que-etc#80, que-etc#53 and que-etc#73.
Thhank you. This worked for me. |
- fix npm vulnerabilities #62 - change ResizeObserver polyfill dependency que-etc/resize-observer-polyfill#80 - bump typescript to 4.2.x and add tslib for importing helpers - update electron to v12.x and set contextIsolation to false (nklayman/vue-cli-plugin-electron-builder#1285, electron/electron#11608) to reach node APIs as it's now disabled by default (electron/electron#27949)
The text was updated successfully, but these errors were encountered: