question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot use latest version of react-dnd in TypeScript

See original GitHub issue

Describe 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:closed
  • Created 5 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
darthtrevinocommented, Jun 13, 2018

Should be resolved in 4.0.5

0reactions
abelkbilcommented, Jun 13, 2018
Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found