Med Karim Garali
Med Karim Garali

Reputation: 943

Cannot find namespace 'Microsoft'

I'm working with Angular 9 and I'm trying to integrate BingMaps,

So I get this compilation error:

src/app/dashboard/pages/infos-generale/infos/infos.component.ts:33:8 

- error TS2503: Cannot find namespace 'Microsoft'.

33   map: Microsoft.Maps.Map;

Upvotes: 2

Views: 1321

Answers (1)

Med Karim Garali
Med Karim Garali

Reputation: 943

You have just to add bingmaps into recognized types in tsconfig.app.json:

tsconfig.app.json :

   "compilerOptions": {
     "outDir": "./out-tsc/app",
     "types": [
+      "bingmaps"
     ]

If types is specified, only packages listed will be included.

So in our case, This tsconfig.json file will only include ./node_modules/@types/bingmaps. Other packages under node_modules/@types/* will not be included. A types package is a folder with a file called index.d.ts or a folder with a package.json that has a types field.

Upvotes: 2

Related Questions