`aggregatedCell` not typed against bound `cellComponents` in `createAppColumnHelper`
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 78/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- react, typescript
- Ambito
- frontend
Direzione di ricerca
Inizia in packages/react-table/src/createTableHook.tsx, in particolare con AppColumnDefBase e il tipo ColumnDef_RowAggregation di rowAggregationFeature, quindi riproduci la discrepanza nel TypeScript playground collegato. Verifica che aggregatedCell riceva la stessa tipizzazione del componente cella associato di cell, e aggiungi o esegui un test mirato di controllo dei tipi se il repository ne fornisce uno.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
TanStack Table version
v9.2.4
Framework/Library version
React v19.2.6
Describe the bug and the steps to reproduce it
createTableHook's AppColumnDefBase enhances cell/header/footer with the
registered cellComponents/headerComponents, via:
Omit<IdentifiedColumnDef<...>, 'cell' | 'header' | 'footer'> & { cell?: ..., header?: ..., footer?: ... }
aggregatedCell (added by rowAggregationFeature's ColumnDef_RowAggregation) is not
included in that Omit list, so it stays typed against the plain, unenhanced CellContext.
Accessing a bound cell component works fine inside cell on a column, but fails inside
aggregatedCell on the exact same column.
Steps to reproduce:
- Register a cellComponents map via createTableHook (e.g.
{ NumberCell }). - Create a column with both
cellandaggregatedCell, each destructuringcelland
accessingcell.NumberCell. cell.NumberCelltype-checks insidecell, but TypeScript reports
"Property 'NumberCell' does not exist on type 'Cell<...>'" insideaggregatedCell.
Confirmed by reading packages/react-table/src/createTableHook.tsx directly (not just from
the compiled .d.ts) — AppColumnDefBase's Omit list is 'cell' | 'header' | 'footer' only.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
export function createAppColumnHelper<TData extends RowData>() {
const helper = createRawColumnHelper<TData>()
function accessor<
TAccessor extends AccessorFn<TData> | DeepKeys<TData>,
TValue extends TAccessor extends AccessorFn<TData, infer TReturn>
? TReturn
: TAccessor extends DeepKeys<TData>
? DeepValue<TData, TAccessor>
: never
>(
accessorArg: TAccessor,
column: Omit<
AppColumnDefBase<typeof appFeatures, TData, TValue, CellComponents, HeaderComponents>,
'aggregatedCell'
> & {
aggregatedCell?: AggregatedCellRender<TData, any>
} & (TAccessor extends AccessorFn<TData> ? { id: string } : {})
): TAccessor extends AccessorFn<TData>
? AccessorFnColumnDef<typeof appFeatures, TData, TValue>
: AccessorKeyColumnDef<typeof appFeatures, TData, TValue> {
const { aggregatedCell, ...rest } = column
return helper.accessor(
accessorArg as never,
{
...rest,
...(typeof aggregatedCell === 'function'
? {
aggregatedCell: (ctx: CellContext<typeof appFeatures, TData, TValue>) =>
aggregatedCell(
ctx as unknown as AppCellContext<
typeof appFeatures,
TData,
any,
CellComponents
>
)
}
: { aggregatedCell })
} as never
) as never
}
return { ...helper, accessor }
}
Terms & Code of Conduct
- I agree to follow this project's Code of Conduct
- I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
- Lingua principale
- TypeScript
- Stelle
- 28.4k
- Fork
- 3.6k
- Merge medio
- 1g 1h
- PR unite (30g)
- 7
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TanStack/table
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
Tutte le issue di TanStack/table
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
bug v2
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
modelcontextprotocol/inspector#2458 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
railmapgen/rmp-gallery#4068 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
carbon-design-system/ibm-products#9907 ·