biomejs/biome · error

Promise interface extends clauses are not supported

Error message

Promise interface extends clauses are not supported

What it means

validate_promise_interface requires the instance-side Promise interface to have no extends clause, since merged-inherited members would bypass the strict method validation. A Promise interface with a heritage clause aborts lowering with this error.

Source

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

                binding: LoweredFunctionParameterBinding::Pattern,
                type_reference: LoweredTypeReference::Predefined("GLOBAL_VOID_CALLBACK_ID"),
                is_optional: false,
                is_rest: false,
            }]),
            return_type: LoweredTypeReference::Predefined("GLOBAL_VOID_ID"),
        }),
    });
    for specification in PROMISE_METHOD_SPECIFICATIONS {
        globals.push(promise_method_global(specification));
    }

    Ok(())
}

/// Requires each merged Promise declaration to use one unconstrained type parameter.
fn validate_promise_interface(declaration: &TsInterfaceDeclaration) -> Result<()> {
    if declaration.extends_clause().is_some() {
        bail!("Promise interface extends clauses are not supported");
    }
    single_type_parameter_name(declaration.type_parameters(), "Promise interface")?;
    Ok(())
}

/// Checks selected methods while allowing overloads and unrelated declaration members.
fn validate_promise_methods(
    declaration: &TsInterfaceDeclaration,
    location: PromiseMemberLocation,
    saw_methods: &mut [bool; PROMISE_METHOD_COUNT],
) -> Result<()> {
    for member in declaration.members() {
        match member {
            AnyTsTypeMember::TsMethodSignatureTypeMember(method) => {
                validate_selected_promise_method(&method, location, saw_methods)?;
            }
            AnyTsTypeMember::TsPropertySignatureTypeMember(property) => {
                reject_selected_promise_non_method(property.name()?, location)?;

View on GitHub (pinned to 3835945f06)

Solutions

  1. Remove the extends clause and inline needed members into interface Promise<T>
  2. Add extends-clause support to the Promise interface validation path
  3. Pin lib sources to a version where Promise has no heritage clause

Example fix

// before
interface Promise<T> extends PromiseLike<T> { ... }
// after
interface Promise<T> { /* PromiseLike members inlined */ ... }
Defensive patterns

Strategy: validation

Validate before calling

if (promiseDecl.extendsClause) {
  throw new Error("interface Promise<T> must not extend anything; inline the inherited members");
}

Prevention

When it happens

Trigger: Running codegen when lib sources contain `interface Promise<T> extends SomeBase<T> { ... }`.

Common situations: Lib updates adding heritage to Promise; merged vendor declarations that extend Promise to add helpers.

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/ad5f15661d39a976. Report an issue: GitHub.