forked from invertase/react-native-firebase
-
Notifications
You must be signed in to change notification settings - Fork 0
/
type-test.ts
138 lines (128 loc) · 2.84 KB
/
type-test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import firebase from '@react-native-firebase/app';
import * as firestore from '@react-native-firebase/firestore';
// tslint:disable-next-line:no-duplicate-imports
import firestoreExport from '@react-native-firebase/firestore';
console.log(firestoreExport().collection);
// checks module exists at root
console.log(firebase.firestore().app.name);
// checks module exists at app level
console.log(firebase.app().firestore().app.name);
console.log(
firebase
.app()
.firestore()
.collection('foo'),
);
// checks statics exist
console.log(firebase.firestore.SDK_VERSION);
// checks statics exist on defaultExport
console.log(firestore.firebase.SDK_VERSION);
// checks root exists
console.log(firebase.SDK_VERSION);
// checks firebase named export exists on module
console.log(firestore.firebase.SDK_VERSION);
// checks multi-app support exists
console.log(firebase.firestore(firebase.app()).app.name);
console.log(firebase.firestore(firebase.app('foo')).app.name);
console.log(firebase.firestore.Blob);
console.log(firebase.firestore.FieldPath);
console.log(firebase.firestore.FieldValue);
console.log(firebase.firestore.GeoPoint);
console.log(firebase.firestore.Timestamp);
console.log(firebase.firestore.CACHE_SIZE_UNLIMITED);
firebase.firestore.setLogLevel('debug');
firebase.firestore().collection('foo');
firebase
.firestore()
.collection('foo')
.doc('foo')
.collection('foo');
firebase
.firestore()
.collection('foo')
.doc('foo');
firebase
.firestore()
.collection('foo')
.doc('foo')
.collection('foo')
.add({ foo: 'bar' })
.then();
firebase
.firestore()
.collection('foo')
.doc('foo')
.update({ foo: 'bar' })
.then();
firebase
.firestore()
.collectionGroup('foo')
.endAt(123)
.startAfter(123)
.get({ source: 'cache' })
.then();
firebase
.firestore()
.collection('foo')
.doc('foo')
.onSnapshot(() => {});
firebase
.firestore()
.collection('foo')
.doc('foo')
.onSnapshot({
next: snapshot => {
console.log(snapshot.get('foo'));
},
error: error => {
console.log(error.message);
},
});
firebase
.firestore()
.collection('foo')
.doc('foo')
.onSnapshot(
{
includeMetadataChanges: true,
},
{
next: snapshot => {
console.log(snapshot.get('foo'));
},
error: error => {
console.log(error.message);
},
complete() {},
},
);
firebase
.firestore()
.collection('foo')
.doc('foo')
.onSnapshot(
snapshot => {
console.log(snapshot.get('foo'));
},
error => {
console.log(error.message);
},
() => {},
);
firebase
.firestore()
.collection('foo')
.onSnapshot(
{
includeMetadataChanges: true,
},
{
next: snapshot => {
console.log(snapshot.docs);
},
error: error => {
console.log(error.message);
},
complete() {},
},
);