Unwraps an Optional, returning the contained value or undefined if
empty.
This function provides a safe way to extract values from Optionals without throwing exceptions. It has overloaded behavior based on the type:
Some<T>: Always returns T (guaranteed by type system)Optional<T>: Returns T | undefinedThe UnknownOptional type to unwrap.
The Optional to unwrap.
The contained value if Some, otherwise undefined.
Unwraps an
Optional, returning the contained value orundefinedif empty.This function provides a safe way to extract values from Optionals without throwing exceptions. It has overloaded behavior based on the type:
Some<T>: Always returnsT(guaranteed by type system)Optional<T>: ReturnsT | undefined