Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(firestore): type definitions #8378

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

SelaseKay
Copy link
Collaborator

Release Summary

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • Yes
  • My change supports the following platforms;
    • Android
    • iOS
    • Other (macOS, web)
  • My change includes tests;
    • e2e tests added or updated in packages/\*\*/e2e
    • jest tests added or updated in packages/\*\*/__tests__
  • I have updated TypeScript types that are affected by my change.
  • This is a breaking change;
    • Yes
    • No

Test Plan


Think react-native-firebase is great? Please consider supporting the project with any of the below:

Copy link

vercel bot commented Feb 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-firebase ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 28, 2025 11:35am

@@ -701,7 +722,7 @@ export function loadBundle(
* @param name - The name of the query.
* @returns A named Query.
*/
export function namedQuery(firestore: Firestore, name: string): Query<DocumentData>;
export function namedQuery(firestore: Firestore, name: string): Promise<Query | null>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking, @mikehardy, in the firebase-js-sdk documentation, it returns a Promise<Query | null>. But we currently return a Query. Should we match the firebase-js-sdk in this instance? (I assume yes!).

@@ -173,7 +176,7 @@ export type OrderByDirection = 'desc' | 'asc';
*/
export function orderBy(
fieldPath: string | FieldPath,
directionStr: OrderByDirection = 'asc',
directionStr?: OrderByDirection,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keep this as it was before, no harm in the additional default information I think

*/
export function endAt(value: number | string | boolean | null, key?: string): QueryConstraint;
export declare function endAt(...fieldValues: unknown[]): QueryEndAtConstraint;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also need to add the other way of calling endAt:

export function endAt<AppModelType, DbModelType extends DocumentData>(
  snapshot: DocumentSnapshot<AppModelType, DbModelType>
): QueryEndAtConstraint;

Comment on lines 139 to 141
export function endAt(fieldValues) {
throw new Error('endAt is not implemented');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be revised to match the firebase-js-sdk:

I think it should literally be:

endAt(...fieldValues) {
  return new QueryConstraint('endAt', ...fieldValues);
}

return new QueryConstraint('endBefore', value, key);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function endBefore(fieldValues) {
throw new Error('endBefore is not implemented');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as endAt() above.

* @param firestore
* @param observer
*/
export declare function onSnapshotsInSync(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onSnapshotsInSync needs to be implemented in a separate PR. We don't have this functionality at the moment for some reason

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants