Commit 2857bff 1 parent 6bcbffa commit 2857bff Copy full SHA for 2857bff
File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1
1
export type MapsApiOptions = {
2
2
key : string ;
3
- libraries ?: string ;
3
+ libraries ?: string | string [ ] ;
4
4
v ?: string ;
5
5
} ;
6
6
@@ -11,13 +11,17 @@ export async function loadMapsApi(apiOptions: MapsApiOptions): Promise<void> {
11
11
return mapsApiLoaded ;
12
12
}
13
13
14
+ if ( Array . isArray ( apiOptions . libraries ) ) {
15
+ apiOptions . libraries = apiOptions . libraries . join ( ',' ) ;
16
+ }
17
+
14
18
const apiUrl = new URL ( 'https://maps.googleapis.com/maps/api/js' ) ;
15
19
for ( const [ key , value ] of Object . entries ( apiOptions ) ) {
16
20
if ( value === undefined ) {
17
21
continue ;
18
22
}
19
23
20
- apiUrl . searchParams . set ( key , value ) ;
24
+ apiUrl . searchParams . set ( key , value as string ) ;
21
25
}
22
26
apiUrl . searchParams . set ( 'callback' , '__maps_callback__' ) ;
23
27
You can’t perform that action at this time.
0 commit comments