mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
use strongly-typed column dataIndex bindings
This commit is contained in:
parent
83b11c035b
commit
cfc90adc9d
1 changed files with 15 additions and 1 deletions
|
|
@ -1,9 +1,23 @@
|
|||
import { ColumnProps } from "antd/lib/table";
|
||||
import { List } from './List';
|
||||
|
||||
const nameof = <T>(name: Extract<keyof T, string>): string => name;
|
||||
|
||||
export const columns: ColumnProps<List>[] = [
|
||||
{
|
||||
title: 'Name',
|
||||
dataIndex: 'name',
|
||||
dataIndex: nameof<List>("name")
|
||||
},
|
||||
{
|
||||
title: 'Description',
|
||||
dataIndex: nameof<List>("description")
|
||||
},
|
||||
{
|
||||
title: 'Languages',
|
||||
dataIndex: nameof<List>("languageIds")
|
||||
},
|
||||
{
|
||||
title: 'Tags',
|
||||
dataIndex: nameof<List>("tagIds")
|
||||
}
|
||||
];
|
||||
|
|
|
|||
Loading…
Reference in a new issue