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):
Can confirm the same error occurs on macOS 10.13.5 using react-dnd 4.0.4.
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
Can confirm for chrome, the problem does not occur on react-dnd 2.6.0.
@manu-st #1075
Should be resolved in 4.0.5
Most helpful comment
Should be resolved in 4.0.5