Type Alias: SnackVideoResult
SnackVideoResult =
SnackVideoSuccess
|SnackVideoFailure
Defined in: src/_other-scraper/snackVideoDL.ts:24
Overview
The SnackVideoResult
type alias serves as a unified representation of the possible outcomes when fetching data from the Snack Video API. It can be either a successful result, represented by SnackVideoSuccess
, or a failure result, represented by SnackVideoFailure
.
Usage
This type alias is primarily used to handle the result from API calls, enabling developers to easily check the status of the response and handle each case accordingly.
Parameters
The SnackVideoResult
type does not take any parameters as it is a type alias that combines two existing interfaces.
Returns
Depending on the context in which it is utilized, the return type will either conform to SnackVideoSuccess
or SnackVideoFailure
.
Example
Here is an example of how to use the SnackVideoResult
type in a function that processes the result of an API call:
function handleSnackVideoResult(result: SnackVideoResult): void {
if ('success' in result) {
console.log('Video fetched successfully:', result.data);
} else {
console.error('Error fetching video:', result.error);
}
}