Skip to content

fix(firestore): restore generic root type exports for DocumentSnapshot, Transaction, and WriteBatch#8997

Merged
russellwheatley merged 9 commits into
mainfrom
firestore-type-test
Apr 30, 2026
Merged

fix(firestore): restore generic root type exports for DocumentSnapshot, Transaction, and WriteBatch#8997
russellwheatley merged 9 commits into
mainfrom
firestore-type-test

Conversation

@russellwheatley

@russellwheatley russellwheatley commented Apr 27, 2026

Copy link
Copy Markdown
Member

Description

Fix a Firestore TypeScript regression where root imports like DocumentSnapshot, Transaction, and WriteBatch resolved to non-generic runtime class declarations instead of the intended public generic types.

This updates the Firestore root export surface and emitted declarations so root-imported Firestore types behave correctly in type positions again, and adds regression coverage for the reported usage patterns.

Why compare-types did not catch it

compare-types currently compares Firestore modular/type files such as types/firestore.d.ts and modular.d.ts, not the package root index.d.ts consumer surface.

Because the generic types already existed in the modular/type declarations, the script saw the Firestore shapes as matching. The regression was in how the root package entrypoint re-exported those symbols for consumers importing from @react-native-firebase/firestore, which sits outside the current compare-types boundary.

Introduces Consumer Type Tests

  • Consumer type tests now test the API the consumer receives.

Related issues

Related issues

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:

@russellwheatley russellwheatley changed the title chore: introduce firestore type test chore: introduce firestore type test for consumer API Apr 27, 2026
@vercel

vercel Bot commented Apr 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-native-firebase Error Error Apr 27, 2026 4:59pm

Request Review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds a comprehensive suite of consumer-facing API type tests for Firestore, covering namespaced, modular, and the new pipelines API. It includes a new test file, a dedicated TypeScript configuration, and a package script for type checking. Feedback was provided regarding the testConverter implementation, which should handle both full and partial object types in toFirestore to properly support merge and update operations.

Comment thread packages/firestore/consumer-type-test.ts Outdated

@mikehardy mikehardy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

seems reasonable - I like that the consumer stuff now isn't per-package and the glob for "consumer-type-test" means this should be easy to use as a pattern for other packages - ideally all of the type tests are "consumer" style ones with rare / maybe not existing non-consumer ones

});
});
console.log(queryEqual(modQuery1, modQuery2));
console.log(queryEqual(modQuery1, modQuery2));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

interesting that passes lint with trailing white space

@russellwheatley russellwheatley changed the title chore: introduce firestore type test for consumer API fix(firestore): restore generic root type exports for DocumentSnapshot, Transaction, and WriteBatch Apr 30, 2026
@russellwheatley russellwheatley marked this pull request as ready for review April 30, 2026 13:47
@russellwheatley russellwheatley merged commit 7cf9502 into main Apr 30, 2026
23 of 27 checks passed
@russellwheatley russellwheatley deleted the firestore-type-test branch April 30, 2026 13:48
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.

[🐛] v24 new typescript interface not working

2 participants