hero icon indicating copy to clipboard operation
hero copied to clipboard

getBoundingClientRect for ISuperNode gives wrong interface (IDomRect)

Open GlenDC opened this issue 3 years ago • 0 comments

getBoundingClientRect method of a ISuperNode. According to the types (typescript) these elements like x etc should be promises, but they are just plain properties. I know this is from a dependency you use, but it's still pretty annoying, nee to manually cast it.

E.g.:

const myEl = await myFrame.querySelector(
            'css path',
        );

        const rect =
            (await myEl.getBoundingClientRect()) as any as {
                x: number;
                y: number;
                width: number;
                height: number;

Without the cast above it thinks that the return object of await myEl.getBoundingClientRect() has its properties like x as a promise. But a debugger shows that it is a plain number, not a promise.

GlenDC avatar Oct 14 '22 21:10 GlenDC