Chartbreaker
    Preparing search index...

    Type Alias Result<Data, ErrData>

    Result:
        | Data & { err?: never }
        | ErrData & { [K in Exclude<keyof Data, keyof ErrData>]?: never }

    Generic discriminated union for a successful result or an error.

    Type Parameters

    • Data extends object

      — The shape of the success payload. When there is no err property, the result will have exactly these properties.

    • ErrData extends { err: ChartbreakerError } = { err: ChartbreakerError }

      — The shape of the error payload. Must include an err: ChartbreakerError property. When err is present, the result will have exactly these properties, and any keys in Data that aren’t in ErrData are disallowed.