{"record":{"id":"13b1ef19d9357731","repo":"biomejs/biome","slug":"type-aliases-are-not-supported-in-the-promise-global","errorCode":null,"errorMessage":"type aliases are not supported in the Promise global","messagePattern":"type aliases are not supported in the Promise global","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/codegen/src/generate_global_types/lower.rs","lineNumber":828,"sourceCode":"    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\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,","sourceCodeStart":810,"sourceCodeEnd":846,"githubUrl":"https://github.com/biomejs/biome/blob/3835945f0638c88162351318b7bc8b64c5f2fba7/xtask/codegen/src/generate_global_types/lower.rs#L810-L846","documentation":"The Promise global lowering pipeline only accepts interfaces and variable declarators inside the 'Promise' declaration group. A TypeScript type alias found there cannot be represented by the generated Promise global code, so lowering aborts with this message.","triggerScenarios":"Running `cargo xtask codegen` when a record in the Promise global group has DeclarationKind::TypeAlias — i.e. someone added `type Promise... = ...` inside the Promise global declaration section of the global typings input.","commonSituations":"Adding a convenience alias (e.g. `type PromiseLikeResult = ...`) in the Promise block; an upstream lib edit converts an interface into a type alias; refactoring declarations moves an alias into the Promise group.","solutions":["Remove the type alias from the Promise global group or convert it back into an interface declaration.","Move the alias to a location outside the Promise global group if it is needed elsewhere.","Regenerate the manifest and re-run `cargo xtask codegen`."],"exampleFix":"// before (inside Promise global declarations)\ntype PromiseResult<T> = T | undefined;\n// after\ninterface PromiseResult<T> { /* members */ }","handlingStrategy":"validation","validationCode":"// Reject aliases inside the Promise group before lowering\nfn assert_no_type_aliases(group: &GlobalGroup) -> Result<()> {\n  ensure!(!group.declarations().iter().any(|r| matches!(r.kind, DeclarationKind::TypeAlias)),\n    \"type aliases are not allowed in the Promise global\");\n  Ok(())\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = lower_promise_globals(&manifest, &mut globals, &source_cache) {\n  if e.to_string().contains(\"type aliases are not supported\") {\n    eprintln!(\"Convert the alias to an interface or move it out of the Promise group: {e}\");\n    std::process::exit(1);\n  }\n  return Err(e.into());\n}","preventionTips":["Never add `type X = ...` declarations inside the Promise global group.","Model new shape abstractions as interfaces, which lowering supports.","Add a fixture test covering allowed declaration kinds in the Promise group.","Review generated manifest contents when adding declarations."],"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-14T00:17:10.932Z"}