// SPDX-FileCopyrightText: 2024 LiveKit, Inc. // // SPDX-License-Identifier: Apache-2.0 type Primitives = null | undefined | string | number | bigint | boolean | symbol; export type Throws = | (T & {__throws?(error: E): void}) | Extract | (T extends void ? T : never); export type ExtractErrors = T extends Throws ? E : never; export type ExtractSuccess = T extends Throws ? S : T; export type CombineErrors> = T extends [infer First, ...infer Rest] ? ExtractErrors | CombineErrors : never; export type PropagatesErrors = Throws< ExtractSuccess, ExtractErrors | AdditionalErrors >;