I have the next code:
interface IPeople {
id: number,
role: string
}
const peoples: IPeople[] = [
{
id: 1,
role: 'student'
},
{
id: 2,
role: 'teacher'
}
]
I need to get the type of string literals based on peoples roles:
type PeoplesRoles = 'student' | 'teacher'
Can i do it dinamically? Thanks