Exploring arrays, I discovered the following setup:
const MyArray = [
{ name: "Alice", age: 15 },
{ name: "Bob", age: 23 },
{ name: "Eve", age: 38 },
];
type Person = typeof MyArray[number];
Curious, I attempted a similar approach with interfaces:
interface A {
a: number;
}
type PropertiesTypeByString = A[string]
Unfortunately, an error was thrown:
Type 'A' has no matching index signature for type 'string'.
If I want to access all properties of type string
, what is the best way to tackle this issue?