Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 4.2k
fix(solid-query): export queryOptions without type errors#9668
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
01364126dab12c7d1d260e7cc7c779cf946File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -29,39 +29,29 @@ export function queryOptions< | ||
| TError = DefaultError, | ||
| TData = TQueryFnData, | ||
| TQueryKey extends QueryKey = QueryKey, | ||
| TOptions extends ReturnType< | ||
| UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> | ||
| > = ReturnType< | ||
| UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> | ||
| >, | ||
| >( | ||
| options: ReturnType< | ||
| UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> | ||
| >, | ||
| ): ReturnType< | ||
| UndefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> | ||
| > & { | ||
| queryKey: DataTag<TQueryKey, TQueryFnData> | ||
| queryKey: DataTag<TQueryKey, TQueryFnData, TError> | ||
| } | ||
Comment on lines
+39
to
40
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 🧩 Analysis chainKey fix: include TError in DataTag for queryKey Passing TError prevents UnsetMarker from leaking into the emitted d.ts and addresses TS2527. LGTM. Optionally verify parity across integrations to avoid regressions elsewhere: 🏁 Script executed: #!/bin/bash# Find queryOptions wrappers that still tag queryKey without TError.
fd --type f 'queryOptions.ts' packages |whileread -r f;doecho">>> $f"
rg -nP 'queryKey:\s*DataTag<\s*[^,>]+,\s*[^,>]+\s*>'"$f"done# Also check for infiniteQueryOptions wrappers if present.
fd --type f 'infiniteQueryOptions.ts' packages |whileread -r f;doecho">>> $f"
rg -nP 'queryKey:\s*DataTag<\s*[^,>]+,\s*[^,>]+\s*>'"$f"doneLength of output: 962 Key fix: include TError in DataTag for queryKey across packages Add the third generic parameter (TError) to prevent UnsetMarker leaking into emitted d.ts and resolve TS2527. Files to update:
Verify parity in other packages' queryOptions.ts / infiniteQueryOptions.ts after applying. | ||
| export function queryOptions< | ||
| TQueryFnData = unknown, | ||
| TError = DefaultError, | ||
| TData = TQueryFnData, | ||
| TQueryKey extends QueryKey = QueryKey, | ||
| TOptions extends ReturnType< | ||
| DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> | ||
| > = ReturnType< | ||
| DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> | ||
| >, | ||
| >( | ||
| options: ReturnType< | ||
| DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> | ||
| >, | ||
| ): ReturnType< | ||
| DefinedInitialDataOptions<TQueryFnData, TError, TData, TQueryKey> | ||
| > & { | ||
| queryKey: DataTag<TQueryKey, TQueryFnData> | ||
| queryKey: DataTag<TQueryKey, TQueryFnData, TError> | ||
| } | ||
| export function queryOptions(options: unknown) { | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
before the fix, this was
typeof unsetMarkerwhich ts treated as an "inaccessible unique symbol"