TS2538
error TS2538: Type ‘Person’ cannot be used as an index type.
Broken Code ❌
1 |
|
Fixed Code ✔️
You cannot use an interface as an index type, but you can use all keys of the interface using the keyof
type operator:
1 |
|
error TS2538: Type ‘Person’ cannot be used as an index type.
1 |
|
You cannot use an interface as an index type, but you can use all keys of the interface using the keyof
type operator:
1 |
|