Skip to content

Name the column of any table, and keep Column checked - #8

Closed
johanrd wants to merge 1 commit into
nvp/inferred-table-typesfrom
any-column
Closed

johanrd wants to merge 1 commit into
nvp/inferred-table-typesfrom
any-column

Conversation

@johanrd

@johanrd johanrd commented Sep 22, 2026

Copy link
Copy Markdown
Owner

On top of universal-ember#202 (60dafd9). An alternative to the CellArgs = any default in that commit, and to #4.

60dafd9 makes CellArgs default to any so that a column whose Cell asks for args fits a Column<DataType> parameter — which the plugin helpers need. It also makes the Cell of every column written by hand unchecked:

// 4.0.0:   ComponentLike<CellContext<Person>>   — @row and @column required
// 60dafd9: ComponentLike<any>                   — any args, none required
type Cell = Column<Person>['Cell'];

So <column.Cell /> with no args, or with args no Cell takes, now passes at any site that writes Column<T> by hand.

The two readings of Column<Person> cannot both hold: "a column I will render", which needs the Cell checked, and "a column I only read", which needs any column to fit. This gives the second one its own name.

  • AnyColumn and AnyTable are what the plugin helpers, meta.forColumn, the header modifier and the resize handle take.
  • CellArgs goes back to unknown, so Column<Person> is checked again.
  • Your takesAnyColumn and takesAnyTable in cell-args.test.ts say AnyColumn / AnyTable, and still pass.

88 lines of source across 11 files, against 250 in #4, which threaded the four parameters through every plugin signature instead. #4 can be closed either way.

Checked: the package, its type tests and test-app are clean. Our app — 13 tables, about 300 call sites — type checks and lints clean on this plus #6.

Cowritten by Claude

60dafd9 makes `CellArgs` default to `any`, so that a column whose Cell
asks for args fits a `Column<DataType>` parameter. It also makes the
Cell of every column written by hand unchecked: `Column<Person>['Cell']`
is `ComponentLike<any>`, which takes any args and requires none, not
even `@row` and `@column`. On 4.0.0 it was `ComponentLike<CellContext<T>>`.

The two readings of `Column<Person>` — "a column I will render" and "a
column I only read" — cannot both hold. This gives the second one its
own name, so the first keeps its checks.

`AnyColumn` and `AnyTable` are what the plugin helpers, `meta.forColumn`,
the header modifier and the resize handle take. The default goes back to
`unknown`.

Cowritten by Claude
@johanrd johanrd closed this Sep 23, 2026
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