brtnshrdr / angular2-hotkeys

Keyboard shortcuts for Angular 2 apps
MIT License
203 stars 95 forks source link

Version 2.1.5 does not work with angular 8 anymore #136

Closed poyrazus closed 3 years ago

poyrazus commented 4 years ago

As @types/mousetrap version is updated from 1.6.3 to 1.6.4, angular2-hotkeys v2.1.5 doesn't work anymore with angular 8.

ERROR in ../node_modules/angular2-hotkeys/src/hotkeys.service.d.ts:9:16 - error TS2304: Cannot find name 'MousetrapInstance'.
9     mousetrap: MousetrapInstance;

In package.json, the dependency is specified as "@types/mousetrap": "^1.6.0" so it automatically updates to 1.6.4, which breaks the builds. Could you make a fix for angular 8 and fix the mousetrap versions to 1.6.3 (latest working version with angular-hotkeys 2.1.5).

Probably it's an issue with @types/mousetrap and they should fix that, as it seems to be a not backward-compatible update and they just update the patch version, but fixing it here for angular 8 and releasing a new version (2.1.6) seemed to be the easiest solution.

As a workaround, I've added "@types/mousetrap": "1.6.3", to the dependencies section of my package.json. Although it was a transitive dependency and not a direct dependency of our project, we needed that to fix the problem.

DaveGold commented 4 years ago

Thanks for the workaround. I experience the same issue

JanneHarju commented 4 years ago

same issue here with angular 9. I just modified corresponding file under node_modules and add that one import line import { MousetrapInstance } from 'mousetrap'; This is not sustain solution because next time I clean my workspace it will got broken. I will try your solution.

petterhoel commented 4 years ago

I'm seeing the same issue with version 2.2.0 and angular 10.

image

daiyis commented 4 years ago

I'm seeing the same issue with version 2.2.0 and angular 10.

image

Exactly same here.

Coffee-Tea commented 3 years ago

Should be fixed right now in https://www.npmjs.com/package/angular2-hotkeys v2.3.1