Skip to content
Source
Sign inSign up
TanStack/table

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

Closedgrzdev(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/6621/headopened

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.
    1. 🦋 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
      NameType
      @tanstack/table-corePatch
      @tanstack/alpine-tablePatch
      @tanstack/angular-table-devtoolsPatch
      @tanstack/angular-tablePatch
      @tanstack/ember-tablePatch
      @tanstack/lit-tablePatch
      @tanstack/octane-tablePatch
      @tanstack/preact-tablePatch
      @tanstack/react-tablePatch
      @tanstack/solid-tablePatch
      @tanstack/svelte-tablePatch
      @tanstack/vue-tablePatch

      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

    2. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      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 6aa0d74946b393f4f316085998bb6ec31c2ef593 and 34c2ca0f9a5754a215461aabf23350a0f42fe6de.

      📒 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 nameStatusExplanationResolution
      Description check⚠️ WarningThe 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⚠️ WarningDocstring 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 nameStatusExplanation
      Title check✅ PassedThe title clearly and concisely identifies both main changes: exporting RangeValue and preserving module scope in emitted declaration files.
      Linked Issues check✅ PassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes check✅ PassedCheck 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.
    3. grzdev(GitHub profile, opens in a new tab)commented

      Closing in favor of the earlier open pull request https://github.com/TanStack/table/pull/6620.

Sign in to join this conversation.