Skip to content

Instantly share code, notes, and snippets.

@bertrandk
Last active March 1, 2016 18:09
Show Gist options
  • Save bertrandk/1331abfa0dab8b0fcc63 to your computer and use it in GitHub Desktop.
Save bertrandk/1331abfa0dab8b0fcc63 to your computer and use it in GitHub Desktop.
Typescript React Geosuggest
/// <reference path="../react/react.d.ts" />
declare namespace Geosuggest {
import React = __React
class LatLng {
constructor(lat: number, lng: number, noWrap?: boolean);
equals(other: LatLng): boolean;
lat(): number;
lng(): number;
toString(): string;
toUrlValue(precision?: number): string;
}
interface LatLngLiteral {
lat: number;
lng: number;
}
class LatLngBounds {
constructor(sw?: LatLng, ne?: LatLng);
contains(latLng: LatLng): boolean;
equals(other: LatLngBounds): boolean;
extend(point: LatLng): LatLngBounds;
getCenter(): LatLng;
getNorthEast(): LatLng;
getSouthWest(): LatLng;
intersects(other: LatLngBounds): boolean;
isEmpty(): boolean;
toSpan(): LatLng;
toString(): string;
toUrlValue(precision?: number): string;
union(other: LatLngBounds): LatLngBounds;
}
interface LatLngBoundsLiteral {
east: number;
north: number;
south: number;
west: number;
}
interface Fixture {
label: string;
location?: LatLng | LatLngLiteral;
className?: string;
}
interface Suggest {
label: string;
placeId: string;
location: LatLng | LatLngLiteral;
gmaps?: Object;
}
interface GeosuggestProps {
placeholder?: string;
initialValue?: string;
className?: string;
inputClassName?: string;
disabled?: boolean;
location?: LatLng | LatLngLiteral;
radius?: number;
bounds?: LatLngBounds | LatLngBoundsLiteral;
country?: string;
types?: Array<string>;
fixtures?: Array<Fixture>;
googleMaps?: Object;
onFocus?: Function;
onBlur?: Function;
onChange?: (value: string) => void;
onSuggestSelect?: (suggest: Suggest) => void;
getSuggestLabel?: (suggest: Suggest) => string;
skipSuggest?: (suggest: Suggest) => boolean;
autoActivateFirstSuggest?: boolean;
}
interface GeosuggestStatic extends React.ComponentClass<GeosuggestProps & React.HTMLProps<HTMLInputElement>> {}
}
declare module 'react-geosuggest' {
export = Geosuggest.GeosuggestStatic;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment