I'm working with typescript and I ran into an unfamiliar notation:
interface IDetailsListGroupedExampleItem {
key: string;
name: string;
color: string;
}
...
...
...
private _onRenderColumn(item: IDetailsListGroupedExampleItem, index: number, column: IColumn) {
const value =
item && column && column.fieldName
? item[column.fieldName as keyof IDetailsListGroupedExampleItem] || ''
: '';
return <div data-is-focusable={true}>{value}</div>;
}
Specifically, what does this line mean item[column.fieldName as keyof IDetailsListGroupedExampleItem]
?
Item is not an array, so I don't understand the usage of square brackets in this case. Is it a way to access a specific property of the item object?