angularng2-dragula

ng2-dragula in angular7 failed to compile


Using a default startup Angular-Cli 7 project and following the steps as described here: https://github.com/valor-software/ng2-dragula to setup ng2-dragula, failed to compile.

ng2-dragula 2.1.0 (latest).

Details message:

ERROR in node_modules/ng2-dragula/dist/MockDrake.d.ts(41,5): error      TS2416:    Property 'on' in type 'MockDrake' is not assignable to the same property in base type 'DrakeWithModels'.
Type '(event: string, callback: Function) => void' is not assignable to type '(events: string, callback: Function) => Drake'.
Type 'void' is not assignable to type 'Drake'.

i 「wdm」: Failed to compile.

Dev. System Info:

Angular CLI: 7.0.3
Node: 8.11.4
OS: win32 x64
Angular: 7.0.1
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.10.3
@angular-devkit/build-angular     0.10.3
@angular-devkit/build-optimizer   0.10.3
@angular-devkit/build-webpack     0.10.3
@angular-devkit/core              7.0.3
@angular-devkit/schematics        7.0.3
@angular/cli                      7.0.3
@ngtools/webpack                  7.0.3
@schematics/angular               7.0.3
@schematics/update                0.10.3
rxjs                              6.3.3
typescript                        3.1.3
webpack                           4.19.1

Solution

  • You can solve the issue by install @types/dragula:

    npm install @types/dragula@^2.1.33
    

    Dragula 2.1.0 requires 2.1.33.

    Check this issue on github for more info: Property 'on' in type 'MockDrake' is not assignable to the same property in base type 'DrakeWithModels