@kellanjs/actioncraft
Version:
Fluent, type-safe builder for Next.js server actions.
17 lines (16 loc) • 813 B
TypeScript
import type { CraftedAction } from "./types/actions.js";
import type { BaseError } from "./types/errors.js";
import type { InferErrors } from "./types/inference.js";
/**
* Error wrapper that provides standard Error semantics while preserving
* the original ActionCraft error data in the cause property.
*/
export declare class ActionCraftError<TErrorData extends BaseError = BaseError> extends Error {
readonly cause: TErrorData;
constructor(errorData: TErrorData);
}
/**
* Type guard to check if an error is an ActionCraftError with the action's error types.
* The action parameter is used purely for type inference.
*/
export declare function isActionCraftError<TAction extends CraftedAction<any, any, any, any>>(error: unknown, _action: TAction): error is ActionCraftError<InferErrors<TAction>>;