babel/babel · error · Error

The partial application plugin requires a "version" option.

Error message

The partial application plugin requires a "version" option. "version" must be one of: ${VERSIONS.join(", ")}.

What it means

Thrown by @babel/plugin-syntax-partial-application (index.ts:13) when `version` is missing or not in the allowed set. The plugin enables the `?` placeholder token for partial application; the parser plugin needs an explicit spec version because the syntax is still at proposal stage and the grammar is versioned.

Source

Thrown at packages/babel-plugin-syntax-partial-application/src/index.ts:13

import { declare } from "@babel/helper-plugin-utils";

const VERSIONS = ["2018-07"] as const;
export interface Options {
  version: (typeof VERSIONS)[number];
}

export default declare((api, options: Options) => {
  api.assertVersion(REQUIRED_VERSION("^7.0.0-0 || ^8.0.0"));
  const { version } = options ?? {};

  if (typeof version !== "string" || !VERSIONS.includes(version)) {
    throw new Error(
      `The partial application plugin requires a "version" option. ` +
        `"version" must be one of: ${VERSIONS.join(", ")}.`,
    );
  }

  return {
    name: "syntax-partial-application",

    manipulateOptions(opts, parserOpts) {
      parserOpts.plugins.push(["partialApplication", { version }]);
    },
  };
});

View on GitHub (pinned to 06b6eae39d)

Solutions

  1. Add `{ version: "2018-07" }` to the plugin options (it is currently the only supported version).

Example fix

// before
plugins: ["@babel/plugin-proposal-partial-application"]
// after
plugins: [["@babel/plugin-proposal-partial-application", { version: "2018-07" }]]
Defensive patterns

Strategy: type-guard

Validate before calling

const ALLOWED = ["2018-07"];
if (!ALLOWED.includes(opts.version)) {
  throw new Error(`partial-application version must be one of: ${ALLOWED.join(", ")}`);
}

Type guard

const PA_VERSIONS = ["2018-07"] as const;
type PAVersion = (typeof PA_VERSIONS)[number];
function isPAVersion(v: unknown): v is PAVersion {
  return typeof v === "string" && (PA_VERSIONS as readonly string[]).includes(v);
}

Prevention

When it happens

Trigger: Loading the plugin as a bare string `"@babel/plugin-proposal-partial-application"` or `["...", {}]` without `version`. VERSIONS is `["2018-07"]` at index.ts:3, and the check at index.ts:12 requires `version` to be exactly one of those.

Common situations: New installs that follow a docs example which omitted the version, or upgrades where a previously defaulted version was removed and made mandatory.

Related errors


AI-assisted analysis of babel/babel@06b6eae39d (2026-08-03). Data as JSON: /data/errors/56a589d6fe8f0f97.json. Report an issue: GitHub.