@@ -161,6 +161,7 @@ export function createWithFirestore(storeKey: any): any
161161
162162// https://github.com/prescottprue/redux-firestore#query-options
163163type WhereOptions = [ string , FirestoreTypes . WhereFilterOp , any ]
164+ type OrderByOptions = [ string , FirestoreTypes . OrderByDirection ]
164165export interface FirestoreQueryOptions {
165166 // https://github.com/prescottprue/redux-firestore#collection
166167 collection : string
@@ -171,7 +172,7 @@ export interface FirestoreQueryOptions {
171172 // https://github.com/prescottprue/redux-firestore#where
172173 where ?: WhereOptions | WhereOptions [ ]
173174 // https://github.com/prescottprue/redux-firestore#orderby
174- orderBy ?: string [ ] | string [ ] [ ]
175+ orderBy ?: OrderByOptions | OrderByOptions [ ]
175176 // https://github.com/prescottprue/redux-firestore#limit
176177 limit ?: number
177178 // https://github.com/prescottprue/redux-firestore#startat
@@ -190,10 +191,10 @@ export interface FirestoreQueryOptions {
190191interface ReduxFirestoreApi {
191192 // https://github.com/prescottprue/redux-firestore#get
192193 // https://github.com/prescottprue/redux-firestore#get-1
193- get : ( docPath : string | FirestoreQueryOptions ) => void
194+ get : ( docPath : string | FirestoreQueryOptions ) => Promise < void >
194195
195196 // https://github.com/prescottprue/redux-firestore#set
196- set : ( docPath : string | FirestoreQueryOptions , data : Object ) => void
197+ set : ( docPath : string | FirestoreQueryOptions , data : Object ) => Promise < void >
197198
198199 // https://github.com/prescottprue/redux-firestore#add
199200 add : (
@@ -325,10 +326,8 @@ interface Auth {
325326 } ,
326327 updateInProfile : boolean
327328 ) => Promise < void >
328- }
329329
330- //http://docs.react-redux-firebase.com/history/v3.0.0/docs/recipes/profile.html
331- interface Profile < ProfileType > {
330+ //http://docs.react-redux-firebase.com/history/v3.0.0/docs/recipes/profile.html
332331 // http://docs.react-redux-firebase.com/history/v3.0.0/docs/recipes/profile.html#update-profile
333332 updateProfile : ( profile : Partial < ProfileType > , options : Object ) => void
334333}
@@ -362,7 +361,6 @@ interface Storage {
362361
363362export interface WithFirebaseProps < ProfileType > {
364363 firebase : Auth &
365- Profile < ProfileType > &
366364 Storage & {
367365 initializeApp : ( options : Object , name ?: string ) => firebase . app . App
368366
@@ -477,7 +475,7 @@ export function firebaseStateReducer(...args: any[]): FirestoreReducer.Reducer
477475 */
478476export function firestoreConnect < TInner = { } > (
479477 connect ?:
480- | mapper < TInner , string [ ] | FirestoreQueryOptions [ ] >
478+ | mapper < TInner , ( string | FirestoreQueryOptions ) [ ] >
481479 | FirestoreQueryOptions [ ]
482480 | string [ ]
483481) : InferableComponentEnhancerWithProps <
@@ -619,26 +617,28 @@ export interface Listeners {
619617 }
620618}
621619
622- export interface Ordered {
623- [ collection : string ] : ( FirestoreTypes . DocumentData & { id : string } ) [ ]
620+ export interface Ordered < T extends FirestoreTypes . DocumentData > {
621+ [ collection : string ] : ( T & { id : string } ) [ ]
624622}
625623
626- export interface Data {
627- [ collection : string ] : {
628- [ documentId : string ] : FirestoreTypes . DocumentData
629- }
624+ export interface Dictionary < T > {
625+ [ documentId : string ] : T
626+ }
627+
628+ export interface Data < T extends FirestoreTypes . DocumentData > {
629+ [ collection : string ] : Dictionary < T >
630630}
631631
632632export namespace FirebaseReducer {
633633 export interface Reducer < ProfileType = { } > {
634634 auth : Auth
635635 profile : Profile < ProfileType >
636636 authError : any
637- data : Data
637+ data : Data < any >
638+ ordered : Ordered < any >
638639 errors : any [ ]
639640 isInitializing : boolean
640641 listeners : Listeners
641- ordered : Ordered
642642 requested : { }
643643 requesting : { }
644644 timestamps : { }
@@ -677,14 +677,16 @@ export namespace FirebaseReducer {
677677
678678export namespace FirestoreReducer {
679679 export interface Reducer {
680- composite : any
681- data : { }
680+ composite ?: Data < any >
681+ data : {
682+ [ collection : string ] : any | Dictionary < any >
683+ }
682684 errors : {
683685 allIds : string [ ]
684686 byQuery : any [ ]
685687 }
686688 listeners : Listeners
687- ordered : Ordered
689+ ordered : Ordered < any >
688690 queries : any
689691 status : {
690692 requested : { }
0 commit comments