Skip to content

Commit d7f69f3

Browse files
authored
Merge pull request #85 from bondz/housekeeping
Housekeeping on typings
2 parents 0c7b034 + a4dc6ee commit d7f69f3

2 files changed

Lines changed: 34 additions & 41 deletions

File tree

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "react-static-google-map",
3-
"version": "0.6.2",
3+
"description": "Reusable react component to load Google Static map images in your react app",
4+
"version": "0.7.0",
45
"main": "dist/react-static-google-map.cjs.js",
56
"module": "dist/react-static-google-map.esm.js",
67
"browser": "dist/react-static-google-map.umd.js",
@@ -50,7 +51,10 @@
5051
"build": "rollup -c",
5152
"dev": "rollup -c -w",
5253
"test": "jest",
53-
"prepublish": "yarn build"
54+
"prepublishOnly": "yarn build",
55+
"postpublish": "git push origin --all; git push origin --tags",
56+
"postversion": "npm publish",
57+
"preversion": "yarn test"
5458
},
5559
"files": [
5660
"dist",

typings/index.d.ts

Lines changed: 28 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { Component, StatelessComponent } from 'react';
1+
import { Component, FunctionComponent } from 'react';
22

33
declare namespace ReactStaticGoogleMap {
44
interface GoogleMapImageProps
@@ -66,15 +66,15 @@ declare namespace ReactStaticGoogleMap {
6666
region?: string;
6767

6868
/**
69-
* Specified the center of the image
69+
* Specifies the center of the image
7070
*
7171
* @type {string}
7272
* @memberof GoogleMapImageProps
7373
*/
7474
center?: string;
7575

7676
/**
77-
* DSPecifies the zoom level of the image
77+
* Specifies the zoom level of the image
7878
*
7979
* @type {(string | number)}
8080
* @memberof GoogleMapImageProps
@@ -148,15 +148,15 @@ declare namespace ReactStaticGoogleMap {
148148
onCacheUpdate?: (cache: cacheType) => void;
149149
}
150150

151-
type cacheType = boolean | { [stringProps: string]: string }
151+
type cacheType = boolean | { [stringProps: string]: string };
152152

153153
type locationType =
154154
| string
155155
| number
156156
| { lat: string | number; lng: string | number }
157157
| Array<string | number | { lat: string | number; lng: string | number }>;
158158

159-
interface MarkerGroup {
159+
interface MarkerProps {
160160
size?: 'tiny' | 'mid' | 'small' | 'normal';
161161
color?:
162162
| 'black'
@@ -182,19 +182,12 @@ declare namespace ReactStaticGoogleMap {
182182
| 'bottomleft'
183183
| 'bottomright'
184184
| string;
185-
}
186-
187-
interface Marker extends MarkerGroup {
188185
location: locationType;
189186
}
190187

191-
const MarkerGroupComponent: StatelessComponent<MarkerGroup>;
188+
type MarkerGroup = Omit<MarkerProps, 'location'>;
192189

193-
interface MarkerComponent extends StatelessComponent<Marker> {
194-
Group: typeof MarkerGroupComponent;
195-
}
196-
197-
interface PathGroup {
190+
interface PathProps {
198191
weight?: string | number;
199192
color?:
200193
| 'black'
@@ -211,28 +204,21 @@ declare namespace ReactStaticGoogleMap {
211204
| number;
212205
fillcolor?: string;
213206
geodesic?: boolean;
214-
}
215-
216-
interface Path extends PathGroup {
217207
points: locationType;
218208
}
219209

220-
const PathGroupComponent: StatelessComponent<PathGroup>;
221-
222-
interface PathComponent extends StatelessComponent<Path> {
223-
Group: typeof PathGroupComponent;
224-
}
210+
type PathGroup = Omit<PathProps, 'points'>;
225211

226-
interface Direction extends PathGroup {
212+
interface DirectionProps extends PathGroup {
227213
origin: string | { lat: string | number; lng: string | number };
228214
destination: string | { lat: string | number; lng: string | number };
229-
apiKey: string;
230-
waypoints: any;
231-
avoid: 'tolls' | 'highways' | 'ferries' | 'indoor';
232-
travelMode: 'driving' | 'walking' | 'bicycling' | 'transit';
233-
transitMode: 'bus' | 'subway' | 'train' | 'tram' | 'rail';
234-
transitRoutingPreference: 'less_walking' | 'fewer_transfers';
235-
requestStrategy: 'fetch' | 'native' | RequestStrategy;
215+
apiKey?: string;
216+
waypoints?: any;
217+
avoid?: 'tolls' | 'highways' | 'ferries' | 'indoor';
218+
travelMode?: 'driving' | 'walking' | 'bicycling' | 'transit';
219+
transitMode?: 'bus' | 'subway' | 'train' | 'tram' | 'rail';
220+
transitRoutingPreference?: 'less_walking' | 'fewer_transfers';
221+
requestStrategy?: 'fetch' | 'native' | RequestStrategy;
236222
}
237223

238224
type RequestStrategy = (data: RequestStrategyOptions) => Promise<string>;
@@ -249,15 +235,18 @@ declare namespace ReactStaticGoogleMap {
249235
transitRoutingPreference?: 'less_walking' | 'fewer_transfers';
250236
[index: string]: any;
251237
}
252-
}
253238

254-
declare class StaticGoogleMap extends Component<
255-
ReactStaticGoogleMap.GoogleMapImageProps,
256-
object
257-
> {}
239+
class StaticGoogleMap extends Component<GoogleMapImageProps> {}
240+
241+
const Marker: FunctionComponent<MarkerProps> & {
242+
Group: FunctionComponent<MarkerGroup>;
243+
};
258244

259-
declare const Marker: ReactStaticGoogleMap.MarkerComponent;
260-
declare const Path: ReactStaticGoogleMap.PathComponent;
261-
declare const Direction: StatelessComponent<ReactStaticGoogleMap.Direction>;
245+
const Path: FunctionComponent<PathProps> & {
246+
Group: FunctionComponent<PathGroup>;
247+
};
248+
249+
const Direction: FunctionComponent<DirectionProps>;
250+
}
262251

263-
export { StaticGoogleMap, Marker, Path, Direction };
252+
export = ReactStaticGoogleMap;

0 commit comments

Comments
 (0)