Skip to content

fix(table-core): export RangeValue and ensure emitted declaration files preserve module scope - #6621

Open
grzdev wants to merge 1 commit into
TanStack:mainfrom
grzdev:fix/table-core-dts-module-scope
Open

grzdev wants to merge 1 commit into
TanStack:mainfrom
grzdev:fix/table-core-dts-module-scope

Conversation

@grzdev

@grzdev grzdev commented Oct 8, 2026 •

Copy link
Copy Markdown

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 RangeValue type in packages/table-core/src/features/row-aggregation/aggregationFns.ts so it is part of the public feature types re-exported from @tanstack/table-core.
  • Update scripts/rewrite-table-core-dts.mjs to ensure every emitted declaration file maintains ES module scope by appending export {}; if no export statements exist in the file.
  • Add changeset for @tanstack/table-core.

Summary by CodeRabbit

  • New Features
    • Exported the RangeValue type for consumers working with range aggregations.
  • Bug Fixes
    • Preserved module scope in generated TypeScript declaration files.

@grzdev
grzdev requested a review from a team as a code owner October 8, 2026 19:38
@changeset-bot

changeset-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 34c2ca0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@tanstack/table-core Patch
@tanstack/alpine-table Patch
@tanstack/angular-table-devtools Patch
@tanstack/angular-table Patch
@tanstack/ember-table Patch
@tanstack/lit-table Patch
@tanstack/octane-table Patch
@tanstack/preact-table Patch
@tanstack/react-table Patch
@tanstack/solid-table Patch
@tanstack/svelte-table Patch
@tanstack/vue-table Patch

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

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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 6aa0d74 and 34c2ca0.

📒 Files selected for processing (3)
  • .changeset/fix-table-core-dts-module-scope.md
  • packages/table-core/src/features/row-aggregation/aggregationFns.ts
  • scripts/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 RangeValue and updates declaration rewriting to add an export {}; 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.md
RangeValue is now exported. Rewritten declarations without a recognized export receive an export {}; marker. The changeset records a patch release.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: kevinvandy

Merge Risk: ⚪ Minimal · up to 34c2c

The PR exports RangeValue and 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant