• Throws if the given value is undefined, otherwise returns it.

    Type Parameters

    • T

      The generic type of the value being tested.

    Parameters

    • value: undefined | T

      The value which could possibly be undefined.

    • name: string = "value"

      The (optional) name of the value, to include in the thrown error message.

    Returns T

    The value, once it has been confirmed it is not undefined.