Type alias $ResolveBranch<T, $O, $B, $D>

$ResolveBranch<T, $O, $B, $D>: [unknown, $D] extends [$D, unknown]
    ? $B extends [infer B]
        ? _Last<T, $O, B>
        : $B extends [infer B, ...(infer Bs extends ($Branch<any> | unknown)[])]
            ? $ResolveBranch._<$ResolveBranch<T, $O, Bs>, $O, B>
            : never
    : _Override<$D, $O, $B>

🧰 type util

Resolve option value based on list of branches. It returns the first branch value that is specified in the option, otherwise will return the default value.

Since this is an type utility, it does not perform extensive validations. Please check the description of each input below for information.

Type Parameters

  • T

  • $O extends Record<string, any>

  • $B extends ($Branch<any> | unknown)[]

  • $D = unknown

Typeparam

$O Should be a Record, not any, unknown, or never

Typeparam

$B Tuple of branches with at least one entry.

Typeparam

$D When specified, resolve the branch in override mode. If no branch in $B is resolved to $Override<X>, $D will be returned.

Generated using TypeDoc