biomejs/biome · error

getter signatures are not supported in the Error global

Error message

getter signatures are not supported in the Error global

What it means

A build-time error from the same Error-global lowering code in xtask/codegen. The generator intentionally rejects TsGetterSignatureTypeMember members on the Error global because the generated Rust representation of Error's type members has no slot for accessor (getter) signatures. The declaration source must only contain plain properties and methods.

Source

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

                kind: LoweredMemberKind::Named { optional },
                type_reference,
            }))
        }
        AnyTsTypeMember::TsMethodSignatureTypeMember(_) => {
            bail!("method signatures are not supported in the Error global")
        }
        AnyTsTypeMember::TsCallSignatureTypeMember(_)
        | AnyTsTypeMember::TsConstructSignatureTypeMember(_) => {
            bail!("Error global signatures must be declared on ErrorConstructor")
        }
        AnyTsTypeMember::JsBogusMember(_) => {
            bail!("bogus members are not supported in the Error global")
        }
        AnyTsTypeMember::JsMetavariable(_) => {
            bail!("metavariable members are not supported in the Error global")
        }
        AnyTsTypeMember::TsGetterSignatureTypeMember(_) => {
            bail!("getter signatures are not supported in the Error global")
        }
        AnyTsTypeMember::TsIndexSignatureTypeMember(_) => {
            bail!("index signatures are not supported in the Error global")
        }
        AnyTsTypeMember::TsSetterSignatureTypeMember(_) => {
            bail!("setter signatures are not supported in the Error global")
        }
    }
}

/// Validates supported optional `Error` members.
fn lower_optional_error_member_reference(
    name: &Text,
    type_reference: LoweredTypeReference,
) -> Result<LoweredTypeReference> {
    match (name.text(), type_reference) {
        ("stack", LoweredTypeReference::Predefined("GLOBAL_STRING_ID")) => {
            Ok(LoweredTypeReference::Predefined("GLOBAL_STRING_ID"))

View on GitHub (pinned to 3835945f06)

Solutions

  1. Rewrite the getter in the source declaration as a plain readonly property (e.g. `get stack(): string` -> `readonly stack: string`).
  2. If accessors must be supported, extend the lowering code to map getter signatures onto property signatures with a readonly flag.

Example fix

// before
declare var Error: {
  get stackTraceLimit(): number;
}
// after
declare var Error: {
  readonly stackTraceLimit: number;
}
Defensive patterns

Strategy: validation

Validate before calling

// Check the Error declaration source for getter members before codegen
fn has_getter(source: &str) -> bool {
    source.lines().any(|l| {
        let t = l.trim();
        t.starts_with("get ") || t.starts_with("readonly get ")
    })
}

Type guard

fn is_lowerable_member(m: &AnyTsTypeMember) -> bool {
    !matches!(m, AnyTsTypeMember::TsGetterSignatureTypeMember(_))
}

Prevention

When it happens

Trigger: Running the global-types codegen when the Error global declaration contains a `get foo() { ... }` getter signature member.

Common situations: Updating the bundled TypeScript lib source for Error to a version that models a property as a getter (e.g. `get stack()`); porting members from a DOM or newer lib.es5 d.ts where accessors are used.

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