Type-check helper method that checks the specified parameter for null or undefined and
throws an exception when the value is null or undefined or returns the specified value if it is not null.
Type Parameters
T
Parameters
value: T
Value ot check
error: string = 'Value cannot be undefined or null'
Optional error message to throw when the value is null
Type-check helper method that checks the specified parameter for null or undefined and throws an exception when the value is null or undefined or returns the specified value if it is not null.