biomejs/biome · error

PromiseConstructor type parameters are not supported

Error message

PromiseConstructor type parameters are not supported

What it means

PromiseConstructor must be declared with no generic type parameters; the lowering hardcodes the single `<T>` used by the synthesized constructor. A declaration like `interface PromiseConstructor<T>` violates this assumption and triggers this error.

Source

Thrown at xtask/codegen/src/generate_global_types/lower.rs:890

            | 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() {
            bail!("PromiseConstructor extends clauses are not supported");
        }
        if declaration.type_parameters().is_some() {
            bail!("PromiseConstructor type parameters are not supported");
        }

        validate_promise_methods(
            &declaration,
            PromiseMemberLocation::Static,
            &mut saw_methods,
        )?;
        for member in declaration.members() {
            if let AnyTsTypeMember::TsConstructSignatureTypeMember(member) = member {
                validate_promise_construct_signature(&member)?;
                saw_construct_signature = true;
            }
        }
    }
    if !saw_constructor_interface {
        bail!("PromiseConstructor must include an interface declaration");
    }
    if !saw_construct_signature {

View on GitHub (pinned to 3835945f06)

Solutions

  1. Remove the type parameter list from interface PromiseConstructor in the lib sources
  2. Extend single_type_parameter handling to the constructor path if parameterization is intended
  3. Pin lib sources to a version without type parameters on PromiseConstructor

Example fix

// before
interface PromiseConstructor<T = any> { new <R>(...): Promise<R>; }
// after
interface PromiseConstructor { new <R>(...): Promise<R>; }
Defensive patterns

Strategy: validation

Validate before calling

if (promiseConstructorDecl.typeParameters?.length) {
  throw new Error("interface PromiseConstructor must not declare type parameters");
}

Prevention

When it happens

Trigger: Running codegen when the merged PromiseConstructor interface declares its own type parameters (e.g. `interface PromiseConstructor<T = any>`).

Common situations: Lib snapshots rewritten to parameterize the constructor interface; automated refactors of the bundled .d.ts files.

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


AI-assisted analysis of biomejs/biome@3835945f06 (2026-09-13). Data as JSON: /api/errors/748d527187cc896a. Report an issue: GitHub.