Skip to content
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

Open
wendellestradairely opened this issue Jan 24, 2021 · 18 comments

Comments

@wendellestradairely
Copy link

Compiling TypeScript sources through NGC
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;
                    ~~~~~~~~~~~
@wendellestradairely wendellestradairely changed the title Error when compiling Error when compiling: Property 'contentRect' must be of type 'DOMRectReadOnly' Jan 24, 2021
@wendellestradairely
Copy link
Author

I think this happens when "@types/resize-observer-browser" is also installed.

@alecgibson
Copy link

We don't have @types/resize-observer-browser installed, but also get this issue.

@alecgibson
Copy link

The issue is because the latest version of TypeScript ships with an official type definition, which this library conflicts with.

@grosch
Copy link

grosch commented Feb 24, 2021

How do we resolve? I'm getting this package because another one I install depends on it.

@alecgibson
Copy link

alecgibson commented Feb 25, 2021

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?

@grosch
Copy link

grosch commented Mar 4, 2021

Is there any ETA on this getting officially fixed?

@juzeppe9000
Copy link

When this fix will be merged into master?

undergroundwires added a commit to undergroundwires/privacy.sexy that referenced this issue Mar 11, 2021
- 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)
gkalpak added a commit to angular/ngcc-validation that referenced this issue Mar 19, 2021
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.
gkalpak added a commit to angular/ngcc-validation that referenced this issue Mar 19, 2021
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.
gkalpak added a commit to angular/ngcc-validation that referenced this issue Mar 19, 2021
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.
TuckerWhitehouse added a commit to Workgrid/workgrid-javascript that referenced this issue Mar 20, 2021
gkalpak added a commit to angular/ngcc-validation that referenced this issue Mar 22, 2021
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.
gkalpak added a commit to angular/ngcc-validation that referenced this issue Mar 24, 2021
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.
gkalpak added a commit to angular/ngcc-validation that referenced this issue Mar 24, 2021
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.
@HristoP96
Copy link

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.

@deefour
Copy link

deefour commented Apr 28, 2021

@HristoP96 thank you for pointing this out!! 👊

@BenLune
Copy link

BenLune commented May 14, 2021

@HristoP96 thank you too ! Just had the problem after switching to angular 12 using typescript 4.2.4.
I'll give a try to @juggle/resize-observer

@AruljothySundaramoorthy

Guys there is fix for this "skipLibCheck": true," in your tsconfig.json and recompile the applicaiton

@CarlosAmaral
Copy link

@BenLune any luck? have the same issue when upgrading to Angular 12.

@viktor-berezin
Copy link

@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.

@Sina7312
Copy link

Sina7312 commented May 31, 2021

You can try adding "skipLibCheck" option in tsconfig.json if the underlying libraries are using it

https://www.typescriptlang.org/tsconfig#skipLibCheck

@shirisha-96
Copy link

Guys there is fix for this "skipLibCheck": true," in your tsconfig.json and recompile the applicaiton

thank you.worked for me.

@fotsohilaire
Copy link

bonsoir l équipe j ai eu le même problème que faire

@AruljothySundaramoorthy

image

By using this method i can run my application now.

jonastieppo added a commit to jonastieppo/resize-observer-polyfill that referenced this issue Jan 27, 2023
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.
@seremwen
Copy link

seremwen commented Feb 8, 2023

You can try adding "skipLibCheck" option in tsconfig.json if the underlying libraries are using it

https://www.typescriptlang.org/tsconfig#skipLibCheck

Thhank you. This worked for me.

LarrMarburger pushed a commit to LarrMarburger/privacy.sexy that referenced this issue Nov 16, 2023
- 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests