{"id":"56a589d6fe8f0f97","repo":"babel/babel","slug":"the-partial-application-plugin-requires-a-version","errorCode":null,"errorMessage":"The partial application plugin requires a \"version\" option. \"version\" must be one of: ${VERSIONS.join(\", \")}.","messagePattern":"The partial application plugin requires a \"version\" option\\. \"version\" must be one of: (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/babel-plugin-syntax-partial-application/src/index.ts","lineNumber":13,"sourceCode":"import { declare } from \"@babel/helper-plugin-utils\";\n\nconst VERSIONS = [\"2018-07\"] as const;\nexport interface Options {\n  version: (typeof VERSIONS)[number];\n}\n\nexport default declare((api, options: Options) => {\n  api.assertVersion(REQUIRED_VERSION(\"^7.0.0-0 || ^8.0.0\"));\n  const { version } = options ?? {};\n\n  if (typeof version !== \"string\" || !VERSIONS.includes(version)) {\n    throw new Error(\n      `The partial application plugin requires a \"version\" option. ` +\n        `\"version\" must be one of: ${VERSIONS.join(\", \")}.`,\n    );\n  }\n\n  return {\n    name: \"syntax-partial-application\",\n\n    manipulateOptions(opts, parserOpts) {\n      parserOpts.plugins.push([\"partialApplication\", { version }]);\n    },\n  };\n});\n","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/babel/babel/blob/06b6eae39da4ce0689fad64e2c48a6375a464208/packages/babel-plugin-syntax-partial-application/src/index.ts#L1-L27","documentation":"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.","triggerScenarios":"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.","commonSituations":"New installs that follow a docs example which omitted the version, or upgrades where a previously defaulted version was removed and made mandatory.","solutions":["Add `{ version: \"2018-07\" }` to the plugin options (it is currently the only supported version)."],"exampleFix":"// before\nplugins: [\"@babel/plugin-proposal-partial-application\"]\n// after\nplugins: [[\"@babel/plugin-proposal-partial-application\", { version: \"2018-07\" }]]","handlingStrategy":"type-guard","validationCode":"const ALLOWED = [\"2018-07\"];\nif (!ALLOWED.includes(opts.version)) {\n  throw new Error(`partial-application version must be one of: ${ALLOWED.join(\", \")}`);\n}","typeGuard":"const PA_VERSIONS = [\"2018-07\"] as const;\ntype PAVersion = (typeof PA_VERSIONS)[number];\nfunction isPAVersion(v: unknown): v is PAVersion {\n  return typeof v === \"string\" && (PA_VERSIONS as readonly string[]).includes(v);\n}","tryCatchPattern":null,"preventionTips":["Always pass the options-object form to versioned proposal plugins.","Centralize proposal-version constants in one config module."],"tags":["babel","partial-application","config","parser-option"],"analyzedSha":"06b6eae39da4ce0689fad64e2c48a6375a464208","analyzedAt":"2026-08-03T20:13:43.465Z","schemaVersion":2}