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.

Error after upgrade to alpha 6: TypeScript cannot find HammerManager

See original GitHub issue

Been using alpha 5-2 along with Angular 2 rc.3 with no issues. Today I updated to ng2 rc4 as well as material2 alpha 6 and now typescript throws the following error during compilation:

/@angular2-material/core/gestures/MdGestureConfig.d.ts(4,40): error TS2304: Cannot find name ‘HammerManager’.

After reading the discussion at #535, I added HammerJS to my typings.json

{
  "globalDependencies": {
    "core-js": "registry:dt/core-js#0.0.0+20160602141332",
    "hammerjs": "registry:dt/hammerjs#2.0.4+20160417130828",
    "jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
    "node": "registry:dt/node#6.0.0+20160621231320"
  }
}

That didn’t fix the error (even if I set tsconfig’s exclude to []. It’s a bit disconcerting that a 3rd party library is throwing errors during compilation. Shouldn’t you include all the d.ts files you rely on?

To quiet the error down, I added the following to my bootstrap main.ts

///<reference path="path/to/typings/globals/hammerjs/index.d.ts"/>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
vapitscommented, Aug 15, 2016

image Same here none of the mentioned solutions worked for me.

alpha.7 versions and, angular-cli@webpack and RC5 versions

1reaction
RoxKillycommented, Aug 11, 2016

I first noticed and reported this error after the upgrade from alpha 5 to alpha 6. Now, after upgrading to alpha 7, it still occurs during Typescript compilation

@angular2-material/core/gestures/MdGestureConfig.d.ts (4,40):
error TS2304: Cannot find name 'HammerManager'

As a workaround:

  • Install hammerjs typing. Add the following to typings.json
"hammerjs": "registry:dt/hammerjs#2.0.4+20160417130828"
  • Run npm run typings install
  • If the error persists, add a reference to the typings file in your main.ts file (adjust the path to get to hammerjs/index.d.ts)
///<reference path="../typings/globals/hammerjs/index.d.ts"/>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error after upgrade to alpha 6: TypeScript cannot find ...
Error after upgrade to alpha 6: TypeScript cannot find HammerManager ... Been using alpha 5-2 along with Angular 2 rc.3 with no issues....
Read more >
Cannot find name 'HammerManager' - angular - Stack Overflow
When I try to compile it throws an error, Cannot find name 'HammerManager'. Please see attached screenshot. Errors. I found some solution for...
Read more >
angular/material2 - Gitter
getting error cannot find name HammerManager. Im using the latest Angular and material libraries. here is my package.json.
Read more >
Cannot Find Name 'Hammermanager' - ADocLib
Error after upgrade to alpha 6: TypeScript cannot find HammerManager Fantashit January error TS2304: Cannot find name 'HammerManager'.
Read more >
Solution working Hammer.js after upgrading to angular 9
js, swipe event is not working. I am not sure what i am missing. I am seeing this warning in chrome console -...
Read more >

github_iconTop Related Medium Post

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