UNPKG

@tanstack/table-core

Version:

Headless UI for building powerful tables & datagrids for TS/JS.

72 lines (63 loc) 1.42 kB
/** * table-core * * Copyright (c) TanStack * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */ 'use strict'; // type Person = { // firstName: string // lastName: string // age: number // visits: number // status: string // progress: number // createdAt: Date // nested: { // foo: [ // { // bar: 'bar' // } // ] // bar: { subBar: boolean }[] // baz: { // foo: 'foo' // bar: { // baz: 'baz' // } // } // } // } // const test: DeepKeys<Person> = 'nested.foo.0.bar' // const test2: DeepKeys<Person> = 'nested.bar' // const helper = createColumnHelper<Person>() // helper.accessor('nested.foo', { // cell: info => info.getValue(), // }) // helper.accessor('nested.foo.0.bar', { // cell: info => info.getValue(), // }) // helper.accessor('nested.bar', { // cell: info => info.getValue(), // }) function createColumnHelper() { return { accessor: (accessor, column) => { return typeof accessor === 'function' ? { ...column, accessorFn: accessor } : { ...column, accessorKey: accessor }; }, display: column => column, group: column => column }; } exports.createColumnHelper = createColumnHelper; //# sourceMappingURL=columnHelper.js.map