Skip to content

Commit

Permalink
feat: columnHelper.display helper for non-accessing column defs
Browse files Browse the repository at this point in the history
  • Loading branch information
tannerlinsley committed Jul 26, 2022
1 parent d249606 commit 6af0d85
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/table-core/src/columnHelper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AccessorFn, ColumnDef, RowData } from './types'
import { DeepKeys, DeepValue } from './utils'
import { DeepKeys, DeepValue, RequiredKeys } from './utils'

// type Person = {
// firstName: string
Expand Down Expand Up @@ -53,6 +53,12 @@ export type ColumnHelper<TData extends RowData> = {
accessor: TAccessor,
column: Omit<ColumnDef<TData, TValue>, 'accessorKey'>
) => ColumnDef<TData, TValue>
display: (
column: RequiredKeys<
Omit<ColumnDef<TData, unknown>, 'accessorKey' | 'accessorFn'>,
'id'
>
) => ColumnDef<TData, unknown>
}

export function createColumnHelper<
Expand All @@ -70,5 +76,6 @@ export function createColumnHelper<
accessorKey: accessor,
}
},
display: column => column as ColumnDef<TData, unknown>,
}
}

0 comments on commit 6af0d85

Please sign in to comment.