fix(table-core): export RangeValue and ensure emitted declaration files preserve module scope #6621
main fromrefs/pull/6621/head·opened Summary#
When bundling declaration files with rolldown-plugin-dts, emitted .d.ts files that lack top-level export statements are treated by TypeScript as ambient scripts rather than ES modules. As a result, private top-level type aliases (such as type RangeValue = Date | number in aggregationFns.ts) are treated as ambiently declared and leak into downstream consumer declaration emit (declaration: true), failing with:
error TS2883: The inferred type cannot be named without a reference to 'RangeValue' from './node_modules/@tanstack/table-core/dist/features/row-aggregation/aggregationFns.js'. This is likely not portable. A type annotation is necessary.
Changes#
- Export
RangeValuetype inpackages/table-core/src/features/row-aggregation/aggregationFns.tsso it is part of the public feature types re-exported from@tanstack/table-core. - Update
scripts/rewrite-table-core-dts.mjsto ensure every emitted declaration file maintains ES module scope by appendingexport {};if no export statements exist in the file. - Add changeset for
@tanstack/table-core.
Summary by CodeRabbit#
- New Features
- Exported the
RangeValuetype for consumers working with range aggregations.
- Exported the
- Bug Fixes
- Preserved module scope in generated TypeScript declaration files.
- 1
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
- Configuration used: Repository: TanStack/table/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
193a913b-de57-4058-8949-7aaec0a80c4e
📥 Commits
Reviewing files that changed from the base of the PR and between 6aa0d74946b393f4f316085998bb6ec31c2ef593 and 34c2ca0f9a5754a215461aabf23350a0f42fe6de.
📒 Files selected for processing (3)
.changeset/fix-table-core-dts-module-scope.mdpackages/table-core/src/features/row-aggregation/aggregationFns.tsscripts/rewrite-table-core-dts.mjs
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
📝 Walkthrough
Walkthrough#
The patch exports
RangeValueand updates declaration rewriting to add anexport {};marker when rewritten declaration content has no recognized export. A changeset records the patch release.Changes#
Table Core declarations
Layer / File(s) Summary Public type and declaration output
packages/table-core/src/features/row-aggregation/aggregationFns.ts,scripts/rewrite-table-core-dts.mjs,.changeset/fix-table-core-dts-module-scope.mdRangeValueis now exported. Rewritten declarations without a recognized export receive anexport {};marker. The changeset records a patch release.Priority: ⬇️ Low
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
kevinvandyMerge Risk: ⚪ Minimal · up to
34c2cThe PR exports
RangeValueand preserves module scope in rewritten declarations. The inspected build inputs do not show the suspected declaration failure, so no actionable merge risk remains beyond normal checks.🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (2 warnings)#
Check name Status Explanation Resolution Description check ⚠️ Warning The description clearly explains the problem, motivation, and implementation changes. It does not include the required Checklist section or the Release Impact section with the applicable checkbox sele… Add the required ## ✅ Checklist and ## 🚀 Release Impact sections. Select the applicable checklist items, confirm whether the required tests were run or do not apply, and confirm that a changeset was added for the published code change. Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold. ✅ Passed checks (3 passed)
Check name Status Explanation Title check ✅ Passed The title clearly and concisely identifies both main changes: exporting RangeValue and preserving module scope in emitted declaration files. Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request. Full details: Description check
Explanation
The description clearly explains the problem, motivation, and implementation changes. It does not include the required Checklist section or the Release Impact section with the applicable checkbox selected.
Full details: Docstring Coverage
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. (1 skipped: 1 unsupported.)
- Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create a new PR
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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 `@coderabbitai help` to get the list of available commands.Closing in favor of the earlier open pull request https://github.com/TanStack/table/pull/6620.
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: 34c2ca0f9a5754a215461aabf23350a0f42fe6de
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR