biomejs/biome · error

PromiseConstructor is missing a construct signature

Error message

PromiseConstructor is missing a construct signature

What it means

After scanning all merged declarations, the codegen requires the PromiseConstructor interface to contain at least one `new (...): Promise<...>` construct signature, tracked via saw_construct_signature. Its absence means the constructor cannot be synthesized, so lowering aborts.

Source

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

        }

        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 {
        bail!("PromiseConstructor is missing a construct signature");
    }
    for (index, specification) in PROMISE_METHOD_SPECIFICATIONS.iter().enumerate() {
        if !saw_methods[index] {
            bail!("Promise is missing {}", specification.global_name);
        }
    }

    let members = std::iter::once(LoweredTypeMember {
        name: Text::from("constructor"),
        kind: LoweredMemberKind::Constructor,
        type_reference: LoweredTypeReference::Predefined("GLOBAL_PROMISE_CONSTRUCTOR_ID"),
    })
    .chain(PROMISE_METHOD_SPECIFICATIONS.map(promise_member))
    .collect();
    globals.push(LoweredGlobal {
        name: Text::from("Promise"),
        id_constant: "PROMISE_ID_GLOBAL_TYPE_ID",
        data: LoweredTypeData::Class(LoweredClass {

View on GitHub (pinned to 3835945f06)

Solutions

  1. Add back a `new <T>(executor: (resolve, reject) => void): Promise<T>` construct signature to the interface
  2. Check that validate_promise_construct_signature accepts the signature's exact shape (it must not be filtered out as an overload with no body type)
  3. Re-generate the lib snapshot from the upstream TypeScript sources if it was hand-edited

Example fix

// before
interface PromiseConstructor { all(...): Promise<...>; }
// after
interface PromiseConstructor {
  new <T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
  all(...): Promise<...>;
}
Defensive patterns

Strategy: validation

Validate before calling

const hasCtor = promiseConstructorDecl.members.some(m => m.type === "ConstructSignature");
if (!hasCtor) throw new Error("interface PromiseConstructor needs a `new <T>(executor): Promise<T>` construct signature");

Prevention

When it happens

Trigger: Running codegen when `interface PromiseConstructor` lacks any `new` signature, e.g. the construct signature was removed, renamed, or written as a call signature instead.

Common situations: Lib snapshot edits that dropped `new <T>(executor: ...): Promise<T>`; replacing a construct signature with a plain callable signature by mistake.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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