-
-
Couldn't load subscription status.
- Fork 3.5k
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
Changes from all commits
0136412
6dab12c
7d1d260
e7cc7c7
79cf946
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 |
|---|---|---|
|
|
@@ -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
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 | while read -r f; do
echo ">>> $f"
rg -nP 'queryKey:\s*DataTag<\s*[^,>]+,\s*[^,>]+\s*>' "$f"
done
# Also check for infiniteQueryOptions wrappers if present.
fd --type f 'infiniteQueryOptions.ts' packages | while read -r f; do
echo ">>> $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) { | ||
|
|
||
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"