Azure-Samples/AzureMapsCodeSamples

azure-maps-control update 3.1.1 -> 3.2.1 compialtion error

Closed this issue · 7 comments

Hi,

After the azure-maps-control update 3.1.1 -> 3.2.1. I get a following compilation error in my angular project:

[ERROR] TS2503: Cannot find namespace 'GeoJSON'. [plugin angular-compiler]

    node_modules/@maplibre/maplibre-gl-style-spec/dist/index.d.ts:604:9:
      604 │   "data": GeoJSON.GeoJSON | string;

Here is my package.json:
package.json

Thanks

I'm able to reproduce this. I've highlighted this issue to the Azure Maps team so they can investigate.

Make sure you have @types/geojson installed in your devDependencies. If it's not, you can add it by running npm install --save-dev @types/geojson.

Hi @yulinscottkang,

I removed node_modules and package-lock.json
I updated azure-maps-control 3.1.1 -> 3.3.0
I ran npm install --save-dev @types/geojson
I ran npm install

But nothing has changed.

My current package.json:
package.json

Thanks

HI @fuliii1, the issue has been fixed in azure-maps-control@3.4.0. If upgrading to the latest version doesn’t solve your problem, you might also try setting skipLibCheck: true (ref) in your tsconfig file.

Hi @yulinscottkang,

I've updated my project to azure-maps-control@3.4.0 but it hasn't helped.
The suggested skipLibCheck: true works. (It seems a workaround for me.)

I've attached my project's source code. It may help in the investigation.
ClientApp.zip

The dev environment:

ng v       

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 18.2.7
Node: 22.9.0
Package Manager: npm 10.8.3
OS: win32 x64

Angular: <error>
... animations, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.7 (cli-only)
@angular-devkit/build-angular   <error>
@angular-devkit/core            18.2.7 (cli-only)
@angular-devkit/schematics      18.2.7 (cli-only)
@angular/cli                    18.2.7 (cli-only)
@schematics/angular             18.2.7 (cli-only)
rxjs                            7.8.1 (cli-only)
typescript                      <error>
zone.js                         <error>

Many thanks

hi @fuliii1, you'll need to remove "types": [] in the src\tsconfig.app.json file.

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "types": []
  },
  "files": [
    "main.ts",
    "polyfills.ts"
  ],
  "include": [
    "src/**/*.d.ts"
  ]
}

Hi @yulinscottkang,

Your suggested solution works.

Thanks for your great help