use strongly-typed column dataIndex bindings

This commit is contained in:
Collin M. Barrett 2019-08-04 18:16:01 -05:00
parent 83b11c035b
commit cfc90adc9d

View file

@ -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")
}
];