google-maps-services-js
google-maps-services-js copied to clipboard
Typescript errors when building
Hello, When I run the build command in an Adonisjs I get various Typescript errors that prevent build unless I ignore the errors
node_modules/@googlemaps/google-maps-services-js/src/client.ts:107:12 - error TS2345:
Argument of type 'import("/Users/foolio/Sites/test-api/node_modules/@googlemaps/google-maps-services-js/node_modules/axios/index").AxiosInstance' is not assignable to parameter of type 'import("/Users/foolio/Sites/test-api/node_modules/axios/index").AxiosInstance'.
Types of property 'defaults' are incompatible.
Type 'AxiosDefaults<any>' is not assignable to type 'Omit<AxiosDefaults<any>, "headers"> & { headers: HeadersDefaults & { [key: string]: AxiosHeaderValue; }; }'.
Type 'AxiosDefaults<any>' is not assignable to type 'Omit<AxiosDefaults<any>, "headers">'.
Types of property 'adapter' are incompatible.
Type 'AxiosAdapter | undefined' is not assignable to type 'AxiosAdapterConfig | AxiosAdapterConfig[] | undefined'.
Type 'AxiosAdapter' is not assignable to type 'AxiosAdapterConfig | AxiosAdapterConfig[] | undefined'.
Type 'import("/Users/foolio/Sites/test-api/node_modules/@googlemaps/google-maps-services-js/node_modules/axios/index").AxiosAdapter' is not assignable to type 'import("/Users/foolio/Sites/test-api/node_modules/axios/index").AxiosAdapter'.
Types of parameters 'config' and 'config' are incompatible.
Type 'InternalAxiosRequestConfig<any>' is not assignable to type 'AxiosRequestConfig<any>'.
Types of property 'paramsSerializer' are incompatible.
Type 'ParamsSerializerOptions | undefined' is not assignable to type '((params: any) => string) | undefined'.
Type 'ParamsSerializerOptions' is not assignable to type '(params: any) => string'.
Type 'ParamsSerializerOptions' provides no match for the signature '(params: any): string'.
107 rax.attach(defaultAxiosInstance);
node_modules/@googlemaps/google-maps-services-js/src/client.ts:159:18 - error TS2345: Argument of type 'import("/Users/foolio/Sites/test-api/node_modules/@googlemaps/google-maps-services-js/node_modules/axios/index").AxiosInstance' is not assignable to parameter of type 'import("/Users/foolio/Sites/test-api/node_modules/axios/index").AxiosInstance'.
node_modules/@googlemaps/google-maps-services-js/src/client.ts:177:5 - error TS2322: Type 'null' is not assignable to type 'string[]'.
node_modules/@googlemaps/google-maps-services-js/src/directions.ts:215:45 - error TS2488: Type 'LatLng[] | undefined' must have a '[Symbol.iterator]()' method that returns an iterator.
node_modules/@googlemaps/google-maps-services-js/src/places/queryautocomplete.ts:20:3 - error TS6133: 'Place' is declared but its value is never read.
Thanks for stopping by to let us know something could be better!
Environment details
-
Specify the API at the beginning of the title (for example, "Places: ...") I'm using this library in an Adonis Js project.
-
OS type and version MacOs Monterey 12.5.1
-
Library version and other environment information Version 3.3.27 this version requires axios 0.27.2
Steps to reproduce
- In an Adonisjs project add a custom route and then run
npm run build
Stack trace
Line numbers included in errors above.
If you would like to upvote the priority of this issue, please comment below or react with :+1: so we can see what is popular when we triage.
@palfaro91 Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:
- Check the issue tracker - bugs and feature requests for Google Maps Platform APIs and SDKs
- Open a support case - Get 1:1 support in Cloud Console.
- Discord - chat with other developers
- StackOverflow - use the
google-mapstag
This is an automated message, feel free to ignore.
Any word?
Until they've fixed it in the repository, you can revert all the breaking changes made by the dependency bot in your local environment.
The bot upgraded quite a lot of packages with major version updates, including breaking changes.
git checkout fb5dc053f685939a6493e43a8ac3a3529cc06696
Until they've fixed it in the repository, you can revert all the breaking changes made by the dependency bot in your local environment.
The bot upgraded quite a lot of packages with major version updates, including breaking changes.
git checkout fb5dc053f685939a6493e43a8ac3a3529cc06696
@nora-soderlund Thanks for the tip! So that would mean downgrading down to ^3.3.26 in package.json?
This should be fixed in the latest release from this afternoon
Hi @amuramoto I just updated my package to 3.3.37 and I'm still getting the same errors.
@amuramoto I'm also using axios in my project and if I downgrade down to the same version that this package requires (0.27.2) the axios errors go away.
node_modules/@googlemaps/google-maps-services-js/src/client.ts:177:5 - error TS2322: Type 'null' is not assignable to type 'string[]'.
177 this.experienceId = null;
for this error it looks like the declaration should be updated to
private experienceId: string[] | null; if null should be an accepted value
for this error
node_modules/@googlemaps/google-maps-services-js/src/directions.ts:215:45 - error TS2488: Type 'LatLng[] | undefined' must have a '[Symbol.iterator]()' method that returns an iterator.
215 params.waypoints = ["optimize:true", ...params.waypoints];
For this error it looks like making waypoints optional is throwing the compiler off. It should be cast as an array
node_modules/@googlemaps/google-maps-services-js/src/places/queryautocomplete.ts:20:3 - error TS6133: 'Place' is declared but its value is never read.
20 Place,
It looks like the Place variable should be removed because it's not used
@amuramoto so I'm also using axios in my project but using version 1.5.0. When I build my project it tries to use my version instead of the required version 0.27.2 and it looks like it's the axios-retry peer dependency that is causing it to use the root axios version
"peerDependencies": {
"axios": "*"
}
Hi @wangela any word on this fix?
Is this ever going to be fixed @wangela ?