Skip to content

fix(table-core): add export {} to declaration files without an export statement - #6620

Open
MFA-G wants to merge 1 commit into
TanStack:mainfrom
MFA-G:feat-dts-export-marker
Open

MFA-G wants to merge 1 commit into
TanStack:mainfrom
MFA-G:feat-dts-export-marker

Conversation

@MFA-G

@MFA-G MFA-G commented Oct 8, 2026 •

Copy link
Copy Markdown

🎯 Changes

Fixes #6619.

Since 9.2.5 the table-core .d.ts files no longer end with export { … } (rolldown-plugin-dts 0.28.2+ inlines the export modifiers instead). A declaration file without any export statement exports every top-level declaration, so private aliases such as RangeValue in aggregationFns.d.ts become referable, but only through a deep path that the package exports map blocks. A consumer emitting declarations then fails:

error TS2883: The inferred type of 'min' cannot be named without a reference to 'RangeValue' from './node_modules/@tanstack/table-core/dist/features/row-aggregation/aggregationFns.js'.

scripts/rewrite-table-core-dts.mjs now appends export {}; to declaration files that have no export { … }, export * or export = statement, as suggested in the issue. This is a workaround until sxzz/rolldown-plugin-dts#312 is fixed upstream (sxzz/rolldown-plugin-dts#310 is still open); once it is, the step becomes a no-op.

Verified against the built dist linked into a consumer through the package exports map, with the repro from the issue (module/moduleResolution: NodeNext, declaration: true):

  • before: TS2883 on RangeValue; 117 of the emitted .d.ts files had no export statement
  • after: compiles, and the emitted type inlines (number | Date) | undefined as with 9.2.4; no declaration file is left without an export statement
  • importing every public entry point (., static-functions, reactivity, flex-render, store-reactivity-bindings, experimental-worker-plugin) with skipLibCheck: false type-checks both before and after, so nothing that the files import from each other was relying on the implicit exports

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm test and pnpm test:e2e, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.

Ran for @tanstack/table-core: build, test:types, test:build (publint) and test:lib (1330 tests pass), plus tsc --noEmit for the React, Vue and Solid adapters against the rebuilt dist. I did not run the full pnpm test / pnpm test:e2e suites; the change only touches the post-build declaration rewrite.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Bug Fixes
    • Prevented private declarations from appearing in generated type definition files, addressing TypeScript errors in affected projects.

@MFA-G
MFA-G requested a review from a team as a code owner October 8, 2026 07:53
@changeset-bot

changeset-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2cf7651

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: eb1cbfe8-8b2c-466c-a22d-585dc205a014
📥 Commits

Reviewing files that changed from the base of the PR and between 6aa0d74 and 2cf7651.

📒 Files selected for processing (2)
  • .changeset/quiet-dts-exports.md
  • 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 declaration rewrite script now appends export {}; to declaration files without a recognized export statement. A changeset declares a patch release for @tanstack/table-core.

Changes

Declaration export preservation

Layer / File(s) Summary
Preserve declaration module status
scripts/rewrite-table-core-dts.mjs, .changeset/quiet-dts-exports.md
The rewrite script leaves files with recognized export statements unchanged and appends export {}; to files without one. The changeset describes the declaration-emission change.

Priority: ➖ Normal

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: kevinvandy

Merge Risk: ⚪ Minimal · up to 2cf76

The change adds module markers to generated declarations that need them. No actionable merge blocker was established.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
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 1 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding export {} to declaration files without export statements in table-core.
Description check ✅ Passed The description includes the required Changes, Checklist, and Release Impact sections. It explains the problem, implementation, motivation, validation results, and changeset. It also clearly states th…
Linked Issues check ✅ Passed Issue [#6619] requires a workaround for TS2883 during consumer declaration emission. The pull request adds ensureExportStatement in scripts/rewrite-table-core-dts.mjs. It appends export {}; when…
Out of Scope Changes check ✅ Passed The changes stay within issue [#6619]. The script change implements the declaration-module workaround. The @tanstack/table-core patch changeset documents the TS2883 fix and supports its release. No …
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 1 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.

table-core 9.2.5+: private types leak from .d.ts files, declaration emit fails with TS2883

1 participant