[docs-update] Update docs for narrowed DataTable Column accessor types#253
Merged
IzumiSy merged 1 commit intoMay 13, 2026
Merged
Conversation
Per the narrow-data-table-accessor changeset, Column.accessor's return type is now narrowed per type branch — returning an array or plain object from a text/number/money/date/badge/link accessor is a compile error. Updates to docs/components/data-table.md: - Update accessor row in shared fields table to reflect type-narrowing - Add 'Accessor return type' column to the cell types table with exact TypeScript types per branch - Add compile error examples showing array/object accessor rejection Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
erickteowarang
pushed a commit
that referenced
this pull request
May 14, 2026
Brings in #247 (type-aware cell renderers), #248 (column align), #251 (oxlint upgrade), #253 (accessor narrowing docs), and #254 (inferColumns no longer carries an accessor). Conflicts: - types.ts: dropped the duplicate `accessor` declaration from `ColumnBase` (it now lives per-branch in `ColumnTypeBranch` per #247) and kept both new fields — `align` (from #248) and `truncate` (from this branch). Updated `truncate`'s JSDoc to describe the Tooltip wiring rather than the `title` attribute. - field-helpers.ts: kept main's spread-based `column()` so the discriminated union survives. - data-table.tsx: combined `align` and `truncate` into the same cell classes; rebuilt `content` via `col.render ?? renderTypedCell(...)` (from #247). - data-table.test.tsx / docs: kept both feature describe blocks and combined doc tables. Per @IzumiSy's review (#249), the truncate tooltip now uses the app-shell `<Tooltip>` component (with a `Tooltip.Provider` mounted at `DataTable.Root`) instead of the browser `title` attribute. The cell is wrapped in `Tooltip.Trigger` only when `accessor` returns a stringifiable primitive — objects / arrays / no accessor still apply the truncate CSS but skip the tooltip wiring. Tests: 1010 passing (was 992 + 8 new truncate tests). Lint, fmt, workspace typecheck all clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updates
docs/components/data-table.mdto reflect the accessor return type narrowing introduced by thenarrow-data-table-accessorchangeset.Changesets that prompted this update
narrow-data-table-accessor.md— NarrowsColumn.accessor's return type per built-intypeso typed cell renderers reject values they can't display (arrays, plain objects).null/undefinedremain allowed.The other three pending changesets were already fully documented:
red-badges-rest.md—subtle-success/subtle-warning/subtle-errorbadge variants already indocs/components/badge.mdshiny-walls-glow.md—defaultOpen/collapsibleSidebarLayout props already indocs/components/sidebar-layout.mdtyped-data-table-cells.md—type/typeOptionsColumn fields already indocs/components/data-table.mdDoc files modified
docs/components/data-table.mdaccessortype from(row: TRow) => unknownto_(narrowed per type)_with a description explaining that typed columns reject arrays and objects, while untyped columns retainunknown.typebranch (text,number,money,date,badge,link).row.tags: string[]) or plain object from a typed accessor is a compile error.