Skip to content

Export CellOptions and CellOptionsOf - #5

Closed
johanrd wants to merge 1 commit into
nvp/inferred-table-typesfrom
options-for-row
Closed

johanrd wants to merge 1 commit into
nvp/inferred-table-typesfrom
options-for-row

Conversation

@johanrd

@johanrd johanrd commented Sep 22, 2026

Copy link
Copy Markdown
Owner

Rebased onto 60dafd9, which already types getOptionsForRow from the Cell's options arg — the same CellOptionsOf this PR carried. Only the exports are left.

CellOptions is the return type of the options callback in a column config, and CellOptionsOf is what getOptionsForRow hands a Cell. Both are part of the surface an app writes against, but neither can be named today:

// an app writing the callback cannot say what it returns
const options = (context: CellContext<Person>): CellOptions => ({ unit: 'years' });

public-option-types.test.ts covers both. The package is clean.

Cowritten by Claude

NullVoxPopuli-ai-agent pushed a commit to NullVoxPopuli-ai-agent/table that referenced this pull request Sep 22, 2026
…@options

- Column and Table default their cell args to `any`, so `Column<Person>`
  and `Table<Person>` accept a column or table whose Cells take extra
  args. The plugin helpers (`sort`, `isVisible`, `hide`, ...) take them
  with no change to their signatures. Tables from headlessTable still
  carry their inferred args.
- `row.table` has the types of the table, like `column.table`, in the
  rows of a table and in `CellContext`.
- `getOptionsForRow` has the `@options` that the Cells ask for, as in
  johanrd#5.
- Tests: each column decides which Cell fits it through its own meta,
  the plugin helpers accept a column with cell args, and a Cell renders
  with `@options={{column.getOptionsForRow row}}`.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
`CellOptions` is what the `options` callback of a column config must
return, and `CellOptionsOf` is what `getOptionsForRow` gives a Cell.
Both are part of the surface an app writes against, but neither could
be named.

Cowritten by Claude
@johanrd johanrd changed the title Give getOptionsForRow the options the Cell asks for Export CellOptions and CellOptionsOf Sep 22, 2026
@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.

1 participant