Skip to content

Keep the cell args a declared column list states - #6

Closed
johanrd wants to merge 1 commit into
nvp/inferred-table-typesfrom
cell-args-of-array
Closed

johanrd wants to merge 1 commit into
nvp/inferred-table-typesfrom
cell-args-of-array

Conversation

@johanrd

@johanrd johanrd commented Sep 22, 2026

Copy link
Copy Markdown
Owner

On top of universal-ember#202 (cfbb714). Independent of #4 and #5.

ColumnMetaOf has a branch for a column list that is a plain array — "A list with a declared type keeps that type". CellArgsOf has no such branch: it always derives the args from the Cells of the list. A plain array has no Cells to read, so the args are lost.

This stops a shared table component, which takes a column list from its caller and builds the table itself:

function makeTable<T, CellArgs>(
  columnConfigList: ColumnConfig<T, unknown, unknown, CellArgs>[],
  data: T[],
) {
  // error: the list is not assignable, because its args cannot be read back
  return headlessTable({}, { columns: () => columnConfigList, data: () => data });
}

The args now come from the config through a type-only property, the way the row type already does. A list written in place still reads its Cells, so nothing that infers today changes.

generic-wrapper.test.ts covers it. The package, its type tests and test-app are clean.

Cowritten by Claude

`ColumnMetaOf` reads the meta a declared list states, because such a list
is a plain array with no tuple members to read. `CellArgsOf` has no such
branch, so it always goes back to the Cells, and a list whose args are a
type parameter has no Cell to read them from.

A component that takes a column list from its caller and builds the
table itself could therefore not keep the args of that list.

The args now come from the config, the way the row type already does.
A list written in place still reads its Cells.

Cowritten by Claude
@johanrd

johanrd commented Sep 23, 2026

Copy link
Copy Markdown
Owner Author

superseded by universal-ember#203

@johanrd johanrd closed this Sep 23, 2026
NullVoxPopuli added a commit to universal-ember/table that referenced this pull request Sep 23, 2026
…red lists

- A column list with a declared type keeps its cell args, like it keeps
  its column meta. A shared component that takes
  `ColumnConfig<Row, unknown, unknown, CellArgs>[]` from its caller can
  build the table (johanrd#6).
- Each column written in place is checked on its own: its Cell takes the
  row type, the column's meta and the table meta, and when the Cell asks
  for `@options`, the column's `options` returns them.
- A table `meta` together with a callback that has parameters no longer
  loses the inferred cell args and column meta. The Cell check read the
  column list while TypeScript was still inferring it.
- `CellOptions` and `CellOptionsOf` are exported (johanrd#5).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.

2 participants