Cannot use latest version of react-dnd in TypeScript
See original GitHub issueDescribe the bug We are using TypeScript and after updating to the latest version of react-dnd (from 2.6.0) we cannot use the new package due to errors similar to this one:
ERROR in C:/Dev/client/node_modules/react-dnd/lib/DragLayer.d.ts(1,8):
TS1192: Module '"C:/Dev/client/node_modules/@types/react/index"' has no default export.
The issue is that in the generated .d.ts files for react-dnd, they use:
import React from 'react';
where it should be using
import * as React from 'react';
To Reproduce Include react-dnd in a typescript project and import it.
Expected behavior It should not generate such an error
Desktop (please complete the following information):
- OS: Windows 10
- Browser: Using electron
- Version 4.0.4
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
react-dnd - npm
Latest version: 16.0.1, last published: 8 months ago. Start using react-dnd in your project by running `npm i react-dnd`.
Read more >Could not find a declaration file for module 'react-dnd' - Stack ...
Try `npm install @types/react-dnd` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-dnd';. Doesn't react- ...
Read more >React DnD
React DnD is a set of React utilities to help you build complex drag and drop interfaces while keeping your components decoupled. It...
Read more >Invalid Hook Call Warning - React
You might be using a version of react-dom (< 16.8.0) or react-native (< 0.59) that doesn't yet support Hooks. You can run npm...
Read more >@types/react-dnd | Yarn - Package Manager
Stub TypeScript definitions entry for react-dnd, which provides its own types ... chore: apply version (729c984); refactor: use spec functions in ...
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
Should be resolved in 4.0.5
@manu-st #1075