Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use latest version of react-dnd in TypeScript #1070

Closed
manu-st opened this issue Jun 7, 2018 · 5 comments
Closed

Cannot use latest version of react-dnd in TypeScript #1070

manu-st opened this issue Jun 7, 2018 · 5 comments

Comments

@manu-st
Copy link

manu-st commented Jun 7, 2018

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
@manu-st manu-st changed the title Cannot use latest version of react-dnd Cannot use latest version of react-dnd in TypeScript Jun 7, 2018
@joelmalone
Copy link

Can confirm the same error occurs on macOS 10.13.5 using react-dnd 4.0.4.

@JDylanM
Copy link

JDylanM commented Jun 12, 2018

Fix till it gets updated:

Stand in project root and run this in terminal, should work for mac/linux.

perl -pi -w -e 's/import React from/import * as React from/g;' ./node_modules/react-dnd/lib/*.d.ts && perl -pi -w -e 's/import PropTypes from/import * as PropTypes from/g;' ./node_modules/react-dnd/lib/*.d.ts

@lukasbach
Copy link

Can confirm for chrome, the problem does not occur on react-dnd 2.6.0.

@abelkbil
Copy link

@manu-st #1075

@darthtrevino
Copy link
Member

Should be resolved in 4.0.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants