function normalizeOptions(
  options,
  optionInfos,
  {
    logger = false,
    isCLI = false,
    passThrough = false,
    FlagSchema,
    descriptor,
  } = {},
) {
  // TODO: Move CLI related part into `/src/cli`
  if (isCLI) {
    /* c8 ignore start */
    if (!FlagSchema) {
      throw new Error("'FlagSchema' option is required.");
    }

    if (!descriptor) {
      throw new Error("'descriptor' option is required.");
    }
    /* c8 ignore stop */
  } else {
    descriptor = vnopts.apiDescriptor;
  }

  const unknown = !passThrough
    ? (key, value, options) => {
        // Don't suggest `_` for unknown flags
        const { _, ...schemas } = options.schemas;
        return vnopts.levenUnknownHandler(key, value, {
          ...options,
          schemas,
        });
      }
    : Array.isArray(passThrough)
      ? (key, value) =>
          !passThrough.includes(key) ? undefined : { [key]: value }
      : (key, value) => ({ [key]: value });

  const schemas = optionInfosToSchemas(optionInfos, { isCLI, FlagSchema });
  const normalizer = new vnopts.Normalizer(schemas, {
    logger,
    unknown,
    descriptor,
  });

  const shouldSuppressDuplicateDeprecationWarnings = logger !== false;

  if (shouldSuppressDuplicateDeprecationWarnings && hasDeprecationWarned) {
    // @ts-expect-error
    normalizer._hasDeprecationWarned = hasDeprecationWarned;
  }

  const normalized = normalizer.normalize(options);

  if (shouldSuppressDuplicateDeprecationWarnings) {
    // @ts-expect-error
    hasDeprecationWarned = normalizer._hasDeprecationWarned;
  }

  return normalized;
}
@param {*} options
@param {*} optionInfos
@param {{ logger?: false; isCLI?: boolean; passThrough?: string[] | boolean; FlagSchema?: any; descriptor?: any }} param2