ng2-dragula: Property 'on' in type 'MockDrake' is not assignable to the same property in base type 'DrakeWithModels'
This issue was not there when I started using this library but later on, found this issue (shown in attachment below):
Issue is very simple:
Draginterface has a methodon(events: string, callback: Function): Drake;=> fileindex.d.ts- Interface
DrakeWithModelsextendsDrake - Class
MockDrakeimplementsDrakeWithModels, where methodon(events: string, callback: Function): void;is overriden but the return type is changed, which is not allowed.
Fix is simple change the return type for method on in Interface Drag to void;
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 18
- Comments: 27 (1 by maintainers)
I’ve solved this problem by adding
"@types/dragula": "2.1.33",to my package.jsonI did
npm install @types/dragula@2.1.33 --save-devand it solved the issue on my side@mba3gar are you sure you installed 2.1.33? you can run
npm install @types/dragula@2.1.33 --save-devagain to be sure (and I would set it as dev dependency) …I’ve solved this problem by @angular/cdk/drag-drop
100% solution “ng2-dragula”: “2.0.0”, “@types/dragula”: “2.1.33”
Since ng2-dragula@2.0.1 and great has dependencies “@types/dragula”: “^2.1.33”. In this case we will have version 2.1.34
Go to your package.json of your project and add
"@types/dragula": "2.1.33"into your"dependencies": { }. And the do,npm ior you can do as suggested by @skydevernpm i @types/dragula
@adlerzz 's solution definitely helped
ng2-dragula@2.1.0 expects @types/dragula@^2.1.33, so I solved it by globally uninstalling @types/dragula (which was version 2.1.34) and installing 2.1.33 instead.
If you go with Yarn add this as a workaround to your package.json:
same problem angular 7.0.0