SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Interface BroadcastOptions

    Options used during broadcasting.

    interface BroadcastOptions {
        coerce?: CoerceParams;
        errorOnInvalidCoercion?: boolean;
        misalignValue?: Scalar;
        onError?: "value" | "throw" | "ignore" | ((error: Known) => void);
        otherType?: ScalarType;
        type?: ScalarType | null;
    }

    Hierarchy (View Summary)

    Index
    coerce?: CoerceParams

    Overrides default coercion behavior per type. When a value cannot be coerced, onError determines the fallback.

    errorOnInvalidCoercion?: boolean

    If true, coercion failure produces #VALUE! rather than silently skipping the value.

    false

    misalignValue?: Scalar

    Controls how misaligned ranges are handled during broadcasting.

    • By default, broadcast() follows strict alignment rules like NumPy and will throw an error if the input ranges cannot be broadcasted together.
    • When misalignValue is provided, broadcast() will instead mimic Excel behavior:
      • It finds the largest valid intersection of the ranges.
      • It expands the result to the union of both range sizes.
      • Any cells that do not have valid corresponding values from the inputs will be filled with misalignValue instead of causing an error.
    • zip(), mask() and choose() always pad and default it to #N/A; in zip() the pad is delivered to the callback as that operand's value rather than written as the result.
    // Throws an error if A and B are not naturally broadcast-compatible
    const result = A.broadcast(B, (a, b) => a + b);
    // Expands to union size and fills gaps with "#N/A" instead of erroring
    const result = A.broadcast(B, (a, b) => a + b, { misalignValue: "#N/A" });
    onError?: "value" | "throw" | "ignore" | ((error: Known) => void)

    What to do when the visited value is a FormulaError.

    throw

    'throw' = throw error. 'ignore' = silently skip the value. 'value' = return a specific error value (default #VALUE!). 'function' = custom handler; use this to return a specific error value.

    otherType?: ScalarType

    Coerces values from other to the specified type before applying the callback. Overrides the type inference that would otherwise be derived from other.

    type?: ScalarType | null

    Specifies the target type for coercion and filtering when getting or iterating values.

    The scalar type of the IRange itself (getType())

    • Values matching the type pass through unchanged.
    • Values coercible to the type are coerced.
    • If not set, the range's own scalar type (getType()) is used.
    • If the range has no scalar type, or set to null explicitly, no coercion or filtering is performed.