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

DOMRectReadOnly interface type miss toJSON() method #53

Open
IlCallo opened this issue Mar 15, 2019 · 3 comments
Open

DOMRectReadOnly interface type miss toJSON() method #53

IlCallo opened this issue Mar 15, 2019 · 3 comments

Comments

@IlCallo
Copy link

IlCallo commented Mar 15, 2019

Trying to contentRect property with right type, but native DOMRectReadOnly has a toJSON method that your interface doesn't have, this results into a type mismatch.

@xinghul
Copy link

xinghul commented Mar 19, 2019

would be great to also export your version of DOMRectReadOnly.

@concatime
Copy link

@JSXS
Copy link

JSXS commented Apr 17, 2020

I've got a function that I was trying to pass entry.contentRect to,
so for the meantime, I'm just defining the argument as Partial<DOMRectReadOnly> for now.

...

const myFunction = (domRect: Partial<DOMRectReadOnly>) => {/*do something*/}

...

for ( const entry of entries) {
   myFunction(entry.contentRect); //works
}

Argument of type "DOMRectReadOnly" is not assignable to parameter of the type "DOMRectReadOnly"

But yeah, either just having this package use TypeScript's built-in DOMRectReadOnly or exporting the one defined by this package would be nice.

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

4 participants