`useMeasure` types fail with the `@types/react` package version `17.0.41`
See original GitHub issueWhat is the current behavior?
The useMeasure
types fail with the @types/react
package version 17.0.41
.
Steps to reproduce it and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn’t have extra dependencies other than react-use
. Paste the link to your JSFiddle or CodeSandbox example below:
https://codesandbox.io/s/broken-hooks-ps75vr?file=/src/App.tsx
What is the expected behavior?
The project compiles correctly!
A little about versions:
- OS: Mac OSX 12.3
- Browser (vendor and version): Safari 15.4
- React: 17.0.2
react-use
: 17.3.2- Did this worked in the previous package version? No
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:8
Top Results From Across the Web
@types/react - npm
Start using @types/react in your project by running `npm i ... TypeScript icon, indicating that this package has built-in type declarations.
Read more >Type errors because of types/react~17. · Issue #17101 - GitHub
I have created a new project with the typescript template, and I get type errors with the react navigation component. Stack.Navigator' cannot be...
Read more >Next.js is not recognizing '@types/react' - Stack Overflow
js app with npm run dev I get an error message saying that I don't have the required packages to run Next with...
Read more >React v16.0 – React Blog
New render return types: fragments and strings · Better error handling · Portals · Better server-side rendering · Support for custom DOM attributes....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
i think the reason is this UseMeasureRef type
export type UseMeasureRef<E extends Element = Element> = (element: E) => void;
the Element can be null just fix the type like thisexport type UseMeasureRef<E extends Element = Element> = (element: E | null) => void;
the error will goneI take it back, it works if you use generic with
useMeasure