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.
A table declares its own types once:
interface ReportTypes { columnMeta: ...; tableMeta: ... }
headlessTable(this, { types: tableTypes<ReportTypes>(), ... })
column.meta and table.config.meta then have these types wherever they
are read, also inside value, options and Cell. The slot names are those
of TanStack Table.
Tables that declare nothing are typed as before. Seven test sites
annotated a bare Table and assigned a typed table to it; that never was
assignable, so they name the table's type now.
|
why not pass a generic to |
|
@NullVoxPopuli I haven't been able to get past TypeScript's "all-or-nothing" rule for type arguments.
It's the same pattern TanStack v9 uses ( |
|
thanks! more questions / comments:
this is why an explicit type arg can be passed
why are there two type args? I don't understand -- current API is just one
what does this mean?
I don't think because someone else does sothing, it means it's the best way. The goal of this library is not to be compatible with tanstack, but to lean in to to the things we can do better, while taking inspiration where we can. |
|
yes, That is the second type parameter this PR adds: Type arguments are positional and all-or-nothing.
I'm not saying Tanstack v9 is necessarily the best for us, but so far it is the only trick i've found that does not break the inferance of DataType and at the same time provide strong types for column and meta. What I tried on this branch against `tsc`:
The helper is just a hidden |
|
thanks for the background (and PR) -- I'm going to attempt an experiment with claude, and see if things improve any -- maybe what you have provided here really is the best way (but I also don't see a problem in breaking changes) |
Replaces #111 . A table declares its types once. They apply wherever the table is read:
column.meta,table.config.metaand the args ofcolumn.Cell, also insidevalue,optionsand aCell.columnMeta,tableMeta). See Support / Investigate TanStack Table #48 .typesare typed as before. No test changed. No newany.NoInfer).Cowritten by Claude