Sometimes you don’t know property names in advance. An index signature says: any string key is allowed, and its value has one of a few types. This is useful for settings, flags, or small dictionaries.
interface Flags {
[key: string]: boolean;
}
You will count how many settings are turned on.
Count enabled flags in a settings object.