{"record":{"id":"d368b7c78fafb0f0","repo":"biomejs/biome","slug":"unsupported-value-side-promise-declaration","errorCode":null,"errorMessage":"unsupported value-side Promise declaration","messagePattern":"unsupported value-side Promise declaration","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/codegen/src/generate_global_types/lower.rs","lineNumber":831,"sourceCode":"    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\n            .find_interface_declaration(record)?\n            .with_context(|| {\n                format!(\n                    \"failed to find interface declaration {} at {:?}\",\n                    record.declared_name.text(),\n                    record.text_range\n                )\n            })?;\n        validate_promise_interface(&declaration)?;\n        validate_promise_methods(\n            &declaration,\n            PromiseMemberLocation::Instance,\n            &mut saw_methods,\n        )?;","sourceCodeStart":813,"sourceCodeEnd":849,"githubUrl":"https://github.com/biomejs/biome/blob/3835945f0638c88162351318b7bc8b64c5f2fba7/xtask/codegen/src/generate_global_types/lower.rs#L813-L849","documentation":"Inside the 'Promise' global group, only interface declarations and variable declarators are supported. A `declare function` or `import equals` record on the value side cannot be lowered into the generated Promise global, so the codegen stops with this error.","triggerScenarios":"Running `cargo xtask codegen` when a Promise-group record has DeclarationKind::DeclareFunction or DeclarationKind::ImportEquals — e.g. the typings define Promise via `declare function Promise(...)` or an `import Promise = ...` alias instead of `declare var`.","commonSituations":"Reimplementing the Promise global from a spec that uses function-style declarations; migrating declaration style while editing globals; an import-equals alias introduced during a refactor.","solutions":["Replace the `declare function`/`import equals` form with the canonical value-side form: `declare var Promise: PromiseConstructor;` (plus the Promise interface).","Remove any import-equals aliasing of Promise from the global declarations.","Regenerate and re-run `cargo xtask codegen`."],"exampleFix":"// before\ndeclare function Promise<T>(executor: ...): Promise<T>;\n// after\ndeclare var Promise: PromiseConstructor;","handlingStrategy":"validation","validationCode":"// Reject unsupported value-side kinds before lowering\nfn assert_supported_value_kinds(group: &GlobalGroup) -> Result<()> {\n  for r in group.declarations() {\n    ensure!(!matches!(r.kind, DeclarationKind::DeclareFunction | DeclarationKind::ImportEquals),\n      \"unsupported Promise declaration kind\");\n  }\n  Ok(())\n}","typeGuard":null,"tryCatchPattern":"match lower_promise_globals(&manifest, &mut globals, &source_cache) {\n  Err(e) if e.to_string().contains(\"unsupported value-side Promise declaration\") => {\n    eprintln!(\"Use `declare var Promise: PromiseConstructor;` instead of declare-function/import-equals: {e}\");\n    std::process::exit(1);\n  }\n  r => r?,\n}","preventionTips":["Always declare Promise's value side as a variable declarator referencing PromiseConstructor.","Avoid `declare function Promise(...)` and `import Promise = ...` forms in globals.","Document the allowed declaration kinds for the Promise group for contributors.","Run codegen locally before pushing globals changes."],"tags":["codegen","rust","build","typescript-globals"],"backgroundTag":"unsupported-operation","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"}