biomejs/biome · error
type aliases are not supported in PromiseConstructor
Error message
type aliases are not supported in PromiseConstructor
What it means
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.
Source
Thrown at xtask/codegen/src/generate_global_types/lower.rs:868
}
if !saw_promise_interface {
bail!("Promise global must include an interface declaration");
}
let Some(constructor_group) = manifest.global_group("PromiseConstructor") else {
bail!("Promise global value side references missing PromiseConstructor group");
};
if !constructor_group.has_role(GlobalDeclarationRole::Type) {
bail!("PromiseConstructor must have a type-side declaration");
}
let mut saw_constructor_interface = false;
let mut saw_construct_signature = false;
for record in constructor_group.declarations() {
match &record.kind {
DeclarationKind::Interface => saw_constructor_interface = true,
DeclarationKind::TypeAlias => {
bail!("type aliases are not supported in PromiseConstructor")
}
DeclarationKind::DeclareFunction
| DeclarationKind::VariableDeclarator { .. }
| DeclarationKind::ImportEquals => {
bail!("value-side PromiseConstructor declarations are not supported")
}
}
let declaration = source_cache
.find_interface_declaration(record)?
.with_context(|| {
format!(
"failed to find interface declaration {} at {:?}",
record.declared_name.text(),
record.text_range
)
})?;
if declaration.extends_clause().is_some() {View on GitHub (pinned to 3835945f06)
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
Example fix
// before (lib .d.ts)
type PromiseConstructor = { new <T>(executor: ...): Promise<T> };
// after
interface PromiseConstructor {
new <T>(executor: (resolve: ..., reject: ...) => void): Promise<T>;
} Defensive patterns
Strategy: validation
Validate before calling
// Before regenerating, scan the PromiseConstructor declaration group
const kinds = group.declarations().map(d => d.kind);
if (kinds.includes("TypeAlias")) {
throw new Error("PromiseConstructor group contains a type alias; convert it to an interface in the lib sources");
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- value-side PromiseConstructor declarations are not supported
- PromiseConstructor extends clauses are not supported
- PromiseConstructor type parameters are not supported
- PromiseConstructor must include an interface declaration
- PromiseConstructor is missing a construct signature
AI-assisted analysis of biomejs/biome@3835945f06 (2026-09-13).
Data as JSON: /api/errors/c8eb1e53b153624a.
Report an issue: GitHub.