Function ofType

  • Returns a Stream that yields elements that are of the specified type.

    Type Parameters

    • T

      Type of items in the source.

    • TOfType = T

      Type of items to yield.

    Parameters

    Returns OperationFunction<T, TOfType>

    Operation that yields elements that are of the specified type.

    const result = ofType<string, string>()(Number)(["a", 1, "b", 2]);
    console.log([...result]); // [1, 2]