Skip to content

Commit 3124bc9

Browse files
committed
improve code
1 parent 0e0e8f9 commit 3124bc9

File tree

2 files changed

+1
-13
lines changed

2 files changed

+1
-13
lines changed

packages/firestore/src/lite-api/reference.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,12 +627,6 @@ export function doc<AppModelType, DbModelType extends DocumentData>(
627627
path?: string,
628628
...pathSegments: string[]
629629
): DocumentReference<AppModelType, DbModelType> {
630-
if (parent === undefined) {
631-
throw new FirestoreError(
632-
Code.INVALID_ARGUMENT,
633-
'Function doc() cannot be called with an undefined first argument.'
634-
);
635-
}
636630
parent = getModularInstance(parent);
637631

638632
// We allow omission of 'pathString' but explicitly prohibit passing in both

packages/firestore/test/lite/integration.test.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,7 @@ describe('doc', () => {
286286
it('validates path', () => {
287287
return withTestDb(db => {
288288
expect(() =>
289-
// @ts-ignore
290-
doc(undefined, 'coll/doc')
291-
).to.throw(
292-
'Function doc() cannot be called with an undefined first argument.'
293-
);
294-
expect(() =>
295-
// @ts-ignore
289+
// @ts-expect-error
296290
doc({}, 'coll/doc')
297291
).to.throw(
298292
'Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore'

0 commit comments

Comments
 (0)