useResizeObserver reports incorrect return type
genepaul opened this issue · comments
Describe the bug
useResizeObserver
reports that it returns DOMRectValues
. However, the state variable DOMRect
is initialized to undefined
, which will cause the first render with that hook to return undefined
. Indeed, the documentation seems to demonstrate that you should always check for the existence of the DOMRect before doing anything with it. I can definitely open a PR to fix this.
To Reproduce
Steps to reproduce the behavior:
- Use the results of
useResizeObserver
in a TypeScript environment, and realize that it is potentially undefined.
Expected behavior
I would like it to report DOMRectValues | undefined
.
Desktop (please complete the following information):
- OS: all
- Browser all
- Version latest
Smartphone (please complete the following information):
- Device: all
- OS: all
- Browser all
- Version latest
Additional context