-
Notifications
You must be signed in to change notification settings - Fork 404
fix: tighten ReactFireOptions generic types, remove T | any widening #740
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
base: main
Are you sure you want to change the base?
Changes from all commits
ae983e9
49009f1
85c720a
f713f4b
5e82299
7e3b9d2
3b5da48
2788e43
a3112dd
13927b5
10897c7
b032294
a10f992
89e1c4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| src/*.type-test.ts |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| /** | ||
| * Type-level regression tests for ReactFireOptions<T> generic constraints. | ||
| * Checked by `tsc --noEmit` in CI. No runtime behavior — not bundled. | ||
| */ | ||
| import type { ReactFireOptions } from './index'; | ||
|
|
||
| // ---- initialData must match T ---- | ||
|
|
||
| void ((): ReactFireOptions<string> => ({ initialData: 'hello' }))(); | ||
| void ((): ReactFireOptions<number> => ({ initialData: 42 }))(); | ||
|
|
||
| // @ts-expect-error initialData must be T, not a different type | ||
| const _wrongInitialData: ReactFireOptions<string> = { initialData: 123 }; | ||
| void _wrongInitialData; | ||
|
|
||
| // @ts-expect-error startWithValue must be T, not a different type | ||
| const _wrongStartWithValue: ReactFireOptions<string> = { startWithValue: 123 }; | ||
| void _wrongStartWithValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think any of these are actually used, and agree deleting is the right thing, but this is technically a breaking change. Let's leave this for now, since it isn't hurting anything (unless it is, in which case let me know)
Please add an issue reminding us to remove all of these in v5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Both are kept as exports (no breaking removal), with a comment marking them unused-and-slated-for-v5. Filed #754 to remove them.
One heads-up: tightening
initialDatatoTshiftscheckinitialData's inferred return type fromanytounknown(visible in its regenerated doc). It's unused internally and on the v5 chopping block, so I left it rather than adding a cast to a dead export, but flagging in case you'd rather I pin it.