We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b260d8b commit a2c110eCopy full SHA for a2c110e
__tests__/src/index.ts
@@ -51,11 +51,12 @@ export function spyOnSnapshotCallback(ref: FirestoreReference) {
51
// This makes sure some tests fail by delaying callbacks
52
export function delayUpdate(ref: firestore.DocumentReference, time = 0) {
53
const onSnapshot = ref.onSnapshot.bind(ref)
54
- // @ts-ignore
55
ref.onSnapshot = (fn) =>
56
57
onSnapshot(async (...args) => {
58
await delay(time)
+ if (typeof fn !== 'function') {
+ throw new Error('onSnapshot can only be called on function')
59
+ }
60
fn(...args)
61
})
62
}
0 commit comments