Skip to content

Commit 8af3f02

Browse files
committed
update code for doc based on the late commit and update version
1 parent 7dd65d5 commit 8af3f02

File tree

4 files changed

+8
-59
lines changed

4 files changed

+8
-59
lines changed

codeForDoc/src/highlights/documentIdFirelord.ts

+6-32
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const groupRef = getFirelord<Child>(db, 'parent', 'child').collectionGroup()
3939
query(
4040
colRef,
4141
// @ts-expect-error
42-
where(documentId(), '==', 'xyz/a' as const)
42+
where(documentId(), '==', 'xyz/a')
4343
) // bad: invalid characters
4444
//
4545
//
@@ -51,7 +51,7 @@ query(
5151
query(
5252
groupRef,
5353
// @ts-expect-error
54-
where(documentId(), '==', 'wrong/path/same/count' as const)
54+
where(documentId(), '==', 'wrong/path/same/count')
5555
) // bad: slash count matched but path is wrong
5656
//
5757
//
@@ -64,9 +64,9 @@ query(
6464
query(
6565
groupRef,
6666
// @ts-expect-error
67-
where(documentId(), '==', 'parent/abc/child' as const)
67+
where(documentId(), '==', 'parent/abc/child')
6868
) // bad: count mismatched
69-
query(groupRef, where(documentId(), '==', 'parent/abc/child/xyz' as const)) // good: count matched and correct type
69+
query(groupRef, where(documentId(), '==', 'parent/abc/child/xyz')) // good: count matched and correct type
7070
//
7171
//
7272
//
@@ -77,33 +77,7 @@ query(groupRef, where(documentId(), '==', 'parent/abc/child/xyz' as const)) // g
7777
query(
7878
colRef,
7979
// @ts-expect-error
80-
where(documentId(), '>', 'xyz' as const),
80+
where(documentId(), '>', 'xyz'),
8181
orderBy('z')
8282
) // bad: first orderBy field is incorrect
83-
query(colRef, where(documentId(), '>', 'xyz' as const), orderBy('__name__')) // good: first orderBy field is correct
84-
//
85-
//
86-
//
87-
//
88-
//
89-
//
90-
//
91-
query(
92-
colRef,
93-
// @ts-expect-error
94-
where(documentId(), '==', 'xyz')
95-
) // bad: no const assertion
96-
query(colRef, where(documentId(), '==', 'xyz' as const)) // good: with const assertion
97-
//
98-
//
99-
//
100-
//
101-
//
102-
//
103-
//
104-
query(
105-
colRef,
106-
// @ts-expect-error
107-
where(documentId(), '==', 'xyz')
108-
) // bad: no const assertion
109-
query(colRef, where(documentId(), '==', 'xyz' as const)) // good: with const assertion
83+
query(colRef, where(documentId(), '>', 'xyz'), orderBy('__name__')) // good: first orderBy field is correct

codeForDoc/src/highlights/whereFirelord.ts

-25
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,6 @@ const colRef = firelordRef.collection('abc')
3232
//
3333
//
3434
//
35-
query(
36-
colRef,
37-
// @ts-expect-error
38-
where('z', '==', 'a')
39-
) // bad: no const assertion
40-
query(colRef, where('z', '==', 'a' as const)) // good: with const assertion
41-
//
42-
const withoutAssertion = 'a'
43-
const withAssertion = 'a' as const
44-
//
45-
//
46-
//
47-
//
48-
query(
49-
colRef,
50-
// @ts-expect-error
51-
where('z', '==', withoutAssertion)
52-
) // bad: no const assertion
53-
query(colRef, where('z', '==', withAssertion)) // good: with const assertion
54-
//
55-
//
56-
//
57-
//
58-
//
59-
//
6035
//
6136
//
6237
// @ts-expect-error

codeForDoc/src/quick_start/queryAndOnSnapshot.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
getDocs(
1414
query(
1515
example.collection(),
16-
where('f.h', '>', 1010 as const),
16+
where('f.h', '>', 1010),
1717
orderBy('f.h'),
1818
limit(10)
1919
)

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "firelord",
3-
"version": "2.3.0",
3+
"version": "2.3.1",
44
"description": "🔥 Write V9 like Firestore Admin code with extreme type safety.",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)