diff --git a/src/compat/firestore/interfaces.ts b/src/compat/firestore/interfaces.ts index e865b16fd..6ee3405aa 100644 --- a/src/compat/firestore/interfaces.ts +++ b/src/compat/firestore/interfaces.ts @@ -1,63 +1,47 @@ import { Subscriber } from 'rxjs'; import firebase from 'firebase/compat/app'; - -export type Settings = firebase.firestore.Settings; -export type CollectionReference<T = DocumentData> = firebase.firestore.CollectionReference<T>; -export type DocumentReference<T = DocumentData> = firebase.firestore.DocumentReference<T>; -export type PersistenceSettings = firebase.firestore.PersistenceSettings; -export type DocumentChangeType = firebase.firestore.DocumentChangeType; -export type SnapshotOptions = firebase.firestore.SnapshotOptions; -export type FieldPath = firebase.firestore.FieldPath; -export type Query<T = DocumentData> = firebase.firestore.Query<T>; - -export type SetOptions = firebase.firestore.SetOptions; -export type DocumentData = firebase.firestore.DocumentData; - -export interface DocumentSnapshotExists<T> extends firebase.firestore.DocumentSnapshot { - readonly exists: true; - data(options?: SnapshotOptions): T; +export declare type Settings = firebase.firestore.Settings; +export declare type CollectionReference<T = DocumentData> = firebase.firestore.CollectionReference<T>; +export declare type DocumentReference<T = DocumentData> = firebase.firestore.DocumentReference<T>; +export declare type PersistenceSettings = firebase.firestore.PersistenceSettings; +export declare type DocumentChangeType = firebase.firestore.DocumentChangeType; +export declare type SnapshotOptions = firebase.firestore.SnapshotOptions; +export declare type FieldPath = firebase.firestore.FieldPath; +export declare type Query<T = DocumentData> = firebase.firestore.Query<T>; +export declare type SetOptions = firebase.firestore.SetOptions; +export declare type DocumentData = firebase.firestore.DocumentData; +export interface DocumentSnapshotExists<T> extends firebase.firestore.DocumentSnapshot<T> { + readonly exists: true; + data(options?: SnapshotOptions): T; } - export interface DocumentSnapshotDoesNotExist extends firebase.firestore.DocumentSnapshot { - readonly exists: false; - data(options?: SnapshotOptions): undefined; - get(fieldPath: string | FieldPath, options?: SnapshotOptions): undefined; + readonly exists: false; + data(options?: SnapshotOptions): undefined; + get(fieldPath: string | FieldPath, options?: SnapshotOptions): undefined; } - -export type DocumentSnapshot<T> = DocumentSnapshotExists<T> | DocumentSnapshotDoesNotExist; - -export interface QueryDocumentSnapshot<T> extends firebase.firestore.QueryDocumentSnapshot { - data(options?: SnapshotOptions): T; +export declare type DocumentSnapshot<T> = DocumentSnapshotExists<T> | DocumentSnapshotDoesNotExist; +export interface QueryDocumentSnapshot<T> extends firebase.firestore.QueryDocumentSnapshot<T> { + data(options?: SnapshotOptions): T; } - -export interface QuerySnapshot<T> extends firebase.firestore.QuerySnapshot { - readonly docs: QueryDocumentSnapshot<T>[]; +export interface QuerySnapshot<T> extends firebase.firestore.QuerySnapshot<T> { + readonly docs: QueryDocumentSnapshot<T>[]; } - -export interface DocumentChange<T> extends firebase.firestore.DocumentChange { - readonly doc: QueryDocumentSnapshot<T>; +export interface DocumentChange<T> extends firebase.firestore.DocumentChange<T> { + readonly doc: QueryDocumentSnapshot<T>; } - export interface DocumentChangeAction<T> { - type: DocumentChangeType; - payload: DocumentChange<T>; + type: DocumentChangeType; + payload: DocumentChange<T>; } - export interface Action<T> { - type: string; - payload: T; + type: string; + payload: T; } - export interface Reference<T> { - onSnapshot: (options: firebase.firestore.SnapshotListenOptions, sub: Subscriber<any>) => any; + onSnapshot: (options: firebase.firestore.SnapshotListenOptions, sub: Subscriber<any>) => any; } - -// A convience type for making a query. -// Example: const query = (ref) => ref.where('name', == 'david'); -export type QueryFn<T = DocumentData> = (ref: CollectionReference<T>) => Query<T>; - -export type QueryGroupFn<T = DocumentData> = (query: Query<T>) => Query<T>; - +export declare type QueryFn<T = DocumentData> = (ref: CollectionReference<T>) => Query<T>; +export declare type QueryGroupFn<T = DocumentData> = (query: Query<T>) => Query<T>; /** * A structure that provides an association between a reference * and a query on that reference. Note: Performing operations @@ -81,6 +65,7 @@ export type QueryGroupFn<T = DocumentData> = (query: Query<T>) => Query<T>; * }); */ export interface AssociatedReference<T = DocumentData> { - ref: CollectionReference<T>; - query: Query<T>; + ref: CollectionReference<T>; + query: Query<T>; } +