Repository navigation
Commit 6407981
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.
Also fixes #741, so this does not break correct code: the raw snapshot
hooks resolve to a DocumentSnapshot/QuerySnapshot, so their options are
now typed with the hook's own resolved type rather than the unwrapped
data type. Without that, seeding them with a snapshot (the only value a
caller can actually have) stopped compiling.
Adds `src/reactfire-options.type-test.ts`, type-level assertions riding
the existing `tsc --noEmit` CI and kept out of the tarball by
`.npmignore`. Both directions are covered: a snapshot hook refuses raw
data, a data hook refuses a snapshot. Mutation-verified, reverting either
fix fails them.
No runtime change.
Fixes #383. Fixes #741.1 parent 1650c89 commit 6407981
15 files changed
Lines changed: 81 additions & 31 deletions
File tree
- docs/reference
- functions
- interfaces
- src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments