Skip to content

[docs-update] Update docs for narrowed DataTable Column accessor types#253

Merged
IzumiSy merged 1 commit into
mainfrom
docs/update-for-pending-changesets-ecdfc59aeccc2e9c
May 13, 2026
Merged

[docs-update] Update docs for narrowed DataTable Column accessor types#253
IzumiSy merged 1 commit into
mainfrom
docs/update-for-pending-changesets-ecdfc59aeccc2e9c

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Summary

Updates docs/components/data-table.md to reflect the accessor return type narrowing introduced by the narrow-data-table-accessor changeset.

Changesets that prompted this update

  • narrow-data-table-accessor.md — Narrows Column.accessor's return type per built-in type so typed cell renderers reject values they can't display (arrays, plain objects). null/undefined remain allowed.

The other three pending changesets were already fully documented:

  • red-badges-rest.mdsubtle-success/subtle-warning/subtle-error badge variants already in docs/components/badge.md
  • shiny-walls-glow.mddefaultOpen/collapsible SidebarLayout props already in docs/components/sidebar-layout.md
  • typed-data-table-cells.mdtype/typeOptions Column fields already in docs/components/data-table.md

Doc files modified

docs/components/data-table.md

  • Shared fields table — Changed accessor type from (row: TRow) => unknown to _(narrowed per type)_ with a description explaining that typed columns reject arrays and objects, while untyped columns retain unknown.
  • Cell types table — Added an "Accessor return type" column showing the exact TypeScript type accepted by each type branch (text, number, money, date, badge, link).
  • Compile error examples — Added two new examples demonstrating that returning an array (row.tags: string[]) or plain object from a typed accessor is a compile error.

Generated by Documentation Updater

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>
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 13, 2026
@IzumiSy IzumiSy marked this pull request as ready for review May 13, 2026 06:59
@IzumiSy IzumiSy merged commit c16a195 into main May 13, 2026
@IzumiSy IzumiSy deleted the docs/update-for-pending-changesets-ecdfc59aeccc2e9c branch May 13, 2026 07:00
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant