Home > Software engineering >  typescript google maps errors
typescript google maps errors

Time:01-02

I am learning typescript with an Udemy course, . I did an exercise where google maps was used.

Then, as I use nvm I updated the node version to 16. As I updated node, I executed the commands to install typescript to the newer version

$ npm install -g typescript ts-node
$ npm install -g @types/node @types/google.maps

I started a new exercise where I have to write only a console log

index.ts

console.log('Hi there')

then I should compile the file

$ ts index.ts

The index.js gets generated but also I get a tone of errors

...
../../../../../../node_modules/@types/googlemaps/reference/polygon.d.ts:51:9 - error TS2717: Subsequent property declarations must have the same type.  Property 'path' must be of type '(LatLngLiteral | LatLng)[] | MVCArray<any>', but here has type 'LatLng[] | MVCArray<LatLng> | LatLngLiteral[]'.

51         path?: MVCArray<LatLng> | LatLng[] | LatLngLiteral[];
           ~~~~

  ../../../../../../node_modules/@types/google.maps/index.d.ts:5066:5
    5066     path?: google.maps.MVCArray<any>|null|
             ~~~~
    'path' was also declared here.

../../../../../../node_modules/@types/googlemaps/reference/polygon.d.ts:75:11 - error TS2300: Duplicate identifier 'Polygon'.

