{"record":{"id":"1c15b541b07c5af0","repo":"biomejs/biome","slug":"promise-global-must-have-a-value-side-declaration","errorCode":null,"errorMessage":"Promise global must have a value-side declaration","messagePattern":"Promise global must have a value-side declaration","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/codegen/src/generate_global_types/lower.rs","lineNumber":817,"sourceCode":"    ));\n\n    Ok(())\n}\n\n/// Validates the selected declarations before emitting the resolver's reduced Promise projection.\nfn lower_promise_globals(\n    manifest: &GlobalManifest,\n    source_cache: &mut ParsedSourceCache,\n    globals: &mut Vec<LoweredGlobal>,\n) -> Result<()> {\n    let Some(promise_group) = manifest.global_group(\"Promise\") else {\n        return Ok(());\n    };\n    if !promise_group.has_role(GlobalDeclarationRole::Type) {\n        bail!(\"Promise global must have a type-side declaration\");\n    }\n    if !promise_group.has_role(GlobalDeclarationRole::Value) {\n        bail!(\"Promise global must have a value-side declaration\");\n    }\n    validate_promise_constructor_reference(promise_group.declarations(), source_cache)?;\n\n    let mut saw_promise_interface = false;\n    let mut saw_methods = [false; PROMISE_METHOD_COUNT];\n    for record in promise_group.declarations() {\n        match &record.kind {\n            DeclarationKind::Interface => saw_promise_interface = true,\n            DeclarationKind::VariableDeclarator { .. } => continue,\n            DeclarationKind::TypeAlias => {\n                bail!(\"type aliases are not supported in the Promise global\")\n            }\n            DeclarationKind::DeclareFunction | DeclarationKind::ImportEquals => {\n                bail!(\"unsupported value-side Promise declaration\")\n            }\n        }\n\n        let declaration = source_cache","sourceCodeStart":799,"sourceCodeEnd":835,"githubUrl":"https://github.com/biomejs/biome/blob/3835945f0638c88162351318b7bc8b64c5f2fba7/xtask/codegen/src/generate_global_types/lower.rs#L799-L835","documentation":"Biome's xtask codegen requires the 'Promise' global declaration group to include a value-side declaration (the `declare var Promise: PromiseConstructor` style record). When the group exists but carries no Value role declaration, the Promise global's runtime value cannot be lowered and the generator bails.","triggerScenarios":"Running `cargo xtask codegen` when the manifest's 'Promise' group has a Type-role record but no Value-role record — e.g. the `declare var Promise: PromiseConstructor;` line is missing from the global typings input or was not recognized as a VariableDeclarator/declaration role.","commonSituations":"Deleting or renaming the Promise value declaration while editing globals; a parser change stops classifying `declare var Promise` as a value-side declaration; roles were manually curated and Value was dropped.","solutions":["Restore the value-side declaration for Promise in the global typings source (e.g. `declare var Promise: PromiseConstructor;`).","Verify declaration-role extraction marks that record with GlobalDeclarationRole::Value.","Regenerate and re-run `cargo xtask codegen` to confirm the group passes both role checks."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Ensure the value-side declaration exists before lowering\nfn has_value_promise(group: &GlobalGroup) -> bool {\n  group.has_role(GlobalDeclarationRole::Value)\n    && group.declarations().iter().any(|r| matches!(r.kind, DeclarationKind::VariableDeclarator { .. }))\n}\nif !has_value_promise(&promise_group) { bail!(\"add `declare var Promise: PromiseConstructor;`\"); }","typeGuard":null,"tryCatchPattern":"match lower_promise_globals(&manifest, &mut globals, &source_cache) {\n  Err(e) if e.to_string().contains(\"value-side declaration\") => {\n    eprintln!(\"Restore `declare var Promise: PromiseConstructor;` and rerun `cargo xtask codegen`\");\n    std::process::exit(1);\n  }\n  r => r?,\n}","preventionTips":["Keep the canonical `declare var Promise: PromiseConstructor;` in the globals source.","Verify role extraction classifies `declare var` records as Value in unit tests.","Run codegen after any change to declaration-kind parsing.","Review global-typings diffs for removed value declarations."],"tags":["codegen","rust","build","typescript-globals"],"backgroundTag":"schema-validation-failed","analyzedSha":"3835945f0638c88162351318b7bc8b64c5f2fba7","analyzedAt":"2026-09-13T15:11:16.919Z","contentChangedAt":"2026-09-13T15:11:16.919Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}