{"record":{"id":"c8eb1e53b153624a","repo":"biomejs/biome","slug":"type-aliases-are-not-supported-in-promiseconstructor","errorCode":null,"errorMessage":"type aliases are not supported in PromiseConstructor","messagePattern":"type aliases are not supported in PromiseConstructor","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/codegen/src/generate_global_types/lower.rs","lineNumber":868,"sourceCode":"    }\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\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        if declaration.extends_clause().is_some() {","sourceCodeStart":850,"sourceCodeEnd":886,"githubUrl":"https://github.com/biomejs/biome/blob/3835945f0638c88162351318b7bc8b64c5f2fba7/xtask/codegen/src/generate_global_types/lower.rs#L850-L886","documentation":"Biome's xtask codegen lowers TypeScript lib global declarations into Biome's internal global-types model. When processing the merged declarations of the PromiseConstructor global, a TypeAlias declaration is encountered among the declaration records, but the lowering code only supports interface-style declarations for this global, so it aborts with this error. This is a build-time invariant check protecting the hand-written Promise lowering logic from unexpected upstream lib declarations.","triggerScenarios":"Running the codegen (just gen-rules / generate_global_types) after updating the bundled TypeScript lib .d.ts files such that a `type PromiseConstructor = ...` type alias is now merged into the PromiseConstructor declaration group instead of an interface.","commonSituations":"A TypeScript lib version bump where lib.es2015.core.d.ts or similar changes PromiseConstructor from an interface to a type alias; a hand-edited or generated lib snapshot that models the constructor as a type alias.","solutions":["Revert or adjust the lib .d.ts change so PromiseConstructor is declared as an `interface PromiseConstructor` again","Update lower.rs to support lowering type aliases into the constructor group if the new lib shape is intentional","Pin/downgrade the TypeScript lib sources to a version where PromiseConstructor is an interface"],"exampleFix":"// before (lib .d.ts)\ntype PromiseConstructor = { new <T>(executor: ...): Promise<T> };\n// after\ninterface PromiseConstructor {\n  new <T>(executor: (resolve: ..., reject: ...) => void): Promise<T>;\n}","handlingStrategy":"validation","validationCode":"// Before regenerating, scan the PromiseConstructor declaration group\nconst kinds = group.declarations().map(d => d.kind);\nif (kinds.includes(\"TypeAlias\")) {\n  throw new Error(\"PromiseConstructor group contains a type alias; convert it to an interface in the lib sources\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep PromiseConstructor modeled as an interface in all bundled lib snapshots","Diff the Promise-related declarations after every lib version bump before running codegen","Add a snapshot test asserting the declaration kinds of the PromiseConstructor group"],"tags":["codegen","build-time","typescript-libs"],"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"}