{"record":{"id":"3974f4e446d4978e","repo":"biomejs/biome","slug":"promiseconstructor-must-have-a-type-side-declaration","errorCode":null,"errorMessage":"PromiseConstructor must have a type-side declaration","messagePattern":"PromiseConstructor must have a type-side declaration","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/codegen/src/generate_global_types/lower.rs","lineNumber":859,"sourceCode":"                    record.text_range\n                )\n            })?;\n        validate_promise_interface(&declaration)?;\n        validate_promise_methods(\n            &declaration,\n            PromiseMemberLocation::Instance,\n            &mut saw_methods,\n        )?;\n    }\n    if !saw_promise_interface {\n        bail!(\"Promise global must include an interface declaration\");\n    }\n\n    let Some(constructor_group) = manifest.global_group(\"PromiseConstructor\") else {\n        bail!(\"Promise global value side references missing PromiseConstructor group\");\n    };\n    if !constructor_group.has_role(GlobalDeclarationRole::Type) {\n        bail!(\"PromiseConstructor must have a type-side declaration\");\n    }\n\n    let mut saw_constructor_interface = false;\n    let mut saw_construct_signature = false;\n    for record in constructor_group.declarations() {\n        match &record.kind {\n            DeclarationKind::Interface => saw_constructor_interface = true,\n            DeclarationKind::TypeAlias => {\n                bail!(\"type aliases are not supported in PromiseConstructor\")\n            }\n            DeclarationKind::DeclareFunction\n            | DeclarationKind::VariableDeclarator { .. }\n            | DeclarationKind::ImportEquals => {\n                bail!(\"value-side PromiseConstructor declarations are not supported\")\n            }\n        }\n\n        let declaration = source_cache","sourceCodeStart":841,"sourceCodeEnd":877,"githubUrl":"https://github.com/biomejs/biome/blob/3835945f0638c88162351318b7bc8b64c5f2fba7/xtask/codegen/src/generate_global_types/lower.rs#L841-L877","documentation":"The 'PromiseConstructor' group must contain a type-side declaration (the PromiseConstructor interface) because the Promise value references it as a type. If the group exists but carries no GlobalDeclarationRole::Type record, lowering cannot generate the constructor type and bails with this error.","triggerScenarios":"Running `cargo xtask codegen` when the PromiseConstructor group's records include only value-side entries (or none classified as Type) — e.g. the `interface PromiseConstructor` was deleted or its type role was lost during role extraction.","commonSituations":"Editing PromiseConstructor declarations and dropping the interface; a role-classification regression marks all records as value-side; splitting the constructor into separate files so the type-side record is no longer grouped.","solutions":["Restore `interface PromiseConstructor` (including its `new (...): Promise<any>` construct signature) in the PromiseConstructor global group.","Verify role extraction tags that interface as GlobalDeclarationRole::Type within the group.","Regenerate and re-run `cargo xtask codegen`."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Ensure the PromiseConstructor group has a type-side record\nfn has_type_role(group: &GlobalGroup) -> bool {\n  group.has_role(GlobalDeclarationRole::Type)\n}\nif !has_type_role(constructor_group) { bail!(\"PromiseConstructor lacks interface (Type role)\"); }","typeGuard":null,"tryCatchPattern":"if let Err(e) = lower_promise_globals(&manifest, &mut globals, &source_cache) {\n  if e.to_string().contains(\"PromiseConstructor must have a type-side declaration\") {\n    eprintln!(\"Restore `interface PromiseConstructor` and rerun `cargo xtask codegen`\");\n    std::process::exit(1);\n  }\n  return Err(e.into());\n}","preventionTips":["Keep `interface PromiseConstructor` (with its construct signature) intact when editing constructor declarations.","Verify role extraction marks the interface as Type in the PromiseConstructor group.","Add a role-completeness unit test for the PromiseConstructor group.","Run codegen locally before committing globals changes."],"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-14T00:17:10.932Z"}