In the TypeScript docs, it gives this example of a array interface:
interface Dictionary {
[index: string]: string;
}
I don't get this. I thought associative arrays such as myArray['First'] were not good practice.
Can someone explain this or give me an example of using this interface?
'First'), not a string-typed index in general. The string literal case can be problematic because not all tools understand it and they can skip over it when you use IDE features like "Find Usages"/"Find All References" or try to rename/refactor a property.