van
van

Reputation: 643

Can not find namespace 'angular'

I have an hybrid angular app with Angularjs 1.5.8 and angular 5.2.9. I had followed the steps from the Upgrading from AngularJS to Angular. It is working perfectly fine. However, after I upgrade angular 5.2.9 to angular 6.0.1, I am getting error during ng serve.

error TS2503: Cannot find namespace 'angular'

As mentioned in the Upgrading from AngularJS to Angular I have declared 'angular'

declare var angular: angular.IAngularStatic;

While upgrading angular from 5.2.9 to 6.0.1, I followed the steps from Angular Update Guide - 5.2 -> 6.0 for Advanced Apps

How can I resolve this problem?

Upvotes: 4

Views: 3548

Answers (1)

Patricio Vargas
Patricio Vargas

Reputation: 5522

try npm install --save-dev @types/angular

if not try the following: you need to add "angular" types to tsconfig.json

...
    "types": [
        "angular"
    ],

Upvotes: 6

Related Questions