googlemaps / js-jest-mocks

Jest mocks for Google Maps Platform
Apache License 2.0
33 stars 29 forks source link

typescript errors between @googlemaps/jest-mocks@2.21.4 and @types/google.maps@3.55.8 #711

Closed KrzysztofWelc closed 2 months ago

KrzysztofWelc commented 3 months ago

I have a app in which i use @types/google.maps@3.55.8 and wanted to implement @googlemaps/jest-mocks (current version: 2.21.4). Tests seem to work well, however when i run build it fails with following error:

node_modules/@googlemaps/jest-mocks/dist/maps/maps/map.d.ts(20,22): error TS2720: Class 'Map_' incorrectly implements class 'Map'. Did you mean to extend 'Map' and inherit its members as a subclass?
--
  | 2157 | 03:42:52 PM | Type 'Map_' is missing the following properties from type 'Map': getHeadingInteractionEnabled, getTiltInteractionEnabled, setHeadingInteractionEnabled, setRenderingType, setTiltInteractionEnabled
  | 2158 | 03:42:52 PM | node_modules/@googlemaps/jest-mocks/dist/drawing/polygons/rectangle.d.ts(25,5): error TS2416: Property 'getMap' in type 'Rectangle' is not assignable to the same property in base type 'Rectangle'.
  | 2159 | 03:42:52 PM | Type 'Mock<Map_, [], any>' is not assignable to type '() => Map \| null'.
more_vert | 2160 | 03:42:52 PM | Type 'Map_' is missing the following properties from type 'Map': getHeadingInteractionEnabled, getTiltInteractionEnabled, setHeadingInteractionEnabled, setRenderingType, setTiltInteractionEnabled
  | 2161 | 03:42:57 PM | node_modules/@googlemaps/jest-mocks/dist/maps/maps/map.d.ts(20,22): error TS2720: Class 'Map_' incorrectly implements class 'Map'. Did you mean to extend 'Map' and inherit its members as a subclass?
  | 2162 | 03:42:57 PM | Type 'Map_' is missing the following properties from type 'Map': getHeadingInteractionEnabled, getTiltInteractionEnabled, setHeadingInteractionEnabled, setRenderingType, setTiltInteractionEnabled
  | 2163 | 03:42:57 PM | node_modules/@googlemaps/jest-mocks/dist/drawing/polygons/rectangle.d.ts(25,5): error TS2416: Property 'getMap' in type 'Rectangle' is not assignable to the same property in base type 'Rectangle'.
  | 2164 | 03:42:57 PM | Type 'Mock<Map_, [], any>' is not assignable to type '() => Map \| null'.
  | 2165 | 03:42:57 PM | Type 'Map_' is missing the following properties from type 'Map': getHeadingInteractionEnabled, getTiltInteractionEnabled, setHeadingInteractionEnabled, setRenderingType, setTiltInteractionEnabled
usefulthink commented 3 months ago

There's going to be an update to the jest-mocks to add support for the latest additions in the maps-api. Would it be an option for you to use an older version of the @types/google.maps package (I think 3.55.7 should work) until this is updated?

KrzysztofWelc commented 3 months ago

i tried with various older and newer versions and it still throws similar errors. For when is the library update planned?