I am gradually learning React using TypeScript.
I constantly face the problem of describing objects so that ESLint can prompt me.
I am trying to describe an object in an array so that its field name
was with a unique value from a possible enumeration IKeyNameColumns
.
To make it easier for me to understand what I mean, I'd better give an example:
type IKeyNameColumns = 'name' | 'status' | 'type' | 'age'
interface IListColumns {
columns: Array<{
title: string
name: IKeyNameColumns // need only one uniq value of IKeyNameColumns
}>
}
I understand that it is rather done with the help of Generics and rather has something to do with the collection Set
.