Components: Error after upgrade to alpha 6: TypeScript cannot find HammerManager

Created on 1 Jul 2016  路  6Comments  路  Source: angular/components

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"/>
P3

Most helpful comment

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

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

All 6 comments

After you and HammerJS,have you try typings i?That fix my error

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"/>

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

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

Same error is thrown if you only use MdMenuModule.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

crutchcorn picture crutchcorn  路  3Comments

vitaly-t picture vitaly-t  路  3Comments

shlomiassaf picture shlomiassaf  路  3Comments

xtianus79 picture xtianus79  路  3Comments

LoganDupont picture LoganDupont  路  3Comments