@swastikbhattacharyya/next-actions - v0.3.2
    Preparing search index...

    Type Alias ActionResult<SuccessPayload, ErrorMap>

    ActionResult:
        | (
            SuccessPayload extends void
                ? { message: string; success: true }
                : { message: string; payload: SuccessPayload; success: true }
        )
        | { message: string; success: false } & {
            [K in keyof ErrorMap]: { errorCode: K; errorPayload: ErrorMap[K] }
        }[keyof ErrorMap]

    Represents the result of an action.

    If the action was successful, it includes a message and an optional payload. If the action was unsuccessful, it includes a message, an error code and its corresponding payload as defined in ErrorMap.

    Type Parameters

    • SuccessPayload extends void | object

      The payload on success, or void.

    • ErrorMap extends void | object

      A map where each key is an error code, and the corresponding value is the payload associated with that specific error.