Let's say I want to have
const isNotNull = (object: any) => {
if (isNull && obj === null) {
throw new Error('object is null');
}
}
const obj: null | object = getObject();
isNotNull(obj);
// now I want to enforce that object is no longer null
How do I do this? Type guards work only if your function isNotNull returns something. I want to infer the type without having my function return anything.
I now want this someAssertion to do a type guard, but to be dynamic