The value to check
Type predicate indicating if the value is a valid AVAILABILITY enum value
// Valid availability values
if (isAvailability('IN_STOCK')) {
console.log('Product is in stock');
}
if (isAvailability('OUT_OF_STOCK')) {
console.log('Product is out of stock');
}
// Invalid availability values
if (!isAvailability('available')) {
console.log('Invalid availability status');
}
if (!isAvailability(123)) {
console.log('Availability must be a string');
}
Type guard to validate if a value is a valid availability status. Checks if the value is a string that matches one of the predefined AVAILABILITY enum values.