function cleanFlagsForSettings(flags = {}) {
  /** @type {LH.Util.RecursivePartial<LH.Config.Settings>} */
  const settings = {};

  for (const key of Object.keys(flags)) {
    if (key in constants.defaultSettings) {
      // @ts-expect-error tsc can't yet express that key is only a single type in each iteration, not a union of types.
      settings[key] = flags[key];
    }
  }

  return settings;
}
Creates a settings object from potential flags object by dropping all the properties
that don't exist on Config.Settings.
@param {Partial<LH.Flags>=} flags
@return {LH.Util.RecursivePartial<LH.Config.Settings>}