Skip to content

Commit e460c06

Browse files
committed
fix: tighten ReactFireOptions generic types, remove T | any widening
Removes `| any` from `initialData` and `startWithValue`, so a value of the wrong type is a TypeScript error rather than silently accepted. `T | any` collapses to `any`, so the generic never enforced anything. Tightens `checkIdField` to read `options?.idField` directly, and narrows `checkOptions` / `checkinitialData` from `any` to `unknown`. Both are kept as exports; removal is tracked in #754. Adds casts at the rxfire `docData` / `collectionData` call sites, where rxfire expects `keyof T` and the field is a plain string. Adds `src/reactfire-options.type-test.ts`, five `@ts-expect-error` assertions riding the existing `tsc --noEmit` CI, kept out of the tarball by `.npmignore`. The negative-case consts are consumed so the directives are load-bearing: without that, `noUnusedLocals` satisfies them with a TS6133 and the file passes even if the tightening is reverted. Breaking for the raw snapshot hooks: their correct `initialData` is a `DocumentSnapshot<T>` / `QuerySnapshot<T>`, and the interface now says `T`, so correct usage stops compiling. #741 tracks the real fix and is required for 5.0.0. Fixes #383.
1 parent 0b70a12 commit e460c06

13 files changed

Lines changed: 169 additions & 25 deletions

‎.npmignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/*.type-test.ts

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Firebase.
1313

1414
## Platform support
1515

16-
ReactFire is designed for **web React apps** and wraps the [Firebase Web SDK](https://firebase.google.com/docs/web/setup). It is not compatible with React Native or Expo. For React Native projects, use [react-native-firebase](https://rnfirebase.io/) instead.
16+
ReactFire is designed for **web React apps** and wraps the [Firebase JavaScript SDK](https://firebase.google.com/docs/web/setup). It is not compatible with React Native or Expo. For React Native projects, use [react-native-firebase](https://rnfirebase.io/) instead.
1717

1818
## Install
1919

‎docs/reference/classes/ReactFireError.md‎

Lines changed: 122 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/reference/functions/checkIdField.md‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/reference/functions/checkOptions.md‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/reference/functions/checkinitialData.md‎

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/reference/interfaces/ReactFireOptions.md‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/reference/interfaces/SignInCheckOptionsBasic.md‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/reference/interfaces/SignInCheckOptionsClaimsObject.md‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/reference/interfaces/SignInCheckOptionsClaimsValidator.md‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)