0 of 6 problems solved0%
4 of 6

Config Extra Keys

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.

Your Task

List all keys other than the known name.

  • Define interface Config { name: string; [key: string]: unknown }.
  • Implement function extraKeys(cfg: Config): string[] that returns every key except 'name'.
  • Do not mutate cfg; return a new array of keys.
  • Order does not matter, but the provided tests expect insertion order for the given input.