Struggling with the following code snippet:
interface IStudentType {
[key: `${Students}`]: IStudent | IStudentMaths| IStudentPhysics
}
The error message received is TS1268: An index signature parameter type must be 'string', 'number', 'symbol', or a template literal type.
To address this, an attempt was made:
type StudentCategories = 'Mature' | 'Graduate' | 'Fresher'
interface IStudentType {
[key: `${StudentCategories}`]: IStudent | IStudentMaths| IStudentPhysics
}
TS1337: An index signature parameter type cannot be a literal type or generic type. Consider using a mapped object type instead.
Looking for suggestions on how to resolve this issue.