75     class Polygon extends MVCObject {
             ~~~~~~~

  ../../../../../../node_modules/@types/google.maps/index.d.ts:4804:9
    4804   class Polygon extends google.maps.MVCObject {
                 ~~~~~~~
    'Polygon' was also declared here.

../../../../../../node_modules/@types/googlemaps/reference/polygon.d.ts:145:9 - error TS2717: Subsequent property declarations must have the same type.  Property 'paths' must be of type 'any[] | MVCArray<any>', but here has type 'LatLng[] | MVCArray<LatLng> | LatLngLiteral[] | MVCArray<MVCArray<LatLng>> | LatLng[][] | LatLngLiteral[][]'.

145         paths?:
            ~~~~~

  ../../../../../../node_modules/@types/google.maps/index.d.ts:4932:5
    4932     paths?: google.maps.MVCArray<any>|null|any[];
             ~~~~~
    'paths' was also declared here.

../../../../../../node_modules/@types/googlemaps/reference/polygon.d.ts:194:11 - error TS2300: Duplicate identifier 'Rectangle'.

194     class Rectangle extends MVCObject {
              ~~~~~~~~~

  ../../../../../../node_modules/@types/google.maps/index.d.ts:5122:9
    5122   class Rectangle extends google.maps.MVCObject {
                 ~~~~~~~~~
    'Rectangle' was also declared here.

../../../../../../node_modules/@types/googlemaps/reference/polygon.d.ts:226:11 - error TS2300: Duplicate identifier 'Circle'.

226     class Circle extends MVCObject {
              ~~~~~~

  ../../../../../../node_modules/@types/google.maps/index.d.ts:74:9
    74   class Circle extends google.maps.MVCObject {
               ~~~~~~
    'Circle' was also declared here.

../../../../../../node_modules/@types/googlemaps/reference/polygon.d.ts:322:9 - error TS2300: Duplicate identifier 'CENTER'.

322         CENTER = 0,
            ~~~~~~

  ../../../../../../node_modules/@types/google.maps/index.d.ts:5883:5
    5883     CENTER = 0.0,
             ~~~~~~
    'CENTER' was also declared here.

../../../../../../node_modules/@types/googlemaps/reference/polygon.d.ts:324:9 - error TS2300: Duplicate identifier 'INSIDE'.

324         INSIDE = 1,
            ~~~~~~

  ../../../../../../node_modules/@types/google.maps/index.d.ts:5887:5
    5887     INSIDE = 1.0,
             ~~~~~~
    'INSIDE' was also declared here.

../../../../../../node_modules/@types/googlemaps/reference/polygon.d.ts:326:9 - error TS2300: Duplicate identifier 'OUTSIDE'.

326         OUTSIDE = 2,
            ~~~~~~~

  ../../../../../../node_modules/@types/google.maps/index.d.ts:5891:5
    5891     OUTSIDE = 2.0,
             ~~~~~~~
    'OUTSIDE' was also declared here.

../../../../../../node_modules/@types/googlemaps/reference/street-view-service.d.ts:1:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: StreetViewService, OK, UNKNOWN_ERROR, ZERO_RESULTS, BEST, NEAREST, DEFAULT, OUTDOOR

1 declare namespace google.maps {
  ~~~~~~~

  ../../../../../../node_modules/@types/google.maps/index.d.ts:20:1
    20 declare namespace google.maps {
       ~~~~~~~
    Conflicts are in this file.

../../../../../../node_modules/@types/googlemaps/reference/street-view-service.d.ts:25:9 - error TS2687: All declarations of 'location' must have identical modifiers.

25         location: LatLng | LatLngLiteral;
           ~~~~~~~~

../../../../../../node_modules/@types/googlemaps/reference/street-view-service.d.ts:32:9 - error TS2687: All declarations of 'pano' must have identical modifiers.

32         pano: string;
           ~~~~

../../../../../../node_modules/@types/googlemaps/reference/street-view-service.d.ts:38:9 - error TS2687: All declarations of 'pano' must have identical modifiers.

38         pano?: string;
           ~~~~

../../../../../../node_modules/@types/googlemaps/reference/street-view-service.d.ts:57:9 - error TS2687: All declarations of 'tiles' must have identical modifiers.

57         tiles?: StreetViewTileData;
           ~~~~~

../../../../../../node_modules/@types/googlemaps/reference/street-view-service.d.ts:61:9 - error TS2687: All declarations of 'description' must have identical modifiers.

61         description?: string;
           ~~~~~~~~~~~

../../../../../../node_modules/@types/googlemaps/reference/street-view-service.d.ts:62:9 - error TS2687: All declarations of 'heading' must have identical modifiers.

62         heading?: number;
           ~~~~~~~

../../../../../../node_modules/@types/googlemaps/reference/street-view-service.d.ts:63:9 - error TS2687: All declarations of 'pano' must have identical modifiers.

63         pano?: string;
           ~~~~

../../../../../../node_modules/@types/googlemaps/reference/street-view.d.ts:2:11 - error TS2300: Duplicate identifier 'StreetViewPanorama'.

2     class StreetViewPanorama extends MVCObject {
            ~~~~~~~~~~~~~~~~~~

  ../../../../../../node_modules/@types/google.maps/index.d.ts:5452:9
    5452   class StreetViewPanorama extends google.maps.MVCObject {
                 ~~~~~~~~~~~~~~~~~~
    'StreetViewPanorama' was also declared here.

../../../../../../node_modules/@types/googlemaps/reference/street-view.d.ts:69:9 - error TS2687: All declarations of 'centerHeading' must have identical modifiers.

69         centerHeading?: number;
           ~~~~~~~~~~~~~

../../../../../../node_modules/@types/googlemaps/reference/street-view.d.ts:70:9 - error TS2687: All declarations of 'tileSize' must have identical modifiers.

70         tileSize?: Size;
           ~~~~~~~~

../../../../../../node_modules/@types/googlemaps/reference/street-view.d.ts:71:9 - error TS2687: All declarations of 'worldSize' must have identical modifiers.

71         worldSize?: Size;
           ~~~~~~~~~

../../../../../../node_modules/@types/googlemaps/reference/street-view.d.ts:75:9 - error TS2687: All declarations of 'heading' must have identical modifiers.

75         heading?: number;
           ~~~~~~~

../../../../../../node_modules/@types/googlemaps/reference/street-view.d.ts:76:9 - error TS2687: All declarations of 'pitch' must have identical modifiers.

76         pitch?: number;
           ~~~~~

../../../../../../node_modules/@types/googlemaps/reference/street-view.d.ts:79:11 - error TS2300: Duplicate identifier 'StreetViewCoverageLayer'.

79     class StreetViewCoverageLayer extends MVCObject {
             ~~~~~~~~~~~~~~~~~~~~~~~

  ../../../../../../node_modules/@types/google.maps/index.d.ts:5347:9
    5347   class StreetViewCoverageLayer extends google.maps.MVCObject {
                 ~~~~~~~~~~~~~~~~~~~~~~~
    'StreetViewCoverageLayer' was also declared here.

../../../../../../node_modules/@types/googlemaps/reference/visualization.d.ts:2:11 - error TS2300: Duplicate identifier 'HeatmapLayer'.

2     class HeatmapLayer extends MVCObject {
            ~~~~~~~~~~~~

  ../../../../../../node_modules/@types/google.maps/index.d.ts:8717:9
    8717   class HeatmapLayer extends google.maps.MVCObject {
                 ~~~~~~~~~~~~
    'HeatmapLayer' was also declared here.

../../../../../../node_modules/@types/googlemaps/reference/visualization.d.ts:12:9 - error TS2687: All declarations of 'data' must have identical modifiers.

12         data: MVCArray<LatLng | WeightedLocation> | Array<LatLng | WeightedLocation>;
           ~~~~

../../../../../../node_modules/@types/googlemaps/reference/visualization.d.ts:12:9 - error TS2717: Subsequent property declarations must have the same type.  Property 'data' must be of type 'MVCArray<any> | (LatLng | WeightedLocation)[]', but here has type '(LatLng | WeightedLocation)[] | MVCArray<LatLng | WeightedLocation>'.

12         data: MVCArray<LatLng | WeightedLocation> | Array<LatLng | WeightedLocation>;
           ~~~~

  ../../../../../../node_modules/@types/google.maps/index.d.ts:8752:5
    8752     data?: google.maps.MVCArray<any>|null|
             ~~~~
    'data' was also declared here.


Found 240 errors.

I have been trying to fix this uninstalling typescript and installing again, but I couldn't.

Also I am not sure why I am getting google maps errors since google maps is not used in the file I am compiling

CodePudding user response:

@types/google.maps is conflicting with deprecated package @types/googlemaps

Try

npm uninstall @types/googlemaps
  • Related