Skip to content

Commit c0bd346

Browse files
committed
feat(JawgPlaces): add function support for languages, countries, layers, sources, circle and rectangle options
1 parent 4b64ecb commit c0bd346

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jawg/types",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "Shared TypeScript definitions for Jawg Maps projects",
55
"types": "./index.d.ts",
66
"typeScriptVersion": "2.3",

src/places-js.d.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,17 @@ declare namespace JawgPlaces {
102102
*/
103103
interface BoudaryOptions {
104104
/**
105-
* Add a restriction by alpha-2 or alpha-3 ISO-3166 country code.
105+
* Add a restriction by alpha-2 or alpha-3 ISO-3166 country code. Countries can be static or dynamic with the function.
106106
*/
107-
countries: string[] | string;
107+
countries: string[] | string | (() => string[]) | (() => string);
108108
/**
109-
* Search within a circular region.
109+
* Search within a circular region. Circle can be static or dynamic with the function.
110110
*/
111-
circle: CircleOptions;
111+
circle: CircleOptions | (() => CircleOptions);
112112
/**
113-
* Search within a rectangular region.
113+
* Search within a rectangular region. Rectangle can be static or dynamic with the function.
114114
*/
115-
rectangle: RectangleOptions;
115+
rectangle: RectangleOptions | (() => RectangleOptions);
116116
}
117117

118118
/**
@@ -170,8 +170,9 @@ declare namespace JawgPlaces {
170170
/**
171171
* Return results in a specific language using [BCP47 standard](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) (e.g 'en', 'fr', 'de', ...).
172172
* By default, we use HTTP Header set by the browser and English when not present.
173+
* Language can be static or dynamic with the function.
173174
*/
174-
language?: string;
175+
language?: string | (() => string);
175176
/**
176177
* Set this to `true` to activate search on typing, this will also use `autocomplete` search.
177178
* Default value is `false`, you will need to press `Enter` to validate your search.
@@ -192,13 +193,13 @@ declare namespace JawgPlaces {
192193
*/
193194
debounceDelay?: number;
194195
/**
195-
* Filter the kind of place you want to find.
196+
* Filter the kind of place you want to find. Layers can be static or dynamic with the function.
196197
*/
197-
layers?: Layer[] | Layer;
198+
layers?: Layer[] | Layer | (() => Layer) | (() => Layer[]);
198199
/**
199-
* Filter the originating source of the data.
200+
* Filter the originating source of the data. Sources can be static or dynamic with the function.
200201
*/
201-
sources?: Source[] | Source;
202+
sources?: Source[] | Source | (() => Source[]) | (() => Source);
202203
/**
203204
* Sort results in part by their proximity to the given coordinate. Coordinates can be static or dynamic with the function.
204205
*/

0 commit comments

Comments
 (0)