-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove Firestore TS definitions (#52)
* ♻️ * use new firestore generic references * fixtures * write the definitions file * check in fixture
- Loading branch information
Showing
3 changed files
with
163 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
testfixtures/firemodel/TestFiremodelFromSchema/ts/firebase.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import * as FIREBASE from 'firebase'; | ||
|
||
declare module 'firebase' { | ||
namespace firestore { | ||
// Snapshots | ||
export interface DocumentSnapshot<T = DocumentData> { | ||
data(options?: SnapshotOptions): D | undefined; | ||
} | ||
export interface QueryDocumentSnapshot<T = DocumentData> extends DocumentSnapshot { | ||
data(options?: SnapshotOptions): T; | ||
} | ||
export interface QuerySnapshot<T = DocumentData> { | ||
readonly docs: QueryDocumentSnapshot<T>[]; | ||
forEach(callback: (result: QueryDocumentSnapshot<T>) => void, thisArg?: any): void; | ||
} | ||
|
||
// References + Queries | ||
export interface DocumentReference<T = DocumentData> { | ||
onSnapshot(observer: { | ||
next?: (snapshot: DocumentSnapshot<T>) => void; | ||
error?: (error: FirestoreError) => void; | ||
complete?: () => void; | ||
}): () => void; | ||
onSnapshot( | ||
options: SnapshotListenOptions, | ||
observer: { | ||
next?: (snapshot: DocumentSnapshot<T>) => void; | ||
error?: (error: Error) => void; | ||
complete?: () => void; | ||
}, | ||
): () => void; | ||
onSnapshot( | ||
onNext: (snapshot: DocumentSnapshot<T>) => void, | ||
onError?: (error: Error) => void, | ||
onCompletion?: () => void, | ||
): () => void; | ||
onSnapshot( | ||
options: SnapshotListenOptions, | ||
onNext: (snapshot: DocumentSnapshot<T>) => void, | ||
onError?: (error: Error) => void, | ||
onCompletion?: () => void, | ||
): () => void; | ||
} | ||
export interface Query<T = DocumentData> { | ||
onSnapshot(observer: { | ||
next?: (snapshot: QuerySnapshot<T>) => void; | ||
error?: (error: Error) => void; | ||
complete?: () => void; | ||
}): () => void; | ||
onSnapshot( | ||
options: SnapshotListenOptions, | ||
observer: { | ||
next?: (snapshot: QuerySnapshot<T>) => void; | ||
error?: (error: Error) => void; | ||
complete?: () => void; | ||
}, | ||
): () => void; | ||
onSnapshot( | ||
onNext: (snapshot: QuerySnapshot<T>) => void, | ||
onError?: (error: Error) => void, | ||
onCompletion?: () => void, | ||
): () => void; | ||
onSnapshot( | ||
options: SnapshotListenOptions, | ||
onNext: (snapshot: QuerySnapshot<T>) => void, | ||
onError?: (error: Error) => void, | ||
onCompletion?: () => void, | ||
): () => void; | ||
} | ||
export interface CollectionReference<T = DocumentData> extends Query<T> {} | ||
} | ||
} |
Oops, something went wrong.