Represents a successful result containing a value. This class indicates that an operation completed successfully.
The type of the success value
The type of the error object (for type compatibility)
Creates a new Ok result.
Optional
The success value to store
Protected
The value to store (either success value or error)
Chains operations on this successful result. Applies the provided function to the contained value.
The type of the new success value
Function to apply to the success value
The result of applying the function
Safely extracts the contained success value.
The contained success value
Type guard indicating this is not an Err result.
Always false for Ok instances
Type guard indicating this is an Ok result.
Always true for Ok instances
Pattern matching implementation for Result types.
The type of the return value from the Ok function
The type of the new error object
Object containing pattern matching functions
Function to execute if this result is Err
Function to execute if this result is Ok
A new Result containing the result of the pattern matching
If the result is neither Ok nor Err
Gets the name of this result class.
The constructor name ('Ok' or 'Err')
Returns this Ok result unchanged since it's already successful. The alternative function is not called.
The type of the alternative success value
Alternative function (not called for Ok results)
This Ok result cast to the new type
Always returns true for Ok results.
Always true
Use isOk() instead
Safely returns the contained value.
Returns the contained value since this is a successful result. The compensation function is not called.
Compensation function (not called for Ok results)
Represents a successful result containing a value. This class indicates that an operation completed successfully.