Skip to main content

ErrorType

ErrorType = Error | string | number

Represents valid error types that can be used in error handling. This type is commonly used in functional programming patterns like Either, Result, and TaskEither.

Since

2.0.0


Example

function handleError(error: ErrorType): string {
if (typeof error === 'string') return error;
if (typeof error === 'number') return `Error ${error}`;
return error.message;
}