I create a type alias as follow
export type Nullable<T> = T | null | undefined;
I would like to have an extension method hasValue
to check whether or not the instance is null or undefined. I tried to use prototype as
Nullable.prototype.hasValue = function(): boolean => {
return Nullable<T>(this) === null || Nullable<T>(this) === undefined
}
However I get the following error.
'Nullable' only refers to a type, but is being used as a value here.
Can anyone please help? Thank you.