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.

Typing issue with @DragDropContext decorator

See original GitHub issue

Hi There, I am new to react-dnd, I am using typescript to build up my first test project with dnd.

@DragDropContext(HTML5Backend) export class DragTest extends React.Component<{}, undefined> { render() {return (<div></div>);} }

And I get the following compile typing error:

 TS1238: Unable to resolve signature of class decorator when called as an expression.
  Type 'ContextComponentClass<{}>' is not assignable to type 'typeof DragTest'.
    Type 'ContextComponent<{}, any>' is not assignable to type 'DragTest'.
      Types of property 'render' are incompatible.
        Type '() => Element | null' is not assignable to type '() => Element'.
          **Type 'Element | null' is not assignable to type 'Element'.**
            Type 'null' is not assignable to type 'Element'.

I appreciate your comment, Thanks

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:9

github_iconTop GitHub Comments

9reactions
kaidezcommented, Jun 1, 2017

Same with me.

2reactions
arvind1234commented, Aug 23, 2017

FWIW, I don’t get the error if I use the ES6 way: export default DragDropContext(HTML5Backend)(DnDTest);

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - How to decorate my React component correctly when ...
I am trying to add the @DragDropContext decorator on my class but I am getting an error when I load it in my...
Read more >
Adding drag-and-drop functionality with react-beautiful-dnd
As we learned above, the first step is to create a DragDropContext that encloses everything we want on our list. In it, we...
Read more >
Implementing Drag and Drop - SurviveJS
In order to set it up, we need to use the DragDropContext decorator and provide the HTML5 back-end to it. To avoid unnecessary...
Read more >
@types/react-dnd-html5-backend | Yarn - Package Manager
This is a stub types definition. react-dnd-html5-backend provides its own type definitions, so you do not need this installed.
Read more >
react-beautiful-dnd - npm
We recommend that you don't raise issues or pull requests, as they will not be ... Accessible: powerful keyboard and screen reader support ......
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