fix(query-devtools): remove experimentalDts to prevent solid-js type leak#10442
fix(query-devtools): remove experimentalDts to prevent solid-js type leak#10442namgi2386 wants to merge 1 commit intoTanStack:mainfrom
Conversation
📝 WalkthroughWalkthroughThe changes fix TypeScript type declaration leakage in Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/fix-solid-js-type-leak.md:
- Around line 7-9: The same dts leakage fix needs applying to
packages/solid-query-devtools: open packages/solid-query-devtools/tsup.config.ts
and remove the experimentalDts: true setting and the delete tsup_option.dts
statement so tsup does not bundle d.ts for solid-js; instead ensure the build
uses rollup-plugin-dts (or the existing rollup dts path) which treats solid-js
as external—mirror the exact change made for `@tanstack/query-devtools` by
deleting the experimentalDts flag and the tsup_option.dts deletion so types are
not emitted/bundled into the package.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 90b1cc0e-e188-4bbf-aa09-df347c2429e0
📒 Files selected for processing (2)
.changeset/fix-solid-js-type-leak.mdpackages/query-devtools/tsup.config.ts
💤 Files with no reviewable changes (1)
- packages/query-devtools/tsup.config.ts
| Remove `experimentalDts: true` and `delete tsup_option.dts` from tsup.config.ts to prevent solid-js internal types from being exposed to React projects. Reverts to rollup-plugin-dts which correctly treats solid-js as external. | ||
|
|
||
| Fixes #10421 |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Check if solid-query-devtools build output contains similar type leakage issues
# Check if solid-query-devtools has the same tsup config pattern
echo "=== Checking solid-query-devtools tsup.config.ts ==="
cat packages/solid-query-devtools/tsup.config.ts
# Check the current build output for type imports (if build exists)
echo -e "\n=== Checking for solid-js imports in solid-query-devtools build output ==="
if [ -f packages/solid-query-devtools/build/index.d.ts ]; then
rg -n "from ['\"]solid-js|from ['\"]@solid-primitives" packages/solid-query-devtools/build/index.d.ts || echo "No solid-js imports found in build output"
else
echo "Build output does not exist. Run 'pnpm build' in solid-query-devtools to verify."
fi
# Compare with query-devtools tsup config to see the difference
echo -e "\n=== Comparing with query-devtools tsup.config.ts ==="
cat packages/query-devtools/tsup.config.tsRepository: TanStack/query
Length of output: 1384
Consider applying the same fix to solid-query-devtools.
The changeset correctly documents the fix for @tanstack/query-devtools. However, packages/solid-query-devtools/tsup.config.ts (lines 19-20) contains the identical problematic pattern (experimentalDts: true and delete tsup_option.dts). Since the issue (#10421) is about dts bundling causing type leakage, solid-query-devtools is susceptible to the same problem and should receive the same fix. Either include it in this PR or open a separate issue to track it.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.changeset/fix-solid-js-type-leak.md around lines 7 - 9, The same dts
leakage fix needs applying to packages/solid-query-devtools: open
packages/solid-query-devtools/tsup.config.ts and remove the experimentalDts:
true setting and the delete tsup_option.dts statement so tsup does not bundle
d.ts for solid-js; instead ensure the build uses rollup-plugin-dts (or the
existing rollup dts path) which treats solid-js as external—mirror the exact
change made for `@tanstack/query-devtools` by deleting the experimentalDts flag
and the tsup_option.dts deletion so types are not emitted/bundled into the
package.
Fixes #10421
Remove
experimentalDts: truefrompackages/query-devtools/tsup.config.tsto prevent internal solid-js types from being exposed in the bundled.d.tsfile, which causes TypeScript errors in React projects.Problem
When using
@tanstack/react-query-devtools(v5.96.2+) in a React project, runningtscproduces errors for solid-js types:This occurs despite solid-js not being a dependency of React projects.
Root Cause
PR #10253 ("ref: ts cutoff") introduced
experimentalDts: trueacross tsup configurations to improve TypeScript version support (5.4+). However:experimentalDts: trueuses@microsoft/api-extractorfor deeper type analysisjsxImportSource: "solid-js"setting.d.tsfile includesimport { JSX } from 'solid-js'Note: This is not intended as criticism of PR #10253. That PR had valid goals (TypeScript modernization) but didn't account for framework-neutral packages exposing internal implementation details.
Solution
Revert to
rollup-plugin-dts(the previousdts: trueapproach) by removing the two lines added in PR #10253:Why This Works
rollup-plugin-dtstreats external packages (solid-js) asexternalduring bundling.d.tsfile🎯 Changes
File Modified:
packages/query-devtools/tsup.config.ts(2 lines removed)File Added:
.changeset/fix-solid-js-type-leak.md(changeset entry for patch release)✅ Testing
Build Verification:
React Project Type Check:
Test Results:
📝 Changeset
A changeset has been created for automatic version management:
🚀 Release Impact
📚 Related Issues
💬 Additional Context
Why Not Update query-devtools To Use solid-query-devtools Approach?
@tanstack/solid-query-devtoolsalso hasexperimentalDts: truebut doesn't have this issue because:@tanstack/query-devtoolsis different:Checklist
pnpm --filter @tanstack/query-devtools buildpnpm changesetfix(query-devtools): ...Author Notes
This is my first contribution to TanStack/query. I've thoroughly verified the fix works in a real React project scenario and doesn't break existing functionality. I'm ready for any requested changes or clarifications during review.
Summary by CodeRabbit