This is to help guard against types that can be undefined since the
recommended eslint rules recommend against using `!` operator on values
like:
const obj: Obj | undefined = ...
obj!.value
Now we can use:
const obj: Obj | undefined = ...
const obj2: Obj = guard(isDefined, obj)
obj.value
The guard function will throw an error if obj parameter is undefined.