File tree Expand file tree Collapse file tree 3 files changed +11
-14
lines changed
Expand file tree Collapse file tree 3 files changed +11
-14
lines changed Original file line number Diff line number Diff line change @@ -121,16 +121,12 @@ const autocompleteRef = useRef(null);
121121
122122### Typescript
123123
124- We are planning on adding full support for TS and Flow in the later releases.
124+ We are planning on rewritting the library with TS/ Flow in the later releases but you can already use it with TypeScript .
125125
126126``` ts
127- import Autocomplete , {
128- ReactGoogleAutocomplete ,
129- } from " react-google-autocomplete" ;
130-
131- const AutocompleteTS: FC <ReactGoogleAutocomplete > = Autocomplete as FC <ReactGoogleAutocomplete >;
127+ import Autocomplete from " react-google-autocomplete" ;
132128
133- < AutocompleteTS apiKey = " 123" / > ;
129+ < Autocomplete apiKey = " 123" / > ;
134130```
135131
136132More examples(dynamic props, MaterialUI) how to use the lib could be found in ` docs/examples.js `
Original file line number Diff line number Diff line change @@ -11,17 +11,18 @@ export type OptionType = {
1111 types ?: string [ ] ;
1212} ;
1313
14- export interface ReactGoogleAutocomplete <
15- T = { current : null } ,
16- B = { current : null }
17- > extends HTMLProps < HTMLInputElement > {
14+ export interface ReactGoogleAutocompleteProps < T = { current : null } >
15+ extends HTMLProps < HTMLInputElement > {
1816 onPlaceSelected ?: (
1917 places : Record < string , unknown > ,
2018 ref : HTMLInputElement
2119 ) => void ;
2220 inputAutocompleteValue ?: string ;
2321 options ?: OptionType ;
2422 apiKey ?: string ;
25- ref ?: T ;
26- autocompleteRef ?: B ;
23+ autocompleteRef ?: T ;
2724}
25+
26+ export default function ReactGoogleAutocomplete (
27+ props : ReactGoogleAutocompleteProps
28+ ) : JSX . Element ;
Original file line number Diff line number Diff line change 11{
22 "name" : " react-google-autocomplete" ,
3- "version" : " 2.0.1 " ,
3+ "version" : " 2.0.2 " ,
44 "description" : " React component for google autocomplete." ,
55 "main" : " index.js" ,
66 "types" : " index.d.ts" ,
You can’t perform that action at this time.
0 commit comments