react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

chore: Allow type-safety for subcollections

Open fivecar opened this issue 8 months ago • 6 comments
trafficstars

Description

Root collections currently allow strong typing:

const allYourBase = firestore()
  .collection<SetUsUp>("are-belong")
  .get();

But subcollections cannot be typed:

const allYourBase = firestore()
  .collection<SetUsUp>("are-belong")
  .doc("8675309")
  .collection<TheBomb>("to-us")  // This is not accepted by index.d.ts
  .get();

This PR attempts to make that possible.

Release Summary

Support strong typing for subcollections

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
    • [X] Yes
  • My change supports the following platforms;
    • [X] Android
    • [X] iOS
    • [X] 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
    • [X] No

Test Plan

Installed local version in my project, and verified that Typescript accepts a subcollection type.

fivecar avatar Feb 26 '25 22:02 fivecar