• Returns the only element of a sequence that satisfies a specified condition, and throws an exception if more than one such element exists.

    Type Parameters

    • TSource

    Parameters

    • src: Iterable<TSource>

      An Iterable to return a single element from.

    • Optionalpredicate: (item: TSource, index: number) => boolean

      A function to test an element for a condition.

    Returns TSource

    The single element of the input sequence that satisfies a condition.

    TSource The type of the elements of source.