@daiso-tech/core
Version:
The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.
69 lines (68 loc) • 2.72 kB
TypeScript
/**
* @module Collection
*/
import { type InferInstance } from "../../utilities/_module.js";
/**
* The error is thrown when the item is not found.
*
* IMPORT_PATH: `"@daiso-tech/core/collection/contracts"`
* @group Errors
*/
export declare class ItemNotFoundCollectionError extends Error {
static create(cause?: unknown): ItemNotFoundCollectionError;
/**
* Note: Do not instantiate `ItemNotFoundCollectionError` directly via the constructor. Use the static `create()` factory method instead.
* The constructor remains public only to maintain compatibility with errorPolicy types and prevent type errors.
* @internal
*/
constructor(message: string, cause?: unknown);
}
/**
* The error is thrown when multiple items are found.
*
* IMPORT_PATH: `"@daiso-tech/core/collection/contracts"`
* @group Errors
*/
export declare class MultipleItemsFoundCollectionError extends Error {
static create(cause?: unknown): MultipleItemsFoundCollectionError;
/**
* Note: Do not instantiate `MultipleItemsFoundCollectionError` directly via the constructor. Use the static `create()` factory method instead.
* The constructor remains public only to maintain compatibility with errorPolicy types and prevent type errors.
* @internal
*/
constructor(message: string, cause?: unknown);
}
/**
* The error is thrown when calling a method that needs the collection not to be empty. For example, the `average` method requires the collection not to be empty.
*
* IMPORT_PATH: `"@daiso-tech/core/collection/contracts"`
* @group Errors
*/
export declare class EmptyCollectionError extends Error {
static create(cause?: unknown): EmptyCollectionError;
/**
* Note: Do not instantiate `EmptyCollectionError` directly via the constructor. Use the static `create()` factory method instead.
* The constructor remains public only to maintain compatibility with errorPolicy types and prevent type errors.
* @internal
*/
constructor(message: string, cause?: unknown);
}
/**
* IMPORT_PATH: `"@daiso-tech/core/collection/contracts"`
* @group Errors
*/
export declare const COLLECTION_ERRORS: {
readonly ItemNotFound: typeof ItemNotFoundCollectionError;
readonly MultipleItemsFound: typeof MultipleItemsFoundCollectionError;
readonly Empty: typeof EmptyCollectionError;
};
/**
* IMPORT_PATH: `"@daiso-tech/core/collection/contracts"`
* @group Errors
*/
export type AllCollectionErrors = InferInstance<(typeof COLLECTION_ERRORS)[keyof typeof COLLECTION_ERRORS]>;
/**
* IMPORT_PATH: `"@daiso-tech/core/collection/contracts"`
* @group Errors
*/
export declare function isCollectionError(value: unknown): value is AllCollectionErrors;