maslianok / react-resize-detector

A Cross-Browser, Event-based, Element Resize Detection for React
http://maslianok.github.io/react-resize-detector/
MIT License
1.25k stars 91 forks source link

Typeerrors in 6.0.1-rc.4 - "Cannot find type definition file for 'resize-observer-browser'." #119

Closed levox closed 3 years ago

levox commented 3 years ago

Hi,

Library-version: 6.0.1-rc.4 TS-versoin: 4.1.3

First of all thank you for creating this library. It's great to use and I like the API design very much.

Just one problem: I expected resize-observer-detector (v6) to work out of the box with a typescript project, as stated on the current github page description.

Sadly I receive some type errors, when trying to use it (see below). It works perfectly fine but the typeerrors are quite annoying.


ERROR in C:/PROJECTFOLDER/node_modules/react-resize-detector/build/ResizeDetector.d.ts(1,23):
TS2688: Cannot find type definition file for 'resize-observer-browser'.
ERROR in C:/PROJECTFOLDER/node_modules/react-resize-detector/build/ResizeDetector.d.ts(110,26):
TS2304: Cannot find name 'ResizeObserverCallback'.
Version: typescript 4.1.3

Am I the only one facing those problems?

Thanks in advance Chris

maslianok commented 3 years ago

Hi @levox

Thank you for your words 🤝

I've added "@types/resize-observer-browser" to the dependencies list. It doesn't affect the package size and should resolve the problem.

Please try v6.0.1-rc.5

levox commented 3 years ago

Thank you so much for your fast response and for fixing the issue. It resolved the problem with the typeerrors completely.

Best regards, Chris