Conversation
- ColumnConfig.meta: static facts about a column, typed by the augmentable ColumnMeta<T>, read as column.meta without a row. - column<T>(): checks one column's Cell against its own options. - Export CellContext, CellOptions, CellArgs, TypedColumnConfig. Table, Column and the plugins keep their type parameters.
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
It changes the published library's public type surface with subtle TypeScript generics currying and interface declaration-merging semantics that warrant final human sign-off, even though no concrete defects were found.
Review effort: Balanced
Findings: None
What changed in this PR
This PR extends the public API of @universal-ember/table with two type-focused features: a per-column meta bag for static, row-independent facts (alignment, export width, header component, etc.), and a curried column<T>() helper that type-checks a column's Cell component against that column's own options. It also promotes CellContext, CellOptions, CellArgs, and TypedColumnConfig to the public entrypoint so consumers no longer need to import from -private. The changes preserve existing type inference (T is still inferred from data/columns) and require no plugin changes.
Changes:
- Add an app-augmentable
ColumnMeta<T>interface plus ameta?field onColumnConfig<T>and ametagetter onColumn. - Add
column<T>()helper withCellArgsandTypedColumnConfigto enforce Cell/options agreement per column; widenCellargs to allow an optional@options. - Expose the new/existing types (
column,CellArgs,TypedColumnConfig,CellContext,CellOptions,ColumnMeta) from the public index and add type tests.
| File | Description |
|---|---|
table/src/index.ts |
Exports the new column helper and the newly public types. |
table/src/-private/interfaces/column.ts |
Adds ColumnMeta<T>, a meta? config field, and widens Cell args with optional options. |
table/src/-private/column.ts |
Adds a meta getter delegating to config.meta. |
table/src/-private/column-helper.ts |
New file defining CellArgs, TypedColumnConfig, and the curried column<T>() helper. |
table/src/-private/-type-tests/column-options.test.ts |
Type tests covering typed options, meta declaration merging, and inference. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Replaces the approach in universal-ember#111.
Table,Columnand the plugins keep their type parameters, soTis still inferred and no plugin file changes.meta: static facts about a column (alignment, export width, a header component). Apps declare the keys once onColumnMeta<T>, then readcolumn.metawith no row. Same idea ascolumnDef.metain TanStack Table.column<T>(): checks one column'sCellagainst that column'soptions. A wrong or missing option is a compile error. Same idea asflexRenderComponent(component, options).CellContext,CellOptions,CellArgsandTypedColumnConfigare public, so apps stop importing from-private.Cowritten by Claude