Skip to content

fix: table internal and tests, lower intantiations more#6322

Merged
KevinVandy merged 1 commit into
betafrom
fix-table-internal-more
Jun 14, 2026
Merged

fix: table internal and tests, lower intantiations more#6322
KevinVandy merged 1 commit into
betafrom
fix-table-internal-more

Conversation

@KevinVandy

@KevinVandy KevinVandy commented Jun 14, 2026

Copy link
Copy Markdown
Member

🎯 Changes

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm test:pr.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed column resizing API method name casing for consistency
    • Expanded table rows now persist during filter changes
  • Documentation

    • Added workflow documentation for investigating and fixing GitHub issues

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Several core table-core type aliases (Table_Core, Table_Internal, TableState_All, Column_Internal, HeaderGroup, CachedRowModel_All, RowModelFns_All, ColumnHelper) are converted to interfaces with in out variance annotations. Internal type casts are simplified, setcolumnResizing is renamed to setColumnResizing, and tests are updated to match. A autoResetExpanded: false fix is applied to the kitchen-sink example, and a new skills document for GitHub issue workflows is added.

Changes

TypeScript Type System Refactor and API Fix

Layer / File(s) Summary
Core type aliases converted to interfaces with variance
packages/table-core/src/types/Table.ts, packages/table-core/src/types/TableState.ts, packages/table-core/src/types/Column.ts, packages/table-core/src/types/HeaderGroup.ts, packages/table-core/src/types/RowModel.ts, packages/table-core/src/types/RowModelFns.ts, packages/table-core/src/helpers/columnHelper.ts
Table_Core, Table_Internal, TableState_All, Column_Internal, HeaderGroup, CachedRowModel_All, RowModelFns_All, and ColumnHelper are each converted from type aliases to interface declarations; Table_Internal also drops its explicit per-feature extends clauses and the associated JSDoc; in out variance annotations are applied where applicable.
Type cast cleanup, API casing fix, and formatting
packages/table-core/src/features/column-resizing/columnResizingFeature.types.ts, packages/table-core/src/core/headers/buildHeaderGroups.ts, packages/table-core/src/features/column-filtering/columnFilteringFeature.utils.ts, packages/table-core/src/features/global-filtering/globalFilteringFeature.utils.ts, packages/table-core/src/features/column-pinning/columnPinningFeature.utils.ts, packages/table-core/src/core/columns/coreColumnsFeature.utils.ts
setcolumnResizing is renamed to setColumnResizing in Table_ColumnResizing. buildHeaderGroups adds an explicit Header<TFeatures, TData, unknown> cast. Column-filtering and global-filtering utils switch Column_Internal casts to any. Column-pinning utils replace Column_Internal-based casts with the public Column type.
Test type strengthening and non-null assertion removal
packages/table-core/tests/helpers/rowPinningHelpers.ts, packages/table-core/tests/implementation/features/row-pinning/rowPinningFeature.test.ts, packages/table-core/tests/unit/core/tableAtoms.test.ts, packages/table-core/tests/unit/features/column-pinning/columnPinningFeature.utils.test.ts, packages/table-core/tests/unit/features/row-pinning/rowPinningFeature.utils.test.ts
createTableWithMockOnPinningChange explicitly types its returned table as Table_Internal & Table_RowPinning. makeTable becomes generic. Column-pinning test casts add Table_ColumnPinning and Table_ColumnOrdering intersections. Non-null assertions on baseAtoms.rowPinning are removed across row-pinning tests.
Kitchen-sink example: disable autoResetExpanded during filtering
examples/react/kitchen-sink/src/main.tsx
Adds autoResetExpanded: false to initialState in useTable, preventing expanded row state from resetting on filter changes.

GitHub Issue Workflow Skill Document

Layer / File(s) Summary
New SKILL.md for GitHub issue workflow
skills/github-issue-repro-and-fix/SKILL.md
Introduces a 90-line skill guide covering steps for gathering issue context, mapping to the codebase, reproducing the issue, applying a focused fix, and reporting outcomes, along with decision rules and useful commands.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • TanStack/table#6268: Both PRs modify buildHeaderGroups.ts—the main PR adds an explicit Header<...> cast when pushing headers, while #6268 refactors the span/iteration logic in that same file.
  • TanStack/table#6305: Directly overlaps with this PR's conversion of Column_Internal, ColumnHelper, HeaderGroup, Table_Core, and TableState_All from type aliases to interfaces and the associated cast/typing adjustments.
  • TanStack/table#6320: Closely related TypeScript type-performance refactor work on table-core, particularly around Table_Core/Table_Internal construction and interface shaping.

Suggested reviewers

  • schiller-manuel

🐇 Interfaces now stand with in out flair,
setColumnResizing spelled with proper care.
Old type aliases hid behind an =,
Now they extend with variance on display!
The rabbit hops through types, checks, and tests—
A cleaner type graph is simply the best! 🎉

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 72.73% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is vague and does not clearly convey the main changes; "intantiations" appears to be a typo, and "lower instantiations more" is unclear about what specifically was refactored. Revise the title to be more specific about the primary changes, such as 'refactor: convert type aliases to interfaces with variance annotations' or clarify the optimization goal with proper spelling.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-table-internal-more

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 and usage tips.

@nx-cloud

nx-cloud Bot commented Jun 14, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit a700803

Command Status Duration Result
nx affected --targets=test:eslint,test:sherif,t... ✅ Succeeded 4m 11s View ↗
nx run-many --targets=build --exclude=examples/** ✅ Succeeded 25s View ↗

☁️ Nx Cloud last updated this comment at 2026-06-14 18:02:55 UTC

@pkg-pr-new

pkg-pr-new Bot commented Jun 14, 2026

Copy link
Copy Markdown
More templates

@tanstack/angular-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/angular-table@6322

@tanstack/angular-table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/angular-table-devtools@6322

@tanstack/lit-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/lit-table@6322

@tanstack/match-sorter-utils

npm i https://pkg.pr.new/TanStack/table/@tanstack/match-sorter-utils@6322

@tanstack/preact-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/preact-table@6322

@tanstack/preact-table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/preact-table-devtools@6322

@tanstack/react-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/react-table@6322

@tanstack/react-table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/react-table-devtools@6322

@tanstack/solid-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/solid-table@6322

@tanstack/solid-table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/solid-table-devtools@6322

@tanstack/svelte-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/svelte-table@6322

@tanstack/table-core

npm i https://pkg.pr.new/TanStack/table/@tanstack/table-core@6322

@tanstack/table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/table-devtools@6322

@tanstack/vue-table

npm i https://pkg.pr.new/TanStack/table/@tanstack/vue-table@6322

@tanstack/vue-table-devtools

npm i https://pkg.pr.new/TanStack/table/@tanstack/vue-table-devtools@6322

commit: a700803

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/table-core/src/features/column-pinning/columnPinningFeature.utils.ts`:
- Line 367: There is a type handling inconsistency across feature utility files
following the Column_Internal type narrowing refactor. In
columnPinningFeature.utils.ts, the explicit type cast was removed and the code
uses the public Column type instead, but in columnFilteringFeature.utils.ts and
globalFilteringFeature.utils.ts, as any casts are still being used. Update
columnFilteringFeature.utils.ts and globalFilteringFeature.utils.ts to follow
the same pattern as columnPinningFeature.utils.ts: remove the as any casts
applied to orderedLeafColumns or similar column array variables, and instead
rely on the public Column type (Column<TFeatures, TData, unknown>) to preserve
the full type contract after the Column_Internal narrowing refactor, ensuring
consistent type handling across all three files.

In `@packages/table-core/src/types/Column.ts`:
- Around line 45-51: The type narrowing in Column_Internal omits the
ExtractFeatureMapTypes intersection present in the broader Column type, causing
type mismatches. Update the callback function signatures that currently expect
Column to instead accept Column_Internal: In columnFilteringFeature.types.ts
(where filterFn.autoRemove is defined around line 83), change the parameter type
to Column_Internal, and in globalFilteringFeature.types.ts (where
getColumnCanGlobalFilter is defined around line 52), change the parameter type
to Column_Internal. Then remove the as any casts at the call sites in
columnFilteringFeature.utils.ts (line 326) and globalFilteringFeature.utils.ts
(line 29) respectively, since the types will now match correctly.
🪄 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: 4ed4f2ef-a4ec-4e1c-abf4-7e4755e16102

📥 Commits

Reviewing files that changed from the base of the PR and between e425d60 and a700803.

📒 Files selected for processing (20)
  • examples/react/kitchen-sink/src/main.tsx
  • packages/table-core/src/core/columns/coreColumnsFeature.utils.ts
  • packages/table-core/src/core/headers/buildHeaderGroups.ts
  • packages/table-core/src/features/column-filtering/columnFilteringFeature.utils.ts
  • packages/table-core/src/features/column-pinning/columnPinningFeature.utils.ts
  • packages/table-core/src/features/column-resizing/columnResizingFeature.types.ts
  • packages/table-core/src/features/global-filtering/globalFilteringFeature.utils.ts
  • packages/table-core/src/helpers/columnHelper.ts
  • packages/table-core/src/types/Column.ts
  • packages/table-core/src/types/HeaderGroup.ts
  • packages/table-core/src/types/RowModel.ts
  • packages/table-core/src/types/RowModelFns.ts
  • packages/table-core/src/types/Table.ts
  • packages/table-core/src/types/TableState.ts
  • packages/table-core/tests/helpers/rowPinningHelpers.ts
  • packages/table-core/tests/implementation/features/row-pinning/rowPinningFeature.test.ts
  • packages/table-core/tests/unit/core/tableAtoms.test.ts
  • packages/table-core/tests/unit/features/column-pinning/columnPinningFeature.utils.test.ts
  • packages/table-core/tests/unit/features/row-pinning/rowPinningFeature.utils.test.ts
  • skills/github-issue-repro-and-fix/SKILL.md

string,
Column_Internal<TFeatures, TData, unknown>
>
const leafColumnsById = table.getAllLeafColumnsById()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Type cast removal at line 367 reflects Column_Internal narrowing.

The explicit cast previously applied to leafColumnsById has been removed, and at lines 371 and 405, the orderedLeafColumns arrays now use the public Column<TFeatures, TData, unknown> type instead of Column_Internal<...>.

This change is consistent with the Column_Internal type narrowing in Column.ts (lines 45-51): since Column_Internal no longer includes feature-specific types, this code switched to the public Column type to preserve the full type contract.

However, this creates an inconsistency with columnFilteringFeature.utils.ts and globalFilteringFeature.utils.ts, which use as any casts instead of switching to Column. The mixed approaches suggest the type refactor may not have a consistent resolution strategy.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/table-core/src/features/column-pinning/columnPinningFeature.utils.ts`
at line 367, There is a type handling inconsistency across feature utility files
following the Column_Internal type narrowing refactor. In
columnPinningFeature.utils.ts, the explicit type cast was removed and the code
uses the public Column type instead, but in columnFilteringFeature.utils.ts and
globalFilteringFeature.utils.ts, as any casts are still being used. Update
columnFilteringFeature.utils.ts and globalFilteringFeature.utils.ts to follow
the same pattern as columnPinningFeature.utils.ts: remove the as any casts
applied to orderedLeafColumns or similar column array variables, and instead
rely on the public Column type (Column<TFeatures, TData, unknown>) to preserve
the full type contract after the Column_Internal narrowing refactor, ensuring
consistent type handling across all three files.

Comment on lines +45 to 51
export interface Column_Internal<
in out TFeatures extends TableFeatures,
in out TData extends RowData,
TValue = unknown,
> = Column<TFeatures, TData, TValue> & {
> extends Omit<Column_Core<TFeatures, TData, TValue>, 'columnDef'> {
columnDef: ColumnDefBase_All<TFeatures, TData, TValue>
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Identify all Column_Internal usages and `as any` casts related to column types
echo "=== All Column_Internal usages ==="
rg -n 'Column_Internal<' --type=ts -C 1

echo ""
echo "=== Column type casts to any (potential type gaps) ==="
rg -n 'column.*as any' --type=ts -C 2

echo ""
echo "=== FilterFn and callback signatures expecting column parameters ==="
rg -nP 'autoRemove.*\(|getColumnCanGlobalFilter.*\(' --type=ts -C 2

Repository: TanStack/table

Length of output: 50370


🏁 Script executed:

# Read the Column_Internal definition and related types
cat -n packages/table-core/src/types/Column.ts | sed -n '40,65p'

Repository: TanStack/table

Length of output: 561


🏁 Script executed:

# Look at FilterFn type definition and autoRemove signature
rg -n 'interface FilterFn|type FilterFn' --type=ts -A 10

Repository: TanStack/table

Length of output: 3792


🏁 Script executed:

# Find getColumnCanGlobalFilter callback signature
rg -n 'getColumnCanGlobalFilter' packages/table-core/src --type=ts -B 2 -A 2

Repository: TanStack/table

Length of output: 2502


🏁 Script executed:

# Find ColumnFilterAutoRemoveTestFn definition
rg -n 'ColumnFilterAutoRemoveTestFn' packages/table-core/src --type=ts -B 1 -A 5

Repository: TanStack/table

Length of output: 1677


🏁 Script executed:

# Get the full getColumnCanGlobalFilter signature
rg -n 'getColumnCanGlobalFilter' packages/table-core/src/features/global-filtering/globalFilteringFeature.types.ts -A 8

Repository: TanStack/table

Length of output: 346


🏁 Script executed:

# Check if Column_Internal ever intersected with Column (check git or find evidence of expected type)
cat -n packages/table-core/src/types/Column.ts | sed -n '39,75p'

Repository: TanStack/table

Length of output: 603


🏁 Script executed:

# Verify these are the only two production code as any casts related to this issue
# Filter out test files and examples
rg -n 'column.*as any' packages/table-core/src --type=ts | grep -v test | grep -v example

Repository: TanStack/table

Length of output: 359


🏁 Script executed:

# Check context around the function that uses these callbacks
cat -n packages/table-core/src/features/column-filtering/columnFilteringFeature.utils.ts | sed -n '310,335p'

Repository: TanStack/table

Length of output: 773


Type narrowing in Column_Internal causes downstream type-safety gaps.

The type definition of Column_Internal extends only Omit<Column_Core<...>, 'columnDef'>, omitting the ExtractFeatureMapTypes intersection present in the broader Column type. This forces two callback functions to suppress type safety with as any casts:

  • packages/table-core/src/features/column-filtering/columnFilteringFeature.utils.ts#L326: Casts column to any when passing to filterFn.autoRemove, which expects Column<TFeatures, TData, TValue> (line 83 of columnFilteringFeature.types.ts).
  • packages/table-core/src/features/global-filtering/globalFilteringFeature.utils.ts#L29: Casts column to any when passing to getColumnCanGlobalFilter, which expects Column<TFeatures, TData, TValue> (line 52 of globalFilteringFeature.types.ts).

Adjust the callback signatures to accept Column_Internal explicitly rather than relying on any to suppress the type mismatch.

📍 Affects 3 files
  • packages/table-core/src/types/Column.ts#L45-L51 (this comment)
  • packages/table-core/src/features/column-filtering/columnFilteringFeature.utils.ts#L326-L326
  • packages/table-core/src/features/global-filtering/globalFilteringFeature.utils.ts#L29-L29
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/table-core/src/types/Column.ts` around lines 45 - 51, The type
narrowing in Column_Internal omits the ExtractFeatureMapTypes intersection
present in the broader Column type, causing type mismatches. Update the callback
function signatures that currently expect Column to instead accept
Column_Internal: In columnFilteringFeature.types.ts (where filterFn.autoRemove
is defined around line 83), change the parameter type to Column_Internal, and in
globalFilteringFeature.types.ts (where getColumnCanGlobalFilter is defined
around line 52), change the parameter type to Column_Internal. Then remove the
as any casts at the call sites in columnFilteringFeature.utils.ts (line 326) and
globalFilteringFeature.utils.ts (line 29) respectively, since the types will now
match correctly.

@KevinVandy KevinVandy merged commit 37debcb into beta Jun 14, 2026
8 of 9 checks passed
@KevinVandy KevinVandy deleted the fix-table-internal-more branch June 14, 2026 23:10
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