{"record":{"id":"fe9a49bcdc305e52","repo":"biomejs/biome","slug":"promise-global-must-have-a-type-side-declaration","errorCode":null,"errorMessage":"Promise global must have a type-side declaration","messagePattern":"Promise global must have a type-side declaration","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/codegen/src/generate_global_types/lower.rs","lineNumber":814,"sourceCode":"        Box::new([LoweredTypeReference::Predefined(\"GLOBAL_U_ID\")]),\n        \"GLOBAL_MAP_CALLBACK_ID\",\n        \"GLOBAL_INSTANCEOF_ARRAY_U_ID\",\n    ));\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            }","sourceCodeStart":796,"sourceCodeEnd":832,"githubUrl":"https://github.com/biomejs/biome/blob/3835945f0638c88162351318b7bc8b64c5f2fba7/xtask/codegen/src/generate_global_types/lower.rs#L796-L832","documentation":"During Promise global lowering, Biome's xtask codegen requires the 'Promise' global declaration group to include a type-side declaration (the Promise interface itself). If the group exists but carries no Type role declaration, lowering cannot produce the Promise global type and fails with this message.","triggerScenarios":"Running `cargo xtask codegen` when the declaration manifest's 'Promise' group lacks any record with GlobalDeclarationRole::Type — e.g. the Promise interface was removed or its role tagging was lost when editing the global typings source.","commonSituations":"Refactoring how declaration roles are extracted from lib.global source files; accidentally deleting or moving the Promise interface declaration; mis-parsing that drops the type-side record from the group.","solutions":["Ensure the global typings source contains a type-side Promise declaration (the `interface Promise<T>` / `declare var Promise` type portion) and that role extraction tags it as Type.","Regenerate the declaration manifest and re-run `cargo xtask codegen`.","If the group is intentionally absent, note the early return only happens when the whole 'Promise' group is missing; a group must always include both roles."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check group roles before lowering\nfn require_roles(group: &GlobalGroup, name: &str) -> Result<()> {\n  ensure!(group.has_role(GlobalDeclarationRole::Type), \"{name} missing type-side declaration\");\n  ensure!(group.has_role(GlobalDeclarationRole::Value), \"{name} missing value-side declaration\");\n  Ok(())\n}","typeGuard":null,"tryCatchPattern":"match lower_promise_globals(&manifest, &mut globals, &source_cache) {\n  Err(e) if e.to_string().contains(\"type-side declaration\") => {\n    eprintln!(\"Restore `interface Promise<T>` in the Promise global group, then rerun codegen: {e}\");\n    std::process::exit(1);\n  }\n  r => r?,\n}","preventionTips":["Keep `interface Promise<T>` (type side) and `declare var Promise` (value side) together in the global typings.","Never remove role tags when touching declaration-role extraction code.","Add a manifest sanity test asserting both roles exist for key globals (Promise, PromiseConstructor).","Regenerate the manifest after any edits to declaration parsing."],"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"}