• Returns the provided value if it's not null or undefined; otherwise, returns the default value.

    Type Parameters

    • T

      The type of the value and default value.

    Parameters

    • value: undefined | null | T

      The value to check.

    • defaultValue: NonNullable<T>

      The default value to return if the provided value is null or undefined.

    Returns NonNullable<T>

    The provided value if it's not null or undefined; otherwise, the default value.