Skip to content

Commit b38eefc

Browse files
committed
refactor: introducing place
1 parent 27ce314 commit b38eefc

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
import { AddTo } from "../../addToInterface";
2-
import { SearchCallback } from "../../types";
32
import { MapInterface } from "../createMap/mapInterface";
3+
import { Place } from 'schema-dts';
44

5+
export type PlaceObject = Exclude<Place, string | URL>;
56

7+
export type SearchCallback = (data: any) => PlaceObject[];
68

7-
export type SearchLocationListItem = {
8-
lat: number;
9-
lng: number;
10-
title: string;
11-
}
9+
export type ListItemClickListener = (event: PlaceObject) => void;
1210

13-
export type SearchEventCallback = (event: any) => void;
14-
export type ListItemClickListener = (event: SearchLocationListItem) => void;
1511
export interface SearchInterface extends SearchUiInterface, SearchApiInterface {
1612
}
1713

@@ -26,6 +22,6 @@ export interface SearchUiInterface extends AddTo {
2622
export interface SearchApiInterface {
2723
setApiUrl(url: string): this;
2824
setSearchParam(searchParam: string): this;
29-
search(question: string): Promise<any>;
25+
search(question: string): Promise<PlaceObject[]>;
3026
addSearchResponseCallback(searchEventCallback: SearchCallback): this;
3127
}

js/types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ export type MapEvent = "click" | "dblclick" | "mousedown" | "mouseup" | "mouseov
44

55
export type MapEventCallback = (event: EventData) => void;
66

7-
export type SearchCallback = (data: any) => any;
8-
97
export type ControlPosition = "topright" | "topleft" | "bottomright" | "bottomleft";
108

119
export type LatLngObject = {

0 commit comments

Comments
 (0)