type-plus
    Preparing search index...

    Type Alias Find<A, Criteria, Options>

    Find: TypePlusOptions.Merge<Options, TuplePlus.Find.DefaultOptions<Criteria>> extends infer O extends
        TuplePlus.Find.Options
        ? IsTuple<
            A,
            {
                $else: O["$array"];
                $then: A["length"] extends 0
                    ? O["$emptyTuple"]
                    : TuplePlus.Find.Device<A, Criteria, O>;
            },
        >
        : never

    🦴 utilities 🔢 customizable

    Find the first type in tuple A that matches Criteria.

    Type Parameters

    type R = TuplePlus.Find<[true, 1, 'x', 3], string> // 'x'
    type R = TuplePlus.Find<[true, 1, 'x', 3], number> // 1
    type R = TuplePlus.Find<[string, number, 1], 1> // widen: 1 | undefined
    type R = TuplePlus.Find<[true, number | string], string> // unionMiss: string | undefined

    type R = TuplePlus.Find<[true, 1, 'x'], 2> // never

    performs widen match. Default to true. With widen match, a narrowed type will match its widen type. e.g. matching 1 against number yields 1 | undefined

    The widen behavior can be customized by Options['$widen']

    return type when A is an array. Default to not supported message.

    return type when A is an empty tuple. Default to never.

    return type when A is never. Default to never.

    Return value when T does not match Criteria. Default to never.

    return type when T in A is a widen type of Criteria. Default to Criteria | undefined. Set it to never for a more type-centric behavior

    Return value when a branch of the union T does not match Criteria. Default to never.

    If you want the type to behave more like JavaScript, you can override it to return undefined.

    Since it is a union, the result will be joined to the matched branch as union.