fix query option declaration emit#10583
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (29)
📝 WalkthroughWalkthroughThis pull request fixes a TypeScript declaration emit issue where exported results from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
09a7167 to
3146fbe
Compare
3146fbe to
80fe4d5
Compare
fixes #8453
This fixes TS4023 errors when a consumer exports an inferred
queryOptionsorinfiniteQueryOptionsvalue while emitting declarations.The issue is that these helpers returned anonymous intersections like:
When TypeScript tried to emit a consumer
.d.ts, it had to expand the taggedqueryKeytype and could end up referencing the internaldataTagSymbol/dataTagErrorSymbolunique symbols directly.This patch keeps the same runtime behavior and the same tagged
queryKeyinference, but gives those return types exported names instead. That lets declaration emit reference the helper result type instead of expanding the internal tag fields.The patch covers the adapters that had the same tagged return shape. Svelte only changes
queryOptions, because itsinfiniteQueryOptionsdoes not add a taggedqueryKeyreturn type.I kept the committed regression tests small: they force declaration emit to name exported option values. I also verified the overload branches separately with a temporary consumer project that imports from package roots.
Verification:
test:types:ts54throughtest:types:ts60for react, preact, vue, solid, angular experimentaltest:typesfor sveltetest:eslintprettier --checkgit diff --checkSummary by CodeRabbit
Release Notes
queryOptionsandinfiniteQueryOptionsacross all query packages. Exported query option types now properly emit without exposing internal implementation details, improving type clarity for TypeScript consumers. Refactored return types to use stable, named result types that maintain consistent type names across package boundaries.