@@ -226,26 +226,28 @@ declare module 'geocodio-library-node' {
226
226
formatted_address : string ;
227
227
} ;
228
228
results : GeocodedAddress [ ] ;
229
+ _warnings ?: string [ ] ;
229
230
}
230
231
231
- export interface BatchGeocodeResponse {
232
- results : Array < {
233
- query : string ;
232
+ export interface BatchGeocodeResponse < Q extends string | AddressInputComponents , T extends Array < Q > | Record < string , Q > > {
233
+ results : T extends Array < Q > ? Array < {
234
+ query : Q ;
234
235
response : SingleGeocodeResponse ;
235
- } > | Record < string , {
236
+ } > : Record < keyof T , {
236
237
response : SingleGeocodeResponse ;
237
238
} > ;
238
239
}
239
240
240
241
export interface ReverseGeocodeResponse {
241
242
results : GeocodedAddress [ ] ;
243
+ _warnings ?: string [ ] ;
242
244
}
243
245
244
- export interface BatchReverseGeocodeResponse {
245
- results : Array < {
246
- query : string ;
246
+ export interface BatchReverseGeocodeResponse < Q extends string | [ number , number ] , T extends Array < Q > | Record < string , Q > > {
247
+ results : T extends Array < Q > ? Array < {
248
+ query : Q ;
247
249
response : ReverseGeocodeResponse ;
248
- } > | Record < string , {
250
+ } > : Record < keyof T , {
249
251
response : ReverseGeocodeResponse ;
250
252
} > ;
251
253
}
@@ -262,10 +264,9 @@ declare module 'geocodio-library-node' {
262
264
constructor ( apiKey ?: string , hostname ?: string , apiVersion ?: string ) ;
263
265
264
266
geocode ( query : string | AddressInputComponents , fields ?: FieldOption [ ] , limit ?: number ) : Promise < SingleGeocodeResponse > ;
265
- geocode ( query : ( string | AddressInputComponents ) [ ] | Record < string , string | AddressInputComponents > , fields ?: FieldOption [ ] , limit ?: number ) : Promise < BatchGeocodeResponse > ;
266
-
267
+ geocode < Q extends string | AddressInputComponents , T extends Array < Q > | Record < string , Q > > ( query : T , fields ?: FieldOption [ ] , limit ?: number ) : Promise < BatchGeocodeResponse < Q , T > > ;
267
268
reverse ( query : string | [ number , number ] , fields ?: FieldOption [ ] , limit ?: number ) : Promise < ReverseGeocodeResponse > ;
268
- reverse ( query : ( string | [ number , number ] ) [ ] | Record < string , string | [ number , number ] > , fields ?: FieldOption [ ] , limit ?: number ) : Promise < BatchReverseGeocodeResponse > ;
269
+ reverse < Q extends string | [ number , number ] , T extends Array < Q > | Record < string , Q > > ( query : T , fields ?: FieldOption [ ] , limit ?: number ) : Promise < BatchReverseGeocodeResponse < Q , T > > ;
269
270
270
271
list : {
271
272
create ( filename : string , direction : string , format : string , callback : string ) : Promise < ListResponse > ;
0 commit comments