Type Alias: SnappinResponse
SnappinResponse =
SnappinSuccess
|SnappinFailure
Overview
The SnappinResponse
type alias represents the result of an operation that can either be a successful outcome or a failure. This type union allows developers to handle different response scenarios appropriately within their applications.
Definition
Defined in: src/_other-scraper/snappin.ts:27
Union Type
- SnappinSuccess: Represents a successful operation response.
- SnappinFailure: Represents a failed operation response.
Usage
Developers should use the SnappinResponse
type to ensure that their handling logic can accommodate both success and failure cases, allowing for robust error handling and response management.
Example
function handleResponse(response: SnappinResponse): void {
if ('data' in response) {
console.log("Success:", response.data);
} else {
console.error("Error:", response.error);
}
}
This function checks the response type and logs the appropriate message based on whether the operation was successful or not.
Last updated on