Index signatures let an object accept many unknown keys alongside known ones. This is useful for flexible configs. You can still reason about known keys while allowing extras.
interface Bag {
name: string;
[k: string]: unknown;
}Return the extra keys so callers can validate or log them.
List all keys other than the known name.
interface Config { name: string; [key: string]: unknown }.extraKeys(cfg: Config): string[] that returns every key except 'name'.cfg; return a new array of keys.