Filters an array and removes null values, casting the resulting array to a specific generic type if specified.

  • Type Parameters

    • T = string

      The generic type of the array elements.

    Parameters

    • arr: (null | T)[]

      The input array containing values of type T or null.

    Returns T[]

    • The filtered array with null values removed.