Type Alias: AnimeFinderResponse
AnimeFinderResponse =
AnimeFinderResult|AnimeFinderError
Defined in
src/anime-finder/anime-finder.ts:40
Overview
The AnimeFinderResponse type alias represents the structured response returned by the AnimeFinder API. It can either be a successful result containing information about the found anime or an error indicating the failure of the request.
Usage
When interacting with the AnimeFinder API, developers should utilize the AnimeFinderResponse type to handle the responses effectively, ensuring they can differentiate between successful results and errors.
Type Structure
This type alias includes two potential structures:
- AnimeFinderResult: Represents a successful response containing information about the anime found.
- AnimeFinderError: Represents an error response which provides details about the issue encountered during the API call.
Example
Hereβs how you might use the AnimeFinderResponse type in a TypeScript function:
import { AnimeFinderResponse } from './path/to/type-definitions';
function handleResponse(response: AnimeFinderResponse) {
if ('error' in response) {
console.error('Error:', response.error);
} else {
console.log('Anime Found:', response.title);
}
}Notes
- Ensure proper error handling when working with
AnimeFinderResponseto maintain robust application behavior. - Refer to the individual interfaces
AnimeFinderResultandAnimeFinderErrorfor detailed structure definitions.
Last updated on