I have the key-value-pair object in the following example
interface ItemType {
a: number;
b: string;
}
const list = {
first: {a: 1, b: 'one'},
second: {a: 2, b: 'two'},
third: {a: 3, b: 'three'},
} as { [key in keyof typeof list]: ItemType }
But it raises an error such as TS2313: Type parameter 'key' has a circular constraint..
I want all items to be of type of ItemType, but still want the list to save keys that I have inserted. If I cast it to { [key in string]: ItemType }, I will loose key names of the list. :(