googlemaps / googlemaps/google-maps-services-js

Typescript errors when building

Open
#945 10 comments 0 reactions 1 assignee Assigned to @wangela View on GitHub
priority: p1 type: bug
Dominant language
TypeScript
Stars
3.1k
Forks
654
Avg merge
3m
Merged PRs (30d)
4

Description

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' is not assignable to type 'Omit, "headers"> & { headers: HeadersDefaults & { [key: string]: AxiosHeaderValue; }; }'.
Type 'AxiosDefaults' is not assignable to type 'Omit, "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' is not assignable to type 'AxiosRequestConfig'.
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

1. Specify the API at the beginning of the title (for example, "Places: ...")
I'm using this library in an Adonis Js project.

2. OS type and version
MacOs Monterey 12.5.1

3. Library version and other environment information
Version 3.3.27
this version requires axios 0.27.2

#### Steps to reproduce

1. In an Adonisjs project add a custom route and then run `npm run build`

#### Stack trace
Line numbers included in errors above.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.