Skip to content

Commit b61f0d7

Browse files
Add variadic arguments to collection()/doc() (#3834)
1 parent 0a1181b commit b61f0d7

File tree

9 files changed

+157
-299
lines changed

9 files changed

+157
-299
lines changed

packages/firestore/exp-types/index.d.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,27 +112,33 @@ export function clearIndexedDbPersistence(
112112

113113
export function collection(
114114
firestore: FirebaseFirestore,
115-
collectionPath: string
115+
path: string,
116+
...pathComponents: string[]
116117
): CollectionReference<DocumentData>;
117118
export function collection(
118119
reference: CollectionReference<unknown>,
119-
collectionPath: string
120+
path: string,
121+
...pathComponents: string[]
120122
): CollectionReference<DocumentData>;
121123
export function collection(
122124
reference: DocumentReference,
123-
collectionPath: string
125+
path: string,
126+
...pathComponents: string[]
124127
): CollectionReference<DocumentData>;
125128
export function doc(
126129
firestore: FirebaseFirestore,
127-
documentPath: string
130+
path: string,
131+
...pathComponents: string[]
128132
): DocumentReference<DocumentData>;
129133
export function doc<T>(
130134
reference: CollectionReference<T>,
131-
documentPath?: string
135+
path?: string,
136+
...pathComponents: string[]
132137
): DocumentReference<T>;
133138
export function doc(
134139
reference: DocumentReference<unknown>,
135-
documentPath: string
140+
path: string,
141+
...pathComponents: string[]
136142
): DocumentReference<DocumentData>;
137143
export function collectionGroup(
138144
firestore: FirebaseFirestore,
@@ -247,7 +253,6 @@ export class DocumentReference<T = DocumentData> {
247253

248254
get parent(): CollectionReference<T>;
249255

250-
collection(collectionPath: string): CollectionReference<DocumentData>;
251256
withConverter<U>(converter: FirestoreDataConverter<U>): DocumentReference<U>;
252257
}
253258

@@ -365,7 +370,6 @@ export class CollectionReference<T = DocumentData> extends Query<T> {
365370

366371
get parent(): DocumentReference<DocumentData> | null;
367372

368-
doc(documentPath?: string): DocumentReference<T>;
369373
withConverter<U>(
370374
converter: FirestoreDataConverter<U>
371375
): CollectionReference<U>;

0 commit comments

Comments
 (0)